Merge "Remove two unused constants from EditPage.php"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-specific options (not run by PHP parser unless
25 # the test includes an html/php section)
26 # php php-only test (not run by the parsoid parser unless
27 # the test includes an html/parsoid section)
28 # showtitle make the first line the title
29 # comment run through Linker::formatComment() instead of main parser
30 # local format section links in edit comment text as local links
31 # notoc disable table of contents
32 # thumbsize=NNN set the default thumb size to NNNpx for this test
33 #
34 # You can also set the following parser properties via test options:
35 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
36 # wgLinkHolderBatchSize, wgRawHtml
37 #
38 # For testing purposes, temporary articles can created:
39 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
40 # where '/' denotes a newline.
41
42 # This is the standard article assumed to exist.
43 !! article
44 Main Page
45 !! text
46 blah blah
47 !! endarticle
48
49 !!article
50 Template:Foo
51 !!text
52 FOO
53 !!endarticle
54
55 !! article
56 Template:Blank
57 !! text
58 !! endarticle
59
60 !! article
61 Template:pipe
62 !! text
63 |
64 !! endarticle
65
66 !!article
67 MediaWiki:bad image list
68 !!text
69 * [[File:Bad.jpg]] except [[Nasty page]]
70 !!endarticle
71
72 !! article
73 Template:inner list
74 !! text
75 * item 1
76 !! endarticle
77
78 !! article
79 Template:tbl-start
80 !! text
81 {|
82 !! endarticle
83
84 !! article
85 Template:tbl-end
86 !! text
87 |}
88 !! endarticle
89
90 !! article
91 Template:echo
92 !! text
93 {{{1}}}
94 !! endarticle
95
96 !! article
97 Template:echo_with_span
98 !! text
99 <span>{{{1}}}</span>
100 !! endarticle
101
102 !! article
103 Template:echo_with_div
104 !! text
105 <div>{{{1}}}</div>
106 !! endarticle
107
108 !! article
109 Template:attr_str
110 !! text
111 {{{1}}}="{{{2}}}"
112 !! endarticle
113
114 !! article
115 Template:table_attribs
116 !! text
117 <noinclude>
118 |</noinclude>style="color: red"| Foo
119 !! endarticle
120
121 !! article
122 Template:table_cells
123 !! text
124 {{table_attribs}} || Bar || Baz
125 !! endarticle
126
127 !! article
128 Template:image_attribs
129 !! text
130 <noinclude>
131 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
132 !! endarticle
133
134 !! article
135 A?b
136 !! text
137 Weirdo titles!
138 !! endarticle
139
140 !!article
141 Template:Bullet
142 !!text
143 * Bar
144 !!endarticle
145
146 !!article
147 Template:OpenTable
148 !!text
149 {|
150 !!endarticle
151
152 ###
153 ### Basic tests
154 ###
155 !! test
156 Blank input
157 !! wikitext
158 !! html
159 !! end
160
161
162 !! test
163 Simple paragraph
164 !! wikitext
165 This is a simple paragraph.
166 !! html
167 <p>This is a simple paragraph.
168 </p>
169 !! end
170
171 !! test
172 Paragraphs with extra newline spacing
173 !! wikitext
174 foo
175
176 bar
177
178
179 baz
180
181
182
183 booz
184 !! html
185 <p>foo
186 </p><p>bar
187 </p><p><br />
188 baz
189 </p><p><br />
190 </p><p>booz
191 </p>
192 !! end
193
194 !! test
195 Paragraphs with newline spacing with comment lines in between
196 !! wikitext
197 ----
198 a
199 <!--foo-->
200 b
201 ----
202 a
203 <!--foo--><!--More than 1 comment, still stripped-->
204 b
205 ----
206 a
207 <!--foo--> <!----> <!-- bar -->
208 b
209 ----
210 a
211 <!--foo-->
212
213 b
214 ----
215 a
216
217 <!--foo-->
218 b
219 ----
220 a
221 <!--foo-->
222
223
224 b
225 ----
226 a
227
228
229 <!--foo-->
230 b
231 ----
232 !! html
233 <hr />
234 <p>a
235 b
236 </p>
237 <hr />
238 <p>a
239 b
240 </p>
241 <hr />
242 <p>a
243 b
244 </p>
245 <hr />
246 <p>a
247 </p><p>b
248 </p>
249 <hr />
250 <p>a
251 </p><p>b
252 </p>
253 <hr />
254 <p>a
255 </p><p><br />
256 b
257 </p>
258 <hr />
259 <p>a
260 </p><p><br />
261 b
262 </p>
263 <hr />
264
265 !! end
266
267 !! test
268 Paragraphs with newline spacing with non-empty white-space lines in between
269 !! wikitext
270 ----
271 a
272
273 b
274 ----
275 a
276
277
278 b
279 ----
280 !! html
281 <hr />
282 <p>a
283 </p><p>b
284 </p>
285 <hr />
286 <p>a
287 </p><p><br />
288 b
289 </p>
290 <hr />
291
292 !! end
293
294 !! test
295 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
296 !! wikitext
297 ----
298 a
299 <!--foo-->
300 b
301 ----
302 a
303 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
304 b
305 ----
306 a
307
308 <!--foo-->
309 <!--bar-->
310 b
311 ----
312 a
313
314 <!--foo-->
315 <!--bar-->
316
317 b
318 ----
319 !! html
320 <hr />
321 <p>a
322 b
323 </p>
324 <hr />
325 <p>a
326 b
327 </p>
328 <hr />
329 <p>a
330 </p><p>b
331 </p>
332 <hr />
333 <p>a
334 </p><p><br />
335 b
336 </p>
337 <hr />
338
339 !! end
340
341 !! test
342 Extra newlines: More paragraphs with indented comment
343 !! wikitext
344 a
345
346 <!--boo-->
347
348 b
349 !! html
350 <p>a
351 </p><p><br />
352 b
353 </p>
354 !!end
355
356 !! test
357 Extra newlines followed by heading
358 !! wikitext
359 a
360
361
362
363 =b=
364 [[a]]
365
366
367 =b=
368 !! html
369 <p>a
370 </p><p><br />
371 </p>
372 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
373 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
374 </p><p><br />
375 </p>
376 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
377
378 !! end
379
380 !! test
381 Extra newlines between heading and content are swallowed
382 !! wikitext
383 =b=
384
385
386
387 [[a]]
388 !! html
389 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
390 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
391 </p>
392 !! end
393
394 !! test
395 Parsing an URL
396 !! wikitext
397 http://fr.wikipedia.org/wiki/🍺
398 <!-- EasterEgg we love beer, better be able be able to link to it -->
399 !! html
400 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
401 </p>
402 !! end
403
404 !! test
405 Simple list
406 !! wikitext
407 * Item 1
408 * Item 2
409 !! html
410 <ul><li> Item 1</li>
411 <li> Item 2</li></ul>
412
413 !! end
414
415 !! test
416 Italics and bold
417 !! wikitext
418 * plain
419 * plain''italic''plain
420 * plain''italic''plain''italic''plain
421 * plain'''bold'''plain
422 * plain'''bold'''plain'''bold'''plain
423 * plain''italic''plain'''bold'''plain
424 * plain'''bold'''plain''italic''plain
425 * plain''italic'''bold-italic'''italic''plain
426 * plain'''bold''bold-italic''bold'''plain
427 * plain'''''bold-italic'''italic''plain
428 * plain'''''bold-italic''bold'''plain
429 * plain''italic'''bold-italic'''''plain
430 * plain'''bold''bold-italic'''''plain
431 * plain l'''italic''plain
432 * plain l''''bold''' plain
433 !! html
434 <ul><li> plain</li>
435 <li> plain<i>italic</i>plain</li>
436 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
437 <li> plain<b>bold</b>plain</li>
438 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
439 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
440 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
441 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
442 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
443 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
444 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
445 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
446 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
447 <li> plain l'<i>italic</i>plain</li>
448 <li> plain l'<b>bold</b> plain</li></ul>
449
450 !! end
451
452 # this example taken from the [[simple:Moon]] article (bug 47326)
453 !! test
454 Italics and possessives (1)
455 !! wikitext
456 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
457 !! html
458 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
459 </p>
460 !! end
461
462 # this example taken from [[en:Flaming Pie]] (bug 49926)
463 !! test
464 Italics and possessives (2)
465 !! wikitext
466 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
467 !! html
468 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
469 </p>
470 !! end
471
472 # this example taken from [[en:Dictionary]] (bug 49926)
473 !! test
474 Italics and possessives (3)
475 !! wikitext
476 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
477 !! html
478 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
479 </p>
480 !! end
481
482
483 ###
484 ### 2-quote opening sequence tests
485 ###
486 !! test
487 Italics and bold: 2-quote opening sequence: (2,2)
488 !! wikitext
489 ''foo''
490 !! html
491 <p><i>foo</i>
492 </p>
493 !!end
494
495
496 !! test
497 Italics and bold: 2-quote opening sequence: (2,3)
498 !! options
499 parsoid=wt2html
500 !! wikitext
501 ''foo'''
502 !! html/*
503 <p><i>foo'</i>
504 </p>
505 !!end
506
507
508 # same html as previous, but wikitext adjusted to match parsoid html2wt
509 !! test
510 Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki
511 !! wikitext
512 ''<nowiki>foo'</nowiki>''
513 !! html
514 <p><i>foo'</i>
515 </p>
516 !! end
517
518
519 !! test
520 Italics and bold: 2-quote opening sequence: (2,4)
521 !! options
522 parsoid=wt2html
523 !! wikitext
524 ''foo''''
525 !! html/*
526 <p><i>foo''</i>
527 </p>
528 !!end
529
530
531 # same html as previous, but wikitext adjusted to match parsoid html2wt
532 !! test
533 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
534 !! wikitext
535 ''<nowiki>foo''</nowiki>''
536 !! html
537 <p><i>foo''</i>
538 </p>
539 !! end
540
541
542 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
543 !! test
544 Italics and bold: 2-quote opening sequence: (2,5)
545 !! options
546 parsoid=wt2html
547 !! wikitext
548 ''foo'''''
549 !! html/php
550 <p><i>foo</i>
551 </p>
552 !! html/parsoid
553 <p><i>foo</i><b></b>
554 </p>
555 !!end
556
557 # same html as previous, but wikitext adjusted to match parsoid html2wt
558 !! test
559 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
560 !! wikitext
561 ''foo'''''<nowiki/>'''
562 !! html/php
563 <p><i>foo</i>
564 </p>
565 !! html/parsoid
566 <p><i>foo</i><b></b>
567 </p>
568 !! end
569
570
571 ###
572 ### 3-quote opening sequence tests
573 ###
574
575 !! test
576 Italics and bold: 3-quote opening sequence: (3,2)
577 !! wikitext
578 '''foo''
579 !! html
580 <p>'<i>foo</i>
581 </p>
582 !!end
583
584
585 !! test
586 Italics and bold: 3-quote opening sequence: (3,3)
587 !! wikitext
588 '''foo'''
589 !! html
590 <p><b>foo</b>
591 </p>
592 !!end
593
594
595 !! test
596 Italics and bold: 3-quote opening sequence: (3,4)
597 !! options
598 parsoid=wt2html
599 !! wikitext
600 '''foo''''
601 !! html/*
602 <p><b>foo'</b>
603 </p>
604 !!end
605
606
607 # same html as previous, but wikitext adjusted to match parsoid html2wt
608 !! test
609 Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki
610 !! wikitext
611 '''<nowiki>foo'</nowiki>'''
612 !! html
613 <p><b>foo'</b>
614 </p>
615 !! end
616
617
618 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
619 !! test
620 Italics and bold: 3-quote opening sequence: (3,5)
621 !! options
622 parsoid=wt2html
623 !! wikitext
624 '''foo'''''
625 !! html/php
626 <p><b>foo</b>
627 </p>
628 !! html/parsoid
629 <p><b>foo</b><i></i>
630 </p>
631 !!end
632
633 # same html as previous, but wikitext adjusted to match parsoid html2wt
634 !! test
635 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
636 !! wikitext
637 '''foo'''''<nowiki/>''
638 !! html/php
639 <p><b>foo</b>
640 </p>
641 !! html/parsoid
642 <p><b>foo</b><i></i>
643 </p>
644 !! end
645
646
647 ###
648 ### 4-quote opening sequence tests
649 ###
650
651 !! test
652 Italics and bold: 4-quote opening sequence: (4,2)
653 !! options
654 parsoid=wt2html
655 !! wikitext
656 ''''foo''
657 !! html/*
658 <p>''<i>foo</i>
659 </p>
660 !!end
661
662
663 # same html as previous, but wikitext adjusted to match parsoid html2wt
664 !! test
665 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
666 !! wikitext
667 <nowiki>''</nowiki>''foo''
668 !! html
669 <p>''<i>foo</i>
670 </p>
671 !! end
672
673
674 !! test
675 Italics and bold: 4-quote opening sequence: (4,3)
676 !! wikitext
677 ''''foo'''
678 !! html
679 <p>'<b>foo</b>
680 </p>
681 !!end
682
683
684 !! test
685 Italics and bold: 4-quote opening sequence: (4,4)
686 !! options
687 parsoid=wt2html
688 !! wikitext
689 ''''foo''''
690 !! html/*
691 <p>'<b>foo'</b>
692 </p>
693 !!end
694
695
696 # same html as previous, but wikitext adjusted to match parsoid html2wt
697 !! test
698 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
699 !! wikitext
700 ''''<nowiki>foo'</nowiki>'''
701 !! html
702 <p>'<b>foo'</b>
703 </p>
704 !! end
705
706
707 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
708 !! test
709 Italics and bold: 4-quote opening sequence: (4,5)
710 !! options
711 parsoid=wt2html
712 !! wikitext
713 ''''foo'''''
714 !! html/php
715 <p>'<b>foo</b>
716 </p>
717 !! html/parsoid
718 <p>'<b>foo</b><i></i>
719 </p>
720 !!end
721
722 # same html as previous, but wikitext adjusted to match parsoid html2wt
723 !! test
724 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
725 !! wikitext
726 ''''foo'''''<nowiki/>''
727 !! html/php
728 <p>'<b>foo</b>
729 </p>
730 !! html/parsoid
731 <p>'<b>foo</b><i></i>
732 </p>
733 !! end
734
735
736 ###
737 ### 5-quote opening sequence tests
738 ###
739
740 !! test
741 Italics and bold: 5-quote opening sequence: (5,2)
742 !! options
743 parsoid=wt2html
744 !! wikitext
745 '''''foo''
746 !! html/*
747 <p><b><i>foo</i></b>
748 </p>
749 !!end
750
751
752 # same html as previous, but wikitext adjusted to match parsoid html2wt
753 # skipping wt2html and html2html because it wants to put <i> before <b>
754 !! test
755 Italics and bold: 5-quote opening sequence: (5,2+3)
756 !! options
757 parsoid=wt2wt,html2wt
758 !! wikitext
759 '''''foo'''''
760 !! html/*
761 <p><b><i>foo</i></b>
762 </p>
763 !! end
764
765 !! test
766 Italics and bold: 5-quote opening sequence: (5,3)
767 !! options
768 parsoid=wt2html
769 !! wikitext
770 '''''foo'''
771 !! html/*
772 <p><i><b>foo</b></i>
773 </p>
774 !!end
775
776
777 # same html as previous, but wikitext adjusted to match parsoid html2wt
778 !! test
779 Italics and bold: 5-quote opening sequence: (5,3+2)
780 !! wikitext
781 '''''foo'''''
782 !! html
783 <p><i><b>foo</b></i>
784 </p>
785 !! end
786
787
788 !! test
789 Italics and bold: 5-quote opening sequence: (5,4)
790 !! options
791 parsoid=wt2html
792 !! wikitext
793 '''''foo''''
794 !! html/*
795 <p><i><b>foo'</b></i>
796 </p>
797 !!end
798
799
800 # same html as previous, but wikitext adjusted to match parsoid html2wt
801 !! test
802 Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki
803 !! wikitext
804 '''''<nowiki>foo'</nowiki>'''''
805 !! html
806 <p><i><b>foo'</b></i>
807 </p>
808 !! end
809
810
811 !! test
812 Italics and bold: 5-quote opening sequence: (5,5)
813 !! wikitext
814 '''''foo'''''
815 !! html
816 <p><i><b>foo</b></i>
817 </p>
818 !!end
819
820 ###
821 ### multiple quote sequences in a line
822 ###
823 !! test
824 Italics and bold: multiple quote sequences: (2,4,2)
825 !! options
826 parsoid=wt2html
827 !! wikitext
828 ''foo''''bar''
829 !! html/*
830 <p><i>foo'<b>bar</b></i>
831 </p>
832 !!end
833
834
835 # same html as previous, but wikitext adjusted to match parsoid html2wt
836 !! test
837 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
838 !! wikitext
839 ''<nowiki>foo'</nowiki>'''bar'''''
840 !! html
841 <p><i>foo'<b>bar</b></i>
842 </p>
843 !! end
844
845
846 !! test
847 Italics and bold: multiple quote sequences: (2,4,3)
848 !! options
849 parsoid=wt2html
850 !! wikitext
851 ''foo''''bar'''
852 !! html/*
853 <p><i>foo'<b>bar</b></i>
854 </p>
855 !!end
856
857
858 # same html as previous, but wikitext adjusted to match parsoid html2wt
859 !! test
860 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
861 !! wikitext
862 ''<nowiki>foo'</nowiki>'''bar'''''
863 !! html
864 <p><i>foo'<b>bar</b></i>
865 </p>
866 !! end
867
868
869 !! test
870 Italics and bold: multiple quote sequences: (2,4,4)
871 !! options
872 parsoid=wt2html
873 !! wikitext
874 ''foo''''bar''''
875 !! html/*
876 <p><i>foo'<b>bar'</b></i>
877 </p>
878 !!end
879
880
881 # same html as previous, but wikitext adjusted to match parsoid html2wt
882 !! test
883 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
884 !! wikitext
885 ''<nowiki>foo'</nowiki>'''<nowiki>bar'</nowiki>'''''
886 !! html
887 <p><i>foo'<b>bar'</b></i>
888 </p>
889 !! end
890
891
892 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
893 !! test
894 Italics and bold: multiple quote sequences: (3,4,2)
895 !! options
896 parsoid=wt2html
897 !! wikitext
898 '''foo''''bar''
899 !! html/php
900 <p><b>foo'</b>bar
901 </p>
902 !! html/parsoid
903 <p><b>foo'</b>bar<i></i>
904 </p>
905 !!end
906
907 # same html as previous, but wikitext adjusted to match parsoid html2wt
908 !! test
909 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
910 !! options
911 parsoid
912 !! wikitext
913 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
914 !! html/php
915 <p><b>foo'</b>bar
916 </p>
917 !! html/parsoid
918 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
919 </p>
920 !! end
921
922
923 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
924 !! test
925 Italics and bold: multiple quote sequences: (3,4,3)
926 !! options
927 parsoid=wt2html
928 !! wikitext
929 '''foo''''bar'''
930 !! html/php
931 <p><b>foo'</b>bar
932 </p>
933 !! html/parsoid
934 <p><b>foo'</b>bar<b></b>
935 </p>
936 !!end
937
938 # same html as previous, but wikitext adjusted to match parsoid html2wt
939 !! test
940 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
941 !! wikitext
942 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
943 !! html/php
944 <p><b>foo'</b>bar
945 </p>
946 !! html/parsoid
947 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
948 </p>
949 !! end
950
951 ###
952 ### other quote tests
953 ###
954 !! test
955 Italics and bold: other quote tests: (2,3,5)
956 !! wikitext
957 ''this is about '''foo's family'''''
958 !! html
959 <p><i>this is about <b>foo's family</b></i>
960 </p>
961 !!end
962
963
964 !! test
965 Italics and bold: other quote tests: (2,(3,3),2)
966 !! wikitext
967 ''this is about '''foo's''' family''
968 !! html
969 <p><i>this is about <b>foo's</b> family</i>
970 </p>
971 !!end
972
973
974 !! test
975 Italics and bold: other quote tests: (3,2,3,2)
976 !! options
977 parsoid=wt2html
978 !! wikitext
979 '''this is about ''foo'''s family''
980 !! html/*
981 <p><b>this is about <i>foo</i></b><i>s family</i>
982 </p>
983 !!end
984
985
986 # same html as previous, but wikitext adjusted to match parsoid html2wt
987 # add 'parsoid' option to use 'parsoid' normalization of the placeholder
988 !! test
989 Italics and bold: other quote tests: (3,2,3+2+2,2)
990 !! options
991 parsoid
992 !! wikitext
993 '''this is about ''foo'''''<nowiki/>''s family''
994 !! html/*
995 <p><b>this is about <i>foo</i></b><i>s family</i>
996 </p>
997 !! end
998
999
1000 !! test
1001 Italics and bold: other quote tests: (3,2,3,3)
1002 !! options
1003 !! wikitext
1004 '''this is about ''foo'''s family'''
1005 !! html
1006 <p>'<i>this is about </i>foo<b>s family</b>
1007 </p>
1008 !!end
1009
1010
1011 !! test
1012 Italics and bold: other quote tests: (3,(2,2),3)
1013 !! wikitext
1014 '''this is about ''foo's'' family'''
1015 !! html
1016 <p><b>this is about <i>foo's</i> family</b>
1017 </p>
1018 !!end
1019
1020
1021 !! test
1022 Italicized possessive
1023 !! wikitext
1024 The ''[[Main Page]]'''s talk page.
1025 !! html
1026 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1027 </p>
1028 !! end
1029
1030 !! test
1031 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1032 (Requires tidy for PHP parser output to be fixed up)
1033 !! options
1034 parsoid=wt2html,wt2wt
1035 !! wikitext
1036 {|
1037 !''a!!''b
1038 |''a||''b
1039 |}
1040 !! html
1041 <table>
1042 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1043 <td><i>a</i></td><td><i>b</i></td></tr>
1044 </tbody></table>
1045 !! end
1046
1047 ###
1048 ### Non-html5 tags
1049 ###
1050
1051 !! test
1052 Non-html5 tags should be accepted
1053 !! wikitext
1054 <center>''foo''</center>
1055 <big>''foo''</big>
1056 <font>''foo''</font>
1057 <strike>''foo''</strike>
1058 <tt>''foo''</tt>
1059 !! html
1060 <center><i>foo</i></center>
1061 <p><big><i>foo</i></big>
1062 <font><i>foo</i></font>
1063 <strike><i>foo</i></strike>
1064 <tt><i>foo</i></tt>
1065 </p>
1066 !! end
1067
1068 !! test
1069 <wbr> is valid wikitext (bug 52468)
1070 !! wikitext
1071 <wbr>
1072 !! html
1073 <p><wbr />
1074 </p>
1075 !! end
1076
1077 # <strike> is HTML4, <s> is HTML4/5.
1078 !! test
1079 <s> or <strike> for strikethrough
1080 !! wikitext
1081 <strike>strike</strike>
1082
1083 <s>s</s>
1084 !! html
1085 <p><strike>strike</strike>
1086 </p><p><s>s</s>
1087 </p>
1088 !! end
1089
1090 ## a not permitted
1091 ## i,b,br omitted
1092 !! test
1093 Text-level semantic html elements in wikitext
1094 !! wikitext
1095 <em>text</em>
1096 <strong>text</strong>
1097 <small>text</small>
1098 <s>text</s>
1099 <cite>text</cite>
1100 <q>text</q>
1101 <dfn>text</dfn>
1102 <abbr>text</abbr>
1103 <data>text</data>
1104 <time>text</time>
1105 <code>text</code>
1106 <var>text</var>
1107 <samp>text</samp>
1108 <kbd>text</kbd>
1109 <sub>text</sub>
1110 <u>text</u>
1111 <mark>text</mark>
1112 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1113 <bdi>text</bdi>
1114 <bdo>text</bdo>
1115 <span>text</span>
1116 <wbr />
1117 !! html
1118 <p><em>text</em>
1119 <strong>text</strong>
1120 <small>text</small>
1121 <s>text</s>
1122 <cite>text</cite>
1123 <q>text</q>
1124 <dfn>text</dfn>
1125 <abbr>text</abbr>
1126 <data>text</data>
1127 <time>text</time>
1128 <code>text</code>
1129 <var>text</var>
1130 <samp>text</samp>
1131 <kbd>text</kbd>
1132 <sub>text</sub>
1133 <u>text</u>
1134 <mark>text</mark>
1135 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1136 <bdi>text</bdi>
1137 <bdo>text</bdo>
1138 <span>text</span>
1139 <wbr />
1140 </p>
1141 !! end
1142
1143 # test cases taken from
1144 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1145 !! test
1146 Ruby markup (W3C-style)
1147 !! wikitext
1148 ; Mono-ruby for individual base characters
1149 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1150 ; Group ruby
1151 : <ruby>今日<rt>きょう</rt></ruby>
1152 ; Jukugo ruby
1153 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1154 ; Inline ruby
1155 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1156 ; Double-sided ruby
1157 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1158 <ruby>
1159 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1160 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1161 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1162 </ruby>
1163 !! html
1164 <dl><dt> Mono-ruby for individual base characters</dt>
1165 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1166 <dt> Group ruby</dt>
1167 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1168 <dt> Jukugo ruby</dt>
1169 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1170 <dt> Inline ruby</dt>
1171 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1172 <dt> Double-sided ruby</dt>
1173 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1174 <p><ruby>
1175 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1176 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1177 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1178 </ruby>
1179 </p>
1180 !! end
1181
1182 !! test
1183 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1184 !! wikitext
1185 <b→> doesn't work! </b→>
1186
1187 <bä> doesn't work! </bä>
1188
1189 <boo> works fine </boo>
1190
1191 <s.foo>s.foo</s.foo>
1192
1193 <sub-ID#1>
1194 !! html
1195 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1196 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1197 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1198 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1199 </p><p>&lt;sub-ID#1&gt;
1200 </p>
1201 !! end
1202
1203 !! test
1204 Isolated close tags should be treated as literal text (bug 52760)
1205 !! wikitext
1206 </b>
1207
1208 <s.foo>s</s>
1209 !! html
1210 <p>&lt;/b&gt;
1211 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1212 </p>
1213 !! end
1214
1215 ###
1216 ### Special characters
1217 ###
1218
1219 !! test
1220 Bare pipe character (bug 52363)
1221 !! wikitext
1222 |
1223 !! html
1224 <p>|
1225 </p>
1226 !! end
1227
1228 !! test
1229 Bare pipe character from a template (bug 52363)
1230 !! wikitext
1231 {{pipe}}
1232 !! html
1233 <p>|
1234 </p>
1235 !! end
1236
1237 ###
1238 ### <nowiki> test cases
1239 ###
1240
1241 !! test
1242 <nowiki> unordered list
1243 !! wikitext
1244 <nowiki>* This is not an unordered list item.</nowiki>
1245 !! html
1246 <p>* This is not an unordered list item.
1247 </p>
1248 !! end
1249
1250 !! test
1251 <nowiki> spacing
1252 !! wikitext
1253 <nowiki>Lorem ipsum dolor
1254
1255 sed abit.
1256 sed nullum.
1257
1258 :and a colon
1259 </nowiki>
1260 !! html
1261 <p>Lorem ipsum dolor
1262
1263 sed abit.
1264 sed nullum.
1265
1266 :and a colon
1267
1268 </p>
1269 !! end
1270
1271 !! test
1272 nowiki 3
1273 !! wikitext
1274 :There is not nowiki.
1275 :There is <nowiki>nowiki</nowiki>.
1276
1277 #There is not nowiki.
1278 #There is <nowiki>nowiki</nowiki>.
1279
1280 *There is not nowiki.
1281 *There is <nowiki>nowiki</nowiki>.
1282 !! html
1283 <dl><dd>There is not nowiki.</dd>
1284 <dd>There is nowiki.</dd></dl>
1285 <ol><li>There is not nowiki.</li>
1286 <li>There is nowiki.</li></ol>
1287 <ul><li>There is not nowiki.</li>
1288 <li>There is nowiki.</li></ul>
1289
1290 !! end
1291
1292 !! test
1293 Entities inside <nowiki>
1294 !! wikitext
1295 <nowiki>&lt;</nowiki>
1296 !! html
1297 <p>&lt;
1298 </p>
1299 !! end
1300
1301 !! test
1302 Entities inside template parameters
1303 !! options
1304 parsoid
1305 !! wikitext
1306 {{echo|&ndash;}}
1307 !! html
1308 <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>
1309 </p>
1310 !! end
1311
1312 !! test
1313 Properly escape nowiki when combined with other wiki markup
1314 !! options
1315 parsoid=html2wt
1316 !! wikitext
1317 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1318 !! html
1319 <p>* &lt;/nowiki&gt; tag</p>
1320 !! end
1321
1322 ###
1323 ### Comments
1324 ###
1325 !! test
1326 Comments and Indent-Pre
1327 !! wikitext
1328 <!-- comment 1 --> asdf
1329
1330 <!-- comment 1 --> asdf
1331 <!-- comment 2 -->
1332
1333 <!-- comment 1 --> asdf
1334 <!-- comment 2 -->xyz
1335
1336 <!-- comment 1 --> asdf
1337 <!-- comment 2 --> xyz
1338 !! html
1339 <pre>asdf
1340 </pre>
1341 <pre>asdf
1342 </pre>
1343 <pre>asdf
1344 </pre>
1345 <p>xyz
1346 </p>
1347 <pre>asdf
1348 xyz
1349 </pre>
1350 !! end
1351
1352 !! test
1353 Comment test 2a
1354 !! wikitext
1355 asdf
1356 <!-- comment 1 -->
1357 jkl
1358 !! html
1359 <p>asdf
1360 jkl
1361 </p>
1362 !! end
1363
1364 !! test
1365 Comment test 2b
1366 !! wikitext
1367 asdf
1368 <!-- comment 1 -->
1369
1370 jkl
1371 !! html
1372 <p>asdf
1373 </p><p>jkl
1374 </p>
1375 !! end
1376
1377 !! test
1378 Comment test 3
1379 !! wikitext
1380 asdf
1381 <!-- comment 1 -->
1382 <!-- comment 2 -->
1383 jkl
1384 !! html
1385 <p>asdf
1386 jkl
1387 </p>
1388 !! end
1389
1390 !! test
1391 Comment test 4
1392 !! wikitext
1393 asdf<!-- comment 1 -->jkl
1394 !! html
1395 <p>asdfjkl
1396 </p>
1397 !! end
1398
1399 !! test
1400 Comment spacing
1401 !! wikitext
1402 a
1403 <!-- foo --> b <!-- bar -->
1404 c
1405 !! html
1406 <p>a
1407 </p>
1408 <pre> b
1409 </pre>
1410 <p>c
1411 </p>
1412 !! end
1413
1414 !! test
1415 Comment whitespace
1416 !! wikitext
1417 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1418 !! html
1419
1420 !! end
1421
1422 !! test
1423 Comment semantics and delimiters
1424 !! wikitext
1425 <!-- --><!----><!-----><!------>
1426 !! html
1427
1428 !! end
1429
1430 !! test
1431 Comment semantics and delimiters, redux
1432 !! wikitext
1433 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1434 -- foo -- funky huh? ... -->
1435 !! html
1436
1437 !! end
1438
1439 !! test
1440 Comment semantics and delimiters: directors cut
1441 !! wikitext
1442 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1443 everything starting with < followed by !-- until the first -- and > we see,
1444 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1445 -->-->
1446 !! html
1447 <p>--&gt;
1448 </p>
1449 !! end
1450
1451 !! test
1452 Comment semantics: nesting
1453 !! wikitext
1454 <!--<!-- no, we're not going to do anything fancy here -->-->
1455 !! html
1456 <p>--&gt;
1457 </p>
1458 !! end
1459
1460 !! test
1461 Comment semantics: unclosed comment at end
1462 !! wikitext
1463 <!--This comment will run out to the end of the document
1464 !! html
1465
1466 !! end
1467
1468 !! test
1469 Comment in template title
1470 !! wikitext
1471 {{f<!---->oo}}
1472 !! html
1473 <p>FOO
1474 </p>
1475 !! end
1476
1477 !! test
1478 Comment on its own line post-expand
1479 !! wikitext
1480 a
1481 {{blank}}<!---->
1482 b
1483 !! html
1484 <p>a
1485 </p><p>b
1486 </p>
1487 !! end
1488
1489 !! test
1490 Comment on its own line post-expand with non-significant whitespace
1491 !! wikitext
1492 a
1493 {{blank}} <!---->
1494 b
1495 !! html
1496 <p>a
1497 </p><p>b
1498 </p>
1499 !! end
1500
1501 !! test
1502 Multiple comments should still parse as SOL-transparent
1503 !! options
1504 parsoid=wt2html,wt2wt
1505 !! wikitext
1506 <!--c1-->*a
1507 <!--c2--><!--c3--><!--c4-->*b
1508 !! html
1509 <ul>
1510 <li>a
1511 </li>
1512 <li>b
1513 </li>
1514 </ul>
1515 !! end
1516
1517 ###
1518 ### paragraph wrapping tests
1519 ###
1520 !! test
1521 No block tags
1522 !! wikitext
1523 a
1524
1525 b
1526 !! html
1527 <p>a
1528 </p><p>b
1529 </p>
1530 !! end
1531
1532 !! test
1533 Block tag on one line (<div>)
1534 !! wikitext
1535 a <div>foo</div>
1536
1537 b
1538 !! html
1539 a <div>foo</div>
1540 <p>b
1541 </p>
1542 !! end
1543
1544 !! test
1545 Block tag on one line (<blockquote>)
1546 !! wikitext
1547 a <blockquote>foo</blockquote>
1548
1549 b
1550 !! html
1551 a <blockquote>foo</blockquote>
1552 <p>b
1553 </p>
1554 !! end
1555
1556 !! test
1557 Block tag on both lines (<div>)
1558 !! wikitext
1559 a <div>foo</div>
1560
1561 b <div>foo</div>
1562 !! html
1563 a <div>foo</div>
1564 b <div>foo</div>
1565
1566 !! end
1567
1568 !! test
1569 Block tag on both lines (<blockquote>)
1570 !! wikitext
1571 a <blockquote>foo</blockquote>
1572
1573 b <blockquote>foo</blockquote>
1574 !! html
1575 a <blockquote>foo</blockquote>
1576 b <blockquote>foo</blockquote>
1577
1578 !! end
1579
1580 !! test
1581 Multiple lines without block tags
1582 !! wikitext
1583 <div>foo</div> a
1584 b
1585 c
1586 d<!--foo--> e
1587 x <div>foo</div> z
1588 !! html
1589 <div>foo</div> a
1590 <p>b
1591 c
1592 d e
1593 </p>
1594 x <div>foo</div> z
1595
1596 !! end
1597
1598 !! test
1599 Empty lines between lines with block tags
1600 !! wikitext
1601 <div></div>
1602
1603
1604 <div></div>a
1605
1606 b
1607 <div>a</div>b
1608
1609 <div>b</div>d
1610
1611
1612 <div>e</div>
1613 !! html
1614 <div></div>
1615 <p><br />
1616 </p>
1617 <div></div>a
1618 <p>b
1619 </p>
1620 <div>a</div>b
1621 <div>b</div>d
1622 <p><br />
1623 </p>
1624 <div>e</div>
1625
1626 !! end
1627
1628 ## PHP parser emits output which is broken
1629 !! test
1630 Unclosed HTML p-tags should be handled properly
1631 !! wikitext
1632 <div><p>foo</div>
1633 a
1634
1635 b
1636 !! html/parsoid
1637 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1638 <p>a</p>
1639 <p>b</p>
1640 !! end
1641
1642 ###
1643 ### Preformatted text
1644 ###
1645 !! test
1646 Preformatted text
1647 !! wikitext
1648 This is some
1649 Preformatted text
1650 With ''italic''
1651 And '''bold'''
1652 And a [[Main Page|link]]
1653 !! html
1654 <pre>This is some
1655 Preformatted text
1656 With <i>italic</i>
1657 And <b>bold</b>
1658 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1659 </pre>
1660 !! end
1661
1662 !! test
1663 Tabs don't trigger preformatted text
1664 !! wikitext
1665 This is not
1666 preformatted text.
1667 This is preformatted text.
1668 So is this.
1669 !! html
1670 <p> This is not
1671 preformatted text.
1672 </p>
1673 <pre>This is preformatted text.
1674 So is this.
1675 </pre>
1676 !! end
1677
1678 !! test
1679 Ident preformatting with inline content
1680 !! wikitext
1681 a
1682 ''b''
1683 !! html
1684 <pre>a
1685 <i>b</i>
1686 </pre>
1687 !! end
1688
1689 !! test
1690 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1691 !! wikitext
1692 <pre><nowiki>
1693 <b>
1694 <cite>
1695 <em>
1696 </nowiki></pre>
1697 !! html
1698 <pre>
1699 &lt;b&gt;
1700 &lt;cite&gt;
1701 &lt;em&gt;
1702 </pre>
1703
1704 !! end
1705
1706 !! test
1707 Regression with preformatted in <center>
1708 !! wikitext
1709 <center>
1710 Blah
1711 </center>
1712 !! html
1713 <center>
1714 <pre>Blah
1715 </pre>
1716 </center>
1717
1718 !! end
1719
1720 !! test
1721 Bug 52763: Preformatted in <blockquote>
1722 !! wikitext
1723 <blockquote>
1724 Blah
1725 {|
1726 |
1727 indented cell (no pre-wrapping!)
1728 |}
1729 </blockquote>
1730 !! html
1731 <blockquote>
1732 <p> Blah
1733 </p>
1734 <table>
1735 <tr>
1736 <td>
1737 <p> indented cell (no pre-wrapping!)
1738 </p>
1739 </td></tr></table>
1740 </blockquote>
1741
1742 !! end
1743
1744 !! test
1745 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1746 !! wikitext
1747 <blockquote>
1748 Foo
1749
1750 Bar
1751 </blockquote>
1752 !! html
1753 <blockquote>
1754 <p>Foo
1755 </p><p>Bar
1756 </p>
1757 </blockquote>
1758
1759 !! end
1760
1761 !! test
1762 Bug 15491: <ins>/<del> in blockquote
1763 !! wikitext
1764 <blockquote>
1765 Foo <del>bar</del> <ins>baz</ins> quux
1766 </blockquote>
1767 !! html
1768 <blockquote>
1769 <p>Foo <del>bar</del> <ins>baz</ins> quux
1770 </p>
1771 </blockquote>
1772
1773 !! end
1774
1775 # Note that the p-wrapping is newline sensitive, which could be
1776 # considered a bug: tidy will wrap only the 'Foo' in the example
1777 # below in a <p> tag. (see comment 23-25 of bug #6200)
1778 !! test
1779 Bug 15491: <ins>/<del> in blockquote (2)
1780 !! wikitext
1781 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1782 </blockquote>
1783 !! html
1784 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1785 </blockquote>
1786
1787 !! end
1788
1789 !! test
1790 <pre> with attributes (bug 3202)
1791 !! wikitext
1792 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1793 !! html
1794 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1795
1796 !! end
1797
1798 !! test
1799 <pre> with width attribute (bug 3202)
1800 !! wikitext
1801 <pre width="8">Narrow screen goodies</pre>
1802 !! html
1803 <pre width="8">Narrow screen goodies</pre>
1804
1805 !! end
1806
1807 !! test
1808 <pre> with forbidden attribute (bug 3202)
1809 !! wikitext
1810 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1811 !! html
1812 <pre width="8">Narrow screen goodies</pre>
1813
1814 !! end
1815
1816 !! test
1817 Entities inside <pre>
1818 !! wikitext
1819 <pre>&lt;</pre>
1820 !! html
1821 <pre>&lt;</pre>
1822
1823 !! end
1824
1825 !! test
1826 <pre> with forbidden attribute values (bug 3202)
1827 !! wikitext
1828 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1829 !! html
1830 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1831
1832 !! end
1833
1834 !! test
1835 <nowiki> inside <pre> (bug 13238)
1836 !! wikitext
1837 <pre>
1838 <nowiki>
1839 </pre>
1840 <pre>
1841 <nowiki></nowiki>
1842 </pre>
1843 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1844 !! html
1845 <pre>
1846 &lt;nowiki&gt;
1847 </pre>
1848 <pre>
1849
1850 </pre>
1851 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1852
1853 !! end
1854
1855 !! test
1856 <nowiki> and <pre> preference (first one wins)
1857 !! wikitext
1858 <pre>
1859 <nowiki>
1860 </pre>
1861 </nowiki>
1862 </pre>
1863
1864 <nowiki>
1865 <pre>
1866 <nowiki>
1867 </pre>
1868 </nowiki>
1869 </pre>
1870
1871 !! html
1872 <pre>
1873 &lt;nowiki&gt;
1874 </pre>
1875 <p>&lt;/nowiki&gt;
1876 &lt;/pre&gt;
1877 </p><p>
1878 &lt;pre&gt;
1879 &lt;nowiki&gt;
1880 &lt;/pre&gt;
1881
1882 &lt;/pre&gt;
1883 </p>
1884 !! end
1885
1886 !! test
1887 </pre> inside nowiki
1888 !! wikitext
1889 <nowiki></pre></nowiki>
1890 !! html
1891 <p>&lt;/pre&gt;
1892 </p>
1893 !! end
1894
1895 !! test
1896 Empty pre; pre inside other HTML tags (bug 54946)
1897 !! wikitext
1898 a
1899
1900 <div><pre>
1901 foo
1902 </pre></div>
1903 <pre></pre>
1904 !! html
1905 <p>a
1906 </p>
1907 <div><pre>
1908 foo
1909 </pre></div>
1910 <pre></pre>
1911
1912 !! end
1913
1914 !! test
1915 HTML pre followed by indent-pre
1916 !! wikitext
1917 <pre>foo</pre>
1918 bar
1919 !! html
1920 <pre>foo</pre>
1921 <pre>bar
1922 </pre>
1923 !! end
1924
1925 !!test
1926 Block tag pre
1927 !!options
1928 parsoid
1929 !! wikitext
1930 <p><pre>foo</pre></p>
1931 !! html
1932 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
1933 !!end
1934
1935 !!test
1936 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1937 !! wikitext
1938 {{echo|}}
1939 !! html
1940
1941 !!end
1942
1943 !!test
1944 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1945 !! wikitext
1946 {{echo|
1947 foo}}
1948 !! html
1949 <p>foo
1950 </p>
1951 !!end
1952
1953 !! test
1954 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1955 !! wikitext
1956 {{echo|a
1957 b}}
1958 !! html
1959 <pre>a
1960 </pre>
1961 <p>b
1962 </p>
1963 !!end
1964
1965 !! test
1966 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1967 !! wikitext
1968 {{echo|a
1969 b
1970 c
1971 d
1972 e
1973 }}
1974 !! html
1975 <pre>a
1976 </pre>
1977 <p>b
1978 c
1979 </p>
1980 <pre>d
1981 </pre>
1982 <p>e
1983 </p>
1984 !!end
1985
1986 !!test
1987 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1988 !! wikitext
1989 {{echo| foo}}
1990
1991 {{echo| foo}}{{echo| bar}}
1992
1993 {{echo| foo}}
1994 {{echo| bar}}
1995
1996 {{echo|<!--cmt--> foo}}
1997
1998 <!--cmt-->{{echo| foo}}
1999
2000 {{echo|{{echo| }}bar}}
2001 !! html
2002 <pre>foo
2003 </pre>
2004 <pre>foo bar
2005 </pre>
2006 <pre>foo
2007 bar
2008 </pre>
2009 <pre>foo
2010 </pre>
2011 <pre>foo
2012 </pre>
2013 <pre>bar
2014 </pre>
2015 !!end
2016
2017 !! test
2018 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2019 !! wikitext
2020 {{echo| }}a
2021
2022 {{echo|
2023 }}a
2024
2025 {{echo|
2026 b}}
2027
2028 {{echo|a
2029 }}b
2030
2031 {{echo|a
2032 }} b
2033 !! html
2034 <pre>a
2035 </pre>
2036 <p><br />
2037 </p>
2038 <pre>a
2039 </pre>
2040 <p><br />
2041 </p>
2042 <pre>b
2043 </pre>
2044 <p>a
2045 </p>
2046 <pre>b
2047 </pre>
2048 <p>a
2049 </p>
2050 <pre>b
2051 </pre>
2052 !!end
2053
2054 !! test
2055 Things that look like <pre> tags aren't treated as such
2056 !! wikitext
2057 Barack Obama <President> of the United States
2058 <President></President>
2059 !! html
2060 <p>Barack Obama &lt;President&gt; of the United States
2061 &lt;President&gt;&lt;/President&gt;
2062 </p>
2063 !! end
2064
2065 ## PHP parser discards the "<pre " string
2066 !! test
2067 Handle broken pre-like tags (bug 64025)
2068 !! options
2069 parsoid=wt2html
2070 !! wikitext
2071 {{echo|<pre <pre>x</pre>}}
2072
2073 <table><pre </table>
2074 !! html/php
2075 <pre>x</pre>
2076 <table><pre></pre></table>
2077
2078 !! html/parsoid
2079 <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>
2080 <pre>x</pre>
2081
2082 <span>&lt;pre </span>
2083 <table></table>
2084 !! end
2085
2086 !! test
2087 Parsoid: handle pre with space after attribute
2088 !! options
2089 parsoid=wt2html
2090 !! wikitext
2091 <pre style="width:50%;" >{{echo|foo}}</pre>
2092 !! html
2093 <pre style="width:50%;">{{echo|foo}}</pre>
2094 !! end
2095
2096 # TODO / maybe: fix wt2wt for this
2097 !! test
2098 Parsoid: Don't paragraph-wrap fosterable content
2099 !! options
2100 parsoid=wt2html
2101 !! wikitext
2102 {|
2103 <td></td>
2104 <td></td>
2105
2106
2107
2108 |}
2109 !! html
2110 <table>
2111
2112 <tbody>
2113 <tr>
2114 <td></td>
2115
2116 <td></td></tr>
2117
2118
2119
2120 </tbody></table>
2121 !! end
2122
2123 !! test
2124 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2125 !! options
2126 parsoid=wt2html
2127 !! wikitext
2128 {|
2129 <td>
2130 <td>
2131 </td>
2132
2133
2134
2135 |}
2136 !! html
2137 <table>
2138
2139 <tbody>
2140 <tr>
2141 <td></td>
2142
2143 <td>
2144 </td></tr>
2145
2146
2147
2148 </tbody></table>
2149 !! end
2150
2151
2152 #--------------------------------------------------------------------
2153 # Transclusion parameter whitespace stripping tests
2154 # Behavior is different for positional and named parameters
2155 #--------------------------------------------------------------------
2156 !! test
2157 Templates: Strip leading and trailing whitespace from named-param values
2158 !! wikitext
2159 {{echo|1= a }}
2160
2161 {{echo|1= {{echo|b}} }}
2162
2163 {{echo| 1 =
2164 c }}
2165
2166 {{echo| 1 =
2167 * d
2168 }}
2169 !! html
2170 <p>a
2171 </p><p>b
2172 </p><p>c
2173 </p>
2174 <ul><li> d</li></ul>
2175
2176 !! end
2177
2178 !! test
2179 Templates: Don't strip whitespace from positional-param values
2180 !! wikitext
2181 {{echo|a }}
2182
2183 {{echo|{{echo|b}} }}
2184
2185 {{echo| c
2186 }}
2187
2188 {{echo| {{echo|d}}
2189 }}
2190
2191 {{echo|
2192 e}}
2193
2194 {{echo|
2195 * f}}
2196
2197 {{echo|
2198 }}g
2199 !! html
2200 <p>a
2201 </p><p>b
2202 </p>
2203 <pre>c
2204 </pre>
2205 <p><br />
2206 </p>
2207 <pre>d
2208 </pre>
2209 <p><br />
2210 </p>
2211 <pre>e
2212 </pre>
2213 <p><br />
2214 </p>
2215 <ul><li> f</li></ul>
2216 <p><br />
2217 </p>
2218 <pre>g
2219 </pre>
2220 !! end
2221
2222 !! test
2223 Templates: Handle empty comment-and-ws-only lines correctly
2224 !! wikitext
2225 {{echo|foo
2226 <!--should be ignored-->
2227 <!--should be ignored as well-->
2228 bar}}
2229 !! html
2230 <p>foo
2231 bar
2232 </p>
2233 !! end
2234
2235 !! test
2236 Templates: Handle comments in the target
2237 !! wikitext
2238 {{echo
2239 <!-- should be ignored -->
2240 |foo}}
2241
2242 {{echo<!-- should be ignored -->
2243 |foo}}
2244
2245 {{echo<!-- should be ignored -->|foo}}
2246
2247 {{<!-- should be ignored -->echo|foo}}
2248 !!html/parsoid
2249 <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>
2250
2251 <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>
2252
2253 <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>
2254
2255 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2256 !!end
2257
2258 #--------------------------------------------------------------------
2259 # Transclusion parameter escaping tests
2260 #--------------------------------------------------------------------
2261 !! test
2262 Templates: Parsoid parameter escaping test 1
2263 !! options
2264 parsoid
2265 !! wikitext
2266 {{echo|[foo]|{{echo|[bar]}}}}
2267 !! html
2268 <p about="#mwt1" typeof="mw:Transclusion"
2269 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2270 !! end
2271
2272 !! test
2273 Parsoid: Pipes in external links in template parameter
2274 !! options
2275 parsoid
2276 !! wikitext
2277 {{echo|[{{echo|http://example.com}} link]}}
2278 !! html
2279 <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>
2280 !! end
2281
2282 !! test
2283 Parsoid: pipe in transclusion parameter
2284 !! options
2285 parsoid
2286 !! wikitext
2287 {{echo|http://foo.com/a&#124;b}}
2288 !! html
2289 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2290 typeof="mw:Transclusion"
2291 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>
2292 !! end
2293
2294 !! test
2295 Parsoid: Pipe in external link target and content in template parameter
2296 !! options
2297 parsoid=html2wt,wt2wt
2298 !! wikitext
2299 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2300 !! html
2301 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2302 typeof="mw:Transclusion"
2303 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2304 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2305 !! end
2306
2307 !! test
2308 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2309 !! options
2310 parsoid
2311 !! wikitext
2312 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2313 !! html
2314 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2315 !! end
2316
2317 !! test
2318 Templates: Don't escape already nowiki-escaped text in template parameters
2319 !! options
2320 parsoid=html2wt,wt2wt
2321 !! wikitext
2322 {{echo|foo<nowiki>|</nowiki>bar}}
2323 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2324 {{echo|<nowiki></nowiki>}}
2325 !! html
2326 <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>
2327 <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>
2328 <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>
2329 </p>
2330 !! end
2331
2332 ## Bug 52824
2333 !! test
2334 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2335 !! options
2336 parsoid=html2wt,wt2wt
2337 !! wikitext
2338 {{echo|{{echo|1=bar}}}}
2339 !! html
2340 <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>
2341 !! end
2342
2343 ## Bug 56733
2344 !! test
2345 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2346 !! options
2347 parsoid
2348 !! wikitext
2349 {{echo|a : b}}
2350 !! html
2351 <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>
2352 !! end
2353
2354 ###
2355 ### Parsoid-centric tests for testing RT edge cases for pre
2356 ###
2357
2358 !!test
2359 1a. Indent-Pre and Comments
2360 !! wikitext
2361 a
2362 <!--a-->
2363 c
2364 !! html
2365 <pre>a
2366 </pre>
2367 <p>c
2368 </p>
2369 !!end
2370
2371 !!test
2372 1b. Indent-Pre and Comments
2373 !! wikitext
2374 a
2375 <!--a-->
2376 c
2377 !! html
2378 <pre>a
2379 </pre>
2380 <p>c
2381 </p>
2382 !!end
2383
2384 !!test
2385 1c. Indent-Pre and Comments
2386 !! wikitext
2387 <!--a--> a
2388
2389 <!--a--> a
2390 !! html
2391 <pre> a
2392 </pre>
2393 <pre> a
2394 </pre>
2395 !!end
2396
2397 !!test
2398 1d. Indent-Pre and Comments
2399 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2400 !! wikitext
2401 <!--a--> a
2402
2403 <!--b-->b
2404 !! html
2405 <pre>a
2406 </pre>
2407 <pre>b
2408 </pre>
2409 !!end
2410
2411 !!test
2412 2a. Indent-Pre and tables
2413 !! wikitext
2414 {|
2415 |-
2416 !h1!!h2
2417 |foo||bar
2418 |}
2419 !! html
2420 <table>
2421
2422 <tr>
2423 <th>h1</th>
2424 <th>h2
2425 </th>
2426 <td>foo</td>
2427 <td>bar
2428 </td></tr></table>
2429
2430 !!end
2431
2432 !!test
2433 2b. Indent-Pre and tables
2434 !! wikitext
2435 {|
2436 |-
2437 |foo
2438 |}
2439 !! html
2440 <table>
2441
2442 <tr>
2443 <td>foo
2444 </td></tr></table>
2445
2446 !!end
2447
2448 !!test
2449 2c. Indent-Pre and tables (bug 42252)
2450 !! wikitext
2451 {|
2452 |+ foo
2453 ! | bar
2454 |}
2455 !! html
2456 <table>
2457 <caption> foo
2458 </caption>
2459 <tr>
2460 <th> bar
2461 </th></tr></table>
2462
2463 !!end
2464
2465 !!test
2466 2d. Indent-Pre and tables
2467 !! wikitext
2468 a
2469 {|
2470 | b
2471 |}
2472 !! html/php
2473 <pre>a
2474 </pre>
2475 <table>
2476 <tr>
2477 <td> b
2478 </td></tr></table>
2479
2480 !! html/parsoid
2481 <pre>a</pre>
2482
2483 <table>
2484
2485 <tbody>
2486 <tr>
2487 <td> b</td></tr>
2488 </tbody></table>
2489 !!end
2490
2491 !!test
2492 2e. Indent-Pre and table-line syntax
2493 !! wikitext
2494 a
2495 | b
2496 | c
2497 !! html/parsoid
2498 <pre>a
2499 | b
2500 | c</pre>
2501 !!end
2502
2503 !!test
2504 2f. Indent-pre started by table-line syntax
2505 !! wikitext
2506 a
2507 | b
2508 | c
2509 !! html/parsoid
2510 <p>a</p>
2511 <pre>
2512 | b
2513 | c</pre>
2514 !!end
2515
2516 !!test
2517 3a. Indent-Pre and block tags (single-line html)
2518 !! wikitext
2519 a <p> foo </p>
2520 b <div> foo </div>
2521 c <blockquote> foo </blockquote>
2522 <span> foo </span>
2523 !! html
2524 a <p> foo </p>
2525 b <div> foo </div>
2526 c <blockquote> foo </blockquote>
2527 <pre><span> foo </span>
2528 </pre>
2529 !!end
2530
2531 !!test
2532 3b. Indent-Pre and block tags (multi-line html)
2533 !! wikitext
2534 a <span>foo</span>
2535 b <div> foo </div>
2536 !! html
2537 <pre>a <span>foo</span>
2538 </pre>
2539 b <div> foo </div>
2540
2541 !!end
2542
2543 !!test
2544 3c. Indent-Pre and block tags (pre-content on separate line)
2545 !! wikitext
2546 <p>
2547 foo
2548 </p>
2549
2550 <div>
2551 foo
2552 </div>
2553
2554 <center>
2555 foo
2556 </center>
2557
2558 <blockquote>
2559 foo
2560 </blockquote>
2561
2562 <blockquote>
2563 <pre>
2564 foo
2565 </pre>
2566 </blockquote>
2567
2568 <table><tr><td>
2569 foo
2570 </td></tr></table>
2571
2572 <ul><li>
2573 foo
2574 </li></ul>
2575
2576 !! html
2577 <p>
2578 foo
2579 </p>
2580 <div>
2581 <pre>foo
2582 </pre>
2583 </div>
2584 <center>
2585 <pre>foo
2586 </pre>
2587 </center>
2588 <blockquote>
2589 <p> foo
2590 </p>
2591 </blockquote>
2592 <blockquote>
2593 <pre>
2594 foo
2595 </pre>
2596 </blockquote>
2597 <table><tr><td>
2598 <pre>foo
2599 </pre>
2600 </td></tr></table>
2601 <ul><li>
2602 foo
2603 </li></ul>
2604
2605 !!end
2606
2607 !!test
2608 4. Indent-Pre and extension tags
2609 !! wikitext
2610 a <gallery>
2611 File:foobar.jpg
2612 </gallery>
2613 !! html
2614 a <ul class="gallery mw-gallery-traditional">
2615 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2616 <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>
2617 <div class="gallerytext">
2618 </div>
2619 </div></li>
2620 </ul>
2621
2622 !!end
2623
2624 !! test
2625 Table wikitext syntax outside wiki-tables
2626 !! wikitext
2627 a
2628 ! not a table heading
2629 |- not a table row
2630 | not a table cell
2631 | class="foo bar" | baz
2632 b
2633 |}
2634 |-
2635 c
2636 !! html
2637 <p>a
2638 ! not a table heading
2639 |- not a table row
2640 | not a table cell
2641 | class="foo bar" | baz
2642 b
2643 |}
2644 |-
2645 c
2646 </p>
2647 !! end
2648
2649 !!test
2650 Render paragraphs when indent-pre is suppressed in blocklevels
2651 !! wikitext
2652 <blockquote>
2653 foo
2654
2655 bar
2656 </blockquote>
2657 !! html
2658 <blockquote>
2659 <p> foo
2660 </p><p> bar
2661 </p>
2662 </blockquote>
2663
2664 !!end
2665
2666 !!test
2667 4. Multiple spaces at start-of-line
2668 !! wikitext
2669 <p> foo </p>
2670 foo
2671 {|
2672 |foo
2673 |}
2674 !! html
2675 <p> foo </p>
2676 <pre> foo
2677 </pre>
2678 <table>
2679 <tr>
2680 <td>foo
2681 </td></tr></table>
2682
2683 !!end
2684
2685 ## NOTE: the leading white-space chars on empty line are significant
2686 !! test
2687 5a. White-space in indent-pre
2688 !! wikitext
2689 a<br />
2690
2691 b
2692 !! html
2693 <pre>a<br />
2694
2695 b
2696 </pre>
2697 !! end
2698
2699 ## NOTE: the leading white-space chars on empty line are significant
2700 !! test
2701 5b. White-space in indent-pre
2702 !! wikitext
2703 a
2704
2705 b
2706
2707
2708 c
2709 !! html
2710 <pre>a
2711
2712 b
2713
2714
2715 c
2716 </pre>
2717 !! end
2718
2719 !! test
2720 5c. White-space in indent-pre
2721 !! wikitext
2722 ''a''
2723 ''b''
2724 ''c''
2725 !! html
2726 <pre><i>a</i>
2727 <i>b</i>
2728 <i>c</i>
2729 </pre>
2730 !! end
2731
2732 !! test
2733 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2734 !! wikitext
2735 a
2736
2737 <!-- continue -->
2738 b
2739
2740 c
2741
2742 d
2743 !! html
2744 <pre>a
2745
2746 b
2747 </pre>
2748 <pre>c
2749
2750 </pre>
2751 <p>d
2752 </p>
2753 !! end
2754
2755 !! test
2756 7a. Indent-pre and category links
2757 !! options
2758 parsoid=wt2html,wt2wt
2759 !! wikitext
2760 [[Category:foo]] <!-- No pre-wrapping -->
2761 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2762 !! html
2763 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2764 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2765 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2766 !! end
2767
2768 !! test
2769 7b. Indent-pre and category links
2770 !! options
2771 parsoid=wt2html,wt2wt
2772 !! wikitext
2773 [[Category:foo]] a
2774 [[Category:foo]] {{echo|b}}
2775 !! html
2776 <pre>
2777 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2778
2779 <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>
2780 !! end
2781
2782 ###
2783 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2784 ###
2785
2786 !!test
2787 HTML-pre: 1. embedded newlines
2788 !! wikitext
2789 <pre>foo</pre>
2790
2791 <pre>
2792 foo
2793 </pre>
2794
2795 <pre>
2796
2797 foo
2798 </pre>
2799
2800 <pre>
2801
2802
2803 foo
2804 </pre>
2805 !! html
2806 <pre>foo</pre>
2807 <pre>
2808 foo
2809 </pre>
2810 <pre>
2811
2812 foo
2813 </pre>
2814 <pre>
2815
2816
2817 foo
2818 </pre>
2819
2820 !! html/parsoid
2821 <pre data-parsoid='{"stx":"html"}'>foo</pre>
2822
2823 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
2824 foo
2825 </pre>
2826
2827 <pre data-parsoid='{"stx":"html"}'>
2828
2829 foo
2830 </pre>
2831
2832 <pre data-parsoid='{"stx":"html"}'>
2833
2834
2835 foo
2836 </pre>
2837 !!end
2838
2839 !! test
2840 HTML-pre: big spaces
2841 !! wikitext
2842 <pre>
2843
2844
2845
2846
2847 haha
2848
2849
2850
2851
2852 haha
2853
2854
2855
2856
2857 </pre>
2858 !! html
2859 <pre>
2860
2861
2862
2863
2864 haha
2865
2866
2867
2868
2869 haha
2870
2871
2872
2873
2874 </pre>
2875
2876 !! html/parsoid
2877 <pre data-parsoid='{"stx":"html"}'>
2878
2879
2880
2881
2882 haha
2883
2884
2885
2886
2887 haha
2888
2889
2890
2891
2892 </pre>
2893 !! end
2894
2895 !!test
2896 HTML-pre: 2: indented text
2897 !! wikitext
2898 <pre>
2899 foo
2900 </pre>
2901 !! html
2902 <pre>
2903 foo
2904 </pre>
2905
2906 !!end
2907
2908 !!test
2909 HTML-pre: 3: other wikitext
2910 !! wikitext
2911 <pre>
2912 * foo
2913 # bar
2914 = no-h =
2915 '' no-italic ''
2916 [[ NoLink ]]
2917 </pre>
2918 !! html
2919 <pre>
2920 * foo
2921 # bar
2922 = no-h =
2923 '' no-italic ''
2924 [[ NoLink ]]
2925 </pre>
2926
2927 !!end
2928
2929 ###
2930 ### Definition lists
2931 ###
2932 !! test
2933 Simple definition
2934 !! wikitext
2935 ; name : Definition
2936 !! html
2937 <dl><dt> name&#160;</dt>
2938 <dd> Definition</dd></dl>
2939
2940 !! end
2941
2942 !! test
2943 Definition list for indentation only
2944 !! wikitext
2945 : Indented text
2946 !! html
2947 <dl><dd> Indented text</dd></dl>
2948
2949 !! end
2950
2951 !! test
2952 Definition list with no space
2953 !! wikitext
2954 ;name:Definition
2955 !! html
2956 <dl><dt>name</dt>
2957 <dd>Definition</dd></dl>
2958
2959 !!end
2960
2961 !! test
2962 Definition list with URL link
2963 !! wikitext
2964 ; http://example.com/ : definition
2965 !! html
2966 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2967 <dd> definition</dd></dl>
2968
2969 !! end
2970
2971 !! test
2972 Definition list with bracketed URL link
2973 !! wikitext
2974 ;[http://www.example.com/ Example]:Something about it
2975 !! html
2976 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2977 <dd>Something about it</dd></dl>
2978
2979 !! end
2980
2981 !! test
2982 Definition list with wikilink containing colon
2983 !! wikitext
2984 ; [[Help:FAQ]]: The least-read page on Wikipedia
2985 !! html
2986 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
2987 <dd> The least-read page on Wikipedia</dd></dl>
2988
2989 !! end
2990
2991 # At Brion's and JeLuF's insistence... :)
2992 !! test
2993 Definition list with news link containing colon
2994 !! wikitext
2995 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2996 !! html
2997 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2998 <dd> This isn't even a real newsgroup!</dd></dl>
2999
3000 !! end
3001
3002 !! test
3003 Malformed definition list with colon
3004 !! wikitext
3005 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3006 !! html
3007 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3008
3009 !! end
3010
3011 !! test
3012 Definition lists: colon in external link text
3013 !! wikitext
3014 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3015 !! html
3016 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3017 <dd> OK, I made that up</dd></dl>
3018
3019 !! end
3020
3021 !! test
3022 Definition lists: colon in HTML attribute
3023 !! wikitext
3024 ;<b style="display: inline">bold</b>
3025 !! html
3026 <dl><dt><b style="display: inline">bold</b></dt></dl>
3027
3028 !! end
3029
3030 !! test
3031 Definition lists: self-closed tag
3032 !! wikitext
3033 ;one<br/>two : two-line fun
3034 !! html
3035 <dl><dt>one<br />two&#160;</dt>
3036 <dd> two-line fun</dd></dl>
3037
3038 !! end
3039
3040 !! test
3041 Bug 11748: Literal closing tags
3042 !! wikitext
3043 <dl>
3044 <dt>test 1</dt>
3045 <dd>test test test test test</dd>
3046 <dt>test 2</dt>
3047 <dd>test test test test test</dd>
3048 </dl>
3049 !! html
3050 <dl>
3051 <dt>test 1</dt>
3052 <dd>test test test test test</dd>
3053 <dt>test 2</dt>
3054 <dd>test test test test test</dd>
3055 </dl>
3056
3057 !! end
3058
3059 !! test
3060 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3061 !! wikitext
3062 <ul><li>
3063 ; term : description
3064 * unordered
3065 </li></ul>
3066 !! html
3067 <ul><li>
3068 <dl><dt> term&#160;</dt>
3069 <dd> description</dd></dl>
3070 <ul><li> unordered</li></ul>
3071 </li></ul>
3072
3073 !! end
3074
3075 !! test
3076
3077 Definition list with empty definition and following paragraph
3078 !! wikitext
3079 ; term:
3080 Paragraph text
3081 !! html
3082 <dl><dt> term</dt>
3083 <dd></dd></dl>
3084 <p>Paragraph text
3085 </p>
3086 !! end
3087
3088 !! test
3089 Nested definition lists using html syntax
3090 !! wikitext
3091 <dl><dt>x</dt>
3092 <dd>a</dd>
3093 <dd>b</dd></dl>
3094
3095 !! end
3096
3097 !! test
3098 Definition Lists: No nesting: Multiple dd's
3099 !! wikitext
3100 ;x
3101 :a
3102 :b
3103 !! html
3104 <dl><dt>x</dt>
3105 <dd>a</dd>
3106 <dd>b</dd></dl>
3107
3108 !! end
3109
3110 !! test
3111 Definition Lists: Indentation: Regular
3112 !! wikitext
3113 :i1
3114 ::i2
3115 :::i3
3116 !! html
3117 <dl><dd>i1
3118 <dl><dd>i2
3119 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3120
3121 !! end
3122
3123 !! test
3124 Definition Lists: Indentation: Missing 1st level
3125 !! wikitext
3126 ::i2
3127 :::i3
3128 !! html
3129 <dl><dd><dl><dd>i2
3130 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3131
3132 !! end
3133
3134 !! test
3135 Definition Lists: Indentation: Multi-level indent
3136 !! wikitext
3137 :::i3
3138 !! html
3139 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3140
3141 !! end
3142
3143 !! test
3144 Definition Lists: Hacky use to indent tables
3145 !! wikitext
3146 ::{|
3147 |foo
3148 |bar
3149 |}
3150 this text
3151 should be left alone
3152 !! html
3153 <dl><dd><dl><dd><table>
3154 <tr>
3155 <td>foo
3156 </td>
3157 <td>bar
3158 </td></tr></table></dd></dl></dd></dl>
3159 <p>this text
3160 should be left alone
3161 </p>
3162 !! end
3163
3164 !! test
3165 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3166 !! wikitext
3167 <!-- foo -->
3168 ::{|
3169 |foo
3170 |bar
3171 |}<!-- bar -->
3172 this text
3173 should be left alone
3174 !! html/parsoid
3175 <!-- foo -->
3176 <dl><dd><dl><dd><table><tr>
3177 <td>foo</td>
3178 <td>bar</td>
3179 </tr></table><!-- bar --></dd></dl></dd></dl>
3180 <p>this text
3181 should be left alone</p>
3182 !! end
3183
3184 !! test
3185 Definition Lists: Hacky use to indent tables, with comment before table
3186 !! wikitext
3187 ::<!-- foo -->{|
3188 |foo
3189 |}
3190 !! html/parsoid
3191 <dl><dd><dl><dd><!-- foo --><table><tr>
3192 <td>foo</td>
3193 </tr></table></dd></dl></dd></dl>
3194 !! end
3195
3196 # Bug 52473
3197 !! test
3198 Definition Lists: Hacky use to indent tables (WS-insensitive)
3199 !! options
3200 parsoid
3201 !! wikitext
3202 : {|
3203 |a
3204 |}
3205 !! html
3206 <dl>
3207 <dd> <table><tr><td>a</td></tr></table> </dd>
3208 </dl>
3209 !! end
3210 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3211 ## as an empty dt item. It also ignores all but the last ";" when followed
3212 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3213 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3214 ## ";"s.
3215 ##
3216 ## Ex: ";;t2 ::d2" is transformed into:
3217 ##
3218 ## <dl>
3219 ## <dt>t2 </dt>
3220 ## <dd>
3221 ## <dl>
3222 ## <dt></dt>
3223 ## <dd>d2</dd>
3224 ## </dl>
3225 ## </dd>
3226 ## </dl>
3227 ##
3228 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3229 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3230 ##
3231 ## <dl>
3232 ## <dt>
3233 ## <dl>
3234 ## <dt>t2 </dt>
3235 ## <dd>:d2</dd>
3236 ## </dl>
3237 ## </dt>
3238 ## </dl>
3239 ##
3240 ## All Parsoid only definition list tests have this difference.
3241 ##
3242 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3243 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3244
3245 !! test
3246 Table / list interaction: indented table with lists in table contents
3247 !! wikitext
3248 :{|
3249 |-
3250 | a
3251 * b
3252 |-
3253 | c
3254 * d
3255 |}
3256 !! html
3257 <dl><dd><table>
3258
3259 <tr>
3260 <td> a
3261 <ul><li> b</li></ul>
3262 </td></tr>
3263 <tr>
3264 <td> c
3265 <ul><li> d</li></ul>
3266 </td></tr></table></dd></dl>
3267
3268 !! end
3269
3270 !!test
3271 Table / list interaction: lists nested in tables nested in indented lists
3272 !! wikitext
3273 :{|
3274 |
3275 :a
3276 :b
3277 |
3278 *c
3279 *d
3280 |}
3281
3282 *e
3283 *f
3284 !! html
3285 <dl><dd><table>
3286 <tr>
3287 <td>
3288 <dl><dd>a</dd>
3289 <dd>b</dd></dl>
3290 </td>
3291 <td>
3292 <ul><li>c</li>
3293 <li>d</li></ul>
3294 </td></tr></table></dd></dl>
3295 <ul><li>e</li>
3296 <li>f</li></ul>
3297
3298 !!end
3299
3300 !! test
3301 Definition Lists: Nesting: Multi-level (Parsoid only)
3302 !! options
3303 parsoid
3304 !! wikitext
3305 ;t1 :d1
3306 ;;t2 ::d2
3307 ;;;t3 :::d3
3308 !! html
3309 <dl>
3310 <dt>t1 </dt>
3311 <dd>d1</dd>
3312 <dt>
3313 <dl>
3314 <dt>t2 </dt>
3315 <dd>:d2</dd>
3316 <dt>
3317 <dl>
3318 <dt>t3 </dt>
3319 <dd>::d3</dd>
3320 </dl>
3321 </dt>
3322 </dl>
3323 </dt>
3324 </dl>
3325
3326
3327 !! end
3328
3329
3330 !! test
3331 Definition Lists: Nesting: Test 2 (Parsoid only)
3332 !! options
3333 parsoid
3334 !! wikitext
3335 ;t1
3336 ::d2
3337 !! html
3338 <dl>
3339 <dt>t1</dt>
3340 <dd>
3341 <dl>
3342 <dd>d2</dd>
3343 </dl>
3344 </dd>
3345 </dl>
3346
3347 !! end
3348
3349
3350 !! test
3351 Definition Lists: Nesting: Test 3 (Parsoid only)
3352 !! options
3353 parsoid
3354 !! wikitext
3355 :;t1
3356 ::::d2
3357 !! html
3358 <dl>
3359 <dd>
3360 <dl>
3361 <dt>t1</dt>
3362 <dd>
3363 <dl>
3364 <dd>
3365 <dl>
3366 <dd>d2</dd>
3367 </dl>
3368 </dd>
3369 </dl>
3370 </dd>
3371 </dl>
3372 </dd>
3373 </dl>
3374
3375 !! end
3376
3377
3378 !! test
3379 Definition Lists: Nesting: Test 4
3380 !! wikitext
3381 ::;t3
3382 :::d3
3383 !! html
3384 <dl><dd><dl><dd><dl><dt>t3</dt>
3385 <dd>d3</dd></dl></dd></dl></dd></dl>
3386
3387 !! end
3388
3389
3390 ## The Parsoid team believes the following three test exposes a
3391 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3392 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3393 !! test
3394 Definition Lists: Mixed Lists: Test 1
3395 !! wikitext
3396 :;* foo
3397 ::* bar
3398 :; baz
3399 !! html/php
3400 <dl><dd><dl><dt><ul><li> foo</li>
3401 <li> bar</li></ul></dt></dl>
3402 <dl><dt> baz</dt></dl></dd></dl>
3403
3404 !! html/parsoid
3405 <dl>
3406 <dd><dl>
3407 <dt><ul>
3408 <li> foo
3409 </li>
3410 </ul></dt>
3411 <dd><ul>
3412 <li> bar
3413 </li>
3414 </ul></dd>
3415 <dt> baz</dt>
3416 </dl></dd>
3417 </dl>
3418 !! end
3419
3420 !! test
3421 Definition Lists: Mixed Lists: Test 2
3422 !! wikitext
3423 *: d1
3424 *: d2
3425 !! html
3426 <ul><li><dl><dd> d1</dd>
3427 <dd> d2</dd></dl></li></ul>
3428
3429 !! end
3430
3431
3432 !! test
3433 Definition Lists: Mixed Lists: Test 3
3434 !! wikitext
3435 *::: d1
3436 *::: d2
3437 !! html
3438 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3439 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3440
3441 !! end
3442
3443
3444 !! test
3445 Definition Lists: Mixed Lists: Test 4
3446 !! wikitext
3447 *;d1 :d2
3448 *;d3 :d4
3449 !! html
3450 <ul><li><dl><dt>d1&#160;</dt>
3451 <dd>d2</dd>
3452 <dt>d3&#160;</dt>
3453 <dd>d4</dd></dl></li></ul>
3454
3455 !! end
3456
3457
3458 !! test
3459 Definition Lists: Mixed Lists: Test 5
3460 !! wikitext
3461 *:d1
3462 *:: d2
3463 !! html
3464 <ul><li><dl><dd>d1
3465 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3466
3467 !! end
3468
3469
3470 !! test
3471 Definition Lists: Mixed Lists: Test 6
3472 !! wikitext
3473 #*:d1
3474 #*::: d3
3475 !! html
3476 <ol><li><ul><li><dl><dd>d1
3477 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3478
3479 !! end
3480
3481
3482 !! test
3483 Definition Lists: Mixed Lists: Test 7
3484 !! wikitext
3485 :* d1
3486 :* d2
3487 !! html
3488 <dl><dd><ul><li> d1</li>
3489 <li> d2</li></ul></dd></dl>
3490
3491 !! end
3492
3493
3494 !! test
3495 Definition Lists: Mixed Lists: Test 8
3496 !! wikitext
3497 :* d1
3498 ::* d2
3499 !! html
3500 <dl><dd><ul><li> d1</li></ul>
3501 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3502
3503 !! end
3504
3505
3506 !! test
3507 Definition Lists: Mixed Lists: Test 9
3508 !! wikitext
3509 *;foo :bar
3510 !! html
3511 <ul><li><dl><dt>foo&#160;</dt>
3512 <dd>bar</dd></dl></li></ul>
3513
3514 !! end
3515
3516
3517 !! test
3518 Definition Lists: Mixed Lists: Test 10
3519 !! wikitext
3520 *#;foo :bar
3521 !! html
3522 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3523 <dd>bar</dd></dl></li></ol></li></ul>
3524
3525 !! end
3526
3527 # The Parsoid team disagrees with the PHP parser's seemingly-random
3528 # rules regarding dd/dt on the next two tests. Parsoid is more
3529 # consistent, and recognizes the shared nesting and keeps the
3530 # still-open tags around until the nesting is complete.
3531
3532 !! test
3533 Definition Lists: Mixed Lists: Test 11
3534 !! wikitext
3535 *#*#;*;;foo :bar
3536 *#*#;boo :baz
3537 !! html/php
3538 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3539 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3540 <dl><dt>boo&#160;</dt>
3541 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3542
3543 !! html/parsoid
3544 <ul>
3545 <li>
3546 <ol>
3547 <li>
3548 <ul>
3549 <li>
3550 <ol>
3551 <li>
3552 <dl>
3553 <dt>
3554 <ul>
3555 <li>
3556 <dl>
3557 <dt>
3558 <dl>
3559 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3560 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3561 </dl></dt>
3562 </dl></li>
3563 </ul></dt>
3564 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3565 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3566 </dl></li>
3567 </ol></li>
3568 </ul></li>
3569 </ol></li>
3570 </ul>
3571 !! end
3572
3573
3574 !! test
3575 Definition Lists: Weird Ones: Test 1
3576 !! wikitext
3577 *#;*::;; foo : bar (who uses this?)
3578 !! html/php
3579 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3580 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
3581
3582 !! html/parsoid
3583 <ul>
3584 <li>
3585 <ol>
3586 <li>
3587 <dl>
3588 <dt>
3589 <ul>
3590 <li>
3591 <dl>
3592 <dd>
3593 <dl>
3594 <dd>
3595 <dl>
3596 <dt>
3597 <dl>
3598 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3599 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3600 </dl></dt>
3601 </dl></dd>
3602 </dl></dd>
3603 </dl></li>
3604 </ul></dt>
3605 </dl></li>
3606 </ol></li>
3607 </ul>
3608 !! end
3609
3610 ###
3611 ### External links
3612 ###
3613 !! test
3614 External links: non-bracketed
3615 !! wikitext
3616 Non-bracketed: http://example.com
3617 !! html
3618 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3619 </p>
3620 !! end
3621
3622 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3623 !! test
3624 External links: numbered
3625 !! wikitext
3626 Numbered: [http://example.com]
3627 Numbered: [http://example.net]
3628 Numbered: [http://example.com]
3629 !! html/php
3630 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3631 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3632 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3633 </p>
3634 !! html/parsoid
3635 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
3636 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
3637 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
3638 !!end
3639
3640 !! test
3641 External links: specified text
3642 !! wikitext
3643 Specified text: [http://example.com link]
3644 !! html
3645 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3646 </p>
3647 !!end
3648
3649 !! test
3650 External links: trail
3651 !! wikitext
3652 Linktrails should not work for external links: [http://example.com link]s
3653 !! html
3654 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3655 </p>
3656 !! end
3657
3658 !! test
3659 External links: dollar sign in URL
3660 !! wikitext
3661 http://example.com/1$2345
3662 !! html
3663 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3664 </p>
3665 !! end
3666
3667 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3668 !! test
3669 External links: dollar sign in URL (autonumber)
3670 !! wikitext
3671 [http://example.com/1$2345]
3672 !! html/php
3673 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3674 </p>
3675 !! html/parsoid
3676 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
3677 !!end
3678
3679 !! test
3680 External links: open square bracket forbidden in URL (bug 4377)
3681 !! options
3682 parsoid=wt2html,wt2wt,html2html
3683 !! wikitext
3684 http://example.com/1[2345
3685 !! html/php
3686 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3687 </p>
3688 !! html/parsoid
3689 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
3690 !! end
3691
3692 !! test
3693 External links: open square bracket forbidden in URL (named) (bug 4377)
3694 !! options
3695 parsoid=wt2html,html2html
3696 !! wikitext
3697 [http://example.com/1[2345]
3698 !! html/php
3699 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3700 </p>
3701 !! html/parsoid
3702 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
3703 !!end
3704
3705 # parsoid adds a space before the link name
3706 !! test
3707 External links: open square bracket forbidden in URL (named) (bug 4377)
3708 Parsoid variant.
3709 !! wikitext
3710 [http://example.com/1 [2345]
3711 !! html
3712 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3713 </p>
3714 !!end
3715
3716 !! test
3717 External links: nowiki in URL link text (bug 6230)
3718 !! wikitext
3719 [http://example.com/ <nowiki>''example site''</nowiki>]
3720 !! html
3721 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3722 </p>
3723 !! end
3724
3725 !! test
3726 External links: newline forbidden in text (bug 6230 regression check)
3727 !! wikitext
3728 [http://example.com/ first
3729 second]
3730 !! html
3731 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3732 second]
3733 </p>
3734 !!end
3735
3736 !! test
3737 External links: Pipe char between url and text
3738 !! wikitext
3739 [http://example.com | link]
3740 !! html
3741 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3742 </p>
3743 !!end
3744
3745 !! test
3746 External links: protocol-relative URL in brackets
3747 !! wikitext
3748 [//example.com/ Test]
3749 !! html
3750 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3751 </p>
3752 !! end
3753
3754 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3755 !! test
3756 External links: protocol-relative URL in brackets without text
3757 !! wikitext
3758 [//example.com]
3759 !! html/php
3760 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3761 </p>
3762 !! html/parsoid
3763 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
3764 !! end
3765
3766 !! test
3767 External links: protocol-relative URL in free text is left alone
3768 !! wikitext
3769 //example.com/Foo
3770 !! html
3771 <p>//example.com/Foo
3772 </p>
3773 !!end
3774
3775 !! test
3776 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3777 !! wikitext
3778 foo//example.com/Foo
3779 !! html
3780 <p>foo//example.com/Foo
3781 </p>
3782 !! end
3783
3784 !! test
3785 External links: with no contents
3786 !! wikitext
3787 [http://en.wikipedia.org/wiki/Foo]
3788
3789 [[wikipedia:Foo|Bar]]
3790
3791 [[wikipedia:Foo|<span>Bar</span>]]
3792 !! html/parsoid
3793 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
3794 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo">Bar</a></p>
3795 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"><span>Bar</span></a></p>
3796 !! end
3797
3798 !! test
3799 External image
3800 !! wikitext
3801 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3802 !! html
3803 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3804 </p>
3805 !! end
3806
3807 !! test
3808 External image from https
3809 !! wikitext
3810 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3811 !! html
3812 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3813 </p>
3814 !! end
3815
3816 !! test
3817 External image (when not allowed)
3818 !! options
3819 wgAllowExternalImages=0
3820 !! wikitext
3821 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3822 !! html
3823 <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>
3824 </p>
3825 !! end
3826
3827 !! test
3828 Link to non-http image, no img tag
3829 !! wikitext
3830 Link to non-http image, no img tag: ftp://example.com/test.jpg
3831 !! html
3832 <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>
3833 </p>
3834 !! end
3835
3836 !! test
3837 External links: terminating separator
3838 !! wikitext
3839 Terminating separator: http://example.com/thing,
3840 !! html
3841 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3842 </p>
3843 !! end
3844
3845 !! test
3846 External links: intervening separator
3847 !! wikitext
3848 Intervening separator: http://example.com/1,2,3
3849 !! html
3850 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3851 </p>
3852 !! end
3853
3854 !! test
3855 External links: old bug with URL in query
3856 !! wikitext
3857 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3858 !! html
3859 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3860 </p>
3861 !! end
3862
3863 !! test
3864 External links: old URL-in-URL bug, mixed protocols
3865 !! wikitext
3866 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3867 !! html
3868 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3869 </p>
3870 !!end
3871
3872 !! test
3873 External links: URL in text
3874 !! wikitext
3875 URL in text: [http://example.com http://example.com]
3876 !! html
3877 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3878 </p>
3879 !! end
3880
3881 !! test
3882 External links: Clickable images
3883 !! wikitext
3884 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3885 !! html
3886 <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>
3887 </p>
3888 !!end
3889
3890 !! test
3891 External links: raw ampersand
3892 !! wikitext
3893 Old &amp; use: http://x&y
3894 !! html
3895 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3896 </p>
3897 !! end
3898
3899 !! test
3900 External links: encoded ampersand
3901 !! wikitext
3902 Old &amp; use: http://x&amp;y
3903 !! html/php
3904 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3905 </p>
3906 !! html/parsoid
3907 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
3908 !! end
3909
3910 !! test
3911 External links: encoded equals (bug 6102)
3912 !! wikitext
3913 http://example.com/?foo&#61;bar
3914 !! html/php
3915 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3916 </p>
3917 !! html/parsoid
3918 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
3919 !! end
3920
3921 ##
3922 ## Note that parsoid doesn't explicit mark autonumbered links, nor
3923 ## does it number them. As discussed in bug 53505, we can identify
3924 ## autonumbered links via CSS.
3925 ##
3926
3927 !! test
3928 External links: [raw ampersand]
3929 !! wikitext
3930 Old &amp; use: [http://x&y]
3931 !! html/php
3932 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3933 </p>
3934 !! html/parsoid
3935 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3936 !! end
3937
3938 # note that parsoid html is identical to [raw ampersand] case; so html2wt
3939 # mode will return the [raw ampersand] wikitext
3940 !! test
3941 External links: [encoded ampersand]
3942 !! options
3943 parsoid=wt2html,wt2wt,html2html
3944 !! wikitext
3945 Old &amp; use: [http://x&amp;y]
3946 !! html/php
3947 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3948 </p>
3949 !! html/parsoid
3950 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3951 !! end
3952
3953 !! test
3954 External links: [raw equals]
3955 !! wikitext
3956 [http://example.com/?foo=bar]
3957 !! html/php
3958 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3959 </p>
3960 !! html/parsoid
3961 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
3962 !! end
3963
3964 # note that parsoid html is identical to [raw equals] case; so html2wt
3965 # mode will return the [raw equals] wikitext
3966 !! test
3967 External links: [encoded equals] (bug 6102)
3968 !! options
3969 parsoid=wt2html,wt2wt,html2html
3970 !! wikitext
3971 [http://example.com/?foo&#61;bar]
3972 !! html/php
3973 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3974 </p>
3975 !! html/parsoid
3976 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
3977 !! end
3978
3979 # xxx parsoid strips the IDN character, so the round-trip tests will
3980 # obviously fail and are disabled. --cscott
3981 !! test
3982 External links: [IDN ignored character reference in hostname; strip it right off]
3983 !! options
3984 parsoid=wt2html,wt2wt,html2html
3985 !! wikitext
3986 [http://e&zwnj;xample.com/]
3987 !! html/php
3988 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3989 </p>
3990 !! html/parsoid
3991 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
3992 !! end
3993
3994 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3995 # Where an external link could easily circumvent the sanitization of the text of
3996 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3997 # test demands a higher standard. That's a bit strange.
3998 #
3999 # Example:
4000 #
4001 # http://e‌xample.com -> [http://example.com|http://example.com]
4002 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4003 #
4004 # The first example is sanitized, but the second is not. Any security benefits
4005 # from this production are trivial to circumvent. Either remove this test and
4006 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4007 # the test accordingly.
4008 #
4009 # All our love,
4010 # The Parsoid team.
4011 # xxx parsoid strips the IDN character, so the round-trip tests will
4012 # obviously fail and are disabled. --cscott
4013 !! test
4014 External links: IDN ignored character reference in hostname; strip it right off
4015 !! options
4016 parsoid=wt2html,html2html
4017 !! wikitext
4018 http://e&zwnj;xample.com/
4019 !! html/php
4020 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4021 </p>
4022 !! html/parsoid
4023 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4024 !! end
4025
4026 !! test
4027 External links: www.jpeg.org (bug 554)
4028 !! wikitext
4029 http://www.jpeg.org
4030 !! html
4031 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4032 </p>
4033 !! end
4034
4035 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4036 !! test
4037 External links: URL within URL (original bug 2)
4038 !! wikitext
4039 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4040 !! html/php
4041 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4042 </p>
4043 !! html/parsoid
4044 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4045 !! end
4046
4047 !! test
4048 BUG 361: URL inside bracketed URL
4049 !! wikitext
4050 [http://www.example.com/foo http://www.example.com/bar]
4051 !! html
4052 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4053 </p>
4054 !! end
4055
4056 !! test
4057 BUG 361: URL within URL, not bracketed
4058 !! wikitext
4059 http://www.example.com/foo?=http://www.example.com/bar
4060 !! html
4061 <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>
4062 </p>
4063 !! end
4064
4065 !! test
4066 BUG 289: ">"-token in URL-tail
4067 !! wikitext
4068 http://www.example.com/<hello>
4069 !! html
4070 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4071 </p>
4072 !!end
4073
4074 !! test
4075 BUG 289: literal ">"-token in URL-tail
4076 !! wikitext
4077 http://www.example.com/<b>html</b>
4078 !! html
4079 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4080 </p>
4081 !!end
4082
4083 !! test
4084 BUG 289: ">"-token in bracketed URL
4085 !! wikitext
4086 [http://www.example.com/<hello> stuff]
4087 !! html
4088 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4089 </p>
4090 !!end
4091
4092 !! test
4093 BUG 289: literal ">"-token in bracketed URL
4094 !! wikitext
4095 [http://www.example.com/<b>html</b> stuff]
4096 !! html
4097 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4098 </p>
4099 !!end
4100
4101 !! test
4102 BUG 289: literal double quote at end of URL
4103 !! wikitext
4104 http://www.example.com/"hello"
4105 !! html
4106 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4107 </p>
4108 !!end
4109
4110 !! test
4111 BUG 289: literal double quote in bracketed URL
4112 !! wikitext
4113 [http://www.example.com/"hello" stuff]
4114 !! html
4115 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4116 </p>
4117 !!end
4118
4119 !! test
4120 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4121 !! wikitext
4122 [http://www.example.com test]
4123 !! html
4124 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4125 </p>
4126 !! end
4127
4128 !! test
4129 External links: link text with spaces
4130 !! wikitext
4131 [http://www.example.com a b c]
4132 [http://www.example.com ''a'' ''b'']
4133 !! html
4134 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4135 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4136 </p>
4137 !! end
4138
4139 !! test
4140 External links: wiki links within external link (Bug 3695)
4141 !! wikitext
4142 [http://example.com [[wikilink]] embedded in ext link]
4143 !! html/php
4144 <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>
4145 </p>
4146 !! html/parsoid
4147 <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>
4148 !! end
4149
4150 !! test
4151 BUG 787: Links with one slash after the url protocol are invalid
4152 !! wikitext
4153 http:/example.com
4154
4155 [http:/example.com title]
4156 !! html
4157 <p>http:/example.com
4158 </p><p>[http:/example.com title]
4159 </p>
4160 !! end
4161
4162 !! test
4163 Bracketed external links with template-generated invalid target
4164 !! wikitext
4165 [{{echo|http:/example.com}} title]
4166 !! html
4167 <p>[http:/example.com title]
4168 </p>
4169 !! end
4170
4171 !! test
4172 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4173 !! wikitext
4174 ''[http://example.com text'']
4175 [http://example.com '''text]'''
4176 ''Something [http://example.com in italic'']
4177 ''Something [http://example.com mixed''''', even bold]'''
4178 '''''Now [http://example.com both''''']
4179 !! html
4180 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4181 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4182 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4183 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4184 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4185 </p>
4186 !! end
4187
4188
4189 !! test
4190 Bug 4781: %26 in URL
4191 !! wikitext
4192 http://www.example.com/?title=AT%26T
4193 !! html/php
4194 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4195 </p>
4196 !! html/parsoid
4197 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4198 !! end
4199
4200 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4201 # % is actually legal in HTML5. Any change in output would need testing though.
4202 !! test
4203 Bug 4781, 5267: %25 in URL
4204 !! wikitext
4205 http://www.example.com/?title=100%25_Bran
4206 !! html/php
4207 <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>
4208 </p>
4209 !! html/parsoid
4210 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4211 !! end
4212
4213 !! test
4214 Bug 4781, 5267: %28, %29 in URL
4215 !! wikitext
4216 http://www.example.com/?title=Ben-Hur_%281959_film%29
4217 !! html/php
4218 <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>
4219 </p>
4220 !! html/parsoid
4221 <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>
4222 !! end
4223
4224
4225 !! test
4226 Bug 4781: %26 in autonumber URL
4227 !! wikitext
4228 [http://www.example.com/?title=AT%26T]
4229 !! html/php
4230 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4231 </p>
4232 !! html/parsoid
4233 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4234 !! end
4235
4236 !! test
4237 Bug 4781, 5267: %26 in autonumber URL
4238 !! wikitext
4239 [http://www.example.com/?title=100%25_Bran]
4240 !! html/php
4241 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4242 </p>
4243 !! html/parsoid
4244 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4245 !! end
4246
4247 !! test
4248 Bug 4781, 5267: %28, %29 in autonumber URL
4249 !! wikitext
4250 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4251 !! html/php
4252 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4253 </p>
4254 !! html/parsoid
4255 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4256 !! end
4257
4258
4259 !! test
4260 Bug 4781: %26 in bracketed URL
4261 !! wikitext
4262 [http://www.example.com/?title=AT%26T link]
4263 !! html/php
4264 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4265 </p>
4266 !! html/parsoid
4267 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4268 !! end
4269
4270 !! test
4271 Bug 4781, 5267: %25 in bracketed URL
4272 !! wikitext
4273 [http://www.example.com/?title=100%25_Bran link]
4274 !! html
4275 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4276 </p>
4277 !! end
4278
4279 !! test
4280 Bug 4781, 5267: %28, %29 in bracketed URL
4281 !! wikitext
4282 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4283 !! html/php
4284 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4285 </p>
4286 !! html/parsoid
4287 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4288 !! end
4289
4290 !! test
4291 External link containing a period in the anchor. (bug 63947)
4292 !! wikitext
4293 [//foo.org/bar#baz. bang]
4294
4295 [//foo.org/bar. bang]
4296 !! html/php
4297 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4298 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4299 </p>
4300 !! html/parsoid
4301 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4302 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4303 !! end
4304
4305 !! test
4306 External link containing a single quote. (bug 63947)
4307 !! wikitext
4308 [//foo.org/bar'baz]
4309
4310 [//foo.org/bar'baz bang]
4311 !! html/php
4312 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4313 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4314 </p>
4315 !! html/parsoid
4316 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4317 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4318 !! end
4319
4320
4321 !! test
4322 External link containing a period in the anchor. (bug 63947)
4323 !! wikitext
4324 [//foo.org/bar#baz. bang]
4325
4326 [//foo.org/bar. bang]
4327 !! html/php
4328 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4329 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4330 </p>
4331 !! html/parsoid
4332 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4333 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4334 !! end
4335
4336 !! test
4337 External link containing a single quote. (bug 63947)
4338 !! wikitext
4339 [//foo.org/bar'baz]
4340
4341 [//foo.org/bar'baz bang]
4342 !! html/php
4343 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4344 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4345 </p>
4346 !! html/parsoid
4347 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4348 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4349 !! end
4350
4351
4352 !! test
4353 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4354 !! wikitext
4355 Some [http://example.com/ pretty ''italics'' and stuff]!
4356 !! html
4357 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4358 </p>
4359 !! end
4360
4361 !! test
4362 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4363 !! wikitext
4364 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4365 !! html
4366 <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>
4367 </p>
4368 !! end
4369
4370 !! test
4371 External link containing double-single-quotes with no space separating the url from text in italics
4372 !! wikitext
4373 [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]].]
4374 !! html/php
4375 <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>
4376 </p>
4377 !! html/parsoid
4378 <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>
4379 !! end
4380
4381 !! test
4382 External link with comments in link text
4383 !! wikitext
4384 [http://www.google.com Google <!-- comment -->]
4385 !! html
4386 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4387 </p>
4388 !! end
4389
4390 !! test
4391 URL-encoding in URL functions (single parameter)
4392 !! wikitext
4393 {{localurl:Some page|amp=&}}
4394 !! html
4395 <p>/index.php?title=Some_page&amp;amp=&amp;
4396 </p>
4397 !! end
4398
4399 !! test
4400 URL-encoding in URL functions (multiple parameters)
4401 !! wikitext
4402 {{localurl:Some page|q=?&amp=&}}
4403 !! html
4404 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4405 </p>
4406 !! end
4407
4408 !! test
4409 Brackets in urls
4410 !! wikitext
4411 http://example.com/index.php?foozoid%5B%5D=bar
4412
4413 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4414 !! html/php
4415 <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>
4416 </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>
4417 </p>
4418 !! html/parsoid
4419 <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>
4420
4421 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4422 !! end
4423
4424 !! test
4425 IPv6 urls (bug 21261)
4426 !! options
4427 disabled
4428 !! wikitext
4429 http://[2404:130:0:1000::187:2]/index.php
4430 !! html
4431 <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>
4432 </p>
4433 !! end
4434
4435 !! test
4436 Non-extlinks in brackets
4437 !! wikitext
4438 [foo]
4439 [foo bar]
4440 [foo ''bar'']
4441 [fool's] errand
4442 [fool's errand]
4443 [{{echo|foo}}]
4444 [{{echo|foo}} bar]
4445 [{{echo|foo}} ''bar'']
4446 [{{echo|foo}}l's] errand
4447 [{{echo|foo}}l's errand]
4448 [url={{echo|foo}}]
4449 [url=http://example.com]
4450 !! html
4451 <p>[foo]
4452 [foo bar]
4453 [foo <i>bar</i>]
4454 [fool's] errand
4455 [fool's errand]
4456 [foo]
4457 [foo bar]
4458 [foo <i>bar</i>]
4459 [fool's] errand
4460 [fool's errand]
4461 [url=foo]
4462 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4463 </p>
4464 !! end
4465
4466 !! test
4467 Percent encoding in external links
4468 !! wikitext
4469 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4470 !! html/php
4471 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4472 </p>
4473 !! html/parsoid
4474 <p><a rel="mw:ExtLink"
4475 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4476 !! end
4477
4478 !! test
4479 Use url link syntax for links where the content is equal the link target
4480 !! wikitext
4481 http://example.com
4482 !! html/php
4483 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4484 </p>
4485 !! html/parsoid
4486 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4487 !! end
4488
4489 !! test
4490 Parenthesis in external links, especially URL links
4491 !! wikitext
4492 http://example.com)
4493
4494 http://example.com/test)
4495
4496 http://example.com/(test)
4497
4498 http://example.com/((test)
4499
4500 (http://example.com/(test))
4501
4502 (http://example.com/(test)))))
4503
4504 http://example.com/a)b
4505
4506 [http://example.com) foo]
4507 !! html/php
4508 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4509 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4510 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4511 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4512 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4513 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4514 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4515 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4516 </p>
4517 !! html/parsoid
4518 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4519 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4520 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4521 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4522 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4523 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4524 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4525 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4526 !! end
4527
4528 !! test
4529 Parenthesis in external links, w/ transclusion or comment
4530 !! wikitext
4531 (http://example.com/{{echo|hi}})
4532
4533 (http://example.com<!-- hi -->)
4534 !! html/php
4535 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4536 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4537 </p>
4538 !! html/parsoid
4539 <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>
4540
4541 <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>
4542 !! end
4543
4544 !! test
4545 Replace invalid link targets when serializing
4546 !! options
4547 parsoid=html2wt
4548 !! html
4549 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
4550 !! wikitext
4551 [[MediaWiki:Badtitletext|Manual]]
4552 !! end
4553
4554 ###
4555 ### Quotes
4556 ###
4557
4558 !! test
4559 Quotes
4560 !! wikitext
4561 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4562
4563 Normal text. '''''Bold italic text.''''' Normal text.
4564 !! html
4565 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4566 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4567 </p>
4568 !! end
4569
4570
4571 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4572 # parser strips. The wikitext contains just the first half of the bold
4573 # quote pair.
4574 !! test
4575 Unclosed and unmatched quotes
4576 !! wikitext
4577 '''''Bold italic text '''with bold deactivated''' in between.'''''
4578
4579 '''''Bold italic text ''with italic deactivated'' in between.'''''
4580
4581 '''Bold text..
4582
4583 ..spanning two paragraphs (should not work).'''
4584
4585 '''Bold tag left open
4586
4587 ''Italic tag left open
4588
4589 Normal text.
4590
4591 <!-- Unmatching number of opening, closing tags: -->
4592 '''This year''''s election ''should'' beat '''last year''''s.
4593
4594 ''Tom'''s car is bigger than ''Susan'''s.
4595
4596 Plain ''italic'''s plain
4597 !! html/php
4598 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4599 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4600 </p><p><b>Bold text..</b>
4601 </p><p>..spanning two paragraphs (should not work).
4602 </p><p><b>Bold tag left open</b>
4603 </p><p><i>Italic tag left open</i>
4604 </p><p>Normal text.
4605 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4606 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4607 </p><p>Plain <i>italic'</i>s plain
4608 </p>
4609 !! html/parsoid
4610 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4611 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4612 </p><p><b>Bold text..</b>
4613 </p><p>..spanning two paragraphs (should not work).<b></b>
4614 </p><p><b>Bold tag left open</b>
4615 </p><p><i>Italic tag left open</i>
4616 </p><p>Normal text.
4617 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4618 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4619 </p><p>Plain <i>italic'</i>s plain
4620 </p>
4621 !! end
4622
4623 ###
4624 ### Tables
4625 ###
4626 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4627 ###
4628
4629 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4630 # is the bare minimum required by the spec, see:
4631 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4632 # Parsoid team replies: empty table tags are legal in HTML5
4633 !! test
4634 A table with no data.
4635 !! options
4636 parsoid=wt2html
4637 !! wikitext
4638 {||}
4639 !! html/php
4640
4641 !! html/parsoid
4642 <table></table>
4643
4644 !! end
4645
4646 !! test
4647 A table with stray table end tags on start tag line (wt2html)
4648 !! options
4649 parsoid=wt2html
4650 !! wikitext
4651 {|style="color: red;"|}
4652
4653 {|style="color: red;" |}
4654 |foo
4655 |}
4656
4657 {|style="color: red;"|} id="foo"
4658 |foo
4659 |}
4660
4661 {|style="color: red;" |} id="foo"
4662 |foo
4663 |}
4664 !! html
4665 <table style="color: red;"></table>
4666
4667 <table style="color: red;">
4668 <tbody><tr>
4669 <td>foo</td>
4670 </tr></tbody>
4671 </table>
4672
4673 <table style="color: red;" id="foo">
4674 <tbody><tr>
4675 <td>foo</td>
4676 </tr></tbody>
4677 </table>
4678
4679 <table style="color: red;" id="foo">
4680 <tbody><tr>
4681 <td>foo</td>
4682 </tr></tbody>
4683 </table>
4684
4685 !! end
4686
4687 !! test
4688 A table with no data (take 2)
4689 !! wikitext
4690 {|
4691 |}
4692 !! html/parsoid
4693 <table></table>
4694 !! end
4695
4696 # A table with nothing but a caption is invalid XHTML, we might want to render
4697 # this as <p>caption</p>
4698 # Parsoid team replies: table with only a caption is legal in HTML5
4699 !! test
4700 A table with nothing but a caption
4701 !! wikitext
4702 {|
4703 |+ caption
4704 |}
4705 !! html/php
4706 <table>
4707 <caption> caption
4708 </caption><tr><td></td></tr></table>
4709
4710 !! html/parsoid
4711 <table><caption> caption</caption></table>
4712 !! end
4713
4714 !! test
4715 A table with caption with default-spaced attributes and a table row
4716 !! wikitext
4717 {|
4718 |+ style="color: red;" | caption1
4719 |-
4720 | foo
4721 |}
4722 !! html
4723 <table>
4724 <caption style="color: red;"> caption1
4725 </caption>
4726 <tr>
4727 <td> foo
4728 </td></tr></table>
4729
4730 !! end
4731
4732 !! test
4733 A table with captions with non-default spaced attributes and a table row
4734 !! wikitext
4735 {|
4736 |+style="color: red;"|caption2
4737 |+ style="color: red;"| caption3
4738 |-
4739 | foo
4740 |}
4741 !! html
4742 <table>
4743 <caption style="color: red;">caption2
4744 </caption>
4745 <caption style="color: red;"> caption3
4746 </caption>
4747 <tr>
4748 <td> foo
4749 </td></tr></table>
4750
4751 !! end
4752
4753 !! test
4754 Table td-cell syntax variations
4755 !! wikitext
4756 {|
4757 | foo bar foo | baz
4758 | foo bar foo || baz
4759 | style='color:red;' | baz
4760 | style='color:red;' || baz
4761 |}
4762 !! html
4763 <table>
4764 <tr>
4765 <td> baz
4766 </td>
4767 <td> foo bar foo </td>
4768 <td> baz
4769 </td>
4770 <td style="color:red;"> baz
4771 </td>
4772 <td> style='color:red;' </td>
4773 <td> baz
4774 </td></tr></table>
4775
4776 !! end
4777
4778 !! test
4779 Simple table
4780 !! wikitext
4781 {|
4782 | 1 || 2
4783 |-
4784 | 3 || 4
4785 |}
4786 !! html
4787 <table>
4788 <tr>
4789 <td> 1 </td>
4790 <td> 2
4791 </td></tr>
4792 <tr>
4793 <td> 3 </td>
4794 <td> 4
4795 </td></tr></table>
4796
4797 !! end
4798
4799 !! test
4800 Simple table but with multiple dashes for row wikitext
4801 !! wikitext
4802 {|
4803 | foo
4804 |-----
4805 | bar
4806 |}
4807 !! html
4808 <table>
4809 <tr>
4810 <td> foo
4811 </td></tr>
4812 <tr>
4813 <td> bar
4814 </td></tr></table>
4815
4816 !! end
4817 !! test
4818 Multiplication table
4819 !! wikitext
4820 {| border="1" cellpadding="2"
4821 |+Multiplication table
4822 |-
4823 ! &times; !! 1 !! 2 !! 3
4824 |-
4825 ! 1
4826 | 1 || 2 || 3
4827 |-
4828 ! 2
4829 | 2 || 4 || 6
4830 |-
4831 ! 3
4832 | 3 || 6 || 9
4833 |-
4834 ! 4
4835 | 4 || 8 || 12
4836 |-
4837 ! 5
4838 | 5 || 10 || 15
4839 |}
4840 !! html
4841 <table border="1" cellpadding="2">
4842 <caption>Multiplication table
4843 </caption>
4844 <tr>
4845 <th> &#215; </th>
4846 <th> 1 </th>
4847 <th> 2 </th>
4848 <th> 3
4849 </th></tr>
4850 <tr>
4851 <th> 1
4852 </th>
4853 <td> 1 </td>
4854 <td> 2 </td>
4855 <td> 3
4856 </td></tr>
4857 <tr>
4858 <th> 2
4859 </th>
4860 <td> 2 </td>
4861 <td> 4 </td>
4862 <td> 6
4863 </td></tr>
4864 <tr>
4865 <th> 3
4866 </th>
4867 <td> 3 </td>
4868 <td> 6 </td>
4869 <td> 9
4870 </td></tr>
4871 <tr>
4872 <th> 4
4873 </th>
4874 <td> 4 </td>
4875 <td> 8 </td>
4876 <td> 12
4877 </td></tr>
4878 <tr>
4879 <th> 5
4880 </th>
4881 <td> 5 </td>
4882 <td> 10 </td>
4883 <td> 15
4884 </td></tr></table>
4885
4886 !! end
4887
4888 !! test
4889 Accept "||" in table headings
4890 !! wikitext
4891 {|
4892 !h1 || h2
4893 |}
4894 !! html
4895 <table>
4896 <tr>
4897 <th>h1 </th>
4898 <th> h2
4899 </th></tr></table>
4900
4901 !! end
4902
4903 !! test
4904 Accept "!!" in table data
4905 !! wikitext
4906 {|
4907 | Foo!! ||
4908 |}
4909 !! html/parsoid
4910 <table data-parsoid='{}'>
4911 <tbody data-parsoid='{}'><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
4912 </tbody></table>
4913 !! end
4914
4915 !! test
4916 Accept "||" in indented table headings
4917 !! wikitext
4918 :{|
4919 !h1 || h2
4920 |}
4921 !! html
4922 <dl><dd><table>
4923 <tr>
4924 <th>h1 </th>
4925 <th> h2
4926 </th></tr></table></dd></dl>
4927
4928 !! end
4929
4930 !! test
4931 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4932 !! wikitext
4933 {|
4934 !| h1
4935 || a
4936 |}
4937 !! html
4938 <table>
4939 <tr>
4940 <th> h1
4941 </th>
4942 <td> a
4943 </td></tr></table>
4944
4945 !! end
4946
4947 !!test
4948 Accept "| !" at start of line in tables (ignore !-attribute)
4949 !! wikitext
4950 {|
4951 |-
4952 | !style="color:red" | bar
4953 |}
4954 !! html
4955 <table>
4956
4957 <tr>
4958 <td> bar
4959 </td></tr></table>
4960
4961 !!end
4962
4963 !!test
4964 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 +/-
4965 !! wikitext
4966 {|
4967 |-
4968 |style='color:red;'|+1
4969 |style='color:blue;'|-1
4970 |-
4971 | 1 || 2 || 3
4972 | 1 ||+2 ||-3
4973 |-
4974 | +1
4975 | -1
4976 |}
4977 !! html
4978 <table>
4979
4980 <tr>
4981 <td style="color:red;">+1
4982 </td>
4983 <td style="color:blue;">-1
4984 </td></tr>
4985 <tr>
4986 <td> 1 </td>
4987 <td> 2 </td>
4988 <td> 3
4989 </td>
4990 <td> 1 </td>
4991 <td>+2 </td>
4992 <td>-3
4993 </td></tr>
4994 <tr>
4995 <td> +1
4996 </td>
4997 <td> -1
4998 </td></tr></table>
4999
5000 !!end
5001
5002 !! test
5003 Table rowspan
5004 !! wikitext
5005 {| border=1
5006 | Cell 1, row 1
5007 |rowspan=2| Cell 2, row 1 (and 2)
5008 | Cell 3, row 1
5009 |-
5010 | Cell 1, row 2
5011 | Cell 3, row 2
5012 |}
5013 !! html
5014 <table border="1">
5015 <tr>
5016 <td> Cell 1, row 1
5017 </td>
5018 <td rowspan="2"> Cell 2, row 1 (and 2)
5019 </td>
5020 <td> Cell 3, row 1
5021 </td></tr>
5022 <tr>
5023 <td> Cell 1, row 2
5024 </td>
5025 <td> Cell 3, row 2
5026 </td></tr></table>
5027
5028 !! end
5029
5030 !! test
5031 Nested table
5032 !! wikitext
5033 {| border=1
5034 | &alpha;
5035 |
5036 {| bgcolor=#ABCDEF border=2
5037 |nested
5038 |-
5039 |table
5040 |}
5041 |the original table again
5042 |}
5043 !! html
5044 <table border="1">
5045 <tr>
5046 <td> &#945;
5047 </td>
5048 <td>
5049 <table bgcolor="#ABCDEF" border="2">
5050 <tr>
5051 <td>nested
5052 </td></tr>
5053 <tr>
5054 <td>table
5055 </td></tr></table>
5056 </td>
5057 <td>the original table again
5058 </td></tr></table>
5059
5060 !! end
5061
5062 !! test
5063 Invalid attributes in table cell (bug 1830)
5064 !! wikitext
5065 {|
5066 |Cell:|broken
5067 |}
5068 !! html
5069 <table>
5070 <tr>
5071 <td>broken
5072 </td></tr></table>
5073
5074 !! end
5075
5076
5077 # The "|}" to close the table is missing from the input, so parsoid's
5078 # *2wt modes will fail.
5079 !! test
5080 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5081 !! options
5082 parsoid=wt2html,html2html
5083 !! wikitext
5084 {|
5085 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5086 !! html/php
5087 <table>
5088 <tr>
5089 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5090 <td>]" onmouseover="alert(document.cookie)"&gt;test
5091 </td>
5092 </tr>
5093 </table>
5094
5095 !! html/parsoid
5096 <table><tbody>
5097 <tr>
5098 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5099 !! end
5100
5101
5102 !! test
5103 Indented table markup mixed with indented pre content (proposed in bug 6200)
5104 !! wikitext
5105 <table>
5106 <tr>
5107 <td>
5108 Text that should be rendered preformatted
5109 </td>
5110 </tr>
5111 </table>
5112 !! html
5113 <table>
5114 <tr>
5115 <td>
5116 <pre>Text that should be rendered preformatted
5117 </pre>
5118 </td>
5119 </tr>
5120 </table>
5121
5122 !! end
5123
5124 !! test
5125 Template-generated table cell attributes and cell content
5126 !! wikitext
5127 {|
5128 |{{table_attribs}}
5129 | {{table_attribs}}
5130 |}
5131 !! html
5132 <table>
5133 <tr>
5134 <td style="color: red"> Foo
5135 </td>
5136 <td style="color: red"> Foo
5137 </td></tr></table>
5138
5139 !! end
5140
5141 !! test
5142 Template-generated table cell attributes and cell content (2)
5143 !! wikitext
5144 {|
5145 |align=center {{table_attribs}}
5146 |}
5147 !! html
5148 <table>
5149 <tr>
5150 <td align="center" style="color: red"> Foo
5151 </td></tr></table>
5152
5153 !! end
5154
5155 !! test
5156 Template-generated table cell attributes and cell content (3)
5157 !! wikitext
5158 {|
5159 |align=center {{table_cells}}
5160 |}
5161 !! html
5162 <table>
5163 <tr>
5164 <td align="center" style="color: red"> Foo </td>
5165 <td> Bar </td>
5166 <td> Baz
5167 </td></tr></table>
5168
5169 !! end
5170
5171 !! test
5172 Table with row followed by newlines and table heading
5173 !! wikitext
5174 {|
5175 |-
5176
5177 ! foo
5178 |}
5179 !! html
5180 <table>
5181
5182
5183 <tr>
5184 <th> foo
5185 </th></tr></table>
5186
5187 !! end
5188
5189 !! test
5190 Table with empty line following the start tag
5191 !! wikitext
5192 {|
5193
5194 |-
5195 | foo
5196 |}
5197 !! html
5198 <table>
5199
5200
5201 <tr>
5202 <td> foo
5203 </td></tr></table>
5204
5205 !! end
5206
5207 # FIXME: Preserve the attribute properly (with an empty string as value) in
5208 # the PHP parser. Parsoid implements the behavior below.
5209 !! test
5210 Table attributes with empty value
5211 !! wikitext
5212 {|
5213 | style=| hello
5214 |}
5215 !! html/parsoid
5216 <table>
5217 <tbody>
5218 <tr>
5219 <td style=""> hello
5220 </td></tr></tbody></table>
5221
5222 !! end
5223
5224 !! test
5225 Wikitext table with a lot of comments
5226 !! wikitext
5227 {|
5228 <!-- c0 -->
5229 | foo
5230 <!-- c1 -->
5231 |- <!-- c2 -->
5232 <!-- c3 -->
5233 |<!-- c4 -->
5234 <!-- c5 -->
5235 |}
5236 !! html
5237 <table>
5238 <tr>
5239 <td> foo
5240 </td></tr>
5241 <tr>
5242 <td>
5243 </td></tr></table>
5244
5245 !! end
5246
5247 !! test
5248 Wikitext table with double-line table cell
5249 !! wikitext
5250 {|
5251 |a
5252 b
5253 |}
5254 !! html
5255 <table>
5256 <tr>
5257 <td>a
5258 <p>b
5259 </p>
5260 </td></tr></table>
5261
5262 !! end
5263
5264 !! test
5265 Table cell with a single comment
5266 !! wikitext
5267 {|
5268 | <!-- c1 -->
5269 | a
5270 |}
5271 !! html
5272 <table>
5273 <tr>
5274 <td>
5275 </td>
5276 <td> a
5277 </td></tr></table>
5278
5279 !! end
5280
5281 !! test
5282 Table-cell after a comment-only-empty-line
5283 !! wikitext
5284 {|
5285 |a
5286 <!--c1-->
5287 <!--c2-->| b
5288 |}
5289 !! html/parsoid
5290 <table>
5291 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5292 <!--c1-->
5293 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5294 </tbody></table>
5295
5296 !! end
5297
5298 # The expected HTML structure in this test is debatable. The PHP parser does
5299 # not parse this kind of table at all. The main focus for Parsoid is on
5300 # round-tripping, so this output is ok for now. TODO: revisit!
5301 !! test
5302 Wikitext table with html-syntax row
5303 !! wikitext
5304 {|
5305 |-
5306 <td>foo</td>
5307 |}
5308 !! html/parsoid
5309 <table>
5310 <tbody>
5311 <tr>
5312 <td>foo</td></tr></tbody></table>
5313 !! end
5314
5315 !! test
5316 Implicit <td> after a |-
5317 (PHP parser relies on Tidy to add the missing <td> tags)
5318 !! options
5319 parsoid=wt2html,wt2wt
5320 !! wikitext
5321 {|
5322 |-
5323 a
5324 |}
5325 !! html
5326 <table>
5327 <tr><td>a</td></tr>
5328 </table>
5329 !! end
5330
5331 !! test
5332 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
5333 (PHP parser relies on Tidy to add the missing <td> tags)
5334 !! options
5335 parsoid=wt2html,wt2wt
5336 !! wikitext
5337 {|
5338 |-
5339 |
5340 a
5341 |-
5342 b
5343 |}
5344 !! html
5345 <table>
5346 <tbody>
5347 <tr><td><pre>a</pre></td></tr>
5348 <tr><td> b</td></tr>
5349 </tbody>
5350 </table>
5351 !! end
5352
5353 !! test
5354 Lists should be recognized in an implicit <td> context
5355 (PHP parser relies on Tidy to add the missing <td> tags)
5356 !! options
5357 parsoid=wt2html,wt2wt
5358 !! wikitext
5359 {|
5360 |-
5361 *a
5362 |}
5363 !! html
5364 <table>
5365 <tr>
5366 <td><ul>
5367 <li>a</li>
5368 </ul></td>
5369 </tr>
5370 </table>
5371 !! end
5372
5373 !! test
5374 Parsoid: Round-trip tables directly followed by content (bug 51219)
5375 !! options
5376 parsoid=wt2html,wt2wt
5377 !! wikitext
5378 {|
5379 |foo
5380 |} bar
5381
5382 {|
5383 |baz
5384 |}<b>quux</b>
5385 !! html
5386 <table><tbody>
5387 <tr>
5388 <td>foo</td></tr></tbody></table> bar
5389 <table>
5390 <tbody>
5391 <tr>
5392 <td>baz</td></tr></tbody></table><b>quux</b>
5393 !! end
5394
5395 !! test
5396 Parsoid: Default to a newline after tables in new content (bug 51219)
5397 !! options
5398 parsoid=html2wt
5399 !! wikitext
5400 {|
5401 |foo
5402 |}
5403 <nowiki> </nowiki>bar
5404 {|
5405 |baz
5406 |}
5407 '''quux'''
5408 !! html
5409 <table><tbody>
5410 <tr><td>foo</td></tr></tbody></table> bar
5411 <table><tbody>
5412 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5413 !! end
5414
5415 !! test
5416 Parsoid: newline inducing block nodes don't suppress <nowiki>
5417 !! options
5418 parsoid=html2wt
5419 !! wikitext
5420 <nowiki> </nowiki>a
5421
5422 = foo =
5423 !! html
5424 a<h1>foo</h1>
5425 !! end
5426
5427 !! test
5428 Parsoid: Row-syntax table headings followed by comment & table cells
5429 !! options
5430 parsoid=wt2html,wt2wt
5431 !! wikitext
5432 {|
5433 ! foo || bar
5434 <!-- foo --> || baz || quux
5435 |}
5436 !! html/parsoid
5437 <table>
5438 <tbody>
5439 <tr><th>foo </th><th>bar </th>
5440 <td>baz </td>
5441 <td>quux</td></tr></tbody></table>
5442 !! end
5443
5444
5445 !!test
5446 Parsoid: Recover better from broken table attributes
5447 !!options
5448 parsoid=wt2html
5449 !!wikitext
5450 {| class="foo
5451 | class="bar" |
5452 foo
5453 |}
5454 !!html/parsoid
5455 <table class="foo">
5456 <tr>
5457 <td class="bar">
5458 <p>foo</p></td></tr>
5459 </tbody></table>
5460 !!end
5461
5462 !! test
5463 Strip unsupported table tags
5464 !! options
5465 parsoid=html2wt
5466 !! html
5467 <table>
5468 <thead>
5469 <tr>
5470 <th>Month</th>
5471 <th>Savings</th>
5472 </tr>
5473 </thead>
5474 <tbody>
5475 <tr>
5476 <td>January</td>
5477 <td>$100</td>
5478 </tr>
5479 <tr>
5480 <td>February</td>
5481 <td>$80</td>
5482 </tr>
5483 </tbody>
5484 <tfoot>
5485 <tr>
5486 <td>Sum</td>
5487 <td>$180</td>
5488 </tr>
5489 </tfoot>
5490 </table>
5491 !! wikitext
5492 {|
5493
5494 !Month
5495 !Savings
5496
5497 |January
5498 |$100
5499
5500 |-
5501 |February
5502 |$80
5503
5504 |Sum
5505 |$180
5506
5507 |}
5508 !! end
5509
5510 ###
5511 ### Internal links
5512 ###
5513 !! test
5514 Plain link, capitalized
5515 !! wikitext
5516 [[Main Page]]
5517 !! html
5518 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5519 </p>
5520 !! end
5521
5522 !! test
5523 Plain link, uncapitalized
5524 !! wikitext
5525 [[main Page]]
5526 !! html
5527 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
5528 </p>
5529 !! end
5530
5531 !! test
5532 Piped link
5533 !! wikitext
5534 [[Main Page|The Main Page]]
5535 !! html
5536 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5537 </p>
5538 !! end
5539
5540 !! test
5541 Piped link with comment in link text
5542 !! wikitext
5543 [[Main Page|The Main<!--front--> Page]]
5544 !! html
5545 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5546 </p>
5547 !! end
5548
5549 !! test
5550 Piped link with multiple pipe characters in link text
5551 !! wikitext
5552 [[Main Page||The|Main|Page|]]
5553 !! html/php
5554 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
5555 </p>
5556 !! html/parsoid
5557 <p><a rel="mw:WikiLink" href="Main_Page">|The|Main|Page|</a></p>
5558 !! end
5559
5560 !! test
5561 Broken link
5562 !! wikitext
5563 [[Zigzagzogzagzig]]
5564 !! html
5565 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
5566 </p>
5567 !! end
5568
5569 !! test
5570 Broken link with fragment
5571 !! wikitext
5572 [[Zigzagzogzagzig#zug]]
5573 !! html
5574 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5575 </p>
5576 !! end
5577
5578 !! test
5579 Special page link with fragment
5580 !! wikitext
5581 [[Special:Version#anchor]]
5582 !! html
5583 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5584 </p>
5585 !! end
5586
5587 !! test
5588 Nonexistent special page link with fragment
5589 !! wikitext
5590 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5591 !! html
5592 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5593 </p>
5594 !! end
5595
5596 !! test
5597 Link with prefix
5598 !! wikitext
5599 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5600 !! html
5601 <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>
5602 </p>
5603 !! end
5604
5605 !! test
5606 Link with suffix
5607 !! wikitext
5608 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5609 !! html
5610 <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>!!!
5611 </p>
5612 !! end
5613
5614 !! article
5615 prefixed article
5616 !! text
5617 Some text
5618 !! endarticle
5619
5620 !! test
5621 Bug 43661: Piped links with identical prefixes
5622 !! wikitext
5623 [[prefixed article|prefixed articles with spaces]]
5624
5625 [[prefixed article|prefixed articlesaoeu]]
5626
5627 [[Main Page|Main Page test]]
5628 !! html
5629 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5630 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5631 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5632 </p>
5633 !! end
5634
5635
5636 !! test
5637 Link with HTML entity in suffix / tail
5638 !! wikitext
5639 [[Main Page]]&quot;, [[Main Page]]&#97;
5640 !! html
5641 <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;
5642 </p>
5643 !! end
5644
5645 !! test
5646 Link with 3 brackets
5647 !! wikitext
5648 [[[Main Page]]]
5649 !! html
5650 <p>[[[Main Page]]]
5651 </p>
5652 !! end
5653
5654 !! test
5655 Link with 4 brackets
5656 !! wikitext
5657 [[[[Main Page]]]]
5658 !! html
5659 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5660 </p>
5661 !! end
5662
5663 !! test
5664 Piped link with 3 brackets
5665 !! wikitext
5666 [[[main page|the main page]]]
5667 !! html
5668 <p>[[[main page|the main page]]]
5669 </p>
5670 !! end
5671
5672 !! test
5673 Piped link with extlink-like text
5674 !! wikitext
5675 [[Main Page|[bar]]]
5676 [[Main Page|This is a [bar]]]
5677 !! html
5678 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5679 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5680 </p>
5681 !! end
5682
5683 !! test
5684 Link with multiple pipes
5685 !! wikitext
5686 [[Main Page|The|Main|Page]]
5687 !! html
5688 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5689 </p>
5690 !! end
5691
5692 # Note that parsoid does not munge anchor text; all non-space
5693 # characters are valid in HTML5 ids.
5694 !! test
5695 Anchor containing a #. (bug 63430)
5696 !! wikitext
5697 [[Main Page#And#Link]]
5698 !! html/php
5699 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
5700 </p>
5701 !! html/parsoid
5702 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link">Main Page#And#Link</a></p>
5703 !! end
5704
5705 !! test
5706 Link to namespaces
5707 !! wikitext
5708 [[Talk:Parser testing]], [[Meta:Disclaimers]]
5709 !! html
5710 <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>
5711 </p>
5712 !! end
5713
5714 !! test
5715 Link with space in namespace
5716 !! wikitext
5717 [[User talk:Foo bar]]
5718 !! html
5719 <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>
5720 </p>
5721 !! end
5722
5723 !! article
5724 MemoryAlpha:AlphaTest
5725 !! text
5726 This is an article in the MemoryAlpha namespace
5727 (which shadows the memoryalpha interwiki link).
5728 !! endarticle
5729
5730 !! test
5731 Namespace takes precedence over interwiki link (bug 51680)
5732 !! wikitext
5733 [[MemoryAlpha:AlphaTest]]
5734 !! html
5735 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5736 </p>
5737 !! end
5738
5739 # The previous test doesn't work correctly in html2*, due to not recognizing the
5740 # link as an internal one. This one checks for the correct behavior.
5741 !! test
5742 Link to namespace preferred over interwiki with correct rel attribute
5743 !! options
5744 parsoid=html2wt,html2html
5745 !! wikitext
5746 [[MemoryAlpha:AlphaTest]]
5747 !! html
5748 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5749 </p>
5750 !! end
5751
5752 !! test
5753 Piped link to namespace
5754 !! wikitext
5755 [[Meta:Disclaimers|The disclaimers]]
5756 !! html
5757 <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>
5758 </p>
5759 !! end
5760
5761 !! test
5762 Link containing }
5763 !! wikitext
5764 [[Usually caused by a typo (oops}]]
5765 !! html
5766 <p>[[Usually caused by a typo (oops}]]
5767 </p>
5768 !! end
5769
5770 !! article
5771 7% Solution
5772 !! text
5773 Just a test of an article title containing a percent.
5774 !! endarticle
5775
5776 !! test
5777 Link containing % (not as a hex sequence)
5778 !! wikitext
5779 [[7% Solution]]
5780 !! html/php
5781 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5782 </p>
5783 !! html/parsoid
5784 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5785 !! end
5786
5787 # note that the parsoid HTML is identical to the previous test output,
5788 # so the previous test ensures that the html2wt mode will generate the
5789 # "not as a hex sequence" wikitext.
5790 !! test
5791 Link containing % as a single hex sequence interpreted to char
5792 !! options
5793 parsoid=wt2wt,wt2html,html2html
5794 !! wikitext
5795 [[7%25 Solution]]
5796 !! html/php
5797 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5798 </p>
5799 !! html/parsoid
5800 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5801 !!end
5802
5803 !! test
5804 Link containing % as a double hex sequence interpreted to hex sequence
5805 !! wikitext
5806 [[7%2525 Solution]]
5807 !! html
5808 <p>[[7%2525 Solution]]
5809 </p>
5810 !!end
5811
5812 # note that parsoid does not munge anchor text; all non-space
5813 # characters are valid in HTML5 anchors.
5814 !! test
5815 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
5816 Example for such a section: == < ==
5817 !! wikitext
5818 [[%23%3c]][[%23%3e]]
5819 !! html/php
5820 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5821 </p>
5822 !! html/parsoid
5823 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E">#></a></p>
5824 !! end
5825
5826 !! test
5827 Link containing "<#" and ">#" as a hex sequences
5828 !! wikitext
5829 [[%3c%23]][[%3e%23]]
5830 !! html
5831 <p>[[%3c%23]][[%3e%23]]
5832 </p>
5833 !! end
5834
5835 !! test
5836 Link containing an equals sign
5837 !! wikitext
5838 [[Special:BookSources/isbn=4-00-026157-6]]
5839 !! html/php
5840 <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>
5841 </p>
5842 !! html/parsoid
5843 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
5844 !! end
5845
5846 !! article
5847 Foo~bar
5848 !! text
5849 Just a test of an article title containing a tilde.
5850 !! endarticle
5851
5852 # note that links containing signatures, like [[Foo~~~~]], are
5853 # massaged by the pre-save transform (PST) and so the tildes are never
5854 # seen by the parser.
5855 !! test
5856 Link containing a tilde
5857 !! wikitext
5858 [[Foo~bar]]
5859 !! html/php
5860 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5861 </p>
5862 !! html/parsoid
5863 <p><a rel="mw:WikiLink" href="./Foo~bar">Foo~bar</a></p>
5864 !! end
5865
5866 !! test
5867 Link containing double-single-quotes '' (bug 4598)
5868 !! wikitext
5869 [[Lista d''e paise d''o munno]]
5870 !! html/php
5871 <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>
5872 </p>
5873 !! html/parsoid
5874 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno">Lista d''e paise d''o munno</a></p>
5875 !! end
5876
5877 !! test
5878 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5879 !! wikitext
5880 Some [[Link|pretty ''italics'' and stuff]]!
5881 !! html/php
5882 <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>!
5883 </p>
5884 !! html/parsoid
5885 <p>Some <a rel="mw:WikiLink" href="Link">pretty <i>italics</i> and stuff</a>!</p>
5886 !! end
5887
5888 !! test
5889 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5890 !! wikitext
5891 ''Some [[Link|pretty ''italics'' and stuff]]!''
5892 !! html
5893 <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>
5894 </p>
5895 !! end
5896
5897 !! test
5898 Link with double quotes in title part (literal) and alternate part (interpreted)
5899 !! wikitext
5900 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5901
5902 [[''Pentecoste'']]
5903
5904 [[''Pentecoste''|Pentecoste]]
5905
5906 [[''Pentecoste''|''Pentecoste'']]
5907 !! html/php
5908 <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>
5909 </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>
5910 </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>
5911 </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>
5912 </p>
5913 !! html/parsoid
5914 <meta typeof="mw:Placeholder"/>
5915 <p><a rel="mw:WikiLink" href="''Pentecoste''">''Pentecoste''</a></p>
5916 <p><a rel="mw:WikiLink" href="''Pentecoste''">Pentecoste</a></p>
5917 <p><a rel="mw:WikiLink" href="''Pentecoste''"><i>Pentecoste</i></a></p>
5918 !! end
5919
5920 !! test
5921 Broken image links with HTML captions (bug 39700)
5922 !! wikitext
5923 [[File:Nonexistent|<script></script>]]
5924 [[File:Nonexistent|100px|<script></script>]]
5925 [[File:Nonexistent|&lt;]]
5926 [[File:Nonexistent|a<i>b</i>c]]
5927 !! html
5928 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5929 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5930 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5931 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5932 </p>
5933 !! end
5934
5935 !! test
5936 Plain link to URL
5937 !! wikitext
5938 [[http://www.example.com]]
5939 !! html/php
5940 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5941 </p>
5942 !! html/parsoid
5943 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
5944 !! end
5945
5946 !! test
5947 Plain link to URL with link text
5948 !! wikitext
5949 [[http://www.example.com Link text]]
5950 !! html
5951 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5952 </p>
5953 !! end
5954
5955 !! test
5956 Plain link to protocol-relative URL
5957 !! wikitext
5958 [[//www.example.com]]
5959 !! html/php
5960 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5961 </p>
5962 !! html/parsoid
5963 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
5964 !! end
5965
5966 !! test
5967 Plain link to protocol-relative URL with link text
5968 !! wikitext
5969 [[//www.example.com Link text]]
5970 !! html
5971 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5972 </p>
5973 !! end
5974
5975 !! test
5976 Plain link to page with question mark in title
5977 !! wikitext
5978 [[A?b]]
5979
5980 [[A?b|Baz]]
5981 !! html
5982 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5983 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5984 </p>
5985 !! end
5986
5987
5988 # I'm fairly sure the expected result here is wrong.
5989 # We want these to be URL links, not pseudo-pages with URLs for titles....
5990 # However the current output is also pretty screwy.
5991 #
5992 # ----
5993 # I'm changing it to match the current output--it arguably makes more
5994 # sense in the light of the test above. Old expected result was:
5995 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5996 #</p>
5997 # But I think this test is bordering on "garbage in, garbage out" anyway.
5998 # -- wtm
5999 !! test
6000 Piped link to URL
6001 !! wikitext
6002 Piped link to URL: [[http://www.example.com|an example URL]]
6003 !! html/php
6004 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6005 </p>
6006 !! html/parsoid
6007 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6008 !! end
6009
6010 !! test
6011 BUG 2: [[page|http://url/]] should link to page, not http://url/
6012 !! wikitext
6013 [[Main Page|http://url/]]
6014 !! html/php
6015 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6016 </p>
6017 !! html/parsoid
6018 <p><a rel="mw:WikiLink" href="./Main_Page">http://url/</a></p>
6019 !! end
6020
6021 # Parsoid does not mark self-links, by design.
6022 !! test
6023 BUG 337: Escaped self-links should be bold
6024 !! options
6025 title=[[Bug462]]
6026 !! wikitext
6027 [[Bu&#103;462]] [[Bug462]]
6028 !! html/php
6029 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6030 </p>
6031 !! html/parsoid
6032 <p><a rel="mw:WikiLink" href="./Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462">Bug462</a></p>
6033 !! end
6034
6035 !! test
6036 Self-link to section should not be bold
6037 !! options
6038 title=[[Main Page]]
6039 !! wikitext
6040 [[Main Page#section]]
6041 !! html
6042 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6043 </p>
6044 !! end
6045
6046 !! article
6047 00
6048 !! text
6049 This is 00.
6050 !! endarticle
6051
6052 !!test
6053 Self-link to numeric title
6054 !!options
6055 title=[[0]]
6056 !! wikitext
6057 [[0]]
6058 !! html
6059 <p><strong class="selflink">0</strong>
6060 </p>
6061 !!end
6062
6063 !!test
6064 Link to numeric-equivalent title
6065 !!options
6066 title=[[0]]
6067 !! wikitext
6068 [[00]]
6069 !! html
6070 <p><a href="/wiki/00" title="00">00</a>
6071 </p>
6072 !!end
6073
6074 !! test
6075 <nowiki> inside a link
6076 !! wikitext
6077 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6078 !! html
6079 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6080 </p>
6081 !! end
6082
6083 !! test
6084 Non-breaking spaces in title
6085 !! wikitext
6086 [[&nbsp; Main &nbsp; Page &nbsp;]]
6087 !! html
6088 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6089 </p>
6090 !!end
6091
6092 !! test
6093 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6094 !! options
6095 language=ca
6096 !! wikitext
6097 '''[[Main Page]]'''
6098 !! html
6099 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6100 </p>
6101 !! end
6102
6103 !! test
6104 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6105 !! options
6106 language=ca
6107 !! wikitext
6108 ''[[Main Page]]''
6109 !! html
6110 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6111 </p>
6112 !! end
6113
6114 !! test
6115 Internal link with en linktrail: no apostrophes (bug 27473)
6116 !! options
6117 language=en
6118 !! wikitext
6119 [[Something]]'nice
6120 !! html
6121 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6122 </p>
6123 !! end
6124
6125 !! test
6126 Internal link with ca linktrail with apostrophes (bug 27473)
6127 !! options
6128 language=ca
6129 !! wikitext
6130 [[Something]]'nice
6131 !! html
6132 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6133 </p>
6134 !! end
6135
6136 !! test
6137 Internal link with kaa linktrail with apostrophes (bug 27473)
6138 !! options
6139 language=kaa
6140 !! wikitext
6141 [[Something]]'nice
6142 !! html
6143 <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>
6144 </p>
6145 !! end
6146
6147 !! test
6148 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6149 !! wikitext
6150 [[User:Foo/Test/63636:Bar|Test]]
6151 !! html/php
6152 <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>
6153 </p>
6154 !! html/parsoid
6155 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar">Test</a></p>
6156 !! end
6157
6158 !! test
6159 Purely hash wikilink
6160 !! options
6161 title=[[User:test/123]]
6162 !! wikitext
6163 [[#a|b]]
6164 !! html/parsoid
6165 <p data-parsoid='{}'><a rel="mw:WikiLink" href="../User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"../User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
6166 !! end
6167
6168 !! test
6169 1. Interaction of linktrail and template encapsulation
6170 !! options
6171 parsoid
6172 !! wikitext
6173 {{echo|[[Foo]]}}l
6174 !! html
6175 <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>
6176 !! end
6177
6178 !! test
6179 2. Interaction of linktrail and template encapsulation
6180 !! options
6181 parsoid
6182 !! wikitext
6183 {{echo|Some [[Fool]]}}s
6184 !! html
6185 <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>
6186 !! end
6187
6188 !! test
6189 3. Interaction of linktrail and template encapsulation
6190 !! options
6191 parsoid
6192 !! wikitext
6193 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6194 !! html
6195 <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>
6196 !! end
6197
6198 !! article
6199 Söfnuður
6200 !! text
6201 Test.
6202 !! endarticle
6203
6204 !! test
6205 Internal link with is link prefix
6206 !! options
6207 language=is
6208 !! wikitext
6209 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6210 !! html
6211 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6212 </p>
6213 !! end
6214
6215 !! article
6216 Mótmælendatrú
6217 !! text
6218 Test.
6219 !! endarticle
6220
6221 !! test
6222 Internal link with is link trail and link prefix
6223 !! options
6224 language=is
6225 !! wikitext
6226 [[mótmælendatrú|xxx]]ar
6227 [[mótmælendatrú]]ar
6228 mótmælenda[[söfnuður]]
6229 mótmælenda[[söfnuður|söfnuðir]]
6230 mótmælenda[[söfnuður|söfnuðir]]xxx
6231 !! html
6232 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6233 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6234 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6235 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6236 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6237 </p>
6238 !! end
6239
6240 !! test
6241 Parsoid link trail escaping
6242 !! options
6243 parsoid=html2wt,html2html
6244 !! wikitext
6245 [[apple]]<nowiki/>s
6246 !! html
6247 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
6248 !! end
6249
6250 !! test
6251 Parsoid link prefix escaping
6252 !! options
6253 language=is
6254 parsoid=html2wt,html2html
6255 !! wikitext
6256 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6257 !! html
6258 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
6259 !! end
6260
6261 !! test
6262 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6263 !! wikitext
6264 [[Foo| bar]]
6265
6266 [[Foo| ''bar'']]
6267
6268 [http://wp.org foo]
6269
6270 [http://wp.org ''foo'']
6271 !! html
6272 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
6273 </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>
6274 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6275 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6276 </p>
6277 !! end
6278
6279 !! test
6280 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6281 !! options
6282 parsoid
6283 !! wikitext
6284 [[Foo|{{echo|a}} b {{echo|c}}]]
6285 !! html
6286 <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>
6287 !! end
6288
6289 !! test
6290 Link with angle bracket after anchor
6291 !! wikitext
6292 [[Foo#<bar>]]
6293 !! html/parsoid
6294 <p><a rel="mw:WikiLink" href="./Foo#%3Cbar%3E" data-parsoid='{"stx":"simple","a":{"href":"./Foo#%3Cbar%3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
6295 !! end
6296
6297 ###
6298 ### Interwiki links (see maintenance/interwiki.sql)
6299 ###
6300
6301 !! test
6302 Inline interwiki link
6303 !! wikitext
6304 [[MeatBall:SoftSecurity]]
6305 !! html
6306 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6307 </p>
6308 !! end
6309
6310 !! test
6311 Inline interwiki link with empty title (bug 2372)
6312 !! wikitext
6313 [[MeatBall:]]
6314 !! html
6315 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6316 </p>
6317 !! end
6318
6319 !! test
6320 Interwiki link encoding conversion (bug 1636)
6321 !! wikitext
6322 *[[Wikipedia:ro:Olteni&#0355;a]]
6323 *[[Wikipedia:ro:Olteni&#355;a]]
6324 !! html
6325 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
6326 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
6327
6328 !! end
6329
6330 !! test
6331 Interwiki link with fragment (bug 2130)
6332 !! wikitext
6333 [[MeatBall:SoftSecurity#foo]]
6334 !! html
6335 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6336 </p>
6337 !! end
6338
6339 # Ideally the wikipedia: prefix here should be proto-relative too
6340 !! test
6341 Different interwiki prefixes mapping to the same URL
6342 !! wikitext
6343 [[:en:Foo]]
6344
6345 [[:en:Foo|Foo]]
6346
6347 [[wikipedia:Foo]]
6348
6349 [[:wikipedia:Foo|Foo]]
6350
6351 [[wikipedia:en:Foo]]
6352
6353 [[:wikipedia:en:Foo]]
6354 !! html/parsoid
6355 <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>
6356
6357 <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>
6358
6359 <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>
6360
6361 <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>
6362
6363 <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>
6364
6365 <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>
6366 !! end
6367
6368 !! test
6369 Interwiki links that cannot be represented in wiki syntax
6370 !! wikitext
6371 [[meatball:ok]]
6372 [[meatball:ok#foo|ok with fragment]]
6373 [[meatball:ok_as_well?|ok ending with ? mark]]
6374 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6375 [http://de.wikipedia.org/wiki/#foo is just fragment]
6376
6377 !! html/parsoid
6378 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
6379 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
6380 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?">ok ending with ? mark</a>
6381 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6382 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6383 !! end
6384
6385 !! test
6386 Interwiki links: trail
6387 !! options
6388 parsoid
6389 !! wikitext
6390 [[wikipedia:Foo|Ba]]r
6391 !! html
6392 <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>
6393 !! end
6394
6395 !! test
6396 Local interwiki link
6397 !! wikitext
6398 [[local:Template:Foo]]
6399 !! html
6400 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
6401 </p>
6402 !! end
6403
6404 !! test
6405 Local interwiki link: self-link to current page
6406 !! options
6407 title=[[Main Page]]
6408 !! wikitext
6409 [[local:Main Page]]
6410 !! html
6411 <p><strong class="selflink">local:Main Page</strong>
6412 </p>
6413 !! end
6414
6415 !! test
6416 Local interwiki link: prefix only (bug 64167)
6417 !! wikitext
6418 [[local:]]
6419 !! html
6420 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
6421 </p>
6422 !! end
6423
6424 !! test
6425 Local interwiki link: with additional interwiki prefix (bug 61357)
6426 !! wikitext
6427 [[local:meatball:Hello]]
6428 !! html
6429 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
6430 </p>
6431 !! end
6432
6433 ###
6434 ### Interlanguage links
6435 ### Language links (so that searching for '### language' matches..)
6436 ###
6437
6438 !! test
6439 Interlanguage link
6440 !! wikitext
6441 Blah blah blah
6442 [[zh:Chinese]]
6443 !! html/php
6444 <p>Blah blah blah
6445 </p>
6446 !! html/parsoid
6447 <p>Blah blah blah
6448 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6449 !! end
6450
6451 !! test
6452 Interlanguage link with spacing
6453 !! wikitext
6454 Blah blah blah
6455 [[ zh : Chinese ]]
6456 !! html/php
6457 <p>Blah blah blah
6458 </p>
6459 !! html/parsoid
6460 <p>Blah blah blah
6461 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6462 !! end
6463
6464 !! test
6465 Double interlanguage link
6466 !! wikitext
6467 Blah blah blah
6468 [[es:Spanish]]
6469 [[zh:Chinese]]
6470 !! html/php
6471 <p>Blah blah blah
6472 </p>
6473 !! html/parsoid
6474 <p>Blah blah blah
6475 <link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Spanish"/>
6476 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6477 !! end
6478
6479 !! test
6480 Interlanguage link, with prefix links
6481 !! options
6482 language=ln
6483 !! wikitext
6484 Blah blah blah
6485 [[zh:Chinese]]
6486 !! html/php
6487 <p>Blah blah blah
6488 </p>
6489 !! html/parsoid
6490 <p>Blah blah blah
6491 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6492 !! end
6493
6494 !! test
6495 Double interlanguage link, with prefix links (bug 8897)
6496 !! options
6497 language=ln
6498 !! wikitext
6499 Blah blah blah
6500 [[es:Spanish]]
6501 [[zh:Chinese]]
6502 !! html/php
6503 <p>Blah blah blah
6504 </p>
6505 !! html/parsoid
6506 <p>Blah blah blah
6507 <link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Spanish"/>
6508 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6509 !! end
6510
6511 !! test
6512 "Extra" interlanguage links (bug 32189 / gerrit 111390)
6513 !! wikitext
6514 Blah blah blah
6515 [[mul:Article]]
6516 !! html/php
6517 <p>Blah blah blah
6518 </p>
6519 !! html/parsoid
6520 <p>Blah blah blah
6521 <link rel="mw:PageProp/Language" title="Multilingual" href="//wikisource.org/wiki/Article"/></p>
6522 !! end
6523
6524 !! test
6525 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
6526 !! options
6527 language=ln
6528 !! wikitext
6529 [[WW&nbsp;II]]
6530 !! html
6531 <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>
6532 </p>
6533 !! end
6534
6535 !! test
6536 Parsoid bug 53221: Wikilinks should be properly entity-escaped
6537 !! options
6538 parsoid=html2wt
6539 !! wikitext
6540 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
6541
6542 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
6543 !! html
6544 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6545 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6546 !! end
6547
6548 !! test
6549 Parsoid: handle constructor well
6550 !! options
6551 parsoid
6552 !! wikitext
6553 [[constructor]]
6554
6555 [[constructor:foo]]
6556 !! html
6557 <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>
6558
6559 <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>
6560 !! end
6561
6562 !! test
6563 Parsoid: recognize interlanguage links without a target page
6564 !! options
6565 parsoid
6566 !! wikitext
6567 [[ko:]]
6568 !! html
6569 <p><link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
6570 !! end
6571
6572 !! test
6573 Parsoid: recognize interwiki links without a target page
6574 !! options
6575 parsoid
6576 !! wikitext
6577 [[:ko:]]
6578 !! html
6579 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
6580 !! end
6581
6582 !! test
6583 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
6584 !! options
6585 parsoid
6586 !! wikitext
6587 [[en:Foo]]
6588 !! html
6589 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
6590 !! end
6591
6592 !! test
6593 Interlanguage link with preceding local interwiki link (bug 68085)
6594 !! wikitext
6595 Blah blah blah
6596 [[local:es:Spanish]]
6597 !! html
6598 <p>Blah blah blah
6599 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
6600 </p>
6601 !! end
6602
6603 !! test
6604 Looks like an interlanguage link, but is actually a local interwiki
6605 !! wikitext
6606 Blah blah blah
6607 [[mi:Template:Foo]]
6608 !! html
6609 <p>Blah blah blah
6610 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
6611 </p>
6612 !! end
6613
6614 ###
6615 ### Redirects, Parsoid-only
6616 ###
6617 !! test
6618 1. Simple redirect to page
6619 !! options
6620 parsoid
6621 !! wikitext
6622 #REDIRECT [[Main Page]]
6623 !! html
6624 <link rel="mw:PageProp/redirect" href="./Main_Page">
6625 !! end
6626
6627 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
6628 !! test
6629 2. Other redirect variants
6630 !! options
6631 parsoid=wt2html,wt2wt
6632 !! wikitext
6633 #REDIRECT [[Main_Page]]
6634 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
6635 !! html
6636 <link rel="mw:PageProp/redirect" href="./Main_Page">
6637 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
6638 !! end
6639
6640 !! test
6641 Empty redirect
6642 !! options
6643 parsoid=wt2html,wt2wt
6644 !! wikitext
6645 #REDIRECT [[]]
6646 !! html
6647 <ol>
6648 <li>REDIRECT [[]]</li></ol>
6649 !! end
6650
6651 !! test
6652 Optional colon in #REDIRECT
6653 !! options
6654 # the colon is archaic syntax. we support it for wt2html, but we
6655 # don't care that it roundtrips back to the modern syntax.
6656 parsoid=wt2html,html2html
6657 !! wikitext
6658 #REDIRECT:[[Main Page]]
6659 !! html
6660 <link rel="mw:PageProp/redirect" href="./Main_Page">
6661 !! end
6662
6663 !! test
6664 Whitespace in #REDIRECT with optional colon
6665 !! options
6666 # the colon and gratuitous whitespace is archaic syntax. we support
6667 # it for wt2html, but we don't care that it roundtrips back to the
6668 # modern syntax (without extra whitespace)
6669 parsoid=wt2html,html2html
6670 !! wikitext
6671
6672 #REDIRECT
6673 :
6674 [[Main Page]]
6675 !! html
6676 <link rel="mw:PageProp/redirect" href="./Main_Page">
6677 !! end
6678
6679 !! test
6680 Piped link in #REDIRECT
6681 !! options
6682 # content after piped link is ignored. we support this syntax,
6683 # but don't care that the piped link is lost when we roundtrip this.
6684 parsoid=wt2html
6685 !! wikitext
6686 #REDIRECT [[Main Page|bar]]
6687 !! html
6688 <link rel="mw:PageProp/redirect" href="./Main_Page">
6689 !! end
6690
6691 !! test
6692 Redirect to category
6693 !! options
6694 parsoid=wt2html
6695 !! wikitext
6696 #REDIRECT [[Category:Foo]]
6697 !! html
6698 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6699 !! end
6700
6701 !! test
6702 Redirect to category with URL encoding
6703 !! options
6704 parsoid=wt2html
6705 !! wikitext
6706 #REDIRECT [[Category%3AFoo]]
6707 !! html
6708 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6709 !! end
6710
6711 !! test
6712 Redirect to category page
6713 !! options
6714 parsoid=wt2html,html2html
6715 !! wikitext
6716 #REDIRECT [[:Category:Foo]]
6717 !! html
6718 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
6719 !! end
6720
6721 !! test
6722 Redirect to image page (1)
6723 !! options
6724 parsoid
6725 !! wikitext
6726 #REDIRECT [[File:Wiki.png]]
6727 !! html
6728 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6729 !! end
6730
6731 !! test
6732 Redirect to image page (2)
6733 !! options
6734 parsoid
6735 !! wikitext
6736 #REDIRECT [[Image:Wiki.png]]
6737 !! html
6738 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6739 !! end
6740
6741 !! test
6742 Redirect to language
6743 !! options
6744 parsoid
6745 !! wikitext
6746 #REDIRECT [[en:File:Wiki.png]]
6747 !! html
6748 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6749 !! end
6750
6751 !! test
6752 Redirect to interwiki
6753 !! options
6754 parsoid
6755 !! wikitext
6756 #REDIRECT [[meatball:File:Wiki.png]]
6757 !! html
6758 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6759 !! end
6760
6761 !! test
6762 Non-English #REDIRECT
6763 !! options
6764 parsoid
6765 language=is
6766 !! wikitext
6767 #TILVÍSUN [[Main Page]]
6768 !! html
6769 <link rel="mw:PageProp/redirect" href="./Main_Page">
6770 !! end
6771
6772 !! test
6773 New redirect
6774 !! options
6775 parsoid=html2wt
6776 !! wikitext
6777 Foo
6778 #REDIRECT [[Foo]]
6779 !! html
6780 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
6781 !! end
6782
6783 ##
6784 ## XHTML tidiness
6785 ###
6786
6787 !! test
6788 <br> to <br />
6789 !! wikitext
6790 1<br>2<br />3
6791 !! html
6792 <p>1<br />2<br />3
6793 </p>
6794 !! end
6795
6796 !! test
6797 Broken br tag sanitization
6798 !! wikitext
6799 </br>
6800 !! html/php
6801 <p>&lt;/br&gt;
6802 </p>
6803 !! end
6804
6805 # TODO: Fix html2html mode (bug 51055)!
6806 !! test
6807 Parsoid: Broken br tag recognition
6808 !! options
6809 parsoid=wt2html
6810 !! wikitext
6811 </br>
6812
6813 <br/ >
6814 !! html/parsoid
6815 <p><br></p>
6816 <p><br/></p>
6817 !! end
6818
6819 !! test
6820 Incorrecly removing closing slashes from correctly formed XHTML
6821 !! wikitext
6822 <br style="clear:both;" />
6823 !! html
6824 <p><br style="clear:both;" />
6825 </p>
6826 !! end
6827
6828 !! test
6829 Failing to transform badly formed HTML into correct XHTML
6830 !! wikitext
6831 <br style="clear: left;">
6832 <br style="clear: right;">
6833 <br style="clear: both;">
6834 !! html
6835 <p><br style="clear: left;" />
6836 <br style="clear: right;" />
6837 <br style="clear: both;" />
6838 </p>
6839 !!end
6840
6841 !! test
6842 Handling html with a div self-closing tag
6843 !! wikitext
6844 <div title />
6845 <div title/>
6846 <div title/ >
6847 <div title=bar />
6848 <div title=bar/>
6849 <div title=bar/ >
6850 !! html
6851 <p>&lt;div title /&gt;
6852 &lt;div title/&gt;
6853 </p>
6854 <div>
6855 <p>&lt;div title=bar /&gt;
6856 &lt;div title=bar/&gt;
6857 </p>
6858 <div title="bar/"></div>
6859 </div>
6860
6861 !! end
6862
6863 !! test
6864 Handling html with a br self-closing tag
6865 !! wikitext
6866 <br title />
6867 <br title/>
6868 <br title/ >
6869 <br title=bar />
6870 <br title=bar/>
6871 <br title=bar/ >
6872 !! html
6873 <p><br title="title" />
6874 <br title="title" />
6875 <br />
6876 <br title="bar" />
6877 <br title="bar" />
6878 <br title="bar/" />
6879 </p>
6880 !! end
6881
6882 !! test
6883 Horizontal ruler (should it add that extra space?)
6884 !! wikitext
6885 <hr>
6886 <hr >
6887 foo <hr
6888 > bar
6889 !! html
6890 <hr />
6891 <hr />
6892 foo <hr /> bar
6893
6894 !! end
6895
6896 !! test
6897 Horizontal ruler -- 4+ dashes render hr
6898 !! wikitext
6899 ----
6900 !! html
6901 <hr />
6902
6903 !! end
6904
6905 !! test
6906 Horizontal ruler -- eats additional dashes on the same line
6907 !! wikitext
6908 ---------
6909 !! html
6910 <hr />
6911
6912 !! end
6913
6914 !! test
6915 Horizontal ruler -- does not collapse dashes on consecutive lines
6916 !! wikitext
6917 ----
6918 ----
6919 !! html
6920 <hr />
6921 <hr />
6922
6923 !! end
6924
6925 !! test
6926 Horizontal ruler -- <4 dashes render as plain text
6927 !! wikitext
6928 ---
6929 !! html
6930 <p>---
6931 </p>
6932 !! end
6933
6934 !! test
6935 Horizontal ruler -- Supports content following dashes on same line
6936 !! wikitext
6937 ---- Foo
6938 !! html
6939 <hr /> Foo
6940
6941 !! end
6942
6943 ###
6944 ### Block-level elements
6945 ###
6946 !! test
6947 Common list
6948 !! wikitext
6949 *Common list
6950 * item 2
6951 *item 3
6952 !! html
6953 <ul><li>Common list</li>
6954 <li> item 2</li>
6955 <li>item 3</li></ul>
6956
6957 !! end
6958
6959 !! test
6960 Numbered list
6961 !! wikitext
6962 #Numbered list
6963 #item 2
6964 # item 3
6965 !! html
6966 <ol><li>Numbered list</li>
6967 <li>item 2</li>
6968 <li> item 3</li></ol>
6969
6970 !! end
6971
6972 !! test
6973 Mixed list
6974 !! wikitext
6975 *Mixed list
6976 *# with numbers
6977 ** and bullets
6978 *# and numbers
6979 *bullets again
6980 **bullet level 2
6981 ***bullet level 3
6982 ***#Number on level 4
6983 **bullet level 2
6984 **#Number on level 3
6985 **#Number on level 3
6986 *#number level 2
6987 *Level 1
6988 *** Level 3
6989 #** Level 3, but ordered
6990 !! html
6991 <ul><li>Mixed list
6992 <ol><li> with numbers</li></ol>
6993 <ul><li> and bullets</li></ul>
6994 <ol><li> and numbers</li></ol></li>
6995 <li>bullets again
6996 <ul><li>bullet level 2
6997 <ul><li>bullet level 3
6998 <ol><li>Number on level 4</li></ol></li></ul></li>
6999 <li>bullet level 2
7000 <ol><li>Number on level 3</li>
7001 <li>Number on level 3</li></ol></li></ul>
7002 <ol><li>number level 2</li></ol></li>
7003 <li>Level 1
7004 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7005 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7006
7007 !! end
7008
7009 !! test
7010 Nested lists 1
7011 !! wikitext
7012 *foo
7013 **bar
7014 !! html
7015 <ul><li>foo
7016 <ul><li>bar</li></ul></li></ul>
7017
7018 !! end
7019
7020 !! test
7021 Nested lists 2
7022 !! wikitext
7023 **foo
7024 *bar
7025 !! html
7026 <ul><li><ul><li>foo</li></ul></li>
7027 <li>bar</li></ul>
7028
7029 !! end
7030
7031 !! test
7032 Nested lists 3 (first element empty)
7033 !! wikitext
7034 *
7035 **bar
7036 !! html
7037 <ul><li>
7038 <ul><li>bar</li></ul></li></ul>
7039
7040 !! end
7041
7042 !! test
7043 Nested lists 4 (first element empty)
7044 !! wikitext
7045 **
7046 *bar
7047 !! html
7048 <ul><li><ul><li></li></ul></li>
7049 <li>bar</li></ul>
7050
7051 !! end
7052
7053 !! test
7054 Nested lists 5 (both elements empty)
7055 !! wikitext
7056 **
7057 *
7058 !! html
7059 <ul><li><ul><li></li></ul></li>
7060 <li></li></ul>
7061
7062 !! end
7063
7064 !! test
7065 Nested lists 6 (both elements empty)
7066 !! wikitext
7067 *
7068 **
7069 !! html
7070 <ul><li>
7071 <ul><li></li></ul></li></ul>
7072
7073 !! end
7074
7075 !! test
7076 Nested lists 7 (skip initial nesting levels)
7077 !! wikitext
7078 *** foo
7079 !! html
7080 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7081
7082 !! end
7083
7084 !! test
7085 Nested lists 8 (multiple nesting transitions)
7086 !! wikitext
7087 * foo
7088 *** bar
7089 ** baz
7090 * boo
7091 !! html
7092 <ul><li> foo
7093 <ul><li><ul><li> bar</li></ul></li>
7094 <li> baz</li></ul></li>
7095 <li> boo</li></ul>
7096
7097 !! end
7098
7099 !! test
7100 1. Lists with start-of-line-transparent tokens before bullets: Comments
7101 !! wikitext
7102 *foo
7103 *<!--cmt-->bar
7104 <!--cmt-->*baz
7105 !! html
7106 <ul><li>foo</li>
7107 <li>bar</li>
7108 <li>baz</li></ul>
7109
7110 !! end
7111
7112 !! test
7113 2. Lists with start-of-line-transparent tokens before bullets: Template close
7114 !! wikitext
7115 *foo {{echo|bar
7116 }}*baz
7117 !! html
7118 <ul><li>foo bar</li>
7119 <li>baz</li></ul>
7120
7121 !! end
7122
7123 !! test
7124 List items are not parsed correctly following a <pre> block (bug 785)
7125 !! wikitext
7126 * <pre>foo</pre>
7127 * <pre>bar</pre>
7128 * zar
7129 !! html
7130 <ul><li> <pre>foo</pre></li>
7131 <li> <pre>bar</pre></li>
7132 <li> zar</li></ul>
7133
7134 !! end
7135
7136 !! test
7137 List items from template
7138 !! wikitext
7139
7140 {{inner list}}
7141 * item 2
7142
7143 * item 0
7144 {{inner list}}
7145 * item 2
7146
7147 * item 0
7148 * notSOL{{inner list}}
7149 * item 2
7150 !! html
7151 <ul><li> item 1</li>
7152 <li> item 2</li></ul>
7153 <ul><li> item 0</li>
7154 <li> item 1</li>
7155 <li> item 2</li></ul>
7156 <ul><li> item 0</li>
7157 <li> notSOL</li>
7158 <li> item 1</li>
7159 <li> item 2</li></ul>
7160
7161 !! end
7162
7163 !! test
7164 List interrupted by empty line or heading
7165 !! wikitext
7166 * foo
7167
7168 ** bar
7169 == A heading ==
7170 * Another list item
7171 !! html
7172 <ul><li> foo</li></ul>
7173 <ul><li><ul><li> bar</li></ul></li></ul>
7174 <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>
7175 <ul><li> Another list item</li></ul>
7176
7177 !!end
7178
7179 !!test
7180 Multiple list tags generated by templates
7181 !! wikitext
7182 {{echo|<li>}}a
7183 {{echo|<li>}}b
7184 {{echo|<li>}}c
7185 !! html
7186 <li>a
7187 <li>b
7188 <li>c</li>
7189 </li>
7190 </li>
7191
7192 !!end
7193
7194 !!test
7195 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7196 !! wikitext
7197 *a
7198 <!--This line will NOT split the list-->
7199 *b
7200 <!--This line will NOT split the list either-->
7201 *c
7202 <!--foo--> <!----> <!--This line NOT split the list either-->
7203 *d
7204 !! html
7205 <ul><li>a</li>
7206 <li>b</li>
7207 <li>c</li>
7208 <li>d</li></ul>
7209
7210 !!end
7211
7212 !!test
7213 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7214 !! wikitext
7215 *a
7216 <!--This line will NOT split the list-->
7217 *b
7218 <!--This line will NOT split the list either-->
7219 *c
7220 <!--foo--> <!----> <!--This line NOT split the list
7221 either-->
7222 *d
7223 !! html
7224 <ul><li>a</li>
7225 <li>b</li>
7226 <li>c</li>
7227 <li>d</li></ul>
7228
7229 !!end
7230
7231 !!test
7232 Test the li-hack
7233 (Cannot test this with PHP parser since it relies on Tidy for the hack)
7234 !!options
7235 parsoid=wt2html,wt2wt
7236 !! wikitext
7237 * foo
7238 * <li>li-hack
7239 * {{echo|<li>templated li-hack}}
7240 * <!--foo--> <li> unsupported li-hack with preceding comments
7241
7242 <ul>
7243 <li><li>not a li-hack
7244 </li>
7245 </ul>
7246 !! html
7247 <ul>
7248 <li> foo</li>
7249 <li>li-hack</li>
7250 <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>
7251 <li> <!--foo--> </li>
7252 <li> li-hack with preceding comments</li>
7253 </ul>
7254
7255 <ul>
7256 <li></li>
7257 <li>not a li-hack
7258 </li>
7259 </ul>
7260 !!end
7261
7262 !! test
7263 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
7264 !! options
7265 parsoid
7266 !! wikitext
7267 # foo
7268 ## bar
7269 * foo
7270 ** bar
7271 : foo
7272 :: bar
7273 !! html
7274 <ol>
7275 <li> foo<ol>
7276 <li> bar</li>
7277 </ol></li>
7278 </ol><ul>
7279 <li> foo<ul>
7280 <li> bar</li>
7281 </ul></li>
7282 </ul><dl>
7283 <dd> foo<dl>
7284 <dd> bar</dd>
7285 </dl></dd>
7286 </dl>
7287 !! end
7288
7289 !! test
7290 Parsoid: Test of whitespace serialization with Templated bullets
7291 !! options
7292 parsoid
7293 !! wikitext
7294 * {{bullet}}
7295 !! html
7296 <ul>
7297 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
7298 </ul>
7299 !! end
7300
7301 # ------------------------------------------------------------------------
7302 # The next set of tests are about Parsoid's ability to handle badly nested
7303 # tags (parse, minimize scope of fixup, and roundtrip back)
7304 # ------------------------------------------------------------------------
7305
7306 !! test
7307 Unbalanced closing block tags break a list
7308 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7309 !! wikitext
7310 <div>
7311 *a</div><div>
7312 *b</div>
7313 !! html/parsoid
7314 <div>
7315 <ul>
7316 <li>a
7317 </li>
7318 </ul></div><div>
7319 <ul>
7320 <li>b
7321 </li>
7322 </ul></div>
7323 !! end
7324
7325 !! test
7326 Unbalanced closing non-block tags don't break a list
7327 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7328 !! wikitext
7329 <span>
7330 *a</span><span>
7331 *b</span>
7332 !! html/parsoid
7333 <p><span></span>
7334 </p>
7335 <ul>
7336 <li>a<span></span>
7337 </li>
7338 <li>b
7339 </li>
7340 </ul>
7341 !! end
7342
7343 !! test
7344 Unclosed formatting tags that straddle lists are closed and reopened
7345 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7346 !! wikitext
7347 # <s> a
7348 # b </s>
7349 !! html/parsoid
7350 <ol>
7351 <li> <s> a </s>
7352 </li>
7353 <li> <s> b </s>
7354 </li>
7355 </ol>
7356 !! end
7357
7358 !!test
7359 List embedded in a non-block tag
7360 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
7361 !! wikitext
7362 <small>
7363 * foo
7364 </small>
7365 !! html/parsoid
7366 <p><small></small></p>
7367 <small>
7368 <ul>
7369 <li> foo</li>
7370 </ul>
7371 </small>
7372 <p><small></small></p>
7373 !!end
7374
7375 !! test
7376 Table with missing opening <tr> tag
7377 !! options
7378 parsoid=wt2html,wt2wt
7379 !! wikitext
7380 <table>
7381 <td>foo</td>
7382 </tr>
7383 </table>
7384 !! html/parsoid
7385 <table>
7386 <tr>
7387 <td>foo</td>
7388 </tr>
7389 </table>
7390 !! end
7391
7392 ###
7393 ### Magic Words
7394 ###
7395
7396 # Note that the current date is hard-coded as
7397 # 1970-01-01T00:02:03Z (a Thursday)
7398 # when running parser tests. The timezone is also fixed to GMT, so
7399 # local date will be identical to current date.
7400
7401 !! test
7402 Magic Word: {{CURRENTDAY}}
7403 !! wikitext
7404 {{CURRENTDAY}}
7405 !! html
7406 <p>1
7407 </p>
7408 !! end
7409
7410 !! test
7411 Magic Word: {{CURRENTDAY2}}
7412 !! wikitext
7413 {{CURRENTDAY2}}
7414 !! html
7415 <p>01
7416 </p>
7417 !! end
7418
7419 !! test
7420 Magic Word: {{CURRENTDAYNAME}}
7421 !! wikitext
7422 {{CURRENTDAYNAME}}
7423 !! html
7424 <p>Thursday
7425 </p>
7426 !! end
7427
7428 !! test
7429 Magic Word: {{CURRENTDOW}}
7430 !! wikitext
7431 {{CURRENTDOW}}
7432 !! html
7433 <p>4
7434 </p>
7435 !! end
7436
7437 !! test
7438 Magic Word: {{CURRENTMONTH}}
7439 !! wikitext
7440 {{CURRENTMONTH}}
7441 !! html
7442 <p>01
7443 </p>
7444 !! end
7445
7446 !! test
7447 Magic Word: {{CURRENTMONTH1}}
7448 !! wikitext
7449 {{CURRENTMONTH1}}
7450 !! html
7451 <p>1
7452 </p>
7453 !! end
7454
7455 !! test
7456 Magic Word: {{CURRENTMONTHABBREV}}
7457 !! wikitext
7458 {{CURRENTMONTHABBREV}}
7459 !! html
7460 <p>Jan
7461 </p>
7462 !! end
7463
7464 !! test
7465 Magic Word: {{CURRENTMONTHNAME}}
7466 !! wikitext
7467 {{CURRENTMONTHNAME}}
7468 !! html
7469 <p>January
7470 </p>
7471 !! end
7472
7473 !! test
7474 Magic Word: {{CURRENTMONTHNAMEGEN}}
7475 !! wikitext
7476 {{CURRENTMONTHNAMEGEN}}
7477 !! html
7478 <p>January
7479 </p>
7480 !! end
7481
7482 !! test
7483 Magic Word: {{CURRENTTIME}}
7484 !! wikitext
7485 {{CURRENTTIME}}
7486 !! html
7487 <p>00:02
7488 </p>
7489 !! end
7490
7491 !! test
7492 Magic Word: {{CURRENTHOUR}}
7493 !! wikitext
7494 {{CURRENTHOUR}}
7495 !! html
7496 <p>00
7497 </p>
7498 !! end
7499
7500 !! test
7501 Magic Word: {{CURRENTWEEK}} (@bug 4594)
7502 !! wikitext
7503 {{CURRENTWEEK}}
7504 !! html
7505 <p>1
7506 </p>
7507 !! end
7508
7509 !! test
7510 Magic Word: {{CURRENTYEAR}}
7511 !! wikitext
7512 {{CURRENTYEAR}}
7513 !! html
7514 <p>1970
7515 </p>
7516 !! end
7517
7518 !! test
7519 Magic Word: {{CURRENTTIMESTAMP}}
7520 !! wikitext
7521 {{CURRENTTIMESTAMP}}
7522 !! html
7523 <p>19700101000203
7524 </p>
7525 !! end
7526
7527 !! test
7528 Magic Words LOCAL (UTC)
7529 !! wikitext
7530 * {{LOCALMONTH}}
7531 * {{LOCALMONTH1}}
7532 * {{LOCALMONTHNAME}}
7533 * {{LOCALMONTHNAMEGEN}}
7534 * {{LOCALMONTHABBREV}}
7535 * {{LOCALDAY}}
7536 * {{LOCALDAY2}}
7537 * {{LOCALDAYNAME}}
7538 * {{LOCALYEAR}}
7539 * {{LOCALTIME}}
7540 * {{LOCALHOUR}}
7541 * {{LOCALWEEK}}
7542 * {{LOCALDOW}}
7543 * {{LOCALTIMESTAMP}}
7544 !! html
7545 <ul><li> 01</li>
7546 <li> 1</li>
7547 <li> January</li>
7548 <li> January</li>
7549 <li> Jan</li>
7550 <li> 1</li>
7551 <li> 01</li>
7552 <li> Thursday</li>
7553 <li> 1970</li>
7554 <li> 00:02</li>
7555 <li> 00</li>
7556 <li> 1</li>
7557 <li> 4</li>
7558 <li> 19700101000203</li></ul>
7559
7560 !! end
7561
7562 !! test
7563 Magic Word: {{FULLPAGENAME}}
7564 !! options
7565 title=[[User:Ævar Arnfjörð Bjarmason]]
7566 !! wikitext
7567 {{FULLPAGENAME}}
7568 !! html
7569 <p>User:Ævar Arnfjörð Bjarmason
7570 </p>
7571 !! end
7572
7573 !! test
7574 Magic Word: {{FULLPAGENAMEE}}
7575 !! options
7576 title=[[User:Ævar Arnfjörð Bjarmason]]
7577 !! wikitext
7578 {{FULLPAGENAMEE}}
7579 !! html
7580 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7581 </p>
7582 !! end
7583
7584 !! test
7585 Magic Word: {{TALKSPACE}}
7586 !! options
7587 title=[[User:Ævar Arnfjörð Bjarmason]]
7588 !! wikitext
7589 {{TALKSPACE}}
7590 !! html
7591 <p>User talk
7592 </p>
7593 !! end
7594
7595 !! test
7596 Magic Word: {{TALKSPACE}}, same namespace
7597 !! options
7598 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7599 !! wikitext
7600 {{TALKSPACE}}
7601 !! html
7602 <p>User talk
7603 </p>
7604 !! end
7605
7606 !! test
7607 Magic Word: {{TALKSPACE}}, main namespace
7608 !! options
7609 title=[[Parser Test]]
7610 !! wikitext
7611 {{TALKSPACE}}
7612 !! html
7613 <p>Talk
7614 </p>
7615 !! end
7616
7617 !! test
7618 Magic Word: {{TALKSPACEE}}
7619 !! options
7620 title=[[User:Ævar Arnfjörð Bjarmason]]
7621 !! wikitext
7622 {{TALKSPACEE}}
7623 !! html
7624 <p>User_talk
7625 </p>
7626 !! end
7627
7628 !! test
7629 Magic Word: {{SUBJECTSPACE}}
7630 !! options
7631 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7632 !! wikitext
7633 {{SUBJECTSPACE}}
7634 !! html
7635 <p>User
7636 </p>
7637 !! end
7638
7639 !! test
7640 Magic Word: {{SUBJECTSPACE}}, same namespace
7641 !! options
7642 title=[[User:Ævar Arnfjörð Bjarmason]]
7643 !! wikitext
7644 {{SUBJECTSPACE}}
7645 !! html
7646 <p>User
7647 </p>
7648 !! end
7649
7650 !! test
7651 Magic Word: {{SUBJECTSPACE}}, main namespace
7652 !! options
7653 title=[[Parser Test]]
7654 !! wikitext
7655 {{SUBJECTSPACE}}
7656 !! html
7657
7658 !! end
7659
7660 !! test
7661 Magic Word: {{SUBJECTSPACEE}}
7662 !! options
7663 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7664 !! wikitext
7665 {{SUBJECTSPACEE}}
7666 !! html
7667 <p>User
7668 </p>
7669 !! end
7670
7671 !! test
7672 Magic Word: {{NAMESPACE}}
7673 !! options
7674 title=[[User:Ævar Arnfjörð Bjarmason]]
7675 !! wikitext
7676 {{NAMESPACE}}
7677 !! html
7678 <p>User
7679 </p>
7680 !! end
7681
7682 !! test
7683 Magic Word: {{NAMESPACEE}}
7684 !! options
7685 title=[[User:Ævar Arnfjörð Bjarmason]]
7686 !! wikitext
7687 {{NAMESPACEE}}
7688 !! html
7689 <p>User
7690 </p>
7691 !! end
7692
7693 !! test
7694 Magic Word: {{NAMESPACENUMBER}}
7695 !! options
7696 title=[[User:Ævar Arnfjörð Bjarmason]]
7697 !! wikitext
7698 {{NAMESPACENUMBER}}
7699 !! html
7700 <p>2
7701 </p>
7702 !! end
7703
7704 !! test
7705 Magic Word: {{SUBPAGENAME}}
7706 !! options
7707 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7708 !! wikitext
7709 {{SUBPAGENAME}}
7710 !! html
7711 <p>sub ö
7712 </p>
7713 !! end
7714
7715 !! test
7716 Magic Word: {{SUBPAGENAMEE}}
7717 !! options
7718 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7719 !! wikitext
7720 {{SUBPAGENAMEE}}
7721 !! html
7722 <p>sub_%C3%B6
7723 </p>
7724 !! end
7725
7726 !! test
7727 Magic Word: {{ROOTPAGENAME}}
7728 !! options
7729 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7730 !! wikitext
7731 {{ROOTPAGENAME}}
7732 !! html
7733 <p>Ævar Arnfjörð Bjarmason
7734 </p>
7735 !! end
7736
7737 !! test
7738 Magic Word: {{ROOTPAGENAMEE}}
7739 !! options
7740 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7741 !! wikitext
7742 {{ROOTPAGENAMEE}}
7743 !! html
7744 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7745 </p>
7746 !! end
7747
7748 !! test
7749 Magic Word: {{BASEPAGENAME}}
7750 !! options
7751 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7752 !! wikitext
7753 {{BASEPAGENAME}}
7754 !! html
7755 <p>Ævar Arnfjörð Bjarmason
7756 </p>
7757 !! end
7758
7759 !! test
7760 Magic Word: {{BASEPAGENAMEE}}
7761 !! options
7762 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7763 !! wikitext
7764 {{BASEPAGENAMEE}}
7765 !! html
7766 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7767 </p>
7768 !! end
7769
7770 !! test
7771 Magic Word: {{TALKPAGENAME}}
7772 !! options
7773 title=[[User:Ævar Arnfjörð Bjarmason]]
7774 !! wikitext
7775 {{TALKPAGENAME}}
7776 !! html
7777 <p>User talk:Ævar Arnfjörð Bjarmason
7778 </p>
7779 !! end
7780
7781 !! test
7782 Magic Word: {{TALKPAGENAMEE}}
7783 !! options
7784 title=[[User:Ævar Arnfjörð Bjarmason]]
7785 !! wikitext
7786 {{TALKPAGENAMEE}}
7787 !! html
7788 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7789 </p>
7790 !! end
7791
7792 !! test
7793 Magic Word: {{SUBJECTPAGENAME}}
7794 !! options
7795 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7796 !! wikitext
7797 {{SUBJECTPAGENAME}}
7798 !! html
7799 <p>User:Ævar Arnfjörð Bjarmason
7800 </p>
7801 !! end
7802
7803 !! test
7804 Magic Word: {{SUBJECTPAGENAMEE}}
7805 !! options
7806 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7807 !! wikitext
7808 {{SUBJECTPAGENAMEE}}
7809 !! html
7810 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7811 </p>
7812 !! end
7813
7814 !! test
7815 Magic Word: {{NUMBEROFFILES}}
7816 !! wikitext
7817 {{NUMBEROFFILES}}
7818 !! html
7819 <p>5
7820 </p>
7821 !! end
7822
7823 !! test
7824 Magic Word: {{PAGENAME}}
7825 !! options
7826 title=[[User:Ævar Arnfjörð Bjarmason]]
7827 !! wikitext
7828 {{PAGENAME}}
7829 !! html
7830 <p>Ævar Arnfjörð Bjarmason
7831 </p>
7832 !! end
7833
7834 !! test
7835 Magic Word: {{PAGENAME}} with metacharacters
7836 !! options
7837 title=[['foo & bar = baz']]
7838 !! wikitext
7839 ''{{PAGENAME}}''
7840 !! html
7841 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7842 </p>
7843 !! end
7844
7845 !! test
7846 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7847 !! options
7848 title=[[*RFC 1234 http://example.com/]]
7849 !! wikitext
7850 {{PAGENAME}}
7851 !! html
7852 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7853 </p>
7854 !! end
7855
7856 !! test
7857 Magic Word: {{PAGENAMEE}}
7858 !! options
7859 title=[[User:Ævar Arnfjörð Bjarmason]]
7860 !! wikitext
7861 {{PAGENAMEE}}
7862 !! html
7863 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7864 </p>
7865 !! end
7866
7867 !! test
7868 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7869 !! options
7870 title=[[*RFC 1234 http://example.com/]]
7871 !! wikitext
7872 {{PAGENAMEE}}
7873 !! html
7874 <p>&#42;RFC_1234_http&#58;//example.com/
7875 </p>
7876 !! end
7877
7878 !! test
7879 Magic Word: {{REVISIONID}}
7880 !! wikitext
7881 {{REVISIONID}}
7882 !! html
7883 <p>1337
7884 </p>
7885 !! end
7886
7887 !! test
7888 Magic Word: {{SCRIPTPATH}}
7889 !! wikitext
7890 {{SCRIPTPATH}}
7891 !! html
7892 <p>/
7893 </p>
7894 !! end
7895
7896 !! test
7897 Magic Word: {{STYLEPATH}}
7898 !! wikitext
7899 {{STYLEPATH}}
7900 !! html
7901 <p>/skins
7902 </p>
7903 !! end
7904
7905 !! test
7906 Magic Word: {{SERVER}}
7907 !! wikitext
7908 {{SERVER}}
7909 !! html
7910 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7911 </p>
7912 !! end
7913
7914 !! test
7915 Magic Word: {{SERVERNAME}}
7916 !! wikitext
7917 {{SERVERNAME}}
7918 !! html
7919 <p>example.org
7920 </p>
7921 !! end
7922
7923 !! test
7924 Magic Word: {{SITENAME}}
7925 !! wikitext
7926 {{SITENAME}}
7927 !! html
7928 <p>MediaWiki
7929 </p>
7930 !! end
7931
7932 !! test
7933 Case-sensitive magic words, when cased differently, should just be template transclusions
7934 !! wikitext
7935 {{CurrentMonth}}
7936 {{currentday}}
7937 {{cURreNTweEK}}
7938 {{currentHour}}
7939 !! html
7940 <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>
7941 <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>
7942 <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>
7943 <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>
7944 </p>
7945 !! end
7946
7947 !! test
7948 Case-insensitive magic words should still work with weird casing.
7949 !! wikitext
7950 {{sErVeRNaMe}}
7951 {{LCFirst:AOEU}}
7952 {{ucFIRST:aoeu}}
7953 {{SERver}}
7954 !! html
7955 <p>example.org
7956 aOEU
7957 Aoeu
7958 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7959 </p>
7960 !! end
7961
7962 !! test
7963 Namespace 1 {{ns:1}}
7964 !! wikitext
7965 {{ns:1}}
7966 !! html
7967 <p>Talk
7968 </p>
7969 !! end
7970
7971 !! test
7972 Namespace 1 {{ns:01}}
7973 !! wikitext
7974 {{ns:01}}
7975 !! html
7976 <p>Talk
7977 </p>
7978 !! end
7979
7980 !! test
7981 Namespace 0 {{ns:0}} (bug 4783)
7982 !! wikitext
7983 {{ns:0}}
7984 !! html
7985
7986 !! end
7987
7988 !! test
7989 Namespace 0 {{ns:00}} (bug 4783)
7990 !! wikitext
7991 {{ns:00}}
7992 !! html
7993
7994 !! end
7995
7996 !! test
7997 Namespace -1 {{ns:-1}}
7998 !! wikitext
7999 {{ns:-1}}
8000 !! html
8001 <p>Special
8002 </p>
8003 !! end
8004
8005 !! test
8006 Namespace User {{ns:User}}
8007 !! wikitext
8008 {{ns:User}}
8009 !! html
8010 <p>User
8011 </p>
8012 !! end
8013
8014 !! test
8015 Namespace User talk {{ns:User_talk}}
8016 !! wikitext
8017 {{ns:User_talk}}
8018 !! html
8019 <p>User talk
8020 </p>
8021 !! end
8022
8023 !! test
8024 Namespace User talk {{ns:uSeR tAlK}}
8025 !! wikitext
8026 {{ns:uSeR tAlK}}
8027 !! html
8028 <p>User talk
8029 </p>
8030 !! end
8031
8032 !! test
8033 Namespace File {{ns:File}}
8034 !! wikitext
8035 {{ns:File}}
8036 !! html
8037 <p>File
8038 </p>
8039 !! end
8040
8041 !! test
8042 Namespace File {{ns:Image}}
8043 !! wikitext
8044 {{ns:Image}}
8045 !! html
8046 <p>File
8047 </p>
8048 !! end
8049
8050 !! test
8051 Namespace (lang=de) Benutzer {{ns:User}}
8052 !! options
8053 language=de
8054 !! wikitext
8055 {{ns:User}}
8056 !! html
8057 <p>Benutzer
8058 </p>
8059 !! end
8060
8061 !! test
8062 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
8063 !! options
8064 language=de
8065 !! wikitext
8066 {{ns:3}}
8067 !! html
8068 <p>Benutzer Diskussion
8069 </p>
8070 !! end
8071
8072
8073 !! test
8074 Urlencode
8075 !! wikitext
8076 {{urlencode:hi world?!}}
8077 {{urlencode:hi world?!|WIKI}}
8078 {{urlencode:hi world?!|PATH}}
8079 {{urlencode:hi world?!|QUERY}}
8080 !! html
8081 <p>hi+world%3F%21
8082 hi_world%3F!
8083 hi%20world%3F%21
8084 hi+world%3F%21
8085 </p>
8086 !! end
8087
8088 !! test
8089 Magic Word: prioritize type info over data-parsoid
8090 !! options
8091 parsoid=html2wt
8092 !! wikitext
8093 __FORCETOC__
8094 !! html
8095 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
8096 !! end
8097
8098 !! test
8099 Magic Word: serialize on separate line (parsoid)
8100 !! options
8101 parsoid=wt2wt,html2wt
8102 !! wikitext
8103 foo
8104 __NOTOC__
8105 bar
8106 !! html
8107 foo<meta property="mw:PageProp/notoc"/>bar
8108 !! end
8109
8110 !! test
8111 Magic Word: rt non-english wikis
8112 !! options
8113 parsoid=wt2wt
8114 language=de
8115 !! wikitext
8116 __NOEDITSECTION__
8117 !! html
8118 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
8119 !! end
8120
8121 ###
8122 ### Magic links
8123 ###
8124 !! test
8125 Magic links: internal link to RFC (bug 479)
8126 !! wikitext
8127 [[RFC 123]]
8128 !! html
8129 <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>
8130 </p>
8131 !! end
8132
8133 !! test
8134 Magic links: RFC (bug 479)
8135 !! wikitext
8136 RFC 822
8137 !! html
8138 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8139 </p>
8140 !! end
8141
8142 !! test
8143 Magic links: ISBN (bug 1937)
8144 !! wikitext
8145 ISBN 0-306-40615-2
8146 !! html
8147 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8148 </p>
8149 !! end
8150
8151 !! test
8152 Magic links: PMID incorrectly converts space to underscore
8153 !! wikitext
8154 PMID 1234
8155 !! html
8156 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8157 </p>
8158 !! end
8159
8160 ###
8161 ### Templates
8162 ####
8163
8164 !! test
8165 Nonexistent template
8166 !! wikitext
8167 {{thistemplatedoesnotexist}}
8168 !! html
8169 <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>
8170 </p>
8171 !! end
8172
8173 !! test
8174 Template with invalid target containing tags
8175 !! wikitext
8176 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8177 !! html
8178 <p>{{a<b>b</b>|foo|a=b|a = b}}
8179 </p>
8180 !! end
8181
8182 !! test
8183 Template with invalid target containing unclosed tag
8184 !! wikitext
8185 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8186 !! html
8187 <p>{{a<b>|foo|a=b|a = b}}</b>
8188 </p>
8189 !! end
8190
8191 !! test
8192 Template with invalid target containing wikilink
8193 !! wikitext
8194 {{[[Main Page]]}}
8195 !! html/php
8196 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
8197 </p>
8198 !! html/parsoid
8199 <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>
8200 !! end
8201
8202 !! article
8203 Template:test
8204 !! text
8205 This is a test template
8206 !! endarticle
8207
8208 !! test
8209 Simple template
8210 !! wikitext
8211 {{test}}
8212 !! html
8213 <p>This is a test template
8214 </p>
8215 !! end
8216
8217 !! test
8218 Template with explicit namespace
8219 !! wikitext
8220 {{Template:test}}
8221 !! html
8222 <p>This is a test template
8223 </p>
8224 !! end
8225
8226
8227 !! article
8228 Template:paramtest
8229 !! text
8230 This is a test template with parameter {{{param}}}
8231 !! endarticle
8232
8233 !! test
8234 Template parameter
8235 !! wikitext
8236 {{paramtest|param=foo}}
8237 !! html
8238 <p>This is a test template with parameter foo
8239 </p>
8240 !! end
8241
8242 !! article
8243 Template:paramtestnum
8244 !! text
8245 [[{{{1}}}|{{{2}}}]]
8246 !! endarticle
8247
8248 !! test
8249 Template unnamed parameter
8250 !! wikitext
8251 {{paramtestnum|Main Page|the main page}}
8252 !! html
8253 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
8254 </p>
8255 !! end
8256
8257 !! article
8258 Template:templatesimple
8259 !! text
8260 (test)
8261 !! endarticle
8262
8263 !! article
8264 Template:templateredirect
8265 !! text
8266 #redirect [[Template:templatesimple]]
8267 !! endarticle
8268
8269 !! article
8270 Template:templateasargtestnum
8271 !! text
8272 {{{{{1}}}}}
8273 !! endarticle
8274
8275 !! article
8276 Template:templateasargtest
8277 !! text
8278 {{template{{{templ}}}}}
8279 !! endarticle
8280
8281 !! article
8282 Template:templateasargtest2
8283 !! text
8284 {{{{{templ}}}}}
8285 !! endarticle
8286
8287 !! test
8288 Template with template name as unnamed argument
8289 !! wikitext
8290 {{templateasargtestnum|templatesimple}}
8291 !! html
8292 <p>(test)
8293 </p>
8294 !! end
8295
8296 !! test
8297 Template with template name as argument
8298 !! wikitext
8299 {{templateasargtest|templ=simple}}
8300 !! html
8301 <p>(test)
8302 </p>
8303 !! end
8304
8305 !! test
8306 Template with template name as argument (2)
8307 !! wikitext
8308 {{templateasargtest2|templ=templatesimple}}
8309 !! html
8310 <p>(test)
8311 </p>
8312 !! end
8313
8314 !! article
8315 Template:templateasargtestdefault
8316 !! text
8317 {{{{{templ|templatesimple}}}}}
8318 !! endarticle
8319
8320 !! article
8321 Template:templa
8322 !! text
8323 '''templ'''
8324 !! endarticle
8325
8326 !! test
8327 Template with default value
8328 !! wikitext
8329 {{templateasargtestdefault}}
8330 !! html
8331 <p>(test)
8332 </p>
8333 !! end
8334
8335 !! test
8336 Template with default value (value set)
8337 !! wikitext
8338 {{templateasargtestdefault|templ=templa}}
8339 !! html
8340 <p><b>templ</b>
8341 </p>
8342 !! end
8343
8344 !! test
8345 Template redirect
8346 !! wikitext
8347 {{templateredirect}}
8348 !! html
8349 <p>(test)
8350 </p>
8351 !! end
8352
8353 !! test
8354 Template with argument in separate line
8355 !! wikitext
8356 {{ templateasargtest |
8357 templ = simple }}
8358 !! html
8359 <p>(test)
8360 </p>
8361 !! end
8362
8363 !! test
8364 Template with complex template as argument
8365 !! wikitext
8366 {{paramtest|
8367 param ={{ templateasargtest |
8368 templ = simple }}}}
8369 !! html
8370 <p>This is a test template with parameter (test)
8371 </p>
8372 !! end
8373
8374 !! test
8375 Template with thumb image (with link in description)
8376 !! wikitext
8377 {{paramtest|
8378 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
8379 !! html
8380 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>
8381
8382 !! end
8383
8384 !! article
8385 Template:complextemplate
8386 !! text
8387 {{{1}}} {{paramtest|
8388 param ={{{param}}}}}
8389 !! endarticle
8390
8391 !! test
8392 Template with complex arguments
8393 !! wikitext
8394 {{complextemplate|
8395 param ={{ templateasargtest |
8396 templ = simple }}|[[Template:complextemplate|link]]}}
8397 !! html
8398 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
8399 </p>
8400 !! end
8401
8402 !! test
8403 BUG 553: link with two variables in a piped link
8404 !! wikitext
8405 {|
8406 |[[{{{1}}}|{{{2}}}]]
8407 |}
8408 !! html
8409 <table>
8410 <tr>
8411 <td>[[{{{1}}}|{{{2}}}]]
8412 </td></tr></table>
8413
8414 !! end
8415
8416 !! test
8417 Magic variable as template parameter
8418 !! wikitext
8419 {{paramtest|param={{SITENAME}}}}
8420 !! html
8421 <p>This is a test template with parameter MediaWiki
8422 </p>
8423 !! end
8424
8425 !! article
8426 Template:linktest
8427 !! text
8428 [[{{{param}}}|link]]
8429 !! endarticle
8430
8431 !! test
8432 Template parameter as link source
8433 !! wikitext
8434 {{linktest|param=Main Page}}
8435 !! html
8436 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
8437 </p>
8438 !! end
8439
8440 !!test
8441 Template-generated attribute string (k='v')
8442 !! wikitext
8443 <span {{attr_str|id|v1}}>bar</span>
8444 !! html
8445 <p><span id="v1">bar</span>
8446 </p>
8447 !!end
8448
8449 !!article
8450 Template:paramtest2
8451 !! text
8452 including another template, {{paramtest|param={{{arg}}}}}
8453 !! endarticle
8454
8455 !! test
8456 Template passing argument to another template
8457 !! wikitext
8458 {{paramtest2|arg='hmm'}}
8459 !! html
8460 <p>including another template, This is a test template with parameter 'hmm'
8461 </p>
8462 !! end
8463
8464 !! article
8465 Template:Linktest2
8466 !! text
8467 Main Page
8468 !! endarticle
8469
8470 !! test
8471 Template as link source
8472 !! wikitext
8473 [[{{linktest2}}]]
8474
8475 [[{{linktest2}}|Main Page]]
8476
8477 [[{{linktest2}}]]Page
8478 !! html
8479 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8480 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8481 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
8482 </p>
8483 !! end
8484
8485
8486 !! article
8487 Template:loop1
8488 !! text
8489 {{loop2}}
8490 !! endarticle
8491
8492 !! article
8493 Template:loop2
8494 !! text
8495 {{loop1}}
8496 !! endarticle
8497
8498 !! test
8499 Template infinite loop
8500 !! wikitext
8501 {{loop1}}
8502 !! html
8503 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
8504 </p>
8505 !! end
8506
8507 !! test
8508 Template from main namespace
8509 !! wikitext
8510 {{:Main Page}}
8511 !! html
8512 <p>blah blah
8513 </p>
8514 !! end
8515
8516 !! article
8517 Template:table
8518 !! text
8519 {|
8520 | 1 || 2
8521 |-
8522 | 3 || 4
8523 |}
8524 !! endarticle
8525
8526 !! test
8527 BUG 529: Template with table, not included at beginning of line
8528 !! wikitext
8529 foo {{table}}
8530 !! html
8531 <p>foo
8532 </p>
8533 <table>
8534 <tr>
8535 <td> 1 </td>
8536 <td> 2
8537 </td></tr>
8538 <tr>
8539 <td> 3 </td>
8540 <td> 4
8541 </td></tr></table>
8542
8543 !! end
8544
8545 !! test
8546 BUG 523: Template shouldn't eat newline (or add an extra one before table)
8547 !! wikitext
8548 foo
8549 {{table}}
8550 !! html
8551 <p>foo
8552 </p>
8553 <table>
8554 <tr>
8555 <td> 1 </td>
8556 <td> 2
8557 </td></tr>
8558 <tr>
8559 <td> 3 </td>
8560 <td> 4
8561 </td></tr></table>
8562
8563 !! end
8564
8565 !! test
8566 BUG 41: Template parameters shown as broken links
8567 !! wikitext
8568 {{{parameter}}}
8569 !! html
8570 <p>{{{parameter}}}
8571 </p>
8572 !! end
8573
8574 !! test
8575 Template with targets containing wikilinks
8576 !! wikitext
8577 {{[[foo]]}}
8578
8579 {{[[{{echo|foo}}]]}}
8580
8581 {{{{echo|[[foo}}]]}}
8582 !! html
8583 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8584 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8585 </p><p>{{[[foo}}]]
8586 </p>
8587 !! end
8588
8589 !! article
8590 Template:MSGNW test
8591 !! text
8592 ''None'' of '''this''' should be
8593 * interpreted
8594 but rather passed unmodified
8595 {{test}}
8596 <gallery>
8597 File:Foobar.jpg
8598 </gallery>
8599 !! endarticle
8600
8601 # hmm, fix this or just deprecate msgnw and document its behavior?
8602 !! test
8603 msgnw keyword
8604 !! wikitext
8605 {{msgnw:MSGNW test}}
8606 !! html
8607 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
8608 &#42; interpreted
8609 &#32;but rather passed unmodified
8610 &#123;&#123;test&#125;&#125;
8611 &#60;gallery&#62;
8612 File:Foobar.jpg
8613 &#60;/gallery&#62;
8614 </p>
8615 !! end
8616
8617 !! test
8618 int keyword
8619 !! wikitext
8620 {{int:youhavenewmessages|lots of money|not!}}
8621 !! html
8622 <p>You have lots of money (not!).
8623 </p>
8624 !! end
8625
8626 !! article
8627 Template:Includes
8628 !! text
8629 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8630 !! endarticle
8631
8632 !! test
8633 <includeonly> and <noinclude> being included
8634 !! wikitext
8635 {{Includes}}
8636 !! html
8637 <p>Foobar
8638 </p>
8639 !! end
8640
8641 !! article
8642 Template:Includes2
8643 !! text
8644 <onlyinclude>Foo</onlyinclude>bar
8645 !! endarticle
8646
8647 !! test
8648 <onlyinclude> being included
8649 !! wikitext
8650 {{Includes2}}
8651 !! html
8652 <p>Foo
8653 </p>
8654 !! end
8655
8656
8657 !! article
8658 Template:Includes3
8659 !! text
8660 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8661 !! endarticle
8662
8663 !! test
8664 <onlyinclude> and <includeonly> being included
8665 !! wikitext
8666 {{Includes3}}
8667 !! html
8668 <p>Foo
8669 </p>
8670 !! end
8671
8672 !! test
8673 <includeonly> and <noinclude> on a page
8674 !! wikitext
8675 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8676 !! html
8677 <p>Foozar
8678 </p>
8679 !! end
8680
8681 !! test
8682 Un-closed <noinclude>
8683 !! wikitext
8684 <noinclude>
8685 !! html
8686 !! end
8687
8688 !! test
8689 <onlyinclude> on a page
8690 !! wikitext
8691 <onlyinclude>Foo</onlyinclude>bar
8692 !! html
8693 <p>Foobar
8694 </p>
8695 !! end
8696
8697 !! test
8698 Un-closed <onlyinclude>
8699 !! wikitext
8700 <onlyinclude>
8701 !! html
8702 !! end
8703
8704 !!test
8705 Self-closed noinclude, includeonly, onlyinclude tags
8706 !! wikitext
8707 <noinclude />
8708 <includeonly />
8709 <onlyinclude />
8710 !! html
8711 <p><br />
8712 </p>
8713 !!end
8714
8715 !!test
8716 Unbalanced includeonly and noinclude tags
8717 !! wikitext
8718 {|
8719 |a</noinclude>
8720 |b</noinclude></noinclude>
8721 |c</noinclude></includeonly>
8722 |d</includeonly></includeonly>
8723 |}
8724 !! html
8725 <table>
8726 <tr>
8727 <td>a
8728 </td>
8729 <td>b
8730 </td>
8731 <td>c&lt;/includeonly&gt;
8732 </td>
8733 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8734 </td></tr></table>
8735
8736 !!end
8737
8738 !! article
8739 Template:Includeonly section
8740 !! text
8741 <includeonly>
8742 ==Includeonly section==
8743 </includeonly>
8744 ==Section T-1==
8745 !!endarticle
8746
8747 !! test
8748 Bug 6563: Edit link generation for section shown by <includeonly>
8749 !! wikitext
8750 {{includeonly section}}
8751 !! html
8752 <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>
8753 <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>
8754
8755 !! end
8756
8757 # Uses same input as the contents of [[Template:Includeonly section]]
8758 !! test
8759 Bug 6563: Section extraction for section shown by <includeonly>
8760 !! options
8761 section=T-2
8762 !! wikitext
8763 <includeonly>
8764 ==Includeonly section==
8765 </includeonly>
8766 ==Section T-2==
8767 !! html
8768 ==Section T-2==
8769 !! end
8770
8771 !! test
8772 Bug 6563: Edit link generation for section suppressed by <includeonly>
8773 !! wikitext
8774 <includeonly>
8775 ==Includeonly section==
8776 </includeonly>
8777 ==Section 1==
8778 !! html
8779 <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>
8780
8781 !! end
8782
8783 !! test
8784 Bug 6563: Section extraction for section suppressed by <includeonly>
8785 !! options
8786 section=1
8787 !! wikitext
8788 <includeonly>
8789 ==Includeonly section==
8790 </includeonly>
8791 ==Section 1==
8792 !! html
8793 ==Section 1==
8794 !! end
8795
8796 !! test
8797 Un-closed <includeonly>
8798 !! wikitext
8799 <includeonly>
8800 !! html
8801 !! end
8802
8803 !! test
8804 Includes and comments at SOL
8805 !! wikitext
8806 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
8807
8808 <noinclude>
8809 some
8810 </noinclude>* stuff
8811 * here
8812
8813 <includeonly>can have stuff</includeonly>=== here ===
8814
8815 !! html/php
8816 <h2><span class="mw-headline" id="hu">hu</span></h2>
8817 <p>some
8818 </p>
8819 <ul><li> stuff</li>
8820 <li> here</li></ul>
8821 <h3><span class="mw-headline" id="here">here</span></h3>
8822
8823 !! html/parsoid
8824 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment -->
8825 <h2 data-parsoid='{}'> hu </h2>
8826
8827 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
8828
8829 <p data-parsoid='{}'>some</p>
8830 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>
8831 <ul data-parsoid='{}'>
8832 <li data-parsoid='{}'> stuff</li>
8833
8834 <li data-parsoid='{}'> here</li></ul>
8835
8836 <h3 data-parsoid='{}'> here </h3>
8837 !! end
8838
8839 # TODO: test with DOM fragment reuse!
8840 !! test
8841 Parsoid: DOM fragment reuse
8842 !! options
8843 parsoid=wt2wt,wt2html
8844 !! wikitext
8845 a{{echo|b<table></table>c}}d
8846
8847 a{{echo|b
8848 <table></table>
8849 c}}d
8850
8851 {{echo|a
8852
8853 <table></table>
8854
8855 b}}
8856 !! html
8857 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8858 <table></table>c"}},"i":0}}]}'>b</span>
8859 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8860
8861
8862 <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">
8863 </span>
8864 <table about="#mwt2"></table><span about="#mwt2">
8865 </span>
8866 <p about="#mwt2">cd</p>
8867
8868
8869 <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">
8870
8871 </span>
8872 <table about="#mwt3"></table><span about="#mwt3">
8873
8874 </span>
8875 <p about="#mwt3">b</p>
8876 !! end
8877
8878 !! test
8879 Parsoid: Merge double tds (bug 50603)
8880 !! options
8881 parsoid
8882 !! wikitext
8883 {|
8884 |{{echo|{{!}} foo}}
8885 |}
8886 !! html
8887 <table><tbody>
8888 <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>
8889 </tbody></table>
8890 !! end
8891
8892 !! test
8893 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8894 !! options
8895 parsoid
8896 !! wikitext
8897 {{echo|<div>}}
8898 {|
8899 |{{echo|{{!}} foo}}
8900 |}
8901 {{echo|</div>}}
8902 !! html
8903 <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}}]}'>
8904 <table><tbody>
8905 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8906 </tbody></table>
8907 </div>
8908 !! end
8909
8910 ###
8911 ### <includeonly> and <noinclude> in attributes
8912 ###
8913 !!test
8914 0. includeonly around the entire attribute
8915 !! wikitext
8916 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8917 !! html
8918 <p><span id="v2">bar</span>
8919 </p>
8920 !!end
8921
8922 !!test
8923 1. includeonly in html attr key
8924 !! wikitext
8925 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8926 !! html
8927 <p><span id="foo">bar</span>
8928 </p>
8929 !!end
8930
8931 !!test
8932 2. includeonly in html attr value
8933 !! wikitext
8934 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8935 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8936 !! html
8937 <p><span id="v1">bar</span>
8938 <span id="v1">bar</span>
8939 </p>
8940 !!end
8941
8942 !!test
8943 3. includeonly in part of an attr value
8944 !! wikitext
8945 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8946 !! html
8947 <p><span style="color:red;">bar</span>
8948 </p>
8949 !!end
8950
8951 !!test
8952 4. includeonly in table attributes
8953 !! wikitext
8954 {|
8955 |- <noinclude>
8956 |-
8957 |a
8958 </noinclude>
8959 |- <includeonly>
8960 |-
8961 |b
8962 </includeonly>
8963 |}
8964 !! html
8965 <table>
8966
8967
8968 <tr>
8969 <td>a
8970 </td></tr>
8971 </table>
8972
8973 !!end
8974
8975 ###
8976 ### Token Stream Patcher tests
8977 ###
8978 ### These tests won't always pass wt2wt and other modes because
8979 ### on serialization, the table will be output on a new line.
8980 ### For now, we are blacklisting them, and using this to test selser.
8981 ###
8982
8983 !!test
8984 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
8985 !!options
8986 parsoid=wt2html,wt2wt
8987 !!wikitext
8988 {{echo|}}{| width = '100%'
8989 |foo
8990 |}
8991 !!html/parsoid
8992 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
8993 <table width="100%">
8994 <tbody>
8995 <tr>
8996 <td>foo</td></tr></tbody></table>
8997 !!end
8998
8999 !!test
9000 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
9001 !!options
9002 parsoid=wt2html,wt2wt
9003 !!wikitext
9004 <includeonly>a</includeonly>{| {{{b}}}
9005 |c
9006 |}
9007 !!html/parsoid
9008 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[31,38,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{b}}}&amp;quot;}\">{{{b}}}&lt;/span>"},{"html":""}]]}' data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}'>
9009 <tbody><tr><td>c</td></tr>
9010 </tbody></table>
9011
9012 !!end
9013
9014 ###
9015 ### Testing parsing of templates where a template arg
9016 ### has the same name as the template itself.
9017 ###
9018
9019 !! article
9020 Template:quote
9021 !! text
9022 {{{quote|{{{1}}}}}}
9023 !! endarticle
9024
9025 !!test
9026 Templates: Template Name/Arg clash: 1. Use of positional param
9027 !! wikitext
9028 {{quote|foo}}
9029 !! html
9030 <p>foo
9031 </p>
9032 !!end
9033
9034 !!test
9035 Templates: Template Name/Arg clash: 2. Use of named param
9036 !! wikitext
9037 {{quote|quote=foo}}
9038 !! html
9039 <p>foo
9040 </p>
9041 !!end
9042
9043 !!test
9044 Templates: Template Name/Arg clash: 3. Use of named param with empty input
9045 !! wikitext
9046 {{quote|quote}}
9047 !! html
9048 <p>quote
9049 </p>
9050 !!end
9051
9052 ###
9053 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
9054 ###
9055
9056 !!test
9057 Templates: 1. Simple use
9058 !! wikitext
9059 {{echo|Foo}}
9060 !! html
9061 <p>Foo
9062 </p>
9063 !!end
9064
9065 !!test
9066 Templates: 2. Inside a block tag
9067 !! wikitext
9068 <div>{{echo|Foo}}</div>
9069 <blockquote>{{echo|Foo}}</blockquote>
9070 !! html
9071 <div>Foo</div>
9072 <blockquote>Foo</blockquote>
9073
9074 !!end
9075
9076 !!test
9077 Templates: P-wrapping: 1a. Templates on consecutive lines
9078 !! wikitext
9079 {{echo|Foo}}
9080 {{echo|bar}}
9081 !! html
9082 <p>Foo
9083 bar
9084 </p>
9085 !!end
9086
9087 !!test
9088 Templates: P-wrapping: 1b. Templates on consecutive lines
9089 !! wikitext
9090 Foo
9091
9092 {{echo|bar}}
9093 {{echo|baz}}
9094 !! html
9095 <p>Foo
9096 </p><p>bar
9097 baz
9098 </p>
9099 !!end
9100
9101 !!test
9102 Templates: P-wrapping: 1c. Templates on consecutive lines
9103 !! wikitext
9104 {{echo|Foo}}
9105 {{echo|bar}} <div>baz</div>
9106 !! html
9107 <p>Foo
9108 </p>
9109 bar <div>baz</div>
9110
9111 !!end
9112
9113 !!test
9114 Templates: P-wrapping: 1d. Template preceded by comment-only line
9115 !!options
9116 parsoid
9117 !! wikitext
9118 <!-- foo -->
9119 {{echo|Bar}}
9120 !! html
9121 <!-- foo -->
9122
9123 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
9124 !!end
9125
9126 !!test
9127 Templates: Inline Text: 1. Multiple template uses
9128 !! wikitext
9129 {{echo|Foo}}bar{{echo|baz}}
9130 !! html
9131 <p>Foobarbaz
9132 </p>
9133 !!end
9134
9135 !!test
9136 Templates: Inline Text: 2. Back-to-back template uses
9137 !! wikitext
9138 {{echo|Foo}}{{echo|bar}}
9139 !! html
9140 <p>Foobar
9141 </p>
9142 !!end
9143
9144 !!test
9145 Templates: Block Tags: 1. Multiple template uses
9146 !! wikitext
9147 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
9148 !! html
9149 <div>Foo</div><div>bar</div><div>baz</div>
9150
9151 !!end
9152
9153 !!test
9154 Templates: Block Tags: 2. Back-to-back template uses
9155 !! wikitext
9156 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
9157 !! html
9158 <div>Foo</div><div>bar</div>
9159
9160 !!end
9161
9162 !!test
9163 Templates: Links: 1. Simple example
9164 !! wikitext
9165 {{echo|[[Foo|bar]]}}
9166 !! html
9167 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9168 </p>
9169 !!end
9170
9171 !!test
9172 Templates: Links: 2. Generation of link href
9173 !! wikitext
9174 [[{{echo|Foo}}|bar]]
9175 !! html
9176 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9177 </p>
9178 !!end
9179
9180 !!test
9181 Templates: Links: 3. Generation of part of a link href
9182 !! wikitext
9183 [[Fo{{echo|o}}|bar]]
9184
9185 [[Foo{{echo|bar}}]]
9186
9187 [[Foo{{echo|bar}}baz]]
9188
9189 [[Foo{{echo|bar}}|bar]]
9190
9191 [[:Foo{{echo|bar}}]]
9192
9193 [[:Foo{{echo|bar}}|bar]]
9194 !! html
9195 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9196 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9197 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
9198 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9199 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9200 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9201 </p>
9202 !!end
9203
9204 !!test
9205 Templates: Links: 4. Multiple templates generating link href
9206 !! wikitext
9207 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
9208 !! html
9209 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9210 </p>
9211 !!end
9212
9213 !!test
9214 Templates: Links: 5. Generation of link text
9215 !! wikitext
9216 [[Foo|{{echo|bar}}]]
9217 !! html
9218 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9219 </p>
9220 !!end
9221
9222 !!test
9223 Templates: Links: 5. Nested templates (only outermost template should be marked)
9224 !! wikitext
9225 {{echo|[[{{echo|Foo}}|bar]]}}
9226 !! html
9227 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9228 </p>
9229 !!end
9230
9231 !!test
9232 Templates: HTML Tag: 1. Generation of HTML attr. key
9233 !! wikitext
9234 <div {{echo|style}}="color:red;">foo</div>
9235 !! html
9236 <div style="color:red;">foo</div>
9237
9238 !!end
9239
9240 !!test
9241 Templates: HTML Tag: 2. Generation of HTML attr. value
9242 !! wikitext
9243 <div style={{echo|'color:red;'}}>foo</div>
9244 !! html
9245 <div style="color:red;">foo</div>
9246
9247 !!end
9248
9249 !!test
9250 Templates: HTML Tag: 3. Generation of HTML attr key and value
9251 !! wikitext
9252 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
9253 !! html
9254 <div style="color:red;">foo</div>
9255
9256 !!end
9257
9258 !!test
9259 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
9260 !! wikitext
9261 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
9262 !! html
9263 <div title="This is a long title with just one piece templated">foo</div>
9264
9265 !!end
9266
9267 !!test
9268 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
9269 !! wikitext
9270 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
9271 !! html
9272 <div title="This is a long title with just one piece templated">foo</div>
9273
9274 !!end
9275
9276 !!test
9277 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
9278 !! wikitext
9279 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
9280 !! html
9281 <div title="This is a long title with just one piece templated">foo</div>
9282
9283 !!end
9284
9285 !!test
9286 Templates: HTML Tag: 7. Generation of partial attribute key string
9287 !! wikitext
9288 <div st{{echo|yle}}="color:red;">foo</div>
9289 !! html
9290 <div style="color:red;">foo</div>
9291
9292 !!end
9293
9294 !!test
9295 Templates: HTML Tables: 1. Generating start of a HTML table
9296 !! wikitext
9297 {{echo|<table><tr><td>foo</td>}}</tr></table>
9298 !! html
9299 <table><tr><td>foo</td></tr></table>
9300
9301 !!end
9302
9303 !!test
9304 Templates: HTML Tables: 2a. Generating middle of a HTML table
9305 !! wikitext
9306 <table><tr>{{echo|<td>foo</td>}}</tr></table>
9307 !! html
9308 <table><tr><td>foo</td></tr></table>
9309
9310 !!end
9311
9312 !!test
9313 Templates: HTML Tables: 2b. Generating middle of a HTML table
9314 !! wikitext
9315 <table>{{echo|<tr><td>foo</td></tr>}}</table>
9316 !! html
9317 <table><tr><td>foo</td></tr></table>
9318
9319 !!end
9320
9321 !!test
9322 Templates: HTML Tables: 3. Generating end of a HTML table
9323 !! wikitext
9324 <table><tr>{{echo|<td>foo</td></tr></table>}}
9325 !! html
9326 <table><tr><td>foo</td></tr></table>
9327
9328 !!end
9329
9330 !!test
9331 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
9332 !! wikitext
9333 {{echo|<table>}}<tr><td>foo</td></tr></table>
9334 !! html
9335 <table><tr><td>foo</td></tr></table>
9336
9337 !!end
9338
9339 !!test
9340 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
9341 !! wikitext
9342 <table>{{echo|<tr>}}<td>foo</td></tr></table>
9343 !! html
9344 <table><tr><td>foo</td></tr></table>
9345
9346 !!end
9347
9348 !!test
9349 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
9350 !! wikitext
9351 <table><tr>{{echo|<td>}}foo</td></tr></table>
9352 !! html
9353 <table><tr><td>foo</td></tr></table>
9354
9355 !!end
9356
9357 !!test
9358 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
9359 !! wikitext
9360 <table><tr><td>foo{{echo|</td>}}</tr></table>
9361 !! html
9362 <table><tr><td>foo</td></tr></table>
9363
9364 !!end
9365
9366 !!test
9367 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
9368 !! wikitext
9369 <table><tr><td>foo</td>{{echo|</tr>}}</table>
9370 !! html
9371 <table><tr><td>foo</td></tr></table>
9372
9373 !!end
9374
9375 !!test
9376 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
9377 !! wikitext
9378 <table><tr><td>foo</td></tr>{{echo|</table>}}
9379 !! html
9380 <table><tr><td>foo</td></tr></table>
9381
9382 !!end
9383
9384 !!test
9385 Templates: HTML Tables: 5. Proper fostering of categories from inside
9386 !!options
9387 parsoid=wt2html,wt2wt
9388 !! wikitext
9389 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
9390 <!--Two categories (Bug 50330)-->
9391 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
9392 !! html
9393 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
9394 <!--Two categories (Bug 50330)-->
9395 <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>
9396 !!end
9397
9398 !!test
9399 Templates: Wiki Tables: 1a. Fostering of entire template content
9400 !! wikitext
9401 {|
9402 {{echo|a}}
9403 |}
9404 !! html
9405 <table>
9406 a
9407 <tr><td></td></tr></table>
9408
9409 !!end
9410
9411 !!test
9412 Templates: Wiki Tables: 1b. Fostering of entire template content
9413 !! wikitext
9414 {|
9415 {{echo|<div>}}
9416 foo
9417 {{echo|</div>}}
9418 |}
9419 !! html
9420 <table>
9421 <div>
9422 <p>foo
9423 </p>
9424 </div>
9425 <tr><td></td></tr></table>
9426
9427 !!end
9428
9429 !!test
9430 Templates: Wiki Tables: 2. Fostering of partial template content
9431 !! wikitext
9432 {|
9433 {{echo|a
9434 <div>b</div>}}
9435 |}
9436 !! html
9437 <table>
9438 a
9439 <div>b</div>
9440 <tr><td></td></tr></table>
9441
9442 !!end
9443
9444 !!test
9445 Templates: Wiki Tables: 3. td-content via multiple templates
9446 !! wikitext
9447 {|
9448 {{echo|{{pipe}}a}}{{echo|b}}
9449 |}
9450 !! html
9451 <table>
9452 <tr>
9453 <td>ab
9454 </td></tr></table>
9455
9456 !!end
9457
9458 !!test
9459 Templates: Wiki Tables: 4. Templated tags, no content
9460 !! wikitext
9461 {{tbl-start}}
9462 {{tbl-end}}
9463 !! html
9464 <table>
9465 <tr><td></td></tr></table>
9466
9467 !!end
9468
9469 !!test
9470 Templates: Wiki Tables: 5. Templated tags, regular td-tags
9471 !! wikitext
9472 {{tbl-start}}
9473 |foo
9474 {{tbl-end}}
9475 !! html
9476 <table>
9477 <tr>
9478 <td>foo
9479 </td></tr></table>
9480
9481 !!end
9482
9483 !!test
9484 Templates: Wiki Tables: 6. Templated tags, templated td-tags
9485 !! wikitext
9486 {{tbl-start}}
9487 {{!}}foo
9488 {{tbl-end}}
9489 !! html
9490 <table>
9491 <tr>
9492 <td>foo
9493 </td></tr></table>
9494
9495 !!end
9496
9497 !!test
9498 Templates: Lists: Multi-line list-items via templates
9499 !! wikitext
9500 *{{echo|a {{nonexistent|
9501 unused}}}}
9502 *{{echo|b {{nonexistent|
9503 unused}}}}
9504 !! html
9505 <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li>
9506 <li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li></ul>
9507
9508 !!end
9509
9510 !!test
9511 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
9512 !! wikitext
9513 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
9514 !! html
9515 <p><i>ab</i>c<i>d</i>e
9516 </p>
9517 !!end
9518
9519 !!test
9520 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
9521 (PHP parser generates misnested html)
9522 !! wikitext
9523 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
9524 !! html/parsoid
9525 <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>
9526 !!end
9527
9528 !!test
9529 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
9530 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
9531 !! options
9532 parsoid=wt2html,wt2wt
9533 !! wikitext
9534 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
9535 !! html
9536 <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>
9537 <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>
9538 <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>
9539 !!end
9540
9541 !!test
9542 Templates: Ugly nesting: 4. Divs opened/closed across templates
9543 !! wikitext
9544 a<div>b{{echo|c</div>d}}e
9545 !! html
9546 a<div>bc</div>de
9547
9548 !!end
9549
9550 !!test
9551 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
9552 (Parsoid-centric)
9553 !! options
9554 parsoid
9555 !! wikitext
9556 {|
9557 |{{echo|foo</table>}}
9558 |bar
9559 |}
9560 !! html
9561 <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|}"]}'>
9562
9563 <tbody>
9564 <tr>
9565 <td>foo</td></tr></tbody></table><span about="#mwt1">
9566 </span><span about="#mwt1">|bar</span><span about="#mwt1">
9567 |}</span>
9568 !!end
9569
9570 !!test
9571 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
9572 (Parsoid-centric)
9573 !! options
9574 parsoid
9575 !! wikitext
9576 <table>
9577 <tr>
9578 <td>
9579 <table>
9580 <tr>
9581 <td>1. {{echo|foo </table>}}</td>
9582 <td> bar </td>
9583 <td>2. {{echo|baz </table>}}</td>
9584 </tr>
9585 <tr>
9586 <td>abc</td>
9587 </tr>
9588 </table>
9589 </td>
9590 </tr>
9591 <tr>
9592 <td>xyz</td>
9593 </tr>
9594 </table>
9595 !! html
9596 <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>"]}'>
9597 <tbody><tr>
9598 <td>
9599 <table>
9600 <tbody><tr>
9601 <td>1. foo </td></tr></tbody></table></td>
9602 <td> bar </td>
9603 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
9604 </span><span about="#mwt2">
9605 </span><span about="#mwt2">
9606 </span><span about="#mwt2">abc</span><span about="#mwt2">
9607 </span><span about="#mwt2">
9608 </span><span about="#mwt2">
9609 </span><span about="#mwt2">
9610 </span><span about="#mwt2">
9611 </span><span about="#mwt2">
9612 </span><span about="#mwt2">xyz</span><span about="#mwt2">
9613 </span><span about="#mwt2">
9614 </span>
9615 !!end
9616
9617 !! test
9618 Templates: Ugly templates: 3. newline-only template parameter
9619 !! wikitext
9620 foo {{echo|
9621 }}
9622 !! html
9623 <p>foo
9624 </p>
9625 !! end
9626
9627 # This looks like a bug: a single newline triggers p/br for some reason.
9628 !! test
9629 Templates: Ugly templates: 4. newline-only template parameter inconsistency
9630 !! wikitext
9631 {{echo|
9632 }}
9633 !! html
9634 <p><br />
9635 </p>
9636 !! end
9637
9638 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
9639 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
9640 !! test
9641 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
9642 !! wikitext
9643 {{echo|<table>}}
9644 {{echo|<div>foo}}
9645 {{echo|</table>}}
9646 !! html/parsoid
9647 <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
9648 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9649 </table>
9650 !! end
9651
9652 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
9653 # that are "identical" and generate nesting cycles in the algorithm
9654 !! test
9655 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
9656 !! wikitext
9657 {{echo|<table><tr><td><table>}}
9658 {{echo|<div>}}
9659 {{echo|</div>}}
9660 !! html/parsoid
9661 <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"}'>
9662 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9663 </table></td></tr></tbody></table>
9664 !! end
9665
9666 !!test
9667 Parser Functions: 1. Simple example
9668 !! wikitext
9669 {{uc:foo}}
9670 !! html
9671 <p>FOO
9672 </p>
9673 !!end
9674
9675 !!test
9676 Parser Functions: 2. Nested use (only outermost should be marked up)
9677 !! wikitext
9678 {{uc:{{lc:FOO}}}}
9679 !! html
9680 <p>FOO
9681 </p>
9682 !!end
9683
9684 ###
9685 ### Pre-save transform tests
9686 ###
9687 !! test
9688 pre-save transform: subst:
9689 !! options
9690 PST
9691 !! wikitext
9692 {{subst:test}}
9693 !! html
9694 This is a test template
9695 !! end
9696
9697 !! test
9698 pre-save transform: normal template
9699 !! options
9700 PST
9701 !! wikitext
9702 {{test}}
9703 !! html
9704 {{test}}
9705 !! end
9706
9707 !! test
9708 pre-save transform: nonexistent template
9709 !! options
9710 PST
9711 !! wikitext
9712 {{thistemplatedoesnotexist}}
9713 !! html
9714 {{thistemplatedoesnotexist}}
9715 !! end
9716
9717
9718 !! test
9719 pre-save transform: subst magic variables
9720 !! options
9721 PST
9722 !! wikitext
9723 {{subst:SITENAME}}
9724 !! html
9725 MediaWiki
9726 !! end
9727
9728 # This is bug 89, which I fixed. -- wtm
9729 !! test
9730 pre-save transform: subst: templates with parameters
9731 !! options
9732 pst
9733 !! wikitext
9734 {{subst:paramtest|param="something else"}}
9735 !! html
9736 This is a test template with parameter "something else"
9737 !! end
9738
9739 !! article
9740 Template:nowikitest
9741 !! text
9742 <nowiki>'''not wiki'''</nowiki>
9743 !! endarticle
9744
9745 !! test
9746 pre-save transform: nowiki in subst (bug 1188)
9747 !! options
9748 pst
9749 !! wikitext
9750 {{subst:nowikitest}}
9751 !! html
9752 <nowiki>'''not wiki'''</nowiki>
9753 !! end
9754
9755
9756 !! article
9757 Template:commenttest
9758 !! text
9759 This template has <!-- a comment --> in it.
9760 !! endarticle
9761
9762 !! test
9763 pre-save transform: comment in subst (bug 1936)
9764 !! options
9765 pst
9766 !! wikitext
9767 {{subst:commenttest}}
9768 !! html
9769 This template has <!-- a comment --> in it.
9770 !! end
9771
9772 !! test
9773 pre-save transform: unclosed tag
9774 !! options
9775 pst noxml
9776 !! wikitext
9777 <nowiki>'''not wiki'''
9778 !! html
9779 <nowiki>'''not wiki'''
9780 !! end
9781
9782 !! test
9783 pre-save transform: mixed tag case
9784 !! options
9785 pst noxml
9786 !! wikitext
9787 <NOwiki>'''not wiki'''</noWIKI>
9788 !! html
9789 <NOwiki>'''not wiki'''</noWIKI>
9790 !! end
9791
9792 !! test
9793 pre-save transform: unclosed comment in <nowiki>
9794 !! options
9795 pst noxml
9796 !! wikitext
9797 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9798 !! html
9799 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9800 !!end
9801
9802 # Leading @ in this template definition works around a limitation
9803 # in parsoid's parserTests which otherwise strips the <span> from the
9804 # result (confusing it for a template wrapper)
9805 !! article
9806 Template:dangerous
9807 !!text
9808 @<span onmouseover="alert('crap')">Oh no</span>
9809 !!endarticle
9810
9811 !!test
9812 (confirming safety of fix for subst bug 1936)
9813 !! wikitext
9814 {{Template:dangerous}}
9815 !! html
9816 <p>@<span>Oh no</span>
9817 </p>
9818 !! end
9819
9820 !! test
9821 pre-save transform: comment containing gallery (bug 5024)
9822 !! options
9823 pst
9824 !! wikitext
9825 <!-- <gallery>data</gallery> -->
9826 !! html
9827 <!-- <gallery>data</gallery> -->
9828 !!end
9829
9830 !! test
9831 pre-save transform: comment containing extension
9832 !! options
9833 pst
9834 !! wikitext
9835 <!-- <tag>data</tag> -->
9836 !! html
9837 <!-- <tag>data</tag> -->
9838 !!end
9839
9840 !! test
9841 pre-save transform: comment containing nowiki
9842 !! options
9843 pst
9844 !! wikitext
9845 <!-- <nowiki>data</nowiki> -->
9846 !! html
9847 <!-- <nowiki>data</nowiki> -->
9848 !!end
9849
9850 !! test
9851 pre-save transform: <noinclude> in subst (bug 3298)
9852 !! options
9853 pst
9854 !! wikitext
9855 {{subst:Includes}}
9856 !! html
9857 Foobar
9858 !! end
9859
9860 !! test
9861 pre-save transform: <onlyinclude> in subst (bug 3298)
9862 !! options
9863 pst
9864 !! wikitext
9865 {{subst:Includes2}}
9866 !! html
9867 Foo
9868 !! end
9869
9870 !! article
9871 Template:SubstTest
9872 !!text
9873 {{<includeonly>subst:</includeonly>Includes}}
9874 !! endarticle
9875
9876 !! article
9877 Template:SafeSubstTest
9878 !! text
9879 {{<includeonly>safesubst:</includeonly>Includes}}
9880 !! endarticle
9881
9882 !! test
9883 bug 22297: safesubst: works during PST
9884 !! options
9885 pst
9886 !! wikitext
9887 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9888 !! html
9889 FoobarFoobar
9890 !! end
9891
9892 !! test
9893 bug 22297: safesubst: works during normal parse
9894 !! wikitext
9895 {{SafeSubstTest}}
9896 !! html
9897 <p>Foobar
9898 </p>
9899 !! end
9900
9901 !! test
9902 subst: does not work during normal parse
9903 !! wikitext
9904 {{SubstTest}}
9905 !! html
9906 <p>{{subst:Includes}}
9907 </p>
9908 !! end
9909
9910 !! test
9911 pre-save transform: context links ("pipe trick")
9912 !! options
9913 pst
9914 !! wikitext
9915 [[Article (context)|]]
9916 [[Bar:Article|]]
9917 [[:Bar:Article|]]
9918 [[Bar:Article (context)|]]
9919 [[:Bar:Article (context)|]]
9920 [[|Article]]
9921 [[|Article (context)]]
9922 [[Bar:X (Y) Z|]]
9923 [[:Bar:X (Y) Z|]]
9924 !! html
9925 [[Article (context)|Article]]
9926 [[Bar:Article|Article]]
9927 [[:Bar:Article|Article]]
9928 [[Bar:Article (context)|Article]]
9929 [[:Bar:Article (context)|Article]]
9930 [[Article]]
9931 [[Article (context)]]
9932 [[Bar:X (Y) Z|X (Y) Z]]
9933 [[:Bar:X (Y) Z|X (Y) Z]]
9934 !! end
9935
9936 !! test
9937 pre-save transform: context links ("pipe trick") with interwiki prefix
9938 !! options
9939 pst
9940 !! wikitext
9941 [[interwiki:Article|]]
9942 [[:interwiki:Article|]]
9943 [[interwiki:Bar:Article|]]
9944 [[:interwiki:Bar:Article|]]
9945 !! html
9946 [[interwiki:Article|Article]]
9947 [[:interwiki:Article|Article]]
9948 [[interwiki:Bar:Article|Bar:Article]]
9949 [[:interwiki:Bar:Article|Bar:Article]]
9950 !! end
9951
9952 !! test
9953 pre-save transform: context links ("pipe trick") with parens in title
9954 !! options
9955 pst title=[[Somearticle (context)]]
9956 !! wikitext
9957 [[|Article]]
9958 !! html
9959 [[Article (context)|Article]]
9960 !! end
9961
9962 !! test
9963 pre-save transform: context links ("pipe trick") with comma in title
9964 !! options
9965 pst title=[[Someplace, Somewhere]]
9966 !! wikitext
9967 [[|Otherplace]]
9968 [[Otherplace, Elsewhere|]]
9969 [[Otherplace, Elsewhere, Anywhere|]]
9970 !! html
9971 [[Otherplace, Somewhere|Otherplace]]
9972 [[Otherplace, Elsewhere|Otherplace]]
9973 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9974 !! end
9975
9976 !! test
9977 pre-save transform: context links ("pipe trick") with parens and comma
9978 !! options
9979 pst title=[[Someplace (IGNORED), Somewhere]]
9980 !! wikitext
9981 [[|Otherplace]]
9982 [[Otherplace (place), Elsewhere|]]
9983 !! html
9984 [[Otherplace, Somewhere|Otherplace]]
9985 [[Otherplace (place), Elsewhere|Otherplace]]
9986 !! end
9987
9988 !! test
9989 pre-save transform: context links ("pipe trick") with comma and parens
9990 !! options
9991 pst title=[[Who, me? (context)]]
9992 !! wikitext
9993 [[|Yes, you.]]
9994 [[Me, Myself, and I (1937 song)|]]
9995 !! html
9996 [[Yes, you. (context)|Yes, you.]]
9997 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9998 !! end
9999
10000 !! test
10001 pre-save transform: context links ("pipe trick") with namespace
10002 !! options
10003 pst title=[[Ns:Somearticle]]
10004 !! wikitext
10005 [[|Article]]
10006 !! html
10007 [[Ns:Article|Article]]
10008 !! end
10009
10010 !! test
10011 pre-save transform: context links ("pipe trick") with namespace and parens
10012 !! options
10013 pst title=[[Ns:Somearticle (context)]]
10014 !! wikitext
10015 [[|Article]]
10016 !! html
10017 [[Ns:Article (context)|Article]]
10018 !! end
10019
10020 !! test
10021 pre-save transform: context links ("pipe trick") with namespace and comma
10022 !! options
10023 pst title=[[Ns:Somearticle, Context, Whatever]]
10024 !! wikitext
10025 [[|Article]]
10026 !! html
10027 [[Ns:Article, Context, Whatever|Article]]
10028 !! end
10029
10030 !! test
10031 pre-save transform: context links ("pipe trick") with namespace, comma and parens
10032 !! options
10033 pst title=[[Ns:Somearticle, Context (context)]]
10034 !! wikitext
10035 [[|Article]]
10036 !! html
10037 [[Ns:Article (context)|Article]]
10038 !! end
10039
10040 !! test
10041 pre-save transform: context links ("pipe trick") with namespace, parens and comma
10042 !! options
10043 pst title=[[Ns:Somearticle (IGNORED), Context]]
10044 !! wikitext
10045 [[|Article]]
10046 !! html
10047 [[Ns:Article, Context|Article]]
10048 !! end
10049
10050 !! test
10051 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
10052 !! options
10053 pst
10054 !! wikitext
10055 [[Article(context)|]]
10056 [[Bar:Article(context)|]]
10057 [[:Bar:Article(context)|]]
10058 [[|Article(context)]]
10059 [[Bar:X(Y)Z|]]
10060 [[:Bar:X(Y)Z|]]
10061 !! html
10062 [[Article(context)|Article]]
10063 [[Bar:Article(context)|Article]]
10064 [[:Bar:Article(context)|Article]]
10065 [[Article(context)]]
10066 [[Bar:X(Y)Z|X(Y)Z]]
10067 [[:Bar:X(Y)Z|X(Y)Z]]
10068 !! end
10069
10070 !! test
10071 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
10072 !! options
10073 pst
10074 !! wikitext
10075 [[Article (context)|]]
10076 [[Bar:Article (context)|]]
10077 [[:Bar:Article (context)|]]
10078 [[|Article (context)]]
10079 [[Bar:X (Y) Z|]]
10080 [[:Bar:X (Y) Z|]]
10081 !! html
10082 [[Article (context)|Article]]
10083 [[Bar:Article (context)|Article]]
10084 [[:Bar:Article (context)|Article]]
10085 [[Article (context)]]
10086 [[Bar:X (Y) Z|X (Y) Z]]
10087 [[:Bar:X (Y) Z|X (Y) Z]]
10088 !! end
10089
10090 !! test
10091 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
10092 !! options
10093 pst
10094 !! wikitext
10095 [[Article(context)|]]
10096 [[Bar:Article(context)|]]
10097 [[:Bar:Article(context)|]]
10098 [[|Article(context)]]
10099 [[Bar:X(Y)Z|]]
10100 [[:Bar:X(Y)Z|]]
10101 !! html
10102 [[Article(context)|Article]]
10103 [[Bar:Article(context)|Article]]
10104 [[:Bar:Article(context)|Article]]
10105 [[Article(context)]]
10106 [[Bar:X(Y)Z|X(Y)Z]]
10107 [[:Bar:X(Y)Z|X(Y)Z]]
10108 !! end
10109
10110 !! test
10111 pre-save transform: context links ("pipe trick") with commas (bug 21660)
10112 !! options
10113 pst
10114 !! wikitext
10115 [[Article (context), context|]]
10116 [[Article (context),context|]]
10117 [[Bar:Article (context), context|]]
10118 [[Bar:Article (context),context|]]
10119 [[:Bar:Article (context), context|]]
10120 [[:Bar:Article (context),context|]]
10121 !! html
10122 [[Article (context), context|Article]]
10123 [[Article (context),context|Article]]
10124 [[Bar:Article (context), context|Article]]
10125 [[Bar:Article (context),context|Article]]
10126 [[:Bar:Article (context), context|Article]]
10127 [[:Bar:Article (context),context|Article]]
10128 !! end
10129
10130 !! test
10131 pre-save transform: trim trailing empty lines
10132 !! options
10133 pst
10134 !! wikitext
10135 Empty lines are trimmed
10136
10137
10138
10139
10140 !! html
10141 Empty lines are trimmed
10142 !! end
10143
10144 !! test
10145 pre-save transform: Signature expansion
10146 !! options
10147 pst
10148 !! wikitext
10149 * ~~~
10150 * <noinclude>~~~</noinclude>
10151 * <includeonly>~~~</includeonly>
10152 * <onlyinclude>~~~</onlyinclude>
10153 !! html
10154 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
10155 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
10156 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
10157 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
10158 !! end
10159
10160
10161 !! test
10162 pre-save transform: Signature expansion in nowiki tags (bug 93)
10163 !! options
10164 pst disabled
10165 !! wikitext
10166 Shall not expand:
10167
10168 <nowiki>~~~~</nowiki>
10169
10170 <includeonly><nowiki>~~~~</nowiki></includeonly>
10171
10172 <noinclude><nowiki>~~~~</nowiki></noinclude>
10173
10174 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10175
10176 {{subst:Foo}} shall be converted to FOO
10177
10178 As well as inside noinclude/onlyinclude
10179 <noinclude>{{subst:Foo}}</noinclude>
10180 <onlyinclude>{{subst:Foo}}</onlyinclude>
10181
10182 But not inside includeonly
10183 <includeonly>{{subst:Foo}}</includeonly>
10184 !! html
10185 Shall not expand:
10186
10187 <nowiki>~~~~</nowiki>
10188
10189 <includeonly><nowiki>~~~~</nowiki></includeonly>
10190
10191 <noinclude><nowiki>~~~~</nowiki></noinclude>
10192
10193 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10194
10195 FOO shall be converted to FOO
10196
10197 As well as inside noinclude/onlyinclude
10198 <noinclude>FOO</noinclude>
10199 <onlyinclude>FOO</onlyinclude>
10200
10201 But not inside includeonly
10202 <includeonly>{{subst:Foo}}</includeonly>
10203 !! end
10204
10205 !! test
10206 Parsoid: Recognize nowiki with trailing space in tags
10207 !! options
10208 parsoid=wt2html
10209 !! wikitext
10210 <nowiki ><div>[[foo]]</nowiki >
10211
10212 a<nowiki / >b
10213
10214 c<nowiki />d
10215
10216 e<nowiki/ >f
10217 !! html
10218 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10219 <p>ab</p>
10220 <p>cd</p>
10221 <p>ef</p>
10222 !! end
10223
10224 !! test
10225 Parsoid: Recognize nowiki with odd capitalization
10226 !! options
10227 parsoid=wt2html
10228 !! wikitext
10229 <noWikI ><div>[[foo]]</Nowiki >
10230 !! html
10231 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10232 !! end
10233
10234
10235 !! test
10236 Parsoid: Escape nowiki with trailing space in tags
10237 !! options
10238 parsoid=html2wt
10239 !! wikitext
10240 &lt;nowiki &gt; foo &lt;/nowiki &gt;
10241
10242 a&lt;nowiki /&gt;b
10243
10244 c&lt;nowiki/ &gt;d
10245 !! html
10246 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
10247 <p>a&lt;nowiki /&gt;b</p>
10248 <p>c&lt;nowiki/ &gt;d</p>
10249 !! end
10250
10251 !! test
10252 Parsoid: Escape weird noWikI capitalizations
10253 !! options
10254 parsoid=html2wt
10255 !! wikitext
10256 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
10257 !! html
10258 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
10259 !! end
10260
10261 ###
10262 ### Message transform tests
10263 ###
10264 !! test
10265 message transform: magic variables
10266 !! options
10267 msg
10268 !! wikitext
10269 {{SITENAME}}
10270 !! html
10271 MediaWiki
10272 !! end
10273
10274 !! test
10275 message transform: should not transform wiki markup
10276 !! options
10277 msg
10278 !! wikitext
10279 ''test''
10280 !! html
10281 ''test''
10282 !! end
10283
10284 !! test
10285 message transform: <noinclude> in transcluded template (bug 4926)
10286 !! options
10287 msg
10288 !! wikitext
10289 {{Includes}}
10290 !! html
10291 Foobar
10292 !! end
10293
10294 !! test
10295 message transform: <onlyinclude> in transcluded template (bug 4926)
10296 !! options
10297 msg
10298 !! wikitext
10299 {{Includes2}}
10300 !! html
10301 Foo
10302 !! end
10303
10304 !! test
10305 {{#special:}} page name, known
10306 !! options
10307 msg
10308 !! wikitext
10309 {{#special:Recentchanges}}
10310 !! html
10311 Special:RecentChanges
10312 !! end
10313
10314 !! test
10315 {{#special:}} page name with subpage, known
10316 !! options
10317 msg
10318 !! wikitext
10319 {{#special:Recentchanges/param}}
10320 !! html
10321 Special:RecentChanges/param
10322 !! end
10323
10324 !! test
10325 {{#special:}} page name, unknown
10326 !! options
10327 msg
10328 !! wikitext
10329 {{#special:foobar nonexistent}}
10330 !! html
10331 Special:Foobar nonexistent
10332 !! end
10333
10334 !! test
10335 {{#speciale:}} page name, known
10336 !! options
10337 msg
10338 !! wikitext
10339 {{#speciale:Recentchanges}}
10340 !! html
10341 Special:RecentChanges
10342 !! end
10343
10344 !! test
10345 {{#speciale:}} page name with subpage, known
10346 !! options
10347 msg
10348 !! wikitext
10349 {{#speciale:Recentchanges/param}}
10350 !! html
10351 Special:RecentChanges/param
10352 !! end
10353
10354 !! test
10355 {{#speciale:}} page name, unknown
10356 !! options
10357 msg
10358 !! wikitext
10359 {{#speciale:foobar nonexistent}}
10360 !! html
10361 Special:Foobar_nonexistent
10362 !! end
10363
10364 ###
10365 ### Images
10366 ###
10367 ### For Parsoid-specific tests, see
10368 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10369
10370 !! test
10371 Simple image
10372 !! options
10373 parsoid=wt2html,wt2wt,html2html
10374 !! wikitext
10375 [[Image:foobar.jpg]]
10376 !! html/php
10377 <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>
10378 </p>
10379 !! html/parsoid
10380 <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>
10381 </p>
10382 !! end
10383
10384 !! test
10385 Simple image (using File: namespace, now canonical)
10386 !! wikitext
10387 [[File:Foobar.jpg]]
10388 !! html/php
10389 <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>
10390 </p>
10391 !! html/parsoid
10392 <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>
10393 </p>
10394 !! end
10395
10396 !! test
10397 Right-aligned image
10398 !! wikitext
10399 [[File:Foobar.jpg|right]]
10400 !! html/php
10401 <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>
10402
10403 !! html/parsoid
10404 <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>
10405 !! end
10406
10407 !! test
10408 Image with caption
10409 !! wikitext
10410 [[File:Foobar.jpg|right|Caption text]]
10411 !! html/php
10412 <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>
10413
10414 !! html/parsoid
10415 <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>
10416 !! end
10417
10418 !! test
10419 Image with caption, bug 53312 #1
10420 !! wikitext
10421 [[File:Foobar.jpg|right|Caption page stuff]]
10422 !! html/php
10423 <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>
10424
10425 !! html/parsoid
10426 <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>
10427 !! end
10428
10429 !! test
10430 Image with caption, bug 53312 #2
10431 !! wikitext
10432 [[File:Foobar.jpg|right|Caption page=]]
10433 !! html/php
10434 <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>
10435
10436 !! html/parsoid
10437 <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>
10438 !! end
10439
10440 !! test
10441 Image with caption, bug 53312 #3
10442 !! wikitext
10443 [[File:Foobar.jpg|right|Caption page=stuff]]
10444 !! html/php
10445 <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>
10446
10447 !! html/parsoid
10448 <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>
10449 !! end
10450
10451 !! test
10452 Allow empty links in image captions (Bug 60753)
10453 !! options
10454 thumbsize=220
10455 !! wikitext
10456 [[File:Foobar.jpg|thumb|Caption [[Link1]]
10457 [[]]
10458 [[Link2]]
10459 ]]
10460 !! html/php
10461 <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>
10462
10463 !! html/parsoid
10464 <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>
10465 [[]]
10466 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
10467 </figcaption></figure>
10468 !! end
10469
10470 !! test
10471 Link with empty target
10472 !! wikitext
10473 [[]]
10474 !! html
10475 <p>[[]]
10476 </p>
10477 !! end
10478
10479 !! test
10480 Image with empty attribute
10481 !! options
10482 parsoid=wt2html,wt2wt,html2html
10483 !! wikitext
10484 [[File:Foobar.jpg|right||Caption text]]
10485 !! html/php
10486 <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>
10487
10488 !! html/parsoid
10489 <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>
10490 !! end
10491
10492 !! test
10493 1. Block image with individual attributes from templates
10494 !! wikitext
10495 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
10496 !! html/php
10497 <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>
10498
10499 !! html/parsoid
10500 <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>
10501 !! end
10502
10503 !! test
10504 2. Block Image with individual attributes from templates
10505 !! wikitext
10506 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
10507 !! html/php
10508 <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>
10509
10510 !! html/parsoid
10511 <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>
10512 !! end
10513
10514 !! test
10515 3. Inline image with individual attributes from templates
10516 !! wikitext
10517 [[File:Foobar.jpg|{{echo|50px}}]]
10518 !! html/php
10519 <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>
10520 </p>
10521 !! html/parsoid
10522 <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>
10523 !! end
10524
10525 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
10526 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
10527 !! test
10528 Image with multiple attributes from the same template
10529 !! wikitext
10530 [[File:Foobar.jpg|{{image_attribs}}]]
10531 !! html/php
10532 <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>
10533
10534 !! html/parsoid
10535 <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>
10536 !! end
10537
10538 !! test
10539 Image with link tails
10540 !! options
10541 thumbsize=220
10542 !! wikitext
10543 123[[File:Foobar.jpg]]456
10544 123[[File:Foobar.jpg|right]]456
10545 123[[File:Foobar.jpg|thumb]]456
10546 !! html/php
10547 <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
10548 </p>
10549 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
10550 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
10551
10552 !! html/parsoid
10553 <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>
10554 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
10555 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
10556 !! end
10557
10558 !! test
10559 Image with multiple captions -- only last one is accepted
10560 !! wikitext
10561 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
10562 !! html/php
10563 <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>
10564
10565 !! html/parsoid
10566 <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>
10567 !! end
10568
10569 !! test
10570 Image with multiple widths -- use last
10571 !! wikitext
10572 [[File:Foobar.jpg|200px|300px|caption]]
10573 !! html/php
10574 <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>
10575 </p>
10576 !! html/parsoid
10577 <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>
10578 !! end
10579
10580 !! test
10581 Image with multiple alignments -- use first (bug 48664)
10582 !! options
10583 thumbsize=220
10584 !! wikitext
10585 [[File:Foobar.jpg|thumb|left|right|center|caption]]
10586
10587 [[File:Foobar.jpg|middle|text-top|caption]]
10588 !! html/php
10589 <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>
10590 <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>
10591 </p>
10592 !! html/parsoid
10593 <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>
10594 <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>
10595 !! end
10596
10597 !! test
10598 Image with width attribute at different positions
10599 !! wikitext
10600 [[File:Foobar.jpg|200px|right|Caption]]
10601 [[File:Foobar.jpg|right|200px|Caption]]
10602 [[File:Foobar.jpg|right|Caption|200px]]
10603 !! html/php
10604 <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>
10605 <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>
10606 <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>
10607
10608 !! html/parsoid
10609 <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>
10610 <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>
10611 <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>
10612 !! end
10613
10614 # a sad bit of backward-compatibility
10615 !! test
10616 Image with size specified with pxpx (bug 13500, 51628)
10617 !! options
10618 parsoid=wt2html,wt2wt,html2html
10619 !! wikitext
10620 [[File:Foobar.jpg|20pxpx]]
10621 [[File:Foobar.jpg|200x20pxpx]]
10622 !! html/php
10623 <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>
10624 <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>
10625 </p>
10626 !! html/parsoid
10627 <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>
10628 !! end
10629
10630 !! test
10631 Image with link parameter, wiki target
10632 !! wikitext
10633 [[File:Foobar.jpg|link=Main Page]]
10634 !! html/php
10635 <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>
10636 </p>
10637 !! html/parsoid
10638 <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>
10639 !! end
10640
10641 # parsoid bug 49293 (part 1)
10642 !! test
10643 Image with link parameter, URL target
10644 !! wikitext
10645 [[File:Foobar.jpg|link=http://example.com/]]
10646 !! html/php
10647 <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>
10648 </p>
10649 !! html/parsoid
10650 <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>
10651 !! end
10652
10653 # parsoid bug 49293 (part 2)
10654 !! test
10655 Image with link parameter, protocol-less URL target
10656 !! wikitext
10657 [[File:Foobar.jpg|link=//example.com/]]
10658 !! html/php
10659 <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>
10660 </p>
10661 !! html/parsoid
10662 <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>
10663 !! end
10664
10665 !! test
10666 Image with link parameter, wgExternalLinkTarget
10667 !! wikitext
10668 [[Image:foobar.jpg|link=http://example.com/]]
10669 !! config
10670 wgExternalLinkTarget='foobar'
10671 !! html
10672 <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>
10673 </p>
10674 !! end
10675
10676 !! test
10677 Image with link parameter, wgNoFollowLinks set to false
10678 !! wikitext
10679 [[Image:foobar.jpg|link=http://example.com/]]
10680 !! config
10681 wgNoFollowLinks=false
10682 !! html
10683 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10684 </p>
10685 !! end
10686
10687 !! test
10688 Image with link parameter, wgNoFollowDomainExceptions
10689 !! wikitext
10690 [[Image:foobar.jpg|link=http://example.com/]]
10691 !! config
10692 wgNoFollowDomainExceptions='example.com'
10693 !! html
10694 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10695 </p>
10696 !! end
10697
10698 !! test
10699 Image with link parameter, wgExternalLinkTarget, unnamed parameter
10700 !! wikitext
10701 [[Image:foobar.jpg|link=http://example.com/|Title]]
10702 !! config
10703 wgExternalLinkTarget='foobar'
10704 !! html
10705 <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>
10706 </p>
10707 !! end
10708
10709 !! test
10710 Image with empty link parameter
10711 !! wikitext
10712 [[File:Foobar.jpg|link=]]
10713 !! html/php
10714 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10715 </p>
10716 !! html/parsoid
10717 <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>
10718 !! end
10719
10720 !! test
10721 Image with link parameter (wiki target) and unnamed parameter
10722 !! wikitext
10723 [[File:Foobar.jpg|link=Main_Page|Title]]
10724 !! html/php
10725 <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>
10726 </p>
10727 !! html/parsoid
10728 <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>
10729 !! end
10730
10731 !! test
10732 Image with link parameter (URL target) and unnamed parameter
10733 !! wikitext
10734 [[File:Foobar.jpg|link=http://example.com/|Title]]
10735 !! html/php
10736 <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>
10737 </p>
10738 !! html/parsoid
10739 <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>
10740 !! end
10741
10742 !! test
10743 Thumbnail image with link parameter
10744 !! options
10745 thumbsize=220
10746 parsoid=wt2html,wt2wt,html2html
10747 !! wikitext
10748 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
10749 !! html/php
10750 <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>
10751
10752 !! html/parsoid
10753 <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>
10754 !! end
10755
10756 !! test
10757 Manually-specified thumbnail image
10758 !! options
10759 thumbsize=220
10760 !! wikitext
10761 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
10762 !! html/php
10763 <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>
10764
10765 !! html/parsoid
10766 <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>
10767 !! end
10768
10769 !! test
10770 Manually-specified thumbnail image with explicit link to wiki page
10771 !! options
10772 thumbsize=220
10773 parsoid=wt2html,wt2wt,html2html
10774 !! wikitext
10775 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
10776 !! html/php
10777 <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>
10778
10779 !! html/parsoid
10780 <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>
10781 !! end
10782
10783 !! test
10784 Manually-specified thumbnail image with explicit link to url
10785 !! options
10786 thumbsize=220
10787 parsoid=wt2html,wt2wt,html2html
10788 !! wikitext
10789 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10790 !! html/php
10791 <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>
10792
10793 !! html/parsoid
10794 <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>
10795 !! end
10796
10797 !! test
10798 Manually-specified thumbnail image with explicit no link
10799 !! options
10800 thumbsize=220
10801 parsoid=wt2html,wt2wt,html2html
10802 !! wikitext
10803 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10804 !! html/php
10805 <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>
10806
10807 !! html/parsoid
10808 <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>
10809 !! end
10810
10811 !! test
10812 Manually-specified thumbnail image with explicit link and alt text
10813 !! options
10814 thumbsize=220
10815 parsoid=wt2html,wt2wt,html2html
10816 !! wikitext
10817 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
10818 !! html/php
10819 <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>
10820
10821 !! html/parsoid
10822 <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>
10823 !! end
10824
10825 !! test
10826 Image with frame and link
10827 !! options
10828 parsoid=wt2html,wt2wt,html2html
10829 !! wikitext
10830 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10831 !! html/php
10832 <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>
10833
10834 !! html/parsoid
10835 <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>
10836 !! end
10837
10838 !! test
10839 Image with frame and link and explicit alt
10840 !! options
10841 parsoid=wt2html,wt2wt,html2html
10842 !! wikitext
10843 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10844 !! html/php
10845 <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>
10846
10847 !! html/parsoid
10848 <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>
10849 !! end
10850
10851 !! test
10852 Image with wiki markup in implicit alt
10853 !! options
10854 parsoid=wt2html,wt2wt,html2html
10855 !! wikitext
10856 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10857
10858 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10859 !! html/php
10860 <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>
10861 </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>
10862 </p>
10863 !! html/parsoid
10864 <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>
10865 <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>
10866 !! end
10867
10868 ###################
10869 # Conflicting image format options.
10870 # First option specified should 'win'.
10871 # All three cases in each test should be identical.
10872
10873 !! test
10874 Image with 'frameless' first.
10875 !! options
10876 parsoid=wt2html,wt2wt,html2html
10877 !! wikitext
10878 [[File:Foobar.jpg|frameless|caption]]
10879
10880 [[File:Foobar.jpg|frameless|frame|caption]]
10881
10882 [[File:Foobar.jpg|frameless|thumb|caption]]
10883 !! html/php
10884 <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>
10885 </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>
10886 </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>
10887 </p>
10888 !! html/parsoid
10889 <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>
10890 <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>
10891 <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>
10892 !! end
10893
10894 !! test
10895 Image with 'frame' first.
10896 !! options
10897 parsoid=wt2html,wt2wt,html2html
10898 !! wikitext
10899 [[File:Foobar.jpg|frame|caption]]
10900 [[File:Foobar.jpg|frame|frameless|caption]]
10901 [[File:Foobar.jpg|frame|thumb|caption]]
10902 !! html/php
10903 <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>
10904 <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>
10905 <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>
10906
10907 !! html/parsoid
10908 <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>
10909 !! end
10910
10911 !! test
10912 Image with 'thumb' first.
10913 !! options
10914 parsoid=wt2html,wt2wt,html2html
10915 !! wikitext
10916 [[File:Foobar.jpg|thumb|caption]]
10917 [[File:Foobar.jpg|thumb|frameless|caption]]
10918 [[File:Foobar.jpg|thumb|frame|caption]]
10919 !! html/php
10920 <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>
10921 <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>
10922 <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>
10923
10924 !! html/parsoid
10925 <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>
10926 !! end
10927
10928 ###################
10929 # Image sizing.
10930 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
10931 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
10932 # Foobar has actual size of 1941x220
10933 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
10934 # a scalable format.
10935 # 2. Framed images always ignore size options; always render at default size.
10936 # 3. "Unspecified format" and border are the only types which can be
10937 # enlarged.
10938
10939 !! test
10940 Image: "unspecified format" and border enlarge
10941 !! options
10942 parsoid=wt2html,wt2wt,html2html
10943 !! wikitext
10944 [[File:Foobar.jpg|2000px]]
10945
10946 [[File:Foobar.jpg|border|2000px]]
10947 !! html/php
10948 <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>
10949 </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>
10950 </p>
10951 !! html/parsoid
10952 <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>
10953 <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>
10954 !! end
10955
10956 !! test
10957 Image: "unspecified format" and border reduce
10958 !! options
10959 parsoid=wt2html,wt2wt,html2html
10960 !! wikitext
10961 [[File:Foobar.jpg|1000px]]
10962
10963 [[File:Foobar.jpg|border|1000px]]
10964 !! html/php
10965 <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>
10966 </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>
10967 </p>
10968 !! html/parsoid
10969 <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>
10970 <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>
10971 !! end
10972
10973 !! test
10974 Image: thumbs reduce
10975 !! options
10976 parsoid=wt2html,wt2wt,html2html
10977 !! wikitext
10978 [[File:Foobar.jpg|thumb|50px]]
10979 !! html/php
10980 <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>
10981
10982 !! html/parsoid
10983 <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>
10984 !! end
10985
10986 !! test
10987 Image: bitmap thumbs can't be enlarged past original size, but vector can.
10988 !! options
10989 parsoid=wt2html,wt2wt,html2html
10990 !! wikitext
10991 [[File:Foobar.jpg|thumb|2000px]]
10992
10993 [[File:Foobar.svg|thumb|2000px]]
10994 !! html/php
10995 <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>
10996 <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>
10997
10998 !! html/parsoid
10999 <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>
11000 <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>
11001 !! end
11002
11003 !! test
11004 Image: frameless can reduce in size
11005 !! options
11006 parsoid=wt2html,wt2wt,html2html
11007 !! wikitext
11008 [[File:Foobar.jpg|frameless|50px]]
11009 !! html/php
11010 <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>
11011 </p>
11012 !! html/parsoid
11013 <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>
11014 !! end
11015
11016 !! test
11017 Image: bitmap frameless can't be enlarged past original size, but vector can
11018 !! options
11019 parsoid=wt2html,wt2wt,html2html
11020 !! wikitext
11021 [[File:Foobar.jpg|frameless|2000px]]
11022
11023 [[File:Foobar.svg|frameless|2000px]]
11024 !! html/php
11025 <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>
11026 </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>
11027 </p>
11028 !! html/parsoid
11029 <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>
11030 <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>
11031 !! end
11032
11033 !! test
11034 Image: framed images are always unscaled.
11035 !! options
11036 parsoid=wt2html,wt2wt,html2html
11037 !! wikitext
11038 [[File:Foobar.jpg|frame]]
11039
11040 [[File:Foobar.jpg|frame|50px]]
11041
11042 [[File:Foobar.jpg|frame|50x50px]]
11043
11044 [[File:Foobar.jpg|frame|2000px]]
11045 !! html/php
11046 <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>
11047 <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>
11048 <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>
11049 <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>
11050
11051 !! html/parsoid
11052 <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>
11053 !! end
11054
11055 ###################
11056
11057 !! test
11058 Link to image page- image page normally doesn't exists, hence edit link
11059 Add test with existing image page
11060 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
11061 !! wikitext
11062 [[:Image:test]]
11063 !! html
11064 <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>
11065 </p>
11066 !! end
11067
11068 !! test
11069 bug 18784 Link to non-existent image page with caption should use caption as link text
11070 !! wikitext
11071 [[:Image:test|caption]]
11072 !! html
11073 <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>
11074 </p>
11075 !! end
11076
11077 !! test
11078 Frameless image caption with a free URL
11079 !! wikitext
11080 [[File:Foobar.jpg|http://example.com]]
11081 !! html/php
11082 <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>
11083 </p>
11084 !! html/parsoid
11085 <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>
11086 !! end
11087
11088 !! test
11089 Thumbnail image caption with a free URL
11090 !! options
11091 thumbsize=220
11092 !! wikitext
11093 [[File:Foobar.jpg|thumb|http://example.com]]
11094 !! html/php
11095 <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>
11096
11097 !! html/parsoid
11098 <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>
11099 !! end
11100
11101 !! test
11102 Thumbnail image caption with a free URL and explicit alt
11103 !! options
11104 thumbsize=220
11105 parsoid=wt2html,wt2wt,html2html
11106 !! wikitext
11107 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
11108 !! html/php
11109 <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>
11110
11111 !! html/parsoid
11112 <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>
11113 !! end
11114
11115 !! test
11116 SVG thumbnails with no language set
11117 !! options
11118 !! wikitext
11119 [[File:Foobar.svg|thumb|caption]]
11120 !! html/php
11121 <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>
11122
11123 !! html/parsoid
11124 <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>
11125 !! end
11126
11127 !! test
11128 SVG thumbnails with language de
11129 !! options
11130 parsoid=wt2html,wt2wt,html2html
11131 !! wikitext
11132 [[File:Foobar.svg|thumb|caption|lang=de]]
11133 !! html/php
11134 <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>
11135
11136 !! html/parsoid
11137 <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>
11138 !! end
11139
11140 !! test
11141 SVG thumbnails with invalid language code
11142 !! options
11143 parsoid=wt2html,wt2wt,html2html
11144 !! wikitext
11145 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
11146 !! html/php
11147 <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>
11148
11149 !! html/parsoid
11150 <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>
11151 !! end
11152
11153 !! test
11154 BUG 1887: A ISBN with a thumbnail
11155 !! wikitext
11156 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
11157 !! html/php
11158 <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>
11159
11160 !! html/parsoid
11161 <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>
11162 !! end
11163
11164 !! test
11165 BUG 1887: A RFC with a thumbnail
11166 !! wikitext
11167 [[File:Foobar.jpg|thumb|This is RFC 12354]]
11168 !! html/php
11169 <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>
11170
11171 !! html/parsoid
11172 <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>
11173 !! end
11174
11175 !! test
11176 BUG 1887: A mailto link with a thumbnail
11177 !! wikitext
11178 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
11179 !! html/php
11180 <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>
11181
11182 !! html/parsoid
11183 <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>
11184 !! end
11185
11186 # Pending resolution to bug 368
11187 !! test
11188 BUG 648: Frameless image caption with a link
11189 !! wikitext
11190 [[File:Foobar.jpg|text with a [[link]] in it]]
11191 !! html/php
11192 <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>
11193 </p>
11194 !! html/parsoid
11195 <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>
11196 !! end
11197
11198 !! test
11199 BUG 648: Frameless image caption with a link (suffix)
11200 !! wikitext
11201 [[File:Foobar.jpg|text with a [[link]]foo in it]]
11202 !! html/php
11203 <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>
11204 </p>
11205 !! html/parsoid
11206 <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>
11207 !! end
11208
11209 !! test
11210 BUG 648: Frameless image caption with an interwiki link
11211 !! wikitext
11212 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
11213 !! html/php
11214 <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>
11215 </p>
11216 !! html/parsoid
11217 <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>
11218 !! end
11219
11220 !! test
11221 BUG 648: Frameless image caption with a piped interwiki link
11222 !! wikitext
11223 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
11224 !! html/php
11225 <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>
11226 </p>
11227 !! html/parsoid
11228 <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>
11229 !! end
11230
11231 !! test
11232 Escape HTML special chars in image alt text
11233 !! wikitext
11234 [[File:Foobar.jpg|& < > "]]
11235 !! html/php
11236 <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>
11237 </p>
11238 !! html/parsoid
11239 <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>
11240 !! end
11241
11242 !! test
11243 BUG 499: Alt text should have &#1234;, not &amp;1234;
11244 !! wikitext
11245 [[File:Foobar.jpg|&#9792;]]
11246 !! html/php
11247 <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>
11248 </p>
11249 !! html/parsoid
11250 <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>
11251 !! end
11252
11253 !! test
11254 Broken image caption with link
11255 !! options
11256 parsoid=wt2html,wt2wt,html2html
11257 !! wikitext
11258 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
11259 !! html/php
11260 <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.
11261 </p>
11262 !! html/parsoid
11263 <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>
11264 !! end
11265
11266 !! test
11267 Image caption containing another image
11268 !! wikitext
11269 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
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>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>
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>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>
11275 !! end
11276
11277 !! test
11278 Image: caption containing a newline
11279 !! wikitext
11280 [[File:Foobar.jpg|This
11281 *is some text]]
11282 !! html/php
11283 <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>
11284 </p>
11285 !! html/parsoid
11286 <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>
11287 !!end
11288
11289 !!test
11290 Image: caption containing leading space
11291 (The leading space should not trigger nowiki escaping in wt2wt mode)
11292 !! wikitext
11293 [[File:Foobar.jpg|thumb| bar]]
11294 !! html/php
11295 <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>
11296
11297 !! html/parsoid
11298 <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>
11299 !!end
11300
11301 !! test
11302 Image: caption containing a table
11303 !! options
11304 parsoid=wt2html,wt2wt,html2html
11305 !! wikitext
11306 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
11307 {|
11308 ! Foo !! Bar
11309 |-
11310 | Foo1 || Bar1
11311 |}
11312 and some more text.]]
11313 !! html/php
11314 <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>
11315
11316 !! html/parsoid
11317 <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
11318 <table>
11319 <tbody>
11320 <tr><th>Foo </th><th>Bar</th></tr>
11321 <tr>
11322 <td>Foo1 </td>
11323 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
11324 !! end
11325
11326 !! test
11327 Bug 3090: External links other than http: in image captions
11328 !! wikitext
11329 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
11330 !! html/php
11331 <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>
11332
11333 !! html/parsoid
11334 <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>
11335 !! end
11336
11337 !! test
11338 Custom class
11339 !! options
11340 parsoid=wt2html,wt2wt,html2html
11341 !! wikitext
11342 [[Image:foobar.jpg|a|class=b]]
11343 !! html/php
11344 <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>
11345 </p>
11346 !! html/parsoid
11347 <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>
11348 !! end
11349
11350 !! test
11351 Localized image handling (1).
11352 !! options
11353 parsoid=wt2html,wt2wt,html2html
11354 language=es
11355 !! wikitext
11356 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
11357 !! html/php
11358 <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>
11359
11360 !! html/parsoid
11361 <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>
11362 !! end
11363
11364 !! test
11365 Localized image handling (2).
11366 !! options
11367 thumbsize=220
11368 parsoid=wt2html,wt2wt,html2html
11369 language=es
11370 !! wikitext
11371 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
11372 !! html/php
11373 <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>
11374
11375 !! html/parsoid
11376 <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>
11377 !! end
11378
11379 !! test
11380 "border", "frameless" and "class" attributes on an image.
11381 !! options
11382 thumbsize=220
11383 parsoid=wt2html,wt2wt,html2html
11384 !! wikitext
11385 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
11386 !! html/php
11387 <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>
11388 </p>
11389 !! html/parsoid
11390 <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>
11391 !! end
11392
11393 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
11394 !! test
11395 Invalid image attributes (bug 62500)
11396 !! options
11397 thumbsize=220
11398 parsoid=wt2html,wt2wt,html2html
11399 !! wikitext
11400 [[File:Foobar.jpg|thumb|float|left|caption]]
11401
11402 [[File:Foobar.jpg|thumb|righ|caption]]
11403
11404 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
11405 !! html/php
11406 <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>
11407 <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>
11408 <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>
11409
11410 !! html/parsoid
11411 <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>
11412 !! end
11413
11414 !! article
11415 File:Barfoo.jpg
11416 !! text
11417 #REDIRECT [[File:Barfoo.jpg]]
11418 !! endarticle
11419
11420 !! test
11421 Redirected image
11422 !! wikitext
11423 [[Image:Barfoo.jpg]]
11424 !! html
11425 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
11426 </p>
11427 !! end
11428
11429 !! test
11430 Missing image with uploads disabled
11431 !! options
11432 wgEnableUploads=0
11433 !! wikitext
11434 [[Image:Foobaz.jpg]]
11435 !! html
11436 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
11437 </p>
11438 !! end
11439
11440 # Parsoid-specific testing for images
11441 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11442 # Currently imperfect due to a flaw in the Parsoid testrunner
11443 # Work in progress
11444 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
11445 # image tests.
11446
11447 !! test
11448 Parsoid-specific image handling - simple image with size and middle alignment
11449 !! wikitext
11450 [[File:Foobar.jpg|middle|50px]]
11451 !! html/parsoid
11452 <p><span class="mw-valign-middle" typeof="mw:Image">
11453 <a href="File:Foobar.jpg">
11454 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11455 </a>
11456 </span>
11457 </p>
11458 !! end
11459
11460 !! test
11461 Parsoid-specific image handling - simple image with size, middle alignment,
11462 non-standard namespace alias
11463 !! options
11464 parsoid=wt2wt,wt2html,html2html
11465 !! wikitext
11466 [[Image:Foobar.jpg|middle|50px]]
11467 !! html/parsoid
11468 <p><span class="mw-valign-middle" typeof="mw:Image">
11469 <a href="File:Foobar.jpg">
11470 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11471 </a>
11472 </span>
11473 </p>
11474 !! end
11475
11476 !! test
11477 Parsoid-specific image handling - simple image with size and middle alignment
11478 (existing content)
11479 !! wikitext
11480 [[File:Foobar.jpg|50px|middle]]
11481 !! html/parsoid
11482 <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>
11483 !! end
11484
11485 !! test
11486 Parsoid-specific image handling - simple image with size and middle alignment
11487 and non-standard namespace name
11488 !! options
11489 parsoid=wt2html,wt2wt,html2html
11490 !! wikitext
11491 [[Image:Foobar.jpg|50px|middle]]
11492 !! html/parsoid
11493 <p><span class="mw-valign-middle" typeof="mw:Image">
11494 <a href="File:Foobar.jpg">
11495 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11496 </a>
11497 </span>
11498 </p>
11499 !! end
11500
11501 !! test
11502 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
11503 !! wikitext
11504 [[File:Foobar.jpg|500x10px|baseline|caption]]
11505 !! html/parsoid
11506 <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>
11507 !! end
11508
11509 !! test
11510 Parsoid-specific image handling - simple image with border and size spec
11511 !! wikitext
11512 [[File:Foobar.jpg|50px|border|caption]]
11513 !! html/parsoid
11514 <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>
11515 !! end
11516
11517 !! test
11518 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11519 !! wikitext
11520 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
11521 !! html/parsoid
11522 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
11523 <a href="File:Foobar.jpg">
11524 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
11525 </a>
11526 <figcaption>caption content</figcaption>
11527 </figure>
11528 !! end
11529
11530 !! test
11531 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11532 (existing content)
11533 !! wikitext
11534 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
11535 !! html/parsoid
11536 <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>
11537 !! end
11538
11539 !! test
11540 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
11541 !! wikitext
11542 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
11543 !! html/parsoid
11544 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
11545 <a href="File:Foobar.jpg">
11546 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
11547 </a>
11548 <figcaption>caption</figcaption>
11549 </figure>
11550 !! end
11551
11552 !! test
11553 Parsoid-specific image handling - thumbnail with specific size, halign,
11554 valign, and caption (existing content)
11555 !! wikitext
11556 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
11557 !! html/parsoid
11558 <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>
11559 !! end
11560
11561 !! test
11562 Parsoid-specific image handling - framed image with specific size and caption
11563 (size is ignored)
11564 !! options
11565 parsoid=wt2html,wt2wt,html2html
11566 !! wikitext
11567 [[File:Foobar.jpg|frame|500x50px|caption]]
11568 !! html/parsoid
11569 <figure typeof="mw:Image/Frame">
11570 <a href="File:Foobar.jpg">
11571 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11572 </a>
11573 <figcaption>caption</figcaption>
11574 </figure>
11575 !! end
11576
11577 !! test
11578 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
11579 (size is ignored)
11580 !! options
11581 parsoid=wt2html,wt2wt,html2html
11582 !! wikitext
11583 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
11584 !! html/parsoid
11585 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
11586 <a href="File:Foobar.jpg">
11587 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11588 </a>
11589 <figcaption>caption</figcaption>
11590 </figure>
11591 !! end
11592
11593 !! test
11594 Parsoid-specific image handling - frameless image with specific size, border, and caption
11595 !! wikitext
11596 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
11597 !! html/parsoid
11598 <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>
11599 !! end
11600
11601 !! test
11602 Parsoid-specific image handling - simple image with a formatted caption
11603 !! wikitext
11604 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
11605 !! html/parsoid
11606 <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>"}'>
11607 <a href="File:Foobar.jpg">
11608 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
11609 </a></span></p>
11610 !! end
11611
11612 !! test
11613 Parsoid-specific image handling - caption with a template in it
11614 !! wikitext
11615 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
11616 !! html/parsoid
11617 <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>
11618 !! end
11619
11620 !! test
11621 Parsoid-specific image handling - caption with unbalanced tags in it
11622 !! options
11623 parsoid=wt2html,wt2wt,html2html
11624 !! wikitext
11625 foo
11626 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
11627 bar
11628 !! html/parsoid
11629 <p>foo</p>
11630 <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>
11631 <p>bar</p>
11632 !! end
11633
11634 !! test
11635 Parsoid-specific image handling - empty caption (1)
11636 !! options
11637 parsoid=wt2html,wt2wt
11638 !! wikitext
11639 [[File:Foobar.jpg|thumb|]]
11640 !! html/parsoid
11641 <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>
11642 !! end
11643
11644 # empty captions don't get serialized unless we're in the "round trip" case
11645 !! test
11646 Parsoid-specific image handling - empty caption (2)
11647 !! options
11648 parsoid=html2wt
11649 !! html/parsoid
11650 <figure class="mw-default-size" typeof="mw:Image/Thumb">
11651 <a href="File:Foobar.jpg">
11652 <img resource="./File:Foobar.jpg"
11653 src="//example.com/images/3/3a/Foobar.jpg"
11654 height="25" width="220"/>
11655 </a>
11656 <figcaption></figcaption>
11657 </figure>
11658 !! wikitext
11659 [[File:Foobar.jpg|thumb]]
11660 !! end
11661
11662 !! test
11663 Parsoid-specific image handling - whitespace caption
11664 !! wikitext
11665 [[File:Foobar.jpg|thumb| ]]
11666 !! html/parsoid
11667 <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>
11668 !! end
11669
11670 !! test
11671 Parsoid-specific image handling - lang option
11672 !! wikitext
11673 foo
11674 [[File:Foobar.svg|lang=de|caption]]
11675 bar
11676 !! html/parsoid
11677 <p>foo
11678 <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>
11679 bar</p>
11680 !! end
11681
11682
11683 ###
11684 ### Subpages
11685 ###
11686 !! article
11687 Subpage test/subpage
11688 !! text
11689 foo
11690 !! endarticle
11691
11692 !! test
11693 Subpage link
11694 !! options
11695 subpage title=[[Subpage test]]
11696 !! wikitext
11697 [[/subpage]]
11698 !! html
11699 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
11700 </p>
11701 !! end
11702
11703 !! test
11704 Subpage noslash link
11705 !! options
11706 subpage title=[[Subpage test]]
11707 !! wikitext
11708 [[/subpage/]]
11709 !! html
11710 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
11711 </p>
11712 !! end
11713
11714 # TODO: make this PHP-parser compatible!
11715 !! test
11716 Relative subpage noslash link
11717 !! options
11718 parsoid=wt2wt,wt2html,html2html
11719 subpage title=[[Subpage test/1/2/3/4]]
11720 !! wikitext
11721 [[../../subpage/]]
11722
11723 [[../../subpage]]
11724 !! html
11725 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
11726 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
11727 !! end
11728
11729 !! test
11730 Parsoid: dot-slash prefixed wikilinks
11731 !! wikitext
11732 [[./foo]]
11733
11734 [[././bar]]
11735
11736 [[././baz/]]
11737 !! html/php
11738 <p>[[./foo]]
11739 </p><p>[[././bar]]
11740 </p><p>[[././baz/]]
11741 </p>
11742 !! html/parsoid
11743 <p>[[./foo]]
11744 </p><p>[[././bar]]
11745 </p><p>[[././baz/]]
11746 </p>
11747 !! end
11748
11749 !! test
11750 Render invalid page names as plain text (bug 51090)
11751 !! wikitext
11752 [[./../foo|bar]]
11753 [[foo�|bar]]
11754 [[foo/.|bar]]
11755 [[foo/..|bar]]
11756 [[foo~~~bar]]
11757 [[foo>bar]]
11758 [[foo[bar]]
11759 [[.]]
11760 [[..]]
11761 [[foo././bar]]
11762
11763 [[{{echo|./../foo}}|bar]]
11764 [[{{echo|foo/.}}|bar]]
11765 [[{{echo|foo/..}}|bar]]
11766 [[{{echo|foo~~~~bar}}]]
11767 [[{{echo|foo>bar}}]]
11768 [[{{echo|foo././bar}}]]
11769 [[{{echo|foo{bar}}]]
11770 [[{{echo|foo}bar}}]]
11771 [[{{echo|foo[bar}}]]
11772 [[{{echo|foo]bar}}]]
11773 [[{{echo|foo<bar}}]]
11774 !!html/php
11775 <p>[[./../foo|bar]]
11776 [[foo�|bar]]
11777 [[foo/.|bar]]
11778 [[foo/..|bar]]
11779 [[foo~~~bar]]
11780 [[foo&gt;bar]]
11781 [[foo[bar]]
11782 [[.]]
11783 [[..]]
11784 [[foo././bar]]
11785 </p><p>[[./../foo|bar]]
11786 [[foo/.|bar]]
11787 [[foo/..|bar]]
11788 [[foo~~~~bar]]
11789 [[foo&gt;bar]]
11790 [[foo././bar]]
11791 [[foo{bar]]
11792 [[foo}bar]]
11793 [[foo[bar]]
11794 [[foo]bar]]
11795 [[foo&lt;bar]]
11796 </p>
11797 !!html/parsoid
11798 <p>[[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]</p>
11799 <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>
11800 !!end
11801
11802 !! test
11803 Disabled subpages
11804 !! wikitext
11805 [[/subpage]]
11806 !! html
11807 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
11808 </p>
11809 !! end
11810
11811 !! test
11812 BUG 561: {{/Subpage}}
11813 !! options
11814 subpage title=[[Page]]
11815 !! wikitext
11816 {{/Subpage}}
11817 !! html
11818 <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>
11819 </p>
11820 !! end
11821
11822 ###
11823 ### Categories
11824 ###
11825 !! article
11826 Category:MediaWiki User's Guide
11827 !! text
11828 blah
11829 !! endarticle
11830
11831 !! test
11832 Link to category
11833 !! wikitext
11834 [[:Category:MediaWiki User's Guide]]
11835 !! html
11836 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
11837 </p>
11838 !! end
11839
11840 !! test
11841 Simple category
11842 !! options
11843 cat
11844 !! wikitext
11845 [[Category:MediaWiki User's Guide]]
11846 !! html
11847 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11848 !! end
11849
11850 !! test
11851 PAGESINCATEGORY invalid title fatal (r33546 fix)
11852 !! wikitext
11853 {{PAGESINCATEGORY:<bogus>}}
11854 !! html
11855 <p>0
11856 </p>
11857 !! end
11858
11859 !! test
11860 Category with different sort key
11861 !! options
11862 cat
11863 !! wikitext
11864 [[Category:MediaWiki User's Guide|Foo]]
11865 !! html
11866 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11867 !! end
11868
11869 !! test
11870 Category with identical sort key
11871 !! options
11872 cat
11873 !! wikitext
11874 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11875 !! html
11876 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11877 !! end
11878
11879 !! test
11880 Category with empty sort key
11881 !! options
11882 cat
11883 pst
11884 !! wikitext
11885 [[Category:MediaWiki User's Guide|]]
11886 !! html
11887 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11888 !! end
11889
11890 !! test
11891 Category with empty sort key and parentheses
11892 !! options
11893 cat
11894 pst
11895 !! wikitext
11896 [[Category:Foo (bar)|]]
11897 !! html
11898 [[Category:Foo (bar)|Foo]]
11899 !! end
11900
11901 !! test
11902 Category with link tail
11903 !! options
11904 cat
11905 pst
11906 !! wikitext
11907 123[[Category:Foo]]456
11908 !! html
11909 123[[Category:Foo]]456
11910 !! end
11911
11912 !! test
11913 Category with template
11914 !! options
11915 cat
11916 pst
11917 !! wikitext
11918 [[Category:{{echo|Foo}}]]
11919 !! html
11920 [[Category:{{echo|Foo}}]]
11921 !! end
11922
11923 !! test
11924 Category with template in sort key
11925 !! options
11926 cat
11927 pst
11928 !! wikitext
11929 [[Category:Foo|{{echo|Bar}}]]
11930 !! html
11931 [[Category:Foo|{{echo|Bar}}]]
11932 !! end
11933
11934 !! test
11935 Category with template in sort key and title
11936 !! options
11937 cat
11938 pst
11939 !! wikitext
11940 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11941 !! html
11942 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11943 !! end
11944
11945 !! test
11946 Category / paragraph interactions
11947 !! wikitext
11948 Foo [[Category:Baz]] Bar
11949
11950 Foo [[Category:Baz]]
11951 Bar
11952
11953 Foo
11954 [[Category:Baz]]
11955 Bar
11956
11957 Foo
11958 [[Category:Baz]] Bar
11959
11960 Foo
11961 [[Category:Baz]]
11962 [[Category:Baz]]
11963 [[Category:Baz]]
11964 Bar
11965
11966 [[Category:Baz]]
11967 [[Category:Baz]]
11968 [[Category:Baz]]
11969
11970 [[Category:Baz]]
11971 {{echo|[[Category:Baz]]}}
11972 [[Category:Baz]]
11973 !! html
11974 <p>Foo Bar
11975 </p><p>Foo
11976 Bar
11977 </p><p>Foo
11978 Bar
11979 </p><p>Foo Bar
11980 </p><p>Foo
11981 Bar
11982 </p>
11983 !! end
11984
11985 !! test
11986 Parsoid: Serialize link to category page with colon escape
11987 !! options
11988 parsoid
11989 !! wikitext
11990
11991 [[:Category:Foo]]
11992 [[:Category:Foo|Bar]]
11993 !! html
11994 <p>
11995 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11996 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11997 </p>
11998 !! end
11999
12000 !! test
12001 Parsoid: Link prefix/suffixes aren't applied to category links
12002 !! options
12003 parsoid=wt2html,wt2wt,html2html
12004 language=is
12005 !! wikitext
12006 x[[Category:Foo]]y
12007 !! html
12008 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
12009 !! end
12010
12011 !! test
12012 Parsoid: Serialize link to file page with colon escape
12013 !! options
12014 parsoid
12015 !! wikitext
12016
12017 [[:File:Foo.png]]
12018 [[:File:Foo.png|Bar]]
12019 !! html
12020 <p>
12021 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
12022 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
12023 </p>
12024 !! end
12025
12026 !! test
12027 Parsoid: Serialize a genuine category link without colon escape
12028 !! options
12029 parsoid
12030 !! wikitext
12031 [[Category:Foo]]
12032 [[Category:Foo|Bar]]
12033 !! html
12034 <link rel="mw:PageProp/Category" href="Category:Foo">
12035 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
12036 !! end
12037
12038 !! test
12039 Parsoid: Defaultsort
12040 !! options
12041 parsoid
12042 !! wikitext
12043 {{DEFAULTSORT:Foo}}
12044 !! html
12045 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
12046 !! end
12047
12048 ###
12049 ### Inter-language links
12050 ###
12051 !! test
12052 Interlanguage links
12053 !! options
12054 ill
12055 !! wikitext
12056 [[es:Alimento]]
12057 [[fr:Nourriture]]
12058 [[zh:食品]]
12059 !! html/php
12060 es:Alimento fr:Nourriture zh:食品
12061 !! html/parsoid
12062 <p><link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Alimento"/>
12063 <link rel="mw:PageProp/Language" href="//fr.wikipedia.org/wiki/Nourriture"/>
12064 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/食品"/></p>
12065 !! end
12066
12067 !! test
12068 Duplicate interlanguage links (bug 24502)
12069 !! options
12070 ill
12071 !! wikitext
12072 [[es:1]]
12073 [[es:2]]
12074 [[fr:1]]
12075 [[fr:2]]
12076 !! html/php
12077 es:1 fr:1
12078 !! html/parsoid
12079 <p><link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/1"/>
12080 <link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/2"/>
12081 <link rel="mw:PageProp/Language" href="//fr.wikipedia.org/wiki/1"/>
12082 <link rel="mw:PageProp/Language" href="//fr.wikipedia.org/wiki/2"/></p>
12083 !! end
12084
12085 ###
12086 ### Sections
12087 ###
12088 !! test
12089 Basic section headings
12090 !! wikitext
12091 == Headline 1 ==
12092 Some text
12093
12094 ==Headline 2==
12095 More
12096 ===Smaller headline===
12097 Blah blah
12098 !! html
12099 <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>
12100 <p>Some text
12101 </p>
12102 <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>
12103 <p>More
12104 </p>
12105 <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>
12106 <p>Blah blah
12107 </p>
12108 !! end
12109
12110 !! test
12111 Section headings with TOC
12112 !! wikitext
12113 == Headline 1 ==
12114 === Subheadline 1 ===
12115 ===== Skipping a level =====
12116 ====== Skipping a level ======
12117
12118 == Headline 2 ==
12119 Some text
12120 ===Another headline===
12121 !! html
12122 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12123 <ul>
12124 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
12125 <ul>
12126 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
12127 <ul>
12128 <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>
12129 <ul>
12130 <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>
12131 </ul>
12132 </li>
12133 </ul>
12134 </li>
12135 </ul>
12136 </li>
12137 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
12138 <ul>
12139 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
12140 </ul>
12141 </li>
12142 </ul>
12143 </div>
12144
12145 <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>
12146 <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>
12147 <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>
12148 <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>
12149 <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>
12150 <p>Some text
12151 </p>
12152 <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>
12153
12154 !! end
12155
12156 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
12157 !! test
12158 Handling of sections up to level 6 and beyond
12159 !! wikitext
12160 = Level 1 Heading=
12161 == Level 2 Heading==
12162 === Level 3 Heading===
12163 ==== Level 4 Heading====
12164 ===== Level 5 Heading=====
12165 ====== Level 6 Heading======
12166 ======= Level 7 Heading=======
12167 ======== Level 8 Heading========
12168 ========= Level 9 Heading=========
12169 ========== Level 10 Heading==========
12170 !! html
12171 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12172 <ul>
12173 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
12174 <ul>
12175 <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>
12176 <ul>
12177 <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>
12178 <ul>
12179 <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>
12180 <ul>
12181 <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>
12182 <ul>
12183 <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>
12184 <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>
12185 <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>
12186 <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>
12187 <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>
12188 </ul>
12189 </li>
12190 </ul>
12191 </li>
12192 </ul>
12193 </li>
12194 </ul>
12195 </li>
12196 </ul>
12197 </li>
12198 </ul>
12199 </div>
12200
12201 <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>
12202 <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>
12203 <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>
12204 <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>
12205 <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>
12206 <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>
12207 <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>
12208 <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>
12209 <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>
12210 <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>
12211
12212 !! end
12213
12214 !! test
12215 TOC regression (bug 9764)
12216 !! wikitext
12217 == title 1 ==
12218 === title 1.1 ===
12219 ==== title 1.1.1 ====
12220 === title 1.2 ===
12221 == title 2 ==
12222 === title 2.1 ===
12223 !! html
12224 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12225 <ul>
12226 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12227 <ul>
12228 <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>
12229 <ul>
12230 <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>
12231 </ul>
12232 </li>
12233 <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>
12234 </ul>
12235 </li>
12236 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12237 <ul>
12238 <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>
12239 </ul>
12240 </li>
12241 </ul>
12242 </div>
12243
12244 <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>
12245 <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>
12246 <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>
12247 <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>
12248 <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>
12249 <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>
12250
12251 !! end
12252
12253 !! test
12254 TOC with wgMaxTocLevel=3 (bug 6204)
12255 !! options
12256 wgMaxTocLevel=3
12257 !! wikitext
12258 == title 1 ==
12259 === title 1.1 ===
12260 ==== title 1.1.1 ====
12261 === title 1.2 ===
12262 == title 2 ==
12263 === title 2.1 ===
12264 !! html
12265 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12266 <ul>
12267 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12268 <ul>
12269 <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>
12270 <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>
12271 </ul>
12272 </li>
12273 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12274 <ul>
12275 <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>
12276 </ul>
12277 </li>
12278 </ul>
12279 </div>
12280
12281 <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>
12282 <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>
12283 <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>
12284 <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>
12285 <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>
12286 <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>
12287
12288 !! end
12289
12290 !! test
12291 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
12292 !! options
12293 wgMaxTocLevel=3
12294 !! wikitext
12295 ==Section 1==
12296 ===Section 1.1===
12297 ====Section 1.1.1====
12298 ====Section 1.1.1.1====
12299 ==Section 2==
12300 !! html
12301 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12302 <ul>
12303 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
12304 <ul>
12305 <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>
12306 </ul>
12307 </li>
12308 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
12309 </ul>
12310 </div>
12311
12312 <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>
12313 <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>
12314 <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>
12315 <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>
12316 <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>
12317
12318 !! end
12319
12320
12321 !! test
12322 Resolving duplicate section names
12323 !! wikitext
12324 == Foo bar ==
12325 == Foo bar ==
12326 !! html
12327 <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>
12328 <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>
12329
12330 !! end
12331
12332 !! test
12333 Resolving duplicate section names with differing case (bug 10721)
12334 !! wikitext
12335 == Foo bar ==
12336 == Foo Bar ==
12337 !! html
12338 <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>
12339 <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>
12340
12341 !! end
12342
12343 !! article
12344 Template:sections
12345 !! text
12346 ===Section 1===
12347 ==Section 2==
12348 !! endarticle
12349
12350 !! test
12351 Template with sections, __NOTOC__
12352 !! wikitext
12353 __NOTOC__
12354 ==Section 0==
12355 {{sections}}
12356 ==Section 4==
12357 !! html
12358 <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>
12359 <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>
12360 <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>
12361 <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>
12362
12363 !! end
12364
12365 !! test
12366 __NOEDITSECTION__ keyword
12367 !! wikitext
12368 __NOEDITSECTION__
12369 ==Section 1==
12370 ==Section 2==
12371 !! html
12372 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
12373 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
12374
12375 !! end
12376
12377 !! test
12378 Link inside a section heading
12379 !! wikitext
12380 ==Section with a [[Main Page|link]] in it==
12381 !! html
12382 <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>
12383
12384 !! end
12385
12386 !! test
12387 TOC regression (bug 12077)
12388 !! wikitext
12389 __TOC__
12390 == title 1 ==
12391 === title 1.1 ===
12392 == title 2 ==
12393 !! html
12394 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12395 <ul>
12396 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12397 <ul>
12398 <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>
12399 </ul>
12400 </li>
12401 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
12402 </ul>
12403 </div>
12404
12405 <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>
12406 <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>
12407 <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>
12408
12409 !! end
12410
12411 !! test
12412 BUG 1219 URL next to image (good)
12413 !! wikitext
12414 http://example.com [[Image:foobar.jpg]]
12415 !! html
12416 <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>
12417 </p>
12418 !!end
12419
12420 !! test
12421 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
12422 !! wikitext
12423 ===
12424 The line above must have a trailing space!
12425 === <!--
12426 --> <!-- -->
12427 But just in case it doesn't...
12428 !! html
12429 <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>
12430 <p>The line above must have a trailing space!
12431 </p>
12432 <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>
12433 <p>But just in case it doesn't...
12434 </p>
12435 !! end
12436
12437 !! test
12438 Header with special characters (bug 25462)
12439 !! wikitext
12440 The tooltips shall not show entities to the user (ie. be double escaped)
12441
12442 == text > text ==
12443 section 1
12444
12445 == text < text ==
12446 section 2
12447
12448 == text & text ==
12449 section 3
12450
12451 == text ' text ==
12452 section 4
12453
12454 == text " text ==
12455 section 5
12456 !! html
12457 <p>The tooltips shall not show entities to the user (ie. be double escaped)
12458 </p>
12459 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12460 <ul>
12461 <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>
12462 <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>
12463 <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>
12464 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
12465 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
12466 </ul>
12467 </div>
12468
12469 <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>
12470 <p>section 1
12471 </p>
12472 <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>
12473 <p>section 2
12474 </p>
12475 <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>
12476 <p>section 3
12477 </p>
12478 <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>
12479 <p>section 4
12480 </p>
12481 <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>
12482 <p>section 5
12483 </p>
12484 !! end
12485
12486 !! test
12487 Headers with excess '=' characters
12488 (Are similar tests necessary beyond the 1st level?)
12489 !! wikitext
12490 =foo==
12491 ==foo=
12492 =''italic'' heading==
12493 ==''italic'' heading=
12494 !! html
12495 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12496 <ul>
12497 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
12498 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
12499 <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>
12500 <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>
12501 </ul>
12502 </div>
12503
12504 <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>
12505 <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>
12506 <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>
12507 <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>
12508
12509 !! end
12510
12511 !! test
12512 HTML headers vs TOC (bug 23393)
12513 (__NOEDITSECTION__ for clearer output, doesn't matter here)
12514 !! wikitext
12515 <h1>Header 1</h1>
12516 == Header 1.1 ==
12517 == Header 1.2 ==
12518
12519 <h1>Header 2
12520 </h1>
12521 == Header 2.1 ==
12522 == Header 2.2 ==
12523 __NOEDITSECTION__
12524 !! html
12525 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12526 <ul>
12527 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
12528 <ul>
12529 <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>
12530 <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>
12531 </ul>
12532 </li>
12533 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
12534 <ul>
12535 <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>
12536 <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>
12537 </ul>
12538 </li>
12539 </ul>
12540 </div>
12541
12542 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
12543 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
12544 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
12545 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
12546 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
12547 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
12548
12549 !! end
12550
12551 !! test
12552 Single-line or multiline-comments can follow headings
12553 !! options
12554 parsoid=wt2html,wt2wt
12555 !! wikitext
12556 ==foo==<!---->
12557 ==bar==<!--c1-->
12558 ==baz==<!--
12559 c2
12560 c3-->
12561 !! html
12562 <h2><span class="mw-headline" id="foo">foo</span></h2>
12563 <h2><span class="mw-headline" id="bar">bar</span></h2>
12564 <h2><span class="mw-headline" id="baz">baz</span></h2>
12565
12566 !! end
12567
12568 !! test
12569 BUG 1219 URL next to image (broken)
12570 !! wikitext
12571 http://example.com[[Image:foobar.jpg]]
12572 !! html
12573 <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>
12574 </p>
12575 !!end
12576
12577 !! test
12578 Bug 1186 news: in the middle of text
12579 !! wikitext
12580 http://en.wikinews.org/wiki/Wikinews:Workplace
12581 !! html
12582 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
12583 </p>
12584 !!end
12585
12586
12587 !! test
12588 Namespaced link must have a title
12589 !! wikitext
12590 [[Project:]]
12591 !! html
12592 <p>[[Project:]]
12593 </p>
12594 !!end
12595
12596 !! test
12597 Namespaced link must have a title (bad fragment version)
12598 !! wikitext
12599 [[Project:#fragment]]
12600 !! html
12601 <p>[[Project:#fragment]]
12602 </p>
12603 !!end
12604
12605
12606 ###
12607 ### HTML tags and HTML attributes
12608 ###
12609
12610 !! test
12611 div with no attributes
12612 !! wikitext
12613 <div>HTML rocks</div>
12614 !! html
12615 <div>HTML rocks</div>
12616
12617 !! end
12618
12619 !! test
12620 div with double-quoted attribute
12621 !! wikitext
12622 <div id="rock">HTML rocks</div>
12623 !! html
12624 <div id="rock">HTML rocks</div>
12625
12626 !! end
12627
12628 !! test
12629 div with single-quoted attribute
12630 !! wikitext
12631 <div id='rock'>HTML rocks</div>
12632 !! html
12633 <div id="rock">HTML rocks</div>
12634
12635 !! end
12636
12637 !! test
12638 div with unquoted attribute
12639 !! wikitext
12640 <div id=rock>HTML rocks</div>
12641 !! html
12642 <div id="rock">HTML rocks</div>
12643
12644 !! end
12645
12646 !! test
12647 div with illegal double attributes
12648 !! wikitext
12649 <div id="a" id="b">HTML rocks</div>
12650 !! html
12651 <div id="b">HTML rocks</div>
12652
12653 !!end
12654
12655 # FIXME: produce empty string instead of "class" in the PHP parser, following
12656 # the HTML5 spec.
12657 !! test
12658 div with empty attribute value, space before equals
12659 !! options
12660 parsoid
12661 !! wikitext
12662 <div class =>HTML rocks</div>
12663 !! html
12664 <div class="">HTML rocks</div>
12665
12666 !! end
12667
12668 # The PHP parser escapes the opening brace to &#123; for some reason, so
12669 # disabled this test for it.
12670 !! test
12671 div with braces in attribute value
12672 !! options
12673 parsoid
12674 !! wikitext
12675 <div title="{}">Foo</div>
12676 !! html
12677 <div title="{}">Foo</div>
12678 !! end
12679
12680 # This it very inconsistent in the PHP parser: it returns
12681 # class="class" if there is a space between the name and the equal sign (see
12682 # 'div with empty attribute value, space before equals'), but strips the
12683 # attribute completely if the space is missing. We hope that not much content
12684 # depends on this, so are implementing the behavior below in Parsoid for
12685 # consistencies' sake. Disabled for the PHP parser.
12686 # FIXME: fix this behavior in the PHP parser?
12687 !! test
12688 div with empty attribute value, no space before equals
12689 !! options
12690 parsoid
12691 !! wikitext
12692 <div class=>HTML rocks</div>
12693 !! html
12694 <div class="">HTML rocks</div>
12695
12696 !! end
12697
12698 !! test
12699 HTML multiple attributes correction
12700 !! wikitext
12701 <p class="error" class="awesome">Awesome!</p>
12702 !! html
12703 <p class="awesome">Awesome!</p>
12704
12705 !!end
12706
12707 !! test
12708 Table multiple attributes correction
12709 !! wikitext
12710 {|
12711 !+ class="error" class="awesome"| status
12712 |}
12713 !! html
12714 <table>
12715 <tr>
12716 <th class="awesome"> status
12717 </th></tr></table>
12718
12719 !!end
12720
12721 !! test
12722 DIV IN UPPERCASE
12723 !! wikitext
12724 <DIV ID="x">HTML ROCKS</DIV>
12725 !! html
12726 <div id="x">HTML ROCKS</div>
12727
12728 !!end
12729
12730 !! test
12731 Non-ASCII pseudo-tags are rendered as text
12732 !! wikitext
12733 <khyô>
12734 !! html
12735 <p>&lt;khyô&gt;
12736 </p>
12737 !! end
12738
12739 !! test
12740 Pseudo-tag with URL 'name' renders as url link
12741 !! wikitext
12742 <http://example.com/>
12743 !! html
12744 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
12745 </p>
12746 !! end
12747
12748 !! test
12749 text with amp in the middle of nowhere
12750 !! wikitext
12751 Remember AT&T?
12752 !! html
12753 <p>Remember AT&amp;T?
12754 </p>
12755 !! end
12756
12757 !! test
12758 text with character entity: eacute
12759 !! wikitext
12760 I always thought &eacute; was a cute letter.
12761 !! html
12762 <p>I always thought &#233; was a cute letter.
12763 </p>
12764 !! end
12765
12766 !! test
12767 text with entity-escaped character entity-like string: eacute
12768 !! wikitext
12769 I always thought &amp;eacute; was a cute letter.
12770 !! html
12771 <p>I always thought &amp;eacute; was a cute letter.
12772 </p>
12773 !! end
12774
12775 !! test
12776 text with undefined character entity: xacute
12777 !! wikitext
12778 I always thought &xacute; was a cute letter.
12779 !! html
12780 <p>I always thought &amp;xacute; was a cute letter.
12781 </p>
12782 !! end
12783
12784 # TODO: generalize to PHP parser?
12785 !! test
12786 HTML5 tags
12787 !! options
12788 parsoid
12789 !! wikitext
12790 <data value="5">five</data>
12791 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12792 <mark>This highlighted text</mark>
12793 !! html
12794 <p><data value="5">five</data>
12795 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12796 <mark>This highlighted text</mark></p>
12797 !! end
12798
12799 !! test
12800 HTML tag with leading space is parsed as text
12801 !! wikitext
12802 < div>foo< /div>
12803 !! html
12804 <p>&lt; div&gt;foo&lt; /div&gt;
12805 </p>
12806 !! end
12807
12808 ###
12809 ### Nesting tests (see bug 41545, 50604, 51081)
12810 ###
12811
12812 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
12813 # Note that html2wt is considerably more difficult if we use <b> in
12814 # the test case, instead of <big>
12815 !! test
12816 Ensure that HTML adoption agency algorithm is properly implemented.
12817 !! wikitext
12818 <big>X<big>Y</big>Z</big>
12819 !! html
12820 <p><big>X<big>Y</big>Z</big>
12821 </p>
12822 !! end
12823
12824 # This was bug 41545 in the PHP parser.
12825 !! test
12826 Nesting of <kbd>
12827 !! wikitext
12828 <kbd>X<kbd>Y</kbd>Z</kbd>
12829 !! html
12830 <p><kbd>X<kbd>Y</kbd>Z</kbd>
12831 </p>
12832 !! end
12833
12834 # The following cases were bug 51081 in the PHP parser.
12835 # Note that there are some other nestable tags (b, i, etc) which are
12836 # not covered; see bug 51081 for discussion.
12837 !! test
12838 Nesting of <em>
12839 !! wikitext
12840 <em>X<em>Y</em>Z</em>
12841 !! html
12842 <p><em>X<em>Y</em>Z</em>
12843 </p>
12844 !! end
12845
12846 !! test
12847 Nesting of <strong>
12848 !! wikitext
12849 <strong>X<strong>Y</strong>Z</strong>
12850 !! html
12851 <p><strong>X<strong>Y</strong>Z</strong>
12852 </p>
12853 !! end
12854
12855 !! test
12856 Nesting of <q>
12857 !! wikitext
12858 <q>X<q>Y</q>Z</q>
12859 !! html
12860 <p><q>X<q>Y</q>Z</q>
12861 </p>
12862 !! end
12863
12864 !! test
12865 Nesting of <ruby>
12866 !! wikitext
12867 <ruby>X<ruby>Y</ruby>Z</ruby>
12868 !! html
12869 <p><ruby>X<ruby>Y</ruby>Z</ruby>
12870 </p>
12871 !! end
12872
12873 !! test
12874 Nesting of <bdo>
12875 !! wikitext
12876 <bdo>X<bdo>Y</bdo>Z</bdo>
12877 !! html
12878 <p><bdo>X<bdo>Y</bdo>Z</bdo>
12879 </p>
12880 !! end
12881
12882
12883 ###
12884 ### Media links
12885 ###
12886
12887 !! test
12888 Media link
12889 !! wikitext
12890 [[Media:Foobar.jpg]]
12891 !! html
12892 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
12893 </p>
12894 !! end
12895
12896 !! test
12897 Media link with text
12898 !! wikitext
12899 [[Media:Foobar.jpg|A neat file to look at]]
12900 !! html
12901 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
12902 </p>
12903 !! end
12904
12905 # FIXME: this is still bad HTML tag nesting
12906 !! test
12907 Media link with nasty text
12908 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
12909 !! wikitext
12910 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12911 !! html
12912 <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>
12913
12914 !! end
12915
12916 !! test
12917 Media link to nonexistent file (bug 1702)
12918 !! wikitext
12919 [[Media:No such.jpg]]
12920 !! html
12921 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12922 </p>
12923 !! end
12924
12925 !! test
12926 Image link to nonexistent file (bug 1850 - good)
12927 !! wikitext
12928 [[Image:No such.jpg]]
12929 !! html
12930 <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>
12931 </p>
12932 !! end
12933
12934 !! test
12935 :Image link to nonexistent file (bug 1850 - bad)
12936 !! wikitext
12937 [[:Image:No such.jpg]]
12938 !! html
12939 <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>
12940 </p>
12941 !! end
12942
12943
12944
12945 !! test
12946 Character reference normalization in link text (bug 1938)
12947 !! wikitext
12948 [[Main Page|this&that]]
12949 !! html
12950 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12951 </p>
12952 !!end
12953
12954 !! article
12955 אַ
12956 !! text
12957 Test for unicode normalization
12958
12959 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12960 !! endarticle
12961
12962 !! test
12963 (bug 19451) Links should refer to the normalized form.
12964 !! wikitext
12965 [[&#xFB2E;]]
12966 [[&#x5d0;&#x5b7;]]
12967 [[&#x5d0;ַ]]
12968 [[א&#x5b7;]]
12969 [[אַ]]
12970 !! html
12971 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12972 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12973 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12974 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12975 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12976 </p>
12977 !! end
12978
12979 !! test
12980 Empty attribute crash test (bug 2067)
12981 !! wikitext
12982 <font color="">foo</font>
12983 !! html
12984 <p><font color="">foo</font>
12985 </p>
12986 !! end
12987
12988 !! test
12989 Empty attribute crash test single-quotes (bug 2067)
12990 !! wikitext
12991 <font color=''>foo</font>
12992 !! html
12993 <p><font color="">foo</font>
12994 </p>
12995 !! end
12996
12997 !! test
12998 Attribute test: equals, then nothing
12999 !! wikitext
13000 <font color=>foo</font>
13001 !! html
13002 <p><font>foo</font>
13003 </p>
13004 !! end
13005
13006 !! test
13007 Attribute test: unquoted value
13008 !! wikitext
13009 <font color=x>foo</font>
13010 !! html
13011 <p><font color="x">foo</font>
13012 </p>
13013 !! end
13014
13015 !! test
13016 Attribute test: unquoted but illegal value (hash)
13017 !! wikitext
13018 <font color=#x>foo</font>
13019 !! html
13020 <p><font color="#x">foo</font>
13021 </p>
13022 !! end
13023
13024 !! test
13025 Attribute test: no value
13026 !! wikitext
13027 <font color>foo</font>
13028 !! html
13029 <p><font color="color">foo</font>
13030 </p>
13031 !! end
13032
13033 !! test
13034 Bug 2095: link with three closing brackets
13035 !! wikitext
13036 [[Main Page]]]
13037 !! html/php
13038 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
13039 </p>
13040 !! html/parsoid
13041 <p><a rel="mw:WikiLink" href="./Main_Page">Main Page</a>]</p>
13042 !! end
13043
13044 !! test
13045 Bug 2095: link with pipe and three closing brackets
13046 !! wikitext
13047 [[Main Page|link]]]
13048 !! html/php
13049 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
13050 </p>
13051 !! html/parsoid
13052 <p><a rel="mw:WikiLink" href="./Main_Page">link</a>]</p>
13053 !! end
13054
13055 !! test
13056 Bug 2095: link with pipe and three closing brackets, version 2
13057 !! wikitext
13058 [[Main Page|[http://example.com/]]]
13059 !! html/php
13060 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
13061 </p>
13062 !! html/parsoid
13063 <p><a rel="mw:WikiLink" href="./Main_Page">[http://example.com/]</a></p>
13064 !! end
13065
13066
13067 ###
13068 ### Safety
13069 ###
13070
13071 !! article
13072 Template:Dangerous attribute
13073 !! text
13074 " onmouseover="alert(document.cookie)
13075 !! endarticle
13076
13077 !! article
13078 Template:Dangerous style attribute
13079 !! text
13080 border-size: expression(alert(document.cookie))
13081 !! endarticle
13082
13083 !! article
13084 Template:Div style
13085 !! text
13086 <div style="float: right; {{{1}}}">Magic div</div>
13087 !! endarticle
13088
13089 !! test
13090 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
13091 !! wikitext
13092 <div title="{{test}}"></div>
13093 !! html
13094 <div title="This is a test template"></div>
13095
13096 !! end
13097
13098 !! test
13099 Bug 2304: HTML attribute safety (dangerous template; 2309)
13100 !! wikitext
13101 <div title="{{dangerous attribute}}"></div>
13102 !! html
13103 <div title=""></div>
13104
13105 !! end
13106
13107 !! test
13108 Bug 2304: HTML attribute safety (dangerous style template; 2309)
13109 !! wikitext
13110 <div style="{{dangerous style attribute}}"></div>
13111 !! html
13112 <div style="/* insecure input */"></div>
13113
13114 !! end
13115
13116 !! test
13117 Bug 2304: HTML attribute safety (safe parameter; 2309)
13118 !! wikitext
13119 {{div style|width: 200px}}
13120 !! html
13121 <div style="float: right; width: 200px">Magic div</div>
13122
13123 !! end
13124
13125 !! test
13126 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
13127 !! wikitext
13128 {{div style|width: expression(alert(document.cookie))}}
13129 !! html
13130 <div style="/* insecure input */">Magic div</div>
13131
13132 !! end
13133
13134 !! test
13135 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
13136 !! wikitext
13137 {{div style|"><script>alert(document.cookie)</script>}}
13138 !! html
13139 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13140
13141 !! end
13142
13143 !! test
13144 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
13145 !! wikitext
13146 {{div style|" ><script>alert(document.cookie)</script>}}
13147 !! html
13148 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13149
13150 !! end
13151
13152 !! test
13153 Bug 2304: HTML attribute safety (link)
13154 !! wikitext
13155 <div title="[[Main Page]]"></div>
13156 !! html
13157 <div title="&#91;&#91;Main Page]]"></div>
13158
13159 !! end
13160
13161 !! test
13162 Bug 2304: HTML attribute safety (italics)
13163 !! wikitext
13164 <div title="''foobar''"></div>
13165 !! html
13166 <div title="&#39;&#39;foobar&#39;&#39;"></div>
13167
13168 !! end
13169
13170 !! test
13171 Bug 2304: HTML attribute safety (bold)
13172 !! wikitext
13173 <div title="'''foobar'''"></div>
13174 !! html
13175 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
13176
13177 !! end
13178
13179
13180 !! test
13181 Bug 2304: HTML attribute safety (ISBN)
13182 !! wikitext
13183 <div title="ISBN 1234567890"></div>
13184 !! html
13185 <div title="&#73;SBN 1234567890"></div>
13186
13187 !! end
13188
13189 !! test
13190 Bug 2304: HTML attribute safety (RFC)
13191 !! wikitext
13192 <div title="RFC 1234"></div>
13193 !! html
13194 <div title="&#82;FC 1234"></div>
13195
13196 !! end
13197
13198 !! test
13199 Bug 2304: HTML attribute safety (PMID)
13200 !! wikitext
13201 <div title="PMID 1234567890"></div>
13202 !! html
13203 <div title="&#80;MID 1234567890"></div>
13204
13205 !! end
13206
13207 !! test
13208 Bug 2304: HTML attribute safety (web link)
13209 !! wikitext
13210 <div title="http://example.com/"></div>
13211 !! html
13212 <div title="http&#58;//example.com/"></div>
13213
13214 !! end
13215
13216 !! test
13217 Bug 2304: HTML attribute safety (named web link)
13218 !! wikitext
13219 <div title="[http://example.com/ link]"></div>
13220 !! html
13221 <div title="&#91;http&#58;//example.com/ link]"></div>
13222
13223 !! end
13224
13225 !! test
13226 Bug 3244: HTML attribute safety (extension; safe)
13227 !! wikitext
13228 <div style="<nowiki>background:blue</nowiki>"></div>
13229 !! html
13230 <div style="background:blue"></div>
13231
13232 !! end
13233
13234 !! test
13235 Bug 3244: HTML attribute safety (extension; unsafe)
13236 !! wikitext
13237 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
13238 !! html
13239 <div style="/* insecure input */"></div>
13240
13241 !! end
13242
13243 # More MSIE fun discovered by Tom Gilder
13244
13245 !! test
13246 MSIE CSS safety test: spurious slash
13247 !! wikitext
13248 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
13249 !! html
13250 <div style="/* insecure input */">evil</div>
13251
13252 !! end
13253
13254 !! test
13255 MSIE CSS safety test: hex code
13256 !! wikitext
13257 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
13258 !! html
13259 <div style="/* insecure input */">evil</div>
13260
13261 !! end
13262
13263 !! test
13264 MSIE CSS safety test: comment in url
13265 !! wikitext
13266 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
13267 !! html
13268 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
13269
13270 !! end
13271
13272 !! test
13273 MSIE CSS safety test: comment in expression
13274 !! wikitext
13275 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
13276 !! html
13277 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
13278
13279 !! end
13280
13281 !! test
13282 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
13283 !! wikitext
13284 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
13285 !! html
13286 <p style="/* invalid control char */">A</p>
13287
13288 !! end
13289
13290 !! test
13291 MSIE 6 CSS safety test: Fullwidth (bug 55332)
13292 !! wikitext
13293 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
13294 <div style="top:EXPRESSION(alert())">B</div>
13295 !! html
13296 <p style="/* insecure input */">A</p>
13297 <div style="/* insecure input */">B</div>
13298
13299 !! end
13300
13301 !! test
13302 MSIE 6 CSS safety test: IPA extensions (bug 55332)
13303 !! wikitext
13304 <div style="background-image:uʀʟ(javascript:alert())">A</div>
13305 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
13306 !! html
13307 <div style="/* insecure input */">A</div>
13308 <p style="/* insecure input */">B</p>
13309
13310 !! end
13311
13312 !! test
13313 MSIE 6 CSS safety test: sup/sub script (bug 55332)
13314 !! wikitext
13315 <div style="background-image:url⁽javascript:alert())">A</div>
13316 <div style="background-image:url₍javascript:alert())">B</div>
13317 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
13318 !! html
13319 <div style="/* insecure input */">A</div>
13320 <div style="/* insecure input */">B</div>
13321 <p style="/* insecure input */">C</p>
13322
13323 !! end
13324
13325 !! test
13326 Opera -o-link CSS
13327 !! wikitext
13328 <div
13329 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;"
13330 style="-o-link:attr(title);-o-link-source:current">X</div>
13331 !! html
13332 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
13333
13334 !! end
13335
13336 !! test
13337 MSIE 6 CSS safety test: Repetition markers (bug 55332)
13338 !! wikitext
13339 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
13340 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
13341 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
13342 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
13343 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
13344 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
13345 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
13346 !! html
13347 <p style="/* insecure input */">A</p>
13348 <p style="/* insecure input */">B</p>
13349 <p style="/* insecure input */">C</p>
13350 <p style="/* insecure input */">D</p>
13351 <p style="/* insecure input */">E</p>
13352 <p style="/* insecure input */">F</p>
13353 <p style="/* insecure input */">G</p>
13354
13355 !! end
13356
13357 !! test
13358 Table attribute legitimate extension
13359 !! wikitext
13360 {|
13361 !+ style="<nowiki>color:blue</nowiki>"| status
13362 |}
13363 !! html
13364 <table>
13365 <tr>
13366 <th style="color:blue"> status
13367 </th></tr></table>
13368
13369 !!end
13370
13371 !! test
13372 Table attribute safety
13373 !! wikitext
13374 {|
13375 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
13376 |}
13377 !! html
13378 <table>
13379 <tr>
13380 <th style="/* insecure input */"> status
13381 </th></tr></table>
13382
13383 !! end
13384
13385 !! test
13386 CSS line continuation 1
13387 !! wikitext
13388 <div style="background-image: u\&#10;rl(test.jpg);"></div>
13389 !! html
13390 <div style="/* insecure input */"></div>
13391
13392 !! end
13393
13394 !! test
13395 CSS line continuation 2
13396 !! wikitext
13397 <div style="background-image: u\&#13;rl(test.jpg); "></div>
13398 !! html
13399 <div style="/* insecure input */"></div>
13400
13401 !! end
13402
13403 !! article
13404 Template:Identity
13405 !! text
13406 {{{1}}}
13407 !! endarticle
13408
13409 !! test
13410 Expansion of multi-line templates in attribute values (bug 6255)
13411 !! wikitext
13412 <div style="background: {{identity|#00FF00}}">-</div>
13413 !! html
13414 <div style="background: #00FF00">-</div>
13415
13416 !! end
13417
13418
13419 !! test
13420 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
13421 !! wikitext
13422 <div style="background:
13423 #00FF00">-</div>
13424 !! html
13425 <div style="background: #00FF00">-</div>
13426
13427 !! end
13428
13429 !! test
13430 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
13431 !! wikitext
13432 <div style="background: &#10;#00FF00">-</div>
13433 !! html
13434 <div style="background: &#10;#00FF00">-</div>
13435
13436 !! end
13437
13438 ###
13439 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
13440 ###
13441 !! test
13442 Parser hook: empty input
13443 !! wikitext
13444 <tag></tag>
13445 !! html
13446 <pre>
13447 ''
13448 array (
13449 )
13450 </pre>
13451
13452 !! end
13453
13454 !! test
13455 Parser hook: empty input using terminated empty elements
13456 !! wikitext
13457 <tag/>
13458 !! html
13459 <pre>
13460 NULL
13461 array (
13462 )
13463 </pre>
13464
13465 !! end
13466
13467 !! test
13468 Parser hook: empty input using terminated empty elements (space before)
13469 !! wikitext
13470 <tag />
13471 !! html
13472 <pre>
13473 NULL
13474 array (
13475 )
13476 </pre>
13477
13478 !! end
13479
13480 !! test
13481 Parser hook: basic input
13482 !! wikitext
13483 <tag>input</tag>
13484 !! html
13485 <pre>
13486 'input'
13487 array (
13488 )
13489 </pre>
13490
13491 !! end
13492
13493
13494 !! test
13495 Parser hook: case insensitive
13496 !! wikitext
13497 <TAG>input</TAG>
13498 !! html
13499 <pre>
13500 'input'
13501 array (
13502 )
13503 </pre>
13504
13505 !! end
13506
13507
13508 !! test
13509 Parser hook: case insensitive, redux
13510 !! wikitext
13511 <TaG>input</TAg>
13512 !! html
13513 <pre>
13514 'input'
13515 array (
13516 )
13517 </pre>
13518
13519 !! end
13520
13521 !! test
13522 Parser hook: nested tags
13523 !! options
13524 noxml
13525 !! wikitext
13526 <tag><tag></tag></tag>
13527 !! html
13528 <pre>
13529 '<tag>'
13530 array (
13531 )
13532 </pre>&lt;/tag&gt;
13533
13534 !! end
13535
13536 !! test
13537 Parser hook: basic arguments
13538 !! wikitext
13539 <tag width=200 height = "100" depth = '50' square></tag>
13540 !! html
13541 <pre>
13542 ''
13543 array (
13544 'width' => '200',
13545 'height' => '100',
13546 'depth' => '50',
13547 'square' => 'square',
13548 )
13549 </pre>
13550
13551 !! end
13552
13553 !! test
13554 Parser hook: argument containing a forward slash (bug 5344)
13555 !! wikitext
13556 <tag filename='/tmp/bla'></tag>
13557 !! html
13558 <pre>
13559 ''
13560 array (
13561 'filename' => '/tmp/bla',
13562 )
13563 </pre>
13564
13565 !! end
13566
13567 !! test
13568 Parser hook: empty input using terminated empty elements (bug 2374)
13569 !! wikitext
13570 <tag foo=bar/>text
13571 !! html
13572 <pre>
13573 NULL
13574 array (
13575 'foo' => 'bar',
13576 )
13577 </pre>text
13578
13579 !! end
13580
13581 # </tag> should be output literally since there is no matching tag that begins it
13582 !! test
13583 Parser hook: basic arguments using terminated empty elements (bug 2374)
13584 !! wikitext
13585 <tag width=200 height = "100" depth = '50' square/>
13586 other stuff
13587 </tag>
13588 !! html
13589 <pre>
13590 NULL
13591 array (
13592 'width' => '200',
13593 'height' => '100',
13594 'depth' => '50',
13595 'square' => 'square',
13596 )
13597 </pre>
13598 <p>other stuff
13599 &lt;/tag&gt;
13600 </p>
13601 !! end
13602
13603 ###
13604 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
13605 ###
13606
13607 !! test
13608 Parser hook: static parser hook not inside a comment
13609 !! wikitext
13610 <statictag>hello, world</statictag>
13611 <statictag action=flush/>
13612 !! html
13613 <p>hello, world
13614 </p>
13615 !! end
13616
13617
13618 !! test
13619 Parser hook: static parser hook inside a comment
13620 !! wikitext
13621 <!-- <statictag>hello, world</statictag> -->
13622 <statictag action=flush/>
13623 !! html
13624 <p><br />
13625 </p>
13626 !! end
13627
13628 # Nested template calls; this case was broken by Parser.php rev 1.506,
13629 # since reverted.
13630
13631 !! article
13632 Template:One-parameter
13633 !! text
13634 (My parameter is: {{{1}}})
13635 !! endarticle
13636
13637 !! article
13638 Template:Map-one-parameter
13639 !! text
13640 {{{{{1}}}|{{{2}}}}}
13641 !! endarticle
13642
13643 !! test
13644 Nested template calls
13645 !! wikitext
13646 {{Map-one-parameter|One-parameter|param}}
13647 !! html
13648 <p>(My parameter is: param)
13649 </p>
13650 !! end
13651
13652
13653 ###
13654 ### Sanitizer
13655 ###
13656 !! test
13657 Sanitizer: Closing of open tags
13658 !! wikitext
13659 <s></s><table></table>
13660 !! html
13661 <s></s><table></table>
13662
13663 !! end
13664
13665 !! test
13666 Sanitizer: Closing of open but not closed tags
13667 !! wikitext
13668 <s>foo
13669 !! html
13670 <p><s>foo</s>
13671 </p>
13672 !! end
13673
13674 !! test
13675 Sanitizer: Closing of closed but not open tags
13676 !! wikitext
13677 </s>
13678 !! html
13679 <p>&lt;/s&gt;
13680 </p>
13681 !! end
13682
13683 !! test
13684 Sanitizer: Closing of closed but not open table tags
13685 !! wikitext
13686 Table not started</td></tr></table>
13687 !! html
13688 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
13689 </p>
13690 !! end
13691
13692 !! test
13693 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
13694 !! wikitext
13695 <span id="æ: v">byte</span>[[#æ: v|backlink]]
13696 !! html
13697 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
13698 </p>
13699 !! end
13700
13701 !! test
13702 Sanitizer: Validating the contents of the id attribute (bug 4515)
13703 !! options
13704 disabled
13705 !! wikitext
13706 <br id=9 />
13707 !! html
13708 Something, but definitely not <br id="9" />...
13709 !! end
13710
13711 !! test
13712 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
13713 !! options
13714 disabled
13715 !! wikitext
13716 <br id="foo" /><br id="foo" />
13717 !! html
13718 Something need to be done. foo-2 ?
13719 !! end
13720
13721 !! test
13722 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
13723 !! wikitext
13724 <div itemscope>
13725 <meta itemprop="hello" content="world">
13726 <meta http-equiv="refresh" content="5">
13727 <meta itemprop="hello" http-equiv="refresh" content="5">
13728 <link itemprop="hello" href="{{SERVER}}">
13729 <link rel="stylesheet" href="{{SERVER}}">
13730 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
13731 </div>
13732 !! html
13733 <div itemscope="itemscope">
13734 <p> <meta itemprop="hello" content="world" />
13735 &lt;meta http-equiv="refresh" content="5"&gt;
13736 <meta itemprop="hello" content="5" />
13737 </p>
13738 <link itemprop="hello" href="http&#58;//example.org" />
13739 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
13740 <link itemprop="hello" href="http&#58;//example.org" />
13741 </div>
13742
13743 !! end
13744
13745 !! test
13746 Language converter: output gets cut off unexpectedly (bug 5757)
13747 !! options
13748 language=zh
13749 !! wikitext
13750 this bit is safe: }-
13751
13752 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
13753
13754 then we get cut off here: }-
13755
13756 all additional text is vanished
13757 !! html
13758 <p>this bit is safe: }-
13759 </p><p>but if we add a conversion instance: xxx
13760 </p><p>then we get cut off here: }-
13761 </p><p>all additional text is vanished
13762 </p>
13763 !! end
13764
13765 !! test
13766 Self closed html pairs (bug 5487)
13767 !! options
13768 !! wikitext
13769 <center><font id="bug" />Centered text</center>
13770 <div><font id="bug2" />In div text</div>
13771 !! html
13772 <center>&lt;font id="bug" /&gt;Centered text</center>
13773 <div>&lt;font id="bug2" /&gt;In div text</div>
13774
13775 !! end
13776
13777 #
13778 #
13779 #
13780
13781 !! test
13782 Punctuation: nbsp before exclamation
13783 !! wikitext
13784 C'est grave !
13785 !! html
13786 <p>C'est grave&#160;!
13787 </p>
13788 !! end
13789
13790 !! test
13791 Punctuation: CSS !important (bug 11874)
13792 !! wikitext
13793 <div style="width:50% !important">important</div>
13794 !! html
13795 <div style="width:50% !important">important</div>
13796
13797 !!end
13798
13799 !! test
13800 Punctuation: CSS ! important (bug 11874; with space after)
13801 !! wikitext
13802 <div style="width:50% ! important">important</div>
13803 !! html
13804 <div style="width:50% ! important">important</div>
13805
13806 !!end
13807
13808
13809 !! test
13810 HTML bullet list, closed tags (bug 5497)
13811 !! wikitext
13812 <ul>
13813 <li>One</li>
13814 <li>Two</li>
13815 </ul>
13816 !! html
13817 <ul>
13818 <li>One</li>
13819 <li>Two</li>
13820 </ul>
13821
13822 !! end
13823
13824 !! test
13825 HTML bullet list, unclosed tags (bug 5497)
13826 !! options
13827 disabled
13828 !! wikitext
13829 <ul>
13830 <li>One
13831 <li>Two
13832 </ul>
13833 !! html
13834 <ul>
13835 <li>One
13836 </li>
13837 <li>Two
13838 </li>
13839 </ul>
13840
13841 !! end
13842
13843 !! test
13844 HTML ordered list, closed tags (bug 5497)
13845 !! wikitext
13846 <ol>
13847 <li>One</li>
13848 <li>Two</li>
13849 </ol>
13850 !! html
13851 <ol>
13852 <li>One</li>
13853 <li>Two</li>
13854 </ol>
13855
13856 !! end
13857
13858 !! test
13859 HTML ordered list, unclosed tags (bug 5497)
13860 !! options
13861 disabled
13862 !! wikitext
13863 <ol>
13864 <li>One
13865 <li>Two
13866 </ol>
13867 !! html
13868 <ol>
13869 <li>One
13870 </li>
13871 <li>Two
13872 </li>
13873 </ol>
13874
13875 !! end
13876
13877 !! test
13878 HTML nested bullet list, closed tags (bug 5497)
13879 !! wikitext
13880 <ul>
13881 <li>One</li>
13882 <li>Two:
13883 <ul>
13884 <li>Sub-one</li>
13885 <li>Sub-two</li>
13886 </ul>
13887 </li>
13888 </ul>
13889 !! html
13890 <ul>
13891 <li>One</li>
13892 <li>Two:
13893 <ul>
13894 <li>Sub-one</li>
13895 <li>Sub-two</li>
13896 </ul>
13897 </li>
13898 </ul>
13899
13900 !! end
13901
13902 !! test
13903 HTML nested bullet list, open tags (bug 5497)
13904 !! options
13905 disabled
13906 !! wikitext
13907 <ul>
13908 <li>One
13909 <li>Two:
13910 <ul>
13911 <li>Sub-one
13912 <li>Sub-two
13913 </ul>
13914 </ul>
13915 !! html
13916 <ul>
13917 <li>One
13918 </li>
13919 <li>Two:
13920 <ul>
13921 <li>Sub-one
13922 </li>
13923 <li>Sub-two
13924 </li>
13925 </ul>
13926 </li>
13927 </ul>
13928
13929 !! end
13930
13931 !! test
13932 HTML nested ordered list, closed tags (bug 5497)
13933 !! wikitext
13934 <ol>
13935 <li>One</li>
13936 <li>Two:
13937 <ol>
13938 <li>Sub-one</li>
13939 <li>Sub-two</li>
13940 </ol>
13941 </li>
13942 </ol>
13943 !! html
13944 <ol>
13945 <li>One</li>
13946 <li>Two:
13947 <ol>
13948 <li>Sub-one</li>
13949 <li>Sub-two</li>
13950 </ol>
13951 </li>
13952 </ol>
13953
13954 !! end
13955
13956 !! test
13957 HTML nested ordered list, open tags (bug 5497)
13958 !! options
13959 disabled
13960 !! wikitext
13961 <ol>
13962 <li>One
13963 <li>Two:
13964 <ol>
13965 <li>Sub-one
13966 <li>Sub-two
13967 </ol>
13968 </ol>
13969 !! html
13970 <ol>
13971 <li>One
13972 </li>
13973 <li>Two:
13974 <ol>
13975 <li>Sub-one
13976 </li>
13977 <li>Sub-two
13978 </li>
13979 </ol>
13980 </li>
13981 </ol>
13982
13983 !! end
13984
13985 !! test
13986 HTML ordered list item with parameters oddity
13987 !! wikitext
13988 <ol><li id="fragment">One</li>
13989 </ol>
13990 !! html
13991 <ol><li id="fragment">One</li>
13992 </ol>
13993
13994 !! end
13995
13996 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
13997 !!test
13998 bug 5918: autonumbering
13999 !! wikitext
14000 [http://first/] [http://second] [ftp://ftp]
14001
14002 ftp://inlineftp
14003
14004 [mailto:enclosed@mail.tld With target]
14005
14006 [mailto:enclosed@mail.tld]
14007
14008 mailto:inline@mail.tld
14009 !! html/php
14010 <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>
14011 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
14012 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
14013 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
14014 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
14015 </p>
14016 !! html/parsoid
14017 <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>
14018 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
14019 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
14020 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
14021 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
14022 !! end
14023
14024
14025 #
14026 # Security and HTML correctness
14027 # From Nick Jenkins' fuzz testing
14028 #
14029
14030 !! test
14031 Fuzz testing: Parser13
14032 !! wikitext
14033 {|
14034 | http://a|
14035 !! html
14036 <table>
14037 <tr>
14038 <td>
14039 </td>
14040 </tr>
14041 </table>
14042
14043 !! end
14044
14045 !! test
14046 Fuzz testing: Parser14
14047 !! wikitext
14048 == onmouseover= ==
14049 http://__TOC__
14050 !! html
14051 <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>
14052 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14053 <ul>
14054 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
14055 </ul>
14056 </div>
14057
14058
14059 !! end
14060
14061 !! test
14062 Fuzz testing: Parser14-table
14063 !! wikitext
14064 ==a==
14065 {| STYLE=__TOC__
14066 !! html
14067 <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>
14068 <table style="&#95;_TOC&#95;_">
14069 <tr><td></td></tr>
14070 </table>
14071
14072 !! end
14073
14074 # Known to produce bogus xml (extra </td>)
14075 !! test
14076 Fuzz testing: Parser16
14077 !! options
14078 noxml
14079 !! wikitext
14080 {|
14081 !https://||||||
14082 !! html
14083 <table>
14084 <tr>
14085 <th>https://</th>
14086 <th></th>
14087 <th></th>
14088 <th>
14089 </td>
14090 </tr>
14091 </table>
14092
14093 !! end
14094
14095 !! test
14096 Fuzz testing: Parser21
14097 !! wikitext
14098 {|
14099 ! irc://{{ftp://a" onmouseover="alert('hello world');"
14100 |
14101 !! html
14102 <table>
14103 <tr>
14104 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
14105 </th>
14106 <td>
14107 </td>
14108 </tr>
14109 </table>
14110
14111 !! end
14112
14113 !! test
14114 Fuzz testing: Parser22
14115 !! wikitext
14116 http://===r:::https://b
14117
14118 {|
14119 !! html
14120 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
14121 </p>
14122 <table>
14123 <tr><td></td></tr>
14124 </table>
14125
14126 !! end
14127
14128 # Known to produce bad XML for now
14129 !! test
14130 Fuzz testing: Parser24
14131 !! options
14132 noxml
14133 !! wikitext
14134 {|
14135 {{{|
14136 <u CLASS=
14137 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
14138 <br style="onmouseover='alert(document.cookie);' " />
14139
14140 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14141 |
14142 !! html
14143 <table>
14144 {{{|
14145 <u class="&#124;">}}}} &gt;
14146 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
14147
14148 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14149 <tr>
14150 <td></u>
14151 </td>
14152 </tr>
14153 </table>
14154
14155 !! end
14156
14157 # Note: the current result listed for this is not what the original one was,
14158 # but the original bug was JavaScript injection, which is fixed in any case.
14159 # It's not clear that the original result listed was any more correct than the
14160 # current one. Original result:
14161 # <p>{{{|
14162 # </p>
14163 # <li class="&#124;&#124;">
14164 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14165 !!test
14166 Fuzz testing: Parser25 (bug 6055)
14167 !! wikitext
14168 {{{
14169 |
14170 <LI CLASS=||
14171 >
14172 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
14173 !! html
14174 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14175 </p>
14176 !! end
14177
14178 !!test
14179 Fuzz testing: URL adjacent extension (with space, clean)
14180 !! options
14181 !! wikitext
14182 http://example.com <nowiki>junk</nowiki>
14183 !! html
14184 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
14185 </p>
14186 !!end
14187
14188 !!test
14189 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
14190 !! options
14191 !! wikitext
14192 http://example.com<nowiki>junk</nowiki>
14193 !! html
14194 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
14195 </p>
14196 !!end
14197
14198 !!test
14199 Fuzz testing: URL adjacent extension (no space, dirty; pre)
14200 !! options
14201 !! wikitext
14202 http://example.com<pre>junk</pre>
14203 !! html
14204 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
14205
14206 !!end
14207
14208 !!test
14209 Fuzz testing: image with bogus manual thumbnail
14210 !! wikitext
14211 [[Image:foobar.jpg|thumbnail= ]]
14212 !! html/php
14213 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
14214
14215 !! html/parsoid
14216 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
14217 !!end
14218
14219 !! test
14220 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
14221 !! wikitext
14222 <pre dir="&#10;"></pre>
14223 !! html
14224 <pre dir="&#10;"></pre>
14225
14226 !! end
14227
14228 !! test
14229 Parsing optional HTML elements (Bug 6171)
14230 !! options
14231 !! wikitext
14232 <table>
14233 <tr>
14234 <td> Some tabular data</td>
14235 <td> More tabular data ...
14236 <td> And yet som tabular data</td>
14237 </tr>
14238 </table>
14239 !! html
14240 <table>
14241 <tr>
14242 <td> Some tabular data</td>
14243 <td> More tabular data ...
14244 </td><td> And yet som tabular data</td>
14245 </tr>
14246 </table>
14247
14248 !! end
14249
14250 !! test
14251 Correct handling of <td>, <tr> (Bug 6171)
14252 !! options
14253 !! wikitext
14254 <table>
14255 <tr>
14256 <td> Some tabular data</td>
14257 <td> More tabular data ...</td>
14258 <td> And yet som tabular data</td>
14259 </tr>
14260 </table>
14261 !! html
14262 <table>
14263 <tr>
14264 <td> Some tabular data</td>
14265 <td> More tabular data ...</td>
14266 <td> And yet som tabular data</td>
14267 </tr>
14268 </table>
14269
14270 !! end
14271
14272
14273 !! test
14274 Parsing crashing regression (fr:JavaScript)
14275 !! wikitext
14276 </body></x>
14277 !! html
14278 <p>&lt;/body&gt;&lt;/x&gt;
14279 </p>
14280 !! end
14281
14282 !! test
14283 Inline wiki vs wiki block nesting
14284 !! wikitext
14285 '''Bold paragraph
14286
14287 New wiki paragraph
14288 !! html
14289 <p><b>Bold paragraph</b>
14290 </p><p>New wiki paragraph
14291 </p>
14292 !! end
14293
14294 !! test
14295 Inline HTML vs wiki block nesting
14296 !! options
14297 disabled
14298 !! wikitext
14299 <b>Bold paragraph
14300
14301 New wiki paragraph
14302 !! html
14303 <p><b>Bold paragraph</b>
14304 </p><p>New wiki paragraph
14305 </p>
14306 !! end
14307
14308 # Original result was this:
14309 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
14310 # </p>
14311 # While that might be marginally more intuitive, maybe, the six-apostrophe
14312 # construct is clearly pathological and the result stated here (which is what
14313 # the parser actually does) is about as reasonable as anything.
14314 !!test
14315 Mixing markup for italics and bold
14316 !! options
14317 !! wikitext
14318 '''bold''''''bold''bolditalics'''''
14319 !! html
14320 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
14321 </p>
14322 !! end
14323
14324
14325 !! article
14326 Xyzzyx
14327 !! text
14328 Article for special page transclusion test
14329 !! endarticle
14330
14331 !! test
14332 Special page transclusion
14333 !! options
14334 !! wikitext
14335 {{Special:Prefixindex/Xyzzyx}}
14336 !! html
14337 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14338
14339 !! end
14340
14341 !! test
14342 Special page transclusion twice (bug 5021)
14343 !! options
14344 !! wikitext
14345 {{Special:Prefixindex/Xyzzyx}}
14346 {{Special:Prefixindex/Xyzzyx}}
14347 !! html
14348 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14349 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14350
14351 !! end
14352
14353 !! test
14354 Transclusion of default MediaWiki message
14355 !! wikitext
14356 {{MediaWiki:Mainpage}}
14357 !! html
14358 <p>Main Page
14359 </p>
14360 !! end
14361
14362 !! test
14363 Transclusion of nonexistent MediaWiki message
14364 !! wikitext
14365 {{MediaWiki:Mainpagexxx}}
14366 !! html
14367 <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>
14368 </p>
14369 !! end
14370
14371 !! test
14372 Transclusion of MediaWiki message with underscore
14373 !! wikitext
14374 {{MediaWiki:history_short}}
14375 !! html
14376 <p>History
14377 </p>
14378 !! end
14379
14380 !! test
14381 Transclusion of MediaWiki message with space
14382 !! wikitext
14383 {{MediaWiki:history short}}
14384 !! html
14385 <p>History
14386 </p>
14387 !! end
14388
14389 !! test
14390 Invalid header with following text
14391 !! wikitext
14392 = x = y
14393 !! html
14394 <p>= x = y
14395 </p>
14396 !! end
14397
14398
14399 !! test
14400 Section extraction test (section 0)
14401 !! options
14402 section=0
14403 !! wikitext
14404 start
14405 ==a==
14406 ===aa===
14407 ====aaa====
14408 ==b==
14409 ===ba===
14410 ===bb===
14411 ====bba====
14412 ===bc===
14413 ==c==
14414 ===ca===
14415 !! html
14416 start
14417 !! end
14418
14419 !! test
14420 Section extraction test (section 1)
14421 !! options
14422 section=1
14423 !! wikitext
14424 start
14425 ==a==
14426 ===aa===
14427 ====aaa====
14428 ==b==
14429 ===ba===
14430 ===bb===
14431 ====bba====
14432 ===bc===
14433 ==c==
14434 ===ca===
14435 !! html
14436 ==a==
14437 ===aa===
14438 ====aaa====
14439 !! end
14440
14441 !! test
14442 Section extraction test (section 2)
14443 !! options
14444 section=2
14445 !! wikitext
14446 start
14447 ==a==
14448 ===aa===
14449 ====aaa====
14450 ==b==
14451 ===ba===
14452 ===bb===
14453 ====bba====
14454 ===bc===
14455 ==c==
14456 ===ca===
14457 !! html
14458 ===aa===
14459 ====aaa====
14460 !! end
14461
14462 !! test
14463 Section extraction test (section 3)
14464 !! options
14465 section=3
14466 !! wikitext
14467 start
14468 ==a==
14469 ===aa===
14470 ====aaa====
14471 ==b==
14472 ===ba===
14473 ===bb===
14474 ====bba====
14475 ===bc===
14476 ==c==
14477 ===ca===
14478 !! html
14479 ====aaa====
14480 !! end
14481
14482 !! test
14483 Section extraction test (section 4)
14484 !! options
14485 section=4
14486 !! wikitext
14487 start
14488 ==a==
14489 ===aa===
14490 ====aaa====
14491 ==b==
14492 ===ba===
14493 ===bb===
14494 ====bba====
14495 ===bc===
14496 ==c==
14497 ===ca===
14498 !! html
14499 ==b==
14500 ===ba===
14501 ===bb===
14502 ====bba====
14503 ===bc===
14504 !! end
14505
14506 !! test
14507 Section extraction test (section 5)
14508 !! options
14509 section=5
14510 !! wikitext
14511 start
14512 ==a==
14513 ===aa===
14514 ====aaa====
14515 ==b==
14516 ===ba===
14517 ===bb===
14518 ====bba====
14519 ===bc===
14520 ==c==
14521 ===ca===
14522 !! html
14523 ===ba===
14524 !! end
14525
14526 !! test
14527 Section extraction test (section 6)
14528 !! options
14529 section=6
14530 !! wikitext
14531 start
14532 ==a==
14533 ===aa===
14534 ====aaa====
14535 ==b==
14536 ===ba===
14537 ===bb===
14538 ====bba====
14539 ===bc===
14540 ==c==
14541 ===ca===
14542 !! html
14543 ===bb===
14544 ====bba====
14545 !! end
14546
14547 !! test
14548 Section extraction test (section 7)
14549 !! options
14550 section=7
14551 !! wikitext
14552 start
14553 ==a==
14554 ===aa===
14555 ====aaa====
14556 ==b==
14557 ===ba===
14558 ===bb===
14559 ====bba====
14560 ===bc===
14561 ==c==
14562 ===ca===
14563 !! html
14564 ====bba====
14565 !! end
14566
14567 !! test
14568 Section extraction test (section 8)
14569 !! options
14570 section=8
14571 !! wikitext
14572 start
14573 ==a==
14574 ===aa===
14575 ====aaa====
14576 ==b==
14577 ===ba===
14578 ===bb===
14579 ====bba====
14580 ===bc===
14581 ==c==
14582 ===ca===
14583 !! html
14584 ===bc===
14585 !! end
14586
14587 !! test
14588 Section extraction test (section 9)
14589 !! options
14590 section=9
14591 !! wikitext
14592 start
14593 ==a==
14594 ===aa===
14595 ====aaa====
14596 ==b==
14597 ===ba===
14598 ===bb===
14599 ====bba====
14600 ===bc===
14601 ==c==
14602 ===ca===
14603 !! html
14604 ==c==
14605 ===ca===
14606 !! end
14607
14608 !! test
14609 Section extraction test (section 10)
14610 !! options
14611 section=10
14612 !! wikitext
14613 start
14614 ==a==
14615 ===aa===
14616 ====aaa====
14617 ==b==
14618 ===ba===
14619 ===bb===
14620 ====bba====
14621 ===bc===
14622 ==c==
14623 ===ca===
14624 !! html
14625 ===ca===
14626 !! end
14627
14628 !! test
14629 Section extraction test (nonexistent section 11)
14630 !! options
14631 section=11
14632 !! wikitext
14633 start
14634 ==a==
14635 ===aa===
14636 ====aaa====
14637 ==b==
14638 ===ba===
14639 ===bb===
14640 ====bba====
14641 ===bc===
14642 ==c==
14643 ===ca===
14644 !! html
14645 !! end
14646
14647 !! test
14648 Section extraction test with bogus heading (section 1)
14649 !! options
14650 section=1
14651 !! wikitext
14652 ==a==
14653 ==bogus== not a legal section
14654 ==b==
14655 !! html
14656 ==a==
14657 ==bogus== not a legal section
14658 !! end
14659
14660 !! test
14661 Section extraction test with bogus heading (section 2)
14662 !! options
14663 section=2
14664 !! wikitext
14665 ==a==
14666 ==bogus== not a legal section
14667 ==b==
14668 !! html
14669 ==b==
14670 !! end
14671
14672 !! test
14673 Section extraction test with comment after heading (section 1)
14674 !! options
14675 section=1
14676 !! wikitext
14677 ==a==
14678 ==b== <!-- -->
14679 ==c==
14680 !! html
14681 ==a==
14682 !! end
14683
14684 !! test
14685 Section extraction test with comment after heading (section 2)
14686 !! options
14687 section=2
14688 !! wikitext
14689 ==a==
14690 ==b== <!-- -->
14691 ==c==
14692 !! html
14693 ==b== <!-- -->
14694 !! end
14695
14696 !! test
14697 Section extraction test with bogus <nowiki> heading (section 1)
14698 !! options
14699 section=1
14700 !! wikitext
14701 ==a==
14702 ==bogus== <nowiki>not a legal section</nowiki>
14703 ==b==
14704 !! html
14705 ==a==
14706 ==bogus== <nowiki>not a legal section</nowiki>
14707 !! end
14708
14709 !! test
14710 Section extraction test with bogus <nowiki> heading (section 2)
14711 !! options
14712 section=2
14713 !! wikitext
14714 ==a==
14715 ==bogus== <nowiki>not a legal section</nowiki>
14716 ==b==
14717 !! html
14718 ==b==
14719 !! end
14720
14721
14722 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
14723 # instead of respecting commented sections
14724 !! test
14725 Section extraction prefixed by comment (section 1)
14726 !! options
14727 section=1
14728 !! wikitext
14729 <!-- -->==sec1==
14730 ==sec2==
14731 !! html
14732 ==sec2==
14733 !!end
14734
14735 !! test
14736 Section extraction prefixed by comment (section 2)
14737 !! options
14738 section=2
14739 !! wikitext
14740 <!-- -->==sec1==
14741 ==sec2==
14742 !! html
14743
14744 !!end
14745
14746
14747 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
14748 # instead of respecting HTML-style headings
14749 !! test
14750 Section extraction, mixed wiki and html (section 1)
14751 !! options
14752 section=1
14753 !! wikitext
14754 <h2>unmarked</h2>
14755 unmarked
14756 ==1==
14757 one
14758 ==2==
14759 two
14760 !! html
14761 ==1==
14762 one
14763 !! end
14764
14765 !! test
14766 Section extraction, mixed wiki and html (section 2)
14767 !! options
14768 section=2
14769 !! wikitext
14770 <h2>unmarked</h2>
14771 unmarked
14772 ==1==
14773 one
14774 ==2==
14775 two
14776 !! html
14777 ==2==
14778 two
14779 !! end
14780
14781
14782 # Formerly testing for bug 3342
14783 !! test
14784 Section extraction, heading surrounded by <noinclude>
14785 !! options
14786 section=1
14787 !! wikitext
14788 <noinclude>==unmarked==</noinclude>
14789 ==marked==
14790 !! html
14791 ==marked==
14792 !!end
14793
14794 # Test behavior of bug 19910
14795 !! test
14796 Sectiion with all-equals
14797 !! options
14798 section=2
14799 !! wikitext
14800 ===
14801 The line above must have a trailing space
14802 === <!--
14803 --> <!-- -->
14804 But just in case it doesn't...
14805 !! html
14806 === <!--
14807 --> <!-- -->
14808 But just in case it doesn't...
14809 !! end
14810
14811 !! test
14812 Section replacement test (section 0)
14813 !! options
14814 replace=0,"xxx"
14815 !! wikitext
14816 start
14817 ==a==
14818 ===aa===
14819 ====aaa====
14820 ==b==
14821 ===ba===
14822 ===bb===
14823 ====bba====
14824 ===bc===
14825 ==c==
14826 ===ca===
14827 !! html
14828 xxx
14829
14830 ==a==
14831 ===aa===
14832 ====aaa====
14833 ==b==
14834 ===ba===
14835 ===bb===
14836 ====bba====
14837 ===bc===
14838 ==c==
14839 ===ca===
14840 !! end
14841
14842 !! test
14843 Section replacement test (section 1)
14844 !! options
14845 replace=1,"xxx"
14846 !! wikitext
14847 start
14848 ==a==
14849 ===aa===
14850 ====aaa====
14851 ==b==
14852 ===ba===
14853 ===bb===
14854 ====bba====
14855 ===bc===
14856 ==c==
14857 ===ca===
14858 !! html
14859 start
14860 xxx
14861
14862 ==b==
14863 ===ba===
14864 ===bb===
14865 ====bba====
14866 ===bc===
14867 ==c==
14868 ===ca===
14869 !! end
14870
14871 !! test
14872 Section replacement test (section 2)
14873 !! options
14874 replace=2,"xxx"
14875 !! wikitext
14876 start
14877 ==a==
14878 ===aa===
14879 ====aaa====
14880 ==b==
14881 ===ba===
14882 ===bb===
14883 ====bba====
14884 ===bc===
14885 ==c==
14886 ===ca===
14887 !! html
14888 start
14889 ==a==
14890 xxx
14891
14892 ==b==
14893 ===ba===
14894 ===bb===
14895 ====bba====
14896 ===bc===
14897 ==c==
14898 ===ca===
14899 !! end
14900
14901 !! test
14902 Section replacement test (section 3)
14903 !! options
14904 replace=3,"xxx"
14905 !! wikitext
14906 start
14907 ==a==
14908 ===aa===
14909 ====aaa====
14910 ==b==
14911 ===ba===
14912 ===bb===
14913 ====bba====
14914 ===bc===
14915 ==c==
14916 ===ca===
14917 !! html
14918 start
14919 ==a==
14920 ===aa===
14921 xxx
14922
14923 ==b==
14924 ===ba===
14925 ===bb===
14926 ====bba====
14927 ===bc===
14928 ==c==
14929 ===ca===
14930 !! end
14931
14932 !! test
14933 Section replacement test (section 4)
14934 !! options
14935 replace=4,"xxx"
14936 !! wikitext
14937 start
14938 ==a==
14939 ===aa===
14940 ====aaa====
14941 ==b==
14942 ===ba===
14943 ===bb===
14944 ====bba====
14945 ===bc===
14946 ==c==
14947 ===ca===
14948 !! html
14949 start
14950 ==a==
14951 ===aa===
14952 ====aaa====
14953 xxx
14954
14955 ==c==
14956 ===ca===
14957 !! end
14958
14959 !! test
14960 Section replacement test (section 5)
14961 !! options
14962 replace=5,"xxx"
14963 !! wikitext
14964 start
14965 ==a==
14966 ===aa===
14967 ====aaa====
14968 ==b==
14969 ===ba===
14970 ===bb===
14971 ====bba====
14972 ===bc===
14973 ==c==
14974 ===ca===
14975 !! html
14976 start
14977 ==a==
14978 ===aa===
14979 ====aaa====
14980 ==b==
14981 xxx
14982
14983 ===bb===
14984 ====bba====
14985 ===bc===
14986 ==c==
14987 ===ca===
14988 !! end
14989
14990 !! test
14991 Section replacement test (section 6)
14992 !! options
14993 replace=6,"xxx"
14994 !! wikitext
14995 start
14996 ==a==
14997 ===aa===
14998 ====aaa====
14999 ==b==
15000 ===ba===
15001 ===bb===
15002 ====bba====
15003 ===bc===
15004 ==c==
15005 ===ca===
15006 !! html
15007 start
15008 ==a==
15009 ===aa===
15010 ====aaa====
15011 ==b==
15012 ===ba===
15013 xxx
15014
15015 ===bc===
15016 ==c==
15017 ===ca===
15018 !! end
15019
15020 !! test
15021 Section replacement test (section 7)
15022 !! options
15023 replace=7,"xxx"
15024 !! wikitext
15025 start
15026 ==a==
15027 ===aa===
15028 ====aaa====
15029 ==b==
15030 ===ba===
15031 ===bb===
15032 ====bba====
15033 ===bc===
15034 ==c==
15035 ===ca===
15036 !! html
15037 start
15038 ==a==
15039 ===aa===
15040 ====aaa====
15041 ==b==
15042 ===ba===
15043 ===bb===
15044 xxx
15045
15046 ===bc===
15047 ==c==
15048 ===ca===
15049 !! end
15050
15051 !! test
15052 Section replacement test (section 8)
15053 !! options
15054 replace=8,"xxx"
15055 !! wikitext
15056 start
15057 ==a==
15058 ===aa===
15059 ====aaa====
15060 ==b==
15061 ===ba===
15062 ===bb===
15063 ====bba====
15064 ===bc===
15065 ==c==
15066 ===ca===
15067 !! html
15068 start
15069 ==a==
15070 ===aa===
15071 ====aaa====
15072 ==b==
15073 ===ba===
15074 ===bb===
15075 ====bba====
15076 xxx
15077
15078 ==c==
15079 ===ca===
15080 !!end
15081
15082 !! test
15083 Section replacement test (section 9)
15084 !! options
15085 replace=9,"xxx"
15086 !! wikitext
15087 start
15088 ==a==
15089 ===aa===
15090 ====aaa====
15091 ==b==
15092 ===ba===
15093 ===bb===
15094 ====bba====
15095 ===bc===
15096 ==c==
15097 ===ca===
15098 !! html
15099 start
15100 ==a==
15101 ===aa===
15102 ====aaa====
15103 ==b==
15104 ===ba===
15105 ===bb===
15106 ====bba====
15107 ===bc===
15108 xxx
15109 !! end
15110
15111 !! test
15112 Section replacement test (section 10)
15113 !! options
15114 replace=10,"xxx"
15115 !! wikitext
15116 start
15117 ==a==
15118 ===aa===
15119 ====aaa====
15120 ==b==
15121 ===ba===
15122 ===bb===
15123 ====bba====
15124 ===bc===
15125 ==c==
15126 ===ca===
15127 !! html
15128 start
15129 ==a==
15130 ===aa===
15131 ====aaa====
15132 ==b==
15133 ===ba===
15134 ===bb===
15135 ====bba====
15136 ===bc===
15137 ==c==
15138 xxx
15139 !! end
15140
15141 !! test
15142 Section replacement test with initial whitespace (bug 13728)
15143 !! options
15144 replace=2,"xxx"
15145 !! wikitext
15146 Preformatted initial line
15147 ==a==
15148 ===a===
15149 !! html
15150 Preformatted initial line
15151 ==a==
15152 xxx
15153 !! end
15154
15155
15156 !! test
15157 Section extraction, heading followed by pre with 20 spaces (bug 6398)
15158 !! options
15159 section=1
15160 !! wikitext
15161 ==a==
15162 a
15163 !! html
15164 ==a==
15165 a
15166 !! end
15167
15168 !! test
15169 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
15170 !! options
15171 section=1
15172 !! wikitext
15173 ==a==
15174 a
15175 !! html
15176 ==a==
15177 a
15178 !! end
15179
15180
15181 !! test
15182 Section extraction, <pre> around bogus header (bug 10309)
15183 !! options
15184 noxml section=2
15185 !! wikitext
15186 == Section One ==
15187 <pre>
15188 =======
15189 </pre>
15190
15191 == Section Two ==
15192 stuff
15193 !! html
15194 == Section Two ==
15195 stuff
15196 !! end
15197
15198 !! test
15199 Section replacement, <pre> around bogus header (bug 10309)
15200 !! options
15201 noxml replace=2,"xxx"
15202 !! wikitext
15203 == Section One ==
15204 <pre>
15205 =======
15206 </pre>
15207
15208 == Section Two ==
15209 stuff
15210 !! html
15211 == Section One ==
15212 <pre>
15213 =======
15214 </pre>
15215
15216 xxx
15217 !! end
15218
15219
15220
15221 !! test
15222 Handling of &#x0A; in URLs
15223 !! wikitext
15224 ** irc://&#x0A;a
15225 !! html/php
15226 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15227
15228 !! html/parsoid
15229 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
15230 a">irc://
15231 a</a></li></ul></li></ul>
15232 !! end
15233
15234 !! test
15235 Handling of %0A in URLs
15236 !! wikitext
15237 ** irc://%0Aa
15238 !! html/php
15239 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15240
15241 !! html/parsoid
15242 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15243 !! end
15244
15245
15246 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
15247 !! test
15248 5 quotes, code coverage +1 line
15249 !! options
15250 parsoid=wt2html
15251 !! wikitext
15252 '''''
15253 !! html/php
15254 !! html/parsoid
15255 <p><b><i></i></b></p>
15256 !! end
15257
15258 # same html as previous, but wikitext adjusted to match parsoid html2wt
15259 # note that wt2html and html2html will put the <i> before the <b>
15260 !! test
15261 5 quotes, code coverage +1 line w/ nowiki (1)
15262 !! options
15263 parsoid=wt2wt,html2wt
15264 !! wikitext
15265 '''''<nowiki/>'''''
15266 !! html/php
15267 <p><i></i>
15268 </p>
15269 !! html/parsoid
15270 <p><b><i></i></b></p>
15271 !! end
15272
15273 # same as previous, just swapping the <i> and <b>
15274 !! test
15275 5 quotes, code coverage +1 line w/ nowiki (2)
15276 !! wikitext
15277 '''''<nowiki/>'''''
15278 !! html/php
15279 <p><i></i>
15280 </p>
15281 !! html/parsoid
15282 <p><i><b></b></i></p>
15283 !! end
15284
15285 !! test
15286 Special:Search page linking.
15287 !! wikitext
15288 {{Special:search}}
15289 !! html
15290 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
15291 </p>
15292 !! end
15293
15294 !! test
15295 Say the magic word
15296 !! options
15297 title=[[Parser test]]
15298 !! wikitext
15299 * {{PAGENAME}}
15300 * {{PAGENAMEE}}
15301 * {{FULLPAGENAME}}
15302 * {{FULLPAGENAMEE}}
15303 * {{BASEPAGENAME}}
15304 * {{BASEPAGENAMEE}}
15305 * {{SUBPAGENAME}}
15306 * {{SUBPAGENAMEE}}
15307 * {{ROOTPAGENAME}}
15308 * {{ROOTPAGENAMEE}}
15309 * {{TALKPAGENAME}}
15310 * {{TALKPAGENAMEE}}
15311 * {{SUBJECTPAGENAME}}
15312 * {{SUBJECTPAGENAMEE}}
15313 * {{NAMESPACEE}}
15314 * {{NAMESPACE}}
15315 * {{NAMESPACENUMBER}}
15316 * {{TALKSPACE}}
15317 * {{TALKSPACEE}}
15318 * {{SUBJECTSPACE}}
15319 * {{SUBJECTSPACEE}}
15320 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
15321 !! html
15322 <ul><li> Parser test</li>
15323 <li> Parser_test</li>
15324 <li> Parser test</li>
15325 <li> Parser_test</li>
15326 <li> Parser test</li>
15327 <li> Parser_test</li>
15328 <li> Parser test</li>
15329 <li> Parser_test</li>
15330 <li> Parser test</li>
15331 <li> Parser_test</li>
15332 <li> Talk:Parser test</li>
15333 <li> Talk:Parser_test</li>
15334 <li> Parser test</li>
15335 <li> Parser_test</li>
15336 <li> </li>
15337 <li> </li>
15338 <li> 0</li>
15339 <li> Talk</li>
15340 <li> Talk</li>
15341 <li> </li>
15342 <li> </li>
15343 <li> <a href="/index.php?title=Template:Dynamic&amp;action=edit&amp;redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a></li></ul>
15344
15345 !! end
15346 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
15347
15348 !! test
15349 Gallery
15350 !! wikitext
15351 <gallery>
15352 image1.png |
15353 image2.gif|||||
15354
15355 image3|
15356 image4 |300px| centre
15357 image5.svg| http://///////
15358 [[x|xx]]]]
15359 * image6
15360 </gallery>
15361 !! html
15362 <ul class="gallery mw-gallery-traditional">
15363 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15364 <div class="thumb" style="height: 150px;">Image1.png</div>
15365 <div class="gallerytext">
15366 </div>
15367 </div></li>
15368 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15369 <div class="thumb" style="height: 150px;">Image2.gif</div>
15370 <div class="gallerytext">
15371 <p>||||
15372 </p>
15373 </div>
15374 </div></li>
15375 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15376 <div class="thumb" style="height: 150px;">Image3</div>
15377 <div class="gallerytext">
15378 </div>
15379 </div></li>
15380 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15381 <div class="thumb" style="height: 150px;">Image4</div>
15382 <div class="gallerytext">
15383 <p>300px| centre
15384 </p>
15385 </div>
15386 </div></li>
15387 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15388 <div class="thumb" style="height: 150px;">Image5.svg</div>
15389 <div class="gallerytext">
15390 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
15391 </p>
15392 </div>
15393 </div></li>
15394 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15395 <div class="thumb" style="height: 150px;">* image6</div>
15396 <div class="gallerytext">
15397 </div>
15398 </div></li>
15399 </ul>
15400
15401 !! end
15402
15403 !! test
15404 Gallery (with options)
15405 !! wikitext
15406 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
15407 File:Nonexistant.jpg|caption
15408 File:Nonexistant.jpg
15409 image:foobar.jpg|some '''caption''' [[Main Page]]
15410 image:foobar.jpg
15411 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
15412 </gallery>
15413 !! html
15414 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
15415 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
15416 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15417 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15418 <div class="gallerytext">
15419 <p>caption
15420 </p>
15421 </div>
15422 </div></li>
15423 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15424 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15425 <div class="gallerytext">
15426 </div>
15427 </div></li>
15428 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15429 <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>
15430 <div class="gallerytext">
15431 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15432 </p>
15433 </div>
15434 </div></li>
15435 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15436 <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>
15437 <div class="gallerytext">
15438 </div>
15439 </div></li>
15440 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15441 <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>
15442 <div class="gallerytext">
15443 <p>Blabla|blabla.
15444 </p>
15445 </div>
15446 </div></li>
15447 </ul>
15448
15449 !! end
15450
15451 !! test
15452 Gallery with link that has fragment
15453 !! wikitext
15454 <gallery>
15455 image:foobar.jpg|link=Main_Page
15456 image:foobar.jpg|link=Main_Page#section
15457 image:foobar.jpg|link=Main Page#section|caption
15458 </gallery>
15459 !! html
15460 <ul class="gallery mw-gallery-traditional">
15461 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15462 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
15463 <div class="gallerytext">
15464 </div>
15465 </div></li>
15466 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15467 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
15468 <div class="gallerytext">
15469 </div>
15470 </div></li>
15471 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15472 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
15473 <div class="gallerytext">
15474 <p>caption
15475 </p>
15476 </div>
15477 </div></li>
15478 </ul>
15479
15480 !! end
15481
15482 !! test
15483 Gallery with wikitext inside caption
15484 !! wikitext
15485 <gallery>
15486 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
15487 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
15488 </gallery>
15489 !! html
15490 <ul class="gallery mw-gallery-traditional">
15491 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15492 <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>
15493 <div class="gallerytext">
15494 <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>
15495 </p>
15496 </div>
15497 </div></li>
15498 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15499 <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>
15500 <div class="gallerytext">
15501 <p>This is a test template
15502 </p>
15503 </div>
15504 </div></li>
15505 </ul>
15506
15507 !! end
15508
15509 !! test
15510 gallery (with showfilename option)
15511 !! wikitext
15512 <gallery showfilename>
15513 File:Nonexistant.jpg|caption
15514 File:Nonexistant.jpg
15515 image:foobar.jpg|some '''caption''' [[Main Page]]
15516 File:Foobar.jpg
15517 </gallery>
15518 !! html
15519 <ul class="gallery mw-gallery-traditional">
15520 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15521 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15522 <div class="gallerytext">
15523 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15524 caption
15525 </p>
15526 </div>
15527 </div></li>
15528 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15529 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15530 <div class="gallerytext">
15531 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15532 </p>
15533 </div>
15534 </div></li>
15535 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15536 <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>
15537 <div class="gallerytext">
15538 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15539 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15540 </p>
15541 </div>
15542 </div></li>
15543 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15544 <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>
15545 <div class="gallerytext">
15546 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15547 </p>
15548 </div>
15549 </div></li>
15550 </ul>
15551
15552 !! end
15553
15554 !! test
15555 Gallery (with namespace-less filenames)
15556 !! wikitext
15557 <gallery>
15558 File:Nonexistant.jpg
15559 Nonexistant.jpg
15560 image:foobar.jpg
15561 foobar.jpg
15562 </gallery>
15563 !! html
15564 <ul class="gallery mw-gallery-traditional">
15565 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15566 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15567 <div class="gallerytext">
15568 </div>
15569 </div></li>
15570 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15571 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15572 <div class="gallerytext">
15573 </div>
15574 </div></li>
15575 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15576 <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>
15577 <div class="gallerytext">
15578 </div>
15579 </div></li>
15580 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15581 <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>
15582 <div class="gallerytext">
15583 </div>
15584 </div></li>
15585 </ul>
15586
15587 !! end
15588
15589 !! test
15590 HTML Hex character encoding (spells the word "JavaScript")
15591 !! options
15592 parsoid=wt2html,wt2wt,html2html
15593 !! wikitext
15594 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
15595 !! html/php
15596 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
15597 </p>
15598 !! html/parsoid
15599 <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>
15600 !! end
15601
15602 !! test
15603 HTML Hex character encoding bogus encoding (bug 26437 regression check)
15604 !! wikitext
15605 &#xsee;&#XSEE;
15606 !! html/php
15607 <p>&amp;#xsee;&amp;#XSEE;
15608 </p>
15609 !! html/parsoid
15610 <p>&amp;#xsee;&amp;#XSEE;</p>
15611 !! end
15612
15613 !! test
15614 HTML Hex character encoding mixed case
15615 !! options
15616 parsoid=wt2html,wt2wt,html2html
15617 !! wikitext
15618 &#xEE;&#Xee;
15619 !! html/php
15620 <p>&#xee;&#xee;
15621 </p>
15622 !! html/parsoid
15623 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
15624 !! end
15625
15626 !! test
15627 __FORCETOC__ override
15628 !! wikitext
15629 __NEWSECTIONLINK__
15630 __FORCETOC__
15631 !! html
15632 <p><br />
15633 </p>
15634 !! end
15635
15636 !! test
15637 ISBN code coverage
15638 !! wikitext
15639 ISBN 978-0-1234-56&#x20;789
15640 !! html
15641 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
15642 </p>
15643 !! end
15644
15645 !! test
15646 ISBN followed by 5 spaces
15647 !! wikitext
15648 ISBN
15649 !! html
15650 <p>ISBN
15651 </p>
15652 !! end
15653
15654 !! test
15655 Double ISBN
15656 !! wikitext
15657 ISBN ISBN 1234567890
15658 !! html
15659 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15660 </p>
15661 !! end
15662
15663 !! test
15664 ISBN with an X
15665 !! wikitext
15666 ISBN 3-462-04561-X
15667 !! html
15668 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
15669 </p>
15670 !! end
15671
15672 !! test
15673 ISBN with empty prefix (parsoid test)
15674 !! wikitext
15675 ISBN 1234567890
15676 !! html/parsoid
15677 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
15678 !! end
15679
15680 !! test
15681 Bug 22905: <abbr> followed by ISBN followed by </a>
15682 !! wikitext
15683 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
15684 !! html
15685 <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>
15686 </p>
15687 !! end
15688
15689 !! test
15690 Double RFC
15691 !! wikitext
15692 RFC RFC 1234
15693 !! html
15694 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
15695 </p>
15696 !! end
15697
15698 !! test
15699 Double RFC with a wiki link
15700 !! wikitext
15701 RFC [[RFC 1234]]
15702 !! html
15703 <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>
15704 </p>
15705 !! end
15706
15707 !! test
15708 RFC code coverage
15709 !! wikitext
15710 RFC 983&#x20;987
15711 !! html
15712 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
15713 </p>
15714 !! end
15715
15716 !! test
15717 Centre-aligned image
15718 !! wikitext
15719 [[Image:foobar.jpg|centre]]
15720 !! html
15721 <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>
15722
15723 !!end
15724
15725 !! test
15726 None-aligned image
15727 !! wikitext
15728 [[Image:foobar.jpg|none]]
15729 !! html
15730 <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>
15731
15732 !!end
15733
15734 !! test
15735 Width + Height sized image (using px) (height is ignored)
15736 !! wikitext
15737 [[Image:foobar.jpg|640x480px]]
15738 !! html
15739 <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>
15740 </p>
15741 !!end
15742
15743 !! test
15744 Width-sized image (using px, no following whitespace)
15745 !! wikitext
15746 [[Image:foobar.jpg|640px]]
15747 !! html
15748 <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>
15749 </p>
15750 !!end
15751
15752 !! test
15753 Width-sized image (using px, with following whitespace - test regression from r39467)
15754 !! wikitext
15755 [[Image:foobar.jpg|640px ]]
15756 !! html
15757 <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>
15758 </p>
15759 !!end
15760
15761 !! test
15762 Width-sized image (using px, with preceding whitespace - test regression from r39467)
15763 !! wikitext
15764 [[Image:foobar.jpg| 640px]]
15765 !! html
15766 <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>
15767 </p>
15768 !!end
15769
15770 !! test
15771 Image with page parameter
15772 !! options
15773 djvu
15774 !! wikitext
15775 [[File:LoremIpsum.djvu|page=2]]
15776 !! html
15777 <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>
15778 </p>
15779 !! end
15780
15781 !! test
15782 Another italics / bold test
15783 !! wikitext
15784 ''' ''x'
15785 !! html
15786 <pre>'<i> </i>x'
15787 </pre>
15788 !!end
15789
15790 # Note the results may be incorrect, as parserTest output included this:
15791 # XML error: Mismatched tag at byte 6120:
15792 # ...<dd> </dt></dl> </dd...
15793 !! test
15794 dt/dd/dl test
15795 !! options
15796 disabled
15797 !! wikitext
15798 :;;;::
15799 !! html
15800 <dl>
15801 <dd><dl>
15802 <dt><dl>
15803 <dt><dl>
15804 <dt><dl>
15805 <dd><dl>
15806 <dd>
15807 </dd>
15808 </dl>
15809 </dd>
15810 </dl>
15811 </dt>
15812 </dl>
15813 </dt>
15814 </dl>
15815 </dt>
15816 </dl>
15817 </dd>
15818 </dl>
15819
15820 !!end
15821
15822
15823 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
15824 !! test
15825 Images with the "|" character in the comment
15826 !! wikitext
15827 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
15828 !! html/php
15829 <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>
15830
15831 !! html/parsoid
15832 <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>
15833 !! end
15834
15835 !! test
15836 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
15837 !! wikitext
15838 <html><script>alert(1);</script></html>
15839 !! html
15840 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
15841 </p>
15842 !! end
15843
15844 !! test
15845 HTML with raw HTML ($wgRawHtml==true)
15846 !! options
15847 wgRawHtml=1
15848 !! wikitext
15849 <html><script>alert(1);</script></html>
15850 !! html
15851 <p><script>alert(1);</script>
15852 </p>
15853 !! end
15854
15855 !! test
15856 Parents of subpages, one level up
15857 !! options
15858 subpage title=[[Subpage test/L1/L2/L3]]
15859 !! wikitext
15860 [[../|L2]]
15861 !! html
15862 <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>
15863 </p>
15864 !! end
15865
15866
15867 !! test
15868 Parents of subpages, one level up, not named
15869 !! options
15870 subpage title=[[Subpage test/L1/L2/L3]]
15871 !! wikitext
15872 [[../]]
15873 !! html
15874 <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>
15875 </p>
15876 !! end
15877
15878
15879
15880 !! test
15881 Parents of subpages, two levels up
15882 !! options
15883 subpage title=[[Subpage test/L1/L2/L3]]
15884 !! wikitext
15885 [[../../|L1]]2
15886
15887 [[../../|L1]]l
15888 !! html
15889 <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
15890 </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>
15891 </p>
15892 !! end
15893
15894 !! test
15895 Parents of subpages, two levels up, without trailing slash or name.
15896 !! options
15897 subpage title=[[Subpage test/L1/L2/L3]]
15898 !! wikitext
15899 [[../..]]
15900 !! html
15901 <p>[[../..]]
15902 </p>
15903 !! end
15904
15905 !! test
15906 Parents of subpages, two levels up, with lots of extra trailing slashes.
15907 !! options
15908 subpage title=[[Subpage test/L1/L2/L3]]
15909 !! wikitext
15910 [[../../////]]
15911 !! html
15912 <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>
15913 </p>
15914 !! end
15915
15916 !! article
15917 Subpage test/L1/L2/L3Sibling
15918 !! text
15919 Sibling article
15920 !! endarticle
15921
15922 !! test
15923 Transclusion of a sibling page (one level up)
15924 !! options
15925 subpage title=[[Subpage test/L1/L2/L3]]
15926 !! wikitext
15927 {{../L3Sibling}}
15928 !! html
15929 <p>Sibling article
15930 </p>
15931 !! end
15932
15933 !! test
15934 Transclusion of a child page
15935 !! options
15936 subpage title=[[Subpage test/L1/L2]]
15937 !! wikitext
15938 {{/L3Sibling}}
15939 !! html
15940 <p>Sibling article
15941 </p>
15942 !! end
15943
15944 !! test
15945 Non-transclusion because of too many up levels
15946 !! options
15947 subpage title=[[Subpage test/L1/L2/L3]]
15948 !! wikitext
15949 {{../../../../More than parent}}
15950 !! html
15951 <p>{{../../../../More than parent}}
15952 </p>
15953 !! end
15954
15955 !! test
15956 Definition list code coverage
15957 !! wikitext
15958 ; title : def
15959 ; title : def
15960 ;title: def
15961 !! html
15962 <dl><dt> title &#160;</dt>
15963 <dd> def</dd>
15964 <dt> title&#160;</dt>
15965 <dd> def</dd>
15966 <dt>title</dt>
15967 <dd> def</dd></dl>
15968
15969 !! end
15970
15971 !! test
15972 Don't fall for the self-closing div
15973 !! wikitext
15974 <div>hello world</div/>
15975 !! html
15976 <div>hello world</div>
15977
15978 !! end
15979
15980 !! test
15981 MSGNW magic word
15982 !! wikitext
15983 {{MSGNW:msg}}
15984 !! html
15985 <p>&#91;&#91;:Template:Msg&#93;&#93;
15986 </p>
15987 !! end
15988
15989 !! test
15990 RAW magic word
15991 !! wikitext
15992 {{RAW:QUERTY}}
15993 !! html
15994 <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>
15995 </p>
15996 !! end
15997
15998 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15999 !! test
16000 Always escape literal '>' in output, not just after '<'
16001 !! wikitext
16002 ><>
16003 !! html
16004 <p>&gt;&lt;&gt;
16005 </p>
16006 !! end
16007
16008 !! test
16009 Template caching
16010 !! wikitext
16011 {{Test}}
16012 {{Test}}
16013 !! html
16014 <p>This is a test template
16015 This is a test template
16016 </p>
16017 !! end
16018
16019
16020 !! article
16021 MediaWiki:Fake
16022 !! text
16023 ==header==
16024 !! endarticle
16025
16026 !! test
16027 Inclusion of !userCanEdit() content
16028 !! wikitext
16029 {{MediaWiki:Fake}}
16030 !! html
16031 <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>
16032
16033 !! end
16034
16035
16036 !! test
16037 Out-of-order TOC heading levels
16038 !! wikitext
16039 ==2==
16040 ======6======
16041 ===3===
16042 =1=
16043 =====5=====
16044 ==2==
16045 !! html
16046 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16047 <ul>
16048 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
16049 <ul>
16050 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
16051 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
16052 </ul>
16053 </li>
16054 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
16055 <ul>
16056 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
16057 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
16058 </ul>
16059 </li>
16060 </ul>
16061 </div>
16062
16063 <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>
16064 <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>
16065 <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>
16066 <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>
16067 <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>
16068 <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>
16069
16070 !! end
16071
16072
16073 !! test
16074 ISBN with a dummy number
16075 !! wikitext
16076 ISBN ---
16077 !! html
16078 <p>ISBN ---
16079 </p>
16080 !! end
16081
16082
16083 !! test
16084 ISBN with space-delimited number
16085 !! wikitext
16086 ISBN 92 9017 032 8
16087 !! html
16088 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
16089 </p>
16090 !! end
16091
16092
16093 !! test
16094 ISBN with multiple spaces, no number
16095 !! wikitext
16096 ISBN foo
16097 !! html
16098 <p>ISBN foo
16099 </p>
16100 !! end
16101
16102
16103 !! test
16104 ISBN length
16105 !! wikitext
16106 ISBN 123456789
16107
16108 ISBN 1234567890
16109
16110 ISBN 12345678901
16111 !! html
16112 <p>ISBN 123456789
16113 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16114 </p><p>ISBN 12345678901
16115 </p>
16116 !! end
16117
16118
16119 !! test
16120 ISBN with trailing year (bug 8110)
16121 !! wikitext
16122 ISBN 1-234-56789-0 - 2006
16123
16124 ISBN 1 234 56789 0 - 2006
16125 !! html
16126 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
16127 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
16128 </p>
16129 !! end
16130
16131
16132 !! test
16133 anchorencode
16134 !! wikitext
16135 {{anchorencode:foo bar©#%n}}
16136 !! html
16137 <p>foo_bar.C2.A9.23.25n
16138 </p>
16139 !! end
16140
16141 !! test
16142 anchorencode trims spaces
16143 !! wikitext
16144 {{anchorencode: __pretty__please__}}
16145 !! html
16146 <p>pretty_please
16147 </p>
16148 !! end
16149
16150 !! test
16151 anchorencode deals with links
16152 !! wikitext
16153 {{anchorencode: [[hello|world]] [[hi]]}}
16154 !! html
16155 <p>world_hi
16156 </p>
16157 !! end
16158
16159 !! test
16160 anchorencode deals with templates
16161 !! wikitext
16162 {{anchorencode: {{Foo}} }}
16163 !! html
16164 <p>FOO
16165 </p>
16166 !! end
16167
16168 !! test
16169 anchorencode encodes like the TOC generator: (bug 18431)
16170 !! wikitext
16171 === _ +:.3A%3A&&amp;]] ===
16172 {{anchorencode: _ +:.3A%3A&&amp;]] }}
16173 __NOEDITSECTION__
16174 !! html
16175 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
16176 <p>.2B:.3A.253A.26.26.5D.5D
16177 </p>
16178 !! end
16179
16180 !! test
16181 Bug 6200: blockquotes and paragraph formatting
16182 !! wikitext
16183 <blockquote>
16184 foo
16185 </blockquote>
16186
16187 bar
16188
16189 baz
16190 !! html
16191 <blockquote>
16192 <p>foo
16193 </p>
16194 </blockquote>
16195 <p>bar
16196 </p>
16197 <pre>baz
16198 </pre>
16199 !! end
16200
16201 !! test
16202 Bug 8293: Use of center tag ruins paragraph formatting
16203 !! wikitext
16204 <center>
16205 foo
16206 </center>
16207
16208 bar
16209
16210 baz
16211 !! html
16212 <center>
16213 <p>foo
16214 </p>
16215 </center>
16216 <p>bar
16217 </p>
16218 <pre>baz
16219 </pre>
16220 !! end
16221
16222 !!test
16223 Parsing of overlapping (improperly nested) inline html tags
16224 !! wikitext
16225 <span><s>x</span></s>
16226 !! html/php
16227 <p><span><s>x&lt;/span&gt;</s></span>
16228 </p>
16229 !! html/parsoid
16230 <p><span><s>x</s></span>
16231 </p>
16232 !!end
16233
16234 ###
16235 ### Language variants related tests
16236 ###
16237 !! test
16238 Self-link in language variants
16239 !! options
16240 title=[[Dunav]] language=sr
16241 !! wikitext
16242 Both [[Dunav]] and [[Дунав]] are names for this river.
16243 !! html
16244 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
16245 </p>
16246 !!end
16247
16248 !! article
16249 Дуна
16250 !! text
16251 content
16252 !! endarticle
16253
16254 !! test
16255 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
16256 !! options
16257 title=[[Duna]] language=sr
16258 !! wikitext
16259 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
16260 !! html
16261 <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.
16262 </p>
16263 !! end
16264
16265 !! test
16266 Link to a section of a variant of this title shouldn't be parsed as self-link
16267 !! options
16268 title=[[Duna]] language=sr
16269 !! wikitext
16270 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
16271 !! html
16272 <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.
16273 </p>
16274 !! end
16275
16276 !! test
16277 Link to pages in language variants
16278 !! options
16279 language=sr
16280 !! wikitext
16281 Main Page can be written as [[Маин Паге]]
16282 !! html
16283 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
16284 </p>
16285 !!end
16286
16287
16288 !! test
16289 Multiple links to pages in language variants
16290 !! options
16291 language=sr
16292 !! wikitext
16293 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
16294 !! html
16295 <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>.
16296 </p>
16297 !!end
16298
16299
16300 !! test
16301 Simple template in language variants
16302 !! options
16303 language=sr
16304 !! wikitext
16305 {{тест}}
16306 !! html
16307 <p>This is a test template
16308 </p>
16309 !! end
16310
16311
16312 !! test
16313 Template with explicit namespace in language variants
16314 !! options
16315 language=sr
16316 !! wikitext
16317 {{Template:тест}}
16318 !! html
16319 <p>This is a test template
16320 </p>
16321 !! end
16322
16323
16324 !! test
16325 Basic test for template parameter in language variants
16326 !! options
16327 language=sr
16328 !! wikitext
16329 {{парамтест|param=foo}}
16330 !! html
16331 <p>This is a test template with parameter foo
16332 </p>
16333 !! end
16334
16335
16336 !! test
16337 Simple category in language variants
16338 !! options
16339 language=sr cat
16340 !! wikitext
16341 [[Category:МедиаWики Усер'с Гуиде]]
16342 !! html
16343 <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>
16344 !! end
16345
16346
16347 !! article
16348 Category:分类
16349 !! text
16350 blah
16351 !! endarticle
16352
16353 !! article
16354 Category:分類
16355 !! text
16356 blah
16357 !! endarticle
16358
16359 !! test
16360 Don't convert blue categorylinks to another variant (bug 33210)
16361 !! options
16362 language=zh cat
16363 !! wikitext
16364 [[A]][[Category:分类]]
16365 !! html
16366 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
16367 !! end
16368
16369
16370 !! test
16371 Stripping -{}- tags (language variants)
16372 !! options
16373 language=sr
16374 !! wikitext
16375 Latin proverb: -{Ne nuntium necare}-
16376 !! html
16377 <p>Latin proverb: Ne nuntium necare
16378 </p>
16379 !! end
16380
16381
16382 !! test
16383 Prevent conversion with -{}- tags (language variants)
16384 !! options
16385 language=sr variant=sr-ec
16386 !! wikitext
16387 Latinski: -{Ne nuntium necare}-
16388 !! html
16389 <p>Латински: Ne nuntium necare
16390 </p>
16391 !! end
16392
16393
16394 !! test
16395 Prevent conversion of text with -{}- tags (language variants)
16396 !! options
16397 language=sr variant=sr-ec
16398 !! wikitext
16399 Latinski: -{Ne nuntium necare}-
16400 !! html
16401 <p>Латински: Ne nuntium necare
16402 </p>
16403 !! end
16404
16405
16406 !! test
16407 Prevent conversion of links with -{}- tags (language variants)
16408 !! options
16409 language=sr variant=sr-ec
16410 !! wikitext
16411 -{[[Main Page]]}-
16412 !! html
16413 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16414 </p>
16415 !! end
16416
16417
16418 !! test
16419 -{}- tags within headlines (within html for parserConvert())
16420 !! options
16421 language=sr variant=sr-ec
16422 !! wikitext
16423 == -{Naslov}- ==
16424 !! html
16425 <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>
16426
16427 !! end
16428
16429
16430 !! test
16431 Explicit definition of language variant alternatives
16432 !! options
16433 language=zh variant=zh-tw
16434 !! wikitext
16435 -{zh:China;zh-tw:Taiwan}-, not China
16436 !! html
16437 <p>Taiwan, not China
16438 </p>
16439 !! end
16440
16441
16442 !! test
16443 Conversion around HTML tags
16444 !! options
16445 language=sr variant=sr-ec
16446 !! wikitext
16447 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
16448 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
16449 !! html
16450 <p>
16451 <span title="ЛаCтин">ски</span>
16452 </p>
16453 !! end
16454
16455
16456 !! test
16457 Explicit session-wise language variant mapping (A flag and - flag)
16458 !! options
16459 language=zh variant=zh-tw
16460 !! wikitext
16461 Taiwan is not China.
16462 But -{A|zh:China;zh-tw:Taiwan}- is China,
16463 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
16464 and -{China}- is China.
16465 !! html
16466 <p>Taiwan is not China.
16467 But Taiwan is Taiwan,
16468 (This should be stripped!)
16469 and China is China.
16470 </p>
16471 !! end
16472
16473 !! test
16474 Explicit session-wise language variant mapping (H flag for hide)
16475 !! options
16476 language=zh variant=zh-tw
16477 !! wikitext
16478 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
16479 Taiwan is China.
16480 !! html
16481 <p>(This should be stripped!)
16482 Taiwan is Taiwan.
16483 </p>
16484 !! end
16485
16486 !! test
16487 Adding explicit conversion rule for title (T flag)
16488 !! options
16489 language=zh variant=zh-tw showtitle
16490 !! wikitext
16491 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16492 !! html
16493 Taiwan
16494 <p>Should be stripped!
16495 </p>
16496 !! end
16497
16498 !! test
16499 Testing that changing the language variant here in the tests actually works
16500 !! options
16501 language=zh variant=zh showtitle
16502 !! wikitext
16503 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16504 !! html
16505 China
16506 <p>Should be stripped!
16507 </p>
16508 !! end
16509
16510 !! test
16511 Recursive conversion of alt and title attrs shouldn't clear converter state
16512 !! options
16513 language=zh variant=zh-cn showtitle
16514 !! wikitext
16515 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
16516 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
16517 !! html
16518 China
16519 <p>
16520 Should be stripped<span title="Exclamation">!</span>
16521 </p>
16522 !! end
16523
16524 !! test
16525 Bug 24072: more test on conversion rule for title
16526 !! options
16527 language=zh variant=zh-tw showtitle
16528 !! wikitext
16529 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16530 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
16531 !! html
16532 Taiwan
16533 <p>This should be stripped!
16534 This won't take interferes with the title rule.
16535 </p>
16536 !! end
16537
16538 !! test
16539 Partly disable title conversion if variant == main language code
16540 !! options
16541 language=zh variant=zh title=[[ZH]] showtitle
16542 !! wikitext
16543 -{T|zh-cn:CN;zh-tw:TW}-
16544 !! html
16545 ZH
16546 <p>
16547 </p>
16548 !! end
16549
16550 !! test
16551 Partly disable title conversion if variant == main language code, more
16552 !! options
16553 language=zh variant=zh title=[[ZH]] showtitle
16554 !! wikitext
16555 -{T|TW}-
16556 !! html
16557 ZH
16558 <p>
16559 </p>
16560 !! end
16561
16562 !! test
16563 Raw output of variant escape tags (R flag)
16564 !! options
16565 language=zh variant=zh-tw
16566 !! wikitext
16567 Raw: -{R|zh:China;zh-tw:Taiwan}-
16568 !! html
16569 <p>Raw: zh:China;zh-tw:Taiwan
16570 </p>
16571 !! end
16572
16573 !! test
16574 Nested using of manual convert syntax
16575 !! options
16576 language=zh variant=zh-hk
16577 !! wikitext
16578 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
16579 !! html
16580 <p>Nested: Hello Hong Kong!
16581 </p>
16582 !! end
16583
16584 !! test
16585 Proper conversion of text in external links
16586 !! options
16587 language=sr variant=sr-ec
16588 !! wikitext
16589 http://www.google.com
16590 gopher://www.google.com
16591 [http://www.google.com http://www.google.com]
16592 [gopher://www.google.com gopher://www.google.com]
16593 [https://www.google.com irc://www.google.com]
16594 [ftp://www.google.com www.google.com/ftp://dir]
16595 [//www.google.com www.google.com]
16596 !! html
16597 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16598 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16599 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16600 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16601 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
16602 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
16603 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
16604 </p>
16605 !! end
16606
16607 !! test
16608 Do not convert roman numbers to language variants
16609 !! options
16610 language=sr variant=sr-ec
16611 !! wikitext
16612 Fridrih IV je car.
16613 !! html
16614 <p>Фридрих IV је цар.
16615 </p>
16616 !! end
16617
16618 !! test
16619 Unclosed language converter markup "-{"
16620 !! options
16621 language=sr
16622 !! wikitext
16623 -{T|hello
16624 !! html
16625 <p>-{T|hello
16626 </p>
16627 !! end
16628
16629 !! test
16630 Don't convert raw rule "-{R|=&gt;}-" to "=>"
16631 !! options
16632 language=sr
16633 !! wikitext
16634 -{R|=&gt;}-
16635 !! html
16636 <p>=&gt;
16637 </p>
16638 !!end
16639
16640 !! test
16641 Don't break link parsing if language converter markup is in the caption.
16642 !! options
16643 language=sr variant=sr-ec
16644 !! wikitext
16645 [[Main Page|-{R|main page}-]]
16646 !! html
16647 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
16648 </p>
16649 !! end
16650
16651 # This test is currently broken in the PHP parser (bug 52661)
16652 !! test
16653 Don't break image parsing if language converter markup is in the caption.
16654 !! options
16655 language=sr
16656 disabled
16657 !! wikitext
16658 [[File:Foobar.jpg|-{R|caption}-]]
16659 !! html
16660 <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>
16661 </p>
16662 !! end
16663
16664 # This test is currently broken in the PHP parser (bug 52661)
16665 !! test
16666 Don't break list handling if language converter markup is in the item.
16667 !! options
16668 language=zh variant=zh-cn
16669 disabled
16670 !! wikitext
16671 ;-{zh-cn:AAA;zh-tw:BBB}-
16672 !! html
16673 <dl><dt>AAA
16674 </dt></dl>
16675
16676 !! end
16677
16678 # This test is currently broken in the PHP parser (bug 52661)
16679 !! test
16680 Don't break table handling if language converter markup is in the cell.
16681 !! options
16682 language=sr variant=sr-ec
16683 disabled
16684 !! wikitext
16685 {|
16686 |-
16687 | -{R|B}-
16688 |}
16689 !! html
16690 <table>
16691
16692 <tr>
16693 <td> B
16694 </td></tr></table>
16695
16696 !! end
16697
16698 !! test
16699 Bug 529: Uncovered bullet
16700 !! wikitext
16701 * Foo {{bullet}}
16702 !! html
16703 <ul><li> Foo </li>
16704 <li> Bar</li></ul>
16705
16706 !! end
16707
16708 # Plain MediaWiki does not remove empty lists, but tidy actually does.
16709 # Templates in Wikipedia rely on this behavior, as tidy has always been
16710 # enabled there. These tests are normally run *without* tidy, so specify the
16711 # full output here.
16712 # To test realistic parsing behavior, apply a tidy-like transformation to both
16713 # the expected output and your parser's output.
16714 !! test
16715 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
16716 !! wikitext
16717 ******* Foo {{bullet}}
16718 !! html
16719 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo </li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li>
16720 <li> Bar</li></ul>
16721
16722 !! end
16723
16724 !! test
16725 Bug 529: Uncovered table already at line-start
16726 !! wikitext
16727 x
16728
16729 {{table}}
16730 y
16731 !! html
16732 <p>x
16733 </p>
16734 <table>
16735 <tr>
16736 <td> 1 </td>
16737 <td> 2
16738 </td></tr>
16739 <tr>
16740 <td> 3 </td>
16741 <td> 4
16742 </td></tr></table>
16743 <p>y
16744 </p>
16745 !! end
16746
16747 !! test
16748 Bug 529: Uncovered bullet in parser function result
16749 !! wikitext
16750 * Foo {{lc:{{bullet}} }}
16751 !! html
16752 <ul><li> Foo </li>
16753 <li> bar</li></ul>
16754
16755 !! end
16756
16757 !! test
16758 Bug 5678: Double-parsed template argument
16759 !! wikitext
16760 {{lc:{{{1}}}|hello}}
16761 !! html
16762 <p>{{{1}}}
16763 </p>
16764 !! end
16765
16766 !! test
16767 Bug 5678: Double-parsed template invocation
16768 !! wikitext
16769 {{lc:{{paramtest {{!}} param = hello }} }}
16770 !! html
16771 <p>{{paramtest | param = hello }}
16772 </p>
16773 !! end
16774
16775 !! test
16776 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
16777 !! options
16778 language=cs
16779 title=[[Main Page]]
16780 !! wikitext
16781 {{PRVNÍVELKÉ:ěščř}}
16782 {{prvnívelké:ěščř}}
16783 {{PRVNÍMALÉ:ěščř}}
16784 {{prvnímalé:ěščř}}
16785 {{MALÁ:ěščř}}
16786 {{malá:ěščř}}
16787 {{VELKÁ:ěščř}}
16788 {{velká:ěščř}}
16789 !! html
16790 <p>Ěščř
16791 Ěščř
16792 ěščř
16793 ěščř
16794 ěščř
16795 ěščř
16796 ĚŠČŘ
16797 ĚŠČŘ
16798 </p>
16799 !! end
16800
16801 !! test
16802 Morwen/13: Unclosed link followed by heading
16803 !! wikitext
16804 [[link
16805 ==heading==
16806 !! html
16807 <p>[[link
16808 </p>
16809 <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>
16810
16811 !! end
16812
16813 !! test
16814 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
16815 !! wikitext
16816 {{foo|
16817 =heading=
16818 !! html
16819 <p>{{foo|
16820 </p>
16821 <h1><span class="mw-headline" id="heading">heading</span></h1>
16822
16823 !! end
16824
16825 !! test
16826 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
16827 !! wikitext
16828 {{foo|
16829 ==heading==
16830 !! html
16831 <p>{{foo|
16832 </p>
16833 <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>
16834
16835 !! end
16836
16837 !! test
16838 Tildes in comments
16839 !! options
16840 pst
16841 !! wikitext
16842 <!-- ~~~~ -->
16843 !! html
16844 <!-- ~~~~ -->
16845 !! end
16846
16847 !! test
16848 Paragraphs inside divs (no extra line breaks)
16849 !! wikitext
16850 <div>Line one
16851
16852 Line two</div>
16853 !! html
16854 <div>Line one
16855 Line two</div>
16856
16857 !! end
16858
16859 !! test
16860 Paragraphs inside divs (extra line break on open)
16861 !! wikitext
16862 <div>
16863 Line one
16864
16865 Line two</div>
16866 !! html
16867 <div>
16868 <p>Line one
16869 </p>
16870 Line two</div>
16871
16872 !! end
16873
16874 !! test
16875 Paragraphs inside divs (extra line break on close)
16876 !! wikitext
16877 <div>Line one
16878
16879 Line two
16880 </div>
16881 !! html
16882 <div>Line one
16883 <p>Line two
16884 </p>
16885 </div>
16886
16887 !! end
16888
16889 !! test
16890 Paragraphs inside divs (extra line break on open and close)
16891 !! wikitext
16892 <div>
16893 Line one
16894
16895 Line two
16896 </div>
16897 !! html
16898 <div>
16899 <p>Line one
16900 </p><p>Line two
16901 </p>
16902 </div>
16903
16904 !! end
16905
16906 !! test
16907 Nesting tags, paragraphs on lines which begin with <div>
16908 !! options
16909 disabled
16910 !! wikitext
16911 <div></div><strong>A
16912 B</strong>
16913 !! html
16914 <div></div>
16915 <p><strong>A
16916 B</strong>
16917 </p>
16918 !! end
16919
16920 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
16921 !! test
16922 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
16923 !! wikitext
16924 <blockquote>Line one
16925
16926 Line two</blockquote>
16927 !! html
16928 <blockquote>Line one
16929 Line two</blockquote>
16930
16931 !! end
16932
16933 !! test
16934 Bug 6200: paragraphs inside blockquotes (extra line break on open)
16935 !! wikitext
16936 <blockquote>
16937 Line one
16938
16939 Line two</blockquote>
16940 !! html
16941 <blockquote>
16942 <p>Line one
16943 </p>
16944 Line two</blockquote>
16945
16946 !! end
16947
16948 !! test
16949 Bug 6200: paragraphs inside blockquotes (extra line break on close)
16950 !! wikitext
16951 <blockquote>Line one
16952
16953 Line two
16954 </blockquote>
16955 !! html
16956 <blockquote>Line one
16957 <p>Line two
16958 </p>
16959 </blockquote>
16960
16961 !! end
16962
16963 !! test
16964 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16965 !! wikitext
16966 <blockquote>
16967 Line one
16968
16969 Line two
16970 </blockquote>
16971 !! html
16972 <blockquote>
16973 <p>Line one
16974 </p><p>Line two
16975 </p>
16976 </blockquote>
16977
16978 !! end
16979
16980 !! test
16981 Paragraphs inside blockquotes/divs (no extra line breaks)
16982 !! wikitext
16983 <blockquote><div>Line one
16984
16985 Line two</div></blockquote>
16986 !! html
16987 <blockquote><div>Line one
16988 Line two</div></blockquote>
16989
16990 !! end
16991
16992 !! test
16993 Paragraphs inside blockquotes/divs (extra line break on open)
16994 !! wikitext
16995 <blockquote><div>
16996 Line one
16997
16998 Line two</div></blockquote>
16999 !! html
17000 <blockquote><div>
17001 <p>Line one
17002 </p>
17003 Line two</div></blockquote>
17004
17005 !! end
17006
17007 !! test
17008 Paragraphs inside blockquotes/divs (extra line break on close)
17009 !! wikitext
17010 <blockquote><div>Line one
17011
17012 Line two
17013 </div></blockquote>
17014 !! html
17015 <blockquote><div>Line one
17016 <p>Line two
17017 </p>
17018 </div></blockquote>
17019
17020 !! end
17021
17022 !! test
17023 Paragraphs inside blockquotes/divs (extra line break on open and close)
17024 !! wikitext
17025 <blockquote><div>
17026 Line one
17027
17028 Line two
17029 </div></blockquote>
17030 !! html
17031 <blockquote><div>
17032 <p>Line one
17033 </p><p>Line two
17034 </p>
17035 </div></blockquote>
17036
17037 !! end
17038
17039 !! test
17040 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
17041 !! options
17042 wgLinkHolderBatchSize=0
17043 !! wikitext
17044 [[meatball:1]]
17045 [[meatball:2]]
17046 [[meatball:3]]
17047 !! html
17048 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
17049 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
17050 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
17051 </p>
17052 !! end
17053
17054 !! test
17055 Free external link invading image caption
17056 !! wikitext
17057 [[Image:Foobar.jpg|thumb|http://x|hello]]
17058 !! html
17059 <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>
17060
17061 !! end
17062
17063 !! test
17064 Bug 15196: localised external link numbers
17065 !! options
17066 language=fa
17067 !! wikitext
17068 [http://en.wikipedia.org/]
17069 !! html/php
17070 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
17071 </p>
17072 !! html/parsoid
17073 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
17074 !! end
17075
17076 !! test
17077 Multibyte character in padleft
17078 !! wikitext
17079 {{padleft:-Hello|7|Æ}}
17080 !! html
17081 <p>Æ-Hello
17082 </p>
17083 !! end
17084
17085 !! test
17086 Multibyte character in padright
17087 !! wikitext
17088 {{padright:Hello-|7|Æ}}
17089 !! html
17090 <p>Hello-Æ
17091 </p>
17092 !! end
17093
17094 !!test
17095 formatdate parser function
17096 !! wikitext
17097 {{#formatdate:2009-03-24}}
17098 !! html
17099 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
17100 </p>
17101 !! end
17102
17103 !!test
17104 formatdate parser function, with default format
17105 !! wikitext
17106 {{#formatdate:2009-03-24|mdy}}
17107 !! html
17108 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
17109 </p>
17110 !! end
17111
17112 !! test
17113 Spacing of numbers in formatted dates
17114 !! wikitext
17115 {{#formatdate:January 15}}
17116 !! html
17117 <p><span class="mw-formatted-date" title="01-15">January 15</span>
17118 </p>
17119 !! end
17120
17121 !! test
17122 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
17123 !! options
17124 language=nl title=[[MediaWiki:Common.css]]
17125 !! wikitext
17126 {{#formatdate:2009-03-24|dmy}}
17127 !! html
17128 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
17129 </p>
17130 !! end
17131
17132 #
17133 #
17134 #
17135
17136 #
17137 # Edit comments
17138 #
17139
17140 !! test
17141 Edit comment with link
17142 !! options
17143 comment
17144 !! wikitext
17145 I like the [[Main Page]] a lot
17146 !! html
17147 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
17148 !!end
17149
17150 !! test
17151 Edit comment with link and link text
17152 !! options
17153 comment
17154 !! wikitext
17155 I like the [[Main Page|best pages]] a lot
17156 !! html
17157 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17158 !!end
17159
17160 !! test
17161 Edit comment with link and link text with suffix
17162 !! options
17163 comment
17164 !! wikitext
17165 I like the [[Main Page|best page]]s a lot
17166 !! html
17167 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17168 !!end
17169
17170 !! test
17171 Edit comment with section link (non-local, eg in history list)
17172 !! options
17173 comment title=[[Main Page]]
17174 !! wikitext
17175 /* External links */ removed bogus entries
17176 !! html
17177 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17178 !!end
17179
17180 !! test
17181 Edit comment with section link and text before it (non-local, eg in history list)
17182 !! options
17183 comment title=[[Main Page]]
17184 !! wikitext
17185 pre-comment text /* External links */ removed bogus entries
17186 !! html
17187 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>
17188 !!end
17189
17190 !! test
17191 Edit comment with section link (local, eg in diff view)
17192 !! options
17193 comment local title=[[Main Page]]
17194 !! wikitext
17195 /* External links */ removed bogus entries
17196 !! html
17197 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17198 !!end
17199
17200 !! test
17201 Edit comment with subpage link (bug 14080)
17202 !! options
17203 comment
17204 subpage
17205 title=[[Subpage test]]
17206 !! wikitext
17207 Poked at a [[/subpage]] here...
17208 !! html
17209 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
17210 !!end
17211
17212 !! test
17213 Edit comment with subpage link and link text (bug 14080)
17214 !! options
17215 comment
17216 subpage
17217 title=[[Subpage test]]
17218 !! wikitext
17219 Poked at a [[/subpage|neat little page]] here...
17220 !! html
17221 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
17222 !!end
17223
17224 !! test
17225 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
17226 !! options
17227 comment
17228 title=[[Subpage test]]
17229 !! wikitext
17230 Poked at a [[/subpage]] here...
17231 !! html
17232 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...
17233 !!end
17234
17235 !! test
17236 Edit comment with bare anchor link (local, as on diff)
17237 !! options
17238 comment
17239 local
17240 title=[[Main Page]]
17241 !! wikitext
17242 [[#section]]
17243 !! html
17244 <a href="#section">#section</a>
17245 !! end
17246
17247 !! test
17248 Edit comment with bare anchor link (non-local, as on history)
17249 !! options
17250 comment
17251 title=[[Main Page]]
17252 !! wikitext
17253 [[#section]]
17254 !! html
17255 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
17256 !! end
17257
17258 !! test
17259 Anchor starting with underscore
17260 !! wikitext
17261 [[#_ref|One]]
17262 !! html
17263 <p><a href="#_ref">One</a>
17264 </p>
17265 !! end
17266
17267 !! test
17268 Id starting with underscore
17269 !! wikitext
17270 <div id="_ref"></div>
17271 !! html
17272 <div id="_ref"></div>
17273
17274 !! end
17275
17276 !! test
17277 Space normalisation on autocomment (bug 22784)
17278 !! options
17279 comment
17280 title=[[Main Page]]
17281 !! wikitext
17282 /* __hello__world__ */
17283 !! html
17284 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
17285 !! end
17286
17287 !! test
17288 percent-encoding and + signs in comments (Bug 26410)
17289 !! options
17290 comment
17291 !! wikitext
17292 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
17293 !! html
17294 <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>
17295 !! end
17296
17297 !! test
17298 Bad images - basic functionality
17299 !! options
17300 disabled
17301 !! wikitext
17302 [[File:Bad.jpg]]
17303 !! html
17304 !! end
17305
17306 !! test
17307 Bad images - bug 16039: text after bad image disappears
17308 !! options
17309 disabled
17310 !! wikitext
17311 Foo bar
17312 [[File:Bad.jpg]]
17313 Bar foo
17314 !! html
17315 <p>Foo bar
17316 </p><p>Bar foo
17317 </p>
17318 !! end
17319
17320 !! test
17321 Verify that displaytitle works (bug #22501) no displaytitle
17322 !! options
17323 showtitle
17324 !! config
17325 wgAllowDisplayTitle=true
17326 wgRestrictDisplayTitle=false
17327 !! wikitext
17328 this is not the the title
17329 !! html
17330 Parser test
17331 <p>this is not the the title
17332 </p>
17333 !! end
17334
17335 !! test
17336 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
17337 !! options
17338 showtitle
17339 title=[[Screen]]
17340 !! config
17341 wgAllowDisplayTitle=true
17342 wgRestrictDisplayTitle=false
17343 !! wikitext
17344 this is not the the title
17345 {{DISPLAYTITLE:whatever}}
17346 !! html
17347 whatever
17348 <p>this is not the the title
17349 </p>
17350 !! end
17351
17352 !! test
17353 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
17354 !! options
17355 showtitle
17356 title=[[Screen]]
17357 !! config
17358 wgAllowDisplayTitle=true
17359 wgRestrictDisplayTitle=true
17360 !! wikitext
17361 this is not the the title
17362 {{DISPLAYTITLE:whatever}}
17363 !! html
17364 Screen
17365 <p>this is not the the title
17366 </p>
17367 !! end
17368
17369 !! test
17370 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
17371 !! options
17372 showtitle
17373 title=[[Screen]]
17374 !! config
17375 wgAllowDisplayTitle=true
17376 wgRestrictDisplayTitle=true
17377 !! wikitext
17378 this is not the the title
17379 {{DISPLAYTITLE:screen}}
17380 !! html
17381 screen
17382 <p>this is not the the title
17383 </p>
17384 !! end
17385
17386 !! test
17387 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
17388 !! options
17389 showtitle
17390 title=[[Screen]]
17391 !! config
17392 wgAllowDisplayTitle=false
17393 !! wikitext
17394 this is not the the title
17395 {{DISPLAYTITLE:screen}}
17396 !! html
17397 Screen
17398 <p>this is not the the title
17399 <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>
17400 </p>
17401 !! end
17402
17403 !! test
17404 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
17405 !! options
17406 showtitle
17407 title=[[Screen]]
17408 !! config
17409 wgAllowDisplayTitle=false
17410 !! wikitext
17411 this is not the the title
17412 !! html
17413 Screen
17414 <p>this is not the the title
17415 </p>
17416 !! end
17417
17418 !! test
17419 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
17420 !! options
17421 showtitle
17422 title=[[Screen]]
17423 !! config
17424 wgAllowDisplayTitle=true
17425 wgRestrictDisplayTitle=true
17426 !! wikitext
17427 this is not the the title
17428 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
17429 !! html
17430 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
17431 <p>this is not the the title
17432 </p>
17433 !! end
17434
17435 !! test
17436 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
17437 !! options
17438 showtitle
17439 title=[[Screen]]
17440 !! config
17441 wgAllowDisplayTitle=true
17442 wgRestrictDisplayTitle=true
17443 !! wikitext
17444 this is not the the title
17445 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
17446 !! html
17447 <span style="color: red;">s</span>creen
17448 <p>this is not the the title
17449 </p>
17450 !! end
17451
17452 !! test
17453 preload: check <noinclude> and <includeonly>
17454 !! options
17455 preload
17456 !! wikitext
17457 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
17458 !! html
17459 Hello kind world.
17460 !! end
17461
17462 !! test
17463 preload: check <onlyinclude>
17464 !! options
17465 preload
17466 !! wikitext
17467 Goodbye <onlyinclude>Hello world</onlyinclude>
17468 !! html
17469 Hello world
17470 !! end
17471
17472 !! test
17473 preload: can pass tags through if we want to
17474 !! options
17475 preload
17476 !! wikitext
17477 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
17478 !! html
17479 <includeonly>Hello world</includeonly>
17480 !! end
17481
17482 !! test
17483 preload: check that it doesn't try to do tricks
17484 !! options
17485 preload
17486 !! wikitext
17487 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17488 !! html
17489 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17490 !! end
17491
17492 !! test
17493 Play a bit with r67090 and bug 3158
17494 !! options
17495 disabled
17496 !! wikitext
17497 <div style="width:50% !important">&nbsp;</div>
17498 <div style="width:50%&nbsp;!important">&nbsp;</div>
17499 <div style="width:50%&#160;!important">&nbsp;</div>
17500 <div style="border : solid;">&nbsp;</div>
17501 !! html
17502 <div style="width:50% !important">&nbsp;</div>
17503 <div style="width:50% !important">&nbsp;</div>
17504 <div style="width:50% !important">&nbsp;</div>
17505 <div style="border&#160;: solid;">&nbsp;</div>
17506
17507 !! end
17508
17509 !! test
17510 HTML5 data attributes
17511 !! wikitext
17512 <span data-foo="bar">Baz</span>
17513 <p data-abc-def_hij="">Quuz</p>
17514 !! html
17515 <p><span data-foo="bar">Baz</span>
17516 </p>
17517 <p data-abc-def_hij="">Quuz</p>
17518
17519 !! end
17520
17521 !! test
17522 percent-encoding and + signs in internal links (Bug 26410)
17523 !! wikitext
17524 [[User:+%]] [[Page+title%]]
17525 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
17526 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
17527 [[%33%45]] [[%33%45+]]
17528 !! html
17529 <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>
17530 <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>
17531 <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>
17532 <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>
17533 </p>
17534 !! end
17535
17536 !! test
17537 Special characters in embedded file links (bug 27679)
17538 !! wikitext
17539 [[File:Contains & ampersand.jpg]]
17540 [[File:Does not exist.jpg|Title with & ampersand]]
17541 !! html
17542 <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>
17543 <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>
17544 </p>
17545 !! end
17546
17547
17548 !! test
17549 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
17550 !! wikitext
17551 Text&apos;s been normalized?
17552 !! html
17553 <p>Text&#39;s been normalized?
17554 </p>
17555 !! end
17556
17557 !! test
17558 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
17559 !! wikitext
17560 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
17561 !! html
17562 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
17563 </p>
17564 !! end
17565
17566 !! test
17567 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
17568 !! wikitext
17569 [http://www.example.org/ ideograms]
17570 !! html
17571 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
17572 </p>
17573 !! end
17574
17575 !! test
17576 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
17577 !! wikitext
17578 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
17579 !! html
17580 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
17581 </p>
17582 !! end
17583
17584 !! article
17585 Mediawiki:loop1
17586 !! text
17587 {{Identical|A}}
17588 !! endarticle
17589
17590 !! article
17591 Mediawiki:loop2
17592 !! text
17593 {{Identical|B}}
17594 !! endarticle
17595
17596 !! article
17597 Template:Identical
17598 !! text
17599 {{int:loop1}}
17600 {{int:loop2}}
17601 !! endarticle
17602
17603 !! test
17604 Bug 31098 Template which includes system messages which includes the template
17605 !! wikitext
17606 {{Identical}}
17607 !! html
17608 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17609 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17610 </p>
17611 !! end
17612
17613 !! test
17614 Bug31490 Turkish: ucfirst 'blah'
17615 !! options
17616 language=tr
17617 !! wikitext
17618 {{ucfirst:blah}}
17619 !! html
17620 <p>Blah
17621 </p>
17622 !! end
17623
17624 !! test
17625 Bug31490 Turkish: ucfirst 'ix'
17626 !! options
17627 language=tr
17628 !! wikitext
17629 {{ucfirst:ix}}
17630 !! html
17631 <p>İx
17632 </p>
17633 !! end
17634
17635 !! test
17636 Bug31490 Turkish: lcfirst 'BLAH'
17637 !! options
17638 language=tr
17639 !! wikitext
17640 {{lcfirst:BLAH}}
17641 !! html
17642 <p>bLAH
17643 </p>
17644 !! end
17645
17646 !! test
17647 Bug31490 Turkish: ucfırst (with a dotless i)
17648 !! options
17649 language=tr
17650 !! wikitext
17651 {{ucfırst:blah}}
17652 !! html
17653 <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>
17654 </p>
17655 !! end
17656
17657 !! test
17658 Bug31490 ucfırst (with a dotless i) with English language
17659 !! options
17660 language=en
17661 !! wikitext
17662 {{ucfırst:blah}}
17663 !! html
17664 <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>
17665 </p>
17666 !! end
17667
17668 !! test
17669 Bug 26375: TOC with italics
17670 !! options
17671 title=[[Main Page]]
17672 !! wikitext
17673 __TOC__
17674 == ''Lost'' episodes ==
17675 !! html
17676 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17677 <ul>
17678 <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>
17679 </ul>
17680 </div>
17681
17682 <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>
17683
17684 !! end
17685
17686 !! test
17687 Bug 26375: TOC with bold
17688 !! options
17689 title=[[Main Page]]
17690 !! wikitext
17691 __TOC__
17692 == '''should be bold''' then normal text ==
17693 !! html
17694 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17695 <ul>
17696 <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>
17697 </ul>
17698 </div>
17699
17700 <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>
17701
17702 !! end
17703
17704 !! test
17705 Bug 33845: Headings become cursive in TOC when they contain an image
17706 !! options
17707 title=[[Main Page]]
17708 !! wikitext
17709 __TOC__
17710 == Image [[Image:foobar.jpg]] ==
17711 !! html
17712 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17713 <ul>
17714 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
17715 </ul>
17716 </div>
17717
17718 <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>
17719
17720 !! end
17721
17722 !! test
17723 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
17724 !! options
17725 title=[[Main Page]]
17726 !! wikitext
17727 __TOC__
17728 == <blockquote>Quote</blockquote> ==
17729 !! html
17730 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17731 <ul>
17732 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
17733 </ul>
17734 </div>
17735
17736 <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>
17737
17738 !! end
17739
17740 !! test
17741 Unclosed tags in TOC
17742 !! options
17743 title=[[Main Page]]
17744 !! wikitext
17745 __TOC__
17746 == Proof: 2 < 3 ==
17747 <small>Hanc marginis exiguitas non caperet.</small>
17748 QED
17749 !! html
17750 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17751 <ul>
17752 <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>
17753 </ul>
17754 </div>
17755
17756 <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>
17757 <p><small>Hanc marginis exiguitas non caperet.</small>
17758 QED
17759 </p>
17760 !! end
17761
17762 !! test
17763 Multiple tags in TOC
17764 !! wikitext
17765 __TOC__
17766 == <i>Foo</i> <b>Bar</b> ==
17767
17768 == <i>Foo</i> <blockquote>Bar</blockquote> ==
17769 !! html
17770 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17771 <ul>
17772 <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>
17773 <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>
17774 </ul>
17775 </div>
17776
17777 <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>
17778 <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>
17779
17780 !! end
17781
17782 !! test
17783 Tags with parameters in TOC
17784 !! wikitext
17785 __TOC__
17786 == <sup class="in-h2">Hello</sup> ==
17787
17788 == <sup class="a > b">Evilbye</sup> ==
17789 !! html
17790 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17791 <ul>
17792 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
17793 <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>
17794 </ul>
17795 </div>
17796
17797 <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>
17798 <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>
17799
17800 !! end
17801
17802 !! test
17803 span tags with directionality in TOC
17804 !! wikitext
17805 __TOC__
17806 == <span dir="ltr">C++</span> ==
17807
17808 == <span dir="rtl">זבנג!</span> ==
17809
17810 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
17811
17812 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
17813
17814 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
17815 !! html
17816 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17817 <ul>
17818 <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>
17819 <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>
17820 <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>
17821 <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>
17822 <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>
17823 </ul>
17824 </div>
17825
17826 <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>
17827 <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>
17828 <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>
17829 <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>
17830 <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>
17831
17832 !! end
17833
17834 !! article
17835 MediaWiki:Bug32057
17836 !! text
17837 == {{int:headline_sample}} ==
17838 !! endarticle
17839
17840 !! test
17841 Bug 32057: Title needed when expanding <h> nodes.
17842 !! options
17843 title=[[Main Page]]
17844 !! wikitext
17845 {{int:Bug32057}}
17846 !! html
17847 <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>
17848
17849 !! end
17850
17851 !! test
17852 Strip marker in urlencode
17853 !! wikitext
17854 {{urlencode:x<nowiki/>y}}
17855 {{urlencode:x<nowiki/>y|wiki}}
17856 {{urlencode:x<nowiki/>y|path}}
17857 !! html
17858 <p>xy
17859 xy
17860 xy
17861 </p>
17862 !! end
17863
17864 !! test
17865 Strip marker in lc
17866 !! wikitext
17867 {{lc:x<nowiki/>y}}
17868 !! html
17869 <p>xy
17870 </p>
17871 !! end
17872
17873 !! test
17874 Strip marker in uc
17875 !! wikitext
17876 {{uc:x<nowiki/>y}}
17877 !! html
17878 <p>XY
17879 </p>
17880 !! end
17881
17882 !! test
17883 Strip marker in formatNum
17884 !! wikitext
17885 {{formatnum:1<nowiki/>2}}
17886 {{formatnum:1<nowiki/>2|R}}
17887 !! html
17888 <p>12
17889 12
17890 </p>
17891 !! end
17892
17893 !! test
17894 Check noCommafy in formatNum
17895 !! options
17896 language=be-tarask
17897 !! wikitext
17898 {{formatnum:123456.78}}
17899 {{formatnum:123456.78|NOSEP}}
17900 !! html
17901 <p>123 456,78
17902 123456.78
17903 </p>
17904 !! end
17905
17906 !! test
17907 Wrong option for formatNum (bug 56199)
17908 !! wikitext
17909 {{formatnum:1,234.56|Random}}
17910 {{formatnum:1,234.56|EVERYTHING}}
17911 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
17912 !! html
17913 <p>1,234.56
17914 1,234.56
17915 1,234.56
17916 </p>
17917 !! end
17918
17919 !! test
17920 Strip marker in grammar
17921 !! options
17922 language=fi
17923 !! wikitext
17924 {{grammar:elative|foo<nowiki/>bar}}
17925 !! html
17926 <p>foobarista
17927 </p>
17928 !! end
17929
17930 !! test
17931 Strip marker in padleft
17932 !! wikitext
17933 {{padleft:|2|x<nowiki/>y}}
17934 !! html
17935 <p>xy
17936 </p>
17937 !! end
17938
17939 !! test
17940 Strip marker in padright
17941 !! wikitext
17942 {{padright:|2|x<nowiki/>y}}
17943 !! html
17944 <p>xy
17945 </p>
17946 !! end
17947
17948 !! test
17949 Strip marker in anchorencode
17950 !! wikitext
17951 {{anchorencode:x<nowiki/>y}}
17952 !! html
17953 <p>xy
17954 </p>
17955 !! end
17956
17957 !! test
17958 nowiki inside link inside heading (bug 18295)
17959 !! wikitext
17960 ==[[foo|x<nowiki>y</nowiki>z]]==
17961 !! html
17962 <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>
17963
17964 !! end
17965
17966 !! test
17967 new support for bdi element (bug 31817)
17968 !! wikitext
17969 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17970 !! html
17971 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17972
17973 !!end
17974
17975 !! test
17976 Ignore pipe between table row attributes
17977 !! wikitext
17978 {|
17979 | quux
17980 |- id=foo | style='color: red'
17981 | bar
17982 |}
17983 !! html
17984 <table>
17985 <tr>
17986 <td> quux
17987 </td></tr>
17988 <tr id="foo" style="color: red">
17989 <td> bar
17990 </td></tr></table>
17991
17992 !! end
17993
17994 !!test
17995 Gallery override link with WikiLink (bug 34852)
17996 !! wikitext
17997 <gallery>
17998 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17999 </gallery>
18000 !! html
18001 <ul class="gallery mw-gallery-traditional">
18002 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18003 <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>
18004 <div class="gallerytext">
18005 <p>caption
18006 </p>
18007 </div>
18008 </div></li>
18009 </ul>
18010
18011 !! end
18012
18013 !!test
18014 Gallery override link with absolute external link (bug 34852)
18015 !! wikitext
18016 <gallery>
18017 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
18018 </gallery>
18019 !! html
18020 <ul class="gallery mw-gallery-traditional">
18021 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18022 <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>
18023 <div class="gallerytext">
18024 <p>caption
18025 </p>
18026 </div>
18027 </div></li>
18028 </ul>
18029
18030 !! end
18031
18032 !!test
18033 Gallery override link with malicious javascript (bug 34852)
18034 !! wikitext
18035 <gallery>
18036 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
18037 </gallery>
18038 !! html
18039 <ul class="gallery mw-gallery-traditional">
18040 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18041 <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>
18042 <div class="gallerytext">
18043 <p>caption
18044 </p>
18045 </div>
18046 </div></li>
18047 </ul>
18048
18049 !! end
18050
18051 !!test
18052 Gallery with invalid title as link (bug 43964)
18053 !! wikitext
18054 <gallery>
18055 File:foobar.jpg|link=<
18056 </gallery>
18057 !! html
18058 <ul class="gallery mw-gallery-traditional">
18059 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18060 <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>
18061 <div class="gallerytext">
18062 </div>
18063 </div></li>
18064 </ul>
18065
18066 !! end
18067
18068 !!test
18069 Language parser function
18070 !! wikitext
18071 {{#language:ar}}
18072 !! html
18073 <p>العربية
18074 </p>
18075 !! end
18076
18077 !!test
18078 Padleft and padright as substr
18079 !! wikitext
18080 {{padleft:|3|abcde}}
18081 {{padright:|3|abcde}}
18082 !! html
18083 <p>abc
18084 abc
18085 </p>
18086 !! end
18087
18088 !!test
18089 Special parser function
18090 !! wikitext
18091 {{#special:RandomPage}}
18092 {{#special:BaDtItLe}}
18093 {{#special:Foobar}}
18094 !! html
18095 <p>Special:Random
18096 Special:Badtitle
18097 Special:Foobar
18098 </p>
18099 !! end
18100
18101 !!test
18102 Bug 34939 - Case insensitive link parsing ([HttP://])
18103 !! wikitext
18104 [HttP://MediaWiki.Org/]
18105 !! html/php
18106 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
18107 </p>
18108 !! html/parsoid
18109 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
18110 !! end
18111
18112 !!test
18113 Bug 34939 - Case insensitive link parsing ([HttP:// title])
18114 !! wikitext
18115 [HttP://MediaWiki.Org/ MediaWiki]
18116 !! html
18117 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
18118 </p>
18119 !! end
18120
18121 !!test
18122 Bug 34939 - Case insensitive link parsing (HttP://)
18123 !! wikitext
18124 HttP://MediaWiki.Org/
18125 !! html/php
18126 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
18127 </p>
18128 !! html/parsoid
18129 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
18130 !! end
18131
18132 !!test
18133 Disable TOC
18134 !! options
18135 notoc
18136 !! wikitext
18137 Lead
18138 == Section 1 ==
18139 == Section 2 ==
18140 == Section 3 ==
18141 == Section 4 ==
18142 == Section 5 ==
18143 !! html
18144 <p>Lead
18145 </p>
18146
18147 <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>
18148 <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>
18149 <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>
18150 <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>
18151 <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>
18152
18153 !! end
18154
18155
18156 ###
18157 ### Parsoid-specific tests
18158 ### Parsoid-PHP parser incompatibilities
18159 ###
18160 !!test
18161 1. SOL-sensitive wikitext tokens as template-args
18162 !!options
18163 parsoid=wt2html,wt2wt
18164 !! wikitext
18165 {{echo|*a}}
18166 {{echo|#a}}
18167 {{echo|:a}}
18168 !! html
18169 <span about="#mwt1" typeof="mw:Transclusion">
18170 </span><ul about="#mwt1"><li>a</li>
18171 </ul>
18172 <span about="#mwt2" typeof="mw:Transclusion">
18173 </span><ol about="#mwt2"><li>a</li>
18174 </ol>
18175 <span about="#mwt3" typeof="mw:Transclusion">
18176 </span><dl about="#mwt3"><dd>a</dd>
18177 </dl>
18178 !!end
18179
18180 #### -----------------------------------------------------------------
18181 #### Parsoid-specific functionality tests
18182 #### -----------------------------------------------------------------
18183
18184 # Bug 63642: Formatting elt fixup is cleaned up.
18185 # We know wt2wt will fail, but we expect selser to pass.
18186 # Due to the nature of our testing, wt2wt and selser tests will enter the
18187 # blacklist and we'll catch selser regressions based on changes to the
18188 # blacklist entries for selser tests.
18189 !! test
18190 Bad treebuilder fixup of formatting elt is cleaned up
18191 !! options
18192 parsoid=wt2html,wt2wt
18193 !! wikitext
18194 {|
18195 |
18196 <small>
18197 [[Image:Foobar.jpg|right|Test]]
18198 </small>
18199 |}
18200 !! html/parsoid
18201 <table>
18202 <tbody><tr><td>
18203 <p><small></small></p>
18204 <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>
18205 <p></p></td></tr>
18206 </tbody></table>
18207 !! end
18208
18209 #### ----------------------------------------------------------------
18210 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
18211 #### tags. Parsoid's output for these tags differs from that of the
18212 #### PHP parser.
18213 #### ----------------------------------------------------------------
18214
18215 !!test
18216 Ref: 1. ref-location should be replaced with an index span
18217 !!options
18218 parsoid
18219 !! wikitext
18220 A <ref>foo</ref>
18221 B <ref name="x">foo</ref>
18222 C <ref name="y" />
18223 !! html
18224 <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>
18225 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>
18226 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>
18227 !!end
18228
18229 !!test
18230 Ref: 2. ref-tags with identical names should all get the same index
18231 !!options
18232 parsoid
18233 !! wikitext
18234 A <ref name="x">foo</ref>
18235 B <ref name="x" />
18236 !! html
18237 <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>
18238 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>
18239 !!end
18240
18241 !!test
18242 Ref: 3. spaces in ref-names should be ignored
18243 !!options
18244 parsoid
18245 !! wikitext
18246 A <ref name="x">foo</ref>
18247 B <ref name=" x " />
18248 C <ref name= x />
18249 !! html
18250 <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>
18251 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>
18252 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>
18253 !!end
18254
18255 !!test
18256 Ref: 4. 'constructor' should be accepted as a valid ref-name
18257 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
18258 !!options
18259 parsoid
18260 !! wikitext
18261 A <ref name="constructor">foo</ref>
18262 !! html
18263 <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>
18264 !!end
18265
18266 !!test
18267 Ref: 5. body should accept generic wikitext
18268 !!options
18269 parsoid
18270 !! wikitext
18271 A <ref>
18272 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
18273 </ref>
18274
18275 <references />
18276 !! html
18277 <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>
18278
18279 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
18280 <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>
18281 </li>
18282 </ol>
18283 !!end
18284
18285 !!test
18286 Ref: 6. indent-pres should not be output in ref-body
18287 !!options
18288 parsoid
18289 !! wikitext
18290 A <ref>
18291 foo
18292 bar
18293 baz
18294 </ref>
18295
18296 <references />
18297 !! html
18298 <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>
18299
18300 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
18301 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18302 bar
18303 baz
18304 </li>
18305 </ol>
18306 !!end
18307
18308 !!test
18309 Ref: 7. No p-wrapping in ref-body
18310 !!options
18311 parsoid
18312 !! wikitext
18313 A <ref>
18314 foo
18315
18316 bar
18317
18318
18319 baz
18320
18321
18322
18323 booz
18324 </ref>
18325
18326 <references />
18327 !! html
18328 <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>
18329
18330 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18331 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18332
18333 bar
18334
18335
18336 baz
18337
18338
18339
18340 booz
18341 </li>
18342 </ol>
18343 !!end
18344
18345 !!test
18346 Ref: 8. transclusion wikitext has lower precedence
18347 !!options
18348 parsoid
18349 !! wikitext
18350 A <ref> foo {{echo|</ref> B C}}
18351
18352 <references />
18353 !! html
18354 <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>
18355 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
18356 <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>
18357 </ol>
18358 !!end
18359
18360 !!test
18361 Ref: 9. unclosed comments should not leak out of ref-body
18362 !!options
18363 parsoid
18364 !! wikitext
18365 A <ref> foo <!--</ref> B C
18366 <references />
18367 !! html
18368 <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>
18369 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18370 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
18371 </ol>
18372 !!end
18373
18374 !!test
18375 Ref: 10. Unclosed HTML tags should not leak out of ref-body
18376 !!options
18377 parsoid
18378 !! wikitext
18379 A <ref> <b> foo </ref> B C
18380
18381 <references />
18382 !! html
18383 <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>
18384
18385
18386 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18387 <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>
18388 </ol>
18389 !!end
18390
18391 !!test
18392 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
18393 !!options
18394 parsoid
18395 !! wikitext
18396 A <ref>foo</ref> B
18397 C <ref>bar</ref> D
18398 !! html
18399 <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
18400 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>
18401 !!end
18402
18403 !!test
18404 Ref: 12. ref-tags act as trailing newline migration barrier
18405 !!options
18406 parsoid
18407 !! wikitext
18408 <!--the newline at the end of this line moves out of the p-tag-->a
18409
18410 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
18411 <ref />
18412
18413 c
18414 !! html
18415 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
18416
18417
18418 <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>
18419 <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>
18420
18421
18422 <p>c</p>
18423 !!end
18424
18425 !!test
18426 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
18427 !!options
18428 parsoid
18429 !! wikitext
18430 <ref>foo</ref> A
18431 <ref>bar
18432 </ref> B
18433 !! html
18434 <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
18435 <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>
18436 !!end
18437
18438 !!test
18439 Ref: 14. A nested ref-tag should be emitted as plain text
18440 !!options
18441 parsoid
18442 !! wikitext
18443 <ref>foo <ref>bar</ref> baz</ref>
18444
18445 <references />
18446 !! html
18447 <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>
18448
18449 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18450 <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>
18451 </ol>
18452 !!end
18453
18454 !!test
18455 Ref: 15. ref-tags with identical names should get identical indexes
18456 !!options
18457 parsoid
18458 !! wikitext
18459 A1 <ref name="a">foo</ref> A2 <ref name="a" />
18460 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
18461
18462 <references />
18463 !! html
18464 <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>
18465 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>
18466
18467 <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>
18468 </ol>
18469 !!end
18470
18471 ## We don't bother wt2wt-ing non-standard whitespace
18472 !!test
18473 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
18474 !!options
18475 parsoid=wt2html
18476 !! wikitext
18477 A <ref >foo</ref >
18478
18479 <references />
18480 !! html
18481 <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>
18482
18483 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18484 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
18485 !!end
18486
18487 !!test
18488 References: 1. references tag without any refs should be handled properly
18489 !!options
18490 parsoid
18491 !! wikitext
18492 <references />
18493 !! html
18494 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
18495 !!end
18496
18497 !!test
18498 References: 2. references tag with group only outputs references from that group
18499 !!options
18500 parsoid
18501 !! wikitext
18502 A <ref group="a">foo</ref>
18503 B <ref group="b">bar</ref>
18504
18505 <references group="a" />
18506 !! html
18507 <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>
18508 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>
18509
18510 <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>
18511 </ol>
18512 !!end
18513
18514 !!test
18515 References: 3. ref list should be cleared after processing references
18516 !!options
18517 parsoid
18518 !! wikitext
18519 A <ref>foo</ref>
18520
18521 <references />
18522
18523 B <ref>bar</ref>
18524
18525 <references />
18526 !! html
18527 <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>
18528
18529 <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>
18530 </ol>
18531
18532 <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>
18533
18534 <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>
18535 </ol>
18536 !!end
18537
18538 !!test
18539 References: 4. only referenced group should be cleared after processing references
18540 !!options
18541 parsoid
18542 !! wikitext
18543 A <ref group="a">afoo</ref>
18544 B <ref>bfoo</ref>
18545
18546 <references group="a" />
18547
18548 C <ref>cfoo</ref>
18549
18550 <references />
18551 !! html
18552 <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>
18553 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>
18554
18555 <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>
18556 </ol>
18557
18558 <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>
18559
18560 <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>
18561 </ol>
18562 !!end
18563
18564 !!test
18565 References: 5. ref tags in references should be processed while ignoring all other content
18566 !!options
18567 parsoid
18568 !! wikitext
18569 A <ref name="a" />
18570 B <ref name="b">bar</ref>
18571
18572 <references>
18573 <ref name="a">foo</ref>
18574 This should just get lost.
18575 </references>
18576 !! html
18577 <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>
18578 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>
18579
18580
18581 <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":{}}'>
18582 <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>
18583 <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>
18584 </ol>
18585 !!end
18586
18587 !!test
18588 References: 6. <references /> from a transclusion
18589 !!options
18590 parsoid
18591 !! wikitext
18592 <ref>Foo</ref> {{echo|<references />}}
18593 !! html
18594 <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>
18595 !!end
18596
18597 !! test
18598 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
18599 !! options
18600 parsoid
18601 !! wikitext
18602 A <ref>foo bar for a</ref>
18603 B <ref group="X" name="b" />
18604
18605 <references />
18606
18607 <references group="X">
18608 <ref name="b">foo</ref>
18609 </references>
18610 !! html
18611 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo bar for a&lt;/ref>"}'><a href="#cite_note-1" data-parsoid="{}">[1]</a></span>
18612 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref group=\"X\" name=\"b\" />"}'><a href="#cite_note-b-2" data-parsoid="{}">[X 1]</a></span></p>
18613
18614 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-1-0" data-parsoid="{}">↑</a></span> foo bar for a</li></ol>
18615
18616 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-parsoid='{"src":"&lt;references group=\"X\">\n&lt;ref name=\"b\">foo&lt;/ref>\n&lt;/references>","group":"X"}' data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"b\">foo&lt;/ref>","html":"\n&lt;span about=\"#mwt10\" class=\"reference\" data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"b\"}}&#39; rel=\"dc:references\" typeof=\"mw:Extension/ref\">&lt;a href=\"#cite_note-b-2\">[X 1]&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'><li about="#cite_note-b-2" id="cite_note-b-2" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-b-2-0" data-parsoid="{}">↑</a></span> foo</li></ol>
18617 !! end
18618
18619 !! test
18620 Entities in ref name
18621 !! options
18622 parsoid
18623 !! wikitext
18624 <ref name="test &amp; me">hi</ref>
18625 !! html
18626 <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>
18627 !! end
18628
18629 # This test is wt2html only because we're permitting the serializer to produce
18630 # dirty diffs, normalizing the unclosed references to the self-closed version.
18631 !! test
18632 Generate references for unclosed references tag
18633 !! options
18634 parsoid=wt2html
18635 !! wikitext
18636 a<ref>foo</ref>
18637
18638 <references>
18639 !! html
18640 <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>
18641
18642
18643 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
18644 <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>
18645 !! end
18646
18647 !! test
18648 New reference serializes on its own line
18649 !! options
18650 parsoid=wt2wt,html2wt
18651 !! wikitext
18652 foo
18653 <references />
18654 !! html
18655 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
18656 !! end
18657
18658 #### ----------------------------------------------------------------
18659 #### The following section of tests are primarily to test
18660 #### wikitext escaping capabilities of Parsoid. Given that
18661 #### escaping can be done any number of ways, the wikitext (input)
18662 #### is always adjusted to reflect how Parsoid adds nowiki
18663 #### escape tags.
18664 ####
18665 #### We are marking several tests as parsoid-only since the
18666 #### HTML in the result section is different from what the
18667 #### PHP parser generates for it.
18668 #### ----------------------------------------------------------------
18669
18670
18671 #### --------------- Headings ---------------
18672 #### 0. Unnested
18673 #### 1. Nested inside html <h1>=foo=</h1>
18674 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
18675 #### 3. Nested inside html with wikitext split by html tags
18676 #### 4. No escape needed
18677 #### 5. Empty headings <h1></h1>
18678 #### 6. Heading chars in SOL context
18679 #### ----------------------------------------
18680 !! test
18681 Headings: 0. Unnested
18682 !! options
18683 parsoid
18684 !! wikitext
18685 <nowiki>=foo=</nowiki>
18686
18687 <nowiki> =foo= </nowiki>
18688 <!--cmt-->
18689 <nowiki>=foo=</nowiki>
18690
18691 =foo''a''<nowiki>=</nowiki>
18692 !! html
18693 <p><span typeof="mw:Nowiki">=foo=</span></p>
18694
18695 <p><span typeof="mw:Nowiki"> =foo= </span>
18696 <!--cmt-->
18697 <span typeof="mw:Nowiki">=foo=</span></p>
18698
18699 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
18700 !!end
18701
18702 !! test
18703 Headings: 1. Nested inside html
18704 (New headings and existing headings are handled differently)
18705 !! options
18706 parsoid=html2wt
18707 !! wikitext
18708 = =foo= =
18709
18710 == =foo= ==
18711
18712 === =foo= ===
18713
18714 =<nowiki>=foo=</nowiki>=
18715 ==<nowiki>=foo=</nowiki>==
18716 ===<nowiki>=foo=</nowiki>===
18717 ====<nowiki>=foo=</nowiki>====
18718 =====<nowiki>=foo=</nowiki>=====
18719 ======<nowiki>=foo=</nowiki>======
18720
18721 !! html
18722 <h1>=foo=</h1>
18723 <h2>=foo=</h2>
18724 <h3>=foo=</h3>
18725
18726 <h1 data-parsoid='{}'>=foo=</h1>
18727 <h2 data-parsoid='{}'>=foo=</h2>
18728 <h3 data-parsoid='{}'>=foo=</h3>
18729 <h4 data-parsoid='{}'>=foo=</h4>
18730 <h5 data-parsoid='{}'>=foo=</h5>
18731 <h6 data-parsoid='{}'>=foo=</h6>
18732 !!end
18733
18734 !! test
18735 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
18736 !! options
18737 parsoid=html2wt
18738 !! wikitext
18739 = foo =
18740 <nowiki>*</nowiki>bar
18741
18742 = foo =
18743 =bar
18744
18745 = foo =
18746 <nowiki>=bar=</nowiki>
18747 !! html
18748 <h1>foo</h1>*bar
18749 <h1>foo</h1>=bar
18750 <h1>foo</h1>=bar=
18751 !!end
18752
18753 !! test
18754 Headings: 3. Nested inside html with wikitext split by html tags
18755 !! options
18756 parsoid=html2wt
18757 !! wikitext
18758 = ='''bold'''<nowiki>foo=</nowiki> =
18759 !! html
18760 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
18761 !!end
18762
18763 !! test
18764 Headings: 4a. No escaping needed (testing just h1 and h2)
18765 !! options
18766 parsoid=html2wt
18767 !! wikitext
18768 = =foo =
18769
18770 = foo= =
18771
18772 = =foo= =
18773
18774 = =foo= bar =
18775
18776 == =foo ==
18777
18778 == foo= ==
18779
18780 = ''=''foo= =
18781
18782 = <nowiki>=</nowiki> =
18783 !! html
18784 <h1>=foo</h1>
18785 <h1>foo=</h1>
18786 <h1> =foo= </h1>
18787 <h1>=foo= bar</h1>
18788 <h2>=foo</h2>
18789 <h2>foo=</h2>
18790 <h1><i>=</i>foo=</h1>
18791 <h1><span typeof="mw:Nowiki">=</span></h1>
18792 !!end
18793
18794 !! test
18795 Headings: 4b. No escaping needed (inside p-tags)
18796 !! options
18797 parsoid=html2wt
18798 !! wikitext
18799 ===
18800 =foo= x
18801 =foo= <s></s>
18802 !! html
18803 <p>===
18804 =foo= x
18805 =foo= <s></s>
18806 </p>
18807 !!end
18808
18809 !! test
18810 Headings: 5. Empty headings
18811 !! options
18812 parsoid
18813 !! wikitext
18814 =<nowiki/>=
18815
18816 ==<nowiki/>==
18817
18818 ===<nowiki/>===
18819
18820 ====<nowiki/>====
18821
18822 =====<nowiki/>=====
18823
18824 ======<nowiki/>======
18825 !! html
18826 <h1></h1>
18827 <h2></h2>
18828 <h3></h3>
18829 <h4></h4>
18830 <h5></h5>
18831 <h6></h6>
18832 !!end
18833
18834 !! test
18835 Headings: 6a. Heading chars in SOL context (with trailing spaces)
18836 !! options
18837 parsoid
18838 !! wikitext
18839 <nowiki>=a=</nowiki>
18840
18841 <nowiki>=a=</nowiki>
18842
18843 <nowiki>=a=</nowiki>
18844
18845 <nowiki>=a=</nowiki>
18846 !! html
18847 <p>=a=</p>
18848 <p>=a= </p>
18849 <p>=a= </p>
18850 <p>=a= </p>
18851 !!end
18852
18853 !! test
18854 Headings: 6b. Heading chars in SOL context (with trailing newlines)
18855 !! options
18856 parsoid
18857 !! wikitext
18858 <nowiki>=a=
18859 b</nowiki>
18860
18861 <nowiki>=a=
18862 b</nowiki>
18863
18864 <nowiki>=a=
18865 b</nowiki>
18866
18867 <nowiki>=a=
18868 b</nowiki>
18869 !! html
18870 <p>=a=
18871 b</p>
18872 <p>=a=
18873 b</p>
18874 <p>=a=
18875 b</p>
18876 <p>=a=
18877 b</p>
18878 </p>
18879 !!end
18880
18881 !! test
18882 Headings: 6c. Heading chars in SOL context (leading newline break)
18883 !! options
18884 parsoid
18885 !! wikitext
18886 a
18887 <nowiki>=b=</nowiki>
18888 !! html
18889 <p>a
18890 =b=</p>
18891 !!end
18892
18893 !! test
18894 Headings: 6d. Heading chars in SOL context (with interspersed comments)
18895 !! options
18896 parsoid
18897 !! wikitext
18898 <!--c0--><nowiki>=a=</nowiki>
18899
18900 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
18901 !! html
18902 <p><!--c0-->=a=</p>
18903 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
18904 !!end
18905
18906 !! test
18907 Headings: 6d. Heading chars in SOL context (No escaping needed)
18908 !! options
18909 parsoid=html2wt
18910 !! wikitext
18911 =a=<div>b</div>
18912 !! html
18913 =a=<div>b</div>
18914 !!end
18915
18916 #### --------------- Lists ---------------
18917 #### 0. Outside nests (*foo, etc.)
18918 #### 1. Nested inside html <ul><li>*foo</li></ul>
18919 #### 2. Inside definition lists
18920 #### 3. Only bullets at start should be escaped
18921 #### 4. No escapes needed
18922 #### 5. No unnecessary escapes
18923 #### 6. Escape bullets in SOL position
18924 #### 7. Escape bullets in a multi-line context
18925 #### ----------------------------------------
18926
18927 !! test
18928 Lists: 0. Outside nests
18929 !! wikitext
18930 <nowiki>*</nowiki>foo
18931
18932 <nowiki>#</nowiki>foo
18933
18934 <nowiki>;Foo:</nowiki>bar
18935 !! html
18936 <p>*foo
18937 </p><p>#foo
18938 </p><p>;Foo:bar
18939 </p>
18940 !!end
18941
18942 !! test
18943 Lists: 1. Nested inside html
18944 !! wikitext
18945 *<nowiki>*foo</nowiki>
18946
18947 *<nowiki>#foo</nowiki>
18948
18949 *<nowiki>:foo</nowiki>
18950
18951 *<nowiki>;foo</nowiki>
18952
18953 #<nowiki>*foo</nowiki>
18954
18955 #<nowiki>#foo</nowiki>
18956
18957 #<nowiki>:foo</nowiki>
18958
18959 #<nowiki>;foo</nowiki>
18960 !! html
18961 <ul><li>*foo</li></ul>
18962 <ul><li>#foo</li></ul>
18963 <ul><li>:foo</li></ul>
18964 <ul><li>;foo</li></ul>
18965 <ol><li>*foo</li></ol>
18966 <ol><li>#foo</li></ol>
18967 <ol><li>:foo</li></ol>
18968 <ol><li>;foo</li></ol>
18969
18970 !!end
18971
18972 !! test
18973 Lists: 2. Inside definition lists
18974 !! wikitext
18975 ;<nowiki>;foo</nowiki>
18976
18977 ;<nowiki>:foo</nowiki>
18978
18979 ;<nowiki>:foo</nowiki>
18980 :bar
18981
18982 :<nowiki>:foo</nowiki>
18983 !! html
18984 <dl><dt>;foo</dt></dl>
18985 <dl><dt>:foo</dt></dl>
18986 <dl><dt>:foo</dt>
18987 <dd>bar</dd></dl>
18988 <dl><dd>:foo</dd></dl>
18989
18990 !!end
18991
18992 !! test
18993 Lists: 3. Only bullets at start of text should be escaped
18994 !! wikitext
18995 *<nowiki>*foo*bar</nowiki>
18996
18997 *<nowiki>*foo</nowiki>''it''*bar
18998 !! html
18999 <ul><li>*foo*bar</li></ul>
19000 <ul><li>*foo<i>it</i>*bar</li></ul>
19001
19002 !!end
19003
19004 !! test
19005 Lists: 4. No escapes needed
19006 !! options
19007 parsoid
19008 !! wikitext
19009 *foo*bar
19010
19011 *''foo''*bar
19012
19013 *[[Foo]]: bar
19014
19015 *[[Foo]]*bar
19016 !! html
19017 <ul>
19018 <li>foo*bar
19019 </li>
19020 </ul>
19021 <ul>
19022 <li><i>foo</i>*bar
19023 </li>
19024 </ul>
19025 <ul>
19026 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
19027 </li>
19028 </ul>
19029 <ul>
19030 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
19031 </li>
19032 </ul>
19033 !!end
19034
19035 !! test
19036 Lists: 5. No unnecessary escapes
19037 !! wikitext
19038 * bar <span><nowiki>[[foo]]</nowiki></span>
19039
19040 *=bar <span><nowiki>[[foo]]</nowiki></span>
19041
19042 *[[bar <span><nowiki>[[foo]]</nowiki></span>
19043
19044 *]]bar <span><nowiki>[[foo]]</nowiki></span>
19045
19046 *=bar <span>foo]]</span>=
19047
19048 * <s></s>: a
19049 !! html
19050 <ul><li> bar <span>[[foo]]</span></li></ul>
19051 <ul><li>=bar <span>[[foo]]</span></li></ul>
19052 <ul><li>[[bar <span>[[foo]]</span></li></ul>
19053 <ul><li>]]bar <span>[[foo]]</span></li></ul>
19054 <ul><li>=bar <span>foo]]</span>=</li></ul>
19055 <ul><li> <s></s>: a</li></ul>
19056
19057 !!end
19058
19059 !! test
19060 Lists: 6. Escape bullets in SOL position
19061 !! options
19062 parsoid
19063 !! wikitext
19064 <!--cmt--><nowiki>*foo</nowiki>
19065 !! html
19066 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
19067 !!end
19068
19069 !! test
19070 Lists: 7. Escape bullets in a multi-line context
19071 !! wikitext
19072 a
19073 <nowiki>*</nowiki>b
19074 !! html
19075 <p>a
19076 *b
19077 </p>
19078 !!end
19079
19080 #### --------------- HRs ---------------
19081 #### 1. Single line
19082 #### -----------------------------------
19083
19084 !! test
19085 HRs: 1. Single line
19086 !! options
19087 parsoid
19088 !! wikitext
19089 ----<nowiki>----</nowiki>
19090 ----=foo=
19091 ----*foo
19092 !! html
19093 <hr><span typeof="mw:Nowiki">----</span>
19094 <hr>=foo=
19095 <hr>*foo
19096 !! end
19097
19098 #### --------------- Tables ---------------
19099 #### 1a. Simple example
19100 #### 1b. No escaping needed (!foo)
19101 #### 1c. No escaping needed (|foo)
19102 #### 1d. No escaping needed (|}foo)
19103 ####
19104 #### 2a. Nested in td (<td>foo|bar</td>)
19105 #### 2b. Nested in td (<td>foo||bar</td>)
19106 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
19107 ####
19108 #### 3a. Nested in th (<th>foo!bar</th>)
19109 #### 3b. Nested in th (<th>foo!!bar</th>)
19110 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
19111 ####
19112 #### 4a. Escape -
19113 #### 4b. Escape +
19114 #### 4c. No escaping needed
19115 #### --------------------------------------
19116
19117 !! test
19118 Tables: 1a. Simple example
19119 !! wikitext
19120 <nowiki>{|
19121 |}</nowiki>
19122 !! html
19123 <p>{|
19124 |}
19125 </p>
19126 !! end
19127
19128 !! test
19129 Tables: 1b. No escaping needed
19130 !! wikitext
19131 !foo
19132 !! html
19133 <p>!foo
19134 </p>
19135 !! end
19136
19137 !! test
19138 Tables: 1c. No escaping needed
19139 !! wikitext
19140 |foo
19141 !! html
19142 <p>|foo
19143 </p>
19144 !! end
19145
19146 !! test
19147 Tables: 1d. No escaping needed
19148 !! wikitext
19149 |}foo
19150 !! html
19151 <p>|}foo
19152 </p>
19153 !! end
19154
19155 !! test
19156 Tables: 2a. Nested in td
19157 !! options
19158 parsoid=html2wt
19159 !! wikitext
19160 {|
19161 |<nowiki>foo|bar</nowiki>
19162 |-
19163 |x<div><nowiki>a|b</nowiki></div>
19164 |}
19165 !! html
19166 <table><tbody><tr>
19167 <td>foo|bar</td></tr>
19168 <tr><td>x<div>a|b</div></td>
19169 </tbody></table>
19170 !! end
19171
19172 !! test
19173 Tables: 2b. Nested in td
19174 !! options
19175 parsoid
19176 !! wikitext
19177 {|
19178 |<nowiki>foo||bar</nowiki>
19179 |''it''<nowiki>foo||bar</nowiki>
19180 |}
19181 !! html
19182 <table><tbody><tr>
19183 <td><span typeof="mw:Nowiki">foo||bar</span></td>
19184 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
19185 !! end
19186
19187 !! test
19188 Tables: 2c. Nested in td -- no escaping needed
19189 !! options
19190 parsoid
19191 !! wikitext
19192 {|
19193 |foo!!bar
19194 |}
19195 !! html
19196 <table><tbody><tr><td>foo!!bar
19197 </td></tr></tbody></table>
19198
19199 !! end
19200
19201 !! test
19202 Tables: 3a. Nested in th
19203 !! options
19204 parsoid
19205 !! wikitext
19206 {|
19207 !foo!bar
19208 |}
19209 !! html
19210 <table><tbody><tr><th>foo!bar
19211 </th></tr></tbody></table>
19212
19213 !! end
19214
19215 !! test
19216 Tables: 3b. Nested in th
19217 !! options
19218 parsoid
19219 !! wikitext
19220 {|
19221 !<nowiki>foo!!bar</nowiki>
19222 |}
19223 !! html
19224 <table>
19225 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
19226 </tbody></table>
19227 !! end
19228
19229 !! test
19230 Tables: 3c. Nested in th -- no escaping needed
19231 !! options
19232 parsoid
19233 !! wikitext
19234 {|
19235 !<nowiki>foo||bar</nowiki>
19236 |}
19237 !! html
19238 <table><tbody><tr>
19239 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
19240 !! end
19241
19242 !! test
19243 Tables: 4a. Escape -
19244 !! options
19245 parsoid
19246 !! wikitext
19247 {|
19248 !-bar
19249 |-
19250 |<nowiki>-bar</nowiki>
19251 |}
19252 !! html
19253 <table><tbody>
19254 <tr><th>-bar</th></tr>
19255 <tr>
19256 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
19257 !! end
19258
19259 !! test
19260 Tables: 4b. Escape +
19261 !! options
19262 parsoid
19263 !! wikitext
19264 {|
19265 !+bar
19266 |-
19267 |<nowiki>+bar</nowiki>
19268 |}
19269 !! html
19270 <table><tbody>
19271 <tr><th>+bar</th></tr>
19272 <tr>
19273 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
19274 !! end
19275
19276 !! test
19277 Tables: 4c. No escaping needed
19278 !! options
19279 parsoid
19280 !! wikitext
19281 {|
19282 |foo-bar
19283 |foo+bar
19284 |-
19285 |''foo''-bar
19286 |''foo''+bar
19287 |-
19288 |foo
19289 bar|baz
19290 +bar
19291 -bar
19292 |-
19293 |x
19294 <div>a|b</div>
19295 |}
19296 !! html
19297 <table><tbody>
19298 <tr><td>foo-bar</td><td>foo+bar</td></tr>
19299 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
19300 <tr><td>foo
19301 <p>bar|baz
19302 +bar
19303 -bar</p></td></tr>
19304 <tr><td>x
19305 <div>a|b</div></td>
19306 </tbody></table>
19307 !! end
19308
19309 !! test
19310 Tables: 4d. No escaping needed
19311 !! options
19312 parsoid
19313 !! wikitext
19314 {|
19315 |[[Foo]]-bar
19316 ||+1
19317 ||-2
19318 |}
19319 !! html
19320 <table>
19321 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
19322 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
19323 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
19324 </tbody></table>
19325 !! end
19326
19327 !! test
19328 Tables: Digest broken attributes on table and tr tag
19329 !! options
19330 parsoid=wt2html
19331 !! wikitext
19332 {| || |} ++
19333 |- || || ++ --
19334 |- > [
19335 |}
19336 !! html
19337 <table>
19338 <tbody>
19339 <tr></tr>
19340 <tr></tr>
19341 </tbody></table>
19342 !! end
19343
19344 #### --------------- Links ----------------
19345 #### 1. Quote marks in link text
19346 #### 2. Wikilinks: Escapes needed
19347 #### 3. Wikilinks: No escapes needed
19348 #### 4. Extlinks: Escapes needed
19349 #### 5. Extlinks: No escapes needed
19350 #### --------------------------------------
19351 !! test
19352 Links 1. Quote marks in link text
19353 !! options
19354 parsoid
19355 !! wikitext
19356 [[Foo|Foo<nowiki>''boo''</nowiki>]]
19357 !! html
19358 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
19359 !! end
19360
19361 !! test
19362 Links 2. WikiLinks: Escapes needed
19363 !! options
19364 parsoid
19365 !! wikitext
19366 [[Foo|[Foobar]]]
19367 [[Foo|<nowiki>Foobar]</nowiki>]]
19368 [[Foo|x [Foobar] x]]
19369 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
19370 [[Foo|<nowiki>[[Bar]]</nowiki>]]
19371 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
19372 [[Foo|<nowiki>|Bar</nowiki>]]
19373 [[Foo|<nowiki>]]bar</nowiki>]]
19374 [[Foo|<nowiki>[[bar</nowiki>]]
19375 [[Foo|<nowiki>x [[ y</nowiki>]]
19376 [[Foo|<nowiki>x ]] y</nowiki>]]
19377 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
19378 !! html
19379 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
19380 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
19381 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
19382 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
19383 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
19384 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
19385 <a href="Foo" rel="mw:WikiLink">|Bar</a>
19386 <a href="Foo" rel="mw:WikiLink">]]bar</a>
19387 <a href="Foo" rel="mw:WikiLink">[[bar</a>
19388 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
19389 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
19390 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
19391 !! end
19392
19393 !! test
19394 Links 3. WikiLinks: No escapes needed
19395 !! options
19396 parsoid
19397 !! wikitext
19398 [[Foo|[Foobar]]
19399 [[Foo|foo|bar]]
19400 !! html
19401 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
19402 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
19403 !! end
19404
19405 !! test
19406 Links 4. ExtLinks: Escapes needed
19407 !! options
19408 parsoid
19409 !! wikitext
19410 [http://google.com <nowiki>[google]</nowiki>]
19411 [http://google.com <nowiki>google]</nowiki>]
19412
19413 <nowiki>[http://google.com]</nowiki>
19414
19415 <nowiki>[http://google.com google]</nowiki>
19416
19417 !! html
19418 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
19419 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
19420 <p>[http://google.com]</p>
19421 <p>[http://google.com google]</p>
19422 !! end
19423
19424 !! test
19425 Links 5. ExtLinks: No escapes needed
19426 !! options
19427 parsoid
19428 !! wikitext
19429 [http://google.com [google]
19430 !! html
19431 <a href="http://google.com" rel="mw:ExtLink">[google</a>
19432 !! end
19433
19434 !! test
19435 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
19436 !! html/parsoid
19437 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
19438 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
19439 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
19440 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
19441 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
19442 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
19443 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19444 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
19445 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19446 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
19447 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
19448 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
19449 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
19450 </p>
19451 !! wikitext
19452 x<nowiki/>http://example.com<nowiki/>y
19453 http://example.com<nowiki/>?x
19454 http://example.com<nowiki/>&x
19455 http://example.com<nowiki/>'x
19456 http://example.com<nowiki/>,x
19457 http://example.com<nowiki/>.x
19458 http://example.com<nowiki/>;x
19459 http://example.com<nowiki/>:x
19460 http://example.com<nowiki/>;x
19461 http://example.com<nowiki/>!x
19462 http://example.com<nowiki/>=x
19463 http://example.com<nowiki/>(x)
19464 http://example.com(x<nowiki/>)
19465 !! end
19466
19467 !! test
19468 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19469 !! html/parsoid
19470 <p>x
19471 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
19472 y
19473 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
19474 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
19475 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
19476 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
19477 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
19478 </p>
19479 !! wikitext
19480 x
19481 http://example.com
19482 y
19483 "http://example.com"
19484 (http://example.com)
19485 (http://example.com) foo
19486 http://example.com,
19487 http://example.com, foo
19488 !! end
19489
19490 ## Parsoid currently fails wt2html on this one!
19491 !! test
19492 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19493 !! html/parsoid
19494 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
19495 !! wikitext
19496 http://example.com.,;:!?
19497 !! end
19498
19499 !! test
19500 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
19501 !! html/parsoid
19502 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
19503 !! wikitext
19504 RFC 123<nowiki/>4
19505 !! end
19506
19507 !! test
19508 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
19509 !! html/parsoid
19510 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19511 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19512 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
19513 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
19514 </p>
19515 !! wikitext
19516 xRFC 123y
19517 XRFC 123y
19518 RFC 123?foo
19519 RFC 123&foo
19520 !! end
19521
19522 !! test
19523 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
19524 !! html/parsoid
19525 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
19526 !! wikitext
19527 PMID 123<nowiki/>4
19528 !! end
19529
19530 !! test
19531 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
19532 !! html/parsoid
19533 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19534 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19535 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
19536 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
19537 </p>
19538 !! wikitext
19539 xPMID 123y
19540 XPMID 123y
19541 PMID 123?foo
19542 PMID 123&foo
19543 !! end
19544
19545 !! test
19546 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
19547 !! html/parsoid
19548 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
19549 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
19550 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
19551 </p>
19552 !! wikitext
19553 ISBN 1234567890<nowiki/>1
19554 ISBN 1234567890<nowiki/>x
19555 ISBN 1234567890<nowiki/>b
19556 !! end
19557
19558 !! test
19559 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
19560 !! html/parsoid
19561 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
19562 !! wikitext
19563 ISBN 1234567890's
19564 !! end
19565
19566 #### --------------- Quotes ---------------
19567 #### 1. Quotes inside <b> and <i>
19568 #### 2. Link fragments separated by <i> and <b> tags
19569 #### 3. Link fragments inside <i> and <b>
19570 #### 4. No escaping needed
19571 #### --------------------------------------
19572 !! test
19573 1. Quotes inside <b> and <i>
19574 !! options
19575 parsoid=html2wt,wt2wt
19576 !! wikitext
19577 ''<nowiki>'foo'</nowiki>''
19578 ''<nowiki>''foo''</nowiki>''
19579 ''<nowiki>'''foo'''</nowiki>''
19580 ''foo''<nowiki/>'s
19581 '''<nowiki>'foo'</nowiki>'''
19582 '''<nowiki>''foo''</nowiki>'''
19583 '''<nowiki>'''foo'''</nowiki>'''
19584 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
19585 '''foo'''<nowiki/>'s
19586 '''foo''
19587 ''foo''<nowiki/>'
19588 '<nowiki/>''foo''<nowiki/>'
19589 ''''foo'''
19590 '''foo'''<nowiki/>'
19591 '<nowiki/>'''foo'''<nowiki/>'
19592 ''fools'<span> errand</span>''
19593 ''<span>fool</span>'s errand''
19594 !! html
19595 <p><i>'foo'</i>
19596 <i>''foo''</i>
19597 <i>'''foo'''</i>
19598 <i>foo</i>'s
19599 <b>'foo'</b>
19600 <b>''foo''</b>
19601 <b>'''foo'''</b>
19602 <b>foo'<i>bar'</i>baz</b>
19603 <b>foo</b>'s
19604 '<i>foo</i>
19605 <i>foo</i>'
19606 '<i>foo</i>'
19607 '<b>foo</b>
19608 <b>foo</b>'
19609 '<b>foo</b>'</p>
19610 <i>fools'<span> errand</span></i>
19611 <i><span>fool</span>'s errand</i>
19612 !! end
19613
19614 !! test
19615 2. Link fragments separated by <i> and <b> tags
19616 !! wikitext
19617 [[''foo''<nowiki>hello]]</nowiki>
19618
19619 [['''foo'''<nowiki>hello]]</nowiki>
19620 !! html
19621 <p>[[<i>foo</i>hello]]
19622 </p><p>[[<b>foo</b>hello]]
19623 </p>
19624 !! end
19625
19626 !! test
19627 3. Link fragments inside <i> and <b>
19628 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
19629 this is one of the shortcomings of this format)
19630 !! wikitext
19631 ''[[foo''<nowiki>]]</nowiki>
19632
19633 '''[[foo'''<nowiki>]]</nowiki>
19634 !! html
19635 <p><i>[[foo</i>]]
19636 </p><p><b>[[foo</b>]]
19637 </p>
19638 !! end
19639
19640 !! test
19641 4. No escaping needed
19642 !! wikitext
19643 '<span>''bar''</span>'
19644 '<span>'''bar'''</span>'
19645 !! html
19646 <p>'<span><i>bar</i></span>'
19647 '<span><b>bar</b></span>'
19648 </p>
19649 !! end
19650
19651 #### ----------- Paragraphs ---------------
19652 #### 1. No unnecessary escapes
19653 #### --------------------------------------
19654
19655 !! test
19656 1. No unnecessary escapes
19657 !! wikitext
19658 bar <span><nowiki>[[foo]]</nowiki></span>
19659
19660 =bar <span><nowiki>[[foo]]</nowiki></span>
19661
19662 [[bar <span><nowiki>[[foo]]</nowiki></span>
19663
19664 ]]bar <span><nowiki>[[foo]]</nowiki></span>
19665
19666 =bar <span>foo]]</span><nowiki>=</nowiki>
19667 !! html
19668 <p>bar <span>[[foo]]</span>
19669 </p><p>=bar <span>[[foo]]</span>
19670 </p><p>[[bar <span>[[foo]]</span>
19671 </p><p>]]bar <span>[[foo]]</span>
19672 </p><p>=bar <span>foo]]</span>=
19673 </p>
19674 !!end
19675
19676 #### ----------------------- PRE --------------------------
19677 #### 1. Leading whitespace in SOL context should be escaped
19678 #### ------------------------------------------------------
19679 !! test
19680 1. Leading whitespace in SOL context should be escaped
19681 !! options
19682 parsoid
19683 !! wikitext
19684 <nowiki> </nowiki>a
19685
19686 <nowiki> </nowiki> a
19687
19688 <nowiki> </nowiki>a(tab)
19689
19690 <nowiki> </nowiki> a
19691 <!--cmt-->
19692 <nowiki> </nowiki> a
19693
19694 a
19695 <nowiki> </nowiki>b
19696
19697 a
19698 <nowiki> </nowiki>b
19699
19700 a
19701 <nowiki> </nowiki> b
19702 !! html
19703 <p> a</p>
19704 <p> a</p>
19705 <p> a(tab)</p>
19706 <p> a</p>
19707 <p><!--cmt--> a</p>
19708 <p>a
19709 b</p>
19710 <p>a
19711 b</p>
19712 <p>a
19713 b</p>
19714 !! end
19715
19716 !! test
19717 2. Leading whitespace in non-indent-pre contexts should not be escaped
19718 !! options
19719 parsoid
19720 !! wikitext
19721 foo <ref>''a''
19722 b</ref>
19723 !! html
19724 <p>foo <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[9,14,2,2]}&#39;>a&lt;/i>\n b"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
19725 !! end
19726
19727 !! test
19728 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
19729 !! options
19730 parsoid
19731 !! wikitext
19732 <blockquote>
19733 a
19734 <span>b</span>
19735 c
19736 </blockquote>
19737 !! html
19738 <blockquote>
19739 <p>
19740 a
19741 <span>b</span>
19742 c</p>
19743 </blockquote>
19744 !! end
19745
19746 !! test
19747 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
19748 !! options
19749 parsoid
19750 !! wikitext
19751 [[File:Foobar.jpg|thumb|caption]]
19752 !! html
19753 !! html/parsoid
19754 <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>
19755 !! end
19756
19757 !! test
19758 5. Nowiki escaping should account for indent-pres
19759 !! options
19760 parsoid=html2wt
19761 !! html
19762 <pre>==foo==</pre>
19763 !! wikitext
19764 ==foo==
19765 !! end
19766
19767 #### --------------- Behavior Switches --------------------
19768 !! test
19769 1. Valid behavior switches should be escaped
19770 !! options
19771 parsoid=html2wt
19772 !! wikitext
19773 <nowiki>__TOC__</nowiki>
19774 ''<nowiki>__TOC__</nowiki>''
19775 !! html
19776 __TOC__
19777 <i>__TOC__</i>
19778 !! end
19779
19780 !! test
19781 2. Invalid behavior switches should not be escaped
19782 !! options
19783 parsoid=html2wt
19784 !! wikitext
19785 __TOO__
19786 __|__
19787 !! html
19788 __TOO__
19789 __|__
19790 !! end
19791
19792 #### --------------- HTML tags ---------------
19793 #### 1. a tags
19794 #### 2. other tags
19795 #### 3. multi-line html tag
19796 #### 4. extension tags
19797 #### -----------------------------------------
19798 !! test
19799 1. a tags
19800 !! options
19801 parsoid
19802 !! wikitext
19803 <a href="http://google.com">google</a>
19804 !! html
19805 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
19806 !! end
19807
19808 !! test
19809 2. other tags
19810 !! wikitext
19811 <nowiki><div>foo</div>
19812 <div style="color:red">foo</div></nowiki>
19813 !! html
19814 <p>&lt;div&gt;foo&lt;/div&gt;
19815 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
19816 </p>
19817 !! end
19818
19819 !! test
19820 3. multi-line html tag
19821 !! wikitext
19822 <nowiki><div
19823 >foo</div
19824 ></nowiki>
19825 !! html
19826 <p>&lt;div
19827 &gt;foo&lt;/div
19828 &gt;
19829 </p>
19830 !! end
19831
19832 !! test
19833 4. extension tags
19834 !! wikitext
19835 <nowiki><ref>foo</ref></nowiki>
19836
19837 <nowiki><ref>bar</nowiki>
19838
19839 baz<nowiki></ref></nowiki>
19840 !! html
19841 <p>&lt;ref&gt;foo&lt;/ref&gt;
19842 </p><p>&lt;ref&gt;bar
19843 </p><p>baz&lt;/ref&gt;
19844 </p>
19845 !! end
19846
19847 #### --------------- Others ---------------
19848 !! test
19849 Escaping nowikis
19850 !! wikitext
19851 &lt;nowiki&gt;foo&lt;/nowiki&gt;
19852 !! html
19853 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
19854 </p>
19855 !! end
19856
19857 ## The quote-char in the input is necessary for triggering the bug
19858 !! test
19859 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
19860 !! options
19861 parsoid=wt2wt,html2wt
19862 !! wikitext
19863 foo's bar :
19864 !! html
19865 <p>foo's bar :</p>
19866 !! end
19867
19868 !! test
19869
19870 Tag-like HTML structures are passed through as text
19871 !! wikitext
19872 <x y>
19873
19874 <x.y>
19875
19876 <x-y>
19877
19878 1>2
19879
19880 x<y
19881
19882 a>b
19883
19884 1<d e>f
19885 !! html
19886 <p>&lt;x y&gt;
19887 </p><p>&lt;x.y&gt;
19888 </p><p>&lt;x-y&gt;
19889 </p><p>1&gt;2
19890 </p><p>x&lt;y
19891 </p><p>a&gt;b
19892 </p><p>1&lt;d e&gt;f
19893 </p>
19894 !! end
19895
19896
19897 # This was a bug in the PHP parser (see bug 17663 and its dups,
19898 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
19899 !! test
19900 Tag names followed by punctuation should not be recognized as tags
19901 !! wikitext
19902 <s.ome> text
19903 !! html
19904 <p>&lt;s.ome&gt; text
19905 </p>
19906 !! end
19907
19908 !! test
19909 HTML tag with necessary entities in attributes
19910 !! wikitext
19911 <span title="&amp;amp;">foo</span>
19912 !! html
19913 <p><span title="&amp;amp;">foo</span>
19914 </p>
19915 !! end
19916
19917 !! test
19918 HTML tag with 'unnecessary' entity encoding in attributes
19919 !! wikitext
19920 <span title="&amp;">foo</span>
19921 !! html
19922 <p><span title="&amp;">foo</span>
19923 </p>
19924 !! end
19925
19926 !! test
19927 HTML tag with broken attribute value quoting
19928 !! wikitext
19929 <span title="Hello world>Foo</span>
19930 !! html
19931 <p><span>Foo</span>
19932 </p>
19933 !! end
19934
19935 !! test
19936 Parsoid-only: HTML tag with broken attribute value quoting
19937 !! options
19938 parsoid
19939 !! wikitext
19940 <span title="Hello world>Foo</span>
19941 !! html
19942 <p><span title="Hello world">Foo</span>
19943 </p>
19944 !! end
19945
19946 !! test
19947 Table with broken attribute value quoting
19948 !! wikitext
19949 {|
19950 | title="Hello world|Foo
19951 |}
19952 !! html
19953 <table>
19954 <tr>
19955 <td>Foo
19956 </td></tr></table>
19957
19958 !! end
19959
19960 !! test
19961 Table with broken attribute value quoting on consecutive lines
19962 !! wikitext
19963 {|
19964 | title="Hello world|Foo
19965 | style="color:red|Bar
19966 |}
19967 !! html
19968 <table>
19969 <tr>
19970 <td>Foo
19971 </td>
19972 <td>Bar
19973 </td></tr></table>
19974
19975 !! end
19976
19977 !! test
19978 Parsoid-only: Table with broken attribute value quoting on consecutive lines
19979 !! options
19980 parsoid
19981 !! wikitext
19982 {|
19983 | title="Hello world|Foo
19984 | style="color:red|Bar
19985 |}
19986 !! html
19987 <table><tbody>
19988 <tr>
19989 <td title="Hello world">Foo
19990 </td><td style="color: red">Bar
19991 </td></tr></tbody></table>
19992
19993 !! end
19994
19995 !! test
19996 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19997 !! options
19998 parsoid
19999 !! wikitext
20000 {{}}
20001 !! html
20002 {{}}
20003 !! end
20004
20005 !! test
20006 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
20007 !! options
20008 parsoid
20009 !! wikitext
20010 }}{{
20011 !! html
20012 }}{{
20013 !! end
20014
20015 !!test
20016 Accept empty td cell attribute
20017 !! wikitext
20018 {|
20019 | align="center" | foo || |
20020 |}
20021 !! html
20022 <table>
20023 <tr>
20024 <td align="center"> foo </td>
20025 <td>
20026 </td></tr></table>
20027
20028 !!end
20029
20030 !!test
20031 Non-empty attributes in th-cells
20032 !! wikitext
20033 {|
20034 ! Foo !! style="color: red" | Bar
20035 |}
20036 !! html
20037 <table>
20038 <tr>
20039 <th> Foo </th>
20040 <th style="color: red"> Bar
20041 </th></tr></table>
20042
20043 !!end
20044
20045 !!test
20046 Accept empty attributes in th-cells
20047 !! wikitext
20048 {|
20049 !| foo !!| bar
20050 |}
20051 !! html
20052 <table>
20053 <tr>
20054 <th> foo </th>
20055 <th> bar
20056 </th></tr></table>
20057
20058 !!end
20059
20060 !!test
20061 Empty table rows go away
20062 !! wikitext
20063 {|
20064 | Hello
20065 | there
20066 |- class="foo"
20067 |-
20068 |}
20069 !! html
20070 <table>
20071 <tr>
20072 <td> Hello
20073 </td>
20074 <td> there
20075 </td></tr>
20076
20077 </table>
20078
20079 !! end
20080
20081 ###
20082 ### Parsoid-centric tests for testing RTing of inter-element separators
20083 ### Edge cases not tested by existing parser tests and specific to
20084 ### Parsoid-specific serialization strategies.
20085 ###
20086
20087 !!test
20088 RT-ed inter-element separators should be valid separators
20089 !! wikitext
20090 {|
20091 |- [[foo]]
20092 |}
20093 !! html
20094 <table>
20095
20096 </table>
20097
20098 !!end
20099
20100 !!test
20101 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
20102 (Parsoid-only since PHP parser relies on Tidy for correct output)
20103 !!options
20104 parsoid
20105 !! wikitext
20106 {|
20107 |<small>foo
20108 bar
20109 |}
20110
20111 {|
20112 |<small>foo<small>
20113 |}
20114 !! html
20115 !!end
20116
20117 !!test
20118 Empty TD followed by TD with tpl-generated attribute
20119 !! wikitext
20120 {|
20121 |-
20122 |
20123 |{{echo|style='color:red'}}|foo
20124 |}
20125 !! html
20126 <table>
20127
20128 <tr>
20129 <td>
20130 </td>
20131 <td>foo
20132 </td></tr></table>
20133
20134 !!end
20135
20136 !!test
20137 Indented table with an empty td
20138 !! wikitext
20139 {|
20140 |-
20141 |
20142 |foo
20143 |}
20144 !! html
20145 <table>
20146
20147 <tr>
20148 <td>
20149 </td>
20150 <td>foo
20151 </td></tr></table>
20152
20153 !!end
20154
20155 !!test
20156 Indented block & table
20157 !! wikitext
20158 <div>foo</div>
20159 {|
20160 |foo
20161 |}
20162 !! html/parsoid
20163 <div data-parsoid='{"stx":"html"}'>foo</div>
20164 <table><tbody>
20165 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
20166 </tbody></table>
20167 !!end
20168
20169 !! test
20170 Indent and comment before table row
20171 !! wikitext
20172 {|
20173 <!--hi-->|-
20174 | there
20175 |}
20176 !! html/parsoid
20177 <table data-parsoid='{}'>
20178 <!--hi--><tbody data-parsoid='{}'><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
20179 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
20180 </tbody></table>
20181 !! end
20182
20183 !!test
20184 Empty TR followed by a template-generated TR
20185 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
20186 !!options
20187 parsoid
20188 !! wikitext
20189 {|
20190 |-
20191 {{echo|<tr><td>foo</td></tr>}}
20192 |}
20193 !! html
20194 <table>
20195 <tbody>
20196 <tr></tr>
20197 <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}}]}'>
20198 <td>foo</td></tr>
20199 </tbody></table>
20200 !!end
20201
20202 ## PHP and parsoid output differ for this, and since this is primarily
20203 ## for testing Parsoid's serializer, marking this Parsoid only
20204 !!test
20205 Empty TR followed by mixed-ws-comment line should RT correctly
20206 !!options
20207 parsoid
20208 !! wikitext
20209 {|
20210 |-
20211 <!--c-->
20212 |-
20213 <!--c--> <!--d-->
20214 |}
20215 !! html
20216 <table>
20217 <tbody>
20218 <tr></tr>
20219 <!--c-->
20220 <tr>
20221 <!--c--> </tr><!--d-->
20222 </tbody></table>
20223
20224 !!end
20225
20226 !!test
20227 Multi-line image caption generated by templates with/without trailing newlines
20228 !!options
20229 parsoid
20230 !! wikitext
20231 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
20232 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
20233 !! html
20234 <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>
20235 <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>
20236
20237 !!end
20238
20239 !! test
20240 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
20241 !! options
20242 parsoid=html2wt
20243 !! wikitext
20244 <includeonly>foo</includeonly>
20245 new para
20246
20247 [[./Category:Foo]]
20248
20249 = new heading =
20250 !! html
20251 <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>
20252
20253 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
20254 !! end
20255
20256 ## PHP emits broken html for this, and since this is primarily
20257 ## a Parsoid serializer test, marking this Parsoid only
20258 !!test
20259 Improperly nested inline or quotes tags with whitespace in between
20260 !!options
20261 parsoid
20262 !! wikitext
20263 <span> <s>x</span> </s>
20264 ''' ''x''' ''
20265 !! html
20266 <p><span> <s>x</s></span><s> </s>
20267 <b> <i>x</i></b><i> </i>
20268 </p>
20269 !!end
20270
20271 !!test
20272 Encapsulate protected attributes from wt
20273 !!options
20274 parsoid
20275 !! wikitext
20276 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
20277 !! html
20278 <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>
20279 </body>
20280 !!end
20281
20282 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
20283 ## Having nested or stray pre tags results in the attempt to add duplicates,
20284 ## causing an assertion fail. This test tries to prevent that situation.
20285 !!test
20286 Ensure ParagraphWrapper can deal with stray closing pre tags
20287 !!options
20288 parsoid=wt2html
20289 !! wikitext
20290 plain text</pre>
20291 !! html
20292 plain text
20293 !!end
20294
20295 !!test
20296 1. Ensure fostered text content is wrapped in spans
20297 !!options
20298 parsoid=wt2html
20299 !! wikitext
20300 <table>hi</table><table>ho</table>
20301 !! html
20302 <span>hi</span>
20303 <table></table>
20304 <span>ho</span>
20305 <table></table>
20306 !!end
20307
20308 !!test
20309 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
20310 !!options
20311 parsoid=wt2html,wt2wt
20312 !! wikitext
20313 <table>
20314 <tr> || ||
20315 <td> a
20316 </table>
20317 !! html
20318 <span> || ||</span>
20319 <table>
20320 <tbody>
20321 <tr>
20322 <td> a</td></tr>
20323 </tbody></table>
20324 !!end
20325
20326 !!test
20327 Encapsulation properly handles null DSR information from foster box
20328 !!options
20329 parsoid=wt2html,wt2wt
20330 !! wikitext
20331 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
20332 !! html
20333 <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;
20334 <table>foo
20335 <tr>
20336 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
20337 <table>
20338 <tbody>
20339 <tr>
20340 <td>bar</td></tr></tbody></table>
20341 !!end
20342
20343 !!test
20344 1. Encapsulate foster-parented transclusion content
20345 !!options
20346 parsoid=wt2wt,wt2html
20347 !! wikitext
20348 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
20349 !! html
20350 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20351 <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
20352 <tr>
20353 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
20354 <table>
20355 <tbody>
20356 <tr>
20357 <td>bar</td></tr></tbody></table>
20358 !!end
20359
20360 !!test
20361 2. Encapsulate foster-parented transclusion content
20362 !!options
20363 parsoid=wt2wt,wt2html
20364 !! wikitext
20365 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
20366 !! html
20367 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20368 <table>
20369 <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>
20370 <tr>
20371 <td>bar</td></tr></table>&quot;]}">foo</div>
20372 <table>
20373 <tbody>
20374 <tr>
20375 <td>bar</td></tr></tbody></table>
20376 !!end
20377
20378 !!test
20379 3. Encapsulate foster-parented transclusion content
20380 !!options
20381 parsoid=wt2wt,wt2html
20382 !! wikitext
20383 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20384 !! html
20385 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20386 <table>
20387 <div>
20388 <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>
20389 <tr>
20390 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20391 <p>foo</p></div>
20392 <table>
20393 <tbody>
20394 <tr>
20395 <td>bar</td></tr></tbody></table>
20396 !!end
20397
20398 !!test
20399 4. Encapsulate foster-parented transclusion content
20400 !!options
20401 parsoid=wt2wt,wt2html
20402 !! wikitext
20403 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20404 !! html
20405 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20406 <table>
20407 <div>
20408 <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>
20409 <tr>
20410 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20411 <p>foo</p></div>
20412 <table>
20413 <tbody>
20414 <tr>
20415 <td>bar</td></tr></tbody></table>
20416 !!end
20417
20418 !!test
20419 5. Encapsulate foster-parented transclusion content
20420 !!options
20421 parsoid=wt2wt,wt2html
20422 !! wikitext
20423 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
20424 !! html
20425 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20426 <table>
20427 <tr>
20428 <td>
20429 <div>
20430 <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>
20431 <table>
20432 <tbody>
20433 <tr>
20434 <td>
20435 <div>
20436 <p>foo</p></div></td></tr></tbody></table>
20437 !!end
20438
20439 !!test
20440 6. Encapsulate foster-parented transclusion content
20441 !!options
20442 parsoid=wt2wt,wt2html
20443 !! wikitext
20444 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
20445 !! html
20446 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20447 <table>
20448 <tr>
20449 <td>
20450 <div>
20451 <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>
20452 <table>
20453 <tbody>
20454 <tr>
20455 <td>
20456 <div>
20457 <p>foo</p></div></td></tr></tbody></table>
20458 <p>ok</p>
20459 !!end
20460
20461 !!test
20462 7. Encapsulate foster-parented transclusion content
20463 !!options
20464 parsoid=wt2wt,wt2html
20465 !! wikitext
20466 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
20467 !! html
20468 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20469 <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;
20470 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
20471 <td>bar</td></table>&quot;]}">foo</p>
20472 <table>
20473 <tbody>
20474 <tr>
20475 <td>bar</td></tr></tbody></table>
20476 !!end
20477
20478 !!test
20479 8. Encapsulate foster-parented transclusion content
20480 !!options
20481 parsoid=wt2wt,wt2html
20482 !! wikitext
20483 {{echo|a
20484 }}{|{{echo|style='color:red'}}
20485 |-
20486 |b
20487 |}
20488 !! html
20489 <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>
20490 <table>
20491 <tbody>
20492 <tr>
20493 <td>b</td></tr></tbody></table>
20494 !!end
20495
20496 !!test
20497 9. Encapsulate foster-parented transclusion content
20498 !!options
20499 parsoid=wt2wt,wt2html
20500 !! wikitext
20501 <table>{{echo|hi</table>hello}}
20502 !! html
20503 <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>
20504 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
20505 !!end
20506
20507 !!test
20508 Table in fosterable position
20509 !!options
20510 parsoid=wt2html,wt2wt
20511 !! wikitext
20512 {{OpenTable}}
20513 <div>
20514 {|
20515 |}
20516 </div>
20517 |}
20518 !! html
20519 <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="{}">
20520 </span>
20521 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
20522
20523 <table>
20524 </table>
20525 !!end
20526
20527 # Parsoid only for bug 64747
20528 !! test
20529 Properly encapsulate empty-content transclusions in fosterable positions
20530 !! wikitext
20531 <table>
20532 {{#if:|
20533 <td>foo</td>
20534 }}
20535 </table>
20536 !! html/parsoid
20537 <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>"}'>
20538
20539 </table>
20540 !! end
20541
20542 !!test
20543 Support <object> element with .data attribute
20544 !!options
20545 parsoid=html2wt
20546 !! wikitext
20547 <object data="test.swf"></object>
20548 !! html
20549 <object data="test.swf"></object>
20550 !!end
20551
20552 # -----------------------------------------------------------------
20553 # The following section of tests are primarily to spec requirements
20554 # around serialization of new/edited content.
20555 #
20556 # All these tests are marked Parsoid html2wt and html2html only
20557 # ----------------------------------------------------------------
20558
20559 !! test
20560 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
20561 !! options
20562 parsoid=html2wt
20563 language=es
20564 !! wikitext
20565 [[Foo]]
20566 !! html
20567 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Foo">Foo</a></p>
20568 !! end
20569
20570 !! test
20571 Image: Modifying size of an image (1)
20572 !! options
20573 parsoid={
20574 "modes": ["wt2wt"],
20575 "changes": [
20576 ["img[height]", "attr", "height", "22"],
20577 ["img[width]", "attr", "width", "200"]
20578 ]
20579 }
20580 !! wikitext
20581 [[Image:Foobar.jpg|230x230px]]
20582 !! wikitext/edited
20583 [[Image:Foobar.jpg|200x200px]]
20584 !!end
20585
20586 !! test
20587 Image: Modifying size of an image (2)
20588 !! options
20589 parsoid={
20590 "modes": ["wt2wt"],
20591 "changes": [
20592 ["img[height]", "attr", "height", "100"],
20593 ["img[width]", "attr", "width", "500"]
20594 ]
20595 }
20596 !! wikitext
20597 [[Image:Foobar.jpg|230x230px]]
20598 !! wikitext/edited
20599 [[Image:Foobar.jpg|500x500px]]
20600 !!end
20601
20602 # Change in size is ignored so long as class='mw-default-size'
20603 !! test
20604 Image: Modifying size of an image (3)
20605 !! options
20606 parsoid={
20607 "modes": ["wt2wt"],
20608 "changes": [
20609 ["figure[class]", "removeClass", "mw-default-size"],
20610 ["figure img", "attr", "height", "19"],
20611 ["figure img", "attr", "width", "170"]
20612 ]
20613 }
20614 !! wikitext
20615 [[Image:Foobar.jpg|thumb]]
20616 !! wikitext/edited
20617 [[Image:Foobar.jpg|thumb|170x170px]]
20618 !!end
20619
20620 !! test
20621 Image: Modifying alignment of an image (bug 48665)
20622 !! options
20623 parsoid={
20624 "modes": ["wt2wt"],
20625 "changes": [
20626 ["figure[class]", "removeClass", "mw-halign-right"],
20627 ["figure[class]", "addClass", "mw-halign-left"]
20628 ]
20629 }
20630 !! wikitext
20631 [[Image:Foobar.jpg|thumb|caption|right]]
20632 !! wikitext/edited
20633 [[Image:Foobar.jpg|thumb|caption|left]]
20634 !! end
20635
20636 !! test
20637 Image: Modifying mw-default-size of an frameless image (bug 62805)
20638 !! options
20639 parsoid={
20640 "modes": ["wt2wt"],
20641 "changes": [
20642 ["figure.mw-default-size", "removeClass", "mw-default-size"]
20643 ]
20644 }
20645 !! wikitext
20646 [[Image:Foobar.jpg|frameless|right]]
20647 !! wikitext/edited
20648 [[Image:Foobar.jpg|frameless|right|220x220px]]
20649 !! end
20650
20651 !! test
20652 Image: Modifying valign of an image (bug 49221)
20653 !! options
20654 parsoid={
20655 "modes": ["wt2wt"],
20656 "changes": [
20657 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
20658 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
20659 ]
20660 }
20661 !! wikitext
20662 [[File:Foobar.jpg|20px|middle]]
20663 !! wikitext/edited
20664 [[File:Foobar.jpg|20px|text-top]]
20665 !! end
20666
20667 !! test
20668 Image: Modifying alt attribute of an image (bug 56400)
20669 !! options
20670 parsoid={
20671 "modes": ["wt2wt"],
20672 "changes": [
20673 ["img[alt]", "attr", "alt", "some alternate edited text"]
20674 ]
20675 }
20676 !! wikitext
20677 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
20678 !! wikitext/edited
20679 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
20680 !!end
20681
20682 !! test
20683 Image: Modifying caption of an image
20684 !! options
20685 parsoid={
20686 "modes": ["wt2wt"],
20687 "changes": [
20688 ["figcaption", "text", "new caption"]
20689 ]
20690 }
20691 !! wikitext
20692 [[Image:Foobar.jpg|thumb|original caption]]
20693 !! wikitext/edited
20694 [[Image:Foobar.jpg|thumb|new caption]]
20695 !!end
20696
20697 !! test
20698 Image: empty alt attribute (bug 48924)
20699 !! options
20700 parsoid
20701 !! wikitext
20702 [[File:Foobar.jpg|thumb|alt=|bar]]
20703 !! html
20704 <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>
20705 !! end
20706
20707 #!! test
20708 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
20709 #!! options
20710 #parsoid=html2wt
20711 #language=ar
20712 #!! input
20713 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
20714 #!! result
20715 #<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>
20716 #!! end
20717
20718 !! test
20719 Image: Block level image should have \n before and after
20720 !! options
20721 parsoid
20722 !! wikitext
20723 123
20724 [[File:Foobar.jpg|right|thumb|150x150px]]
20725 456
20726 !! html
20727 <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>
20728 !!end
20729
20730 !! test
20731 Image: New block level image should have \n before and after (existing
20732 content)
20733 !! options
20734 parsoid
20735 !! wikitext
20736 123
20737 [[File:Foobar.jpg|right|thumb|150x150px]]
20738 456
20739 !! html
20740 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
20741 <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>
20742 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
20743 !!end
20744
20745 !! test
20746 Image: upright option (parsoid)
20747 !! options
20748 parsoid
20749 !! wikitext
20750 [[File:Foobar.jpg|thumb|upright|caption]]
20751 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
20752 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
20753 !! html
20754 <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>
20755 !!end
20756
20757 !! test
20758 Image: upright option is ignored on inline and frame images (parsoid)
20759 !! options
20760 parsoid
20761 !! wikitext
20762 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
20763 !! html
20764 <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>
20765 !!end
20766
20767 !! test
20768 Image: from basic HTML (1)
20769 !! options
20770 parsoid=html2wt
20771 !! html/parsoid
20772 <span typeof="mw:Image">
20773 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20774 </span>
20775 !! wikitext
20776 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20777 !! end
20778
20779 !! test
20780 Image: from basic HTML (2)
20781 !! options
20782 parsoid=html2wt
20783 !! html/parsoid
20784 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20785 !! wikitext
20786 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20787 !! end
20788
20789 !! test
20790 Image: from basic HTML (3)
20791 !! options
20792 parsoid=html2wt
20793 !! html/parsoid
20794 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
20795 !! wikitext
20796 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
20797 !! end
20798
20799 !! test
20800 Image: from basic HTML (4)
20801 !! options
20802 parsoid=html2wt
20803 !! html/parsoid
20804 <img src="File:Foobar.jpg">
20805 !! wikitext
20806 [[File:Foobar.jpg|link=]]
20807 !! end
20808
20809 !! test
20810 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
20811 !! options
20812 parsoid=html2wt
20813 !! wikitext
20814 * foo
20815 !! html
20816 <ul>
20817 <li><p>foo</p></li>
20818 </ul>
20819 !! end
20820
20821 !! test
20822 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
20823 !! options
20824 parsoid=html2wt
20825 !! wikitext
20826 * foo
20827 !! html
20828 <ul> <li>foo</li></ul>
20829 !! end
20830
20831 !! test
20832 Don't strip leading whitespace when handling indent-pre suppressing tags
20833 !! options
20834 parsoid=html2wt
20835 !! wikitext
20836 {|
20837 | indented row
20838 |}
20839 <blockquote>
20840 '''This is very bold of you!'''
20841
20842 {|
20843 |
20844 indented cell (no pre-wrapping!)
20845 |}
20846 </blockquote>
20847 foo
20848 <div>bar</div>
20849 !! html
20850 <table>
20851 <tr><td> indented row</td></tr>
20852 </table>
20853 <blockquote><p>
20854 <b>This is very bold of you!</b>
20855 </p>
20856 <table><tr><td>
20857 indented cell (no pre-wrapping!)
20858 </td></tr></table>
20859 </blockquote>
20860 <p>foo</p>
20861 <div>bar</div>
20862 !! end
20863
20864 !! test
20865 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
20866 !! options
20867 parsoid=html2wt
20868 !! wikitext
20869 foo
20870 <nowiki> </nowiki><span>bar</span>
20871
20872 <span>foo2
20873 <nowiki> </nowiki></span>bar2
20874
20875 <div>foo</div>
20876 <nowiki> </nowiki><span>bar</span>
20877
20878 <div>
20879 <nowiki> </nowiki><span>foo</span>
20880 </div>
20881 !! html
20882 <p>foo</p>
20883 <span>bar</span>
20884
20885 <span>foo2
20886 </span>bar2
20887
20888 <div>foo</div>
20889 <span>bar</span>
20890
20891 <div>
20892 <span>foo</span>
20893 </div>
20894 !! end
20895
20896 !! test
20897 Lists: Add space after bullets
20898 !! options
20899 parsoid=html2wt
20900 !! wikitext
20901 * foo
20902 * bar
20903 * <span> baz</span>
20904 !! html
20905 <ul>
20906 <li>foo</li>
20907 <li> bar</li>
20908 <li><span> baz</span></li>
20909 </ul>
20910 !! end
20911
20912 !! test
20913 Lists: Dont insert newlines in a serialized list item.
20914 !! options
20915 parsoid=html2wt
20916 !! wikitext
20917 * a<br>b
20918 * c
20919 !! html
20920 <ul><li>a<br>b</li><li>c</li></ul>
20921 !! end
20922
20923 !! test
20924 Headings: Add space before/after == (Bug 51744)
20925 !! options
20926 parsoid=html2wt
20927 !! wikitext
20928 == foo ==
20929
20930 == bar ==
20931
20932 == baz ==
20933
20934 == <span> baz</span> ==
20935 !! html
20936 <h2>foo</h2>
20937 <h2> bar</h2>
20938 <h2>baz </h2>
20939 <h2><span> baz</span></h2>
20940 !! end
20941
20942 !! test
20943 Parsoid: Serialize positional parameters with = in them as named parameter
20944 !! options
20945 parsoid=html2wt
20946 !! wikitext
20947 {{echo|1 = f=oo}}
20948
20949 {{echo|1 = f=oo|2 = bar}}
20950
20951 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20952 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20953 {{echo|<nowiki>f=oo</nowiki>|bar}}
20954 !! html
20955 <p about="#mwt1" typeof="mw:Transclusion"
20956 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
20957
20958 <p about="#mwt1" typeof="mw:Transclusion"
20959 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
20960
20961 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20962 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20963 <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>
20964 !! end
20965
20966 !! test
20967 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
20968 !! options
20969 parsoid=html2wt
20970 !! wikitext
20971 <div>a
20972 b
20973 </div>
20974 <div>a
20975 b
20976 </div>
20977 <div>
20978 a
20979
20980 b
20981 </div>
20982 !! html
20983 <div>a<p>b</p></div>
20984 <div>a
20985 <p>b</p></div>
20986 <div>
20987 a
20988 <p>b</p></div>
20989 !! end
20990
20991 !! test
20992 Substrings resembling wikitext in hrefs should not get nowiki escapes
20993 !! options
20994 parsoid=html2wt
20995 !! wikitext
20996 [[Foo''bar''baz]]
20997 !! html
20998 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
20999 !! end
21000
21001 #-----------------------------
21002 # I/B quote minimization tests
21003 #-----------------------------
21004
21005 !! test
21006 1. I/B quote minimization: wikitext-only tags should be combined
21007 !! options
21008 parsoid=html2wt
21009 !! wikitext
21010 ''AB''
21011
21012 '''AB'''
21013
21014 ''A'''B'''''
21015
21016 '''A''B'''''
21017
21018 '''A''BC''D'''
21019
21020 '''''AB'''''
21021
21022 '''''AB'''''
21023
21024 '''''AB'''''
21025 !! html
21026 <p><i>A</i><i>B</i></p>
21027 <p><b>A</b><b>B</b></p>
21028 <p><i>A</i><b><i>B</i></b></p>
21029 <p><b>A</b><i><b>B</b></i></p>
21030 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
21031 <p><i><b>A</b></i><i><b>B</b></i></p>
21032 <p><i><b>A</b></i><b><i>B</i></b></p>
21033 <p><b><i>A</i></b><i><b>B</b></i></p>
21034 !! end
21035
21036 !! test
21037 2. I/B quote minimization: wikitext and html tags should not be combined
21038 !! options
21039 parsoid=html2wt
21040 !! wikitext
21041 ''A''<i>B</i>
21042
21043 ''A'''''<i>B</i>'''
21044 !! html
21045 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
21046 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
21047 !! end
21048
21049 !! test
21050 3. I/B quote minimization: templated content stops minimization
21051 !! options
21052 parsoid=html2wt
21053 !! wikitext
21054 ''A''{{echo|''B''}}
21055
21056 ''A''{{echo|'''''B'''''}}
21057 !! html
21058 <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>
21059 <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>
21060 !! end
21061
21062 !! test
21063 4. I/B quote minimization: new content should be mimimized with adjacent old content
21064 !! options
21065 parsoid=html2wt
21066 !! wikitext
21067 ''AB''
21068
21069 '''AB'''
21070
21071 ''A'''B'''''
21072 !! html
21073 <p><i>A</i><i data-parsoid='{}'>B</i></p>
21074 <p><b data-parsoid='{}'>A</b><b>B</b></p>
21075 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
21076 !! end
21077
21078 #------------------------------------
21079 # End of I/B quote minimization tests
21080 #------------------------------------
21081
21082 !!test
21083 Bug 54262: New entities
21084 !! options
21085 parsoid=html2wt
21086 !! wikitext
21087 &nbsp;
21088 !! html
21089 <span typeof="mw:Entity">&nbsp;</span>
21090 !! end
21091
21092 ## Note that there is no wikitext output for 'unknownproperty' ##
21093 ## Unknown magic words are silently dropped ##
21094
21095 !! test
21096 Magic words
21097 !! options
21098 parsoid=html2wt
21099 !! wikitext
21100 __TOC__
21101 __NOTOC__
21102 __FORCETOC__
21103 __INDEX__
21104 __NOINDEX__
21105 __NOGALLERY__
21106 __NOEDITSECTION__
21107 __NOTITLECONVERT__
21108 __NOCONTENTCONVERT__
21109 !! html
21110 <meta property='mw:PageProp/toc' />
21111 <meta property='mw:PageProp/notoc' />
21112 <meta property='mw:PageProp/forcetoc' />
21113 <meta property='mw:PageProp/index' />
21114 <meta property='mw:PageProp/noindex' />
21115 <meta property='mw:PageProp/nogallery' />
21116 <meta property='mw:PageProp/noeditsection' />
21117 <meta property='mw:PageProp/notitleconvert' />
21118 <meta property='mw:PageProp/nocontentconvert' />
21119 <meta property='mw:PageProp/unknownproperty' />
21120 !! end
21121
21122 !! test
21123 Consecutive <pre>s should not get merged
21124 !! options
21125 parsoid=html2wt,html2html
21126 !! wikitext
21127 a
21128
21129 b
21130
21131 c
21132
21133 d
21134
21135 e
21136
21137
21138
21139 f
21140 !! html
21141 <pre>a</pre><pre>b</pre>
21142
21143 <pre>c
21144 </pre><pre>
21145 d</pre>
21146
21147 <pre>e
21148
21149 </pre><pre>
21150
21151 f</pre>
21152 !! end
21153
21154 !! test
21155 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
21156 !! options
21157 parsoid=html2wt
21158 !! wikitext
21159 [[Special:BookSources/1234567890|ISBN 1234567895]]
21160 !! html
21161 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
21162 !! end
21163
21164 !! test
21165 Edited RFC links not serializable as RFC links should serialize as extlinks
21166 !! options
21167 parsoid=html2wt
21168 !! wikitext
21169 [//tools.ietf.org/html/rfc123 New RFC]
21170 !! html
21171 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
21172 !! end
21173
21174 !! test
21175 Edited PMID links not serializable as PMID links should serialize as extlinks
21176 !! options
21177 parsoid=html2wt
21178 !! wikitext
21179 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
21180 !! html
21181 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
21182 !! end
21183
21184 !! test
21185 Edited Redirect link should emit a non-piped wikitext link
21186 !! options
21187 parsoid=html2wt
21188 !! wikitext
21189 #REDIRECT [[Bar]]
21190 !! html
21191 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
21192 !! end
21193
21194 # -----------------------------------------------------------------
21195 # End of section for Parsoid-only html2wt tests for serialization
21196 # of new content
21197 # -----------------------------------------------------------------
21198
21199 TODO:
21200 more images
21201 more tables
21202 character entities
21203 and much more
21204 Try for 100% code coverage