Merge "Use FormSpecialPage for Special:RandomInCategory"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-specific options (not run by PHP parser unless
25 # the test includes an html/php section)
26 # php php-only test (not run by the parsoid parser unless
27 # the test includes an html/parsoid section)
28 # showtitle make the first line the title
29 # comment run through Linker::formatComment() instead of main parser
30 # local format section links in edit comment text as local links
31 # notoc disable table of contents
32 # thumbsize=NNN set the default thumb size to NNNpx for this test
33 #
34 # You can also set the following parser properties via test options:
35 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
36 # wgLinkHolderBatchSize, wgRawHtml
37 #
38 # For testing purposes, temporary articles can created:
39 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
40 # where '/' denotes a newline.
41
42 # This is the standard article assumed to exist.
43 !! article
44 Main Page
45 !! text
46 blah blah
47 !! endarticle
48
49 !!article
50 Foo
51 !!text
52 FOO
53 !!endarticle
54
55 !!article
56 Template:Foo
57 !!text
58 FOO
59 !!endarticle
60
61 !! article
62 Template:Blank
63 !! text
64 !! endarticle
65
66 !! article
67 Template:pipe
68 !! text
69 |
70 !! endarticle
71
72 !!article
73 MediaWiki:bad image list
74 !!text
75 * [[File:Bad.jpg]] except [[Nasty page]]
76 !!endarticle
77
78 !! article
79 Template:inner list
80 !! text
81 * item 1
82 !! endarticle
83
84 !! article
85 Template:tbl-start
86 !! text
87 {|
88 !! endarticle
89
90 !! article
91 Template:tbl-end
92 !! text
93 |}
94 !! endarticle
95
96 !! article
97 Template:echo
98 !! text
99 {{{1}}}
100 !! endarticle
101
102 !! article
103 Template:echo_with_span
104 !! text
105 <span>{{{1}}}</span>
106 !! endarticle
107
108 !! article
109 Template:echo_with_div
110 !! text
111 <div>{{{1}}}</div>
112 !! endarticle
113
114 !! article
115 Template:attr_str
116 !! text
117 {{{1}}}="{{{2}}}"
118 !! endarticle
119
120 !! article
121 Template:table_attribs
122 !! text
123 <noinclude>
124 |</noinclude>style="color: red"| Foo
125 !! endarticle
126
127 !! article
128 Template:table_cells
129 !! text
130 {{table_attribs}} || Bar || Baz
131 !! endarticle
132
133 !! article
134 Template:image_attribs
135 !! text
136 <noinclude>
137 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
138 !! endarticle
139
140 !! article
141 A?b
142 !! text
143 Weirdo titles!
144 !! endarticle
145
146 !!article
147 Template:Bullet
148 !!text
149 * Bar
150 !!endarticle
151
152 !!article
153 Template:OpenTable
154 !!text
155 {|
156 !!endarticle
157
158 ###
159 ### Basic tests
160 ###
161 !! test
162 Blank input
163 !! wikitext
164 !! html
165 !! end
166
167
168 !! test
169 Simple paragraph
170 !! wikitext
171 This is a simple paragraph.
172 !! html
173 <p>This is a simple paragraph.
174 </p>
175 !! end
176
177 !! test
178 Paragraphs with extra newline spacing
179 !! wikitext
180 foo
181
182 bar
183
184
185 baz
186
187
188
189 booz
190 !! html
191 <p>foo
192 </p><p>bar
193 </p><p><br />
194 baz
195 </p><p><br />
196 </p><p>booz
197 </p>
198 !! end
199
200 !! test
201 Paragraphs with newline spacing with comment lines in between
202 !! wikitext
203 ----
204 a
205 <!--foo-->
206 b
207 ----
208 a
209 <!--foo--><!--More than 1 comment, still stripped-->
210 b
211 ----
212 a
213 <!--foo--> <!----> <!-- bar -->
214 b
215 ----
216 a
217 <!--foo-->
218
219 b
220 ----
221 a
222
223 <!--foo-->
224 b
225 ----
226 a
227 <!--foo-->
228
229
230 b
231 ----
232 a
233
234
235 <!--foo-->
236 b
237 ----
238 !! html
239 <hr />
240 <p>a
241 b
242 </p>
243 <hr />
244 <p>a
245 b
246 </p>
247 <hr />
248 <p>a
249 b
250 </p>
251 <hr />
252 <p>a
253 </p><p>b
254 </p>
255 <hr />
256 <p>a
257 </p><p>b
258 </p>
259 <hr />
260 <p>a
261 </p><p><br />
262 b
263 </p>
264 <hr />
265 <p>a
266 </p><p><br />
267 b
268 </p>
269 <hr />
270
271 !! end
272
273 !! test
274 Paragraphs with newline spacing with non-empty white-space lines in between
275 !! wikitext
276 ----
277 a
278
279 b
280 ----
281 a
282
283
284 b
285 ----
286 !! html
287 <hr />
288 <p>a
289 </p><p>b
290 </p>
291 <hr />
292 <p>a
293 </p><p><br />
294 b
295 </p>
296 <hr />
297
298 !! end
299
300 !! test
301 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
302 !! wikitext
303 ----
304 a
305 <!--foo-->
306 b
307 ----
308 a
309 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
310 b
311 ----
312 a
313
314 <!--foo-->
315 <!--bar-->
316 b
317 ----
318 a
319
320 <!--foo-->
321 <!--bar-->
322
323 b
324 ----
325 !! html
326 <hr />
327 <p>a
328 b
329 </p>
330 <hr />
331 <p>a
332 b
333 </p>
334 <hr />
335 <p>a
336 </p><p>b
337 </p>
338 <hr />
339 <p>a
340 </p><p><br />
341 b
342 </p>
343 <hr />
344
345 !! end
346
347 !! test
348 Extra newlines: More paragraphs with indented comment
349 !! wikitext
350 a
351
352 <!--boo-->
353
354 b
355 !! html
356 <p>a
357 </p><p><br />
358 b
359 </p>
360 !!end
361
362 !! test
363 Extra newlines followed by heading
364 !! wikitext
365 a
366
367
368
369 =b=
370 [[a]]
371
372
373 =b=
374 !! html
375 <p>a
376 </p><p><br />
377 </p>
378 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
379 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
380 </p><p><br />
381 </p>
382 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
383
384 !! end
385
386 !! test
387 Extra newlines between heading and content are swallowed
388 !! wikitext
389 =b=
390
391
392
393 [[a]]
394 !! html
395 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
396 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
397 </p>
398 !! end
399
400 !! test
401 Parsing an URL
402 !! wikitext
403 http://fr.wikipedia.org/wiki/🍺
404 <!-- EasterEgg we love beer, better be able be able to link to it -->
405 !! html
406 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
407 </p>
408 !! end
409
410 # Note that the html+tidy output removes the spaces after the <li>,
411 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
412 # This is an issue for all tests with lists. We intentionally do
413 # *not* add html+tidy clauses for these, as we don't want to
414 # document/test the broken behavior. (Parsoid matches the non-tidy
415 # output in these cases.)
416
417 !! test
418 Simple list
419 !! wikitext
420 * Item 1
421 * Item 2
422 !! html
423 <ul><li> Item 1</li>
424 <li> Item 2</li></ul>
425
426 !! end
427
428 !! test
429 Italics and bold
430 !! wikitext
431 * plain
432 * plain''italic''plain
433 * plain''italic''plain''italic''plain
434 * plain'''bold'''plain
435 * plain'''bold'''plain'''bold'''plain
436 * plain''italic''plain'''bold'''plain
437 * plain'''bold'''plain''italic''plain
438 * plain''italic'''bold-italic'''italic''plain
439 * plain'''bold''bold-italic''bold'''plain
440 * plain'''''bold-italic'''italic''plain
441 * plain'''''bold-italic''bold'''plain
442 * plain''italic'''bold-italic'''''plain
443 * plain'''bold''bold-italic'''''plain
444 * plain l'''italic''plain
445 * plain l''''bold''' plain
446 !! html
447 <ul><li> plain</li>
448 <li> plain<i>italic</i>plain</li>
449 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
450 <li> plain<b>bold</b>plain</li>
451 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
452 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
453 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
454 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
455 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
456 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
457 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
458 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
459 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
460 <li> plain l'<i>italic</i>plain</li>
461 <li> plain l'<b>bold</b> plain</li></ul>
462
463 !! end
464
465 # this example taken from the [[simple:Moon]] article (bug 47326)
466 !! test
467 Italics and possessives (1)
468 !! wikitext
469 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
470 !! html
471 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
472 </p>
473 !! end
474
475 # this example taken from [[en:Flaming Pie]] (bug 49926)
476 !! test
477 Italics and possessives (2)
478 !! wikitext
479 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
480 !! html
481 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
482 </p>
483 !! end
484
485 # this example taken from [[en:Dictionary]] (bug 49926)
486 !! test
487 Italics and possessives (3)
488 !! wikitext
489 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
490 !! html
491 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
492 </p>
493 !! end
494
495
496 ###
497 ### 2-quote opening sequence tests
498 ###
499 !! test
500 Italics and bold: 2-quote opening sequence: (2,2)
501 !! wikitext
502 ''foo''
503 !! html
504 <p><i>foo</i>
505 </p>
506 !!end
507
508
509 !! test
510 Italics and bold: 2-quote opening sequence: (2,3)
511 !! options
512 parsoid=wt2html
513 !! wikitext
514 ''foo'''
515 !! html/*
516 <p><i>foo'</i>
517 </p>
518 !!end
519
520
521 # same html as previous, but wikitext adjusted to match parsoid html2wt
522 !! test
523 Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki
524 !! wikitext
525 ''<nowiki>foo'</nowiki>''
526 !! html
527 <p><i>foo'</i>
528 </p>
529 !! end
530
531
532 !! test
533 Italics and bold: 2-quote opening sequence: (2,4)
534 !! options
535 parsoid=wt2html
536 !! wikitext
537 ''foo''''
538 !! html/*
539 <p><i>foo''</i>
540 </p>
541 !!end
542
543
544 # same html as previous, but wikitext adjusted to match parsoid html2wt
545 !! test
546 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
547 !! wikitext
548 ''<nowiki>foo''</nowiki>''
549 !! html
550 <p><i>foo''</i>
551 </p>
552 !! end
553
554
555 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
556 !! test
557 Italics and bold: 2-quote opening sequence: (2,5)
558 !! options
559 parsoid=wt2html
560 !! wikitext
561 ''foo'''''
562 !! html/php
563 <p><i>foo</i>
564 </p>
565 !! html/parsoid
566 <p><i>foo</i><b></b>
567 </p>
568 !!end
569
570 # same html as previous, but wikitext adjusted to match parsoid html2wt
571 !! test
572 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
573 !! wikitext
574 ''foo'''''<nowiki/>'''
575 !! html/php
576 <p><i>foo</i>
577 </p>
578 !! html/parsoid
579 <p><i>foo</i><b></b>
580 </p>
581 !! end
582
583
584 ###
585 ### 3-quote opening sequence tests
586 ###
587
588 !! test
589 Italics and bold: 3-quote opening sequence: (3,2)
590 !! wikitext
591 '''foo''
592 !! html
593 <p>'<i>foo</i>
594 </p>
595 !!end
596
597
598 !! test
599 Italics and bold: 3-quote opening sequence: (3,3)
600 !! wikitext
601 '''foo'''
602 !! html
603 <p><b>foo</b>
604 </p>
605 !!end
606
607
608 !! test
609 Italics and bold: 3-quote opening sequence: (3,4)
610 !! options
611 parsoid=wt2html
612 !! wikitext
613 '''foo''''
614 !! html/*
615 <p><b>foo'</b>
616 </p>
617 !!end
618
619
620 # same html as previous, but wikitext adjusted to match parsoid html2wt
621 !! test
622 Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki
623 !! wikitext
624 '''<nowiki>foo'</nowiki>'''
625 !! html
626 <p><b>foo'</b>
627 </p>
628 !! end
629
630
631 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
632 !! test
633 Italics and bold: 3-quote opening sequence: (3,5)
634 !! options
635 parsoid=wt2html
636 !! wikitext
637 '''foo'''''
638 !! html/php
639 <p><b>foo</b>
640 </p>
641 !! html/parsoid
642 <p><b>foo</b><i></i>
643 </p>
644 !!end
645
646 # same html as previous, but wikitext adjusted to match parsoid html2wt
647 !! test
648 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
649 !! wikitext
650 '''foo'''''<nowiki/>''
651 !! html/php
652 <p><b>foo</b>
653 </p>
654 !! html/parsoid
655 <p><b>foo</b><i></i>
656 </p>
657 !! end
658
659
660 ###
661 ### 4-quote opening sequence tests
662 ###
663
664 !! test
665 Italics and bold: 4-quote opening sequence: (4,2)
666 !! options
667 parsoid=wt2html
668 !! wikitext
669 ''''foo''
670 !! html/*
671 <p>''<i>foo</i>
672 </p>
673 !!end
674
675
676 # same html as previous, but wikitext adjusted to match parsoid html2wt
677 !! test
678 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
679 !! wikitext
680 <nowiki>''</nowiki>''foo''
681 !! html
682 <p>''<i>foo</i>
683 </p>
684 !! end
685
686
687 !! test
688 Italics and bold: 4-quote opening sequence: (4,3)
689 !! wikitext
690 ''''foo'''
691 !! html
692 <p>'<b>foo</b>
693 </p>
694 !!end
695
696
697 !! test
698 Italics and bold: 4-quote opening sequence: (4,4)
699 !! options
700 parsoid=wt2html
701 !! wikitext
702 ''''foo''''
703 !! html/*
704 <p>'<b>foo'</b>
705 </p>
706 !!end
707
708
709 # same html as previous, but wikitext adjusted to match parsoid html2wt
710 !! test
711 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
712 !! wikitext
713 ''''<nowiki>foo'</nowiki>'''
714 !! html
715 <p>'<b>foo'</b>
716 </p>
717 !! end
718
719
720 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
721 !! test
722 Italics and bold: 4-quote opening sequence: (4,5)
723 !! options
724 parsoid=wt2html
725 !! wikitext
726 ''''foo'''''
727 !! html/php
728 <p>'<b>foo</b>
729 </p>
730 !! html/parsoid
731 <p>'<b>foo</b><i></i>
732 </p>
733 !!end
734
735 # same html as previous, but wikitext adjusted to match parsoid html2wt
736 !! test
737 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
738 !! wikitext
739 ''''foo'''''<nowiki/>''
740 !! html/php
741 <p>'<b>foo</b>
742 </p>
743 !! html/parsoid
744 <p>'<b>foo</b><i></i>
745 </p>
746 !! end
747
748
749 ###
750 ### 5-quote opening sequence tests
751 ###
752
753 !! test
754 Italics and bold: 5-quote opening sequence: (5,2)
755 !! options
756 parsoid=wt2html
757 !! wikitext
758 '''''foo''
759 !! html/*
760 <p><b><i>foo</i></b>
761 </p>
762 !!end
763
764
765 # same html as previous, but wikitext adjusted to match parsoid html2wt
766 # skipping wt2html and html2html because it wants to put <i> before <b>
767 !! test
768 Italics and bold: 5-quote opening sequence: (5,2+3)
769 !! options
770 parsoid=wt2wt,html2wt
771 !! wikitext
772 '''''foo'''''
773 !! html
774 <p><b><i>foo</i></b>
775 </p>
776 !! end
777
778 !! test
779 Italics and bold: 5-quote opening sequence: (5,3)
780 !! options
781 parsoid=wt2html
782 !! wikitext
783 '''''foo'''
784 !! html/*
785 <p><i><b>foo</b></i>
786 </p>
787 !!end
788
789
790 # same html as previous, but wikitext adjusted to match parsoid html2wt
791 !! test
792 Italics and bold: 5-quote opening sequence: (5,3+2)
793 !! wikitext
794 '''''foo'''''
795 !! html
796 <p><i><b>foo</b></i>
797 </p>
798 !! end
799
800
801 !! test
802 Italics and bold: 5-quote opening sequence: (5,4)
803 !! options
804 parsoid=wt2html
805 !! wikitext
806 '''''foo''''
807 !! html/*
808 <p><i><b>foo'</b></i>
809 </p>
810 !!end
811
812
813 # same html as previous, but wikitext adjusted to match parsoid html2wt
814 !! test
815 Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki
816 !! wikitext
817 '''''<nowiki>foo'</nowiki>'''''
818 !! html
819 <p><i><b>foo'</b></i>
820 </p>
821 !! end
822
823
824 !! test
825 Italics and bold: 5-quote opening sequence: (5,5)
826 !! wikitext
827 '''''foo'''''
828 !! html
829 <p><i><b>foo</b></i>
830 </p>
831 !!end
832
833 ###
834 ### multiple quote sequences in a line
835 ###
836 !! test
837 Italics and bold: multiple quote sequences: (2,4,2)
838 !! options
839 parsoid=wt2html
840 !! wikitext
841 ''foo''''bar''
842 !! html/*
843 <p><i>foo'<b>bar</b></i>
844 </p>
845 !!end
846
847
848 # same html as previous, but wikitext adjusted to match parsoid html2wt
849 !! test
850 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
851 !! wikitext
852 ''<nowiki>foo'</nowiki>'''bar'''''
853 !! html
854 <p><i>foo'<b>bar</b></i>
855 </p>
856 !! end
857
858
859 !! test
860 Italics and bold: multiple quote sequences: (2,4,3)
861 !! options
862 parsoid=wt2html
863 !! wikitext
864 ''foo''''bar'''
865 !! html/*
866 <p><i>foo'<b>bar</b></i>
867 </p>
868 !!end
869
870
871 # same html as previous, but wikitext adjusted to match parsoid html2wt
872 !! test
873 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
874 !! wikitext
875 ''<nowiki>foo'</nowiki>'''bar'''''
876 !! html
877 <p><i>foo'<b>bar</b></i>
878 </p>
879 !! end
880
881
882 !! test
883 Italics and bold: multiple quote sequences: (2,4,4)
884 !! options
885 parsoid=wt2html
886 !! wikitext
887 ''foo''''bar''''
888 !! html/*
889 <p><i>foo'<b>bar'</b></i>
890 </p>
891 !!end
892
893
894 # same html as previous, but wikitext adjusted to match parsoid html2wt
895 !! test
896 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
897 !! wikitext
898 ''<nowiki>foo'</nowiki>'''<nowiki>bar'</nowiki>'''''
899 !! html
900 <p><i>foo'<b>bar'</b></i>
901 </p>
902 !! end
903
904
905 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
906 !! test
907 Italics and bold: multiple quote sequences: (3,4,2)
908 !! options
909 parsoid=wt2html
910 !! wikitext
911 '''foo''''bar''
912 !! html/php
913 <p><b>foo'</b>bar
914 </p>
915 !! html/parsoid
916 <p><b>foo'</b>bar<i></i>
917 </p>
918 !!end
919
920 # same html as previous, but wikitext adjusted to match parsoid html2wt
921 !! test
922 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
923 !! options
924 parsoid
925 !! wikitext
926 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
927 !! html/php
928 <p><b>foo'</b>bar
929 </p>
930 !! html/parsoid
931 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
932 </p>
933 !! end
934
935
936 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
937 !! test
938 Italics and bold: multiple quote sequences: (3,4,3)
939 !! options
940 parsoid=wt2html
941 !! wikitext
942 '''foo''''bar'''
943 !! html/php
944 <p><b>foo'</b>bar
945 </p>
946 !! html/parsoid
947 <p><b>foo'</b>bar<b></b>
948 </p>
949 !!end
950
951 # same html as previous, but wikitext adjusted to match parsoid html2wt
952 !! test
953 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
954 !! wikitext
955 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
956 !! html/php
957 <p><b>foo'</b>bar
958 </p>
959 !! html/parsoid
960 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
961 </p>
962 !! end
963
964 ###
965 ### other quote tests
966 ###
967 !! test
968 Italics and bold: other quote tests: (2,3,5)
969 !! wikitext
970 ''this is about '''foo's family'''''
971 !! html
972 <p><i>this is about <b>foo's family</b></i>
973 </p>
974 !!end
975
976
977 !! test
978 Italics and bold: other quote tests: (2,(3,3),2)
979 !! wikitext
980 ''this is about '''foo's''' family''
981 !! html
982 <p><i>this is about <b>foo's</b> family</i>
983 </p>
984 !!end
985
986
987 !! test
988 Italics and bold: other quote tests: (3,2,3,2)
989 !! options
990 parsoid=wt2html
991 !! wikitext
992 '''this is about ''foo'''s family''
993 !! html/*
994 <p><b>this is about <i>foo</i></b><i>s family</i>
995 </p>
996 !!end
997
998
999 # same html as previous, but wikitext adjusted to match parsoid html2wt
1000 # add 'parsoid' option to use 'parsoid' normalization of the placeholder
1001 !! test
1002 Italics and bold: other quote tests: (3,2,3+2+2,2)
1003 !! options
1004 parsoid
1005 !! wikitext
1006 '''this is about ''foo'''''<nowiki/>''s family''
1007 !! html/*
1008 <p><b>this is about <i>foo</i></b><i>s family</i>
1009 </p>
1010 !! end
1011
1012
1013 !! test
1014 Italics and bold: other quote tests: (3,2,3,3)
1015 !! options
1016 !! wikitext
1017 '''this is about ''foo'''s family'''
1018 !! html
1019 <p>'<i>this is about </i>foo<b>s family</b>
1020 </p>
1021 !!end
1022
1023
1024 !! test
1025 Italics and bold: other quote tests: (3,(2,2),3)
1026 !! wikitext
1027 '''this is about ''foo's'' family'''
1028 !! html
1029 <p><b>this is about <i>foo's</i> family</b>
1030 </p>
1031 !!end
1032
1033
1034 !! test
1035 Italicized possessive
1036 !! wikitext
1037 The ''[[Main Page]]'''s talk page.
1038 !! html
1039 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1040 </p>
1041 !! end
1042
1043 !! test
1044 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1045 (Requires tidy for PHP parser output to be fixed up)
1046 !! options
1047 parsoid=wt2html,wt2wt
1048 !! wikitext
1049 {|
1050 !''a!!''b
1051 |''a||''b
1052 |}
1053 !! html/php+tidy
1054 <table>
1055 <tr>
1056 <th><i>a</i></th>
1057 <th><i>b</i></th>
1058 <td><i>a</i></td>
1059 <td><i>b</i></td>
1060 </tr>
1061 </table>
1062 !! html/parsoid
1063 <table>
1064 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1065 <td><i>a</i></td><td><i>b</i></td></tr>
1066 </tbody></table>
1067 !! end
1068
1069 ###
1070 ### Non-html5 tags
1071 ###
1072
1073 !! test
1074 Non-html5 tags should be accepted
1075 !! wikitext
1076 <center>''foo''</center>
1077 <big>''foo''</big>
1078 <font>''foo''</font>
1079 <strike>''foo''</strike>
1080 <tt>''foo''</tt>
1081 !! html
1082 <center><i>foo</i></center>
1083 <p><big><i>foo</i></big>
1084 <font><i>foo</i></font>
1085 <strike><i>foo</i></strike>
1086 <tt><i>foo</i></tt>
1087 </p>
1088 !! end
1089
1090 !! test
1091 <wbr> is valid wikitext (bug 52468)
1092 !! wikitext
1093 <wbr>
1094 !! html
1095 <p><wbr />
1096 </p>
1097 !! end
1098
1099 # <strike> is HTML4, <s> is HTML4/5.
1100 !! test
1101 <s> or <strike> for strikethrough
1102 !! wikitext
1103 <strike>strike</strike>
1104
1105 <s>s</s>
1106 !! html
1107 <p><strike>strike</strike>
1108 </p><p><s>s</s>
1109 </p>
1110 !! end
1111
1112 ## a not permitted
1113 ## i,b,br omitted
1114 !! test
1115 Text-level semantic html elements in wikitext
1116 !! wikitext
1117 <em>text</em>
1118 <strong>text</strong>
1119 <small>text</small>
1120 <s>text</s>
1121 <cite>text</cite>
1122 <q>text</q>
1123 <dfn>text</dfn>
1124 <abbr>text</abbr>
1125 <data>text</data>
1126 <time>text</time>
1127 <code>text</code>
1128 <var>text</var>
1129 <samp>text</samp>
1130 <kbd>text</kbd>
1131 <sub>text</sub>
1132 <u>text</u>
1133 <mark>text</mark>
1134 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1135 <bdi>text</bdi>
1136 <bdo>text</bdo>
1137 <span>text</span>
1138 <wbr />
1139 !! html
1140 <p><em>text</em>
1141 <strong>text</strong>
1142 <small>text</small>
1143 <s>text</s>
1144 <cite>text</cite>
1145 <q>text</q>
1146 <dfn>text</dfn>
1147 <abbr>text</abbr>
1148 <data>text</data>
1149 <time>text</time>
1150 <code>text</code>
1151 <var>text</var>
1152 <samp>text</samp>
1153 <kbd>text</kbd>
1154 <sub>text</sub>
1155 <u>text</u>
1156 <mark>text</mark>
1157 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1158 <bdi>text</bdi>
1159 <bdo>text</bdo>
1160 <span>text</span>
1161 <wbr />
1162 </p>
1163 !! end
1164
1165 # test cases taken from
1166 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1167 !! test
1168 Ruby markup (W3C-style)
1169 !! wikitext
1170 ; Mono-ruby for individual base characters
1171 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1172 ; Group ruby
1173 : <ruby>今日<rt>きょう</rt></ruby>
1174 ; Jukugo ruby
1175 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1176 ; Inline ruby
1177 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1178 ; Double-sided ruby
1179 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1180 <ruby>
1181 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1182 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1183 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1184 </ruby>
1185 !! html
1186 <dl><dt> Mono-ruby for individual base characters</dt>
1187 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1188 <dt> Group ruby</dt>
1189 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1190 <dt> Jukugo ruby</dt>
1191 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1192 <dt> Inline ruby</dt>
1193 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1194 <dt> Double-sided ruby</dt>
1195 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1196 <p><ruby>
1197 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1198 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1199 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1200 </ruby>
1201 </p>
1202 !! end
1203
1204 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1205 !! test
1206 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1207 !! wikitext
1208 <b→> doesn't work! </b→>
1209
1210 <bä> doesn't work! </bä>
1211
1212 <boo> works fine </boo>
1213
1214 <s.foo>s.foo</s.foo>
1215
1216 <sub-ID#1>
1217 !! html
1218 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1219 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1220 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1221 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1222 </p><p>&lt;sub-ID#1&gt;
1223 </p>
1224 !! end
1225
1226 !! test
1227 Isolated close tags should be treated as literal text (bug 52760)
1228 !! wikitext
1229 </b>
1230
1231 <s.foo>s</s>
1232 !! html
1233 <p>&lt;/b&gt;
1234 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1235 </p>
1236 !! end
1237
1238 ###
1239 ### Special characters
1240 ###
1241
1242 !! test
1243 Bare pipe character (bug 52363)
1244 !! wikitext
1245 |
1246 !! html
1247 <p>|
1248 </p>
1249 !! end
1250
1251 !! test
1252 Bare pipe character from a template (bug 52363)
1253 !! wikitext
1254 {{pipe}}
1255 !! html
1256 <p>|
1257 </p>
1258 !! end
1259
1260 ###
1261 ### <nowiki> test cases
1262 ###
1263
1264 !! test
1265 <nowiki> unordered list
1266 !! wikitext
1267 <nowiki>* This is not an unordered list item.</nowiki>
1268 !! html
1269 <p>* This is not an unordered list item.
1270 </p>
1271 !! end
1272
1273 !! test
1274 <nowiki> spacing
1275 !! wikitext
1276 <nowiki>Lorem ipsum dolor
1277
1278 sed abit.
1279 sed nullum.
1280
1281 :and a colon
1282 </nowiki>
1283 !! html
1284 <p>Lorem ipsum dolor
1285
1286 sed abit.
1287 sed nullum.
1288
1289 :and a colon
1290
1291 </p>
1292 !! end
1293
1294 !! test
1295 nowiki 3
1296 !! wikitext
1297 :There is not nowiki.
1298 :There is <nowiki>nowiki</nowiki>.
1299
1300 #There is not nowiki.
1301 #There is <nowiki>nowiki</nowiki>.
1302
1303 *There is not nowiki.
1304 *There is <nowiki>nowiki</nowiki>.
1305 !! html
1306 <dl><dd>There is not nowiki.</dd>
1307 <dd>There is nowiki.</dd></dl>
1308 <ol><li>There is not nowiki.</li>
1309 <li>There is nowiki.</li></ol>
1310 <ul><li>There is not nowiki.</li>
1311 <li>There is nowiki.</li></ul>
1312
1313 !! end
1314
1315 !! test
1316 Entities inside <nowiki>
1317 !! wikitext
1318 <nowiki>&lt;</nowiki>
1319 !! html
1320 <p>&lt;
1321 </p>
1322 !! end
1323
1324 !! test
1325 Entities inside template parameters
1326 !! options
1327 parsoid
1328 !! wikitext
1329 {{echo|&ndash;}}
1330 !! html
1331 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span>
1332 </p>
1333 !! end
1334
1335 !! test
1336 Properly escape nowiki when combined with other wiki markup
1337 !! options
1338 parsoid=html2wt
1339 !! wikitext
1340 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1341 !! html
1342 <p>* &lt;/nowiki&gt; tag</p>
1343 !! end
1344
1345 ###
1346 ### Comments
1347 ###
1348 !! test
1349 Comments and Indent-Pre
1350 !! wikitext
1351 <!-- comment 1 --> asdf
1352
1353 <!-- comment 1 --> asdf
1354 <!-- comment 2 -->
1355
1356 <!-- comment 1 --> asdf
1357 <!-- comment 2 -->xyz
1358
1359 <!-- comment 1 --> asdf
1360 <!-- comment 2 --> xyz
1361 !! html
1362 <pre>asdf
1363 </pre>
1364 <pre>asdf
1365 </pre>
1366 <pre>asdf
1367 </pre>
1368 <p>xyz
1369 </p>
1370 <pre>asdf
1371 xyz
1372 </pre>
1373 !! end
1374
1375 !! test
1376 Comment test 2a
1377 !! wikitext
1378 asdf
1379 <!-- comment 1 -->
1380 jkl
1381 !! html
1382 <p>asdf
1383 jkl
1384 </p>
1385 !! end
1386
1387 !! test
1388 Comment test 2b
1389 !! wikitext
1390 asdf
1391 <!-- comment 1 -->
1392
1393 jkl
1394 !! html
1395 <p>asdf
1396 </p><p>jkl
1397 </p>
1398 !! end
1399
1400 !! test
1401 Comment test 3
1402 !! wikitext
1403 asdf
1404 <!-- comment 1 -->
1405 <!-- comment 2 -->
1406 jkl
1407 !! html
1408 <p>asdf
1409 jkl
1410 </p>
1411 !! end
1412
1413 !! test
1414 Comment test 4
1415 !! wikitext
1416 asdf<!-- comment 1 -->jkl
1417 !! html
1418 <p>asdfjkl
1419 </p>
1420 !! end
1421
1422 !! test
1423 Comment spacing
1424 !! wikitext
1425 a
1426 <!-- foo --> b <!-- bar -->
1427 c
1428 !! html
1429 <p>a
1430 </p>
1431 <pre> b
1432 </pre>
1433 <p>c
1434 </p>
1435 !! end
1436
1437 !! test
1438 Comment whitespace
1439 !! wikitext
1440 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1441 !! html
1442
1443 !! end
1444
1445 !! test
1446 Comment semantics and delimiters
1447 !! wikitext
1448 <!-- --><!----><!-----><!------>
1449 !! html
1450
1451 !! end
1452
1453 !! test
1454 Comment semantics and delimiters, redux
1455 !! wikitext
1456 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1457 -- foo -- funky huh? ... -->
1458 !! html
1459
1460 !! end
1461
1462 !! test
1463 Comment semantics and delimiters: directors cut
1464 !! wikitext
1465 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1466 everything starting with < followed by !-- until the first -- and > we see,
1467 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1468 -->-->
1469 !! html
1470 <p>--&gt;
1471 </p>
1472 !! end
1473
1474 !! test
1475 Comment semantics: nesting
1476 !! wikitext
1477 <!--<!-- no, we're not going to do anything fancy here -->-->
1478 !! html
1479 <p>--&gt;
1480 </p>
1481 !! end
1482
1483 !! test
1484 Comment semantics: unclosed comment at end
1485 !! wikitext
1486 <!--This comment will run out to the end of the document
1487 !! html
1488
1489 !! end
1490
1491 !! test
1492 Comment in template title
1493 !! wikitext
1494 {{f<!---->oo}}
1495 !! html
1496 <p>FOO
1497 </p>
1498 !! end
1499
1500 !! test
1501 Comment on its own line post-expand
1502 !! wikitext
1503 a
1504 {{blank}}<!---->
1505 b
1506 !! html
1507 <p>a
1508 </p><p>b
1509 </p>
1510 !! end
1511
1512 !! test
1513 Comment on its own line post-expand with non-significant whitespace
1514 !! wikitext
1515 a
1516 {{blank}} <!---->
1517 b
1518 !! html
1519 <p>a
1520 </p><p>b
1521 </p>
1522 !! end
1523
1524 !! test
1525 Multiple comments should still parse as SOL-transparent
1526 !! options
1527 parsoid=wt2html,wt2wt
1528 !! wikitext
1529 <!--c1-->*a
1530 <!--c2--><!--c3--><!--c4-->*b
1531 !! html
1532 <ul>
1533 <li>a
1534 </li>
1535 <li>b
1536 </li>
1537 </ul>
1538 !! end
1539
1540 ###
1541 ### paragraph wrapping tests
1542 ###
1543 !! test
1544 No block tags
1545 !! wikitext
1546 a
1547
1548 b
1549 !! html
1550 <p>a
1551 </p><p>b
1552 </p>
1553 !! end
1554
1555 !! test
1556 Block tag on one line (<div>)
1557 !! wikitext
1558 a <div>foo</div>
1559
1560 b
1561 !! html
1562 a <div>foo</div>
1563 <p>b
1564 </p>
1565 !! html+tidy
1566 <p>a</p>
1567 <div>foo</div>
1568 <p>b</p>
1569 !! end
1570
1571 !! test
1572 Block tag on one line (<blockquote>)
1573 !! wikitext
1574 a <blockquote>foo</blockquote>
1575
1576 b
1577 !! html
1578 a <blockquote>foo</blockquote>
1579 <p>b
1580 </p>
1581 !! html+tidy
1582 <p>a</p>
1583 <blockquote>
1584 <p>foo</p>
1585 </blockquote>
1586 <p>b</p>
1587 !! end
1588
1589 !! test
1590 Block tag on both lines (<div>)
1591 !! wikitext
1592 a <div>foo</div>
1593
1594 b <div>foo</div>
1595 !! html
1596 a <div>foo</div>
1597 b <div>foo</div>
1598
1599 !! html+tidy
1600 <p>a</p>
1601 <div>foo</div>
1602 <p>b</p>
1603 <div>foo</div>
1604 !! end
1605
1606 !! test
1607 Block tag on both lines (<blockquote>)
1608 !! wikitext
1609 a <blockquote>foo</blockquote>
1610
1611 b <blockquote>foo</blockquote>
1612 !! html
1613 a <blockquote>foo</blockquote>
1614 b <blockquote>foo</blockquote>
1615
1616 !! html+tidy
1617 <p>a</p>
1618 <blockquote>
1619 <p>foo</p>
1620 </blockquote>
1621 <p>b</p>
1622 <blockquote>
1623 <p>foo</p>
1624 </blockquote>
1625 !! end
1626
1627 !! test
1628 Multiple lines without block tags
1629 !! wikitext
1630 <div>foo</div> a
1631 b
1632 c
1633 d<!--foo--> e
1634 x <div>foo</div> z
1635 !! html
1636 <div>foo</div> a
1637 <p>b
1638 c
1639 d e
1640 </p>
1641 x <div>foo</div> z
1642
1643 !! html+tidy
1644 <div>foo</div>
1645 <p>a</p>
1646 <p>b c d e</p>
1647 <p>x</p>
1648 <div>foo</div>
1649 <p>z</p>
1650 !! end
1651
1652 !! test
1653 Empty lines between lines with block tags
1654 !! wikitext
1655 <div></div>
1656
1657
1658 <div></div>a
1659
1660 b
1661 <div>a</div>b
1662
1663 <div>b</div>d
1664
1665
1666 <div>e</div>
1667 !! html
1668 <div></div>
1669 <p><br />
1670 </p>
1671 <div></div>a
1672 <p>b
1673 </p>
1674 <div>a</div>b
1675 <div>b</div>d
1676 <p><br />
1677 </p>
1678 <div>e</div>
1679
1680 !! html+tidy
1681 <p><br /></p>
1682 <p>a</p>
1683 <p>b</p>
1684 <div>a</div>
1685 <p>b</p>
1686 <div>b</div>
1687 <p>d</p>
1688 <p><br /></p>
1689 <div>e</div>
1690 !! end
1691
1692 ## PHP parser emits output which is broken
1693 ## XXX The parsoid output doesn't match the tidy output.
1694 !! test
1695 Unclosed HTML p-tags should be handled properly
1696 !! wikitext
1697 <div><p>foo</div>
1698 a
1699
1700 b
1701 !! html/php+tidy
1702 <div>
1703 <p>foo&lt;/div&gt;</p>
1704 <p>a</p>
1705 b</div>
1706 !! html/parsoid
1707 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1708 <p>a</p>
1709 <p>b</p>
1710 !! end
1711
1712 ###
1713 ### Preformatted text
1714 ###
1715 !! test
1716 Preformatted text
1717 !! wikitext
1718 This is some
1719 Preformatted text
1720 With ''italic''
1721 And '''bold'''
1722 And a [[Main Page|link]]
1723 !! html
1724 <pre>This is some
1725 Preformatted text
1726 With <i>italic</i>
1727 And <b>bold</b>
1728 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1729 </pre>
1730 !! end
1731
1732 !! test
1733 Tabs don't trigger preformatted text
1734 !! wikitext
1735 This is not
1736 preformatted text.
1737 This is preformatted text.
1738 So is this.
1739 !! html
1740 <p> This is not
1741 preformatted text.
1742 </p>
1743 <pre>This is preformatted text.
1744 So is this.
1745 </pre>
1746 !! end
1747
1748 !! test
1749 Ident preformatting with inline content
1750 !! wikitext
1751 a
1752 ''b''
1753 !! html
1754 <pre>a
1755 <i>b</i>
1756 </pre>
1757 !! end
1758
1759 !! test
1760 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1761 !! wikitext
1762 <pre><nowiki>
1763 <b>
1764 <cite>
1765 <em>
1766 </nowiki></pre>
1767 !! html
1768 <pre>
1769 &lt;b&gt;
1770 &lt;cite&gt;
1771 &lt;em&gt;
1772 </pre>
1773
1774 !! end
1775
1776 !! test
1777 Regression with preformatted in <center>
1778 !! wikitext
1779 <center>
1780 Blah
1781 </center>
1782 !! html
1783 <center>
1784 <pre>Blah
1785 </pre>
1786 </center>
1787
1788 !! end
1789
1790 !! test
1791 Bug 52763: Preformatted in <blockquote>
1792 !! wikitext
1793 <blockquote>
1794 Blah
1795 {|
1796 |
1797 indented cell (no pre-wrapping!)
1798 |}
1799 </blockquote>
1800 !! html
1801 <blockquote>
1802 <p> Blah
1803 </p>
1804 <table>
1805 <tr>
1806 <td>
1807 <p> indented cell (no pre-wrapping!)
1808 </p>
1809 </td></tr></table>
1810 </blockquote>
1811
1812 !! end
1813
1814 !! test
1815 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1816 !! wikitext
1817 <blockquote>
1818 Foo
1819
1820 Bar
1821 </blockquote>
1822 !! html
1823 <blockquote>
1824 <p>Foo
1825 </p><p>Bar
1826 </p>
1827 </blockquote>
1828
1829 !! end
1830
1831 !! test
1832 Bug 15491: <ins>/<del> in blockquote
1833 !! wikitext
1834 <blockquote>
1835 Foo <del>bar</del> <ins>baz</ins> quux
1836 </blockquote>
1837 !! html
1838 <blockquote>
1839 <p>Foo <del>bar</del> <ins>baz</ins> quux
1840 </p>
1841 </blockquote>
1842
1843 !! end
1844
1845 # Note that the p-wrapping is newline sensitive, which could be
1846 # considered a bug: tidy will wrap only the 'Foo' in the example
1847 # below in a <p> tag. (see comment 23-25 of bug #6200)
1848 !! test
1849 Bug 15491: <ins>/<del> in blockquote (2)
1850 !! wikitext
1851 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1852 </blockquote>
1853 !! html
1854 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1855 </blockquote>
1856
1857 !! html+tidy
1858 <blockquote>
1859 <p>Foo</p>
1860 <del>bar</del> <ins>baz</ins> quux</blockquote>
1861 !! end
1862
1863 !! test
1864 <pre> with attributes (bug 3202)
1865 !! wikitext
1866 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1867 !! html
1868 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1869
1870 !! end
1871
1872 !! test
1873 <pre> with width attribute (bug 3202)
1874 !! wikitext
1875 <pre width="8">Narrow screen goodies</pre>
1876 !! html
1877 <pre width="8">Narrow screen goodies</pre>
1878
1879 !! end
1880
1881 !! test
1882 <pre> with forbidden attribute (bug 3202)
1883 !! wikitext
1884 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1885 !! html
1886 <pre width="8">Narrow screen goodies</pre>
1887
1888 !! end
1889
1890 !! test
1891 Entities inside <pre>
1892 !! wikitext
1893 <pre>&lt;</pre>
1894 !! html
1895 <pre>&lt;</pre>
1896
1897 !! end
1898
1899 !! test
1900 <pre> with forbidden attribute values (bug 3202)
1901 !! wikitext
1902 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1903 !! html
1904 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1905
1906 !! end
1907
1908 !! test
1909 <nowiki> inside <pre> (bug 13238)
1910 !! wikitext
1911 <pre>
1912 <nowiki>
1913 </pre>
1914 <pre>
1915 <nowiki></nowiki>
1916 </pre>
1917 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1918 !! html
1919 <pre>
1920 &lt;nowiki&gt;
1921 </pre>
1922 <pre>
1923
1924 </pre>
1925 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1926
1927 !! end
1928
1929 !! test
1930 <nowiki> and <pre> preference (first one wins)
1931 !! wikitext
1932 <pre>
1933 <nowiki>
1934 </pre>
1935 </nowiki>
1936 </pre>
1937
1938 <nowiki>
1939 <pre>
1940 <nowiki>
1941 </pre>
1942 </nowiki>
1943 </pre>
1944
1945 !! html
1946 <pre>
1947 &lt;nowiki&gt;
1948 </pre>
1949 <p>&lt;/nowiki&gt;
1950 &lt;/pre&gt;
1951 </p><p>
1952 &lt;pre&gt;
1953 &lt;nowiki&gt;
1954 &lt;/pre&gt;
1955
1956 &lt;/pre&gt;
1957 </p>
1958 !! end
1959
1960 !! test
1961 </pre> inside nowiki
1962 !! wikitext
1963 <nowiki></pre></nowiki>
1964 !! html
1965 <p>&lt;/pre&gt;
1966 </p>
1967 !! end
1968
1969 !! test
1970 Empty pre; pre inside other HTML tags (bug 54946)
1971 !! wikitext
1972 a
1973
1974 <div><pre>
1975 foo
1976 </pre></div>
1977 <pre></pre>
1978 !! html
1979 <p>a
1980 </p>
1981 <div><pre>
1982 foo
1983 </pre></div>
1984 <pre></pre>
1985
1986 !! html+tidy
1987 <p>a</p>
1988 <div>
1989 <pre>
1990 foo
1991 </pre></div>
1992 !! end
1993
1994 !! test
1995 HTML pre followed by indent-pre
1996 !! wikitext
1997 <pre>foo</pre>
1998 bar
1999 !! html
2000 <pre>foo</pre>
2001 <pre>bar
2002 </pre>
2003 !! end
2004
2005 !!test
2006 Block tag pre
2007 !!options
2008 parsoid
2009 !! wikitext
2010 <p><pre>foo</pre></p>
2011 !! html
2012 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2013 !!end
2014
2015 !!test
2016 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2017 !! wikitext
2018 {{echo|}}
2019 !! html
2020
2021 !!end
2022
2023 !!test
2024 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2025 !! wikitext
2026 {{echo|
2027 foo}}
2028 !! html
2029 <p>foo
2030 </p>
2031 !!end
2032
2033 !! test
2034 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2035 !! wikitext
2036 {{echo|a
2037 b}}
2038 !! html
2039 <pre>a
2040 </pre>
2041 <p>b
2042 </p>
2043 !!end
2044
2045 !! test
2046 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2047 !! wikitext
2048 {{echo|a
2049 b
2050 c
2051 d
2052 e
2053 }}
2054 !! html
2055 <pre>a
2056 </pre>
2057 <p>b
2058 c
2059 </p>
2060 <pre>d
2061 </pre>
2062 <p>e
2063 </p>
2064 !!end
2065
2066 !!test
2067 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2068 !! wikitext
2069 {{echo| foo}}
2070
2071 {{echo| foo}}{{echo| bar}}
2072
2073 {{echo| foo}}
2074 {{echo| bar}}
2075
2076 {{echo|<!--cmt--> foo}}
2077
2078 <!--cmt-->{{echo| foo}}
2079
2080 {{echo|{{echo| }}bar}}
2081 !! html
2082 <pre>foo
2083 </pre>
2084 <pre>foo bar
2085 </pre>
2086 <pre>foo
2087 bar
2088 </pre>
2089 <pre>foo
2090 </pre>
2091 <pre>foo
2092 </pre>
2093 <pre>bar
2094 </pre>
2095 !!end
2096
2097 !! test
2098 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2099 !! wikitext
2100 {{echo| }}a
2101
2102 {{echo|
2103 }}a
2104
2105 {{echo|
2106 b}}
2107
2108 {{echo|a
2109 }}b
2110
2111 {{echo|a
2112 }} b
2113 !! html
2114 <pre>a
2115 </pre>
2116 <p><br />
2117 </p>
2118 <pre>a
2119 </pre>
2120 <p><br />
2121 </p>
2122 <pre>b
2123 </pre>
2124 <p>a
2125 </p>
2126 <pre>b
2127 </pre>
2128 <p>a
2129 </p>
2130 <pre>b
2131 </pre>
2132 !!end
2133
2134 !! test
2135 Things that look like <pre> tags aren't treated as such
2136 !! wikitext
2137 Barack Obama <President> of the United States
2138 <President></President>
2139 !! html
2140 <p>Barack Obama &lt;President&gt; of the United States
2141 &lt;President&gt;&lt;/President&gt;
2142 </p>
2143 !! end
2144
2145 ## PHP parser discards the "<pre " string
2146 !! test
2147 Handle broken pre-like tags (bug 64025)
2148 !! options
2149 parsoid=wt2html
2150 !! wikitext
2151 {{echo|<pre <pre>x</pre>}}
2152
2153 <table><pre </table>
2154 !! html/php
2155 <pre>x</pre>
2156 <table><pre></pre></table>
2157
2158 !! html/parsoid
2159 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>&lt;pre </span>
2160 <pre>x</pre>
2161
2162 <span>&lt;pre </span>
2163 <table></table>
2164 !! end
2165
2166 !! test
2167 Parsoid: handle pre with space after attribute
2168 !! options
2169 parsoid=wt2html
2170 !! wikitext
2171 <pre style="width:50%;" >{{echo|foo}}</pre>
2172 !! html
2173 <pre style="width:50%;">{{echo|foo}}</pre>
2174 !! end
2175
2176 # TODO / maybe: fix wt2wt for this
2177 !! test
2178 Parsoid: Don't paragraph-wrap fosterable content
2179 !! options
2180 parsoid=wt2html
2181 !! wikitext
2182 {|
2183 <td></td>
2184 <td></td>
2185
2186
2187
2188 |}
2189 !! html
2190 <table>
2191
2192 <tbody>
2193 <tr>
2194 <td></td>
2195
2196 <td></td></tr>
2197
2198
2199
2200 </tbody></table>
2201 !! end
2202
2203 !! test
2204 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2205 !! options
2206 parsoid=wt2html
2207 !! wikitext
2208 {|
2209 <td>
2210 <td>
2211 </td>
2212
2213
2214
2215 |}
2216 !! html
2217 <table>
2218
2219 <tbody>
2220 <tr>
2221 <td></td>
2222
2223 <td>
2224 </td></tr>
2225
2226
2227
2228 </tbody></table>
2229 !! end
2230
2231
2232 #--------------------------------------------------------------------
2233 # Transclusion parameter whitespace stripping tests
2234 # Behavior is different for positional and named parameters
2235 #--------------------------------------------------------------------
2236 !! test
2237 Templates: Strip leading and trailing whitespace from named-param values
2238 !! wikitext
2239 {{echo|1= a }}
2240
2241 {{echo|1= {{echo|b}} }}
2242
2243 {{echo| 1 =
2244 c }}
2245
2246 {{echo| 1 =
2247 * d
2248 }}
2249 !! html
2250 <p>a
2251 </p><p>b
2252 </p><p>c
2253 </p>
2254 <ul><li> d</li></ul>
2255
2256 !! end
2257
2258 !! test
2259 Templates: Don't strip whitespace from positional-param values
2260 !! wikitext
2261 {{echo|a }}
2262
2263 {{echo|{{echo|b}} }}
2264
2265 {{echo| c
2266 }}
2267
2268 {{echo| {{echo|d}}
2269 }}
2270
2271 {{echo|
2272 e}}
2273
2274 {{echo|
2275 * f}}
2276
2277 {{echo|
2278 }}g
2279 !! html
2280 <p>a
2281 </p><p>b
2282 </p>
2283 <pre>c
2284 </pre>
2285 <p><br />
2286 </p>
2287 <pre>d
2288 </pre>
2289 <p><br />
2290 </p>
2291 <pre>e
2292 </pre>
2293 <p><br />
2294 </p>
2295 <ul><li> f</li></ul>
2296 <p><br />
2297 </p>
2298 <pre>g
2299 </pre>
2300 !! end
2301
2302 !! test
2303 Templates: Handle empty comment-and-ws-only lines correctly
2304 !! wikitext
2305 {{echo|foo
2306 <!--should be ignored-->
2307 <!--should be ignored as well-->
2308 bar}}
2309 !! html
2310 <p>foo
2311 bar
2312 </p>
2313 !! end
2314
2315 !! test
2316 Templates: Handle comments in the target
2317 !! wikitext
2318 {{echo
2319 <!-- should be ignored -->
2320 |foo}}
2321
2322 {{echo<!-- should be ignored -->
2323 |foo}}
2324
2325 {{echo<!-- should be ignored -->|foo}}
2326
2327 {{<!-- should be ignored -->echo|foo}}
2328 !!html/parsoid
2329 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2330
2331 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2332
2333 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2334
2335 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2336 !!end
2337
2338 #--------------------------------------------------------------------
2339 # Transclusion parameter escaping tests
2340 #--------------------------------------------------------------------
2341 !! test
2342 Templates: Parsoid parameter escaping test 1
2343 !! options
2344 parsoid
2345 !! wikitext
2346 {{echo|[foo]|{{echo|[bar]}}}}
2347 !! html
2348 <p about="#mwt1" typeof="mw:Transclusion"
2349 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2350 !! end
2351
2352 !! test
2353 Parsoid: Pipes in external links in template parameter
2354 !! options
2355 parsoid
2356 !! wikitext
2357 {{echo|[{{echo|http://example.com}} link]}}
2358 !! html
2359 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2360 !! end
2361
2362 !! test
2363 Parsoid: pipe in transclusion parameter
2364 !! options
2365 parsoid
2366 !! wikitext
2367 {{echo|http://foo.com/a&#124;b}}
2368 !! html
2369 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2370 typeof="mw:Transclusion"
2371 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2372 !! end
2373
2374 !! test
2375 Parsoid: Pipe in external link target and content in template parameter
2376 !! options
2377 parsoid=html2wt,wt2wt
2378 !! wikitext
2379 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2380 !! html
2381 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2382 typeof="mw:Transclusion"
2383 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2384 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2385 !! end
2386
2387 !! test
2388 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2389 !! options
2390 parsoid
2391 !! wikitext
2392 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2393 !! html
2394 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2395 !! end
2396
2397 !! test
2398 Templates: Don't escape already nowiki-escaped text in template parameters
2399 !! options
2400 parsoid=html2wt,wt2wt
2401 !! wikitext
2402 {{echo|foo<nowiki>|</nowiki>bar}}
2403 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2404 {{echo|<nowiki></nowiki>}}
2405 !! html
2406 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2407 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2408 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2409 </p>
2410 !! end
2411
2412 ## Bug 52824
2413 !! test
2414 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2415 !! options
2416 parsoid=html2wt,wt2wt
2417 !! wikitext
2418 {{echo|{{echo|1=bar}}}}
2419 !! html
2420 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2421 !! end
2422
2423 ## Bug 56733
2424 !! test
2425 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2426 !! options
2427 parsoid
2428 !! wikitext
2429 {{echo|a : b}}
2430 !! html
2431 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2432 !! end
2433
2434 ###
2435 ### Parsoid-centric tests for testing RT edge cases for pre
2436 ###
2437
2438 !!test
2439 1a. Indent-Pre and Comments
2440 !! wikitext
2441 a
2442 <!--a-->
2443 c
2444 !! html
2445 <pre>a
2446 </pre>
2447 <p>c
2448 </p>
2449 !!end
2450
2451 !!test
2452 1b. Indent-Pre and Comments
2453 !! wikitext
2454 a
2455 <!--a-->
2456 c
2457 !! html
2458 <pre>a
2459 </pre>
2460 <p>c
2461 </p>
2462 !!end
2463
2464 !!test
2465 1c. Indent-Pre and Comments
2466 !! wikitext
2467 <!--a--> a
2468
2469 <!--a--> a
2470 !! html
2471 <pre> a
2472 </pre>
2473 <pre> a
2474 </pre>
2475 !!end
2476
2477 !!test
2478 1d. Indent-Pre and Comments
2479 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2480 !! wikitext
2481 <!--a--> a
2482
2483 <!--b-->b
2484 !! html
2485 <pre>a
2486 </pre>
2487 <pre>b
2488 </pre>
2489 !!end
2490
2491 !!test
2492 2a. Indent-Pre and tables
2493 !! wikitext
2494 {|
2495 |-
2496 !h1!!h2
2497 |foo||bar
2498 |}
2499 !! html
2500 <table>
2501
2502 <tr>
2503 <th>h1</th>
2504 <th>h2
2505 </th>
2506 <td>foo</td>
2507 <td>bar
2508 </td></tr></table>
2509
2510 !!end
2511
2512 !!test
2513 2b. Indent-Pre and tables
2514 !! wikitext
2515 {|
2516 |-
2517 |foo
2518 |}
2519 !! html
2520 <table>
2521
2522 <tr>
2523 <td>foo
2524 </td></tr></table>
2525
2526 !!end
2527
2528 !!test
2529 2c. Indent-Pre and tables (bug 42252)
2530 !! wikitext
2531 {|
2532 |+ foo
2533 ! | bar
2534 |}
2535 !! html
2536 <table>
2537 <caption> foo
2538 </caption>
2539 <tr>
2540 <th> bar
2541 </th></tr></table>
2542
2543 !!end
2544
2545 !!test
2546 2d. Indent-Pre and tables
2547 !! wikitext
2548 a
2549 {|
2550 | b
2551 |}
2552 !! html/php
2553 <pre>a
2554 </pre>
2555 <table>
2556 <tr>
2557 <td> b
2558 </td></tr></table>
2559
2560 !! html/parsoid
2561 <pre>a</pre>
2562
2563 <table>
2564
2565 <tbody>
2566 <tr>
2567 <td> b</td></tr>
2568 </tbody></table>
2569 !!end
2570
2571 !!test
2572 2e. Indent-Pre and table-line syntax
2573 !! wikitext
2574 a
2575 | b
2576 | c
2577 !! html/php
2578 <pre>a
2579 | b
2580 | c
2581 </pre>
2582 !!end
2583
2584 !!test
2585 2f. Indent-pre started by table-line syntax
2586 !! wikitext
2587 a
2588 | b
2589 | c
2590 !! html/php
2591 <p>a
2592 </p>
2593 <pre>| b
2594 | c
2595 </pre>
2596 !! html/parsoid
2597 <p>a</p>
2598 <pre>
2599 | b
2600 | c</pre>
2601 !!end
2602
2603 !!test
2604 3a. Indent-Pre and block tags (single-line html)
2605 !! wikitext
2606 a <p> foo </p>
2607 b <div> foo </div>
2608 c <blockquote> foo </blockquote>
2609 <span> foo </span>
2610 !! html
2611 a <p> foo </p>
2612 b <div> foo </div>
2613 c <blockquote> foo </blockquote>
2614 <pre><span> foo </span>
2615 </pre>
2616 !! html+tidy
2617 <p>a</p>
2618 <p>foo</p>
2619 <p>b</p>
2620 <div>foo</div>
2621 <p>c</p>
2622 <blockquote>
2623 <p>foo</p>
2624 </blockquote>
2625 <pre>
2626 <span> foo </span>
2627 </pre>
2628 !! end
2629
2630 !!test
2631 3b. Indent-Pre and block tags (multi-line html)
2632 !! wikitext
2633 a <span>foo</span>
2634 b <div> foo </div>
2635 !! html
2636 <pre>a <span>foo</span>
2637 </pre>
2638 b <div> foo </div>
2639
2640 !! html+tidy
2641 <pre>
2642 a <span>foo</span>
2643 </pre>
2644 <p>b</p>
2645 <div>foo</div>
2646 !!end
2647
2648 !!test
2649 3c. Indent-Pre and block tags (pre-content on separate line)
2650 !! wikitext
2651 <p>
2652 foo
2653 </p>
2654
2655 <div>
2656 foo
2657 </div>
2658
2659 <center>
2660 foo
2661 </center>
2662
2663 <blockquote>
2664 foo
2665 </blockquote>
2666
2667 <blockquote>
2668 <pre>
2669 foo
2670 </pre>
2671 </blockquote>
2672
2673 <table><tr><td>
2674 foo
2675 </td></tr></table>
2676
2677 <ul><li>
2678 foo
2679 </li></ul>
2680
2681 !! html
2682 <p>
2683 foo
2684 </p>
2685 <div>
2686 <pre>foo
2687 </pre>
2688 </div>
2689 <center>
2690 <pre>foo
2691 </pre>
2692 </center>
2693 <blockquote>
2694 <p> foo
2695 </p>
2696 </blockquote>
2697 <blockquote>
2698 <pre>
2699 foo
2700 </pre>
2701 </blockquote>
2702 <table><tr><td>
2703 <pre>foo
2704 </pre>
2705 </td></tr></table>
2706 <ul><li>
2707 foo
2708 </li></ul>
2709
2710 !!end
2711
2712 !!test
2713 4. Indent-Pre and extension tags
2714 !! wikitext
2715 a <gallery>
2716 File:foobar.jpg
2717 </gallery>
2718 !! html
2719 a <ul class="gallery mw-gallery-traditional">
2720 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2721 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
2722 <div class="gallerytext">
2723 </div>
2724 </div></li>
2725 </ul>
2726
2727 !! html+tidy
2728 <p>a</p>
2729 <ul class="gallery mw-gallery-traditional">
2730 <li class="gallerybox" style="width: 155px">
2731 <div style="width: 155px">
2732 <div class="thumb" style="width: 150px;">
2733 <div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div>
2734 </div>
2735 <div class="gallerytext"></div>
2736 </div>
2737 </li>
2738 </ul>
2739 !!end
2740
2741 !! test
2742 Table wikitext syntax outside wiki-tables
2743 !! wikitext
2744 a
2745 ! not a table heading
2746 |- not a table row
2747 | not a table cell
2748 | class="foo bar" | baz
2749 b
2750 |}
2751 |-
2752 c
2753 !! html
2754 <p>a
2755 ! not a table heading
2756 |- not a table row
2757 | not a table cell
2758 | class="foo bar" | baz
2759 b
2760 |}
2761 |-
2762 c
2763 </p>
2764 !! end
2765
2766 !!test
2767 Render paragraphs when indent-pre is suppressed in blocklevels
2768 !! wikitext
2769 <blockquote>
2770 foo
2771
2772 bar
2773 </blockquote>
2774 !! html
2775 <blockquote>
2776 <p> foo
2777 </p><p> bar
2778 </p>
2779 </blockquote>
2780
2781 !!end
2782
2783 !!test
2784 4. Multiple spaces at start-of-line
2785 !! wikitext
2786 <p> foo </p>
2787 foo
2788 {|
2789 |foo
2790 |}
2791 !! html
2792 <p> foo </p>
2793 <pre> foo
2794 </pre>
2795 <table>
2796 <tr>
2797 <td>foo
2798 </td></tr></table>
2799
2800 !!end
2801
2802 ## NOTE: the leading white-space chars on empty line are significant
2803 !! test
2804 5a. White-space in indent-pre
2805 !! wikitext
2806 a<br />
2807
2808 b
2809 !! html
2810 <pre>a<br />
2811
2812 b
2813 </pre>
2814 !! end
2815
2816 ## NOTE: the leading white-space chars on empty line are significant
2817 !! test
2818 5b. White-space in indent-pre
2819 !! wikitext
2820 a
2821
2822 b
2823
2824
2825 c
2826 !! html
2827 <pre>a
2828
2829 b
2830
2831
2832 c
2833 </pre>
2834 !! end
2835
2836 !! test
2837 5c. White-space in indent-pre
2838 !! wikitext
2839 ''a''
2840 ''b''
2841 ''c''
2842 !! html
2843 <pre><i>a</i>
2844 <i>b</i>
2845 <i>c</i>
2846 </pre>
2847 !! end
2848
2849 !! test
2850 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2851 !! wikitext
2852 a
2853
2854 <!-- continue -->
2855 b
2856
2857 c
2858
2859 d
2860 !! html
2861 <pre>a
2862
2863 b
2864 </pre>
2865 <pre>c
2866
2867 </pre>
2868 <p>d
2869 </p>
2870 !! end
2871
2872 !! test
2873 7a. Indent-pre and category links
2874 !! options
2875 parsoid=wt2html,wt2wt
2876 !! wikitext
2877 [[Category:foo]] <!-- No pre-wrapping -->
2878 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2879 !! html
2880 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2881 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2882 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2883 !! end
2884
2885 !! test
2886 7b. Indent-pre and category links
2887 !! options
2888 parsoid=wt2html,wt2wt
2889 !! wikitext
2890 [[Category:foo]] a
2891 [[Category:foo]] {{echo|b}}
2892 !! html
2893 <pre>
2894 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2895
2896 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
2897 !! end
2898
2899 ###
2900 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2901 ###
2902
2903 !!test
2904 HTML-pre: 1. embedded newlines
2905 !! wikitext
2906 <pre>foo</pre>
2907
2908 <pre>
2909 foo
2910 </pre>
2911
2912 <pre>
2913
2914 foo
2915 </pre>
2916
2917 <pre>
2918
2919
2920 foo
2921 </pre>
2922 !! html
2923 <pre>foo</pre>
2924 <pre>
2925 foo
2926 </pre>
2927 <pre>
2928
2929 foo
2930 </pre>
2931 <pre>
2932
2933
2934 foo
2935 </pre>
2936
2937 !! html/parsoid
2938 <pre data-parsoid='{"stx":"html"}'>foo</pre>
2939
2940 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
2941 foo
2942 </pre>
2943
2944 <pre data-parsoid='{"stx":"html"}'>
2945
2946 foo
2947 </pre>
2948
2949 <pre data-parsoid='{"stx":"html"}'>
2950
2951
2952 foo
2953 </pre>
2954 !!end
2955
2956 !! test
2957 HTML-pre: big spaces
2958 !! wikitext
2959 <pre>
2960
2961
2962
2963
2964 haha
2965
2966
2967
2968
2969 haha
2970
2971
2972
2973
2974 </pre>
2975 !! html
2976 <pre>
2977
2978
2979
2980
2981 haha
2982
2983
2984
2985
2986 haha
2987
2988
2989
2990
2991 </pre>
2992
2993 !! html/parsoid
2994 <pre data-parsoid='{"stx":"html"}'>
2995
2996
2997
2998
2999 haha
3000
3001
3002
3003
3004 haha
3005
3006
3007
3008
3009 </pre>
3010 !! end
3011
3012 !!test
3013 HTML-pre: 2: indented text
3014 !! wikitext
3015 <pre>
3016 foo
3017 </pre>
3018 !! html
3019 <pre>
3020 foo
3021 </pre>
3022
3023 !!end
3024
3025 !!test
3026 HTML-pre: 3: other wikitext
3027 !! wikitext
3028 <pre>
3029 * foo
3030 # bar
3031 = no-h =
3032 '' no-italic ''
3033 [[ NoLink ]]
3034 </pre>
3035 !! html
3036 <pre>
3037 * foo
3038 # bar
3039 = no-h =
3040 '' no-italic ''
3041 [[ NoLink ]]
3042 </pre>
3043
3044 !!end
3045
3046 ###
3047 ### Definition lists
3048 ###
3049 !! test
3050 Simple definition
3051 !! wikitext
3052 ; name : Definition
3053 !! html
3054 <dl><dt> name&#160;</dt>
3055 <dd> Definition</dd></dl>
3056
3057 !! end
3058
3059 !! test
3060 Definition list for indentation only
3061 !! wikitext
3062 : Indented text
3063 !! html
3064 <dl><dd> Indented text</dd></dl>
3065
3066 !! end
3067
3068 !! test
3069 Definition list with no space
3070 !! wikitext
3071 ;name:Definition
3072 !! html
3073 <dl><dt>name</dt>
3074 <dd>Definition</dd></dl>
3075
3076 !!end
3077
3078 !! test
3079 Definition list with URL link
3080 !! wikitext
3081 ; http://example.com/ : definition
3082 !! html
3083 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3084 <dd> definition</dd></dl>
3085
3086 !! end
3087
3088 !! test
3089 Definition list with bracketed URL link
3090 !! wikitext
3091 ;[http://www.example.com/ Example]:Something about it
3092 !! html
3093 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3094 <dd>Something about it</dd></dl>
3095
3096 !! end
3097
3098 !! test
3099 Definition list with wikilink containing colon
3100 !! wikitext
3101 ; [[Help:FAQ]]: The least-read page on Wikipedia
3102 !! html
3103 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3104 <dd> The least-read page on Wikipedia</dd></dl>
3105
3106 !! end
3107
3108 # At Brion's and JeLuF's insistence... :)
3109 !! test
3110 Definition list with news link containing colon
3111 !! wikitext
3112 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3113 !! html
3114 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3115 <dd> This isn't even a real newsgroup!</dd></dl>
3116
3117 !! end
3118
3119 !! test
3120 Malformed definition list with colon
3121 !! wikitext
3122 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3123 !! html
3124 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3125
3126 !! end
3127
3128 !! test
3129 Definition lists: colon in external link text
3130 !! wikitext
3131 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3132 !! html
3133 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3134 <dd> OK, I made that up</dd></dl>
3135
3136 !! end
3137
3138 !! test
3139 Definition lists: colon in HTML attribute
3140 !! wikitext
3141 ;<b style="display: inline">bold</b>
3142 !! html
3143 <dl><dt><b style="display: inline">bold</b></dt></dl>
3144
3145 !! end
3146
3147 !! test
3148 Definition lists: self-closed tag
3149 !! wikitext
3150 ;one<br/>two : two-line fun
3151 !! html
3152 <dl><dt>one<br />two&#160;</dt>
3153 <dd> two-line fun</dd></dl>
3154
3155 !! end
3156
3157 !! test
3158 Bug 11748: Literal closing tags
3159 !! wikitext
3160 <dl>
3161 <dt>test 1</dt>
3162 <dd>test test test test test</dd>
3163 <dt>test 2</dt>
3164 <dd>test test test test test</dd>
3165 </dl>
3166 !! html
3167 <dl>
3168 <dt>test 1</dt>
3169 <dd>test test test test test</dd>
3170 <dt>test 2</dt>
3171 <dd>test test test test test</dd>
3172 </dl>
3173
3174 !! end
3175
3176 !! test
3177 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3178 !! wikitext
3179 <ul><li>
3180 ; term : description
3181 * unordered
3182 </li></ul>
3183 !! html
3184 <ul><li>
3185 <dl><dt> term&#160;</dt>
3186 <dd> description</dd></dl>
3187 <ul><li> unordered</li></ul>
3188 </li></ul>
3189
3190 !! end
3191
3192 !! test
3193
3194 Definition list with empty definition and following paragraph
3195 !! wikitext
3196 ; term:
3197 Paragraph text
3198 !! html
3199 <dl><dt> term</dt>
3200 <dd></dd></dl>
3201 <p>Paragraph text
3202 </p>
3203 !! end
3204
3205 !! test
3206 Nested definition lists using html syntax
3207 !! wikitext
3208 <dl><dt>x</dt>
3209 <dd>a</dd>
3210 <dd>b</dd></dl>
3211
3212 !! end
3213
3214 !! test
3215 Definition Lists: No nesting: Multiple dd's
3216 !! wikitext
3217 ;x
3218 :a
3219 :b
3220 !! html
3221 <dl><dt>x</dt>
3222 <dd>a</dd>
3223 <dd>b</dd></dl>
3224
3225 !! end
3226
3227 !! test
3228 Definition Lists: Indentation: Regular
3229 !! wikitext
3230 :i1
3231 ::i2
3232 :::i3
3233 !! html
3234 <dl><dd>i1
3235 <dl><dd>i2
3236 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3237
3238 !! end
3239
3240 !! test
3241 Definition Lists: Indentation: Missing 1st level
3242 !! wikitext
3243 ::i2
3244 :::i3
3245 !! html
3246 <dl><dd><dl><dd>i2
3247 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3248
3249 !! end
3250
3251 !! test
3252 Definition Lists: Indentation: Multi-level indent
3253 !! wikitext
3254 :::i3
3255 !! html
3256 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3257
3258 !! end
3259
3260 !! test
3261 Definition Lists: Hacky use to indent tables
3262 !! wikitext
3263 ::{|
3264 |foo
3265 |bar
3266 |}
3267 this text
3268 should be left alone
3269 !! html
3270 <dl><dd><dl><dd><table>
3271 <tr>
3272 <td>foo
3273 </td>
3274 <td>bar
3275 </td></tr></table></dd></dl></dd></dl>
3276 <p>this text
3277 should be left alone
3278 </p>
3279 !! end
3280
3281 !! test
3282 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3283 !! wikitext
3284 <!-- foo -->
3285 ::{|
3286 |foo
3287 |bar
3288 |}<!-- bar -->
3289 this text
3290 should be left alone
3291 !! html/parsoid
3292 <!-- foo -->
3293 <dl><dd><dl><dd><table><tr>
3294 <td>foo</td>
3295 <td>bar</td>
3296 </tr></table><!-- bar --></dd></dl></dd></dl>
3297 <p>this text
3298 should be left alone</p>
3299 !! end
3300
3301 !! test
3302 Definition Lists: Hacky use to indent tables, with comment before table
3303 !! wikitext
3304 ::<!-- foo -->{|
3305 |foo
3306 |}
3307 !! html/parsoid
3308 <dl><dd><dl><dd><!-- foo --><table><tr>
3309 <td>foo</td>
3310 </tr></table></dd></dl></dd></dl>
3311 !! end
3312
3313 # Bug 52473
3314 !! test
3315 Definition Lists: Hacky use to indent tables (WS-insensitive)
3316 !! options
3317 parsoid
3318 !! wikitext
3319 : {|
3320 |a
3321 |}
3322 !! html
3323 <dl>
3324 <dd> <table><tr><td>a</td></tr></table> </dd>
3325 </dl>
3326 !! end
3327 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3328 ## as an empty dt item. It also ignores all but the last ";" when followed
3329 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3330 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3331 ## ";"s.
3332 ##
3333 ## Ex: ";;t2 ::d2" is transformed into:
3334 ##
3335 ## <dl>
3336 ## <dt>t2 </dt>
3337 ## <dd>
3338 ## <dl>
3339 ## <dt></dt>
3340 ## <dd>d2</dd>
3341 ## </dl>
3342 ## </dd>
3343 ## </dl>
3344 ##
3345 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3346 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3347 ##
3348 ## <dl>
3349 ## <dt>
3350 ## <dl>
3351 ## <dt>t2 </dt>
3352 ## <dd>:d2</dd>
3353 ## </dl>
3354 ## </dt>
3355 ## </dl>
3356 ##
3357 ## All Parsoid only definition list tests have this difference.
3358 ##
3359 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3360 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3361
3362 !! test
3363 Table / list interaction: indented table with lists in table contents
3364 !! wikitext
3365 :{|
3366 |-
3367 | a
3368 * b
3369 |-
3370 | c
3371 * d
3372 |}
3373 !! html
3374 <dl><dd><table>
3375
3376 <tr>
3377 <td> a
3378 <ul><li> b</li></ul>
3379 </td></tr>
3380 <tr>
3381 <td> c
3382 <ul><li> d</li></ul>
3383 </td></tr></table></dd></dl>
3384
3385 !! end
3386
3387 !!test
3388 Table / list interaction: lists nested in tables nested in indented lists
3389 !! wikitext
3390 :{|
3391 |
3392 :a
3393 :b
3394 |
3395 *c
3396 *d
3397 |}
3398
3399 *e
3400 *f
3401 !! html
3402 <dl><dd><table>
3403 <tr>
3404 <td>
3405 <dl><dd>a</dd>
3406 <dd>b</dd></dl>
3407 </td>
3408 <td>
3409 <ul><li>c</li>
3410 <li>d</li></ul>
3411 </td></tr></table></dd></dl>
3412 <ul><li>e</li>
3413 <li>f</li></ul>
3414
3415 !!end
3416
3417 !! test
3418 Definition Lists: Nesting: Multi-level (Parsoid only)
3419 !! options
3420 parsoid
3421 !! wikitext
3422 ;t1 :d1
3423 ;;t2 ::d2
3424 ;;;t3 :::d3
3425 !! html
3426 <dl>
3427 <dt>t1 </dt>
3428 <dd>d1</dd>
3429 <dt>
3430 <dl>
3431 <dt>t2 </dt>
3432 <dd>:d2</dd>
3433 <dt>
3434 <dl>
3435 <dt>t3 </dt>
3436 <dd>::d3</dd>
3437 </dl>
3438 </dt>
3439 </dl>
3440 </dt>
3441 </dl>
3442
3443
3444 !! end
3445
3446
3447 !! test
3448 Definition Lists: Nesting: Test 2 (Parsoid only)
3449 !! options
3450 parsoid
3451 !! wikitext
3452 ;t1
3453 ::d2
3454 !! html
3455 <dl>
3456 <dt>t1</dt>
3457 <dd>
3458 <dl>
3459 <dd>d2</dd>
3460 </dl>
3461 </dd>
3462 </dl>
3463
3464 !! end
3465
3466
3467 !! test
3468 Definition Lists: Nesting: Test 3 (Parsoid only)
3469 !! options
3470 parsoid
3471 !! wikitext
3472 :;t1
3473 ::::d2
3474 !! html
3475 <dl>
3476 <dd>
3477 <dl>
3478 <dt>t1</dt>
3479 <dd>
3480 <dl>
3481 <dd>
3482 <dl>
3483 <dd>d2</dd>
3484 </dl>
3485 </dd>
3486 </dl>
3487 </dd>
3488 </dl>
3489 </dd>
3490 </dl>
3491
3492 !! end
3493
3494
3495 !! test
3496 Definition Lists: Nesting: Test 4
3497 !! wikitext
3498 ::;t3
3499 :::d3
3500 !! html
3501 <dl><dd><dl><dd><dl><dt>t3</dt>
3502 <dd>d3</dd></dl></dd></dl></dd></dl>
3503
3504 !! end
3505
3506
3507 ## The Parsoid team believes the following three test exposes a
3508 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3509 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3510 ## It also exposes a "misfeature" in tidy, which doesn't like
3511 ## <dl> tags with a single <dt> child; it converts the <dt> into
3512 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3513 !! test
3514 Definition Lists: Mixed Lists: Test 1
3515 !! wikitext
3516 :;* foo
3517 ::* bar
3518 :; baz
3519 !! html/php
3520 <dl><dd><dl><dt><ul><li> foo</li>
3521 <li> bar</li></ul></dt></dl>
3522 <dl><dt> baz</dt></dl></dd></dl>
3523
3524 !! html/php+tidy
3525 <dl>
3526 <dd>
3527 <dl>
3528 <dd>
3529 <ul>
3530 <li>foo</li>
3531 <li>bar</li>
3532 </ul>
3533 </dd>
3534 </dl>
3535 <dl>
3536 <dt>baz</dt>
3537 </dl>
3538 </dd>
3539 </dl>
3540 !! html/parsoid
3541 <dl>
3542 <dd><dl>
3543 <dt><ul>
3544 <li> foo
3545 </li>
3546 </ul></dt>
3547 <dd><ul>
3548 <li> bar
3549 </li>
3550 </ul></dd>
3551 <dt> baz</dt>
3552 </dl></dd>
3553 </dl>
3554 !! end
3555
3556 !! test
3557 Definition Lists: Mixed Lists: Test 2
3558 !! wikitext
3559 *: d1
3560 *: d2
3561 !! html
3562 <ul><li><dl><dd> d1</dd>
3563 <dd> d2</dd></dl></li></ul>
3564
3565 !! end
3566
3567
3568 !! test
3569 Definition Lists: Mixed Lists: Test 3
3570 !! wikitext
3571 *::: d1
3572 *::: d2
3573 !! html
3574 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3575 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3576
3577 !! end
3578
3579
3580 !! test
3581 Definition Lists: Mixed Lists: Test 4
3582 !! wikitext
3583 *;d1 :d2
3584 *;d3 :d4
3585 !! html
3586 <ul><li><dl><dt>d1&#160;</dt>
3587 <dd>d2</dd>
3588 <dt>d3&#160;</dt>
3589 <dd>d4</dd></dl></li></ul>
3590
3591 !! end
3592
3593
3594 !! test
3595 Definition Lists: Mixed Lists: Test 5
3596 !! wikitext
3597 *:d1
3598 *:: d2
3599 !! html
3600 <ul><li><dl><dd>d1
3601 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3602
3603 !! end
3604
3605
3606 !! test
3607 Definition Lists: Mixed Lists: Test 6
3608 !! wikitext
3609 #*:d1
3610 #*::: d3
3611 !! html
3612 <ol><li><ul><li><dl><dd>d1
3613 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3614
3615 !! end
3616
3617
3618 !! test
3619 Definition Lists: Mixed Lists: Test 7
3620 !! wikitext
3621 :* d1
3622 :* d2
3623 !! html
3624 <dl><dd><ul><li> d1</li>
3625 <li> d2</li></ul></dd></dl>
3626
3627 !! end
3628
3629
3630 !! test
3631 Definition Lists: Mixed Lists: Test 8
3632 !! wikitext
3633 :* d1
3634 ::* d2
3635 !! html
3636 <dl><dd><ul><li> d1</li></ul>
3637 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3638
3639 !! end
3640
3641
3642 !! test
3643 Definition Lists: Mixed Lists: Test 9
3644 !! wikitext
3645 *;foo :bar
3646 !! html
3647 <ul><li><dl><dt>foo&#160;</dt>
3648 <dd>bar</dd></dl></li></ul>
3649
3650 !! end
3651
3652
3653 !! test
3654 Definition Lists: Mixed Lists: Test 10
3655 !! wikitext
3656 *#;foo :bar
3657 !! html
3658 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3659 <dd>bar</dd></dl></li></ol></li></ul>
3660
3661 !! end
3662
3663 # The Parsoid team disagrees with the PHP parser's seemingly-random
3664 # rules regarding dd/dt on the next two tests. Parsoid is more
3665 # consistent, and recognizes the shared nesting and keeps the
3666 # still-open tags around until the nesting is complete.
3667 # (And tidy again converts <dt> to <dd> before 'bar'.)
3668
3669 !! test
3670 Definition Lists: Mixed Lists: Test 11
3671 !! wikitext
3672 *#*#;*;;foo :bar
3673 *#*#;boo :baz
3674 !! html/php
3675 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3676 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3677 <dl><dt>boo&#160;</dt>
3678 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3679
3680 !! html/php+tidy
3681 <ul>
3682 <li>
3683 <ol>
3684 <li>
3685 <ul>
3686 <li>
3687 <ol>
3688 <li>
3689 <dl>
3690 <dt>foo&#160;</dt>
3691 <dd>
3692 <ul>
3693 <li>
3694 <dl>
3695 <dd>
3696 <dl>
3697 <dt>bar</dt>
3698 </dl>
3699 </dd>
3700 </dl>
3701 </li>
3702 </ul>
3703 </dd>
3704 </dl>
3705 <dl>
3706 <dt>boo&#160;</dt>
3707 <dd>baz</dd>
3708 </dl>
3709 </li>
3710 </ol>
3711 </li>
3712 </ul>
3713 </li>
3714 </ol>
3715 </li>
3716 </ul>
3717 !! html/parsoid
3718 <ul>
3719 <li>
3720 <ol>
3721 <li>
3722 <ul>
3723 <li>
3724 <ol>
3725 <li>
3726 <dl>
3727 <dt>
3728 <ul>
3729 <li>
3730 <dl>
3731 <dt>
3732 <dl>
3733 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3734 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3735 </dl></dt>
3736 </dl></li>
3737 </ul></dt>
3738 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3739 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3740 </dl></li>
3741 </ol></li>
3742 </ul></li>
3743 </ol></li>
3744 </ul>
3745 !! end
3746
3747
3748 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
3749 !! test
3750 Definition Lists: Weird Ones: Test 1
3751 !! wikitext
3752 *#;*::;; foo : bar (who uses this?)
3753 !! html/php
3754 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3755 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
3756
3757 !! html/php+tidy
3758 <ul>
3759 <li>
3760 <ol>
3761 <li>
3762 <dl>
3763 <dt>foo&#160;</dt>
3764 <dd>
3765 <ul>
3766 <li>
3767 <dl>
3768 <dd>
3769 <dl>
3770 <dd>
3771 <dl>
3772 <dd>
3773 <dl>
3774 <dt>bar (who uses this?)</dt>
3775 </dl>
3776 </dd>
3777 </dl>
3778 </dd>
3779 </dl>
3780 </dd>
3781 </dl>
3782 </li>
3783 </ul>
3784 </dd>
3785 </dl>
3786 </li>
3787 </ol>
3788 </li>
3789 </ul>
3790 !! html/parsoid
3791 <ul>
3792 <li>
3793 <ol>
3794 <li>
3795 <dl>
3796 <dt>
3797 <ul>
3798 <li>
3799 <dl>
3800 <dd>
3801 <dl>
3802 <dd>
3803 <dl>
3804 <dt>
3805 <dl>
3806 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3807 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3808 </dl></dt>
3809 </dl></dd>
3810 </dl></dd>
3811 </dl></li>
3812 </ul></dt>
3813 </dl></li>
3814 </ol></li>
3815 </ul>
3816 !! end
3817
3818 ###
3819 ### External links
3820 ###
3821 !! test
3822 External links: non-bracketed
3823 !! wikitext
3824 Non-bracketed: http://example.com
3825 !! html
3826 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3827 </p>
3828 !! end
3829
3830 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3831 !! test
3832 External links: numbered
3833 !! wikitext
3834 Numbered: [http://example.com]
3835 Numbered: [http://example.net]
3836 Numbered: [http://example.com]
3837 !! html/php
3838 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3839 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3840 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3841 </p>
3842 !! html/parsoid
3843 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
3844 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
3845 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
3846 !!end
3847
3848 !! test
3849 External links: specified text
3850 !! wikitext
3851 Specified text: [http://example.com link]
3852 !! html
3853 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3854 </p>
3855 !!end
3856
3857 !! test
3858 External links: trail
3859 !! wikitext
3860 Linktrails should not work for external links: [http://example.com link]s
3861 !! html
3862 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3863 </p>
3864 !! end
3865
3866 !! test
3867 External links: dollar sign in URL
3868 !! wikitext
3869 http://example.com/1$2345
3870 !! html
3871 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3872 </p>
3873 !! end
3874
3875 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3876 !! test
3877 External links: dollar sign in URL (autonumber)
3878 !! wikitext
3879 [http://example.com/1$2345]
3880 !! html/php
3881 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3882 </p>
3883 !! html/parsoid
3884 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
3885 !!end
3886
3887 !! test
3888 External links: open square bracket forbidden in URL (bug 4377)
3889 !! options
3890 parsoid=wt2html,wt2wt,html2html
3891 !! wikitext
3892 http://example.com/1[2345
3893 !! html/php
3894 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3895 </p>
3896 !! html/parsoid
3897 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
3898 !! end
3899
3900 !! test
3901 External links: open square bracket forbidden in URL (named) (bug 4377)
3902 !! options
3903 parsoid=wt2html,html2html
3904 !! wikitext
3905 [http://example.com/1[2345]
3906 !! html/php
3907 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3908 </p>
3909 !! html/parsoid
3910 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
3911 !!end
3912
3913 # parsoid adds a space before the link name
3914 !! test
3915 External links: open square bracket forbidden in URL (named) (bug 4377)
3916 Parsoid variant.
3917 !! wikitext
3918 [http://example.com/1 [2345]
3919 !! html
3920 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3921 </p>
3922 !!end
3923
3924 !! test
3925 External links: nowiki in URL link text (bug 6230)
3926 !! wikitext
3927 [http://example.com/ <nowiki>''example site''</nowiki>]
3928 !! html
3929 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3930 </p>
3931 !! end
3932
3933 !! test
3934 External links: newline forbidden in text (bug 6230 regression check)
3935 !! wikitext
3936 [http://example.com/ first
3937 second]
3938 !! html
3939 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3940 second]
3941 </p>
3942 !!end
3943
3944 !! test
3945 External links: Pipe char between url and text
3946 !! wikitext
3947 [http://example.com | link]
3948 !! html
3949 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3950 </p>
3951 !!end
3952
3953 !! test
3954 External links: protocol-relative URL in brackets
3955 !! wikitext
3956 [//example.com/ Test]
3957 !! html
3958 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3959 </p>
3960 !! end
3961
3962 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3963 !! test
3964 External links: protocol-relative URL in brackets without text
3965 !! wikitext
3966 [//example.com]
3967 !! html/php
3968 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3969 </p>
3970 !! html/parsoid
3971 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
3972 !! end
3973
3974 !! test
3975 External links: protocol-relative URL in free text is left alone
3976 !! wikitext
3977 //example.com/Foo
3978 !! html
3979 <p>//example.com/Foo
3980 </p>
3981 !!end
3982
3983 !! test
3984 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3985 !! wikitext
3986 foo//example.com/Foo
3987 !! html
3988 <p>foo//example.com/Foo
3989 </p>
3990 !! end
3991
3992 !! test
3993 External links: with no contents
3994 !! wikitext
3995 [http://en.wikipedia.org/wiki/Foo]
3996
3997 [[wikipedia:Foo|Bar]]
3998
3999 [[wikipedia:Foo|<span>Bar</span>]]
4000 !! html/php
4001 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4002 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4003 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4004 </p>
4005 !! html/parsoid
4006 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4007 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo">Bar</a></p>
4008 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"><span>Bar</span></a></p>
4009 !! end
4010
4011 !! test
4012 External image
4013 !! wikitext
4014 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4015 !! html
4016 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4017 </p>
4018 !! end
4019
4020 !! test
4021 External image from https
4022 !! wikitext
4023 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4024 !! html
4025 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4026 </p>
4027 !! end
4028
4029 !! test
4030 External image (when not allowed)
4031 !! options
4032 wgAllowExternalImages=0
4033 !! wikitext
4034 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4035 !! html
4036 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
4037 </p>
4038 !! end
4039
4040 !! test
4041 Link to non-http image, no img tag
4042 !! wikitext
4043 Link to non-http image, no img tag: ftp://example.com/test.jpg
4044 !! html
4045 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
4046 </p>
4047 !! end
4048
4049 !! test
4050 External links: terminating separator
4051 !! wikitext
4052 Terminating separator: http://example.com/thing,
4053 !! html
4054 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4055 </p>
4056 !! end
4057
4058 !! test
4059 External links: intervening separator
4060 !! wikitext
4061 Intervening separator: http://example.com/1,2,3
4062 !! html
4063 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4064 </p>
4065 !! end
4066
4067 !! test
4068 External links: old bug with URL in query
4069 !! wikitext
4070 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4071 !! html
4072 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4073 </p>
4074 !! end
4075
4076 !! test
4077 External links: old URL-in-URL bug, mixed protocols
4078 !! wikitext
4079 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4080 !! html
4081 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4082 </p>
4083 !!end
4084
4085 !! test
4086 External links: URL in text
4087 !! wikitext
4088 URL in text: [http://example.com http://example.com]
4089 !! html
4090 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4091 </p>
4092 !! end
4093
4094 !! test
4095 External links: Clickable images
4096 !! wikitext
4097 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4098 !! html
4099 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
4100 </p>
4101 !!end
4102
4103 !! test
4104 External links: raw ampersand
4105 !! wikitext
4106 Old &amp; use: http://x&y
4107 !! html
4108 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4109 </p>
4110 !! end
4111
4112 !! test
4113 External links: encoded ampersand
4114 !! wikitext
4115 Old &amp; use: http://x&amp;y
4116 !! html/php
4117 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4118 </p>
4119 !! html/parsoid
4120 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4121 !! end
4122
4123 !! test
4124 External links: encoded equals (bug 6102)
4125 !! wikitext
4126 http://example.com/?foo&#61;bar
4127 !! html/php
4128 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4129 </p>
4130 !! html/parsoid
4131 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4132 !! end
4133
4134 ##
4135 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4136 ## does it number them. As discussed in bug 53505, we can identify
4137 ## autonumbered links via CSS.
4138 ##
4139
4140 !! test
4141 External links: [raw ampersand]
4142 !! wikitext
4143 Old &amp; use: [http://x&y]
4144 !! html/php
4145 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4146 </p>
4147 !! html/parsoid
4148 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4149 !! end
4150
4151 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4152 # mode will return the [raw ampersand] wikitext
4153 !! test
4154 External links: [encoded ampersand]
4155 !! options
4156 parsoid=wt2html,wt2wt,html2html
4157 !! wikitext
4158 Old &amp; use: [http://x&amp;y]
4159 !! html/php
4160 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4161 </p>
4162 !! html/parsoid
4163 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4164 !! end
4165
4166 !! test
4167 External links: [raw equals]
4168 !! wikitext
4169 [http://example.com/?foo=bar]
4170 !! html/php
4171 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4172 </p>
4173 !! html/parsoid
4174 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4175 !! end
4176
4177 # note that parsoid html is identical to [raw equals] case; so html2wt
4178 # mode will return the [raw equals] wikitext
4179 !! test
4180 External links: [encoded equals] (bug 6102)
4181 !! options
4182 parsoid=wt2html,wt2wt,html2html
4183 !! wikitext
4184 [http://example.com/?foo&#61;bar]
4185 !! html/php
4186 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4187 </p>
4188 !! html/parsoid
4189 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4190 !! end
4191
4192 # xxx parsoid strips the IDN character, so the round-trip tests will
4193 # obviously fail and are disabled. --cscott
4194 !! test
4195 External links: [IDN ignored character reference in hostname; strip it right off]
4196 !! options
4197 parsoid=wt2html,wt2wt,html2html
4198 !! wikitext
4199 [http://e&zwnj;xample.com/]
4200 !! html/php
4201 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4202 </p>
4203 !! html/parsoid
4204 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4205 !! end
4206
4207 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4208 # Where an external link could easily circumvent the sanitization of the text of
4209 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4210 # test demands a higher standard. That's a bit strange.
4211 #
4212 # Example:
4213 #
4214 # http://e‌xample.com -> [http://example.com|http://example.com]
4215 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4216 #
4217 # The first example is sanitized, but the second is not. Any security benefits
4218 # from this production are trivial to circumvent. Either remove this test and
4219 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4220 # the test accordingly.
4221 #
4222 # All our love,
4223 # The Parsoid team.
4224 # xxx parsoid strips the IDN character, so the round-trip tests will
4225 # obviously fail and are disabled. --cscott
4226 !! test
4227 External links: IDN ignored character reference in hostname; strip it right off
4228 !! options
4229 parsoid=wt2html,html2html
4230 !! wikitext
4231 http://e&zwnj;xample.com/
4232 !! html/php
4233 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4234 </p>
4235 !! html/parsoid
4236 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4237 !! end
4238
4239 !! test
4240 External links: www.jpeg.org (bug 554)
4241 !! wikitext
4242 http://www.jpeg.org
4243 !! html
4244 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4245 </p>
4246 !! end
4247
4248 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4249 !! test
4250 External links: URL within URL (original bug 2)
4251 !! wikitext
4252 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4253 !! html/php
4254 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4255 </p>
4256 !! html/parsoid
4257 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4258 !! end
4259
4260 !! test
4261 BUG 361: URL inside bracketed URL
4262 !! wikitext
4263 [http://www.example.com/foo http://www.example.com/bar]
4264 !! html
4265 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4266 </p>
4267 !! end
4268
4269 !! test
4270 BUG 361: URL within URL, not bracketed
4271 !! wikitext
4272 http://www.example.com/foo?=http://www.example.com/bar
4273 !! html
4274 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
4275 </p>
4276 !! end
4277
4278 !! test
4279 BUG 289: ">"-token in URL-tail
4280 !! wikitext
4281 http://www.example.com/<hello>
4282 !! html
4283 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4284 </p>
4285 !!end
4286
4287 !! test
4288 BUG 289: literal ">"-token in URL-tail
4289 !! wikitext
4290 http://www.example.com/<b>html</b>
4291 !! html
4292 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4293 </p>
4294 !!end
4295
4296 !! test
4297 BUG 289: ">"-token in bracketed URL
4298 !! wikitext
4299 [http://www.example.com/<hello> stuff]
4300 !! html
4301 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4302 </p>
4303 !!end
4304
4305 !! test
4306 BUG 289: literal ">"-token in bracketed URL
4307 !! wikitext
4308 [http://www.example.com/<b>html</b> stuff]
4309 !! html
4310 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4311 </p>
4312 !!end
4313
4314 !! test
4315 BUG 289: literal double quote at end of URL
4316 !! wikitext
4317 http://www.example.com/"hello"
4318 !! html
4319 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4320 </p>
4321 !!end
4322
4323 !! test
4324 BUG 289: literal double quote in bracketed URL
4325 !! wikitext
4326 [http://www.example.com/"hello" stuff]
4327 !! html
4328 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4329 </p>
4330 !!end
4331
4332 !! test
4333 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4334 !! wikitext
4335 [http://www.example.com test]
4336 !! html
4337 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4338 </p>
4339 !! end
4340
4341 !! test
4342 External links: link text with spaces
4343 !! wikitext
4344 [http://www.example.com a b c]
4345 [http://www.example.com ''a'' ''b'']
4346 !! html
4347 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4348 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4349 </p>
4350 !! end
4351
4352 !! test
4353 External links: wiki links within external link (Bug 3695)
4354 !! wikitext
4355 [http://example.com [[wikilink]] embedded in ext link]
4356 !! html/php
4357 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
4358 </p>
4359 !! html/parsoid
4360 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink">wikilink</a><span> embedded in ext link</span></p>
4361 !! end
4362
4363 !! test
4364 BUG 787: Links with one slash after the url protocol are invalid
4365 !! wikitext
4366 http:/example.com
4367
4368 [http:/example.com title]
4369 !! html
4370 <p>http:/example.com
4371 </p><p>[http:/example.com title]
4372 </p>
4373 !! end
4374
4375 !! test
4376 Bracketed external links with template-generated invalid target
4377 !! wikitext
4378 [{{echo|http:/example.com}} title]
4379 !! html
4380 <p>[http:/example.com title]
4381 </p>
4382 !! end
4383
4384 !! test
4385 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4386 !! wikitext
4387 ''[http://example.com text'']
4388 [http://example.com '''text]'''
4389 ''Something [http://example.com in italic'']
4390 ''Something [http://example.com mixed''''', even bold]'''
4391 '''''Now [http://example.com both''''']
4392 !! html
4393 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4394 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4395 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4396 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4397 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4398 </p>
4399 !! end
4400
4401
4402 !! test
4403 Bug 4781: %26 in URL
4404 !! wikitext
4405 http://www.example.com/?title=AT%26T
4406 !! html/php
4407 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4408 </p>
4409 !! html/parsoid
4410 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4411 !! end
4412
4413 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4414 # % is actually legal in HTML5. Any change in output would need testing though.
4415 !! test
4416 Bug 4781, 5267: %25 in URL
4417 !! wikitext
4418 http://www.example.com/?title=100%25_Bran
4419 !! html/php
4420 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
4421 </p>
4422 !! html/parsoid
4423 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4424 !! end
4425
4426 !! test
4427 Bug 4781, 5267: %28, %29 in URL
4428 !! wikitext
4429 http://www.example.com/?title=Ben-Hur_%281959_film%29
4430 !! html/php
4431 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
4432 </p>
4433 !! html/parsoid
4434 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
4435 !! end
4436
4437
4438 !! test
4439 Bug 4781: %26 in autonumber URL
4440 !! wikitext
4441 [http://www.example.com/?title=AT%26T]
4442 !! html/php
4443 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4444 </p>
4445 !! html/parsoid
4446 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4447 !! end
4448
4449 !! test
4450 Bug 4781, 5267: %26 in autonumber URL
4451 !! wikitext
4452 [http://www.example.com/?title=100%25_Bran]
4453 !! html/php
4454 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4455 </p>
4456 !! html/parsoid
4457 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4458 !! end
4459
4460 !! test
4461 Bug 4781, 5267: %28, %29 in autonumber URL
4462 !! wikitext
4463 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4464 !! html/php
4465 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4466 </p>
4467 !! html/parsoid
4468 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4469 !! end
4470
4471
4472 !! test
4473 Bug 4781: %26 in bracketed URL
4474 !! wikitext
4475 [http://www.example.com/?title=AT%26T link]
4476 !! html/php
4477 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4478 </p>
4479 !! html/parsoid
4480 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4481 !! end
4482
4483 !! test
4484 Bug 4781, 5267: %25 in bracketed URL
4485 !! wikitext
4486 [http://www.example.com/?title=100%25_Bran link]
4487 !! html
4488 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4489 </p>
4490 !! end
4491
4492 !! test
4493 Bug 4781, 5267: %28, %29 in bracketed URL
4494 !! wikitext
4495 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4496 !! html/php
4497 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4498 </p>
4499 !! html/parsoid
4500 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4501 !! end
4502
4503 !! test
4504 External link containing a period in the anchor. (bug 63947)
4505 !! wikitext
4506 [//foo.org/bar#baz. bang]
4507
4508 [//foo.org/bar. bang]
4509 !! html/php
4510 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4511 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4512 </p>
4513 !! html/parsoid
4514 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4515 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4516 !! end
4517
4518 !! test
4519 External link containing a single quote. (bug 63947)
4520 !! wikitext
4521 [//foo.org/bar'baz]
4522
4523 [//foo.org/bar'baz bang]
4524 !! html/php
4525 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4526 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4527 </p>
4528 !! html/parsoid
4529 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4530 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4531 !! end
4532
4533
4534 !! test
4535 External link containing a period in the anchor. (bug 63947)
4536 !! wikitext
4537 [//foo.org/bar#baz. bang]
4538
4539 [//foo.org/bar. bang]
4540 !! html/php
4541 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4542 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4543 </p>
4544 !! html/parsoid
4545 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4546 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4547 !! end
4548
4549 !! test
4550 External link containing a single quote. (bug 63947)
4551 !! wikitext
4552 [//foo.org/bar'baz]
4553
4554 [//foo.org/bar'baz bang]
4555 !! html/php
4556 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4557 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4558 </p>
4559 !! html/parsoid
4560 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4561 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4562 !! end
4563
4564
4565 !! test
4566 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4567 !! wikitext
4568 Some [http://example.com/ pretty ''italics'' and stuff]!
4569 !! html
4570 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4571 </p>
4572 !! end
4573
4574 !! test
4575 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4576 !! wikitext
4577 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4578 !! html
4579 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
4580 </p>
4581 !! end
4582
4583 !! test
4584 External link containing double-single-quotes with no space separating the url from text in italics
4585 !! wikitext
4586 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
4587 !! html/php
4588 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
4589 </p>
4590 !! html/php+tidy
4591 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
4592 !! html/parsoid
4593 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)">Museo Picasso</a><span>.</span></p>
4594 !! end
4595
4596 !! test
4597 External link with comments in link text
4598 !! wikitext
4599 [http://www.google.com Google <!-- comment -->]
4600 !! html
4601 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4602 </p>
4603 !! end
4604
4605 !! test
4606 URL-encoding in URL functions (single parameter)
4607 !! wikitext
4608 {{localurl:Some page|amp=&}}
4609 !! html
4610 <p>/index.php?title=Some_page&amp;amp=&amp;
4611 </p>
4612 !! end
4613
4614 !! test
4615 URL-encoding in URL functions (multiple parameters)
4616 !! wikitext
4617 {{localurl:Some page|q=?&amp=&}}
4618 !! html
4619 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4620 </p>
4621 !! end
4622
4623 !! test
4624 Brackets in urls
4625 !! wikitext
4626 http://example.com/index.php?foozoid%5B%5D=bar
4627
4628 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4629 !! html/php
4630 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
4631 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
4632 </p>
4633 !! html/parsoid
4634 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
4635
4636 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4637 !! end
4638
4639 !! test
4640 IPv6 urls (bug 21261)
4641 !! options
4642 disabled
4643 !! wikitext
4644 http://[2404:130:0:1000::187:2]/index.php
4645 !! html
4646 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
4647 </p>
4648 !! end
4649
4650 !! test
4651 Non-extlinks in brackets
4652 !! wikitext
4653 [foo]
4654 [foo bar]
4655 [foo ''bar'']
4656 [fool's] errand
4657 [fool's errand]
4658 [{{echo|foo}}]
4659 [{{echo|foo}} bar]
4660 [{{echo|foo}} ''bar'']
4661 [{{echo|foo}}l's] errand
4662 [{{echo|foo}}l's errand]
4663 [url={{echo|foo}}]
4664 [url=http://example.com]
4665 !! html
4666 <p>[foo]
4667 [foo bar]
4668 [foo <i>bar</i>]
4669 [fool's] errand
4670 [fool's errand]
4671 [foo]
4672 [foo bar]
4673 [foo <i>bar</i>]
4674 [fool's] errand
4675 [fool's errand]
4676 [url=foo]
4677 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4678 </p>
4679 !! end
4680
4681 !! test
4682 Percent encoding in external links
4683 !! wikitext
4684 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4685 !! html/php
4686 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4687 </p>
4688 !! html/parsoid
4689 <p><a rel="mw:ExtLink"
4690 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4691 !! end
4692
4693 !! test
4694 Use url link syntax for links where the content is equal the link target
4695 !! wikitext
4696 http://example.com
4697 !! html/php
4698 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4699 </p>
4700 !! html/parsoid
4701 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4702 !! end
4703
4704 !! test
4705 Parenthesis in external links, especially URL links
4706 !! wikitext
4707 http://example.com)
4708
4709 http://example.com/test)
4710
4711 http://example.com/(test)
4712
4713 http://example.com/((test)
4714
4715 (http://example.com/(test))
4716
4717 (http://example.com/(test)))))
4718
4719 http://example.com/a)b
4720
4721 [http://example.com) foo]
4722 !! html/php
4723 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4724 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4725 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4726 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4727 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4728 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4729 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4730 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4731 </p>
4732 !! html/parsoid
4733 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4734 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4735 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4736 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4737 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4738 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4739 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4740 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4741 !! end
4742
4743 !! test
4744 Parenthesis in external links, w/ transclusion or comment
4745 !! wikitext
4746 (http://example.com/{{echo|hi}})
4747
4748 (http://example.com<!-- hi -->)
4749 !! html/php
4750 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4751 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4752 </p>
4753 !! html/parsoid
4754 <p>(<a data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\">hi&lt;/span>"}]]}' typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}'>http://example.com/hi</a>)</p>
4755
4756 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
4757 !! end
4758
4759 !! test
4760 Replace invalid link targets when serializing
4761 !! options
4762 parsoid=html2wt
4763 !! html
4764 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
4765 !! wikitext
4766 [[MediaWiki:Badtitletext|Manual]]
4767 !! end
4768
4769 ###
4770 ### Quotes
4771 ###
4772
4773 !! test
4774 Quotes
4775 !! wikitext
4776 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4777
4778 Normal text. '''''Bold italic text.''''' Normal text.
4779 !! html
4780 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4781 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4782 </p>
4783 !! end
4784
4785
4786 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4787 # parser strips. The wikitext contains just the first half of the bold
4788 # quote pair.
4789 !! test
4790 Unclosed and unmatched quotes
4791 !! wikitext
4792 '''''Bold italic text '''with bold deactivated''' in between.'''''
4793
4794 '''''Bold italic text ''with italic deactivated'' in between.'''''
4795
4796 '''Bold text..
4797
4798 ..spanning two paragraphs (should not work).'''
4799
4800 '''Bold tag left open
4801
4802 ''Italic tag left open
4803
4804 Normal text.
4805
4806 <!-- Unmatching number of opening, closing tags: -->
4807 '''This year''''s election ''should'' beat '''last year''''s.
4808
4809 ''Tom'''s car is bigger than ''Susan'''s.
4810
4811 Plain ''italic'''s plain
4812 !! html/php
4813 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4814 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4815 </p><p><b>Bold text..</b>
4816 </p><p>..spanning two paragraphs (should not work).
4817 </p><p><b>Bold tag left open</b>
4818 </p><p><i>Italic tag left open</i>
4819 </p><p>Normal text.
4820 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4821 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4822 </p><p>Plain <i>italic'</i>s plain
4823 </p>
4824 !! html/parsoid
4825 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4826 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4827 </p><p><b>Bold text..</b>
4828 </p><p>..spanning two paragraphs (should not work).<b></b>
4829 </p><p><b>Bold tag left open</b>
4830 </p><p><i>Italic tag left open</i>
4831 </p><p>Normal text.
4832 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4833 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4834 </p><p>Plain <i>italic'</i>s plain
4835 </p>
4836 !! end
4837
4838 ###
4839 ### Tables
4840 ###
4841 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4842 ###
4843
4844 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4845 # is the bare minimum required by the spec, see:
4846 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4847 # Parsoid team replies: empty table tags are legal in HTML5
4848 !! test
4849 A table with no data.
4850 !! options
4851 parsoid=wt2html
4852 !! wikitext
4853 {||}
4854 !! html/php
4855
4856 !! html/parsoid
4857 <table></table>
4858
4859 !! end
4860
4861 !! test
4862 A table with stray table end tags on start tag line (wt2html)
4863 !! options
4864 parsoid=wt2html
4865 !! wikitext
4866 {|style="color: red;"|}
4867
4868 {|style="color: red;" |}
4869 |foo
4870 |}
4871
4872 {|style="color: red;"|} id="foo"
4873 |foo
4874 |}
4875
4876 {|style="color: red;" |} id="foo"
4877 |foo
4878 |}
4879 !! html
4880 <table style="color: red;"></table>
4881
4882 <table style="color: red;">
4883 <tbody><tr>
4884 <td>foo</td>
4885 </tr></tbody>
4886 </table>
4887
4888 <table style="color: red;" id="foo">
4889 <tbody><tr>
4890 <td>foo</td>
4891 </tr></tbody>
4892 </table>
4893
4894 <table style="color: red;" id="foo">
4895 <tbody><tr>
4896 <td>foo</td>
4897 </tr></tbody>
4898 </table>
4899
4900 !! end
4901
4902 !! test
4903 A table with no data (take 2)
4904 !! wikitext
4905 {|
4906 |}
4907 !! html/parsoid
4908 <table></table>
4909 !! end
4910
4911 # A table with nothing but a caption is invalid XHTML, we might want to render
4912 # this as <p>caption</p>
4913 # Parsoid team replies: table with only a caption is legal in HTML5
4914 !! test
4915 A table with nothing but a caption
4916 !! wikitext
4917 {|
4918 |+ caption
4919 |}
4920 !! html/php
4921 <table>
4922 <caption> caption
4923 </caption><tr><td></td></tr></table>
4924
4925 !! html/parsoid
4926 <table><caption> caption</caption></table>
4927 !! end
4928
4929 !! test
4930 A table with caption with default-spaced attributes and a table row
4931 !! wikitext
4932 {|
4933 |+ style="color: red;" | caption1
4934 |-
4935 | foo
4936 |}
4937 !! html
4938 <table>
4939 <caption style="color: red;"> caption1
4940 </caption>
4941 <tr>
4942 <td> foo
4943 </td></tr></table>
4944
4945 !! end
4946
4947 !! test
4948 A table with captions with non-default spaced attributes and a table row
4949 !! wikitext
4950 {|
4951 |+style="color: red;"|caption2
4952 |+ style="color: red;"| caption3
4953 |-
4954 | foo
4955 |}
4956 !! html
4957 <table>
4958 <caption style="color: red;">caption2
4959 </caption>
4960 <caption style="color: red;"> caption3
4961 </caption>
4962 <tr>
4963 <td> foo
4964 </td></tr></table>
4965
4966 !! end
4967
4968 !! test
4969 Table td-cell syntax variations
4970 !! wikitext
4971 {|
4972 | foo bar foo | baz
4973 | foo bar foo || baz
4974 | style='color:red;' | baz
4975 | style='color:red;' || baz
4976 |}
4977 !! html
4978 <table>
4979 <tr>
4980 <td> baz
4981 </td>
4982 <td> foo bar foo </td>
4983 <td> baz
4984 </td>
4985 <td style="color:red;"> baz
4986 </td>
4987 <td> style='color:red;' </td>
4988 <td> baz
4989 </td></tr></table>
4990
4991 !! end
4992
4993 !! test
4994 Simple table
4995 !! wikitext
4996 {|
4997 | 1 || 2
4998 |-
4999 | 3 || 4
5000 |}
5001 !! html
5002 <table>
5003 <tr>
5004 <td> 1 </td>
5005 <td> 2
5006 </td></tr>
5007 <tr>
5008 <td> 3 </td>
5009 <td> 4
5010 </td></tr></table>
5011
5012 !! end
5013
5014 !! test
5015 Simple table but with multiple dashes for row wikitext
5016 !! wikitext
5017 {|
5018 | foo
5019 |-----
5020 | bar
5021 |}
5022 !! html
5023 <table>
5024 <tr>
5025 <td> foo
5026 </td></tr>
5027 <tr>
5028 <td> bar
5029 </td></tr></table>
5030
5031 !! end
5032 !! test
5033 Multiplication table
5034 !! wikitext
5035 {| border="1" cellpadding="2"
5036 |+Multiplication table
5037 |-
5038 ! &times; !! 1 !! 2 !! 3
5039 |-
5040 ! 1
5041 | 1 || 2 || 3
5042 |-
5043 ! 2
5044 | 2 || 4 || 6
5045 |-
5046 ! 3
5047 | 3 || 6 || 9
5048 |-
5049 ! 4
5050 | 4 || 8 || 12
5051 |-
5052 ! 5
5053 | 5 || 10 || 15
5054 |}
5055 !! html
5056 <table border="1" cellpadding="2">
5057 <caption>Multiplication table
5058 </caption>
5059 <tr>
5060 <th> &#215; </th>
5061 <th> 1 </th>
5062 <th> 2 </th>
5063 <th> 3
5064 </th></tr>
5065 <tr>
5066 <th> 1
5067 </th>
5068 <td> 1 </td>
5069 <td> 2 </td>
5070 <td> 3
5071 </td></tr>
5072 <tr>
5073 <th> 2
5074 </th>
5075 <td> 2 </td>
5076 <td> 4 </td>
5077 <td> 6
5078 </td></tr>
5079 <tr>
5080 <th> 3
5081 </th>
5082 <td> 3 </td>
5083 <td> 6 </td>
5084 <td> 9
5085 </td></tr>
5086 <tr>
5087 <th> 4
5088 </th>
5089 <td> 4 </td>
5090 <td> 8 </td>
5091 <td> 12
5092 </td></tr>
5093 <tr>
5094 <th> 5
5095 </th>
5096 <td> 5 </td>
5097 <td> 10 </td>
5098 <td> 15
5099 </td></tr></table>
5100
5101 !! end
5102
5103 !! test
5104 Accept "||" in table headings
5105 !! wikitext
5106 {|
5107 !h1 || h2
5108 |}
5109 !! html
5110 <table>
5111 <tr>
5112 <th>h1 </th>
5113 <th> h2
5114 </th></tr></table>
5115
5116 !! end
5117
5118 !! test
5119 Accept "!!" in table data
5120 !! wikitext
5121 {|
5122 | Foo!! ||
5123 |}
5124 !! html
5125 <table>
5126 <tr>
5127 <td> Foo!! </td>
5128 <td>
5129 </td></tr></table>
5130
5131 !! html/parsoid
5132 <table data-parsoid='{}'>
5133 <tbody data-parsoid='{}'><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
5134 </tbody></table>
5135 !! end
5136
5137 !! test
5138 Accept "||" in indented table headings
5139 !! wikitext
5140 :{|
5141 !h1 || h2
5142 |}
5143 !! html
5144 <dl><dd><table>
5145 <tr>
5146 <th>h1 </th>
5147 <th> h2
5148 </th></tr></table></dd></dl>
5149
5150 !! end
5151
5152 !! test
5153 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5154 !! wikitext
5155 {|
5156 !| h1
5157 || a
5158 |}
5159 !! html
5160 <table>
5161 <tr>
5162 <th> h1
5163 </th>
5164 <td> a
5165 </td></tr></table>
5166
5167 !! end
5168
5169 !!test
5170 Accept "| !" at start of line in tables (ignore !-attribute)
5171 !! wikitext
5172 {|
5173 |-
5174 | !style="color:red" | bar
5175 |}
5176 !! html
5177 <table>
5178
5179 <tr>
5180 <td> bar
5181 </td></tr></table>
5182
5183 !!end
5184
5185 !!test
5186 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
5187 !! wikitext
5188 {|
5189 |-
5190 |style='color:red;'|+1
5191 |style='color:blue;'|-1
5192 |-
5193 | 1 || 2 || 3
5194 | 1 ||+2 ||-3
5195 |-
5196 | +1
5197 | -1
5198 |}
5199 !! html
5200 <table>
5201
5202 <tr>
5203 <td style="color:red;">+1
5204 </td>
5205 <td style="color:blue;">-1
5206 </td></tr>
5207 <tr>
5208 <td> 1 </td>
5209 <td> 2 </td>
5210 <td> 3
5211 </td>
5212 <td> 1 </td>
5213 <td>+2 </td>
5214 <td>-3
5215 </td></tr>
5216 <tr>
5217 <td> +1
5218 </td>
5219 <td> -1
5220 </td></tr></table>
5221
5222 !!end
5223
5224 !! test
5225 Table rowspan
5226 !! wikitext
5227 {| border=1
5228 | Cell 1, row 1
5229 |rowspan=2| Cell 2, row 1 (and 2)
5230 | Cell 3, row 1
5231 |-
5232 | Cell 1, row 2
5233 | Cell 3, row 2
5234 |}
5235 !! html
5236 <table border="1">
5237 <tr>
5238 <td> Cell 1, row 1
5239 </td>
5240 <td rowspan="2"> Cell 2, row 1 (and 2)
5241 </td>
5242 <td> Cell 3, row 1
5243 </td></tr>
5244 <tr>
5245 <td> Cell 1, row 2
5246 </td>
5247 <td> Cell 3, row 2
5248 </td></tr></table>
5249
5250 !! end
5251
5252 !! test
5253 Nested table
5254 !! wikitext
5255 {| border=1
5256 | &alpha;
5257 |
5258 {| bgcolor=#ABCDEF border=2
5259 |nested
5260 |-
5261 |table
5262 |}
5263 |the original table again
5264 |}
5265 !! html
5266 <table border="1">
5267 <tr>
5268 <td> &#945;
5269 </td>
5270 <td>
5271 <table bgcolor="#ABCDEF" border="2">
5272 <tr>
5273 <td>nested
5274 </td></tr>
5275 <tr>
5276 <td>table
5277 </td></tr></table>
5278 </td>
5279 <td>the original table again
5280 </td></tr></table>
5281
5282 !! end
5283
5284 !! test
5285 Invalid attributes in table cell (bug 1830)
5286 !! wikitext
5287 {|
5288 |Cell:|broken
5289 |}
5290 !! html
5291 <table>
5292 <tr>
5293 <td>broken
5294 </td></tr></table>
5295
5296 !! end
5297
5298
5299 # The "|}" to close the table is missing from the input, so parsoid's
5300 # *2wt modes will fail.
5301 !! test
5302 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5303 !! options
5304 parsoid=wt2html,html2html
5305 !! wikitext
5306 {|
5307 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5308 !! html/php
5309 <table>
5310 <tr>
5311 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5312 <td>]" onmouseover="alert(document.cookie)"&gt;test
5313 </td>
5314 </tr>
5315 </table>
5316
5317 !! html/parsoid
5318 <table><tbody>
5319 <tr>
5320 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5321 !! end
5322
5323
5324 !! test
5325 Indented table markup mixed with indented pre content (proposed in bug 6200)
5326 !! wikitext
5327 <table>
5328 <tr>
5329 <td>
5330 Text that should be rendered preformatted
5331 </td>
5332 </tr>
5333 </table>
5334 !! html
5335 <table>
5336 <tr>
5337 <td>
5338 <pre>Text that should be rendered preformatted
5339 </pre>
5340 </td>
5341 </tr>
5342 </table>
5343
5344 !! end
5345
5346 !! test
5347 Template-generated table cell attributes and cell content
5348 !! wikitext
5349 {|
5350 |{{table_attribs}}
5351 | {{table_attribs}}
5352 |}
5353 !! html
5354 <table>
5355 <tr>
5356 <td style="color: red"> Foo
5357 </td>
5358 <td style="color: red"> Foo
5359 </td></tr></table>
5360
5361 !! end
5362
5363 !! test
5364 Template-generated table cell attributes and cell content (2)
5365 !! wikitext
5366 {|
5367 |align=center {{table_attribs}}
5368 |}
5369 !! html
5370 <table>
5371 <tr>
5372 <td align="center" style="color: red"> Foo
5373 </td></tr></table>
5374
5375 !! end
5376
5377 !! test
5378 Template-generated table cell attributes and cell content (3)
5379 !! wikitext
5380 {|
5381 |align=center {{table_cells}}
5382 |}
5383 !! html
5384 <table>
5385 <tr>
5386 <td align="center" style="color: red"> Foo </td>
5387 <td> Bar </td>
5388 <td> Baz
5389 </td></tr></table>
5390
5391 !! end
5392
5393 !! test
5394 Table with row followed by newlines and table heading
5395 !! wikitext
5396 {|
5397 |-
5398
5399 ! foo
5400 |}
5401 !! html
5402 <table>
5403
5404
5405 <tr>
5406 <th> foo
5407 </th></tr></table>
5408
5409 !! end
5410
5411 !! test
5412 Table with empty line following the start tag
5413 !! wikitext
5414 {|
5415
5416 |-
5417 | foo
5418 |}
5419 !! html
5420 <table>
5421
5422
5423 <tr>
5424 <td> foo
5425 </td></tr></table>
5426
5427 !! end
5428
5429 # FIXME: Preserve the attribute properly (with an empty string as value) in
5430 # the PHP parser. Parsoid implements the behavior below.
5431 !! test
5432 Table attributes with empty value
5433 !! wikitext
5434 {|
5435 | style=| hello
5436 |}
5437 !! html/parsoid
5438 <table>
5439 <tbody>
5440 <tr>
5441 <td style=""> hello
5442 </td></tr></tbody></table>
5443
5444 !! end
5445
5446 !! test
5447 Wikitext table with a lot of comments
5448 !! wikitext
5449 {|
5450 <!-- c0 -->
5451 | foo
5452 <!-- c1 -->
5453 |- <!-- c2 -->
5454 <!-- c3 -->
5455 |<!-- c4 -->
5456 <!-- c5 -->
5457 |}
5458 !! html
5459 <table>
5460 <tr>
5461 <td> foo
5462 </td></tr>
5463 <tr>
5464 <td>
5465 </td></tr></table>
5466
5467 !! end
5468
5469 !! test
5470 Wikitext table with double-line table cell
5471 !! wikitext
5472 {|
5473 |a
5474 b
5475 |}
5476 !! html
5477 <table>
5478 <tr>
5479 <td>a
5480 <p>b
5481 </p>
5482 </td></tr></table>
5483
5484 !! end
5485
5486 !! test
5487 Table cell with a single comment
5488 !! wikitext
5489 {|
5490 | <!-- c1 -->
5491 | a
5492 |}
5493 !! html
5494 <table>
5495 <tr>
5496 <td>
5497 </td>
5498 <td> a
5499 </td></tr></table>
5500
5501 !! end
5502
5503 !! test
5504 Table-cell after a comment-only-empty-line
5505 !! wikitext
5506 {|
5507 |a
5508 <!--c1-->
5509 <!--c2-->| b
5510 |}
5511 !! html
5512 <table>
5513 <tr>
5514 <td>a
5515 </td>
5516 <td> b
5517 </td></tr></table>
5518
5519 !! html/parsoid
5520 <table>
5521 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5522 <!--c1-->
5523 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5524 </tbody></table>
5525
5526 !! end
5527
5528 # The expected HTML structure in this test is debatable. The PHP parser does
5529 # not parse this kind of table at all. The main focus for Parsoid is on
5530 # round-tripping, so this output is ok for now. TODO: revisit!
5531 !! test
5532 Wikitext table with html-syntax row
5533 !! wikitext
5534 {|
5535 |-
5536 <td>foo</td>
5537 |}
5538 !! html/parsoid
5539 <table>
5540 <tbody>
5541 <tr>
5542 <td>foo</td></tr></tbody></table>
5543 !! end
5544
5545 ## Note that Parsoid output differs from PHP and PHP+tidy here.
5546 ## The lack of <tr> tags in the PHP output is arguably a bug in the
5547 ## PHP parser, which tidy then compounds by fostering the content
5548 ## entirely out of the table. Parsoid recognizes the table context
5549 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
5550 ## depends on PHP's treatment of broken table markup!
5551 !! test
5552 Implicit <td> after a |-
5553 !! options
5554 parsoid=wt2html,wt2wt
5555 !! wikitext
5556 {|
5557 |-
5558 a
5559 |}
5560 !! html/php
5561 <table>
5562
5563 a
5564 </table>
5565
5566 !! html/php+tidy
5567 <p>a</p>
5568 !! html/parsoid
5569 <table>
5570 <tr><td>a</td></tr>
5571 </table>
5572 !! end
5573
5574 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
5575 !! test
5576 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
5577 !! options
5578 parsoid=wt2html,wt2wt
5579 !! wikitext
5580 {|
5581 |-
5582 |
5583 a
5584 |-
5585 b
5586 |}
5587 !! html/php
5588 <table>
5589
5590 <tr>
5591 <td>
5592 <pre>a
5593 </pre>
5594 </td></tr>
5595 b
5596 </table>
5597
5598 !! html/php+tidy
5599 <p>b</p>
5600 <table>
5601 <tr>
5602 <td>
5603 <pre>
5604 a
5605 </pre></td>
5606 </tr>
5607 </table>
5608 !! html/parsoid
5609 <table>
5610 <tbody>
5611 <tr><td><pre>a</pre></td></tr>
5612 <tr><td> b</td></tr>
5613 </tbody>
5614 </table>
5615 !! end
5616
5617 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
5618 !! test
5619 Lists should be recognized in an implicit <td> context
5620 !! options
5621 parsoid=wt2html,wt2wt
5622 !! wikitext
5623 {|
5624 |-
5625 *a
5626 |}
5627 !! html/php
5628 <table>
5629
5630 <ul><li>a</li></ul>
5631 </table>
5632
5633 !! html/php+tidy
5634 <ul>
5635 <li>a</li>
5636 </ul>
5637 !! html/parsoid
5638 <table>
5639 <tr>
5640 <td><ul>
5641 <li>a</li>
5642 </ul></td>
5643 </tr>
5644 </table>
5645 !! end
5646
5647 !! test
5648 Parsoid: Round-trip tables directly followed by content (bug 51219)
5649 !! options
5650 parsoid=wt2html,wt2wt
5651 !! wikitext
5652 {|
5653 |foo
5654 |} bar
5655
5656 {|
5657 |baz
5658 |}<b>quux</b>
5659 !! html
5660 <table><tbody>
5661 <tr>
5662 <td>foo</td></tr></tbody></table> bar
5663 <table>
5664 <tbody>
5665 <tr>
5666 <td>baz</td></tr></tbody></table><b>quux</b>
5667 !! end
5668
5669 !! test
5670 Parsoid: Default to a newline after tables in new content (bug 51219)
5671 !! options
5672 parsoid=html2wt
5673 !! wikitext
5674 {|
5675 |foo
5676 |}
5677 <nowiki> </nowiki>bar
5678 {|
5679 |baz
5680 |}
5681 '''quux'''
5682 !! html
5683 <table><tbody>
5684 <tr><td>foo</td></tr></tbody></table> bar
5685 <table><tbody>
5686 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5687 !! end
5688
5689 !! test
5690 Parsoid: newline inducing block nodes don't suppress <nowiki>
5691 !! options
5692 parsoid=html2wt
5693 !! wikitext
5694 <nowiki> </nowiki>a
5695
5696 = foo =
5697 !! html
5698 a<h1>foo</h1>
5699 !! end
5700
5701 !! test
5702 Parsoid: Row-syntax table headings followed by comment & table cells
5703 !! options
5704 parsoid=wt2html,wt2wt
5705 !! wikitext
5706 {|
5707 ! foo || bar
5708 <!-- foo --> || baz || quux
5709 |}
5710 !! html/php
5711 <table>
5712 <tr>
5713 <th> foo </th>
5714 <th> bar
5715 </th>
5716 <td> baz </td>
5717 <td> quux
5718 </td></tr></table>
5719
5720 !! html/parsoid
5721 <table>
5722 <tbody><tr><th> foo </th><th> bar
5723 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
5724 </tbody></table>
5725 !! end
5726
5727
5728 # PHP throws away the (semi-broken) "foo" class here; Parsoid
5729 # preserves it.
5730 !!test
5731 Parsoid: Recover better from broken table attributes
5732 !!options
5733 parsoid=wt2html
5734 !!wikitext
5735 {| class="foo
5736 | class="bar" |
5737 foo
5738 |}
5739 !!html/php+tidy
5740 <table>
5741 <tr>
5742 <td class="bar">
5743 <p>foo</p>
5744 </td>
5745 </tr>
5746 </table>
5747 !!html/parsoid
5748 <table class="foo">
5749 <tr>
5750 <td class="bar">
5751 <p>foo</p></td></tr>
5752 </tbody></table>
5753 !!end
5754
5755 !! test
5756 Strip unsupported table tags
5757 !! options
5758 parsoid=html2wt
5759 !! html
5760 <table>
5761 <thead>
5762 <tr>
5763 <th>Month</th>
5764 <th>Savings</th>
5765 </tr>
5766 </thead>
5767 <tbody>
5768 <tr>
5769 <td>January</td>
5770 <td>$100</td>
5771 </tr>
5772 <tr>
5773 <td>February</td>
5774 <td>$80</td>
5775 </tr>
5776 </tbody>
5777 <tfoot>
5778 <tr>
5779 <td>Sum</td>
5780 <td>$180</td>
5781 </tr>
5782 </tfoot>
5783 </table>
5784 !! wikitext
5785 {|
5786
5787 !Month
5788 !Savings
5789
5790 |January
5791 |$100
5792
5793 |-
5794 |February
5795 |$80
5796
5797 |Sum
5798 |$180
5799
5800 |}
5801 !! end
5802
5803 ###
5804 ### Internal links
5805 ###
5806 !! test
5807 Plain link, capitalized
5808 !! wikitext
5809 [[Main Page]]
5810 !! html
5811 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5812 </p>
5813 !! end
5814
5815 !! test
5816 Plain link, uncapitalized
5817 !! wikitext
5818 [[main Page]]
5819 !! html
5820 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
5821 </p>
5822 !! end
5823
5824 !! test
5825 Piped link
5826 !! wikitext
5827 [[Main Page|The Main Page]]
5828 !! html
5829 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5830 </p>
5831 !! end
5832
5833 !! test
5834 Piped link with comment in link text
5835 !! wikitext
5836 [[Main Page|The Main<!--front--> Page]]
5837 !! html
5838 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5839 </p>
5840 !! end
5841
5842 !! test
5843 Piped link with multiple pipe characters in link text
5844 !! wikitext
5845 [[Main Page||The|Main|Page|]]
5846 !! html/php
5847 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
5848 </p>
5849 !! html/parsoid
5850 <p><a rel="mw:WikiLink" href="Main_Page">|The|Main|Page|</a></p>
5851 !! end
5852
5853 !! test
5854 Broken link
5855 !! wikitext
5856 [[Zigzagzogzagzig]]
5857 !! html
5858 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
5859 </p>
5860 !! end
5861
5862 !! test
5863 Broken link with fragment
5864 !! wikitext
5865 [[Zigzagzogzagzig#zug]]
5866 !! html
5867 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5868 </p>
5869 !! end
5870
5871 !! test
5872 Special page link with fragment
5873 !! wikitext
5874 [[Special:Version#anchor]]
5875 !! html
5876 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5877 </p>
5878 !! end
5879
5880 !! test
5881 Nonexistent special page link with fragment
5882 !! wikitext
5883 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5884 !! html
5885 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5886 </p>
5887 !! end
5888
5889 !! test
5890 Link with prefix
5891 !! wikitext
5892 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5893 !! html
5894 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5895 </p>
5896 !! end
5897
5898 !! test
5899 Link with suffix
5900 !! wikitext
5901 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5902 !! html
5903 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
5904 </p>
5905 !! end
5906
5907 !! article
5908 prefixed article
5909 !! text
5910 Some text
5911 !! endarticle
5912
5913 !! test
5914 Bug 43661: Piped links with identical prefixes
5915 !! wikitext
5916 [[prefixed article|prefixed articles with spaces]]
5917
5918 [[prefixed article|prefixed articlesaoeu]]
5919
5920 [[Main Page|Main Page test]]
5921 !! html
5922 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5923 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5924 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5925 </p>
5926 !! end
5927
5928
5929 !! test
5930 Link with HTML entity in suffix / tail
5931 !! wikitext
5932 [[Main Page]]&quot;, [[Main Page]]&#97;
5933 !! html
5934 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
5935 </p>
5936 !! end
5937
5938 !! test
5939 Link with 3 brackets
5940 !! wikitext
5941 [[[Main Page]]]
5942 !! html
5943 <p>[[[Main Page]]]
5944 </p>
5945 !! end
5946
5947 !! test
5948 Link with 4 brackets
5949 !! wikitext
5950 [[[[Main Page]]]]
5951 !! html
5952 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5953 </p>
5954 !! end
5955
5956 !! test
5957 Piped link with 3 brackets
5958 !! wikitext
5959 [[[main page|the main page]]]
5960 !! html
5961 <p>[[[main page|the main page]]]
5962 </p>
5963 !! end
5964
5965 !! test
5966 Piped link with extlink-like text
5967 !! wikitext
5968 [[Main Page|[bar]]]
5969 [[Main Page|This is a [bar]]]
5970 !! html
5971 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5972 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5973 </p>
5974 !! end
5975
5976 !! test
5977 Link with multiple pipes
5978 !! wikitext
5979 [[Main Page|The|Main|Page]]
5980 !! html
5981 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5982 </p>
5983 !! end
5984
5985 # Note that parsoid does not munge anchor text; all non-space
5986 # characters are valid in HTML5 ids.
5987 !! test
5988 Anchor containing a #. (bug 63430)
5989 !! wikitext
5990 [[Main Page#And#Link]]
5991 !! html/php
5992 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
5993 </p>
5994 !! html/parsoid
5995 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link">Main Page#And#Link</a></p>
5996 !! end
5997
5998 !! test
5999 Link to namespaces
6000 !! wikitext
6001 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6002 !! html
6003 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
6004 </p>
6005 !! end
6006
6007 !! test
6008 Link with space in namespace
6009 !! wikitext
6010 [[User talk:Foo bar]]
6011 !! html
6012 <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
6013 </p>
6014 !! end
6015
6016 !! article
6017 MemoryAlpha:AlphaTest
6018 !! text
6019 This is an article in the MemoryAlpha namespace
6020 (which shadows the memoryalpha interwiki link).
6021 !! endarticle
6022
6023 !! test
6024 Namespace takes precedence over interwiki link (bug 51680)
6025 !! wikitext
6026 [[MemoryAlpha:AlphaTest]]
6027 !! html
6028 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6029 </p>
6030 !! end
6031
6032 # The previous test doesn't work correctly in html2*, due to not recognizing the
6033 # link as an internal one. This one checks for the correct behavior.
6034 !! test
6035 Link to namespace preferred over interwiki with correct rel attribute
6036 !! options
6037 parsoid=html2wt,html2html
6038 !! wikitext
6039 [[MemoryAlpha:AlphaTest]]
6040 !! html
6041 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6042 </p>
6043 !! end
6044
6045 !! test
6046 Piped link to namespace
6047 !! wikitext
6048 [[Meta:Disclaimers|The disclaimers]]
6049 !! html
6050 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
6051 </p>
6052 !! end
6053
6054 !! test
6055 Link containing }
6056 !! wikitext
6057 [[Usually caused by a typo (oops}]]
6058 !! html
6059 <p>[[Usually caused by a typo (oops}]]
6060 </p>
6061 !! end
6062
6063 !! article
6064 7% Solution
6065 !! text
6066 Just a test of an article title containing a percent.
6067 !! endarticle
6068
6069 !! test
6070 Link containing % (not as a hex sequence)
6071 !! wikitext
6072 [[7% Solution]]
6073 !! html/php
6074 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6075 </p>
6076 !! html/parsoid
6077 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
6078 !! end
6079
6080 # note that the parsoid HTML is identical to the previous test output,
6081 # so the previous test ensures that the html2wt mode will generate the
6082 # "not as a hex sequence" wikitext.
6083 !! test
6084 Link containing % as a single hex sequence interpreted to char
6085 !! options
6086 parsoid=wt2wt,wt2html,html2html
6087 !! wikitext
6088 [[7%25 Solution]]
6089 !! html/php
6090 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6091 </p>
6092 !! html/parsoid
6093 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
6094 !!end
6095
6096 !! test
6097 Link containing % as a double hex sequence interpreted to hex sequence
6098 !! wikitext
6099 [[7%2525 Solution]]
6100 !! html
6101 <p>[[7%2525 Solution]]
6102 </p>
6103 !!end
6104
6105 # note that parsoid does not munge anchor text; all non-space
6106 # characters are valid in HTML5 anchors.
6107 !! test
6108 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6109 Example for such a section: == < ==
6110 !! wikitext
6111 [[%23%3c]][[%23%3e]]
6112 !! html/php
6113 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6114 </p>
6115 !! html/parsoid
6116 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E">#></a></p>
6117 !! end
6118
6119 !! test
6120 Link containing "<#" and ">#" as a hex sequences
6121 !! wikitext
6122 [[%3c%23]][[%3e%23]]
6123 !! html
6124 <p>[[%3c%23]][[%3e%23]]
6125 </p>
6126 !! end
6127
6128 !! test
6129 Link containing an equals sign
6130 !! wikitext
6131 [[Special:BookSources/isbn=4-00-026157-6]]
6132 !! html/php
6133 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
6134 </p>
6135 !! html/parsoid
6136 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
6137 !! end
6138
6139 !! article
6140 Foo~bar
6141 !! text
6142 Just a test of an article title containing a tilde.
6143 !! endarticle
6144
6145 # note that links containing signatures, like [[Foo~~~~]], are
6146 # massaged by the pre-save transform (PST) and so the tildes are never
6147 # seen by the parser.
6148 !! test
6149 Link containing a tilde
6150 !! wikitext
6151 [[Foo~bar]]
6152 !! html/php
6153 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6154 </p>
6155 !! html/parsoid
6156 <p><a rel="mw:WikiLink" href="./Foo~bar">Foo~bar</a></p>
6157 !! end
6158
6159 !! test
6160 Link containing double-single-quotes '' (bug 4598)
6161 !! wikitext
6162 [[Lista d''e paise d''o munno]]
6163 !! html/php
6164 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
6165 </p>
6166 !! html/parsoid
6167 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno">Lista d''e paise d''o munno</a></p>
6168 !! end
6169
6170 !! test
6171 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6172 !! wikitext
6173 Some [[Link|pretty ''italics'' and stuff]]!
6174 !! html/php
6175 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
6176 </p>
6177 !! html/parsoid
6178 <p>Some <a rel="mw:WikiLink" href="Link">pretty <i>italics</i> and stuff</a>!</p>
6179 !! end
6180
6181 !! test
6182 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6183 !! wikitext
6184 ''Some [[Link|pretty ''italics'' and stuff]]!''
6185 !! html
6186 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
6187 </p>
6188 !! end
6189
6190 !! test
6191 Link with double quotes in title part (literal) and alternate part (interpreted)
6192 !! wikitext
6193 [[File:Denys Savchenko ''Pentecoste''.jpg]]
6194
6195 [[''Pentecoste'']]
6196
6197 [[''Pentecoste''|Pentecoste]]
6198
6199 [[''Pentecoste''|''Pentecoste'']]
6200 !! html/php
6201 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
6202 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
6203 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
6204 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
6205 </p>
6206 !! html/parsoid
6207 <meta typeof="mw:Placeholder"/>
6208 <p><a rel="mw:WikiLink" href="''Pentecoste''">''Pentecoste''</a></p>
6209 <p><a rel="mw:WikiLink" href="''Pentecoste''">Pentecoste</a></p>
6210 <p><a rel="mw:WikiLink" href="''Pentecoste''"><i>Pentecoste</i></a></p>
6211 !! end
6212
6213 !! test
6214 Broken image links with HTML captions (bug 39700)
6215 !! wikitext
6216 [[File:Nonexistent|<script></script>]]
6217 [[File:Nonexistent|100px|<script></script>]]
6218 [[File:Nonexistent|&lt;]]
6219 [[File:Nonexistent|a<i>b</i>c]]
6220 !! html
6221 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6222 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6223 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6224 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6225 </p>
6226 !! end
6227
6228 !! test
6229 Plain link to URL
6230 !! wikitext
6231 [[http://www.example.com]]
6232 !! html/php
6233 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6234 </p>
6235 !! html/parsoid
6236 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6237 !! end
6238
6239 !! test
6240 Plain link to URL with link text
6241 !! wikitext
6242 [[http://www.example.com Link text]]
6243 !! html
6244 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6245 </p>
6246 !! end
6247
6248 !! test
6249 Plain link to protocol-relative URL
6250 !! wikitext
6251 [[//www.example.com]]
6252 !! html/php
6253 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6254 </p>
6255 !! html/parsoid
6256 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6257 !! end
6258
6259 !! test
6260 Plain link to protocol-relative URL with link text
6261 !! wikitext
6262 [[//www.example.com Link text]]
6263 !! html
6264 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6265 </p>
6266 !! end
6267
6268 !! test
6269 Plain link to page with question mark in title
6270 !! wikitext
6271 [[A?b]]
6272
6273 [[A?b|Baz]]
6274 !! html
6275 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6276 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6277 </p>
6278 !! end
6279
6280
6281 # I'm fairly sure the expected result here is wrong.
6282 # We want these to be URL links, not pseudo-pages with URLs for titles....
6283 # However the current output is also pretty screwy.
6284 #
6285 # ----
6286 # I'm changing it to match the current output--it arguably makes more
6287 # sense in the light of the test above. Old expected result was:
6288 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6289 #</p>
6290 # But I think this test is bordering on "garbage in, garbage out" anyway.
6291 # -- wtm
6292 !! test
6293 Piped link to URL
6294 !! wikitext
6295 Piped link to URL: [[http://www.example.com|an example URL]]
6296 !! html/php
6297 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6298 </p>
6299 !! html/parsoid
6300 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6301 !! end
6302
6303 !! test
6304 BUG 2: [[page|http://url/]] should link to page, not http://url/
6305 !! wikitext
6306 [[Main Page|http://url/]]
6307 !! html/php
6308 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6309 </p>
6310 !! html/parsoid
6311 <p><a rel="mw:WikiLink" href="./Main_Page">http://url/</a></p>
6312 !! end
6313
6314 # Parsoid does not mark self-links, by design.
6315 !! test
6316 BUG 337: Escaped self-links should be bold
6317 !! options
6318 title=[[Bug462]]
6319 !! wikitext
6320 [[Bu&#103;462]] [[Bug462]]
6321 !! html/php
6322 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6323 </p>
6324 !! html/php+tidy
6325 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6326 !! html/parsoid
6327 <p><a rel="mw:WikiLink" href="./Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462">Bug462</a></p>
6328 !! end
6329
6330 !! test
6331 Self-link to section should not be bold
6332 !! options
6333 title=[[Main Page]]
6334 !! wikitext
6335 [[Main Page#section]]
6336 !! html
6337 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6338 </p>
6339 !! end
6340
6341 !! article
6342 00
6343 !! text
6344 This is 00.
6345 !! endarticle
6346
6347 !!test
6348 Self-link to numeric title
6349 !!options
6350 title=[[0]]
6351 !! wikitext
6352 [[0]]
6353 !! html
6354 <p><strong class="selflink">0</strong>
6355 </p>
6356 !!end
6357
6358 !!test
6359 Link to numeric-equivalent title
6360 !!options
6361 title=[[0]]
6362 !! wikitext
6363 [[00]]
6364 !! html
6365 <p><a href="/wiki/00" title="00">00</a>
6366 </p>
6367 !!end
6368
6369 !! test
6370 <nowiki> inside a link
6371 !! wikitext
6372 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6373 !! html
6374 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6375 </p>
6376 !! end
6377
6378 !! test
6379 Non-breaking spaces in title
6380 !! wikitext
6381 [[&nbsp; Main &nbsp; Page &nbsp;]]
6382 !! html
6383 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6384 </p>
6385 !!end
6386
6387 !! test
6388 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6389 !! options
6390 language=ca
6391 !! wikitext
6392 '''[[Main Page]]'''
6393 !! html
6394 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6395 </p>
6396 !! end
6397
6398 !! test
6399 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6400 !! options
6401 language=ca
6402 !! wikitext
6403 ''[[Main Page]]''
6404 !! html
6405 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6406 </p>
6407 !! end
6408
6409 !! test
6410 Internal link with en linktrail: no apostrophes (bug 27473)
6411 !! options
6412 language=en
6413 !! wikitext
6414 [[Something]]'nice
6415 !! html
6416 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6417 </p>
6418 !! end
6419
6420 !! test
6421 Internal link with ca linktrail with apostrophes (bug 27473)
6422 !! options
6423 language=ca
6424 !! wikitext
6425 [[Something]]'nice
6426 !! html
6427 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6428 </p>
6429 !! end
6430
6431 !! test
6432 Internal link with kaa linktrail with apostrophes (bug 27473)
6433 !! options
6434 language=kaa
6435 !! wikitext
6436 [[Something]]'nice
6437 !! html
6438 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
6439 </p>
6440 !! end
6441
6442 !! test
6443 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6444 !! wikitext
6445 [[User:Foo/Test/63636:Bar|Test]]
6446 !! html/php
6447 <p><a href="/index.php?title=User:Foo/Test/63636:Bar&amp;action=edit&amp;redlink=1" class="new" title="User:Foo/Test/63636:Bar (page does not exist)">Test</a>
6448 </p>
6449 !! html/parsoid
6450 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar">Test</a></p>
6451 !! end
6452
6453 !! test
6454 Purely hash wikilink
6455 !! options
6456 title=[[User:test/123]]
6457 !! wikitext
6458 [[#a|b]]
6459 !! html/php
6460 <p><a href="#a">b</a>
6461 </p>
6462 !! html/parsoid
6463 <p data-parsoid='{}'><a rel="mw:WikiLink" href="../User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"../User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
6464 !! end
6465
6466 !! test
6467 1. Interaction of linktrail and template encapsulation
6468 !! options
6469 parsoid
6470 !! wikitext
6471 {{echo|[[Foo]]}}l
6472 !! html
6473 <p><a rel="mw:WikiLink" href="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
6474 !! end
6475
6476 !! test
6477 2. Interaction of linktrail and template encapsulation
6478 !! options
6479 parsoid
6480 !! wikitext
6481 {{echo|Some [[Fool]]}}s
6482 !! html
6483 <p data-parsoid='{}'><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
6484 !! end
6485
6486 !! test
6487 3. Interaction of linktrail and template encapsulation
6488 !! options
6489 parsoid
6490 !! wikitext
6491 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6492 !! html
6493 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some <a rel="mw:WikiLink" href="./Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b data-parsoid="{}">bold and foolish</b></p>
6494 !! end
6495
6496 !! article
6497 Söfnuður
6498 !! text
6499 Test.
6500 !! endarticle
6501
6502 !! test
6503 Internal link with is link prefix
6504 !! options
6505 language=is
6506 !! wikitext
6507 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6508 !! html
6509 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6510 </p>
6511 !! end
6512
6513 !! article
6514 Mótmælendatrú
6515 !! text
6516 Test.
6517 !! endarticle
6518
6519 !! test
6520 Internal link with is link trail and link prefix
6521 !! options
6522 language=is
6523 !! wikitext
6524 [[mótmælendatrú|xxx]]ar
6525 [[mótmælendatrú]]ar
6526 mótmælenda[[söfnuður]]
6527 mótmælenda[[söfnuður|söfnuðir]]
6528 mótmælenda[[söfnuður|söfnuðir]]xxx
6529 !! html
6530 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6531 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6532 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6533 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6534 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6535 </p>
6536 !! end
6537
6538 !! test
6539 Parsoid link trail escaping
6540 !! options
6541 parsoid=html2wt,html2html
6542 !! wikitext
6543 [[apple]]<nowiki/>s
6544 !! html
6545 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
6546 !! end
6547
6548 !! test
6549 Parsoid link prefix escaping
6550 !! options
6551 language=is
6552 parsoid=html2wt,html2html
6553 !! wikitext
6554 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6555 !! html
6556 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
6557 !! end
6558
6559 !! test
6560 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6561 !! wikitext
6562 [[Foo| bar]]
6563
6564 [[Foo| ''bar'']]
6565
6566 [http://wp.org foo]
6567
6568 [http://wp.org ''foo'']
6569 !! html
6570 <p><a href="/wiki/Foo" title="Foo"> bar</a>
6571 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
6572 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6573 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6574 </p>
6575 !! end
6576
6577 !! test
6578 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6579 !! options
6580 parsoid
6581 !! wikitext
6582 [[Foo|{{echo|a}} b {{echo|c}}]]
6583 !! html
6584 <p><a rel="mw:WikiLink" href="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
6585 !! end
6586
6587 !! test
6588 Link with angle bracket after anchor
6589 !! wikitext
6590 [[Foo#<bar>]]
6591 !! html/php
6592 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
6593 </p>
6594 !! html/parsoid
6595 <p><a rel="mw:WikiLink" href="./Foo#%3Cbar%3E" data-parsoid='{"stx":"simple","a":{"href":"./Foo#%3Cbar%3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
6596 !! end
6597
6598 ###
6599 ### Interwiki links (see maintenance/interwiki.sql)
6600 ###
6601
6602 !! test
6603 Inline interwiki link
6604 !! wikitext
6605 [[MeatBall:SoftSecurity]]
6606 !! html
6607 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6608 </p>
6609 !! end
6610
6611 !! test
6612 Inline interwiki link with empty title (bug 2372)
6613 !! wikitext
6614 [[MeatBall:]]
6615 !! html
6616 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6617 </p>
6618 !! end
6619
6620 !! test
6621 Interwiki link encoding conversion (bug 1636)
6622 !! wikitext
6623 *[[Wikipedia:ro:Olteni&#0355;a]]
6624 *[[Wikipedia:ro:Olteni&#355;a]]
6625 !! html
6626 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
6627 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
6628
6629 !! html+tidy
6630 <ul>
6631 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
6632 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
6633 </ul>
6634 !! end
6635
6636 !! test
6637 Interwiki link with fragment (bug 2130)
6638 !! wikitext
6639 [[MeatBall:SoftSecurity#foo]]
6640 !! html
6641 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6642 </p>
6643 !! end
6644
6645 # Ideally the wikipedia: prefix here should be proto-relative too
6646 !! test
6647 Different interwiki prefixes mapping to the same URL
6648 !! wikitext
6649 [[:en:Foo]]
6650
6651 [[:en:Foo|Foo]]
6652
6653 [[wikipedia:Foo]]
6654
6655 [[:wikipedia:Foo|Foo]]
6656
6657 [[wikipedia:en:Foo]]
6658
6659 [[:wikipedia:en:Foo]]
6660 !! html/parsoid
6661 <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>
6662
6663 <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>
6664
6665 <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>
6666
6667 <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>
6668
6669 <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>
6670
6671 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}'>wikipedia:en:Foo</a></p>
6672 !! end
6673
6674 !! test
6675 Interwiki links that cannot be represented in wiki syntax
6676 !! wikitext
6677 [[meatball:ok]]
6678 [[meatball:ok#foo|ok with fragment]]
6679 [[meatball:ok_as_well?|ok ending with ? mark]]
6680 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6681 [http://de.wikipedia.org/wiki/#foo is just fragment]
6682
6683 !! html/parsoid
6684 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
6685 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
6686 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?">ok ending with ? mark</a>
6687 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6688 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6689 !! end
6690
6691 !! test
6692 Interwiki links: trail
6693 !! options
6694 parsoid
6695 !! wikitext
6696 [[wikipedia:Foo|Ba]]r
6697 !! html
6698 <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>
6699 !! end
6700
6701 !! test
6702 Local interwiki link
6703 !! wikitext
6704 [[local:Template:Foo]]
6705 !! html
6706 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
6707 </p>
6708 !! end
6709
6710 !! test
6711 Local interwiki link: self-link to current page
6712 !! options
6713 title=[[Main Page]]
6714 !! wikitext
6715 [[local:Main Page]]
6716 !! html
6717 <p><strong class="selflink">local:Main Page</strong>
6718 </p>
6719 !! end
6720
6721 !! test
6722 Local interwiki link: prefix only (bug 64167)
6723 !! wikitext
6724 [[local:]]
6725 !! html
6726 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
6727 </p>
6728 !! end
6729
6730 !! test
6731 Local interwiki link: with additional interwiki prefix (bug 61357)
6732 !! wikitext
6733 [[local:meatball:Hello]]
6734 !! html
6735 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
6736 </p>
6737 !! end
6738
6739 ###
6740 ### Interlanguage links
6741 ### Language links (so that searching for '### language' matches..)
6742 ###
6743
6744 !! test
6745 Interlanguage link
6746 !! wikitext
6747 Blah blah blah
6748 [[zh:Chinese]]
6749 !! html/php
6750 <p>Blah blah blah
6751 </p>
6752 !! html/parsoid
6753 <p>Blah blah blah
6754 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6755 !! end
6756
6757 !! test
6758 Interlanguage link with spacing
6759 !! wikitext
6760 Blah blah blah
6761 [[ zh : Chinese ]]
6762 !! html/php
6763 <p>Blah blah blah
6764 </p>
6765 !! html/parsoid
6766 <p>Blah blah blah
6767 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6768 !! end
6769
6770 !! test
6771 Double interlanguage link
6772 !! wikitext
6773 Blah blah blah
6774 [[es:Spanish]]
6775 [[zh:Chinese]]
6776 !! html/php
6777 <p>Blah blah blah
6778 </p>
6779 !! html/parsoid
6780 <p>Blah blah blah
6781 <link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Spanish"/>
6782 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6783 !! end
6784
6785 !! test
6786 Interlanguage link, with prefix links
6787 !! options
6788 language=ln
6789 !! wikitext
6790 Blah blah blah
6791 [[zh:Chinese]]
6792 !! html/php
6793 <p>Blah blah blah
6794 </p>
6795 !! html/parsoid
6796 <p>Blah blah blah
6797 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6798 !! end
6799
6800 !! test
6801 Double interlanguage link, with prefix links (bug 8897)
6802 !! options
6803 language=ln
6804 !! wikitext
6805 Blah blah blah
6806 [[es:Spanish]]
6807 [[zh:Chinese]]
6808 !! html/php
6809 <p>Blah blah blah
6810 </p>
6811 !! html/parsoid
6812 <p>Blah blah blah
6813 <link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Spanish"/>
6814 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6815 !! end
6816
6817 !! test
6818 "Extra" interlanguage links (bug 32189 / gerrit 111390)
6819 !! wikitext
6820 Blah blah blah
6821 [[mul:Article]]
6822 !! html/php
6823 <p>Blah blah blah
6824 </p>
6825 !! html/parsoid
6826 <p>Blah blah blah
6827 <link rel="mw:PageProp/Language" title="Multilingual" href="//wikisource.org/wiki/Article"/></p>
6828 !! end
6829
6830 !! test
6831 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
6832 !! options
6833 language=ln
6834 !! wikitext
6835 [[WW&nbsp;II]]
6836 !! html
6837 <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>
6838 </p>
6839 !! end
6840
6841 !! test
6842 Parsoid bug 53221: Wikilinks should be properly entity-escaped
6843 !! options
6844 parsoid=html2wt
6845 !! wikitext
6846 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
6847
6848 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
6849 !! html
6850 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6851 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6852 !! end
6853
6854 !! test
6855 Parsoid: handle constructor well
6856 !! options
6857 parsoid
6858 !! wikitext
6859 [[constructor]]
6860
6861 [[constructor:foo]]
6862 !! html
6863 <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>
6864
6865 <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>
6866 !! end
6867
6868 !! test
6869 Parsoid: recognize interlanguage links without a target page
6870 !! options
6871 parsoid
6872 !! wikitext
6873 [[ko:]]
6874 !! html
6875 <p><link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
6876 !! end
6877
6878 !! test
6879 Parsoid: recognize interwiki links without a target page
6880 !! options
6881 parsoid
6882 !! wikitext
6883 [[:ko:]]
6884 !! html
6885 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
6886 !! end
6887
6888 !! test
6889 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
6890 !! options
6891 parsoid
6892 !! wikitext
6893 [[en:Foo]]
6894 !! html
6895 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
6896 !! end
6897
6898 !! test
6899 Interlanguage link with preceding local interwiki link (bug 68085)
6900 !! wikitext
6901 Blah blah blah
6902 [[local:es:Spanish]]
6903 !! html
6904 <p>Blah blah blah
6905 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
6906 </p>
6907 !! end
6908
6909 !! test
6910 Looks like an interlanguage link, but is actually a local interwiki
6911 !! wikitext
6912 Blah blah blah
6913 [[mi:Template:Foo]]
6914 !! html
6915 <p>Blah blah blah
6916 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
6917 </p>
6918 !! end
6919
6920 ###
6921 ### Redirects, Parsoid-only
6922 ###
6923 !! test
6924 1. Simple redirect to page
6925 !! options
6926 parsoid
6927 !! wikitext
6928 #REDIRECT [[Main Page]]
6929 !! html
6930 <link rel="mw:PageProp/redirect" href="./Main_Page">
6931 !! end
6932
6933 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
6934 !! test
6935 2. Other redirect variants
6936 !! options
6937 parsoid=wt2html,wt2wt
6938 !! wikitext
6939 #REDIRECT [[Main_Page]]
6940 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
6941 !! html
6942 <link rel="mw:PageProp/redirect" href="./Main_Page">
6943 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
6944 !! end
6945
6946 !! test
6947 Empty redirect
6948 !! options
6949 parsoid=wt2html,wt2wt
6950 !! wikitext
6951 #REDIRECT [[]]
6952 !! html
6953 <ol>
6954 <li>REDIRECT [[]]</li></ol>
6955 !! end
6956
6957 !! test
6958 Optional colon in #REDIRECT
6959 !! options
6960 # the colon is archaic syntax. we support it for wt2html, but we
6961 # don't care that it roundtrips back to the modern syntax.
6962 parsoid=wt2html,html2html
6963 !! wikitext
6964 #REDIRECT:[[Main Page]]
6965 !! html
6966 <link rel="mw:PageProp/redirect" href="./Main_Page">
6967 !! end
6968
6969 !! test
6970 Whitespace in #REDIRECT with optional colon
6971 !! options
6972 # the colon and gratuitous whitespace is archaic syntax. we support
6973 # it for wt2html, but we don't care that it roundtrips back to the
6974 # modern syntax (without extra whitespace)
6975 parsoid=wt2html,html2html
6976 !! wikitext
6977
6978 #REDIRECT
6979 :
6980 [[Main Page]]
6981 !! html
6982 <link rel="mw:PageProp/redirect" href="./Main_Page">
6983 !! end
6984
6985 !! test
6986 Piped link in #REDIRECT
6987 !! options
6988 # content after piped link is ignored. we support this syntax,
6989 # but don't care that the piped link is lost when we roundtrip this.
6990 parsoid=wt2html
6991 !! wikitext
6992 #REDIRECT [[Main Page|bar]]
6993 !! html
6994 <link rel="mw:PageProp/redirect" href="./Main_Page">
6995 !! end
6996
6997 !! test
6998 Redirect to category
6999 !! options
7000 parsoid=wt2html
7001 !! wikitext
7002 #REDIRECT [[Category:Foo]]
7003 !! html
7004 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7005 !! end
7006
7007 !! test
7008 Redirect to category with URL encoding
7009 !! options
7010 parsoid=wt2html
7011 !! wikitext
7012 #REDIRECT [[Category%3AFoo]]
7013 !! html
7014 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7015 !! end
7016
7017 !! test
7018 Redirect to category page
7019 !! options
7020 parsoid=wt2html,html2html
7021 !! wikitext
7022 #REDIRECT [[:Category:Foo]]
7023 !! html
7024 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
7025 !! end
7026
7027 !! test
7028 Redirect to image page (1)
7029 !! options
7030 parsoid
7031 !! wikitext
7032 #REDIRECT [[File:Wiki.png]]
7033 !! html
7034 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7035 !! end
7036
7037 !! test
7038 Redirect to image page (2)
7039 !! options
7040 parsoid
7041 !! wikitext
7042 #REDIRECT [[Image:Wiki.png]]
7043 !! html
7044 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7045 !! end
7046
7047 !! test
7048 Redirect to language
7049 !! options
7050 parsoid
7051 !! wikitext
7052 #REDIRECT [[en:File:Wiki.png]]
7053 !! html
7054 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7055 !! end
7056
7057 !! test
7058 Redirect to interwiki
7059 !! options
7060 parsoid
7061 !! wikitext
7062 #REDIRECT [[meatball:File:Wiki.png]]
7063 !! html
7064 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7065 !! end
7066
7067 !! test
7068 Non-English #REDIRECT
7069 !! options
7070 parsoid
7071 language=is
7072 !! wikitext
7073 #TILVÍSUN [[Main Page]]
7074 !! html
7075 <link rel="mw:PageProp/redirect" href="./Main_Page">
7076 !! end
7077
7078 !! test
7079 New redirect
7080 !! options
7081 parsoid=html2wt
7082 !! wikitext
7083 Foo
7084 #REDIRECT [[Foo]]
7085 !! html
7086 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7087 !! end
7088
7089 ##
7090 ## XHTML tidiness
7091 ###
7092
7093 !! test
7094 <br> to <br />
7095 !! wikitext
7096 1<br>2<br />3
7097 !! html
7098 <p>1<br />2<br />3
7099 </p>
7100 !! end
7101
7102 !! test
7103 Broken br tag sanitization
7104 !! wikitext
7105 </br>
7106 !! html/php
7107 <p>&lt;/br&gt;
7108 </p>
7109 !! end
7110
7111 # TODO: Fix html2html mode (bug 51055)!
7112 # This </br> handling was added as part of bug 50831; but it
7113 # differs from how PHP+tidy handles this. We should investigate
7114 # this.
7115 !! test
7116 Parsoid: Broken br tag recognition
7117 !! options
7118 parsoid=wt2html
7119 !! wikitext
7120 </br>
7121
7122 <br/ >
7123 !! html/php+tidy
7124 <p>&lt;/br&gt;</p>
7125 <p><br /></p>
7126 !! html/parsoid
7127 <p><br></p>
7128 <p><br/></p>
7129 !! end
7130
7131 !! test
7132 Incorrecly removing closing slashes from correctly formed XHTML
7133 !! wikitext
7134 <br style="clear:both;" />
7135 !! html
7136 <p><br style="clear:both;" />
7137 </p>
7138 !! end
7139
7140 !! test
7141 Failing to transform badly formed HTML into correct XHTML
7142 !! wikitext
7143 <br style="clear: left;">
7144 <br style="clear: right;">
7145 <br style="clear: both;">
7146 !! html
7147 <p><br style="clear: left;" />
7148 <br style="clear: right;" />
7149 <br style="clear: both;" />
7150 </p>
7151 !!end
7152
7153 !! test
7154 Handling html with a div self-closing tag
7155 !! wikitext
7156 <div title />
7157 <div title/>
7158 <div title/ >
7159 <div title=bar />
7160 <div title=bar/>
7161 <div title=bar/ >
7162 !! html
7163 <p>&lt;div title /&gt;
7164 &lt;div title/&gt;
7165 </p>
7166 <div>
7167 <p>&lt;div title=bar /&gt;
7168 &lt;div title=bar/&gt;
7169 </p>
7170 <div title="bar/"></div>
7171 </div>
7172
7173 !! end
7174
7175 !! test
7176 Handling html with a br self-closing tag
7177 !! wikitext
7178 <br title />
7179 <br title/>
7180 <br title/ >
7181 <br title=bar />
7182 <br title=bar/>
7183 <br title=bar/ >
7184 !! html
7185 <p><br title="title" />
7186 <br title="title" />
7187 <br />
7188 <br title="bar" />
7189 <br title="bar" />
7190 <br title="bar/" />
7191 </p>
7192 !! end
7193
7194 !! test
7195 Horizontal ruler (should it add that extra space?)
7196 !! wikitext
7197 <hr>
7198 <hr >
7199 foo <hr
7200 > bar
7201 !! html
7202 <hr />
7203 <hr />
7204 foo <hr /> bar
7205
7206 !! end
7207
7208 !! test
7209 Horizontal ruler -- 4+ dashes render hr
7210 !! wikitext
7211 ----
7212 !! html
7213 <hr />
7214
7215 !! end
7216
7217 !! test
7218 Horizontal ruler -- eats additional dashes on the same line
7219 !! wikitext
7220 ---------
7221 !! html
7222 <hr />
7223
7224 !! end
7225
7226 !! test
7227 Horizontal ruler -- does not collapse dashes on consecutive lines
7228 !! wikitext
7229 ----
7230 ----
7231 !! html
7232 <hr />
7233 <hr />
7234
7235 !! end
7236
7237 !! test
7238 Horizontal ruler -- <4 dashes render as plain text
7239 !! wikitext
7240 ---
7241 !! html
7242 <p>---
7243 </p>
7244 !! end
7245
7246 !! test
7247 Horizontal ruler -- Supports content following dashes on same line
7248 !! wikitext
7249 ---- Foo
7250 !! html
7251 <hr /> Foo
7252
7253 !! html+tidy
7254 <hr />
7255 <p>Foo</p>
7256 !! end
7257
7258 ###
7259 ### Block-level elements
7260 ###
7261 !! test
7262 Common list
7263 !! wikitext
7264 *Common list
7265 * item 2
7266 *item 3
7267 !! html
7268 <ul><li>Common list</li>
7269 <li> item 2</li>
7270 <li>item 3</li></ul>
7271
7272 !! end
7273
7274 !! test
7275 Numbered list
7276 !! wikitext
7277 #Numbered list
7278 #item 2
7279 # item 3
7280 !! html
7281 <ol><li>Numbered list</li>
7282 <li>item 2</li>
7283 <li> item 3</li></ol>
7284
7285 !! end
7286
7287 !! test
7288 Mixed list
7289 !! wikitext
7290 *Mixed list
7291 *# with numbers
7292 ** and bullets
7293 *# and numbers
7294 *bullets again
7295 **bullet level 2
7296 ***bullet level 3
7297 ***#Number on level 4
7298 **bullet level 2
7299 **#Number on level 3
7300 **#Number on level 3
7301 *#number level 2
7302 *Level 1
7303 *** Level 3
7304 #** Level 3, but ordered
7305 !! html
7306 <ul><li>Mixed list
7307 <ol><li> with numbers</li></ol>
7308 <ul><li> and bullets</li></ul>
7309 <ol><li> and numbers</li></ol></li>
7310 <li>bullets again
7311 <ul><li>bullet level 2
7312 <ul><li>bullet level 3
7313 <ol><li>Number on level 4</li></ol></li></ul></li>
7314 <li>bullet level 2
7315 <ol><li>Number on level 3</li>
7316 <li>Number on level 3</li></ol></li></ul>
7317 <ol><li>number level 2</li></ol></li>
7318 <li>Level 1
7319 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7320 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7321
7322 !! end
7323
7324 !! test
7325 Nested lists 1
7326 !! wikitext
7327 *foo
7328 **bar
7329 !! html
7330 <ul><li>foo
7331 <ul><li>bar</li></ul></li></ul>
7332
7333 !! end
7334
7335 !! test
7336 Nested lists 2
7337 !! wikitext
7338 **foo
7339 *bar
7340 !! html
7341 <ul><li><ul><li>foo</li></ul></li>
7342 <li>bar</li></ul>
7343
7344 !! end
7345
7346 !! test
7347 Nested lists 3 (first element empty)
7348 !! wikitext
7349 *
7350 **bar
7351 !! html
7352 <ul><li>
7353 <ul><li>bar</li></ul></li></ul>
7354
7355 !! end
7356
7357 !! test
7358 Nested lists 4 (first element empty)
7359 !! wikitext
7360 **
7361 *bar
7362 !! html
7363 <ul><li><ul><li></li></ul></li>
7364 <li>bar</li></ul>
7365
7366 !! end
7367
7368 !! test
7369 Nested lists 5 (both elements empty)
7370 !! wikitext
7371 **
7372 *
7373 !! html
7374 <ul><li><ul><li></li></ul></li>
7375 <li></li></ul>
7376
7377 !! end
7378
7379 !! test
7380 Nested lists 6 (both elements empty)
7381 !! wikitext
7382 *
7383 **
7384 !! html
7385 <ul><li>
7386 <ul><li></li></ul></li></ul>
7387
7388 !! end
7389
7390 !! test
7391 Nested lists 7 (skip initial nesting levels)
7392 !! wikitext
7393 *** foo
7394 !! html
7395 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7396
7397 !! end
7398
7399 !! test
7400 Nested lists 8 (multiple nesting transitions)
7401 !! wikitext
7402 * foo
7403 *** bar
7404 ** baz
7405 * boo
7406 !! html
7407 <ul><li> foo
7408 <ul><li><ul><li> bar</li></ul></li>
7409 <li> baz</li></ul></li>
7410 <li> boo</li></ul>
7411
7412 !! end
7413
7414 !! test
7415 1. Lists with start-of-line-transparent tokens before bullets: Comments
7416 !! wikitext
7417 *foo
7418 *<!--cmt-->bar
7419 <!--cmt-->*baz
7420 !! html
7421 <ul><li>foo</li>
7422 <li>bar</li>
7423 <li>baz</li></ul>
7424
7425 !! end
7426
7427 !! test
7428 2. Lists with start-of-line-transparent tokens before bullets: Template close
7429 !! wikitext
7430 *foo {{echo|bar
7431 }}*baz
7432 !! html
7433 <ul><li>foo bar</li>
7434 <li>baz</li></ul>
7435
7436 !! end
7437
7438 !! test
7439 List items are not parsed correctly following a <pre> block (bug 785)
7440 !! wikitext
7441 * <pre>foo</pre>
7442 * <pre>bar</pre>
7443 * zar
7444 !! html
7445 <ul><li> <pre>foo</pre></li>
7446 <li> <pre>bar</pre></li>
7447 <li> zar</li></ul>
7448
7449 !! end
7450
7451 !! test
7452 List items from template
7453 !! wikitext
7454
7455 {{inner list}}
7456 * item 2
7457
7458 * item 0
7459 {{inner list}}
7460 * item 2
7461
7462 * item 0
7463 * notSOL{{inner list}}
7464 * item 2
7465 !! html
7466 <ul><li> item 1</li>
7467 <li> item 2</li></ul>
7468 <ul><li> item 0</li>
7469 <li> item 1</li>
7470 <li> item 2</li></ul>
7471 <ul><li> item 0</li>
7472 <li> notSOL</li>
7473 <li> item 1</li>
7474 <li> item 2</li></ul>
7475
7476 !! end
7477
7478 !! test
7479 List interrupted by empty line or heading
7480 !! wikitext
7481 * foo
7482
7483 ** bar
7484 == A heading ==
7485 * Another list item
7486 !! html
7487 <ul><li> foo</li></ul>
7488 <ul><li><ul><li> bar</li></ul></li></ul>
7489 <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>
7490 <ul><li> Another list item</li></ul>
7491
7492 !!end
7493
7494 !!test
7495 Multiple list tags generated by templates
7496 !! wikitext
7497 {{echo|<li>}}a
7498 {{echo|<li>}}b
7499 {{echo|<li>}}c
7500 !! html
7501 <li>a
7502 <li>b
7503 <li>c</li>
7504 </li>
7505 </li>
7506
7507 !! html+tidy
7508 <ul>
7509 <li>a</li>
7510 <li>b</li>
7511 <li>c</li>
7512 </ul>
7513 !!end
7514
7515 !!test
7516 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7517 !! wikitext
7518 *a
7519 <!--This line will NOT split the list-->
7520 *b
7521 <!--This line will NOT split the list either-->
7522 *c
7523 <!--foo--> <!----> <!--This line NOT split the list either-->
7524 *d
7525 !! html
7526 <ul><li>a</li>
7527 <li>b</li>
7528 <li>c</li>
7529 <li>d</li></ul>
7530
7531 !!end
7532
7533 !!test
7534 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7535 !! wikitext
7536 *a
7537 <!--This line will NOT split the list-->
7538 *b
7539 <!--This line will NOT split the list either-->
7540 *c
7541 <!--foo--> <!----> <!--This line NOT split the list
7542 either-->
7543 *d
7544 !! html
7545 <ul><li>a</li>
7546 <li>b</li>
7547 <li>c</li>
7548 <li>d</li></ul>
7549
7550 !!end
7551
7552 !!test
7553 Test the li-hack
7554 (The PHP parser relies on Tidy for the hack)
7555 !!options
7556 parsoid=wt2html,wt2wt
7557 !! wikitext
7558 * foo
7559 * <li>li-hack
7560 * {{echo|<li>templated li-hack}}
7561 * <!--foo--> <li> unsupported li-hack with preceding comments
7562
7563 <ul>
7564 <li><li>not a li-hack
7565 </li>
7566 </ul>
7567 !! html+tidy
7568 <ul>
7569 <li>foo</li>
7570 <li>li-hack</li>
7571 <li>templated li-hack</li>
7572 <li>unsupported li-hack with preceding comments</li>
7573 </ul>
7574 <ul>
7575 <li>not a li-hack</li>
7576 </ul>
7577 !!end
7578
7579 !! test
7580 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
7581 !! options
7582 parsoid
7583 !! wikitext
7584 # foo
7585 ## bar
7586 * foo
7587 ** bar
7588 : foo
7589 :: bar
7590 !! html
7591 <ol>
7592 <li> foo<ol>
7593 <li> bar</li>
7594 </ol></li>
7595 </ol><ul>
7596 <li> foo<ul>
7597 <li> bar</li>
7598 </ul></li>
7599 </ul><dl>
7600 <dd> foo<dl>
7601 <dd> bar</dd>
7602 </dl></dd>
7603 </dl>
7604 !! end
7605
7606 !! test
7607 Parsoid: Test of whitespace serialization with Templated bullets
7608 !! options
7609 parsoid
7610 !! wikitext
7611 * {{bullet}}
7612 !! html
7613 <ul>
7614 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
7615 </ul>
7616 !! end
7617
7618 # ------------------------------------------------------------------------
7619 # The next set of tests are about Parsoid's ability to handle badly nested
7620 # tags (parse, minimize scope of fixup, and roundtrip back)
7621 # ------------------------------------------------------------------------
7622
7623 !! test
7624 Unbalanced closing block tags break a list
7625 (php parser relies on Tidy to fix up)
7626 !! wikitext
7627 <div>
7628 *a</div><div>
7629 *b</div>
7630 !! html+tidy
7631 <div>
7632 <ul>
7633 <li>a</li>
7634 </ul>
7635 </div>
7636 <div>
7637 <ul>
7638 <li>b</li>
7639 </ul>
7640 </div>
7641 !! end
7642
7643 # Parsoid fails this test, but it might be tricky to support properly.
7644 # See bug 68395.
7645 !! test
7646 Unbalanced closing non-block tags don't break a list
7647 (php parser relies on Tidy to fix up)
7648 !! wikitext
7649 <span>
7650 *a</span><span>
7651 *b</span>
7652 !! html/php+tidy
7653 <ul>
7654 <li><span>a</span></li>
7655 <li><span>b</span></li>
7656 </ul>
7657 !! html/parsoid
7658 <span>
7659 <ul>
7660 <li>a<span></span>
7661 </li>
7662 <li>b
7663 </li>
7664 </ul>
7665 </span>
7666 !! end
7667
7668 !! test
7669 Unclosed formatting tags that straddle lists are closed and reopened
7670 (php parser relies on Tidy to fix up)
7671 !! wikitext
7672 # <s> a
7673 # b </s>
7674 !! html/php+tidy
7675 <ol>
7676 <li><s>a</s></li>
7677 <li><s>b</s></li>
7678 </ol>
7679 !! html/parsoid
7680 <ol>
7681 <li> <s> a </s>
7682 </li>
7683 <li> <s> b </s>
7684 </li>
7685 </ol>
7686 !! end
7687
7688 # Parsoid fails this test, but it might be tricky to support properly.
7689 # See bug 68395.
7690 !!test
7691 List embedded in a non-block tag
7692 (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
7693 !! wikitext
7694 <small>
7695 * foo
7696 </small>
7697 !! html/php+tidy
7698 <ul>
7699 <li><small>foo</small></li>
7700 </ul>
7701 !! html/parsoid
7702 <small>
7703 <ul>
7704 <li> foo</li>
7705 </ul>
7706 </small>
7707 !!end
7708
7709 # This is a bug in the PHP parser + tidy combination.
7710 # (The </tr> tag gets parsed as text and html-escaped by PHP,
7711 # and then fostered out of the table by tidy.)
7712 # We believe the Parsoid output to be correct.
7713 !! test
7714 Table with missing opening <tr> tag
7715 !! options
7716 parsoid=wt2html,wt2wt
7717 !! wikitext
7718 <table>
7719 <td>foo</td>
7720 </tr>
7721 </table>
7722 !! html/php+tidy
7723 <p>&lt;/tr&gt;</p>
7724 <table>
7725 <tr>
7726 <td>foo</td>
7727 </tr>
7728 </table>
7729 !! html/parsoid
7730 <table>
7731 <tr>
7732 <td>foo</td>
7733 </tr>
7734 </table>
7735 !! end
7736
7737 ###
7738 ### Magic Words
7739 ###
7740
7741 # Note that the current date is hard-coded as
7742 # 1970-01-01T00:02:03Z (a Thursday)
7743 # when running parser tests. The timezone is also fixed to GMT, so
7744 # local date will be identical to current date.
7745
7746 !! test
7747 Magic Word: {{CURRENTDAY}}
7748 !! wikitext
7749 {{CURRENTDAY}}
7750 !! html
7751 <p>1
7752 </p>
7753 !! end
7754
7755 !! test
7756 Magic Word: {{CURRENTDAY2}}
7757 !! wikitext
7758 {{CURRENTDAY2}}
7759 !! html
7760 <p>01
7761 </p>
7762 !! end
7763
7764 !! test
7765 Magic Word: {{CURRENTDAYNAME}}
7766 !! wikitext
7767 {{CURRENTDAYNAME}}
7768 !! html
7769 <p>Thursday
7770 </p>
7771 !! end
7772
7773 !! test
7774 Magic Word: {{CURRENTDOW}}
7775 !! wikitext
7776 {{CURRENTDOW}}
7777 !! html
7778 <p>4
7779 </p>
7780 !! end
7781
7782 !! test
7783 Magic Word: {{CURRENTMONTH}}
7784 !! wikitext
7785 {{CURRENTMONTH}}
7786 !! html
7787 <p>01
7788 </p>
7789 !! end
7790
7791 !! test
7792 Magic Word: {{CURRENTMONTH1}}
7793 !! wikitext
7794 {{CURRENTMONTH1}}
7795 !! html
7796 <p>1
7797 </p>
7798 !! end
7799
7800 !! test
7801 Magic Word: {{CURRENTMONTHABBREV}}
7802 !! wikitext
7803 {{CURRENTMONTHABBREV}}
7804 !! html
7805 <p>Jan
7806 </p>
7807 !! end
7808
7809 !! test
7810 Magic Word: {{CURRENTMONTHNAME}}
7811 !! wikitext
7812 {{CURRENTMONTHNAME}}
7813 !! html
7814 <p>January
7815 </p>
7816 !! end
7817
7818 !! test
7819 Magic Word: {{CURRENTMONTHNAMEGEN}}
7820 !! wikitext
7821 {{CURRENTMONTHNAMEGEN}}
7822 !! html
7823 <p>January
7824 </p>
7825 !! end
7826
7827 !! test
7828 Magic Word: {{CURRENTTIME}}
7829 !! wikitext
7830 {{CURRENTTIME}}
7831 !! html
7832 <p>00:02
7833 </p>
7834 !! end
7835
7836 !! test
7837 Magic Word: {{CURRENTHOUR}}
7838 !! wikitext
7839 {{CURRENTHOUR}}
7840 !! html
7841 <p>00
7842 </p>
7843 !! end
7844
7845 !! test
7846 Magic Word: {{CURRENTWEEK}} (@bug 4594)
7847 !! wikitext
7848 {{CURRENTWEEK}}
7849 !! html
7850 <p>1
7851 </p>
7852 !! end
7853
7854 !! test
7855 Magic Word: {{CURRENTYEAR}}
7856 !! wikitext
7857 {{CURRENTYEAR}}
7858 !! html
7859 <p>1970
7860 </p>
7861 !! end
7862
7863 !! test
7864 Magic Word: {{CURRENTTIMESTAMP}}
7865 !! wikitext
7866 {{CURRENTTIMESTAMP}}
7867 !! html
7868 <p>19700101000203
7869 </p>
7870 !! end
7871
7872 !! test
7873 Magic Words LOCAL (UTC)
7874 !! wikitext
7875 * {{LOCALMONTH}}
7876 * {{LOCALMONTH1}}
7877 * {{LOCALMONTHNAME}}
7878 * {{LOCALMONTHNAMEGEN}}
7879 * {{LOCALMONTHABBREV}}
7880 * {{LOCALDAY}}
7881 * {{LOCALDAY2}}
7882 * {{LOCALDAYNAME}}
7883 * {{LOCALYEAR}}
7884 * {{LOCALTIME}}
7885 * {{LOCALHOUR}}
7886 * {{LOCALWEEK}}
7887 * {{LOCALDOW}}
7888 * {{LOCALTIMESTAMP}}
7889 !! html
7890 <ul><li> 01</li>
7891 <li> 1</li>
7892 <li> January</li>
7893 <li> January</li>
7894 <li> Jan</li>
7895 <li> 1</li>
7896 <li> 01</li>
7897 <li> Thursday</li>
7898 <li> 1970</li>
7899 <li> 00:02</li>
7900 <li> 00</li>
7901 <li> 1</li>
7902 <li> 4</li>
7903 <li> 19700101000203</li></ul>
7904
7905 !! end
7906
7907 !! test
7908 Magic Word: {{FULLPAGENAME}}
7909 !! options
7910 title=[[User:Ævar Arnfjörð Bjarmason]]
7911 !! wikitext
7912 {{FULLPAGENAME}}
7913 !! html
7914 <p>User:Ævar Arnfjörð Bjarmason
7915 </p>
7916 !! end
7917
7918 !! test
7919 Magic Word: {{FULLPAGENAMEE}}
7920 !! options
7921 title=[[User:Ævar Arnfjörð Bjarmason]]
7922 !! wikitext
7923 {{FULLPAGENAMEE}}
7924 !! html
7925 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7926 </p>
7927 !! end
7928
7929 !! test
7930 Magic Word: {{TALKSPACE}}
7931 !! options
7932 title=[[User:Ævar Arnfjörð Bjarmason]]
7933 !! wikitext
7934 {{TALKSPACE}}
7935 !! html
7936 <p>User talk
7937 </p>
7938 !! end
7939
7940 !! test
7941 Magic Word: {{TALKSPACE}}, same namespace
7942 !! options
7943 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7944 !! wikitext
7945 {{TALKSPACE}}
7946 !! html
7947 <p>User talk
7948 </p>
7949 !! end
7950
7951 !! test
7952 Magic Word: {{TALKSPACE}}, main namespace
7953 !! options
7954 title=[[Parser Test]]
7955 !! wikitext
7956 {{TALKSPACE}}
7957 !! html
7958 <p>Talk
7959 </p>
7960 !! end
7961
7962 !! test
7963 Magic Word: {{TALKSPACEE}}
7964 !! options
7965 title=[[User:Ævar Arnfjörð Bjarmason]]
7966 !! wikitext
7967 {{TALKSPACEE}}
7968 !! html
7969 <p>User_talk
7970 </p>
7971 !! end
7972
7973 !! test
7974 Magic Word: {{SUBJECTSPACE}}
7975 !! options
7976 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7977 !! wikitext
7978 {{SUBJECTSPACE}}
7979 !! html
7980 <p>User
7981 </p>
7982 !! end
7983
7984 !! test
7985 Magic Word: {{SUBJECTSPACE}}, same namespace
7986 !! options
7987 title=[[User:Ævar Arnfjörð Bjarmason]]
7988 !! wikitext
7989 {{SUBJECTSPACE}}
7990 !! html
7991 <p>User
7992 </p>
7993 !! end
7994
7995 !! test
7996 Magic Word: {{SUBJECTSPACE}}, main namespace
7997 !! options
7998 title=[[Parser Test]]
7999 !! wikitext
8000 {{SUBJECTSPACE}}
8001 !! html
8002
8003 !! end
8004
8005 !! test
8006 Magic Word: {{SUBJECTSPACEE}}
8007 !! options
8008 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8009 !! wikitext
8010 {{SUBJECTSPACEE}}
8011 !! html
8012 <p>User
8013 </p>
8014 !! end
8015
8016 !! test
8017 Magic Word: {{NAMESPACE}}
8018 !! options
8019 title=[[User:Ævar Arnfjörð Bjarmason]]
8020 !! wikitext
8021 {{NAMESPACE}}
8022 !! html
8023 <p>User
8024 </p>
8025 !! end
8026
8027 !! test
8028 Magic Word: {{NAMESPACEE}}
8029 !! options
8030 title=[[User:Ævar Arnfjörð Bjarmason]]
8031 !! wikitext
8032 {{NAMESPACEE}}
8033 !! html
8034 <p>User
8035 </p>
8036 !! end
8037
8038 !! test
8039 Magic Word: {{NAMESPACENUMBER}}
8040 !! options
8041 title=[[User:Ævar Arnfjörð Bjarmason]]
8042 !! wikitext
8043 {{NAMESPACENUMBER}}
8044 !! html
8045 <p>2
8046 </p>
8047 !! end
8048
8049 !! test
8050 Magic Word: {{SUBPAGENAME}}
8051 !! options
8052 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8053 !! wikitext
8054 {{SUBPAGENAME}}
8055 !! html
8056 <p>sub ö
8057 </p>
8058 !! end
8059
8060 !! test
8061 Magic Word: {{SUBPAGENAMEE}}
8062 !! options
8063 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8064 !! wikitext
8065 {{SUBPAGENAMEE}}
8066 !! html
8067 <p>sub_%C3%B6
8068 </p>
8069 !! end
8070
8071 !! test
8072 Magic Word: {{ROOTPAGENAME}}
8073 !! options
8074 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8075 !! wikitext
8076 {{ROOTPAGENAME}}
8077 !! html
8078 <p>Ævar Arnfjörð Bjarmason
8079 </p>
8080 !! end
8081
8082 !! test
8083 Magic Word: {{ROOTPAGENAMEE}}
8084 !! options
8085 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8086 !! wikitext
8087 {{ROOTPAGENAMEE}}
8088 !! html
8089 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8090 </p>
8091 !! end
8092
8093 !! test
8094 Magic Word: {{BASEPAGENAME}}
8095 !! options
8096 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8097 !! wikitext
8098 {{BASEPAGENAME}}
8099 !! html
8100 <p>Ævar Arnfjörð Bjarmason
8101 </p>
8102 !! end
8103
8104 !! test
8105 Magic Word: {{BASEPAGENAMEE}}
8106 !! options
8107 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8108 !! wikitext
8109 {{BASEPAGENAMEE}}
8110 !! html
8111 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8112 </p>
8113 !! end
8114
8115 !! test
8116 Magic Word: {{TALKPAGENAME}}
8117 !! options
8118 title=[[User:Ævar Arnfjörð Bjarmason]]
8119 !! wikitext
8120 {{TALKPAGENAME}}
8121 !! html
8122 <p>User talk:Ævar Arnfjörð Bjarmason
8123 </p>
8124 !! end
8125
8126 !! test
8127 Magic Word: {{TALKPAGENAMEE}}
8128 !! options
8129 title=[[User:Ævar Arnfjörð Bjarmason]]
8130 !! wikitext
8131 {{TALKPAGENAMEE}}
8132 !! html
8133 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8134 </p>
8135 !! end
8136
8137 !! test
8138 Magic Word: {{SUBJECTPAGENAME}}
8139 !! options
8140 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8141 !! wikitext
8142 {{SUBJECTPAGENAME}}
8143 !! html
8144 <p>User:Ævar Arnfjörð Bjarmason
8145 </p>
8146 !! end
8147
8148 !! test
8149 Magic Word: {{SUBJECTPAGENAMEE}}
8150 !! options
8151 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8152 !! wikitext
8153 {{SUBJECTPAGENAMEE}}
8154 !! html
8155 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8156 </p>
8157 !! end
8158
8159 !! test
8160 Magic Word: {{NUMBEROFFILES}}
8161 !! wikitext
8162 {{NUMBEROFFILES}}
8163 !! html
8164 <p>5
8165 </p>
8166 !! end
8167
8168 !! test
8169 Magic Word: {{PAGENAME}}
8170 !! options
8171 title=[[User:Ævar Arnfjörð Bjarmason]]
8172 !! wikitext
8173 {{PAGENAME}}
8174 !! html
8175 <p>Ævar Arnfjörð Bjarmason
8176 </p>
8177 !! end
8178
8179 !! test
8180 Magic Word: {{PAGENAME}} with metacharacters
8181 !! options
8182 title=[['foo & bar = baz']]
8183 !! wikitext
8184 ''{{PAGENAME}}''
8185 !! html/php
8186 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8187 </p>
8188 !! html+tidy
8189 <p><i>'foo &amp; bar = baz'</i></p>
8190 !! end
8191
8192 !! test
8193 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8194 !! options
8195 title=[[*RFC 1234 http://example.com/]]
8196 !! wikitext
8197 {{PAGENAME}}
8198 !! html/php
8199 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8200 </p>
8201 !! html+tidy
8202 <p>*RFC 1234 http://example.com/</p>
8203 !! end
8204
8205 !! test
8206 Magic Word: {{PAGENAMEE}}
8207 !! options
8208 title=[[User:Ævar Arnfjörð Bjarmason]]
8209 !! wikitext
8210 {{PAGENAMEE}}
8211 !! html
8212 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8213 </p>
8214 !! end
8215
8216 !! test
8217 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8218 !! options
8219 title=[[*RFC 1234 http://example.com/]]
8220 !! wikitext
8221 {{PAGENAMEE}}
8222 !! html/php
8223 <p>&#42;RFC_1234_http&#58;//example.com/
8224 </p>
8225 !! html+tidy
8226 <p>*RFC_1234_http://example.com/</p>
8227 !! end
8228
8229 !! test
8230 Magic Word: {{REVISIONID}}
8231 !! wikitext
8232 {{REVISIONID}}
8233 !! html
8234 <p>1337
8235 </p>
8236 !! end
8237
8238 !! test
8239 Magic Word: {{SCRIPTPATH}}
8240 !! wikitext
8241 {{SCRIPTPATH}}
8242 !! html
8243 <p>/
8244 </p>
8245 !! end
8246
8247 !! test
8248 Magic Word: {{STYLEPATH}}
8249 !! wikitext
8250 {{STYLEPATH}}
8251 !! html
8252 <p>/skins
8253 </p>
8254 !! end
8255
8256 !! test
8257 Magic Word: {{SERVER}}
8258 !! wikitext
8259 {{SERVER}}
8260 !! html
8261 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8262 </p>
8263 !! end
8264
8265 !! test
8266 Magic Word: {{SERVERNAME}}
8267 !! wikitext
8268 {{SERVERNAME}}
8269 !! html
8270 <p>example.org
8271 </p>
8272 !! end
8273
8274 !! test
8275 Magic Word: {{SITENAME}}
8276 !! wikitext
8277 {{SITENAME}}
8278 !! html
8279 <p>MediaWiki
8280 </p>
8281 !! end
8282
8283 !! test
8284 Case-sensitive magic words, when cased differently, should just be template transclusions
8285 !! wikitext
8286 {{CurrentMonth}}
8287 {{currentday}}
8288 {{cURreNTweEK}}
8289 {{currentHour}}
8290 !! html
8291 <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>
8292 <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>
8293 <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>
8294 <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>
8295 </p>
8296 !! end
8297
8298 !! test
8299 Case-insensitive magic words should still work with weird casing.
8300 !! wikitext
8301 {{sErVeRNaMe}}
8302 {{LCFirst:AOEU}}
8303 {{ucFIRST:aoeu}}
8304 {{SERver}}
8305 !! html
8306 <p>example.org
8307 aOEU
8308 Aoeu
8309 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8310 </p>
8311 !! end
8312
8313 !! test
8314 Namespace 1 {{ns:1}}
8315 !! wikitext
8316 {{ns:1}}
8317 !! html
8318 <p>Talk
8319 </p>
8320 !! end
8321
8322 !! test
8323 Namespace 1 {{ns:01}}
8324 !! wikitext
8325 {{ns:01}}
8326 !! html
8327 <p>Talk
8328 </p>
8329 !! end
8330
8331 !! test
8332 Namespace 0 {{ns:0}} (bug 4783)
8333 !! wikitext
8334 {{ns:0}}
8335 !! html
8336
8337 !! end
8338
8339 !! test
8340 Namespace 0 {{ns:00}} (bug 4783)
8341 !! wikitext
8342 {{ns:00}}
8343 !! html
8344
8345 !! end
8346
8347 !! test
8348 Namespace -1 {{ns:-1}}
8349 !! wikitext
8350 {{ns:-1}}
8351 !! html
8352 <p>Special
8353 </p>
8354 !! end
8355
8356 !! test
8357 Namespace User {{ns:User}}
8358 !! wikitext
8359 {{ns:User}}
8360 !! html
8361 <p>User
8362 </p>
8363 !! end
8364
8365 !! test
8366 Namespace User talk {{ns:User_talk}}
8367 !! wikitext
8368 {{ns:User_talk}}
8369 !! html
8370 <p>User talk
8371 </p>
8372 !! end
8373
8374 !! test
8375 Namespace User talk {{ns:uSeR tAlK}}
8376 !! wikitext
8377 {{ns:uSeR tAlK}}
8378 !! html
8379 <p>User talk
8380 </p>
8381 !! end
8382
8383 !! test
8384 Namespace File {{ns:File}}
8385 !! wikitext
8386 {{ns:File}}
8387 !! html
8388 <p>File
8389 </p>
8390 !! end
8391
8392 !! test
8393 Namespace File {{ns:Image}}
8394 !! wikitext
8395 {{ns:Image}}
8396 !! html
8397 <p>File
8398 </p>
8399 !! end
8400
8401 !! test
8402 Namespace (lang=de) Benutzer {{ns:User}}
8403 !! options
8404 language=de
8405 !! wikitext
8406 {{ns:User}}
8407 !! html
8408 <p>Benutzer
8409 </p>
8410 !! end
8411
8412 !! test
8413 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
8414 !! options
8415 language=de
8416 !! wikitext
8417 {{ns:3}}
8418 !! html
8419 <p>Benutzer Diskussion
8420 </p>
8421 !! end
8422
8423
8424 !! test
8425 Urlencode
8426 !! wikitext
8427 {{urlencode:hi world?!}}
8428 {{urlencode:hi world?!|WIKI}}
8429 {{urlencode:hi world?!|PATH}}
8430 {{urlencode:hi world?!|QUERY}}
8431 !! html
8432 <p>hi+world%3F%21
8433 hi_world%3F!
8434 hi%20world%3F%21
8435 hi+world%3F%21
8436 </p>
8437 !! end
8438
8439 !! test
8440 Magic Word: prioritize type info over data-parsoid
8441 !! options
8442 parsoid=html2wt
8443 !! wikitext
8444 __FORCETOC__
8445 !! html
8446 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
8447 !! end
8448
8449 !! test
8450 Magic Word: serialize on separate line (parsoid)
8451 !! options
8452 parsoid=wt2wt,html2wt
8453 !! wikitext
8454 foo
8455 __NOTOC__
8456 bar
8457 !! html
8458 foo<meta property="mw:PageProp/notoc"/>bar
8459 !! end
8460
8461 !! test
8462 Magic Word: rt non-english wikis
8463 !! options
8464 parsoid=wt2wt
8465 language=de
8466 !! wikitext
8467 __NOEDITSECTION__
8468 !! html
8469 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
8470 !! end
8471
8472 ###
8473 ### Magic links
8474 ###
8475 !! test
8476 Magic links: internal link to RFC (bug 479)
8477 !! wikitext
8478 [[RFC 123]]
8479 !! html
8480 <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>
8481 </p>
8482 !! end
8483
8484 !! test
8485 Magic links: RFC (bug 479)
8486 !! wikitext
8487 RFC 822
8488 !! html
8489 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8490 </p>
8491 !! end
8492
8493 !! test
8494 Magic links: ISBN (bug 1937)
8495 !! wikitext
8496 ISBN 0-306-40615-2
8497 !! html
8498 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8499 </p>
8500 !! end
8501
8502 !! test
8503 Magic links: PMID incorrectly converts space to underscore
8504 !! wikitext
8505 PMID 1234
8506 !! html
8507 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8508 </p>
8509 !! end
8510
8511 ###
8512 ### Templates
8513 ####
8514
8515 !! test
8516 Nonexistent template
8517 !! wikitext
8518 {{thistemplatedoesnotexist}}
8519 !! html
8520 <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>
8521 </p>
8522 !! end
8523
8524 !! test
8525 Template with invalid target containing tags
8526 !! wikitext
8527 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8528 !! html
8529 <p>{{a<b>b</b>|foo|a=b|a = b}}
8530 </p>
8531 !! end
8532
8533 !! test
8534 Template with invalid target containing unclosed tag
8535 !! wikitext
8536 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8537 !! html
8538 <p>{{a<b>|foo|a=b|a = b}}</b>
8539 </p>
8540 !! end
8541
8542 !! test
8543 Template with invalid target containing wikilink
8544 !! wikitext
8545 {{[[Main Page]]}}
8546 !! html/php
8547 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
8548 </p>
8549 !! html/parsoid
8550 <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>
8551 !! end
8552
8553 !! article
8554 Template:test
8555 !! text
8556 This is a test template
8557 !! endarticle
8558
8559 !! test
8560 Simple template
8561 !! wikitext
8562 {{test}}
8563 !! html
8564 <p>This is a test template
8565 </p>
8566 !! end
8567
8568 !! test
8569 Template with explicit namespace
8570 !! wikitext
8571 {{Template:test}}
8572 !! html
8573 <p>This is a test template
8574 </p>
8575 !! end
8576
8577
8578 !! article
8579 Template:paramtest
8580 !! text
8581 This is a test template with parameter {{{param}}}
8582 !! endarticle
8583
8584 !! test
8585 Template parameter
8586 !! wikitext
8587 {{paramtest|param=foo}}
8588 !! html
8589 <p>This is a test template with parameter foo
8590 </p>
8591 !! end
8592
8593 !! article
8594 Template:paramtestnum
8595 !! text
8596 [[{{{1}}}|{{{2}}}]]
8597 !! endarticle
8598
8599 !! test
8600 Template unnamed parameter
8601 !! wikitext
8602 {{paramtestnum|Main Page|the main page}}
8603 !! html
8604 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
8605 </p>
8606 !! end
8607
8608 !! article
8609 Template:templatesimple
8610 !! text
8611 (test)
8612 !! endarticle
8613
8614 !! article
8615 Template:templateredirect
8616 !! text
8617 #redirect [[Template:templatesimple]]
8618 !! endarticle
8619
8620 !! article
8621 Template:templateasargtestnum
8622 !! text
8623 {{{{{1}}}}}
8624 !! endarticle
8625
8626 !! article
8627 Template:templateasargtest
8628 !! text
8629 {{template{{{templ}}}}}
8630 !! endarticle
8631
8632 !! article
8633 Template:templateasargtest2
8634 !! text
8635 {{{{{templ}}}}}
8636 !! endarticle
8637
8638 !! test
8639 Template with template name as unnamed argument
8640 !! wikitext
8641 {{templateasargtestnum|templatesimple}}
8642 !! html
8643 <p>(test)
8644 </p>
8645 !! end
8646
8647 !! test
8648 Template with template name as argument
8649 !! wikitext
8650 {{templateasargtest|templ=simple}}
8651 !! html
8652 <p>(test)
8653 </p>
8654 !! end
8655
8656 !! test
8657 Template with template name as argument (2)
8658 !! wikitext
8659 {{templateasargtest2|templ=templatesimple}}
8660 !! html
8661 <p>(test)
8662 </p>
8663 !! end
8664
8665 !! article
8666 Template:templateasargtestdefault
8667 !! text
8668 {{{{{templ|templatesimple}}}}}
8669 !! endarticle
8670
8671 !! article
8672 Template:templa
8673 !! text
8674 '''templ'''
8675 !! endarticle
8676
8677 !! test
8678 Template with default value
8679 !! wikitext
8680 {{templateasargtestdefault}}
8681 !! html
8682 <p>(test)
8683 </p>
8684 !! end
8685
8686 !! test
8687 Template with default value (value set)
8688 !! wikitext
8689 {{templateasargtestdefault|templ=templa}}
8690 !! html
8691 <p><b>templ</b>
8692 </p>
8693 !! end
8694
8695 !! test
8696 Template redirect
8697 !! wikitext
8698 {{templateredirect}}
8699 !! html
8700 <p>(test)
8701 </p>
8702 !! end
8703
8704 !! test
8705 Template with argument in separate line
8706 !! wikitext
8707 {{ templateasargtest |
8708 templ = simple }}
8709 !! html
8710 <p>(test)
8711 </p>
8712 !! end
8713
8714 !! test
8715 Template with complex template as argument
8716 !! wikitext
8717 {{paramtest|
8718 param ={{ templateasargtest |
8719 templ = simple }}}}
8720 !! html
8721 <p>This is a test template with parameter (test)
8722 </p>
8723 !! end
8724
8725 !! test
8726 Template with thumb image (with link in description)
8727 !! wikitext
8728 {{paramtest|
8729 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
8730 !! html/php
8731 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>
8732
8733 !! html+tidy
8734 <p>This is a test template with parameter</p>
8735 <div class="thumb tright">
8736 <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>
8737 <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>
8738 </div>
8739 </div>
8740 !! end
8741
8742 !! article
8743 Template:complextemplate
8744 !! text
8745 {{{1}}} {{paramtest|
8746 param ={{{param}}}}}
8747 !! endarticle
8748
8749 !! test
8750 Template with complex arguments
8751 !! wikitext
8752 {{complextemplate|
8753 param ={{ templateasargtest |
8754 templ = simple }}|[[Template:complextemplate|link]]}}
8755 !! html
8756 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
8757 </p>
8758 !! end
8759
8760 !! test
8761 BUG 553: link with two variables in a piped link
8762 !! wikitext
8763 {|
8764 |[[{{{1}}}|{{{2}}}]]
8765 |}
8766 !! html
8767 <table>
8768 <tr>
8769 <td>[[{{{1}}}|{{{2}}}]]
8770 </td></tr></table>
8771
8772 !! end
8773
8774 !! test
8775 Magic variable as template parameter
8776 !! wikitext
8777 {{paramtest|param={{SITENAME}}}}
8778 !! html
8779 <p>This is a test template with parameter MediaWiki
8780 </p>
8781 !! end
8782
8783 !! article
8784 Template:linktest
8785 !! text
8786 [[{{{param}}}|link]]
8787 !! endarticle
8788
8789 !! test
8790 Template parameter as link source
8791 !! wikitext
8792 {{linktest|param=Main Page}}
8793 !! html
8794 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
8795 </p>
8796 !! end
8797
8798 !!test
8799 Template-generated attribute string (k='v')
8800 !! wikitext
8801 <span {{attr_str|id|v1}}>bar</span>
8802 !! html
8803 <p><span id="v1">bar</span>
8804 </p>
8805 !!end
8806
8807 !!article
8808 Template:paramtest2
8809 !! text
8810 including another template, {{paramtest|param={{{arg}}}}}
8811 !! endarticle
8812
8813 !! test
8814 Template passing argument to another template
8815 !! wikitext
8816 {{paramtest2|arg='hmm'}}
8817 !! html
8818 <p>including another template, This is a test template with parameter 'hmm'
8819 </p>
8820 !! end
8821
8822 !! article
8823 Template:Linktest2
8824 !! text
8825 Main Page
8826 !! endarticle
8827
8828 !! test
8829 Template as link source
8830 !! wikitext
8831 [[{{linktest2}}]]
8832
8833 [[{{linktest2}}|Main Page]]
8834
8835 [[{{linktest2}}]]Page
8836 !! html
8837 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8838 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8839 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
8840 </p>
8841 !! end
8842
8843
8844 !! article
8845 Template:loop1
8846 !! text
8847 {{loop2}}
8848 !! endarticle
8849
8850 !! article
8851 Template:loop2
8852 !! text
8853 {{loop1}}
8854 !! endarticle
8855
8856 !! test
8857 Template infinite loop
8858 !! wikitext
8859 {{loop1}}
8860 !! html
8861 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
8862 </p>
8863 !! end
8864
8865 !! test
8866 Template from main namespace
8867 !! wikitext
8868 {{:Main Page}}
8869 !! html
8870 <p>blah blah
8871 </p>
8872 !! end
8873
8874 !! article
8875 Template:table
8876 !! text
8877 {|
8878 | 1 || 2
8879 |-
8880 | 3 || 4
8881 |}
8882 !! endarticle
8883
8884 !! test
8885 BUG 529: Template with table, not included at beginning of line
8886 !! wikitext
8887 foo {{table}}
8888 !! html
8889 <p>foo
8890 </p>
8891 <table>
8892 <tr>
8893 <td> 1 </td>
8894 <td> 2
8895 </td></tr>
8896 <tr>
8897 <td> 3 </td>
8898 <td> 4
8899 </td></tr></table>
8900
8901 !! end
8902
8903 !! test
8904 BUG 523: Template shouldn't eat newline (or add an extra one before table)
8905 !! wikitext
8906 foo
8907 {{table}}
8908 !! html
8909 <p>foo
8910 </p>
8911 <table>
8912 <tr>
8913 <td> 1 </td>
8914 <td> 2
8915 </td></tr>
8916 <tr>
8917 <td> 3 </td>
8918 <td> 4
8919 </td></tr></table>
8920
8921 !! end
8922
8923 !! test
8924 BUG 41: Template parameters shown as broken links
8925 !! wikitext
8926 {{{parameter}}}
8927 !! html
8928 <p>{{{parameter}}}
8929 </p>
8930 !! end
8931
8932 !! test
8933 Template with targets containing wikilinks
8934 !! wikitext
8935 {{[[foo]]}}
8936
8937 {{[[{{echo|foo}}]]}}
8938
8939 {{{{echo|[[foo}}]]}}
8940 !! html
8941 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
8942 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
8943 </p><p>{{[[foo}}]]
8944 </p>
8945 !! end
8946
8947 !! article
8948 Template:MSGNW test
8949 !! text
8950 ''None'' of '''this''' should be
8951 * interpreted
8952 but rather passed unmodified
8953 {{test}}
8954 <gallery>
8955 File:Foobar.jpg
8956 </gallery>
8957 !! endarticle
8958
8959 # hmm, fix this or just deprecate msgnw and document its behavior?
8960 !! test
8961 msgnw keyword
8962 !! wikitext
8963 {{msgnw:MSGNW test}}
8964 !! html
8965 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
8966 &#42; interpreted
8967 &#32;but rather passed unmodified
8968 &#123;&#123;test&#125;&#125;
8969 &#60;gallery&#62;
8970 File:Foobar.jpg
8971 &#60;/gallery&#62;
8972 </p>
8973 !! end
8974
8975 !! test
8976 int keyword
8977 !! wikitext
8978 {{int:youhavenewmessages|lots of money|not!}}
8979 !! html
8980 <p>You have lots of money (not!).
8981 </p>
8982 !! end
8983
8984 !! article
8985 Template:Includes
8986 !! text
8987 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8988 !! endarticle
8989
8990 !! test
8991 <includeonly> and <noinclude> being included
8992 !! wikitext
8993 {{Includes}}
8994 !! html
8995 <p>Foobar
8996 </p>
8997 !! end
8998
8999 !! article
9000 Template:Includes2
9001 !! text
9002 <onlyinclude>Foo</onlyinclude>bar
9003 !! endarticle
9004
9005 !! test
9006 <onlyinclude> being included
9007 !! wikitext
9008 {{Includes2}}
9009 !! html
9010 <p>Foo
9011 </p>
9012 !! end
9013
9014
9015 !! article
9016 Template:Includes3
9017 !! text
9018 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9019 !! endarticle
9020
9021 !! test
9022 <onlyinclude> and <includeonly> being included
9023 !! wikitext
9024 {{Includes3}}
9025 !! html
9026 <p>Foo
9027 </p>
9028 !! end
9029
9030 !! test
9031 <includeonly> and <noinclude> on a page
9032 !! wikitext
9033 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9034 !! html
9035 <p>Foozar
9036 </p>
9037 !! end
9038
9039 !! test
9040 Un-closed <noinclude>
9041 !! wikitext
9042 <noinclude>
9043 !! html
9044 !! end
9045
9046 !! test
9047 <onlyinclude> on a page
9048 !! wikitext
9049 <onlyinclude>Foo</onlyinclude>bar
9050 !! html
9051 <p>Foobar
9052 </p>
9053 !! end
9054
9055 !! test
9056 Un-closed <onlyinclude>
9057 !! wikitext
9058 <onlyinclude>
9059 !! html
9060 !! end
9061
9062 !!test
9063 Self-closed noinclude, includeonly, onlyinclude tags
9064 !! wikitext
9065 <noinclude />
9066 <includeonly />
9067 <onlyinclude />
9068 !! html
9069 <p><br />
9070 </p>
9071 !!end
9072
9073 !!test
9074 Unbalanced includeonly and noinclude tags
9075 !! wikitext
9076 {|
9077 |a</noinclude>
9078 |b</noinclude></noinclude>
9079 |c</noinclude></includeonly>
9080 |d</includeonly></includeonly>
9081 |}
9082 !! html
9083 <table>
9084 <tr>
9085 <td>a
9086 </td>
9087 <td>b
9088 </td>
9089 <td>c&lt;/includeonly&gt;
9090 </td>
9091 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9092 </td></tr></table>
9093
9094 !!end
9095
9096 !! article
9097 Template:Includeonly section
9098 !! text
9099 <includeonly>
9100 ==Includeonly section==
9101 </includeonly>
9102 ==Section T-1==
9103 !!endarticle
9104
9105 !! test
9106 Bug 6563: Edit link generation for section shown by <includeonly>
9107 !! wikitext
9108 {{includeonly section}}
9109 !! html
9110 <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>
9111 <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>
9112
9113 !! end
9114
9115 # Uses same input as the contents of [[Template:Includeonly section]]
9116 !! test
9117 Bug 6563: Section extraction for section shown by <includeonly>
9118 !! options
9119 section=T-2
9120 !! wikitext
9121 <includeonly>
9122 ==Includeonly section==
9123 </includeonly>
9124 ==Section T-2==
9125 !! html
9126 ==Section T-2==
9127 !! end
9128
9129 !! test
9130 Bug 6563: Edit link generation for section suppressed by <includeonly>
9131 !! wikitext
9132 <includeonly>
9133 ==Includeonly section==
9134 </includeonly>
9135 ==Section 1==
9136 !! html
9137 <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>
9138
9139 !! end
9140
9141 !! test
9142 Bug 6563: Section extraction for section suppressed by <includeonly>
9143 !! options
9144 section=1
9145 !! wikitext
9146 <includeonly>
9147 ==Includeonly section==
9148 </includeonly>
9149 ==Section 1==
9150 !! html
9151 ==Section 1==
9152 !! end
9153
9154 !! test
9155 Un-closed <includeonly>
9156 !! wikitext
9157 <includeonly>
9158 !! html
9159 !! end
9160
9161 !! test
9162 Includes and comments at SOL
9163 !! wikitext
9164 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
9165
9166 <noinclude>
9167 some
9168 </noinclude>* stuff
9169 * here
9170
9171 <includeonly>can have stuff</includeonly>=== here ===
9172
9173 !! html/php
9174 <h2><span class="mw-headline" id="hu">hu</span></h2>
9175 <p>some
9176 </p>
9177 <ul><li> stuff</li>
9178 <li> here</li></ul>
9179 <h3><span class="mw-headline" id="here">here</span></h3>
9180
9181 !! html/parsoid
9182 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment -->
9183 <h2 data-parsoid='{}'> hu </h2>
9184
9185 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
9186
9187 <p data-parsoid='{}'>some</p>
9188 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>
9189 <ul data-parsoid='{}'>
9190 <li data-parsoid='{}'> stuff</li>
9191
9192 <li data-parsoid='{}'> here</li></ul>
9193
9194 <h3 data-parsoid='{}'> here </h3>
9195 !! end
9196
9197 # TODO: test with DOM fragment reuse!
9198 !! test
9199 Parsoid: DOM fragment reuse
9200 !! options
9201 parsoid=wt2wt,wt2html
9202 !! wikitext
9203 a{{echo|b<table></table>c}}d
9204
9205 a{{echo|b
9206 <table></table>
9207 c}}d
9208
9209 {{echo|a
9210
9211 <table></table>
9212
9213 b}}
9214 !! html
9215 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
9216 <table></table>c"}},"i":0}}]}'>b</span>
9217 <table about="#mwt1"></table><span about="#mwt1">c</span>d
9218
9219
9220 <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">
9221 </span>
9222 <table about="#mwt2"></table><span about="#mwt2">
9223 </span>
9224 <p about="#mwt2">cd</p>
9225
9226
9227 <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">
9228
9229 </span>
9230 <table about="#mwt3"></table><span about="#mwt3">
9231
9232 </span>
9233 <p about="#mwt3">b</p>
9234 !! end
9235
9236 !! test
9237 Parsoid: Merge double tds (bug 50603)
9238 !! options
9239 parsoid
9240 !! wikitext
9241 {|
9242 |{{echo|{{!}} foo}}
9243 |}
9244 !! html
9245 <table><tbody>
9246 <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>
9247 </tbody></table>
9248 !! end
9249
9250 !! test
9251 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9252 !! options
9253 parsoid
9254 !! wikitext
9255 {{echo|<div>}}
9256 {|
9257 |{{echo|{{!}} foo}}
9258 |}
9259 {{echo|</div>}}
9260 !! html
9261 <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}}]}'>
9262 <table><tbody>
9263 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9264 </tbody></table>
9265 </div>
9266 !! end
9267
9268 ###
9269 ### <includeonly> and <noinclude> in attributes
9270 ###
9271 !!test
9272 0. includeonly around the entire attribute
9273 !! wikitext
9274 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9275 !! html
9276 <p><span id="v2">bar</span>
9277 </p>
9278 !!end
9279
9280 !!test
9281 1. includeonly in html attr key
9282 !! wikitext
9283 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9284 !! html
9285 <p><span id="foo">bar</span>
9286 </p>
9287 !!end
9288
9289 !!test
9290 2. includeonly in html attr value
9291 !! wikitext
9292 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9293 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9294 !! html
9295 <p><span id="v1">bar</span>
9296 <span id="v1">bar</span>
9297 </p>
9298 !!end
9299
9300 !!test
9301 3. includeonly in part of an attr value
9302 !! wikitext
9303 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9304 !! html
9305 <p><span style="color:red;">bar</span>
9306 </p>
9307 !!end
9308
9309 !!test
9310 4. includeonly in table attributes
9311 !! wikitext
9312 {|
9313 |- <noinclude>
9314 |-
9315 |a
9316 </noinclude>
9317 |- <includeonly>
9318 |-
9319 |b
9320 </includeonly>
9321 |}
9322 !! html
9323 <table>
9324
9325
9326 <tr>
9327 <td>a
9328 </td></tr>
9329 </table>
9330
9331 !!end
9332
9333 ###
9334 ### Token Stream Patcher tests
9335 ###
9336 ### These tests won't always pass wt2wt and other modes because
9337 ### on serialization, the table will be output on a new line.
9338 ### For now, we are blacklisting them, and using this to test selser.
9339 ###
9340
9341 !!test
9342 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
9343 !!options
9344 parsoid=wt2html,wt2wt
9345 !!wikitext
9346 {{echo|}}{| width = '100%'
9347 |foo
9348 |}
9349 !!html/parsoid
9350 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
9351 <table width="100%">
9352 <tbody>
9353 <tr>
9354 <td>foo</td></tr></tbody></table>
9355 !!end
9356
9357 !!test
9358 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
9359 !!options
9360 parsoid=wt2html,wt2wt
9361 !!wikitext
9362 <includeonly>a</includeonly>{| {{{b}}}
9363 |c
9364 |}
9365 !!html/parsoid
9366 <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}}}":""}}'>
9367 <tbody><tr><td>c</td></tr>
9368 </tbody></table>
9369
9370 !!end
9371
9372 ###
9373 ### Testing parsing of templates where a template arg
9374 ### has the same name as the template itself.
9375 ###
9376
9377 !! article
9378 Template:quote
9379 !! text
9380 {{{quote|{{{1}}}}}}
9381 !! endarticle
9382
9383 !!test
9384 Templates: Template Name/Arg clash: 1. Use of positional param
9385 !! wikitext
9386 {{quote|foo}}
9387 !! html
9388 <p>foo
9389 </p>
9390 !!end
9391
9392 !!test
9393 Templates: Template Name/Arg clash: 2. Use of named param
9394 !! wikitext
9395 {{quote|quote=foo}}
9396 !! html
9397 <p>foo
9398 </p>
9399 !!end
9400
9401 !!test
9402 Templates: Template Name/Arg clash: 3. Use of named param with empty input
9403 !! wikitext
9404 {{quote|quote}}
9405 !! html
9406 <p>quote
9407 </p>
9408 !!end
9409
9410 ###
9411 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
9412 ###
9413
9414 !!test
9415 Templates: 1. Simple use
9416 !! wikitext
9417 {{echo|Foo}}
9418 !! html
9419 <p>Foo
9420 </p>
9421 !!end
9422
9423 !!test
9424 Templates: 2. Inside a block tag
9425 !! wikitext
9426 <div>{{echo|Foo}}</div>
9427 <blockquote>{{echo|Foo}}</blockquote>
9428 !! html
9429 <div>Foo</div>
9430 <blockquote>Foo</blockquote>
9431
9432 !! html+tidy
9433 <div>Foo</div>
9434 <blockquote>
9435 <p>Foo</p>
9436 </blockquote>
9437 !!end
9438
9439 !!test
9440 Templates: P-wrapping: 1a. Templates on consecutive lines
9441 !! wikitext
9442 {{echo|Foo}}
9443 {{echo|bar}}
9444 !! html
9445 <p>Foo
9446 bar
9447 </p>
9448 !!end
9449
9450 !!test
9451 Templates: P-wrapping: 1b. Templates on consecutive lines
9452 !! wikitext
9453 Foo
9454
9455 {{echo|bar}}
9456 {{echo|baz}}
9457 !! html
9458 <p>Foo
9459 </p><p>bar
9460 baz
9461 </p>
9462 !!end
9463
9464 !!test
9465 Templates: P-wrapping: 1c. Templates on consecutive lines
9466 !! wikitext
9467 {{echo|Foo}}
9468 {{echo|bar}} <div>baz</div>
9469 !! html
9470 <p>Foo
9471 </p>
9472 bar <div>baz</div>
9473
9474 !! html+tidy
9475 <p>Foo</p>
9476 <p>bar</p>
9477 <div>baz</div>
9478 !! end
9479
9480 !!test
9481 Templates: P-wrapping: 1d. Template preceded by comment-only line
9482 !!options
9483 parsoid
9484 !! wikitext
9485 <!-- foo -->
9486 {{echo|Bar}}
9487 !! html
9488 <!-- foo -->
9489
9490 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
9491 !!end
9492
9493 !!test
9494 Templates: Inline Text: 1. Multiple template uses
9495 !! wikitext
9496 {{echo|Foo}}bar{{echo|baz}}
9497 !! html
9498 <p>Foobarbaz
9499 </p>
9500 !!end
9501
9502 !!test
9503 Templates: Inline Text: 2. Back-to-back template uses
9504 !! wikitext
9505 {{echo|Foo}}{{echo|bar}}
9506 !! html
9507 <p>Foobar
9508 </p>
9509 !!end
9510
9511 !!test
9512 Templates: Block Tags: 1. Multiple template uses
9513 !! wikitext
9514 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
9515 !! html
9516 <div>Foo</div><div>bar</div><div>baz</div>
9517
9518 !!end
9519
9520 !!test
9521 Templates: Block Tags: 2. Back-to-back template uses
9522 !! wikitext
9523 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
9524 !! html
9525 <div>Foo</div><div>bar</div>
9526
9527 !!end
9528
9529 !!test
9530 Templates: Links: 1. Simple example
9531 !! wikitext
9532 {{echo|[[Foo|bar]]}}
9533 !! html
9534 <p><a href="/wiki/Foo" title="Foo">bar</a>
9535 </p>
9536 !!end
9537
9538 !!test
9539 Templates: Links: 2. Generation of link href
9540 !! wikitext
9541 [[{{echo|Foo}}|bar]]
9542 !! html
9543 <p><a href="/wiki/Foo" title="Foo">bar</a>
9544 </p>
9545 !!end
9546
9547 !!test
9548 Templates: Links: 3. Generation of part of a link href
9549 !! wikitext
9550 [[Fo{{echo|o}}|bar]]
9551
9552 [[Foo{{echo|bar}}]]
9553
9554 [[Foo{{echo|bar}}baz]]
9555
9556 [[Foo{{echo|bar}}|bar]]
9557
9558 [[:Foo{{echo|bar}}]]
9559
9560 [[:Foo{{echo|bar}}|bar]]
9561 !! html
9562 <p><a href="/wiki/Foo" title="Foo">bar</a>
9563 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9564 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
9565 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9566 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9567 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9568 </p>
9569 !!end
9570
9571 !!test
9572 Templates: Links: 4. Multiple templates generating link href
9573 !! wikitext
9574 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
9575 !! html
9576 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9577 </p>
9578 !!end
9579
9580 !!test
9581 Templates: Links: 5. Generation of link text
9582 !! wikitext
9583 [[Foo|{{echo|bar}}]]
9584 !! html
9585 <p><a href="/wiki/Foo" title="Foo">bar</a>
9586 </p>
9587 !!end
9588
9589 !!test
9590 Templates: Links: 5. Nested templates (only outermost template should be marked)
9591 !! wikitext
9592 {{echo|[[{{echo|Foo}}|bar]]}}
9593 !! html
9594 <p><a href="/wiki/Foo" title="Foo">bar</a>
9595 </p>
9596 !!end
9597
9598 !!test
9599 Templates: HTML Tag: 1. Generation of HTML attr. key
9600 !! wikitext
9601 <div {{echo|style}}="color:red;">foo</div>
9602 !! html
9603 <div style="color:red;">foo</div>
9604
9605 !!end
9606
9607 !!test
9608 Templates: HTML Tag: 2. Generation of HTML attr. value
9609 !! wikitext
9610 <div style={{echo|'color:red;'}}>foo</div>
9611 !! html
9612 <div style="color:red;">foo</div>
9613
9614 !!end
9615
9616 !!test
9617 Templates: HTML Tag: 3. Generation of HTML attr key and value
9618 !! wikitext
9619 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
9620 !! html
9621 <div style="color:red;">foo</div>
9622
9623 !!end
9624
9625 !!test
9626 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
9627 !! wikitext
9628 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
9629 !! html
9630 <div title="This is a long title with just one piece templated">foo</div>
9631
9632 !!end
9633
9634 !!test
9635 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
9636 !! wikitext
9637 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
9638 !! html
9639 <div title="This is a long title with just one piece templated">foo</div>
9640
9641 !!end
9642
9643 !!test
9644 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
9645 !! wikitext
9646 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
9647 !! html
9648 <div title="This is a long title with just one piece templated">foo</div>
9649
9650 !!end
9651
9652 !!test
9653 Templates: HTML Tag: 7. Generation of partial attribute key string
9654 !! wikitext
9655 <div st{{echo|yle}}="color:red;">foo</div>
9656 !! html
9657 <div style="color:red;">foo</div>
9658
9659 !!end
9660
9661 !!test
9662 Templates: HTML Tables: 1. Generating start of a HTML table
9663 !! wikitext
9664 {{echo|<table><tr><td>foo</td>}}</tr></table>
9665 !! html
9666 <table><tr><td>foo</td></tr></table>
9667
9668 !!end
9669
9670 !!test
9671 Templates: HTML Tables: 2a. Generating middle of a HTML table
9672 !! wikitext
9673 <table><tr>{{echo|<td>foo</td>}}</tr></table>
9674 !! html
9675 <table><tr><td>foo</td></tr></table>
9676
9677 !!end
9678
9679 !!test
9680 Templates: HTML Tables: 2b. Generating middle of a HTML table
9681 !! wikitext
9682 <table>{{echo|<tr><td>foo</td></tr>}}</table>
9683 !! html
9684 <table><tr><td>foo</td></tr></table>
9685
9686 !!end
9687
9688 !!test
9689 Templates: HTML Tables: 3. Generating end of a HTML table
9690 !! wikitext
9691 <table><tr>{{echo|<td>foo</td></tr></table>}}
9692 !! html
9693 <table><tr><td>foo</td></tr></table>
9694
9695 !!end
9696
9697 !!test
9698 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
9699 !! wikitext
9700 {{echo|<table>}}<tr><td>foo</td></tr></table>
9701 !! html
9702 <table><tr><td>foo</td></tr></table>
9703
9704 !!end
9705
9706 !!test
9707 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
9708 !! wikitext
9709 <table>{{echo|<tr>}}<td>foo</td></tr></table>
9710 !! html
9711 <table><tr><td>foo</td></tr></table>
9712
9713 !!end
9714
9715 !!test
9716 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
9717 !! wikitext
9718 <table><tr>{{echo|<td>}}foo</td></tr></table>
9719 !! html
9720 <table><tr><td>foo</td></tr></table>
9721
9722 !!end
9723
9724 !!test
9725 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
9726 !! wikitext
9727 <table><tr><td>foo{{echo|</td>}}</tr></table>
9728 !! html
9729 <table><tr><td>foo</td></tr></table>
9730
9731 !!end
9732
9733 !!test
9734 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
9735 !! wikitext
9736 <table><tr><td>foo</td>{{echo|</tr>}}</table>
9737 !! html
9738 <table><tr><td>foo</td></tr></table>
9739
9740 !!end
9741
9742 !!test
9743 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
9744 !! wikitext
9745 <table><tr><td>foo</td></tr>{{echo|</table>}}
9746 !! html
9747 <table><tr><td>foo</td></tr></table>
9748
9749 !!end
9750
9751 !!test
9752 Templates: HTML Tables: 5. Proper fostering of categories from inside
9753 !!options
9754 parsoid=wt2html,wt2wt
9755 !! wikitext
9756 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
9757 <!--Two categories (Bug 50330)-->
9758 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
9759 !! html
9760 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
9761 <!--Two categories (Bug 50330)-->
9762 <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>
9763 !!end
9764
9765 !!test
9766 Templates: Wiki Tables: 1a. Fostering of entire template content
9767 !! wikitext
9768 {|
9769 {{echo|a}}
9770 |}
9771 !! html
9772 <table>
9773 a
9774 <tr><td></td></tr></table>
9775
9776 !! html+tidy
9777 <p>a</p>
9778 <table>
9779 <tr>
9780 <td></td>
9781 </tr>
9782 </table>
9783 !! end
9784
9785 !!test
9786 Templates: Wiki Tables: 1b. Fostering of entire template content
9787 !! wikitext
9788 {|
9789 {{echo|<div>}}
9790 foo
9791 {{echo|</div>}}
9792 |}
9793 !! html
9794 <table>
9795 <div>
9796 <p>foo
9797 </p>
9798 </div>
9799 <tr><td></td></tr></table>
9800
9801 !! html+tidy
9802 <div>
9803 <p>foo</p>
9804 </div>
9805 <table>
9806 <tr>
9807 <td></td>
9808 </tr>
9809 </table>
9810 !! end
9811
9812 !!test
9813 Templates: Wiki Tables: 2. Fostering of partial template content
9814 !! wikitext
9815 {|
9816 {{echo|a
9817 <div>b</div>}}
9818 |}
9819 !! html
9820 <table>
9821 a
9822 <div>b</div>
9823 <tr><td></td></tr></table>
9824
9825 !! html+tidy
9826 <p>a</p>
9827 <div>b</div>
9828 <table>
9829 <tr>
9830 <td></td>
9831 </tr>
9832 </table>
9833 !! end
9834
9835 !!test
9836 Templates: Wiki Tables: 3. td-content via multiple templates
9837 !! wikitext
9838 {|
9839 {{echo|{{pipe}}a}}{{echo|b}}
9840 |}
9841 !! html
9842 <table>
9843 <tr>
9844 <td>ab
9845 </td></tr></table>
9846
9847 !!end
9848
9849 !!test
9850 Templates: Wiki Tables: 4. Templated tags, no content
9851 !! wikitext
9852 {{tbl-start}}
9853 {{tbl-end}}
9854 !! html
9855 <table>
9856 <tr><td></td></tr></table>
9857
9858 !!end
9859
9860 !!test
9861 Templates: Wiki Tables: 5. Templated tags, regular td-tags
9862 !! wikitext
9863 {{tbl-start}}
9864 |foo
9865 {{tbl-end}}
9866 !! html
9867 <table>
9868 <tr>
9869 <td>foo
9870 </td></tr></table>
9871
9872 !!end
9873
9874 !!test
9875 Templates: Wiki Tables: 6. Templated tags, templated td-tags
9876 !! wikitext
9877 {{tbl-start}}
9878 {{!}}foo
9879 {{tbl-end}}
9880 !! html
9881 <table>
9882 <tr>
9883 <td>foo
9884 </td></tr></table>
9885
9886 !!end
9887
9888 !!test
9889 Templates: Lists: Multi-line list-items via templates
9890 !! wikitext
9891 *{{echo|a {{nonexistent|
9892 unused}}}}
9893 *{{echo|b {{nonexistent|
9894 unused}}}}
9895 !! html
9896 <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>
9897 <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>
9898
9899 !!end
9900
9901 !!test
9902 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
9903 !! wikitext
9904 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
9905 !! html
9906 <p><i>ab</i>c<i>d</i>e
9907 </p>
9908 !!end
9909
9910 !!test
9911 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
9912 (PHP parser generates misnested html)
9913 !! wikitext
9914 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
9915 !! html/parsoid
9916 <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>
9917 !!end
9918
9919 !!test
9920 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
9921 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
9922 !! options
9923 parsoid=wt2html,wt2wt
9924 !! wikitext
9925 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
9926 !! html
9927 <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>
9928 <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>
9929 <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>
9930 !!end
9931
9932 !!test
9933 Templates: Ugly nesting: 4. Divs opened/closed across templates
9934 !! wikitext
9935 a<div>b{{echo|c</div>d}}e
9936 !! html
9937 a<div>bc</div>de
9938
9939 !! html+tidy
9940 <p>a</p>
9941 <div>bc</div>
9942 <p>de</p>
9943 !! end
9944
9945 !!test
9946 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
9947 (Parsoid-centric)
9948 !! options
9949 parsoid
9950 !! wikitext
9951 {|
9952 |{{echo|foo</table>}}
9953 |bar
9954 |}
9955 !! html
9956 <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|}"]}'>
9957
9958 <tbody>
9959 <tr>
9960 <td>foo</td></tr></tbody></table><span about="#mwt1">
9961 </span><span about="#mwt1">|bar</span><span about="#mwt1">
9962 |}</span>
9963 !!end
9964
9965 !!test
9966 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
9967 (Parsoid-centric)
9968 !! options
9969 parsoid
9970 !! wikitext
9971 <table>
9972 <tr>
9973 <td>
9974 <table>
9975 <tr>
9976 <td>1. {{echo|foo </table>}}</td>
9977 <td> bar </td>
9978 <td>2. {{echo|baz </table>}}</td>
9979 </tr>
9980 <tr>
9981 <td>abc</td>
9982 </tr>
9983 </table>
9984 </td>
9985 </tr>
9986 <tr>
9987 <td>xyz</td>
9988 </tr>
9989 </table>
9990 !! html
9991 <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>"]}'>
9992 <tbody><tr>
9993 <td>
9994 <table>
9995 <tbody><tr>
9996 <td>1. foo </td></tr></tbody></table></td>
9997 <td> bar </td>
9998 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
9999 </span><span about="#mwt2">
10000 </span><span about="#mwt2">
10001 </span><span about="#mwt2">abc</span><span about="#mwt2">
10002 </span><span about="#mwt2">
10003 </span><span about="#mwt2">
10004 </span><span about="#mwt2">
10005 </span><span about="#mwt2">
10006 </span><span about="#mwt2">
10007 </span><span about="#mwt2">xyz</span><span about="#mwt2">
10008 </span><span about="#mwt2">
10009 </span>
10010 !!end
10011
10012 !! test
10013 Templates: Ugly templates: 3. newline-only template parameter
10014 !! wikitext
10015 foo {{echo|
10016 }}
10017 !! html
10018 <p>foo
10019 </p>
10020 !! end
10021
10022 # This looks like a bug: a single newline triggers p/br for some reason.
10023 !! test
10024 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10025 !! wikitext
10026 {{echo|
10027 }}
10028 !! html
10029 <p><br />
10030 </p>
10031 !! end
10032
10033 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10034 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10035 !! test
10036 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10037 !! wikitext
10038 {{echo|<table>}}
10039 {{echo|<div>foo}}
10040 {{echo|</table>}}
10041 !! html/parsoid
10042 <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
10043 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10044 </table>
10045 !! end
10046
10047 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10048 # that are "identical" and generate nesting cycles in the algorithm
10049 !! test
10050 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
10051 !! wikitext
10052 {{echo|<table><tr><td><table>}}
10053 {{echo|<div>}}
10054 {{echo|</div>}}
10055 !! html/parsoid
10056 <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"}'>
10057 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10058 </table></td></tr></tbody></table>
10059 !! end
10060
10061 !!test
10062 Parser Functions: 1. Simple example
10063 !! wikitext
10064 {{uc:foo}}
10065 !! html
10066 <p>FOO
10067 </p>
10068 !!end
10069
10070 !!test
10071 Parser Functions: 2. Nested use (only outermost should be marked up)
10072 !! wikitext
10073 {{uc:{{lc:FOO}}}}
10074 !! html
10075 <p>FOO
10076 </p>
10077 !!end
10078
10079 ###
10080 ### Pre-save transform tests
10081 ###
10082 !! test
10083 pre-save transform: subst:
10084 !! options
10085 PST
10086 !! wikitext
10087 {{subst:test}}
10088 !! html
10089 This is a test template
10090 !! end
10091
10092 !! test
10093 pre-save transform: normal template
10094 !! options
10095 PST
10096 !! wikitext
10097 {{test}}
10098 !! html
10099 {{test}}
10100 !! end
10101
10102 !! test
10103 pre-save transform: nonexistent template
10104 !! options
10105 PST
10106 !! wikitext
10107 {{thistemplatedoesnotexist}}
10108 !! html
10109 {{thistemplatedoesnotexist}}
10110 !! end
10111
10112
10113 !! test
10114 pre-save transform: subst magic variables
10115 !! options
10116 PST
10117 !! wikitext
10118 {{subst:SITENAME}}
10119 !! html
10120 MediaWiki
10121 !! end
10122
10123 # This is bug 89, which I fixed. -- wtm
10124 !! test
10125 pre-save transform: subst: templates with parameters
10126 !! options
10127 pst
10128 !! wikitext
10129 {{subst:paramtest|param="something else"}}
10130 !! html
10131 This is a test template with parameter "something else"
10132 !! end
10133
10134 !! article
10135 Template:nowikitest
10136 !! text
10137 <nowiki>'''not wiki'''</nowiki>
10138 !! endarticle
10139
10140 !! test
10141 pre-save transform: nowiki in subst (bug 1188)
10142 !! options
10143 pst
10144 !! wikitext
10145 {{subst:nowikitest}}
10146 !! html
10147 <nowiki>'''not wiki'''</nowiki>
10148 !! end
10149
10150
10151 !! article
10152 Template:commenttest
10153 !! text
10154 This template has <!-- a comment --> in it.
10155 !! endarticle
10156
10157 !! test
10158 pre-save transform: comment in subst (bug 1936)
10159 !! options
10160 pst
10161 !! wikitext
10162 {{subst:commenttest}}
10163 !! html
10164 This template has <!-- a comment --> in it.
10165 !! end
10166
10167 !! test
10168 pre-save transform: unclosed tag
10169 !! options
10170 pst noxml
10171 !! wikitext
10172 <nowiki>'''not wiki'''
10173 !! html
10174 <nowiki>'''not wiki'''
10175 !! end
10176
10177 !! test
10178 pre-save transform: mixed tag case
10179 !! options
10180 pst noxml
10181 !! wikitext
10182 <NOwiki>'''not wiki'''</noWIKI>
10183 !! html
10184 <NOwiki>'''not wiki'''</noWIKI>
10185 !! end
10186
10187 !! test
10188 pre-save transform: unclosed comment in <nowiki>
10189 !! options
10190 pst noxml
10191 !! wikitext
10192 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10193 !! html
10194 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10195 !!end
10196
10197 # Leading @ in this template definition works around a limitation
10198 # in parsoid's parserTests which otherwise strips the <span> from the
10199 # result (confusing it for a template wrapper)
10200 !! article
10201 Template:dangerous
10202 !!text
10203 @<span onmouseover="alert('crap')">Oh no</span>
10204 !!endarticle
10205
10206 !!test
10207 (confirming safety of fix for subst bug 1936)
10208 !! wikitext
10209 {{Template:dangerous}}
10210 !! html
10211 <p>@<span>Oh no</span>
10212 </p>
10213 !! end
10214
10215 !! test
10216 pre-save transform: comment containing gallery (bug 5024)
10217 !! options
10218 pst
10219 !! wikitext
10220 <!-- <gallery>data</gallery> -->
10221 !! html
10222 <!-- <gallery>data</gallery> -->
10223 !!end
10224
10225 !! test
10226 pre-save transform: comment containing extension
10227 !! options
10228 pst
10229 !! wikitext
10230 <!-- <tag>data</tag> -->
10231 !! html
10232 <!-- <tag>data</tag> -->
10233 !!end
10234
10235 !! test
10236 pre-save transform: comment containing nowiki
10237 !! options
10238 pst
10239 !! wikitext
10240 <!-- <nowiki>data</nowiki> -->
10241 !! html
10242 <!-- <nowiki>data</nowiki> -->
10243 !!end
10244
10245 !! test
10246 pre-save transform: <noinclude> in subst (bug 3298)
10247 !! options
10248 pst
10249 !! wikitext
10250 {{subst:Includes}}
10251 !! html
10252 Foobar
10253 !! end
10254
10255 !! test
10256 pre-save transform: <onlyinclude> in subst (bug 3298)
10257 !! options
10258 pst
10259 !! wikitext
10260 {{subst:Includes2}}
10261 !! html
10262 Foo
10263 !! end
10264
10265 !! article
10266 Template:SubstTest
10267 !!text
10268 {{<includeonly>subst:</includeonly>Includes}}
10269 !! endarticle
10270
10271 !! article
10272 Template:SafeSubstTest
10273 !! text
10274 {{<includeonly>safesubst:</includeonly>Includes}}
10275 !! endarticle
10276
10277 !! test
10278 bug 22297: safesubst: works during PST
10279 !! options
10280 pst
10281 !! wikitext
10282 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
10283 !! html
10284 FoobarFoobar
10285 !! end
10286
10287 !! test
10288 bug 22297: safesubst: works during normal parse
10289 !! wikitext
10290 {{SafeSubstTest}}
10291 !! html
10292 <p>Foobar
10293 </p>
10294 !! end
10295
10296 !! test
10297 subst: does not work during normal parse
10298 !! wikitext
10299 {{SubstTest}}
10300 !! html
10301 <p>{{subst:Includes}}
10302 </p>
10303 !! end
10304
10305 !! test
10306 pre-save transform: context links ("pipe trick")
10307 !! options
10308 pst
10309 !! wikitext
10310 [[Article (context)|]]
10311 [[Bar:Article|]]
10312 [[:Bar:Article|]]
10313 [[Bar:Article (context)|]]
10314 [[:Bar:Article (context)|]]
10315 [[|Article]]
10316 [[|Article (context)]]
10317 [[Bar:X (Y) Z|]]
10318 [[:Bar:X (Y) Z|]]
10319 !! html
10320 [[Article (context)|Article]]
10321 [[Bar:Article|Article]]
10322 [[:Bar:Article|Article]]
10323 [[Bar:Article (context)|Article]]
10324 [[:Bar:Article (context)|Article]]
10325 [[Article]]
10326 [[Article (context)]]
10327 [[Bar:X (Y) Z|X (Y) Z]]
10328 [[:Bar:X (Y) Z|X (Y) Z]]
10329 !! end
10330
10331 !! test
10332 pre-save transform: context links ("pipe trick") with interwiki prefix
10333 !! options
10334 pst
10335 !! wikitext
10336 [[interwiki:Article|]]
10337 [[:interwiki:Article|]]
10338 [[interwiki:Bar:Article|]]
10339 [[:interwiki:Bar:Article|]]
10340 !! html
10341 [[interwiki:Article|Article]]
10342 [[:interwiki:Article|Article]]
10343 [[interwiki:Bar:Article|Bar:Article]]
10344 [[:interwiki:Bar:Article|Bar:Article]]
10345 !! end
10346
10347 !! test
10348 pre-save transform: context links ("pipe trick") with parens in title
10349 !! options
10350 pst title=[[Somearticle (context)]]
10351 !! wikitext
10352 [[|Article]]
10353 !! html
10354 [[Article (context)|Article]]
10355 !! end
10356
10357 !! test
10358 pre-save transform: context links ("pipe trick") with comma in title
10359 !! options
10360 pst title=[[Someplace, Somewhere]]
10361 !! wikitext
10362 [[|Otherplace]]
10363 [[Otherplace, Elsewhere|]]
10364 [[Otherplace, Elsewhere, Anywhere|]]
10365 !! html
10366 [[Otherplace, Somewhere|Otherplace]]
10367 [[Otherplace, Elsewhere|Otherplace]]
10368 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
10369 !! end
10370
10371 !! test
10372 pre-save transform: context links ("pipe trick") with parens and comma
10373 !! options
10374 pst title=[[Someplace (IGNORED), Somewhere]]
10375 !! wikitext
10376 [[|Otherplace]]
10377 [[Otherplace (place), Elsewhere|]]
10378 !! html
10379 [[Otherplace, Somewhere|Otherplace]]
10380 [[Otherplace (place), Elsewhere|Otherplace]]
10381 !! end
10382
10383 !! test
10384 pre-save transform: context links ("pipe trick") with comma and parens
10385 !! options
10386 pst title=[[Who, me? (context)]]
10387 !! wikitext
10388 [[|Yes, you.]]
10389 [[Me, Myself, and I (1937 song)|]]
10390 !! html
10391 [[Yes, you. (context)|Yes, you.]]
10392 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
10393 !! end
10394
10395 !! test
10396 pre-save transform: context links ("pipe trick") with namespace
10397 !! options
10398 pst title=[[Ns:Somearticle]]
10399 !! wikitext
10400 [[|Article]]
10401 !! html
10402 [[Ns:Article|Article]]
10403 !! end
10404
10405 !! test
10406 pre-save transform: context links ("pipe trick") with namespace and parens
10407 !! options
10408 pst title=[[Ns:Somearticle (context)]]
10409 !! wikitext
10410 [[|Article]]
10411 !! html
10412 [[Ns:Article (context)|Article]]
10413 !! end
10414
10415 !! test
10416 pre-save transform: context links ("pipe trick") with namespace and comma
10417 !! options
10418 pst title=[[Ns:Somearticle, Context, Whatever]]
10419 !! wikitext
10420 [[|Article]]
10421 !! html
10422 [[Ns:Article, Context, Whatever|Article]]
10423 !! end
10424
10425 !! test
10426 pre-save transform: context links ("pipe trick") with namespace, comma and parens
10427 !! options
10428 pst title=[[Ns:Somearticle, Context (context)]]
10429 !! wikitext
10430 [[|Article]]
10431 !! html
10432 [[Ns:Article (context)|Article]]
10433 !! end
10434
10435 !! test
10436 pre-save transform: context links ("pipe trick") with namespace, parens and comma
10437 !! options
10438 pst title=[[Ns:Somearticle (IGNORED), Context]]
10439 !! wikitext
10440 [[|Article]]
10441 !! html
10442 [[Ns:Article, Context|Article]]
10443 !! end
10444
10445 !! test
10446 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
10447 !! options
10448 pst
10449 !! wikitext
10450 [[Article(context)|]]
10451 [[Bar:Article(context)|]]
10452 [[:Bar:Article(context)|]]
10453 [[|Article(context)]]
10454 [[Bar:X(Y)Z|]]
10455 [[:Bar:X(Y)Z|]]
10456 !! html
10457 [[Article(context)|Article]]
10458 [[Bar:Article(context)|Article]]
10459 [[:Bar:Article(context)|Article]]
10460 [[Article(context)]]
10461 [[Bar:X(Y)Z|X(Y)Z]]
10462 [[:Bar:X(Y)Z|X(Y)Z]]
10463 !! end
10464
10465 !! test
10466 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
10467 !! options
10468 pst
10469 !! wikitext
10470 [[Article (context)|]]
10471 [[Bar:Article (context)|]]
10472 [[:Bar:Article (context)|]]
10473 [[|Article (context)]]
10474 [[Bar:X (Y) Z|]]
10475 [[:Bar:X (Y) Z|]]
10476 !! html
10477 [[Article (context)|Article]]
10478 [[Bar:Article (context)|Article]]
10479 [[:Bar:Article (context)|Article]]
10480 [[Article (context)]]
10481 [[Bar:X (Y) Z|X (Y) Z]]
10482 [[:Bar:X (Y) Z|X (Y) Z]]
10483 !! end
10484
10485 !! test
10486 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
10487 !! options
10488 pst
10489 !! wikitext
10490 [[Article(context)|]]
10491 [[Bar:Article(context)|]]
10492 [[:Bar:Article(context)|]]
10493 [[|Article(context)]]
10494 [[Bar:X(Y)Z|]]
10495 [[:Bar:X(Y)Z|]]
10496 !! html
10497 [[Article(context)|Article]]
10498 [[Bar:Article(context)|Article]]
10499 [[:Bar:Article(context)|Article]]
10500 [[Article(context)]]
10501 [[Bar:X(Y)Z|X(Y)Z]]
10502 [[:Bar:X(Y)Z|X(Y)Z]]
10503 !! end
10504
10505 !! test
10506 pre-save transform: context links ("pipe trick") with commas (bug 21660)
10507 !! options
10508 pst
10509 !! wikitext
10510 [[Article (context), context|]]
10511 [[Article (context),context|]]
10512 [[Bar:Article (context), context|]]
10513 [[Bar:Article (context),context|]]
10514 [[:Bar:Article (context), context|]]
10515 [[:Bar:Article (context),context|]]
10516 !! html
10517 [[Article (context), context|Article]]
10518 [[Article (context),context|Article]]
10519 [[Bar:Article (context), context|Article]]
10520 [[Bar:Article (context),context|Article]]
10521 [[:Bar:Article (context), context|Article]]
10522 [[:Bar:Article (context),context|Article]]
10523 !! end
10524
10525 !! test
10526 pre-save transform: trim trailing empty lines
10527 !! options
10528 pst
10529 !! wikitext
10530 Empty lines are trimmed
10531
10532
10533
10534
10535 !! html
10536 Empty lines are trimmed
10537 !! end
10538
10539 !! test
10540 pre-save transform: Signature expansion
10541 !! options
10542 pst
10543 !! wikitext
10544 * ~~~
10545 * <noinclude>~~~</noinclude>
10546 * <includeonly>~~~</includeonly>
10547 * <onlyinclude>~~~</onlyinclude>
10548 !! html
10549 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
10550 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
10551 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
10552 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
10553 !! end
10554
10555
10556 !! test
10557 pre-save transform: Signature expansion in nowiki tags (bug 93)
10558 !! options
10559 pst disabled
10560 !! wikitext
10561 Shall not expand:
10562
10563 <nowiki>~~~~</nowiki>
10564
10565 <includeonly><nowiki>~~~~</nowiki></includeonly>
10566
10567 <noinclude><nowiki>~~~~</nowiki></noinclude>
10568
10569 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10570
10571 {{subst:Foo}} shall be converted to FOO
10572
10573 As well as inside noinclude/onlyinclude
10574 <noinclude>{{subst:Foo}}</noinclude>
10575 <onlyinclude>{{subst:Foo}}</onlyinclude>
10576
10577 But not inside includeonly
10578 <includeonly>{{subst:Foo}}</includeonly>
10579 !! html
10580 Shall not expand:
10581
10582 <nowiki>~~~~</nowiki>
10583
10584 <includeonly><nowiki>~~~~</nowiki></includeonly>
10585
10586 <noinclude><nowiki>~~~~</nowiki></noinclude>
10587
10588 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10589
10590 FOO shall be converted to FOO
10591
10592 As well as inside noinclude/onlyinclude
10593 <noinclude>FOO</noinclude>
10594 <onlyinclude>FOO</onlyinclude>
10595
10596 But not inside includeonly
10597 <includeonly>{{subst:Foo}}</includeonly>
10598 !! end
10599
10600 !! test
10601 Parsoid: Recognize nowiki with trailing space in tags
10602 !! options
10603 parsoid=wt2html
10604 !! wikitext
10605 <nowiki ><div>[[foo]]</nowiki >
10606
10607 a<nowiki / >b
10608
10609 c<nowiki />d
10610
10611 e<nowiki/ >f
10612 !! html
10613 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10614 <p>ab</p>
10615 <p>cd</p>
10616 <p>ef</p>
10617 !! end
10618
10619 !! test
10620 Parsoid: Recognize nowiki with odd capitalization
10621 !! options
10622 parsoid=wt2html
10623 !! wikitext
10624 <noWikI ><div>[[foo]]</Nowiki >
10625 !! html
10626 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10627 !! end
10628
10629
10630 !! test
10631 Parsoid: Escape nowiki with trailing space in tags
10632 !! options
10633 parsoid=html2wt
10634 !! wikitext
10635 &lt;nowiki &gt; foo &lt;/nowiki &gt;
10636
10637 a&lt;nowiki /&gt;b
10638
10639 c&lt;nowiki/ &gt;d
10640 !! html
10641 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
10642 <p>a&lt;nowiki /&gt;b</p>
10643 <p>c&lt;nowiki/ &gt;d</p>
10644 !! end
10645
10646 !! test
10647 Parsoid: Escape weird noWikI capitalizations
10648 !! options
10649 parsoid=html2wt
10650 !! wikitext
10651 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
10652 !! html
10653 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
10654 !! end
10655
10656 ###
10657 ### Message transform tests
10658 ###
10659 !! test
10660 message transform: magic variables
10661 !! options
10662 msg
10663 !! wikitext
10664 {{SITENAME}}
10665 !! html
10666 MediaWiki
10667 !! end
10668
10669 !! test
10670 message transform: should not transform wiki markup
10671 !! options
10672 msg
10673 !! wikitext
10674 ''test''
10675 !! html
10676 ''test''
10677 !! end
10678
10679 !! test
10680 message transform: <noinclude> in transcluded template (bug 4926)
10681 !! options
10682 msg
10683 !! wikitext
10684 {{Includes}}
10685 !! html
10686 Foobar
10687 !! end
10688
10689 !! test
10690 message transform: <onlyinclude> in transcluded template (bug 4926)
10691 !! options
10692 msg
10693 !! wikitext
10694 {{Includes2}}
10695 !! html
10696 Foo
10697 !! end
10698
10699 !! test
10700 {{#special:}} page name, known
10701 !! options
10702 msg
10703 !! wikitext
10704 {{#special:Recentchanges}}
10705 !! html
10706 Special:RecentChanges
10707 !! end
10708
10709 !! test
10710 {{#special:}} page name with subpage, known
10711 !! options
10712 msg
10713 !! wikitext
10714 {{#special:Recentchanges/param}}
10715 !! html
10716 Special:RecentChanges/param
10717 !! end
10718
10719 !! test
10720 {{#special:}} page name, unknown
10721 !! options
10722 msg
10723 !! wikitext
10724 {{#special:foobar nonexistent}}
10725 !! html
10726 Special:Foobar nonexistent
10727 !! end
10728
10729 !! test
10730 {{#speciale:}} page name, known
10731 !! options
10732 msg
10733 !! wikitext
10734 {{#speciale:Recentchanges}}
10735 !! html
10736 Special:RecentChanges
10737 !! end
10738
10739 !! test
10740 {{#speciale:}} page name with subpage, known
10741 !! options
10742 msg
10743 !! wikitext
10744 {{#speciale:Recentchanges/param}}
10745 !! html
10746 Special:RecentChanges/param
10747 !! end
10748
10749 !! test
10750 {{#speciale:}} page name, unknown
10751 !! options
10752 msg
10753 !! wikitext
10754 {{#speciale:foobar nonexistent}}
10755 !! html
10756 Special:Foobar_nonexistent
10757 !! end
10758
10759 ###
10760 ### Images
10761 ###
10762 ### For Parsoid-specific tests, see
10763 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10764
10765 !! test
10766 Simple image
10767 !! options
10768 parsoid=wt2html,wt2wt,html2html
10769 !! wikitext
10770 [[Image:foobar.jpg]]
10771 !! html/php
10772 <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>
10773 </p>
10774 !! html/parsoid
10775 <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>
10776 </p>
10777 !! end
10778
10779 !! test
10780 Simple image (using File: namespace, now canonical)
10781 !! wikitext
10782 [[File:Foobar.jpg]]
10783 !! html/php
10784 <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>
10785 </p>
10786 !! html/parsoid
10787 <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>
10788 </p>
10789 !! end
10790
10791 !! test
10792 Right-aligned image
10793 !! wikitext
10794 [[File:Foobar.jpg|right]]
10795 !! html/php
10796 <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>
10797
10798 !! html/parsoid
10799 <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>
10800 !! end
10801
10802 !! test
10803 Image with caption
10804 !! wikitext
10805 [[File:Foobar.jpg|right|Caption text]]
10806 !! html/php
10807 <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>
10808
10809 !! html/parsoid
10810 <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>
10811 !! end
10812
10813 !! test
10814 Image with caption, bug 53312 #1
10815 !! wikitext
10816 [[File:Foobar.jpg|right|Caption page stuff]]
10817 !! html/php
10818 <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>
10819
10820 !! html/parsoid
10821 <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>
10822 !! end
10823
10824 !! test
10825 Image with caption, bug 53312 #2
10826 !! wikitext
10827 [[File:Foobar.jpg|right|Caption page=]]
10828 !! html/php
10829 <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>
10830
10831 !! html/parsoid
10832 <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>
10833 !! end
10834
10835 !! test
10836 Image with caption, bug 53312 #3
10837 !! wikitext
10838 [[File:Foobar.jpg|right|Caption page=stuff]]
10839 !! html/php
10840 <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>
10841
10842 !! html/parsoid
10843 <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>
10844 !! end
10845
10846 !! test
10847 Allow empty links in image captions (Bug 60753)
10848 !! options
10849 thumbsize=220
10850 !! wikitext
10851 [[File:Foobar.jpg|thumb|Caption [[Link1]]
10852 [[]]
10853 [[Link2]]
10854 ]]
10855 !! html/php
10856 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Caption <a href="/index.php?title=Link1&amp;action=edit&amp;redlink=1" class="new" title="Link1 (page does not exist)">Link1</a> [[]] <a href="/index.php?title=Link2&amp;action=edit&amp;redlink=1" class="new" title="Link2 (page does not exist)">Link2</a></div></div></div>
10857
10858 !! html/parsoid
10859 <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>
10860 [[]]
10861 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
10862 </figcaption></figure>
10863 !! end
10864
10865 !! test
10866 Link with empty target
10867 !! wikitext
10868 [[]]
10869 !! html
10870 <p>[[]]
10871 </p>
10872 !! end
10873
10874 !! test
10875 Image with empty attribute
10876 !! options
10877 parsoid=wt2html,wt2wt,html2html
10878 !! wikitext
10879 [[File:Foobar.jpg|right||Caption text]]
10880 !! html/php
10881 <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>
10882
10883 !! html/parsoid
10884 <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>
10885 !! end
10886
10887 !! test
10888 1. Block image with individual attributes from templates
10889 !! wikitext
10890 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
10891 !! html/php
10892 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
10893
10894 !! html/parsoid
10895 <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>
10896 !! end
10897
10898 !! test
10899 2. Block Image with individual attributes from templates
10900 !! wikitext
10901 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
10902 !! html/php
10903 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
10904
10905 !! html/parsoid
10906 <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>
10907 !! end
10908
10909 !! test
10910 3. Inline image with individual attributes from templates
10911 !! wikitext
10912 [[File:Foobar.jpg|{{echo|50px}}]]
10913 !! html/php
10914 <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>
10915 </p>
10916 !! html/parsoid
10917 <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>
10918 !! end
10919
10920 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
10921 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
10922 !! test
10923 Image with multiple attributes from the same template
10924 !! wikitext
10925 [[File:Foobar.jpg|{{image_attribs}}]]
10926 !! html/php
10927 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
10928
10929 !! html/parsoid
10930 <figure class="mw-default-size mw-halign-right" typeof="mw:Image 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>
10931 !! end
10932
10933 # Parsoid's output here is broken (incorrect p-wrapping); see bug 64901.
10934 !! test
10935 Image with link tails
10936 !! options
10937 thumbsize=220
10938 !! wikitext
10939 123[[File:Foobar.jpg]]456
10940 123[[File:Foobar.jpg|right]]456
10941 123[[File:Foobar.jpg|thumb]]456
10942 !! html/php
10943 <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
10944 </p>
10945 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
10946 123<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>456
10947
10948 !! html/php+tidy
10949 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456</p>
10950 <p>123</p>
10951 <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>
10952 <p>456 123</p>
10953 <div class="thumb tright">
10954 <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>
10955 <div class="thumbcaption">
10956 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
10957 </div>
10958 </div>
10959 </div>
10960 <p>456</p>
10961 !! html/parsoid
10962 <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>
10963 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
10964 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
10965 !! end
10966
10967 !! test
10968 Image with multiple captions -- only last one is accepted
10969 !! wikitext
10970 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
10971 !! html/php
10972 <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>
10973
10974 !! html/parsoid
10975 <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>
10976 !! end
10977
10978 !! test
10979 Image with multiple widths -- use last
10980 !! wikitext
10981 [[File:Foobar.jpg|200px|300px|caption]]
10982 !! html/php
10983 <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>
10984 </p>
10985 !! html/parsoid
10986 <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>
10987 !! end
10988
10989 !! test
10990 Image with multiple alignments -- use first (bug 48664)
10991 !! options
10992 thumbsize=220
10993 !! wikitext
10994 [[File:Foobar.jpg|thumb|left|right|center|caption]]
10995
10996 [[File:Foobar.jpg|middle|text-top|caption]]
10997 !! html/php
10998 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
10999 <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>
11000 </p>
11001 !! html/parsoid
11002 <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>
11003 <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>
11004 !! end
11005
11006 !! test
11007 Image with width attribute at different positions
11008 !! wikitext
11009 [[File:Foobar.jpg|200px|right|Caption]]
11010 [[File:Foobar.jpg|right|200px|Caption]]
11011 [[File:Foobar.jpg|right|Caption|200px]]
11012 !! html/php
11013 <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>
11014 <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>
11015 <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>
11016
11017 !! html/parsoid
11018 <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>
11019 <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>
11020 <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>
11021 !! end
11022
11023 # a sad bit of backward-compatibility
11024 !! test
11025 Image with size specified with pxpx (bug 13500, 51628)
11026 !! options
11027 parsoid=wt2html,wt2wt,html2html
11028 !! wikitext
11029 [[File:Foobar.jpg|20pxpx]]
11030 [[File:Foobar.jpg|200x20pxpx]]
11031 !! html/php
11032 <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>
11033 <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>
11034 </p>
11035 !! html/parsoid
11036 <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>
11037 !! end
11038
11039 !! test
11040 Image with link parameter, wiki target
11041 !! wikitext
11042 [[File:Foobar.jpg|link=Main Page]]
11043 !! html/php
11044 <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>
11045 </p>
11046 !! html/parsoid
11047 <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>
11048 !! end
11049
11050 # parsoid bug 49293 (part 1)
11051 !! test
11052 Image with link parameter, URL target
11053 !! wikitext
11054 [[File:Foobar.jpg|link=http://example.com/]]
11055 !! html/php
11056 <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>
11057 </p>
11058 !! html/parsoid
11059 <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>
11060 !! end
11061
11062 # parsoid bug 49293 (part 2)
11063 !! test
11064 Image with link parameter, protocol-less URL target
11065 !! wikitext
11066 [[File:Foobar.jpg|link=//example.com/]]
11067 !! html/php
11068 <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>
11069 </p>
11070 !! html/parsoid
11071 <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>
11072 !! end
11073
11074 !! test
11075 Image with link parameter, wgExternalLinkTarget
11076 !! wikitext
11077 [[Image:foobar.jpg|link=http://example.com/]]
11078 !! config
11079 wgExternalLinkTarget='foobar'
11080 !! html
11081 <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>
11082 </p>
11083 !! end
11084
11085 !! test
11086 Image with link parameter, wgNoFollowLinks set to false
11087 !! wikitext
11088 [[Image:foobar.jpg|link=http://example.com/]]
11089 !! config
11090 wgNoFollowLinks=false
11091 !! html
11092 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11093 </p>
11094 !! end
11095
11096 !! test
11097 Image with link parameter, wgNoFollowDomainExceptions
11098 !! wikitext
11099 [[Image:foobar.jpg|link=http://example.com/]]
11100 !! config
11101 wgNoFollowDomainExceptions='example.com'
11102 !! html
11103 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11104 </p>
11105 !! end
11106
11107 !! test
11108 Image with link parameter, wgExternalLinkTarget, unnamed parameter
11109 !! wikitext
11110 [[Image:foobar.jpg|link=http://example.com/|Title]]
11111 !! config
11112 wgExternalLinkTarget='foobar'
11113 !! html
11114 <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>
11115 </p>
11116 !! end
11117
11118 !! test
11119 Image with empty link parameter
11120 !! wikitext
11121 [[File:Foobar.jpg|link=]]
11122 !! html/php
11123 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
11124 </p>
11125 !! html/parsoid
11126 <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>
11127 !! end
11128
11129 !! test
11130 Image with link parameter (wiki target) and unnamed parameter
11131 !! wikitext
11132 [[File:Foobar.jpg|link=Main_Page|Title]]
11133 !! html/php
11134 <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>
11135 </p>
11136 !! html/parsoid
11137 <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>
11138 !! end
11139
11140 !! test
11141 Image with link parameter (URL target) and unnamed parameter
11142 !! wikitext
11143 [[File:Foobar.jpg|link=http://example.com/|Title]]
11144 !! html/php
11145 <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>
11146 </p>
11147 !! html/parsoid
11148 <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>
11149 !! end
11150
11151 !! test
11152 Thumbnail image with link parameter
11153 !! options
11154 thumbsize=220
11155 parsoid=wt2html,wt2wt,html2html
11156 !! wikitext
11157 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
11158 !! html/php
11159 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
11160
11161 !! html/parsoid
11162 <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>
11163 !! end
11164
11165 !! test
11166 Manually-specified thumbnail image
11167 !! options
11168 thumbsize=220
11169 !! wikitext
11170 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
11171 !! html/php
11172 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
11173
11174 !! html/parsoid
11175 <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>
11176 !! end
11177
11178 !! test
11179 Manually-specified thumbnail image with explicit link to wiki page
11180 !! options
11181 thumbsize=220
11182 parsoid=wt2html,wt2wt,html2html
11183 !! wikitext
11184 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
11185 !! html/php
11186 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
11187
11188 !! html/parsoid
11189 <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>
11190 !! end
11191
11192 !! test
11193 Manually-specified thumbnail image with explicit link to url
11194 !! options
11195 thumbsize=220
11196 parsoid=wt2html,wt2wt,html2html
11197 !! wikitext
11198 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
11199 !! html/php
11200 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
11201
11202 !! html/parsoid
11203 <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>
11204 !! end
11205
11206 !! test
11207 Manually-specified thumbnail image with explicit no link
11208 !! options
11209 thumbsize=220
11210 parsoid=wt2html,wt2wt,html2html
11211 !! wikitext
11212 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
11213 !! html/php
11214 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
11215
11216 !! html/parsoid
11217 <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>
11218 !! end
11219
11220 !! test
11221 Manually-specified thumbnail image with explicit link and alt text
11222 !! options
11223 thumbsize=220
11224 parsoid=wt2html,wt2wt,html2html
11225 !! wikitext
11226 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
11227 !! html/php
11228 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
11229
11230 !! html/parsoid
11231 <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>
11232 !! end
11233
11234 !! test
11235 Image with frame and link
11236 !! options
11237 parsoid=wt2html,wt2wt,html2html
11238 !! wikitext
11239 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
11240 !! html/php
11241 <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>
11242
11243 !! html/parsoid
11244 <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>
11245 !! end
11246
11247 !! test
11248 Image with frame and link and explicit alt
11249 !! options
11250 parsoid=wt2html,wt2wt,html2html
11251 !! wikitext
11252 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
11253 !! html/php
11254 <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>
11255
11256 !! html/parsoid
11257 <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>
11258 !! end
11259
11260 !! test
11261 Image with wiki markup in implicit alt
11262 !! options
11263 parsoid=wt2html,wt2wt,html2html
11264 !! wikitext
11265 [[Image:Foobar.jpg|testing '''bold''' in alt]]
11266
11267 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
11268 !! html/php
11269 <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>
11270 </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>
11271 </p>
11272 !! html/parsoid
11273 <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>
11274 <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>
11275 !! end
11276
11277 ###################
11278 # Conflicting image format options.
11279 # First option specified should 'win'.
11280 # All three cases in each test should be identical.
11281
11282 !! test
11283 Image with 'frameless' first.
11284 !! options
11285 parsoid=wt2html,wt2wt,html2html
11286 !! wikitext
11287 [[File:Foobar.jpg|frameless|caption]]
11288
11289 [[File:Foobar.jpg|frameless|frame|caption]]
11290
11291 [[File:Foobar.jpg|frameless|thumb|caption]]
11292 !! html/php
11293 <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>
11294 </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>
11295 </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>
11296 </p>
11297 !! html/parsoid
11298 <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>
11299 <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>
11300 <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>
11301 !! end
11302
11303 !! test
11304 Image with 'frame' first.
11305 !! options
11306 parsoid=wt2html,wt2wt,html2html
11307 !! wikitext
11308 [[File:Foobar.jpg|frame|caption]]
11309 [[File:Foobar.jpg|frame|frameless|caption]]
11310 [[File:Foobar.jpg|frame|thumb|caption]]
11311 !! html/php
11312 <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>
11313 <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>
11314 <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>
11315
11316 !! html/parsoid
11317 <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>
11318 !! end
11319
11320 !! test
11321 Image with 'thumb' first.
11322 !! options
11323 parsoid=wt2html,wt2wt,html2html
11324 !! wikitext
11325 [[File:Foobar.jpg|thumb|caption]]
11326 [[File:Foobar.jpg|thumb|frameless|caption]]
11327 [[File:Foobar.jpg|thumb|frame|caption]]
11328 !! html/php
11329 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
11330 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
11331 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
11332
11333 !! html/parsoid
11334 <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>
11335 !! end
11336
11337 ###################
11338 # Image sizing.
11339 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
11340 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
11341 # Foobar has actual size of 1941x220
11342 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
11343 # a scalable format.
11344 # 2. Framed images always ignore size options; always render at default size.
11345 # 3. "Unspecified format" and border are the only types which can be
11346 # enlarged.
11347
11348 !! test
11349 Image: "unspecified format" and border enlarge
11350 !! options
11351 parsoid=wt2html,wt2wt,html2html
11352 !! wikitext
11353 [[File:Foobar.jpg|2000px]]
11354
11355 [[File:Foobar.jpg|border|2000px]]
11356 !! html/php
11357 <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>
11358 </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>
11359 </p>
11360 !! html/parsoid
11361 <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>
11362 <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>
11363 !! end
11364
11365 !! test
11366 Image: "unspecified format" and border reduce
11367 !! options
11368 parsoid=wt2html,wt2wt,html2html
11369 !! wikitext
11370 [[File:Foobar.jpg|1000px]]
11371
11372 [[File:Foobar.jpg|border|1000px]]
11373 !! html/php
11374 <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>
11375 </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>
11376 </p>
11377 !! html/parsoid
11378 <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>
11379 <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>
11380 !! end
11381
11382 !! test
11383 Image: thumbs reduce
11384 !! options
11385 parsoid=wt2html,wt2wt,html2html
11386 !! wikitext
11387 [[File:Foobar.jpg|thumb|50px]]
11388 !! html/php
11389 <div class="thumb tright"><div class="thumbinner" style="width:52px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
11390
11391 !! html/parsoid
11392 <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>
11393 !! end
11394
11395 !! test
11396 Image: bitmap thumbs can't be enlarged past original size, but vector can.
11397 !! options
11398 parsoid=wt2html,wt2wt,html2html
11399 !! wikitext
11400 [[File:Foobar.jpg|thumb|2000px]]
11401
11402 [[File:Foobar.svg|thumb|2000px]]
11403 !! html/php
11404 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
11405 <div class="thumb tright"><div class="thumbinner" style="width:2002px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div></div></div></div>
11406
11407 !! html/parsoid
11408 <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>
11409 <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>
11410 !! end
11411
11412 !! test
11413 Image: frameless can reduce in size
11414 !! options
11415 parsoid=wt2html,wt2wt,html2html
11416 !! wikitext
11417 [[File:Foobar.jpg|frameless|50px]]
11418 !! html/php
11419 <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>
11420 </p>
11421 !! html/parsoid
11422 <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>
11423 !! end
11424
11425 !! test
11426 Image: bitmap frameless can't be enlarged past original size, but vector can
11427 !! options
11428 parsoid=wt2html,wt2wt,html2html
11429 !! wikitext
11430 [[File:Foobar.jpg|frameless|2000px]]
11431
11432 [[File:Foobar.svg|frameless|2000px]]
11433 !! html/php
11434 <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>
11435 </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>
11436 </p>
11437 !! html/parsoid
11438 <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>
11439 <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>
11440 !! end
11441
11442 !! test
11443 Image: framed images are always unscaled.
11444 !! options
11445 parsoid=wt2html,wt2wt,html2html
11446 !! wikitext
11447 [[File:Foobar.jpg|frame]]
11448
11449 [[File:Foobar.jpg|frame|50px]]
11450
11451 [[File:Foobar.jpg|frame|50x50px]]
11452
11453 [[File:Foobar.jpg|frame|2000px]]
11454 !! html/php
11455 <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>
11456 <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>
11457 <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>
11458 <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>
11459
11460 !! html/parsoid
11461 <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>
11462 !! end
11463
11464 ###################
11465
11466 !! test
11467 Link to image page- image page normally doesn't exists, hence edit link
11468 Add test with existing image page
11469 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
11470 !! wikitext
11471 [[:Image:test]]
11472 !! html
11473 <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>
11474 </p>
11475 !! end
11476
11477 !! test
11478 bug 18784 Link to non-existent image page with caption should use caption as link text
11479 !! wikitext
11480 [[:Image:test|caption]]
11481 !! html
11482 <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>
11483 </p>
11484 !! end
11485
11486 !! test
11487 Frameless image caption with a free URL
11488 !! wikitext
11489 [[File:Foobar.jpg|http://example.com]]
11490 !! html/php
11491 <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>
11492 </p>
11493 !! html/parsoid
11494 <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>
11495 !! end
11496
11497 !! test
11498 Thumbnail image caption with a free URL
11499 !! options
11500 thumbsize=220
11501 !! wikitext
11502 [[File:Foobar.jpg|thumb|http://example.com]]
11503 !! html/php
11504 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
11505
11506 !! html/parsoid
11507 <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>
11508 !! end
11509
11510 !! test
11511 Thumbnail image caption with a free URL and explicit alt
11512 !! options
11513 thumbsize=220
11514 parsoid=wt2html,wt2wt,html2html
11515 !! wikitext
11516 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
11517 !! html/php
11518 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
11519
11520 !! html/parsoid
11521 <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>
11522 !! end
11523
11524 !! test
11525 SVG thumbnails with no language set
11526 !! options
11527 !! wikitext
11528 [[File:Foobar.svg|thumb|caption]]
11529 !! html/php
11530 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
11531
11532 !! html/parsoid
11533 <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>
11534 !! end
11535
11536 !! test
11537 SVG thumbnails with language de
11538 !! options
11539 parsoid=wt2html,wt2wt,html2html
11540 !! wikitext
11541 [[File:Foobar.svg|thumb|caption|lang=de]]
11542 !! html/php
11543 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=File:Foobar.svg&amp;lang=de" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
11544
11545 !! html/parsoid
11546 <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>
11547 !! end
11548
11549 !! test
11550 SVG thumbnails with invalid language code
11551 !! options
11552 parsoid=wt2html,wt2wt,html2html
11553 !! wikitext
11554 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
11555 !! html/php
11556 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>lang=invalid.language.code</div></div></div>
11557
11558 !! html/parsoid
11559 <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>
11560 !! end
11561
11562 !! test
11563 BUG 1887: A ISBN with a thumbnail
11564 !! wikitext
11565 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
11566 !! html/php
11567 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
11568
11569 !! html/parsoid
11570 <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>
11571 !! end
11572
11573 !! test
11574 BUG 1887: A RFC with a thumbnail
11575 !! wikitext
11576 [[File:Foobar.jpg|thumb|This is RFC 12354]]
11577 !! html/php
11578 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
11579
11580 !! html/parsoid
11581 <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>
11582 !! end
11583
11584 !! test
11585 BUG 1887: A mailto link with a thumbnail
11586 !! wikitext
11587 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
11588 !! html/php
11589 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
11590
11591 !! html/parsoid
11592 <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>
11593 !! end
11594
11595 # Pending resolution to bug 368
11596 !! test
11597 BUG 648: Frameless image caption with a link
11598 !! wikitext
11599 [[File:Foobar.jpg|text with a [[link]] in it]]
11600 !! html/php
11601 <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>
11602 </p>
11603 !! html/parsoid
11604 <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>
11605 !! end
11606
11607 !! test
11608 BUG 648: Frameless image caption with a link (suffix)
11609 !! wikitext
11610 [[File:Foobar.jpg|text with a [[link]]foo in it]]
11611 !! html/php
11612 <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>
11613 </p>
11614 !! html/parsoid
11615 <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>
11616 !! end
11617
11618 !! test
11619 BUG 648: Frameless image caption with an interwiki link
11620 !! wikitext
11621 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
11622 !! html/php
11623 <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>
11624 </p>
11625 !! html/parsoid
11626 <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>
11627 !! end
11628
11629 !! test
11630 BUG 648: Frameless image caption with a piped interwiki link
11631 !! wikitext
11632 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
11633 !! html/php
11634 <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>
11635 </p>
11636 !! html/parsoid
11637 <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>
11638 !! end
11639
11640 !! test
11641 Escape HTML special chars in image alt text
11642 !! wikitext
11643 [[File:Foobar.jpg|& < > "]]
11644 !! html/php
11645 <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>
11646 </p>
11647 !! html/parsoid
11648 <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>
11649 !! end
11650
11651 !! test
11652 BUG 499: Alt text should have &#1234;, not &amp;1234;
11653 !! wikitext
11654 [[File:Foobar.jpg|&#9792;]]
11655 !! html/php
11656 <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>
11657 </p>
11658 !! html/parsoid
11659 <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>
11660 !! end
11661
11662 !! test
11663 Broken image caption with link
11664 !! options
11665 parsoid=wt2html,wt2wt,html2html
11666 !! wikitext
11667 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
11668 !! html/php
11669 <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.
11670 </p>
11671 !! html/parsoid
11672 <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>
11673 !! end
11674
11675 !! test
11676 Image caption containing another image
11677 !! wikitext
11678 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
11679 !! html/php
11680 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption with another <a href="/wiki/File:Thumb.png" class="image" title="image"><img alt="image" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" /></a> inside it!</div></div></div>
11681
11682 !! html/parsoid
11683 <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>
11684 !! end
11685
11686 !! test
11687 Image: caption containing a newline
11688 !! wikitext
11689 [[File:Foobar.jpg|This
11690 *is some text]]
11691 !! html/php
11692 <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>
11693 </p>
11694 !! html/parsoid
11695 <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>
11696 !!end
11697
11698 !!test
11699 Image: caption containing leading space
11700 (The leading space should not trigger nowiki escaping in wt2wt mode)
11701 !! wikitext
11702 [[File:Foobar.jpg|thumb| bar]]
11703 !! html/php
11704 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>bar</div></div></div>
11705
11706 !! html/parsoid
11707 <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>
11708 !!end
11709
11710 !! test
11711 Image: caption containing a table
11712 !! options
11713 parsoid=wt2html,wt2wt,html2html
11714 !! wikitext
11715 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
11716 {|
11717 ! Foo !! Bar
11718 |-
11719 | Foo1 || Bar1
11720 |}
11721 and some more text.]]
11722 !! html/php
11723 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is an example image thumbnail caption with a table <table> <tr> <th> Foo </th> <th> Bar </th></tr> <tr> <td> Foo1 </td> <td> Bar1 </td></tr></table> and some more text.</div></div></div>
11724
11725 !! html/parsoid
11726 <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
11727 <table>
11728 <tbody>
11729 <tr><th>Foo </th><th>Bar</th></tr>
11730 <tr>
11731 <td>Foo1 </td>
11732 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
11733 !! end
11734
11735 !! test
11736 Bug 3090: External links other than http: in image captions
11737 !! wikitext
11738 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
11739 !! html/php
11740 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
11741
11742 !! html/parsoid
11743 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="23" width="200"/></a><figcaption>This caption has <a 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>
11744 !! end
11745
11746 !! test
11747 Custom class
11748 !! options
11749 parsoid=wt2html,wt2wt,html2html
11750 !! wikitext
11751 [[Image:foobar.jpg|a|class=b]]
11752 !! html/php
11753 <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>
11754 </p>
11755 !! html/parsoid
11756 <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>
11757 !! end
11758
11759 !! test
11760 Localized image handling (1).
11761 !! options
11762 parsoid=wt2html,wt2wt,html2html
11763 language=es
11764 !! wikitext
11765 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
11766 !! html/php
11767 <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>
11768
11769 !! html/parsoid
11770 <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>
11771 !! end
11772
11773 !! test
11774 Localized image handling (2).
11775 !! options
11776 thumbsize=220
11777 parsoid=wt2html,wt2wt,html2html
11778 language=es
11779 !! wikitext
11780 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
11781 !! html/php
11782 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"></a></div>caption</div></div></div>
11783
11784 !! html/parsoid
11785 <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>
11786 !! end
11787
11788 !! test
11789 "border", "frameless" and "class" attributes on an image.
11790 !! options
11791 thumbsize=220
11792 parsoid=wt2html,wt2wt,html2html
11793 !! wikitext
11794 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
11795 !! html/php
11796 <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>
11797 </p>
11798 !! html/parsoid
11799 <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>
11800 !! end
11801
11802 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
11803 !! test
11804 Invalid image attributes (bug 62500)
11805 !! options
11806 thumbsize=220
11807 parsoid=wt2html,wt2wt,html2html
11808 !! wikitext
11809 [[File:Foobar.jpg|thumb|float|left|caption]]
11810
11811 [[File:Foobar.jpg|thumb|righ|caption]]
11812
11813 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
11814 !! html/php
11815 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
11816 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
11817 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
11818
11819 !! html/parsoid
11820 <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>
11821 !! end
11822
11823 !! article
11824 File:Barfoo.jpg
11825 !! text
11826 #REDIRECT [[File:Barfoo.jpg]]
11827 !! endarticle
11828
11829 !! test
11830 Redirected image
11831 !! wikitext
11832 [[Image:Barfoo.jpg]]
11833 !! html
11834 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
11835 </p>
11836 !! end
11837
11838 !! test
11839 Missing image with uploads disabled
11840 !! options
11841 wgEnableUploads=0
11842 !! wikitext
11843 [[Image:Foobaz.jpg]]
11844 !! html
11845 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
11846 </p>
11847 !! end
11848
11849 # Parsoid-specific testing for images
11850 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11851 # Currently imperfect due to a flaw in the Parsoid testrunner
11852 # Work in progress
11853 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
11854 # image tests.
11855
11856 !! test
11857 Parsoid-specific image handling - simple image with size and middle alignment
11858 !! wikitext
11859 [[File:Foobar.jpg|middle|50px]]
11860 !! html/parsoid
11861 <p><span class="mw-valign-middle" typeof="mw:Image">
11862 <a href="File:Foobar.jpg">
11863 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11864 </a>
11865 </span>
11866 </p>
11867 !! end
11868
11869 !! test
11870 Parsoid-specific image handling - simple image with size, middle alignment,
11871 non-standard namespace alias
11872 !! options
11873 parsoid=wt2wt,wt2html,html2html
11874 !! wikitext
11875 [[Image:Foobar.jpg|middle|50px]]
11876 !! html/parsoid
11877 <p><span class="mw-valign-middle" typeof="mw:Image">
11878 <a href="File:Foobar.jpg">
11879 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11880 </a>
11881 </span>
11882 </p>
11883 !! end
11884
11885 !! test
11886 Parsoid-specific image handling - simple image with size and middle alignment
11887 (existing content)
11888 !! wikitext
11889 [[File:Foobar.jpg|50px|middle]]
11890 !! html/parsoid
11891 <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>
11892 !! end
11893
11894 !! test
11895 Parsoid-specific image handling - simple image with size and middle alignment
11896 and non-standard namespace name
11897 !! options
11898 parsoid=wt2html,wt2wt,html2html
11899 !! wikitext
11900 [[Image:Foobar.jpg|50px|middle]]
11901 !! html/parsoid
11902 <p><span class="mw-valign-middle" typeof="mw:Image">
11903 <a href="File:Foobar.jpg">
11904 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11905 </a>
11906 </span>
11907 </p>
11908 !! end
11909
11910 !! test
11911 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
11912 !! wikitext
11913 [[File:Foobar.jpg|500x10px|baseline|caption]]
11914 !! html/parsoid
11915 <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>
11916 !! end
11917
11918 !! test
11919 Parsoid-specific image handling - simple image with border and size spec
11920 !! wikitext
11921 [[File:Foobar.jpg|50px|border|caption]]
11922 !! html/parsoid
11923 <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>
11924 !! end
11925
11926 !! test
11927 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11928 !! wikitext
11929 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
11930 !! html/parsoid
11931 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
11932 <a href="File:Foobar.jpg">
11933 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
11934 </a>
11935 <figcaption>caption content</figcaption>
11936 </figure>
11937 !! end
11938
11939 !! test
11940 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11941 (existing content)
11942 !! wikitext
11943 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
11944 !! html/parsoid
11945 <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>
11946 !! end
11947
11948 !! test
11949 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
11950 !! wikitext
11951 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
11952 !! html/parsoid
11953 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
11954 <a href="File:Foobar.jpg">
11955 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
11956 </a>
11957 <figcaption>caption</figcaption>
11958 </figure>
11959 !! end
11960
11961 !! test
11962 Parsoid-specific image handling - thumbnail with specific size, halign,
11963 valign, and caption (existing content)
11964 !! wikitext
11965 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
11966 !! html/parsoid
11967 <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>
11968 !! end
11969
11970 !! test
11971 Parsoid-specific image handling - framed image with specific size and caption
11972 (size is ignored)
11973 !! options
11974 parsoid=wt2html,wt2wt,html2html
11975 !! wikitext
11976 [[File:Foobar.jpg|frame|500x50px|caption]]
11977 !! html/parsoid
11978 <figure typeof="mw:Image/Frame">
11979 <a href="File:Foobar.jpg">
11980 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11981 </a>
11982 <figcaption>caption</figcaption>
11983 </figure>
11984 !! end
11985
11986 !! test
11987 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
11988 (size is ignored)
11989 !! options
11990 parsoid=wt2html,wt2wt,html2html
11991 !! wikitext
11992 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
11993 !! html/parsoid
11994 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
11995 <a href="File:Foobar.jpg">
11996 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11997 </a>
11998 <figcaption>caption</figcaption>
11999 </figure>
12000 !! end
12001
12002 !! test
12003 Parsoid-specific image handling - frameless image with specific size, border, and caption
12004 !! wikitext
12005 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12006 !! html/parsoid
12007 <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>
12008 !! end
12009
12010 !! test
12011 Parsoid-specific image handling - simple image with a formatted caption
12012 !! wikitext
12013 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12014 !! html/parsoid
12015 <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>"}'>
12016 <a href="File:Foobar.jpg">
12017 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
12018 </a></span></p>
12019 !! end
12020
12021 !! test
12022 Parsoid-specific image handling - caption with a template in it
12023 !! wikitext
12024 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12025 !! html/parsoid
12026 <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>
12027 !! end
12028
12029 !! test
12030 Parsoid-specific image handling - caption with unbalanced tags in it
12031 !! options
12032 parsoid=wt2html,wt2wt,html2html
12033 !! wikitext
12034 foo
12035 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12036 bar
12037 !! html/parsoid
12038 <p>foo</p>
12039 <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>
12040 <p>bar</p>
12041 !! end
12042
12043 !! test
12044 Parsoid-specific image handling - empty caption (1)
12045 !! options
12046 parsoid=wt2html,wt2wt
12047 !! wikitext
12048 [[File:Foobar.jpg|thumb|]]
12049 !! html/parsoid
12050 <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>
12051 !! end
12052
12053 # empty captions don't get serialized unless we're in the "round trip" case
12054 !! test
12055 Parsoid-specific image handling - empty caption (2)
12056 !! options
12057 parsoid=html2wt
12058 !! html/parsoid
12059 <figure class="mw-default-size" typeof="mw:Image/Thumb">
12060 <a href="File:Foobar.jpg">
12061 <img resource="./File:Foobar.jpg"
12062 src="//example.com/images/3/3a/Foobar.jpg"
12063 height="25" width="220"/>
12064 </a>
12065 <figcaption></figcaption>
12066 </figure>
12067 !! wikitext
12068 [[File:Foobar.jpg|thumb]]
12069 !! end
12070
12071 !! test
12072 Parsoid-specific image handling - whitespace caption
12073 !! wikitext
12074 [[File:Foobar.jpg|thumb| ]]
12075 !! html/parsoid
12076 <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>
12077 !! end
12078
12079 !! test
12080 Parsoid-specific image handling - lang option
12081 !! wikitext
12082 foo
12083 [[File:Foobar.svg|lang=de|caption]]
12084 bar
12085 !! html/parsoid
12086 <p>foo
12087 <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>
12088 bar</p>
12089 !! end
12090
12091
12092 ###
12093 ### Subpages
12094 ###
12095 !! article
12096 Subpage test/subpage
12097 !! text
12098 foo
12099 !! endarticle
12100
12101 !! test
12102 Subpage link
12103 !! options
12104 subpage title=[[Subpage test]]
12105 !! wikitext
12106 [[/subpage]]
12107 !! html
12108 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
12109 </p>
12110 !! end
12111
12112 !! test
12113 Subpage noslash link
12114 !! options
12115 subpage title=[[Subpage test]]
12116 !! wikitext
12117 [[/subpage/]]
12118 !! html
12119 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
12120 </p>
12121 !! end
12122
12123 # TODO: make this PHP-parser compatible!
12124 !! test
12125 Relative subpage noslash link
12126 !! options
12127 parsoid=wt2wt,wt2html,html2html
12128 subpage title=[[Subpage test/1/2/3/4]]
12129 !! wikitext
12130 [[../../subpage/]]
12131
12132 [[../../subpage]]
12133 !! html
12134 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
12135 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
12136 !! end
12137
12138 !! test
12139 Parsoid: dot-slash prefixed wikilinks
12140 !! wikitext
12141 [[./foo]]
12142
12143 [[././bar]]
12144
12145 [[././baz/]]
12146 !! html/php
12147 <p>[[./foo]]
12148 </p><p>[[././bar]]
12149 </p><p>[[././baz/]]
12150 </p>
12151 !! html/parsoid
12152 <p>[[./foo]]
12153 </p><p>[[././bar]]
12154 </p><p>[[././baz/]]
12155 </p>
12156 !! end
12157
12158 !! test
12159 Render invalid page names as plain text (bug 51090)
12160 !! wikitext
12161 [[./../foo|bar]]
12162 [[foo�|bar]]
12163 [[foo/.|bar]]
12164 [[foo/..|bar]]
12165 [[foo~~~bar]]
12166 [[foo>bar]]
12167 [[foo[bar]]
12168 [[.]]
12169 [[..]]
12170 [[foo././bar]]
12171
12172 [[{{echo|./../foo}}|bar]]
12173 [[{{echo|foo/.}}|bar]]
12174 [[{{echo|foo/..}}|bar]]
12175 [[{{echo|foo~~~~bar}}]]
12176 [[{{echo|foo>bar}}]]
12177 [[{{echo|foo././bar}}]]
12178 [[{{echo|foo{bar}}]]
12179 [[{{echo|foo}bar}}]]
12180 [[{{echo|foo[bar}}]]
12181 [[{{echo|foo]bar}}]]
12182 [[{{echo|foo<bar}}]]
12183 !!html/php
12184 <p>[[./../foo|bar]]
12185 [[foo�|bar]]
12186 [[foo/.|bar]]
12187 [[foo/..|bar]]
12188 [[foo~~~bar]]
12189 [[foo&gt;bar]]
12190 [[foo[bar]]
12191 [[.]]
12192 [[..]]
12193 [[foo././bar]]
12194 </p><p>[[./../foo|bar]]
12195 [[foo/.|bar]]
12196 [[foo/..|bar]]
12197 [[foo~~~~bar]]
12198 [[foo&gt;bar]]
12199 [[foo././bar]]
12200 [[foo{bar]]
12201 [[foo}bar]]
12202 [[foo[bar]]
12203 [[foo]bar]]
12204 [[foo&lt;bar]]
12205 </p>
12206 !!html/parsoid
12207 <p>[[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]</p>
12208 <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>
12209 !!end
12210
12211 !! test
12212 Disabled subpages
12213 !! wikitext
12214 [[/subpage]]
12215 !! html
12216 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
12217 </p>
12218 !! end
12219
12220 !! test
12221 BUG 561: {{/Subpage}}
12222 !! options
12223 subpage title=[[Page]]
12224 !! wikitext
12225 {{/Subpage}}
12226 !! html
12227 <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>
12228 </p>
12229 !! end
12230
12231 ###
12232 ### Categories
12233 ###
12234 !! article
12235 Category:MediaWiki User's Guide
12236 !! text
12237 blah
12238 !! endarticle
12239
12240 !! test
12241 Link to category
12242 !! wikitext
12243 [[:Category:MediaWiki User's Guide]]
12244 !! html
12245 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
12246 </p>
12247 !! end
12248
12249 !! test
12250 Simple category
12251 !! options
12252 cat
12253 !! wikitext
12254 [[Category:MediaWiki User's Guide]]
12255 !! html
12256 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12257 !! end
12258
12259 !! test
12260 PAGESINCATEGORY invalid title fatal (r33546 fix)
12261 !! wikitext
12262 {{PAGESINCATEGORY:<bogus>}}
12263 !! html
12264 <p>0
12265 </p>
12266 !! end
12267
12268 !! test
12269 Category with different sort key
12270 !! options
12271 cat
12272 !! wikitext
12273 [[Category:MediaWiki User's Guide|Foo]]
12274 !! html
12275 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12276 !! end
12277
12278 !! test
12279 Category with identical sort key
12280 !! options
12281 cat
12282 !! wikitext
12283 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12284 !! html
12285 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12286 !! end
12287
12288 !! test
12289 Category with empty sort key
12290 !! options
12291 cat
12292 pst
12293 !! wikitext
12294 [[Category:MediaWiki User's Guide|]]
12295 !! html
12296 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12297 !! end
12298
12299 !! test
12300 Category with empty sort key and parentheses
12301 !! options
12302 cat
12303 pst
12304 !! wikitext
12305 [[Category:Foo (bar)|]]
12306 !! html
12307 [[Category:Foo (bar)|Foo]]
12308 !! end
12309
12310 !! test
12311 Category with link tail
12312 !! options
12313 cat
12314 pst
12315 !! wikitext
12316 123[[Category:Foo]]456
12317 !! html
12318 123[[Category:Foo]]456
12319 !! end
12320
12321 !! test
12322 Category with template
12323 !! options
12324 cat
12325 pst
12326 !! wikitext
12327 [[Category:{{echo|Foo}}]]
12328 !! html
12329 [[Category:{{echo|Foo}}]]
12330 !! end
12331
12332 !! test
12333 Category with template in sort key
12334 !! options
12335 cat
12336 pst
12337 !! wikitext
12338 [[Category:Foo|{{echo|Bar}}]]
12339 !! html
12340 [[Category:Foo|{{echo|Bar}}]]
12341 !! end
12342
12343 !! test
12344 Category with template in sort key and title
12345 !! options
12346 cat
12347 pst
12348 !! wikitext
12349 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12350 !! html
12351 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12352 !! end
12353
12354 !! test
12355 Category / paragraph interactions
12356 !! wikitext
12357 Foo [[Category:Baz]] Bar
12358
12359 Foo [[Category:Baz]]
12360 Bar
12361
12362 Foo
12363 [[Category:Baz]]
12364 Bar
12365
12366 Foo
12367 [[Category:Baz]] Bar
12368
12369 Foo
12370 [[Category:Baz]]
12371 [[Category:Baz]]
12372 [[Category:Baz]]
12373 Bar
12374
12375 [[Category:Baz]]
12376 [[Category:Baz]]
12377 [[Category:Baz]]
12378
12379 [[Category:Baz]]
12380 {{echo|[[Category:Baz]]}}
12381 [[Category:Baz]]
12382 !! html
12383 <p>Foo Bar
12384 </p><p>Foo
12385 Bar
12386 </p><p>Foo
12387 Bar
12388 </p><p>Foo Bar
12389 </p><p>Foo
12390 Bar
12391 </p>
12392 !! end
12393
12394 !! test
12395 Parsoid: Serialize link to category page with colon escape
12396 !! options
12397 parsoid
12398 !! wikitext
12399
12400 [[:Category:Foo]]
12401 [[:Category:Foo|Bar]]
12402 !! html
12403 <p>
12404 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
12405 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
12406 </p>
12407 !! end
12408
12409 !! test
12410 Parsoid: Link prefix/suffixes aren't applied to category links
12411 !! options
12412 parsoid=wt2html,wt2wt,html2html
12413 language=is
12414 !! wikitext
12415 x[[Category:Foo]]y
12416 !! html
12417 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
12418 !! end
12419
12420 !! test
12421 Parsoid: Serialize link to file page with colon escape
12422 !! options
12423 parsoid
12424 !! wikitext
12425
12426 [[:File:Foo.png]]
12427 [[:File:Foo.png|Bar]]
12428 !! html
12429 <p>
12430 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
12431 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
12432 </p>
12433 !! end
12434
12435 !! test
12436 Parsoid: Serialize a genuine category link without colon escape
12437 !! options
12438 parsoid
12439 !! wikitext
12440 [[Category:Foo]]
12441 [[Category:Foo|Bar]]
12442 !! html
12443 <link rel="mw:PageProp/Category" href="Category:Foo">
12444 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
12445 !! end
12446
12447 !! test
12448 Parsoid: Defaultsort
12449 !! options
12450 parsoid
12451 !! wikitext
12452 {{DEFAULTSORT:Foo}}
12453 !! html
12454 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
12455 !! end
12456
12457 ###
12458 ### Inter-language links
12459 ###
12460 !! test
12461 Interlanguage links
12462 !! options
12463 ill
12464 !! wikitext
12465 [[es:Alimento]]
12466 [[fr:Nourriture]]
12467 [[zh:食品]]
12468 !! html/php
12469 es:Alimento fr:Nourriture zh:食品
12470 !! html/parsoid
12471 <p><link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Alimento"/>
12472 <link rel="mw:PageProp/Language" href="//fr.wikipedia.org/wiki/Nourriture"/>
12473 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/食品"/></p>
12474 !! end
12475
12476 !! test
12477 Duplicate interlanguage links (bug 24502)
12478 !! options
12479 ill
12480 !! wikitext
12481 [[es:1]]
12482 [[es:2]]
12483 [[fr:1]]
12484 [[fr:2]]
12485 !! html/php
12486 es:1 fr:1
12487 !! html/parsoid
12488 <p><link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/1"/>
12489 <link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/2"/>
12490 <link rel="mw:PageProp/Language" href="//fr.wikipedia.org/wiki/1"/>
12491 <link rel="mw:PageProp/Language" href="//fr.wikipedia.org/wiki/2"/></p>
12492 !! end
12493
12494 ###
12495 ### Sections
12496 ###
12497 !! test
12498 Basic section headings
12499 !! wikitext
12500 == Headline 1 ==
12501 Some text
12502
12503 ==Headline 2==
12504 More
12505 ===Smaller headline===
12506 Blah blah
12507 !! html
12508 <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>
12509 <p>Some text
12510 </p>
12511 <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>
12512 <p>More
12513 </p>
12514 <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>
12515 <p>Blah blah
12516 </p>
12517 !! end
12518
12519 !! test
12520 Section headings with TOC
12521 !! wikitext
12522 == Headline 1 ==
12523 === Subheadline 1 ===
12524 ===== Skipping a level =====
12525 ====== Skipping a level ======
12526
12527 == Headline 2 ==
12528 Some text
12529 ===Another headline===
12530 !! html
12531 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12532 <ul>
12533 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
12534 <ul>
12535 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
12536 <ul>
12537 <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>
12538 <ul>
12539 <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>
12540 </ul>
12541 </li>
12542 </ul>
12543 </li>
12544 </ul>
12545 </li>
12546 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
12547 <ul>
12548 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
12549 </ul>
12550 </li>
12551 </ul>
12552 </div>
12553
12554 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12555 <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>
12556 <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>
12557 <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>
12558 <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>
12559 <p>Some text
12560 </p>
12561 <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>
12562
12563 !! end
12564
12565 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
12566 !! test
12567 Handling of sections up to level 6 and beyond
12568 !! wikitext
12569 = Level 1 Heading=
12570 == Level 2 Heading==
12571 === Level 3 Heading===
12572 ==== Level 4 Heading====
12573 ===== Level 5 Heading=====
12574 ====== Level 6 Heading======
12575 ======= Level 7 Heading=======
12576 ======== Level 8 Heading========
12577 ========= Level 9 Heading=========
12578 ========== Level 10 Heading==========
12579 !! html
12580 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12581 <ul>
12582 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
12583 <ul>
12584 <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>
12585 <ul>
12586 <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>
12587 <ul>
12588 <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>
12589 <ul>
12590 <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>
12591 <ul>
12592 <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>
12593 <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>
12594 <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>
12595 <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>
12596 <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>
12597 </ul>
12598 </li>
12599 </ul>
12600 </li>
12601 </ul>
12602 </li>
12603 </ul>
12604 </li>
12605 </ul>
12606 </li>
12607 </ul>
12608 </div>
12609
12610 <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>
12611 <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>
12612 <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>
12613 <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>
12614 <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>
12615 <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>
12616 <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>
12617 <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>
12618 <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>
12619 <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>
12620
12621 !! end
12622
12623 !! test
12624 TOC regression (bug 9764)
12625 !! wikitext
12626 == title 1 ==
12627 === title 1.1 ===
12628 ==== title 1.1.1 ====
12629 === title 1.2 ===
12630 == title 2 ==
12631 === title 2.1 ===
12632 !! html
12633 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12634 <ul>
12635 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12636 <ul>
12637 <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>
12638 <ul>
12639 <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>
12640 </ul>
12641 </li>
12642 <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>
12643 </ul>
12644 </li>
12645 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12646 <ul>
12647 <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>
12648 </ul>
12649 </li>
12650 </ul>
12651 </div>
12652
12653 <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>
12654 <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>
12655 <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>
12656 <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>
12657 <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>
12658 <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>
12659
12660 !! end
12661
12662 !! test
12663 TOC with wgMaxTocLevel=3 (bug 6204)
12664 !! options
12665 wgMaxTocLevel=3
12666 !! wikitext
12667 == title 1 ==
12668 === title 1.1 ===
12669 ==== title 1.1.1 ====
12670 === title 1.2 ===
12671 == title 2 ==
12672 === title 2.1 ===
12673 !! html
12674 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12675 <ul>
12676 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12677 <ul>
12678 <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>
12679 <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>
12680 </ul>
12681 </li>
12682 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12683 <ul>
12684 <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>
12685 </ul>
12686 </li>
12687 </ul>
12688 </div>
12689
12690 <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>
12691 <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>
12692 <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>
12693 <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>
12694 <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>
12695 <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>
12696
12697 !! end
12698
12699 !! test
12700 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
12701 !! options
12702 wgMaxTocLevel=3
12703 !! wikitext
12704 ==Section 1==
12705 ===Section 1.1===
12706 ====Section 1.1.1====
12707 ====Section 1.1.1.1====
12708 ==Section 2==
12709 !! html
12710 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12711 <ul>
12712 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
12713 <ul>
12714 <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>
12715 </ul>
12716 </li>
12717 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
12718 </ul>
12719 </div>
12720
12721 <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>
12722 <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>
12723 <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>
12724 <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>
12725 <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>
12726
12727 !! end
12728
12729
12730 !! test
12731 Resolving duplicate section names
12732 !! wikitext
12733 == Foo bar ==
12734 == Foo bar ==
12735 !! html
12736 <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>
12737 <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>
12738
12739 !! end
12740
12741 !! test
12742 Resolving duplicate section names with differing case (bug 10721)
12743 !! wikitext
12744 == Foo bar ==
12745 == Foo Bar ==
12746 !! html
12747 <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>
12748 <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>
12749
12750 !! end
12751
12752 !! article
12753 Template:sections
12754 !! text
12755 ===Section 1===
12756 ==Section 2==
12757 !! endarticle
12758
12759 !! test
12760 Template with sections, __NOTOC__
12761 !! wikitext
12762 __NOTOC__
12763 ==Section 0==
12764 {{sections}}
12765 ==Section 4==
12766 !! html
12767 <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>
12768 <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>
12769 <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>
12770 <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>
12771
12772 !! end
12773
12774 !! test
12775 __NOEDITSECTION__ keyword
12776 !! wikitext
12777 __NOEDITSECTION__
12778 ==Section 1==
12779 ==Section 2==
12780 !! html
12781 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
12782 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
12783
12784 !! end
12785
12786 !! test
12787 Link inside a section heading
12788 !! wikitext
12789 ==Section with a [[Main Page|link]] in it==
12790 !! html
12791 <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>
12792
12793 !! end
12794
12795 !! test
12796 TOC regression (bug 12077)
12797 !! wikitext
12798 __TOC__
12799 == title 1 ==
12800 === title 1.1 ===
12801 == title 2 ==
12802 !! html
12803 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12804 <ul>
12805 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12806 <ul>
12807 <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>
12808 </ul>
12809 </li>
12810 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
12811 </ul>
12812 </div>
12813
12814 <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>
12815 <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>
12816 <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>
12817
12818 !! end
12819
12820 !! test
12821 BUG 1219 URL next to image (good)
12822 !! wikitext
12823 http://example.com [[Image:foobar.jpg]]
12824 !! html
12825 <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>
12826 </p>
12827 !!end
12828
12829 !! test
12830 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
12831 !! wikitext
12832 ===
12833 The line above must have a trailing space!
12834 === <!--
12835 --> <!-- -->
12836 But just in case it doesn't...
12837 !! html
12838 <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>
12839 <p>The line above must have a trailing space!
12840 </p>
12841 <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>
12842 <p>But just in case it doesn't...
12843 </p>
12844 !! end
12845
12846 !! test
12847 Header with special characters (bug 25462)
12848 !! wikitext
12849 The tooltips shall not show entities to the user (ie. be double escaped)
12850
12851 == text > text ==
12852 section 1
12853
12854 == text < text ==
12855 section 2
12856
12857 == text & text ==
12858 section 3
12859
12860 == text ' text ==
12861 section 4
12862
12863 == text " text ==
12864 section 5
12865 !! html
12866 <p>The tooltips shall not show entities to the user (ie. be double escaped)
12867 </p>
12868 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12869 <ul>
12870 <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>
12871 <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>
12872 <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>
12873 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
12874 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
12875 </ul>
12876 </div>
12877
12878 <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>
12879 <p>section 1
12880 </p>
12881 <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>
12882 <p>section 2
12883 </p>
12884 <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>
12885 <p>section 3
12886 </p>
12887 <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>
12888 <p>section 4
12889 </p>
12890 <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>
12891 <p>section 5
12892 </p>
12893 !! end
12894
12895 !! test
12896 Headers with excess '=' characters
12897 (Are similar tests necessary beyond the 1st level?)
12898 !! wikitext
12899 =foo==
12900 ==foo=
12901 =''italic'' heading==
12902 ==''italic'' heading=
12903 !! html
12904 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12905 <ul>
12906 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
12907 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
12908 <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>
12909 <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>
12910 </ul>
12911 </div>
12912
12913 <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>
12914 <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>
12915 <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>
12916 <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>
12917
12918 !! end
12919
12920 !! test
12921 HTML headers vs TOC (bug 23393)
12922 (__NOEDITSECTION__ for clearer output, doesn't matter here)
12923 !! wikitext
12924 <h1>Header 1</h1>
12925 == Header 1.1 ==
12926 == Header 1.2 ==
12927
12928 <h1>Header 2
12929 </h1>
12930 == Header 2.1 ==
12931 == Header 2.2 ==
12932 __NOEDITSECTION__
12933 !! html
12934 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12935 <ul>
12936 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
12937 <ul>
12938 <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>
12939 <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>
12940 </ul>
12941 </li>
12942 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
12943 <ul>
12944 <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>
12945 <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>
12946 </ul>
12947 </li>
12948 </ul>
12949 </div>
12950
12951 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
12952 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
12953 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
12954 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
12955 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
12956 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
12957
12958 !! end
12959
12960 !! test
12961 Single-line or multiline-comments can follow headings
12962 !! options
12963 parsoid=wt2html,wt2wt
12964 !! wikitext
12965 ==foo==<!---->
12966 ==bar==<!--c1-->
12967 ==baz==<!--
12968 c2
12969 c3-->
12970 !! html
12971 <h2><span class="mw-headline" id="foo">foo</span></h2>
12972 <h2><span class="mw-headline" id="bar">bar</span></h2>
12973 <h2><span class="mw-headline" id="baz">baz</span></h2>
12974
12975 !! end
12976
12977 !! test
12978 BUG 1219 URL next to image (broken)
12979 !! wikitext
12980 http://example.com[[Image:foobar.jpg]]
12981 !! html
12982 <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>
12983 </p>
12984 !!end
12985
12986 !! test
12987 Bug 1186 news: in the middle of text
12988 !! wikitext
12989 http://en.wikinews.org/wiki/Wikinews:Workplace
12990 !! html
12991 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
12992 </p>
12993 !!end
12994
12995
12996 !! test
12997 Namespaced link must have a title
12998 !! wikitext
12999 [[Project:]]
13000 !! html
13001 <p>[[Project:]]
13002 </p>
13003 !!end
13004
13005 !! test
13006 Namespaced link must have a title (bad fragment version)
13007 !! wikitext
13008 [[Project:#fragment]]
13009 !! html
13010 <p>[[Project:#fragment]]
13011 </p>
13012 !!end
13013
13014
13015 ###
13016 ### HTML tags and HTML attributes
13017 ###
13018
13019 !! test
13020 div with no attributes
13021 !! wikitext
13022 <div>HTML rocks</div>
13023 !! html
13024 <div>HTML rocks</div>
13025
13026 !! end
13027
13028 !! test
13029 div with double-quoted attribute
13030 !! wikitext
13031 <div id="rock">HTML rocks</div>
13032 !! html
13033 <div id="rock">HTML rocks</div>
13034
13035 !! end
13036
13037 !! test
13038 div with single-quoted attribute
13039 !! wikitext
13040 <div id='rock'>HTML rocks</div>
13041 !! html
13042 <div id="rock">HTML rocks</div>
13043
13044 !! end
13045
13046 !! test
13047 div with unquoted attribute
13048 !! wikitext
13049 <div id=rock>HTML rocks</div>
13050 !! html
13051 <div id="rock">HTML rocks</div>
13052
13053 !! end
13054
13055 !! test
13056 div with illegal double attributes
13057 !! wikitext
13058 <div id="a" id="b">HTML rocks</div>
13059 !! html
13060 <div id="b">HTML rocks</div>
13061
13062 !!end
13063
13064 # FIXME: produce empty string instead of "class" in the PHP parser, following
13065 # the HTML5 spec.
13066 !! test
13067 div with empty attribute value, space before equals
13068 !! options
13069 parsoid
13070 !! wikitext
13071 <div class =>HTML rocks</div>
13072 !! html
13073 <div class="">HTML rocks</div>
13074
13075 !! end
13076
13077 # The PHP parser escapes the opening brace to &#123; for some reason, so
13078 # disabled this test for it.
13079 !! test
13080 div with braces in attribute value
13081 !! options
13082 parsoid
13083 !! wikitext
13084 <div title="{}">Foo</div>
13085 !! html
13086 <div title="{}">Foo</div>
13087 !! end
13088
13089 # This it very inconsistent in the PHP parser: it returns
13090 # class="class" if there is a space between the name and the equal sign (see
13091 # 'div with empty attribute value, space before equals'), but strips the
13092 # attribute completely if the space is missing. We hope that not much content
13093 # depends on this, so are implementing the behavior below in Parsoid for
13094 # consistencies' sake. Disabled for the PHP parser.
13095 # FIXME: fix this behavior in the PHP parser?
13096 !! test
13097 div with empty attribute value, no space before equals
13098 !! options
13099 parsoid
13100 !! wikitext
13101 <div class=>HTML rocks</div>
13102 !! html
13103 <div class="">HTML rocks</div>
13104
13105 !! end
13106
13107 !! test
13108 HTML multiple attributes correction
13109 !! wikitext
13110 <p class="error" class="awesome">Awesome!</p>
13111 !! html
13112 <p class="awesome">Awesome!</p>
13113
13114 !!end
13115
13116 !! test
13117 Table multiple attributes correction
13118 !! wikitext
13119 {|
13120 !+ class="error" class="awesome"| status
13121 |}
13122 !! html
13123 <table>
13124 <tr>
13125 <th class="awesome"> status
13126 </th></tr></table>
13127
13128 !!end
13129
13130 !! test
13131 DIV IN UPPERCASE
13132 !! wikitext
13133 <DIV ID="x">HTML ROCKS</DIV>
13134 !! html
13135 <div id="x">HTML ROCKS</div>
13136
13137 !!end
13138
13139 !! test
13140 Non-ASCII pseudo-tags are rendered as text
13141 !! wikitext
13142 <khyô>
13143 !! html
13144 <p>&lt;khyô&gt;
13145 </p>
13146 !! end
13147
13148 !! test
13149 Pseudo-tag with URL 'name' renders as url link
13150 !! wikitext
13151 <http://example.com/>
13152 !! html
13153 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
13154 </p>
13155 !! end
13156
13157 !! test
13158 text with amp in the middle of nowhere
13159 !! wikitext
13160 Remember AT&T?
13161 !! html
13162 <p>Remember AT&amp;T?
13163 </p>
13164 !! end
13165
13166 !! test
13167 text with character entity: eacute
13168 !! wikitext
13169 I always thought &eacute; was a cute letter.
13170 !! html
13171 <p>I always thought &#233; was a cute letter.
13172 </p>
13173 !! html+tidy
13174 <p>I always thought é was a cute letter.</p>
13175 !! end
13176
13177 !! test
13178 text with entity-escaped character entity-like string: eacute
13179 !! wikitext
13180 I always thought &amp;eacute; was a cute letter.
13181 !! html
13182 <p>I always thought &amp;eacute; was a cute letter.
13183 </p>
13184 !! end
13185
13186 !! test
13187 text with undefined character entity: xacute
13188 !! wikitext
13189 I always thought &xacute; was a cute letter.
13190 !! html
13191 <p>I always thought &amp;xacute; was a cute letter.
13192 </p>
13193 !! end
13194
13195 # TODO: generalize to PHP parser?
13196 !! test
13197 HTML5 tags
13198 !! options
13199 parsoid
13200 !! wikitext
13201 <data value="5">five</data>
13202 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13203 <mark>This highlighted text</mark>
13204 !! html
13205 <p><data value="5">five</data>
13206 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13207 <mark>This highlighted text</mark></p>
13208 !! end
13209
13210 !! test
13211 HTML tag with leading space is parsed as text
13212 !! wikitext
13213 < div>foo< /div>
13214 !! html
13215 <p>&lt; div&gt;foo&lt; /div&gt;
13216 </p>
13217 !! end
13218
13219 ###
13220 ### Nesting tests (see bug 41545, 50604, 51081)
13221 ###
13222
13223 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
13224 # Note that html2wt is considerably more difficult if we use <b> in
13225 # the test case, instead of <big>
13226 !! test
13227 Ensure that HTML adoption agency algorithm is properly implemented.
13228 !! wikitext
13229 <big>X<big>Y</big>Z</big>
13230 !! html
13231 <p><big>X<big>Y</big>Z</big>
13232 </p>
13233 !! end
13234
13235 # This was bug 41545 in the PHP parser.
13236 # Note that tidy doesn't handle this correctly.
13237 !! test
13238 Nesting of <kbd>
13239 !! wikitext
13240 <kbd>X<kbd>Y</kbd>Z</kbd>
13241 !! html
13242 <p><kbd>X<kbd>Y</kbd>Z</kbd>
13243 </p>
13244 !! end
13245
13246 # The following cases were bug 51081 in the PHP parser.
13247 # Note that there are some other nestable tags (b, i, etc) which are
13248 # not covered; see bug 51081 for discussion.
13249
13250 # Note that tidy doesn't handle this correctly.
13251 !! test
13252 Nesting of <em>
13253 !! wikitext
13254 <em>X<em>Y</em>Z</em>
13255 !! html
13256 <p><em>X<em>Y</em>Z</em>
13257 </p>
13258 !! end
13259
13260 # Note that tidy doesn't handle this correctly.
13261 !! test
13262 Nesting of <strong>
13263 !! wikitext
13264 <strong>X<strong>Y</strong>Z</strong>
13265 !! html
13266 <p><strong>X<strong>Y</strong>Z</strong>
13267 </p>
13268 !! end
13269
13270 !! test
13271 Nesting of <q>
13272 !! wikitext
13273 <q>X<q>Y</q>Z</q>
13274 !! html+tidy
13275 <p><q>X<q>Y</q>Z</q></p>
13276 !! end
13277
13278 # Note that tidy doesn't handle this correctly.
13279 !! test
13280 Nesting of <ruby>
13281 !! wikitext
13282 <ruby>X<ruby>Y</ruby>Z</ruby>
13283 !! html
13284 <p><ruby>X<ruby>Y</ruby>Z</ruby>
13285 </p>
13286 !! end
13287
13288 # Note that tidy doesn't handle this correctly.
13289 !! test
13290 Nesting of <bdo>
13291 !! wikitext
13292 <bdo>X<bdo>Y</bdo>Z</bdo>
13293 !! html
13294 <p><bdo>X<bdo>Y</bdo>Z</bdo>
13295 </p>
13296 !! end
13297
13298
13299 ###
13300 ### Media links
13301 ###
13302
13303 !! test
13304 Media link
13305 !! wikitext
13306 [[Media:Foobar.jpg]]
13307 !! html
13308 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
13309 </p>
13310 !! end
13311
13312 !! test
13313 Media link with text
13314 !! wikitext
13315 [[Media:Foobar.jpg|A neat file to look at]]
13316 !! html
13317 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
13318 </p>
13319 !! end
13320
13321 # FIXME: this is still bad HTML tag nesting
13322 !! test
13323 Media link with nasty text
13324 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
13325 !! wikitext
13326 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
13327 !! html
13328 <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>
13329
13330 !! html+tidy
13331 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link&lt;div style="display:none"&gt;" onmouseover="alert(document.cookie)" onfoo="&lt;/div&gt;</a></p>
13332 !! end
13333
13334 !! test
13335 Media link to nonexistent file (bug 1702)
13336 !! wikitext
13337 [[Media:No such.jpg]]
13338 !! html
13339 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
13340 </p>
13341 !! end
13342
13343 !! test
13344 Image link to nonexistent file (bug 1850 - good)
13345 !! wikitext
13346 [[Image:No such.jpg]]
13347 !! html
13348 <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>
13349 </p>
13350 !! end
13351
13352 !! test
13353 :Image link to nonexistent file (bug 1850 - bad)
13354 !! wikitext
13355 [[:Image:No such.jpg]]
13356 !! html
13357 <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>
13358 </p>
13359 !! end
13360
13361
13362
13363 !! test
13364 Character reference normalization in link text (bug 1938)
13365 !! wikitext
13366 [[Main Page|this&that]]
13367 !! html
13368 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
13369 </p>
13370 !!end
13371
13372 !! article
13373 אַ
13374 !! text
13375 Test for unicode normalization
13376
13377 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
13378 !! endarticle
13379
13380 !! test
13381 (bug 19451) Links should refer to the normalized form.
13382 !! wikitext
13383 [[&#xFB2E;]]
13384 [[&#x5d0;&#x5b7;]]
13385 [[&#x5d0;ַ]]
13386 [[א&#x5b7;]]
13387 [[אַ]]
13388 !! html
13389 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
13390 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
13391 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
13392 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
13393 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
13394 </p>
13395 !! end
13396
13397 !! test
13398 Empty attribute crash test (bug 2067)
13399 !! wikitext
13400 <font color="">foo</font>
13401 !! html
13402 <p><font color="">foo</font>
13403 </p>
13404 !! end
13405
13406 !! test
13407 Empty attribute crash test single-quotes (bug 2067)
13408 !! wikitext
13409 <font color=''>foo</font>
13410 !! html
13411 <p><font color="">foo</font>
13412 </p>
13413 !! end
13414
13415 !! test
13416 Attribute test: equals, then nothing
13417 !! wikitext
13418 <font color=>foo</font>
13419 !! html
13420 <p><font>foo</font>
13421 </p>
13422 !! end
13423
13424 !! test
13425 Attribute test: unquoted value
13426 !! wikitext
13427 <font color=x>foo</font>
13428 !! html
13429 <p><font color="x">foo</font>
13430 </p>
13431 !! end
13432
13433 !! test
13434 Attribute test: unquoted but illegal value (hash)
13435 !! wikitext
13436 <font color=#x>foo</font>
13437 !! html
13438 <p><font color="#x">foo</font>
13439 </p>
13440 !! end
13441
13442 !! test
13443 Attribute test: no value
13444 !! wikitext
13445 <font color>foo</font>
13446 !! html
13447 <p><font color="color">foo</font>
13448 </p>
13449 !! end
13450
13451 !! test
13452 Bug 2095: link with three closing brackets
13453 !! wikitext
13454 [[Main Page]]]
13455 !! html/php
13456 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
13457 </p>
13458 !! html/parsoid
13459 <p><a rel="mw:WikiLink" href="./Main_Page">Main Page</a>]</p>
13460 !! end
13461
13462 !! test
13463 Bug 2095: link with pipe and three closing brackets
13464 !! wikitext
13465 [[Main Page|link]]]
13466 !! html/php
13467 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
13468 </p>
13469 !! html/parsoid
13470 <p><a rel="mw:WikiLink" href="./Main_Page">link</a>]</p>
13471 !! end
13472
13473 !! test
13474 Bug 2095: link with pipe and three closing brackets, version 2
13475 !! wikitext
13476 [[Main Page|[http://example.com/]]]
13477 !! html/php
13478 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
13479 </p>
13480 !! html/parsoid
13481 <p><a rel="mw:WikiLink" href="./Main_Page">[http://example.com/]</a></p>
13482 !! end
13483
13484
13485 ###
13486 ### Safety
13487 ###
13488
13489 !! article
13490 Template:Dangerous attribute
13491 !! text
13492 " onmouseover="alert(document.cookie)
13493 !! endarticle
13494
13495 !! article
13496 Template:Dangerous style attribute
13497 !! text
13498 border-size: expression(alert(document.cookie))
13499 !! endarticle
13500
13501 !! article
13502 Template:Div style
13503 !! text
13504 <div style="float: right; {{{1}}}">Magic div</div>
13505 !! endarticle
13506
13507 !! test
13508 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
13509 !! wikitext
13510 <div title="{{test}}"></div>
13511 !! html
13512 <div title="This is a test template"></div>
13513
13514 !! end
13515
13516 !! test
13517 Bug 2304: HTML attribute safety (dangerous template; 2309)
13518 !! wikitext
13519 <div title="{{dangerous attribute}}"></div>
13520 !! html
13521 <div title=""></div>
13522
13523 !! end
13524
13525 !! test
13526 Bug 2304: HTML attribute safety (dangerous style template; 2309)
13527 !! wikitext
13528 <div style="{{dangerous style attribute}}"></div>
13529 !! html
13530 <div style="/* insecure input */"></div>
13531
13532 !! end
13533
13534 !! test
13535 Bug 2304: HTML attribute safety (safe parameter; 2309)
13536 !! wikitext
13537 {{div style|width: 200px}}
13538 !! html
13539 <div style="float: right; width: 200px">Magic div</div>
13540
13541 !! end
13542
13543 !! test
13544 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
13545 !! wikitext
13546 {{div style|width: expression(alert(document.cookie))}}
13547 !! html
13548 <div style="/* insecure input */">Magic div</div>
13549
13550 !! end
13551
13552 !! test
13553 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
13554 !! wikitext
13555 {{div style|"><script>alert(document.cookie)</script>}}
13556 !! html
13557 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13558
13559 !! end
13560
13561 !! test
13562 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
13563 !! wikitext
13564 {{div style|" ><script>alert(document.cookie)</script>}}
13565 !! html
13566 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13567
13568 !! end
13569
13570 !! test
13571 Bug 2304: HTML attribute safety (link)
13572 !! wikitext
13573 <div title="[[Main Page]]"></div>
13574 !! html
13575 <div title="&#91;&#91;Main Page]]"></div>
13576
13577 !! end
13578
13579 !! test
13580 Bug 2304: HTML attribute safety (italics)
13581 !! wikitext
13582 <div title="''foobar''"></div>
13583 !! html
13584 <div title="&#39;&#39;foobar&#39;&#39;"></div>
13585
13586 !! end
13587
13588 !! test
13589 Bug 2304: HTML attribute safety (bold)
13590 !! wikitext
13591 <div title="'''foobar'''"></div>
13592 !! html
13593 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
13594
13595 !! end
13596
13597
13598 !! test
13599 Bug 2304: HTML attribute safety (ISBN)
13600 !! wikitext
13601 <div title="ISBN 1234567890"></div>
13602 !! html
13603 <div title="&#73;SBN 1234567890"></div>
13604
13605 !! end
13606
13607 !! test
13608 Bug 2304: HTML attribute safety (RFC)
13609 !! wikitext
13610 <div title="RFC 1234"></div>
13611 !! html
13612 <div title="&#82;FC 1234"></div>
13613
13614 !! end
13615
13616 !! test
13617 Bug 2304: HTML attribute safety (PMID)
13618 !! wikitext
13619 <div title="PMID 1234567890"></div>
13620 !! html
13621 <div title="&#80;MID 1234567890"></div>
13622
13623 !! end
13624
13625 !! test
13626 Bug 2304: HTML attribute safety (web link)
13627 !! wikitext
13628 <div title="http://example.com/"></div>
13629 !! html
13630 <div title="http&#58;//example.com/"></div>
13631
13632 !! end
13633
13634 !! test
13635 Bug 2304: HTML attribute safety (named web link)
13636 !! wikitext
13637 <div title="[http://example.com/ link]"></div>
13638 !! html
13639 <div title="&#91;http&#58;//example.com/ link]"></div>
13640
13641 !! end
13642
13643 !! test
13644 Bug 3244: HTML attribute safety (extension; safe)
13645 !! wikitext
13646 <div style="<nowiki>background:blue</nowiki>"></div>
13647 !! html
13648 <div style="background:blue"></div>
13649
13650 !! end
13651
13652 !! test
13653 Bug 3244: HTML attribute safety (extension; unsafe)
13654 !! wikitext
13655 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
13656 !! html
13657 <div style="/* insecure input */"></div>
13658
13659 !! end
13660
13661 # More MSIE fun discovered by Tom Gilder
13662
13663 !! test
13664 MSIE CSS safety test: spurious slash
13665 !! wikitext
13666 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
13667 !! html
13668 <div style="/* insecure input */">evil</div>
13669
13670 !! end
13671
13672 !! test
13673 MSIE CSS safety test: hex code
13674 !! wikitext
13675 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
13676 !! html
13677 <div style="/* insecure input */">evil</div>
13678
13679 !! end
13680
13681 !! test
13682 MSIE CSS safety test: comment in url
13683 !! wikitext
13684 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
13685 !! html
13686 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
13687
13688 !! end
13689
13690 !! test
13691 MSIE CSS safety test: comment in expression
13692 !! wikitext
13693 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
13694 !! html
13695 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
13696
13697 !! end
13698
13699 !! test
13700 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
13701 !! wikitext
13702 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
13703 !! html
13704 <p style="/* invalid control char */">A</p>
13705
13706 !! end
13707
13708 !! test
13709 MSIE 6 CSS safety test: Fullwidth (bug 55332)
13710 !! wikitext
13711 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
13712 <div style="top:EXPRESSION(alert())">B</div>
13713 !! html
13714 <p style="/* insecure input */">A</p>
13715 <div style="/* insecure input */">B</div>
13716
13717 !! end
13718
13719 !! test
13720 MSIE 6 CSS safety test: IPA extensions (bug 55332)
13721 !! wikitext
13722 <div style="background-image:uʀʟ(javascript:alert())">A</div>
13723 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
13724 !! html
13725 <div style="/* insecure input */">A</div>
13726 <p style="/* insecure input */">B</p>
13727
13728 !! end
13729
13730 !! test
13731 MSIE 6 CSS safety test: sup/sub script (bug 55332)
13732 !! wikitext
13733 <div style="background-image:url⁽javascript:alert())">A</div>
13734 <div style="background-image:url₍javascript:alert())">B</div>
13735 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
13736 !! html
13737 <div style="/* insecure input */">A</div>
13738 <div style="/* insecure input */">B</div>
13739 <p style="/* insecure input */">C</p>
13740
13741 !! end
13742
13743 !! test
13744 Opera -o-link CSS
13745 !! wikitext
13746 <div
13747 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;"
13748 style="-o-link:attr(title);-o-link-source:current">X</div>
13749 !! html
13750 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
13751
13752 !! end
13753
13754 !! test
13755 MSIE 6 CSS safety test: Repetition markers (bug 55332)
13756 !! wikitext
13757 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
13758 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
13759 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
13760 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
13761 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
13762 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
13763 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
13764 !! html
13765 <p style="/* insecure input */">A</p>
13766 <p style="/* insecure input */">B</p>
13767 <p style="/* insecure input */">C</p>
13768 <p style="/* insecure input */">D</p>
13769 <p style="/* insecure input */">E</p>
13770 <p style="/* insecure input */">F</p>
13771 <p style="/* insecure input */">G</p>
13772
13773 !! end
13774
13775 !! test
13776 Table attribute legitimate extension
13777 !! wikitext
13778 {|
13779 !+ style="<nowiki>color:blue</nowiki>"| status
13780 |}
13781 !! html
13782 <table>
13783 <tr>
13784 <th style="color:blue"> status
13785 </th></tr></table>
13786
13787 !!end
13788
13789 !! test
13790 Table attribute safety
13791 !! wikitext
13792 {|
13793 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
13794 |}
13795 !! html
13796 <table>
13797 <tr>
13798 <th style="/* insecure input */"> status
13799 </th></tr></table>
13800
13801 !! end
13802
13803 !! test
13804 CSS line continuation 1
13805 !! wikitext
13806 <div style="background-image: u\&#10;rl(test.jpg);"></div>
13807 !! html
13808 <div style="/* insecure input */"></div>
13809
13810 !! end
13811
13812 !! test
13813 CSS line continuation 2
13814 !! wikitext
13815 <div style="background-image: u\&#13;rl(test.jpg); "></div>
13816 !! html
13817 <div style="/* insecure input */"></div>
13818
13819 !! end
13820
13821 !! article
13822 Template:Identity
13823 !! text
13824 {{{1}}}
13825 !! endarticle
13826
13827 !! test
13828 Expansion of multi-line templates in attribute values (bug 6255)
13829 !! wikitext
13830 <div style="background: {{identity|#00FF00}}">-</div>
13831 !! html
13832 <div style="background: #00FF00">-</div>
13833
13834 !! end
13835
13836
13837 !! test
13838 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
13839 !! wikitext
13840 <div style="background:
13841 #00FF00">-</div>
13842 !! html
13843 <div style="background: #00FF00">-</div>
13844
13845 !! end
13846
13847 !! test
13848 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
13849 !! wikitext
13850 <div style="background: &#10;#00FF00">-</div>
13851 !! html
13852 <div style="background: &#10;#00FF00">-</div>
13853
13854 !! end
13855
13856 ###
13857 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
13858 ###
13859 !! test
13860 Parser hook: empty input
13861 !! wikitext
13862 <tag></tag>
13863 !! html
13864 <pre>
13865 ''
13866 array (
13867 )
13868 </pre>
13869
13870 !! end
13871
13872 !! test
13873 Parser hook: empty input using terminated empty elements
13874 !! wikitext
13875 <tag/>
13876 !! html
13877 <pre>
13878 NULL
13879 array (
13880 )
13881 </pre>
13882
13883 !! end
13884
13885 !! test
13886 Parser hook: empty input using terminated empty elements (space before)
13887 !! wikitext
13888 <tag />
13889 !! html
13890 <pre>
13891 NULL
13892 array (
13893 )
13894 </pre>
13895
13896 !! end
13897
13898 !! test
13899 Parser hook: basic input
13900 !! wikitext
13901 <tag>input</tag>
13902 !! html
13903 <pre>
13904 'input'
13905 array (
13906 )
13907 </pre>
13908
13909 !! end
13910
13911
13912 !! test
13913 Parser hook: case insensitive
13914 !! wikitext
13915 <TAG>input</TAG>
13916 !! html
13917 <pre>
13918 'input'
13919 array (
13920 )
13921 </pre>
13922
13923 !! end
13924
13925
13926 !! test
13927 Parser hook: case insensitive, redux
13928 !! wikitext
13929 <TaG>input</TAg>
13930 !! html
13931 <pre>
13932 'input'
13933 array (
13934 )
13935 </pre>
13936
13937 !! end
13938
13939 !! test
13940 Parser hook: nested tags
13941 !! options
13942 noxml
13943 !! wikitext
13944 <tag><tag></tag></tag>
13945 !! html
13946 <pre>
13947 '<tag>'
13948 array (
13949 )
13950 </pre>&lt;/tag&gt;
13951
13952 !! end
13953
13954 !! test
13955 Parser hook: basic arguments
13956 !! wikitext
13957 <tag width=200 height = "100" depth = '50' square></tag>
13958 !! html
13959 <pre>
13960 ''
13961 array (
13962 'width' => '200',
13963 'height' => '100',
13964 'depth' => '50',
13965 'square' => 'square',
13966 )
13967 </pre>
13968
13969 !! end
13970
13971 !! test
13972 Parser hook: argument containing a forward slash (bug 5344)
13973 !! wikitext
13974 <tag filename='/tmp/bla'></tag>
13975 !! html
13976 <pre>
13977 ''
13978 array (
13979 'filename' => '/tmp/bla',
13980 )
13981 </pre>
13982
13983 !! end
13984
13985 !! test
13986 Parser hook: empty input using terminated empty elements (bug 2374)
13987 !! wikitext
13988 <tag foo=bar/>text
13989 !! html
13990 <pre>
13991 NULL
13992 array (
13993 'foo' => 'bar',
13994 )
13995 </pre>text
13996
13997 !! end
13998
13999 # </tag> should be output literally since there is no matching tag that begins it
14000 !! test
14001 Parser hook: basic arguments using terminated empty elements (bug 2374)
14002 !! wikitext
14003 <tag width=200 height = "100" depth = '50' square/>
14004 other stuff
14005 </tag>
14006 !! html
14007 <pre>
14008 NULL
14009 array (
14010 'width' => '200',
14011 'height' => '100',
14012 'depth' => '50',
14013 'square' => 'square',
14014 )
14015 </pre>
14016 <p>other stuff
14017 &lt;/tag&gt;
14018 </p>
14019 !! end
14020
14021 ###
14022 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14023 ###
14024
14025 !! test
14026 Parser hook: static parser hook not inside a comment
14027 !! wikitext
14028 <statictag>hello, world</statictag>
14029 <statictag action=flush/>
14030 !! html
14031 <p>hello, world
14032 </p>
14033 !! end
14034
14035
14036 !! test
14037 Parser hook: static parser hook inside a comment
14038 !! wikitext
14039 <!-- <statictag>hello, world</statictag> -->
14040 <statictag action=flush/>
14041 !! html
14042 <p><br />
14043 </p>
14044 !! end
14045
14046 # Nested template calls; this case was broken by Parser.php rev 1.506,
14047 # since reverted.
14048
14049 !! article
14050 Template:One-parameter
14051 !! text
14052 (My parameter is: {{{1}}})
14053 !! endarticle
14054
14055 !! article
14056 Template:Map-one-parameter
14057 !! text
14058 {{{{{1}}}|{{{2}}}}}
14059 !! endarticle
14060
14061 !! test
14062 Nested template calls
14063 !! wikitext
14064 {{Map-one-parameter|One-parameter|param}}
14065 !! html
14066 <p>(My parameter is: param)
14067 </p>
14068 !! end
14069
14070
14071 ###
14072 ### Sanitizer
14073 ###
14074 !! test
14075 Sanitizer: Closing of open tags
14076 !! wikitext
14077 <s></s><table></table>
14078 !! html
14079 <s></s><table></table>
14080
14081 !! end
14082
14083 !! test
14084 Sanitizer: Closing of open but not closed tags
14085 !! wikitext
14086 <s>foo
14087 !! html
14088 <p><s>foo</s>
14089 </p>
14090 !! end
14091
14092 !! test
14093 Sanitizer: Closing of closed but not open tags
14094 !! wikitext
14095 </s>
14096 !! html
14097 <p>&lt;/s&gt;
14098 </p>
14099 !! end
14100
14101 !! test
14102 Sanitizer: Closing of closed but not open table tags
14103 !! wikitext
14104 Table not started</td></tr></table>
14105 !! html
14106 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
14107 </p>
14108 !! end
14109
14110 !! test
14111 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
14112 !! wikitext
14113 <span id="æ: v">byte</span>[[#æ: v|backlink]]
14114 !! html
14115 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
14116 </p>
14117 !! end
14118
14119 !! test
14120 Sanitizer: Validating the contents of the id attribute (bug 4515)
14121 !! options
14122 disabled
14123 !! wikitext
14124 <br id=9 />
14125 !! html
14126 Something, but definitely not <br id="9" />...
14127 !! end
14128
14129 !! test
14130 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
14131 !! options
14132 disabled
14133 !! wikitext
14134 <br id="foo" /><br id="foo" />
14135 !! html
14136 Something need to be done. foo-2 ?
14137 !! end
14138
14139 !! test
14140 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
14141 !! wikitext
14142 <div itemscope>
14143 <meta itemprop="hello" content="world">
14144 <meta http-equiv="refresh" content="5">
14145 <meta itemprop="hello" http-equiv="refresh" content="5">
14146 <link itemprop="hello" href="{{SERVER}}">
14147 <link rel="stylesheet" href="{{SERVER}}">
14148 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
14149 </div>
14150 !! html
14151 <div itemscope="itemscope">
14152 <p> <meta itemprop="hello" content="world" />
14153 &lt;meta http-equiv="refresh" content="5"&gt;
14154 <meta itemprop="hello" content="5" />
14155 </p>
14156 <link itemprop="hello" href="http&#58;//example.org" />
14157 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
14158 <link itemprop="hello" href="http&#58;//example.org" />
14159 </div>
14160
14161 !! end
14162
14163 !! test
14164 Language converter: output gets cut off unexpectedly (bug 5757)
14165 !! options
14166 language=zh
14167 !! wikitext
14168 this bit is safe: }-
14169
14170 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
14171
14172 then we get cut off here: }-
14173
14174 all additional text is vanished
14175 !! html
14176 <p>this bit is safe: }-
14177 </p><p>but if we add a conversion instance: xxx
14178 </p><p>then we get cut off here: }-
14179 </p><p>all additional text is vanished
14180 </p>
14181 !! end
14182
14183 !! test
14184 Self closed html pairs (bug 5487)
14185 !! options
14186 !! wikitext
14187 <center><font id="bug" />Centered text</center>
14188 <div><font id="bug2" />In div text</div>
14189 !! html
14190 <center>&lt;font id="bug" /&gt;Centered text</center>
14191 <div>&lt;font id="bug2" /&gt;In div text</div>
14192
14193 !! end
14194
14195 #
14196 #
14197 #
14198
14199 !! test
14200 Punctuation: nbsp before exclamation
14201 !! wikitext
14202 C'est grave !
14203 !! html
14204 <p>C'est grave&#160;!
14205 </p>
14206 !! end
14207
14208 !! test
14209 Punctuation: CSS !important (bug 11874)
14210 !! wikitext
14211 <div style="width:50% !important">important</div>
14212 !! html
14213 <div style="width:50% !important">important</div>
14214
14215 !!end
14216
14217 !! test
14218 Punctuation: CSS ! important (bug 11874; with space after)
14219 !! wikitext
14220 <div style="width:50% ! important">important</div>
14221 !! html
14222 <div style="width:50% ! important">important</div>
14223
14224 !!end
14225
14226
14227 !! test
14228 HTML bullet list, closed tags (bug 5497)
14229 !! wikitext
14230 <ul>
14231 <li>One</li>
14232 <li>Two</li>
14233 </ul>
14234 !! html
14235 <ul>
14236 <li>One</li>
14237 <li>Two</li>
14238 </ul>
14239
14240 !! end
14241
14242 !! test
14243 HTML bullet list, unclosed tags (bug 5497)
14244 !! options
14245 disabled
14246 !! wikitext
14247 <ul>
14248 <li>One
14249 <li>Two
14250 </ul>
14251 !! html
14252 <ul>
14253 <li>One
14254 </li>
14255 <li>Two
14256 </li>
14257 </ul>
14258
14259 !! end
14260
14261 !! test
14262 HTML ordered list, closed tags (bug 5497)
14263 !! wikitext
14264 <ol>
14265 <li>One</li>
14266 <li>Two</li>
14267 </ol>
14268 !! html
14269 <ol>
14270 <li>One</li>
14271 <li>Two</li>
14272 </ol>
14273
14274 !! end
14275
14276 !! test
14277 HTML ordered list, unclosed tags (bug 5497)
14278 !! options
14279 disabled
14280 !! wikitext
14281 <ol>
14282 <li>One
14283 <li>Two
14284 </ol>
14285 !! html
14286 <ol>
14287 <li>One
14288 </li>
14289 <li>Two
14290 </li>
14291 </ol>
14292
14293 !! end
14294
14295 !! test
14296 HTML nested bullet list, closed tags (bug 5497)
14297 !! wikitext
14298 <ul>
14299 <li>One</li>
14300 <li>Two:
14301 <ul>
14302 <li>Sub-one</li>
14303 <li>Sub-two</li>
14304 </ul>
14305 </li>
14306 </ul>
14307 !! html
14308 <ul>
14309 <li>One</li>
14310 <li>Two:
14311 <ul>
14312 <li>Sub-one</li>
14313 <li>Sub-two</li>
14314 </ul>
14315 </li>
14316 </ul>
14317
14318 !! end
14319
14320 !! test
14321 HTML nested bullet list, open tags (bug 5497)
14322 !! options
14323 disabled
14324 !! wikitext
14325 <ul>
14326 <li>One
14327 <li>Two:
14328 <ul>
14329 <li>Sub-one
14330 <li>Sub-two
14331 </ul>
14332 </ul>
14333 !! html
14334 <ul>
14335 <li>One
14336 </li>
14337 <li>Two:
14338 <ul>
14339 <li>Sub-one
14340 </li>
14341 <li>Sub-two
14342 </li>
14343 </ul>
14344 </li>
14345 </ul>
14346
14347 !! end
14348
14349 !! test
14350 HTML nested ordered list, closed tags (bug 5497)
14351 !! wikitext
14352 <ol>
14353 <li>One</li>
14354 <li>Two:
14355 <ol>
14356 <li>Sub-one</li>
14357 <li>Sub-two</li>
14358 </ol>
14359 </li>
14360 </ol>
14361 !! html
14362 <ol>
14363 <li>One</li>
14364 <li>Two:
14365 <ol>
14366 <li>Sub-one</li>
14367 <li>Sub-two</li>
14368 </ol>
14369 </li>
14370 </ol>
14371
14372 !! end
14373
14374 !! test
14375 HTML nested ordered list, open tags (bug 5497)
14376 !! options
14377 disabled
14378 !! wikitext
14379 <ol>
14380 <li>One
14381 <li>Two:
14382 <ol>
14383 <li>Sub-one
14384 <li>Sub-two
14385 </ol>
14386 </ol>
14387 !! html
14388 <ol>
14389 <li>One
14390 </li>
14391 <li>Two:
14392 <ol>
14393 <li>Sub-one
14394 </li>
14395 <li>Sub-two
14396 </li>
14397 </ol>
14398 </li>
14399 </ol>
14400
14401 !! end
14402
14403 !! test
14404 HTML ordered list item with parameters oddity
14405 !! wikitext
14406 <ol><li id="fragment">One</li>
14407 </ol>
14408 !! html
14409 <ol><li id="fragment">One</li>
14410 </ol>
14411
14412 !! end
14413
14414 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
14415 !!test
14416 bug 5918: autonumbering
14417 !! wikitext
14418 [http://first/] [http://second] [ftp://ftp]
14419
14420 ftp://inlineftp
14421
14422 [mailto:enclosed@mail.tld With target]
14423
14424 [mailto:enclosed@mail.tld]
14425
14426 mailto:inline@mail.tld
14427 !! html/php
14428 <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>
14429 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
14430 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
14431 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
14432 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
14433 </p>
14434 !! html/parsoid
14435 <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>
14436 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
14437 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
14438 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
14439 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
14440 !! end
14441
14442
14443 #
14444 # Security and HTML correctness
14445 # From Nick Jenkins' fuzz testing
14446 #
14447
14448 !! test
14449 Fuzz testing: Parser13
14450 !! wikitext
14451 {|
14452 | http://a|
14453 !! html
14454 <table>
14455 <tr>
14456 <td>
14457 </td>
14458 </tr>
14459 </table>
14460
14461 !! end
14462
14463 !! test
14464 Fuzz testing: Parser14
14465 !! wikitext
14466 == onmouseover= ==
14467 http://__TOC__
14468 !! html
14469 <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>
14470 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14471 <ul>
14472 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
14473 </ul>
14474 </div>
14475
14476
14477 !! html+tidy
14478 <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>
14479 <p>http://</p>
14480 <div id="toc" class="toc">
14481 <div id="toctitle">
14482 <h2>Contents</h2>
14483 </div>
14484 <ul>
14485 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
14486 </ul>
14487 </div>
14488 !! end
14489
14490 !! test
14491 Fuzz testing: Parser14-table
14492 !! wikitext
14493 ==a==
14494 {| STYLE=__TOC__
14495 !! html
14496 <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>
14497 <table style="&#95;_TOC&#95;_">
14498 <tr><td></td></tr>
14499 </table>
14500
14501 !! html+tidy
14502 <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>
14503 <table style="__TOC__">
14504 <tr>
14505 <td></td>
14506 </tr>
14507 </table>
14508 !! end
14509
14510 # Known to produce bogus xml (extra </td>)
14511 !! test
14512 Fuzz testing: Parser16
14513 !! options
14514 noxml
14515 !! wikitext
14516 {|
14517 !https://||||||
14518 !! html
14519 <table>
14520 <tr>
14521 <th>https://</th>
14522 <th></th>
14523 <th></th>
14524 <th>
14525 </td>
14526 </tr>
14527 </table>
14528
14529 !! html+tidy
14530 <table>
14531 <tr>
14532 <th>https://</th>
14533 <th></th>
14534 <th></th>
14535 <th></th>
14536 </tr>
14537 </table>
14538 !! end
14539
14540 !! test
14541 Fuzz testing: Parser21
14542 !! wikitext
14543 {|
14544 ! irc://{{ftp://a" onmouseover="alert('hello world');"
14545 |
14546 !! html
14547 <table>
14548 <tr>
14549 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
14550 </th>
14551 <td>
14552 </td>
14553 </tr>
14554 </table>
14555
14556 !! end
14557
14558 !! test
14559 Fuzz testing: Parser22
14560 !! wikitext
14561 http://===r:::https://b
14562
14563 {|
14564 !! html
14565 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
14566 </p>
14567 <table>
14568 <tr><td></td></tr>
14569 </table>
14570
14571 !! end
14572
14573 # Known to produce bad XML for now
14574 !! test
14575 Fuzz testing: Parser24
14576 !! options
14577 noxml
14578 !! wikitext
14579 {|
14580 {{{|
14581 <u CLASS=
14582 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
14583 <br style="onmouseover='alert(document.cookie);' " />
14584
14585 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14586 |
14587 !! html
14588 <table>
14589 {{{|
14590 <u class="&#124;">}}}} &gt;
14591 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
14592
14593 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14594 <tr>
14595 <td></u>
14596 </td>
14597 </tr>
14598 </table>
14599
14600 !! end
14601
14602 # Note: the current result listed for this is not what the original one was,
14603 # but the original bug was JavaScript injection, which is fixed in any case.
14604 # It's not clear that the original result listed was any more correct than the
14605 # current one. Original result:
14606 # <p>{{{|
14607 # </p>
14608 # <li class="&#124;&#124;">
14609 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14610 !!test
14611 Fuzz testing: Parser25 (bug 6055)
14612 !! wikitext
14613 {{{
14614 |
14615 <LI CLASS=||
14616 >
14617 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
14618 !! html
14619 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14620 </p>
14621 !! end
14622
14623 !!test
14624 Fuzz testing: URL adjacent extension (with space, clean)
14625 !! wikitext
14626 http://example.com <nowiki>junk</nowiki>
14627 !! html
14628 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
14629 </p>
14630 !!end
14631
14632 !!test
14633 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
14634 !! wikitext
14635 http://example.com<nowiki>junk</nowiki>
14636 !! html
14637 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
14638 </p>
14639 !!end
14640
14641 !!test
14642 Fuzz testing: URL adjacent extension (no space, dirty; pre)
14643 !! wikitext
14644 http://example.com<pre>junk</pre>
14645 !! html
14646 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
14647
14648 !! html+tidy
14649 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
14650 <pre>
14651 junk
14652 </pre>
14653 !!end
14654
14655 !!test
14656 Fuzz testing: image with bogus manual thumbnail
14657 !! wikitext
14658 [[Image:foobar.jpg|thumbnail= ]]
14659 !! html/php
14660 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
14661
14662 !! html/parsoid
14663 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
14664 !!end
14665
14666 !! test
14667 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
14668 !! wikitext
14669 <pre dir="&#10;"></pre>
14670 !! html
14671 <pre dir="&#10;"></pre>
14672
14673 !! end
14674
14675 !! test
14676 Parsing optional HTML elements (Bug 6171)
14677 !! options
14678 !! wikitext
14679 <table>
14680 <tr>
14681 <td> Some tabular data</td>
14682 <td> More tabular data ...
14683 <td> And yet som tabular data</td>
14684 </tr>
14685 </table>
14686 !! html
14687 <table>
14688 <tr>
14689 <td> Some tabular data</td>
14690 <td> More tabular data ...
14691 </td><td> And yet som tabular data</td>
14692 </tr>
14693 </table>
14694
14695 !! end
14696
14697 !! test
14698 Correct handling of <td>, <tr> (Bug 6171)
14699 !! options
14700 !! wikitext
14701 <table>
14702 <tr>
14703 <td> Some tabular data</td>
14704 <td> More tabular data ...</td>
14705 <td> And yet som tabular data</td>
14706 </tr>
14707 </table>
14708 !! html
14709 <table>
14710 <tr>
14711 <td> Some tabular data</td>
14712 <td> More tabular data ...</td>
14713 <td> And yet som tabular data</td>
14714 </tr>
14715 </table>
14716
14717 !! end
14718
14719
14720 !! test
14721 Parsing crashing regression (fr:JavaScript)
14722 !! wikitext
14723 </body></x>
14724 !! html
14725 <p>&lt;/body&gt;&lt;/x&gt;
14726 </p>
14727 !! end
14728
14729 !! test
14730 Inline wiki vs wiki block nesting
14731 !! wikitext
14732 '''Bold paragraph
14733
14734 New wiki paragraph
14735 !! html
14736 <p><b>Bold paragraph</b>
14737 </p><p>New wiki paragraph
14738 </p>
14739 !! end
14740
14741 !! test
14742 Inline HTML vs wiki block nesting
14743 !! options
14744 disabled
14745 !! wikitext
14746 <b>Bold paragraph
14747
14748 New wiki paragraph
14749 !! html
14750 <p><b>Bold paragraph</b>
14751 </p><p>New wiki paragraph
14752 </p>
14753 !! end
14754
14755 # Original result was this:
14756 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
14757 # </p>
14758 # While that might be marginally more intuitive, maybe, the six-apostrophe
14759 # construct is clearly pathological and the result stated here (which is what
14760 # the parser actually does) is about as reasonable as anything.
14761 !!test
14762 Mixing markup for italics and bold
14763 !! options
14764 !! wikitext
14765 '''bold''''''bold''bolditalics'''''
14766 !! html
14767 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
14768 </p>
14769 !! end
14770
14771
14772 !! article
14773 Xyzzyx
14774 !! text
14775 Article for special page transclusion test
14776 !! endarticle
14777
14778 !! test
14779 Special page transclusion
14780 !! options
14781 !! wikitext
14782 {{Special:Prefixindex/Xyzzyx}}
14783 !! html
14784 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14785
14786 !! end
14787
14788 !! test
14789 Special page transclusion twice (bug 5021)
14790 !! options
14791 !! wikitext
14792 {{Special:Prefixindex/Xyzzyx}}
14793 {{Special:Prefixindex/Xyzzyx}}
14794 !! html
14795 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14796 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14797
14798 !! end
14799
14800 !! test
14801 Transclusion of default MediaWiki message
14802 !! wikitext
14803 {{MediaWiki:Mainpage}}
14804 !! html
14805 <p>Main Page
14806 </p>
14807 !! end
14808
14809 !! test
14810 Transclusion of nonexistent MediaWiki message
14811 !! wikitext
14812 {{MediaWiki:Mainpagexxx}}
14813 !! html
14814 <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>
14815 </p>
14816 !! end
14817
14818 !! test
14819 Transclusion of MediaWiki message with underscore
14820 !! wikitext
14821 {{MediaWiki:history_short}}
14822 !! html
14823 <p>History
14824 </p>
14825 !! end
14826
14827 !! test
14828 Transclusion of MediaWiki message with space
14829 !! wikitext
14830 {{MediaWiki:history short}}
14831 !! html
14832 <p>History
14833 </p>
14834 !! end
14835
14836 !! test
14837 Invalid header with following text
14838 !! wikitext
14839 = x = y
14840 !! html
14841 <p>= x = y
14842 </p>
14843 !! end
14844
14845
14846 !! test
14847 Section extraction test (section 0)
14848 !! options
14849 section=0
14850 !! wikitext
14851 start
14852 ==a==
14853 ===aa===
14854 ====aaa====
14855 ==b==
14856 ===ba===
14857 ===bb===
14858 ====bba====
14859 ===bc===
14860 ==c==
14861 ===ca===
14862 !! html
14863 start
14864 !! end
14865
14866 !! test
14867 Section extraction test (section 1)
14868 !! options
14869 section=1
14870 !! wikitext
14871 start
14872 ==a==
14873 ===aa===
14874 ====aaa====
14875 ==b==
14876 ===ba===
14877 ===bb===
14878 ====bba====
14879 ===bc===
14880 ==c==
14881 ===ca===
14882 !! html
14883 ==a==
14884 ===aa===
14885 ====aaa====
14886 !! end
14887
14888 !! test
14889 Section extraction test (section 2)
14890 !! options
14891 section=2
14892 !! wikitext
14893 start
14894 ==a==
14895 ===aa===
14896 ====aaa====
14897 ==b==
14898 ===ba===
14899 ===bb===
14900 ====bba====
14901 ===bc===
14902 ==c==
14903 ===ca===
14904 !! html
14905 ===aa===
14906 ====aaa====
14907 !! end
14908
14909 !! test
14910 Section extraction test (section 3)
14911 !! options
14912 section=3
14913 !! wikitext
14914 start
14915 ==a==
14916 ===aa===
14917 ====aaa====
14918 ==b==
14919 ===ba===
14920 ===bb===
14921 ====bba====
14922 ===bc===
14923 ==c==
14924 ===ca===
14925 !! html
14926 ====aaa====
14927 !! end
14928
14929 !! test
14930 Section extraction test (section 4)
14931 !! options
14932 section=4
14933 !! wikitext
14934 start
14935 ==a==
14936 ===aa===
14937 ====aaa====
14938 ==b==
14939 ===ba===
14940 ===bb===
14941 ====bba====
14942 ===bc===
14943 ==c==
14944 ===ca===
14945 !! html
14946 ==b==
14947 ===ba===
14948 ===bb===
14949 ====bba====
14950 ===bc===
14951 !! end
14952
14953 !! test
14954 Section extraction test (section 5)
14955 !! options
14956 section=5
14957 !! wikitext
14958 start
14959 ==a==
14960 ===aa===
14961 ====aaa====
14962 ==b==
14963 ===ba===
14964 ===bb===
14965 ====bba====
14966 ===bc===
14967 ==c==
14968 ===ca===
14969 !! html
14970 ===ba===
14971 !! end
14972
14973 !! test
14974 Section extraction test (section 6)
14975 !! options
14976 section=6
14977 !! wikitext
14978 start
14979 ==a==
14980 ===aa===
14981 ====aaa====
14982 ==b==
14983 ===ba===
14984 ===bb===
14985 ====bba====
14986 ===bc===
14987 ==c==
14988 ===ca===
14989 !! html
14990 ===bb===
14991 ====bba====
14992 !! end
14993
14994 !! test
14995 Section extraction test (section 7)
14996 !! options
14997 section=7
14998 !! wikitext
14999 start
15000 ==a==
15001 ===aa===
15002 ====aaa====
15003 ==b==
15004 ===ba===
15005 ===bb===
15006 ====bba====
15007 ===bc===
15008 ==c==
15009 ===ca===
15010 !! html
15011 ====bba====
15012 !! end
15013
15014 !! test
15015 Section extraction test (section 8)
15016 !! options
15017 section=8
15018 !! wikitext
15019 start
15020 ==a==
15021 ===aa===
15022 ====aaa====
15023 ==b==
15024 ===ba===
15025 ===bb===
15026 ====bba====
15027 ===bc===
15028 ==c==
15029 ===ca===
15030 !! html
15031 ===bc===
15032 !! end
15033
15034 !! test
15035 Section extraction test (section 9)
15036 !! options
15037 section=9
15038 !! wikitext
15039 start
15040 ==a==
15041 ===aa===
15042 ====aaa====
15043 ==b==
15044 ===ba===
15045 ===bb===
15046 ====bba====
15047 ===bc===
15048 ==c==
15049 ===ca===
15050 !! html
15051 ==c==
15052 ===ca===
15053 !! end
15054
15055 !! test
15056 Section extraction test (section 10)
15057 !! options
15058 section=10
15059 !! wikitext
15060 start
15061 ==a==
15062 ===aa===
15063 ====aaa====
15064 ==b==
15065 ===ba===
15066 ===bb===
15067 ====bba====
15068 ===bc===
15069 ==c==
15070 ===ca===
15071 !! html
15072 ===ca===
15073 !! end
15074
15075 !! test
15076 Section extraction test (nonexistent section 11)
15077 !! options
15078 section=11
15079 !! wikitext
15080 start
15081 ==a==
15082 ===aa===
15083 ====aaa====
15084 ==b==
15085 ===ba===
15086 ===bb===
15087 ====bba====
15088 ===bc===
15089 ==c==
15090 ===ca===
15091 !! html
15092 !! end
15093
15094 !! test
15095 Section extraction test with bogus heading (section 1)
15096 !! options
15097 section=1
15098 !! wikitext
15099 ==a==
15100 ==bogus== not a legal section
15101 ==b==
15102 !! html
15103 ==a==
15104 ==bogus== not a legal section
15105 !! end
15106
15107 !! test
15108 Section extraction test with bogus heading (section 2)
15109 !! options
15110 section=2
15111 !! wikitext
15112 ==a==
15113 ==bogus== not a legal section
15114 ==b==
15115 !! html
15116 ==b==
15117 !! end
15118
15119 !! test
15120 Section extraction test with comment after heading (section 1)
15121 !! options
15122 section=1
15123 !! wikitext
15124 ==a==
15125 ==b== <!-- -->
15126 ==c==
15127 !! html
15128 ==a==
15129 !! end
15130
15131 !! test
15132 Section extraction test with comment after heading (section 2)
15133 !! options
15134 section=2
15135 !! wikitext
15136 ==a==
15137 ==b== <!-- -->
15138 ==c==
15139 !! html
15140 ==b== <!-- -->
15141 !! end
15142
15143 !! test
15144 Section extraction test with bogus <nowiki> heading (section 1)
15145 !! options
15146 section=1
15147 !! wikitext
15148 ==a==
15149 ==bogus== <nowiki>not a legal section</nowiki>
15150 ==b==
15151 !! html
15152 ==a==
15153 ==bogus== <nowiki>not a legal section</nowiki>
15154 !! end
15155
15156 !! test
15157 Section extraction test with bogus <nowiki> heading (section 2)
15158 !! options
15159 section=2
15160 !! wikitext
15161 ==a==
15162 ==bogus== <nowiki>not a legal section</nowiki>
15163 ==b==
15164 !! html
15165 ==b==
15166 !! end
15167
15168
15169 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
15170 # instead of respecting commented sections
15171 !! test
15172 Section extraction prefixed by comment (section 1)
15173 !! options
15174 section=1
15175 !! wikitext
15176 <!-- -->==sec1==
15177 ==sec2==
15178 !! html
15179 ==sec2==
15180 !!end
15181
15182 !! test
15183 Section extraction prefixed by comment (section 2)
15184 !! options
15185 section=2
15186 !! wikitext
15187 <!-- -->==sec1==
15188 ==sec2==
15189 !! html
15190
15191 !!end
15192
15193
15194 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
15195 # instead of respecting HTML-style headings
15196 !! test
15197 Section extraction, mixed wiki and html (section 1)
15198 !! options
15199 section=1
15200 !! wikitext
15201 <h2>unmarked</h2>
15202 unmarked
15203 ==1==
15204 one
15205 ==2==
15206 two
15207 !! html
15208 ==1==
15209 one
15210 !! end
15211
15212 !! test
15213 Section extraction, mixed wiki and html (section 2)
15214 !! options
15215 section=2
15216 !! wikitext
15217 <h2>unmarked</h2>
15218 unmarked
15219 ==1==
15220 one
15221 ==2==
15222 two
15223 !! html
15224 ==2==
15225 two
15226 !! end
15227
15228
15229 # Formerly testing for bug 3342
15230 !! test
15231 Section extraction, heading surrounded by <noinclude>
15232 !! options
15233 section=1
15234 !! wikitext
15235 <noinclude>==unmarked==</noinclude>
15236 ==marked==
15237 !! html
15238 ==marked==
15239 !!end
15240
15241 # Test behavior of bug 19910
15242 !! test
15243 Sectiion with all-equals
15244 !! options
15245 section=2
15246 !! wikitext
15247 ===
15248 The line above must have a trailing space
15249 === <!--
15250 --> <!-- -->
15251 But just in case it doesn't...
15252 !! html
15253 === <!--
15254 --> <!-- -->
15255 But just in case it doesn't...
15256 !! end
15257
15258 !! test
15259 Section replacement test (section 0)
15260 !! options
15261 replace=0,"xxx"
15262 !! wikitext
15263 start
15264 ==a==
15265 ===aa===
15266 ====aaa====
15267 ==b==
15268 ===ba===
15269 ===bb===
15270 ====bba====
15271 ===bc===
15272 ==c==
15273 ===ca===
15274 !! html
15275 xxx
15276
15277 ==a==
15278 ===aa===
15279 ====aaa====
15280 ==b==
15281 ===ba===
15282 ===bb===
15283 ====bba====
15284 ===bc===
15285 ==c==
15286 ===ca===
15287 !! end
15288
15289 !! test
15290 Section replacement test (section 1)
15291 !! options
15292 replace=1,"xxx"
15293 !! wikitext
15294 start
15295 ==a==
15296 ===aa===
15297 ====aaa====
15298 ==b==
15299 ===ba===
15300 ===bb===
15301 ====bba====
15302 ===bc===
15303 ==c==
15304 ===ca===
15305 !! html
15306 start
15307 xxx
15308
15309 ==b==
15310 ===ba===
15311 ===bb===
15312 ====bba====
15313 ===bc===
15314 ==c==
15315 ===ca===
15316 !! end
15317
15318 !! test
15319 Section replacement test (section 2)
15320 !! options
15321 replace=2,"xxx"
15322 !! wikitext
15323 start
15324 ==a==
15325 ===aa===
15326 ====aaa====
15327 ==b==
15328 ===ba===
15329 ===bb===
15330 ====bba====
15331 ===bc===
15332 ==c==
15333 ===ca===
15334 !! html
15335 start
15336 ==a==
15337 xxx
15338
15339 ==b==
15340 ===ba===
15341 ===bb===
15342 ====bba====
15343 ===bc===
15344 ==c==
15345 ===ca===
15346 !! end
15347
15348 !! test
15349 Section replacement test (section 3)
15350 !! options
15351 replace=3,"xxx"
15352 !! wikitext
15353 start
15354 ==a==
15355 ===aa===
15356 ====aaa====
15357 ==b==
15358 ===ba===
15359 ===bb===
15360 ====bba====
15361 ===bc===
15362 ==c==
15363 ===ca===
15364 !! html
15365 start
15366 ==a==
15367 ===aa===
15368 xxx
15369
15370 ==b==
15371 ===ba===
15372 ===bb===
15373 ====bba====
15374 ===bc===
15375 ==c==
15376 ===ca===
15377 !! end
15378
15379 !! test
15380 Section replacement test (section 4)
15381 !! options
15382 replace=4,"xxx"
15383 !! wikitext
15384 start
15385 ==a==
15386 ===aa===
15387 ====aaa====
15388 ==b==
15389 ===ba===
15390 ===bb===
15391 ====bba====
15392 ===bc===
15393 ==c==
15394 ===ca===
15395 !! html
15396 start
15397 ==a==
15398 ===aa===
15399 ====aaa====
15400 xxx
15401
15402 ==c==
15403 ===ca===
15404 !! end
15405
15406 !! test
15407 Section replacement test (section 5)
15408 !! options
15409 replace=5,"xxx"
15410 !! wikitext
15411 start
15412 ==a==
15413 ===aa===
15414 ====aaa====
15415 ==b==
15416 ===ba===
15417 ===bb===
15418 ====bba====
15419 ===bc===
15420 ==c==
15421 ===ca===
15422 !! html
15423 start
15424 ==a==
15425 ===aa===
15426 ====aaa====
15427 ==b==
15428 xxx
15429
15430 ===bb===
15431 ====bba====
15432 ===bc===
15433 ==c==
15434 ===ca===
15435 !! end
15436
15437 !! test
15438 Section replacement test (section 6)
15439 !! options
15440 replace=6,"xxx"
15441 !! wikitext
15442 start
15443 ==a==
15444 ===aa===
15445 ====aaa====
15446 ==b==
15447 ===ba===
15448 ===bb===
15449 ====bba====
15450 ===bc===
15451 ==c==
15452 ===ca===
15453 !! html
15454 start
15455 ==a==
15456 ===aa===
15457 ====aaa====
15458 ==b==
15459 ===ba===
15460 xxx
15461
15462 ===bc===
15463 ==c==
15464 ===ca===
15465 !! end
15466
15467 !! test
15468 Section replacement test (section 7)
15469 !! options
15470 replace=7,"xxx"
15471 !! wikitext
15472 start
15473 ==a==
15474 ===aa===
15475 ====aaa====
15476 ==b==
15477 ===ba===
15478 ===bb===
15479 ====bba====
15480 ===bc===
15481 ==c==
15482 ===ca===
15483 !! html
15484 start
15485 ==a==
15486 ===aa===
15487 ====aaa====
15488 ==b==
15489 ===ba===
15490 ===bb===
15491 xxx
15492
15493 ===bc===
15494 ==c==
15495 ===ca===
15496 !! end
15497
15498 !! test
15499 Section replacement test (section 8)
15500 !! options
15501 replace=8,"xxx"
15502 !! wikitext
15503 start
15504 ==a==
15505 ===aa===
15506 ====aaa====
15507 ==b==
15508 ===ba===
15509 ===bb===
15510 ====bba====
15511 ===bc===
15512 ==c==
15513 ===ca===
15514 !! html
15515 start
15516 ==a==
15517 ===aa===
15518 ====aaa====
15519 ==b==
15520 ===ba===
15521 ===bb===
15522 ====bba====
15523 xxx
15524
15525 ==c==
15526 ===ca===
15527 !!end
15528
15529 !! test
15530 Section replacement test (section 9)
15531 !! options
15532 replace=9,"xxx"
15533 !! wikitext
15534 start
15535 ==a==
15536 ===aa===
15537 ====aaa====
15538 ==b==
15539 ===ba===
15540 ===bb===
15541 ====bba====
15542 ===bc===
15543 ==c==
15544 ===ca===
15545 !! html
15546 start
15547 ==a==
15548 ===aa===
15549 ====aaa====
15550 ==b==
15551 ===ba===
15552 ===bb===
15553 ====bba====
15554 ===bc===
15555 xxx
15556 !! end
15557
15558 !! test
15559 Section replacement test (section 10)
15560 !! options
15561 replace=10,"xxx"
15562 !! wikitext
15563 start
15564 ==a==
15565 ===aa===
15566 ====aaa====
15567 ==b==
15568 ===ba===
15569 ===bb===
15570 ====bba====
15571 ===bc===
15572 ==c==
15573 ===ca===
15574 !! html
15575 start
15576 ==a==
15577 ===aa===
15578 ====aaa====
15579 ==b==
15580 ===ba===
15581 ===bb===
15582 ====bba====
15583 ===bc===
15584 ==c==
15585 xxx
15586 !! end
15587
15588 !! test
15589 Section replacement test with initial whitespace (bug 13728)
15590 !! options
15591 replace=2,"xxx"
15592 !! wikitext
15593 Preformatted initial line
15594 ==a==
15595 ===a===
15596 !! html
15597 Preformatted initial line
15598 ==a==
15599 xxx
15600 !! end
15601
15602
15603 !! test
15604 Section extraction, heading followed by pre with 20 spaces (bug 6398)
15605 !! options
15606 section=1
15607 !! wikitext
15608 ==a==
15609 a
15610 !! html
15611 ==a==
15612 a
15613 !! end
15614
15615 !! test
15616 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
15617 !! options
15618 section=1
15619 !! wikitext
15620 ==a==
15621 a
15622 !! html
15623 ==a==
15624 a
15625 !! end
15626
15627
15628 !! test
15629 Section extraction, <pre> around bogus header (bug 10309)
15630 !! options
15631 noxml section=2
15632 !! wikitext
15633 == Section One ==
15634 <pre>
15635 =======
15636 </pre>
15637
15638 == Section Two ==
15639 stuff
15640 !! html
15641 == Section Two ==
15642 stuff
15643 !! end
15644
15645 !! test
15646 Section replacement, <pre> around bogus header (bug 10309)
15647 !! options
15648 noxml replace=2,"xxx"
15649 !! wikitext
15650 == Section One ==
15651 <pre>
15652 =======
15653 </pre>
15654
15655 == Section Two ==
15656 stuff
15657 !! html
15658 == Section One ==
15659 <pre>
15660 =======
15661 </pre>
15662
15663 xxx
15664 !! end
15665
15666
15667
15668 !! test
15669 Handling of &#x0A; in URLs
15670 !! wikitext
15671 ** irc://&#x0A;a
15672 !! html/php
15673 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15674
15675 !! html/parsoid
15676 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
15677 a">irc://
15678 a</a></li></ul></li></ul>
15679 !! end
15680
15681 !! test
15682 Handling of %0A in URLs
15683 !! wikitext
15684 ** irc://%0Aa
15685 !! html/php
15686 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15687
15688 !! html/parsoid
15689 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15690 !! end
15691
15692
15693 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
15694 !! test
15695 5 quotes, code coverage +1 line
15696 !! options
15697 parsoid=wt2html
15698 !! wikitext
15699 '''''
15700 !! html/php
15701 !! html/parsoid
15702 <p><b><i></i></b></p>
15703 !! end
15704
15705 # same html as previous, but wikitext adjusted to match parsoid html2wt
15706 # note that wt2html and html2html will put the <i> before the <b>
15707 !! test
15708 5 quotes, code coverage +1 line w/ nowiki (1)
15709 !! options
15710 parsoid=wt2wt,html2wt
15711 !! wikitext
15712 '''''<nowiki/>'''''
15713 !! html/php
15714 <p><i></i>
15715 </p>
15716 !! html/parsoid
15717 <p><b><i></i></b></p>
15718 !! end
15719
15720 # same as previous, just swapping the <i> and <b>
15721 !! test
15722 5 quotes, code coverage +1 line w/ nowiki (2)
15723 !! wikitext
15724 '''''<nowiki/>'''''
15725 !! html/php
15726 <p><i></i>
15727 </p>
15728 !! html/parsoid
15729 <p><i><b></b></i></p>
15730 !! end
15731
15732 !! test
15733 Special:Search page linking.
15734 !! wikitext
15735 {{Special:search}}
15736 !! html
15737 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
15738 </p>
15739 !! end
15740
15741 !! test
15742 Say the magic word
15743 !! options
15744 title=[[Parser test]]
15745 !! wikitext
15746 * {{PAGENAME}}
15747 * {{PAGENAMEE}}
15748 * {{FULLPAGENAME}}
15749 * {{FULLPAGENAMEE}}
15750 * {{BASEPAGENAME}}
15751 * {{BASEPAGENAMEE}}
15752 * {{SUBPAGENAME}}
15753 * {{SUBPAGENAMEE}}
15754 * {{ROOTPAGENAME}}
15755 * {{ROOTPAGENAMEE}}
15756 * {{TALKPAGENAME}}
15757 * {{TALKPAGENAMEE}}
15758 * {{SUBJECTPAGENAME}}
15759 * {{SUBJECTPAGENAMEE}}
15760 * {{NAMESPACEE}}
15761 * {{NAMESPACE}}
15762 * {{NAMESPACENUMBER}}
15763 * {{TALKSPACE}}
15764 * {{TALKSPACEE}}
15765 * {{SUBJECTSPACE}}
15766 * {{SUBJECTSPACEE}}
15767 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
15768 !! html
15769 <ul><li> Parser test</li>
15770 <li> Parser_test</li>
15771 <li> Parser test</li>
15772 <li> Parser_test</li>
15773 <li> Parser test</li>
15774 <li> Parser_test</li>
15775 <li> Parser test</li>
15776 <li> Parser_test</li>
15777 <li> Parser test</li>
15778 <li> Parser_test</li>
15779 <li> Talk:Parser test</li>
15780 <li> Talk:Parser_test</li>
15781 <li> Parser test</li>
15782 <li> Parser_test</li>
15783 <li> </li>
15784 <li> </li>
15785 <li> 0</li>
15786 <li> Talk</li>
15787 <li> Talk</li>
15788 <li> </li>
15789 <li> </li>
15790 <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>
15791
15792 !! end
15793 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
15794
15795 !! test
15796 Gallery
15797 !! wikitext
15798 <gallery>
15799 image1.png |
15800 image2.gif|||||
15801
15802 image3|
15803 image4 |300px| centre
15804 image5.svg| http://///////
15805 [[x|xx]]]]
15806 * image6
15807 </gallery>
15808 !! html
15809 <ul class="gallery mw-gallery-traditional">
15810 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15811 <div class="thumb" style="height: 150px;">Image1.png</div>
15812 <div class="gallerytext">
15813 </div>
15814 </div></li>
15815 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15816 <div class="thumb" style="height: 150px;">Image2.gif</div>
15817 <div class="gallerytext">
15818 <p>||||
15819 </p>
15820 </div>
15821 </div></li>
15822 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15823 <div class="thumb" style="height: 150px;">Image3</div>
15824 <div class="gallerytext">
15825 </div>
15826 </div></li>
15827 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15828 <div class="thumb" style="height: 150px;">Image4</div>
15829 <div class="gallerytext">
15830 <p>300px| centre
15831 </p>
15832 </div>
15833 </div></li>
15834 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15835 <div class="thumb" style="height: 150px;">Image5.svg</div>
15836 <div class="gallerytext">
15837 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
15838 </p>
15839 </div>
15840 </div></li>
15841 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15842 <div class="thumb" style="height: 150px;">* image6</div>
15843 <div class="gallerytext">
15844 </div>
15845 </div></li>
15846 </ul>
15847
15848 !! end
15849
15850 !! test
15851 Gallery (with options)
15852 !! wikitext
15853 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
15854 File:Nonexistant.jpg|caption
15855 File:Nonexistant.jpg
15856 image:foobar.jpg|some '''caption''' [[Main Page]]
15857 image:foobar.jpg
15858 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
15859 </gallery>
15860 !! html
15861 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
15862 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
15863 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15864 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15865 <div class="gallerytext">
15866 <p>caption
15867 </p>
15868 </div>
15869 </div></li>
15870 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15871 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15872 <div class="gallerytext">
15873 </div>
15874 </div></li>
15875 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15876 <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>
15877 <div class="gallerytext">
15878 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15879 </p>
15880 </div>
15881 </div></li>
15882 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15883 <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>
15884 <div class="gallerytext">
15885 </div>
15886 </div></li>
15887 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15888 <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>
15889 <div class="gallerytext">
15890 <p>Blabla|blabla.
15891 </p>
15892 </div>
15893 </div></li>
15894 </ul>
15895
15896 !! end
15897
15898 !! test
15899 Gallery with link that has fragment
15900 !! wikitext
15901 <gallery>
15902 image:foobar.jpg|link=Main_Page
15903 image:foobar.jpg|link=Main_Page#section
15904 image:foobar.jpg|link=Main Page#section|caption
15905 </gallery>
15906 !! html
15907 <ul class="gallery mw-gallery-traditional">
15908 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15909 <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>
15910 <div class="gallerytext">
15911 </div>
15912 </div></li>
15913 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15914 <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>
15915 <div class="gallerytext">
15916 </div>
15917 </div></li>
15918 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15919 <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>
15920 <div class="gallerytext">
15921 <p>caption
15922 </p>
15923 </div>
15924 </div></li>
15925 </ul>
15926
15927 !! end
15928
15929 !! test
15930 Gallery with wikitext inside caption
15931 !! wikitext
15932 <gallery>
15933 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
15934 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
15935 </gallery>
15936 !! html
15937 <ul class="gallery mw-gallery-traditional">
15938 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15939 <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>
15940 <div class="gallerytext">
15941 <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>
15942 </p>
15943 </div>
15944 </div></li>
15945 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15946 <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>
15947 <div class="gallerytext">
15948 <p>This is a test template
15949 </p>
15950 </div>
15951 </div></li>
15952 </ul>
15953
15954 !! end
15955
15956 !! test
15957 gallery (with showfilename option)
15958 !! wikitext
15959 <gallery showfilename>
15960 File:Nonexistant.jpg|caption
15961 File:Nonexistant.jpg
15962 image:foobar.jpg|some '''caption''' [[Main Page]]
15963 File:Foobar.jpg
15964 </gallery>
15965 !! html
15966 <ul class="gallery mw-gallery-traditional">
15967 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15968 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15969 <div class="gallerytext">
15970 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15971 caption
15972 </p>
15973 </div>
15974 </div></li>
15975 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15976 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15977 <div class="gallerytext">
15978 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15979 </p>
15980 </div>
15981 </div></li>
15982 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15983 <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>
15984 <div class="gallerytext">
15985 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15986 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15987 </p>
15988 </div>
15989 </div></li>
15990 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15991 <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>
15992 <div class="gallerytext">
15993 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15994 </p>
15995 </div>
15996 </div></li>
15997 </ul>
15998
15999 !! end
16000
16001 !! test
16002 Gallery (with namespace-less filenames)
16003 !! wikitext
16004 <gallery>
16005 File:Nonexistant.jpg
16006 Nonexistant.jpg
16007 image:foobar.jpg
16008 foobar.jpg
16009 </gallery>
16010 !! html
16011 <ul class="gallery mw-gallery-traditional">
16012 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16013 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16014 <div class="gallerytext">
16015 </div>
16016 </div></li>
16017 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16018 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16019 <div class="gallerytext">
16020 </div>
16021 </div></li>
16022 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16023 <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>
16024 <div class="gallerytext">
16025 </div>
16026 </div></li>
16027 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16028 <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>
16029 <div class="gallerytext">
16030 </div>
16031 </div></li>
16032 </ul>
16033
16034 !! end
16035
16036 !! test
16037 HTML Hex character encoding (spells the word "JavaScript")
16038 !! options
16039 parsoid=wt2html,wt2wt,html2html
16040 !! wikitext
16041 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
16042 !! html/php
16043 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
16044 </p>
16045 !! html/php+tidy
16046 <p>JavaScript</p>
16047 !! html/parsoid
16048 <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>
16049 !! end
16050
16051 !! test
16052 HTML Hex character encoding bogus encoding (bug 26437 regression check)
16053 !! wikitext
16054 &#xsee;&#XSEE;
16055 !! html/php
16056 <p>&amp;#xsee;&amp;#XSEE;
16057 </p>
16058 !! html/parsoid
16059 <p>&amp;#xsee;&amp;#XSEE;</p>
16060 !! end
16061
16062 !! test
16063 HTML Hex character encoding mixed case
16064 !! options
16065 parsoid=wt2html,wt2wt,html2html
16066 !! wikitext
16067 &#xEE;&#Xee;
16068 !! html/php
16069 <p>&#xee;&#xee;
16070 </p>
16071 !! html/php+tidy
16072 <p>îî</p>
16073 !! html/parsoid
16074 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
16075 !! end
16076
16077 !! test
16078 __FORCETOC__ override
16079 !! wikitext
16080 __NEWSECTIONLINK__
16081 __FORCETOC__
16082 !! html
16083 <p><br />
16084 </p>
16085 !! end
16086
16087 !! test
16088 ISBN code coverage
16089 !! wikitext
16090 ISBN 978-0-1234-56&#x20;789
16091 !! html
16092 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
16093 </p>
16094 !! html+tidy
16095 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
16096 !! end
16097
16098 !! test
16099 ISBN followed by 5 spaces
16100 !! wikitext
16101 ISBN
16102 !! html
16103 <p>ISBN
16104 </p>
16105 !! end
16106
16107 !! test
16108 Double ISBN
16109 !! wikitext
16110 ISBN ISBN 1234567890
16111 !! html
16112 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16113 </p>
16114 !! end
16115
16116 !! test
16117 ISBN with an X
16118 !! wikitext
16119 ISBN 3-462-04561-X
16120 !! html
16121 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
16122 </p>
16123 !! end
16124
16125 !! test
16126 ISBN with empty prefix (parsoid test)
16127 !! wikitext
16128 ISBN 1234567890
16129 !! html/parsoid
16130 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
16131 !! end
16132
16133 !! test
16134 Bug 22905: <abbr> followed by ISBN followed by </a>
16135 !! wikitext
16136 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
16137 !! html
16138 <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>
16139 </p>
16140 !! end
16141
16142 !! test
16143 Double RFC
16144 !! wikitext
16145 RFC RFC 1234
16146 !! html
16147 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
16148 </p>
16149 !! end
16150
16151 !! test
16152 Double RFC with a wiki link
16153 !! wikitext
16154 RFC [[RFC 1234]]
16155 !! html
16156 <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>
16157 </p>
16158 !! end
16159
16160 !! test
16161 RFC code coverage
16162 !! wikitext
16163 RFC 983&#x20;987
16164 !! html
16165 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
16166 </p>
16167 !! html+tidy
16168 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
16169 !! end
16170
16171 !! test
16172 Centre-aligned image
16173 !! wikitext
16174 [[Image:foobar.jpg|centre]]
16175 !! html
16176 <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>
16177
16178 !!end
16179
16180 !! test
16181 None-aligned image
16182 !! wikitext
16183 [[Image:foobar.jpg|none]]
16184 !! html
16185 <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>
16186
16187 !!end
16188
16189 !! test
16190 Width + Height sized image (using px) (height is ignored)
16191 !! wikitext
16192 [[Image:foobar.jpg|640x480px]]
16193 !! html
16194 <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>
16195 </p>
16196 !!end
16197
16198 !! test
16199 Width-sized image (using px, no following whitespace)
16200 !! wikitext
16201 [[Image:foobar.jpg|640px]]
16202 !! html
16203 <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>
16204 </p>
16205 !!end
16206
16207 !! test
16208 Width-sized image (using px, with following whitespace - test regression from r39467)
16209 !! wikitext
16210 [[Image:foobar.jpg|640px ]]
16211 !! html
16212 <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>
16213 </p>
16214 !!end
16215
16216 !! test
16217 Width-sized image (using px, with preceding whitespace - test regression from r39467)
16218 !! wikitext
16219 [[Image:foobar.jpg| 640px]]
16220 !! html
16221 <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>
16222 </p>
16223 !!end
16224
16225 !! test
16226 Image with page parameter
16227 !! options
16228 djvu
16229 !! wikitext
16230 [[File:LoremIpsum.djvu|page=2]]
16231 !! html
16232 <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>
16233 </p>
16234 !! end
16235
16236 !! test
16237 Another italics / bold test
16238 !! wikitext
16239 ''' ''x'
16240 !! html
16241 <pre>'<i> </i>x'
16242 </pre>
16243 !!end
16244
16245 # Note the results may be incorrect, as parserTest output included this:
16246 # XML error: Mismatched tag at byte 6120:
16247 # ...<dd> </dt></dl> </dd...
16248 !! test
16249 dt/dd/dl test
16250 !! options
16251 disabled
16252 !! wikitext
16253 :;;;::
16254 !! html
16255 <dl>
16256 <dd><dl>
16257 <dt><dl>
16258 <dt><dl>
16259 <dt><dl>
16260 <dd><dl>
16261 <dd>
16262 </dd>
16263 </dl>
16264 </dd>
16265 </dl>
16266 </dt>
16267 </dl>
16268 </dt>
16269 </dl>
16270 </dt>
16271 </dl>
16272 </dd>
16273 </dl>
16274
16275 !!end
16276
16277
16278 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
16279 !! test
16280 Images with the "|" character in the comment
16281 !! wikitext
16282 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
16283 !! html/php
16284 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
16285
16286 !! html/parsoid
16287 <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>
16288 !! end
16289
16290 !! test
16291 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
16292 !! wikitext
16293 <html><script>alert(1);</script></html>
16294 !! html
16295 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
16296 </p>
16297 !! end
16298
16299 !! test
16300 HTML with raw HTML ($wgRawHtml==true)
16301 !! options
16302 wgRawHtml=1
16303 !! wikitext
16304 <html><script>alert(1);</script></html>
16305 !! html
16306 <p><script>alert(1);</script>
16307 </p>
16308 !! end
16309
16310 !! test
16311 Parents of subpages, one level up
16312 !! options
16313 subpage title=[[Subpage test/L1/L2/L3]]
16314 !! wikitext
16315 [[../|L2]]
16316 !! html
16317 <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>
16318 </p>
16319 !! end
16320
16321
16322 !! test
16323 Parents of subpages, one level up, not named
16324 !! options
16325 subpage title=[[Subpage test/L1/L2/L3]]
16326 !! wikitext
16327 [[../]]
16328 !! html
16329 <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>
16330 </p>
16331 !! end
16332
16333
16334
16335 !! test
16336 Parents of subpages, two levels up
16337 !! options
16338 subpage title=[[Subpage test/L1/L2/L3]]
16339 !! wikitext
16340 [[../../|L1]]2
16341
16342 [[../../|L1]]l
16343 !! html
16344 <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
16345 </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>
16346 </p>
16347 !! end
16348
16349 !! test
16350 Parents of subpages, two levels up, without trailing slash or name.
16351 !! options
16352 subpage title=[[Subpage test/L1/L2/L3]]
16353 !! wikitext
16354 [[../..]]
16355 !! html
16356 <p>[[../..]]
16357 </p>
16358 !! end
16359
16360 !! test
16361 Parents of subpages, two levels up, with lots of extra trailing slashes.
16362 !! options
16363 subpage title=[[Subpage test/L1/L2/L3]]
16364 !! wikitext
16365 [[../../////]]
16366 !! html
16367 <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>
16368 </p>
16369 !! end
16370
16371 !! article
16372 Subpage test/L1/L2/L3Sibling
16373 !! text
16374 Sibling article
16375 !! endarticle
16376
16377 !! test
16378 Transclusion of a sibling page (one level up)
16379 !! options
16380 subpage title=[[Subpage test/L1/L2/L3]]
16381 !! wikitext
16382 {{../L3Sibling}}
16383 !! html
16384 <p>Sibling article
16385 </p>
16386 !! end
16387
16388 !! test
16389 Transclusion of a child page
16390 !! options
16391 subpage title=[[Subpage test/L1/L2]]
16392 !! wikitext
16393 {{/L3Sibling}}
16394 !! html
16395 <p>Sibling article
16396 </p>
16397 !! end
16398
16399 !! test
16400 Non-transclusion because of too many up levels
16401 !! options
16402 subpage title=[[Subpage test/L1/L2/L3]]
16403 !! wikitext
16404 {{../../../../More than parent}}
16405 !! html
16406 <p>{{../../../../More than parent}}
16407 </p>
16408 !! end
16409
16410 !! test
16411 Definition list code coverage
16412 !! wikitext
16413 ; title : def
16414 ; title : def
16415 ;title: def
16416 !! html
16417 <dl><dt> title &#160;</dt>
16418 <dd> def</dd>
16419 <dt> title&#160;</dt>
16420 <dd> def</dd>
16421 <dt>title</dt>
16422 <dd> def</dd></dl>
16423
16424 !! end
16425
16426 !! test
16427 Don't fall for the self-closing div
16428 !! wikitext
16429 <div>hello world</div/>
16430 !! html
16431 <div>hello world</div>
16432
16433 !! end
16434
16435 !! test
16436 MSGNW magic word
16437 !! wikitext
16438 {{MSGNW:msg}}
16439 !! html
16440 <p>&#91;&#91;:Template:Msg&#93;&#93;
16441 </p>
16442 !! end
16443
16444 !! test
16445 RAW magic word
16446 !! wikitext
16447 {{RAW:QUERTY}}
16448 !! html
16449 <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>
16450 </p>
16451 !! end
16452
16453 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
16454 !! test
16455 Always escape literal '>' in output, not just after '<'
16456 !! wikitext
16457 ><>
16458 !! html
16459 <p>&gt;&lt;&gt;
16460 </p>
16461 !! end
16462
16463 !! test
16464 Template caching
16465 !! wikitext
16466 {{Test}}
16467 {{Test}}
16468 !! html
16469 <p>This is a test template
16470 This is a test template
16471 </p>
16472 !! end
16473
16474
16475 !! article
16476 MediaWiki:Fake
16477 !! text
16478 ==header==
16479 !! endarticle
16480
16481 !! test
16482 Inclusion of !userCanEdit() content
16483 !! wikitext
16484 {{MediaWiki:Fake}}
16485 !! html
16486 <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>
16487
16488 !! end
16489
16490
16491 !! test
16492 Out-of-order TOC heading levels
16493 !! wikitext
16494 ==2==
16495 ======6======
16496 ===3===
16497 =1=
16498 =====5=====
16499 ==2==
16500 !! html
16501 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16502 <ul>
16503 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
16504 <ul>
16505 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
16506 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
16507 </ul>
16508 </li>
16509 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
16510 <ul>
16511 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
16512 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
16513 </ul>
16514 </li>
16515 </ul>
16516 </div>
16517
16518 <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>
16519 <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>
16520 <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>
16521 <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>
16522 <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>
16523 <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>
16524
16525 !! end
16526
16527
16528 !! test
16529 ISBN with a dummy number
16530 !! wikitext
16531 ISBN ---
16532 !! html
16533 <p>ISBN ---
16534 </p>
16535 !! end
16536
16537
16538 !! test
16539 ISBN with space-delimited number
16540 !! wikitext
16541 ISBN 92 9017 032 8
16542 !! html
16543 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
16544 </p>
16545 !! end
16546
16547
16548 !! test
16549 ISBN with multiple spaces, no number
16550 !! wikitext
16551 ISBN foo
16552 !! html
16553 <p>ISBN foo
16554 </p>
16555 !! end
16556
16557
16558 !! test
16559 ISBN length
16560 !! wikitext
16561 ISBN 123456789
16562
16563 ISBN 1234567890
16564
16565 ISBN 12345678901
16566 !! html
16567 <p>ISBN 123456789
16568 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16569 </p><p>ISBN 12345678901
16570 </p>
16571 !! end
16572
16573
16574 !! test
16575 ISBN with trailing year (bug 8110)
16576 !! wikitext
16577 ISBN 1-234-56789-0 - 2006
16578
16579 ISBN 1 234 56789 0 - 2006
16580 !! html
16581 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
16582 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
16583 </p>
16584 !! end
16585
16586
16587 !! test
16588 anchorencode
16589 !! wikitext
16590 {{anchorencode:foo bar©#%n}}
16591 !! html
16592 <p>foo_bar.C2.A9.23.25n
16593 </p>
16594 !! end
16595
16596 !! test
16597 anchorencode trims spaces
16598 !! wikitext
16599 {{anchorencode: __pretty__please__}}
16600 !! html
16601 <p>pretty_please
16602 </p>
16603 !! end
16604
16605 !! test
16606 anchorencode deals with links
16607 !! wikitext
16608 {{anchorencode: [[hello|world]] [[hi]]}}
16609 !! html
16610 <p>world_hi
16611 </p>
16612 !! end
16613
16614 !! test
16615 anchorencode deals with templates
16616 !! wikitext
16617 {{anchorencode: {{Foo}} }}
16618 !! html
16619 <p>FOO
16620 </p>
16621 !! end
16622
16623 !! test
16624 anchorencode encodes like the TOC generator: (bug 18431)
16625 !! wikitext
16626 === _ +:.3A%3A&&amp;]] ===
16627 {{anchorencode: _ +:.3A%3A&&amp;]] }}
16628 __NOEDITSECTION__
16629 !! html
16630 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
16631 <p>.2B:.3A.253A.26.26.5D.5D
16632 </p>
16633 !! end
16634
16635 !! test
16636 Bug 6200: blockquotes and paragraph formatting
16637 !! wikitext
16638 <blockquote>
16639 foo
16640 </blockquote>
16641
16642 bar
16643
16644 baz
16645 !! html
16646 <blockquote>
16647 <p>foo
16648 </p>
16649 </blockquote>
16650 <p>bar
16651 </p>
16652 <pre>baz
16653 </pre>
16654 !! end
16655
16656 !! test
16657 Bug 8293: Use of center tag ruins paragraph formatting
16658 !! wikitext
16659 <center>
16660 foo
16661 </center>
16662
16663 bar
16664
16665 baz
16666 !! html
16667 <center>
16668 <p>foo
16669 </p>
16670 </center>
16671 <p>bar
16672 </p>
16673 <pre>baz
16674 </pre>
16675 !! end
16676
16677 !!test
16678 Parsing of overlapping (improperly nested) inline html tags
16679 !! wikitext
16680 <span><s>x</span></s>
16681 !! html/php
16682 <p><span><s>x&lt;/span&gt;</s></span>
16683 </p>
16684 !! html/parsoid
16685 <p><span><s>x</s></span>
16686 </p>
16687 !!end
16688
16689 ###
16690 ### Language variants related tests
16691 ###
16692 !! test
16693 Self-link in language variants
16694 !! options
16695 title=[[Dunav]] language=sr
16696 !! wikitext
16697 Both [[Dunav]] and [[Дунав]] are names for this river.
16698 !! html
16699 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
16700 </p>
16701 !!end
16702
16703 !! article
16704 Дуна
16705 !! text
16706 content
16707 !! endarticle
16708
16709 !! test
16710 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
16711 !! options
16712 title=[[Duna]] language=sr
16713 !! wikitext
16714 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
16715 !! html
16716 <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.
16717 </p>
16718 !! end
16719
16720 !! test
16721 Link to a section of a variant of this title shouldn't be parsed as self-link
16722 !! options
16723 title=[[Duna]] language=sr
16724 !! wikitext
16725 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
16726 !! html
16727 <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.
16728 </p>
16729 !! end
16730
16731 !! test
16732 Link to pages in language variants
16733 !! options
16734 language=sr
16735 !! wikitext
16736 Main Page can be written as [[Маин Паге]]
16737 !! html
16738 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
16739 </p>
16740 !!end
16741
16742
16743 !! test
16744 Multiple links to pages in language variants
16745 !! options
16746 language=sr
16747 !! wikitext
16748 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
16749 !! html
16750 <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>.
16751 </p>
16752 !!end
16753
16754
16755 !! test
16756 Simple template in language variants
16757 !! options
16758 language=sr
16759 !! wikitext
16760 {{тест}}
16761 !! html
16762 <p>This is a test template
16763 </p>
16764 !! end
16765
16766
16767 !! test
16768 Template with explicit namespace in language variants
16769 !! options
16770 language=sr
16771 !! wikitext
16772 {{Template:тест}}
16773 !! html
16774 <p>This is a test template
16775 </p>
16776 !! end
16777
16778
16779 !! test
16780 Basic test for template parameter in language variants
16781 !! options
16782 language=sr
16783 !! wikitext
16784 {{парамтест|param=foo}}
16785 !! html
16786 <p>This is a test template with parameter foo
16787 </p>
16788 !! end
16789
16790
16791 !! test
16792 Simple category in language variants
16793 !! options
16794 language=sr cat
16795 !! wikitext
16796 [[Category:МедиаWики Усер'с Гуиде]]
16797 !! html
16798 <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>
16799 !! end
16800
16801
16802 !! article
16803 Category:分类
16804 !! text
16805 blah
16806 !! endarticle
16807
16808 !! article
16809 Category:分類
16810 !! text
16811 blah
16812 !! endarticle
16813
16814 !! test
16815 Don't convert blue categorylinks to another variant (bug 33210)
16816 !! options
16817 language=zh cat
16818 !! wikitext
16819 [[A]][[Category:分类]]
16820 !! html
16821 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
16822 !! end
16823
16824
16825 !! test
16826 Stripping -{}- tags (language variants)
16827 !! options
16828 language=sr
16829 !! wikitext
16830 Latin proverb: -{Ne nuntium necare}-
16831 !! html
16832 <p>Latin proverb: Ne nuntium necare
16833 </p>
16834 !! end
16835
16836
16837 !! test
16838 Prevent conversion with -{}- tags (language variants)
16839 !! options
16840 language=sr variant=sr-ec
16841 !! wikitext
16842 Latinski: -{Ne nuntium necare}-
16843 !! html
16844 <p>Латински: Ne nuntium necare
16845 </p>
16846 !! end
16847
16848
16849 !! test
16850 Prevent conversion of text with -{}- tags (language variants)
16851 !! options
16852 language=sr variant=sr-ec
16853 !! wikitext
16854 Latinski: -{Ne nuntium necare}-
16855 !! html
16856 <p>Латински: Ne nuntium necare
16857 </p>
16858 !! end
16859
16860
16861 !! test
16862 Prevent conversion of links with -{}- tags (language variants)
16863 !! options
16864 language=sr variant=sr-ec
16865 !! wikitext
16866 -{[[Main Page]]}-
16867 !! html
16868 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16869 </p>
16870 !! end
16871
16872
16873 !! test
16874 -{}- tags within headlines (within html for parserConvert())
16875 !! options
16876 language=sr variant=sr-ec
16877 !! wikitext
16878 == -{Naslov}- ==
16879 !! html
16880 <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>
16881
16882 !! end
16883
16884
16885 !! test
16886 Explicit definition of language variant alternatives
16887 !! options
16888 language=zh variant=zh-tw
16889 !! wikitext
16890 -{zh:China;zh-tw:Taiwan}-, not China
16891 !! html
16892 <p>Taiwan, not China
16893 </p>
16894 !! end
16895
16896
16897 !! test
16898 Conversion around HTML tags
16899 !! options
16900 language=sr variant=sr-ec
16901 !! wikitext
16902 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
16903 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
16904 !! html
16905 <p>
16906 <span title="ЛаCтин">ски</span>
16907 </p>
16908 !! end
16909
16910
16911 !! test
16912 Explicit session-wise language variant mapping (A flag and - flag)
16913 !! options
16914 language=zh variant=zh-tw
16915 !! wikitext
16916 Taiwan is not China.
16917 But -{A|zh:China;zh-tw:Taiwan}- is China,
16918 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
16919 and -{China}- is China.
16920 !! html
16921 <p>Taiwan is not China.
16922 But Taiwan is Taiwan,
16923 (This should be stripped!)
16924 and China is China.
16925 </p>
16926 !! end
16927
16928 !! test
16929 Explicit session-wise language variant mapping (H flag for hide)
16930 !! options
16931 language=zh variant=zh-tw
16932 !! wikitext
16933 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
16934 Taiwan is China.
16935 !! html
16936 <p>(This should be stripped!)
16937 Taiwan is Taiwan.
16938 </p>
16939 !! end
16940
16941 !! test
16942 Adding explicit conversion rule for title (T flag)
16943 !! options
16944 language=zh variant=zh-tw showtitle
16945 !! wikitext
16946 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16947 !! html
16948 Taiwan
16949 <p>Should be stripped!
16950 </p>
16951 !! end
16952
16953 !! test
16954 Testing that changing the language variant here in the tests actually works
16955 !! options
16956 language=zh variant=zh showtitle
16957 !! wikitext
16958 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16959 !! html
16960 China
16961 <p>Should be stripped!
16962 </p>
16963 !! end
16964
16965 !! test
16966 Recursive conversion of alt and title attrs shouldn't clear converter state
16967 !! options
16968 language=zh variant=zh-cn showtitle
16969 !! wikitext
16970 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
16971 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
16972 !! html
16973 China
16974 <p>
16975 Should be stripped<span title="Exclamation">!</span>
16976 </p>
16977 !! end
16978
16979 !! test
16980 Bug 24072: more test on conversion rule for title
16981 !! options
16982 language=zh variant=zh-tw showtitle
16983 !! wikitext
16984 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16985 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
16986 !! html
16987 Taiwan
16988 <p>This should be stripped!
16989 This won't take interferes with the title rule.
16990 </p>
16991 !! end
16992
16993 !! test
16994 Partly disable title conversion if variant == main language code
16995 !! options
16996 language=zh variant=zh title=[[ZH]] showtitle
16997 !! wikitext
16998 -{T|zh-cn:CN;zh-tw:TW}-
16999 !! html
17000 ZH
17001 <p>
17002 </p>
17003 !! end
17004
17005 !! test
17006 Partly disable title conversion if variant == main language code, more
17007 !! options
17008 language=zh variant=zh title=[[ZH]] showtitle
17009 !! wikitext
17010 -{T|TW}-
17011 !! html
17012 ZH
17013 <p>
17014 </p>
17015 !! end
17016
17017 !! test
17018 Raw output of variant escape tags (R flag)
17019 !! options
17020 language=zh variant=zh-tw
17021 !! wikitext
17022 Raw: -{R|zh:China;zh-tw:Taiwan}-
17023 !! html
17024 <p>Raw: zh:China;zh-tw:Taiwan
17025 </p>
17026 !! end
17027
17028 !! test
17029 Nested using of manual convert syntax
17030 !! options
17031 language=zh variant=zh-hk
17032 !! wikitext
17033 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
17034 !! html
17035 <p>Nested: Hello Hong Kong!
17036 </p>
17037 !! end
17038
17039 !! test
17040 Proper conversion of text in external links
17041 !! options
17042 language=sr variant=sr-ec
17043 !! wikitext
17044 http://www.google.com
17045 gopher://www.google.com
17046 [http://www.google.com http://www.google.com]
17047 [gopher://www.google.com gopher://www.google.com]
17048 [https://www.google.com irc://www.google.com]
17049 [ftp://www.google.com www.google.com/ftp://dir]
17050 [//www.google.com www.google.com]
17051 !! html
17052 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17053 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17054 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17055 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17056 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
17057 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
17058 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
17059 </p>
17060 !! end
17061
17062 !! test
17063 Do not convert roman numbers to language variants
17064 !! options
17065 language=sr variant=sr-ec
17066 !! wikitext
17067 Fridrih IV je car.
17068 !! html
17069 <p>Фридрих IV је цар.
17070 </p>
17071 !! end
17072
17073 !! test
17074 Unclosed language converter markup "-{"
17075 !! options
17076 language=sr
17077 !! wikitext
17078 -{T|hello
17079 !! html
17080 <p>-{T|hello
17081 </p>
17082 !! end
17083
17084 !! test
17085 Don't convert raw rule "-{R|=&gt;}-" to "=>"
17086 !! options
17087 language=sr
17088 !! wikitext
17089 -{R|=&gt;}-
17090 !! html
17091 <p>=&gt;
17092 </p>
17093 !!end
17094
17095 !! test
17096 Don't break link parsing if language converter markup is in the caption.
17097 !! options
17098 language=sr variant=sr-ec
17099 !! wikitext
17100 [[Main Page|-{R|main page}-]]
17101 !! html
17102 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
17103 </p>
17104 !! end
17105
17106 # This test is currently broken in the PHP parser (bug 52661)
17107 !! test
17108 Don't break image parsing if language converter markup is in the caption.
17109 !! options
17110 language=sr
17111 disabled
17112 !! wikitext
17113 [[File:Foobar.jpg|-{R|caption}-]]
17114 !! html
17115 <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>
17116 </p>
17117 !! end
17118
17119 # This test is currently broken in the PHP parser (bug 52661)
17120 !! test
17121 Don't break list handling if language converter markup is in the item.
17122 !! options
17123 language=zh variant=zh-cn
17124 disabled
17125 !! wikitext
17126 ;-{zh-cn:AAA;zh-tw:BBB}-
17127 !! html
17128 <dl><dt>AAA
17129 </dt></dl>
17130
17131 !! end
17132
17133 # This test is currently broken in the PHP parser (bug 52661)
17134 !! test
17135 Don't break table handling if language converter markup is in the cell.
17136 !! options
17137 language=sr variant=sr-ec
17138 disabled
17139 !! wikitext
17140 {|
17141 |-
17142 | -{R|B}-
17143 |}
17144 !! html
17145 <table>
17146
17147 <tr>
17148 <td> B
17149 </td></tr></table>
17150
17151 !! end
17152
17153 !! test
17154 Bug 529: Uncovered bullet
17155 !! wikitext
17156 * Foo {{bullet}}
17157 !! html
17158 <ul><li> Foo </li>
17159 <li> Bar</li></ul>
17160
17161 !! end
17162
17163 # Plain MediaWiki does not remove empty lists, but tidy actually does.
17164 # Templates in Wikipedia rely on this behavior, as tidy has always been
17165 # enabled there. These tests are normally run *without* tidy, so specify the
17166 # full output here.
17167 # To test realistic parsing behavior, apply a tidy-like transformation to both
17168 # the expected output and your parser's output.
17169 !! test
17170 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
17171 !! wikitext
17172 ******* Foo {{bullet}}
17173 !! html
17174 <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>
17175 <li> Bar</li></ul>
17176
17177 !! end
17178
17179 !! test
17180 Bug 529: Uncovered table already at line-start
17181 !! wikitext
17182 x
17183
17184 {{table}}
17185 y
17186 !! html
17187 <p>x
17188 </p>
17189 <table>
17190 <tr>
17191 <td> 1 </td>
17192 <td> 2
17193 </td></tr>
17194 <tr>
17195 <td> 3 </td>
17196 <td> 4
17197 </td></tr></table>
17198 <p>y
17199 </p>
17200 !! end
17201
17202 !! test
17203 Bug 529: Uncovered bullet in parser function result
17204 !! wikitext
17205 * Foo {{lc:{{bullet}} }}
17206 !! html
17207 <ul><li> Foo </li>
17208 <li> bar</li></ul>
17209
17210 !! end
17211
17212 !! test
17213 Bug 5678: Double-parsed template argument
17214 !! wikitext
17215 {{lc:{{{1}}}|hello}}
17216 !! html
17217 <p>{{{1}}}
17218 </p>
17219 !! end
17220
17221 !! test
17222 Bug 5678: Double-parsed template invocation
17223 !! wikitext
17224 {{lc:{{paramtest {{!}} param = hello }} }}
17225 !! html
17226 <p>{{paramtest | param = hello }}
17227 </p>
17228 !! end
17229
17230 !! test
17231 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
17232 !! options
17233 language=cs
17234 title=[[Main Page]]
17235 !! wikitext
17236 {{PRVNÍVELKÉ:ěščř}}
17237 {{prvnívelké:ěščř}}
17238 {{PRVNÍMALÉ:ěščř}}
17239 {{prvnímalé:ěščř}}
17240 {{MALÁ:ěščř}}
17241 {{malá:ěščř}}
17242 {{VELKÁ:ěščř}}
17243 {{velká:ěščř}}
17244 !! html
17245 <p>Ěščř
17246 Ěščř
17247 ěščř
17248 ěščř
17249 ěščř
17250 ěščř
17251 ĚŠČŘ
17252 ĚŠČŘ
17253 </p>
17254 !! end
17255
17256 !! test
17257 Morwen/13: Unclosed link followed by heading
17258 !! wikitext
17259 [[link
17260 ==heading==
17261 !! html
17262 <p>[[link
17263 </p>
17264 <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>
17265
17266 !! end
17267
17268 !! test
17269 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
17270 !! wikitext
17271 {{foo|
17272 =heading=
17273 !! html
17274 <p>{{foo|
17275 </p>
17276 <h1><span class="mw-headline" id="heading">heading</span></h1>
17277
17278 !! end
17279
17280 !! test
17281 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
17282 !! wikitext
17283 {{foo|
17284 ==heading==
17285 !! html
17286 <p>{{foo|
17287 </p>
17288 <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>
17289
17290 !! end
17291
17292 !! test
17293 Tildes in comments
17294 !! options
17295 pst
17296 !! wikitext
17297 <!-- ~~~~ -->
17298 !! html
17299 <!-- ~~~~ -->
17300 !! end
17301
17302 !! test
17303 Paragraphs inside divs (no extra line breaks)
17304 !! wikitext
17305 <div>Line one
17306
17307 Line two</div>
17308 !! html
17309 <div>Line one
17310 Line two</div>
17311
17312 !! end
17313
17314 !! test
17315 Paragraphs inside divs (extra line break on open)
17316 !! wikitext
17317 <div>
17318 Line one
17319
17320 Line two</div>
17321 !! html
17322 <div>
17323 <p>Line one
17324 </p>
17325 Line two</div>
17326
17327 !! end
17328
17329 !! test
17330 Paragraphs inside divs (extra line break on close)
17331 !! wikitext
17332 <div>Line one
17333
17334 Line two
17335 </div>
17336 !! html
17337 <div>Line one
17338 <p>Line two
17339 </p>
17340 </div>
17341
17342 !! end
17343
17344 !! test
17345 Paragraphs inside divs (extra line break on open and close)
17346 !! wikitext
17347 <div>
17348 Line one
17349
17350 Line two
17351 </div>
17352 !! html
17353 <div>
17354 <p>Line one
17355 </p><p>Line two
17356 </p>
17357 </div>
17358
17359 !! end
17360
17361 !! test
17362 Nesting tags, paragraphs on lines which begin with <div>
17363 !! options
17364 disabled
17365 !! wikitext
17366 <div></div><strong>A
17367 B</strong>
17368 !! html
17369 <div></div>
17370 <p><strong>A
17371 B</strong>
17372 </p>
17373 !! end
17374
17375 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
17376 !! test
17377 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
17378 !! wikitext
17379 <blockquote>Line one
17380
17381 Line two</blockquote>
17382 !! html
17383 <blockquote>Line one
17384 Line two</blockquote>
17385
17386 !! html+tidy
17387 <blockquote>
17388 <p>Line one Line two</p>
17389 </blockquote>
17390 !! end
17391
17392 !! test
17393 Bug 6200: paragraphs inside blockquotes (extra line break on open)
17394 !! wikitext
17395 <blockquote>
17396 Line one
17397
17398 Line two</blockquote>
17399 !! html
17400 <blockquote>
17401 <p>Line one
17402 </p>
17403 Line two</blockquote>
17404
17405 !! html+tidy
17406 <blockquote>
17407 <p>Line one</p>
17408 Line two</blockquote>
17409 !! end
17410
17411 !! test
17412 Bug 6200: paragraphs inside blockquotes (extra line break on close)
17413 !! wikitext
17414 <blockquote>Line one
17415
17416 Line two
17417 </blockquote>
17418 !! html
17419 <blockquote>Line one
17420 <p>Line two
17421 </p>
17422 </blockquote>
17423
17424 !! html+tidy
17425 <blockquote>
17426 <p>Line one</p>
17427 <p>Line two</p>
17428 </blockquote>
17429 !! end
17430
17431 !! test
17432 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
17433 !! wikitext
17434 <blockquote>
17435 Line one
17436
17437 Line two
17438 </blockquote>
17439 !! html
17440 <blockquote>
17441 <p>Line one
17442 </p><p>Line two
17443 </p>
17444 </blockquote>
17445
17446 !! html+tidy
17447 <blockquote>
17448 <p>Line one</p>
17449 <p>Line two</p>
17450 </blockquote>
17451 !! end
17452
17453 !! test
17454 Paragraphs inside blockquotes/divs (no extra line breaks)
17455 !! wikitext
17456 <blockquote><div>Line one
17457
17458 Line two</div></blockquote>
17459 !! html
17460 <blockquote><div>Line one
17461 Line two</div></blockquote>
17462
17463 !! end
17464
17465 !! test
17466 Paragraphs inside blockquotes/divs (extra line break on open)
17467 !! wikitext
17468 <blockquote><div>
17469 Line one
17470
17471 Line two</div></blockquote>
17472 !! html
17473 <blockquote><div>
17474 <p>Line one
17475 </p>
17476 Line two</div></blockquote>
17477
17478 !! end
17479
17480 !! test
17481 Paragraphs inside blockquotes/divs (extra line break on close)
17482 !! wikitext
17483 <blockquote><div>Line one
17484
17485 Line two
17486 </div></blockquote>
17487 !! html
17488 <blockquote><div>Line one
17489 <p>Line two
17490 </p>
17491 </div></blockquote>
17492
17493 !! end
17494
17495 !! test
17496 Paragraphs inside blockquotes/divs (extra line break on open and close)
17497 !! wikitext
17498 <blockquote><div>
17499 Line one
17500
17501 Line two
17502 </div></blockquote>
17503 !! html
17504 <blockquote><div>
17505 <p>Line one
17506 </p><p>Line two
17507 </p>
17508 </div></blockquote>
17509
17510 !! end
17511
17512 !! test
17513 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
17514 !! options
17515 wgLinkHolderBatchSize=0
17516 !! wikitext
17517 [[meatball:1]]
17518 [[meatball:2]]
17519 [[meatball:3]]
17520 !! html
17521 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
17522 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
17523 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
17524 </p>
17525 !! end
17526
17527 !! test
17528 Free external link invading image caption
17529 !! wikitext
17530 [[Image:Foobar.jpg|thumb|http://x|hello]]
17531 !! html
17532 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>hello</div></div></div>
17533
17534 !! end
17535
17536 !! test
17537 Bug 15196: localised external link numbers
17538 !! options
17539 language=fa
17540 !! wikitext
17541 [http://en.wikipedia.org/]
17542 !! html/php
17543 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
17544 </p>
17545 !! html/parsoid
17546 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
17547 !! end
17548
17549 !! test
17550 Multibyte character in padleft
17551 !! wikitext
17552 {{padleft:-Hello|7|Æ}}
17553 !! html
17554 <p>Æ-Hello
17555 </p>
17556 !! end
17557
17558 !! test
17559 Multibyte character in padright
17560 !! wikitext
17561 {{padright:Hello-|7|Æ}}
17562 !! html
17563 <p>Hello-Æ
17564 </p>
17565 !! end
17566
17567 !!test
17568 formatdate parser function
17569 !! wikitext
17570 {{#formatdate:2009-03-24}}
17571 !! html
17572 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
17573 </p>
17574 !! end
17575
17576 !!test
17577 formatdate parser function, with default format
17578 !! wikitext
17579 {{#formatdate:2009-03-24|mdy}}
17580 !! html
17581 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
17582 </p>
17583 !! end
17584
17585 !! test
17586 Spacing of numbers in formatted dates
17587 !! wikitext
17588 {{#formatdate:January 15}}
17589 !! html
17590 <p><span class="mw-formatted-date" title="01-15">January 15</span>
17591 </p>
17592 !! end
17593
17594 !! test
17595 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
17596 !! options
17597 language=nl title=[[MediaWiki:Common.css]]
17598 !! wikitext
17599 {{#formatdate:2009-03-24|dmy}}
17600 !! html
17601 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
17602 </p>
17603 !! end
17604
17605 #
17606 #
17607 #
17608
17609 #
17610 # Edit comments
17611 #
17612
17613 !! test
17614 Edit comment with link
17615 !! options
17616 comment
17617 !! wikitext
17618 I like the [[Main Page]] a lot
17619 !! html
17620 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
17621 !!end
17622
17623 !! test
17624 Edit comment with link and link text
17625 !! options
17626 comment
17627 !! wikitext
17628 I like the [[Main Page|best pages]] a lot
17629 !! html
17630 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17631 !!end
17632
17633 !! test
17634 Edit comment with link and link text with suffix
17635 !! options
17636 comment
17637 !! wikitext
17638 I like the [[Main Page|best page]]s a lot
17639 !! html
17640 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17641 !!end
17642
17643 !! test
17644 Edit comment with section link (non-local, eg in history list)
17645 !! options
17646 comment title=[[Main Page]]
17647 !! wikitext
17648 /* External links */ removed bogus entries
17649 !! html
17650 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17651 !!end
17652
17653 !! test
17654 Edit comment with section link and text before it (non-local, eg in history list)
17655 !! options
17656 comment title=[[Main Page]]
17657 !! wikitext
17658 pre-comment text /* External links */ removed bogus entries
17659 !! html
17660 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>
17661 !!end
17662
17663 !! test
17664 Edit comment with section link (local, eg in diff view)
17665 !! options
17666 comment local title=[[Main Page]]
17667 !! wikitext
17668 /* External links */ removed bogus entries
17669 !! html
17670 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17671 !!end
17672
17673 !! test
17674 Edit comment with subpage link (bug 14080)
17675 !! options
17676 comment
17677 subpage
17678 title=[[Subpage test]]
17679 !! wikitext
17680 Poked at a [[/subpage]] here...
17681 !! html
17682 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
17683 !!end
17684
17685 !! test
17686 Edit comment with subpage link and link text (bug 14080)
17687 !! options
17688 comment
17689 subpage
17690 title=[[Subpage test]]
17691 !! wikitext
17692 Poked at a [[/subpage|neat little page]] here...
17693 !! html
17694 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
17695 !!end
17696
17697 !! test
17698 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
17699 !! options
17700 comment
17701 title=[[Subpage test]]
17702 !! wikitext
17703 Poked at a [[/subpage]] here...
17704 !! html
17705 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...
17706 !!end
17707
17708 !! test
17709 Edit comment with bare anchor link (local, as on diff)
17710 !! options
17711 comment
17712 local
17713 title=[[Main Page]]
17714 !! wikitext
17715 [[#section]]
17716 !! html
17717 <a href="#section">#section</a>
17718 !! end
17719
17720 !! test
17721 Edit comment with bare anchor link (non-local, as on history)
17722 !! options
17723 comment
17724 title=[[Main Page]]
17725 !! wikitext
17726 [[#section]]
17727 !! html
17728 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
17729 !! end
17730
17731 !! test
17732 Anchor starting with underscore
17733 !! wikitext
17734 [[#_ref|One]]
17735 !! html
17736 <p><a href="#_ref">One</a>
17737 </p>
17738 !! end
17739
17740 !! test
17741 Id starting with underscore
17742 !! wikitext
17743 <div id="_ref"></div>
17744 !! html
17745 <div id="_ref"></div>
17746
17747 !! end
17748
17749 !! test
17750 Space normalisation on autocomment (bug 22784)
17751 !! options
17752 comment
17753 title=[[Main Page]]
17754 !! wikitext
17755 /* __hello__world__ */
17756 !! html
17757 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
17758 !! end
17759
17760 !! test
17761 percent-encoding and + signs in comments (Bug 26410)
17762 !! options
17763 comment
17764 !! wikitext
17765 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
17766 !! html
17767 <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>
17768 !! end
17769
17770 !! test
17771 Bad images - basic functionality
17772 !! options
17773 disabled
17774 !! wikitext
17775 [[File:Bad.jpg]]
17776 !! html
17777 !! end
17778
17779 !! test
17780 Bad images - bug 16039: text after bad image disappears
17781 !! options
17782 disabled
17783 !! wikitext
17784 Foo bar
17785 [[File:Bad.jpg]]
17786 Bar foo
17787 !! html
17788 <p>Foo bar
17789 </p><p>Bar foo
17790 </p>
17791 !! end
17792
17793 !! test
17794 Verify that displaytitle works (bug #22501) no displaytitle
17795 !! options
17796 showtitle
17797 !! config
17798 wgAllowDisplayTitle=true
17799 wgRestrictDisplayTitle=false
17800 !! wikitext
17801 this is not the the title
17802 !! html
17803 Parser test
17804 <p>this is not the the title
17805 </p>
17806 !! end
17807
17808 !! test
17809 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
17810 !! options
17811 showtitle
17812 title=[[Screen]]
17813 !! config
17814 wgAllowDisplayTitle=true
17815 wgRestrictDisplayTitle=false
17816 !! wikitext
17817 this is not the the title
17818 {{DISPLAYTITLE:whatever}}
17819 !! html
17820 whatever
17821 <p>this is not the the title
17822 </p>
17823 !! end
17824
17825 !! test
17826 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
17827 !! options
17828 showtitle
17829 title=[[Screen]]
17830 !! config
17831 wgAllowDisplayTitle=true
17832 wgRestrictDisplayTitle=true
17833 !! wikitext
17834 this is not the the title
17835 {{DISPLAYTITLE:whatever}}
17836 !! html
17837 Screen
17838 <p>this is not the the title
17839 </p>
17840 !! end
17841
17842 !! test
17843 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
17844 !! options
17845 showtitle
17846 title=[[Screen]]
17847 !! config
17848 wgAllowDisplayTitle=true
17849 wgRestrictDisplayTitle=true
17850 !! wikitext
17851 this is not the the title
17852 {{DISPLAYTITLE:screen}}
17853 !! html
17854 screen
17855 <p>this is not the the title
17856 </p>
17857 !! end
17858
17859 !! test
17860 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
17861 !! options
17862 showtitle
17863 title=[[Screen]]
17864 !! config
17865 wgAllowDisplayTitle=false
17866 !! wikitext
17867 this is not the the title
17868 {{DISPLAYTITLE:screen}}
17869 !! html
17870 Screen
17871 <p>this is not the the title
17872 <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>
17873 </p>
17874 !! end
17875
17876 !! test
17877 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
17878 !! options
17879 showtitle
17880 title=[[Screen]]
17881 !! config
17882 wgAllowDisplayTitle=false
17883 !! wikitext
17884 this is not the the title
17885 !! html
17886 Screen
17887 <p>this is not the the title
17888 </p>
17889 !! end
17890
17891 !! test
17892 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
17893 !! options
17894 showtitle
17895 title=[[Screen]]
17896 !! config
17897 wgAllowDisplayTitle=true
17898 wgRestrictDisplayTitle=true
17899 !! wikitext
17900 this is not the the title
17901 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
17902 !! html
17903 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
17904 <p>this is not the the title
17905 </p>
17906 !! end
17907
17908 !! test
17909 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
17910 !! options
17911 showtitle
17912 title=[[Screen]]
17913 !! config
17914 wgAllowDisplayTitle=true
17915 wgRestrictDisplayTitle=true
17916 !! wikitext
17917 this is not the the title
17918 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
17919 !! html
17920 <span style="color: red;">s</span>creen
17921 <p>this is not the the title
17922 </p>
17923 !! end
17924
17925 !! test
17926 preload: check <noinclude> and <includeonly>
17927 !! options
17928 preload
17929 !! wikitext
17930 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
17931 !! html
17932 Hello kind world.
17933 !! end
17934
17935 !! test
17936 preload: check <onlyinclude>
17937 !! options
17938 preload
17939 !! wikitext
17940 Goodbye <onlyinclude>Hello world</onlyinclude>
17941 !! html
17942 Hello world
17943 !! end
17944
17945 !! test
17946 preload: can pass tags through if we want to
17947 !! options
17948 preload
17949 !! wikitext
17950 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
17951 !! html
17952 <includeonly>Hello world</includeonly>
17953 !! end
17954
17955 !! test
17956 preload: check that it doesn't try to do tricks
17957 !! options
17958 preload
17959 !! wikitext
17960 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17961 !! html
17962 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17963 !! end
17964
17965 !! test
17966 Play a bit with r67090 and bug 3158
17967 !! options
17968 disabled
17969 !! wikitext
17970 <div style="width:50% !important">&nbsp;</div>
17971 <div style="width:50%&nbsp;!important">&nbsp;</div>
17972 <div style="width:50%&#160;!important">&nbsp;</div>
17973 <div style="border : solid;">&nbsp;</div>
17974 !! html
17975 <div style="width:50% !important">&nbsp;</div>
17976 <div style="width:50% !important">&nbsp;</div>
17977 <div style="width:50% !important">&nbsp;</div>
17978 <div style="border&#160;: solid;">&nbsp;</div>
17979
17980 !! end
17981
17982 !! test
17983 HTML5 data attributes
17984 !! wikitext
17985 <span data-foo="bar">Baz</span>
17986 <p data-abc-def_hij="">Quuz</p>
17987 !! html
17988 <p><span data-foo="bar">Baz</span>
17989 </p>
17990 <p data-abc-def_hij="">Quuz</p>
17991
17992 !! end
17993
17994 !! test
17995 percent-encoding and + signs in internal links (Bug 26410)
17996 !! wikitext
17997 [[User:+%]] [[Page+title%]]
17998 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
17999 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
18000 [[%33%45]] [[%33%45+]]
18001 !! html
18002 <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>
18003 <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>
18004 <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>
18005 <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>
18006 </p>
18007 !! end
18008
18009 !! test
18010 Special characters in embedded file links (bug 27679)
18011 !! wikitext
18012 [[File:Contains & ampersand.jpg]]
18013 [[File:Does not exist.jpg|Title with & ampersand]]
18014 !! html
18015 <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>
18016 <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>
18017 </p>
18018 !! end
18019
18020
18021 !! test
18022 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
18023 !! wikitext
18024 Text&apos;s been normalized?
18025 !! html
18026 <p>Text&#39;s been normalized?
18027 </p>
18028 !! end
18029
18030 !! test
18031 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
18032 !! wikitext
18033 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
18034 !! html
18035 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
18036 </p>
18037 !! end
18038
18039 !! test
18040 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
18041 !! wikitext
18042 [http://www.example.org/ ideograms]
18043 !! html
18044 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
18045 </p>
18046 !! end
18047
18048 !! test
18049 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
18050 !! wikitext
18051 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
18052 !! html
18053 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
18054 </p>
18055 !! end
18056
18057 !! article
18058 Mediawiki:loop1
18059 !! text
18060 {{Identical|A}}
18061 !! endarticle
18062
18063 !! article
18064 Mediawiki:loop2
18065 !! text
18066 {{Identical|B}}
18067 !! endarticle
18068
18069 !! article
18070 Template:Identical
18071 !! text
18072 {{int:loop1}}
18073 {{int:loop2}}
18074 !! endarticle
18075
18076 !! test
18077 Bug 31098 Template which includes system messages which includes the template
18078 !! wikitext
18079 {{Identical}}
18080 !! html
18081 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18082 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18083 </p>
18084 !! end
18085
18086 !! test
18087 Bug31490 Turkish: ucfirst 'blah'
18088 !! options
18089 language=tr
18090 !! wikitext
18091 {{ucfirst:blah}}
18092 !! html
18093 <p>Blah
18094 </p>
18095 !! end
18096
18097 !! test
18098 Bug31490 Turkish: ucfirst 'ix'
18099 !! options
18100 language=tr
18101 !! wikitext
18102 {{ucfirst:ix}}
18103 !! html
18104 <p>İx
18105 </p>
18106 !! end
18107
18108 !! test
18109 Bug31490 Turkish: lcfirst 'BLAH'
18110 !! options
18111 language=tr
18112 !! wikitext
18113 {{lcfirst:BLAH}}
18114 !! html
18115 <p>bLAH
18116 </p>
18117 !! end
18118
18119 !! test
18120 Bug31490 Turkish: ucfırst (with a dotless i)
18121 !! options
18122 language=tr
18123 !! wikitext
18124 {{ucfırst:blah}}
18125 !! html
18126 <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>
18127 </p>
18128 !! end
18129
18130 !! test
18131 Bug31490 ucfırst (with a dotless i) with English language
18132 !! options
18133 language=en
18134 !! wikitext
18135 {{ucfırst:blah}}
18136 !! html
18137 <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>
18138 </p>
18139 !! end
18140
18141 !! test
18142 Bug 26375: TOC with italics
18143 !! options
18144 title=[[Main Page]]
18145 !! wikitext
18146 __TOC__
18147 == ''Lost'' episodes ==
18148 !! html
18149 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18150 <ul>
18151 <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>
18152 </ul>
18153 </div>
18154
18155 <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>
18156
18157 !! end
18158
18159 !! test
18160 Bug 26375: TOC with bold
18161 !! options
18162 title=[[Main Page]]
18163 !! wikitext
18164 __TOC__
18165 == '''should be bold''' then normal text ==
18166 !! html
18167 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18168 <ul>
18169 <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>
18170 </ul>
18171 </div>
18172
18173 <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>
18174
18175 !! end
18176
18177 !! test
18178 Bug 33845: Headings become cursive in TOC when they contain an image
18179 !! options
18180 title=[[Main Page]]
18181 !! wikitext
18182 __TOC__
18183 == Image [[Image:foobar.jpg]] ==
18184 !! html
18185 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18186 <ul>
18187 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
18188 </ul>
18189 </div>
18190
18191 <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>
18192
18193 !! end
18194
18195 !! test
18196 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
18197 !! options
18198 title=[[Main Page]]
18199 !! wikitext
18200 __TOC__
18201 == <blockquote>Quote</blockquote> ==
18202 !! html
18203 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18204 <ul>
18205 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18206 </ul>
18207 </div>
18208
18209 <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>
18210
18211 !! html+tidy
18212 <div id="toc" class="toc">
18213 <div id="toctitle">
18214 <h2>Contents</h2>
18215 </div>
18216 <ul>
18217 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18218 </ul>
18219 </div>
18220 <h2><span class="mw-headline" id="Quote"></span></h2>
18221 <blockquote>
18222 <p><span class="mw-headline" id="Quote">Quote</span></p>
18223 </blockquote>
18224 <p><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a><span class="mw-editsection-bracket">]</span></span></p>
18225 !! end
18226
18227 !! test
18228 Unclosed tags in TOC
18229 !! options
18230 title=[[Main Page]]
18231 !! wikitext
18232 __TOC__
18233 == Proof: 2 < 3 ==
18234 <small>Hanc marginis exiguitas non caperet.</small>
18235 QED
18236 !! html
18237 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18238 <ul>
18239 <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>
18240 </ul>
18241 </div>
18242
18243 <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>
18244 <p><small>Hanc marginis exiguitas non caperet.</small>
18245 QED
18246 </p>
18247 !! end
18248
18249 !! test
18250 Multiple tags in TOC
18251 !! wikitext
18252 __TOC__
18253 == <i>Foo</i> <b>Bar</b> ==
18254
18255 == <i>Foo</i> <blockquote>Bar</blockquote> ==
18256 !! html
18257 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18258 <ul>
18259 <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>
18260 <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>
18261 </ul>
18262 </div>
18263
18264 <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>
18265 <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>
18266
18267 !! html+tidy
18268 <div id="toc" class="toc">
18269 <div id="toctitle">
18270 <h2>Contents</h2>
18271 </div>
18272 <ul>
18273 <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>
18274 <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>
18275 </ul>
18276 </div>
18277 <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>
18278 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
18279 <blockquote>
18280 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
18281 </blockquote>
18282 <p><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></p>
18283 !! end
18284
18285 !! test
18286 Tags with parameters in TOC
18287 !! wikitext
18288 __TOC__
18289 == <sup class="in-h2">Hello</sup> ==
18290
18291 == <sup class="a > b">Evilbye</sup> ==
18292 !! html
18293 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18294 <ul>
18295 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
18296 <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>
18297 </ul>
18298 </div>
18299
18300 <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>
18301 <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>
18302
18303 !! end
18304
18305 !! test
18306 span tags with directionality in TOC
18307 !! wikitext
18308 __TOC__
18309 == <span dir="ltr">C++</span> ==
18310
18311 == <span dir="rtl">זבנג!</span> ==
18312
18313 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
18314
18315 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
18316
18317 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
18318 !! html
18319 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18320 <ul>
18321 <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>
18322 <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>
18323 <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>
18324 <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>
18325 <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>
18326 </ul>
18327 </div>
18328
18329 <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>
18330 <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>
18331 <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>
18332 <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>
18333 <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>
18334
18335 !! end
18336
18337 !! article
18338 MediaWiki:Bug32057
18339 !! text
18340 == {{int:headline_sample}} ==
18341 !! endarticle
18342
18343 !! test
18344 Bug 32057: Title needed when expanding <h> nodes.
18345 !! options
18346 title=[[Main Page]]
18347 !! wikitext
18348 {{int:Bug32057}}
18349 !! html
18350 <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>
18351
18352 !! end
18353
18354 !! test
18355 Strip marker in urlencode
18356 !! wikitext
18357 {{urlencode:x<nowiki/>y}}
18358 {{urlencode:x<nowiki/>y|wiki}}
18359 {{urlencode:x<nowiki/>y|path}}
18360 !! html
18361 <p>xy
18362 xy
18363 xy
18364 </p>
18365 !! end
18366
18367 !! test
18368 Strip marker in lc
18369 !! wikitext
18370 {{lc:x<nowiki/>y}}
18371 !! html
18372 <p>xy
18373 </p>
18374 !! end
18375
18376 !! test
18377 Strip marker in uc
18378 !! wikitext
18379 {{uc:x<nowiki/>y}}
18380 !! html
18381 <p>XY
18382 </p>
18383 !! end
18384
18385 !! test
18386 Strip marker in formatNum
18387 !! wikitext
18388 {{formatnum:1<nowiki/>2}}
18389 {{formatnum:1<nowiki/>2|R}}
18390 !! html
18391 <p>12
18392 12
18393 </p>
18394 !! end
18395
18396 !! test
18397 Check noCommafy in formatNum
18398 !! options
18399 language=be-tarask
18400 !! wikitext
18401 {{formatnum:123456.78}}
18402 {{formatnum:123456.78|NOSEP}}
18403 !! html
18404 <p>123 456,78
18405 123456.78
18406 </p>
18407 !! end
18408
18409 !! test
18410 Wrong option for formatNum (bug 56199)
18411 !! wikitext
18412 {{formatnum:1,234.56|Random}}
18413 {{formatnum:1,234.56|EVERYTHING}}
18414 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
18415 !! html
18416 <p>1,234.56
18417 1,234.56
18418 1,234.56
18419 </p>
18420 !! end
18421
18422 !! test
18423 Strip marker in grammar
18424 !! options
18425 language=fi
18426 !! wikitext
18427 {{grammar:elative|foo<nowiki/>bar}}
18428 !! html
18429 <p>foobarista
18430 </p>
18431 !! end
18432
18433 !! test
18434 Strip marker in padleft
18435 !! wikitext
18436 {{padleft:|2|x<nowiki/>y}}
18437 !! html
18438 <p>xy
18439 </p>
18440 !! end
18441
18442 !! test
18443 Strip marker in padright
18444 !! wikitext
18445 {{padright:|2|x<nowiki/>y}}
18446 !! html
18447 <p>xy
18448 </p>
18449 !! end
18450
18451 !! test
18452 Strip marker in anchorencode
18453 !! wikitext
18454 {{anchorencode:x<nowiki/>y}}
18455 !! html
18456 <p>xy
18457 </p>
18458 !! end
18459
18460 !! test
18461 nowiki inside link inside heading (bug 18295)
18462 !! wikitext
18463 ==[[foo|x<nowiki>y</nowiki>z]]==
18464 !! html
18465 <h2><span class="mw-headline" id="xyz"><a href="/wiki/Foo" title="Foo">xyz</a></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18466
18467 !! end
18468
18469 !! test
18470 new support for bdi element (bug 31817)
18471 !! wikitext
18472 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
18473 !! html
18474 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
18475
18476 !!end
18477
18478 !! test
18479 Ignore pipe between table row attributes
18480 !! wikitext
18481 {|
18482 | quux
18483 |- id=foo | style='color: red'
18484 | bar
18485 |}
18486 !! html
18487 <table>
18488 <tr>
18489 <td> quux
18490 </td></tr>
18491 <tr id="foo" style="color: red">
18492 <td> bar
18493 </td></tr></table>
18494
18495 !! end
18496
18497 !!test
18498 Gallery override link with WikiLink (bug 34852)
18499 !! wikitext
18500 <gallery>
18501 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
18502 </gallery>
18503 !! html
18504 <ul class="gallery mw-gallery-traditional">
18505 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18506 <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>
18507 <div class="gallerytext">
18508 <p>caption
18509 </p>
18510 </div>
18511 </div></li>
18512 </ul>
18513
18514 !! end
18515
18516 !!test
18517 Gallery override link with absolute external link (bug 34852)
18518 !! wikitext
18519 <gallery>
18520 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
18521 </gallery>
18522 !! html
18523 <ul class="gallery mw-gallery-traditional">
18524 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18525 <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>
18526 <div class="gallerytext">
18527 <p>caption
18528 </p>
18529 </div>
18530 </div></li>
18531 </ul>
18532
18533 !! end
18534
18535 !!test
18536 Gallery override link with malicious javascript (bug 34852)
18537 !! wikitext
18538 <gallery>
18539 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
18540 </gallery>
18541 !! html
18542 <ul class="gallery mw-gallery-traditional">
18543 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18544 <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>
18545 <div class="gallerytext">
18546 <p>caption
18547 </p>
18548 </div>
18549 </div></li>
18550 </ul>
18551
18552 !! end
18553
18554 !!test
18555 Gallery with invalid title as link (bug 43964)
18556 !! wikitext
18557 <gallery>
18558 File:foobar.jpg|link=<
18559 </gallery>
18560 !! html
18561 <ul class="gallery mw-gallery-traditional">
18562 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18563 <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>
18564 <div class="gallerytext">
18565 </div>
18566 </div></li>
18567 </ul>
18568
18569 !! end
18570
18571 !!test
18572 Language parser function
18573 !! wikitext
18574 {{#language:ar}}
18575 !! html
18576 <p>العربية
18577 </p>
18578 !! end
18579
18580 !!test
18581 Padleft and padright as substr
18582 !! wikitext
18583 {{padleft:|3|abcde}}
18584 {{padright:|3|abcde}}
18585 !! html
18586 <p>abc
18587 abc
18588 </p>
18589 !! end
18590
18591 !!test
18592 Special parser function
18593 !! wikitext
18594 {{#special:RandomPage}}
18595 {{#special:BaDtItLe}}
18596 {{#special:Foobar}}
18597 !! html
18598 <p>Special:Random
18599 Special:Badtitle
18600 Special:Foobar
18601 </p>
18602 !! end
18603
18604 !!test
18605 Bug 34939 - Case insensitive link parsing ([HttP://])
18606 !! wikitext
18607 [HttP://MediaWiki.Org/]
18608 !! html/php
18609 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
18610 </p>
18611 !! html/parsoid
18612 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
18613 !! end
18614
18615 !!test
18616 Bug 34939 - Case insensitive link parsing ([HttP:// title])
18617 !! wikitext
18618 [HttP://MediaWiki.Org/ MediaWiki]
18619 !! html
18620 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
18621 </p>
18622 !! end
18623
18624 !!test
18625 Bug 34939 - Case insensitive link parsing (HttP://)
18626 !! wikitext
18627 HttP://MediaWiki.Org/
18628 !! html/php
18629 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
18630 </p>
18631 !! html/parsoid
18632 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
18633 !! end
18634
18635 !!test
18636 Disable TOC
18637 !! options
18638 notoc
18639 !! wikitext
18640 Lead
18641 == Section 1 ==
18642 == Section 2 ==
18643 == Section 3 ==
18644 == Section 4 ==
18645 == Section 5 ==
18646 !! html
18647 <p>Lead
18648 </p>
18649
18650 <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>
18651 <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>
18652 <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>
18653 <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>
18654 <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>
18655
18656 !! end
18657
18658
18659 ###
18660 ### Parsoid-specific tests
18661 ### Parsoid-PHP parser incompatibilities
18662 ###
18663 !!test
18664 1. SOL-sensitive wikitext tokens as template-args
18665 !!options
18666 parsoid=wt2html,wt2wt
18667 !! wikitext
18668 {{echo|*a}}
18669 {{echo|#a}}
18670 {{echo|:a}}
18671 !! html
18672 <span about="#mwt1" typeof="mw:Transclusion">
18673 </span><ul about="#mwt1"><li>a</li>
18674 </ul>
18675 <span about="#mwt2" typeof="mw:Transclusion">
18676 </span><ol about="#mwt2"><li>a</li>
18677 </ol>
18678 <span about="#mwt3" typeof="mw:Transclusion">
18679 </span><dl about="#mwt3"><dd>a</dd>
18680 </dl>
18681 !!end
18682
18683 #### -----------------------------------------------------------------
18684 #### Parsoid-specific functionality tests
18685 #### -----------------------------------------------------------------
18686
18687 # Bug 63642: Formatting elt fixup is cleaned up.
18688 # We know wt2wt will fail, but we expect selser to pass.
18689 # Due to the nature of our testing, wt2wt and selser tests will enter the
18690 # blacklist and we'll catch selser regressions based on changes to the
18691 # blacklist entries for selser tests.
18692 !! test
18693 Bad treebuilder fixup of formatting elt is cleaned up
18694 !! options
18695 parsoid=wt2html,wt2wt
18696 !! wikitext
18697 {|
18698 |
18699 <small>
18700 [[Image:Foobar.jpg|right|Test]]
18701 </small>
18702 |}
18703 !! html/parsoid
18704 <table>
18705 <tbody><tr><td>
18706 <p><small></small></p>
18707 <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>
18708 <p></p></td></tr>
18709 </tbody></table>
18710 !! end
18711
18712 #### ----------------------------------------------------------------
18713 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
18714 #### tags. Parsoid's output for these tags differs from that of the
18715 #### PHP parser.
18716 #### ----------------------------------------------------------------
18717
18718 !!test
18719 Ref: 1. ref-location should be replaced with an index span
18720 !!options
18721 parsoid
18722 !! wikitext
18723 A <ref>foo</ref>
18724 B <ref name="x">foo</ref>
18725 C <ref name="y" />
18726 !! html
18727 <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>
18728 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>
18729 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>
18730 !!end
18731
18732 !!test
18733 Ref: 2. ref-tags with identical names should all get the same index
18734 !!options
18735 parsoid
18736 !! wikitext
18737 A <ref name="x">foo</ref>
18738 B <ref name="x" />
18739 !! html
18740 <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>
18741 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>
18742 !!end
18743
18744 !!test
18745 Ref: 3. spaces in ref-names should be ignored
18746 !!options
18747 parsoid
18748 !! wikitext
18749 A <ref name="x">foo</ref>
18750 B <ref name=" x " />
18751 C <ref name= x />
18752 !! html
18753 <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>
18754 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>
18755 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>
18756 !!end
18757
18758 !!test
18759 Ref: 4. 'constructor' should be accepted as a valid ref-name
18760 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
18761 !!options
18762 parsoid
18763 !! wikitext
18764 A <ref name="constructor">foo</ref>
18765 !! html
18766 <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>
18767 !!end
18768
18769 !!test
18770 Ref: 5. body should accept generic wikitext
18771 !!options
18772 parsoid
18773 !! wikitext
18774 A <ref>
18775 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
18776 </ref>
18777
18778 <references />
18779 !! html
18780 <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>
18781
18782 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
18783 <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>
18784 </li>
18785 </ol>
18786 !!end
18787
18788 !!test
18789 Ref: 6. indent-pres should not be output in ref-body
18790 !!options
18791 parsoid
18792 !! wikitext
18793 A <ref>
18794 foo
18795 bar
18796 baz
18797 </ref>
18798
18799 <references />
18800 !! html
18801 <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>
18802
18803 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
18804 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18805 bar
18806 baz
18807 </li>
18808 </ol>
18809 !!end
18810
18811 !!test
18812 Ref: 7. No p-wrapping in ref-body
18813 !!options
18814 parsoid
18815 !! wikitext
18816 A <ref>
18817 foo
18818
18819 bar
18820
18821
18822 baz
18823
18824
18825
18826 booz
18827 </ref>
18828
18829 <references />
18830 !! html
18831 <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>
18832
18833 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18834 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18835
18836 bar
18837
18838
18839 baz
18840
18841
18842
18843 booz
18844 </li>
18845 </ol>
18846 !!end
18847
18848 !!test
18849 Ref: 8. transclusion wikitext has lower precedence
18850 !!options
18851 parsoid
18852 !! wikitext
18853 A <ref> foo {{echo|</ref> B C}}
18854
18855 <references />
18856 !! html
18857 <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>
18858 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
18859 <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>
18860 </ol>
18861 !!end
18862
18863 !!test
18864 Ref: 9. unclosed comments should not leak out of ref-body
18865 !!options
18866 parsoid
18867 !! wikitext
18868 A <ref> foo <!--</ref> B C
18869 <references />
18870 !! html
18871 <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>
18872 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18873 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
18874 </ol>
18875 !!end
18876
18877 !!test
18878 Ref: 10. Unclosed HTML tags should not leak out of ref-body
18879 !!options
18880 parsoid
18881 !! wikitext
18882 A <ref> <b> foo </ref> B C
18883
18884 <references />
18885 !! html
18886 <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>
18887
18888
18889 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18890 <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>
18891 </ol>
18892 !!end
18893
18894 !!test
18895 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
18896 !!options
18897 parsoid
18898 !! wikitext
18899 A <ref>foo</ref> B
18900 C <ref>bar</ref> D
18901 !! html
18902 <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
18903 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>
18904 !!end
18905
18906 !!test
18907 Ref: 12. ref-tags act as trailing newline migration barrier
18908 !!options
18909 parsoid
18910 !! wikitext
18911 <!--the newline at the end of this line moves out of the p-tag-->a
18912
18913 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
18914 <ref />
18915
18916 c
18917 !! html
18918 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
18919
18920
18921 <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>
18922 <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>
18923
18924
18925 <p>c</p>
18926 !!end
18927
18928 !!test
18929 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
18930 !!options
18931 parsoid
18932 !! wikitext
18933 <ref>foo</ref> A
18934 <ref>bar
18935 </ref> B
18936 !! html
18937 <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
18938 <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>
18939 !!end
18940
18941 !!test
18942 Ref: 14. A nested ref-tag should be emitted as plain text
18943 !!options
18944 parsoid
18945 !! wikitext
18946 <ref>foo <ref>bar</ref> baz</ref>
18947
18948 <references />
18949 !! html
18950 <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>
18951
18952 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18953 <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>
18954 </ol>
18955 !!end
18956
18957 !!test
18958 Ref: 15. ref-tags with identical names should get identical indexes
18959 !!options
18960 parsoid
18961 !! wikitext
18962 A1 <ref name="a">foo</ref> A2 <ref name="a" />
18963 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
18964
18965 <references />
18966 !! html
18967 <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>
18968 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>
18969
18970 <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>
18971 </ol>
18972 !!end
18973
18974 ## We don't bother wt2wt-ing non-standard whitespace
18975 !!test
18976 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
18977 !!options
18978 parsoid=wt2html
18979 !! wikitext
18980 A <ref >foo</ref >
18981
18982 <references />
18983 !! html
18984 <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>
18985
18986 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18987 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
18988 !!end
18989
18990 !!test
18991 References: 1. references tag without any refs should be handled properly
18992 !!options
18993 parsoid
18994 !! wikitext
18995 <references />
18996 !! html
18997 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
18998 !!end
18999
19000 !!test
19001 References: 2. references tag with group only outputs references from that group
19002 !!options
19003 parsoid
19004 !! wikitext
19005 A <ref group="a">foo</ref>
19006 B <ref group="b">bar</ref>
19007
19008 <references group="a" />
19009 !! html
19010 <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>
19011 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>
19012
19013 <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>
19014 </ol>
19015 !!end
19016
19017 !!test
19018 References: 3. ref list should be cleared after processing references
19019 !!options
19020 parsoid
19021 !! wikitext
19022 A <ref>foo</ref>
19023
19024 <references />
19025
19026 B <ref>bar</ref>
19027
19028 <references />
19029 !! html
19030 <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>
19031
19032 <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>
19033 </ol>
19034
19035 <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>
19036
19037 <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>
19038 </ol>
19039 !!end
19040
19041 !!test
19042 References: 4. only referenced group should be cleared after processing references
19043 !!options
19044 parsoid
19045 !! wikitext
19046 A <ref group="a">afoo</ref>
19047 B <ref>bfoo</ref>
19048
19049 <references group="a" />
19050
19051 C <ref>cfoo</ref>
19052
19053 <references />
19054 !! html
19055 <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>
19056 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>
19057
19058 <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>
19059 </ol>
19060
19061 <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>
19062
19063 <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>
19064 </ol>
19065 !!end
19066
19067 !!test
19068 References: 5. ref tags in references should be processed while ignoring all other content
19069 !!options
19070 parsoid
19071 !! wikitext
19072 A <ref name="a" />
19073 B <ref name="b">bar</ref>
19074
19075 <references>
19076 <ref name="a">foo</ref>
19077 This should just get lost.
19078 </references>
19079 !! html
19080 <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>
19081 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>
19082
19083
19084 <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":{}}'>
19085 <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>
19086 <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>
19087 </ol>
19088 !!end
19089
19090 !!test
19091 References: 6. <references /> from a transclusion
19092 !!options
19093 parsoid
19094 !! wikitext
19095 <ref>Foo</ref> {{echo|<references />}}
19096 !! html
19097 <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>
19098 !!end
19099
19100 !! test
19101 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
19102 !! options
19103 parsoid
19104 !! wikitext
19105 A <ref>foo bar for a</ref>
19106 B <ref group="X" name="b" />
19107
19108 <references />
19109
19110 <references group="X">
19111 <ref name="b">foo</ref>
19112 </references>
19113 !! html
19114 <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>
19115 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>
19116
19117 <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>
19118
19119 <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>
19120 !! end
19121
19122 !! test
19123 Entities in ref name
19124 !! options
19125 parsoid
19126 !! wikitext
19127 <ref name="test &amp; me">hi</ref>
19128 !! html
19129 <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>
19130 !! end
19131
19132 # This test is wt2html only because we're permitting the serializer to produce
19133 # dirty diffs, normalizing the unclosed references to the self-closed version.
19134 !! test
19135 Generate references for unclosed references tag
19136 !! options
19137 parsoid=wt2html
19138 !! wikitext
19139 a<ref>foo</ref>
19140
19141 <references>
19142 !! html
19143 <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>
19144
19145
19146 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
19147 <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>
19148 !! end
19149
19150 !! test
19151 New reference serializes on its own line
19152 !! options
19153 parsoid=wt2wt,html2wt
19154 !! wikitext
19155 foo
19156 <references />
19157 !! html
19158 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
19159 !! end
19160
19161 #### ----------------------------------------------------------------
19162 #### The following section of tests are primarily to test
19163 #### wikitext escaping capabilities of Parsoid. Given that
19164 #### escaping can be done any number of ways, the wikitext (input)
19165 #### is always adjusted to reflect how Parsoid adds nowiki
19166 #### escape tags.
19167 ####
19168 #### We are marking several tests as parsoid-only since the
19169 #### HTML in the result section is different from what the
19170 #### PHP parser generates for it.
19171 #### ----------------------------------------------------------------
19172
19173
19174 #### --------------- Headings ---------------
19175 #### 0. Unnested
19176 #### 1. Nested inside html <h1>=foo=</h1>
19177 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
19178 #### 3. Nested inside html with wikitext split by html tags
19179 #### 4. No escape needed
19180 #### 5. Empty headings <h1></h1>
19181 #### 6. Heading chars in SOL context
19182 #### ----------------------------------------
19183 !! test
19184 Headings: 0. Unnested
19185 !! options
19186 parsoid
19187 !! wikitext
19188 <nowiki>=foo=</nowiki>
19189
19190 <nowiki> =foo= </nowiki>
19191 <!--cmt-->
19192 <nowiki>=foo=</nowiki>
19193
19194 =foo''a''<nowiki>=</nowiki>
19195 !! html
19196 <p><span typeof="mw:Nowiki">=foo=</span></p>
19197
19198 <p><span typeof="mw:Nowiki"> =foo= </span>
19199 <!--cmt-->
19200 <span typeof="mw:Nowiki">=foo=</span></p>
19201
19202 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
19203 !!end
19204
19205 !! test
19206 Headings: 1. Nested inside html
19207 (New headings and existing headings are handled differently)
19208 !! options
19209 parsoid=html2wt
19210 !! wikitext
19211 = =foo= =
19212
19213 == =foo= ==
19214
19215 === =foo= ===
19216
19217 =<nowiki>=foo=</nowiki>=
19218 ==<nowiki>=foo=</nowiki>==
19219 ===<nowiki>=foo=</nowiki>===
19220 ====<nowiki>=foo=</nowiki>====
19221 =====<nowiki>=foo=</nowiki>=====
19222 ======<nowiki>=foo=</nowiki>======
19223
19224 !! html
19225 <h1>=foo=</h1>
19226 <h2>=foo=</h2>
19227 <h3>=foo=</h3>
19228
19229 <h1 data-parsoid='{}'>=foo=</h1>
19230 <h2 data-parsoid='{}'>=foo=</h2>
19231 <h3 data-parsoid='{}'>=foo=</h3>
19232 <h4 data-parsoid='{}'>=foo=</h4>
19233 <h5 data-parsoid='{}'>=foo=</h5>
19234 <h6 data-parsoid='{}'>=foo=</h6>
19235 !!end
19236
19237 !! test
19238 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
19239 !! options
19240 parsoid=html2wt
19241 !! wikitext
19242 = foo =
19243 <nowiki>*</nowiki>bar
19244
19245 = foo =
19246 =bar
19247
19248 = foo =
19249 <nowiki>=bar=</nowiki>
19250 !! html
19251 <h1>foo</h1>*bar
19252 <h1>foo</h1>=bar
19253 <h1>foo</h1>=bar=
19254 !!end
19255
19256 !! test
19257 Headings: 3. Nested inside html with wikitext split by html tags
19258 !! options
19259 parsoid=html2wt
19260 !! wikitext
19261 = ='''bold'''<nowiki>foo=</nowiki> =
19262 !! html
19263 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
19264 !!end
19265
19266 !! test
19267 Headings: 4a. No escaping needed (testing just h1 and h2)
19268 !! options
19269 parsoid=html2wt
19270 !! wikitext
19271 = =foo =
19272
19273 = foo= =
19274
19275 = =foo= =
19276
19277 = =foo= bar =
19278
19279 == =foo ==
19280
19281 == foo= ==
19282
19283 = ''=''foo= =
19284
19285 = <nowiki>=</nowiki> =
19286 !! html
19287 <h1>=foo</h1>
19288 <h1>foo=</h1>
19289 <h1> =foo= </h1>
19290 <h1>=foo= bar</h1>
19291 <h2>=foo</h2>
19292 <h2>foo=</h2>
19293 <h1><i>=</i>foo=</h1>
19294 <h1><span typeof="mw:Nowiki">=</span></h1>
19295 !!end
19296
19297 !! test
19298 Headings: 4b. No escaping needed (inside p-tags)
19299 !! options
19300 parsoid=html2wt
19301 !! wikitext
19302 ===
19303 =foo= x
19304 =foo= <s></s>
19305 !! html
19306 <p>===
19307 =foo= x
19308 =foo= <s></s>
19309 </p>
19310 !!end
19311
19312 !! test
19313 Headings: 5. Empty headings
19314 !! options
19315 parsoid
19316 !! wikitext
19317 =<nowiki/>=
19318
19319 ==<nowiki/>==
19320
19321 ===<nowiki/>===
19322
19323 ====<nowiki/>====
19324
19325 =====<nowiki/>=====
19326
19327 ======<nowiki/>======
19328 !! html
19329 <h1></h1>
19330 <h2></h2>
19331 <h3></h3>
19332 <h4></h4>
19333 <h5></h5>
19334 <h6></h6>
19335 !!end
19336
19337 !! test
19338 Headings: 6a. Heading chars in SOL context (with trailing spaces)
19339 !! options
19340 parsoid
19341 !! wikitext
19342 <nowiki>=a=</nowiki>
19343
19344 <nowiki>=a=</nowiki>
19345
19346 <nowiki>=a=</nowiki>
19347
19348 <nowiki>=a=</nowiki>
19349 !! html
19350 <p>=a=</p>
19351 <p>=a= </p>
19352 <p>=a= </p>
19353 <p>=a= </p>
19354 !!end
19355
19356 !! test
19357 Headings: 6b. Heading chars in SOL context (with trailing newlines)
19358 !! options
19359 parsoid
19360 !! wikitext
19361 <nowiki>=a=
19362 b</nowiki>
19363
19364 <nowiki>=a=
19365 b</nowiki>
19366
19367 <nowiki>=a=
19368 b</nowiki>
19369
19370 <nowiki>=a=
19371 b</nowiki>
19372 !! html
19373 <p>=a=
19374 b</p>
19375 <p>=a=
19376 b</p>
19377 <p>=a=
19378 b</p>
19379 <p>=a=
19380 b</p>
19381 </p>
19382 !!end
19383
19384 !! test
19385 Headings: 6c. Heading chars in SOL context (leading newline break)
19386 !! options
19387 parsoid
19388 !! wikitext
19389 a
19390 <nowiki>=b=</nowiki>
19391 !! html
19392 <p>a
19393 =b=</p>
19394 !!end
19395
19396 !! test
19397 Headings: 6d. Heading chars in SOL context (with interspersed comments)
19398 !! options
19399 parsoid
19400 !! wikitext
19401 <!--c0--><nowiki>=a=</nowiki>
19402
19403 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
19404 !! html
19405 <p><!--c0-->=a=</p>
19406 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
19407 !!end
19408
19409 !! test
19410 Headings: 6d. Heading chars in SOL context (No escaping needed)
19411 !! options
19412 parsoid=html2wt
19413 !! wikitext
19414 =a=<div>b</div>
19415 !! html
19416 =a=<div>b</div>
19417 !!end
19418
19419 #### --------------- Lists ---------------
19420 #### 0. Outside nests (*foo, etc.)
19421 #### 1. Nested inside html <ul><li>*foo</li></ul>
19422 #### 2. Inside definition lists
19423 #### 3. Only bullets at start should be escaped
19424 #### 4. No escapes needed
19425 #### 5. No unnecessary escapes
19426 #### 6. Escape bullets in SOL position
19427 #### 7. Escape bullets in a multi-line context
19428 #### ----------------------------------------
19429
19430 !! test
19431 Lists: 0. Outside nests
19432 !! wikitext
19433 <nowiki>*</nowiki>foo
19434
19435 <nowiki>#</nowiki>foo
19436
19437 <nowiki>;Foo:</nowiki>bar
19438 !! html
19439 <p>*foo
19440 </p><p>#foo
19441 </p><p>;Foo:bar
19442 </p>
19443 !!end
19444
19445 !! test
19446 Lists: 1. Nested inside html
19447 !! wikitext
19448 *<nowiki>*foo</nowiki>
19449
19450 *<nowiki>#foo</nowiki>
19451
19452 *<nowiki>:foo</nowiki>
19453
19454 *<nowiki>;foo</nowiki>
19455
19456 #<nowiki>*foo</nowiki>
19457
19458 #<nowiki>#foo</nowiki>
19459
19460 #<nowiki>:foo</nowiki>
19461
19462 #<nowiki>;foo</nowiki>
19463 !! html
19464 <ul><li>*foo</li></ul>
19465 <ul><li>#foo</li></ul>
19466 <ul><li>:foo</li></ul>
19467 <ul><li>;foo</li></ul>
19468 <ol><li>*foo</li></ol>
19469 <ol><li>#foo</li></ol>
19470 <ol><li>:foo</li></ol>
19471 <ol><li>;foo</li></ol>
19472
19473 !!end
19474
19475 !! test
19476 Lists: 2. Inside definition lists
19477 !! wikitext
19478 ;<nowiki>;foo</nowiki>
19479
19480 ;<nowiki>:foo</nowiki>
19481
19482 ;<nowiki>:foo</nowiki>
19483 :bar
19484
19485 :<nowiki>:foo</nowiki>
19486 !! html
19487 <dl><dt>;foo</dt></dl>
19488 <dl><dt>:foo</dt></dl>
19489 <dl><dt>:foo</dt>
19490 <dd>bar</dd></dl>
19491 <dl><dd>:foo</dd></dl>
19492
19493 !!end
19494
19495 !! test
19496 Lists: 3. Only bullets at start of text should be escaped
19497 !! wikitext
19498 *<nowiki>*foo*bar</nowiki>
19499
19500 *<nowiki>*foo</nowiki>''it''*bar
19501 !! html
19502 <ul><li>*foo*bar</li></ul>
19503 <ul><li>*foo<i>it</i>*bar</li></ul>
19504
19505 !!end
19506
19507 !! test
19508 Lists: 4. No escapes needed
19509 !! options
19510 parsoid
19511 !! wikitext
19512 *foo*bar
19513
19514 *''foo''*bar
19515
19516 *[[Foo]]: bar
19517
19518 *[[Foo]]*bar
19519 !! html
19520 <ul>
19521 <li>foo*bar
19522 </li>
19523 </ul>
19524 <ul>
19525 <li><i>foo</i>*bar
19526 </li>
19527 </ul>
19528 <ul>
19529 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
19530 </li>
19531 </ul>
19532 <ul>
19533 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
19534 </li>
19535 </ul>
19536 !!end
19537
19538 !! test
19539 Lists: 5. No unnecessary escapes
19540 !! wikitext
19541 * bar <span><nowiki>[[foo]]</nowiki></span>
19542
19543 *=bar <span><nowiki>[[foo]]</nowiki></span>
19544
19545 *[[bar <span><nowiki>[[foo]]</nowiki></span>
19546
19547 *]]bar <span><nowiki>[[foo]]</nowiki></span>
19548
19549 *=bar <span>foo]]</span>=
19550
19551 * <s></s>: a
19552 !! html
19553 <ul><li> bar <span>[[foo]]</span></li></ul>
19554 <ul><li>=bar <span>[[foo]]</span></li></ul>
19555 <ul><li>[[bar <span>[[foo]]</span></li></ul>
19556 <ul><li>]]bar <span>[[foo]]</span></li></ul>
19557 <ul><li>=bar <span>foo]]</span>=</li></ul>
19558 <ul><li> <s></s>: a</li></ul>
19559
19560 !!end
19561
19562 !! test
19563 Lists: 6. Escape bullets in SOL position
19564 !! options
19565 parsoid
19566 !! wikitext
19567 <!--cmt--><nowiki>*foo</nowiki>
19568 !! html
19569 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
19570 !!end
19571
19572 !! test
19573 Lists: 7. Escape bullets in a multi-line context
19574 !! wikitext
19575 a
19576 <nowiki>*</nowiki>b
19577 !! html
19578 <p>a
19579 *b
19580 </p>
19581 !!end
19582
19583 #### --------------- HRs ---------------
19584 #### 1. Single line
19585 #### -----------------------------------
19586
19587 !! test
19588 HRs: 1. Single line
19589 !! options
19590 parsoid
19591 !! wikitext
19592 ----<nowiki>----</nowiki>
19593 ----=foo=
19594 ----*foo
19595 !! html
19596 <hr><span typeof="mw:Nowiki">----</span>
19597 <hr>=foo=
19598 <hr>*foo
19599 !! end
19600
19601 #### --------------- Tables ---------------
19602 #### 1a. Simple example
19603 #### 1b. No escaping needed (!foo)
19604 #### 1c. No escaping needed (|foo)
19605 #### 1d. No escaping needed (|}foo)
19606 ####
19607 #### 2a. Nested in td (<td>foo|bar</td>)
19608 #### 2b. Nested in td (<td>foo||bar</td>)
19609 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
19610 ####
19611 #### 3a. Nested in th (<th>foo!bar</th>)
19612 #### 3b. Nested in th (<th>foo!!bar</th>)
19613 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
19614 ####
19615 #### 4a. Escape -
19616 #### 4b. Escape +
19617 #### 4c. No escaping needed
19618 #### --------------------------------------
19619
19620 !! test
19621 Tables: 1a. Simple example
19622 !! wikitext
19623 <nowiki>{|
19624 |}</nowiki>
19625 !! html
19626 <p>{|
19627 |}
19628 </p>
19629 !! end
19630
19631 !! test
19632 Tables: 1b. No escaping needed
19633 !! wikitext
19634 !foo
19635 !! html
19636 <p>!foo
19637 </p>
19638 !! end
19639
19640 !! test
19641 Tables: 1c. No escaping needed
19642 !! wikitext
19643 |foo
19644 !! html
19645 <p>|foo
19646 </p>
19647 !! end
19648
19649 !! test
19650 Tables: 1d. No escaping needed
19651 !! wikitext
19652 |}foo
19653 !! html
19654 <p>|}foo
19655 </p>
19656 !! end
19657
19658 !! test
19659 Tables: 2a. Nested in td
19660 !! options
19661 parsoid=html2wt
19662 !! wikitext
19663 {|
19664 |<nowiki>foo|bar</nowiki>
19665 |-
19666 |x<div><nowiki>a|b</nowiki></div>
19667 |}
19668 !! html
19669 <table><tbody><tr>
19670 <td>foo|bar</td></tr>
19671 <tr><td>x<div>a|b</div></td>
19672 </tbody></table>
19673 !! end
19674
19675 !! test
19676 Tables: 2b. Nested in td
19677 !! options
19678 parsoid
19679 !! wikitext
19680 {|
19681 |<nowiki>foo||bar</nowiki>
19682 |''it''<nowiki>foo||bar</nowiki>
19683 |}
19684 !! html
19685 <table><tbody><tr>
19686 <td><span typeof="mw:Nowiki">foo||bar</span></td>
19687 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
19688 !! end
19689
19690 !! test
19691 Tables: 2c. Nested in td -- no escaping needed
19692 !! options
19693 parsoid
19694 !! wikitext
19695 {|
19696 |foo!!bar
19697 |}
19698 !! html
19699 <table><tbody><tr><td>foo!!bar
19700 </td></tr></tbody></table>
19701
19702 !! end
19703
19704 !! test
19705 Tables: 3a. Nested in th
19706 !! options
19707 parsoid
19708 !! wikitext
19709 {|
19710 !foo!bar
19711 |}
19712 !! html
19713 <table><tbody><tr><th>foo!bar
19714 </th></tr></tbody></table>
19715
19716 !! end
19717
19718 !! test
19719 Tables: 3b. Nested in th
19720 !! options
19721 parsoid
19722 !! wikitext
19723 {|
19724 !<nowiki>foo!!bar</nowiki>
19725 |}
19726 !! html
19727 <table>
19728 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
19729 </tbody></table>
19730 !! end
19731
19732 !! test
19733 Tables: 3c. Nested in th -- no escaping needed
19734 !! options
19735 parsoid
19736 !! wikitext
19737 {|
19738 !<nowiki>foo||bar</nowiki>
19739 |}
19740 !! html
19741 <table><tbody><tr>
19742 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
19743 !! end
19744
19745 !! test
19746 Tables: 4a. Escape -
19747 !! options
19748 parsoid
19749 !! wikitext
19750 {|
19751 !-bar
19752 |-
19753 |<nowiki>-bar</nowiki>
19754 |}
19755 !! html
19756 <table><tbody>
19757 <tr><th>-bar</th></tr>
19758 <tr>
19759 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
19760 !! end
19761
19762 !! test
19763 Tables: 4b. Escape +
19764 !! options
19765 parsoid
19766 !! wikitext
19767 {|
19768 !+bar
19769 |-
19770 |<nowiki>+bar</nowiki>
19771 |}
19772 !! html
19773 <table><tbody>
19774 <tr><th>+bar</th></tr>
19775 <tr>
19776 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
19777 !! end
19778
19779 !! test
19780 Tables: 4c. No escaping needed
19781 !! options
19782 parsoid
19783 !! wikitext
19784 {|
19785 |foo-bar
19786 |foo+bar
19787 |-
19788 |''foo''-bar
19789 |''foo''+bar
19790 |-
19791 |foo
19792 bar|baz
19793 +bar
19794 -bar
19795 |-
19796 |x
19797 <div>a|b</div>
19798 |}
19799 !! html
19800 <table><tbody>
19801 <tr><td>foo-bar</td><td>foo+bar</td></tr>
19802 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
19803 <tr><td>foo
19804 <p>bar|baz
19805 +bar
19806 -bar</p></td></tr>
19807 <tr><td>x
19808 <div>a|b</div></td>
19809 </tbody></table>
19810 !! end
19811
19812 !! test
19813 Tables: 4d. No escaping needed
19814 !! options
19815 parsoid
19816 !! wikitext
19817 {|
19818 |[[Foo]]-bar
19819 ||+1
19820 ||-2
19821 |}
19822 !! html
19823 <table>
19824 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
19825 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
19826 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
19827 </tbody></table>
19828 !! end
19829
19830 !! test
19831 Tables: Digest broken attributes on table and tr tag
19832 !! options
19833 parsoid=wt2html
19834 !! wikitext
19835 {| || |} ++
19836 |- || || ++ --
19837 |- > [
19838 |}
19839 !! html
19840 <table>
19841 <tbody>
19842 <tr></tr>
19843 <tr></tr>
19844 </tbody></table>
19845 !! end
19846
19847 #### --------------- Links ----------------
19848 #### 1. Quote marks in link text
19849 #### 2. Wikilinks: Escapes needed
19850 #### 3. Wikilinks: No escapes needed
19851 #### 4. Extlinks: Escapes needed
19852 #### 5. Extlinks: No escapes needed
19853 #### --------------------------------------
19854 !! test
19855 Links 1. Quote marks in link text
19856 !! options
19857 parsoid
19858 !! wikitext
19859 [[Foo|Foo<nowiki>''boo''</nowiki>]]
19860 !! html
19861 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
19862 !! end
19863
19864 !! test
19865 Links 2. WikiLinks: Escapes needed
19866 !! options
19867 parsoid
19868 !! wikitext
19869 [[Foo|[Foobar]]]
19870 [[Foo|<nowiki>Foobar]</nowiki>]]
19871 [[Foo|x [Foobar] x]]
19872 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
19873 [[Foo|<nowiki>[[Bar]]</nowiki>]]
19874 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
19875 [[Foo|<nowiki>|Bar</nowiki>]]
19876 [[Foo|<nowiki>]]bar</nowiki>]]
19877 [[Foo|<nowiki>[[bar</nowiki>]]
19878 [[Foo|<nowiki>x [[ y</nowiki>]]
19879 [[Foo|<nowiki>x ]] y</nowiki>]]
19880 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
19881 !! html
19882 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
19883 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
19884 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
19885 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
19886 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
19887 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
19888 <a href="Foo" rel="mw:WikiLink">|Bar</a>
19889 <a href="Foo" rel="mw:WikiLink">]]bar</a>
19890 <a href="Foo" rel="mw:WikiLink">[[bar</a>
19891 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
19892 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
19893 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
19894 !! end
19895
19896 !! test
19897 Links 3. WikiLinks: No escapes needed
19898 !! options
19899 parsoid
19900 !! wikitext
19901 [[Foo|[Foobar]]
19902 [[Foo|foo|bar]]
19903 !! html
19904 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
19905 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
19906 !! end
19907
19908 !! test
19909 Links 4. ExtLinks: Escapes needed
19910 !! options
19911 parsoid
19912 !! wikitext
19913 [http://google.com <nowiki>[google]</nowiki>]
19914 [http://google.com <nowiki>google]</nowiki>]
19915
19916 <nowiki>[http://google.com]</nowiki>
19917
19918 <nowiki>[http://google.com google]</nowiki>
19919
19920 !! html
19921 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
19922 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
19923 <p>[http://google.com]</p>
19924 <p>[http://google.com google]</p>
19925 !! end
19926
19927 !! test
19928 Links 5. ExtLinks: No escapes needed
19929 !! options
19930 parsoid
19931 !! wikitext
19932 [http://google.com [google]
19933 !! html
19934 <a href="http://google.com" rel="mw:ExtLink">[google</a>
19935 !! end
19936
19937 !! test
19938 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
19939 !! html/parsoid
19940 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
19941 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
19942 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
19943 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
19944 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
19945 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
19946 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19947 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
19948 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19949 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
19950 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
19951 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
19952 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
19953 </p>
19954 !! wikitext
19955 x<nowiki/>http://example.com<nowiki/>y
19956 http://example.com<nowiki/>?x
19957 http://example.com<nowiki/>&x
19958 http://example.com<nowiki/>'x
19959 http://example.com<nowiki/>,x
19960 http://example.com<nowiki/>.x
19961 http://example.com<nowiki/>;x
19962 http://example.com<nowiki/>:x
19963 http://example.com<nowiki/>;x
19964 http://example.com<nowiki/>!x
19965 http://example.com<nowiki/>=x
19966 http://example.com<nowiki/>(x)
19967 http://example.com(x<nowiki/>)
19968 !! end
19969
19970 !! test
19971 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19972 !! html/parsoid
19973 <p>x
19974 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
19975 y
19976 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
19977 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
19978 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
19979 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
19980 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
19981 </p>
19982 !! wikitext
19983 x
19984 http://example.com
19985 y
19986 "http://example.com"
19987 (http://example.com)
19988 (http://example.com) foo
19989 http://example.com,
19990 http://example.com, foo
19991 !! end
19992
19993 ## Parsoid currently fails wt2html on this one!
19994 !! test
19995 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19996 !! html/parsoid
19997 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
19998 !! wikitext
19999 http://example.com.,;:!?
20000 !! end
20001
20002 !! test
20003 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
20004 !! html/parsoid
20005 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
20006 !! wikitext
20007 RFC 123<nowiki/>4
20008 !! end
20009
20010 !! test
20011 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
20012 !! html/parsoid
20013 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20014 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20015 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
20016 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
20017 </p>
20018 !! wikitext
20019 xRFC 123y
20020 XRFC 123y
20021 RFC 123?foo
20022 RFC 123&foo
20023 !! end
20024
20025 !! test
20026 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
20027 !! html/parsoid
20028 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
20029 !! wikitext
20030 PMID 123<nowiki/>4
20031 !! end
20032
20033 !! test
20034 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
20035 !! html/parsoid
20036 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20037 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20038 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
20039 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
20040 </p>
20041 !! wikitext
20042 xPMID 123y
20043 XPMID 123y
20044 PMID 123?foo
20045 PMID 123&foo
20046 !! end
20047
20048 !! test
20049 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
20050 !! html/parsoid
20051 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
20052 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
20053 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
20054 </p>
20055 !! wikitext
20056 ISBN 1234567890<nowiki/>1
20057 ISBN 1234567890<nowiki/>x
20058 ISBN 1234567890<nowiki/>b
20059 !! end
20060
20061 !! test
20062 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
20063 !! html/parsoid
20064 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
20065 !! wikitext
20066 ISBN 1234567890's
20067 !! end
20068
20069 #### --------------- Quotes ---------------
20070 #### 1. Quotes inside <b> and <i>
20071 #### 2. Link fragments separated by <i> and <b> tags
20072 #### 3. Link fragments inside <i> and <b>
20073 #### 4. No escaping needed
20074 #### --------------------------------------
20075 !! test
20076 1. Quotes inside <b> and <i>
20077 !! options
20078 parsoid=html2wt,wt2wt
20079 !! wikitext
20080 ''<nowiki>'foo'</nowiki>''
20081 ''<nowiki>''foo''</nowiki>''
20082 ''<nowiki>'''foo'''</nowiki>''
20083 ''foo''<nowiki/>'s
20084 '''<nowiki>'foo'</nowiki>'''
20085 '''<nowiki>''foo''</nowiki>'''
20086 '''<nowiki>'''foo'''</nowiki>'''
20087 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
20088 '''foo'''<nowiki/>'s
20089 '''foo''
20090 ''foo''<nowiki/>'
20091 '<nowiki/>''foo''<nowiki/>'
20092 ''''foo'''
20093 '''foo'''<nowiki/>'
20094 '<nowiki/>'''foo'''<nowiki/>'
20095 ''fools'<span> errand</span>''
20096 ''<span>fool</span>'s errand''
20097 !! html
20098 <p><i>'foo'</i>
20099 <i>''foo''</i>
20100 <i>'''foo'''</i>
20101 <i>foo</i>'s
20102 <b>'foo'</b>
20103 <b>''foo''</b>
20104 <b>'''foo'''</b>
20105 <b>foo'<i>bar'</i>baz</b>
20106 <b>foo</b>'s
20107 '<i>foo</i>
20108 <i>foo</i>'
20109 '<i>foo</i>'
20110 '<b>foo</b>
20111 <b>foo</b>'
20112 '<b>foo</b>'</p>
20113 <i>fools'<span> errand</span></i>
20114 <i><span>fool</span>'s errand</i>
20115 !! end
20116
20117 !! test
20118 2. Link fragments separated by <i> and <b> tags
20119 !! wikitext
20120 [[''foo''<nowiki>hello]]</nowiki>
20121
20122 [['''foo'''<nowiki>hello]]</nowiki>
20123 !! html
20124 <p>[[<i>foo</i>hello]]
20125 </p><p>[[<b>foo</b>hello]]
20126 </p>
20127 !! end
20128
20129 !! test
20130 3. Link fragments inside <i> and <b>
20131 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
20132 this is one of the shortcomings of this format)
20133 !! wikitext
20134 ''[[foo''<nowiki>]]</nowiki>
20135
20136 '''[[foo'''<nowiki>]]</nowiki>
20137 !! html
20138 <p><i>[[foo</i>]]
20139 </p><p><b>[[foo</b>]]
20140 </p>
20141 !! end
20142
20143 !! test
20144 4. No escaping needed
20145 !! wikitext
20146 '<span>''bar''</span>'
20147 '<span>'''bar'''</span>'
20148 !! html
20149 <p>'<span><i>bar</i></span>'
20150 '<span><b>bar</b></span>'
20151 </p>
20152 !! end
20153
20154 #### ----------- Paragraphs ---------------
20155 #### 1. No unnecessary escapes
20156 #### --------------------------------------
20157
20158 !! test
20159 1. No unnecessary escapes
20160 !! wikitext
20161 bar <span><nowiki>[[foo]]</nowiki></span>
20162
20163 =bar <span><nowiki>[[foo]]</nowiki></span>
20164
20165 [[bar <span><nowiki>[[foo]]</nowiki></span>
20166
20167 ]]bar <span><nowiki>[[foo]]</nowiki></span>
20168
20169 =bar <span>foo]]</span><nowiki>=</nowiki>
20170 !! html
20171 <p>bar <span>[[foo]]</span>
20172 </p><p>=bar <span>[[foo]]</span>
20173 </p><p>[[bar <span>[[foo]]</span>
20174 </p><p>]]bar <span>[[foo]]</span>
20175 </p><p>=bar <span>foo]]</span>=
20176 </p>
20177 !!end
20178
20179 #### ----------------------- PRE --------------------------
20180 #### 1. Leading whitespace in SOL context should be escaped
20181 #### ------------------------------------------------------
20182 !! test
20183 1. Leading whitespace in SOL context should be escaped
20184 !! options
20185 parsoid
20186 !! wikitext
20187 <nowiki> </nowiki>a
20188
20189 <nowiki> </nowiki> a
20190
20191 <nowiki> </nowiki>a(tab)
20192
20193 <nowiki> </nowiki> a
20194 <!--cmt-->
20195 <nowiki> </nowiki> a
20196
20197 a
20198 <nowiki> </nowiki>b
20199
20200 a
20201 <nowiki> </nowiki>b
20202
20203 a
20204 <nowiki> </nowiki> b
20205 !! html
20206 <p> a</p>
20207 <p> a</p>
20208 <p> a(tab)</p>
20209 <p> a</p>
20210 <p><!--cmt--> a</p>
20211 <p>a
20212 b</p>
20213 <p>a
20214 b</p>
20215 <p>a
20216 b</p>
20217 !! end
20218
20219 !! test
20220 2. Leading whitespace in non-indent-pre contexts should not be escaped
20221 !! options
20222 parsoid
20223 !! wikitext
20224 foo <ref>''a''
20225 b</ref>
20226 !! html
20227 <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>
20228 !! end
20229
20230 !! test
20231 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
20232 !! options
20233 parsoid
20234 !! wikitext
20235 <blockquote>
20236 a
20237 <span>b</span>
20238 c
20239 </blockquote>
20240 !! html
20241 <blockquote>
20242 <p>
20243 a
20244 <span>b</span>
20245 c</p>
20246 </blockquote>
20247 !! end
20248
20249 !! test
20250 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
20251 !! options
20252 parsoid
20253 !! wikitext
20254 [[File:Foobar.jpg|thumb|caption]]
20255 !! html
20256 !! html/parsoid
20257 <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>
20258 !! end
20259
20260 !! test
20261 5. Nowiki escaping should account for indent-pres
20262 !! options
20263 parsoid=html2wt
20264 !! html
20265 <pre>==foo==</pre>
20266 !! wikitext
20267 ==foo==
20268 !! end
20269
20270 #### --------------- Behavior Switches --------------------
20271 !! test
20272 1. Valid behavior switches should be escaped
20273 !! options
20274 parsoid=html2wt
20275 !! wikitext
20276 <nowiki>__TOC__</nowiki>
20277 ''<nowiki>__TOC__</nowiki>''
20278 !! html
20279 __TOC__
20280 <i>__TOC__</i>
20281 !! end
20282
20283 !! test
20284 2. Invalid behavior switches should not be escaped
20285 !! options
20286 parsoid=html2wt
20287 !! wikitext
20288 __TOO__
20289 __|__
20290 !! html
20291 __TOO__
20292 __|__
20293 !! end
20294
20295 #### --------------- HTML tags ---------------
20296 #### 1. a tags
20297 #### 2. other tags
20298 #### 3. multi-line html tag
20299 #### 4. extension tags
20300 #### -----------------------------------------
20301 !! test
20302 1. a tags
20303 !! options
20304 parsoid
20305 !! wikitext
20306 <a href="http://google.com">google</a>
20307 !! html
20308 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
20309 !! end
20310
20311 !! test
20312 2. other tags
20313 !! wikitext
20314 <nowiki><div>foo</div>
20315 <div style="color:red">foo</div></nowiki>
20316 !! html
20317 <p>&lt;div&gt;foo&lt;/div&gt;
20318 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
20319 </p>
20320 !! end
20321
20322 !! test
20323 3. multi-line html tag
20324 !! wikitext
20325 <nowiki><div
20326 >foo</div
20327 ></nowiki>
20328 !! html
20329 <p>&lt;div
20330 &gt;foo&lt;/div
20331 &gt;
20332 </p>
20333 !! end
20334
20335 !! test
20336 4. extension tags
20337 !! wikitext
20338 <nowiki><ref>foo</ref></nowiki>
20339
20340 <nowiki><ref>bar</nowiki>
20341
20342 baz<nowiki></ref></nowiki>
20343 !! html
20344 <p>&lt;ref&gt;foo&lt;/ref&gt;
20345 </p><p>&lt;ref&gt;bar
20346 </p><p>baz&lt;/ref&gt;
20347 </p>
20348 !! end
20349
20350 #### --------------- Others ---------------
20351 !! test
20352 Escaping nowikis
20353 !! wikitext
20354 &lt;nowiki&gt;foo&lt;/nowiki&gt;
20355 !! html
20356 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
20357 </p>
20358 !! end
20359
20360 ## The quote-char in the input is necessary for triggering the bug
20361 !! test
20362 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
20363 !! options
20364 parsoid=wt2wt,html2wt
20365 !! wikitext
20366 foo's bar :
20367 !! html
20368 <p>foo's bar :</p>
20369 !! end
20370
20371 !! test
20372
20373 Tag-like HTML structures are passed through as text
20374 !! wikitext
20375 <x y>
20376
20377 <x.y>
20378
20379 <x-y>
20380
20381 1>2
20382
20383 x<y
20384
20385 a>b
20386
20387 1<d e>f
20388 !! html
20389 <p>&lt;x y&gt;
20390 </p><p>&lt;x.y&gt;
20391 </p><p>&lt;x-y&gt;
20392 </p><p>1&gt;2
20393 </p><p>x&lt;y
20394 </p><p>a&gt;b
20395 </p><p>1&lt;d e&gt;f
20396 </p>
20397 !! end
20398
20399
20400 # This was a bug in the PHP parser (see bug 17663 and its dups,
20401 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
20402 !! test
20403 Tag names followed by punctuation should not be recognized as tags
20404 !! wikitext
20405 <s.ome> text
20406 !! html
20407 <p>&lt;s.ome&gt; text
20408 </p>
20409 !! end
20410
20411 !! test
20412 HTML tag with necessary entities in attributes
20413 !! wikitext
20414 <span title="&amp;amp;">foo</span>
20415 !! html
20416 <p><span title="&amp;amp;">foo</span>
20417 </p>
20418 !! end
20419
20420 !! test
20421 HTML tag with 'unnecessary' entity encoding in attributes
20422 !! wikitext
20423 <span title="&amp;">foo</span>
20424 !! html
20425 <p><span title="&amp;">foo</span>
20426 </p>
20427 !! end
20428
20429 !! test
20430 HTML tag with broken attribute value quoting
20431 !! wikitext
20432 <span title="Hello world>Foo</span>
20433 !! html
20434 <p><span>Foo</span>
20435 </p>
20436 !! end
20437
20438 !! test
20439 Parsoid-only: HTML tag with broken attribute value quoting
20440 !! options
20441 parsoid
20442 !! wikitext
20443 <span title="Hello world>Foo</span>
20444 !! html
20445 <p><span title="Hello world">Foo</span>
20446 </p>
20447 !! end
20448
20449 !! test
20450 Table with broken attribute value quoting
20451 !! wikitext
20452 {|
20453 | title="Hello world|Foo
20454 |}
20455 !! html
20456 <table>
20457 <tr>
20458 <td>Foo
20459 </td></tr></table>
20460
20461 !! end
20462
20463 !! test
20464 Table with broken attribute value quoting on consecutive lines
20465 !! wikitext
20466 {|
20467 | title="Hello world|Foo
20468 | style="color:red|Bar
20469 |}
20470 !! html
20471 <table>
20472 <tr>
20473 <td>Foo
20474 </td>
20475 <td>Bar
20476 </td></tr></table>
20477
20478 !! end
20479
20480 !! test
20481 Parsoid-only: Table with broken attribute value quoting on consecutive lines
20482 !! options
20483 parsoid
20484 !! wikitext
20485 {|
20486 | title="Hello world|Foo
20487 | style="color:red|Bar
20488 |}
20489 !! html
20490 <table><tbody>
20491 <tr>
20492 <td title="Hello world">Foo
20493 </td><td style="color: red">Bar
20494 </td></tr></tbody></table>
20495
20496 !! end
20497
20498 !! test
20499 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
20500 !! options
20501 parsoid
20502 !! wikitext
20503 {{}}
20504 !! html
20505 {{}}
20506 !! end
20507
20508 !! test
20509 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
20510 !! options
20511 parsoid
20512 !! wikitext
20513 }}{{
20514 !! html
20515 }}{{
20516 !! end
20517
20518 !!test
20519 Accept empty td cell attribute
20520 !! wikitext
20521 {|
20522 | align="center" | foo || |
20523 |}
20524 !! html
20525 <table>
20526 <tr>
20527 <td align="center"> foo </td>
20528 <td>
20529 </td></tr></table>
20530
20531 !!end
20532
20533 !!test
20534 Non-empty attributes in th-cells
20535 !! wikitext
20536 {|
20537 ! Foo !! style="color: red" | Bar
20538 |}
20539 !! html
20540 <table>
20541 <tr>
20542 <th> Foo </th>
20543 <th style="color: red"> Bar
20544 </th></tr></table>
20545
20546 !!end
20547
20548 !!test
20549 Accept empty attributes in th-cells
20550 !! wikitext
20551 {|
20552 !| foo !!| bar
20553 |}
20554 !! html
20555 <table>
20556 <tr>
20557 <th> foo </th>
20558 <th> bar
20559 </th></tr></table>
20560
20561 !!end
20562
20563 !!test
20564 Empty table rows go away
20565 !! wikitext
20566 {|
20567 | Hello
20568 | there
20569 |- class="foo"
20570 |-
20571 |}
20572 !! html
20573 <table>
20574 <tr>
20575 <td> Hello
20576 </td>
20577 <td> there
20578 </td></tr>
20579
20580 </table>
20581
20582 !! end
20583
20584 ###
20585 ### Parsoid-centric tests for testing RTing of inter-element separators
20586 ### Edge cases not tested by existing parser tests and specific to
20587 ### Parsoid-specific serialization strategies.
20588 ###
20589
20590 !!test
20591 RT-ed inter-element separators should be valid separators
20592 !! wikitext
20593 {|
20594 |- [[foo]]
20595 |}
20596 !! html
20597 <table>
20598
20599 </table>
20600
20601 !!end
20602
20603 !!test
20604 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
20605 (Parsoid-only since PHP parser relies on Tidy for correct output)
20606 !!options
20607 parsoid
20608 !! wikitext
20609 {|
20610 |<small>foo
20611 bar
20612 |}
20613
20614 {|
20615 |<small>foo<small>
20616 |}
20617 !! html
20618 !!end
20619
20620 !!test
20621 Empty TD followed by TD with tpl-generated attribute
20622 !! wikitext
20623 {|
20624 |-
20625 |
20626 |{{echo|style='color:red'}}|foo
20627 |}
20628 !! html
20629 <table>
20630
20631 <tr>
20632 <td>
20633 </td>
20634 <td>foo
20635 </td></tr></table>
20636
20637 !!end
20638
20639 !!test
20640 Indented table with an empty td
20641 !! wikitext
20642 {|
20643 |-
20644 |
20645 |foo
20646 |}
20647 !! html
20648 <table>
20649
20650 <tr>
20651 <td>
20652 </td>
20653 <td>foo
20654 </td></tr></table>
20655
20656 !!end
20657
20658 !!test
20659 Indented block & table
20660 !! wikitext
20661 <div>foo</div>
20662 {|
20663 |foo
20664 |}
20665 !! html/php
20666 <div>foo</div>
20667 <table>
20668 <tr>
20669 <td>foo
20670 </td></tr></table>
20671
20672 !! html/parsoid
20673 <div data-parsoid='{"stx":"html"}'>foo</div>
20674 <table><tbody>
20675 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
20676 </tbody></table>
20677 !!end
20678
20679 !! test
20680 Indent and comment before table row
20681 !! wikitext
20682 {|
20683 <!--hi-->|-
20684 | there
20685 |}
20686 !! html/php
20687 <table>
20688
20689 <tr>
20690 <td> there
20691 </td></tr></table>
20692
20693 !! html/parsoid
20694 <table data-parsoid='{}'>
20695 <!--hi--><tbody data-parsoid='{}'><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
20696 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
20697 </tbody></table>
20698 !! end
20699
20700 !!test
20701 Empty TR followed by a template-generated TR
20702 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
20703 !!options
20704 parsoid
20705 !! wikitext
20706 {|
20707 |-
20708 {{echo|<tr><td>foo</td></tr>}}
20709 |}
20710 !! html
20711 <table>
20712 <tbody>
20713 <tr></tr>
20714 <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}}]}'>
20715 <td>foo</td></tr>
20716 </tbody></table>
20717 !!end
20718
20719 ## PHP and parsoid output differ for this, and since this is primarily
20720 ## for testing Parsoid's serializer, marking this Parsoid only
20721 !!test
20722 Empty TR followed by mixed-ws-comment line should RT correctly
20723 !!options
20724 parsoid
20725 !! wikitext
20726 {|
20727 |-
20728 <!--c-->
20729 |-
20730 <!--c--> <!--d-->
20731 |}
20732 !! html
20733 <table>
20734 <tbody>
20735 <tr></tr>
20736 <!--c-->
20737 <tr>
20738 <!--c--> </tr><!--d-->
20739 </tbody></table>
20740
20741 !!end
20742
20743 !!test
20744 Multi-line image caption generated by templates with/without trailing newlines
20745 !!options
20746 parsoid
20747 !! wikitext
20748 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
20749 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
20750 !! html
20751 <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>
20752 <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>
20753
20754 !!end
20755
20756 !! test
20757 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
20758 !! options
20759 parsoid=html2wt
20760 !! wikitext
20761 <includeonly>foo</includeonly>
20762 new para
20763
20764 [[./Category:Foo]]
20765
20766 = new heading =
20767 !! html
20768 <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>
20769
20770 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
20771 !! end
20772
20773 ## PHP emits broken html for this, and since this is primarily
20774 ## a Parsoid serializer test, marking this Parsoid only
20775 !!test
20776 Improperly nested inline or quotes tags with whitespace in between
20777 !!options
20778 parsoid
20779 !! wikitext
20780 <span> <s>x</span> </s>
20781 ''' ''x''' ''
20782 !! html
20783 <p><span> <s>x</s></span><s> </s>
20784 <b> <i>x</i></b><i> </i>
20785 </p>
20786 !!end
20787
20788 !!test
20789 Encapsulate protected attributes from wt
20790 !!options
20791 parsoid
20792 !! wikitext
20793 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
20794 !! html
20795 <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>
20796 </body>
20797 !!end
20798
20799 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
20800 ## Having nested or stray pre tags results in the attempt to add duplicates,
20801 ## causing an assertion fail. This test tries to prevent that situation.
20802 !!test
20803 Ensure ParagraphWrapper can deal with stray closing pre tags
20804 !!options
20805 parsoid=wt2html
20806 !! wikitext
20807 plain text</pre>
20808 !! html
20809 plain text
20810 !!end
20811
20812 !!test
20813 1. Ensure fostered text content is wrapped in spans
20814 !!options
20815 parsoid=wt2html
20816 !! wikitext
20817 <table>hi</table><table>ho</table>
20818 !! html
20819 <span>hi</span>
20820 <table></table>
20821 <span>ho</span>
20822 <table></table>
20823 !!end
20824
20825 !!test
20826 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
20827 !!options
20828 parsoid=wt2html,wt2wt
20829 !! wikitext
20830 <table>
20831 <tr> || ||
20832 <td> a
20833 </table>
20834 !! html
20835 <span> || ||</span>
20836 <table>
20837 <tbody>
20838 <tr>
20839 <td> a</td></tr>
20840 </tbody></table>
20841 !!end
20842
20843 !!test
20844 Encapsulation properly handles null DSR information from foster box
20845 !!options
20846 parsoid=wt2html,wt2wt
20847 !! wikitext
20848 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
20849 !! html
20850 <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;
20851 <table>foo
20852 <tr>
20853 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
20854 <table>
20855 <tbody>
20856 <tr>
20857 <td>bar</td></tr></tbody></table>
20858 !!end
20859
20860 !!test
20861 1. Encapsulate foster-parented transclusion content
20862 !!options
20863 parsoid=wt2wt,wt2html
20864 !! wikitext
20865 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
20866 !! html
20867 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20868 <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
20869 <tr>
20870 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
20871 <table>
20872 <tbody>
20873 <tr>
20874 <td>bar</td></tr></tbody></table>
20875 !!end
20876
20877 !!test
20878 2. Encapsulate foster-parented transclusion content
20879 !!options
20880 parsoid=wt2wt,wt2html
20881 !! wikitext
20882 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
20883 !! html
20884 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20885 <table>
20886 <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>
20887 <tr>
20888 <td>bar</td></tr></table>&quot;]}">foo</div>
20889 <table>
20890 <tbody>
20891 <tr>
20892 <td>bar</td></tr></tbody></table>
20893 !!end
20894
20895 !!test
20896 3. Encapsulate foster-parented transclusion content
20897 !!options
20898 parsoid=wt2wt,wt2html
20899 !! wikitext
20900 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20901 !! html
20902 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20903 <table>
20904 <div>
20905 <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>
20906 <tr>
20907 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20908 <p>foo</p></div>
20909 <table>
20910 <tbody>
20911 <tr>
20912 <td>bar</td></tr></tbody></table>
20913 !!end
20914
20915 !!test
20916 4. Encapsulate foster-parented transclusion content
20917 !!options
20918 parsoid=wt2wt,wt2html
20919 !! wikitext
20920 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20921 !! html
20922 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20923 <table>
20924 <div>
20925 <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>
20926 <tr>
20927 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20928 <p>foo</p></div>
20929 <table>
20930 <tbody>
20931 <tr>
20932 <td>bar</td></tr></tbody></table>
20933 !!end
20934
20935 !!test
20936 5. Encapsulate foster-parented transclusion content
20937 !!options
20938 parsoid=wt2wt,wt2html
20939 !! wikitext
20940 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
20941 !! html
20942 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20943 <table>
20944 <tr>
20945 <td>
20946 <div>
20947 <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>
20948 <table>
20949 <tbody>
20950 <tr>
20951 <td>
20952 <div>
20953 <p>foo</p></div></td></tr></tbody></table>
20954 !!end
20955
20956 !!test
20957 6. Encapsulate foster-parented transclusion content
20958 !!options
20959 parsoid=wt2wt,wt2html
20960 !! wikitext
20961 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
20962 !! html
20963 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20964 <table>
20965 <tr>
20966 <td>
20967 <div>
20968 <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>
20969 <table>
20970 <tbody>
20971 <tr>
20972 <td>
20973 <div>
20974 <p>foo</p></div></td></tr></tbody></table>
20975 <p>ok</p>
20976 !!end
20977
20978 !!test
20979 7. Encapsulate foster-parented transclusion content
20980 !!options
20981 parsoid=wt2wt,wt2html
20982 !! wikitext
20983 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
20984 !! html
20985 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20986 <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;
20987 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
20988 <td>bar</td></table>&quot;]}">foo</p>
20989 <table>
20990 <tbody>
20991 <tr>
20992 <td>bar</td></tr></tbody></table>
20993 !!end
20994
20995 !!test
20996 8. Encapsulate foster-parented transclusion content
20997 !!options
20998 parsoid=wt2wt,wt2html
20999 !! wikitext
21000 {{echo|a
21001 }}{|{{echo|style='color:red'}}
21002 |-
21003 |b
21004 |}
21005 !! html
21006 <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>
21007 <table>
21008 <tbody>
21009 <tr>
21010 <td>b</td></tr></tbody></table>
21011 !!end
21012
21013 !!test
21014 9. Encapsulate foster-parented transclusion content
21015 !!options
21016 parsoid=wt2wt,wt2html
21017 !! wikitext
21018 <table>{{echo|hi</table>hello}}
21019 !! html
21020 <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>
21021 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
21022 !!end
21023
21024 !!test
21025 Table in fosterable position
21026 !!options
21027 parsoid=wt2html,wt2wt
21028 !! wikitext
21029 {{OpenTable}}
21030 <div>
21031 {|
21032 |}
21033 </div>
21034 |}
21035 !! html
21036 <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="{}">
21037 </span>
21038 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
21039
21040 <table>
21041 </table>
21042 !!end
21043
21044 # Parsoid only for bug 64747
21045 !! test
21046 Properly encapsulate empty-content transclusions in fosterable positions
21047 !! wikitext
21048 <table>
21049 {{#if:|
21050 <td>foo</td>
21051 }}
21052 </table>
21053 !! html/parsoid
21054 <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>"}'>
21055
21056 </table>
21057 !! end
21058
21059 !!test
21060 Support <object> element with .data attribute
21061 !!options
21062 parsoid=html2wt
21063 !! wikitext
21064 <object data="test.swf"></object>
21065 !! html
21066 <object data="test.swf"></object>
21067 !!end
21068
21069 # -----------------------------------------------------------------
21070 # The following section of tests are primarily to spec requirements
21071 # around serialization of new/edited content.
21072 #
21073 # All these tests are marked Parsoid html2wt and html2html only
21074 # ----------------------------------------------------------------
21075
21076 !! test
21077 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
21078 !! options
21079 parsoid=html2wt
21080 language=es
21081 !! wikitext
21082 [[Foo]]
21083 !! html
21084 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Foo">Foo</a></p>
21085 !! end
21086
21087 !! test
21088 Image: Modifying size of an image (1)
21089 !! options
21090 parsoid={
21091 "modes": ["wt2wt"],
21092 "changes": [
21093 ["img[height]", "attr", "height", "22"],
21094 ["img[width]", "attr", "width", "200"]
21095 ]
21096 }
21097 !! wikitext
21098 [[Image:Foobar.jpg|230x230px]]
21099 !! wikitext/edited
21100 [[Image:Foobar.jpg|200x200px]]
21101 !!end
21102
21103 !! test
21104 Image: Modifying size of an image (2)
21105 !! options
21106 parsoid={
21107 "modes": ["wt2wt"],
21108 "changes": [
21109 ["img[height]", "attr", "height", "100"],
21110 ["img[width]", "attr", "width", "500"]
21111 ]
21112 }
21113 !! wikitext
21114 [[Image:Foobar.jpg|230x230px]]
21115 !! wikitext/edited
21116 [[Image:Foobar.jpg|500x500px]]
21117 !!end
21118
21119 # Change in size is ignored so long as class='mw-default-size'
21120 !! test
21121 Image: Modifying size of an image (3)
21122 !! options
21123 parsoid={
21124 "modes": ["wt2wt"],
21125 "changes": [
21126 ["figure[class]", "removeClass", "mw-default-size"],
21127 ["figure img", "attr", "height", "19"],
21128 ["figure img", "attr", "width", "170"]
21129 ]
21130 }
21131 !! wikitext
21132 [[Image:Foobar.jpg|thumb]]
21133 !! wikitext/edited
21134 [[Image:Foobar.jpg|thumb|170x170px]]
21135 !!end
21136
21137 !! test
21138 Image: Modifying alignment of an image (bug 48665)
21139 !! options
21140 parsoid={
21141 "modes": ["wt2wt"],
21142 "changes": [
21143 ["figure[class]", "removeClass", "mw-halign-right"],
21144 ["figure[class]", "addClass", "mw-halign-left"]
21145 ]
21146 }
21147 !! wikitext
21148 [[Image:Foobar.jpg|thumb|caption|right]]
21149 !! wikitext/edited
21150 [[Image:Foobar.jpg|thumb|caption|left]]
21151 !! end
21152
21153 !! test
21154 Image: Modifying mw-default-size of an frameless image (bug 62805)
21155 !! options
21156 parsoid={
21157 "modes": ["wt2wt"],
21158 "changes": [
21159 ["figure.mw-default-size", "removeClass", "mw-default-size"]
21160 ]
21161 }
21162 !! wikitext
21163 [[Image:Foobar.jpg|frameless|right]]
21164 !! wikitext/edited
21165 [[Image:Foobar.jpg|frameless|right|220x220px]]
21166 !! end
21167
21168 !! test
21169 Image: Modifying valign of an image (bug 49221)
21170 !! options
21171 parsoid={
21172 "modes": ["wt2wt"],
21173 "changes": [
21174 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
21175 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
21176 ]
21177 }
21178 !! wikitext
21179 [[File:Foobar.jpg|20px|middle]]
21180 !! wikitext/edited
21181 [[File:Foobar.jpg|20px|text-top]]
21182 !! end
21183
21184 !! test
21185 Image: Modifying alt attribute of an image (bug 56400)
21186 !! options
21187 parsoid={
21188 "modes": ["wt2wt"],
21189 "changes": [
21190 ["img[alt]", "attr", "alt", "some alternate edited text"]
21191 ]
21192 }
21193 !! wikitext
21194 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
21195 !! wikitext/edited
21196 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
21197 !!end
21198
21199 !! test
21200 Image: Modifying caption of an image
21201 !! options
21202 parsoid={
21203 "modes": ["wt2wt"],
21204 "changes": [
21205 ["figcaption", "text", "new caption"]
21206 ]
21207 }
21208 !! wikitext
21209 [[Image:Foobar.jpg|thumb|original caption]]
21210 !! wikitext/edited
21211 [[Image:Foobar.jpg|thumb|new caption]]
21212 !!end
21213
21214 !! test
21215 Image: empty alt attribute (bug 48924)
21216 !! options
21217 parsoid
21218 !! wikitext
21219 [[File:Foobar.jpg|thumb|alt=|bar]]
21220 !! html
21221 <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>
21222 !! end
21223
21224 #!! test
21225 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
21226 #!! options
21227 #parsoid=html2wt
21228 #language=ar
21229 #!! input
21230 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
21231 #!! result
21232 #<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>
21233 #!! end
21234
21235 !! test
21236 Image: Block level image should have \n before and after
21237 !! options
21238 parsoid
21239 !! wikitext
21240 123
21241 [[File:Foobar.jpg|right|thumb|150x150px]]
21242 456
21243 !! html
21244 <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>
21245 !!end
21246
21247 !! test
21248 Image: New block level image should have \n before and after (existing
21249 content)
21250 !! options
21251 parsoid
21252 !! wikitext
21253 123
21254 [[File:Foobar.jpg|right|thumb|150x150px]]
21255 456
21256 !! html
21257 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
21258 <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>
21259 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
21260 !!end
21261
21262 !! test
21263 Image: upright option (parsoid)
21264 !! options
21265 parsoid
21266 !! wikitext
21267 [[File:Foobar.jpg|thumb|upright|caption]]
21268 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
21269 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
21270 !! html
21271 <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>
21272 !!end
21273
21274 !! test
21275 Image: upright option is ignored on inline and frame images (parsoid)
21276 !! options
21277 parsoid
21278 !! wikitext
21279 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
21280 !! html
21281 <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>
21282 !!end
21283
21284 !! test
21285 Image: from basic HTML (1)
21286 !! options
21287 parsoid=html2wt
21288 !! html/parsoid
21289 <span typeof="mw:Image">
21290 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
21291 </span>
21292 !! wikitext
21293 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
21294 !! end
21295
21296 !! test
21297 Image: from basic HTML (2)
21298 !! options
21299 parsoid=html2wt
21300 !! html/parsoid
21301 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
21302 !! wikitext
21303 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
21304 !! end
21305
21306 !! test
21307 Image: from basic HTML (3)
21308 !! options
21309 parsoid=html2wt
21310 !! html/parsoid
21311 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
21312 !! wikitext
21313 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
21314 !! end
21315
21316 !! test
21317 Image: from basic HTML (4)
21318 !! options
21319 parsoid=html2wt
21320 !! html/parsoid
21321 <img src="File:Foobar.jpg">
21322 !! wikitext
21323 [[File:Foobar.jpg|link=]]
21324 !! end
21325
21326 !! test
21327 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
21328 !! options
21329 parsoid=html2wt
21330 !! wikitext
21331 * foo
21332 !! html
21333 <ul>
21334 <li><p>foo</p></li>
21335 </ul>
21336 !! end
21337
21338 !! test
21339 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
21340 !! options
21341 parsoid=html2wt
21342 !! wikitext
21343 * foo
21344 !! html
21345 <ul> <li>foo</li></ul>
21346 !! end
21347
21348 !! test
21349 Don't strip leading whitespace when handling indent-pre suppressing tags
21350 !! options
21351 parsoid=html2wt
21352 !! wikitext
21353 {|
21354 | indented row
21355 |}
21356 <blockquote>
21357 '''This is very bold of you!'''
21358
21359 {|
21360 |
21361 indented cell (no pre-wrapping!)
21362 |}
21363 </blockquote>
21364 foo
21365 <div>bar</div>
21366 !! html
21367 <table>
21368 <tr><td> indented row</td></tr>
21369 </table>
21370 <blockquote><p>
21371 <b>This is very bold of you!</b>
21372 </p>
21373 <table><tr><td>
21374 indented cell (no pre-wrapping!)
21375 </td></tr></table>
21376 </blockquote>
21377 <p>foo</p>
21378 <div>bar</div>
21379 !! end
21380
21381 !! test
21382 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
21383 !! options
21384 parsoid=html2wt
21385 !! wikitext
21386 foo
21387 <nowiki> </nowiki><span>bar</span>
21388
21389 <span>foo2
21390 <nowiki> </nowiki></span>bar2
21391
21392 <div>foo</div>
21393 <nowiki> </nowiki><span>bar</span>
21394
21395 <div>
21396 <nowiki> </nowiki><span>foo</span>
21397 </div>
21398 !! html
21399 <p>foo</p>
21400 <span>bar</span>
21401
21402 <span>foo2
21403 </span>bar2
21404
21405 <div>foo</div>
21406 <span>bar</span>
21407
21408 <div>
21409 <span>foo</span>
21410 </div>
21411 !! end
21412
21413 !! test
21414 Lists: Add space after bullets
21415 !! options
21416 parsoid=html2wt
21417 !! wikitext
21418 * foo
21419 * bar
21420 * <span> baz</span>
21421 !! html
21422 <ul>
21423 <li>foo</li>
21424 <li> bar</li>
21425 <li><span> baz</span></li>
21426 </ul>
21427 !! end
21428
21429 !! test
21430 Lists: Dont insert newlines in a serialized list item.
21431 !! options
21432 parsoid=html2wt
21433 !! wikitext
21434 * a<br>b
21435 * c
21436 !! html
21437 <ul><li>a<br>b</li><li>c</li></ul>
21438 !! end
21439
21440 !! test
21441 Headings: Add space before/after == (Bug 51744)
21442 !! options
21443 parsoid=html2wt
21444 !! wikitext
21445 == foo ==
21446
21447 == bar ==
21448
21449 == baz ==
21450
21451 == <span> baz</span> ==
21452 !! html
21453 <h2>foo</h2>
21454 <h2> bar</h2>
21455 <h2>baz </h2>
21456 <h2><span> baz</span></h2>
21457 !! end
21458
21459 !! test
21460 Parsoid: Serialize positional parameters with = in them as named parameter
21461 !! options
21462 parsoid=html2wt
21463 !! wikitext
21464 {{echo|1 = f=oo}}
21465
21466 {{echo|1 = f=oo|2 = bar}}
21467
21468 <!--Orig params with data-parsoid has heuristics for handling = chars-->
21469 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
21470 {{echo|<nowiki>f=oo</nowiki>|bar}}
21471 !! html
21472 <p about="#mwt1" typeof="mw:Transclusion"
21473 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
21474
21475 <p about="#mwt1" typeof="mw:Transclusion"
21476 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
21477
21478 <!--Orig params with data-parsoid has heuristics for handling = chars-->
21479 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
21480 <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>
21481 !! end
21482
21483 !! test
21484 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
21485 !! options
21486 parsoid=html2wt
21487 !! wikitext
21488 <div>a
21489 b
21490 </div>
21491 <div>a
21492 b
21493 </div>
21494 <div>
21495 a
21496
21497 b
21498 </div>
21499 !! html
21500 <div>a<p>b</p></div>
21501 <div>a
21502 <p>b</p></div>
21503 <div>
21504 a
21505 <p>b</p></div>
21506 !! end
21507
21508 !! test
21509 Substrings resembling wikitext in hrefs should not get nowiki escapes
21510 !! options
21511 parsoid=html2wt
21512 !! wikitext
21513 [[Foo''bar''baz]]
21514 !! html
21515 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
21516 !! end
21517
21518 #-----------------------------
21519 # I/B quote minimization tests
21520 #-----------------------------
21521
21522 !! test
21523 1. I/B quote minimization: wikitext-only tags should be combined
21524 !! options
21525 parsoid=html2wt
21526 !! wikitext
21527 ''AB''
21528
21529 '''AB'''
21530
21531 ''A'''B'''''
21532
21533 '''A''B'''''
21534
21535 '''A''BC''D'''
21536
21537 '''''AB'''''
21538
21539 '''''AB'''''
21540
21541 '''''AB'''''
21542 !! html
21543 <p><i>A</i><i>B</i></p>
21544 <p><b>A</b><b>B</b></p>
21545 <p><i>A</i><b><i>B</i></b></p>
21546 <p><b>A</b><i><b>B</b></i></p>
21547 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
21548 <p><i><b>A</b></i><i><b>B</b></i></p>
21549 <p><i><b>A</b></i><b><i>B</i></b></p>
21550 <p><b><i>A</i></b><i><b>B</b></i></p>
21551 !! end
21552
21553 !! test
21554 2. I/B quote minimization: wikitext and html tags should not be combined
21555 !! options
21556 parsoid=html2wt
21557 !! wikitext
21558 ''A''<i>B</i>
21559
21560 ''A'''''<i>B</i>'''
21561 !! html
21562 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
21563 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
21564 !! end
21565
21566 !! test
21567 3. I/B quote minimization: templated content stops minimization
21568 !! options
21569 parsoid=html2wt
21570 !! wikitext
21571 ''A''{{echo|''B''}}
21572
21573 ''A''{{echo|'''''B'''''}}
21574 !! html
21575 <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>
21576 <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>
21577 !! end
21578
21579 !! test
21580 4. I/B quote minimization: new content should be mimimized with adjacent old content
21581 !! options
21582 parsoid=html2wt
21583 !! wikitext
21584 ''AB''
21585
21586 '''AB'''
21587
21588 ''A'''B'''''
21589 !! html
21590 <p><i>A</i><i data-parsoid='{}'>B</i></p>
21591 <p><b data-parsoid='{}'>A</b><b>B</b></p>
21592 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
21593 !! end
21594
21595 #------------------------------------
21596 # End of I/B quote minimization tests
21597 #------------------------------------
21598
21599 !!test
21600 Bug 54262: New entities
21601 !! options
21602 parsoid=html2wt
21603 !! wikitext
21604 &nbsp;
21605 !! html
21606 <span typeof="mw:Entity">&nbsp;</span>
21607 !! end
21608
21609 ## Note that there is no wikitext output for 'unknownproperty' ##
21610 ## Unknown magic words are silently dropped ##
21611
21612 !! test
21613 Magic words
21614 !! options
21615 parsoid=html2wt
21616 !! wikitext
21617 __TOC__
21618 __NOTOC__
21619 __FORCETOC__
21620 __INDEX__
21621 __NOINDEX__
21622 __NOGALLERY__
21623 __NOEDITSECTION__
21624 __NOTITLECONVERT__
21625 __NOCONTENTCONVERT__
21626 !! html
21627 <meta property='mw:PageProp/toc' />
21628 <meta property='mw:PageProp/notoc' />
21629 <meta property='mw:PageProp/forcetoc' />
21630 <meta property='mw:PageProp/index' />
21631 <meta property='mw:PageProp/noindex' />
21632 <meta property='mw:PageProp/nogallery' />
21633 <meta property='mw:PageProp/noeditsection' />
21634 <meta property='mw:PageProp/notitleconvert' />
21635 <meta property='mw:PageProp/nocontentconvert' />
21636 <meta property='mw:PageProp/unknownproperty' />
21637 !! end
21638
21639 !! test
21640 Consecutive <pre>s should not get merged
21641 !! options
21642 parsoid=html2wt,html2html
21643 !! wikitext
21644 a
21645
21646 b
21647
21648 c
21649
21650 d
21651
21652 e
21653
21654
21655
21656 f
21657 !! html
21658 <pre>a</pre><pre>b</pre>
21659
21660 <pre>c
21661 </pre><pre>
21662 d</pre>
21663
21664 <pre>e
21665
21666 </pre><pre>
21667
21668 f</pre>
21669 !! end
21670
21671 !! test
21672 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
21673 !! options
21674 parsoid=html2wt
21675 !! wikitext
21676 [[Special:BookSources/1234567890|ISBN 1234567895]]
21677 !! html
21678 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
21679 !! end
21680
21681 !! test
21682 Edited RFC links not serializable as RFC links should serialize as extlinks
21683 !! options
21684 parsoid=html2wt
21685 !! wikitext
21686 [//tools.ietf.org/html/rfc123 New RFC]
21687 !! html
21688 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
21689 !! end
21690
21691 !! test
21692 Edited PMID links not serializable as PMID links should serialize as extlinks
21693 !! options
21694 parsoid=html2wt
21695 !! wikitext
21696 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
21697 !! html
21698 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
21699 !! end
21700
21701 !! test
21702 Edited Redirect link should emit a non-piped wikitext link
21703 !! options
21704 parsoid=html2wt
21705 !! wikitext
21706 #REDIRECT [[Bar]]
21707 !! html
21708 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
21709 !! end
21710
21711 # -----------------------------------------------------------------
21712 # End of section for Parsoid-only html2wt tests for serialization
21713 # of new content
21714 # -----------------------------------------------------------------
21715
21716 TODO:
21717 more images
21718 more tables
21719 character entities
21720 and much more
21721 Try for 100% code coverage