Merge "Add jMY to Arab date formats ($datePreferences)"
[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 <President></President>
1996 !! html
1997 <p>Barack Obama &lt;President&gt; of the United States
1998 &lt;President&gt;&lt;/President&gt;
1999 </p>
2000 !! end
2001
2002 ## PHP parser discards the "<pre " string
2003 !! test
2004 Handle broken pre-like tags (bug 64025)
2005 !! options
2006 parsoid=wt2html
2007 !! wikitext
2008 {{echo|<pre <pre>x</pre>}}
2009
2010 <table><pre </table>
2011 !! html/php
2012 <pre>x</pre>
2013 <table><pre></pre></table>
2014
2015 !! html/parsoid
2016 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>&lt;pre </span>
2017 <pre>x</pre>
2018
2019 <span>&lt;pre </span>
2020 <table></table>
2021 !! end
2022
2023 !! test
2024 Parsoid: handle pre with space after attribute
2025 !! options
2026 parsoid=wt2html
2027 !! wikitext
2028 <pre style="width:50%;" >{{echo|foo}}</pre>
2029 !! html
2030 <pre style="width:50%;">{{echo|foo}}</pre>
2031 !! end
2032
2033 # TODO / maybe: fix wt2wt for this
2034 !! test
2035 Parsoid: Don't paragraph-wrap fosterable content
2036 !! options
2037 parsoid=wt2html
2038 !! wikitext
2039 {|
2040 <td></td>
2041 <td></td>
2042
2043
2044
2045 |}
2046 !! html
2047 <table>
2048
2049 <tbody>
2050 <tr>
2051 <td></td>
2052
2053 <td></td></tr>
2054
2055
2056
2057 </tbody></table>
2058 !! end
2059
2060 !! test
2061 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2062 !! options
2063 parsoid=wt2html
2064 !! wikitext
2065 {|
2066 <td>
2067 <td>
2068 </td>
2069
2070
2071
2072 |}
2073 !! html
2074 <table>
2075
2076 <tbody>
2077 <tr>
2078 <td></td>
2079
2080 <td>
2081 </td></tr>
2082
2083
2084
2085 </tbody></table>
2086 !! end
2087
2088
2089 #--------------------------------------------------------------------
2090 # Transclusion parameter whitespace stripping tests
2091 # Behavior is different for positional and named parameters
2092 #--------------------------------------------------------------------
2093 !! test
2094 Templates: Strip leading and trailing whitespace from named-param values
2095 !! wikitext
2096 {{echo|1= a }}
2097
2098 {{echo|1= {{echo|b}} }}
2099
2100 {{echo| 1 =
2101 c }}
2102
2103 {{echo| 1 =
2104 * d
2105 }}
2106 !! html
2107 <p>a
2108 </p><p>b
2109 </p><p>c
2110 </p>
2111 <ul>
2112 <li> d
2113 </li>
2114 </ul>
2115
2116 !! end
2117
2118 !! test
2119 Templates: Don't strip whitespace from positional-param values
2120 !! wikitext
2121 {{echo|a }}
2122
2123 {{echo|{{echo|b}} }}
2124
2125 {{echo| c
2126 }}
2127
2128 {{echo| {{echo|d}}
2129 }}
2130
2131 {{echo|
2132 e}}
2133
2134 {{echo|
2135 * f}}
2136
2137 {{echo|
2138 }}g
2139 !! html
2140 <p>a
2141 </p><p>b
2142 </p>
2143 <pre>c
2144 </pre>
2145 <p><br />
2146 </p>
2147 <pre>d
2148 </pre>
2149 <p><br />
2150 </p>
2151 <pre>e
2152 </pre>
2153 <p><br />
2154 </p>
2155 <ul>
2156 <li> f
2157 </li>
2158 </ul>
2159 <p><br />
2160 </p>
2161 <pre>g
2162 </pre>
2163 !! end
2164
2165 !! test
2166 Templates: Handle empty comment-and-ws-only lines correctly
2167 !! wikitext
2168 {{echo|foo
2169 <!--should be ignored-->
2170 <!--should be ignored as well-->
2171 bar}}
2172 !! html
2173 <p>foo
2174 bar
2175 </p>
2176 !! end
2177
2178 !! test
2179 Templates: Handle comments in the target
2180 !! wikitext
2181 {{echo
2182 <!-- should be ignored -->
2183 |foo}}
2184
2185 {{echo<!-- should be ignored -->
2186 |foo}}
2187
2188 {{echo<!-- should be ignored -->|foo}}
2189
2190 {{<!-- should be ignored -->echo|foo}}
2191 !!html/parsoid
2192 <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>
2193
2194 <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>
2195
2196 <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>
2197
2198 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2199 !!end
2200
2201 #--------------------------------------------------------------------
2202 # Transclusion parameter escaping tests
2203 #--------------------------------------------------------------------
2204 !! test
2205 Templates: Parsoid parameter escaping test 1
2206 !! options
2207 parsoid
2208 !! wikitext
2209 {{echo|[foo]|{{echo|[bar]}}}}
2210 !! html
2211 <p about="#mwt1" typeof="mw:Transclusion"
2212 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2213 !! end
2214
2215 !! test
2216 Parsoid: Pipes in external links in template parameter
2217 !! options
2218 parsoid
2219 !! wikitext
2220 {{echo|[{{echo|http://example.com}} link]}}
2221 !! html
2222 <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>
2223 !! end
2224
2225 !! test
2226 Parsoid: pipe in transclusion parameter
2227 !! options
2228 parsoid
2229 !! wikitext
2230 {{echo|http://foo.com/a&#124;b}}
2231 !! html
2232 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2233 typeof="mw:Transclusion"
2234 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>
2235 !! end
2236
2237 !! test
2238 Parsoid: Pipe in external link target and content in template parameter
2239 !! options
2240 parsoid=html2wt,wt2wt
2241 !! wikitext
2242 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2243 !! html
2244 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2245 typeof="mw:Transclusion"
2246 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2247 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2248 !! end
2249
2250 !! test
2251 Templates: Don't escape already nowiki-escaped text in template parameters
2252 !! options
2253 parsoid=html2wt,wt2wt
2254 !! wikitext
2255 {{echo|foo<nowiki>|</nowiki>bar}}
2256 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2257 {{echo|<nowiki></nowiki>}}
2258 !! html
2259 <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>
2260 <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>
2261 <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>
2262 </p>
2263 !! end
2264
2265 ## Bug 52824
2266 !! test
2267 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2268 !! options
2269 parsoid=html2wt,wt2wt
2270 !! wikitext
2271 {{echo|{{echo|1=bar}}}}
2272 !! html
2273 <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>
2274 !! end
2275
2276 ## Bug 56733
2277 !! test
2278 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2279 !! options
2280 parsoid
2281 !! wikitext
2282 {{echo|a : b}}
2283 !! html
2284 <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>
2285 !! end
2286
2287 ###
2288 ### Parsoid-centric tests for testing RT edge cases for pre
2289 ###
2290
2291 !!test
2292 1a. Indent-Pre and Comments
2293 !! wikitext
2294 a
2295 <!--a-->
2296 c
2297 !! html
2298 <pre>a
2299 </pre>
2300 <p>c
2301 </p>
2302 !!end
2303
2304 !!test
2305 1b. Indent-Pre and Comments
2306 !! wikitext
2307 a
2308 <!--a-->
2309 c
2310 !! html
2311 <pre>a
2312 </pre>
2313 <p>c
2314 </p>
2315 !!end
2316
2317 !!test
2318 1c. Indent-Pre and Comments
2319 !! wikitext
2320 <!--a--> a
2321
2322 <!--a--> a
2323 !! html
2324 <pre> a
2325 </pre>
2326 <pre> a
2327 </pre>
2328 !!end
2329
2330 !!test
2331 1d. Indent-Pre and Comments
2332 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2333 !! wikitext
2334 <!--a--> a
2335
2336 <!--b-->b
2337 !! html
2338 <pre>a
2339 </pre>
2340 <pre>b
2341 </pre>
2342 !!end
2343
2344 !!test
2345 2a. Indent-Pre and tables
2346 !! wikitext
2347 {|
2348 |-
2349 !h1!!h2
2350 |foo||bar
2351 |}
2352 !! html
2353 <table>
2354
2355 <tr>
2356 <th>h1</th>
2357 <th>h2
2358 </th>
2359 <td>foo</td>
2360 <td>bar
2361 </td></tr></table>
2362
2363 !!end
2364
2365 !!test
2366 2b. Indent-Pre and tables
2367 !! wikitext
2368 {|
2369 |-
2370 |foo
2371 |}
2372 !! html
2373 <table>
2374
2375 <tr>
2376 <td>foo
2377 </td></tr></table>
2378
2379 !!end
2380
2381 !!test
2382 2c. Indent-Pre and tables (bug 42252)
2383 !! wikitext
2384 {|
2385 |+ foo
2386 ! | bar
2387 |}
2388 !! html
2389 <table>
2390 <caption> foo
2391 </caption>
2392 <tr>
2393 <th> bar
2394 </th></tr></table>
2395
2396 !!end
2397
2398 !!test
2399 3a. Indent-Pre and block tags (single-line html)
2400 !! wikitext
2401 a <p> foo </p>
2402 b <div> foo </div>
2403 c <blockquote> foo </blockquote>
2404 <span> foo </span>
2405 !! html
2406 a <p> foo </p>
2407 b <div> foo </div>
2408 c <blockquote> foo </blockquote>
2409 <pre><span> foo </span>
2410 </pre>
2411 !!end
2412
2413 !!test
2414 3b. Indent-Pre and block tags (multi-line html)
2415 !! wikitext
2416 a <span>foo</span>
2417 b <div> foo </div>
2418 !! html
2419 <pre>a <span>foo</span>
2420 </pre>
2421 b <div> foo </div>
2422
2423 !!end
2424
2425 !!test
2426 3c. Indent-Pre and block tags (pre-content on separate line)
2427 !! wikitext
2428 <p>
2429 foo
2430 </p>
2431
2432 <div>
2433 foo
2434 </div>
2435
2436 <center>
2437 foo
2438 </center>
2439
2440 <blockquote>
2441 foo
2442 </blockquote>
2443
2444 <blockquote>
2445 <pre>
2446 foo
2447 </pre>
2448 </blockquote>
2449
2450 <table><tr><td>
2451 foo
2452 </td></tr></table>
2453
2454 <ul><li>
2455 foo
2456 </li></ul>
2457
2458 !! html
2459 <p>
2460 foo
2461 </p>
2462 <div>
2463 <pre>foo
2464 </pre>
2465 </div>
2466 <center>
2467 <pre>foo
2468 </pre>
2469 </center>
2470 <blockquote>
2471 <p> foo
2472 </p>
2473 </blockquote>
2474 <blockquote>
2475 <pre>
2476 foo
2477 </pre>
2478 </blockquote>
2479 <table><tr><td>
2480 <pre>foo
2481 </pre>
2482 </td></tr></table>
2483 <ul><li>
2484 foo
2485 </li></ul>
2486
2487 !!end
2488
2489 !!test
2490 4. Indent-Pre and extension tags
2491 !! wikitext
2492 a <gallery>
2493 File:foobar.jpg
2494 </gallery>
2495 !! html
2496 a <ul class="gallery mw-gallery-traditional">
2497 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2498 <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>
2499 <div class="gallerytext">
2500 </div>
2501 </div></li>
2502 </ul>
2503
2504 !!end
2505
2506 !! test
2507 Leading pipes outside of tables
2508 !! options
2509 parsoid
2510 !! wikitext
2511 | foo
2512 !! html
2513 <p>| foo</p>
2514 !! end
2515
2516 !! test
2517 Leading pipes outside of tables 2
2518 !! options
2519 parsoid
2520 !! wikitext
2521 a
2522 | foo
2523 b
2524 !! html
2525 <p>a
2526 | foo
2527 b</p>
2528 !! end
2529
2530 !! test
2531 Leading pipes outside of tables 3
2532 !! options
2533 parsoid
2534 !! wikitext
2535 a
2536 | class="foo bar" | baz
2537 b
2538 !! html
2539 <p>a
2540 | class="foo bar" | baz
2541 b</p>
2542 !! end
2543
2544 !!test
2545 Render paragraphs when indent-pre is suppressed in blocklevels
2546 !! wikitext
2547 <blockquote>
2548 foo
2549
2550 bar
2551 </blockquote>
2552 !! html
2553 <blockquote>
2554 <p> foo
2555 </p><p> bar
2556 </p>
2557 </blockquote>
2558
2559 !!end
2560
2561 !!test
2562 4. Multiple spaces at start-of-line
2563 !! wikitext
2564 <p> foo </p>
2565 foo
2566 {|
2567 |foo
2568 |}
2569 !! html
2570 <p> foo </p>
2571 <pre> foo
2572 </pre>
2573 <table>
2574 <tr>
2575 <td>foo
2576 </td></tr></table>
2577
2578 !!end
2579
2580 ## NOTE: the leading white-space chars on empty line are significant
2581 !! test
2582 5a. White-space in indent-pre
2583 !! wikitext
2584 a<br />
2585
2586 b
2587 !! html
2588 <pre>a<br />
2589
2590 b
2591 </pre>
2592 !! end
2593
2594 ## NOTE: the leading white-space chars on empty line are significant
2595 !! test
2596 5b. White-space in indent-pre
2597 !! wikitext
2598 a
2599
2600 b
2601
2602
2603 c
2604 !! html
2605 <pre>a
2606
2607 b
2608
2609
2610 c
2611 </pre>
2612 !! end
2613
2614 !! test
2615 5c. White-space in indent-pre
2616 !! wikitext
2617 ''a''
2618 ''b''
2619 ''c''
2620 !! html
2621 <pre><i>a</i>
2622 <i>b</i>
2623 <i>c</i>
2624 </pre>
2625 !! end
2626
2627 !! test
2628 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2629 !! wikitext
2630 a
2631
2632 <!-- continue -->
2633 b
2634
2635 c
2636
2637 d
2638 !! html
2639 <pre>a
2640
2641 b
2642 </pre>
2643 <pre>c
2644
2645 </pre>
2646 <p>d
2647 </p>
2648 !! end
2649
2650 !! test
2651 7a. Indent-pre and category links
2652 !! options
2653 parsoid=wt2html,wt2wt
2654 !! wikitext
2655 [[Category:foo]] <!-- No pre-wrapping -->
2656 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2657 !! html
2658 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2659 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2660 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2661 !! end
2662
2663 !! test
2664 7b. Indent-pre and category links
2665 !! options
2666 parsoid=wt2html,wt2wt
2667 !! wikitext
2668 [[Category:foo]] a
2669 [[Category:foo]] {{echo|b}}
2670 !! html
2671 <pre>
2672 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2673
2674 <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>
2675 !! end
2676
2677 ###
2678 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2679 ###
2680
2681 !!test
2682 HTML-pre: 1. embedded newlines
2683 !! wikitext
2684 <pre>foo</pre>
2685
2686 <pre>
2687 foo
2688 </pre>
2689
2690 <pre>
2691
2692 foo
2693 </pre>
2694
2695 <pre>
2696
2697
2698 foo
2699 </pre>
2700 !! html
2701 <pre>foo</pre>
2702 <pre>
2703 foo
2704 </pre>
2705 <pre>
2706
2707 foo
2708 </pre>
2709 <pre>
2710
2711
2712 foo
2713 </pre>
2714
2715 !! html/parsoid
2716 <pre data-parsoid='{"stx":"html"}'>foo</pre>
2717
2718 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
2719 foo
2720 </pre>
2721
2722 <pre data-parsoid='{"stx":"html"}'>
2723
2724 foo
2725 </pre>
2726
2727 <pre data-parsoid='{"stx":"html"}'>
2728
2729
2730 foo
2731 </pre>
2732 !!end
2733
2734 !! test
2735 HTML-pre: big spaces
2736 !! wikitext
2737 <pre>
2738
2739
2740
2741
2742 haha
2743
2744
2745
2746
2747 haha
2748
2749
2750
2751
2752 </pre>
2753 !! html
2754 <pre>
2755
2756
2757
2758
2759 haha
2760
2761
2762
2763
2764 haha
2765
2766
2767
2768
2769 </pre>
2770
2771 !! html/parsoid
2772 <pre data-parsoid='{"stx":"html"}'>
2773
2774
2775
2776
2777 haha
2778
2779
2780
2781
2782 haha
2783
2784
2785
2786
2787 </pre>
2788 !! end
2789
2790 !!test
2791 HTML-pre: 2: indented text
2792 !! wikitext
2793 <pre>
2794 foo
2795 </pre>
2796 !! html
2797 <pre>
2798 foo
2799 </pre>
2800
2801 !!end
2802
2803 !!test
2804 HTML-pre: 3: other wikitext
2805 !! wikitext
2806 <pre>
2807 * foo
2808 # bar
2809 = no-h =
2810 '' no-italic ''
2811 [[ NoLink ]]
2812 </pre>
2813 !! html
2814 <pre>
2815 * foo
2816 # bar
2817 = no-h =
2818 '' no-italic ''
2819 [[ NoLink ]]
2820 </pre>
2821
2822 !!end
2823
2824 ###
2825 ### Definition lists
2826 ###
2827 !! test
2828 Simple definition
2829 !! wikitext
2830 ; name : Definition
2831 !! html
2832 <dl>
2833 <dt> name&#160;</dt>
2834 <dd> Definition
2835 </dd>
2836 </dl>
2837
2838 !! end
2839
2840 !! test
2841 Definition list for indentation only
2842 !! wikitext
2843 : Indented text
2844 !! html
2845 <dl>
2846 <dd> Indented text
2847 </dd>
2848 </dl>
2849
2850 !! end
2851
2852 !! test
2853 Definition list with no space
2854 !! wikitext
2855 ;name:Definition
2856 !! html
2857 <dl>
2858 <dt>name</dt>
2859 <dd>Definition
2860 </dd>
2861 </dl>
2862
2863 !!end
2864
2865 !! test
2866 Definition list with URL link
2867 !! wikitext
2868 ; http://example.com/ : definition
2869 !! html
2870 <dl>
2871 <dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2872 <dd> definition
2873 </dd>
2874 </dl>
2875
2876 !! end
2877
2878 !! test
2879 Definition list with bracketed URL link
2880 !! wikitext
2881 ;[http://www.example.com/ Example]:Something about it
2882 !! html
2883 <dl>
2884 <dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2885 <dd>Something about it
2886 </dd>
2887 </dl>
2888
2889 !! end
2890
2891 !! test
2892 Definition list with wikilink containing colon
2893 !! wikitext
2894 ; [[Help:FAQ]]: The least-read page on Wikipedia
2895 !! html
2896 <dl>
2897 <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>
2898 <dd> The least-read page on Wikipedia
2899 </dd>
2900 </dl>
2901
2902 !! end
2903
2904 # At Brion's and JeLuF's insistence... :)
2905 !! test
2906 Definition list with news link containing colon
2907 !! wikitext
2908 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2909 !! html
2910 <dl>
2911 <dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2912 <dd> This isn't even a real newsgroup!
2913 </dd>
2914 </dl>
2915
2916 !! end
2917
2918 !! test
2919 Malformed definition list with colon
2920 !! wikitext
2921 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2922 !! html
2923 <dl>
2924 <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
2925 </dt>
2926 </dl>
2927
2928 !! end
2929
2930 !! test
2931 Definition lists: colon in external link text
2932 !! wikitext
2933 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2934 !! html
2935 <dl>
2936 <dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
2937 <dd> OK, I made that up
2938 </dd>
2939 </dl>
2940
2941 !! end
2942
2943 !! test
2944 Definition lists: colon in HTML attribute
2945 !! wikitext
2946 ;<b style="display: inline">bold</b>
2947 !! html
2948 <dl>
2949 <dt><b style="display: inline">bold</b>
2950 </dt>
2951 </dl>
2952
2953 !! end
2954
2955 !! test
2956 Definition lists: self-closed tag
2957 !! wikitext
2958 ;one<br/>two : two-line fun
2959 !! html
2960 <dl>
2961 <dt>one<br />two&#160;</dt>
2962 <dd> two-line fun
2963 </dd>
2964 </dl>
2965
2966 !! end
2967
2968 !! test
2969 Bug 11748: Literal closing tags
2970 !! wikitext
2971 <dl>
2972 <dt>test 1</dt>
2973 <dd>test test test test test</dd>
2974 <dt>test 2</dt>
2975 <dd>test test test test test</dd>
2976 </dl>
2977 !! html
2978 <dl>
2979 <dt>test 1</dt>
2980 <dd>test test test test test</dd>
2981 <dt>test 2</dt>
2982 <dd>test test test test test</dd>
2983 </dl>
2984
2985 !! end
2986
2987 !! test
2988 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2989 !! wikitext
2990 <ul><li>
2991 ; term : description
2992 * unordered
2993 </li></ul>
2994 !! html
2995 <ul><li>
2996 <dl>
2997 <dt> term&#160;</dt>
2998 <dd> description
2999 </dd>
3000 </dl>
3001 <ul>
3002 <li> unordered
3003 </li>
3004 </ul>
3005 </li></ul>
3006
3007 !! end
3008
3009 !! test
3010
3011 Definition list with empty definition and following paragraph
3012 !! wikitext
3013 ; term:
3014 Paragraph text
3015 !! html
3016 <dl>
3017 <dt> term</dt>
3018 <dd>
3019 </dd>
3020 </dl>
3021 <p>Paragraph text
3022 </p>
3023 !! end
3024
3025 !! test
3026 Nested definition lists using html syntax
3027 !! wikitext
3028 <dl><dd>
3029 <dl>
3030 <dd>Foo</dd>
3031 </dl>
3032 </dd></dl>
3033 !! html
3034 <dl><dd>
3035 <dl>
3036 <dd>Foo</dd>
3037 </dl>
3038 </dd></dl>
3039
3040 !! end
3041
3042 !! test
3043 Definition Lists: No nesting: Multiple dd's
3044 !! wikitext
3045 ;x
3046 :a
3047 :b
3048 !! html
3049 <dl>
3050 <dt>x
3051 </dt>
3052 <dd>a
3053 </dd>
3054 <dd>b
3055 </dd>
3056 </dl>
3057
3058 !! end
3059
3060 !! test
3061 Definition Lists: Indentation: Regular
3062 !! wikitext
3063 :i1
3064 ::i2
3065 :::i3
3066 !! html
3067 <dl>
3068 <dd>i1
3069 <dl>
3070 <dd>i2
3071 <dl>
3072 <dd>i3
3073 </dd>
3074 </dl>
3075 </dd>
3076 </dl>
3077 </dd>
3078 </dl>
3079
3080 !! end
3081
3082 !! test
3083 Definition Lists: Indentation: Missing 1st level
3084 !! wikitext
3085 ::i2
3086 :::i3
3087 !! html
3088 <dl>
3089 <dd><dl>
3090 <dd>i2
3091 <dl>
3092 <dd>i3
3093 </dd>
3094 </dl>
3095 </dd>
3096 </dl>
3097 </dd>
3098 </dl>
3099
3100 !! end
3101
3102 !! test
3103 Definition Lists: Indentation: Multi-level indent
3104 !! wikitext
3105 :::i3
3106 !! html
3107 <dl>
3108 <dd><dl>
3109 <dd><dl>
3110 <dd>i3
3111 </dd>
3112 </dl>
3113 </dd>
3114 </dl>
3115 </dd>
3116 </dl>
3117
3118 !! end
3119
3120 !! test
3121 Definition Lists: Hacky use to indent tables
3122 !! wikitext
3123 ::{|
3124 |foo
3125 |bar
3126 |}
3127 this text
3128 should be left alone
3129 !! html
3130 <dl><dd><dl><dd><table>
3131 <tr>
3132 <td>foo
3133 </td>
3134 <td>bar
3135 </td></tr></table></dd></dl></dd></dl>
3136 <p>this text
3137 should be left alone
3138 </p>
3139 !! end
3140
3141 !! test
3142 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3143 !! wikitext
3144 <!-- foo -->
3145 ::{|
3146 |foo
3147 |bar
3148 |}<!-- bar -->
3149 this text
3150 should be left alone
3151 !! html/parsoid
3152 <!-- foo -->
3153 <dl><dd><dl><dd><table><tr>
3154 <td>foo</td>
3155 <td>bar</td>
3156 </tr></table><!-- bar --></dd></dl></dd></dl>
3157 <p>this text
3158 should be left alone</p>
3159 !! end
3160
3161 !! test
3162 Definition Lists: Hacky use to indent tables, with comment before table
3163 !! wikitext
3164 ::<!-- foo -->{|
3165 |foo
3166 |}
3167 !! html/parsoid
3168 <dl><dd><dl><dd><!-- foo --><table><tr>
3169 <td>foo</td>
3170 </tr></table></dd></dl></dd></dl>
3171 !! end
3172
3173 # Bug 52473
3174 !! test
3175 Definition Lists: Hacky use to indent tables (WS-insensitive)
3176 !! options
3177 parsoid
3178 !! wikitext
3179 : {|
3180 |a
3181 |}
3182 !! html
3183 <dl>
3184 <dd> <table><tr><td>a</td></tr></table> </dd>
3185 </dl>
3186 !! end
3187 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3188 ## as an empty dt item. It also ignores all but the last ";" when followed
3189 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3190 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3191 ## ";"s.
3192 ##
3193 ## Ex: ";;t2 ::d2" is transformed into:
3194 ##
3195 ## <dl>
3196 ## <dt>t2 </dt>
3197 ## <dd>
3198 ## <dl>
3199 ## <dt></dt>
3200 ## <dd>d2</dd>
3201 ## </dl>
3202 ## </dd>
3203 ## </dl>
3204 ##
3205 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3206 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3207 ##
3208 ## <dl>
3209 ## <dt>
3210 ## <dl>
3211 ## <dt>t2 </dt>
3212 ## <dd>:d2</dd>
3213 ## </dl>
3214 ## </dt>
3215 ## </dl>
3216 ##
3217 ## All Parsoid only definition list tests have this difference.
3218 ##
3219 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3220 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3221
3222 !! test
3223 Table / list interaction: indented table with lists in table contents
3224 !! wikitext
3225 :{|
3226 |-
3227 | a
3228 * b
3229 |-
3230 | c
3231 * d
3232 |}
3233 !! html
3234 <dl><dd><table>
3235
3236 <tr>
3237 <td> a
3238 <ul>
3239 <li> b
3240 </li>
3241 </ul>
3242 </td></tr>
3243 <tr>
3244 <td> c
3245 <ul>
3246 <li> d
3247 </li>
3248 </ul>
3249 </td></tr></table></dd></dl>
3250
3251 !! end
3252
3253 !!test
3254 Table / list interaction: lists nested in tables nested in indented lists
3255 !! wikitext
3256 :{|
3257 |
3258 :a
3259 :b
3260 |
3261 *c
3262 *d
3263 |}
3264
3265 *e
3266 *f
3267 !! html
3268 <dl><dd><table>
3269 <tr>
3270 <td>
3271 <dl>
3272 <dd>a
3273 </dd>
3274 <dd>b
3275 </dd>
3276 </dl>
3277 </td>
3278 <td>
3279 <ul>
3280 <li>c
3281 </li>
3282 <li>d
3283 </li>
3284 </ul>
3285 </td></tr></table></dd></dl>
3286 <ul>
3287 <li>e
3288 </li>
3289 <li>f
3290 </li>
3291 </ul>
3292
3293 !!end
3294
3295 !! test
3296 Definition Lists: Nesting: Multi-level (Parsoid only)
3297 !! options
3298 parsoid
3299 !! wikitext
3300 ;t1 :d1
3301 ;;t2 ::d2
3302 ;;;t3 :::d3
3303 !! html
3304 <dl>
3305 <dt>t1 </dt>
3306 <dd>d1</dd>
3307 <dt>
3308 <dl>
3309 <dt>t2 </dt>
3310 <dd>:d2</dd>
3311 <dt>
3312 <dl>
3313 <dt>t3 </dt>
3314 <dd>::d3</dd>
3315 </dl>
3316 </dt>
3317 </dl>
3318 </dt>
3319 </dl>
3320
3321
3322 !! end
3323
3324
3325 !! test
3326 Definition Lists: Nesting: Test 2 (Parsoid only)
3327 !! options
3328 parsoid
3329 !! wikitext
3330 ;t1
3331 ::d2
3332 !! html
3333 <dl>
3334 <dt>t1</dt>
3335 <dd>
3336 <dl>
3337 <dd>d2</dd>
3338 </dl>
3339 </dd>
3340 </dl>
3341
3342 !! end
3343
3344
3345 !! test
3346 Definition Lists: Nesting: Test 3 (Parsoid only)
3347 !! options
3348 parsoid
3349 !! wikitext
3350 :;t1
3351 ::::d2
3352 !! html
3353 <dl>
3354 <dd>
3355 <dl>
3356 <dt>t1</dt>
3357 <dd>
3358 <dl>
3359 <dd>
3360 <dl>
3361 <dd>d2</dd>
3362 </dl>
3363 </dd>
3364 </dl>
3365 </dd>
3366 </dl>
3367 </dd>
3368 </dl>
3369
3370 !! end
3371
3372
3373 !! test
3374 Definition Lists: Nesting: Test 4
3375 !! wikitext
3376 ::;t3
3377 :::d3
3378 !! html
3379 <dl>
3380 <dd><dl>
3381 <dd><dl>
3382 <dt>t3
3383 </dt>
3384 <dd>d3
3385 </dd>
3386 </dl>
3387 </dd>
3388 </dl>
3389 </dd>
3390 </dl>
3391
3392 !! end
3393
3394
3395 ## The Parsoid team believes the following three test exposes a
3396 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3397 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3398 !! test
3399 Definition Lists: Mixed Lists: Test 1
3400 !! wikitext
3401 :;* foo
3402 ::* bar
3403 :; baz
3404 !! html/php
3405 <dl>
3406 <dd><dl>
3407 <dt><ul>
3408 <li> foo
3409 </li>
3410 <li> bar
3411 </li>
3412 </ul>
3413 </dt>
3414 </dl>
3415 <dl>
3416 <dt> baz
3417 </dt>
3418 </dl>
3419 </dd>
3420 </dl>
3421
3422 !! html/parsoid
3423 <dl>
3424 <dd><dl>
3425 <dt><ul>
3426 <li> foo
3427 </li>
3428 </ul></dt>
3429 <dd><ul>
3430 <li> bar
3431 </li>
3432 </ul></dd>
3433 <dt> baz</dt>
3434 </dl></dd>
3435 </dl>
3436 !! end
3437
3438 !! test
3439 Definition Lists: Mixed Lists: Test 2
3440 !! wikitext
3441 *: d1
3442 *: d2
3443 !! html
3444 <ul>
3445 <li><dl>
3446 <dd> d1
3447 </dd>
3448 <dd> d2
3449 </dd>
3450 </dl>
3451 </li>
3452 </ul>
3453
3454 !! end
3455
3456
3457 !! test
3458 Definition Lists: Mixed Lists: Test 3
3459 !! wikitext
3460 *::: d1
3461 *::: d2
3462 !! html
3463 <ul>
3464 <li><dl>
3465 <dd><dl>
3466 <dd><dl>
3467 <dd> d1
3468 </dd>
3469 <dd> d2
3470 </dd>
3471 </dl>
3472 </dd>
3473 </dl>
3474 </dd>
3475 </dl>
3476 </li>
3477 </ul>
3478
3479 !! end
3480
3481
3482 !! test
3483 Definition Lists: Mixed Lists: Test 4
3484 !! wikitext
3485 *;d1 :d2
3486 *;d3 :d4
3487 !! html
3488 <ul>
3489 <li><dl>
3490 <dt>d1&#160;</dt>
3491 <dd>d2
3492 </dd>
3493 <dt>d3&#160;</dt>
3494 <dd>d4
3495 </dd>
3496 </dl>
3497 </li>
3498 </ul>
3499
3500 !! end
3501
3502
3503 !! test
3504 Definition Lists: Mixed Lists: Test 5
3505 !! wikitext
3506 *:d1
3507 *:: d2
3508 !! html
3509 <ul>
3510 <li><dl>
3511 <dd>d1
3512 <dl>
3513 <dd> d2
3514 </dd>
3515 </dl>
3516 </dd>
3517 </dl>
3518 </li>
3519 </ul>
3520
3521 !! end
3522
3523
3524 !! test
3525 Definition Lists: Mixed Lists: Test 6
3526 !! wikitext
3527 #*:d1
3528 #*::: d3
3529 !! html
3530 <ol>
3531 <li><ul>
3532 <li><dl>
3533 <dd>d1
3534 <dl>
3535 <dd><dl>
3536 <dd> d3
3537 </dd>
3538 </dl>
3539 </dd>
3540 </dl>
3541 </dd>
3542 </dl>
3543 </li>
3544 </ul>
3545 </li>
3546 </ol>
3547
3548 !! end
3549
3550
3551 !! test
3552 Definition Lists: Mixed Lists: Test 7
3553 !! wikitext
3554 :* d1
3555 :* d2
3556 !! html
3557 <dl>
3558 <dd><ul>
3559 <li> d1
3560 </li>
3561 <li> d2
3562 </li>
3563 </ul>
3564 </dd>
3565 </dl>
3566
3567 !! end
3568
3569
3570 !! test
3571 Definition Lists: Mixed Lists: Test 8
3572 !! wikitext
3573 :* d1
3574 ::* d2
3575 !! html
3576 <dl>
3577 <dd><ul>
3578 <li> d1
3579 </li>
3580 </ul>
3581 <dl>
3582 <dd><ul>
3583 <li> d2
3584 </li>
3585 </ul>
3586 </dd>
3587 </dl>
3588 </dd>
3589 </dl>
3590
3591 !! end
3592
3593
3594 !! test
3595 Definition Lists: Mixed Lists: Test 9
3596 !! wikitext
3597 *;foo :bar
3598 !! html
3599 <ul>
3600 <li><dl>
3601 <dt>foo&#160;</dt>
3602 <dd>bar
3603 </dd>
3604 </dl>
3605 </li>
3606 </ul>
3607
3608 !! end
3609
3610
3611 !! test
3612 Definition Lists: Mixed Lists: Test 10
3613 !! wikitext
3614 *#;foo :bar
3615 !! html
3616 <ul>
3617 <li><ol>
3618 <li><dl>
3619 <dt>foo&#160;</dt>
3620 <dd>bar
3621 </dd>
3622 </dl>
3623 </li>
3624 </ol>
3625 </li>
3626 </ul>
3627
3628 !! end
3629
3630 # The Parsoid team disagrees with the PHP parser's seemingly-random
3631 # rules regarding dd/dt on the next two tests. Parsoid is more
3632 # consistent, and recognizes the shared nesting and keeps the
3633 # still-open tags around until the nesting is complete.
3634
3635 !! test
3636 Definition Lists: Mixed Lists: Test 11
3637 !! wikitext
3638 *#*#;*;;foo :bar
3639 *#*#;boo :baz
3640 !! html/php
3641 <ul>
3642 <li><ol>
3643 <li><ul>
3644 <li><ol>
3645 <li><dl>
3646 <dt>foo&#160;</dt>
3647 <dd><ul>
3648 <li><dl>
3649 <dt><dl>
3650 <dt>bar
3651 </dt>
3652 </dl>
3653 </dd>
3654 </dl>
3655 </li>
3656 </ul>
3657 </dd>
3658 </dl>
3659 <dl>
3660 <dt>boo&#160;</dt>
3661 <dd>baz
3662 </dd>
3663 </dl>
3664 </li>
3665 </ol>
3666 </li>
3667 </ul>
3668 </li>
3669 </ol>
3670 </li>
3671 </ul>
3672
3673 !! html/parsoid
3674 <ul>
3675 <li>
3676 <ol>
3677 <li>
3678 <ul>
3679 <li>
3680 <ol>
3681 <li>
3682 <dl>
3683 <dt>
3684 <ul>
3685 <li>
3686 <dl>
3687 <dt>
3688 <dl>
3689 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3690 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3691 </dl></dt>
3692 </dl></li>
3693 </ul></dt>
3694 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3695 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3696 </dl></li>
3697 </ol></li>
3698 </ul></li>
3699 </ol></li>
3700 </ul>
3701 !! end
3702
3703
3704 !! test
3705 Definition Lists: Weird Ones: Test 1
3706 !! wikitext
3707 *#;*::;; foo : bar (who uses this?)
3708 !! html/php
3709 <ul>
3710 <li><ol>
3711 <li><dl>
3712 <dt> foo&#160;</dt>
3713 <dd><ul>
3714 <li><dl>
3715 <dd><dl>
3716 <dd><dl>
3717 <dt><dl>
3718 <dt> bar (who uses this?)
3719 </dt>
3720 </dl>
3721 </dd>
3722 </dl>
3723 </dd>
3724 </dl>
3725 </dd>
3726 </dl>
3727 </li>
3728 </ul>
3729 </dd>
3730 </dl>
3731 </li>
3732 </ol>
3733 </li>
3734 </ul>
3735
3736 !! html/parsoid
3737 <ul>
3738 <li>
3739 <ol>
3740 <li>
3741 <dl>
3742 <dt>
3743 <ul>
3744 <li>
3745 <dl>
3746 <dd>
3747 <dl>
3748 <dd>
3749 <dl>
3750 <dt>
3751 <dl>
3752 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3753 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3754 </dl></dt>
3755 </dl></dd>
3756 </dl></dd>
3757 </dl></li>
3758 </ul></dt>
3759 </dl></li>
3760 </ol></li>
3761 </ul>
3762 !! end
3763
3764 ###
3765 ### External links
3766 ###
3767 !! test
3768 External links: non-bracketed
3769 !! wikitext
3770 Non-bracketed: http://example.com
3771 !! html
3772 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3773 </p>
3774 !! end
3775
3776 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3777 !! test
3778 External links: numbered
3779 !! wikitext
3780 Numbered: [http://example.com]
3781 Numbered: [http://example.net]
3782 Numbered: [http://example.com]
3783 !! html/php
3784 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3785 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3786 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3787 </p>
3788 !! html/parsoid
3789 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
3790 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
3791 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
3792 !!end
3793
3794 !! test
3795 External links: specified text
3796 !! wikitext
3797 Specified text: [http://example.com link]
3798 !! html
3799 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3800 </p>
3801 !!end
3802
3803 !! test
3804 External links: trail
3805 !! wikitext
3806 Linktrails should not work for external links: [http://example.com link]s
3807 !! html
3808 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3809 </p>
3810 !! end
3811
3812 !! test
3813 External links: dollar sign in URL
3814 !! wikitext
3815 http://example.com/1$2345
3816 !! html
3817 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3818 </p>
3819 !! end
3820
3821 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3822 !! test
3823 External links: dollar sign in URL (autonumber)
3824 !! wikitext
3825 [http://example.com/1$2345]
3826 !! html/php
3827 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3828 </p>
3829 !! html/parsoid
3830 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
3831 !!end
3832
3833 !! test
3834 External links: open square bracket forbidden in URL (bug 4377)
3835 !! options
3836 parsoid=wt2html,wt2wt,html2html
3837 !! wikitext
3838 http://example.com/1[2345
3839 !! html/php
3840 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3841 </p>
3842 !! html/parsoid
3843 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
3844 !! end
3845
3846 !! test
3847 External links: open square bracket forbidden in URL (named) (bug 4377)
3848 !! options
3849 parsoid=wt2html,html2html
3850 !! wikitext
3851 [http://example.com/1[2345]
3852 !! html/php
3853 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3854 </p>
3855 !! html/parsoid
3856 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
3857 !!end
3858
3859 # parsoid adds a space before the link name
3860 !! test
3861 External links: open square bracket forbidden in URL (named) (bug 4377)
3862 Parsoid variant.
3863 !! wikitext
3864 [http://example.com/1 [2345]
3865 !! html
3866 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3867 </p>
3868 !!end
3869
3870 !! test
3871 External links: nowiki in URL link text (bug 6230)
3872 !! wikitext
3873 [http://example.com/ <nowiki>''example site''</nowiki>]
3874 !! html
3875 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3876 </p>
3877 !! end
3878
3879 !! test
3880 External links: newline forbidden in text (bug 6230 regression check)
3881 !! wikitext
3882 [http://example.com/ first
3883 second]
3884 !! html
3885 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3886 second]
3887 </p>
3888 !!end
3889
3890 !! test
3891 External links: Pipe char between url and text
3892 !! wikitext
3893 [http://example.com | link]
3894 !! html
3895 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3896 </p>
3897 !!end
3898
3899 !! test
3900 External links: protocol-relative URL in brackets
3901 !! wikitext
3902 [//example.com/ Test]
3903 !! html
3904 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3905 </p>
3906 !! end
3907
3908 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3909 !! test
3910 External links: protocol-relative URL in brackets without text
3911 !! wikitext
3912 [//example.com]
3913 !! html/php
3914 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3915 </p>
3916 !! html/parsoid
3917 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
3918 !! end
3919
3920 !! test
3921 External links: protocol-relative URL in free text is left alone
3922 !! wikitext
3923 //example.com/Foo
3924 !! html
3925 <p>//example.com/Foo
3926 </p>
3927 !!end
3928
3929 !! test
3930 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3931 !! wikitext
3932 foo//example.com/Foo
3933 !! html
3934 <p>foo//example.com/Foo
3935 </p>
3936 !! end
3937
3938 !! test
3939 External links: with no contents
3940 !! wikitext
3941 [http://en.wikipedia.org/wiki/Foo]
3942
3943 [[wikipedia:Foo|Bar]]
3944
3945 [[wikipedia:Foo|<span>Bar</span>]]
3946 !! html/parsoid
3947 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
3948 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo">Bar</a></p>
3949 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"><span>Bar</span></a></p>
3950 !! end
3951
3952 !! test
3953 External image
3954 !! wikitext
3955 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3956 !! html
3957 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3958 </p>
3959 !! end
3960
3961 !! test
3962 External image from https
3963 !! wikitext
3964 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3965 !! html
3966 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3967 </p>
3968 !! end
3969
3970 !! test
3971 External image (when not allowed)
3972 !! options
3973 wgAllowExternalImages=0
3974 !! wikitext
3975 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3976 !! html
3977 <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>
3978 </p>
3979 !! end
3980
3981 !! test
3982 Link to non-http image, no img tag
3983 !! wikitext
3984 Link to non-http image, no img tag: ftp://example.com/test.jpg
3985 !! html
3986 <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>
3987 </p>
3988 !! end
3989
3990 !! test
3991 External links: terminating separator
3992 !! wikitext
3993 Terminating separator: http://example.com/thing,
3994 !! html
3995 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3996 </p>
3997 !! end
3998
3999 !! test
4000 External links: intervening separator
4001 !! wikitext
4002 Intervening separator: http://example.com/1,2,3
4003 !! html
4004 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4005 </p>
4006 !! end
4007
4008 !! test
4009 External links: old bug with URL in query
4010 !! wikitext
4011 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4012 !! html
4013 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4014 </p>
4015 !! end
4016
4017 !! test
4018 External links: old URL-in-URL bug, mixed protocols
4019 !! wikitext
4020 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4021 !! html
4022 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4023 </p>
4024 !!end
4025
4026 !! test
4027 External links: URL in text
4028 !! wikitext
4029 URL in text: [http://example.com http://example.com]
4030 !! html
4031 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4032 </p>
4033 !! end
4034
4035 !! test
4036 External links: Clickable images
4037 !! wikitext
4038 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4039 !! html
4040 <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>
4041 </p>
4042 !!end
4043
4044 !! test
4045 External links: raw ampersand
4046 !! wikitext
4047 Old &amp; use: http://x&y
4048 !! html
4049 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4050 </p>
4051 !! end
4052
4053 !! test
4054 External links: encoded ampersand
4055 !! wikitext
4056 Old &amp; use: http://x&amp;y
4057 !! html/php
4058 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4059 </p>
4060 !! html/parsoid
4061 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4062 !! end
4063
4064 !! test
4065 External links: encoded equals (bug 6102)
4066 !! wikitext
4067 http://example.com/?foo&#61;bar
4068 !! html/php
4069 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4070 </p>
4071 !! html/parsoid
4072 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4073 !! end
4074
4075 ##
4076 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4077 ## does it number them. As discussed in bug 53505, we can identify
4078 ## autonumbered links via CSS.
4079 ##
4080
4081 !! test
4082 External links: [raw ampersand]
4083 !! wikitext
4084 Old &amp; use: [http://x&y]
4085 !! html/php
4086 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4087 </p>
4088 !! html/parsoid
4089 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4090 !! end
4091
4092 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4093 # mode will return the [raw ampersand] wikitext
4094 !! test
4095 External links: [encoded ampersand]
4096 !! options
4097 parsoid=wt2html,wt2wt,html2html
4098 !! wikitext
4099 Old &amp; use: [http://x&amp;y]
4100 !! html/php
4101 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4102 </p>
4103 !! html/parsoid
4104 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4105 !! end
4106
4107 !! test
4108 External links: [raw equals]
4109 !! wikitext
4110 [http://example.com/?foo=bar]
4111 !! html/php
4112 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4113 </p>
4114 !! html/parsoid
4115 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4116 !! end
4117
4118 # note that parsoid html is identical to [raw equals] case; so html2wt
4119 # mode will return the [raw equals] wikitext
4120 !! test
4121 External links: [encoded equals] (bug 6102)
4122 !! options
4123 parsoid=wt2html,wt2wt,html2html
4124 !! wikitext
4125 [http://example.com/?foo&#61;bar]
4126 !! html/php
4127 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4128 </p>
4129 !! html/parsoid
4130 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4131 !! end
4132
4133 # xxx parsoid strips the IDN character, so the round-trip tests will
4134 # obviously fail and are disabled. --cscott
4135 !! test
4136 External links: [IDN ignored character reference in hostname; strip it right off]
4137 !! options
4138 parsoid=wt2html,wt2wt,html2html
4139 !! wikitext
4140 [http://e&zwnj;xample.com/]
4141 !! html/php
4142 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4143 </p>
4144 !! html/parsoid
4145 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4146 !! end
4147
4148 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4149 # Where an external link could easily circumvent the sanitization of the text of
4150 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4151 # test demands a higher standard. That's a bit strange.
4152 #
4153 # Example:
4154 #
4155 # http://e‌xample.com -> [http://example.com|http://example.com]
4156 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4157 #
4158 # The first example is sanitized, but the second is not. Any security benefits
4159 # from this production are trivial to circumvent. Either remove this test and
4160 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4161 # the test accordingly.
4162 #
4163 # All our love,
4164 # The Parsoid team.
4165 # xxx parsoid strips the IDN character, so the round-trip tests will
4166 # obviously fail and are disabled. --cscott
4167 !! test
4168 External links: IDN ignored character reference in hostname; strip it right off
4169 !! options
4170 parsoid=wt2html,html2html
4171 !! wikitext
4172 http://e&zwnj;xample.com/
4173 !! html/php
4174 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4175 </p>
4176 !! html/parsoid
4177 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4178 !! end
4179
4180 !! test
4181 External links: www.jpeg.org (bug 554)
4182 !! wikitext
4183 http://www.jpeg.org
4184 !! html
4185 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4186 </p>
4187 !! end
4188
4189 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4190 !! test
4191 External links: URL within URL (original bug 2)
4192 !! wikitext
4193 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4194 !! html/php
4195 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4196 </p>
4197 !! html/parsoid
4198 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4199 !! end
4200
4201 !! test
4202 BUG 361: URL inside bracketed URL
4203 !! wikitext
4204 [http://www.example.com/foo http://www.example.com/bar]
4205 !! html
4206 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4207 </p>
4208 !! end
4209
4210 !! test
4211 BUG 361: URL within URL, not bracketed
4212 !! wikitext
4213 http://www.example.com/foo?=http://www.example.com/bar
4214 !! html
4215 <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>
4216 </p>
4217 !! end
4218
4219 !! test
4220 BUG 289: ">"-token in URL-tail
4221 !! wikitext
4222 http://www.example.com/<hello>
4223 !! html
4224 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4225 </p>
4226 !!end
4227
4228 !! test
4229 BUG 289: literal ">"-token in URL-tail
4230 !! wikitext
4231 http://www.example.com/<b>html</b>
4232 !! html
4233 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4234 </p>
4235 !!end
4236
4237 !! test
4238 BUG 289: ">"-token in bracketed URL
4239 !! wikitext
4240 [http://www.example.com/<hello> stuff]
4241 !! html
4242 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4243 </p>
4244 !!end
4245
4246 !! test
4247 BUG 289: literal ">"-token in bracketed URL
4248 !! wikitext
4249 [http://www.example.com/<b>html</b> stuff]
4250 !! html
4251 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4252 </p>
4253 !!end
4254
4255 !! test
4256 BUG 289: literal double quote at end of URL
4257 !! wikitext
4258 http://www.example.com/"hello"
4259 !! html
4260 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4261 </p>
4262 !!end
4263
4264 !! test
4265 BUG 289: literal double quote in bracketed URL
4266 !! wikitext
4267 [http://www.example.com/"hello" stuff]
4268 !! html
4269 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4270 </p>
4271 !!end
4272
4273 !! test
4274 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4275 !! wikitext
4276 [http://www.example.com test]
4277 !! html
4278 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4279 </p>
4280 !! end
4281
4282 !! test
4283 External links: link text with spaces
4284 !! wikitext
4285 [http://www.example.com a b c]
4286 [http://www.example.com ''a'' ''b'']
4287 !! html
4288 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4289 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4290 </p>
4291 !! end
4292
4293 !! test
4294 External links: wiki links within external link (Bug 3695)
4295 !! wikitext
4296 [http://example.com [[wikilink]] embedded in ext link]
4297 !! html/php
4298 <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>
4299 </p>
4300 !! html/parsoid
4301 <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>
4302 !! end
4303
4304 !! test
4305 BUG 787: Links with one slash after the url protocol are invalid
4306 !! wikitext
4307 http:/example.com
4308
4309 [http:/example.com title]
4310 !! html
4311 <p>http:/example.com
4312 </p><p>[http:/example.com title]
4313 </p>
4314 !! end
4315
4316 !! test
4317 Bracketed external links with template-generated invalid target
4318 !! wikitext
4319 [{{echo|http:/example.com}} title]
4320 !! html
4321 <p>[http:/example.com title]
4322 </p>
4323 !! end
4324
4325 !! test
4326 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4327 !! wikitext
4328 ''[http://example.com text'']
4329 [http://example.com '''text]'''
4330 ''Something [http://example.com in italic'']
4331 ''Something [http://example.com mixed''''', even bold]'''
4332 '''''Now [http://example.com both''''']
4333 !! html
4334 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4335 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4336 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4337 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4338 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4339 </p>
4340 !! end
4341
4342
4343 !! test
4344 Bug 4781: %26 in URL
4345 !! wikitext
4346 http://www.example.com/?title=AT%26T
4347 !! html/php
4348 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4349 </p>
4350 !! html/parsoid
4351 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4352 !! end
4353
4354 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4355 # % is actually legal in HTML5. Any change in output would need testing though.
4356 !! test
4357 Bug 4781, 5267: %25 in URL
4358 !! wikitext
4359 http://www.example.com/?title=100%25_Bran
4360 !! html/php
4361 <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>
4362 </p>
4363 !! html/parsoid
4364 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4365 !! end
4366
4367 !! test
4368 Bug 4781, 5267: %28, %29 in URL
4369 !! wikitext
4370 http://www.example.com/?title=Ben-Hur_%281959_film%29
4371 !! html/php
4372 <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>
4373 </p>
4374 !! html/parsoid
4375 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
4376 !! end
4377
4378
4379 !! test
4380 Bug 4781: %26 in autonumber URL
4381 !! wikitext
4382 [http://www.example.com/?title=AT%26T]
4383 !! html/php
4384 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4385 </p>
4386 !! html/parsoid
4387 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4388 !! end
4389
4390 !! test
4391 Bug 4781, 5267: %26 in autonumber URL
4392 !! wikitext
4393 [http://www.example.com/?title=100%25_Bran]
4394 !! html/php
4395 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4396 </p>
4397 !! html/parsoid
4398 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4399 !! end
4400
4401 !! test
4402 Bug 4781, 5267: %28, %29 in autonumber URL
4403 !! wikitext
4404 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4405 !! html/php
4406 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4407 </p>
4408 !! html/parsoid
4409 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4410 !! end
4411
4412
4413 !! test
4414 Bug 4781: %26 in bracketed URL
4415 !! wikitext
4416 [http://www.example.com/?title=AT%26T link]
4417 !! html/php
4418 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4419 </p>
4420 !! html/parsoid
4421 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4422 !! end
4423
4424 !! test
4425 Bug 4781, 5267: %25 in bracketed URL
4426 !! wikitext
4427 [http://www.example.com/?title=100%25_Bran link]
4428 !! html
4429 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4430 </p>
4431 !! end
4432
4433 !! test
4434 Bug 4781, 5267: %28, %29 in bracketed URL
4435 !! wikitext
4436 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4437 !! html/php
4438 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4439 </p>
4440 !! html/parsoid
4441 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4442 !! end
4443
4444 # Note that parsoid does not munge anchor text; all non-space
4445 # characters are valid in HTML5 ids.
4446 !! test
4447 Anchor containing a #. (bug 63430)
4448 !! wikitext
4449 [[Main Page#And#Link]]
4450 !! html/php
4451 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
4452 </p>
4453 !! html/parsoid
4454 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link">Main Page#And#Link</a></p>
4455 !! end
4456
4457 # Note that parsoid does not munge anchor text; all non-space
4458 # characters are valid in HTML5 ids.
4459 !! test
4460 Anchor containing a #. (bug 63430)
4461 !! wikitext
4462 [[Main Page#And#Link]]
4463 !! html/php
4464 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
4465 </p>
4466 !! html/parsoid
4467 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link">Main Page#And#Link</a></p>
4468 !! end
4469
4470 !! test
4471 External link containing a period in the anchor. (bug 63947)
4472 !! wikitext
4473 [//foo.org/bar#baz. bang]
4474
4475 [//foo.org/bar. bang]
4476 !! html/php
4477 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4478 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4479 </p>
4480 !! html/parsoid
4481 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4482 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4483 !! end
4484
4485 !! test
4486 External link containing a single quote. (bug 63947)
4487 !! wikitext
4488 [//foo.org/bar'baz]
4489
4490 [//foo.org/bar'baz bang]
4491 !! html/php
4492 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4493 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4494 </p>
4495 !! html/parsoid
4496 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4497 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4498 !! end
4499
4500
4501 !! test
4502 External link containing a period in the anchor. (bug 63947)
4503 !! wikitext
4504 [//foo.org/bar#baz. bang]
4505
4506 [//foo.org/bar. bang]
4507 !! html/php
4508 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4509 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4510 </p>
4511 !! html/parsoid
4512 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4513 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4514 !! end
4515
4516 !! test
4517 External link containing a single quote. (bug 63947)
4518 !! wikitext
4519 [//foo.org/bar'baz]
4520
4521 [//foo.org/bar'baz bang]
4522 !! html/php
4523 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4524 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4525 </p>
4526 !! html/parsoid
4527 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4528 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4529 !! end
4530
4531
4532 !! test
4533 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4534 !! wikitext
4535 Some [http://example.com/ pretty ''italics'' and stuff]!
4536 !! html
4537 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4538 </p>
4539 !! end
4540
4541 !! test
4542 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4543 !! wikitext
4544 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4545 !! html
4546 <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>
4547 </p>
4548 !! end
4549
4550 !! test
4551 External link containing double-single-quotes with no space separating the url from text in italics
4552 !! wikitext
4553 [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]].]
4554 !! html/php
4555 <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>
4556 </p>
4557 !! html/parsoid
4558 <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>
4559 !! end
4560
4561 !! test
4562 External link with comments in link text
4563 !! wikitext
4564 [http://www.google.com Google <!-- comment -->]
4565 !! html
4566 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4567 </p>
4568 !! end
4569
4570 !! test
4571 URL-encoding in URL functions (single parameter)
4572 !! wikitext
4573 {{localurl:Some page|amp=&}}
4574 !! html
4575 <p>/index.php?title=Some_page&amp;amp=&amp;
4576 </p>
4577 !! end
4578
4579 !! test
4580 URL-encoding in URL functions (multiple parameters)
4581 !! wikitext
4582 {{localurl:Some page|q=?&amp=&}}
4583 !! html
4584 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4585 </p>
4586 !! end
4587
4588 !! test
4589 Brackets in urls
4590 !! wikitext
4591 http://example.com/index.php?foozoid%5B%5D=bar
4592
4593 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4594 !! html/php
4595 <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>
4596 </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>
4597 </p>
4598 !! html/parsoid
4599 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
4600
4601 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4602 !! end
4603
4604 !! test
4605 IPv6 urls (bug 21261)
4606 !! options
4607 disabled
4608 !! wikitext
4609 http://[2404:130:0:1000::187:2]/index.php
4610 !! html
4611 <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>
4612 </p>
4613 !! end
4614
4615 !! test
4616 Non-extlinks in brackets
4617 !! wikitext
4618 [foo]
4619 [foo bar]
4620 [foo ''bar'']
4621 [fool's] errand
4622 [fool's errand]
4623 [{{echo|foo}}]
4624 [{{echo|foo}} bar]
4625 [{{echo|foo}} ''bar'']
4626 [{{echo|foo}}l's] errand
4627 [{{echo|foo}}l's errand]
4628 [url={{echo|foo}}]
4629 [url=http://example.com]
4630 !! html
4631 <p>[foo]
4632 [foo bar]
4633 [foo <i>bar</i>]
4634 [fool's] errand
4635 [fool's errand]
4636 [foo]
4637 [foo bar]
4638 [foo <i>bar</i>]
4639 [fool's] errand
4640 [fool's errand]
4641 [url=foo]
4642 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4643 </p>
4644 !! end
4645
4646 !! test
4647 Percent encoding in external links
4648 !! wikitext
4649 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4650 !! html/php
4651 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4652 </p>
4653 !! html/parsoid
4654 <p><a rel="mw:ExtLink"
4655 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4656 !! end
4657
4658 !! test
4659 Use url link syntax for links where the content is equal the link target
4660 !! wikitext
4661 http://example.com
4662 !! html/php
4663 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4664 </p>
4665 !! html/parsoid
4666 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4667 !! end
4668
4669 !! test
4670 Parenthesis in external links, especially URL links
4671 !! wikitext
4672 http://example.com)
4673
4674 http://example.com/test)
4675
4676 http://example.com/(test)
4677
4678 http://example.com/((test)
4679
4680 (http://example.com/(test))
4681
4682 (http://example.com/(test)))))
4683
4684 http://example.com/a)b
4685
4686 [http://example.com) foo]
4687 !! html/php
4688 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4689 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4690 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4691 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4692 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4693 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4694 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4695 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4696 </p>
4697 !! html/parsoid
4698 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4699 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4700 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4701 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4702 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4703 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4704 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4705 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4706 !! end
4707
4708 !! test
4709 Parenthesis in external links, w/ transclusion or comment
4710 !! wikitext
4711 (http://example.com/{{echo|hi}})
4712
4713 (http://example.com<!-- hi -->)
4714 !! html/php
4715 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4716 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4717 </p>
4718 !! html/parsoid
4719 <p>(<a data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\">hi&lt;/span>"}]]}' typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}'>http://example.com/hi</a>)</p>
4720
4721 <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>
4722 !! end
4723
4724 ###
4725 ### Quotes
4726 ###
4727
4728 !! test
4729 Quotes
4730 !! wikitext
4731 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4732
4733 Normal text. '''''Bold italic text.''''' Normal text.
4734 !! html
4735 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4736 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4737 </p>
4738 !! end
4739
4740
4741 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4742 # parser strips. The wikitext contains just the first half of the bold
4743 # quote pair.
4744 !! test
4745 Unclosed and unmatched quotes
4746 !! wikitext
4747 '''''Bold italic text '''with bold deactivated''' in between.'''''
4748
4749 '''''Bold italic text ''with italic deactivated'' in between.'''''
4750
4751 '''Bold text..
4752
4753 ..spanning two paragraphs (should not work).'''
4754
4755 '''Bold tag left open
4756
4757 ''Italic tag left open
4758
4759 Normal text.
4760
4761 <!-- Unmatching number of opening, closing tags: -->
4762 '''This year''''s election ''should'' beat '''last year''''s.
4763
4764 ''Tom'''s car is bigger than ''Susan'''s.
4765
4766 Plain ''italic'''s plain
4767 !! html/php
4768 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4769 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4770 </p><p><b>Bold text..</b>
4771 </p><p>..spanning two paragraphs (should not work).
4772 </p><p><b>Bold tag left open</b>
4773 </p><p><i>Italic tag left open</i>
4774 </p><p>Normal text.
4775 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4776 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4777 </p><p>Plain <i>italic'</i>s plain
4778 </p>
4779 !! html/parsoid
4780 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4781 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4782 </p><p><b>Bold text..</b>
4783 </p><p>..spanning two paragraphs (should not work).<b></b>
4784 </p><p><b>Bold tag left open</b>
4785 </p><p><i>Italic tag left open</i>
4786 </p><p>Normal text.
4787 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4788 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4789 </p><p>Plain <i>italic'</i>s plain
4790 </p>
4791 !! end
4792
4793 ###
4794 ### Tables
4795 ###
4796 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4797 ###
4798
4799 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4800 # is the bare minimum required by the spec, see:
4801 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4802 # Parsoid team replies: empty table tags are legal in HTML5
4803 !! test
4804 A table with no data.
4805 !! options
4806 parsoid=wt2html
4807 !! wikitext
4808 {||}
4809 !! html/php
4810
4811 !! html/parsoid
4812 <table></table>
4813
4814 !! end
4815
4816 !! test
4817 A table with stray table end tags on start tag line (wt2html)
4818 !! options
4819 parsoid=wt2html
4820 !! wikitext
4821 {|style="color: red;"|}
4822
4823 {|style="color: red;" |}
4824 |foo
4825 |}
4826
4827 {|style="color: red;"|} id="foo"
4828 |foo
4829 |}
4830
4831 {|style="color: red;" |} id="foo"
4832 |foo
4833 |}
4834 !! html
4835 <table style="color: red;"></table>
4836
4837 <table style="color: red;">
4838 <tbody><tr>
4839 <td>foo</td>
4840 </tr></tbody>
4841 </table>
4842
4843 <table style="color: red;" id="foo">
4844 <tbody><tr>
4845 <td>foo</td>
4846 </tr></tbody>
4847 </table>
4848
4849 <table style="color: red;" id="foo">
4850 <tbody><tr>
4851 <td>foo</td>
4852 </tr></tbody>
4853 </table>
4854
4855 !! end
4856
4857 !! test
4858 A table with no data (take 2)
4859 !! wikitext
4860 {|
4861 |}
4862 !! html/parsoid
4863 <table></table>
4864 !! end
4865
4866 # A table with nothing but a caption is invalid XHTML, we might want to render
4867 # this as <p>caption</p>
4868 # Parsoid team replies: table with only a caption is legal in HTML5
4869 !! test
4870 A table with nothing but a caption
4871 !! wikitext
4872 {|
4873 |+ caption
4874 |}
4875 !! html/php
4876 <table>
4877 <caption> caption
4878 </caption><tr><td></td></tr></table>
4879
4880 !! html/parsoid
4881 <table><caption> caption</caption></table>
4882 !! end
4883
4884 !! test
4885 A table with caption with default-spaced attributes and a table row
4886 !! wikitext
4887 {|
4888 |+ style="color: red;" | caption1
4889 |-
4890 | foo
4891 |}
4892 !! html
4893 <table>
4894 <caption style="color: red;"> caption1
4895 </caption>
4896 <tr>
4897 <td> foo
4898 </td></tr></table>
4899
4900 !! end
4901
4902 !! test
4903 A table with captions with non-default spaced attributes and a table row
4904 !! wikitext
4905 {|
4906 |+style="color: red;"|caption2
4907 |+ style="color: red;"| caption3
4908 |-
4909 | foo
4910 |}
4911 !! html
4912 <table>
4913 <caption style="color: red;">caption2
4914 </caption>
4915 <caption style="color: red;"> caption3
4916 </caption>
4917 <tr>
4918 <td> foo
4919 </td></tr></table>
4920
4921 !! end
4922
4923 !! test
4924 Table td-cell syntax variations
4925 !! wikitext
4926 {|
4927 | foo bar foo | baz
4928 | foo bar foo || baz
4929 | style='color:red;' | baz
4930 | style='color:red;' || baz
4931 |}
4932 !! html
4933 <table>
4934 <tr>
4935 <td> baz
4936 </td>
4937 <td> foo bar foo </td>
4938 <td> baz
4939 </td>
4940 <td style="color:red;"> baz
4941 </td>
4942 <td> style='color:red;' </td>
4943 <td> baz
4944 </td></tr></table>
4945
4946 !! end
4947
4948 !! test
4949 Simple table
4950 !! wikitext
4951 {|
4952 | 1 || 2
4953 |-
4954 | 3 || 4
4955 |}
4956 !! html
4957 <table>
4958 <tr>
4959 <td> 1 </td>
4960 <td> 2
4961 </td></tr>
4962 <tr>
4963 <td> 3 </td>
4964 <td> 4
4965 </td></tr></table>
4966
4967 !! end
4968
4969 !! test
4970 Simple table but with multiple dashes for row wikitext
4971 !! wikitext
4972 {|
4973 | foo
4974 |-----
4975 | bar
4976 |}
4977 !! html
4978 <table>
4979 <tr>
4980 <td> foo
4981 </td></tr>
4982 <tr>
4983 <td> bar
4984 </td></tr></table>
4985
4986 !! end
4987 !! test
4988 Multiplication table
4989 !! wikitext
4990 {| border="1" cellpadding="2"
4991 |+Multiplication table
4992 |-
4993 ! &times; !! 1 !! 2 !! 3
4994 |-
4995 ! 1
4996 | 1 || 2 || 3
4997 |-
4998 ! 2
4999 | 2 || 4 || 6
5000 |-
5001 ! 3
5002 | 3 || 6 || 9
5003 |-
5004 ! 4
5005 | 4 || 8 || 12
5006 |-
5007 ! 5
5008 | 5 || 10 || 15
5009 |}
5010 !! html
5011 <table border="1" cellpadding="2">
5012 <caption>Multiplication table
5013 </caption>
5014 <tr>
5015 <th> &#215; </th>
5016 <th> 1 </th>
5017 <th> 2 </th>
5018 <th> 3
5019 </th></tr>
5020 <tr>
5021 <th> 1
5022 </th>
5023 <td> 1 </td>
5024 <td> 2 </td>
5025 <td> 3
5026 </td></tr>
5027 <tr>
5028 <th> 2
5029 </th>
5030 <td> 2 </td>
5031 <td> 4 </td>
5032 <td> 6
5033 </td></tr>
5034 <tr>
5035 <th> 3
5036 </th>
5037 <td> 3 </td>
5038 <td> 6 </td>
5039 <td> 9
5040 </td></tr>
5041 <tr>
5042 <th> 4
5043 </th>
5044 <td> 4 </td>
5045 <td> 8 </td>
5046 <td> 12
5047 </td></tr>
5048 <tr>
5049 <th> 5
5050 </th>
5051 <td> 5 </td>
5052 <td> 10 </td>
5053 <td> 15
5054 </td></tr></table>
5055
5056 !! end
5057
5058 !! test
5059 Accept "||" in table headings
5060 !! wikitext
5061 {|
5062 !h1 || h2
5063 |}
5064 !! html
5065 <table>
5066 <tr>
5067 <th>h1 </th>
5068 <th> h2
5069 </th></tr></table>
5070
5071 !! end
5072
5073 !! test
5074 Accept "||" in indented table headings
5075 !! wikitext
5076 :{|
5077 !h1 || h2
5078 |}
5079 !! html
5080 <dl><dd><table>
5081 <tr>
5082 <th>h1 </th>
5083 <th> h2
5084 </th></tr></table></dd></dl>
5085
5086 !! end
5087
5088 !! test
5089 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5090 !! wikitext
5091 {|
5092 !| h1
5093 || a
5094 |}
5095 !! html
5096 <table>
5097 <tr>
5098 <th> h1
5099 </th>
5100 <td> a
5101 </td></tr></table>
5102
5103 !! end
5104
5105 !!test
5106 Accept "| !" at start of line in tables (ignore !-attribute)
5107 !! wikitext
5108 {|
5109 |-
5110 | !style="color:red" | bar
5111 |}
5112 !! html
5113 <table>
5114
5115 <tr>
5116 <td> bar
5117 </td></tr></table>
5118
5119 !!end
5120
5121 !!test
5122 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 +/-
5123 !! wikitext
5124 {|
5125 |-
5126 |style='color:red;'|+1
5127 |style='color:blue;'|-1
5128 |-
5129 | 1 || 2 || 3
5130 | 1 ||+2 ||-3
5131 |-
5132 | +1
5133 | -1
5134 |}
5135 !! html
5136 <table>
5137
5138 <tr>
5139 <td style="color:red;">+1
5140 </td>
5141 <td style="color:blue;">-1
5142 </td></tr>
5143 <tr>
5144 <td> 1 </td>
5145 <td> 2 </td>
5146 <td> 3
5147 </td>
5148 <td> 1 </td>
5149 <td>+2 </td>
5150 <td>-3
5151 </td></tr>
5152 <tr>
5153 <td> +1
5154 </td>
5155 <td> -1
5156 </td></tr></table>
5157
5158 !!end
5159
5160 !! test
5161 Table rowspan
5162 !! wikitext
5163 {| border=1
5164 | Cell 1, row 1
5165 |rowspan=2| Cell 2, row 1 (and 2)
5166 | Cell 3, row 1
5167 |-
5168 | Cell 1, row 2
5169 | Cell 3, row 2
5170 |}
5171 !! html
5172 <table border="1">
5173 <tr>
5174 <td> Cell 1, row 1
5175 </td>
5176 <td rowspan="2"> Cell 2, row 1 (and 2)
5177 </td>
5178 <td> Cell 3, row 1
5179 </td></tr>
5180 <tr>
5181 <td> Cell 1, row 2
5182 </td>
5183 <td> Cell 3, row 2
5184 </td></tr></table>
5185
5186 !! end
5187
5188 !! test
5189 Nested table
5190 !! wikitext
5191 {| border=1
5192 | &alpha;
5193 |
5194 {| bgcolor=#ABCDEF border=2
5195 |nested
5196 |-
5197 |table
5198 |}
5199 |the original table again
5200 |}
5201 !! html
5202 <table border="1">
5203 <tr>
5204 <td> &#945;
5205 </td>
5206 <td>
5207 <table bgcolor="#ABCDEF" border="2">
5208 <tr>
5209 <td>nested
5210 </td></tr>
5211 <tr>
5212 <td>table
5213 </td></tr></table>
5214 </td>
5215 <td>the original table again
5216 </td></tr></table>
5217
5218 !! end
5219
5220 !! test
5221 Invalid attributes in table cell (bug 1830)
5222 !! wikitext
5223 {|
5224 |Cell:|broken
5225 |}
5226 !! html
5227 <table>
5228 <tr>
5229 <td>broken
5230 </td></tr></table>
5231
5232 !! end
5233
5234
5235 # The "|}" to close the table is missing from the input, so parsoid's
5236 # *2wt modes will fail.
5237 !! test
5238 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5239 !! options
5240 parsoid=wt2html,html2html
5241 !! wikitext
5242 {|
5243 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5244 !! html/php
5245 <table>
5246 <tr>
5247 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5248 <td>]" onmouseover="alert(document.cookie)"&gt;test
5249 </td>
5250 </tr>
5251 </table>
5252
5253 !! html/parsoid
5254 <table><tbody>
5255 <tr>
5256 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5257 !! end
5258
5259
5260 !! test
5261 Indented table markup mixed with indented pre content (proposed in bug 6200)
5262 !! wikitext
5263 <table>
5264 <tr>
5265 <td>
5266 Text that should be rendered preformatted
5267 </td>
5268 </tr>
5269 </table>
5270 !! html
5271 <table>
5272 <tr>
5273 <td>
5274 <pre>Text that should be rendered preformatted
5275 </pre>
5276 </td>
5277 </tr>
5278 </table>
5279
5280 !! end
5281
5282 !! test
5283 Template-generated table cell attributes and cell content
5284 !! wikitext
5285 {|
5286 |{{table_attribs}}
5287 | {{table_attribs}}
5288 |}
5289 !! html
5290 <table>
5291 <tr>
5292 <td style="color: red"> Foo
5293 </td>
5294 <td style="color: red"> Foo
5295 </td></tr></table>
5296
5297 !! end
5298
5299 !! test
5300 Template-generated table cell attributes and cell content (2)
5301 !! wikitext
5302 {|
5303 |align=center {{table_attribs}}
5304 |}
5305 !! html
5306 <table>
5307 <tr>
5308 <td align="center" style="color: red"> Foo
5309 </td></tr></table>
5310
5311 !! end
5312
5313 !! test
5314 Template-generated table cell attributes and cell content (3)
5315 !! wikitext
5316 {|
5317 |align=center {{table_cells}}
5318 |}
5319 !! html
5320 <table>
5321 <tr>
5322 <td align="center" style="color: red"> Foo </td>
5323 <td> Bar </td>
5324 <td> Baz
5325 </td></tr></table>
5326
5327 !! end
5328
5329 !! test
5330 Table with row followed by newlines and table heading
5331 !! wikitext
5332 {|
5333 |-
5334
5335 ! foo
5336 |}
5337 !! html
5338 <table>
5339
5340
5341 <tr>
5342 <th> foo
5343 </th></tr></table>
5344
5345 !! end
5346
5347 !! test
5348 Table with empty line following the start tag
5349 !! wikitext
5350 {|
5351
5352 |-
5353 | foo
5354 |}
5355 !! html
5356 <table>
5357
5358
5359 <tr>
5360 <td> foo
5361 </td></tr></table>
5362
5363 !! end
5364
5365 # FIXME: Preserve the attribute properly (with an empty string as value) in
5366 # the PHP parser. Parsoid implements the behavior below.
5367 !! test
5368 Table attributes with empty value
5369 !! wikitext
5370 {|
5371 | style=| hello
5372 |}
5373 !! html/parsoid
5374 <table>
5375 <tbody>
5376 <tr>
5377 <td style=""> hello
5378 </td></tr></tbody></table>
5379
5380 !! end
5381
5382 !! test
5383 Wikitext table with a lot of comments
5384 !! wikitext
5385 {|
5386 <!-- c0 -->
5387 | foo
5388 <!-- c1 -->
5389 |- <!-- c2 -->
5390 <!-- c3 -->
5391 |<!-- c4 -->
5392 <!-- c5 -->
5393 |}
5394 !! html
5395 <table>
5396 <tr>
5397 <td> foo
5398 </td></tr>
5399 <tr>
5400 <td>
5401 </td></tr></table>
5402
5403 !! end
5404
5405 !! test
5406 Wikitext table with double-line table cell
5407 !! wikitext
5408 {|
5409 |a
5410 b
5411 |}
5412 !! html
5413 <table>
5414 <tr>
5415 <td>a
5416 <p>b
5417 </p>
5418 </td></tr></table>
5419
5420 !! end
5421
5422 !! test
5423 Table cell with a single comment
5424 !! wikitext
5425 {|
5426 | <!-- c1 -->
5427 | a
5428 |}
5429 !! html
5430 <table>
5431 <tr>
5432 <td>
5433 </td>
5434 <td> a
5435 </td></tr></table>
5436
5437 !! end
5438
5439 # The expected HTML structure in this test is debatable. The PHP parser does
5440 # not parse this kind of table at all. The main focus for Parsoid is on
5441 # round-tripping, so this output is ok for now. TODO: revisit!
5442 !! test
5443 Wikitext table with html-syntax row
5444 !! wikitext
5445 {|
5446 |-
5447 <td>foo</td>
5448 |}
5449 !! html/parsoid
5450 <table>
5451 <tbody>
5452 <tr>
5453 <td>foo</td></tr></tbody></table>
5454 !! end
5455
5456 !! test
5457 Implicit <td> after a |-
5458 (PHP parser relies on Tidy to add the missing <td> tags)
5459 !! options
5460 parsoid=wt2html,wt2wt
5461 !! wikitext
5462 {|
5463 |-
5464 a
5465 |}
5466 !! html
5467 <table>
5468 <tr><td>a</td></tr>
5469 </table>
5470 !! end
5471
5472 !! test
5473 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
5474 (PHP parser relies on Tidy to add the missing <td> tags)
5475 !! options
5476 parsoid=wt2html,wt2wt
5477 !! wikitext
5478 {|
5479 |-
5480 |
5481 a
5482 |-
5483 b
5484 |}
5485 !! html
5486 <table>
5487 <tbody>
5488 <tr><td><pre>a</pre></td></tr>
5489 <tr><td> b</td></tr>
5490 </tbody>
5491 </table>
5492 !! end
5493
5494 !! test
5495 Lists should be recognized in an implicit <td> context
5496 (PHP parser relies on Tidy to add the missing <td> tags)
5497 !! options
5498 parsoid=wt2html,wt2wt
5499 !! wikitext
5500 {|
5501 |-
5502 *a
5503 |}
5504 !! html
5505 <table>
5506 <tr>
5507 <td><ul>
5508 <li>a</li>
5509 </ul></td>
5510 </tr>
5511 </table>
5512 !! end
5513
5514 !! test
5515 Parsoid: Round-trip tables directly followed by content (bug 51219)
5516 !! options
5517 parsoid=wt2html,wt2wt
5518 !! wikitext
5519 {|
5520 |foo
5521 |} bar
5522
5523 {|
5524 |baz
5525 |}<b>quux</b>
5526 !! html
5527 <table><tbody>
5528 <tr>
5529 <td>foo</td></tr></tbody></table> bar
5530 <table>
5531 <tbody>
5532 <tr>
5533 <td>baz</td></tr></tbody></table><b>quux</b>
5534 !! end
5535
5536 !! test
5537 Parsoid: Default to a newline after tables in new content (bug 51219)
5538 !! options
5539 parsoid=html2wt
5540 !! wikitext
5541 {|
5542 |foo
5543 |}
5544 <nowiki> </nowiki>bar
5545 {|
5546 |baz
5547 |}
5548 '''quux'''
5549 !! html
5550 <table><tbody>
5551 <tr><td>foo</td></tr></tbody></table> bar
5552 <table><tbody>
5553 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5554 !! end
5555
5556 !! test
5557 Parsoid: newline inducing block nodes don't suppress <nowiki>
5558 !! options
5559 parsoid=html2wt
5560 !! wikitext
5561 <nowiki> </nowiki>a
5562
5563 = foo =
5564 !! html
5565 a<h1>foo</h1>
5566 !! end
5567
5568 !! test
5569 Parsoid: Row-syntax table headings followed by comment & table cells
5570 !! options
5571 parsoid=wt2html,wt2wt
5572 !! wikitext
5573 {|
5574 ! foo || bar
5575 <!-- foo --> || baz || quux
5576 |}
5577 !! html/parsoid
5578 <table>
5579 <tbody>
5580 <tr><th>foo </th><th>bar </th>
5581 <td>baz </td>
5582 <td>quux</td></tr></tbody></table>
5583 !! end
5584
5585
5586 !!test
5587 Parsoid: Recover better from broken table attributes
5588 !!options
5589 parsoid=wt2html
5590 !!wikitext
5591 {| class="foo
5592 | class="bar" |
5593 foo
5594 |}
5595 !!html/parsoid
5596 <table class="foo">
5597 <tr>
5598 <td class="bar">
5599 <p>foo</p></td></tr>
5600 </tbody></table>
5601 !!end
5602
5603 ###
5604 ### Internal links
5605 ###
5606 !! test
5607 Plain link, capitalized
5608 !! wikitext
5609 [[Main Page]]
5610 !! html
5611 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5612 </p>
5613 !! end
5614
5615 !! test
5616 Plain link, uncapitalized
5617 !! wikitext
5618 [[main Page]]
5619 !! html
5620 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
5621 </p>
5622 !! end
5623
5624 !! test
5625 Piped link
5626 !! wikitext
5627 [[Main Page|The Main Page]]
5628 !! html
5629 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5630 </p>
5631 !! end
5632
5633 !! test
5634 Piped link with comment in link text
5635 !! wikitext
5636 [[Main Page|The Main<!--front--> Page]]
5637 !! html
5638 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5639 </p>
5640 !! end
5641
5642 !! test
5643 Piped link with multiple pipe characters in link text
5644 !! wikitext
5645 [[Main Page||The|Main|Page|]]
5646 !! html/php
5647 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
5648 </p>
5649 !! html/parsoid
5650 <p><a rel="mw:WikiLink" href="Main_Page">|The|Main|Page|</a></p>
5651 !! end
5652
5653 !! test
5654 Broken link
5655 !! wikitext
5656 [[Zigzagzogzagzig]]
5657 !! html
5658 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
5659 </p>
5660 !! end
5661
5662 !! test
5663 Broken link with fragment
5664 !! wikitext
5665 [[Zigzagzogzagzig#zug]]
5666 !! html
5667 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5668 </p>
5669 !! end
5670
5671 !! test
5672 Special page link with fragment
5673 !! wikitext
5674 [[Special:Version#anchor]]
5675 !! html
5676 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5677 </p>
5678 !! end
5679
5680 !! test
5681 Nonexistent special page link with fragment
5682 !! wikitext
5683 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5684 !! html
5685 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5686 </p>
5687 !! end
5688
5689 !! test
5690 Link with prefix
5691 !! wikitext
5692 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5693 !! html
5694 <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>
5695 </p>
5696 !! end
5697
5698 !! test
5699 Link with suffix
5700 !! wikitext
5701 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5702 !! html
5703 <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>!!!
5704 </p>
5705 !! end
5706
5707 !! article
5708 prefixed article
5709 !! text
5710 Some text
5711 !! endarticle
5712
5713 !! test
5714 Bug 43661: Piped links with identical prefixes
5715 !! wikitext
5716 [[prefixed article|prefixed articles with spaces]]
5717
5718 [[prefixed article|prefixed articlesaoeu]]
5719
5720 [[Main Page|Main Page test]]
5721 !! html
5722 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5723 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5724 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5725 </p>
5726 !! end
5727
5728
5729 !! test
5730 Link with HTML entity in suffix / tail
5731 !! wikitext
5732 [[Main Page]]&quot;, [[Main Page]]&#97;
5733 !! html
5734 <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;
5735 </p>
5736 !! end
5737
5738 !! test
5739 Link with 3 brackets
5740 !! wikitext
5741 [[[Main Page]]]
5742 !! html
5743 <p>[[[Main Page]]]
5744 </p>
5745 !! end
5746
5747 !! test
5748 Link with 4 brackets
5749 !! wikitext
5750 [[[[Main Page]]]]
5751 !! html
5752 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5753 </p>
5754 !! end
5755
5756 !! test
5757 Piped link with 3 brackets
5758 !! wikitext
5759 [[[main page|the main page]]]
5760 !! html
5761 <p>[[[main page|the main page]]]
5762 </p>
5763 !! end
5764
5765 !! test
5766 Piped link with extlink-like text
5767 !! wikitext
5768 [[Main Page|[bar]]]
5769 [[Main Page|This is a [bar]]]
5770 !! html
5771 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5772 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5773 </p>
5774 !! end
5775
5776 !! test
5777 Link with multiple pipes
5778 !! wikitext
5779 [[Main Page|The|Main|Page]]
5780 !! html
5781 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5782 </p>
5783 !! end
5784
5785 !! test
5786 Link to namespaces
5787 !! wikitext
5788 [[Talk:Parser testing]], [[Meta:Disclaimers]]
5789 !! html
5790 <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>
5791 </p>
5792 !! end
5793
5794 !! test
5795 Link with space in namespace
5796 !! wikitext
5797 [[User talk:Foo bar]]
5798 !! html
5799 <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
5800 </p>
5801 !! end
5802
5803 !! article
5804 MemoryAlpha:AlphaTest
5805 !! text
5806 This is an article in the MemoryAlpha namespace
5807 (which shadows the memoryalpha interwiki link).
5808 !! endarticle
5809
5810 !! test
5811 Namespace takes precedence over interwiki link (bug 51680)
5812 !! wikitext
5813 [[MemoryAlpha:AlphaTest]]
5814 !! html
5815 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5816 </p>
5817 !! end
5818
5819 # The previous test doesn't work correctly in html2*, due to not recognizing the
5820 # link as an internal one. This one checks for the correct behavior.
5821 !! test
5822 Link to namespace preferred over interwiki with correct rel attribute
5823 !! options
5824 parsoid=html2wt,html2html
5825 !! wikitext
5826 [[MemoryAlpha:AlphaTest]]
5827 !! html
5828 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5829 </p>
5830 !! end
5831
5832 !! test
5833 Piped link to namespace
5834 !! wikitext
5835 [[Meta:Disclaimers|The disclaimers]]
5836 !! html
5837 <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>
5838 </p>
5839 !! end
5840
5841 !! test
5842 Link containing }
5843 !! wikitext
5844 [[Usually caused by a typo (oops}]]
5845 !! html
5846 <p>[[Usually caused by a typo (oops}]]
5847 </p>
5848 !! end
5849
5850 !! article
5851 7% Solution
5852 !! text
5853 Just a test of an article title containing a percent.
5854 !! endarticle
5855
5856 !! test
5857 Link containing % (not as a hex sequence)
5858 !! wikitext
5859 [[7% Solution]]
5860 !! html/php
5861 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5862 </p>
5863 !! html/parsoid
5864 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5865 !! end
5866
5867 # note that the parsoid HTML is identical to the previous test output,
5868 # so the previous test ensures that the html2wt mode will generate the
5869 # "not as a hex sequence" wikitext.
5870 !! test
5871 Link containing % as a single hex sequence interpreted to char
5872 !! options
5873 parsoid=wt2wt,wt2html,html2html
5874 !! wikitext
5875 [[7%25 Solution]]
5876 !! html/php
5877 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5878 </p>
5879 !! html/parsoid
5880 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5881 !!end
5882
5883 !! test
5884 Link containing % as a double hex sequence interpreted to hex sequence
5885 !! wikitext
5886 [[7%2525 Solution]]
5887 !! html
5888 <p>[[7%2525 Solution]]
5889 </p>
5890 !!end
5891
5892 # note that parsoid does not munge anchor text; all non-space
5893 # characters are valid in HTML5 anchors.
5894 !! test
5895 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
5896 Example for such a section: == < ==
5897 !! wikitext
5898 [[%23%3c]][[%23%3e]]
5899 !! html/php
5900 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5901 </p>
5902 !! html/parsoid
5903 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E">#></a></p>
5904 !! end
5905
5906 !! test
5907 Link containing "<#" and ">#" as a hex sequences
5908 !! wikitext
5909 [[%3c%23]][[%3e%23]]
5910 !! html
5911 <p>[[%3c%23]][[%3e%23]]
5912 </p>
5913 !! end
5914
5915 !! test
5916 Link containing an equals sign
5917 !! wikitext
5918 [[Special:BookSources/isbn=4-00-026157-6]]
5919 !! html/php
5920 <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>
5921 </p>
5922 !! html/parsoid
5923 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
5924 !! end
5925
5926 !! article
5927 Foo~bar
5928 !! text
5929 Just a test of an article title containing a tilde.
5930 !! endarticle
5931
5932 # note that links containing signatures, like [[Foo~~~~]], are
5933 # massaged by the pre-save transform (PST) and so the tildes are never
5934 # seen by the parser.
5935 !! test
5936 Link containing a tilde
5937 !! wikitext
5938 [[Foo~bar]]
5939 !! html/php
5940 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5941 </p>
5942 !! html/parsoid
5943 <p><a rel="mw:WikiLink" href="./Foo~bar">Foo~bar</a></p>
5944 !! end
5945
5946 !! test
5947 Link containing double-single-quotes '' (bug 4598)
5948 !! wikitext
5949 [[Lista d''e paise d''o munno]]
5950 !! html/php
5951 <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>
5952 </p>
5953 !! html/parsoid
5954 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno">Lista d''e paise d''o munno</a></p>
5955 !! end
5956
5957 !! test
5958 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5959 !! wikitext
5960 Some [[Link|pretty ''italics'' and stuff]]!
5961 !! html/php
5962 <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>!
5963 </p>
5964 !! html/parsoid
5965 <p>Some <a rel="mw:WikiLink" href="Link">pretty <i>italics</i> and stuff</a>!</p>
5966 !! end
5967
5968 !! test
5969 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5970 !! wikitext
5971 ''Some [[Link|pretty ''italics'' and stuff]]!''
5972 !! html
5973 <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>
5974 </p>
5975 !! end
5976
5977 !! test
5978 Link with double quotes in title part (literal) and alternate part (interpreted)
5979 !! wikitext
5980 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5981
5982 [[''Pentecoste'']]
5983
5984 [[''Pentecoste''|Pentecoste]]
5985
5986 [[''Pentecoste''|''Pentecoste'']]
5987 !! html/php
5988 <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>
5989 </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>
5990 </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>
5991 </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>
5992 </p>
5993 !! html/parsoid
5994 <meta typeof="mw:Placeholder"/>
5995 <p><a rel="mw:WikiLink" href="''Pentecoste''">''Pentecoste''</a></p>
5996 <p><a rel="mw:WikiLink" href="''Pentecoste''">Pentecoste</a></p>
5997 <p><a rel="mw:WikiLink" href="''Pentecoste''"><i>Pentecoste</i></a></p>
5998 !! end
5999
6000 !! test
6001 Broken image links with HTML captions (bug 39700)
6002 !! wikitext
6003 [[File:Nonexistent|<script></script>]]
6004 [[File:Nonexistent|100px|<script></script>]]
6005 [[File:Nonexistent|&lt;]]
6006 [[File:Nonexistent|a<i>b</i>c]]
6007 !! html
6008 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6009 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6010 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6011 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6012 </p>
6013 !! end
6014
6015 !! test
6016 Plain link to URL
6017 !! wikitext
6018 [[http://www.example.com]]
6019 !! html/php
6020 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6021 </p>
6022 !! html/parsoid
6023 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6024 !! end
6025
6026 !! test
6027 Plain link to URL with link text
6028 !! wikitext
6029 [[http://www.example.com Link text]]
6030 !! html
6031 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6032 </p>
6033 !! end
6034
6035 !! test
6036 Plain link to protocol-relative URL
6037 !! wikitext
6038 [[//www.example.com]]
6039 !! html/php
6040 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6041 </p>
6042 !! html/parsoid
6043 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6044 !! end
6045
6046 !! test
6047 Plain link to protocol-relative URL with link text
6048 !! wikitext
6049 [[//www.example.com Link text]]
6050 !! html
6051 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6052 </p>
6053 !! end
6054
6055 !! test
6056 Plain link to page with question mark in title
6057 !! wikitext
6058 [[A?b]]
6059
6060 [[A?b|Baz]]
6061 !! html
6062 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6063 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6064 </p>
6065 !! end
6066
6067
6068 # I'm fairly sure the expected result here is wrong.
6069 # We want these to be URL links, not pseudo-pages with URLs for titles....
6070 # However the current output is also pretty screwy.
6071 #
6072 # ----
6073 # I'm changing it to match the current output--it arguably makes more
6074 # sense in the light of the test above. Old expected result was:
6075 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6076 #</p>
6077 # But I think this test is bordering on "garbage in, garbage out" anyway.
6078 # -- wtm
6079 !! test
6080 Piped link to URL
6081 !! wikitext
6082 Piped link to URL: [[http://www.example.com|an example URL]]
6083 !! html/php
6084 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6085 </p>
6086 !! html/parsoid
6087 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6088 !! end
6089
6090 !! test
6091 BUG 2: [[page|http://url/]] should link to page, not http://url/
6092 !! wikitext
6093 [[Main Page|http://url/]]
6094 !! html/php
6095 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6096 </p>
6097 !! html/parsoid
6098 <p><a rel="mw:WikiLink" href="./Main_Page">http://url/</a></p>
6099 !! end
6100
6101 # Parsoid does not mark self-links, by design.
6102 !! test
6103 BUG 337: Escaped self-links should be bold
6104 !! options
6105 title=[[Bug462]]
6106 !! wikitext
6107 [[Bu&#103;462]] [[Bug462]]
6108 !! html/php
6109 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6110 </p>
6111 !! html/parsoid
6112 <p><a rel="mw:WikiLink" href="./Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462">Bug462</a></p>
6113 !! end
6114
6115 !! test
6116 Self-link to section should not be bold
6117 !! options
6118 title=[[Main Page]]
6119 !! wikitext
6120 [[Main Page#section]]
6121 !! html
6122 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6123 </p>
6124 !! end
6125
6126 !! article
6127 00
6128 !! text
6129 This is 00.
6130 !! endarticle
6131
6132 !!test
6133 Self-link to numeric title
6134 !!options
6135 title=[[0]]
6136 !! wikitext
6137 [[0]]
6138 !! html
6139 <p><strong class="selflink">0</strong>
6140 </p>
6141 !!end
6142
6143 !!test
6144 Link to numeric-equivalent title
6145 !!options
6146 title=[[0]]
6147 !! wikitext
6148 [[00]]
6149 !! html
6150 <p><a href="/wiki/00" title="00">00</a>
6151 </p>
6152 !!end
6153
6154 !! test
6155 <nowiki> inside a link
6156 !! wikitext
6157 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6158 !! html
6159 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6160 </p>
6161 !! end
6162
6163 !! test
6164 Non-breaking spaces in title
6165 !! wikitext
6166 [[&nbsp; Main &nbsp; Page &nbsp;]]
6167 !! html
6168 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6169 </p>
6170 !!end
6171
6172 !! test
6173 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6174 !! options
6175 language=ca
6176 !! wikitext
6177 '''[[Main Page]]'''
6178 !! html
6179 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6180 </p>
6181 !! end
6182
6183 !! test
6184 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6185 !! options
6186 language=ca
6187 !! wikitext
6188 ''[[Main Page]]''
6189 !! html
6190 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6191 </p>
6192 !! end
6193
6194 !! test
6195 Internal link with en linktrail: no apostrophes (bug 27473)
6196 !! options
6197 language=en
6198 !! wikitext
6199 [[Something]]'nice
6200 !! html
6201 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6202 </p>
6203 !! end
6204
6205 !! test
6206 Internal link with ca linktrail with apostrophes (bug 27473)
6207 !! options
6208 language=ca
6209 !! wikitext
6210 [[Something]]'nice
6211 !! html
6212 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6213 </p>
6214 !! end
6215
6216 !! test
6217 Internal link with kaa linktrail with apostrophes (bug 27473)
6218 !! options
6219 language=kaa
6220 !! wikitext
6221 [[Something]]'nice
6222 !! html
6223 <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>
6224 </p>
6225 !! end
6226
6227 !! test
6228 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6229 !! wikitext
6230 [[User:Foo/Test/63636:Bar|Test]]
6231 !! html/php
6232 <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>
6233 </p>
6234 !! html/parsoid
6235 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar">Test</a></p>
6236 !! end
6237
6238 !! test
6239 1. Interaction of linktrail and template encapsulation
6240 !! options
6241 parsoid
6242 !! wikitext
6243 {{echo|[[Foo]]}}l
6244 !! html
6245 <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>
6246 !! end
6247
6248 !! test
6249 2. Interaction of linktrail and template encapsulation
6250 !! options
6251 parsoid
6252 !! wikitext
6253 {{echo|Some [[Fool]]}}s
6254 !! html
6255 <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>
6256 !! end
6257
6258 !! test
6259 3. Interaction of linktrail and template encapsulation
6260 !! options
6261 parsoid
6262 !! wikitext
6263 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6264 !! html
6265 <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>
6266 !! end
6267
6268 !! article
6269 Söfnuður
6270 !! text
6271 Test.
6272 !! endarticle
6273
6274 !! test
6275 Internal link with is link prefix
6276 !! options
6277 language=is
6278 !! wikitext
6279 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6280 !! html
6281 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6282 </p>
6283 !! end
6284
6285 !! article
6286 Mótmælendatrú
6287 !! text
6288 Test.
6289 !! endarticle
6290
6291 !! test
6292 Internal link with is link trail and link prefix
6293 !! options
6294 language=is
6295 !! wikitext
6296 [[mótmælendatrú|xxx]]ar
6297 [[mótmælendatrú]]ar
6298 mótmælenda[[söfnuður]]
6299 mótmælenda[[söfnuður|söfnuðir]]
6300 mótmælenda[[söfnuður|söfnuðir]]xxx
6301 !! html
6302 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6303 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6304 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6305 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6306 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6307 </p>
6308 !! end
6309
6310 !! test
6311 Parsoid link trail escaping
6312 !! options
6313 parsoid=html2wt,html2html
6314 !! wikitext
6315 [[apple]]<nowiki/>s
6316 !! html
6317 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
6318 !! end
6319
6320 !! test
6321 Parsoid link prefix escaping
6322 !! options
6323 language=is
6324 parsoid=html2wt,html2html
6325 !! wikitext
6326 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6327 !! html
6328 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
6329 !! end
6330
6331 !! test
6332 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6333 !! wikitext
6334 [[Foo| bar]]
6335
6336 [[Foo| ''bar'']]
6337
6338 [http://wp.org foo]
6339
6340 [http://wp.org ''foo'']
6341 !! html
6342 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
6343 </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>
6344 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6345 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6346 </p>
6347 !! end
6348
6349 !! test
6350 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6351 !! options
6352 parsoid
6353 !! wikitext
6354 [[Foo|{{echo|a}} b {{echo|c}}]]
6355 !! html
6356 <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>
6357 !! end
6358
6359 ###
6360 ### Interwiki links (see maintenance/interwiki.sql)
6361 ###
6362
6363 !! test
6364 Inline interwiki link
6365 !! wikitext
6366 [[MeatBall:SoftSecurity]]
6367 !! html
6368 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6369 </p>
6370 !! end
6371
6372 !! test
6373 Inline interwiki link with empty title (bug 2372)
6374 !! wikitext
6375 [[MeatBall:]]
6376 !! html
6377 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6378 </p>
6379 !! end
6380
6381 !! test
6382 Interwiki link encoding conversion (bug 1636)
6383 !! wikitext
6384 *[[Wikipedia:ro:Olteni&#0355;a]]
6385 *[[Wikipedia:ro:Olteni&#355;a]]
6386 !! html
6387 <ul>
6388 <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>
6389 </li>
6390 <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>
6391 </li>
6392 </ul>
6393
6394 !! end
6395
6396 !! test
6397 Interwiki link with fragment (bug 2130)
6398 !! wikitext
6399 [[MeatBall:SoftSecurity#foo]]
6400 !! html
6401 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6402 </p>
6403 !! end
6404
6405 # Ideally the wikipedia: prefix here should be proto-relative too
6406 !! test
6407 Different interwiki prefixes mapping to the same URL
6408 !! wikitext
6409 [[:en:Foo]]
6410
6411 [[:en:Foo|Foo]]
6412
6413 [[wikipedia:Foo]]
6414
6415 [[:wikipedia:Foo|Foo]]
6416
6417 [[wikipedia:en:Foo]]
6418
6419 [[:wikipedia:en:Foo]]
6420 !! html/parsoid
6421 <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>
6422
6423 <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>
6424
6425 <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>
6426
6427 <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>
6428
6429 <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>
6430
6431 <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>
6432 !! end
6433
6434 !! test
6435 Interwiki links that cannot be represented in wiki syntax
6436 !! wikitext
6437 [[meatball:ok]]
6438 [[meatball:ok#foo|ok with fragment]]
6439 [[meatball:ok_as_well?|ok ending with ? mark]]
6440 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6441 [http://de.wikipedia.org/wiki/#foo is just fragment]
6442
6443 !! html/parsoid
6444 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
6445 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
6446 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?">ok ending with ? mark</a>
6447 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6448 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6449 !! end
6450
6451 !! test
6452 Interwiki links: trail
6453 !! options
6454 parsoid
6455 !! wikitext
6456 [[wikipedia:Foo|Ba]]r
6457 !! html
6458 <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>
6459 !! end
6460
6461 ###
6462 ### Interlanguage links
6463 ### Language links (so that searching for '### language' matches..)
6464 ###
6465
6466 !! test
6467 Interlanguage link
6468 !! wikitext
6469 Blah blah blah
6470 [[zh:Chinese]]
6471 !! html
6472 <p>Blah blah blah
6473 </p>
6474 !! end
6475
6476 !! test
6477 Double interlanguage link
6478 !! wikitext
6479 Blah blah blah
6480 [[es:Spanish]]
6481 [[zh:Chinese]]
6482 !! html
6483 <p>Blah blah blah
6484 </p>
6485 !! end
6486
6487 !! test
6488 Interlanguage link, with prefix links
6489 !! options
6490 language=ln
6491 !! wikitext
6492 Blah blah blah
6493 [[zh:Chinese]]
6494 !! html
6495 <p>Blah blah blah
6496 </p>
6497 !! end
6498
6499 !! test
6500 Double interlanguage link, with prefix links (bug 8897)
6501 !! options
6502 language=ln
6503 !! wikitext
6504 Blah blah blah
6505 [[es:Spanish]]
6506 [[zh:Chinese]]
6507 !! html
6508 <p>Blah blah blah
6509 </p>
6510 !! end
6511
6512 !! test
6513 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
6514 !! options
6515 language=ln
6516 !! wikitext
6517 [[WW&nbsp;II]]
6518 !! html
6519 <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>
6520 </p>
6521 !! end
6522
6523 !! test
6524 Parsoid bug 53221: Wikilinks should be properly entity-escaped
6525 !! options
6526 parsoid=html2wt
6527 !! wikitext
6528 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
6529
6530 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
6531 !! html
6532 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6533 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6534 !! end
6535
6536 !! test
6537 Parsoid: handle constructor well
6538 !! options
6539 parsoid
6540 !! wikitext
6541 [[constructor]]
6542
6543 [[constructor:foo]]
6544 !! html
6545 <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>
6546
6547 <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>
6548 !! end
6549
6550 !! test
6551 Parsoid: recognize interlanguage links without a target page
6552 !! options
6553 parsoid
6554 !! wikitext
6555 [[ko:]]
6556 !! html
6557 <p><link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
6558 !! end
6559
6560 !! test
6561 Parsoid: recognize interwiki links without a target page
6562 !! options
6563 parsoid
6564 !! wikitext
6565 [[:ko:]]
6566 !! html
6567 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
6568 !! end
6569
6570 !! test
6571 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
6572 !! options
6573 parsoid
6574 !! wikitext
6575 [[en:Foo]]
6576 !! html
6577 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
6578 !! end
6579
6580 ###
6581 ### Redirects, Parsoid-only
6582 ###
6583 !! test
6584 1. Simple redirect to page
6585 !! options
6586 parsoid
6587 !! wikitext
6588 #REDIRECT [[Main Page]]
6589 !! html
6590 <link rel="mw:PageProp/redirect" href="./Main_Page">
6591 !! end
6592
6593 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
6594 !! test
6595 2. Other redirect variants
6596 !! options
6597 parsoid=wt2html,wt2wt
6598 !! wikitext
6599 #REDIRECT [[Main_Page]]
6600 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
6601 !! html
6602 <link rel="mw:PageProp/redirect" href="./Main_Page">
6603 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
6604 !! end
6605
6606 !! test
6607 Empty redirect
6608 !! options
6609 parsoid=wt2html,wt2wt
6610 !! wikitext
6611 #REDIRECT [[]]
6612 !! html
6613 <ol>
6614 <li>REDIRECT [[]]</li></ol>
6615 !! end
6616
6617 !! test
6618 Optional colon in #REDIRECT
6619 !! options
6620 # the colon is archaic syntax. we support it for wt2html, but we
6621 # don't care that it roundtrips back to the modern syntax.
6622 parsoid=wt2html,html2html
6623 !! wikitext
6624 #REDIRECT:[[Main Page]]
6625 !! html
6626 <link rel="mw:PageProp/redirect" href="./Main_Page">
6627 !! end
6628
6629 !! test
6630 Whitespace in #REDIRECT with optional colon
6631 !! options
6632 # the colon and gratuitous whitespace is archaic syntax. we support
6633 # it for wt2html, but we don't care that it roundtrips back to the
6634 # modern syntax (without extra whitespace)
6635 parsoid=wt2html,html2html
6636 !! wikitext
6637
6638 #REDIRECT
6639 :
6640 [[Main Page]]
6641 !! html
6642 <link rel="mw:PageProp/redirect" href="./Main_Page">
6643 !! end
6644
6645 !! test
6646 Piped link in #REDIRECT
6647 !! options
6648 # content after piped link is ignored. we support this syntax,
6649 # but don't care that the piped link is lost when we roundtrip this.
6650 parsoid=wt2html
6651 !! wikitext
6652 #REDIRECT [[Main Page|bar]]
6653 !! html
6654 <link rel="mw:PageProp/redirect" href="./Main_Page">
6655 !! end
6656
6657 !! test
6658 Redirect to category
6659 !! options
6660 parsoid=wt2html
6661 !! wikitext
6662 #REDIRECT [[Category:Foo]]
6663 !! html
6664 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6665 !! end
6666
6667 !! test
6668 Redirect to category with URL encoding
6669 !! options
6670 parsoid=wt2html
6671 !! wikitext
6672 #REDIRECT [[Category%3AFoo]]
6673 !! html
6674 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6675 !! end
6676
6677 !! test
6678 Redirect to category page
6679 !! options
6680 parsoid=wt2html,html2html
6681 !! wikitext
6682 #REDIRECT [[:Category:Foo]]
6683 !! html
6684 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
6685 !! end
6686
6687 !! test
6688 Redirect to image page (1)
6689 !! options
6690 parsoid
6691 !! wikitext
6692 #REDIRECT [[File:Wiki.png]]
6693 !! html
6694 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6695 !! end
6696
6697 !! test
6698 Redirect to image page (2)
6699 !! options
6700 parsoid
6701 !! wikitext
6702 #REDIRECT [[Image:Wiki.png]]
6703 !! html
6704 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6705 !! end
6706
6707 !! test
6708 Redirect to language
6709 !! options
6710 parsoid
6711 !! wikitext
6712 #REDIRECT [[en:File:Wiki.png]]
6713 !! html
6714 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6715 !! end
6716
6717 !! test
6718 Redirect to interwiki
6719 !! options
6720 parsoid
6721 !! wikitext
6722 #REDIRECT [[meatball:File:Wiki.png]]
6723 !! html
6724 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6725 !! end
6726
6727 !! test
6728 Non-English #REDIRECT
6729 !! options
6730 parsoid
6731 language=is
6732 !! wikitext
6733 #TILVÍSUN [[Main Page]]
6734 !! html
6735 <link rel="mw:PageProp/redirect" href="./Main_Page">
6736 !! end
6737
6738 !! test
6739 New redirect
6740 !! options
6741 parsoid=html2wt
6742 !! wikitext
6743 Foo
6744 #REDIRECT [[Foo]]
6745 !! html
6746 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
6747 !! end
6748
6749 ##
6750 ## XHTML tidiness
6751 ###
6752
6753 !! test
6754 <br> to <br />
6755 !! wikitext
6756 1<br>2<br />3
6757 !! html
6758 <p>1<br />2<br />3
6759 </p>
6760 !! end
6761
6762 !! test
6763 Broken br tag sanitization
6764 !! wikitext
6765 </br>
6766 !! html/php
6767 <p>&lt;/br&gt;
6768 </p>
6769 !! end
6770
6771 # TODO: Fix html2html mode (bug 51055)!
6772 !! test
6773 Parsoid: Broken br tag recognition
6774 !! options
6775 parsoid=wt2html
6776 !! wikitext
6777 </br>
6778
6779 <br/ >
6780 !! html/parsoid
6781 <p><br></p>
6782 <p><br/></p>
6783 !! end
6784
6785 !! test
6786 Incorrecly removing closing slashes from correctly formed XHTML
6787 !! wikitext
6788 <br style="clear:both;" />
6789 !! html
6790 <p><br style="clear:both;" />
6791 </p>
6792 !! end
6793
6794 !! test
6795 Failing to transform badly formed HTML into correct XHTML
6796 !! wikitext
6797 <br style="clear: left;">
6798 <br style="clear: right;">
6799 <br style="clear: both;">
6800 !! html
6801 <p><br style="clear: left;" />
6802 <br style="clear: right;" />
6803 <br style="clear: both;" />
6804 </p>
6805 !!end
6806
6807 !! test
6808 Handling html with a div self-closing tag
6809 !! wikitext
6810 <div title />
6811 <div title/>
6812 <div title/ >
6813 <div title=bar />
6814 <div title=bar/>
6815 <div title=bar/ >
6816 !! html
6817 <p>&lt;div title /&gt;
6818 &lt;div title/&gt;
6819 </p>
6820 <div>
6821 <p>&lt;div title=bar /&gt;
6822 &lt;div title=bar/&gt;
6823 </p>
6824 <div title="bar/"></div>
6825 </div>
6826
6827 !! end
6828
6829 !! test
6830 Handling html with a br self-closing tag
6831 !! wikitext
6832 <br title />
6833 <br title/>
6834 <br title/ >
6835 <br title=bar />
6836 <br title=bar/>
6837 <br title=bar/ >
6838 !! html
6839 <p><br title="title" />
6840 <br title="title" />
6841 <br />
6842 <br title="bar" />
6843 <br title="bar" />
6844 <br title="bar/" />
6845 </p>
6846 !! end
6847
6848 !! test
6849 Horizontal ruler (should it add that extra space?)
6850 !! wikitext
6851 <hr>
6852 <hr >
6853 foo <hr
6854 > bar
6855 !! html
6856 <hr />
6857 <hr />
6858 foo <hr /> bar
6859
6860 !! end
6861
6862 !! test
6863 Horizontal ruler -- 4+ dashes render hr
6864 !! wikitext
6865 ----
6866 !! html
6867 <hr />
6868
6869 !! end
6870
6871 !! test
6872 Horizontal ruler -- eats additional dashes on the same line
6873 !! wikitext
6874 ---------
6875 !! html
6876 <hr />
6877
6878 !! end
6879
6880 !! test
6881 Horizontal ruler -- does not collapse dashes on consecutive lines
6882 !! wikitext
6883 ----
6884 ----
6885 !! html
6886 <hr />
6887 <hr />
6888
6889 !! end
6890
6891 !! test
6892 Horizontal ruler -- <4 dashes render as plain text
6893 !! wikitext
6894 ---
6895 !! html
6896 <p>---
6897 </p>
6898 !! end
6899
6900 !! test
6901 Horizontal ruler -- Supports content following dashes on same line
6902 !! wikitext
6903 ---- Foo
6904 !! html
6905 <hr /> Foo
6906
6907 !! end
6908
6909 ###
6910 ### Block-level elements
6911 ###
6912 !! test
6913 Common list
6914 !! wikitext
6915 *Common list
6916 * item 2
6917 *item 3
6918 !! html
6919 <ul>
6920 <li>Common list
6921 </li>
6922 <li> item 2
6923 </li>
6924 <li>item 3
6925 </li>
6926 </ul>
6927
6928 !! end
6929
6930 !! test
6931 Numbered list
6932 !! wikitext
6933 #Numbered list
6934 #item 2
6935 # item 3
6936 !! html
6937 <ol>
6938 <li>Numbered list
6939 </li>
6940 <li>item 2
6941 </li>
6942 <li> item 3
6943 </li>
6944 </ol>
6945
6946 !! end
6947
6948 !! test
6949 Mixed list
6950 !! wikitext
6951 *Mixed list
6952 *# with numbers
6953 ** and bullets
6954 *# and numbers
6955 *bullets again
6956 **bullet level 2
6957 ***bullet level 3
6958 ***#Number on level 4
6959 **bullet level 2
6960 **#Number on level 3
6961 **#Number on level 3
6962 *#number level 2
6963 *Level 1
6964 *** Level 3
6965 #** Level 3, but ordered
6966 !! html
6967 <ul>
6968 <li>Mixed list
6969 <ol>
6970 <li> with numbers
6971 </li>
6972 </ol>
6973 <ul>
6974 <li> and bullets
6975 </li>
6976 </ul>
6977 <ol>
6978 <li> and numbers
6979 </li>
6980 </ol>
6981 </li>
6982 <li>bullets again
6983 <ul>
6984 <li>bullet level 2
6985 <ul>
6986 <li>bullet level 3
6987 <ol>
6988 <li>Number on level 4
6989 </li>
6990 </ol>
6991 </li>
6992 </ul>
6993 </li>
6994 <li>bullet level 2
6995 <ol>
6996 <li>Number on level 3
6997 </li>
6998 <li>Number on level 3
6999 </li>
7000 </ol>
7001 </li>
7002 </ul>
7003 <ol>
7004 <li>number level 2
7005 </li>
7006 </ol>
7007 </li>
7008 <li>Level 1
7009 <ul>
7010 <li><ul>
7011 <li> Level 3
7012 </li>
7013 </ul>
7014 </li>
7015 </ul>
7016 </li>
7017 </ul>
7018 <ol>
7019 <li><ul>
7020 <li><ul>
7021 <li> Level 3, but ordered
7022 </li>
7023 </ul>
7024 </li>
7025 </ul>
7026 </li>
7027 </ol>
7028
7029 !! end
7030
7031 !! test
7032 Nested lists 1
7033 !! wikitext
7034 *foo
7035 **bar
7036 !! html
7037 <ul>
7038 <li>foo
7039 <ul>
7040 <li>bar
7041 </li>
7042 </ul>
7043 </li>
7044 </ul>
7045
7046 !! end
7047
7048 !! test
7049 Nested lists 2
7050 !! wikitext
7051 **foo
7052 *bar
7053 !! html
7054 <ul>
7055 <li><ul>
7056 <li>foo
7057 </li>
7058 </ul>
7059 </li>
7060 <li>bar
7061 </li>
7062 </ul>
7063
7064 !! end
7065
7066 !! test
7067 Nested lists 3 (first element empty)
7068 !! wikitext
7069 *
7070 **bar
7071 !! html
7072 <ul>
7073 <li>
7074 <ul>
7075 <li>bar
7076 </li>
7077 </ul>
7078 </li>
7079 </ul>
7080
7081 !! end
7082
7083 !! test
7084 Nested lists 4 (first element empty)
7085 !! wikitext
7086 **
7087 *bar
7088 !! html
7089 <ul>
7090 <li><ul>
7091 <li>
7092 </li>
7093 </ul>
7094 </li>
7095 <li>bar
7096 </li>
7097 </ul>
7098
7099 !! end
7100
7101 !! test
7102 Nested lists 5 (both elements empty)
7103 !! wikitext
7104 **
7105 *
7106 !! html
7107 <ul>
7108 <li><ul>
7109 <li>
7110 </li>
7111 </ul>
7112 </li>
7113 <li>
7114 </li>
7115 </ul>
7116
7117 !! end
7118
7119 !! test
7120 Nested lists 6 (both elements empty)
7121 !! wikitext
7122 *
7123 **
7124 !! html
7125 <ul>
7126 <li>
7127 <ul>
7128 <li>
7129 </li>
7130 </ul>
7131 </li>
7132 </ul>
7133
7134 !! end
7135
7136 !! test
7137 Nested lists 7 (skip initial nesting levels)
7138 !! wikitext
7139 *** foo
7140 !! html
7141 <ul>
7142 <li><ul>
7143 <li><ul>
7144 <li> foo
7145 </li>
7146 </ul>
7147 </li>
7148 </ul>
7149 </li>
7150 </ul>
7151
7152 !! end
7153
7154 !! test
7155 Nested lists 8 (multiple nesting transitions)
7156 !! wikitext
7157 * foo
7158 *** bar
7159 ** baz
7160 * boo
7161 !! html
7162 <ul>
7163 <li> foo
7164 <ul>
7165 <li><ul>
7166 <li> bar
7167 </li>
7168 </ul>
7169 </li>
7170 <li> baz
7171 </li>
7172 </ul>
7173 </li>
7174 <li> boo
7175 </li>
7176 </ul>
7177
7178 !! end
7179
7180 !! test
7181 1. Lists with start-of-line-transparent tokens before bullets: Comments
7182 !! wikitext
7183 *foo
7184 *<!--cmt-->bar
7185 <!--cmt-->*baz
7186 !! html
7187 <ul>
7188 <li>foo
7189 </li>
7190 <li>bar
7191 </li>
7192 <li>baz
7193 </li>
7194 </ul>
7195
7196 !! end
7197
7198 !! test
7199 2. Lists with start-of-line-transparent tokens before bullets: Template close
7200 !! wikitext
7201 *foo {{echo|bar
7202 }}*baz
7203 !! html
7204 <ul>
7205 <li>foo bar
7206 </li>
7207 <li>baz
7208 </li>
7209 </ul>
7210
7211 !! end
7212
7213 !! test
7214 List items are not parsed correctly following a <pre> block (bug 785)
7215 !! wikitext
7216 * <pre>foo</pre>
7217 * <pre>bar</pre>
7218 * zar
7219 !! html
7220 <ul>
7221 <li> <pre>foo</pre>
7222 </li>
7223 <li> <pre>bar</pre>
7224 </li>
7225 <li> zar
7226 </li>
7227 </ul>
7228
7229 !! end
7230
7231 !! test
7232 List items from template
7233 !! wikitext
7234
7235 {{inner list}}
7236 * item 2
7237
7238 * item 0
7239 {{inner list}}
7240 * item 2
7241
7242 * item 0
7243 * notSOL{{inner list}}
7244 * item 2
7245 !! html
7246 <ul>
7247 <li> item 1
7248 </li>
7249 <li> item 2
7250 </li>
7251 </ul>
7252 <ul>
7253 <li> item 0
7254 </li>
7255 <li> item 1
7256 </li>
7257 <li> item 2
7258 </li>
7259 </ul>
7260 <ul>
7261 <li> item 0
7262 </li>
7263 <li> notSOL
7264 </li>
7265 <li> item 1
7266 </li>
7267 <li> item 2
7268 </li>
7269 </ul>
7270
7271 !! end
7272
7273 !! test
7274 List interrupted by empty line or heading
7275 !! wikitext
7276 * foo
7277
7278 ** bar
7279 == A heading ==
7280 * Another list item
7281 !! html
7282 <ul>
7283 <li> foo
7284 </li>
7285 </ul>
7286 <ul>
7287 <li><ul>
7288 <li> bar
7289 </li>
7290 </ul>
7291 </li>
7292 </ul>
7293 <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>
7294 <ul>
7295 <li> Another list item
7296 </li>
7297 </ul>
7298
7299 !!end
7300
7301 !!test
7302 Multiple list tags generated by templates
7303 !! wikitext
7304 {{echo|<li>}}a
7305 {{echo|<li>}}b
7306 {{echo|<li>}}c
7307 !! html
7308 <li>a
7309 <li>b
7310 <li>c</li>
7311 </li>
7312 </li>
7313
7314 !!end
7315
7316 !!test
7317 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7318 !! wikitext
7319 *a
7320 <!--This line will NOT split the list-->
7321 *b
7322 <!--This line will NOT split the list either-->
7323 *c
7324 <!--foo--> <!----> <!--This line NOT split the list either-->
7325 *d
7326 !! html
7327 <ul>
7328 <li>a
7329 </li>
7330 <li>b
7331 </li>
7332 <li>c
7333 </li>
7334 <li>d
7335 </li>
7336 </ul>
7337
7338 !!end
7339
7340 !!test
7341 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7342 !! wikitext
7343 *a
7344 <!--This line will NOT split the list-->
7345 *b
7346 <!--This line will NOT split the list either-->
7347 *c
7348 <!--foo--> <!----> <!--This line NOT split the list
7349 either-->
7350 *d
7351 !! html
7352 <ul>
7353 <li>a
7354 </li>
7355 <li>b
7356 </li>
7357 <li>c
7358 </li>
7359 <li>d
7360 </li>
7361 </ul>
7362
7363 !!end
7364
7365 !!test
7366 Test the li-hack
7367 (Cannot test this with PHP parser since it relies on Tidy for the hack)
7368 !!options
7369 parsoid=wt2html,wt2wt
7370 !! wikitext
7371 * foo
7372 * <li>li-hack
7373 * {{echo|<li>templated li-hack}}
7374 * <!--foo--> <li> unsupported li-hack with preceding comments
7375
7376 <ul>
7377 <li><li>not a li-hack
7378 </li>
7379 </ul>
7380 !! html
7381 <ul>
7382 <li> foo</li>
7383 <li>li-hack</li>
7384 <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>
7385 <li> <!--foo--> </li>
7386 <li> li-hack with preceding comments</li>
7387 </ul>
7388
7389 <ul>
7390 <li></li>
7391 <li>not a li-hack
7392 </li>
7393 </ul>
7394 !!end
7395
7396 !! test
7397 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
7398 !! options
7399 parsoid
7400 !! wikitext
7401 # foo
7402 ## bar
7403 * foo
7404 ** bar
7405 : foo
7406 :: bar
7407 !! html
7408 <ol>
7409 <li> foo<ol>
7410 <li> bar</li>
7411 </ol></li>
7412 </ol><ul>
7413 <li> foo<ul>
7414 <li> bar</li>
7415 </ul></li>
7416 </ul><dl>
7417 <dd> foo<dl>
7418 <dd> bar</dd>
7419 </dl></dd>
7420 </dl>
7421 !! end
7422
7423 !! test
7424 Parsoid: Test of whitespace serialization with Templated bullets
7425 !! options
7426 parsoid
7427 !! wikitext
7428 * {{bullet}}
7429 !! html
7430 <ul>
7431 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
7432 </ul>
7433 !! end
7434
7435 # ------------------------------------------------------------------------
7436 # The next set of tests are about Parsoid's ability to handle badly nested
7437 # tags (parse, minimize scope of fixup, and roundtrip back)
7438 # ------------------------------------------------------------------------
7439
7440 !! test
7441 Unbalanced closing block tags break a list
7442 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7443 !! wikitext
7444 <div>
7445 *a</div><div>
7446 *b</div>
7447 !! html/parsoid
7448 <div>
7449 <ul>
7450 <li>a
7451 </li>
7452 </ul></div><div>
7453 <ul>
7454 <li>b
7455 </li>
7456 </ul></div>
7457 !! end
7458
7459 !! test
7460 Unbalanced closing non-block tags don't break a list
7461 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7462 !! wikitext
7463 <span>
7464 *a</span><span>
7465 *b</span>
7466 !! html/parsoid
7467 <p><span></span>
7468 </p>
7469 <ul>
7470 <li>a<span></span>
7471 </li>
7472 <li>b
7473 </li>
7474 </ul>
7475 !! end
7476
7477 !! test
7478 Unclosed formatting tags that straddle lists are closed and reopened
7479 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7480 !! wikitext
7481 # <s> a
7482 # b </s>
7483 !! html/parsoid
7484 <ol>
7485 <li> <s> a </s>
7486 </li>
7487 <li> <s> b </s>
7488 </li>
7489 </ol>
7490 !! end
7491
7492 !!test
7493 List embedded in a non-block tag
7494 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
7495 !! wikitext
7496 <small>
7497 * foo
7498 </small>
7499 !! html/parsoid
7500 <p><small></small></p>
7501 <small>
7502 <ul>
7503 <li> foo</li>
7504 </ul>
7505 </small>
7506 <p><small></small></p>
7507 !!end
7508
7509 !! test
7510 Table with missing opening <tr> tag
7511 !! options
7512 parsoid=wt2html,wt2wt
7513 !! wikitext
7514 <table>
7515 <td>foo</td>
7516 </tr>
7517 </table>
7518 !! html/parsoid
7519 <table>
7520 <tr>
7521 <td>foo</td>
7522 </tr>
7523 </table>
7524 !! end
7525
7526 ###
7527 ### Magic Words
7528 ###
7529
7530 # Note that the current date is hard-coded as
7531 # 1970-01-01T00:02:03Z (a Thursday)
7532 # when running parser tests. The timezone is also fixed to GMT, so
7533 # local date will be identical to current date.
7534
7535 !! test
7536 Magic Word: {{CURRENTDAY}}
7537 !! wikitext
7538 {{CURRENTDAY}}
7539 !! html
7540 <p>1
7541 </p>
7542 !! end
7543
7544 !! test
7545 Magic Word: {{CURRENTDAY2}}
7546 !! wikitext
7547 {{CURRENTDAY2}}
7548 !! html
7549 <p>01
7550 </p>
7551 !! end
7552
7553 !! test
7554 Magic Word: {{CURRENTDAYNAME}}
7555 !! wikitext
7556 {{CURRENTDAYNAME}}
7557 !! html
7558 <p>Thursday
7559 </p>
7560 !! end
7561
7562 !! test
7563 Magic Word: {{CURRENTDOW}}
7564 !! wikitext
7565 {{CURRENTDOW}}
7566 !! html
7567 <p>4
7568 </p>
7569 !! end
7570
7571 !! test
7572 Magic Word: {{CURRENTMONTH}}
7573 !! wikitext
7574 {{CURRENTMONTH}}
7575 !! html
7576 <p>01
7577 </p>
7578 !! end
7579
7580 !! test
7581 Magic Word: {{CURRENTMONTH1}}
7582 !! wikitext
7583 {{CURRENTMONTH1}}
7584 !! html
7585 <p>1
7586 </p>
7587 !! end
7588
7589 !! test
7590 Magic Word: {{CURRENTMONTHABBREV}}
7591 !! wikitext
7592 {{CURRENTMONTHABBREV}}
7593 !! html
7594 <p>Jan
7595 </p>
7596 !! end
7597
7598 !! test
7599 Magic Word: {{CURRENTMONTHNAME}}
7600 !! wikitext
7601 {{CURRENTMONTHNAME}}
7602 !! html
7603 <p>January
7604 </p>
7605 !! end
7606
7607 !! test
7608 Magic Word: {{CURRENTMONTHNAMEGEN}}
7609 !! wikitext
7610 {{CURRENTMONTHNAMEGEN}}
7611 !! html
7612 <p>January
7613 </p>
7614 !! end
7615
7616 !! test
7617 Magic Word: {{CURRENTTIME}}
7618 !! wikitext
7619 {{CURRENTTIME}}
7620 !! html
7621 <p>00:02
7622 </p>
7623 !! end
7624
7625 !! test
7626 Magic Word: {{CURRENTHOUR}}
7627 !! wikitext
7628 {{CURRENTHOUR}}
7629 !! html
7630 <p>00
7631 </p>
7632 !! end
7633
7634 !! test
7635 Magic Word: {{CURRENTWEEK}} (@bug 4594)
7636 !! wikitext
7637 {{CURRENTWEEK}}
7638 !! html
7639 <p>1
7640 </p>
7641 !! end
7642
7643 !! test
7644 Magic Word: {{CURRENTYEAR}}
7645 !! wikitext
7646 {{CURRENTYEAR}}
7647 !! html
7648 <p>1970
7649 </p>
7650 !! end
7651
7652 !! test
7653 Magic Word: {{CURRENTTIMESTAMP}}
7654 !! wikitext
7655 {{CURRENTTIMESTAMP}}
7656 !! html
7657 <p>19700101000203
7658 </p>
7659 !! end
7660
7661 !! test
7662 Magic Words LOCAL (UTC)
7663 !! wikitext
7664 * {{LOCALMONTH}}
7665 * {{LOCALMONTH1}}
7666 * {{LOCALMONTHNAME}}
7667 * {{LOCALMONTHNAMEGEN}}
7668 * {{LOCALMONTHABBREV}}
7669 * {{LOCALDAY}}
7670 * {{LOCALDAY2}}
7671 * {{LOCALDAYNAME}}
7672 * {{LOCALYEAR}}
7673 * {{LOCALTIME}}
7674 * {{LOCALHOUR}}
7675 * {{LOCALWEEK}}
7676 * {{LOCALDOW}}
7677 * {{LOCALTIMESTAMP}}
7678 !! html
7679 <ul>
7680 <li> 01
7681 </li>
7682 <li> 1
7683 </li>
7684 <li> January
7685 </li>
7686 <li> January
7687 </li>
7688 <li> Jan
7689 </li>
7690 <li> 1
7691 </li>
7692 <li> 01
7693 </li>
7694 <li> Thursday
7695 </li>
7696 <li> 1970
7697 </li>
7698 <li> 00:02
7699 </li>
7700 <li> 00
7701 </li>
7702 <li> 1
7703 </li>
7704 <li> 4
7705 </li>
7706 <li> 19700101000203
7707 </li>
7708 </ul>
7709
7710 !! end
7711
7712 !! test
7713 Magic Word: {{FULLPAGENAME}}
7714 !! options
7715 title=[[User:Ævar Arnfjörð Bjarmason]]
7716 !! wikitext
7717 {{FULLPAGENAME}}
7718 !! html
7719 <p>User:Ævar Arnfjörð Bjarmason
7720 </p>
7721 !! end
7722
7723 !! test
7724 Magic Word: {{FULLPAGENAMEE}}
7725 !! options
7726 title=[[User:Ævar Arnfjörð Bjarmason]]
7727 !! wikitext
7728 {{FULLPAGENAMEE}}
7729 !! html
7730 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7731 </p>
7732 !! end
7733
7734 !! test
7735 Magic Word: {{TALKSPACE}}
7736 !! options
7737 title=[[User:Ævar Arnfjörð Bjarmason]]
7738 !! wikitext
7739 {{TALKSPACE}}
7740 !! html
7741 <p>User talk
7742 </p>
7743 !! end
7744
7745 !! test
7746 Magic Word: {{TALKSPACE}}, same namespace
7747 !! options
7748 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7749 !! wikitext
7750 {{TALKSPACE}}
7751 !! html
7752 <p>User talk
7753 </p>
7754 !! end
7755
7756 !! test
7757 Magic Word: {{TALKSPACE}}, main namespace
7758 !! options
7759 title=[[Parser Test]]
7760 !! wikitext
7761 {{TALKSPACE}}
7762 !! html
7763 <p>Talk
7764 </p>
7765 !! end
7766
7767 !! test
7768 Magic Word: {{TALKSPACEE}}
7769 !! options
7770 title=[[User:Ævar Arnfjörð Bjarmason]]
7771 !! wikitext
7772 {{TALKSPACEE}}
7773 !! html
7774 <p>User_talk
7775 </p>
7776 !! end
7777
7778 !! test
7779 Magic Word: {{SUBJECTSPACE}}
7780 !! options
7781 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7782 !! wikitext
7783 {{SUBJECTSPACE}}
7784 !! html
7785 <p>User
7786 </p>
7787 !! end
7788
7789 !! test
7790 Magic Word: {{SUBJECTSPACE}}, same namespace
7791 !! options
7792 title=[[User:Ævar Arnfjörð Bjarmason]]
7793 !! wikitext
7794 {{SUBJECTSPACE}}
7795 !! html
7796 <p>User
7797 </p>
7798 !! end
7799
7800 !! test
7801 Magic Word: {{SUBJECTSPACE}}, main namespace
7802 !! options
7803 title=[[Parser Test]]
7804 !! wikitext
7805 {{SUBJECTSPACE}}
7806 !! html
7807
7808 !! end
7809
7810 !! test
7811 Magic Word: {{SUBJECTSPACEE}}
7812 !! options
7813 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7814 !! wikitext
7815 {{SUBJECTSPACEE}}
7816 !! html
7817 <p>User
7818 </p>
7819 !! end
7820
7821 !! test
7822 Magic Word: {{NAMESPACE}}
7823 !! options
7824 title=[[User:Ævar Arnfjörð Bjarmason]]
7825 !! wikitext
7826 {{NAMESPACE}}
7827 !! html
7828 <p>User
7829 </p>
7830 !! end
7831
7832 !! test
7833 Magic Word: {{NAMESPACEE}}
7834 !! options
7835 title=[[User:Ævar Arnfjörð Bjarmason]]
7836 !! wikitext
7837 {{NAMESPACEE}}
7838 !! html
7839 <p>User
7840 </p>
7841 !! end
7842
7843 !! test
7844 Magic Word: {{NAMESPACENUMBER}}
7845 !! options
7846 title=[[User:Ævar Arnfjörð Bjarmason]]
7847 !! wikitext
7848 {{NAMESPACENUMBER}}
7849 !! html
7850 <p>2
7851 </p>
7852 !! end
7853
7854 !! test
7855 Magic Word: {{SUBPAGENAME}}
7856 !! options
7857 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7858 !! wikitext
7859 {{SUBPAGENAME}}
7860 !! html
7861 <p>sub ö
7862 </p>
7863 !! end
7864
7865 !! test
7866 Magic Word: {{SUBPAGENAMEE}}
7867 !! options
7868 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7869 !! wikitext
7870 {{SUBPAGENAMEE}}
7871 !! html
7872 <p>sub_%C3%B6
7873 </p>
7874 !! end
7875
7876 !! test
7877 Magic Word: {{ROOTPAGENAME}}
7878 !! options
7879 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7880 !! wikitext
7881 {{ROOTPAGENAME}}
7882 !! html
7883 <p>Ævar Arnfjörð Bjarmason
7884 </p>
7885 !! end
7886
7887 !! test
7888 Magic Word: {{ROOTPAGENAMEE}}
7889 !! options
7890 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7891 !! wikitext
7892 {{ROOTPAGENAMEE}}
7893 !! html
7894 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7895 </p>
7896 !! end
7897
7898 !! test
7899 Magic Word: {{BASEPAGENAME}}
7900 !! options
7901 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7902 !! wikitext
7903 {{BASEPAGENAME}}
7904 !! html
7905 <p>Ævar Arnfjörð Bjarmason
7906 </p>
7907 !! end
7908
7909 !! test
7910 Magic Word: {{BASEPAGENAMEE}}
7911 !! options
7912 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7913 !! wikitext
7914 {{BASEPAGENAMEE}}
7915 !! html
7916 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7917 </p>
7918 !! end
7919
7920 !! test
7921 Magic Word: {{TALKPAGENAME}}
7922 !! options
7923 title=[[User:Ævar Arnfjörð Bjarmason]]
7924 !! wikitext
7925 {{TALKPAGENAME}}
7926 !! html
7927 <p>User talk:Ævar Arnfjörð Bjarmason
7928 </p>
7929 !! end
7930
7931 !! test
7932 Magic Word: {{TALKPAGENAMEE}}
7933 !! options
7934 title=[[User:Ævar Arnfjörð Bjarmason]]
7935 !! wikitext
7936 {{TALKPAGENAMEE}}
7937 !! html
7938 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7939 </p>
7940 !! end
7941
7942 !! test
7943 Magic Word: {{SUBJECTPAGENAME}}
7944 !! options
7945 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7946 !! wikitext
7947 {{SUBJECTPAGENAME}}
7948 !! html
7949 <p>User:Ævar Arnfjörð Bjarmason
7950 </p>
7951 !! end
7952
7953 !! test
7954 Magic Word: {{SUBJECTPAGENAMEE}}
7955 !! options
7956 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7957 !! wikitext
7958 {{SUBJECTPAGENAMEE}}
7959 !! html
7960 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7961 </p>
7962 !! end
7963
7964 !! test
7965 Magic Word: {{NUMBEROFFILES}}
7966 !! wikitext
7967 {{NUMBEROFFILES}}
7968 !! html
7969 <p>5
7970 </p>
7971 !! end
7972
7973 !! test
7974 Magic Word: {{PAGENAME}}
7975 !! options
7976 title=[[User:Ævar Arnfjörð Bjarmason]]
7977 !! wikitext
7978 {{PAGENAME}}
7979 !! html
7980 <p>Ævar Arnfjörð Bjarmason
7981 </p>
7982 !! end
7983
7984 !! test
7985 Magic Word: {{PAGENAME}} with metacharacters
7986 !! options
7987 title=[['foo & bar = baz']]
7988 !! wikitext
7989 ''{{PAGENAME}}''
7990 !! html
7991 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7992 </p>
7993 !! end
7994
7995 !! test
7996 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7997 !! options
7998 title=[[*RFC 1234 http://example.com/]]
7999 !! wikitext
8000 {{PAGENAME}}
8001 !! html
8002 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8003 </p>
8004 !! end
8005
8006 !! test
8007 Magic Word: {{PAGENAMEE}}
8008 !! options
8009 title=[[User:Ævar Arnfjörð Bjarmason]]
8010 !! wikitext
8011 {{PAGENAMEE}}
8012 !! html
8013 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8014 </p>
8015 !! end
8016
8017 !! test
8018 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8019 !! options
8020 title=[[*RFC 1234 http://example.com/]]
8021 !! wikitext
8022 {{PAGENAMEE}}
8023 !! html
8024 <p>&#42;RFC_1234_http&#58;//example.com/
8025 </p>
8026 !! end
8027
8028 !! test
8029 Magic Word: {{REVISIONID}}
8030 !! wikitext
8031 {{REVISIONID}}
8032 !! html
8033 <p>1337
8034 </p>
8035 !! end
8036
8037 !! test
8038 Magic Word: {{SCRIPTPATH}}
8039 !! wikitext
8040 {{SCRIPTPATH}}
8041 !! html
8042 <p>/
8043 </p>
8044 !! end
8045
8046 !! test
8047 Magic Word: {{STYLEPATH}}
8048 !! wikitext
8049 {{STYLEPATH}}
8050 !! html
8051 <p>/skins
8052 </p>
8053 !! end
8054
8055 !! test
8056 Magic Word: {{SERVER}}
8057 !! wikitext
8058 {{SERVER}}
8059 !! html
8060 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8061 </p>
8062 !! end
8063
8064 !! test
8065 Magic Word: {{SERVERNAME}}
8066 !! wikitext
8067 {{SERVERNAME}}
8068 !! html
8069 <p>example.org
8070 </p>
8071 !! end
8072
8073 !! test
8074 Magic Word: {{SITENAME}}
8075 !! wikitext
8076 {{SITENAME}}
8077 !! html
8078 <p>MediaWiki
8079 </p>
8080 !! end
8081
8082 !! test
8083 Case-sensitive magic words, when cased differently, should just be template transclusions
8084 !! wikitext
8085 {{CurrentMonth}}
8086 {{currentday}}
8087 {{cURreNTweEK}}
8088 {{currentHour}}
8089 !! html
8090 <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>
8091 <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>
8092 <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>
8093 <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>
8094 </p>
8095 !! end
8096
8097 !! test
8098 Case-insensitive magic words should still work with weird casing.
8099 !! wikitext
8100 {{sErVeRNaMe}}
8101 {{LCFirst:AOEU}}
8102 {{ucFIRST:aoeu}}
8103 {{SERver}}
8104 !! html
8105 <p>example.org
8106 aOEU
8107 Aoeu
8108 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8109 </p>
8110 !! end
8111
8112 !! test
8113 Namespace 1 {{ns:1}}
8114 !! wikitext
8115 {{ns:1}}
8116 !! html
8117 <p>Talk
8118 </p>
8119 !! end
8120
8121 !! test
8122 Namespace 1 {{ns:01}}
8123 !! wikitext
8124 {{ns:01}}
8125 !! html
8126 <p>Talk
8127 </p>
8128 !! end
8129
8130 !! test
8131 Namespace 0 {{ns:0}} (bug 4783)
8132 !! wikitext
8133 {{ns:0}}
8134 !! html
8135
8136 !! end
8137
8138 !! test
8139 Namespace 0 {{ns:00}} (bug 4783)
8140 !! wikitext
8141 {{ns:00}}
8142 !! html
8143
8144 !! end
8145
8146 !! test
8147 Namespace -1 {{ns:-1}}
8148 !! wikitext
8149 {{ns:-1}}
8150 !! html
8151 <p>Special
8152 </p>
8153 !! end
8154
8155 !! test
8156 Namespace User {{ns:User}}
8157 !! wikitext
8158 {{ns:User}}
8159 !! html
8160 <p>User
8161 </p>
8162 !! end
8163
8164 !! test
8165 Namespace User talk {{ns:User_talk}}
8166 !! wikitext
8167 {{ns:User_talk}}
8168 !! html
8169 <p>User talk
8170 </p>
8171 !! end
8172
8173 !! test
8174 Namespace User talk {{ns:uSeR tAlK}}
8175 !! wikitext
8176 {{ns:uSeR tAlK}}
8177 !! html
8178 <p>User talk
8179 </p>
8180 !! end
8181
8182 !! test
8183 Namespace File {{ns:File}}
8184 !! wikitext
8185 {{ns:File}}
8186 !! html
8187 <p>File
8188 </p>
8189 !! end
8190
8191 !! test
8192 Namespace File {{ns:Image}}
8193 !! wikitext
8194 {{ns:Image}}
8195 !! html
8196 <p>File
8197 </p>
8198 !! end
8199
8200 !! test
8201 Namespace (lang=de) Benutzer {{ns:User}}
8202 !! options
8203 language=de
8204 !! wikitext
8205 {{ns:User}}
8206 !! html
8207 <p>Benutzer
8208 </p>
8209 !! end
8210
8211 !! test
8212 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
8213 !! options
8214 language=de
8215 !! wikitext
8216 {{ns:3}}
8217 !! html
8218 <p>Benutzer Diskussion
8219 </p>
8220 !! end
8221
8222
8223 !! test
8224 Urlencode
8225 !! wikitext
8226 {{urlencode:hi world?!}}
8227 {{urlencode:hi world?!|WIKI}}
8228 {{urlencode:hi world?!|PATH}}
8229 {{urlencode:hi world?!|QUERY}}
8230 !! html
8231 <p>hi+world%3F%21
8232 hi_world%3F!
8233 hi%20world%3F%21
8234 hi+world%3F%21
8235 </p>
8236 !! end
8237
8238 !! test
8239 Magic Word: prioritize type info over data-parsoid
8240 !! options
8241 parsoid=html2wt
8242 !! wikitext
8243 __FORCETOC__
8244 !! html
8245 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
8246 !! end
8247
8248 !! test
8249 Magic Word: serialize on separate line (parsoid)
8250 !! options
8251 parsoid=wt2wt,html2wt
8252 !! wikitext
8253 foo
8254 __NOTOC__
8255 bar
8256 !! html
8257 foo<meta property="mw:PageProp/notoc"/>bar
8258 !! end
8259
8260 !! test
8261 Magic Word: rt non-english wikis
8262 !! options
8263 parsoid=wt2wt
8264 language=de
8265 !! wikitext
8266 __NOEDITSECTION__
8267 !! html
8268 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
8269 !! end
8270
8271 ###
8272 ### Magic links
8273 ###
8274 !! test
8275 Magic links: internal link to RFC (bug 479)
8276 !! wikitext
8277 [[RFC 123]]
8278 !! html
8279 <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>
8280 </p>
8281 !! end
8282
8283 !! test
8284 Magic links: RFC (bug 479)
8285 !! wikitext
8286 RFC 822
8287 !! html
8288 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8289 </p>
8290 !! end
8291
8292 !! test
8293 Magic links: ISBN (bug 1937)
8294 !! wikitext
8295 ISBN 0-306-40615-2
8296 !! html
8297 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8298 </p>
8299 !! end
8300
8301 !! test
8302 Magic links: PMID incorrectly converts space to underscore
8303 !! wikitext
8304 PMID 1234
8305 !! html
8306 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8307 </p>
8308 !! end
8309
8310 ###
8311 ### Templates
8312 ####
8313
8314 !! test
8315 Nonexistent template
8316 !! wikitext
8317 {{thistemplatedoesnotexist}}
8318 !! html
8319 <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>
8320 </p>
8321 !! end
8322
8323 !! test
8324 Template with invalid target containing tags
8325 !! wikitext
8326 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8327 !! html
8328 <p>{{a<b>b</b>|foo|a=b|a = b}}
8329 </p>
8330 !! end
8331
8332 !! test
8333 Template with invalid target containing unclosed tag
8334 !! wikitext
8335 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8336 !! html
8337 <p>{{a<b>|foo|a=b|a = b}}</b>
8338 </p>
8339 !! end
8340
8341 !! test
8342 Template with invalid target containing wikilink
8343 !! wikitext
8344 {{[[Main Page]]}}
8345 !! html/php
8346 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
8347 </p>
8348 !! html/parsoid
8349 <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>
8350 !! end
8351
8352 !! article
8353 Template:test
8354 !! text
8355 This is a test template
8356 !! endarticle
8357
8358 !! test
8359 Simple template
8360 !! wikitext
8361 {{test}}
8362 !! html
8363 <p>This is a test template
8364 </p>
8365 !! end
8366
8367 !! test
8368 Template with explicit namespace
8369 !! wikitext
8370 {{Template:test}}
8371 !! html
8372 <p>This is a test template
8373 </p>
8374 !! end
8375
8376
8377 !! article
8378 Template:paramtest
8379 !! text
8380 This is a test template with parameter {{{param}}}
8381 !! endarticle
8382
8383 !! test
8384 Template parameter
8385 !! wikitext
8386 {{paramtest|param=foo}}
8387 !! html
8388 <p>This is a test template with parameter foo
8389 </p>
8390 !! end
8391
8392 !! article
8393 Template:paramtestnum
8394 !! text
8395 [[{{{1}}}|{{{2}}}]]
8396 !! endarticle
8397
8398 !! test
8399 Template unnamed parameter
8400 !! wikitext
8401 {{paramtestnum|Main Page|the main page}}
8402 !! html
8403 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
8404 </p>
8405 !! end
8406
8407 !! article
8408 Template:templatesimple
8409 !! text
8410 (test)
8411 !! endarticle
8412
8413 !! article
8414 Template:templateredirect
8415 !! text
8416 #redirect [[Template:templatesimple]]
8417 !! endarticle
8418
8419 !! article
8420 Template:templateasargtestnum
8421 !! text
8422 {{{{{1}}}}}
8423 !! endarticle
8424
8425 !! article
8426 Template:templateasargtest
8427 !! text
8428 {{template{{{templ}}}}}
8429 !! endarticle
8430
8431 !! article
8432 Template:templateasargtest2
8433 !! text
8434 {{{{{templ}}}}}
8435 !! endarticle
8436
8437 !! test
8438 Template with template name as unnamed argument
8439 !! wikitext
8440 {{templateasargtestnum|templatesimple}}
8441 !! html
8442 <p>(test)
8443 </p>
8444 !! end
8445
8446 !! test
8447 Template with template name as argument
8448 !! wikitext
8449 {{templateasargtest|templ=simple}}
8450 !! html
8451 <p>(test)
8452 </p>
8453 !! end
8454
8455 !! test
8456 Template with template name as argument (2)
8457 !! wikitext
8458 {{templateasargtest2|templ=templatesimple}}
8459 !! html
8460 <p>(test)
8461 </p>
8462 !! end
8463
8464 !! article
8465 Template:templateasargtestdefault
8466 !! text
8467 {{{{{templ|templatesimple}}}}}
8468 !! endarticle
8469
8470 !! article
8471 Template:templa
8472 !! text
8473 '''templ'''
8474 !! endarticle
8475
8476 !! test
8477 Template with default value
8478 !! wikitext
8479 {{templateasargtestdefault}}
8480 !! html
8481 <p>(test)
8482 </p>
8483 !! end
8484
8485 !! test
8486 Template with default value (value set)
8487 !! wikitext
8488 {{templateasargtestdefault|templ=templa}}
8489 !! html
8490 <p><b>templ</b>
8491 </p>
8492 !! end
8493
8494 !! test
8495 Template redirect
8496 !! wikitext
8497 {{templateredirect}}
8498 !! html
8499 <p>(test)
8500 </p>
8501 !! end
8502
8503 !! test
8504 Template with argument in separate line
8505 !! wikitext
8506 {{ templateasargtest |
8507 templ = simple }}
8508 !! html
8509 <p>(test)
8510 </p>
8511 !! end
8512
8513 !! test
8514 Template with complex template as argument
8515 !! wikitext
8516 {{paramtest|
8517 param ={{ templateasargtest |
8518 templ = simple }}}}
8519 !! html
8520 <p>This is a test template with parameter (test)
8521 </p>
8522 !! end
8523
8524 !! test
8525 Template with thumb image (with link in description)
8526 !! wikitext
8527 {{paramtest|
8528 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
8529 !! html
8530 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>
8531
8532 !! end
8533
8534 !! article
8535 Template:complextemplate
8536 !! text
8537 {{{1}}} {{paramtest|
8538 param ={{{param}}}}}
8539 !! endarticle
8540
8541 !! test
8542 Template with complex arguments
8543 !! wikitext
8544 {{complextemplate|
8545 param ={{ templateasargtest |
8546 templ = simple }}|[[Template:complextemplate|link]]}}
8547 !! html
8548 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
8549 </p>
8550 !! end
8551
8552 !! test
8553 BUG 553: link with two variables in a piped link
8554 !! wikitext
8555 {|
8556 |[[{{{1}}}|{{{2}}}]]
8557 |}
8558 !! html
8559 <table>
8560 <tr>
8561 <td>[[{{{1}}}|{{{2}}}]]
8562 </td></tr></table>
8563
8564 !! end
8565
8566 !! test
8567 Magic variable as template parameter
8568 !! wikitext
8569 {{paramtest|param={{SITENAME}}}}
8570 !! html
8571 <p>This is a test template with parameter MediaWiki
8572 </p>
8573 !! end
8574
8575 !! article
8576 Template:linktest
8577 !! text
8578 [[{{{param}}}|link]]
8579 !! endarticle
8580
8581 !! test
8582 Template parameter as link source
8583 !! wikitext
8584 {{linktest|param=Main Page}}
8585 !! html
8586 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
8587 </p>
8588 !! end
8589
8590 !!test
8591 Template-generated attribute string (k='v')
8592 !! wikitext
8593 <span {{attr_str|id|v1}}>bar</span>
8594 !! html
8595 <p><span id="v1">bar</span>
8596 </p>
8597 !!end
8598
8599 !!article
8600 Template:paramtest2
8601 !! text
8602 including another template, {{paramtest|param={{{arg}}}}}
8603 !! endarticle
8604
8605 !! test
8606 Template passing argument to another template
8607 !! wikitext
8608 {{paramtest2|arg='hmm'}}
8609 !! html
8610 <p>including another template, This is a test template with parameter 'hmm'
8611 </p>
8612 !! end
8613
8614 !! article
8615 Template:Linktest2
8616 !! text
8617 Main Page
8618 !! endarticle
8619
8620 !! test
8621 Template as link source
8622 !! wikitext
8623 [[{{linktest2}}]]
8624
8625 [[{{linktest2}}|Main Page]]
8626
8627 [[{{linktest2}}]]Page
8628 !! html
8629 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8630 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8631 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
8632 </p>
8633 !! end
8634
8635
8636 !! article
8637 Template:loop1
8638 !! text
8639 {{loop2}}
8640 !! endarticle
8641
8642 !! article
8643 Template:loop2
8644 !! text
8645 {{loop1}}
8646 !! endarticle
8647
8648 !! test
8649 Template infinite loop
8650 !! wikitext
8651 {{loop1}}
8652 !! html
8653 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
8654 </p>
8655 !! end
8656
8657 !! test
8658 Template from main namespace
8659 !! wikitext
8660 {{:Main Page}}
8661 !! html
8662 <p>blah blah
8663 </p>
8664 !! end
8665
8666 !! article
8667 Template:table
8668 !! text
8669 {|
8670 | 1 || 2
8671 |-
8672 | 3 || 4
8673 |}
8674 !! endarticle
8675
8676 !! test
8677 BUG 529: Template with table, not included at beginning of line
8678 !! wikitext
8679 foo {{table}}
8680 !! html
8681 <p>foo
8682 </p>
8683 <table>
8684 <tr>
8685 <td> 1 </td>
8686 <td> 2
8687 </td></tr>
8688 <tr>
8689 <td> 3 </td>
8690 <td> 4
8691 </td></tr></table>
8692
8693 !! end
8694
8695 !! test
8696 BUG 523: Template shouldn't eat newline (or add an extra one before table)
8697 !! wikitext
8698 foo
8699 {{table}}
8700 !! html
8701 <p>foo
8702 </p>
8703 <table>
8704 <tr>
8705 <td> 1 </td>
8706 <td> 2
8707 </td></tr>
8708 <tr>
8709 <td> 3 </td>
8710 <td> 4
8711 </td></tr></table>
8712
8713 !! end
8714
8715 !! test
8716 BUG 41: Template parameters shown as broken links
8717 !! wikitext
8718 {{{parameter}}}
8719 !! html
8720 <p>{{{parameter}}}
8721 </p>
8722 !! end
8723
8724 !! test
8725 Template with targets containing wikilinks
8726 !! wikitext
8727 {{[[foo]]}}
8728
8729 {{[[{{echo|foo}}]]}}
8730
8731 {{{{echo|[[foo}}]]}}
8732 !! html
8733 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8734 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8735 </p><p>{{[[foo}}]]
8736 </p>
8737 !! end
8738
8739 !! article
8740 Template:MSGNW test
8741 !! text
8742 ''None'' of '''this''' should be
8743 * interpreted
8744 but rather passed unmodified
8745 {{test}}
8746 !! endarticle
8747
8748 # hmm, fix this or just deprecate msgnw and document its behavior?
8749 !! test
8750 msgnw keyword
8751 !! options
8752 disabled
8753 !! wikitext
8754 {{msgnw:MSGNW test}}
8755 !! html
8756 <p>''None'' of '''this''' should be
8757 * interpreted
8758 but rather passed unmodified
8759 {{test}}
8760 </p>
8761 !! end
8762
8763 !! test
8764 int keyword
8765 !! wikitext
8766 {{int:youhavenewmessages|lots of money|not!}}
8767 !! html
8768 <p>You have lots of money (not!).
8769 </p>
8770 !! end
8771
8772 !! article
8773 Template:Includes
8774 !! text
8775 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8776 !! endarticle
8777
8778 !! test
8779 <includeonly> and <noinclude> being included
8780 !! wikitext
8781 {{Includes}}
8782 !! html
8783 <p>Foobar
8784 </p>
8785 !! end
8786
8787 !! article
8788 Template:Includes2
8789 !! text
8790 <onlyinclude>Foo</onlyinclude>bar
8791 !! endarticle
8792
8793 !! test
8794 <onlyinclude> being included
8795 !! wikitext
8796 {{Includes2}}
8797 !! html
8798 <p>Foo
8799 </p>
8800 !! end
8801
8802
8803 !! article
8804 Template:Includes3
8805 !! text
8806 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8807 !! endarticle
8808
8809 !! test
8810 <onlyinclude> and <includeonly> being included
8811 !! wikitext
8812 {{Includes3}}
8813 !! html
8814 <p>Foo
8815 </p>
8816 !! end
8817
8818 !! test
8819 <includeonly> and <noinclude> on a page
8820 !! wikitext
8821 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8822 !! html
8823 <p>Foozar
8824 </p>
8825 !! end
8826
8827 !! test
8828 Un-closed <noinclude>
8829 !! wikitext
8830 <noinclude>
8831 !! html
8832 !! end
8833
8834 !! test
8835 <onlyinclude> on a page
8836 !! wikitext
8837 <onlyinclude>Foo</onlyinclude>bar
8838 !! html
8839 <p>Foobar
8840 </p>
8841 !! end
8842
8843 !! test
8844 Un-closed <onlyinclude>
8845 !! wikitext
8846 <onlyinclude>
8847 !! html
8848 !! end
8849
8850 !!test
8851 Self-closed noinclude, includeonly, onlyinclude tags
8852 !! wikitext
8853 <noinclude />
8854 <includeonly />
8855 <onlyinclude />
8856 !! html
8857 <p><br />
8858 </p>
8859 !!end
8860
8861 !!test
8862 Unbalanced includeonly and noinclude tags
8863 !! wikitext
8864 {|
8865 |a</noinclude>
8866 |b</noinclude></noinclude>
8867 |c</noinclude></includeonly>
8868 |d</includeonly></includeonly>
8869 |}
8870 !! html
8871 <table>
8872 <tr>
8873 <td>a
8874 </td>
8875 <td>b
8876 </td>
8877 <td>c&lt;/includeonly&gt;
8878 </td>
8879 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8880 </td></tr></table>
8881
8882 !!end
8883
8884 !! article
8885 Template:Includeonly section
8886 !! text
8887 <includeonly>
8888 ==Includeonly section==
8889 </includeonly>
8890 ==Section T-1==
8891 !!endarticle
8892
8893 !! test
8894 Bug 6563: Edit link generation for section shown by <includeonly>
8895 !! wikitext
8896 {{includeonly section}}
8897 !! html
8898 <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>
8899 <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>
8900
8901 !! end
8902
8903 # Uses same input as the contents of [[Template:Includeonly section]]
8904 !! test
8905 Bug 6563: Section extraction for section shown by <includeonly>
8906 !! options
8907 section=T-2
8908 !! wikitext
8909 <includeonly>
8910 ==Includeonly section==
8911 </includeonly>
8912 ==Section T-2==
8913 !! html
8914 ==Section T-2==
8915 !! end
8916
8917 !! test
8918 Bug 6563: Edit link generation for section suppressed by <includeonly>
8919 !! wikitext
8920 <includeonly>
8921 ==Includeonly section==
8922 </includeonly>
8923 ==Section 1==
8924 !! html
8925 <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>
8926
8927 !! end
8928
8929 !! test
8930 Bug 6563: Section extraction for section suppressed by <includeonly>
8931 !! options
8932 section=1
8933 !! wikitext
8934 <includeonly>
8935 ==Includeonly section==
8936 </includeonly>
8937 ==Section 1==
8938 !! html
8939 ==Section 1==
8940 !! end
8941
8942 !! test
8943 Un-closed <includeonly>
8944 !! wikitext
8945 <includeonly>
8946 !! html
8947 !! end
8948
8949 # TODO: test with DOM fragment reuse!
8950 !! test
8951 Parsoid: DOM fragment reuse
8952 !! options
8953 parsoid=wt2wt,wt2html
8954 !! wikitext
8955 a{{echo|b<table></table>c}}d
8956
8957 a{{echo|b
8958 <table></table>
8959 c}}d
8960
8961 {{echo|a
8962
8963 <table></table>
8964
8965 b}}
8966 !! html
8967 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8968 <table></table>c"}},"i":0}}]}'>b</span>
8969 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8970
8971
8972 <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">
8973 </span>
8974 <table about="#mwt2"></table><span about="#mwt2">
8975 </span>
8976 <p about="#mwt2">cd</p>
8977
8978
8979 <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">
8980
8981 </span>
8982 <table about="#mwt3"></table><span about="#mwt3">
8983
8984 </span>
8985 <p about="#mwt3">b</p>
8986 !! end
8987
8988 !! test
8989 Parsoid: Merge double tds (bug 50603)
8990 !! options
8991 parsoid
8992 !! wikitext
8993 {|
8994 |{{echo|{{!}} foo}}
8995 |}
8996 !! html
8997 <table><tbody>
8998 <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>
8999 </tbody></table>
9000 !! end
9001
9002 !! test
9003 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9004 !! options
9005 parsoid
9006 !! wikitext
9007 {{echo|<div>}}
9008 {|
9009 |{{echo|{{!}} foo}}
9010 |}
9011 {{echo|</div>}}
9012 !! html
9013 <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}}]}'>
9014 <table><tbody>
9015 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9016 </tbody></table>
9017 </div>
9018 !! end
9019
9020 ###
9021 ### <includeonly> and <noinclude> in attributes
9022 ###
9023 !!test
9024 0. includeonly around the entire attribute
9025 !! wikitext
9026 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9027 !! html
9028 <p><span id="v2">bar</span>
9029 </p>
9030 !!end
9031
9032 !!test
9033 1. includeonly in html attr key
9034 !! wikitext
9035 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9036 !! html
9037 <p><span id="foo">bar</span>
9038 </p>
9039 !!end
9040
9041 !!test
9042 2. includeonly in html attr value
9043 !! wikitext
9044 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9045 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9046 !! html
9047 <p><span id="v1">bar</span>
9048 <span id="v1">bar</span>
9049 </p>
9050 !!end
9051
9052 !!test
9053 3. includeonly in part of an attr value
9054 !! wikitext
9055 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9056 !! html
9057 <p><span style="color:red;">bar</span>
9058 </p>
9059 !!end
9060
9061 !!test
9062 4. includeonly in table attributes
9063 !! wikitext
9064 {|
9065 |- <noinclude>
9066 |-
9067 |a
9068 </noinclude>
9069 |- <includeonly>
9070 |-
9071 |b
9072 </includeonly>
9073 |}
9074 !! html
9075 <table>
9076
9077
9078 <tr>
9079 <td>a
9080 </td></tr>
9081 </table>
9082
9083 !!end
9084
9085 ###
9086 ### Token Stream Patcher tests
9087 ###
9088 ### These tests won't always pass wt2wt and other modes because
9089 ### on serialization, the table will be output on a new line.
9090 ### For now, we are blacklisting them, and using this to test selser.
9091 ###
9092
9093 !!test
9094 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
9095 !!options
9096 parsoid=wt2html,wt2wt
9097 !!wikitext
9098 {{echo|}}{| width = '100%'
9099 |foo
9100 |}
9101 !!html/parsoid
9102 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
9103 <table width="100%">
9104 <tbody>
9105 <tr>
9106 <td>foo</td></tr></tbody></table>
9107 !!end
9108
9109 !!test
9110 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
9111 !!options
9112 parsoid=wt2html,wt2wt
9113 !!wikitext
9114 <includeonly>a</includeonly>{| {{{b}}}
9115 |c
9116 |}
9117 !!html/parsoid
9118 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":"&lt;/includeonly>"}'/><span typeof="mw:Param" about="#mwt1" id="mwt1" data-mw="{}">{{{b}}}</span><table about="#mwt1">
9119 <tbody><tr><td>c</td></tr>
9120 </tbody></table>
9121 !!end
9122
9123 ###
9124 ### Testing parsing of templates where a template arg
9125 ### has the same name as the template itself.
9126 ###
9127
9128 !! article
9129 Template:quote
9130 !! text
9131 {{{quote|{{{1}}}}}}
9132 !! endarticle
9133
9134 !!test
9135 Templates: Template Name/Arg clash: 1. Use of positional param
9136 !! wikitext
9137 {{quote|foo}}
9138 !! html
9139 <p>foo
9140 </p>
9141 !!end
9142
9143 !!test
9144 Templates: Template Name/Arg clash: 2. Use of named param
9145 !! wikitext
9146 {{quote|quote=foo}}
9147 !! html
9148 <p>foo
9149 </p>
9150 !!end
9151
9152 !!test
9153 Templates: Template Name/Arg clash: 3. Use of named param with empty input
9154 !! wikitext
9155 {{quote|quote}}
9156 !! html
9157 <p>quote
9158 </p>
9159 !!end
9160
9161 ###
9162 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
9163 ###
9164
9165 !!test
9166 Templates: 1. Simple use
9167 !! wikitext
9168 {{echo|Foo}}
9169 !! html
9170 <p>Foo
9171 </p>
9172 !!end
9173
9174 !!test
9175 Templates: 2. Inside a block tag
9176 !! wikitext
9177 <div>{{echo|Foo}}</div>
9178 <blockquote>{{echo|Foo}}</blockquote>
9179 !! html
9180 <div>Foo</div>
9181 <blockquote>Foo</blockquote>
9182
9183 !!end
9184
9185 !!test
9186 Templates: P-wrapping: 1a. Templates on consecutive lines
9187 !! wikitext
9188 {{echo|Foo}}
9189 {{echo|bar}}
9190 !! html
9191 <p>Foo
9192 bar
9193 </p>
9194 !!end
9195
9196 !!test
9197 Templates: P-wrapping: 1b. Templates on consecutive lines
9198 !! wikitext
9199 Foo
9200
9201 {{echo|bar}}
9202 {{echo|baz}}
9203 !! html
9204 <p>Foo
9205 </p><p>bar
9206 baz
9207 </p>
9208 !!end
9209
9210 !!test
9211 Templates: P-wrapping: 1c. Templates on consecutive lines
9212 !! wikitext
9213 {{echo|Foo}}
9214 {{echo|bar}} <div>baz</div>
9215 !! html
9216 <p>Foo
9217 </p>
9218 bar <div>baz</div>
9219
9220 !!end
9221
9222 !!test
9223 Templates: P-wrapping: 1d. Template preceded by comment-only line
9224 !!options
9225 parsoid
9226 !! wikitext
9227 <!-- foo -->
9228 {{echo|Bar}}
9229 !! html
9230 <!-- foo -->
9231
9232 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
9233 !!end
9234
9235 !!test
9236 Templates: Inline Text: 1. Multiple template uses
9237 !! wikitext
9238 {{echo|Foo}}bar{{echo|baz}}
9239 !! html
9240 <p>Foobarbaz
9241 </p>
9242 !!end
9243
9244 !!test
9245 Templates: Inline Text: 2. Back-to-back template uses
9246 !! wikitext
9247 {{echo|Foo}}{{echo|bar}}
9248 !! html
9249 <p>Foobar
9250 </p>
9251 !!end
9252
9253 !!test
9254 Templates: Block Tags: 1. Multiple template uses
9255 !! wikitext
9256 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
9257 !! html
9258 <div>Foo</div><div>bar</div><div>baz</div>
9259
9260 !!end
9261
9262 !!test
9263 Templates: Block Tags: 2. Back-to-back template uses
9264 !! wikitext
9265 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
9266 !! html
9267 <div>Foo</div><div>bar</div>
9268
9269 !!end
9270
9271 !!test
9272 Templates: Links: 1. Simple example
9273 !! wikitext
9274 {{echo|[[Foo|bar]]}}
9275 !! html
9276 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9277 </p>
9278 !!end
9279
9280 !!test
9281 Templates: Links: 2. Generation of link href
9282 !! wikitext
9283 [[{{echo|Foo}}|bar]]
9284 !! html
9285 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9286 </p>
9287 !!end
9288
9289 !!test
9290 Templates: Links: 3. Generation of part of a link href
9291 !! wikitext
9292 [[Fo{{echo|o}}|bar]]
9293
9294 [[Foo{{echo|bar}}]]
9295
9296 [[Foo{{echo|bar}}baz]]
9297
9298 [[Foo{{echo|bar}}|bar]]
9299
9300 [[:Foo{{echo|bar}}]]
9301
9302 [[:Foo{{echo|bar}}|bar]]
9303 !! html
9304 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9305 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9306 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
9307 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9308 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9309 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9310 </p>
9311 !!end
9312
9313 !!test
9314 Templates: Links: 4. Multiple templates generating link href
9315 !! wikitext
9316 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
9317 !! html
9318 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9319 </p>
9320 !!end
9321
9322 !!test
9323 Templates: Links: 5. Generation of link text
9324 !! wikitext
9325 [[Foo|{{echo|bar}}]]
9326 !! html
9327 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9328 </p>
9329 !!end
9330
9331 !!test
9332 Templates: Links: 5. Nested templates (only outermost template should be marked)
9333 !! wikitext
9334 {{echo|[[{{echo|Foo}}|bar]]}}
9335 !! html
9336 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9337 </p>
9338 !!end
9339
9340 !!test
9341 Templates: HTML Tag: 1. Generation of HTML attr. key
9342 !! wikitext
9343 <div {{echo|style}}="color:red;">foo</div>
9344 !! html
9345 <div style="color:red;">foo</div>
9346
9347 !!end
9348
9349 !!test
9350 Templates: HTML Tag: 2. Generation of HTML attr. value
9351 !! wikitext
9352 <div style={{echo|'color:red;'}}>foo</div>
9353 !! html
9354 <div style="color:red;">foo</div>
9355
9356 !!end
9357
9358 !!test
9359 Templates: HTML Tag: 3. Generation of HTML attr key and value
9360 !! wikitext
9361 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
9362 !! html
9363 <div style="color:red;">foo</div>
9364
9365 !!end
9366
9367 !!test
9368 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
9369 !! wikitext
9370 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
9371 !! html
9372 <div title="This is a long title with just one piece templated">foo</div>
9373
9374 !!end
9375
9376 !!test
9377 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
9378 !! wikitext
9379 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
9380 !! html
9381 <div title="This is a long title with just one piece templated">foo</div>
9382
9383 !!end
9384
9385 !!test
9386 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
9387 !! wikitext
9388 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
9389 !! html
9390 <div title="This is a long title with just one piece templated">foo</div>
9391
9392 !!end
9393
9394 !!test
9395 Templates: HTML Tag: 7. Generation of partial attribute key string
9396 !! wikitext
9397 <div st{{echo|yle}}="color:red;">foo</div>
9398 !! html
9399 <div style="color:red;">foo</div>
9400
9401 !!end
9402
9403 !!test
9404 Templates: HTML Tables: 1. Generating start of a HTML table
9405 !! wikitext
9406 {{echo|<table><tr><td>foo</td>}}</tr></table>
9407 !! html
9408 <table><tr><td>foo</td></tr></table>
9409
9410 !!end
9411
9412 !!test
9413 Templates: HTML Tables: 2a. Generating middle of a HTML table
9414 !! wikitext
9415 <table><tr>{{echo|<td>foo</td>}}</tr></table>
9416 !! html
9417 <table><tr><td>foo</td></tr></table>
9418
9419 !!end
9420
9421 !!test
9422 Templates: HTML Tables: 2b. Generating middle of a HTML table
9423 !! wikitext
9424 <table>{{echo|<tr><td>foo</td></tr>}}</table>
9425 !! html
9426 <table><tr><td>foo</td></tr></table>
9427
9428 !!end
9429
9430 !!test
9431 Templates: HTML Tables: 3. Generating end of a HTML table
9432 !! wikitext
9433 <table><tr>{{echo|<td>foo</td></tr></table>}}
9434 !! html
9435 <table><tr><td>foo</td></tr></table>
9436
9437 !!end
9438
9439 !!test
9440 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
9441 !! wikitext
9442 {{echo|<table>}}<tr><td>foo</td></tr></table>
9443 !! html
9444 <table><tr><td>foo</td></tr></table>
9445
9446 !!end
9447
9448 !!test
9449 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
9450 !! wikitext
9451 <table>{{echo|<tr>}}<td>foo</td></tr></table>
9452 !! html
9453 <table><tr><td>foo</td></tr></table>
9454
9455 !!end
9456
9457 !!test
9458 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
9459 !! wikitext
9460 <table><tr>{{echo|<td>}}foo</td></tr></table>
9461 !! html
9462 <table><tr><td>foo</td></tr></table>
9463
9464 !!end
9465
9466 !!test
9467 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
9468 !! wikitext
9469 <table><tr><td>foo{{echo|</td>}}</tr></table>
9470 !! html
9471 <table><tr><td>foo</td></tr></table>
9472
9473 !!end
9474
9475 !!test
9476 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
9477 !! wikitext
9478 <table><tr><td>foo</td>{{echo|</tr>}}</table>
9479 !! html
9480 <table><tr><td>foo</td></tr></table>
9481
9482 !!end
9483
9484 !!test
9485 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
9486 !! wikitext
9487 <table><tr><td>foo</td></tr>{{echo|</table>}}
9488 !! html
9489 <table><tr><td>foo</td></tr></table>
9490
9491 !!end
9492
9493 !!test
9494 Templates: HTML Tables: 5. Proper fostering of categories from inside
9495 !!options
9496 parsoid=wt2html,wt2wt
9497 !! wikitext
9498 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
9499 <!--Two categories (Bug 50330)-->
9500 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
9501 !! html
9502 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
9503 <!--Two categories (Bug 50330)-->
9504 <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>
9505 !!end
9506
9507 !!test
9508 Templates: Wiki Tables: 1a. Fostering of entire template content
9509 !! wikitext
9510 {|
9511 {{echo|a}}
9512 |}
9513 !! html
9514 <table>
9515 a
9516 <tr><td></td></tr></table>
9517
9518 !!end
9519
9520 !!test
9521 Templates: Wiki Tables: 1b. Fostering of entire template content
9522 !! wikitext
9523 {|
9524 {{echo|<div>}}
9525 foo
9526 {{echo|</div>}}
9527 |}
9528 !! html
9529 <table>
9530 <div>
9531 <p>foo
9532 </p>
9533 </div>
9534 <tr><td></td></tr></table>
9535
9536 !!end
9537
9538 !!test
9539 Templates: Wiki Tables: 2. Fostering of partial template content
9540 !! wikitext
9541 {|
9542 {{echo|a
9543 <div>b</div>}}
9544 |}
9545 !! html
9546 <table>
9547 a
9548 <div>b</div>
9549 <tr><td></td></tr></table>
9550
9551 !!end
9552
9553 !!test
9554 Templates: Wiki Tables: 3. td-content via multiple templates
9555 !! wikitext
9556 {|
9557 {{echo|{{pipe}}a}}{{echo|b}}
9558 |}
9559 !! html
9560 <table>
9561 <tr>
9562 <td>ab
9563 </td></tr></table>
9564
9565 !!end
9566
9567 !!test
9568 Templates: Wiki Tables: 4. Templated tags, no content
9569 !! wikitext
9570 {{tbl-start}}
9571 {{tbl-end}}
9572 !! html
9573 <table>
9574 <tr><td></td></tr></table>
9575
9576 !!end
9577
9578 !!test
9579 Templates: Wiki Tables: 5. Templated tags, regular td-tags
9580 !! wikitext
9581 {{tbl-start}}
9582 |foo
9583 {{tbl-end}}
9584 !! html
9585 <table>
9586 <tr>
9587 <td>foo
9588 </td></tr></table>
9589
9590 !!end
9591
9592 !!test
9593 Templates: Wiki Tables: 6. Templated tags, templated td-tags
9594 !! wikitext
9595 {{tbl-start}}
9596 {{!}}foo
9597 {{tbl-end}}
9598 !! html
9599 <table>
9600 <tr>
9601 <td>foo
9602 </td></tr></table>
9603
9604 !!end
9605
9606 !!test
9607 Templates: Lists: Multi-line list-items via templates
9608 !! wikitext
9609 *{{echo|a {{nonexistent|
9610 unused}}}}
9611 *{{echo|b {{nonexistent|
9612 unused}}}}
9613 !! html
9614 <ul>
9615 <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>
9616 </li>
9617 <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>
9618 </li>
9619 </ul>
9620
9621 !!end
9622
9623 !!test
9624 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
9625 !! wikitext
9626 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
9627 !! html
9628 <p><i>ab</i>c<i>d</i>e
9629 </p>
9630 !!end
9631
9632 !!test
9633 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
9634 (PHP parser generates misnested html)
9635 !! wikitext
9636 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
9637 !! html/parsoid
9638 <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>
9639 !!end
9640
9641 !!test
9642 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
9643 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
9644 !! options
9645 parsoid=wt2html,wt2wt
9646 !! wikitext
9647 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
9648 !! html
9649 <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>
9650 <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>
9651 <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>
9652 !!end
9653
9654 !!test
9655 Templates: Ugly nesting: 4. Divs opened/closed across templates
9656 !! wikitext
9657 a<div>b{{echo|c</div>d}}e
9658 !! html
9659 a<div>bc</div>de
9660
9661 !!end
9662
9663 !!test
9664 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
9665 (Parsoid-centric)
9666 !! options
9667 parsoid
9668 !! wikitext
9669 {|
9670 |{{echo|foo</table>}}
9671 |bar
9672 |}
9673 !! html
9674 <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|}"]}'>
9675
9676 <tbody>
9677 <tr>
9678 <td>foo</td></tr></tbody></table><span about="#mwt1">
9679 </span><span about="#mwt1">|bar</span><span about="#mwt1">
9680 |}</span>
9681 !!end
9682
9683 !!test
9684 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
9685 (Parsoid-centric)
9686 !! options
9687 parsoid
9688 !! wikitext
9689 <table>
9690 <tr>
9691 <td>
9692 <table>
9693 <tr>
9694 <td>1. {{echo|foo </table>}}</td>
9695 <td> bar </td>
9696 <td>2. {{echo|baz </table>}}</td>
9697 </tr>
9698 <tr>
9699 <td>abc</td>
9700 </tr>
9701 </table>
9702 </td>
9703 </tr>
9704 <tr>
9705 <td>xyz</td>
9706 </tr>
9707 </table>
9708 !! html
9709 <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>"]}'>
9710 <tbody><tr>
9711 <td>
9712 <table>
9713 <tbody><tr>
9714 <td>1. foo </td></tr></tbody></table></td>
9715 <td> bar </td>
9716 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
9717 </span><span about="#mwt2">
9718 </span><span about="#mwt2">
9719 </span><span about="#mwt2">abc</span><span about="#mwt2">
9720 </span><span about="#mwt2">
9721 </span><span about="#mwt2">
9722 </span><span about="#mwt2">
9723 </span><span about="#mwt2">
9724 </span><span about="#mwt2">
9725 </span><span about="#mwt2">xyz</span><span about="#mwt2">
9726 </span><span about="#mwt2">
9727 </span>
9728 !!end
9729
9730 !! test
9731 Templates: Ugly templates: 3. newline-only template parameter
9732 !! wikitext
9733 foo {{echo|
9734 }}
9735 !! html
9736 <p>foo
9737 </p>
9738 !! end
9739
9740 # This looks like a bug: a single newline triggers p/br for some reason.
9741 !! test
9742 Templates: Ugly templates: 4. newline-only template parameter inconsistency
9743 !! wikitext
9744 {{echo|
9745 }}
9746 !! html
9747 <p><br />
9748 </p>
9749 !! end
9750
9751 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
9752 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
9753 !! test
9754 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
9755 !! wikitext
9756 {{echo|<table>}}
9757 {{echo|<div>foo}}
9758 {{echo|</table>}}
9759 !! html/parsoid
9760 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>foo"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/table>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'>foo
9761 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9762 </table>
9763 !! end
9764
9765 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
9766 # that are "identical" and generate nesting cycles in the algorithm
9767 !! test
9768 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
9769 !! wikitext
9770 {{echo|<table><tr><td><table>}}
9771 {{echo|<div>}}
9772 {{echo|</div>}}
9773 !! html/parsoid
9774 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>&lt;tr>&lt;td>&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/div>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
9775 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9776 </table></td></tr></tbody></table>
9777 !! end
9778
9779 !!test
9780 Parser Functions: 1. Simple example
9781 !! wikitext
9782 {{uc:foo}}
9783 !! html
9784 <p>FOO
9785 </p>
9786 !!end
9787
9788 !!test
9789 Parser Functions: 2. Nested use (only outermost should be marked up)
9790 !! wikitext
9791 {{uc:{{lc:FOO}}}}
9792 !! html
9793 <p>FOO
9794 </p>
9795 !!end
9796
9797 ###
9798 ### Pre-save transform tests
9799 ###
9800 !! test
9801 pre-save transform: subst:
9802 !! options
9803 PST
9804 !! wikitext
9805 {{subst:test}}
9806 !! html
9807 This is a test template
9808 !! end
9809
9810 !! test
9811 pre-save transform: normal template
9812 !! options
9813 PST
9814 !! wikitext
9815 {{test}}
9816 !! html
9817 {{test}}
9818 !! end
9819
9820 !! test
9821 pre-save transform: nonexistent template
9822 !! options
9823 PST
9824 !! wikitext
9825 {{thistemplatedoesnotexist}}
9826 !! html
9827 {{thistemplatedoesnotexist}}
9828 !! end
9829
9830
9831 !! test
9832 pre-save transform: subst magic variables
9833 !! options
9834 PST
9835 !! wikitext
9836 {{subst:SITENAME}}
9837 !! html
9838 MediaWiki
9839 !! end
9840
9841 # This is bug 89, which I fixed. -- wtm
9842 !! test
9843 pre-save transform: subst: templates with parameters
9844 !! options
9845 pst
9846 !! wikitext
9847 {{subst:paramtest|param="something else"}}
9848 !! html
9849 This is a test template with parameter "something else"
9850 !! end
9851
9852 !! article
9853 Template:nowikitest
9854 !! text
9855 <nowiki>'''not wiki'''</nowiki>
9856 !! endarticle
9857
9858 !! test
9859 pre-save transform: nowiki in subst (bug 1188)
9860 !! options
9861 pst
9862 !! wikitext
9863 {{subst:nowikitest}}
9864 !! html
9865 <nowiki>'''not wiki'''</nowiki>
9866 !! end
9867
9868
9869 !! article
9870 Template:commenttest
9871 !! text
9872 This template has <!-- a comment --> in it.
9873 !! endarticle
9874
9875 !! test
9876 pre-save transform: comment in subst (bug 1936)
9877 !! options
9878 pst
9879 !! wikitext
9880 {{subst:commenttest}}
9881 !! html
9882 This template has <!-- a comment --> in it.
9883 !! end
9884
9885 !! test
9886 pre-save transform: unclosed tag
9887 !! options
9888 pst noxml
9889 !! wikitext
9890 <nowiki>'''not wiki'''
9891 !! html
9892 <nowiki>'''not wiki'''
9893 !! end
9894
9895 !! test
9896 pre-save transform: mixed tag case
9897 !! options
9898 pst noxml
9899 !! wikitext
9900 <NOwiki>'''not wiki'''</noWIKI>
9901 !! html
9902 <NOwiki>'''not wiki'''</noWIKI>
9903 !! end
9904
9905 !! test
9906 pre-save transform: unclosed comment in <nowiki>
9907 !! options
9908 pst noxml
9909 !! wikitext
9910 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9911 !! html
9912 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9913 !!end
9914
9915 # Leading @ in this template definition works around a limitation
9916 # in parsoid's parserTests which otherwise strips the <span> from the
9917 # result (confusing it for a template wrapper)
9918 !! article
9919 Template:dangerous
9920 !!text
9921 @<span onmouseover="alert('crap')">Oh no</span>
9922 !!endarticle
9923
9924 !!test
9925 (confirming safety of fix for subst bug 1936)
9926 !! wikitext
9927 {{Template:dangerous}}
9928 !! html
9929 <p>@<span>Oh no</span>
9930 </p>
9931 !! end
9932
9933 !! test
9934 pre-save transform: comment containing gallery (bug 5024)
9935 !! options
9936 pst
9937 !! wikitext
9938 <!-- <gallery>data</gallery> -->
9939 !! html
9940 <!-- <gallery>data</gallery> -->
9941 !!end
9942
9943 !! test
9944 pre-save transform: comment containing extension
9945 !! options
9946 pst
9947 !! wikitext
9948 <!-- <tag>data</tag> -->
9949 !! html
9950 <!-- <tag>data</tag> -->
9951 !!end
9952
9953 !! test
9954 pre-save transform: comment containing nowiki
9955 !! options
9956 pst
9957 !! wikitext
9958 <!-- <nowiki>data</nowiki> -->
9959 !! html
9960 <!-- <nowiki>data</nowiki> -->
9961 !!end
9962
9963 !! test
9964 pre-save transform: <noinclude> in subst (bug 3298)
9965 !! options
9966 pst
9967 !! wikitext
9968 {{subst:Includes}}
9969 !! html
9970 Foobar
9971 !! end
9972
9973 !! test
9974 pre-save transform: <onlyinclude> in subst (bug 3298)
9975 !! options
9976 pst
9977 !! wikitext
9978 {{subst:Includes2}}
9979 !! html
9980 Foo
9981 !! end
9982
9983 !! article
9984 Template:SubstTest
9985 !!text
9986 {{<includeonly>subst:</includeonly>Includes}}
9987 !! endarticle
9988
9989 !! article
9990 Template:SafeSubstTest
9991 !! text
9992 {{<includeonly>safesubst:</includeonly>Includes}}
9993 !! endarticle
9994
9995 !! test
9996 bug 22297: safesubst: works during PST
9997 !! options
9998 pst
9999 !! wikitext
10000 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
10001 !! html
10002 FoobarFoobar
10003 !! end
10004
10005 !! test
10006 bug 22297: safesubst: works during normal parse
10007 !! wikitext
10008 {{SafeSubstTest}}
10009 !! html
10010 <p>Foobar
10011 </p>
10012 !! end
10013
10014 !! test
10015 subst: does not work during normal parse
10016 !! wikitext
10017 {{SubstTest}}
10018 !! html
10019 <p>{{subst:Includes}}
10020 </p>
10021 !! end
10022
10023 !! test
10024 pre-save transform: context links ("pipe trick")
10025 !! options
10026 pst
10027 !! wikitext
10028 [[Article (context)|]]
10029 [[Bar:Article|]]
10030 [[:Bar:Article|]]
10031 [[Bar:Article (context)|]]
10032 [[:Bar:Article (context)|]]
10033 [[|Article]]
10034 [[|Article (context)]]
10035 [[Bar:X (Y) Z|]]
10036 [[:Bar:X (Y) Z|]]
10037 !! html
10038 [[Article (context)|Article]]
10039 [[Bar:Article|Article]]
10040 [[:Bar:Article|Article]]
10041 [[Bar:Article (context)|Article]]
10042 [[:Bar:Article (context)|Article]]
10043 [[Article]]
10044 [[Article (context)]]
10045 [[Bar:X (Y) Z|X (Y) Z]]
10046 [[:Bar:X (Y) Z|X (Y) Z]]
10047 !! end
10048
10049 !! test
10050 pre-save transform: context links ("pipe trick") with interwiki prefix
10051 !! options
10052 pst
10053 !! wikitext
10054 [[interwiki:Article|]]
10055 [[:interwiki:Article|]]
10056 [[interwiki:Bar:Article|]]
10057 [[:interwiki:Bar:Article|]]
10058 !! html
10059 [[interwiki:Article|Article]]
10060 [[:interwiki:Article|Article]]
10061 [[interwiki:Bar:Article|Bar:Article]]
10062 [[:interwiki:Bar:Article|Bar:Article]]
10063 !! end
10064
10065 !! test
10066 pre-save transform: context links ("pipe trick") with parens in title
10067 !! options
10068 pst title=[[Somearticle (context)]]
10069 !! wikitext
10070 [[|Article]]
10071 !! html
10072 [[Article (context)|Article]]
10073 !! end
10074
10075 !! test
10076 pre-save transform: context links ("pipe trick") with comma in title
10077 !! options
10078 pst title=[[Someplace, Somewhere]]
10079 !! wikitext
10080 [[|Otherplace]]
10081 [[Otherplace, Elsewhere|]]
10082 [[Otherplace, Elsewhere, Anywhere|]]
10083 !! html
10084 [[Otherplace, Somewhere|Otherplace]]
10085 [[Otherplace, Elsewhere|Otherplace]]
10086 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
10087 !! end
10088
10089 !! test
10090 pre-save transform: context links ("pipe trick") with parens and comma
10091 !! options
10092 pst title=[[Someplace (IGNORED), Somewhere]]
10093 !! wikitext
10094 [[|Otherplace]]
10095 [[Otherplace (place), Elsewhere|]]
10096 !! html
10097 [[Otherplace, Somewhere|Otherplace]]
10098 [[Otherplace (place), Elsewhere|Otherplace]]
10099 !! end
10100
10101 !! test
10102 pre-save transform: context links ("pipe trick") with comma and parens
10103 !! options
10104 pst title=[[Who, me? (context)]]
10105 !! wikitext
10106 [[|Yes, you.]]
10107 [[Me, Myself, and I (1937 song)|]]
10108 !! html
10109 [[Yes, you. (context)|Yes, you.]]
10110 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
10111 !! end
10112
10113 !! test
10114 pre-save transform: context links ("pipe trick") with namespace
10115 !! options
10116 pst title=[[Ns:Somearticle]]
10117 !! wikitext
10118 [[|Article]]
10119 !! html
10120 [[Ns:Article|Article]]
10121 !! end
10122
10123 !! test
10124 pre-save transform: context links ("pipe trick") with namespace and parens
10125 !! options
10126 pst title=[[Ns:Somearticle (context)]]
10127 !! wikitext
10128 [[|Article]]
10129 !! html
10130 [[Ns:Article (context)|Article]]
10131 !! end
10132
10133 !! test
10134 pre-save transform: context links ("pipe trick") with namespace and comma
10135 !! options
10136 pst title=[[Ns:Somearticle, Context, Whatever]]
10137 !! wikitext
10138 [[|Article]]
10139 !! html
10140 [[Ns:Article, Context, Whatever|Article]]
10141 !! end
10142
10143 !! test
10144 pre-save transform: context links ("pipe trick") with namespace, comma and parens
10145 !! options
10146 pst title=[[Ns:Somearticle, Context (context)]]
10147 !! wikitext
10148 [[|Article]]
10149 !! html
10150 [[Ns:Article (context)|Article]]
10151 !! end
10152
10153 !! test
10154 pre-save transform: context links ("pipe trick") with namespace, parens and comma
10155 !! options
10156 pst title=[[Ns:Somearticle (IGNORED), Context]]
10157 !! wikitext
10158 [[|Article]]
10159 !! html
10160 [[Ns:Article, Context|Article]]
10161 !! end
10162
10163 !! test
10164 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
10165 !! options
10166 pst
10167 !! wikitext
10168 [[Article(context)|]]
10169 [[Bar:Article(context)|]]
10170 [[:Bar:Article(context)|]]
10171 [[|Article(context)]]
10172 [[Bar:X(Y)Z|]]
10173 [[:Bar:X(Y)Z|]]
10174 !! html
10175 [[Article(context)|Article]]
10176 [[Bar:Article(context)|Article]]
10177 [[:Bar:Article(context)|Article]]
10178 [[Article(context)]]
10179 [[Bar:X(Y)Z|X(Y)Z]]
10180 [[:Bar:X(Y)Z|X(Y)Z]]
10181 !! end
10182
10183 !! test
10184 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
10185 !! options
10186 pst
10187 !! wikitext
10188 [[Article (context)|]]
10189 [[Bar:Article (context)|]]
10190 [[:Bar:Article (context)|]]
10191 [[|Article (context)]]
10192 [[Bar:X (Y) Z|]]
10193 [[:Bar:X (Y) Z|]]
10194 !! html
10195 [[Article (context)|Article]]
10196 [[Bar:Article (context)|Article]]
10197 [[:Bar:Article (context)|Article]]
10198 [[Article (context)]]
10199 [[Bar:X (Y) Z|X (Y) Z]]
10200 [[:Bar:X (Y) Z|X (Y) Z]]
10201 !! end
10202
10203 !! test
10204 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
10205 !! options
10206 pst
10207 !! wikitext
10208 [[Article(context)|]]
10209 [[Bar:Article(context)|]]
10210 [[:Bar:Article(context)|]]
10211 [[|Article(context)]]
10212 [[Bar:X(Y)Z|]]
10213 [[:Bar:X(Y)Z|]]
10214 !! html
10215 [[Article(context)|Article]]
10216 [[Bar:Article(context)|Article]]
10217 [[:Bar:Article(context)|Article]]
10218 [[Article(context)]]
10219 [[Bar:X(Y)Z|X(Y)Z]]
10220 [[:Bar:X(Y)Z|X(Y)Z]]
10221 !! end
10222
10223 !! test
10224 pre-save transform: context links ("pipe trick") with commas (bug 21660)
10225 !! options
10226 pst
10227 !! wikitext
10228 [[Article (context), context|]]
10229 [[Article (context),context|]]
10230 [[Bar:Article (context), context|]]
10231 [[Bar:Article (context),context|]]
10232 [[:Bar:Article (context), context|]]
10233 [[:Bar:Article (context),context|]]
10234 !! html
10235 [[Article (context), context|Article]]
10236 [[Article (context),context|Article]]
10237 [[Bar:Article (context), context|Article]]
10238 [[Bar:Article (context),context|Article]]
10239 [[:Bar:Article (context), context|Article]]
10240 [[:Bar:Article (context),context|Article]]
10241 !! end
10242
10243 !! test
10244 pre-save transform: trim trailing empty lines
10245 !! options
10246 pst
10247 !! wikitext
10248 Empty lines are trimmed
10249
10250
10251
10252
10253 !! html
10254 Empty lines are trimmed
10255 !! end
10256
10257 !! test
10258 pre-save transform: Signature expansion
10259 !! options
10260 pst
10261 !! wikitext
10262 * ~~~
10263 * <noinclude>~~~</noinclude>
10264 * <includeonly>~~~</includeonly>
10265 * <onlyinclude>~~~</onlyinclude>
10266 !! html
10267 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
10268 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
10269 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
10270 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
10271 !! end
10272
10273
10274 !! test
10275 pre-save transform: Signature expansion in nowiki tags (bug 93)
10276 !! options
10277 pst disabled
10278 !! wikitext
10279 Shall not expand:
10280
10281 <nowiki>~~~~</nowiki>
10282
10283 <includeonly><nowiki>~~~~</nowiki></includeonly>
10284
10285 <noinclude><nowiki>~~~~</nowiki></noinclude>
10286
10287 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10288
10289 {{subst:Foo}} shall be converted to FOO
10290
10291 As well as inside noinclude/onlyinclude
10292 <noinclude>{{subst:Foo}}</noinclude>
10293 <onlyinclude>{{subst:Foo}}</onlyinclude>
10294
10295 But not inside includeonly
10296 <includeonly>{{subst:Foo}}</includeonly>
10297 !! html
10298 Shall not expand:
10299
10300 <nowiki>~~~~</nowiki>
10301
10302 <includeonly><nowiki>~~~~</nowiki></includeonly>
10303
10304 <noinclude><nowiki>~~~~</nowiki></noinclude>
10305
10306 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10307
10308 FOO shall be converted to FOO
10309
10310 As well as inside noinclude/onlyinclude
10311 <noinclude>FOO</noinclude>
10312 <onlyinclude>FOO</onlyinclude>
10313
10314 But not inside includeonly
10315 <includeonly>{{subst:Foo}}</includeonly>
10316 !! end
10317
10318 !! test
10319 Parsoid: Recognize nowiki with trailing space in tags
10320 !! options
10321 parsoid=wt2html
10322 !! wikitext
10323 <nowiki ><div>[[foo]]</nowiki >
10324
10325 a<nowiki / >b
10326
10327 c<nowiki />d
10328
10329 e<nowiki/ >f
10330 !! html
10331 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10332 <p>ab</p>
10333 <p>cd</p>
10334 <p>ef</p>
10335 !! end
10336
10337 !! test
10338 Parsoid: Recognize nowiki with odd capitalization
10339 !! options
10340 parsoid=wt2html
10341 !! wikitext
10342 <noWikI ><div>[[foo]]</Nowiki >
10343 !! html
10344 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10345 !! end
10346
10347
10348 !! test
10349 Parsoid: Escape nowiki with trailing space in tags
10350 !! options
10351 parsoid=html2wt
10352 !! wikitext
10353 &lt;nowiki &gt; foo &lt;/nowiki &gt;
10354
10355 a&lt;nowiki /&gt;b
10356
10357 c&lt;nowiki/ &gt;d
10358 !! html
10359 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
10360 <p>a&lt;nowiki /&gt;b</p>
10361 <p>c&lt;nowiki/ &gt;d</p>
10362 !! end
10363
10364 !! test
10365 Parsoid: Escape weird noWikI capitalizations
10366 !! options
10367 parsoid=html2wt
10368 !! wikitext
10369 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
10370 !! html
10371 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
10372 !! end
10373
10374 ###
10375 ### Message transform tests
10376 ###
10377 !! test
10378 message transform: magic variables
10379 !! options
10380 msg
10381 !! wikitext
10382 {{SITENAME}}
10383 !! html
10384 MediaWiki
10385 !! end
10386
10387 !! test
10388 message transform: should not transform wiki markup
10389 !! options
10390 msg
10391 !! wikitext
10392 ''test''
10393 !! html
10394 ''test''
10395 !! end
10396
10397 !! test
10398 message transform: <noinclude> in transcluded template (bug 4926)
10399 !! options
10400 msg
10401 !! wikitext
10402 {{Includes}}
10403 !! html
10404 Foobar
10405 !! end
10406
10407 !! test
10408 message transform: <onlyinclude> in transcluded template (bug 4926)
10409 !! options
10410 msg
10411 !! wikitext
10412 {{Includes2}}
10413 !! html
10414 Foo
10415 !! end
10416
10417 !! test
10418 {{#special:}} page name, known
10419 !! options
10420 msg
10421 !! wikitext
10422 {{#special:Recentchanges}}
10423 !! html
10424 Special:RecentChanges
10425 !! end
10426
10427 !! test
10428 {{#special:}} page name with subpage, known
10429 !! options
10430 msg
10431 !! wikitext
10432 {{#special:Recentchanges/param}}
10433 !! html
10434 Special:RecentChanges/param
10435 !! end
10436
10437 !! test
10438 {{#special:}} page name, unknown
10439 !! options
10440 msg
10441 !! wikitext
10442 {{#special:foobar nonexistent}}
10443 !! html
10444 Special:Foobar nonexistent
10445 !! end
10446
10447 !! test
10448 {{#speciale:}} page name, known
10449 !! options
10450 msg
10451 !! wikitext
10452 {{#speciale:Recentchanges}}
10453 !! html
10454 Special:RecentChanges
10455 !! end
10456
10457 !! test
10458 {{#speciale:}} page name with subpage, known
10459 !! options
10460 msg
10461 !! wikitext
10462 {{#speciale:Recentchanges/param}}
10463 !! html
10464 Special:RecentChanges/param
10465 !! end
10466
10467 !! test
10468 {{#speciale:}} page name, unknown
10469 !! options
10470 msg
10471 !! wikitext
10472 {{#speciale:foobar nonexistent}}
10473 !! html
10474 Special:Foobar_nonexistent
10475 !! end
10476
10477 ###
10478 ### Images
10479 ###
10480 ### For Parsoid-specific tests, see
10481 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10482
10483 !! test
10484 Simple image
10485 !! options
10486 parsoid=wt2html,wt2wt,html2html
10487 !! wikitext
10488 [[Image:foobar.jpg]]
10489 !! html/php
10490 <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>
10491 </p>
10492 !! html/parsoid
10493 <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>
10494 </p>
10495 !! end
10496
10497 !! test
10498 Simple image (using File: namespace, now canonical)
10499 !! wikitext
10500 [[File:Foobar.jpg]]
10501 !! html/php
10502 <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>
10503 </p>
10504 !! html/parsoid
10505 <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>
10506 </p>
10507 !! end
10508
10509 !! test
10510 Right-aligned image
10511 !! wikitext
10512 [[File:Foobar.jpg|right]]
10513 !! html/php
10514 <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>
10515
10516 !! html/parsoid
10517 <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>
10518 !! end
10519
10520 !! test
10521 Image with caption
10522 !! wikitext
10523 [[File:Foobar.jpg|right|Caption text]]
10524 !! html/php
10525 <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>
10526
10527 !! html/parsoid
10528 <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>
10529 !! end
10530
10531 !! test
10532 Image with caption, bug 53312 #1
10533 !! wikitext
10534 [[File:Foobar.jpg|right|Caption page stuff]]
10535 !! html/php
10536 <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>
10537
10538 !! html/parsoid
10539 <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>
10540 !! end
10541
10542 !! test
10543 Image with caption, bug 53312 #2
10544 !! wikitext
10545 [[File:Foobar.jpg|right|Caption page=]]
10546 !! html/php
10547 <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>
10548
10549 !! html/parsoid
10550 <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>
10551 !! end
10552
10553 !! test
10554 Image with caption, bug 53312 #3
10555 !! wikitext
10556 [[File:Foobar.jpg|right|Caption page=stuff]]
10557 !! html/php
10558 <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>
10559
10560 !! html/parsoid
10561 <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>
10562 !! end
10563
10564 !! test
10565 Allow empty links in image captions (Bug 60753)
10566 !! options
10567 thumbsize=220
10568 !! wikitext
10569 [[File:Foobar.jpg|thumb|Caption [[Link1]]
10570 [[]]
10571 [[Link2]]
10572 ]]
10573 !! html/php
10574 <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>
10575
10576 !! html/parsoid
10577 <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>
10578 [[]]
10579 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
10580 </figcaption></figure>
10581 !! end
10582
10583 !! test
10584 Link with empty target
10585 !! wikitext
10586 [[]]
10587 !! html
10588 <p>[[]]
10589 </p>
10590 !! end
10591
10592 !! test
10593 Image with empty attribute
10594 !! options
10595 parsoid=wt2html,wt2wt,html2html
10596 !! wikitext
10597 [[File:Foobar.jpg|right||Caption text]]
10598 !! html/php
10599 <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>
10600
10601 !! html/parsoid
10602 <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>
10603 !! end
10604
10605 !! test
10606 1. Block image with individual attributes from templates
10607 !! wikitext
10608 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
10609 !! html/php
10610 <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>
10611
10612 !! html/parsoid
10613 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[24,38,null,null]}\">137px&lt;/span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
10614 !! end
10615
10616 !! test
10617 2. Block Image with individual attributes from templates
10618 !! wikitext
10619 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
10620 !! html/php
10621 <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>
10622
10623 !! html/parsoid
10624 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,32,null,null]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[33,47,null,null]}\">137px&lt;/span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
10625 !! end
10626
10627 !! test
10628 3. Inline image with individual attributes from templates
10629 !! wikitext
10630 [[File:Foobar.jpg|{{echo|50px}}]]
10631 !! html/php
10632 <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>
10633 </p>
10634 !! html/parsoid
10635 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;50px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,31,null,null]}\">50px&lt;/span>"}]]}' data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
10636 !! end
10637
10638 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
10639 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
10640 !! test
10641 Image with multiple attributes from the same template
10642 !! wikitext
10643 [[File:Foobar.jpg|{{image_attribs}}]]
10644 !! html/php
10645 <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>
10646
10647 !! html/parsoid
10648 <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>
10649 !! end
10650
10651 !! test
10652 Image with link tails
10653 !! options
10654 thumbsize=220
10655 !! wikitext
10656 123[[File:Foobar.jpg]]456
10657 123[[File:Foobar.jpg|right]]456
10658 123[[File:Foobar.jpg|thumb]]456
10659 !! html/php
10660 <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
10661 </p>
10662 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
10663 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
10664
10665 !! html/parsoid
10666 <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>
10667 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
10668 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
10669 !! end
10670
10671 !! test
10672 Image with multiple captions -- only last one is accepted
10673 !! wikitext
10674 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
10675 !! html/php
10676 <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>
10677
10678 !! html/parsoid
10679 <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>
10680 !! end
10681
10682 !! test
10683 Image with multiple widths -- use last
10684 !! wikitext
10685 [[File:Foobar.jpg|200px|300px|caption]]
10686 !! html/php
10687 <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>
10688 </p>
10689 !! html/parsoid
10690 <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>
10691 !! end
10692
10693 !! test
10694 Image with multiple alignments -- use first (bug 48664)
10695 !! options
10696 thumbsize=220
10697 !! wikitext
10698 [[File:Foobar.jpg|thumb|left|right|center|caption]]
10699
10700 [[File:Foobar.jpg|middle|text-top|caption]]
10701 !! html/php
10702 <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>
10703 <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>
10704 </p>
10705 !! html/parsoid
10706 <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>
10707 <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>
10708 !! end
10709
10710 !! test
10711 Image with width attribute at different positions
10712 !! wikitext
10713 [[File:Foobar.jpg|200px|right|Caption]]
10714 [[File:Foobar.jpg|right|200px|Caption]]
10715 [[File:Foobar.jpg|right|Caption|200px]]
10716 !! html/php
10717 <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>
10718 <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>
10719 <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>
10720
10721 !! html/parsoid
10722 <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>
10723 <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>
10724 <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>
10725 !! end
10726
10727 # a sad bit of backward-compatibility
10728 !! test
10729 Image with size specified with pxpx (bug 13500, 51628)
10730 !! options
10731 parsoid=wt2html,wt2wt,html2html
10732 !! wikitext
10733 [[File:Foobar.jpg|20pxpx]]
10734 [[File:Foobar.jpg|200x20pxpx]]
10735 !! html/php
10736 <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>
10737 <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>
10738 </p>
10739 !! html/parsoid
10740 <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>
10741 !! end
10742
10743 !! test
10744 Image with link parameter, wiki target
10745 !! wikitext
10746 [[File:Foobar.jpg|link=Main Page]]
10747 !! html/php
10748 <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>
10749 </p>
10750 !! html/parsoid
10751 <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>
10752 !! end
10753
10754 # parsoid bug 49293 (part 1)
10755 !! test
10756 Image with link parameter, URL target
10757 !! wikitext
10758 [[File:Foobar.jpg|link=http://example.com/]]
10759 !! html/php
10760 <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>
10761 </p>
10762 !! html/parsoid
10763 <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>
10764 !! end
10765
10766 # parsoid bug 49293 (part 2)
10767 !! test
10768 Image with link parameter, protocol-less URL target
10769 !! wikitext
10770 [[File:Foobar.jpg|link=//example.com/]]
10771 !! html/php
10772 <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>
10773 </p>
10774 !! html/parsoid
10775 <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>
10776 !! end
10777
10778 !! test
10779 Image with link parameter, wgExternalLinkTarget
10780 !! wikitext
10781 [[Image:foobar.jpg|link=http://example.com/]]
10782 !! config
10783 wgExternalLinkTarget='foobar'
10784 !! html
10785 <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>
10786 </p>
10787 !! end
10788
10789 !! test
10790 Image with link parameter, wgNoFollowLinks set to false
10791 !! wikitext
10792 [[Image:foobar.jpg|link=http://example.com/]]
10793 !! config
10794 wgNoFollowLinks=false
10795 !! html
10796 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10797 </p>
10798 !! end
10799
10800 !! test
10801 Image with link parameter, wgNoFollowDomainExceptions
10802 !! wikitext
10803 [[Image:foobar.jpg|link=http://example.com/]]
10804 !! config
10805 wgNoFollowDomainExceptions='example.com'
10806 !! html
10807 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10808 </p>
10809 !! end
10810
10811 !! test
10812 Image with link parameter, wgExternalLinkTarget, unnamed parameter
10813 !! wikitext
10814 [[Image:foobar.jpg|link=http://example.com/|Title]]
10815 !! config
10816 wgExternalLinkTarget='foobar'
10817 !! html
10818 <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>
10819 </p>
10820 !! end
10821
10822 !! test
10823 Image with empty link parameter
10824 !! wikitext
10825 [[File:Foobar.jpg|link=]]
10826 !! html/php
10827 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10828 </p>
10829 !! html/parsoid
10830 <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>
10831 !! end
10832
10833 !! test
10834 Image with link parameter (wiki target) and unnamed parameter
10835 !! wikitext
10836 [[File:Foobar.jpg|link=Main_Page|Title]]
10837 !! html/php
10838 <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>
10839 </p>
10840 !! html/parsoid
10841 <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>
10842 !! end
10843
10844 !! test
10845 Image with link parameter (URL target) and unnamed parameter
10846 !! wikitext
10847 [[File:Foobar.jpg|link=http://example.com/|Title]]
10848 !! html/php
10849 <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>
10850 </p>
10851 !! html/parsoid
10852 <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>
10853 !! end
10854
10855 !! test
10856 Thumbnail image with link parameter
10857 !! options
10858 thumbsize=220
10859 parsoid=wt2html,wt2wt,html2html
10860 !! wikitext
10861 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
10862 !! html/php
10863 <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>
10864
10865 !! html/parsoid
10866 <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>
10867 !! end
10868
10869 !! test
10870 Manually-specified thumbnail image
10871 !! options
10872 thumbsize=220
10873 !! wikitext
10874 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
10875 !! html/php
10876 <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>
10877
10878 !! html/parsoid
10879 <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>
10880 !! end
10881
10882 !! test
10883 Manually-specified thumbnail image with explicit link to wiki page
10884 !! options
10885 thumbsize=220
10886 parsoid=wt2html,wt2wt,html2html
10887 !! wikitext
10888 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
10889 !! html/php
10890 <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>
10891
10892 !! html/parsoid
10893 <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>
10894 !! end
10895
10896 !! test
10897 Manually-specified thumbnail image with explicit link to url
10898 !! options
10899 thumbsize=220
10900 parsoid=wt2html,wt2wt,html2html
10901 !! wikitext
10902 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10903 !! html/php
10904 <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>
10905
10906 !! html/parsoid
10907 <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>
10908 !! end
10909
10910 !! test
10911 Manually-specified thumbnail image with explicit no link
10912 !! options
10913 thumbsize=220
10914 parsoid=wt2html,wt2wt,html2html
10915 !! wikitext
10916 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10917 !! html/php
10918 <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>
10919
10920 !! html/parsoid
10921 <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>
10922 !! end
10923
10924 !! test
10925 Manually-specified thumbnail image with explicit link and alt text
10926 !! options
10927 thumbsize=220
10928 parsoid=wt2html,wt2wt,html2html
10929 !! wikitext
10930 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
10931 !! html/php
10932 <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>
10933
10934 !! html/parsoid
10935 <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>
10936 !! end
10937
10938 !! test
10939 Image with frame and link
10940 !! options
10941 parsoid=wt2html,wt2wt,html2html
10942 !! wikitext
10943 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10944 !! html/php
10945 <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>
10946
10947 !! html/parsoid
10948 <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>
10949 !! end
10950
10951 !! test
10952 Image with frame and link and explicit alt
10953 !! options
10954 parsoid=wt2html,wt2wt,html2html
10955 !! wikitext
10956 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10957 !! html/php
10958 <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>
10959
10960 !! html/parsoid
10961 <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>
10962 !! end
10963
10964 !! test
10965 Image with wiki markup in implicit alt
10966 !! options
10967 parsoid=wt2html,wt2wt,html2html
10968 !! wikitext
10969 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10970
10971 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10972 !! html/php
10973 <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>
10974 </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>
10975 </p>
10976 !! html/parsoid
10977 <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>
10978 <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>
10979 !! end
10980
10981 ###################
10982 # Conflicting image format options.
10983 # First option specified should 'win'.
10984 # All three cases in each test should be identical.
10985
10986 !! test
10987 Image with 'frameless' first.
10988 !! options
10989 parsoid=wt2html,wt2wt,html2html
10990 !! wikitext
10991 [[File:Foobar.jpg|frameless|caption]]
10992
10993 [[File:Foobar.jpg|frameless|frame|caption]]
10994
10995 [[File:Foobar.jpg|frameless|thumb|caption]]
10996 !! html/php
10997 <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>
10998 </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>
10999 </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>
11000 </p>
11001 !! html/parsoid
11002 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a></span></p>
11003 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a></span></p>
11004 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a></span></p>
11005 !! end
11006
11007 !! test
11008 Image with 'frame' first.
11009 !! options
11010 parsoid=wt2html,wt2wt,html2html
11011 !! wikitext
11012 [[File:Foobar.jpg|frame|caption]]
11013 [[File:Foobar.jpg|frame|frameless|caption]]
11014 [[File:Foobar.jpg|frame|thumb|caption]]
11015 !! html/php
11016 <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>
11017 <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>
11018 <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>
11019
11020 !! html/parsoid
11021 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a><figcaption>caption</figcaption></figure><figure class="mw-default-size" typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a><figcaption>caption</figcaption></figure><figure class="mw-default-size" typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
11022 !! end
11023
11024 !! test
11025 Image with 'thumb' first.
11026 !! options
11027 parsoid=wt2html,wt2wt,html2html
11028 !! wikitext
11029 [[File:Foobar.jpg|thumb|caption]]
11030 [[File:Foobar.jpg|thumb|frameless|caption]]
11031 [[File:Foobar.jpg|thumb|frame|caption]]
11032 !! html/php
11033 <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>
11034 <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>
11035 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
11036
11037 !! html/parsoid
11038 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
11039 !! end
11040
11041 ###################
11042 # Image sizing.
11043 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
11044 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
11045 # Foobar has actual size of 1941x220
11046 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
11047 # a scalable format.
11048 # 2. Framed images always ignore size options; always render at default size.
11049 # 3. "Unspecified format" and border are the only types which can be
11050 # enlarged.
11051
11052 !! test
11053 Image: "unspecified format" and border enlarge
11054 !! options
11055 parsoid=wt2html,wt2wt,html2html
11056 !! wikitext
11057 [[File:Foobar.jpg|2000px]]
11058
11059 [[File:Foobar.jpg|border|2000px]]
11060 !! html/php
11061 <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>
11062 </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>
11063 </p>
11064 !! html/parsoid
11065 <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>
11066 <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>
11067 !! end
11068
11069 !! test
11070 Image: "unspecified format" and border reduce
11071 !! options
11072 parsoid=wt2html,wt2wt,html2html
11073 !! wikitext
11074 [[File:Foobar.jpg|1000px]]
11075
11076 [[File:Foobar.jpg|border|1000px]]
11077 !! html/php
11078 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/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>
11079 </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>
11080 </p>
11081 !! html/parsoid
11082 <p><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="113" width="1000"/></a></span></p>
11083 <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>
11084 !! end
11085
11086 !! test
11087 Image: thumbs reduce
11088 !! options
11089 parsoid=wt2html,wt2wt,html2html
11090 !! wikitext
11091 [[File:Foobar.jpg|thumb|50px]]
11092 !! html/php
11093 <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>
11094
11095 !! html/parsoid
11096 <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>
11097 !! end
11098
11099 !! test
11100 Image: bitmap thumbs can't be enlarged past original size, but vector can.
11101 !! options
11102 parsoid=wt2html,wt2wt,html2html
11103 !! wikitext
11104 [[File:Foobar.jpg|thumb|2000px]]
11105
11106 [[File:Foobar.svg|thumb|2000px]]
11107 !! html/php
11108 <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>
11109 <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>
11110
11111 !! html/parsoid
11112 <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>
11113 <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>
11114 !! end
11115
11116 !! test
11117 Image: frameless can reduce in size
11118 !! options
11119 parsoid=wt2html,wt2wt,html2html
11120 !! wikitext
11121 [[File:Foobar.jpg|frameless|50px]]
11122 !! html/php
11123 <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>
11124 </p>
11125 !! html/parsoid
11126 <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>
11127 !! end
11128
11129 !! test
11130 Image: bitmap frameless can't be enlarged past original size, but vector can
11131 !! options
11132 parsoid=wt2html,wt2wt,html2html
11133 !! wikitext
11134 [[File:Foobar.jpg|frameless|2000px]]
11135
11136 [[File:Foobar.svg|frameless|2000px]]
11137 !! html/php
11138 <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>
11139 </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>
11140 </p>
11141 !! html/parsoid
11142 <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>
11143 <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>
11144 !! end
11145
11146 !! test
11147 Image: framed images are always unscaled.
11148 !! options
11149 parsoid=wt2html,wt2wt,html2html
11150 !! wikitext
11151 [[File:Foobar.jpg|frame]]
11152
11153 [[File:Foobar.jpg|frame|50px]]
11154
11155 [[File:Foobar.jpg|frame|50x50px]]
11156
11157 [[File:Foobar.jpg|frame|2000px]]
11158 !! html/php
11159 <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>
11160 <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>
11161 <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>
11162 <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>
11163
11164 !! html/parsoid
11165 <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>
11166 !! end
11167
11168 ###################
11169
11170 !! test
11171 Link to image page- image page normally doesn't exists, hence edit link
11172 Add test with existing image page
11173 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
11174 !! wikitext
11175 [[:Image:test]]
11176 !! html
11177 <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>
11178 </p>
11179 !! end
11180
11181 !! test
11182 bug 18784 Link to non-existent image page with caption should use caption as link text
11183 !! wikitext
11184 [[:Image:test|caption]]
11185 !! html
11186 <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>
11187 </p>
11188 !! end
11189
11190 !! test
11191 Frameless image caption with a free URL
11192 !! wikitext
11193 [[File:Foobar.jpg|http://example.com]]
11194 !! html/php
11195 <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>
11196 </p>
11197 !! html/parsoid
11198 <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>
11199 !! end
11200
11201 !! test
11202 Thumbnail image caption with a free URL
11203 !! options
11204 thumbsize=220
11205 !! wikitext
11206 [[File:Foobar.jpg|thumb|http://example.com]]
11207 !! html/php
11208 <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>
11209
11210 !! html/parsoid
11211 <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>
11212 !! end
11213
11214 !! test
11215 Thumbnail image caption with a free URL and explicit alt
11216 !! options
11217 thumbsize=220
11218 parsoid=wt2html,wt2wt,html2html
11219 !! wikitext
11220 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
11221 !! html/php
11222 <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>
11223
11224 !! html/parsoid
11225 <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>
11226 !! end
11227
11228 !! test
11229 SVG thumbnails with no language set
11230 !! options
11231 !! wikitext
11232 [[File:Foobar.svg|thumb|caption]]
11233 !! html/php
11234 <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>
11235
11236 !! html/parsoid
11237 <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>
11238 !! end
11239
11240 !! test
11241 SVG thumbnails with language de
11242 !! options
11243 parsoid=wt2html,wt2wt,html2html
11244 !! wikitext
11245 [[File:Foobar.svg|thumb|caption|lang=de]]
11246 !! html/php
11247 <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>
11248
11249 !! html/parsoid
11250 <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>
11251 !! end
11252
11253 !! test
11254 SVG thumbnails with invalid language code
11255 !! options
11256 parsoid=wt2html,wt2wt,html2html
11257 !! wikitext
11258 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
11259 !! html/php
11260 <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>
11261
11262 !! html/parsoid
11263 <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>
11264 !! end
11265
11266 !! test
11267 BUG 1887: A ISBN with a thumbnail
11268 !! wikitext
11269 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
11270 !! html/php
11271 <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>
11272
11273 !! html/parsoid
11274 <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>
11275 !! end
11276
11277 !! test
11278 BUG 1887: A RFC with a thumbnail
11279 !! wikitext
11280 [[File:Foobar.jpg|thumb|This is RFC 12354]]
11281 !! html/php
11282 <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>
11283
11284 !! html/parsoid
11285 <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>
11286 !! end
11287
11288 !! test
11289 BUG 1887: A mailto link with a thumbnail
11290 !! wikitext
11291 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
11292 !! html/php
11293 <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>
11294
11295 !! html/parsoid
11296 <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>
11297 !! end
11298
11299 # Pending resolution to bug 368
11300 !! test
11301 BUG 648: Frameless image caption with a link
11302 !! wikitext
11303 [[File:Foobar.jpg|text with a [[link]] in it]]
11304 !! html/php
11305 <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>
11306 </p>
11307 !! html/parsoid
11308 <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>
11309 !! end
11310
11311 !! test
11312 BUG 648: Frameless image caption with a link (suffix)
11313 !! wikitext
11314 [[File:Foobar.jpg|text with a [[link]]foo in it]]
11315 !! html/php
11316 <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>
11317 </p>
11318 !! html/parsoid
11319 <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>
11320 !! end
11321
11322 !! test
11323 BUG 648: Frameless image caption with an interwiki link
11324 !! wikitext
11325 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
11326 !! html/php
11327 <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>
11328 </p>
11329 !! html/parsoid
11330 <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>
11331 !! end
11332
11333 !! test
11334 BUG 648: Frameless image caption with a piped interwiki link
11335 !! wikitext
11336 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
11337 !! html/php
11338 <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>
11339 </p>
11340 !! html/parsoid
11341 <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>
11342 !! end
11343
11344 !! test
11345 Escape HTML special chars in image alt text
11346 !! wikitext
11347 [[File:Foobar.jpg|& < > "]]
11348 !! html/php
11349 <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>
11350 </p>
11351 !! html/parsoid
11352 <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>
11353 !! end
11354
11355 !! test
11356 BUG 499: Alt text should have &#1234;, not &amp;1234;
11357 !! wikitext
11358 [[File:Foobar.jpg|&#9792;]]
11359 !! html/php
11360 <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>
11361 </p>
11362 !! html/parsoid
11363 <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>
11364 !! end
11365
11366 !! test
11367 Broken image caption with link
11368 !! options
11369 parsoid=wt2html,wt2wt,html2html
11370 !! wikitext
11371 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
11372 !! html/php
11373 <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.
11374 </p>
11375 !! html/parsoid
11376 <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>
11377 !! end
11378
11379 !! test
11380 Image caption containing another image
11381 !! wikitext
11382 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
11383 !! html/php
11384 <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>
11385
11386 !! html/parsoid
11387 <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>
11388 !! end
11389
11390 !! test
11391 Image: caption containing a newline
11392 !! wikitext
11393 [[File:Foobar.jpg|This
11394 *is some text]]
11395 !! html/php
11396 <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>
11397 </p>
11398 !! html/parsoid
11399 <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>
11400 !!end
11401
11402 !!test
11403 Image: caption containing leading space
11404 (The leading space should not trigger nowiki escaping in wt2wt mode)
11405 !! wikitext
11406 [[File:Foobar.jpg|thumb| bar]]
11407 !! html/php
11408 <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>
11409
11410 !! html/parsoid
11411 <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>
11412 !!end
11413
11414 !! test
11415 Image: caption containing a table
11416 !! options
11417 parsoid=wt2html,wt2wt,html2html
11418 !! wikitext
11419 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
11420 {|
11421 ! Foo !! Bar
11422 |-
11423 | Foo1 || Bar1
11424 |}
11425 and some more text.]]
11426 !! html/php
11427 <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>
11428
11429 !! html/parsoid
11430 <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
11431 <table>
11432 <tbody>
11433 <tr><th>Foo </th><th>Bar</th></tr>
11434 <tr>
11435 <td>Foo1 </td>
11436 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
11437 !! end
11438
11439 !! test
11440 Bug 3090: External links other than http: in image captions
11441 !! wikitext
11442 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
11443 !! html/php
11444 <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>
11445
11446 !! html/parsoid
11447 <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>
11448 !! end
11449
11450 !! test
11451 Custom class
11452 !! options
11453 parsoid=wt2html,wt2wt,html2html
11454 !! wikitext
11455 [[Image:foobar.jpg|a|class=b]]
11456 !! html/php
11457 <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>
11458 </p>
11459 !! html/parsoid
11460 <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>
11461 !! end
11462
11463 !! test
11464 Localized image handling (1).
11465 !! options
11466 parsoid=wt2html,wt2wt,html2html
11467 language=es
11468 !! wikitext
11469 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
11470 !! html/php
11471 <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>
11472
11473 !! html/parsoid
11474 <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>
11475 !! end
11476
11477 !! test
11478 Localized image handling (2).
11479 !! options
11480 thumbsize=220
11481 parsoid=wt2html,wt2wt,html2html
11482 language=es
11483 !! wikitext
11484 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
11485 !! html/php
11486 <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>
11487
11488 !! html/parsoid
11489 <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>
11490 !! end
11491
11492 !! test
11493 "border", "frameless" and "class" attributes on an image.
11494 !! options
11495 thumbsize=220
11496 parsoid=wt2html,wt2wt,html2html
11497 !! wikitext
11498 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
11499 !! html/php
11500 <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>
11501 </p>
11502 !! html/parsoid
11503 <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>
11504 !! end
11505
11506 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
11507 !! test
11508 Invalid image attributes (bug 62500)
11509 !! options
11510 thumbsize=220
11511 parsoid=wt2html,wt2wt,html2html
11512 !! wikitext
11513 [[File:Foobar.jpg|thumb|float|left|caption]]
11514
11515 [[File:Foobar.jpg|thumb|righ|caption]]
11516
11517 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
11518 !! html/php
11519 <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>
11520 <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>
11521 <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>
11522
11523 !! html/parsoid
11524 <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>
11525 !! end
11526
11527 !! article
11528 File:Barfoo.jpg
11529 !! text
11530 #REDIRECT [[File:Barfoo.jpg]]
11531 !! endarticle
11532
11533 !! test
11534 Redirected image
11535 !! wikitext
11536 [[Image:Barfoo.jpg]]
11537 !! html
11538 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
11539 </p>
11540 !! end
11541
11542 !! test
11543 Missing image with uploads disabled
11544 !! options
11545 wgEnableUploads=0
11546 !! wikitext
11547 [[Image:Foobaz.jpg]]
11548 !! html
11549 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
11550 </p>
11551 !! end
11552
11553 # Parsoid-specific testing for images
11554 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11555 # Currently imperfect due to a flaw in the Parsoid testrunner
11556 # Work in progress
11557 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
11558 # image tests.
11559
11560 !! test
11561 Parsoid-specific image handling - simple image with size and middle alignment
11562 !! wikitext
11563 [[File:Foobar.jpg|middle|50px]]
11564 !! html/parsoid
11565 <p><span class="mw-valign-middle" typeof="mw:Image">
11566 <a href="File:Foobar.jpg">
11567 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11568 </a>
11569 </span>
11570 </p>
11571 !! end
11572
11573 !! test
11574 Parsoid-specific image handling - simple image with size, middle alignment,
11575 non-standard namespace alias
11576 !! options
11577 parsoid=wt2wt,wt2html,html2html
11578 !! wikitext
11579 [[Image:Foobar.jpg|middle|50px]]
11580 !! html/parsoid
11581 <p><span class="mw-valign-middle" typeof="mw:Image">
11582 <a href="File:Foobar.jpg">
11583 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11584 </a>
11585 </span>
11586 </p>
11587 !! end
11588
11589 !! test
11590 Parsoid-specific image handling - simple image with size and middle alignment
11591 (existing content)
11592 !! wikitext
11593 [[File:Foobar.jpg|50px|middle]]
11594 !! html/parsoid
11595 <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>
11596 !! end
11597
11598 !! test
11599 Parsoid-specific image handling - simple image with size and middle alignment
11600 and non-standard namespace name
11601 !! options
11602 parsoid=wt2html,wt2wt,html2html
11603 !! wikitext
11604 [[Image:Foobar.jpg|50px|middle]]
11605 !! html/parsoid
11606 <p><span class="mw-valign-middle" typeof="mw:Image">
11607 <a href="File:Foobar.jpg">
11608 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11609 </a>
11610 </span>
11611 </p>
11612 !! end
11613
11614 !! test
11615 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
11616 !! wikitext
11617 [[File:Foobar.jpg|500x10px|baseline|caption]]
11618 !! html/parsoid
11619 <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>
11620 !! end
11621
11622 !! test
11623 Parsoid-specific image handling - simple image with border and size spec
11624 !! wikitext
11625 [[File:Foobar.jpg|50px|border|caption]]
11626 !! html/parsoid
11627 <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>
11628 !! end
11629
11630 !! test
11631 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11632 !! wikitext
11633 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
11634 !! html/parsoid
11635 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
11636 <a href="File:Foobar.jpg">
11637 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
11638 </a>
11639 <figcaption>caption content</figcaption>
11640 </figure>
11641 !! end
11642
11643 !! test
11644 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11645 (existing content)
11646 !! wikitext
11647 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
11648 !! html/parsoid
11649 <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>
11650 !! end
11651
11652 !! test
11653 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
11654 !! wikitext
11655 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
11656 !! html/parsoid
11657 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
11658 <a href="File:Foobar.jpg">
11659 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
11660 </a>
11661 <figcaption>caption</figcaption>
11662 </figure>
11663 !! end
11664
11665 !! test
11666 Parsoid-specific image handling - thumbnail with specific size, halign,
11667 valign, and caption (existing content)
11668 !! wikitext
11669 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
11670 !! html/parsoid
11671 <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>
11672 !! end
11673
11674 !! test
11675 Parsoid-specific image handling - framed image with specific size and caption
11676 (size is ignored)
11677 !! options
11678 parsoid=wt2html,wt2wt,html2html
11679 !! wikitext
11680 [[File:Foobar.jpg|frame|500x50px|caption]]
11681 !! html/parsoid
11682 <figure typeof="mw:Image/Frame">
11683 <a href="File:Foobar.jpg">
11684 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11685 </a>
11686 <figcaption>caption</figcaption>
11687 </figure>
11688 !! end
11689
11690 !! test
11691 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
11692 (size is ignored)
11693 !! options
11694 parsoid=wt2html,wt2wt,html2html
11695 !! wikitext
11696 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
11697 !! html/parsoid
11698 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
11699 <a href="File:Foobar.jpg">
11700 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11701 </a>
11702 <figcaption>caption</figcaption>
11703 </figure>
11704 !! end
11705
11706 !! test
11707 Parsoid-specific image handling - frameless image with specific size, border, and caption
11708 !! wikitext
11709 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
11710 !! html/parsoid
11711 <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>
11712 !! end
11713
11714 !! test
11715 Parsoid-specific image handling - simple image with a formatted caption
11716 !! wikitext
11717 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
11718 !! html/parsoid
11719 <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>"}'>
11720 <a href="File:Foobar.jpg">
11721 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
11722 </a></span></p>
11723 !! end
11724
11725 !! test
11726 Parsoid-specific image handling - caption with a template in it
11727 !! wikitext
11728 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
11729 !! html/parsoid
11730 <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>
11731 !! end
11732
11733 !! test
11734 Parsoid-specific image handling - caption with unbalanced tags in it
11735 !! options
11736 parsoid=wt2html,wt2wt,html2html
11737 !! wikitext
11738 foo
11739 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
11740 bar
11741 !! html/parsoid
11742 <p>foo</p>
11743 <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>
11744 <p>bar</p>
11745 !! end
11746
11747 !! test
11748 Parsoid-specific image handling - empty caption (1)
11749 !! options
11750 parsoid=wt2html,wt2wt
11751 !! wikitext
11752 [[File:Foobar.jpg|thumb|]]
11753 !! html/parsoid
11754 <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>
11755 !! end
11756
11757 # empty captions don't get serialized unless we're in the "round trip" case
11758 !! test
11759 Parsoid-specific image handling - empty caption (2)
11760 !! options
11761 parsoid=html2wt
11762 !! html/parsoid
11763 <figure class="mw-default-size" typeof="mw:Image/Thumb">
11764 <a href="File:Foobar.jpg">
11765 <img resource="./File:Foobar.jpg"
11766 src="//example.com/images/3/3a/Foobar.jpg"
11767 height="25" width="220"/>
11768 </a>
11769 <figcaption></figcaption>
11770 </figure>
11771 !! wikitext
11772 [[File:Foobar.jpg|thumb]]
11773 !! end
11774
11775 !! test
11776 Parsoid-specific image handling - whitespace caption
11777 !! wikitext
11778 [[File:Foobar.jpg|thumb| ]]
11779 !! html/parsoid
11780 <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>
11781 !! end
11782
11783 !! test
11784 Parsoid-specific image handling - lang option
11785 !! wikitext
11786 foo
11787 [[File:Foobar.svg|lang=de|caption]]
11788 bar
11789 !! html/parsoid
11790 <p>foo
11791 <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>
11792 bar</p>
11793 !! end
11794
11795
11796 ###
11797 ### Subpages
11798 ###
11799 !! article
11800 Subpage test/subpage
11801 !! text
11802 foo
11803 !! endarticle
11804
11805 !! test
11806 Subpage link
11807 !! options
11808 subpage title=[[Subpage test]]
11809 !! wikitext
11810 [[/subpage]]
11811 !! html
11812 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
11813 </p>
11814 !! end
11815
11816 !! test
11817 Subpage noslash link
11818 !! options
11819 subpage title=[[Subpage test]]
11820 !! wikitext
11821 [[/subpage/]]
11822 !! html
11823 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
11824 </p>
11825 !! end
11826
11827 # TODO: make this PHP-parser compatible!
11828 !! test
11829 Relative subpage noslash link
11830 !! options
11831 parsoid=wt2wt,wt2html,html2html
11832 subpage title=[[Subpage test/1/2/3/4]]
11833 !! wikitext
11834 [[../../subpage/]]
11835
11836 [[../../subpage]]
11837 !! html
11838 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
11839 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
11840 !! end
11841
11842 !! test
11843 Parsoid: dot-slash prefixed wikilinks
11844 !! wikitext
11845 [[./foo]]
11846
11847 [[././bar]]
11848
11849 [[././baz/]]
11850 !! html/php
11851 <p>[[./foo]]
11852 </p><p>[[././bar]]
11853 </p><p>[[././baz/]]
11854 </p>
11855 !! html/parsoid
11856 <p>[[./foo]]
11857 </p><p>[[././bar]]
11858 </p><p>[[././baz/]]
11859 </p>
11860 !! end
11861
11862 !! test
11863 Render invalid page names as plain text (bug 51090)
11864 !! wikitext
11865 [[./../foo|bar]]
11866 [[foo�|bar]]
11867 [[foo/.|bar]]
11868 [[foo/..|bar]]
11869 [[foo~~~bar]]
11870 [[foo>bar]]
11871 [[foo[bar]]
11872 [[.]]
11873 [[..]]
11874 [[foo././bar]]
11875
11876 [[{{echo|./../foo}}|bar]]
11877 [[{{echo|foo/.}}|bar]]
11878 [[{{echo|foo/..}}|bar]]
11879 [[{{echo|foo~~~~bar}}]]
11880 [[{{echo|foo>bar}}]]
11881 [[{{echo|foo././bar}}]]
11882 [[{{echo|foo{bar}}]]
11883 [[{{echo|foo}bar}}]]
11884 [[{{echo|foo[bar}}]]
11885 [[{{echo|foo]bar}}]]
11886 [[{{echo|foo<bar}}]]
11887 !!html/php
11888 <p>[[./../foo|bar]]
11889 [[foo�|bar]]
11890 [[foo/.|bar]]
11891 [[foo/..|bar]]
11892 [[foo~~~bar]]
11893 [[foo&gt;bar]]
11894 [[foo[bar]]
11895 [[.]]
11896 [[..]]
11897 [[foo././bar]]
11898 </p><p>[[./../foo|bar]]
11899 [[foo/.|bar]]
11900 [[foo/..|bar]]
11901 [[foo~~~~bar]]
11902 [[foo&gt;bar]]
11903 [[foo././bar]]
11904 [[foo{bar]]
11905 [[foo}bar]]
11906 [[foo[bar]]
11907 [[foo]bar]]
11908 [[foo&lt;bar]]
11909 </p>
11910 !!html/parsoid
11911 <p>[[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]</p>
11912 <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>
11913 !!end
11914
11915 !! test
11916 Disabled subpages
11917 !! wikitext
11918 [[/subpage]]
11919 !! html
11920 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
11921 </p>
11922 !! end
11923
11924 !! test
11925 BUG 561: {{/Subpage}}
11926 !! options
11927 subpage title=[[Page]]
11928 !! wikitext
11929 {{/Subpage}}
11930 !! html
11931 <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>
11932 </p>
11933 !! end
11934
11935 ###
11936 ### Categories
11937 ###
11938 !! article
11939 Category:MediaWiki User's Guide
11940 !! text
11941 blah
11942 !! endarticle
11943
11944 !! test
11945 Link to category
11946 !! wikitext
11947 [[:Category:MediaWiki User's Guide]]
11948 !! html
11949 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
11950 </p>
11951 !! end
11952
11953 !! test
11954 Simple category
11955 !! options
11956 cat
11957 !! wikitext
11958 [[Category:MediaWiki User's Guide]]
11959 !! html
11960 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11961 !! end
11962
11963 !! test
11964 PAGESINCATEGORY invalid title fatal (r33546 fix)
11965 !! wikitext
11966 {{PAGESINCATEGORY:<bogus>}}
11967 !! html
11968 <p>0
11969 </p>
11970 !! end
11971
11972 !! test
11973 Category with different sort key
11974 !! options
11975 cat
11976 !! wikitext
11977 [[Category:MediaWiki User's Guide|Foo]]
11978 !! html
11979 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11980 !! end
11981
11982 !! test
11983 Category with identical sort key
11984 !! options
11985 cat
11986 !! wikitext
11987 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11988 !! html
11989 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11990 !! end
11991
11992 !! test
11993 Category with empty sort key
11994 !! options
11995 cat
11996 pst
11997 !! wikitext
11998 [[Category:MediaWiki User's Guide|]]
11999 !! html
12000 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12001 !! end
12002
12003 !! test
12004 Category with empty sort key and parentheses
12005 !! options
12006 cat
12007 pst
12008 !! wikitext
12009 [[Category:Foo (bar)|]]
12010 !! html
12011 [[Category:Foo (bar)|Foo]]
12012 !! end
12013
12014 !! test
12015 Category with link tail
12016 !! options
12017 cat
12018 pst
12019 !! wikitext
12020 123[[Category:Foo]]456
12021 !! html
12022 123[[Category:Foo]]456
12023 !! end
12024
12025 !! test
12026 Category with template
12027 !! options
12028 cat
12029 pst
12030 !! wikitext
12031 [[Category:{{echo|Foo}}]]
12032 !! html
12033 [[Category:{{echo|Foo}}]]
12034 !! end
12035
12036 !! test
12037 Category with template in sort key
12038 !! options
12039 cat
12040 pst
12041 !! wikitext
12042 [[Category:Foo|{{echo|Bar}}]]
12043 !! html
12044 [[Category:Foo|{{echo|Bar}}]]
12045 !! end
12046
12047 !! test
12048 Category with template in sort key and title
12049 !! options
12050 cat
12051 pst
12052 !! wikitext
12053 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12054 !! html
12055 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12056 !! end
12057
12058 !! test
12059 Category / paragraph interactions
12060 !! wikitext
12061 Foo [[Category:Baz]] Bar
12062
12063 Foo [[Category:Baz]]
12064 Bar
12065
12066 Foo
12067 [[Category:Baz]]
12068 Bar
12069
12070 Foo
12071 [[Category:Baz]] Bar
12072
12073 Foo
12074 [[Category:Baz]]
12075 [[Category:Baz]]
12076 [[Category:Baz]]
12077 Bar
12078
12079 [[Category:Baz]]
12080 [[Category:Baz]]
12081 [[Category:Baz]]
12082
12083 [[Category:Baz]]
12084 {{echo|[[Category:Baz]]}}
12085 [[Category:Baz]]
12086 !! html
12087 <p>Foo Bar
12088 </p><p>Foo
12089 Bar
12090 </p><p>Foo
12091 Bar
12092 </p><p>Foo Bar
12093 </p><p>Foo
12094 Bar
12095 </p>
12096 !! end
12097
12098 !! test
12099 Parsoid: Serialize link to category page with colon escape
12100 !! options
12101 parsoid
12102 !! wikitext
12103
12104 [[:Category:Foo]]
12105 [[:Category:Foo|Bar]]
12106 !! html
12107 <p>
12108 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
12109 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
12110 </p>
12111 !! end
12112
12113 !! test
12114 Parsoid: Link prefix/suffixes aren't applied to category links
12115 !! options
12116 parsoid=wt2html,wt2wt,html2html
12117 language=is
12118 !! wikitext
12119 x[[Category:Foo]]y
12120 !! html
12121 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
12122 !! end
12123
12124 !! test
12125 Parsoid: Serialize link to file page with colon escape
12126 !! options
12127 parsoid
12128 !! wikitext
12129
12130 [[:File:Foo.png]]
12131 [[:File:Foo.png|Bar]]
12132 !! html
12133 <p>
12134 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
12135 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
12136 </p>
12137 !! end
12138
12139 !! test
12140 Parsoid: Serialize a genuine category link without colon escape
12141 !! options
12142 parsoid
12143 !! wikitext
12144 [[Category:Foo]]
12145 [[Category:Foo|Bar]]
12146 !! html
12147 <link rel="mw:PageProp/Category" href="Category:Foo">
12148 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
12149 !! end
12150
12151 !! test
12152 Parsoid: Defaultsort
12153 !! options
12154 parsoid
12155 !! wikitext
12156 {{DEFAULTSORT:Foo}}
12157 !! html
12158 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
12159 !! end
12160
12161 ###
12162 ### Inter-language links
12163 ###
12164 !! test
12165 Inter-language links
12166 !! options
12167 ill
12168 !! wikitext
12169 [[es:Alimento]]
12170 [[fr:Nourriture]]
12171 [[zh:&#39135;&#21697;]]
12172 !! html
12173 es:Alimento fr:Nourriture zh:食品
12174 !! end
12175
12176 !! test
12177 Duplicate interlanguage links (bug 24502)
12178 !! options
12179 ill
12180 !! wikitext
12181 [[es:1]]
12182 [[es:2]]
12183 [[fr:1]]
12184 [[fr:2]]
12185 !! html
12186 es:1 fr:1
12187 !! end
12188
12189 ###
12190 ### Sections
12191 ###
12192 !! test
12193 Basic section headings
12194 !! wikitext
12195 == Headline 1 ==
12196 Some text
12197
12198 ==Headline 2==
12199 More
12200 ===Smaller headline===
12201 Blah blah
12202 !! html
12203 <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>
12204 <p>Some text
12205 </p>
12206 <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>
12207 <p>More
12208 </p>
12209 <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>
12210 <p>Blah blah
12211 </p>
12212 !! end
12213
12214 !! test
12215 Section headings with TOC
12216 !! wikitext
12217 == Headline 1 ==
12218 === Subheadline 1 ===
12219 ===== Skipping a level =====
12220 ====== Skipping a level ======
12221
12222 == Headline 2 ==
12223 Some text
12224 ===Another headline===
12225 !! html
12226 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12227 <ul>
12228 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
12229 <ul>
12230 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
12231 <ul>
12232 <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>
12233 <ul>
12234 <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>
12235 </ul>
12236 </li>
12237 </ul>
12238 </li>
12239 </ul>
12240 </li>
12241 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
12242 <ul>
12243 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
12244 </ul>
12245 </li>
12246 </ul>
12247 </div>
12248
12249 <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>
12250 <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>
12251 <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>
12252 <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>
12253 <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>
12254 <p>Some text
12255 </p>
12256 <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>
12257
12258 !! end
12259
12260 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
12261 !! test
12262 Handling of sections up to level 6 and beyond
12263 !! wikitext
12264 = Level 1 Heading=
12265 == Level 2 Heading==
12266 === Level 3 Heading===
12267 ==== Level 4 Heading====
12268 ===== Level 5 Heading=====
12269 ====== Level 6 Heading======
12270 ======= Level 7 Heading=======
12271 ======== Level 8 Heading========
12272 ========= Level 9 Heading=========
12273 ========== Level 10 Heading==========
12274 !! html
12275 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12276 <ul>
12277 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
12278 <ul>
12279 <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>
12280 <ul>
12281 <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>
12282 <ul>
12283 <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>
12284 <ul>
12285 <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>
12286 <ul>
12287 <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>
12288 <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>
12289 <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>
12290 <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>
12291 <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>
12292 </ul>
12293 </li>
12294 </ul>
12295 </li>
12296 </ul>
12297 </li>
12298 </ul>
12299 </li>
12300 </ul>
12301 </li>
12302 </ul>
12303 </div>
12304
12305 <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>
12306 <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>
12307 <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>
12308 <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>
12309 <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>
12310 <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>
12311 <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>
12312 <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>
12313 <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>
12314 <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>
12315
12316 !! end
12317
12318 !! test
12319 TOC regression (bug 9764)
12320 !! wikitext
12321 == title 1 ==
12322 === title 1.1 ===
12323 ==== title 1.1.1 ====
12324 === title 1.2 ===
12325 == title 2 ==
12326 === title 2.1 ===
12327 !! html
12328 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12329 <ul>
12330 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12331 <ul>
12332 <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>
12333 <ul>
12334 <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>
12335 </ul>
12336 </li>
12337 <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>
12338 </ul>
12339 </li>
12340 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12341 <ul>
12342 <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>
12343 </ul>
12344 </li>
12345 </ul>
12346 </div>
12347
12348 <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>
12349 <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>
12350 <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>
12351 <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>
12352 <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>
12353 <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>
12354
12355 !! end
12356
12357 !! test
12358 TOC with wgMaxTocLevel=3 (bug 6204)
12359 !! options
12360 wgMaxTocLevel=3
12361 !! wikitext
12362 == title 1 ==
12363 === title 1.1 ===
12364 ==== title 1.1.1 ====
12365 === title 1.2 ===
12366 == title 2 ==
12367 === title 2.1 ===
12368 !! html
12369 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12370 <ul>
12371 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12372 <ul>
12373 <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>
12374 <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>
12375 </ul>
12376 </li>
12377 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12378 <ul>
12379 <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>
12380 </ul>
12381 </li>
12382 </ul>
12383 </div>
12384
12385 <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>
12386 <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>
12387 <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>
12388 <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>
12389 <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>
12390 <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>
12391
12392 !! end
12393
12394 !! test
12395 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
12396 !! options
12397 wgMaxTocLevel=3
12398 !! wikitext
12399 ==Section 1==
12400 ===Section 1.1===
12401 ====Section 1.1.1====
12402 ====Section 1.1.1.1====
12403 ==Section 2==
12404 !! html
12405 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12406 <ul>
12407 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
12408 <ul>
12409 <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>
12410 </ul>
12411 </li>
12412 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
12413 </ul>
12414 </div>
12415
12416 <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>
12417 <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>
12418 <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>
12419 <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>
12420 <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>
12421
12422 !! end
12423
12424
12425 !! test
12426 Resolving duplicate section names
12427 !! wikitext
12428 == Foo bar ==
12429 == Foo bar ==
12430 !! html
12431 <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>
12432 <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>
12433
12434 !! end
12435
12436 !! test
12437 Resolving duplicate section names with differing case (bug 10721)
12438 !! wikitext
12439 == Foo bar ==
12440 == Foo Bar ==
12441 !! html
12442 <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>
12443 <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>
12444
12445 !! end
12446
12447 !! article
12448 Template:sections
12449 !! text
12450 ===Section 1===
12451 ==Section 2==
12452 !! endarticle
12453
12454 !! test
12455 Template with sections, __NOTOC__
12456 !! wikitext
12457 __NOTOC__
12458 ==Section 0==
12459 {{sections}}
12460 ==Section 4==
12461 !! html
12462 <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>
12463 <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>
12464 <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>
12465 <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>
12466
12467 !! end
12468
12469 !! test
12470 __NOEDITSECTION__ keyword
12471 !! wikitext
12472 __NOEDITSECTION__
12473 ==Section 1==
12474 ==Section 2==
12475 !! html
12476 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
12477 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
12478
12479 !! end
12480
12481 !! test
12482 Link inside a section heading
12483 !! wikitext
12484 ==Section with a [[Main Page|link]] in it==
12485 !! html
12486 <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>
12487
12488 !! end
12489
12490 !! test
12491 TOC regression (bug 12077)
12492 !! wikitext
12493 __TOC__
12494 == title 1 ==
12495 === title 1.1 ===
12496 == title 2 ==
12497 !! html
12498 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12499 <ul>
12500 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12501 <ul>
12502 <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>
12503 </ul>
12504 </li>
12505 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
12506 </ul>
12507 </div>
12508
12509 <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>
12510 <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>
12511 <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>
12512
12513 !! end
12514
12515 !! test
12516 BUG 1219 URL next to image (good)
12517 !! wikitext
12518 http://example.com [[Image:foobar.jpg]]
12519 !! html
12520 <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>
12521 </p>
12522 !!end
12523
12524 !! test
12525 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
12526 !! wikitext
12527 ===
12528 The line above must have a trailing space!
12529 === <!--
12530 --> <!-- -->
12531 But just in case it doesn't...
12532 !! html
12533 <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>
12534 <p>The line above must have a trailing space!
12535 </p>
12536 <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>
12537 <p>But just in case it doesn't...
12538 </p>
12539 !! end
12540
12541 !! test
12542 Header with special characters (bug 25462)
12543 !! wikitext
12544 The tooltips shall not show entities to the user (ie. be double escaped)
12545
12546 == text > text ==
12547 section 1
12548
12549 == text < text ==
12550 section 2
12551
12552 == text & text ==
12553 section 3
12554
12555 == text ' text ==
12556 section 4
12557
12558 == text " text ==
12559 section 5
12560 !! html
12561 <p>The tooltips shall not show entities to the user (ie. be double escaped)
12562 </p>
12563 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12564 <ul>
12565 <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>
12566 <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>
12567 <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>
12568 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
12569 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
12570 </ul>
12571 </div>
12572
12573 <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>
12574 <p>section 1
12575 </p>
12576 <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>
12577 <p>section 2
12578 </p>
12579 <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>
12580 <p>section 3
12581 </p>
12582 <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>
12583 <p>section 4
12584 </p>
12585 <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>
12586 <p>section 5
12587 </p>
12588 !! end
12589
12590 !! test
12591 Headers with excess '=' characters
12592 (Are similar tests necessary beyond the 1st level?)
12593 !! wikitext
12594 =foo==
12595 ==foo=
12596 =''italic'' heading==
12597 ==''italic'' heading=
12598 !! html
12599 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12600 <ul>
12601 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
12602 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
12603 <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>
12604 <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>
12605 </ul>
12606 </div>
12607
12608 <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>
12609 <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>
12610 <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>
12611 <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>
12612
12613 !! end
12614
12615 !! test
12616 HTML headers vs TOC (bug 23393)
12617 (__NOEDITSECTION__ for clearer output, doesn't matter here)
12618 !! wikitext
12619 <h1>Header 1</h1>
12620 == Header 1.1 ==
12621 == Header 1.2 ==
12622
12623 <h1>Header 2
12624 </h1>
12625 == Header 2.1 ==
12626 == Header 2.2 ==
12627 __NOEDITSECTION__
12628 !! html
12629 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12630 <ul>
12631 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
12632 <ul>
12633 <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>
12634 <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>
12635 </ul>
12636 </li>
12637 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
12638 <ul>
12639 <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>
12640 <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>
12641 </ul>
12642 </li>
12643 </ul>
12644 </div>
12645
12646 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
12647 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
12648 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
12649 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
12650 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
12651 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
12652
12653 !! end
12654
12655 !! test
12656 Single-line or multiline-comments can follow headings
12657 !! options
12658 parsoid=wt2html,wt2wt
12659 !! wikitext
12660 ==foo==<!---->
12661 ==bar==<!--c1-->
12662 ==baz==<!--
12663 c2
12664 c3-->
12665 !! html
12666 <h2><span class="mw-headline" id="foo">foo</span></h2>
12667 <h2><span class="mw-headline" id="bar">bar</span></h2>
12668 <h2><span class="mw-headline" id="baz">baz</span></h2>
12669
12670 !! end
12671
12672 !! test
12673 BUG 1219 URL next to image (broken)
12674 !! wikitext
12675 http://example.com[[Image:foobar.jpg]]
12676 !! html
12677 <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>
12678 </p>
12679 !!end
12680
12681 !! test
12682 Bug 1186 news: in the middle of text
12683 !! wikitext
12684 http://en.wikinews.org/wiki/Wikinews:Workplace
12685 !! html
12686 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
12687 </p>
12688 !!end
12689
12690
12691 !! test
12692 Namespaced link must have a title
12693 !! wikitext
12694 [[Project:]]
12695 !! html
12696 <p>[[Project:]]
12697 </p>
12698 !!end
12699
12700 !! test
12701 Namespaced link must have a title (bad fragment version)
12702 !! wikitext
12703 [[Project:#fragment]]
12704 !! html
12705 <p>[[Project:#fragment]]
12706 </p>
12707 !!end
12708
12709
12710 ###
12711 ### HTML tags and HTML attributes
12712 ###
12713
12714 !! test
12715 div with no attributes
12716 !! wikitext
12717 <div>HTML rocks</div>
12718 !! html
12719 <div>HTML rocks</div>
12720
12721 !! end
12722
12723 !! test
12724 div with double-quoted attribute
12725 !! wikitext
12726 <div id="rock">HTML rocks</div>
12727 !! html
12728 <div id="rock">HTML rocks</div>
12729
12730 !! end
12731
12732 !! test
12733 div with single-quoted attribute
12734 !! wikitext
12735 <div id='rock'>HTML rocks</div>
12736 !! html
12737 <div id="rock">HTML rocks</div>
12738
12739 !! end
12740
12741 !! test
12742 div with unquoted attribute
12743 !! wikitext
12744 <div id=rock>HTML rocks</div>
12745 !! html
12746 <div id="rock">HTML rocks</div>
12747
12748 !! end
12749
12750 !! test
12751 div with illegal double attributes
12752 !! wikitext
12753 <div id="a" id="b">HTML rocks</div>
12754 !! html
12755 <div id="b">HTML rocks</div>
12756
12757 !!end
12758
12759 # FIXME: produce empty string instead of "class" in the PHP parser, following
12760 # the HTML5 spec.
12761 !! test
12762 div with empty attribute value, space before equals
12763 !! options
12764 parsoid
12765 !! wikitext
12766 <div class =>HTML rocks</div>
12767 !! html
12768 <div class="">HTML rocks</div>
12769
12770 !! end
12771
12772 # The PHP parser escapes the opening brace to &#123; for some reason, so
12773 # disabled this test for it.
12774 !! test
12775 div with braces in attribute value
12776 !! options
12777 parsoid
12778 !! wikitext
12779 <div title="{}">Foo</div>
12780 !! html
12781 <div title="{}">Foo</div>
12782 !! end
12783
12784 # This it very inconsistent in the PHP parser: it returns
12785 # class="class" if there is a space between the name and the equal sign (see
12786 # 'div with empty attribute value, space before equals'), but strips the
12787 # attribute completely if the space is missing. We hope that not much content
12788 # depends on this, so are implementing the behavior below in Parsoid for
12789 # consistencies' sake. Disabled for the PHP parser.
12790 # FIXME: fix this behavior in the PHP parser?
12791 !! test
12792 div with empty attribute value, no space before equals
12793 !! options
12794 parsoid
12795 !! wikitext
12796 <div class=>HTML rocks</div>
12797 !! html
12798 <div class="">HTML rocks</div>
12799
12800 !! end
12801
12802 !! test
12803 HTML multiple attributes correction
12804 !! wikitext
12805 <p class="error" class="awesome">Awesome!</p>
12806 !! html
12807 <p class="awesome">Awesome!</p>
12808
12809 !!end
12810
12811 !! test
12812 Table multiple attributes correction
12813 !! wikitext
12814 {|
12815 !+ class="error" class="awesome"| status
12816 |}
12817 !! html
12818 <table>
12819 <tr>
12820 <th class="awesome"> status
12821 </th></tr></table>
12822
12823 !!end
12824
12825 !! test
12826 DIV IN UPPERCASE
12827 !! wikitext
12828 <DIV ID="x">HTML ROCKS</DIV>
12829 !! html
12830 <div id="x">HTML ROCKS</div>
12831
12832 !!end
12833
12834 !! test
12835 Non-ASCII pseudo-tags are rendered as text
12836 !! wikitext
12837 <khyô>
12838 !! html
12839 <p>&lt;khyô&gt;
12840 </p>
12841 !! end
12842
12843 !! test
12844 Pseudo-tag with URL 'name' renders as url link
12845 !! wikitext
12846 <http://example.com/>
12847 !! html
12848 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
12849 </p>
12850 !! end
12851
12852 !! test
12853 text with amp in the middle of nowhere
12854 !! wikitext
12855 Remember AT&T?
12856 !! html
12857 <p>Remember AT&amp;T?
12858 </p>
12859 !! end
12860
12861 !! test
12862 text with character entity: eacute
12863 !! wikitext
12864 I always thought &eacute; was a cute letter.
12865 !! html
12866 <p>I always thought &#233; was a cute letter.
12867 </p>
12868 !! end
12869
12870 !! test
12871 text with entity-escaped character entity-like string: eacute
12872 !! wikitext
12873 I always thought &amp;eacute; was a cute letter.
12874 !! html
12875 <p>I always thought &amp;eacute; was a cute letter.
12876 </p>
12877 !! end
12878
12879 !! test
12880 text with undefined character entity: xacute
12881 !! wikitext
12882 I always thought &xacute; was a cute letter.
12883 !! html
12884 <p>I always thought &amp;xacute; was a cute letter.
12885 </p>
12886 !! end
12887
12888 # TODO: generalize to PHP parser?
12889 !! test
12890 HTML5 tags
12891 !! options
12892 parsoid
12893 !! wikitext
12894 <data value="5">five</data>
12895 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12896 <mark>This highlighted text</mark>
12897 !! html
12898 <p><data value="5">five</data>
12899 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12900 <mark>This highlighted text</mark></p>
12901 !! end
12902
12903 !! test
12904 HTML tag with leading space is parsed as text
12905 !! wikitext
12906 < div>foo< /div>
12907 !! html
12908 <p>&lt; div&gt;foo&lt; /div&gt;
12909 </p>
12910 !! end
12911
12912 ###
12913 ### Nesting tests (see bug 41545, 50604, 51081)
12914 ###
12915
12916 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
12917 # Note that html2wt is considerably more difficult if we use <b> in
12918 # the test case, instead of <big>
12919 !! test
12920 Ensure that HTML adoption agency algorithm is properly implemented.
12921 !! wikitext
12922 <big>X<big>Y</big>Z</big>
12923 !! html
12924 <p><big>X<big>Y</big>Z</big>
12925 </p>
12926 !! end
12927
12928 # This was bug 41545 in the PHP parser.
12929 !! test
12930 Nesting of <kbd>
12931 !! wikitext
12932 <kbd>X<kbd>Y</kbd>Z</kbd>
12933 !! html
12934 <p><kbd>X<kbd>Y</kbd>Z</kbd>
12935 </p>
12936 !! end
12937
12938 # The following cases were bug 51081 in the PHP parser.
12939 # Note that there are some other nestable tags (b, i, etc) which are
12940 # not covered; see bug 51081 for discussion.
12941 !! test
12942 Nesting of <em>
12943 !! wikitext
12944 <em>X<em>Y</em>Z</em>
12945 !! html
12946 <p><em>X<em>Y</em>Z</em>
12947 </p>
12948 !! end
12949
12950 !! test
12951 Nesting of <strong>
12952 !! wikitext
12953 <strong>X<strong>Y</strong>Z</strong>
12954 !! html
12955 <p><strong>X<strong>Y</strong>Z</strong>
12956 </p>
12957 !! end
12958
12959 !! test
12960 Nesting of <q>
12961 !! wikitext
12962 <q>X<q>Y</q>Z</q>
12963 !! html
12964 <p><q>X<q>Y</q>Z</q>
12965 </p>
12966 !! end
12967
12968 !! test
12969 Nesting of <ruby>
12970 !! wikitext
12971 <ruby>X<ruby>Y</ruby>Z</ruby>
12972 !! html
12973 <p><ruby>X<ruby>Y</ruby>Z</ruby>
12974 </p>
12975 !! end
12976
12977 !! test
12978 Nesting of <bdo>
12979 !! wikitext
12980 <bdo>X<bdo>Y</bdo>Z</bdo>
12981 !! html
12982 <p><bdo>X<bdo>Y</bdo>Z</bdo>
12983 </p>
12984 !! end
12985
12986
12987 ###
12988 ### Media links
12989 ###
12990
12991 !! test
12992 Media link
12993 !! wikitext
12994 [[Media:Foobar.jpg]]
12995 !! html
12996 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
12997 </p>
12998 !! end
12999
13000 !! test
13001 Media link with text
13002 !! wikitext
13003 [[Media:Foobar.jpg|A neat file to look at]]
13004 !! html
13005 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
13006 </p>
13007 !! end
13008
13009 # FIXME: this is still bad HTML tag nesting
13010 !! test
13011 Media link with nasty text
13012 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
13013 !! wikitext
13014 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
13015 !! html
13016 <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>
13017
13018 !! end
13019
13020 !! test
13021 Media link to nonexistent file (bug 1702)
13022 !! wikitext
13023 [[Media:No such.jpg]]
13024 !! html
13025 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
13026 </p>
13027 !! end
13028
13029 !! test
13030 Image link to nonexistent file (bug 1850 - good)
13031 !! wikitext
13032 [[Image:No such.jpg]]
13033 !! html
13034 <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>
13035 </p>
13036 !! end
13037
13038 !! test
13039 :Image link to nonexistent file (bug 1850 - bad)
13040 !! wikitext
13041 [[:Image:No such.jpg]]
13042 !! html
13043 <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>
13044 </p>
13045 !! end
13046
13047
13048
13049 !! test
13050 Character reference normalization in link text (bug 1938)
13051 !! wikitext
13052 [[Main Page|this&that]]
13053 !! html
13054 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
13055 </p>
13056 !!end
13057
13058 !! article
13059 אַ
13060 !! text
13061 Test for unicode normalization
13062
13063 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
13064 !! endarticle
13065
13066 !! test
13067 (bug 19451) Links should refer to the normalized form.
13068 !! wikitext
13069 [[&#xFB2E;]]
13070 [[&#x5d0;&#x5b7;]]
13071 [[&#x5d0;ַ]]
13072 [[א&#x5b7;]]
13073 [[אַ]]
13074 !! html
13075 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
13076 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
13077 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
13078 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
13079 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
13080 </p>
13081 !! end
13082
13083 !! test
13084 Empty attribute crash test (bug 2067)
13085 !! wikitext
13086 <font color="">foo</font>
13087 !! html
13088 <p><font color="">foo</font>
13089 </p>
13090 !! end
13091
13092 !! test
13093 Empty attribute crash test single-quotes (bug 2067)
13094 !! wikitext
13095 <font color=''>foo</font>
13096 !! html
13097 <p><font color="">foo</font>
13098 </p>
13099 !! end
13100
13101 !! test
13102 Attribute test: equals, then nothing
13103 !! wikitext
13104 <font color=>foo</font>
13105 !! html
13106 <p><font>foo</font>
13107 </p>
13108 !! end
13109
13110 !! test
13111 Attribute test: unquoted value
13112 !! wikitext
13113 <font color=x>foo</font>
13114 !! html
13115 <p><font color="x">foo</font>
13116 </p>
13117 !! end
13118
13119 !! test
13120 Attribute test: unquoted but illegal value (hash)
13121 !! wikitext
13122 <font color=#x>foo</font>
13123 !! html
13124 <p><font color="#x">foo</font>
13125 </p>
13126 !! end
13127
13128 !! test
13129 Attribute test: no value
13130 !! wikitext
13131 <font color>foo</font>
13132 !! html
13133 <p><font color="color">foo</font>
13134 </p>
13135 !! end
13136
13137 !! test
13138 Bug 2095: link with three closing brackets
13139 !! wikitext
13140 [[Main Page]]]
13141 !! html/php
13142 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
13143 </p>
13144 !! html/parsoid
13145 <p><a rel="mw:WikiLink" href="./Main_Page">Main Page</a>]</p>
13146 !! end
13147
13148 !! test
13149 Bug 2095: link with pipe and three closing brackets
13150 !! wikitext
13151 [[Main Page|link]]]
13152 !! html/php
13153 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
13154 </p>
13155 !! html/parsoid
13156 <p><a rel="mw:WikiLink" href="./Main_Page">link</a>]</p>
13157 !! end
13158
13159 !! test
13160 Bug 2095: link with pipe and three closing brackets, version 2
13161 !! wikitext
13162 [[Main Page|[http://example.com/]]]
13163 !! html/php
13164 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
13165 </p>
13166 !! html/parsoid
13167 <p><a rel="mw:WikiLink" href="./Main_Page">[http://example.com/]</a></p>
13168 !! end
13169
13170
13171 ###
13172 ### Safety
13173 ###
13174
13175 !! article
13176 Template:Dangerous attribute
13177 !! text
13178 " onmouseover="alert(document.cookie)
13179 !! endarticle
13180
13181 !! article
13182 Template:Dangerous style attribute
13183 !! text
13184 border-size: expression(alert(document.cookie))
13185 !! endarticle
13186
13187 !! article
13188 Template:Div style
13189 !! text
13190 <div style="float: right; {{{1}}}">Magic div</div>
13191 !! endarticle
13192
13193 !! test
13194 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
13195 !! wikitext
13196 <div title="{{test}}"></div>
13197 !! html
13198 <div title="This is a test template"></div>
13199
13200 !! end
13201
13202 !! test
13203 Bug 2304: HTML attribute safety (dangerous template; 2309)
13204 !! wikitext
13205 <div title="{{dangerous attribute}}"></div>
13206 !! html
13207 <div title=""></div>
13208
13209 !! end
13210
13211 !! test
13212 Bug 2304: HTML attribute safety (dangerous style template; 2309)
13213 !! wikitext
13214 <div style="{{dangerous style attribute}}"></div>
13215 !! html
13216 <div style="/* insecure input */"></div>
13217
13218 !! end
13219
13220 !! test
13221 Bug 2304: HTML attribute safety (safe parameter; 2309)
13222 !! wikitext
13223 {{div style|width: 200px}}
13224 !! html
13225 <div style="float: right; width: 200px">Magic div</div>
13226
13227 !! end
13228
13229 !! test
13230 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
13231 !! wikitext
13232 {{div style|width: expression(alert(document.cookie))}}
13233 !! html
13234 <div style="/* insecure input */">Magic div</div>
13235
13236 !! end
13237
13238 !! test
13239 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
13240 !! wikitext
13241 {{div style|"><script>alert(document.cookie)</script>}}
13242 !! html
13243 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13244
13245 !! end
13246
13247 !! test
13248 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
13249 !! wikitext
13250 {{div style|" ><script>alert(document.cookie)</script>}}
13251 !! html
13252 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13253
13254 !! end
13255
13256 !! test
13257 Bug 2304: HTML attribute safety (link)
13258 !! wikitext
13259 <div title="[[Main Page]]"></div>
13260 !! html
13261 <div title="&#91;&#91;Main Page]]"></div>
13262
13263 !! end
13264
13265 !! test
13266 Bug 2304: HTML attribute safety (italics)
13267 !! wikitext
13268 <div title="''foobar''"></div>
13269 !! html
13270 <div title="&#39;&#39;foobar&#39;&#39;"></div>
13271
13272 !! end
13273
13274 !! test
13275 Bug 2304: HTML attribute safety (bold)
13276 !! wikitext
13277 <div title="'''foobar'''"></div>
13278 !! html
13279 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
13280
13281 !! end
13282
13283
13284 !! test
13285 Bug 2304: HTML attribute safety (ISBN)
13286 !! wikitext
13287 <div title="ISBN 1234567890"></div>
13288 !! html
13289 <div title="&#73;SBN 1234567890"></div>
13290
13291 !! end
13292
13293 !! test
13294 Bug 2304: HTML attribute safety (RFC)
13295 !! wikitext
13296 <div title="RFC 1234"></div>
13297 !! html
13298 <div title="&#82;FC 1234"></div>
13299
13300 !! end
13301
13302 !! test
13303 Bug 2304: HTML attribute safety (PMID)
13304 !! wikitext
13305 <div title="PMID 1234567890"></div>
13306 !! html
13307 <div title="&#80;MID 1234567890"></div>
13308
13309 !! end
13310
13311 !! test
13312 Bug 2304: HTML attribute safety (web link)
13313 !! wikitext
13314 <div title="http://example.com/"></div>
13315 !! html
13316 <div title="http&#58;//example.com/"></div>
13317
13318 !! end
13319
13320 !! test
13321 Bug 2304: HTML attribute safety (named web link)
13322 !! wikitext
13323 <div title="[http://example.com/ link]"></div>
13324 !! html
13325 <div title="&#91;http&#58;//example.com/ link]"></div>
13326
13327 !! end
13328
13329 !! test
13330 Bug 3244: HTML attribute safety (extension; safe)
13331 !! wikitext
13332 <div style="<nowiki>background:blue</nowiki>"></div>
13333 !! html
13334 <div style="background:blue"></div>
13335
13336 !! end
13337
13338 !! test
13339 Bug 3244: HTML attribute safety (extension; unsafe)
13340 !! wikitext
13341 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
13342 !! html
13343 <div style="/* insecure input */"></div>
13344
13345 !! end
13346
13347 # More MSIE fun discovered by Tom Gilder
13348
13349 !! test
13350 MSIE CSS safety test: spurious slash
13351 !! wikitext
13352 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
13353 !! html
13354 <div style="/* insecure input */">evil</div>
13355
13356 !! end
13357
13358 !! test
13359 MSIE CSS safety test: hex code
13360 !! wikitext
13361 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
13362 !! html
13363 <div style="/* insecure input */">evil</div>
13364
13365 !! end
13366
13367 !! test
13368 MSIE CSS safety test: comment in url
13369 !! wikitext
13370 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
13371 !! html
13372 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
13373
13374 !! end
13375
13376 !! test
13377 MSIE CSS safety test: comment in expression
13378 !! wikitext
13379 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
13380 !! html
13381 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
13382
13383 !! end
13384
13385 !! test
13386 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
13387 !! wikitext
13388 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
13389 !! html
13390 <p style="/* invalid control char */">A</p>
13391
13392 !! end
13393
13394 !! test
13395 MSIE 6 CSS safety test: Fullwidth (bug 55332)
13396 !! wikitext
13397 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
13398 <div style="top:EXPRESSION(alert())">B</div>
13399 !! html
13400 <p style="/* insecure input */">A</p>
13401 <div style="/* insecure input */">B</div>
13402
13403 !! end
13404
13405 !! test
13406 MSIE 6 CSS safety test: IPA extensions (bug 55332)
13407 !! wikitext
13408 <div style="background-image:uʀʟ(javascript:alert())">A</div>
13409 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
13410 !! html
13411 <div style="/* insecure input */">A</div>
13412 <p style="/* insecure input */">B</p>
13413
13414 !! end
13415
13416 !! test
13417 MSIE 6 CSS safety test: sup/sub script (bug 55332)
13418 !! wikitext
13419 <div style="background-image:url⁽javascript:alert())">A</div>
13420 <div style="background-image:url₍javascript:alert())">B</div>
13421 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
13422 !! html
13423 <div style="/* insecure input */">A</div>
13424 <div style="/* insecure input */">B</div>
13425 <p style="/* insecure input */">C</p>
13426
13427 !! end
13428
13429 !! test
13430 Opera -o-link CSS
13431 !! wikitext
13432 <div
13433 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;"
13434 style="-o-link:attr(title);-o-link-source:current">X</div>
13435 !! html
13436 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
13437
13438 !! end
13439
13440 !! test
13441 MSIE 6 CSS safety test: Repetition markers (bug 55332)
13442 !! wikitext
13443 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
13444 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
13445 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
13446 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
13447 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
13448 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
13449 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
13450 !! html
13451 <p style="/* insecure input */">A</p>
13452 <p style="/* insecure input */">B</p>
13453 <p style="/* insecure input */">C</p>
13454 <p style="/* insecure input */">D</p>
13455 <p style="/* insecure input */">E</p>
13456 <p style="/* insecure input */">F</p>
13457 <p style="/* insecure input */">G</p>
13458
13459 !! end
13460
13461 !! test
13462 Table attribute legitimate extension
13463 !! wikitext
13464 {|
13465 !+ style="<nowiki>color:blue</nowiki>"| status
13466 |}
13467 !! html
13468 <table>
13469 <tr>
13470 <th style="color:blue"> status
13471 </th></tr></table>
13472
13473 !!end
13474
13475 !! test
13476 Table attribute safety
13477 !! wikitext
13478 {|
13479 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
13480 |}
13481 !! html
13482 <table>
13483 <tr>
13484 <th style="/* insecure input */"> status
13485 </th></tr></table>
13486
13487 !! end
13488
13489 !! test
13490 CSS line continuation 1
13491 !! wikitext
13492 <div style="background-image: u\&#10;rl(test.jpg);"></div>
13493 !! html
13494 <div style="/* insecure input */"></div>
13495
13496 !! end
13497
13498 !! test
13499 CSS line continuation 2
13500 !! wikitext
13501 <div style="background-image: u\&#13;rl(test.jpg); "></div>
13502 !! html
13503 <div style="/* insecure input */"></div>
13504
13505 !! end
13506
13507 !! article
13508 Template:Identity
13509 !! text
13510 {{{1}}}
13511 !! endarticle
13512
13513 !! test
13514 Expansion of multi-line templates in attribute values (bug 6255)
13515 !! wikitext
13516 <div style="background: {{identity|#00FF00}}">-</div>
13517 !! html
13518 <div style="background: #00FF00">-</div>
13519
13520 !! end
13521
13522
13523 !! test
13524 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
13525 !! wikitext
13526 <div style="background:
13527 #00FF00">-</div>
13528 !! html
13529 <div style="background: #00FF00">-</div>
13530
13531 !! end
13532
13533 !! test
13534 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
13535 !! wikitext
13536 <div style="background: &#10;#00FF00">-</div>
13537 !! html
13538 <div style="background: &#10;#00FF00">-</div>
13539
13540 !! end
13541
13542 ###
13543 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
13544 ###
13545 !! test
13546 Parser hook: empty input
13547 !! wikitext
13548 <tag></tag>
13549 !! html
13550 <pre>
13551 ''
13552 array (
13553 )
13554 </pre>
13555
13556 !! end
13557
13558 !! test
13559 Parser hook: empty input using terminated empty elements
13560 !! wikitext
13561 <tag/>
13562 !! html
13563 <pre>
13564 NULL
13565 array (
13566 )
13567 </pre>
13568
13569 !! end
13570
13571 !! test
13572 Parser hook: empty input using terminated empty elements (space before)
13573 !! wikitext
13574 <tag />
13575 !! html
13576 <pre>
13577 NULL
13578 array (
13579 )
13580 </pre>
13581
13582 !! end
13583
13584 !! test
13585 Parser hook: basic input
13586 !! wikitext
13587 <tag>input</tag>
13588 !! html
13589 <pre>
13590 'input'
13591 array (
13592 )
13593 </pre>
13594
13595 !! end
13596
13597
13598 !! test
13599 Parser hook: case insensitive
13600 !! wikitext
13601 <TAG>input</TAG>
13602 !! html
13603 <pre>
13604 'input'
13605 array (
13606 )
13607 </pre>
13608
13609 !! end
13610
13611
13612 !! test
13613 Parser hook: case insensitive, redux
13614 !! wikitext
13615 <TaG>input</TAg>
13616 !! html
13617 <pre>
13618 'input'
13619 array (
13620 )
13621 </pre>
13622
13623 !! end
13624
13625 !! test
13626 Parser hook: nested tags
13627 !! options
13628 noxml
13629 !! wikitext
13630 <tag><tag></tag></tag>
13631 !! html
13632 <pre>
13633 '<tag>'
13634 array (
13635 )
13636 </pre>&lt;/tag&gt;
13637
13638 !! end
13639
13640 !! test
13641 Parser hook: basic arguments
13642 !! wikitext
13643 <tag width=200 height = "100" depth = '50' square></tag>
13644 !! html
13645 <pre>
13646 ''
13647 array (
13648 'width' => '200',
13649 'height' => '100',
13650 'depth' => '50',
13651 'square' => 'square',
13652 )
13653 </pre>
13654
13655 !! end
13656
13657 !! test
13658 Parser hook: argument containing a forward slash (bug 5344)
13659 !! wikitext
13660 <tag filename='/tmp/bla'></tag>
13661 !! html
13662 <pre>
13663 ''
13664 array (
13665 'filename' => '/tmp/bla',
13666 )
13667 </pre>
13668
13669 !! end
13670
13671 !! test
13672 Parser hook: empty input using terminated empty elements (bug 2374)
13673 !! wikitext
13674 <tag foo=bar/>text
13675 !! html
13676 <pre>
13677 NULL
13678 array (
13679 'foo' => 'bar',
13680 )
13681 </pre>text
13682
13683 !! end
13684
13685 # </tag> should be output literally since there is no matching tag that begins it
13686 !! test
13687 Parser hook: basic arguments using terminated empty elements (bug 2374)
13688 !! wikitext
13689 <tag width=200 height = "100" depth = '50' square/>
13690 other stuff
13691 </tag>
13692 !! html
13693 <pre>
13694 NULL
13695 array (
13696 'width' => '200',
13697 'height' => '100',
13698 'depth' => '50',
13699 'square' => 'square',
13700 )
13701 </pre>
13702 <p>other stuff
13703 &lt;/tag&gt;
13704 </p>
13705 !! end
13706
13707 ###
13708 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
13709 ###
13710
13711 !! test
13712 Parser hook: static parser hook not inside a comment
13713 !! wikitext
13714 <statictag>hello, world</statictag>
13715 <statictag action=flush/>
13716 !! html
13717 <p>hello, world
13718 </p>
13719 !! end
13720
13721
13722 !! test
13723 Parser hook: static parser hook inside a comment
13724 !! wikitext
13725 <!-- <statictag>hello, world</statictag> -->
13726 <statictag action=flush/>
13727 !! html
13728 <p><br />
13729 </p>
13730 !! end
13731
13732 # Nested template calls; this case was broken by Parser.php rev 1.506,
13733 # since reverted.
13734
13735 !! article
13736 Template:One-parameter
13737 !! text
13738 (My parameter is: {{{1}}})
13739 !! endarticle
13740
13741 !! article
13742 Template:Map-one-parameter
13743 !! text
13744 {{{{{1}}}|{{{2}}}}}
13745 !! endarticle
13746
13747 !! test
13748 Nested template calls
13749 !! wikitext
13750 {{Map-one-parameter|One-parameter|param}}
13751 !! html
13752 <p>(My parameter is: param)
13753 </p>
13754 !! end
13755
13756
13757 ###
13758 ### Sanitizer
13759 ###
13760 !! test
13761 Sanitizer: Closing of open tags
13762 !! wikitext
13763 <s></s><table></table>
13764 !! html
13765 <s></s><table></table>
13766
13767 !! end
13768
13769 !! test
13770 Sanitizer: Closing of open but not closed tags
13771 !! wikitext
13772 <s>foo
13773 !! html
13774 <p><s>foo</s>
13775 </p>
13776 !! end
13777
13778 !! test
13779 Sanitizer: Closing of closed but not open tags
13780 !! wikitext
13781 </s>
13782 !! html
13783 <p>&lt;/s&gt;
13784 </p>
13785 !! end
13786
13787 !! test
13788 Sanitizer: Closing of closed but not open table tags
13789 !! wikitext
13790 Table not started</td></tr></table>
13791 !! html
13792 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
13793 </p>
13794 !! end
13795
13796 !! test
13797 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
13798 !! wikitext
13799 <span id="æ: v">byte</span>[[#æ: v|backlink]]
13800 !! html
13801 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
13802 </p>
13803 !! end
13804
13805 !! test
13806 Sanitizer: Validating the contents of the id attribute (bug 4515)
13807 !! options
13808 disabled
13809 !! wikitext
13810 <br id=9 />
13811 !! html
13812 Something, but definitely not <br id="9" />...
13813 !! end
13814
13815 !! test
13816 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
13817 !! options
13818 disabled
13819 !! wikitext
13820 <br id="foo" /><br id="foo" />
13821 !! html
13822 Something need to be done. foo-2 ?
13823 !! end
13824
13825 !! test
13826 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
13827 !! wikitext
13828 <div itemscope>
13829 <meta itemprop="hello" content="world">
13830 <meta http-equiv="refresh" content="5">
13831 <meta itemprop="hello" http-equiv="refresh" content="5">
13832 <link itemprop="hello" href="{{SERVER}}">
13833 <link rel="stylesheet" href="{{SERVER}}">
13834 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
13835 </div>
13836 !! html
13837 <div itemscope="itemscope">
13838 <p> <meta itemprop="hello" content="world" />
13839 &lt;meta http-equiv="refresh" content="5"&gt;
13840 <meta itemprop="hello" content="5" />
13841 </p>
13842 <link itemprop="hello" href="http&#58;//example.org" />
13843 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
13844 <link itemprop="hello" href="http&#58;//example.org" />
13845 </div>
13846
13847 !! end
13848
13849 !! test
13850 Language converter: output gets cut off unexpectedly (bug 5757)
13851 !! options
13852 language=zh
13853 !! wikitext
13854 this bit is safe: }-
13855
13856 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
13857
13858 then we get cut off here: }-
13859
13860 all additional text is vanished
13861 !! html
13862 <p>this bit is safe: }-
13863 </p><p>but if we add a conversion instance: xxx
13864 </p><p>then we get cut off here: }-
13865 </p><p>all additional text is vanished
13866 </p>
13867 !! end
13868
13869 !! test
13870 Self closed html pairs (bug 5487)
13871 !! options
13872 !! wikitext
13873 <center><font id="bug" />Centered text</center>
13874 <div><font id="bug2" />In div text</div>
13875 !! html
13876 <center>&lt;font id="bug" /&gt;Centered text</center>
13877 <div>&lt;font id="bug2" /&gt;In div text</div>
13878
13879 !! end
13880
13881 #
13882 #
13883 #
13884
13885 !! test
13886 Punctuation: nbsp before exclamation
13887 !! wikitext
13888 C'est grave !
13889 !! html
13890 <p>C'est grave&#160;!
13891 </p>
13892 !! end
13893
13894 !! test
13895 Punctuation: CSS !important (bug 11874)
13896 !! wikitext
13897 <div style="width:50% !important">important</div>
13898 !! html
13899 <div style="width:50% !important">important</div>
13900
13901 !!end
13902
13903 !! test
13904 Punctuation: CSS ! important (bug 11874; with space after)
13905 !! wikitext
13906 <div style="width:50% ! important">important</div>
13907 !! html
13908 <div style="width:50% ! important">important</div>
13909
13910 !!end
13911
13912
13913 !! test
13914 HTML bullet list, closed tags (bug 5497)
13915 !! wikitext
13916 <ul>
13917 <li>One</li>
13918 <li>Two</li>
13919 </ul>
13920 !! html
13921 <ul>
13922 <li>One</li>
13923 <li>Two</li>
13924 </ul>
13925
13926 !! end
13927
13928 !! test
13929 HTML bullet list, unclosed tags (bug 5497)
13930 !! options
13931 disabled
13932 !! wikitext
13933 <ul>
13934 <li>One
13935 <li>Two
13936 </ul>
13937 !! html
13938 <ul>
13939 <li>One
13940 </li>
13941 <li>Two
13942 </li>
13943 </ul>
13944
13945 !! end
13946
13947 !! test
13948 HTML ordered list, closed tags (bug 5497)
13949 !! wikitext
13950 <ol>
13951 <li>One</li>
13952 <li>Two</li>
13953 </ol>
13954 !! html
13955 <ol>
13956 <li>One</li>
13957 <li>Two</li>
13958 </ol>
13959
13960 !! end
13961
13962 !! test
13963 HTML ordered list, unclosed tags (bug 5497)
13964 !! options
13965 disabled
13966 !! wikitext
13967 <ol>
13968 <li>One
13969 <li>Two
13970 </ol>
13971 !! html
13972 <ol>
13973 <li>One
13974 </li>
13975 <li>Two
13976 </li>
13977 </ol>
13978
13979 !! end
13980
13981 !! test
13982 HTML nested bullet list, closed tags (bug 5497)
13983 !! wikitext
13984 <ul>
13985 <li>One</li>
13986 <li>Two:
13987 <ul>
13988 <li>Sub-one</li>
13989 <li>Sub-two</li>
13990 </ul>
13991 </li>
13992 </ul>
13993 !! html
13994 <ul>
13995 <li>One</li>
13996 <li>Two:
13997 <ul>
13998 <li>Sub-one</li>
13999 <li>Sub-two</li>
14000 </ul>
14001 </li>
14002 </ul>
14003
14004 !! end
14005
14006 !! test
14007 HTML nested bullet list, open tags (bug 5497)
14008 !! options
14009 disabled
14010 !! wikitext
14011 <ul>
14012 <li>One
14013 <li>Two:
14014 <ul>
14015 <li>Sub-one
14016 <li>Sub-two
14017 </ul>
14018 </ul>
14019 !! html
14020 <ul>
14021 <li>One
14022 </li>
14023 <li>Two:
14024 <ul>
14025 <li>Sub-one
14026 </li>
14027 <li>Sub-two
14028 </li>
14029 </ul>
14030 </li>
14031 </ul>
14032
14033 !! end
14034
14035 !! test
14036 HTML nested ordered list, closed tags (bug 5497)
14037 !! wikitext
14038 <ol>
14039 <li>One</li>
14040 <li>Two:
14041 <ol>
14042 <li>Sub-one</li>
14043 <li>Sub-two</li>
14044 </ol>
14045 </li>
14046 </ol>
14047 !! html
14048 <ol>
14049 <li>One</li>
14050 <li>Two:
14051 <ol>
14052 <li>Sub-one</li>
14053 <li>Sub-two</li>
14054 </ol>
14055 </li>
14056 </ol>
14057
14058 !! end
14059
14060 !! test
14061 HTML nested ordered list, open tags (bug 5497)
14062 !! options
14063 disabled
14064 !! wikitext
14065 <ol>
14066 <li>One
14067 <li>Two:
14068 <ol>
14069 <li>Sub-one
14070 <li>Sub-two
14071 </ol>
14072 </ol>
14073 !! html
14074 <ol>
14075 <li>One
14076 </li>
14077 <li>Two:
14078 <ol>
14079 <li>Sub-one
14080 </li>
14081 <li>Sub-two
14082 </li>
14083 </ol>
14084 </li>
14085 </ol>
14086
14087 !! end
14088
14089 !! test
14090 HTML ordered list item with parameters oddity
14091 !! wikitext
14092 <ol><li id="fragment">One</li>
14093 </ol>
14094 !! html
14095 <ol><li id="fragment">One</li>
14096 </ol>
14097
14098 !! end
14099
14100 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
14101 !!test
14102 bug 5918: autonumbering
14103 !! wikitext
14104 [http://first/] [http://second] [ftp://ftp]
14105
14106 ftp://inlineftp
14107
14108 [mailto:enclosed@mail.tld With target]
14109
14110 [mailto:enclosed@mail.tld]
14111
14112 mailto:inline@mail.tld
14113 !! html/php
14114 <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>
14115 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
14116 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
14117 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
14118 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
14119 </p>
14120 !! html/parsoid
14121 <p><a rel="mw:ExtLink" href="http://first/"></a> <a rel="mw:ExtLink" href="http://second"></a> <a rel="mw:ExtLink" href="ftp://ftp"></a></p>
14122 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
14123 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
14124 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
14125 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
14126 !! end
14127
14128
14129 #
14130 # Security and HTML correctness
14131 # From Nick Jenkins' fuzz testing
14132 #
14133
14134 !! test
14135 Fuzz testing: Parser13
14136 !! wikitext
14137 {|
14138 | http://a|
14139 !! html
14140 <table>
14141 <tr>
14142 <td>
14143 </td>
14144 </tr>
14145 </table>
14146
14147 !! end
14148
14149 !! test
14150 Fuzz testing: Parser14
14151 !! wikitext
14152 == onmouseover= ==
14153 http://__TOC__
14154 !! html
14155 <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>
14156 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14157 <ul>
14158 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
14159 </ul>
14160 </div>
14161
14162
14163 !! end
14164
14165 !! test
14166 Fuzz testing: Parser14-table
14167 !! wikitext
14168 ==a==
14169 {| STYLE=__TOC__
14170 !! html
14171 <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>
14172 <table style="&#95;_TOC&#95;_">
14173 <tr><td></td></tr>
14174 </table>
14175
14176 !! end
14177
14178 # Known to produce bogus xml (extra </td>)
14179 !! test
14180 Fuzz testing: Parser16
14181 !! options
14182 noxml
14183 !! wikitext
14184 {|
14185 !https://||||||
14186 !! html
14187 <table>
14188 <tr>
14189 <th>https://</th>
14190 <th></th>
14191 <th></th>
14192 <th>
14193 </td>
14194 </tr>
14195 </table>
14196
14197 !! end
14198
14199 !! test
14200 Fuzz testing: Parser21
14201 !! wikitext
14202 {|
14203 ! irc://{{ftp://a" onmouseover="alert('hello world');"
14204 |
14205 !! html
14206 <table>
14207 <tr>
14208 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
14209 </th>
14210 <td>
14211 </td>
14212 </tr>
14213 </table>
14214
14215 !! end
14216
14217 !! test
14218 Fuzz testing: Parser22
14219 !! wikitext
14220 http://===r:::https://b
14221
14222 {|
14223 !! html
14224 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
14225 </p>
14226 <table>
14227 <tr><td></td></tr>
14228 </table>
14229
14230 !! end
14231
14232 # Known to produce bad XML for now
14233 !! test
14234 Fuzz testing: Parser24
14235 !! options
14236 noxml
14237 !! wikitext
14238 {|
14239 {{{|
14240 <u CLASS=
14241 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
14242 <br style="onmouseover='alert(document.cookie);' " />
14243
14244 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14245 |
14246 !! html
14247 <table>
14248 {{{|
14249 <u class="&#124;">}}}} &gt;
14250 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
14251
14252 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14253 <tr>
14254 <td></u>
14255 </td>
14256 </tr>
14257 </table>
14258
14259 !! end
14260
14261 # Note: the current result listed for this is not what the original one was,
14262 # but the original bug was JavaScript injection, which is fixed in any case.
14263 # It's not clear that the original result listed was any more correct than the
14264 # current one. Original result:
14265 # <p>{{{|
14266 # </p>
14267 # <li class="&#124;&#124;">
14268 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14269 !!test
14270 Fuzz testing: Parser25 (bug 6055)
14271 !! wikitext
14272 {{{
14273 |
14274 <LI CLASS=||
14275 >
14276 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
14277 !! html
14278 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14279 </p>
14280 !! end
14281
14282 !!test
14283 Fuzz testing: URL adjacent extension (with space, clean)
14284 !! options
14285 !! wikitext
14286 http://example.com <nowiki>junk</nowiki>
14287 !! html
14288 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
14289 </p>
14290 !!end
14291
14292 !!test
14293 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
14294 !! options
14295 !! wikitext
14296 http://example.com<nowiki>junk</nowiki>
14297 !! html
14298 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
14299 </p>
14300 !!end
14301
14302 !!test
14303 Fuzz testing: URL adjacent extension (no space, dirty; pre)
14304 !! options
14305 !! wikitext
14306 http://example.com<pre>junk</pre>
14307 !! html
14308 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
14309
14310 !!end
14311
14312 !!test
14313 Fuzz testing: image with bogus manual thumbnail
14314 !! wikitext
14315 [[Image:foobar.jpg|thumbnail= ]]
14316 !! html/php
14317 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
14318
14319 !! html/parsoid
14320 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
14321 !!end
14322
14323 !! test
14324 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
14325 !! wikitext
14326 <pre dir="&#10;"></pre>
14327 !! html
14328 <pre dir="&#10;"></pre>
14329
14330 !! end
14331
14332 !! test
14333 Parsing optional HTML elements (Bug 6171)
14334 !! options
14335 !! wikitext
14336 <table>
14337 <tr>
14338 <td> Some tabular data</td>
14339 <td> More tabular data ...
14340 <td> And yet som tabular data</td>
14341 </tr>
14342 </table>
14343 !! html
14344 <table>
14345 <tr>
14346 <td> Some tabular data</td>
14347 <td> More tabular data ...
14348 </td><td> And yet som tabular data</td>
14349 </tr>
14350 </table>
14351
14352 !! end
14353
14354 !! test
14355 Correct handling of <td>, <tr> (Bug 6171)
14356 !! options
14357 !! wikitext
14358 <table>
14359 <tr>
14360 <td> Some tabular data</td>
14361 <td> More tabular data ...</td>
14362 <td> And yet som tabular data</td>
14363 </tr>
14364 </table>
14365 !! html
14366 <table>
14367 <tr>
14368 <td> Some tabular data</td>
14369 <td> More tabular data ...</td>
14370 <td> And yet som tabular data</td>
14371 </tr>
14372 </table>
14373
14374 !! end
14375
14376
14377 !! test
14378 Parsing crashing regression (fr:JavaScript)
14379 !! wikitext
14380 </body></x>
14381 !! html
14382 <p>&lt;/body&gt;&lt;/x&gt;
14383 </p>
14384 !! end
14385
14386 !! test
14387 Inline wiki vs wiki block nesting
14388 !! wikitext
14389 '''Bold paragraph
14390
14391 New wiki paragraph
14392 !! html
14393 <p><b>Bold paragraph</b>
14394 </p><p>New wiki paragraph
14395 </p>
14396 !! end
14397
14398 !! test
14399 Inline HTML vs wiki block nesting
14400 !! options
14401 disabled
14402 !! wikitext
14403 <b>Bold paragraph
14404
14405 New wiki paragraph
14406 !! html
14407 <p><b>Bold paragraph</b>
14408 </p><p>New wiki paragraph
14409 </p>
14410 !! end
14411
14412 # Original result was this:
14413 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
14414 # </p>
14415 # While that might be marginally more intuitive, maybe, the six-apostrophe
14416 # construct is clearly pathological and the result stated here (which is what
14417 # the parser actually does) is about as reasonable as anything.
14418 !!test
14419 Mixing markup for italics and bold
14420 !! options
14421 !! wikitext
14422 '''bold''''''bold''bolditalics'''''
14423 !! html
14424 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
14425 </p>
14426 !! end
14427
14428
14429 !! article
14430 Xyzzyx
14431 !! text
14432 Article for special page transclusion test
14433 !! endarticle
14434
14435 !! test
14436 Special page transclusion
14437 !! options
14438 !! wikitext
14439 {{Special:Prefixindex/Xyzzyx}}
14440 !! html
14441 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14442
14443 !! end
14444
14445 !! test
14446 Special page transclusion twice (bug 5021)
14447 !! options
14448 !! wikitext
14449 {{Special:Prefixindex/Xyzzyx}}
14450 {{Special:Prefixindex/Xyzzyx}}
14451 !! html
14452 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14453 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14454
14455 !! end
14456
14457 !! test
14458 Transclusion of default MediaWiki message
14459 !! wikitext
14460 {{MediaWiki:Mainpage}}
14461 !! html
14462 <p>Main Page
14463 </p>
14464 !! end
14465
14466 !! test
14467 Transclusion of nonexistent MediaWiki message
14468 !! wikitext
14469 {{MediaWiki:Mainpagexxx}}
14470 !! html
14471 <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>
14472 </p>
14473 !! end
14474
14475 !! test
14476 Transclusion of MediaWiki message with underscore
14477 !! wikitext
14478 {{MediaWiki:history_short}}
14479 !! html
14480 <p>History
14481 </p>
14482 !! end
14483
14484 !! test
14485 Transclusion of MediaWiki message with space
14486 !! wikitext
14487 {{MediaWiki:history short}}
14488 !! html
14489 <p>History
14490 </p>
14491 !! end
14492
14493 !! test
14494 Invalid header with following text
14495 !! wikitext
14496 = x = y
14497 !! html
14498 <p>= x = y
14499 </p>
14500 !! end
14501
14502
14503 !! test
14504 Section extraction test (section 0)
14505 !! options
14506 section=0
14507 !! wikitext
14508 start
14509 ==a==
14510 ===aa===
14511 ====aaa====
14512 ==b==
14513 ===ba===
14514 ===bb===
14515 ====bba====
14516 ===bc===
14517 ==c==
14518 ===ca===
14519 !! html
14520 start
14521 !! end
14522
14523 !! test
14524 Section extraction test (section 1)
14525 !! options
14526 section=1
14527 !! wikitext
14528 start
14529 ==a==
14530 ===aa===
14531 ====aaa====
14532 ==b==
14533 ===ba===
14534 ===bb===
14535 ====bba====
14536 ===bc===
14537 ==c==
14538 ===ca===
14539 !! html
14540 ==a==
14541 ===aa===
14542 ====aaa====
14543 !! end
14544
14545 !! test
14546 Section extraction test (section 2)
14547 !! options
14548 section=2
14549 !! wikitext
14550 start
14551 ==a==
14552 ===aa===
14553 ====aaa====
14554 ==b==
14555 ===ba===
14556 ===bb===
14557 ====bba====
14558 ===bc===
14559 ==c==
14560 ===ca===
14561 !! html
14562 ===aa===
14563 ====aaa====
14564 !! end
14565
14566 !! test
14567 Section extraction test (section 3)
14568 !! options
14569 section=3
14570 !! wikitext
14571 start
14572 ==a==
14573 ===aa===
14574 ====aaa====
14575 ==b==
14576 ===ba===
14577 ===bb===
14578 ====bba====
14579 ===bc===
14580 ==c==
14581 ===ca===
14582 !! html
14583 ====aaa====
14584 !! end
14585
14586 !! test
14587 Section extraction test (section 4)
14588 !! options
14589 section=4
14590 !! wikitext
14591 start
14592 ==a==
14593 ===aa===
14594 ====aaa====
14595 ==b==
14596 ===ba===
14597 ===bb===
14598 ====bba====
14599 ===bc===
14600 ==c==
14601 ===ca===
14602 !! html
14603 ==b==
14604 ===ba===
14605 ===bb===
14606 ====bba====
14607 ===bc===
14608 !! end
14609
14610 !! test
14611 Section extraction test (section 5)
14612 !! options
14613 section=5
14614 !! wikitext
14615 start
14616 ==a==
14617 ===aa===
14618 ====aaa====
14619 ==b==
14620 ===ba===
14621 ===bb===
14622 ====bba====
14623 ===bc===
14624 ==c==
14625 ===ca===
14626 !! html
14627 ===ba===
14628 !! end
14629
14630 !! test
14631 Section extraction test (section 6)
14632 !! options
14633 section=6
14634 !! wikitext
14635 start
14636 ==a==
14637 ===aa===
14638 ====aaa====
14639 ==b==
14640 ===ba===
14641 ===bb===
14642 ====bba====
14643 ===bc===
14644 ==c==
14645 ===ca===
14646 !! html
14647 ===bb===
14648 ====bba====
14649 !! end
14650
14651 !! test
14652 Section extraction test (section 7)
14653 !! options
14654 section=7
14655 !! wikitext
14656 start
14657 ==a==
14658 ===aa===
14659 ====aaa====
14660 ==b==
14661 ===ba===
14662 ===bb===
14663 ====bba====
14664 ===bc===
14665 ==c==
14666 ===ca===
14667 !! html
14668 ====bba====
14669 !! end
14670
14671 !! test
14672 Section extraction test (section 8)
14673 !! options
14674 section=8
14675 !! wikitext
14676 start
14677 ==a==
14678 ===aa===
14679 ====aaa====
14680 ==b==
14681 ===ba===
14682 ===bb===
14683 ====bba====
14684 ===bc===
14685 ==c==
14686 ===ca===
14687 !! html
14688 ===bc===
14689 !! end
14690
14691 !! test
14692 Section extraction test (section 9)
14693 !! options
14694 section=9
14695 !! wikitext
14696 start
14697 ==a==
14698 ===aa===
14699 ====aaa====
14700 ==b==
14701 ===ba===
14702 ===bb===
14703 ====bba====
14704 ===bc===
14705 ==c==
14706 ===ca===
14707 !! html
14708 ==c==
14709 ===ca===
14710 !! end
14711
14712 !! test
14713 Section extraction test (section 10)
14714 !! options
14715 section=10
14716 !! wikitext
14717 start
14718 ==a==
14719 ===aa===
14720 ====aaa====
14721 ==b==
14722 ===ba===
14723 ===bb===
14724 ====bba====
14725 ===bc===
14726 ==c==
14727 ===ca===
14728 !! html
14729 ===ca===
14730 !! end
14731
14732 !! test
14733 Section extraction test (nonexistent section 11)
14734 !! options
14735 section=11
14736 !! wikitext
14737 start
14738 ==a==
14739 ===aa===
14740 ====aaa====
14741 ==b==
14742 ===ba===
14743 ===bb===
14744 ====bba====
14745 ===bc===
14746 ==c==
14747 ===ca===
14748 !! html
14749 !! end
14750
14751 !! test
14752 Section extraction test with bogus heading (section 1)
14753 !! options
14754 section=1
14755 !! wikitext
14756 ==a==
14757 ==bogus== not a legal section
14758 ==b==
14759 !! html
14760 ==a==
14761 ==bogus== not a legal section
14762 !! end
14763
14764 !! test
14765 Section extraction test with bogus heading (section 2)
14766 !! options
14767 section=2
14768 !! wikitext
14769 ==a==
14770 ==bogus== not a legal section
14771 ==b==
14772 !! html
14773 ==b==
14774 !! end
14775
14776 !! test
14777 Section extraction test with comment after heading (section 1)
14778 !! options
14779 section=1
14780 !! wikitext
14781 ==a==
14782 ==b== <!-- -->
14783 ==c==
14784 !! html
14785 ==a==
14786 !! end
14787
14788 !! test
14789 Section extraction test with comment after heading (section 2)
14790 !! options
14791 section=2
14792 !! wikitext
14793 ==a==
14794 ==b== <!-- -->
14795 ==c==
14796 !! html
14797 ==b== <!-- -->
14798 !! end
14799
14800 !! test
14801 Section extraction test with bogus <nowiki> heading (section 1)
14802 !! options
14803 section=1
14804 !! wikitext
14805 ==a==
14806 ==bogus== <nowiki>not a legal section</nowiki>
14807 ==b==
14808 !! html
14809 ==a==
14810 ==bogus== <nowiki>not a legal section</nowiki>
14811 !! end
14812
14813 !! test
14814 Section extraction test with bogus <nowiki> heading (section 2)
14815 !! options
14816 section=2
14817 !! wikitext
14818 ==a==
14819 ==bogus== <nowiki>not a legal section</nowiki>
14820 ==b==
14821 !! html
14822 ==b==
14823 !! end
14824
14825
14826 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
14827 # instead of respecting commented sections
14828 !! test
14829 Section extraction prefixed by comment (section 1)
14830 !! options
14831 section=1
14832 !! wikitext
14833 <!-- -->==sec1==
14834 ==sec2==
14835 !! html
14836 ==sec2==
14837 !!end
14838
14839 !! test
14840 Section extraction prefixed by comment (section 2)
14841 !! options
14842 section=2
14843 !! wikitext
14844 <!-- -->==sec1==
14845 ==sec2==
14846 !! html
14847
14848 !!end
14849
14850
14851 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
14852 # instead of respecting HTML-style headings
14853 !! test
14854 Section extraction, mixed wiki and html (section 1)
14855 !! options
14856 section=1
14857 !! wikitext
14858 <h2>unmarked</h2>
14859 unmarked
14860 ==1==
14861 one
14862 ==2==
14863 two
14864 !! html
14865 ==1==
14866 one
14867 !! end
14868
14869 !! test
14870 Section extraction, mixed wiki and html (section 2)
14871 !! options
14872 section=2
14873 !! wikitext
14874 <h2>unmarked</h2>
14875 unmarked
14876 ==1==
14877 one
14878 ==2==
14879 two
14880 !! html
14881 ==2==
14882 two
14883 !! end
14884
14885
14886 # Formerly testing for bug 3342
14887 !! test
14888 Section extraction, heading surrounded by <noinclude>
14889 !! options
14890 section=1
14891 !! wikitext
14892 <noinclude>==unmarked==</noinclude>
14893 ==marked==
14894 !! html
14895 ==marked==
14896 !!end
14897
14898 # Test behavior of bug 19910
14899 !! test
14900 Sectiion with all-equals
14901 !! options
14902 section=2
14903 !! wikitext
14904 ===
14905 The line above must have a trailing space
14906 === <!--
14907 --> <!-- -->
14908 But just in case it doesn't...
14909 !! html
14910 === <!--
14911 --> <!-- -->
14912 But just in case it doesn't...
14913 !! end
14914
14915 !! test
14916 Section replacement test (section 0)
14917 !! options
14918 replace=0,"xxx"
14919 !! wikitext
14920 start
14921 ==a==
14922 ===aa===
14923 ====aaa====
14924 ==b==
14925 ===ba===
14926 ===bb===
14927 ====bba====
14928 ===bc===
14929 ==c==
14930 ===ca===
14931 !! html
14932 xxx
14933
14934 ==a==
14935 ===aa===
14936 ====aaa====
14937 ==b==
14938 ===ba===
14939 ===bb===
14940 ====bba====
14941 ===bc===
14942 ==c==
14943 ===ca===
14944 !! end
14945
14946 !! test
14947 Section replacement test (section 1)
14948 !! options
14949 replace=1,"xxx"
14950 !! wikitext
14951 start
14952 ==a==
14953 ===aa===
14954 ====aaa====
14955 ==b==
14956 ===ba===
14957 ===bb===
14958 ====bba====
14959 ===bc===
14960 ==c==
14961 ===ca===
14962 !! html
14963 start
14964 xxx
14965
14966 ==b==
14967 ===ba===
14968 ===bb===
14969 ====bba====
14970 ===bc===
14971 ==c==
14972 ===ca===
14973 !! end
14974
14975 !! test
14976 Section replacement test (section 2)
14977 !! options
14978 replace=2,"xxx"
14979 !! wikitext
14980 start
14981 ==a==
14982 ===aa===
14983 ====aaa====
14984 ==b==
14985 ===ba===
14986 ===bb===
14987 ====bba====
14988 ===bc===
14989 ==c==
14990 ===ca===
14991 !! html
14992 start
14993 ==a==
14994 xxx
14995
14996 ==b==
14997 ===ba===
14998 ===bb===
14999 ====bba====
15000 ===bc===
15001 ==c==
15002 ===ca===
15003 !! end
15004
15005 !! test
15006 Section replacement test (section 3)
15007 !! options
15008 replace=3,"xxx"
15009 !! wikitext
15010 start
15011 ==a==
15012 ===aa===
15013 ====aaa====
15014 ==b==
15015 ===ba===
15016 ===bb===
15017 ====bba====
15018 ===bc===
15019 ==c==
15020 ===ca===
15021 !! html
15022 start
15023 ==a==
15024 ===aa===
15025 xxx
15026
15027 ==b==
15028 ===ba===
15029 ===bb===
15030 ====bba====
15031 ===bc===
15032 ==c==
15033 ===ca===
15034 !! end
15035
15036 !! test
15037 Section replacement test (section 4)
15038 !! options
15039 replace=4,"xxx"
15040 !! wikitext
15041 start
15042 ==a==
15043 ===aa===
15044 ====aaa====
15045 ==b==
15046 ===ba===
15047 ===bb===
15048 ====bba====
15049 ===bc===
15050 ==c==
15051 ===ca===
15052 !! html
15053 start
15054 ==a==
15055 ===aa===
15056 ====aaa====
15057 xxx
15058
15059 ==c==
15060 ===ca===
15061 !! end
15062
15063 !! test
15064 Section replacement test (section 5)
15065 !! options
15066 replace=5,"xxx"
15067 !! wikitext
15068 start
15069 ==a==
15070 ===aa===
15071 ====aaa====
15072 ==b==
15073 ===ba===
15074 ===bb===
15075 ====bba====
15076 ===bc===
15077 ==c==
15078 ===ca===
15079 !! html
15080 start
15081 ==a==
15082 ===aa===
15083 ====aaa====
15084 ==b==
15085 xxx
15086
15087 ===bb===
15088 ====bba====
15089 ===bc===
15090 ==c==
15091 ===ca===
15092 !! end
15093
15094 !! test
15095 Section replacement test (section 6)
15096 !! options
15097 replace=6,"xxx"
15098 !! wikitext
15099 start
15100 ==a==
15101 ===aa===
15102 ====aaa====
15103 ==b==
15104 ===ba===
15105 ===bb===
15106 ====bba====
15107 ===bc===
15108 ==c==
15109 ===ca===
15110 !! html
15111 start
15112 ==a==
15113 ===aa===
15114 ====aaa====
15115 ==b==
15116 ===ba===
15117 xxx
15118
15119 ===bc===
15120 ==c==
15121 ===ca===
15122 !! end
15123
15124 !! test
15125 Section replacement test (section 7)
15126 !! options
15127 replace=7,"xxx"
15128 !! wikitext
15129 start
15130 ==a==
15131 ===aa===
15132 ====aaa====
15133 ==b==
15134 ===ba===
15135 ===bb===
15136 ====bba====
15137 ===bc===
15138 ==c==
15139 ===ca===
15140 !! html
15141 start
15142 ==a==
15143 ===aa===
15144 ====aaa====
15145 ==b==
15146 ===ba===
15147 ===bb===
15148 xxx
15149
15150 ===bc===
15151 ==c==
15152 ===ca===
15153 !! end
15154
15155 !! test
15156 Section replacement test (section 8)
15157 !! options
15158 replace=8,"xxx"
15159 !! wikitext
15160 start
15161 ==a==
15162 ===aa===
15163 ====aaa====
15164 ==b==
15165 ===ba===
15166 ===bb===
15167 ====bba====
15168 ===bc===
15169 ==c==
15170 ===ca===
15171 !! html
15172 start
15173 ==a==
15174 ===aa===
15175 ====aaa====
15176 ==b==
15177 ===ba===
15178 ===bb===
15179 ====bba====
15180 xxx
15181
15182 ==c==
15183 ===ca===
15184 !!end
15185
15186 !! test
15187 Section replacement test (section 9)
15188 !! options
15189 replace=9,"xxx"
15190 !! wikitext
15191 start
15192 ==a==
15193 ===aa===
15194 ====aaa====
15195 ==b==
15196 ===ba===
15197 ===bb===
15198 ====bba====
15199 ===bc===
15200 ==c==
15201 ===ca===
15202 !! html
15203 start
15204 ==a==
15205 ===aa===
15206 ====aaa====
15207 ==b==
15208 ===ba===
15209 ===bb===
15210 ====bba====
15211 ===bc===
15212 xxx
15213 !! end
15214
15215 !! test
15216 Section replacement test (section 10)
15217 !! options
15218 replace=10,"xxx"
15219 !! wikitext
15220 start
15221 ==a==
15222 ===aa===
15223 ====aaa====
15224 ==b==
15225 ===ba===
15226 ===bb===
15227 ====bba====
15228 ===bc===
15229 ==c==
15230 ===ca===
15231 !! html
15232 start
15233 ==a==
15234 ===aa===
15235 ====aaa====
15236 ==b==
15237 ===ba===
15238 ===bb===
15239 ====bba====
15240 ===bc===
15241 ==c==
15242 xxx
15243 !! end
15244
15245 !! test
15246 Section replacement test with initial whitespace (bug 13728)
15247 !! options
15248 replace=2,"xxx"
15249 !! wikitext
15250 Preformatted initial line
15251 ==a==
15252 ===a===
15253 !! html
15254 Preformatted initial line
15255 ==a==
15256 xxx
15257 !! end
15258
15259
15260 !! test
15261 Section extraction, heading followed by pre with 20 spaces (bug 6398)
15262 !! options
15263 section=1
15264 !! wikitext
15265 ==a==
15266 a
15267 !! html
15268 ==a==
15269 a
15270 !! end
15271
15272 !! test
15273 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
15274 !! options
15275 section=1
15276 !! wikitext
15277 ==a==
15278 a
15279 !! html
15280 ==a==
15281 a
15282 !! end
15283
15284
15285 !! test
15286 Section extraction, <pre> around bogus header (bug 10309)
15287 !! options
15288 noxml section=2
15289 !! wikitext
15290 == Section One ==
15291 <pre>
15292 =======
15293 </pre>
15294
15295 == Section Two ==
15296 stuff
15297 !! html
15298 == Section Two ==
15299 stuff
15300 !! end
15301
15302 !! test
15303 Section replacement, <pre> around bogus header (bug 10309)
15304 !! options
15305 noxml replace=2,"xxx"
15306 !! wikitext
15307 == Section One ==
15308 <pre>
15309 =======
15310 </pre>
15311
15312 == Section Two ==
15313 stuff
15314 !! html
15315 == Section One ==
15316 <pre>
15317 =======
15318 </pre>
15319
15320 xxx
15321 !! end
15322
15323
15324
15325 !! test
15326 Handling of &#x0A; in URLs
15327 !! wikitext
15328 ** irc://&#x0A;a
15329 !! html/php
15330 <ul>
15331 <li><ul>
15332 <li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
15333 </li>
15334 </ul>
15335 </li>
15336 </ul>
15337
15338 !! html/parsoid
15339 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
15340 a">irc://
15341 a</a></li></ul></li></ul>
15342 !! end
15343
15344 !! test
15345 Handling of %0A in URLs
15346 !! wikitext
15347 ** irc://%0Aa
15348 !! html/php
15349 <ul>
15350 <li><ul>
15351 <li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
15352 </li>
15353 </ul>
15354 </li>
15355 </ul>
15356
15357 !! html/parsoid
15358 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15359 !! end
15360
15361
15362 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
15363 !! test
15364 5 quotes, code coverage +1 line
15365 !! options
15366 parsoid=wt2html
15367 !! wikitext
15368 '''''
15369 !! html/php
15370 !! html/parsoid
15371 <p><b><i></i></b></p>
15372 !! end
15373
15374 # same html as previous, but wikitext adjusted to match parsoid html2wt
15375 # note that wt2html and html2html will put the <i> before the <b>
15376 !! test
15377 5 quotes, code coverage +1 line w/ nowiki (1)
15378 !! options
15379 parsoid=wt2wt,html2wt
15380 !! wikitext
15381 '''''<nowiki/>'''''
15382 !! html/php
15383 <p><i></i>
15384 </p>
15385 !! html/parsoid
15386 <p><b><i></i></b></p>
15387 !! end
15388
15389 # same as previous, just swapping the <i> and <b>
15390 !! test
15391 5 quotes, code coverage +1 line w/ nowiki (2)
15392 !! wikitext
15393 '''''<nowiki/>'''''
15394 !! html/php
15395 <p><i></i>
15396 </p>
15397 !! html/parsoid
15398 <p><i><b></b></i></p>
15399 !! end
15400
15401 !! test
15402 Special:Search page linking.
15403 !! wikitext
15404 {{Special:search}}
15405 !! html
15406 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
15407 </p>
15408 !! end
15409
15410 !! test
15411 Say the magic word
15412 !! options
15413 title=[[Parser test]]
15414 !! wikitext
15415 * {{PAGENAME}}
15416 * {{PAGENAMEE}}
15417 * {{FULLPAGENAME}}
15418 * {{FULLPAGENAMEE}}
15419 * {{BASEPAGENAME}}
15420 * {{BASEPAGENAMEE}}
15421 * {{SUBPAGENAME}}
15422 * {{SUBPAGENAMEE}}
15423 * {{ROOTPAGENAME}}
15424 * {{ROOTPAGENAMEE}}
15425 * {{TALKPAGENAME}}
15426 * {{TALKPAGENAMEE}}
15427 * {{SUBJECTPAGENAME}}
15428 * {{SUBJECTPAGENAMEE}}
15429 * {{NAMESPACEE}}
15430 * {{NAMESPACE}}
15431 * {{NAMESPACENUMBER}}
15432 * {{TALKSPACE}}
15433 * {{TALKSPACEE}}
15434 * {{SUBJECTSPACE}}
15435 * {{SUBJECTSPACEE}}
15436 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
15437 !! html
15438 <ul>
15439 <li> Parser test
15440 </li>
15441 <li> Parser_test
15442 </li>
15443 <li> Parser test
15444 </li>
15445 <li> Parser_test
15446 </li>
15447 <li> Parser test
15448 </li>
15449 <li> Parser_test
15450 </li>
15451 <li> Parser test
15452 </li>
15453 <li> Parser_test
15454 </li>
15455 <li> Parser test
15456 </li>
15457 <li> Parser_test
15458 </li>
15459 <li> Talk:Parser test
15460 </li>
15461 <li> Talk:Parser_test
15462 </li>
15463 <li> Parser test
15464 </li>
15465 <li> Parser_test
15466 </li>
15467 <li>
15468 </li>
15469 <li>
15470 </li>
15471 <li> 0
15472 </li>
15473 <li> Talk
15474 </li>
15475 <li> Talk
15476 </li>
15477 <li>
15478 </li>
15479 <li>
15480 </li>
15481 <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>
15482 </li>
15483 </ul>
15484
15485 !! end
15486 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
15487
15488 !! test
15489 Gallery
15490 !! wikitext
15491 <gallery>
15492 image1.png |
15493 image2.gif|||||
15494
15495 image3|
15496 image4 |300px| centre
15497 image5.svg| http://///////
15498 [[x|xx]]]]
15499 * image6
15500 </gallery>
15501 !! html
15502 <ul class="gallery mw-gallery-traditional">
15503 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15504 <div class="thumb" style="height: 150px;">Image1.png</div>
15505 <div class="gallerytext">
15506 </div>
15507 </div></li>
15508 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15509 <div class="thumb" style="height: 150px;">Image2.gif</div>
15510 <div class="gallerytext">
15511 <p>||||
15512 </p>
15513 </div>
15514 </div></li>
15515 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15516 <div class="thumb" style="height: 150px;">Image3</div>
15517 <div class="gallerytext">
15518 </div>
15519 </div></li>
15520 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15521 <div class="thumb" style="height: 150px;">Image4</div>
15522 <div class="gallerytext">
15523 <p>300px| centre
15524 </p>
15525 </div>
15526 </div></li>
15527 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15528 <div class="thumb" style="height: 150px;">Image5.svg</div>
15529 <div class="gallerytext">
15530 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
15531 </p>
15532 </div>
15533 </div></li>
15534 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15535 <div class="thumb" style="height: 150px;">* image6</div>
15536 <div class="gallerytext">
15537 </div>
15538 </div></li>
15539 </ul>
15540
15541 !! end
15542
15543 !! test
15544 Gallery (with options)
15545 !! wikitext
15546 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
15547 File:Nonexistant.jpg|caption
15548 File:Nonexistant.jpg
15549 image:foobar.jpg|some '''caption''' [[Main Page]]
15550 image:foobar.jpg
15551 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
15552 </gallery>
15553 !! html
15554 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
15555 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
15556 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15557 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15558 <div class="gallerytext">
15559 <p>caption
15560 </p>
15561 </div>
15562 </div></li>
15563 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15564 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15565 <div class="gallerytext">
15566 </div>
15567 </div></li>
15568 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15569 <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>
15570 <div class="gallerytext">
15571 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15572 </p>
15573 </div>
15574 </div></li>
15575 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15576 <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>
15577 <div class="gallerytext">
15578 </div>
15579 </div></li>
15580 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15581 <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>
15582 <div class="gallerytext">
15583 <p>Blabla|blabla.
15584 </p>
15585 </div>
15586 </div></li>
15587 </ul>
15588
15589 !! end
15590
15591 !! test
15592 Gallery with wikitext inside caption
15593 !! wikitext
15594 <gallery>
15595 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
15596 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
15597 </gallery>
15598 !! html
15599 <ul class="gallery mw-gallery-traditional">
15600 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15601 <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>
15602 <div class="gallerytext">
15603 <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>
15604 </p>
15605 </div>
15606 </div></li>
15607 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15608 <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>
15609 <div class="gallerytext">
15610 <p>This is a test template
15611 </p>
15612 </div>
15613 </div></li>
15614 </ul>
15615
15616 !! end
15617
15618 !! test
15619 gallery (with showfilename option)
15620 !! wikitext
15621 <gallery showfilename>
15622 File:Nonexistant.jpg|caption
15623 File:Nonexistant.jpg
15624 image:foobar.jpg|some '''caption''' [[Main Page]]
15625 File:Foobar.jpg
15626 </gallery>
15627 !! html
15628 <ul class="gallery mw-gallery-traditional">
15629 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15630 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15631 <div class="gallerytext">
15632 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15633 caption
15634 </p>
15635 </div>
15636 </div></li>
15637 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15638 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15639 <div class="gallerytext">
15640 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15641 </p>
15642 </div>
15643 </div></li>
15644 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15645 <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>
15646 <div class="gallerytext">
15647 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15648 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15649 </p>
15650 </div>
15651 </div></li>
15652 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15653 <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>
15654 <div class="gallerytext">
15655 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15656 </p>
15657 </div>
15658 </div></li>
15659 </ul>
15660
15661 !! end
15662
15663 !! test
15664 Gallery (with namespace-less filenames)
15665 !! wikitext
15666 <gallery>
15667 File:Nonexistant.jpg
15668 Nonexistant.jpg
15669 image:foobar.jpg
15670 foobar.jpg
15671 </gallery>
15672 !! html
15673 <ul class="gallery mw-gallery-traditional">
15674 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15675 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15676 <div class="gallerytext">
15677 </div>
15678 </div></li>
15679 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15680 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15681 <div class="gallerytext">
15682 </div>
15683 </div></li>
15684 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15685 <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>
15686 <div class="gallerytext">
15687 </div>
15688 </div></li>
15689 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15690 <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>
15691 <div class="gallerytext">
15692 </div>
15693 </div></li>
15694 </ul>
15695
15696 !! end
15697
15698 !! test
15699 HTML Hex character encoding (spells the word "JavaScript")
15700 !! options
15701 parsoid=wt2html,wt2wt,html2html
15702 !! wikitext
15703 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
15704 !! html/php
15705 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
15706 </p>
15707 !! html/parsoid
15708 <p><span typeof="mw:Entity">J</span><span typeof="mw:Entity">a</span><span typeof="mw:Entity">v</span><span typeof="mw:Entity">a</span><span typeof="mw:Entity">S</span><span typeof="mw:Entity">c</span><span typeof="mw:Entity">r</span><span typeof="mw:Entity">i</span><span typeof="mw:Entity">p</span><span typeof="mw:Entity">t</span></p>
15709 !! end
15710
15711 !! test
15712 HTML Hex character encoding bogus encoding (bug 26437 regression check)
15713 !! wikitext
15714 &#xsee;&#XSEE;
15715 !! html/php
15716 <p>&amp;#xsee;&amp;#XSEE;
15717 </p>
15718 !! html/parsoid
15719 <p>&amp;#xsee;&amp;#XSEE;</p>
15720 !! end
15721
15722 !! test
15723 HTML Hex character encoding mixed case
15724 !! options
15725 parsoid=wt2html,wt2wt,html2html
15726 !! wikitext
15727 &#xEE;&#Xee;
15728 !! html/php
15729 <p>&#xee;&#xee;
15730 </p>
15731 !! html/parsoid
15732 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
15733 !! end
15734
15735 !! test
15736 __FORCETOC__ override
15737 !! wikitext
15738 __NEWSECTIONLINK__
15739 __FORCETOC__
15740 !! html
15741 <p><br />
15742 </p>
15743 !! end
15744
15745 !! test
15746 ISBN code coverage
15747 !! wikitext
15748 ISBN 978-0-1234-56&#x20;789
15749 !! html
15750 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
15751 </p>
15752 !! end
15753
15754 !! test
15755 ISBN followed by 5 spaces
15756 !! wikitext
15757 ISBN
15758 !! html
15759 <p>ISBN
15760 </p>
15761 !! end
15762
15763 !! test
15764 Double ISBN
15765 !! wikitext
15766 ISBN ISBN 1234567890
15767 !! html
15768 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15769 </p>
15770 !! end
15771
15772 !! test
15773 ISBN with an X
15774 !! wikitext
15775 ISBN 3-462-04561-X
15776 !! html
15777 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
15778 </p>
15779 !! end
15780
15781 !! test
15782 ISBN with empty prefix (parsoid test)
15783 !! wikitext
15784 ISBN 1234567890
15785 !! html/parsoid
15786 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
15787 !! end
15788
15789 !! test
15790 Bug 22905: <abbr> followed by ISBN followed by </a>
15791 !! wikitext
15792 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
15793 !! html
15794 <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>
15795 </p>
15796 !! end
15797
15798 !! test
15799 Double RFC
15800 !! wikitext
15801 RFC RFC 1234
15802 !! html
15803 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
15804 </p>
15805 !! end
15806
15807 !! test
15808 Double RFC with a wiki link
15809 !! wikitext
15810 RFC [[RFC 1234]]
15811 !! html
15812 <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>
15813 </p>
15814 !! end
15815
15816 !! test
15817 RFC code coverage
15818 !! wikitext
15819 RFC 983&#x20;987
15820 !! html
15821 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
15822 </p>
15823 !! end
15824
15825 !! test
15826 Centre-aligned image
15827 !! wikitext
15828 [[Image:foobar.jpg|centre]]
15829 !! html
15830 <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>
15831
15832 !!end
15833
15834 !! test
15835 None-aligned image
15836 !! wikitext
15837 [[Image:foobar.jpg|none]]
15838 !! html
15839 <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>
15840
15841 !!end
15842
15843 !! test
15844 Width + Height sized image (using px) (height is ignored)
15845 !! wikitext
15846 [[Image:foobar.jpg|640x480px]]
15847 !! html
15848 <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>
15849 </p>
15850 !!end
15851
15852 !! test
15853 Width-sized image (using px, no following whitespace)
15854 !! wikitext
15855 [[Image:foobar.jpg|640px]]
15856 !! html
15857 <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>
15858 </p>
15859 !!end
15860
15861 !! test
15862 Width-sized image (using px, with following whitespace - test regression from r39467)
15863 !! wikitext
15864 [[Image:foobar.jpg|640px ]]
15865 !! html
15866 <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>
15867 </p>
15868 !!end
15869
15870 !! test
15871 Width-sized image (using px, with preceding whitespace - test regression from r39467)
15872 !! wikitext
15873 [[Image:foobar.jpg| 640px]]
15874 !! html
15875 <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>
15876 </p>
15877 !!end
15878
15879 !! test
15880 Image with page parameter
15881 !! options
15882 djvu
15883 !! wikitext
15884 [[File:LoremIpsum.djvu|page=2]]
15885 !! html
15886 <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>
15887 </p>
15888 !! end
15889
15890 !! test
15891 Another italics / bold test
15892 !! wikitext
15893 ''' ''x'
15894 !! html
15895 <pre>'<i> </i>x'
15896 </pre>
15897 !!end
15898
15899 # Note the results may be incorrect, as parserTest output included this:
15900 # XML error: Mismatched tag at byte 6120:
15901 # ...<dd> </dt></dl> </dd...
15902 !! test
15903 dt/dd/dl test
15904 !! options
15905 disabled
15906 !! wikitext
15907 :;;;::
15908 !! html
15909 <dl>
15910 <dd><dl>
15911 <dt><dl>
15912 <dt><dl>
15913 <dt><dl>
15914 <dd><dl>
15915 <dd>
15916 </dd>
15917 </dl>
15918 </dd>
15919 </dl>
15920 </dt>
15921 </dl>
15922 </dt>
15923 </dl>
15924 </dt>
15925 </dl>
15926 </dd>
15927 </dl>
15928
15929 !!end
15930
15931
15932 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
15933 !! test
15934 Images with the "|" character in the comment
15935 !! wikitext
15936 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
15937 !! html/php
15938 <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>
15939
15940 !! html/parsoid
15941 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" href="http://test/?param1=|left|&amp;param2=|x">external</a> URL</figcaption></figure>
15942 !! end
15943
15944 !! test
15945 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
15946 !! wikitext
15947 <html><script>alert(1);</script></html>
15948 !! html
15949 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
15950 </p>
15951 !! end
15952
15953 !! test
15954 HTML with raw HTML ($wgRawHtml==true)
15955 !! options
15956 wgRawHtml=1
15957 !! wikitext
15958 <html><script>alert(1);</script></html>
15959 !! html
15960 <p><script>alert(1);</script>
15961 </p>
15962 !! end
15963
15964 !! test
15965 Parents of subpages, one level up
15966 !! options
15967 subpage title=[[Subpage test/L1/L2/L3]]
15968 !! wikitext
15969 [[../|L2]]
15970 !! html
15971 <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>
15972 </p>
15973 !! end
15974
15975
15976 !! test
15977 Parents of subpages, one level up, not named
15978 !! options
15979 subpage title=[[Subpage test/L1/L2/L3]]
15980 !! wikitext
15981 [[../]]
15982 !! html
15983 <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>
15984 </p>
15985 !! end
15986
15987
15988
15989 !! test
15990 Parents of subpages, two levels up
15991 !! options
15992 subpage title=[[Subpage test/L1/L2/L3]]
15993 !! wikitext
15994 [[../../|L1]]2
15995
15996 [[../../|L1]]l
15997 !! html
15998 <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
15999 </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>
16000 </p>
16001 !! end
16002
16003 !! test
16004 Parents of subpages, two levels up, without trailing slash or name.
16005 !! options
16006 subpage title=[[Subpage test/L1/L2/L3]]
16007 !! wikitext
16008 [[../..]]
16009 !! html
16010 <p>[[../..]]
16011 </p>
16012 !! end
16013
16014 !! test
16015 Parents of subpages, two levels up, with lots of extra trailing slashes.
16016 !! options
16017 subpage title=[[Subpage test/L1/L2/L3]]
16018 !! wikitext
16019 [[../../////]]
16020 !! html
16021 <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>
16022 </p>
16023 !! end
16024
16025 !! article
16026 Subpage test/L1/L2/L3Sibling
16027 !! text
16028 Sibling article
16029 !! endarticle
16030
16031 !! test
16032 Transclusion of a sibling page (one level up)
16033 !! options
16034 subpage title=[[Subpage test/L1/L2/L3]]
16035 !! wikitext
16036 {{../L3Sibling}}
16037 !! html
16038 <p>Sibling article
16039 </p>
16040 !! end
16041
16042 !! test
16043 Transclusion of a child page
16044 !! options
16045 subpage title=[[Subpage test/L1/L2]]
16046 !! wikitext
16047 {{/L3Sibling}}
16048 !! html
16049 <p>Sibling article
16050 </p>
16051 !! end
16052
16053 !! test
16054 Non-transclusion because of too many up levels
16055 !! options
16056 subpage title=[[Subpage test/L1/L2/L3]]
16057 !! wikitext
16058 {{../../../../More than parent}}
16059 !! html
16060 <p>{{../../../../More than parent}}
16061 </p>
16062 !! end
16063
16064 !! test
16065 Definition list code coverage
16066 !! wikitext
16067 ; title : def
16068 ; title : def
16069 ;title: def
16070 !! html
16071 <dl>
16072 <dt> title &#160;</dt>
16073 <dd> def
16074 </dd>
16075 <dt> title&#160;</dt>
16076 <dd> def
16077 </dd>
16078 <dt>title</dt>
16079 <dd> def
16080 </dd>
16081 </dl>
16082
16083 !! end
16084
16085 !! test
16086 Don't fall for the self-closing div
16087 !! wikitext
16088 <div>hello world</div/>
16089 !! html
16090 <div>hello world</div>
16091
16092 !! end
16093
16094 !! test
16095 MSGNW magic word
16096 !! wikitext
16097 {{MSGNW:msg}}
16098 !! html
16099 <p>&#91;&#91;:Template:Msg&#93;&#93;
16100 </p>
16101 !! end
16102
16103 !! test
16104 RAW magic word
16105 !! wikitext
16106 {{RAW:QUERTY}}
16107 !! html
16108 <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>
16109 </p>
16110 !! end
16111
16112 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
16113 !! test
16114 Always escape literal '>' in output, not just after '<'
16115 !! wikitext
16116 ><>
16117 !! html
16118 <p>&gt;&lt;&gt;
16119 </p>
16120 !! end
16121
16122 !! test
16123 Template caching
16124 !! wikitext
16125 {{Test}}
16126 {{Test}}
16127 !! html
16128 <p>This is a test template
16129 This is a test template
16130 </p>
16131 !! end
16132
16133
16134 !! article
16135 MediaWiki:Fake
16136 !! text
16137 ==header==
16138 !! endarticle
16139
16140 !! test
16141 Inclusion of !userCanEdit() content
16142 !! wikitext
16143 {{MediaWiki:Fake}}
16144 !! html
16145 <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>
16146
16147 !! end
16148
16149
16150 !! test
16151 Out-of-order TOC heading levels
16152 !! wikitext
16153 ==2==
16154 ======6======
16155 ===3===
16156 =1=
16157 =====5=====
16158 ==2==
16159 !! html
16160 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16161 <ul>
16162 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
16163 <ul>
16164 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
16165 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
16166 </ul>
16167 </li>
16168 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
16169 <ul>
16170 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
16171 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
16172 </ul>
16173 </li>
16174 </ul>
16175 </div>
16176
16177 <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>
16178 <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>
16179 <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>
16180 <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>
16181 <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>
16182 <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>
16183
16184 !! end
16185
16186
16187 !! test
16188 ISBN with a dummy number
16189 !! wikitext
16190 ISBN ---
16191 !! html
16192 <p>ISBN ---
16193 </p>
16194 !! end
16195
16196
16197 !! test
16198 ISBN with space-delimited number
16199 !! wikitext
16200 ISBN 92 9017 032 8
16201 !! html
16202 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
16203 </p>
16204 !! end
16205
16206
16207 !! test
16208 ISBN with multiple spaces, no number
16209 !! wikitext
16210 ISBN foo
16211 !! html
16212 <p>ISBN foo
16213 </p>
16214 !! end
16215
16216
16217 !! test
16218 ISBN length
16219 !! wikitext
16220 ISBN 123456789
16221
16222 ISBN 1234567890
16223
16224 ISBN 12345678901
16225 !! html
16226 <p>ISBN 123456789
16227 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16228 </p><p>ISBN 12345678901
16229 </p>
16230 !! end
16231
16232
16233 !! test
16234 ISBN with trailing year (bug 8110)
16235 !! wikitext
16236 ISBN 1-234-56789-0 - 2006
16237
16238 ISBN 1 234 56789 0 - 2006
16239 !! html
16240 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
16241 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
16242 </p>
16243 !! end
16244
16245
16246 !! test
16247 anchorencode
16248 !! wikitext
16249 {{anchorencode:foo bar©#%n}}
16250 !! html
16251 <p>foo_bar.C2.A9.23.25n
16252 </p>
16253 !! end
16254
16255 !! test
16256 anchorencode trims spaces
16257 !! wikitext
16258 {{anchorencode: __pretty__please__}}
16259 !! html
16260 <p>pretty_please
16261 </p>
16262 !! end
16263
16264 !! test
16265 anchorencode deals with links
16266 !! wikitext
16267 {{anchorencode: [[hello|world]] [[hi]]}}
16268 !! html
16269 <p>world_hi
16270 </p>
16271 !! end
16272
16273 !! test
16274 anchorencode deals with templates
16275 !! wikitext
16276 {{anchorencode: {{Foo}} }}
16277 !! html
16278 <p>FOO
16279 </p>
16280 !! end
16281
16282 !! test
16283 anchorencode encodes like the TOC generator: (bug 18431)
16284 !! wikitext
16285 === _ +:.3A%3A&&amp;]] ===
16286 {{anchorencode: _ +:.3A%3A&&amp;]] }}
16287 __NOEDITSECTION__
16288 !! html
16289 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
16290 <p>.2B:.3A.253A.26.26.5D.5D
16291 </p>
16292 !! end
16293
16294 !! test
16295 Bug 6200: blockquotes and paragraph formatting
16296 !! wikitext
16297 <blockquote>
16298 foo
16299 </blockquote>
16300
16301 bar
16302
16303 baz
16304 !! html
16305 <blockquote>
16306 <p>foo
16307 </p>
16308 </blockquote>
16309 <p>bar
16310 </p>
16311 <pre>baz
16312 </pre>
16313 !! end
16314
16315 !! test
16316 Bug 8293: Use of center tag ruins paragraph formatting
16317 !! wikitext
16318 <center>
16319 foo
16320 </center>
16321
16322 bar
16323
16324 baz
16325 !! html
16326 <center>
16327 <p>foo
16328 </p>
16329 </center>
16330 <p>bar
16331 </p>
16332 <pre>baz
16333 </pre>
16334 !! end
16335
16336 !!test
16337 Parsing of overlapping (improperly nested) inline html tags
16338 !! wikitext
16339 <span><s>x</span></s>
16340 !! html/php
16341 <p><span><s>x&lt;/span&gt;</s></span>
16342 </p>
16343 !! html/parsoid
16344 <p><span><s>x</s></span>
16345 </p>
16346 !!end
16347
16348 ###
16349 ### Language variants related tests
16350 ###
16351 !! test
16352 Self-link in language variants
16353 !! options
16354 title=[[Dunav]] language=sr
16355 !! wikitext
16356 Both [[Dunav]] and [[Дунав]] are names for this river.
16357 !! html
16358 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
16359 </p>
16360 !!end
16361
16362 !! article
16363 Дуна
16364 !! text
16365 content
16366 !! endarticle
16367
16368 !! test
16369 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
16370 !! options
16371 title=[[Duna]] language=sr
16372 !! wikitext
16373 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
16374 !! html
16375 <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.
16376 </p>
16377 !! end
16378
16379 !! test
16380 Link to a section of a variant of this title shouldn't be parsed as self-link
16381 !! options
16382 title=[[Duna]] language=sr
16383 !! wikitext
16384 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
16385 !! html
16386 <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.
16387 </p>
16388 !! end
16389
16390 !! test
16391 Link to pages in language variants
16392 !! options
16393 language=sr
16394 !! wikitext
16395 Main Page can be written as [[Маин Паге]]
16396 !! html
16397 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
16398 </p>
16399 !!end
16400
16401
16402 !! test
16403 Multiple links to pages in language variants
16404 !! options
16405 language=sr
16406 !! wikitext
16407 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
16408 !! html
16409 <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>.
16410 </p>
16411 !!end
16412
16413
16414 !! test
16415 Simple template in language variants
16416 !! options
16417 language=sr
16418 !! wikitext
16419 {{тест}}
16420 !! html
16421 <p>This is a test template
16422 </p>
16423 !! end
16424
16425
16426 !! test
16427 Template with explicit namespace in language variants
16428 !! options
16429 language=sr
16430 !! wikitext
16431 {{Template:тест}}
16432 !! html
16433 <p>This is a test template
16434 </p>
16435 !! end
16436
16437
16438 !! test
16439 Basic test for template parameter in language variants
16440 !! options
16441 language=sr
16442 !! wikitext
16443 {{парамтест|param=foo}}
16444 !! html
16445 <p>This is a test template with parameter foo
16446 </p>
16447 !! end
16448
16449
16450 !! test
16451 Simple category in language variants
16452 !! options
16453 language=sr cat
16454 !! wikitext
16455 [[Category:МедиаWики Усер'с Гуиде]]
16456 !! html
16457 <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>
16458 !! end
16459
16460
16461 !! article
16462 Category:分类
16463 !! text
16464 blah
16465 !! endarticle
16466
16467 !! article
16468 Category:分類
16469 !! text
16470 blah
16471 !! endarticle
16472
16473 !! test
16474 Don't convert blue categorylinks to another variant (bug 33210)
16475 !! options
16476 language=zh cat
16477 !! wikitext
16478 [[A]][[Category:分类]]
16479 !! html
16480 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
16481 !! end
16482
16483
16484 !! test
16485 Stripping -{}- tags (language variants)
16486 !! options
16487 language=sr
16488 !! wikitext
16489 Latin proverb: -{Ne nuntium necare}-
16490 !! html
16491 <p>Latin proverb: Ne nuntium necare
16492 </p>
16493 !! end
16494
16495
16496 !! test
16497 Prevent conversion with -{}- tags (language variants)
16498 !! options
16499 language=sr variant=sr-ec
16500 !! wikitext
16501 Latinski: -{Ne nuntium necare}-
16502 !! html
16503 <p>Латински: Ne nuntium necare
16504 </p>
16505 !! end
16506
16507
16508 !! test
16509 Prevent conversion of text with -{}- tags (language variants)
16510 !! options
16511 language=sr variant=sr-ec
16512 !! wikitext
16513 Latinski: -{Ne nuntium necare}-
16514 !! html
16515 <p>Латински: Ne nuntium necare
16516 </p>
16517 !! end
16518
16519
16520 !! test
16521 Prevent conversion of links with -{}- tags (language variants)
16522 !! options
16523 language=sr variant=sr-ec
16524 !! wikitext
16525 -{[[Main Page]]}-
16526 !! html
16527 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16528 </p>
16529 !! end
16530
16531
16532 !! test
16533 -{}- tags within headlines (within html for parserConvert())
16534 !! options
16535 language=sr variant=sr-ec
16536 !! wikitext
16537 == -{Naslov}- ==
16538 !! html
16539 <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>
16540
16541 !! end
16542
16543
16544 !! test
16545 Explicit definition of language variant alternatives
16546 !! options
16547 language=zh variant=zh-tw
16548 !! wikitext
16549 -{zh:China;zh-tw:Taiwan}-, not China
16550 !! html
16551 <p>Taiwan, not China
16552 </p>
16553 !! end
16554
16555
16556 !! test
16557 Conversion around HTML tags
16558 !! options
16559 language=sr variant=sr-ec
16560 !! wikitext
16561 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
16562 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
16563 !! html
16564 <p>
16565 <span title="ЛаCтин">ски</span>
16566 </p>
16567 !! end
16568
16569
16570 !! test
16571 Explicit session-wise language variant mapping (A flag and - flag)
16572 !! options
16573 language=zh variant=zh-tw
16574 !! wikitext
16575 Taiwan is not China.
16576 But -{A|zh:China;zh-tw:Taiwan}- is China,
16577 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
16578 and -{China}- is China.
16579 !! html
16580 <p>Taiwan is not China.
16581 But Taiwan is Taiwan,
16582 (This should be stripped!)
16583 and China is China.
16584 </p>
16585 !! end
16586
16587 !! test
16588 Explicit session-wise language variant mapping (H flag for hide)
16589 !! options
16590 language=zh variant=zh-tw
16591 !! wikitext
16592 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
16593 Taiwan is China.
16594 !! html
16595 <p>(This should be stripped!)
16596 Taiwan is Taiwan.
16597 </p>
16598 !! end
16599
16600 !! test
16601 Adding explicit conversion rule for title (T flag)
16602 !! options
16603 language=zh variant=zh-tw showtitle
16604 !! wikitext
16605 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16606 !! html
16607 Taiwan
16608 <p>Should be stripped!
16609 </p>
16610 !! end
16611
16612 !! test
16613 Testing that changing the language variant here in the tests actually works
16614 !! options
16615 language=zh variant=zh showtitle
16616 !! wikitext
16617 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16618 !! html
16619 China
16620 <p>Should be stripped!
16621 </p>
16622 !! end
16623
16624 !! test
16625 Recursive conversion of alt and title attrs shouldn't clear converter state
16626 !! options
16627 language=zh variant=zh-cn showtitle
16628 !! wikitext
16629 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
16630 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
16631 !! html
16632 China
16633 <p>
16634 Should be stripped<span title="Exclamation">!</span>
16635 </p>
16636 !! end
16637
16638 !! test
16639 Bug 24072: more test on conversion rule for title
16640 !! options
16641 language=zh variant=zh-tw showtitle
16642 !! wikitext
16643 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16644 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
16645 !! html
16646 Taiwan
16647 <p>This should be stripped!
16648 This won't take interferes with the title rule.
16649 </p>
16650 !! end
16651
16652 !! test
16653 Partly disable title conversion if variant == main language code
16654 !! options
16655 language=zh variant=zh title=[[ZH]] showtitle
16656 !! wikitext
16657 -{T|zh-cn:CN;zh-tw:TW}-
16658 !! html
16659 ZH
16660 <p>
16661 </p>
16662 !! end
16663
16664 !! test
16665 Partly disable title conversion if variant == main language code, more
16666 !! options
16667 language=zh variant=zh title=[[ZH]] showtitle
16668 !! wikitext
16669 -{T|TW}-
16670 !! html
16671 ZH
16672 <p>
16673 </p>
16674 !! end
16675
16676 !! test
16677 Raw output of variant escape tags (R flag)
16678 !! options
16679 language=zh variant=zh-tw
16680 !! wikitext
16681 Raw: -{R|zh:China;zh-tw:Taiwan}-
16682 !! html
16683 <p>Raw: zh:China;zh-tw:Taiwan
16684 </p>
16685 !! end
16686
16687 !! test
16688 Nested using of manual convert syntax
16689 !! options
16690 language=zh variant=zh-hk
16691 !! wikitext
16692 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
16693 !! html
16694 <p>Nested: Hello Hong Kong!
16695 </p>
16696 !! end
16697
16698 !! test
16699 Proper conversion of text in external links
16700 !! options
16701 language=sr variant=sr-ec
16702 !! wikitext
16703 http://www.google.com
16704 gopher://www.google.com
16705 [http://www.google.com http://www.google.com]
16706 [gopher://www.google.com gopher://www.google.com]
16707 [https://www.google.com irc://www.google.com]
16708 [ftp://www.google.com www.google.com/ftp://dir]
16709 [//www.google.com www.google.com]
16710 !! html
16711 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16712 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16713 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16714 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16715 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
16716 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
16717 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
16718 </p>
16719 !! end
16720
16721 !! test
16722 Do not convert roman numbers to language variants
16723 !! options
16724 language=sr variant=sr-ec
16725 !! wikitext
16726 Fridrih IV je car.
16727 !! html
16728 <p>Фридрих IV је цар.
16729 </p>
16730 !! end
16731
16732 !! test
16733 Unclosed language converter markup "-{"
16734 !! options
16735 language=sr
16736 !! wikitext
16737 -{T|hello
16738 !! html
16739 <p>-{T|hello
16740 </p>
16741 !! end
16742
16743 !! test
16744 Don't convert raw rule "-{R|=&gt;}-" to "=>"
16745 !! options
16746 language=sr
16747 !! wikitext
16748 -{R|=&gt;}-
16749 !! html
16750 <p>=&gt;
16751 </p>
16752 !!end
16753
16754 !! test
16755 Don't break link parsing if language converter markup is in the caption.
16756 !! options
16757 language=sr variant=sr-ec
16758 !! wikitext
16759 [[Main Page|-{R|main page}-]]
16760 !! html
16761 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
16762 </p>
16763 !! end
16764
16765 # This test is currently broken in the PHP parser (bug 52661)
16766 !! test
16767 Don't break image parsing if language converter markup is in the caption.
16768 !! options
16769 language=sr
16770 disabled
16771 !! wikitext
16772 [[File:Foobar.jpg|-{R|caption}-]]
16773 !! html
16774 <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>
16775 </p>
16776 !! end
16777
16778 # This test is currently broken in the PHP parser (bug 52661)
16779 !! test
16780 Don't break list handling if language converter markup is in the item.
16781 !! options
16782 language=zh variant=zh-cn
16783 disabled
16784 !! wikitext
16785 ;-{zh-cn:AAA;zh-tw:BBB}-
16786 !! html
16787 <dl><dt>AAA
16788 </dt></dl>
16789
16790 !! end
16791
16792 # This test is currently broken in the PHP parser (bug 52661)
16793 !! test
16794 Don't break table handling if language converter markup is in the cell.
16795 !! options
16796 language=sr variant=sr-ec
16797 disabled
16798 !! wikitext
16799 {|
16800 |-
16801 | -{R|B}-
16802 |}
16803 !! html
16804 <table>
16805
16806 <tr>
16807 <td> B
16808 </td></tr></table>
16809
16810 !! end
16811
16812 !! test
16813 Bug 529: Uncovered bullet
16814 !! wikitext
16815 * Foo {{bullet}}
16816 !! html
16817 <ul>
16818 <li> Foo
16819 </li>
16820 <li> Bar
16821 </li>
16822 </ul>
16823
16824 !! end
16825
16826 # Plain MediaWiki does not remove empty lists, but tidy actually does.
16827 # Templates in Wikipedia rely on this behavior, as tidy has always been
16828 # enabled there. These tests are normally run *without* tidy, so specify the
16829 # full output here.
16830 # To test realistic parsing behavior, apply a tidy-like transformation to both
16831 # the expected output and your parser's output.
16832 !! test
16833 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
16834 !! wikitext
16835 ******* Foo {{bullet}}
16836 !! html
16837 <ul>
16838 <li><ul>
16839 <li><ul>
16840 <li><ul>
16841 <li><ul>
16842 <li><ul>
16843 <li><ul>
16844 <li> Foo
16845 </li>
16846 </ul>
16847 </li>
16848 </ul>
16849 </li>
16850 </ul>
16851 </li>
16852 </ul>
16853 </li>
16854 </ul>
16855 </li>
16856 </ul>
16857 </li>
16858 <li> Bar
16859 </li>
16860 </ul>
16861
16862 !! end
16863
16864 !! test
16865 Bug 529: Uncovered table already at line-start
16866 !! wikitext
16867 x
16868
16869 {{table}}
16870 y
16871 !! html
16872 <p>x
16873 </p>
16874 <table>
16875 <tr>
16876 <td> 1 </td>
16877 <td> 2
16878 </td></tr>
16879 <tr>
16880 <td> 3 </td>
16881 <td> 4
16882 </td></tr></table>
16883 <p>y
16884 </p>
16885 !! end
16886
16887 !! test
16888 Bug 529: Uncovered bullet in parser function result
16889 !! wikitext
16890 * Foo {{lc:{{bullet}} }}
16891 !! html
16892 <ul>
16893 <li> Foo
16894 </li>
16895 <li> bar
16896 </li>
16897 </ul>
16898
16899 !! end
16900
16901 !! test
16902 Bug 5678: Double-parsed template argument
16903 !! wikitext
16904 {{lc:{{{1}}}|hello}}
16905 !! html
16906 <p>{{{1}}}
16907 </p>
16908 !! end
16909
16910 !! test
16911 Bug 5678: Double-parsed template invocation
16912 !! wikitext
16913 {{lc:{{paramtest {{!}} param = hello }} }}
16914 !! html
16915 <p>{{paramtest | param = hello }}
16916 </p>
16917 !! end
16918
16919 !! test
16920 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
16921 !! options
16922 language=cs
16923 title=[[Main Page]]
16924 !! wikitext
16925 {{PRVNÍVELKÉ:ěščř}}
16926 {{prvnívelké:ěščř}}
16927 {{PRVNÍMALÉ:ěščř}}
16928 {{prvnímalé:ěščř}}
16929 {{MALÁ:ěščř}}
16930 {{malá:ěščř}}
16931 {{VELKÁ:ěščř}}
16932 {{velká:ěščř}}
16933 !! html
16934 <p>Ěščř
16935 Ěščř
16936 ěščř
16937 ěščř
16938 ěščř
16939 ěščř
16940 ĚŠČŘ
16941 ĚŠČŘ
16942 </p>
16943 !! end
16944
16945 !! test
16946 Morwen/13: Unclosed link followed by heading
16947 !! wikitext
16948 [[link
16949 ==heading==
16950 !! html
16951 <p>[[link
16952 </p>
16953 <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>
16954
16955 !! end
16956
16957 !! test
16958 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
16959 !! wikitext
16960 {{foo|
16961 =heading=
16962 !! html
16963 <p>{{foo|
16964 </p>
16965 <h1><span class="mw-headline" id="heading">heading</span></h1>
16966
16967 !! end
16968
16969 !! test
16970 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
16971 !! wikitext
16972 {{foo|
16973 ==heading==
16974 !! html
16975 <p>{{foo|
16976 </p>
16977 <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>
16978
16979 !! end
16980
16981 !! test
16982 Tildes in comments
16983 !! options
16984 pst
16985 !! wikitext
16986 <!-- ~~~~ -->
16987 !! html
16988 <!-- ~~~~ -->
16989 !! end
16990
16991 !! test
16992 Paragraphs inside divs (no extra line breaks)
16993 !! wikitext
16994 <div>Line one
16995
16996 Line two</div>
16997 !! html
16998 <div>Line one
16999 Line two</div>
17000
17001 !! end
17002
17003 !! test
17004 Paragraphs inside divs (extra line break on open)
17005 !! wikitext
17006 <div>
17007 Line one
17008
17009 Line two</div>
17010 !! html
17011 <div>
17012 <p>Line one
17013 </p>
17014 Line two</div>
17015
17016 !! end
17017
17018 !! test
17019 Paragraphs inside divs (extra line break on close)
17020 !! wikitext
17021 <div>Line one
17022
17023 Line two
17024 </div>
17025 !! html
17026 <div>Line one
17027 <p>Line two
17028 </p>
17029 </div>
17030
17031 !! end
17032
17033 !! test
17034 Paragraphs inside divs (extra line break on open and close)
17035 !! wikitext
17036 <div>
17037 Line one
17038
17039 Line two
17040 </div>
17041 !! html
17042 <div>
17043 <p>Line one
17044 </p><p>Line two
17045 </p>
17046 </div>
17047
17048 !! end
17049
17050 !! test
17051 Nesting tags, paragraphs on lines which begin with <div>
17052 !! options
17053 disabled
17054 !! wikitext
17055 <div></div><strong>A
17056 B</strong>
17057 !! html
17058 <div></div>
17059 <p><strong>A
17060 B</strong>
17061 </p>
17062 !! end
17063
17064 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
17065 !! test
17066 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
17067 !! wikitext
17068 <blockquote>Line one
17069
17070 Line two</blockquote>
17071 !! html
17072 <blockquote>Line one
17073 Line two</blockquote>
17074
17075 !! end
17076
17077 !! test
17078 Bug 6200: paragraphs inside blockquotes (extra line break on open)
17079 !! wikitext
17080 <blockquote>
17081 Line one
17082
17083 Line two</blockquote>
17084 !! html
17085 <blockquote>
17086 <p>Line one
17087 </p>
17088 Line two</blockquote>
17089
17090 !! end
17091
17092 !! test
17093 Bug 6200: paragraphs inside blockquotes (extra line break on close)
17094 !! wikitext
17095 <blockquote>Line one
17096
17097 Line two
17098 </blockquote>
17099 !! html
17100 <blockquote>Line one
17101 <p>Line two
17102 </p>
17103 </blockquote>
17104
17105 !! end
17106
17107 !! test
17108 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
17109 !! wikitext
17110 <blockquote>
17111 Line one
17112
17113 Line two
17114 </blockquote>
17115 !! html
17116 <blockquote>
17117 <p>Line one
17118 </p><p>Line two
17119 </p>
17120 </blockquote>
17121
17122 !! end
17123
17124 !! test
17125 Paragraphs inside blockquotes/divs (no extra line breaks)
17126 !! wikitext
17127 <blockquote><div>Line one
17128
17129 Line two</div></blockquote>
17130 !! html
17131 <blockquote><div>Line one
17132 Line two</div></blockquote>
17133
17134 !! end
17135
17136 !! test
17137 Paragraphs inside blockquotes/divs (extra line break on open)
17138 !! wikitext
17139 <blockquote><div>
17140 Line one
17141
17142 Line two</div></blockquote>
17143 !! html
17144 <blockquote><div>
17145 <p>Line one
17146 </p>
17147 Line two</div></blockquote>
17148
17149 !! end
17150
17151 !! test
17152 Paragraphs inside blockquotes/divs (extra line break on close)
17153 !! wikitext
17154 <blockquote><div>Line one
17155
17156 Line two
17157 </div></blockquote>
17158 !! html
17159 <blockquote><div>Line one
17160 <p>Line two
17161 </p>
17162 </div></blockquote>
17163
17164 !! end
17165
17166 !! test
17167 Paragraphs inside blockquotes/divs (extra line break on open and close)
17168 !! wikitext
17169 <blockquote><div>
17170 Line one
17171
17172 Line two
17173 </div></blockquote>
17174 !! html
17175 <blockquote><div>
17176 <p>Line one
17177 </p><p>Line two
17178 </p>
17179 </div></blockquote>
17180
17181 !! end
17182
17183 !! test
17184 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
17185 !! options
17186 wgLinkHolderBatchSize=0
17187 !! wikitext
17188 [[meatball:1]]
17189 [[meatball:2]]
17190 [[meatball:3]]
17191 !! html
17192 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
17193 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
17194 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
17195 </p>
17196 !! end
17197
17198 !! test
17199 Free external link invading image caption
17200 !! wikitext
17201 [[Image:Foobar.jpg|thumb|http://x|hello]]
17202 !! html
17203 <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>
17204
17205 !! end
17206
17207 !! test
17208 Bug 15196: localised external link numbers
17209 !! options
17210 language=fa
17211 !! wikitext
17212 [http://en.wikipedia.org/]
17213 !! html/php
17214 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
17215 </p>
17216 !! html/parsoid
17217 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
17218 !! end
17219
17220 !! test
17221 Multibyte character in padleft
17222 !! wikitext
17223 {{padleft:-Hello|7|Æ}}
17224 !! html
17225 <p>Æ-Hello
17226 </p>
17227 !! end
17228
17229 !! test
17230 Multibyte character in padright
17231 !! wikitext
17232 {{padright:Hello-|7|Æ}}
17233 !! html
17234 <p>Hello-Æ
17235 </p>
17236 !! end
17237
17238 !!test
17239 formatdate parser function
17240 !! wikitext
17241 {{#formatdate:2009-03-24}}
17242 !! html
17243 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
17244 </p>
17245 !! end
17246
17247 !!test
17248 formatdate parser function, with default format
17249 !! wikitext
17250 {{#formatdate:2009-03-24|mdy}}
17251 !! html
17252 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
17253 </p>
17254 !! end
17255
17256 !! test
17257 Spacing of numbers in formatted dates
17258 !! wikitext
17259 {{#formatdate:January 15}}
17260 !! html
17261 <p><span class="mw-formatted-date" title="01-15">January 15</span>
17262 </p>
17263 !! end
17264
17265 !! test
17266 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
17267 !! options
17268 language=nl title=[[MediaWiki:Common.css]]
17269 !! wikitext
17270 {{#formatdate:2009-03-24|dmy}}
17271 !! html
17272 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
17273 </p>
17274 !! end
17275
17276 #
17277 #
17278 #
17279
17280 #
17281 # Edit comments
17282 #
17283
17284 !! test
17285 Edit comment with link
17286 !! options
17287 comment
17288 !! wikitext
17289 I like the [[Main Page]] a lot
17290 !! html
17291 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
17292 !!end
17293
17294 !! test
17295 Edit comment with link and link text
17296 !! options
17297 comment
17298 !! wikitext
17299 I like the [[Main Page|best pages]] a lot
17300 !! html
17301 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17302 !!end
17303
17304 !! test
17305 Edit comment with link and link text with suffix
17306 !! options
17307 comment
17308 !! wikitext
17309 I like the [[Main Page|best page]]s a lot
17310 !! html
17311 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17312 !!end
17313
17314 !! test
17315 Edit comment with section link (non-local, eg in history list)
17316 !! options
17317 comment title=[[Main Page]]
17318 !! wikitext
17319 /* External links */ removed bogus entries
17320 !! html
17321 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17322 !!end
17323
17324 !! test
17325 Edit comment with section link and text before it (non-local, eg in history list)
17326 !! options
17327 comment title=[[Main Page]]
17328 !! wikitext
17329 pre-comment text /* External links */ removed bogus entries
17330 !! html
17331 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>
17332 !!end
17333
17334 !! test
17335 Edit comment with section link (local, eg in diff view)
17336 !! options
17337 comment local title=[[Main Page]]
17338 !! wikitext
17339 /* External links */ removed bogus entries
17340 !! html
17341 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17342 !!end
17343
17344 !! test
17345 Edit comment with subpage link (bug 14080)
17346 !! options
17347 comment
17348 subpage
17349 title=[[Subpage test]]
17350 !! wikitext
17351 Poked at a [[/subpage]] here...
17352 !! html
17353 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
17354 !!end
17355
17356 !! test
17357 Edit comment with subpage link and link text (bug 14080)
17358 !! options
17359 comment
17360 subpage
17361 title=[[Subpage test]]
17362 !! wikitext
17363 Poked at a [[/subpage|neat little page]] here...
17364 !! html
17365 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
17366 !!end
17367
17368 !! test
17369 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
17370 !! options
17371 comment
17372 title=[[Subpage test]]
17373 !! wikitext
17374 Poked at a [[/subpage]] here...
17375 !! html
17376 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...
17377 !!end
17378
17379 !! test
17380 Edit comment with bare anchor link (local, as on diff)
17381 !! options
17382 comment
17383 local
17384 title=[[Main Page]]
17385 !! wikitext
17386 [[#section]]
17387 !! html
17388 <a href="#section">#section</a>
17389 !! end
17390
17391 !! test
17392 Edit comment with bare anchor link (non-local, as on history)
17393 !! options
17394 comment
17395 title=[[Main Page]]
17396 !! wikitext
17397 [[#section]]
17398 !! html
17399 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
17400 !! end
17401
17402 !! test
17403 Anchor starting with underscore
17404 !! wikitext
17405 [[#_ref|One]]
17406 !! html
17407 <p><a href="#_ref">One</a>
17408 </p>
17409 !! end
17410
17411 !! test
17412 Id starting with underscore
17413 !! wikitext
17414 <div id="_ref"></div>
17415 !! html
17416 <div id="_ref"></div>
17417
17418 !! end
17419
17420 !! test
17421 Space normalisation on autocomment (bug 22784)
17422 !! options
17423 comment
17424 title=[[Main Page]]
17425 !! wikitext
17426 /* __hello__world__ */
17427 !! html
17428 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
17429 !! end
17430
17431 !! test
17432 percent-encoding and + signs in comments (Bug 26410)
17433 !! options
17434 comment
17435 !! wikitext
17436 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
17437 !! html
17438 <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>
17439 !! end
17440
17441 !! test
17442 Bad images - basic functionality
17443 !! options
17444 disabled
17445 !! wikitext
17446 [[File:Bad.jpg]]
17447 !! html
17448 !! end
17449
17450 !! test
17451 Bad images - bug 16039: text after bad image disappears
17452 !! options
17453 disabled
17454 !! wikitext
17455 Foo bar
17456 [[File:Bad.jpg]]
17457 Bar foo
17458 !! html
17459 <p>Foo bar
17460 </p><p>Bar foo
17461 </p>
17462 !! end
17463
17464 !! test
17465 Verify that displaytitle works (bug #22501) no displaytitle
17466 !! options
17467 showtitle
17468 !! config
17469 wgAllowDisplayTitle=true
17470 wgRestrictDisplayTitle=false
17471 !! wikitext
17472 this is not the the title
17473 !! html
17474 Parser test
17475 <p>this is not the the title
17476 </p>
17477 !! end
17478
17479 !! test
17480 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
17481 !! options
17482 showtitle
17483 title=[[Screen]]
17484 !! config
17485 wgAllowDisplayTitle=true
17486 wgRestrictDisplayTitle=false
17487 !! wikitext
17488 this is not the the title
17489 {{DISPLAYTITLE:whatever}}
17490 !! html
17491 whatever
17492 <p>this is not the the title
17493 </p>
17494 !! end
17495
17496 !! test
17497 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
17498 !! options
17499 showtitle
17500 title=[[Screen]]
17501 !! config
17502 wgAllowDisplayTitle=true
17503 wgRestrictDisplayTitle=true
17504 !! wikitext
17505 this is not the the title
17506 {{DISPLAYTITLE:whatever}}
17507 !! html
17508 Screen
17509 <p>this is not the the title
17510 </p>
17511 !! end
17512
17513 !! test
17514 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
17515 !! options
17516 showtitle
17517 title=[[Screen]]
17518 !! config
17519 wgAllowDisplayTitle=true
17520 wgRestrictDisplayTitle=true
17521 !! wikitext
17522 this is not the the title
17523 {{DISPLAYTITLE:screen}}
17524 !! html
17525 screen
17526 <p>this is not the the title
17527 </p>
17528 !! end
17529
17530 !! test
17531 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
17532 !! options
17533 showtitle
17534 title=[[Screen]]
17535 !! config
17536 wgAllowDisplayTitle=false
17537 !! wikitext
17538 this is not the the title
17539 {{DISPLAYTITLE:screen}}
17540 !! html
17541 Screen
17542 <p>this is not the the title
17543 <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>
17544 </p>
17545 !! end
17546
17547 !! test
17548 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
17549 !! options
17550 showtitle
17551 title=[[Screen]]
17552 !! config
17553 wgAllowDisplayTitle=false
17554 !! wikitext
17555 this is not the the title
17556 !! html
17557 Screen
17558 <p>this is not the the title
17559 </p>
17560 !! end
17561
17562 !! test
17563 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
17564 !! options
17565 showtitle
17566 title=[[Screen]]
17567 !! config
17568 wgAllowDisplayTitle=true
17569 wgRestrictDisplayTitle=true
17570 !! wikitext
17571 this is not the the title
17572 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
17573 !! html
17574 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
17575 <p>this is not the the title
17576 </p>
17577 !! end
17578
17579 !! test
17580 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
17581 !! options
17582 showtitle
17583 title=[[Screen]]
17584 !! config
17585 wgAllowDisplayTitle=true
17586 wgRestrictDisplayTitle=true
17587 !! wikitext
17588 this is not the the title
17589 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
17590 !! html
17591 <span style="color: red;">s</span>creen
17592 <p>this is not the the title
17593 </p>
17594 !! end
17595
17596 !! test
17597 preload: check <noinclude> and <includeonly>
17598 !! options
17599 preload
17600 !! wikitext
17601 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
17602 !! html
17603 Hello kind world.
17604 !! end
17605
17606 !! test
17607 preload: check <onlyinclude>
17608 !! options
17609 preload
17610 !! wikitext
17611 Goodbye <onlyinclude>Hello world</onlyinclude>
17612 !! html
17613 Hello world
17614 !! end
17615
17616 !! test
17617 preload: can pass tags through if we want to
17618 !! options
17619 preload
17620 !! wikitext
17621 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
17622 !! html
17623 <includeonly>Hello world</includeonly>
17624 !! end
17625
17626 !! test
17627 preload: check that it doesn't try to do tricks
17628 !! options
17629 preload
17630 !! wikitext
17631 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17632 !! html
17633 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17634 !! end
17635
17636 !! test
17637 Play a bit with r67090 and bug 3158
17638 !! options
17639 disabled
17640 !! wikitext
17641 <div style="width:50% !important">&nbsp;</div>
17642 <div style="width:50%&nbsp;!important">&nbsp;</div>
17643 <div style="width:50%&#160;!important">&nbsp;</div>
17644 <div style="border : solid;">&nbsp;</div>
17645 !! html
17646 <div style="width:50% !important">&nbsp;</div>
17647 <div style="width:50% !important">&nbsp;</div>
17648 <div style="width:50% !important">&nbsp;</div>
17649 <div style="border&#160;: solid;">&nbsp;</div>
17650
17651 !! end
17652
17653 !! test
17654 HTML5 data attributes
17655 !! wikitext
17656 <span data-foo="bar">Baz</span>
17657 <p data-abc-def_hij="">Quuz</p>
17658 !! html
17659 <p><span data-foo="bar">Baz</span>
17660 </p>
17661 <p data-abc-def_hij="">Quuz</p>
17662
17663 !! end
17664
17665 !! test
17666 percent-encoding and + signs in internal links (Bug 26410)
17667 !! wikitext
17668 [[User:+%]] [[Page+title%]]
17669 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
17670 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
17671 [[%33%45]] [[%33%45+]]
17672 !! html
17673 <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>
17674 <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>
17675 <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>
17676 <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>
17677 </p>
17678 !! end
17679
17680 !! test
17681 Special characters in embedded file links (bug 27679)
17682 !! wikitext
17683 [[File:Contains & ampersand.jpg]]
17684 [[File:Does not exist.jpg|Title with & ampersand]]
17685 !! html
17686 <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>
17687 <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>
17688 </p>
17689 !! end
17690
17691
17692 !! test
17693 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
17694 !! wikitext
17695 Text&apos;s been normalized?
17696 !! html
17697 <p>Text&#39;s been normalized?
17698 </p>
17699 !! end
17700
17701 !! test
17702 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
17703 !! wikitext
17704 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
17705 !! html
17706 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
17707 </p>
17708 !! end
17709
17710 !! test
17711 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
17712 !! wikitext
17713 [http://www.example.org/ ideograms]
17714 !! html
17715 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
17716 </p>
17717 !! end
17718
17719 !! test
17720 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
17721 !! wikitext
17722 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
17723 !! html
17724 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
17725 </p>
17726 !! end
17727
17728 !! article
17729 Mediawiki:loop1
17730 !! text
17731 {{Identical|A}}
17732 !! endarticle
17733
17734 !! article
17735 Mediawiki:loop2
17736 !! text
17737 {{Identical|B}}
17738 !! endarticle
17739
17740 !! article
17741 Template:Identical
17742 !! text
17743 {{int:loop1}}
17744 {{int:loop2}}
17745 !! endarticle
17746
17747 !! test
17748 Bug 31098 Template which includes system messages which includes the template
17749 !! wikitext
17750 {{Identical}}
17751 !! html
17752 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17753 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17754 </p>
17755 !! end
17756
17757 !! test
17758 Bug31490 Turkish: ucfirst 'blah'
17759 !! options
17760 language=tr
17761 !! wikitext
17762 {{ucfirst:blah}}
17763 !! html
17764 <p>Blah
17765 </p>
17766 !! end
17767
17768 !! test
17769 Bug31490 Turkish: ucfirst 'ix'
17770 !! options
17771 language=tr
17772 !! wikitext
17773 {{ucfirst:ix}}
17774 !! html
17775 <p>İx
17776 </p>
17777 !! end
17778
17779 !! test
17780 Bug31490 Turkish: lcfirst 'BLAH'
17781 !! options
17782 language=tr
17783 !! wikitext
17784 {{lcfirst:BLAH}}
17785 !! html
17786 <p>bLAH
17787 </p>
17788 !! end
17789
17790 !! test
17791 Bug31490 Turkish: ucfırst (with a dotless i)
17792 !! options
17793 language=tr
17794 !! wikitext
17795 {{ucfırst:blah}}
17796 !! html
17797 <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>
17798 </p>
17799 !! end
17800
17801 !! test
17802 Bug31490 ucfırst (with a dotless i) with English language
17803 !! options
17804 language=en
17805 !! wikitext
17806 {{ucfırst:blah}}
17807 !! html
17808 <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>
17809 </p>
17810 !! end
17811
17812 !! test
17813 Bug 26375: TOC with italics
17814 !! options
17815 title=[[Main Page]]
17816 !! wikitext
17817 __TOC__
17818 == ''Lost'' episodes ==
17819 !! html
17820 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17821 <ul>
17822 <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>
17823 </ul>
17824 </div>
17825
17826 <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>
17827
17828 !! end
17829
17830 !! test
17831 Bug 26375: TOC with bold
17832 !! options
17833 title=[[Main Page]]
17834 !! wikitext
17835 __TOC__
17836 == '''should be bold''' then normal text ==
17837 !! html
17838 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17839 <ul>
17840 <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>
17841 </ul>
17842 </div>
17843
17844 <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>
17845
17846 !! end
17847
17848 !! test
17849 Bug 33845: Headings become cursive in TOC when they contain an image
17850 !! options
17851 title=[[Main Page]]
17852 !! wikitext
17853 __TOC__
17854 == Image [[Image:foobar.jpg]] ==
17855 !! html
17856 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17857 <ul>
17858 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
17859 </ul>
17860 </div>
17861
17862 <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>
17863
17864 !! end
17865
17866 !! test
17867 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
17868 !! options
17869 title=[[Main Page]]
17870 !! wikitext
17871 __TOC__
17872 == <blockquote>Quote</blockquote> ==
17873 !! html
17874 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17875 <ul>
17876 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
17877 </ul>
17878 </div>
17879
17880 <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>
17881
17882 !! end
17883
17884 !! test
17885 Unclosed tags in TOC
17886 !! options
17887 title=[[Main Page]]
17888 !! wikitext
17889 __TOC__
17890 == Proof: 2 < 3 ==
17891 <small>Hanc marginis exiguitas non caperet.</small>
17892 QED
17893 !! html
17894 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17895 <ul>
17896 <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>
17897 </ul>
17898 </div>
17899
17900 <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>
17901 <p><small>Hanc marginis exiguitas non caperet.</small>
17902 QED
17903 </p>
17904 !! end
17905
17906 !! test
17907 Multiple tags in TOC
17908 !! wikitext
17909 __TOC__
17910 == <i>Foo</i> <b>Bar</b> ==
17911
17912 == <i>Foo</i> <blockquote>Bar</blockquote> ==
17913 !! html
17914 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17915 <ul>
17916 <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>
17917 <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>
17918 </ul>
17919 </div>
17920
17921 <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>
17922 <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>
17923
17924 !! end
17925
17926 !! test
17927 Tags with parameters in TOC
17928 !! wikitext
17929 __TOC__
17930 == <sup class="in-h2">Hello</sup> ==
17931
17932 == <sup class="a > b">Evilbye</sup> ==
17933 !! html
17934 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17935 <ul>
17936 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
17937 <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>
17938 </ul>
17939 </div>
17940
17941 <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>
17942 <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>
17943
17944 !! end
17945
17946 !! test
17947 span tags with directionality in TOC
17948 !! wikitext
17949 __TOC__
17950 == <span dir="ltr">C++</span> ==
17951
17952 == <span dir="rtl">זבנג!</span> ==
17953
17954 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
17955
17956 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
17957
17958 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
17959 !! html
17960 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17961 <ul>
17962 <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>
17963 <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>
17964 <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>
17965 <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>
17966 <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>
17967 </ul>
17968 </div>
17969
17970 <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>
17971 <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>
17972 <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>
17973 <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>
17974 <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>
17975
17976 !! end
17977
17978 !! article
17979 MediaWiki:Bug32057
17980 !! text
17981 == {{int:headline_sample}} ==
17982 !! endarticle
17983
17984 !! test
17985 Bug 32057: Title needed when expanding <h> nodes.
17986 !! options
17987 title=[[Main Page]]
17988 !! wikitext
17989 {{int:Bug32057}}
17990 !! html
17991 <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>
17992
17993 !! end
17994
17995 !! test
17996 Strip marker in urlencode
17997 !! wikitext
17998 {{urlencode:x<nowiki/>y}}
17999 {{urlencode:x<nowiki/>y|wiki}}
18000 {{urlencode:x<nowiki/>y|path}}
18001 !! html
18002 <p>xy
18003 xy
18004 xy
18005 </p>
18006 !! end
18007
18008 !! test
18009 Strip marker in lc
18010 !! wikitext
18011 {{lc:x<nowiki/>y}}
18012 !! html
18013 <p>xy
18014 </p>
18015 !! end
18016
18017 !! test
18018 Strip marker in uc
18019 !! wikitext
18020 {{uc:x<nowiki/>y}}
18021 !! html
18022 <p>XY
18023 </p>
18024 !! end
18025
18026 !! test
18027 Strip marker in formatNum
18028 !! wikitext
18029 {{formatnum:1<nowiki/>2}}
18030 {{formatnum:1<nowiki/>2|R}}
18031 !! html
18032 <p>12
18033 12
18034 </p>
18035 !! end
18036
18037 !! test
18038 Check noCommafy in formatNum
18039 !! options
18040 language=be-tarask
18041 !! wikitext
18042 {{formatnum:123456.78}}
18043 {{formatnum:123456.78|NOSEP}}
18044 !! html
18045 <p>123 456,78
18046 123456.78
18047 </p>
18048 !! end
18049
18050 !! test
18051 Wrong option for formatNum (bug 56199)
18052 !! wikitext
18053 {{formatnum:1,234.56|Random}}
18054 {{formatnum:1,234.56|EVERYTHING}}
18055 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
18056 !! html
18057 <p>1,234.56
18058 1,234.56
18059 1,234.56
18060 </p>
18061 !! end
18062
18063 !! test
18064 Strip marker in grammar
18065 !! options
18066 language=fi
18067 !! wikitext
18068 {{grammar:elative|foo<nowiki/>bar}}
18069 !! html
18070 <p>foobarista
18071 </p>
18072 !! end
18073
18074 !! test
18075 Strip marker in padleft
18076 !! wikitext
18077 {{padleft:|2|x<nowiki/>y}}
18078 !! html
18079 <p>xy
18080 </p>
18081 !! end
18082
18083 !! test
18084 Strip marker in padright
18085 !! wikitext
18086 {{padright:|2|x<nowiki/>y}}
18087 !! html
18088 <p>xy
18089 </p>
18090 !! end
18091
18092 !! test
18093 Strip marker in anchorencode
18094 !! wikitext
18095 {{anchorencode:x<nowiki/>y}}
18096 !! html
18097 <p>xy
18098 </p>
18099 !! end
18100
18101 !! test
18102 nowiki inside link inside heading (bug 18295)
18103 !! wikitext
18104 ==[[foo|x<nowiki>y</nowiki>z]]==
18105 !! html
18106 <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>
18107
18108 !! end
18109
18110 !! test
18111 new support for bdi element (bug 31817)
18112 !! wikitext
18113 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
18114 !! html
18115 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
18116
18117 !!end
18118
18119 !! test
18120 Ignore pipe between table row attributes
18121 !! wikitext
18122 {|
18123 | quux
18124 |- id=foo | style='color: red'
18125 | bar
18126 |}
18127 !! html
18128 <table>
18129 <tr>
18130 <td> quux
18131 </td></tr>
18132 <tr id="foo" style="color: red">
18133 <td> bar
18134 </td></tr></table>
18135
18136 !! end
18137
18138 !!test
18139 Gallery override link with WikiLink (bug 34852)
18140 !! wikitext
18141 <gallery>
18142 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
18143 </gallery>
18144 !! html
18145 <ul class="gallery mw-gallery-traditional">
18146 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18147 <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>
18148 <div class="gallerytext">
18149 <p>caption
18150 </p>
18151 </div>
18152 </div></li>
18153 </ul>
18154
18155 !! end
18156
18157 !!test
18158 Gallery override link with absolute external link (bug 34852)
18159 !! wikitext
18160 <gallery>
18161 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
18162 </gallery>
18163 !! html
18164 <ul class="gallery mw-gallery-traditional">
18165 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18166 <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>
18167 <div class="gallerytext">
18168 <p>caption
18169 </p>
18170 </div>
18171 </div></li>
18172 </ul>
18173
18174 !! end
18175
18176 !!test
18177 Gallery override link with malicious javascript (bug 34852)
18178 !! wikitext
18179 <gallery>
18180 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
18181 </gallery>
18182 !! html
18183 <ul class="gallery mw-gallery-traditional">
18184 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18185 <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>
18186 <div class="gallerytext">
18187 <p>caption
18188 </p>
18189 </div>
18190 </div></li>
18191 </ul>
18192
18193 !! end
18194
18195 !!test
18196 Gallery with invalid title as link (bug 43964)
18197 !! wikitext
18198 <gallery>
18199 File:foobar.jpg|link=<
18200 </gallery>
18201 !! html
18202 <ul class="gallery mw-gallery-traditional">
18203 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18204 <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>
18205 <div class="gallerytext">
18206 </div>
18207 </div></li>
18208 </ul>
18209
18210 !! end
18211
18212 !!test
18213 Language parser function
18214 !! wikitext
18215 {{#language:ar}}
18216 !! html
18217 <p>العربية
18218 </p>
18219 !! end
18220
18221 !!test
18222 Padleft and padright as substr
18223 !! wikitext
18224 {{padleft:|3|abcde}}
18225 {{padright:|3|abcde}}
18226 !! html
18227 <p>abc
18228 abc
18229 </p>
18230 !! end
18231
18232 !!test
18233 Special parser function
18234 !! wikitext
18235 {{#special:RandomPage}}
18236 {{#special:BaDtItLe}}
18237 {{#special:Foobar}}
18238 !! html
18239 <p>Special:Random
18240 Special:Badtitle
18241 Special:Foobar
18242 </p>
18243 !! end
18244
18245 !!test
18246 Bug 34939 - Case insensitive link parsing ([HttP://])
18247 !! wikitext
18248 [HttP://MediaWiki.Org/]
18249 !! html/php
18250 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
18251 </p>
18252 !! html/parsoid
18253 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
18254 !! end
18255
18256 !!test
18257 Bug 34939 - Case insensitive link parsing ([HttP:// title])
18258 !! wikitext
18259 [HttP://MediaWiki.Org/ MediaWiki]
18260 !! html
18261 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
18262 </p>
18263 !! end
18264
18265 !!test
18266 Bug 34939 - Case insensitive link parsing (HttP://)
18267 !! wikitext
18268 HttP://MediaWiki.Org/
18269 !! html/php
18270 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
18271 </p>
18272 !! html/parsoid
18273 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
18274 !! end
18275
18276 !!test
18277 Disable TOC
18278 !! options
18279 notoc
18280 !! wikitext
18281 Lead
18282 == Section 1 ==
18283 == Section 2 ==
18284 == Section 3 ==
18285 == Section 4 ==
18286 == Section 5 ==
18287 !! html
18288 <p>Lead
18289 </p>
18290
18291 <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>
18292 <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>
18293 <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>
18294 <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>
18295 <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>
18296
18297 !! end
18298
18299
18300 ###
18301 ### Parsoid-specific tests
18302 ### Parsoid-PHP parser incompatibilities
18303 ###
18304 !!test
18305 1. SOL-sensitive wikitext tokens as template-args
18306 !!options
18307 parsoid=wt2html,wt2wt
18308 !! wikitext
18309 {{echo|*a}}
18310 {{echo|#a}}
18311 {{echo|:a}}
18312 !! html
18313 <span about="#mwt1" typeof="mw:Transclusion">
18314 </span><ul about="#mwt1"><li>a</li>
18315 </ul>
18316 <span about="#mwt2" typeof="mw:Transclusion">
18317 </span><ol about="#mwt2"><li>a</li>
18318 </ol>
18319 <span about="#mwt3" typeof="mw:Transclusion">
18320 </span><dl about="#mwt3"><dd>a</dd>
18321 </dl>
18322 !!end
18323
18324 #### -----------------------------------------------------------------
18325 #### Parsoid-specific functionality tests
18326 #### -----------------------------------------------------------------
18327
18328 # Bug 63642: Formatting elt fixup is cleaned up.
18329 # We know wt2wt will fail, but we expect selser to pass.
18330 # Due to the nature of our testing, wt2wt and selser tests will enter the
18331 # blacklist and we'll catch selser regressions based on changes to the
18332 # blacklist entries for selser tests.
18333 !! test
18334 Bad treebuilder fixup of formatting elt is cleaned up
18335 !! options
18336 parsoid=wt2html,wt2wt
18337 !! wikitext
18338 {|
18339 |
18340 <small>
18341 [[Image:Foobar.jpg|right|Test]]
18342 </small>
18343 |}
18344 !! html/parsoid
18345 <table>
18346 <tbody><tr><td>
18347 <p><small></small></p>
18348 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption><small>Test</small></figcaption></figure>
18349 <p></p></td></tr>
18350 </tbody></table>
18351 !! end
18352
18353 #### ----------------------------------------------------------------
18354 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
18355 #### tags. Parsoid's output for these tags differs from that of the
18356 #### PHP parser.
18357 #### ----------------------------------------------------------------
18358
18359 !!test
18360 Ref: 1. ref-location should be replaced with an index span
18361 !!options
18362 parsoid
18363 !! wikitext
18364 A <ref>foo</ref>
18365 B <ref name="x">foo</ref>
18366 C <ref name="y" />
18367 !! html
18368 <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>
18369 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>
18370 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>
18371 !!end
18372
18373 !!test
18374 Ref: 2. ref-tags with identical names should all get the same index
18375 !!options
18376 parsoid
18377 !! wikitext
18378 A <ref name="x">foo</ref>
18379 B <ref name="x" />
18380 !! html
18381 <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>
18382 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>
18383 !!end
18384
18385 !!test
18386 Ref: 3. spaces in ref-names should be ignored
18387 !!options
18388 parsoid
18389 !! wikitext
18390 A <ref name="x">foo</ref>
18391 B <ref name=" x " />
18392 C <ref name= x />
18393 !! html
18394 <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>
18395 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>
18396 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>
18397 !!end
18398
18399 !!test
18400 Ref: 4. 'constructor' should be accepted as a valid ref-name
18401 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
18402 !!options
18403 parsoid
18404 !! wikitext
18405 A <ref name="constructor">foo</ref>
18406 !! html
18407 <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>
18408 !!end
18409
18410 !!test
18411 Ref: 5. body should accept generic wikitext
18412 !!options
18413 parsoid
18414 !! wikitext
18415 A <ref>
18416 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
18417 </ref>
18418
18419 <references />
18420 !! html
18421 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"This is a &lt;b data-parsoid=&#39;{\"dsr\":[19,40,3,3]}&#39;>&lt;a rel=\"mw:WikiLink\" href=\"./Bolded_link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bolded_link\"},\"sa\":{\"href\":\"bolded link\"},\"dsr\":[22,37,2,2]}&#39;>bolded link&lt;/a>&lt;/b> and this is a &lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"transclusion\"}},\"i\":0}}]}&#39; data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]],\"dsr\":[55,76,null,null]}&#39;>transclusion&lt;/span>\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
18422
18423 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
18424 <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>
18425 </li>
18426 </ol>
18427 !!end
18428
18429 !!test
18430 Ref: 6. indent-pres should not be output in ref-body
18431 !!options
18432 parsoid
18433 !! wikitext
18434 A <ref>
18435 foo
18436 bar
18437 baz
18438 </ref>
18439
18440 <references />
18441 !! html
18442 <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>
18443
18444 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
18445 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18446 bar
18447 baz
18448 </li>
18449 </ol>
18450 !!end
18451
18452 !!test
18453 Ref: 7. No p-wrapping in ref-body
18454 !!options
18455 parsoid
18456 !! wikitext
18457 A <ref>
18458 foo
18459
18460 bar
18461
18462
18463 baz
18464
18465
18466
18467 booz
18468 </ref>
18469
18470 <references />
18471 !! html
18472 <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>
18473
18474 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18475 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18476
18477 bar
18478
18479
18480 baz
18481
18482
18483
18484 booz
18485 </li>
18486 </ol>
18487 !!end
18488
18489 !!test
18490 Ref: 8. transclusion wikitext has lower precedence
18491 !!options
18492 parsoid
18493 !! wikitext
18494 A <ref> foo {{echo|</ref> B C}}
18495
18496 <references />
18497 !! html
18498 <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>
18499 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
18500 <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>
18501 </ol>
18502 !!end
18503
18504 !!test
18505 Ref: 9. unclosed comments should not leak out of ref-body
18506 !!options
18507 parsoid
18508 !! wikitext
18509 A <ref> foo <!--</ref> B C
18510 <references />
18511 !! html
18512 <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>
18513 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18514 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
18515 </ol>
18516 !!end
18517
18518 !!test
18519 Ref: 10. Unclosed HTML tags should not leak out of ref-body
18520 !!options
18521 parsoid
18522 !! wikitext
18523 A <ref> <b> foo </ref> B C
18524
18525 <references />
18526 !! html
18527 <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>
18528
18529
18530 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18531 <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>
18532 </ol>
18533 !!end
18534
18535 !!test
18536 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
18537 !!options
18538 parsoid
18539 !! wikitext
18540 A <ref>foo</ref> B
18541 C <ref>bar</ref> D
18542 !! html
18543 <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
18544 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>
18545 !!end
18546
18547 !!test
18548 Ref: 12. ref-tags act as trailing newline migration barrier
18549 !!options
18550 parsoid
18551 !! wikitext
18552 <!--the newline at the end of this line moves out of the p-tag-->a
18553
18554 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
18555 <ref />
18556
18557 c
18558 !! html
18559 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
18560
18561
18562 <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>
18563 <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>
18564
18565
18566 <p>c</p>
18567 !!end
18568
18569 !!test
18570 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
18571 !!options
18572 parsoid
18573 !! wikitext
18574 <ref>foo</ref> A
18575 <ref>bar
18576 </ref> B
18577 !! html
18578 <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
18579 <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>
18580 !!end
18581
18582 !!test
18583 Ref: 14. A nested ref-tag should be emitted as plain text
18584 !!options
18585 parsoid
18586 !! wikitext
18587 <ref>foo <ref>bar</ref> baz</ref>
18588
18589 <references />
18590 !! html
18591 <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>
18592
18593 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18594 <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>
18595 </ol>
18596 !!end
18597
18598 !!test
18599 Ref: 15. ref-tags with identical names should get identical indexes
18600 !!options
18601 parsoid
18602 !! wikitext
18603 A1 <ref name="a">foo</ref> A2 <ref name="a" />
18604 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
18605
18606 <references />
18607 !! html
18608 <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>
18609 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>
18610
18611 <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>
18612 </ol>
18613 !!end
18614
18615 ## We don't bother wt2wt-ing non-standard whitespace
18616 !!test
18617 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
18618 !!options
18619 parsoid=wt2html
18620 !! wikitext
18621 A <ref >foo</ref >
18622
18623 <references />
18624 !! html
18625 <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>
18626
18627 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18628 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
18629 !!end
18630
18631 !!test
18632 References: 1. references tag without any refs should be handled properly
18633 !!options
18634 parsoid
18635 !! wikitext
18636 <references />
18637 !! html
18638 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
18639 !!end
18640
18641 !!test
18642 References: 2. references tag with group only outputs references from that group
18643 !!options
18644 parsoid
18645 !! wikitext
18646 A <ref group="a">foo</ref>
18647 B <ref group="b">bar</ref>
18648
18649 <references group="a" />
18650 !! html
18651 <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>
18652 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>
18653
18654 <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>
18655 </ol>
18656 !!end
18657
18658 !!test
18659 References: 3. ref list should be cleared after processing references
18660 !!options
18661 parsoid
18662 !! wikitext
18663 A <ref>foo</ref>
18664
18665 <references />
18666
18667 B <ref>bar</ref>
18668
18669 <references />
18670 !! html
18671 <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>
18672
18673 <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>
18674 </ol>
18675
18676 <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>
18677
18678 <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>
18679 </ol>
18680 !!end
18681
18682 !!test
18683 References: 4. only referenced group should be cleared after processing references
18684 !!options
18685 parsoid
18686 !! wikitext
18687 A <ref group="a">afoo</ref>
18688 B <ref>bfoo</ref>
18689
18690 <references group="a" />
18691
18692 C <ref>cfoo</ref>
18693
18694 <references />
18695 !! html
18696 <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>
18697 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>
18698
18699 <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>
18700 </ol>
18701
18702 <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>
18703
18704 <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>
18705 </ol>
18706 !!end
18707
18708 !!test
18709 References: 5. ref tags in references should be processed while ignoring all other content
18710 !!options
18711 parsoid
18712 !! wikitext
18713 A <ref name="a" />
18714 B <ref name="b">bar</ref>
18715
18716 <references>
18717 <ref name="a">foo</ref>
18718 This should just get lost.
18719 </references>
18720 !! html
18721 <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>
18722 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>
18723
18724
18725 <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":{}}'>
18726 <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>
18727 <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>
18728 </ol>
18729 !!end
18730
18731 !!test
18732 References: 6. <references /> from a transclusion
18733 !!options
18734 parsoid
18735 !! wikitext
18736 <ref>Foo</ref> {{echo|<references />}}
18737 !! html
18738 <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>
18739 !!end
18740
18741 !! test
18742 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
18743 !! options
18744 parsoid
18745 !! wikitext
18746 A <ref>foo bar for a</ref>
18747 B <ref group="X" name="b" />
18748
18749 <references />
18750
18751 <references group="X">
18752 <ref name="b">foo</ref>
18753 </references>
18754 !! html
18755 <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>
18756 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>
18757
18758 <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>
18759
18760 <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>
18761 !! end
18762
18763 !! test
18764 Entities in ref name
18765 !! options
18766 parsoid
18767 !! wikitext
18768 <ref name="test &amp; me">hi</ref>
18769 !! html
18770 <p data-parsoid='{}'><span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"hi"},"attrs":{"name":"test &amp; me"}}' id="cite_ref-test &amp; me-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref name=\"test &amp;amp; me\">hi&lt;/ref>"}'><a href="#cite_note-test &amp; me-1" data-parsoid="{}">[1]</a></span></p>
18771 !! end
18772
18773 # This test is wt2html only because we're permitting the serializer to produce
18774 # dirty diffs, normalizing the unclosed references to the self-closed version.
18775 !! test
18776 Generate references for unclosed references tag
18777 !! options
18778 parsoid=wt2html
18779 !! wikitext
18780 a<ref>foo</ref>
18781
18782 <references>
18783 !! html
18784 <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>
18785
18786
18787 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
18788 <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>
18789 !! end
18790
18791 !! test
18792 New reference serializes on its own line
18793 !! options
18794 parsoid=wt2wt,html2wt
18795 !! wikitext
18796 foo
18797 <references />
18798 !! html
18799 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
18800 !! end
18801
18802 #### ----------------------------------------------------------------
18803 #### The following section of tests are primarily to test
18804 #### wikitext escaping capabilities of Parsoid. Given that
18805 #### escaping can be done any number of ways, the wikitext (input)
18806 #### is always adjusted to reflect how Parsoid adds nowiki
18807 #### escape tags.
18808 ####
18809 #### We are marking several tests as parsoid-only since the
18810 #### HTML in the result section is different from what the
18811 #### PHP parser generates for it.
18812 #### ----------------------------------------------------------------
18813
18814
18815 #### --------------- Headings ---------------
18816 #### 0. Unnested
18817 #### 1. Nested inside html <h1>=foo=</h1>
18818 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
18819 #### 3. Nested inside html with wikitext split by html tags
18820 #### 4. No escape needed
18821 #### 5. Empty headings <h1></h1>
18822 #### 6. Heading chars in SOL context
18823 #### ----------------------------------------
18824 !! test
18825 Headings: 0. Unnested
18826 !! options
18827 parsoid
18828 !! wikitext
18829 <nowiki>=foo=</nowiki>
18830
18831 <nowiki> =foo= </nowiki>
18832 <!--cmt-->
18833 <nowiki>=foo=</nowiki>
18834
18835 =foo''a''<nowiki>=</nowiki>
18836 !! html
18837 <p><span typeof="mw:Nowiki">=foo=</span></p>
18838
18839 <p><span typeof="mw:Nowiki"> =foo= </span>
18840 <!--cmt-->
18841 <span typeof="mw:Nowiki">=foo=</span></p>
18842
18843 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
18844 !!end
18845
18846 !! test
18847 Headings: 1. Nested inside html
18848 (New headings and existing headings are handled differently)
18849 !! options
18850 parsoid=html2wt
18851 !! wikitext
18852 = =foo= =
18853
18854 == =foo= ==
18855
18856 === =foo= ===
18857
18858 =<nowiki>=foo=</nowiki>=
18859 ==<nowiki>=foo=</nowiki>==
18860 ===<nowiki>=foo=</nowiki>===
18861 ====<nowiki>=foo=</nowiki>====
18862 =====<nowiki>=foo=</nowiki>=====
18863 ======<nowiki>=foo=</nowiki>======
18864
18865 !! html
18866 <h1>=foo=</h1>
18867 <h2>=foo=</h2>
18868 <h3>=foo=</h3>
18869
18870 <h1 data-parsoid='{}'>=foo=</h1>
18871 <h2 data-parsoid='{}'>=foo=</h2>
18872 <h3 data-parsoid='{}'>=foo=</h3>
18873 <h4 data-parsoid='{}'>=foo=</h4>
18874 <h5 data-parsoid='{}'>=foo=</h5>
18875 <h6 data-parsoid='{}'>=foo=</h6>
18876 !!end
18877
18878 !! test
18879 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
18880 !! options
18881 parsoid=html2wt
18882 !! wikitext
18883 = foo =
18884 <nowiki>*</nowiki>bar
18885
18886 = foo =
18887 =bar
18888
18889 = foo =
18890 <nowiki>=bar=</nowiki>
18891 !! html
18892 <h1>foo</h1>*bar
18893 <h1>foo</h1>=bar
18894 <h1>foo</h1>=bar=
18895 !!end
18896
18897 !! test
18898 Headings: 3. Nested inside html with wikitext split by html tags
18899 !! options
18900 parsoid=html2wt
18901 !! wikitext
18902 = ='''bold'''<nowiki>foo=</nowiki> =
18903 !! html
18904 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
18905 !!end
18906
18907 !! test
18908 Headings: 4a. No escaping needed (testing just h1 and h2)
18909 !! options
18910 parsoid=html2wt
18911 !! wikitext
18912 = =foo =
18913
18914 = foo= =
18915
18916 = =foo= =
18917
18918 = =foo= bar =
18919
18920 == =foo ==
18921
18922 == foo= ==
18923
18924 = ''=''foo= =
18925
18926 = <nowiki>=</nowiki> =
18927 !! html
18928 <h1>=foo</h1>
18929 <h1>foo=</h1>
18930 <h1> =foo= </h1>
18931 <h1>=foo= bar</h1>
18932 <h2>=foo</h2>
18933 <h2>foo=</h2>
18934 <h1><i>=</i>foo=</h1>
18935 <h1><span typeof="mw:Nowiki">=</span></h1>
18936 !!end
18937
18938 !! test
18939 Headings: 4b. No escaping needed (inside p-tags)
18940 !! options
18941 parsoid=html2wt
18942 !! wikitext
18943 ===
18944 =foo= x
18945 =foo= <s></s>
18946 !! html
18947 <p>===
18948 =foo= x
18949 =foo= <s></s>
18950 </p>
18951 !!end
18952
18953 !! test
18954 Headings: 5. Empty headings
18955 !! options
18956 parsoid
18957 !! wikitext
18958 =<nowiki/>=
18959
18960 ==<nowiki/>==
18961
18962 ===<nowiki/>===
18963
18964 ====<nowiki/>====
18965
18966 =====<nowiki/>=====
18967
18968 ======<nowiki/>======
18969 !! html
18970 <h1></h1>
18971 <h2></h2>
18972 <h3></h3>
18973 <h4></h4>
18974 <h5></h5>
18975 <h6></h6>
18976 !!end
18977
18978 !! test
18979 Headings: 6a. Heading chars in SOL context (with trailing spaces)
18980 !! options
18981 parsoid
18982 !! wikitext
18983 <nowiki>=a=</nowiki>
18984
18985 <nowiki>=a=</nowiki>
18986
18987 <nowiki>=a=</nowiki>
18988
18989 <nowiki>=a=</nowiki>
18990 !! html
18991 <p>=a=</p>
18992 <p>=a= </p>
18993 <p>=a= </p>
18994 <p>=a= </p>
18995 !!end
18996
18997 !! test
18998 Headings: 6b. Heading chars in SOL context (with trailing newlines)
18999 !! options
19000 parsoid
19001 !! wikitext
19002 <nowiki>=a=
19003 b</nowiki>
19004
19005 <nowiki>=a=
19006 b</nowiki>
19007
19008 <nowiki>=a=
19009 b</nowiki>
19010
19011 <nowiki>=a=
19012 b</nowiki>
19013 !! html
19014 <p>=a=
19015 b</p>
19016 <p>=a=
19017 b</p>
19018 <p>=a=
19019 b</p>
19020 <p>=a=
19021 b</p>
19022 </p>
19023 !!end
19024
19025 !! test
19026 Headings: 6c. Heading chars in SOL context (leading newline break)
19027 !! options
19028 parsoid
19029 !! wikitext
19030 a
19031 <nowiki>=b=</nowiki>
19032 !! html
19033 <p>a
19034 =b=</p>
19035 !!end
19036
19037 !! test
19038 Headings: 6d. Heading chars in SOL context (with interspersed comments)
19039 !! options
19040 parsoid
19041 !! wikitext
19042 <!--c0--><nowiki>=a=</nowiki>
19043
19044 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
19045 !! html
19046 <p><!--c0-->=a=</p>
19047 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
19048 !!end
19049
19050 !! test
19051 Headings: 6d. Heading chars in SOL context (No escaping needed)
19052 !! options
19053 parsoid=html2wt
19054 !! wikitext
19055 =a=<div>b</div>
19056 !! html
19057 =a=<div>b</div>
19058 !!end
19059
19060 #### --------------- Lists ---------------
19061 #### 0. Outside nests (*foo, etc.)
19062 #### 1. Nested inside html <ul><li>*foo</li></ul>
19063 #### 2. Inside definition lists
19064 #### 3. Only bullets at start should be escaped
19065 #### 4. No escapes needed
19066 #### 5. No unnecessary escapes
19067 #### 6. Escape bullets in SOL position
19068 #### 7. Escape bullets in a multi-line context
19069 #### ----------------------------------------
19070
19071 !! test
19072 Lists: 0. Outside nests
19073 !! wikitext
19074 <nowiki>*</nowiki>foo
19075
19076 <nowiki>#</nowiki>foo
19077
19078 <nowiki>;Foo:</nowiki>bar
19079 !! html
19080 <p>*foo
19081 </p><p>#foo
19082 </p><p>;Foo:bar
19083 </p>
19084 !!end
19085
19086 !! test
19087 Lists: 1. Nested inside html
19088 !! wikitext
19089 *<nowiki>*foo</nowiki>
19090
19091 *<nowiki>#foo</nowiki>
19092
19093 *<nowiki>:foo</nowiki>
19094
19095 *<nowiki>;foo</nowiki>
19096
19097 #<nowiki>*foo</nowiki>
19098
19099 #<nowiki>#foo</nowiki>
19100
19101 #<nowiki>:foo</nowiki>
19102
19103 #<nowiki>;foo</nowiki>
19104 !! html
19105 <ul>
19106 <li>*foo
19107 </li>
19108 </ul>
19109 <ul>
19110 <li>#foo
19111 </li>
19112 </ul>
19113 <ul>
19114 <li>:foo
19115 </li>
19116 </ul>
19117 <ul>
19118 <li>;foo
19119 </li>
19120 </ul>
19121 <ol>
19122 <li>*foo
19123 </li>
19124 </ol>
19125 <ol>
19126 <li>#foo
19127 </li>
19128 </ol>
19129 <ol>
19130 <li>:foo
19131 </li>
19132 </ol>
19133 <ol>
19134 <li>;foo
19135 </li>
19136 </ol>
19137
19138 !!end
19139
19140 !! test
19141 Lists: 2. Inside definition lists
19142 !! wikitext
19143 ;<nowiki>;foo</nowiki>
19144
19145 ;<nowiki>:foo</nowiki>
19146
19147 ;<nowiki>:foo</nowiki>
19148 :bar
19149
19150 :<nowiki>:foo</nowiki>
19151 !! html
19152 <dl>
19153 <dt>;foo
19154 </dt>
19155 </dl>
19156 <dl>
19157 <dt>:foo
19158 </dt>
19159 </dl>
19160 <dl>
19161 <dt>:foo
19162 </dt>
19163 <dd>bar
19164 </dd>
19165 </dl>
19166 <dl>
19167 <dd>:foo
19168 </dd>
19169 </dl>
19170
19171 !!end
19172
19173 !! test
19174 Lists: 3. Only bullets at start of text should be escaped
19175 !! wikitext
19176 *<nowiki>*foo*bar</nowiki>
19177
19178 *<nowiki>*foo</nowiki>''it''*bar
19179 !! html
19180 <ul>
19181 <li>*foo*bar
19182 </li>
19183 </ul>
19184 <ul>
19185 <li>*foo<i>it</i>*bar
19186 </li>
19187 </ul>
19188
19189 !!end
19190
19191 !! test
19192 Lists: 4. No escapes needed
19193 !! options
19194 parsoid
19195 !! wikitext
19196 *foo*bar
19197
19198 *''foo''*bar
19199
19200 *[[Foo]]: bar
19201
19202 *[[Foo]]*bar
19203 !! html
19204 <ul>
19205 <li>foo*bar
19206 </li>
19207 </ul>
19208 <ul>
19209 <li><i>foo</i>*bar
19210 </li>
19211 </ul>
19212 <ul>
19213 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
19214 </li>
19215 </ul>
19216 <ul>
19217 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
19218 </li>
19219 </ul>
19220 !!end
19221
19222 !! test
19223 Lists: 5. No unnecessary escapes
19224 !! wikitext
19225 * bar <span><nowiki>[[foo]]</nowiki></span>
19226
19227 *=bar <span><nowiki>[[foo]]</nowiki></span>
19228
19229 *[[bar <span><nowiki>[[foo]]</nowiki></span>
19230
19231 *]]bar <span><nowiki>[[foo]]</nowiki></span>
19232
19233 *=bar <span>foo]]</span>=
19234
19235 * <s></s>: a
19236 !! html
19237 <ul>
19238 <li> bar <span>[[foo]]</span>
19239 </li>
19240 </ul>
19241 <ul>
19242 <li>=bar <span>[[foo]]</span>
19243 </li>
19244 </ul>
19245 <ul>
19246 <li>[[bar <span>[[foo]]</span>
19247 </li>
19248 </ul>
19249 <ul>
19250 <li>]]bar <span>[[foo]]</span>
19251 </li>
19252 </ul>
19253 <ul>
19254 <li>=bar <span>foo]]</span>=
19255 </li>
19256 </ul>
19257 <ul>
19258 <li> <s></s>: a
19259 </li>
19260 </ul>
19261
19262 !!end
19263
19264 !! test
19265 Lists: 6. Escape bullets in SOL position
19266 !! options
19267 parsoid
19268 !! wikitext
19269 <!--cmt--><nowiki>*foo</nowiki>
19270 !! html
19271 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
19272 !!end
19273
19274 !! test
19275 Lists: 7. Escape bullets in a multi-line context
19276 !! wikitext
19277 a
19278 <nowiki>*</nowiki>b
19279 !! html
19280 <p>a
19281 *b
19282 </p>
19283 !!end
19284
19285 #### --------------- HRs ---------------
19286 #### 1. Single line
19287 #### -----------------------------------
19288
19289 !! test
19290 HRs: 1. Single line
19291 !! options
19292 parsoid
19293 !! wikitext
19294 ----<nowiki>----</nowiki>
19295 ----=foo=
19296 ----*foo
19297 !! html
19298 <hr><span typeof="mw:Nowiki">----</span>
19299 <hr>=foo=
19300 <hr>*foo
19301 !! end
19302
19303 #### --------------- Tables ---------------
19304 #### 1a. Simple example
19305 #### 1b. No escaping needed (!foo)
19306 #### 1c. No escaping needed (|foo)
19307 #### 1d. No escaping needed (|}foo)
19308 ####
19309 #### 2a. Nested in td (<td>foo|bar</td>)
19310 #### 2b. Nested in td (<td>foo||bar</td>)
19311 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
19312 ####
19313 #### 3a. Nested in th (<th>foo!bar</th>)
19314 #### 3b. Nested in th (<th>foo!!bar</th>)
19315 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
19316 ####
19317 #### 4a. Escape -
19318 #### 4b. Escape +
19319 #### 4c. No escaping needed
19320 #### --------------------------------------
19321
19322 !! test
19323 Tables: 1a. Simple example
19324 !! wikitext
19325 <nowiki>{|
19326 |}</nowiki>
19327 !! html
19328 <p>{|
19329 |}
19330 </p>
19331 !! end
19332
19333 !! test
19334 Tables: 1b. No escaping needed
19335 !! wikitext
19336 !foo
19337 !! html
19338 <p>!foo
19339 </p>
19340 !! end
19341
19342 !! test
19343 Tables: 1c. No escaping needed
19344 !! wikitext
19345 |foo
19346 !! html
19347 <p>|foo
19348 </p>
19349 !! end
19350
19351 !! test
19352 Tables: 1d. No escaping needed
19353 !! wikitext
19354 |}foo
19355 !! html
19356 <p>|}foo
19357 </p>
19358 !! end
19359
19360 !! test
19361 Tables: 2a. Nested in td
19362 !! options
19363 parsoid=html2wt
19364 !! wikitext
19365 {|
19366 |<nowiki>foo|bar</nowiki>
19367 |-
19368 |x<div><nowiki>a|b</nowiki></div>
19369 |}
19370 !! html
19371 <table><tbody><tr>
19372 <td>foo|bar</td></tr>
19373 <tr><td>x<div>a|b</div></td>
19374 </tbody></table>
19375 !! end
19376
19377 !! test
19378 Tables: 2b. Nested in td
19379 !! options
19380 parsoid
19381 !! wikitext
19382 {|
19383 |<nowiki>foo||bar</nowiki>
19384 |''it''<nowiki>foo||bar</nowiki>
19385 |}
19386 !! html
19387 <table><tbody><tr>
19388 <td><span typeof="mw:Nowiki">foo||bar</span></td>
19389 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
19390 !! end
19391
19392 !! test
19393 Tables: 2c. Nested in td -- no escaping needed
19394 !! options
19395 parsoid
19396 !! wikitext
19397 {|
19398 |foo!!bar
19399 |}
19400 !! html
19401 <table><tbody><tr><td>foo!!bar
19402 </td></tr></tbody></table>
19403
19404 !! end
19405
19406 !! test
19407 Tables: 3a. Nested in th
19408 !! options
19409 parsoid
19410 !! wikitext
19411 {|
19412 !foo!bar
19413 |}
19414 !! html
19415 <table><tbody><tr><th>foo!bar
19416 </th></tr></tbody></table>
19417
19418 !! end
19419
19420 !! test
19421 Tables: 3b. Nested in th
19422 !! options
19423 parsoid
19424 !! wikitext
19425 {|
19426 !<nowiki>foo!!bar</nowiki>
19427 |}
19428 !! html
19429 <table>
19430 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
19431 </tbody></table>
19432 !! end
19433
19434 !! test
19435 Tables: 3c. Nested in th -- no escaping needed
19436 !! options
19437 parsoid
19438 !! wikitext
19439 {|
19440 !<nowiki>foo||bar</nowiki>
19441 |}
19442 !! html
19443 <table><tbody><tr>
19444 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
19445 !! end
19446
19447 !! test
19448 Tables: 4a. Escape -
19449 !! options
19450 parsoid
19451 !! wikitext
19452 {|
19453 !-bar
19454 |-
19455 |<nowiki>-bar</nowiki>
19456 |}
19457 !! html
19458 <table><tbody>
19459 <tr><th>-bar</th></tr>
19460 <tr>
19461 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
19462 !! end
19463
19464 !! test
19465 Tables: 4b. Escape +
19466 !! options
19467 parsoid
19468 !! wikitext
19469 {|
19470 !+bar
19471 |-
19472 |<nowiki>+bar</nowiki>
19473 |}
19474 !! html
19475 <table><tbody>
19476 <tr><th>+bar</th></tr>
19477 <tr>
19478 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
19479 !! end
19480
19481 !! test
19482 Tables: 4c. No escaping needed
19483 !! options
19484 parsoid
19485 !! wikitext
19486 {|
19487 |foo-bar
19488 |foo+bar
19489 |-
19490 |''foo''-bar
19491 |''foo''+bar
19492 |-
19493 |foo
19494 bar|baz
19495 +bar
19496 -bar
19497 |-
19498 |x
19499 <div>a|b</div>
19500 |}
19501 !! html
19502 <table><tbody>
19503 <tr><td>foo-bar</td><td>foo+bar</td></tr>
19504 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
19505 <tr><td>foo
19506 <p>bar|baz
19507 +bar
19508 -bar</p></td></tr>
19509 <tr><td>x
19510 <div>a|b</div></td>
19511 </tbody></table>
19512 !! end
19513
19514 !! test
19515 Tables: 4d. No escaping needed
19516 !! options
19517 parsoid
19518 !! wikitext
19519 {|
19520 |[[Foo]]-bar
19521 ||+1
19522 ||-2
19523 |}
19524 !! html
19525 <table>
19526 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
19527 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
19528 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
19529 </tbody></table>
19530 !! end
19531
19532 !! test
19533 Tables: Digest broken attributes on table and tr tag
19534 !! options
19535 parsoid=wt2html
19536 !! wikitext
19537 {| || |} ++
19538 |- || || ++ --
19539 |- > [
19540 |}
19541 !! html
19542 <table>
19543 <tbody>
19544 <tr></tr>
19545 <tr></tr>
19546 </tbody></table>
19547 !! end
19548
19549 #### --------------- Links ----------------
19550 #### 1. Quote marks in link text
19551 #### 2. Wikilinks: Escapes needed
19552 #### 3. Wikilinks: No escapes needed
19553 #### 4. Extlinks: Escapes needed
19554 #### 5. Extlinks: No escapes needed
19555 #### --------------------------------------
19556 !! test
19557 Links 1. Quote marks in link text
19558 !! options
19559 parsoid
19560 !! wikitext
19561 [[Foo|Foo<nowiki>''boo''</nowiki>]]
19562 !! html
19563 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
19564 !! end
19565
19566 !! test
19567 Links 2. WikiLinks: Escapes needed
19568 !! options
19569 parsoid
19570 !! wikitext
19571 [[Foo|[Foobar]]]
19572 [[Foo|<nowiki>Foobar]</nowiki>]]
19573 [[Foo|x [Foobar] x]]
19574 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
19575 [[Foo|<nowiki>[[Bar]]</nowiki>]]
19576 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
19577 [[Foo|<nowiki>|Bar</nowiki>]]
19578 [[Foo|<nowiki>]]bar</nowiki>]]
19579 [[Foo|<nowiki>[[bar</nowiki>]]
19580 [[Foo|<nowiki>x [[ y</nowiki>]]
19581 [[Foo|<nowiki>x ]] y</nowiki>]]
19582 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
19583 !! html
19584 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
19585 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
19586 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
19587 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
19588 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
19589 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
19590 <a href="Foo" rel="mw:WikiLink">|Bar</a>
19591 <a href="Foo" rel="mw:WikiLink">]]bar</a>
19592 <a href="Foo" rel="mw:WikiLink">[[bar</a>
19593 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
19594 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
19595 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
19596 !! end
19597
19598 !! test
19599 Links 3. WikiLinks: No escapes needed
19600 !! options
19601 parsoid
19602 !! wikitext
19603 [[Foo|[Foobar]]
19604 [[Foo|foo|bar]]
19605 !! html
19606 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
19607 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
19608 !! end
19609
19610 !! test
19611 Links 4. ExtLinks: Escapes needed
19612 !! options
19613 parsoid
19614 !! wikitext
19615 [http://google.com <nowiki>[google]</nowiki>]
19616 [http://google.com <nowiki>google]</nowiki>]
19617
19618 <nowiki>[http://google.com]</nowiki>
19619
19620 <nowiki>[http://google.com google]</nowiki>
19621
19622 !! html
19623 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
19624 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
19625 <p>[http://google.com]</p>
19626 <p>[http://google.com google]</p>
19627 !! end
19628
19629 !! test
19630 Links 5. ExtLinks: No escapes needed
19631 !! options
19632 parsoid
19633 !! wikitext
19634 [http://google.com [google]
19635 !! html
19636 <a href="http://google.com" rel="mw:ExtLink">[google</a>
19637 !! end
19638
19639 !! test
19640 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
19641 !! html/parsoid
19642 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
19643 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
19644 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
19645 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
19646 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
19647 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
19648 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19649 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
19650 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19651 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
19652 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
19653 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
19654 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
19655 </p>
19656 !! wikitext
19657 x<nowiki/>http://example.com<nowiki/>y
19658 http://example.com<nowiki/>?x
19659 http://example.com<nowiki/>&x
19660 http://example.com<nowiki/>'x
19661 http://example.com<nowiki/>,x
19662 http://example.com<nowiki/>.x
19663 http://example.com<nowiki/>;x
19664 http://example.com<nowiki/>:x
19665 http://example.com<nowiki/>;x
19666 http://example.com<nowiki/>!x
19667 http://example.com<nowiki/>=x
19668 http://example.com<nowiki/>(x)
19669 http://example.com(x<nowiki/>)
19670 !! end
19671
19672 !! test
19673 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19674 !! html/parsoid
19675 <p>x
19676 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
19677 y
19678 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
19679 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
19680 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
19681 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
19682 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
19683 </p>
19684 !! wikitext
19685 x
19686 http://example.com
19687 y
19688 "http://example.com"
19689 (http://example.com)
19690 (http://example.com) foo
19691 http://example.com,
19692 http://example.com, foo
19693 !! end
19694
19695 ## Parsoid currently fails wt2html on this one!
19696 !! test
19697 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19698 !! html/parsoid
19699 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
19700 !! wikitext
19701 http://example.com.,;:!?
19702 !! end
19703
19704 !! test
19705 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
19706 !! html/parsoid
19707 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
19708 !! wikitext
19709 RFC 123<nowiki/>4
19710 !! end
19711
19712 !! test
19713 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
19714 !! html/parsoid
19715 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19716 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19717 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
19718 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
19719 </p>
19720 !! wikitext
19721 xRFC 123y
19722 XRFC 123y
19723 RFC 123?foo
19724 RFC 123&foo
19725 !! end
19726
19727 !! test
19728 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
19729 !! html/parsoid
19730 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
19731 !! wikitext
19732 PMID 123<nowiki/>4
19733 !! end
19734
19735 !! test
19736 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
19737 !! html/parsoid
19738 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19739 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19740 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
19741 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
19742 </p>
19743 !! wikitext
19744 xPMID 123y
19745 XPMID 123y
19746 PMID 123?foo
19747 PMID 123&foo
19748 !! end
19749
19750 !! test
19751 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
19752 !! html/parsoid
19753 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
19754 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
19755 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
19756 </p>
19757 !! wikitext
19758 ISBN 1234567890<nowiki/>1
19759 ISBN 1234567890<nowiki/>x
19760 ISBN 1234567890<nowiki/>b
19761 !! end
19762
19763 !! test
19764 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
19765 !! html/parsoid
19766 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
19767 !! wikitext
19768 ISBN 1234567890's
19769 !! end
19770
19771 #### --------------- Quotes ---------------
19772 #### 1. Quotes inside <b> and <i>
19773 #### 2. Link fragments separated by <i> and <b> tags
19774 #### 3. Link fragments inside <i> and <b>
19775 #### 4. No escaping needed
19776 #### --------------------------------------
19777 !! test
19778 1. Quotes inside <b> and <i>
19779 !! options
19780 parsoid=html2wt,wt2wt
19781 !! wikitext
19782 ''<nowiki>'foo'</nowiki>''
19783 ''<nowiki>''foo''</nowiki>''
19784 ''<nowiki>'''foo'''</nowiki>''
19785 ''foo''<nowiki/>'s
19786 '''<nowiki>'foo'</nowiki>'''
19787 '''<nowiki>''foo''</nowiki>'''
19788 '''<nowiki>'''foo'''</nowiki>'''
19789 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
19790 '''foo'''<nowiki/>'s
19791 '''foo''
19792 ''foo''<nowiki/>'
19793 '<nowiki/>''foo''<nowiki/>'
19794 ''''foo'''
19795 '''foo'''<nowiki/>'
19796 '<nowiki/>'''foo'''<nowiki/>'
19797 ''fools'<span> errand</span>''
19798 ''<span>fool</span>'s errand''
19799 !! html
19800 <p><i>'foo'</i>
19801 <i>''foo''</i>
19802 <i>'''foo'''</i>
19803 <i>foo</i>'s
19804 <b>'foo'</b>
19805 <b>''foo''</b>
19806 <b>'''foo'''</b>
19807 <b>foo'<i>bar'</i>baz</b>
19808 <b>foo</b>'s
19809 '<i>foo</i>
19810 <i>foo</i>'
19811 '<i>foo</i>'
19812 '<b>foo</b>
19813 <b>foo</b>'
19814 '<b>foo</b>'</p>
19815 <i>fools'<span> errand</span></i>
19816 <i><span>fool</span>'s errand</i>
19817 !! end
19818
19819 !! test
19820 2. Link fragments separated by <i> and <b> tags
19821 !! wikitext
19822 [[''foo''<nowiki>hello]]</nowiki>
19823
19824 [['''foo'''<nowiki>hello]]</nowiki>
19825 !! html
19826 <p>[[<i>foo</i>hello]]
19827 </p><p>[[<b>foo</b>hello]]
19828 </p>
19829 !! end
19830
19831 !! test
19832 3. Link fragments inside <i> and <b>
19833 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
19834 this is one of the shortcomings of this format)
19835 !! wikitext
19836 ''[[foo''<nowiki>]]</nowiki>
19837
19838 '''[[foo'''<nowiki>]]</nowiki>
19839 !! html
19840 <p><i>[[foo</i>]]
19841 </p><p><b>[[foo</b>]]
19842 </p>
19843 !! end
19844
19845 !! test
19846 4. No escaping needed
19847 !! wikitext
19848 '<span>''bar''</span>'
19849 '<span>'''bar'''</span>'
19850 !! html
19851 <p>'<span><i>bar</i></span>'
19852 '<span><b>bar</b></span>'
19853 </p>
19854 !! end
19855
19856 #### ----------- Paragraphs ---------------
19857 #### 1. No unnecessary escapes
19858 #### --------------------------------------
19859
19860 !! test
19861 1. No unnecessary escapes
19862 !! wikitext
19863 bar <span><nowiki>[[foo]]</nowiki></span>
19864
19865 =bar <span><nowiki>[[foo]]</nowiki></span>
19866
19867 [[bar <span><nowiki>[[foo]]</nowiki></span>
19868
19869 ]]bar <span><nowiki>[[foo]]</nowiki></span>
19870
19871 =bar <span>foo]]</span><nowiki>=</nowiki>
19872 !! html
19873 <p>bar <span>[[foo]]</span>
19874 </p><p>=bar <span>[[foo]]</span>
19875 </p><p>[[bar <span>[[foo]]</span>
19876 </p><p>]]bar <span>[[foo]]</span>
19877 </p><p>=bar <span>foo]]</span>=
19878 </p>
19879 !!end
19880
19881 #### ----------------------- PRE --------------------------
19882 #### 1. Leading whitespace in SOL context should be escaped
19883 #### ------------------------------------------------------
19884 !! test
19885 1. Leading whitespace in SOL context should be escaped
19886 !! options
19887 parsoid
19888 !! wikitext
19889 <nowiki> </nowiki>a
19890
19891 <nowiki> </nowiki> a
19892
19893 <nowiki> </nowiki>a(tab)
19894
19895 <nowiki> </nowiki> a
19896 <!--cmt-->
19897 <nowiki> </nowiki> a
19898
19899 a
19900 <nowiki> </nowiki>b
19901
19902 a
19903 <nowiki> </nowiki>b
19904
19905 a
19906 <nowiki> </nowiki> b
19907 !! html
19908 <p> a</p>
19909 <p> a</p>
19910 <p> a(tab)</p>
19911 <p> a</p>
19912 <p><!--cmt--> a</p>
19913 <p>a
19914 b</p>
19915 <p>a
19916 b</p>
19917 <p>a
19918 b</p>
19919 !! end
19920
19921 #### --------------- Behavior Switches --------------------
19922 !! test
19923 1. Valid behavior switches should be escaped
19924 !! options
19925 parsoid=html2wt
19926 !! wikitext
19927 <nowiki>__TOC__</nowiki>
19928 !! html
19929 __TOC__
19930 !! end
19931
19932 !! test
19933 2. Invalid behavior switches should not be escaped
19934 !! options
19935 parsoid=html2wt
19936 !! wikitext
19937 __TOO__
19938 __|__
19939 !! html
19940 __TOO__
19941 __|__
19942 !! end
19943
19944 #### --------------- HTML tags ---------------
19945 #### 1. a tags
19946 #### 2. other tags
19947 #### 3. multi-line html tag
19948 #### 4. extension tags
19949 #### -----------------------------------------
19950 !! test
19951 1. a tags
19952 !! options
19953 parsoid
19954 !! wikitext
19955 <a href="http://google.com">google</a>
19956 !! html
19957 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
19958 !! end
19959
19960 !! test
19961 2. other tags
19962 !! wikitext
19963 <nowiki><div>foo</div>
19964 <div style="color:red">foo</div></nowiki>
19965 !! html
19966 <p>&lt;div&gt;foo&lt;/div&gt;
19967 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
19968 </p>
19969 !! end
19970
19971 !! test
19972 3. multi-line html tag
19973 !! wikitext
19974 <nowiki><div
19975 >foo</div
19976 ></nowiki>
19977 !! html
19978 <p>&lt;div
19979 &gt;foo&lt;/div
19980 &gt;
19981 </p>
19982 !! end
19983
19984 !! test
19985 4. extension tags
19986 !! wikitext
19987 <nowiki><ref>foo</ref></nowiki>
19988
19989 <nowiki><ref>bar</nowiki>
19990
19991 baz<nowiki></ref></nowiki>
19992 !! html
19993 <p>&lt;ref&gt;foo&lt;/ref&gt;
19994 </p><p>&lt;ref&gt;bar
19995 </p><p>baz&lt;/ref&gt;
19996 </p>
19997 !! end
19998
19999 #### --------------- Others ---------------
20000 !! test
20001 Escaping nowikis
20002 !! wikitext
20003 &lt;nowiki&gt;foo&lt;/nowiki&gt;
20004 !! html
20005 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
20006 </p>
20007 !! end
20008
20009 ## The quote-char in the input is necessary for triggering the bug
20010 !! test
20011 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
20012 !! options
20013 parsoid=wt2wt,html2wt
20014 !! wikitext
20015 foo's bar :
20016 !! html
20017 <p>foo's bar :</p>
20018 !! end
20019
20020 !! test
20021
20022 Tag-like HTML structures are passed through as text
20023 !! wikitext
20024 <x y>
20025
20026 <x.y>
20027
20028 <x-y>
20029
20030 1>2
20031
20032 x<y
20033
20034 a>b
20035
20036 1<d e>f
20037 !! html
20038 <p>&lt;x y&gt;
20039 </p><p>&lt;x.y&gt;
20040 </p><p>&lt;x-y&gt;
20041 </p><p>1&gt;2
20042 </p><p>x&lt;y
20043 </p><p>a&gt;b
20044 </p><p>1&lt;d e&gt;f
20045 </p>
20046 !! end
20047
20048
20049 # This was a bug in the PHP parser (see bug 17663 and its dups,
20050 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
20051 !! test
20052 Tag names followed by punctuation should not be recognized as tags
20053 !! wikitext
20054 <s.ome> text
20055 !! html
20056 <p>&lt;s.ome&gt; text
20057 </p>
20058 !! end
20059
20060 !! test
20061 HTML tag with necessary entities in attributes
20062 !! wikitext
20063 <span title="&amp;amp;">foo</span>
20064 !! html
20065 <p><span title="&amp;amp;">foo</span>
20066 </p>
20067 !! end
20068
20069 !! test
20070 HTML tag with 'unnecessary' entity encoding in attributes
20071 !! wikitext
20072 <span title="&amp;">foo</span>
20073 !! html
20074 <p><span title="&amp;">foo</span>
20075 </p>
20076 !! end
20077
20078 !! test
20079 HTML tag with broken attribute value quoting
20080 !! wikitext
20081 <span title="Hello world>Foo</span>
20082 !! html
20083 <p><span>Foo</span>
20084 </p>
20085 !! end
20086
20087 !! test
20088 Parsoid-only: HTML tag with broken attribute value quoting
20089 !! options
20090 parsoid
20091 !! wikitext
20092 <span title="Hello world>Foo</span>
20093 !! html
20094 <p><span title="Hello world">Foo</span>
20095 </p>
20096 !! end
20097
20098 !! test
20099 Table with broken attribute value quoting
20100 !! wikitext
20101 {|
20102 | title="Hello world|Foo
20103 |}
20104 !! html
20105 <table>
20106 <tr>
20107 <td>Foo
20108 </td></tr></table>
20109
20110 !! end
20111
20112 !! test
20113 Table with broken attribute value quoting on consecutive lines
20114 !! wikitext
20115 {|
20116 | title="Hello world|Foo
20117 | style="color:red|Bar
20118 |}
20119 !! html
20120 <table>
20121 <tr>
20122 <td>Foo
20123 </td>
20124 <td>Bar
20125 </td></tr></table>
20126
20127 !! end
20128
20129 !! test
20130 Parsoid-only: Table with broken attribute value quoting on consecutive lines
20131 !! options
20132 parsoid
20133 !! wikitext
20134 {|
20135 | title="Hello world|Foo
20136 | style="color:red|Bar
20137 |}
20138 !! html
20139 <table><tbody>
20140 <tr>
20141 <td title="Hello world">Foo
20142 </td><td style="color: red">Bar
20143 </td></tr></tbody></table>
20144
20145 !! end
20146
20147 !! test
20148 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
20149 !! options
20150 parsoid
20151 !! wikitext
20152 {{}}
20153 !! html
20154 {{}}
20155 !! end
20156
20157 !! test
20158 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
20159 !! options
20160 parsoid
20161 !! wikitext
20162 }}{{
20163 !! html
20164 }}{{
20165 !! end
20166
20167 !!test
20168 Accept empty td cell attribute
20169 !! wikitext
20170 {|
20171 | align="center" | foo || |
20172 |}
20173 !! html
20174 <table>
20175 <tr>
20176 <td align="center"> foo </td>
20177 <td>
20178 </td></tr></table>
20179
20180 !!end
20181
20182 !!test
20183 Non-empty attributes in th-cells
20184 !! wikitext
20185 {|
20186 ! Foo !! style="color: red" | Bar
20187 |}
20188 !! html
20189 <table>
20190 <tr>
20191 <th> Foo </th>
20192 <th style="color: red"> Bar
20193 </th></tr></table>
20194
20195 !!end
20196
20197 !!test
20198 Accept empty attributes in th-cells
20199 !! wikitext
20200 {|
20201 !| foo !!| bar
20202 |}
20203 !! html
20204 <table>
20205 <tr>
20206 <th> foo </th>
20207 <th> bar
20208 </th></tr></table>
20209
20210 !!end
20211
20212 !!test
20213 Empty table rows go away
20214 !! wikitext
20215 {|
20216 | Hello
20217 | there
20218 |- class="foo"
20219 |-
20220 |}
20221 !! html
20222 <table>
20223 <tr>
20224 <td> Hello
20225 </td>
20226 <td> there
20227 </td></tr>
20228
20229 </table>
20230
20231 !! end
20232
20233 ###
20234 ### Parsoid-centric tests for testing RTing of inter-element separators
20235 ### Edge cases not tested by existing parser tests and specific to
20236 ### Parsoid-specific serialization strategies.
20237 ###
20238
20239 !!test
20240 RT-ed inter-element separators should be valid separators
20241 !! wikitext
20242 {|
20243 |- [[foo]]
20244 |}
20245 !! html
20246 <table>
20247
20248 </table>
20249
20250 !!end
20251
20252 !!test
20253 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
20254 (Parsoid-only since PHP parser relies on Tidy for correct output)
20255 !!options
20256 parsoid
20257 !! wikitext
20258 {|
20259 |<small>foo
20260 bar
20261 |}
20262
20263 {|
20264 |<small>foo<small>
20265 |}
20266 !! html
20267 !!end
20268
20269 !!test
20270 Empty TD followed by TD with tpl-generated attribute
20271 !! wikitext
20272 {|
20273 |-
20274 |
20275 |{{echo|style='color:red'}}|foo
20276 |}
20277 !! html
20278 <table>
20279
20280 <tr>
20281 <td>
20282 </td>
20283 <td>foo
20284 </td></tr></table>
20285
20286 !!end
20287
20288 !!test
20289 Indented table with an empty td
20290 !! wikitext
20291 {|
20292 |-
20293 |
20294 |foo
20295 |}
20296 !! html
20297 <table>
20298
20299 <tr>
20300 <td>
20301 </td>
20302 <td>foo
20303 </td></tr></table>
20304
20305 !!end
20306
20307 !!test
20308 Empty TR followed by a template-generated TR
20309 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
20310 !!options
20311 parsoid
20312 !! wikitext
20313 {|
20314 |-
20315 {{echo|<tr><td>foo</td></tr>}}
20316 |}
20317 !! html
20318 <table>
20319 <tbody>
20320 <tr></tr>
20321 <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}}]}'>
20322 <td>foo</td></tr>
20323 </tbody></table>
20324 !!end
20325
20326 ## PHP and parsoid output differ for this, and since this is primarily
20327 ## for testing Parsoid's serializer, marking this Parsoid only
20328 !!test
20329 Empty TR followed by mixed-ws-comment line should RT correctly
20330 !!options
20331 parsoid
20332 !! wikitext
20333 {|
20334 |-
20335 <!--c-->
20336 |-
20337 <!--c--> <!--d-->
20338 |}
20339 !! html
20340 <table>
20341 <tbody>
20342 <tr></tr>
20343 <!--c-->
20344 <tr>
20345 <!--c--> </tr><!--d-->
20346 </tbody></table>
20347
20348 !!end
20349
20350 !!test
20351 Multi-line image caption generated by templates with/without trailing newlines
20352 !!options
20353 parsoid
20354 !! wikitext
20355 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
20356 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
20357 !! html
20358 <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>
20359 <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>
20360
20361 !!end
20362
20363 !! test
20364 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
20365 !! options
20366 parsoid=html2wt
20367 !! wikitext
20368 <includeonly>foo</includeonly>
20369 new para
20370
20371 [[./Category:Foo]]
20372
20373 = new heading =
20374 !! html
20375 <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>
20376
20377 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
20378 !! end
20379
20380 ## PHP emits broken html for this, and since this is primarily
20381 ## a Parsoid serializer test, marking this Parsoid only
20382 !!test
20383 Improperly nested inline or quotes tags with whitespace in between
20384 !!options
20385 parsoid
20386 !! wikitext
20387 <span> <s>x</span> </s>
20388 ''' ''x''' ''
20389 !! html
20390 <p><span> <s>x</s></span><s> </s>
20391 <b> <i>x</i></b><i> </i>
20392 </p>
20393 !!end
20394
20395 !!test
20396 Encapsulate protected attributes from wt
20397 !!options
20398 parsoid
20399 !! wikitext
20400 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
20401 !! html
20402 <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>
20403 </body>
20404 !!end
20405
20406 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
20407 ## Having nested or stray pre tags results in the attempt to add duplicates,
20408 ## causing an assertion fail. This test tries to prevent that situation.
20409 !!test
20410 Ensure ParagraphWrapper can deal with stray closing pre tags
20411 !!options
20412 parsoid=wt2html
20413 !! wikitext
20414 plain text</pre>
20415 !! html
20416 plain text
20417 !!end
20418
20419 !!test
20420 1. Ensure fostered text content is wrapped in spans
20421 !!options
20422 parsoid=wt2html
20423 !! wikitext
20424 <table>hi</table><table>ho</table>
20425 !! html
20426 <span>hi</span>
20427 <table></table>
20428 <span>ho</span>
20429 <table></table>
20430 !!end
20431
20432 !!test
20433 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
20434 !!options
20435 parsoid=wt2html,wt2wt
20436 !! wikitext
20437 <table>
20438 <tr> || ||
20439 <td> a
20440 </table>
20441 !! html
20442 <span> || ||</span>
20443 <table>
20444 <tbody>
20445 <tr>
20446 <td> a</td></tr>
20447 </tbody></table>
20448 !!end
20449
20450 !!test
20451 Encapsulation properly handles null DSR information from foster box
20452 !!options
20453 parsoid=wt2html,wt2wt
20454 !! wikitext
20455 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
20456 !! html
20457 <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;
20458 <table>foo
20459 <tr>
20460 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
20461 <table>
20462 <tbody>
20463 <tr>
20464 <td>bar</td></tr></tbody></table>
20465 !!end
20466
20467 !!test
20468 1. Encapsulate foster-parented transclusion content
20469 !!options
20470 parsoid=wt2wt,wt2html
20471 !! wikitext
20472 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
20473 !! html
20474 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20475 <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
20476 <tr>
20477 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
20478 <table>
20479 <tbody>
20480 <tr>
20481 <td>bar</td></tr></tbody></table>
20482 !!end
20483
20484 !!test
20485 2. Encapsulate foster-parented transclusion content
20486 !!options
20487 parsoid=wt2wt,wt2html
20488 !! wikitext
20489 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
20490 !! html
20491 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20492 <table>
20493 <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>
20494 <tr>
20495 <td>bar</td></tr></table>&quot;]}">foo</div>
20496 <table>
20497 <tbody>
20498 <tr>
20499 <td>bar</td></tr></tbody></table>
20500 !!end
20501
20502 !!test
20503 3. Encapsulate foster-parented transclusion content
20504 !!options
20505 parsoid=wt2wt,wt2html
20506 !! wikitext
20507 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20508 !! html
20509 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20510 <table>
20511 <div>
20512 <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>
20513 <tr>
20514 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20515 <p>foo</p></div>
20516 <table>
20517 <tbody>
20518 <tr>
20519 <td>bar</td></tr></tbody></table>
20520 !!end
20521
20522 !!test
20523 4. Encapsulate foster-parented transclusion content
20524 !!options
20525 parsoid=wt2wt,wt2html
20526 !! wikitext
20527 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20528 !! html
20529 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20530 <table>
20531 <div>
20532 <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>
20533 <tr>
20534 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20535 <p>foo</p></div>
20536 <table>
20537 <tbody>
20538 <tr>
20539 <td>bar</td></tr></tbody></table>
20540 !!end
20541
20542 !!test
20543 5. Encapsulate foster-parented transclusion content
20544 !!options
20545 parsoid=wt2wt,wt2html
20546 !! wikitext
20547 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
20548 !! html
20549 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20550 <table>
20551 <tr>
20552 <td>
20553 <div>
20554 <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>
20555 <table>
20556 <tbody>
20557 <tr>
20558 <td>
20559 <div>
20560 <p>foo</p></div></td></tr></tbody></table>
20561 !!end
20562
20563 !!test
20564 6. Encapsulate foster-parented transclusion content
20565 !!options
20566 parsoid=wt2wt,wt2html
20567 !! wikitext
20568 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
20569 !! html
20570 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20571 <table>
20572 <tr>
20573 <td>
20574 <div>
20575 <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>
20576 <table>
20577 <tbody>
20578 <tr>
20579 <td>
20580 <div>
20581 <p>foo</p></div></td></tr></tbody></table>
20582 <p>ok</p>
20583 !!end
20584
20585 !!test
20586 7. Encapsulate foster-parented transclusion content
20587 !!options
20588 parsoid=wt2wt,wt2html
20589 !! wikitext
20590 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
20591 !! html
20592 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20593 <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;
20594 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
20595 <td>bar</td></table>&quot;]}">foo</p>
20596 <table>
20597 <tbody>
20598 <tr>
20599 <td>bar</td></tr></tbody></table>
20600 !!end
20601
20602 !!test
20603 8. Encapsulate foster-parented transclusion content
20604 !!options
20605 parsoid=wt2wt,wt2html
20606 !! wikitext
20607 {{echo|a
20608 }}{|{{echo|style='color:red'}}
20609 |-
20610 |b
20611 |}
20612 !! html
20613 <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>
20614 <table>
20615 <tbody>
20616 <tr>
20617 <td>b</td></tr></tbody></table>
20618 !!end
20619
20620 !!test
20621 9. Encapsulate foster-parented transclusion content
20622 !!options
20623 parsoid=wt2wt,wt2html
20624 !! wikitext
20625 <table>{{echo|hi</table>hello}}
20626 !! html
20627 <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>
20628 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
20629 !!end
20630
20631 !!test
20632 Table in fosterable position
20633 !!options
20634 parsoid=wt2html,wt2wt
20635 !! wikitext
20636 {{OpenTable}}
20637 <div>
20638 {|
20639 |}
20640 </div>
20641 |}
20642 !! html
20643 <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="{}">
20644 </span>
20645 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
20646
20647 <table>
20648 </table>
20649 !!end
20650
20651 # Parsoid only for bug 64747
20652 !! test
20653 Properly encapsulate empty-content transclusions in fosterable positions
20654 !! wikitext
20655 <table>
20656 {{#if:|
20657 <td>foo</td>
20658 }}
20659 </table>
20660 !! html/parsoid
20661 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["&lt;table>\n",{"template":{"target":{"wt":"#if:","function":"#if"},"params":{"1":{"wt":"\n&lt;td>foo&lt;/td>\n"}},"i":0}},"\n&lt;/table>"]}' data-parsoid='{"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]],"src":"&lt;table>\n{{#if:|\n&lt;td>foo&lt;/td>\n}}\n&lt;/table>"}'>
20662
20663 </table>
20664 !! end
20665
20666 !!test
20667 Support <object> element with .data attribute
20668 !!options
20669 parsoid=html2wt
20670 !! wikitext
20671 <object data="test.swf"></object>
20672 !! html
20673 <object data="test.swf"></object>
20674 !!end
20675
20676 # -----------------------------------------------------------------
20677 # The following section of tests are primarily to spec requirements
20678 # around serialization of new/edited content.
20679 #
20680 # All these tests are marked Parsoid html2wt and html2html only
20681 # ----------------------------------------------------------------
20682
20683 !! test
20684 Image: Modifying size of an image (1)
20685 !! options
20686 parsoid={
20687 "modes": ["wt2wt"],
20688 "changes": [
20689 ["img[height]", "attr", "height", "22"],
20690 ["img[width]", "attr", "width", "200"]
20691 ]
20692 }
20693 !! wikitext
20694 [[Image:Foobar.jpg|230x230px]]
20695 !! wikitext/edited
20696 [[Image:Foobar.jpg|200x200px]]
20697 !!end
20698
20699 !! test
20700 Image: Modifying size of an image (2)
20701 !! options
20702 parsoid={
20703 "modes": ["wt2wt"],
20704 "changes": [
20705 ["img[height]", "attr", "height", "100"],
20706 ["img[width]", "attr", "width", "500"]
20707 ]
20708 }
20709 !! wikitext
20710 [[Image:Foobar.jpg|230x230px]]
20711 !! wikitext/edited
20712 [[Image:Foobar.jpg|500x500px]]
20713 !!end
20714
20715 # Change in size is ignored so long as class='mw-default-size'
20716 !! test
20717 Image: Modifying size of an image (3)
20718 !! options
20719 parsoid={
20720 "modes": ["wt2wt"],
20721 "changes": [
20722 ["figure[class]", "removeClass", "mw-default-size"],
20723 ["figure img", "attr", "height", "19"],
20724 ["figure img", "attr", "width", "170"]
20725 ]
20726 }
20727 !! wikitext
20728 [[Image:Foobar.jpg|thumb]]
20729 !! wikitext/edited
20730 [[Image:Foobar.jpg|thumb|170x170px]]
20731 !!end
20732
20733 !! test
20734 Image: Modifying alignment of an image (bug 48665)
20735 !! options
20736 parsoid={
20737 "modes": ["wt2wt"],
20738 "changes": [
20739 ["figure[class]", "removeClass", "mw-halign-right"],
20740 ["figure[class]", "addClass", "mw-halign-left"]
20741 ]
20742 }
20743 !! wikitext
20744 [[Image:Foobar.jpg|thumb|caption|right]]
20745 !! wikitext/edited
20746 [[Image:Foobar.jpg|thumb|caption|left]]
20747 !! end
20748
20749 !! test
20750 Image: Modifying mw-default-size of an frameless image (bug 62805)
20751 !! options
20752 parsoid={
20753 "modes": ["wt2wt"],
20754 "changes": [
20755 ["figure.mw-default-size", "removeClass", "mw-default-size"]
20756 ]
20757 }
20758 !! wikitext
20759 [[Image:Foobar.jpg|frameless|right]]
20760 !! wikitext/edited
20761 [[Image:Foobar.jpg|frameless|right|220x220px]]
20762 !! end
20763
20764 !! test
20765 Image: Modifying valign of an image (bug 49221)
20766 !! options
20767 parsoid={
20768 "modes": ["wt2wt"],
20769 "changes": [
20770 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
20771 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
20772 ]
20773 }
20774 !! wikitext
20775 [[File:Foobar.jpg|20px|middle]]
20776 !! wikitext/edited
20777 [[File:Foobar.jpg|20px|text-top]]
20778 !! end
20779
20780 !! test
20781 Image: Modifying alt attribute of an image (bug 56400)
20782 !! options
20783 parsoid={
20784 "modes": ["wt2wt"],
20785 "changes": [
20786 ["img[alt]", "attr", "alt", "some alternate edited text"]
20787 ]
20788 }
20789 !! wikitext
20790 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
20791 !! wikitext/edited
20792 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
20793 !!end
20794
20795 !! test
20796 Image: Modifying caption of an image
20797 !! options
20798 parsoid={
20799 "modes": ["wt2wt"],
20800 "changes": [
20801 ["figcaption", "text", "new caption"]
20802 ]
20803 }
20804 !! wikitext
20805 [[Image:Foobar.jpg|thumb|original caption]]
20806 !! wikitext/edited
20807 [[Image:Foobar.jpg|thumb|new caption]]
20808 !!end
20809
20810 !! test
20811 Image: empty alt attribute (bug 48924)
20812 !! options
20813 parsoid
20814 !! wikitext
20815 [[File:Foobar.jpg|thumb|alt=|bar]]
20816 !! html
20817 <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>
20818 !! end
20819
20820 #!! test
20821 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
20822 #!! options
20823 #parsoid=html2wt
20824 #language=ar
20825 #!! input
20826 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
20827 #!! result
20828 #<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>
20829 #!! end
20830
20831 !! test
20832 Image: Block level image should have \n before and after
20833 !! options
20834 parsoid
20835 !! wikitext
20836 123
20837 [[File:Foobar.jpg|right|thumb|150x150px]]
20838 456
20839 !! html
20840 <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>
20841 !!end
20842
20843 !! test
20844 Image: New block level image should have \n before and after (existing
20845 content)
20846 !! options
20847 parsoid
20848 !! wikitext
20849 123
20850 [[File:Foobar.jpg|right|thumb|150x150px]]
20851 456
20852 !! html
20853 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
20854 <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>
20855 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
20856 !!end
20857
20858 !! test
20859 Image: upright option (parsoid)
20860 !! options
20861 parsoid
20862 !! wikitext
20863 [[File:Foobar.jpg|thumb|upright|caption]]
20864 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
20865 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
20866 !! html
20867 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="19" width="170"/></a><figcaption>caption</figcaption></figure><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="12" width="110"/></a><figcaption>caption</figcaption></figure><figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="57" width="500"/></a><figcaption>caption</figcaption></figure>
20868 !!end
20869
20870 !! test
20871 Image: upright option is ignored on inline and frame images (parsoid)
20872 !! options
20873 parsoid
20874 !! wikitext
20875 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
20876 !! html
20877 <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>
20878 !!end
20879
20880 !! test
20881 Image: from basic HTML (1)
20882 !! options
20883 parsoid=html2wt
20884 !! html/parsoid
20885 <span typeof="mw:Image">
20886 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20887 </span>
20888 !! wikitext
20889 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20890 !! end
20891
20892 !! test
20893 Image: from basic HTML (2)
20894 !! options
20895 parsoid=html2wt
20896 !! html/parsoid
20897 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20898 !! wikitext
20899 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20900 !! end
20901
20902 !! test
20903 Image: from basic HTML (3)
20904 !! options
20905 parsoid=html2wt
20906 !! html/parsoid
20907 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
20908 !! wikitext
20909 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
20910 !! end
20911
20912 !! test
20913 Image: from basic HTML (4)
20914 !! options
20915 parsoid=html2wt
20916 !! html/parsoid
20917 <img src="File:Foobar.jpg">
20918 !! wikitext
20919 [[File:Foobar.jpg|link=]]
20920 !! end
20921
20922 !! test
20923 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
20924 !! options
20925 parsoid=html2wt
20926 !! wikitext
20927 * foo
20928 !! html
20929 <ul>
20930 <li><p>foo</p></li>
20931 </ul>
20932 !! end
20933
20934 !! test
20935 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
20936 !! options
20937 parsoid=html2wt
20938 !! wikitext
20939 * foo
20940 !! html
20941 <ul> <li>foo</li></ul>
20942 !! end
20943
20944 !! test
20945 Don't strip leading whitespace when handling indent-pre suppressing tags
20946 !! options
20947 parsoid=html2wt
20948 !! wikitext
20949 {|
20950 | indented row
20951 |}
20952 <blockquote>
20953 '''This is very bold of you!'''
20954
20955 {|
20956 |
20957 indented cell (no pre-wrapping!)
20958 |}
20959 </blockquote>
20960 foo
20961 <div>bar</div>
20962 !! html
20963 <table>
20964 <tr><td> indented row</td></tr>
20965 </table>
20966 <blockquote><p>
20967 <b>This is very bold of you!</b>
20968 </p>
20969 <table><tr><td>
20970 indented cell (no pre-wrapping!)
20971 </td></tr></table>
20972 </blockquote>
20973 <p>foo</p>
20974 <div>bar</div>
20975 !! end
20976
20977 !! test
20978 Strip leading whitespace when handling indent-pre inducing tags
20979 !! options
20980 parsoid=html2wt
20981 !! wikitext
20982 foo
20983 <span>bar</span>
20984
20985 <span>foo2
20986 </span>bar2
20987
20988 <div>foo</div>
20989 <span>bar</span>
20990
20991 <div>
20992 <span>foo</span>
20993 </div>
20994 !! html
20995 <p>foo</p>
20996 <span>bar</span>
20997
20998 <span>foo2
20999 </span>bar2
21000
21001 <div>foo</div>
21002 <span>bar</span>
21003
21004 <div>
21005 <span>foo</span>
21006 </div>
21007 !! end
21008
21009 !! test
21010 Lists: Add space after bullets
21011 !! options
21012 parsoid=html2wt
21013 !! wikitext
21014 * foo
21015 * bar
21016 * <span> baz</span>
21017 !! html
21018 <ul>
21019 <li>foo</li>
21020 <li> bar</li>
21021 <li><span> baz</span></li>
21022 </ul>
21023 !! end
21024
21025 !! test
21026 Lists: Dont insert newlines in a serialized list item.
21027 !! options
21028 parsoid=html2wt
21029 !! wikitext
21030 * a<br>b
21031 * c
21032 !! html
21033 <ul><li>a<br>b</li><li>c</li></ul>
21034 !! end
21035
21036 !! test
21037 Headings: Add space before/after == (Bug 51744)
21038 !! options
21039 parsoid=html2wt
21040 !! wikitext
21041 == foo ==
21042
21043 == bar ==
21044
21045 == baz ==
21046
21047 == <span> baz</span> ==
21048 !! html
21049 <h2>foo</h2>
21050 <h2> bar</h2>
21051 <h2>baz </h2>
21052 <h2><span> baz</span></h2>
21053 !! end
21054
21055 !! test
21056 Parsoid: Serialize positional parameters with = in them as named parameter
21057 !! options
21058 parsoid=html2wt
21059 !! wikitext
21060 {{echo|1 = f=oo}}
21061
21062 {{echo|1 = f=oo|2 = bar}}
21063
21064 <!--Orig params with data-parsoid has heuristics for handling = chars-->
21065 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
21066 {{echo|<nowiki>f=oo</nowiki>|bar}}
21067 !! html
21068 <p about="#mwt1" typeof="mw:Transclusion"
21069 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
21070
21071 <p about="#mwt1" typeof="mw:Transclusion"
21072 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
21073
21074 <!--Orig params with data-parsoid has heuristics for handling = chars-->
21075 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
21076 <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>
21077 !! end
21078
21079 !! test
21080 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
21081 !! options
21082 parsoid=html2wt
21083 !! wikitext
21084 <div>a
21085 b
21086 </div>
21087 <div>a
21088 b
21089 </div>
21090 <div>
21091 a
21092
21093 b
21094 </div>
21095 !! html
21096 <div>a<p>b</p></div>
21097 <div>a
21098 <p>b</p></div>
21099 <div>
21100 a
21101 <p>b</p></div>
21102 !! end
21103
21104 !! test
21105 Substrings resembling wikitext in hrefs should not get nowiki escapes
21106 !! options
21107 parsoid=html2wt
21108 !! wikitext
21109 [[Foo''bar''baz]]
21110 !! html
21111 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
21112 !! end
21113
21114 #-----------------------------
21115 # I/B quote minimization tests
21116 #-----------------------------
21117
21118 !! test
21119 1. I/B quote minimization: wikitext-only tags should be combined
21120 !! options
21121 parsoid=html2wt
21122 !! wikitext
21123 ''AB''
21124
21125 '''AB'''
21126
21127 ''A'''B'''''
21128
21129 '''A''B'''''
21130
21131 '''A''BC''D'''
21132
21133 '''''AB'''''
21134
21135 '''''AB'''''
21136
21137 '''''AB'''''
21138 !! html
21139 <p><i>A</i><i>B</i></p>
21140 <p><b>A</b><b>B</b></p>
21141 <p><i>A</i><b><i>B</i></b></p>
21142 <p><b>A</b><i><b>B</b></i></p>
21143 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
21144 <p><i><b>A</b></i><i><b>B</b></i></p>
21145 <p><i><b>A</b></i><b><i>B</i></b></p>
21146 <p><b><i>A</i></b><i><b>B</b></i></p>
21147 !! end
21148
21149 !! test
21150 2. I/B quote minimization: wikitext and html tags should not be combined
21151 !! options
21152 parsoid=html2wt
21153 !! wikitext
21154 ''A''<i>B</i>
21155
21156 ''A'''''<i>B</i>'''
21157 !! html
21158 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
21159 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
21160 !! end
21161
21162 !! test
21163 3. I/B quote minimization: templated content stops minimization
21164 !! options
21165 parsoid=html2wt
21166 !! wikitext
21167 ''A''{{echo|''B''}}
21168
21169 ''A''{{echo|'''''B'''''}}
21170 !! html
21171 <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>
21172 <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>
21173 !! end
21174
21175 !! test
21176 4. I/B quote minimization: new content should be mimimized with adjacent old content
21177 !! options
21178 parsoid=html2wt
21179 !! wikitext
21180 ''AB''
21181
21182 '''AB'''
21183
21184 ''A'''B'''''
21185 !! html
21186 <p><i>A</i><i data-parsoid='{}'>B</i></p>
21187 <p><b data-parsoid='{}'>A</b><b>B</b></p>
21188 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
21189 !! end
21190
21191 #------------------------------------
21192 # End of I/B quote minimization tests
21193 #------------------------------------
21194
21195 !!test
21196 Bug 54262: New entities
21197 !! options
21198 parsoid=html2wt
21199 !! wikitext
21200 &nbsp;
21201 !! html
21202 <span typeof="mw:Entity">&nbsp;</span>
21203 !! end
21204
21205 ## Note that there is no wikitext output for 'unknownproperty' ##
21206 ## Unknown magic words are silently dropped ##
21207
21208 !! test
21209 Magic words
21210 !! options
21211 parsoid=html2wt
21212 !! wikitext
21213 __TOC__
21214 __NOTOC__
21215 __FORCETOC__
21216 __INDEX__
21217 __NOINDEX__
21218 __NOGALLERY__
21219 __NOEDITSECTION__
21220 __NOTITLECONVERT__
21221 __NOCONTENTCONVERT__
21222 !! html
21223 <meta property='mw:PageProp/toc' />
21224 <meta property='mw:PageProp/notoc' />
21225 <meta property='mw:PageProp/forcetoc' />
21226 <meta property='mw:PageProp/index' />
21227 <meta property='mw:PageProp/noindex' />
21228 <meta property='mw:PageProp/nogallery' />
21229 <meta property='mw:PageProp/noeditsection' />
21230 <meta property='mw:PageProp/notitleconvert' />
21231 <meta property='mw:PageProp/nocontentconvert' />
21232 <meta property='mw:PageProp/unknownproperty' />
21233 !! end
21234
21235 !! test
21236 Consecutive <pre>s should not get merged
21237 !! options
21238 parsoid=html2wt,html2html
21239 !! wikitext
21240 a
21241
21242 b
21243
21244 c
21245
21246 d
21247
21248 e
21249
21250
21251
21252 f
21253 !! html
21254 <pre>a</pre><pre>b</pre>
21255
21256 <pre>c
21257 </pre><pre>
21258 d</pre>
21259
21260 <pre>e
21261
21262 </pre><pre>
21263
21264 f</pre>
21265 !! end
21266
21267 !! test
21268 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
21269 !! options
21270 parsoid=html2wt
21271 !! wikitext
21272 [[Special:BookSources/1234567890|ISBN 1234567895]]
21273 !! html
21274 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
21275 !! end
21276
21277 !! test
21278 Edited RFC links not serializable as RFC links should serialize as extlinks
21279 !! options
21280 parsoid=html2wt
21281 !! wikitext
21282 [//tools.ietf.org/html/rfc123 New RFC]
21283 !! html
21284 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
21285 !! end
21286
21287 !! test
21288 Edited PMID links not serializable as PMID links should serialize as extlinks
21289 !! options
21290 parsoid=html2wt
21291 !! wikitext
21292 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
21293 !! html
21294 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
21295 !! end
21296
21297 !! test
21298 Edited Redirect link should emit a non-piped wikitext link
21299 !! options
21300 parsoid=html2wt
21301 !! wikitext
21302 #REDIRECT [[Bar]]
21303 !! html
21304 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
21305 !! end
21306
21307 # -----------------------------------------------------------------
21308 # End of section for Parsoid-only html2wt tests for serialization
21309 # of new content
21310 # -----------------------------------------------------------------
21311
21312 TODO:
21313 more images
21314 more tables
21315 character entities
21316 and much more
21317 Try for 100% code coverage