Sync up with Parsoid parserTests.
[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-formedness
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 !!article
159 Template:EmptyLITest
160 !!text
161 *a
162 *
163 *
164 *b
165 !!endarticle
166
167 !!article
168 Template:EmptyTRTest
169 !!text
170 {|
171 |-
172 |-
173 |foo
174 |-
175 |-
176 |bar
177 |}
178 !!endarticle
179
180 !!article
181 Template:EmptyTRWithHTMLAttrTest
182 !!text
183 <table>
184 <tr align="center"></tr>
185 <tr><td>foo</td></tr>
186 <tr align="center"></tr>
187 <tr><td>bar</td></tr>
188 </table>
189 !!endarticle
190
191 ###
192 ### Basic tests
193 ###
194 !! test
195 Blank input
196 !! wikitext
197 !! html
198 !! end
199
200
201 !! test
202 Simple paragraph
203 !! wikitext
204 This is a simple paragraph.
205 !! html
206 <p>This is a simple paragraph.
207 </p>
208 !! end
209
210 !! test
211 Paragraphs with extra newline spacing
212 !! wikitext
213 foo
214
215 bar
216
217
218 baz
219
220
221
222 booz
223 !! html
224 <p>foo
225 </p><p>bar
226 </p><p><br />
227 baz
228 </p><p><br />
229 </p><p>booz
230 </p>
231 !! end
232
233 !! test
234 Paragraphs with newline spacing with comment lines in between
235 !! wikitext
236 ----
237 a
238 <!--foo-->
239 b
240 ----
241 a
242 <!--foo--><!--More than 1 comment, still stripped-->
243 b
244 ----
245 a
246 <!--foo--> <!----> <!-- bar -->
247 b
248 ----
249 a
250 <!--foo-->
251
252 b
253 ----
254 a
255
256 <!--foo-->
257 b
258 ----
259 a
260 <!--foo-->
261
262
263 b
264 ----
265 a
266
267
268 <!--foo-->
269 b
270 ----
271 !! html
272 <hr />
273 <p>a
274 b
275 </p>
276 <hr />
277 <p>a
278 b
279 </p>
280 <hr />
281 <p>a
282 b
283 </p>
284 <hr />
285 <p>a
286 </p><p>b
287 </p>
288 <hr />
289 <p>a
290 </p><p>b
291 </p>
292 <hr />
293 <p>a
294 </p><p><br />
295 b
296 </p>
297 <hr />
298 <p>a
299 </p><p><br />
300 b
301 </p>
302 <hr />
303
304 !! end
305
306 !! test
307 Paragraphs with newline spacing with non-empty white-space lines in between
308 !! wikitext
309 ----
310 a
311
312 b
313 ----
314 a
315
316
317 b
318 ----
319 !! html
320 <hr />
321 <p>a
322 </p><p>b
323 </p>
324 <hr />
325 <p>a
326 </p><p><br />
327 b
328 </p>
329 <hr />
330
331 !! end
332
333 !! test
334 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
335 !! wikitext
336 ----
337 a
338 <!--foo-->
339 b
340 ----
341 a
342 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
343 b
344 ----
345 a
346
347 <!--foo-->
348 <!--bar-->
349 b
350 ----
351 a
352
353 <!--foo-->
354 <!--bar-->
355
356 b
357 ----
358 !! html
359 <hr />
360 <p>a
361 b
362 </p>
363 <hr />
364 <p>a
365 b
366 </p>
367 <hr />
368 <p>a
369 </p><p>b
370 </p>
371 <hr />
372 <p>a
373 </p><p><br />
374 b
375 </p>
376 <hr />
377
378 !! end
379
380 !! test
381 Extra newlines: More paragraphs with indented comment
382 !! wikitext
383 a
384
385 <!--boo-->
386
387 b
388 !! html
389 <p>a
390 </p><p><br />
391 b
392 </p>
393 !!end
394
395 !! test
396 Extra newlines followed by heading
397 !! wikitext
398 a
399
400
401
402 =b=
403 [[a]]
404
405
406 =b=
407 !! html
408 <p>a
409 </p><p><br />
410 </p>
411 <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>
412 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
413 </p><p><br />
414 </p>
415 <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>
416
417 !! end
418
419 !! test
420 Extra newlines between heading and content are swallowed
421 !! wikitext
422 =b=
423
424
425
426 [[a]]
427 !! html
428 <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>
429 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
430 </p>
431 !! end
432
433 !! test
434 Parsing an URL
435 !! wikitext
436 http://fr.wikipedia.org/wiki/🍺
437 <!-- EasterEgg we love beer, better be able be able to link to it -->
438 !! html
439 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
440 </p>
441 !! end
442
443 # Note that the html+tidy output removes the spaces after the <li>,
444 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
445 # This is an issue for all tests with lists. We intentionally do
446 # *not* add html+tidy clauses for these, as we don't want to
447 # document/test the broken behavior. (Parsoid matches the non-tidy
448 # output in these cases.)
449
450 !! test
451 Simple list
452 !! wikitext
453 * Item 1
454 * Item 2
455 !! html
456 <ul><li> Item 1</li>
457 <li> Item 2</li></ul>
458
459 !! end
460
461 !! test
462 Italics and bold
463 !! wikitext
464 * plain
465 * plain''italic''plain
466 * plain''italic''plain''italic''plain
467 * plain'''bold'''plain
468 * plain'''bold'''plain'''bold'''plain
469 * plain''italic''plain'''bold'''plain
470 * plain'''bold'''plain''italic''plain
471 * plain''italic'''bold-italic'''italic''plain
472 * plain'''bold''bold-italic''bold'''plain
473 * plain'''''bold-italic'''italic''plain
474 * plain'''''bold-italic''bold'''plain
475 * plain''italic'''bold-italic'''''plain
476 * plain'''bold''bold-italic'''''plain
477 * plain l'''italic''plain
478 * plain l''''bold''' plain
479 !! html
480 <ul><li> plain</li>
481 <li> plain<i>italic</i>plain</li>
482 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
483 <li> plain<b>bold</b>plain</li>
484 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
485 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
486 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
487 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
488 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
489 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
490 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
491 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
492 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
493 <li> plain l'<i>italic</i>plain</li>
494 <li> plain l'<b>bold</b> plain</li></ul>
495
496 !! end
497
498 # this example taken from the [[simple:Moon]] article (bug 47326)
499 !! test
500 Italics and possessives (1)
501 !! wikitext
502 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
503 !! html
504 <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
505 </p>
506 !! end
507
508 # this example taken from [[en:Flaming Pie]] (bug 49926)
509 !! test
510 Italics and possessives (2)
511 !! wikitext
512 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
513 !! html
514 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
515 </p>
516 !! end
517
518 # this example taken from [[en:Dictionary]] (bug 49926)
519 !! test
520 Italics and possessives (3)
521 !! wikitext
522 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''.
523 !! html
524 <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>.
525 </p>
526 !! end
527
528
529 ###
530 ### 2-quote opening sequence tests
531 ###
532 !! test
533 Italics and bold: 2-quote opening sequence: (2,2)
534 !! wikitext
535 ''foo''
536 !! html
537 <p><i>foo</i>
538 </p>
539 !!end
540
541 !! test
542 Italics and bold: 2-quote opening sequence: (2,3)
543 !! wikitext
544 ''foo'''
545 !! html/*
546 <p><i>foo'</i>
547 </p>
548 !!end
549
550 !! test
551 Italics and bold: 2-quote opening sequence: (2,4)
552 !! options
553 parsoid=wt2html
554 !! wikitext
555 ''foo''''
556 !! html/*
557 <p><i>foo''</i>
558 </p>
559 !!end
560
561 # same html as previous, but wikitext adjusted to match parsoid html2wt
562 !! test
563 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
564 !! wikitext
565 ''foo<nowiki>''</nowiki>''
566 !! html
567 <p><i>foo''</i>
568 </p>
569 !! end
570
571 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
572 !! test
573 Italics and bold: 2-quote opening sequence: (2,5)
574 !! options
575 parsoid=wt2html
576 !! wikitext
577 ''foo'''''
578 !! html/php
579 <p><i>foo</i>
580 </p>
581 !! html/parsoid
582 <p><i>foo</i><b></b>
583 </p>
584 !!end
585
586 # same html as previous, but wikitext adjusted to match parsoid html2wt
587 !! test
588 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
589 !! wikitext
590 ''foo'''''<nowiki/>'''
591 !! html/php
592 <p><i>foo</i>
593 </p>
594 !! html/parsoid
595 <p><i>foo</i><b></b>
596 </p>
597 !! end
598
599
600 ###
601 ### 3-quote opening sequence tests
602 ###
603
604 !! test
605 Italics and bold: 3-quote opening sequence: (3,2)
606 !! wikitext
607 '''foo''
608 !! html/*
609 <p>'<i>foo</i>
610 </p>
611 !!end
612
613 !! test
614 Italics and bold: 3-quote opening sequence: (3,3)
615 !! wikitext
616 '''foo'''
617 !! html
618 <p><b>foo</b>
619 </p>
620 !!end
621
622 !! test
623 Italics and bold: 3-quote opening sequence: (3,4)
624 !! wikitext
625 '''foo''''
626 !! html/*
627 <p><b>foo'</b>
628 </p>
629 !!end
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 # same html as previous, but wikitext adjusted to match parsoid html2wt
676 !! test
677 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
678 !! wikitext
679 <nowiki>''</nowiki>''foo''
680 !! html
681 <p>''<i>foo</i>
682 </p>
683 !! end
684
685 !! test
686 Italics and bold: 4-quote opening sequence: (4,3)
687 !! wikitext
688 ''''foo'''
689 !! html/*
690 <p>'<b>foo</b>
691 </p>
692 !!end
693
694 !! test
695 Italics and bold: 4-quote opening sequence: (4,4)
696 !! options
697 parsoid=wt2html
698 !! wikitext
699 ''''foo''''
700 !! html/*
701 <p>'<b>foo'</b>
702 </p>
703 !!end
704
705 # same html as previous, but wikitext adjusted to match parsoid html2wt
706 !! test
707 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
708 !! wikitext
709 '<nowiki/>'''foo'<nowiki/>'''
710 !! html
711 <p>'<b>foo'</b>
712 </p>
713 !! end
714
715 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
716 !! test
717 Italics and bold: 4-quote opening sequence: (4,5)
718 !! options
719 parsoid=wt2html
720 !! wikitext
721 ''''foo'''''
722 !! html/php
723 <p>'<b>foo</b>
724 </p>
725 !! html/parsoid
726 <p>'<b>foo</b><i></i>
727 </p>
728 !!end
729
730 # same html as previous, but wikitext adjusted to match parsoid html2wt
731 !! test
732 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
733 !! wikitext
734 '<nowiki/>'''foo'''''<nowiki/>''
735 !! html/php
736 <p>'<b>foo</b>
737 </p>
738 !! html/parsoid
739 <p>'<b>foo</b><i></i>
740 </p>
741 !! end
742
743
744 ###
745 ### 5-quote opening sequence tests
746 ###
747
748 !! test
749 Italics and bold: 5-quote opening sequence: (5,2)
750 !! options
751 parsoid=wt2html
752 !! wikitext
753 '''''foo''
754 !! html/*
755 <p><b><i>foo</i></b>
756 </p>
757 !!end
758
759 # same html as previous, but wikitext adjusted to match parsoid html2wt
760 # skipping wt2html and html2html because it wants to put <i> before <b>
761 !! test
762 Italics and bold: 5-quote opening sequence: (5,2+3)
763 !! options
764 parsoid=wt2wt,html2wt
765 !! wikitext
766 '''''foo'''''
767 !! html
768 <p><b><i>foo</i></b>
769 </p>
770 !! end
771
772 !! test
773 Italics and bold: 5-quote opening sequence: (5,3)
774 !! options
775 parsoid=wt2html
776 !! wikitext
777 '''''foo'''
778 !! html/*
779 <p><i><b>foo</b></i>
780 </p>
781 !!end
782
783 # same html as previous, but wikitext adjusted to match parsoid html2wt
784 !! test
785 Italics and bold: 5-quote opening sequence: (5,3+2)
786 !! wikitext
787 '''''foo'''''
788 !! html
789 <p><i><b>foo</b></i>
790 </p>
791 !! end
792
793 !! test
794 Italics and bold: 5-quote opening sequence: (5,4)
795 !! options
796 parsoid=wt2html
797 !! wikitext
798 '''''foo''''
799 !! html/*
800 <p><i><b>foo'</b></i>
801 </p>
802 !!end
803
804 !! test
805 Italics and bold: 5-quote opening sequence: (5,5)
806 !! wikitext
807 '''''foo'''''
808 !! html
809 <p><i><b>foo</b></i>
810 </p>
811 !!end
812
813 !! test
814 Italics and bold: 5-quote opening sequence: (5,6)
815 !! wikitext
816 '''''foo''''''
817 !! html/*
818 <p><i><b>foo'</b></i>
819 </p>
820 !! end
821
822 ###
823 ### multiple quote sequences in a line
824 ###
825 !! test
826 Italics and bold: multiple quote sequences: (2,4,2)
827 !! options
828 parsoid=wt2html
829 !! wikitext
830 ''foo''''bar''
831 !! html/*
832 <p><i>foo'<b>bar</b></i>
833 </p>
834 !!end
835
836
837 # same html as previous, but wikitext adjusted to match parsoid html2wt
838 !! test
839 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
840 !! wikitext
841 ''foo'<nowiki/>'''bar'''''
842 !! html
843 <p><i>foo'<b>bar</b></i>
844 </p>
845 !! end
846
847
848 !! test
849 Italics and bold: multiple quote sequences: (2,4,3)
850 !! options
851 parsoid=wt2html
852 !! wikitext
853 ''foo''''bar'''
854 !! html/*
855 <p><i>foo'<b>bar</b></i>
856 </p>
857 !!end
858
859
860 # same html as previous, but wikitext adjusted to match parsoid html2wt
861 !! test
862 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
863 !! wikitext
864 ''foo'<nowiki/>'''bar'''''
865 !! html
866 <p><i>foo'<b>bar</b></i>
867 </p>
868 !! end
869
870
871 !! test
872 Italics and bold: multiple quote sequences: (2,4,4)
873 !! options
874 parsoid=wt2html
875 !! wikitext
876 ''foo''''bar''''
877 !! html/*
878 <p><i>foo'<b>bar'</b></i>
879 </p>
880 !!end
881
882
883 # same html as previous, but wikitext adjusted to match parsoid html2wt
884 !! test
885 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
886 !! wikitext
887 ''foo'<nowiki/>'''bar'<nowiki/>'''''
888 !! html
889 <p><i>foo'<b>bar'</b></i>
890 </p>
891 !! end
892
893
894 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
895 !! test
896 Italics and bold: multiple quote sequences: (3,4,2)
897 !! options
898 parsoid=wt2html
899 !! wikitext
900 '''foo''''bar''
901 !! html/php
902 <p><b>foo'</b>bar
903 </p>
904 !! html/parsoid
905 <p><b>foo'</b>bar<i></i>
906 </p>
907 !!end
908
909 # same html as previous, but wikitext adjusted to match parsoid html2wt
910 !! test
911 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
912 !! options
913 parsoid
914 !! wikitext
915 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
916 !! html/php
917 <p><b>foo'</b>bar
918 </p>
919 !! html/parsoid
920 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
921 </p>
922 !! end
923
924
925 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
926 !! test
927 Italics and bold: multiple quote sequences: (3,4,3)
928 !! options
929 parsoid=wt2html
930 !! wikitext
931 '''foo''''bar'''
932 !! html/php
933 <p><b>foo'</b>bar
934 </p>
935 !! html/parsoid
936 <p><b>foo'</b>bar<b></b>
937 </p>
938 !!end
939
940 # same html as previous, but wikitext adjusted to match parsoid html2wt
941 !! test
942 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
943 !! wikitext
944 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
945 !! html/php
946 <p><b>foo'</b>bar
947 </p>
948 !! html/parsoid
949 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
950 </p>
951 !! end
952
953 ###
954 ### other quote tests
955 ###
956 !! test
957 Italics and bold: other quote tests: (2,3,5)
958 !! wikitext
959 ''this is about '''foo's family'''''
960 !! html
961 <p><i>this is about <b>foo's family</b></i>
962 </p>
963 !!end
964
965
966 !! test
967 Italics and bold: other quote tests: (2,(3,3),2)
968 !! wikitext
969 ''this is about '''foo's''' family''
970 !! html
971 <p><i>this is about <b>foo's</b> family</i>
972 </p>
973 !!end
974
975
976 !! test
977 Italics and bold: other quote tests: (3,2,3,2)
978 !! options
979 parsoid=wt2html
980 !! wikitext
981 '''this is about ''foo'''s family''
982 !! html/*
983 <p><b>this is about <i>foo</i></b><i>s family</i>
984 </p>
985 !!end
986
987
988 # same html as previous, but wikitext adjusted to match parsoid html2wt
989 !! test
990 Italics and bold: other quote tests: (3,2,3+2+2,2)
991 !! wikitext
992 '''this is about ''foo'''''<nowiki/>''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 !! test
1000 Italics and bold: other quote tests: (3,2,3,3)
1001 !! wikitext
1002 '''this is about ''foo'''s family'''
1003 !! html/*
1004 <p>'<i>this is about </i>foo<b>s family</b>
1005 </p>
1006 !!end
1007
1008
1009 !! test
1010 Italics and bold: other quote tests: (3,(2,2),3)
1011 !! wikitext
1012 '''this is about ''foo's'' family'''
1013 !! html
1014 <p><b>this is about <i>foo's</i> family</b>
1015 </p>
1016 !!end
1017
1018
1019 !! test
1020 Italicized possessive
1021 !! wikitext
1022 The ''[[Main Page]]'''s talk page.
1023 !! html/php
1024 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1025 </p>
1026 !! html/parsoid
1027 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1028 !! end
1029
1030 !! test
1031 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1032 (Requires tidy for PHP parser output to be fixed up)
1033 !! options
1034 parsoid=wt2html,wt2wt
1035 !! wikitext
1036 {|
1037 !''a!!''b
1038 |''a||''b
1039 |}
1040 !! html/php+tidy
1041 <table>
1042 <tr>
1043 <th><i>a</i></th>
1044 <th><i>b</i></th>
1045 <td><i>a</i></td>
1046 <td><i>b</i></td>
1047 </tr>
1048 </table>
1049 !! html/parsoid
1050 <table>
1051 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1052 <td><i>a</i></td><td><i>b</i></td></tr>
1053 </tbody></table>
1054 !! end
1055
1056 ###
1057 ### Non-html5 tags
1058 ###
1059
1060 !! test
1061 Non-html5 tags should be accepted
1062 !! wikitext
1063 <center>''foo''</center>
1064 <big>''foo''</big>
1065 <font>''foo''</font>
1066 <strike>''foo''</strike>
1067 <tt>''foo''</tt>
1068 !! html
1069 <center><i>foo</i></center>
1070 <p><big><i>foo</i></big>
1071 <font><i>foo</i></font>
1072 <strike><i>foo</i></strike>
1073 <tt><i>foo</i></tt>
1074 </p>
1075 !! end
1076
1077 !! test
1078 <wbr> is valid wikitext (bug 52468)
1079 !! wikitext
1080 <wbr>
1081 !! html
1082 <p><wbr />
1083 </p>
1084 !! end
1085
1086 # <strike> is HTML4, <s> is HTML4/5.
1087 !! test
1088 <s> or <strike> for strikethrough
1089 !! wikitext
1090 <strike>strike</strike>
1091
1092 <s>s</s>
1093 !! html
1094 <p><strike>strike</strike>
1095 </p><p><s>s</s>
1096 </p>
1097 !! end
1098
1099 ## a not permitted
1100 ## i,b,br omitted
1101 !! test
1102 Text-level semantic html elements in wikitext
1103 !! wikitext
1104 <em>text</em>
1105 <strong>text</strong>
1106 <small>text</small>
1107 <s>text</s>
1108 <cite>text</cite>
1109 <q>text</q>
1110 <dfn>text</dfn>
1111 <abbr>text</abbr>
1112 <data>text</data>
1113 <time>text</time>
1114 <code>text</code>
1115 <var>text</var>
1116 <samp>text</samp>
1117 <kbd>text</kbd>
1118 <sub>text</sub>
1119 <u>text</u>
1120 <mark>text</mark>
1121 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1122 <bdi>text</bdi>
1123 <bdo>text</bdo>
1124 <span>text</span>
1125 <wbr />
1126 !! html
1127 <p><em>text</em>
1128 <strong>text</strong>
1129 <small>text</small>
1130 <s>text</s>
1131 <cite>text</cite>
1132 <q>text</q>
1133 <dfn>text</dfn>
1134 <abbr>text</abbr>
1135 <data>text</data>
1136 <time>text</time>
1137 <code>text</code>
1138 <var>text</var>
1139 <samp>text</samp>
1140 <kbd>text</kbd>
1141 <sub>text</sub>
1142 <u>text</u>
1143 <mark>text</mark>
1144 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1145 <bdi>text</bdi>
1146 <bdo>text</bdo>
1147 <span>text</span>
1148 <wbr />
1149 </p>
1150 !! end
1151
1152 # test cases taken from
1153 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1154 !! test
1155 Ruby markup (W3C-style)
1156 !! wikitext
1157 ; Mono-ruby for individual base characters
1158 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1159 ; Group ruby
1160 : <ruby>今日<rt>きょう</rt></ruby>
1161 ; Jukugo ruby
1162 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1163 ; Inline ruby
1164 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1165 ; Double-sided ruby
1166 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1167 <ruby>
1168 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1169 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1170 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1171 </ruby>
1172 !! html
1173 <dl><dt> Mono-ruby for individual base characters</dt>
1174 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1175 <dt> Group ruby</dt>
1176 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1177 <dt> Jukugo ruby</dt>
1178 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1179 <dt> Inline ruby</dt>
1180 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1181 <dt> Double-sided ruby</dt>
1182 <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>
1183 <p><ruby>
1184 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1185 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1186 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1187 </ruby>
1188 </p>
1189 !! end
1190
1191 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1192 !! test
1193 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1194 !! wikitext
1195 <b→> doesn't work! </b→>
1196
1197 <bä> doesn't work! </bä>
1198
1199 <boo> works fine </boo>
1200
1201 <s.foo>s.foo</s.foo>
1202
1203 <sub-ID#1>
1204 !! html
1205 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1206 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1207 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1208 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1209 </p><p>&lt;sub-ID#1&gt;
1210 </p>
1211 !! end
1212
1213 !! test
1214 Isolated close tags should be treated as literal text (bug 52760)
1215 !! wikitext
1216 </b>
1217
1218 <s.foo>s</s>
1219 !! html
1220 <p>&lt;/b&gt;
1221 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1222 </p>
1223 !! end
1224
1225 ###
1226 ### Special characters
1227 ###
1228
1229 !! test
1230 Bare pipe character (bug 52363)
1231 !! wikitext
1232 |
1233 !! html
1234 <p>|
1235 </p>
1236 !! end
1237
1238 !! test
1239 Bare pipe character from a template (bug 52363)
1240 !! wikitext
1241 {{pipe}}
1242 !! html
1243 <p>|
1244 </p>
1245 !! end
1246
1247 ###
1248 ### <nowiki> test cases
1249 ###
1250
1251 !! test
1252 <nowiki> unordered list
1253 !! wikitext
1254 <nowiki>* This is not an unordered list item.</nowiki>
1255 !! html
1256 <p>* This is not an unordered list item.
1257 </p>
1258 !! end
1259
1260 !! test
1261 <nowiki> spacing
1262 !! wikitext
1263 <nowiki>Lorem ipsum dolor
1264
1265 sed abit.
1266 sed nullum.
1267
1268 :and a colon
1269 </nowiki>
1270 !! html
1271 <p>Lorem ipsum dolor
1272
1273 sed abit.
1274 sed nullum.
1275
1276 :and a colon
1277
1278 </p>
1279 !! end
1280
1281 !! test
1282 nowiki 3
1283 !! wikitext
1284 :There is not nowiki.
1285 :There is <nowiki>nowiki</nowiki>.
1286
1287 #There is not nowiki.
1288 #There is <nowiki>nowiki</nowiki>.
1289
1290 *There is not nowiki.
1291 *There is <nowiki>nowiki</nowiki>.
1292 !! html
1293 <dl><dd>There is not nowiki.</dd>
1294 <dd>There is nowiki.</dd></dl>
1295 <ol><li>There is not nowiki.</li>
1296 <li>There is nowiki.</li></ol>
1297 <ul><li>There is not nowiki.</li>
1298 <li>There is nowiki.</li></ul>
1299
1300 !! end
1301
1302 !! test
1303 Entities inside <nowiki>
1304 !! wikitext
1305 <nowiki>&lt;</nowiki>
1306 !! html
1307 <p>&lt;
1308 </p>
1309 !! end
1310
1311 !! test
1312 Entities inside template parameters
1313 !! options
1314 parsoid
1315 !! wikitext
1316 {{echo|&ndash;}}
1317 !! html
1318 <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></p>
1319 !! end
1320
1321 !! test
1322 Properly escape nowiki when combined with other wiki markup
1323 !! options
1324 parsoid=html2wt
1325 !! wikitext
1326 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1327 !! html
1328 <p>* &lt;/nowiki&gt; tag</p>
1329 !! end
1330
1331 ###
1332 ### Comments
1333 ###
1334 !! test
1335 Comments and Indent-Pre
1336 !! wikitext
1337 <!-- comment 1 --> asdf
1338
1339 <!-- comment 1 --> asdf
1340 <!-- comment 2 -->
1341
1342 <!-- comment 1 --> asdf
1343 <!-- comment 2 -->xyz
1344
1345 <!-- comment 1 --> asdf
1346 <!-- comment 2 --> xyz
1347 !! html
1348 <pre>asdf
1349 </pre>
1350 <pre>asdf
1351 </pre>
1352 <pre>asdf
1353 </pre>
1354 <p>xyz
1355 </p>
1356 <pre>asdf
1357 xyz
1358 </pre>
1359 !! end
1360
1361 !! test
1362 Comment test 2a
1363 !! wikitext
1364 asdf
1365 <!-- comment 1 -->
1366 jkl
1367 !! html
1368 <p>asdf
1369 jkl
1370 </p>
1371 !! end
1372
1373 !! test
1374 Comment test 2b
1375 !! wikitext
1376 asdf
1377 <!-- comment 1 -->
1378
1379 jkl
1380 !! html
1381 <p>asdf
1382 </p><p>jkl
1383 </p>
1384 !! end
1385
1386 !! test
1387 Comment test 3
1388 !! wikitext
1389 asdf
1390 <!-- comment 1 -->
1391 <!-- comment 2 -->
1392 jkl
1393 !! html
1394 <p>asdf
1395 jkl
1396 </p>
1397 !! end
1398
1399 !! test
1400 Comment test 4
1401 !! wikitext
1402 asdf<!-- comment 1 -->jkl
1403 !! html
1404 <p>asdfjkl
1405 </p>
1406 !! end
1407
1408 !! test
1409 Comment spacing
1410 !! wikitext
1411 a
1412 <!-- foo --> b <!-- bar -->
1413 c
1414 !! html
1415 <p>a
1416 </p>
1417 <pre> b
1418 </pre>
1419 <p>c
1420 </p>
1421 !! end
1422
1423 !! test
1424 Comment whitespace
1425 !! wikitext
1426 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1427 !! html
1428
1429 !! end
1430
1431 !! test
1432 Comment semantics and delimiters
1433 !! wikitext
1434 <!-- --><!----><!-----><!------>
1435 !! html
1436
1437 !! end
1438
1439 !! test
1440 Comment semantics and delimiters, redux
1441 !! wikitext
1442 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1443 -- foo -- funky huh? ... -->
1444 !! html
1445
1446 !! end
1447
1448 !! test
1449 Comment semantics and delimiters: directors cut
1450 !! wikitext
1451 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1452 everything starting with < followed by !-- until the first -- and > we see,
1453 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1454 -->-->
1455 !! html
1456 <p>--&gt;
1457 </p>
1458 !! end
1459
1460 !! test
1461 Comment semantics: nesting
1462 !! wikitext
1463 <!--<!-- no, we're not going to do anything fancy here -->-->
1464 !! html
1465 <p>--&gt;
1466 </p>
1467 !! end
1468
1469 !! test
1470 Comment semantics: unclosed comment at end
1471 !! wikitext
1472 <!--This comment will run out to the end of the document
1473 !! html
1474
1475 !! end
1476
1477 # Bug 58184: document parsoid's behaviour
1478 !! test
1479 Suppress comment closing tag in lenient browsers
1480 !! options
1481 parsoid=wt2html,html2html
1482 !! wikitext
1483 <!-- Browsers--!> think this is closed -->
1484 !! html/php
1485
1486 !! html/parsoid
1487 <!-- Browsers--¡> think this is closed -->
1488 !! end
1489
1490 !! test
1491 Comment in template title
1492 !! wikitext
1493 {{f<!---->oo}}
1494 !! html
1495 <p>FOO
1496 </p>
1497 !! end
1498
1499 !! test
1500 Comment on its own line post-expand
1501 !! wikitext
1502 a
1503 {{blank}}<!---->
1504 b
1505 !! html
1506 <p>a
1507 </p><p>b
1508 </p>
1509 !! end
1510
1511 !! test
1512 Comment on its own line post-expand with non-significant whitespace
1513 !! wikitext
1514 a
1515 {{blank}} <!---->
1516 b
1517 !! html
1518 <p>a
1519 </p><p>b
1520 </p>
1521 !! end
1522
1523 !! test
1524 Multiple comments should still parse as SOL-transparent
1525 !! options
1526 parsoid=wt2html,wt2wt
1527 !! wikitext
1528 <!--c1-->*a
1529 <!--c2--><!--c3--><!--c4-->*b
1530 !! html
1531 <ul>
1532 <li>a
1533 </li>
1534 <li>b
1535 </li>
1536 </ul>
1537 !! end
1538
1539 ###
1540 ### paragraph wrapping tests
1541 ###
1542 !! test
1543 No block tags
1544 !! wikitext
1545 a
1546
1547 b
1548 !! html
1549 <p>a
1550 </p><p>b
1551 </p>
1552 !! end
1553
1554 !! test
1555 Block tag on one line (<div>)
1556 !! wikitext
1557 a <div>foo</div>
1558
1559 b
1560 !! html
1561 a <div>foo</div>
1562 <p>b
1563 </p>
1564 !! html+tidy
1565 <p>a</p>
1566 <div>foo</div>
1567 <p>b</p>
1568 !! end
1569
1570 !! test
1571 Block tag on one line (<blockquote>)
1572 !! wikitext
1573 a <blockquote>foo</blockquote>
1574
1575 b
1576 !! html
1577 a <blockquote>foo</blockquote>
1578 <p>b
1579 </p>
1580 !! html+tidy
1581 <p>a</p>
1582 <blockquote>
1583 <p>foo</p>
1584 </blockquote>
1585 <p>b</p>
1586 !! end
1587
1588 !! test
1589 Block tag on both lines (<div>)
1590 !! wikitext
1591 a <div>foo</div>
1592
1593 b <div>foo</div>
1594 !! html
1595 a <div>foo</div>
1596 b <div>foo</div>
1597
1598 !! html+tidy
1599 <p>a</p>
1600 <div>foo</div>
1601 <p>b</p>
1602 <div>foo</div>
1603 !! end
1604
1605 !! test
1606 Block tag on both lines (<blockquote>)
1607 !! wikitext
1608 a <blockquote>foo</blockquote>
1609
1610 b <blockquote>foo</blockquote>
1611 !! html
1612 a <blockquote>foo</blockquote>
1613 b <blockquote>foo</blockquote>
1614
1615 !! html+tidy
1616 <p>a</p>
1617 <blockquote>
1618 <p>foo</p>
1619 </blockquote>
1620 <p>b</p>
1621 <blockquote>
1622 <p>foo</p>
1623 </blockquote>
1624 !! end
1625
1626 !! test
1627 Multiple lines without block tags
1628 !! wikitext
1629 <div>foo</div> a
1630 b
1631 c
1632 d<!--foo--> e
1633 x <div>foo</div> z
1634 !! html
1635 <div>foo</div> a
1636 <p>b
1637 c
1638 d e
1639 </p>
1640 x <div>foo</div> z
1641
1642 !! html+tidy
1643 <div>foo</div>
1644 <p>a</p>
1645 <p>b c d e</p>
1646 <p>x</p>
1647 <div>foo</div>
1648 <p>z</p>
1649 !! end
1650
1651 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1652 # So, we have a separate section for Parsoid. We don't want
1653 # to mimic this stripping behavior in Parsoid. It affects
1654 # editing experience and also requires us to maintain additional
1655 # info for RT-ing.
1656 !! test
1657 Empty lines between lines with block tags
1658 !! wikitext
1659 <div></div>
1660
1661
1662 <div></div>a
1663
1664 b
1665 <div>a</div>b
1666
1667 <div>b</div>d
1668
1669
1670 <div>e</div>
1671 !! html
1672 <div></div>
1673 <p><br />
1674 </p>
1675 <div></div>a
1676 <p>b
1677 </p>
1678 <div>a</div>b
1679 <div>b</div>d
1680 <p><br />
1681 </p>
1682 <div>e</div>
1683
1684 !! html+tidy
1685 <p><br /></p>
1686 <p>a</p>
1687 <p>b</p>
1688 <div>a</div>
1689 <p>b</p>
1690 <div>b</div>
1691 <p>d</p>
1692 <p><br /></p>
1693 <div>e</div>
1694 !! html/parsoid
1695 <div data-parsoid='{"stx":"html"}'></div>
1696
1697 <p><br /></p>
1698 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1699
1700 <p>b</p>
1701 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1702
1703 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1704
1705 <p><br /></p>
1706 <div data-parsoid='{"stx":"html"}'>e</div>
1707 !! end
1708
1709 ## PHP parser emits output which is broken
1710 ## XXX The parsoid output doesn't match the tidy output.
1711 !! test
1712 Unclosed HTML p-tags should be handled properly
1713 !! wikitext
1714 <div><p>foo</div>
1715 a
1716
1717 b
1718 !! html/php+tidy
1719 <div>
1720 <p>foo&lt;/div&gt;</p>
1721 <p>a</p>
1722 b</div>
1723 !! html/parsoid
1724 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1725 <p>a</p>
1726 <p>b</p>
1727 !! end
1728
1729 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
1730 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
1731 ## them for now.
1732 !! test
1733 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
1734 !! options
1735 parsoid=wt2html
1736 !! wikitext
1737 a [[Category:A1]] [[Category:A2]]
1738 [[Category:A3]]
1739 [[Category:A4]]
1740 !! html/parsoid
1741 <p>a</p>
1742 <link href="Category:A1"/> <link href="Category:A2"/> <link href="Category:A3"/> <link href="Category:A4"/>
1743 !! end
1744
1745 !! test
1746 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
1747 !! options
1748 parsoid=wt2html
1749 !! wikitext
1750 [[Category:A1]]a
1751 !! html/parsoid
1752 <link href="Category:A1"/><p>a</p>
1753 !! end
1754
1755 ###
1756 ### Preformatted text
1757 ###
1758 !! test
1759 Preformatted text
1760 !! wikitext
1761 This is some
1762 Preformatted text
1763 With ''italic''
1764 And '''bold'''
1765 And a [[Main Page|link]]
1766 !! html
1767 <pre>This is some
1768 Preformatted text
1769 With <i>italic</i>
1770 And <b>bold</b>
1771 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1772 </pre>
1773 !! end
1774
1775 !! test
1776 Tabs don't trigger preformatted text
1777 !! wikitext
1778 This is not
1779 preformatted text.
1780 This is preformatted text.
1781 So is this.
1782 !! html
1783 <p> This is not
1784 preformatted text.
1785 </p>
1786 <pre>This is preformatted text.
1787 So is this.
1788 </pre>
1789 !! end
1790
1791 !! test
1792 Ident preformatting with inline content
1793 !! wikitext
1794 a
1795 ''b''
1796 !! html
1797 <pre>a
1798 <i>b</i>
1799 </pre>
1800 !! end
1801
1802 !! test
1803 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1804 !! wikitext
1805 <pre><nowiki>
1806 <b>
1807 <cite>
1808 <em>
1809 </nowiki></pre>
1810 !! html
1811 <pre>
1812 &lt;b&gt;
1813 &lt;cite&gt;
1814 &lt;em&gt;
1815 </pre>
1816
1817 !! end
1818
1819 !! test
1820 Regression with preformatted in <center>
1821 !! wikitext
1822 <center>
1823 Blah
1824 </center>
1825 !! html
1826 <center>
1827 <pre>Blah
1828 </pre>
1829 </center>
1830
1831 !! end
1832
1833 !! test
1834 Bug 52763: Preformatted in <blockquote>
1835 !! wikitext
1836 <blockquote>
1837 Blah
1838 {|
1839 |
1840 indented cell (no pre-wrapping!)
1841 |}
1842 </blockquote>
1843 !! html
1844 <blockquote>
1845 <p> Blah
1846 </p>
1847 <table>
1848 <tr>
1849 <td>
1850 <p> indented cell (no pre-wrapping!)
1851 </p>
1852 </td></tr></table>
1853 </blockquote>
1854
1855 !! end
1856
1857 !! test
1858 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1859 !! wikitext
1860 <blockquote>
1861 Foo
1862
1863 Bar
1864 </blockquote>
1865 !! html
1866 <blockquote>
1867 <p>Foo
1868 </p><p>Bar
1869 </p>
1870 </blockquote>
1871
1872 !! end
1873
1874 !! test
1875 Bug 15491: <ins>/<del> in blockquote
1876 !! wikitext
1877 <blockquote>
1878 Foo <del>bar</del> <ins>baz</ins> quux
1879 </blockquote>
1880 !! html
1881 <blockquote>
1882 <p>Foo <del>bar</del> <ins>baz</ins> quux
1883 </p>
1884 </blockquote>
1885
1886 !! end
1887
1888 # Note that the p-wrapping is newline sensitive, which could be
1889 # considered a bug: tidy will wrap only the 'Foo' in the example
1890 # below in a <p> tag. (see comment 23-25 of bug #6200)
1891 !! test
1892 Bug 15491: <ins>/<del> in blockquote (2)
1893 !! wikitext
1894 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1895 </blockquote>
1896 !! html
1897 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1898 </blockquote>
1899
1900 !! html+tidy
1901 <blockquote>
1902 <p>Foo</p>
1903 <del>bar</del> <ins>baz</ins> quux</blockquote>
1904 !! end
1905
1906 !! test
1907 <pre> with attributes (bug 3202)
1908 !! wikitext
1909 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1910 !! html
1911 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1912
1913 !! end
1914
1915 !! test
1916 <pre> with width attribute (bug 3202)
1917 !! wikitext
1918 <pre width="8">Narrow screen goodies</pre>
1919 !! html
1920 <pre width="8">Narrow screen goodies</pre>
1921
1922 !! end
1923
1924 !! test
1925 <pre> with forbidden attribute (bug 3202)
1926 !! wikitext
1927 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1928 !! html
1929 <pre width="8">Narrow screen goodies</pre>
1930
1931 !! end
1932
1933 !! test
1934 Entities inside <pre>
1935 !! wikitext
1936 <pre>&lt;</pre>
1937 !! html
1938 <pre>&lt;</pre>
1939
1940 !! end
1941
1942 !! test
1943 <pre> with forbidden attribute values (bug 3202)
1944 !! wikitext
1945 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1946 !! html
1947 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1948
1949 !! end
1950
1951 !! test
1952 <nowiki> inside <pre> (bug 13238)
1953 !! wikitext
1954 <pre>
1955 <nowiki>
1956 </pre>
1957 <pre>
1958 <nowiki></nowiki>
1959 </pre>
1960 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1961 !! html
1962 <pre>
1963 &lt;nowiki&gt;
1964 </pre>
1965 <pre>
1966
1967 </pre>
1968 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1969
1970 !! end
1971
1972 !! test
1973 <nowiki> and <pre> preference (first one wins)
1974 !! wikitext
1975 <pre>
1976 <nowiki>
1977 </pre>
1978 </nowiki>
1979 </pre>
1980
1981 <nowiki>
1982 <pre>
1983 <nowiki>
1984 </pre>
1985 </nowiki>
1986 </pre>
1987
1988 !! html
1989 <pre>
1990 &lt;nowiki&gt;
1991 </pre>
1992 <p>&lt;/nowiki&gt;
1993 &lt;/pre&gt;
1994 </p><p>
1995 &lt;pre&gt;
1996 &lt;nowiki&gt;
1997 &lt;/pre&gt;
1998
1999 &lt;/pre&gt;
2000 </p>
2001 !! end
2002
2003 !! test
2004 </pre> inside nowiki
2005 !! wikitext
2006 <nowiki></pre></nowiki>
2007 !! html
2008 <p>&lt;/pre&gt;
2009 </p>
2010 !! end
2011
2012 # Parsoid doesn't strip empty tags, like Tidy does.
2013 !! test
2014 Empty pre; pre inside other HTML tags (bug 54946)
2015 !! options
2016 parsoid=wt2html,wt2wt
2017 !! wikitext
2018 a
2019
2020 <div><pre>
2021 foo
2022 </pre></div>
2023 <pre></pre>
2024 !! html/php
2025 <p>a
2026 </p>
2027 <div><pre>
2028 foo
2029 </pre></div>
2030 <pre></pre>
2031
2032 !! html/php+tidy
2033 <p>a</p>
2034 <div>
2035 <pre>
2036 foo
2037 </pre></div>
2038 !! html/parsoid
2039 <p>a</p>
2040
2041 <div><pre>foo
2042 </pre></div>
2043 <pre></pre>
2044 !! end
2045
2046 !! test
2047 HTML pre followed by indent-pre
2048 !! wikitext
2049 <pre>foo</pre>
2050 bar
2051 !! html
2052 <pre>foo</pre>
2053 <pre>bar
2054 </pre>
2055 !! end
2056
2057 !!test
2058 Block tag pre
2059 !!options
2060 parsoid
2061 !! wikitext
2062 <p><pre>foo</pre></p>
2063 !! html
2064 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2065 !!end
2066
2067 !!test
2068 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2069 !! wikitext
2070 {{echo|}}
2071 !! html
2072
2073 !!end
2074
2075 !!test
2076 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2077 !! wikitext
2078 {{echo|
2079 foo}}
2080 !! html
2081 <p>foo
2082 </p>
2083 !!end
2084
2085 !! test
2086 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2087 !! wikitext
2088 {{echo|a
2089 b}}
2090 !! html
2091 <pre>a
2092 </pre>
2093 <p>b
2094 </p>
2095 !!end
2096
2097 !! test
2098 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2099 !! wikitext
2100 {{echo|a
2101 b
2102 c
2103 d
2104 e
2105 }}
2106 !! html
2107 <pre>a
2108 </pre>
2109 <p>b
2110 c
2111 </p>
2112 <pre>d
2113 </pre>
2114 <p>e
2115 </p>
2116 !!end
2117
2118 !!test
2119 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2120 !! wikitext
2121 {{echo| foo}}
2122
2123 {{echo| foo}}{{echo| bar}}
2124
2125 {{echo| foo}}
2126 {{echo| bar}}
2127
2128 {{echo|<!--cmt--> foo}}
2129
2130 <!--cmt-->{{echo| foo}}
2131
2132 {{echo|{{echo| }}bar}}
2133 !! html
2134 <pre>foo
2135 </pre>
2136 <pre>foo bar
2137 </pre>
2138 <pre>foo
2139 bar
2140 </pre>
2141 <pre>foo
2142 </pre>
2143 <pre>foo
2144 </pre>
2145 <pre>bar
2146 </pre>
2147 !!end
2148
2149 !! test
2150 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2151 !! wikitext
2152 {{echo| }}a
2153
2154 {{echo|
2155 }}a
2156
2157 {{echo|
2158 b}}
2159
2160 {{echo|a
2161 }}b
2162
2163 {{echo|a
2164 }} b
2165 !! html
2166 <pre>a
2167 </pre>
2168 <p><br />
2169 </p>
2170 <pre>a
2171 </pre>
2172 <p><br />
2173 </p>
2174 <pre>b
2175 </pre>
2176 <p>a
2177 </p>
2178 <pre>b
2179 </pre>
2180 <p>a
2181 </p>
2182 <pre>b
2183 </pre>
2184 !!end
2185
2186 !! test
2187 Things that look like <pre> tags aren't treated as such
2188 !! wikitext
2189 Barack Obama <President> of the United States
2190 <President></President>
2191 !! html
2192 <p>Barack Obama &lt;President&gt; of the United States
2193 &lt;President&gt;&lt;/President&gt;
2194 </p>
2195 !! end
2196
2197 ## PHP parser discards the "<pre " string
2198 !! test
2199 Handle broken pre-like tags (bug 64025)
2200 !! options
2201 parsoid=wt2html
2202 !! wikitext
2203 {{echo|<pre <pre>x</pre>}}
2204
2205 <table><pre </table>
2206 !! html/php
2207 <pre>x</pre>
2208 <table><pre></pre></table>
2209
2210 !! html/parsoid
2211 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2212
2213
2214 <p>&lt;pre </p>
2215
2216 <table></table>
2217 !! end
2218
2219 !! test
2220 Parsoid: handle pre with space after attribute
2221 !! options
2222 parsoid=wt2html
2223 !! wikitext
2224 <pre style="width:50%;" >{{echo|foo}}</pre>
2225 !! html
2226 <pre style="width:50%;">{{echo|foo}}</pre>
2227 !! end
2228
2229 # TODO / maybe: fix wt2wt for this
2230 !! test
2231 Parsoid: Don't paragraph-wrap fosterable content
2232 !! options
2233 parsoid=wt2html
2234 !! wikitext
2235 {|
2236 <td></td>
2237 <td></td>
2238
2239
2240
2241 |}
2242 !! html
2243 <table>
2244
2245 <tbody>
2246 <tr>
2247 <td></td>
2248
2249 <td></td></tr>
2250
2251
2252
2253 </tbody></table>
2254 !! end
2255
2256 !! test
2257 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2258 !! options
2259 parsoid=wt2html
2260 !! wikitext
2261 {|
2262 <td>
2263 <td>
2264 </td>
2265
2266
2267
2268 |}
2269 !! html
2270 <table>
2271
2272 <tbody>
2273 <tr>
2274 <td></td>
2275
2276 <td>
2277 </td></tr>
2278
2279
2280
2281 </tbody></table>
2282 !! end
2283
2284
2285 #--------------------------------------------------------------------
2286 # Transclusion parameter whitespace stripping tests
2287 # Behavior is different for positional and named parameters
2288 #--------------------------------------------------------------------
2289 !! test
2290 Templates: Strip leading and trailing whitespace from named-param values
2291 !! wikitext
2292 {{echo|1= a }}
2293
2294 {{echo|1= {{echo|b}} }}
2295
2296 {{echo| 1 =
2297 c }}
2298
2299 {{echo| 1 =
2300 * d
2301 }}
2302 !! html
2303 <p>a
2304 </p><p>b
2305 </p><p>c
2306 </p>
2307 <ul><li> d</li></ul>
2308
2309 !! end
2310
2311 !! test
2312 Templates: Don't strip whitespace from positional-param values
2313 !! wikitext
2314 {{echo|a }}
2315
2316 {{echo|{{echo|b}} }}
2317
2318 {{echo| c
2319 }}
2320
2321 {{echo| {{echo|d}}
2322 }}
2323
2324 {{echo|
2325 e}}
2326
2327 {{echo|
2328 * f}}
2329
2330 {{echo|
2331 }}g
2332 !! html
2333 <p>a
2334 </p><p>b
2335 </p>
2336 <pre>c
2337 </pre>
2338 <p><br />
2339 </p>
2340 <pre>d
2341 </pre>
2342 <p><br />
2343 </p>
2344 <pre>e
2345 </pre>
2346 <p><br />
2347 </p>
2348 <ul><li> f</li></ul>
2349 <p><br />
2350 </p>
2351 <pre>g
2352 </pre>
2353 !! end
2354
2355 !! test
2356 Templates: Handle empty comment-and-ws-only lines correctly
2357 !! wikitext
2358 {{echo|foo
2359 <!--should be ignored-->
2360 <!--should be ignored as well-->
2361 bar}}
2362 !! html
2363 <p>foo
2364 bar
2365 </p>
2366 !! end
2367
2368 !! test
2369 Templates: Handle comments in the target
2370 !! wikitext
2371 {{echo
2372 <!-- should be ignored -->
2373 |foo}}
2374
2375 {{echo<!-- should be ignored -->
2376 |foo}}
2377
2378 {{echo<!-- should be ignored -->|foo}}
2379
2380 {{<!-- should be ignored -->echo|foo}}
2381 !!html/parsoid
2382 <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>
2383
2384 <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>
2385
2386 <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>
2387
2388 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2389 !!end
2390
2391 !! test
2392 Templates: Handle comments in parameter names (bug 67657)
2393 !! wikitext
2394 {{echo|1
2395 <!-- should be ignored -->
2396 =foo}}
2397
2398 {{echo|
2399 <!-- should be ignored -->
2400 1 = foo}}
2401
2402 {{echo|1<!-- should be ignored --> = foo}}
2403
2404 {{echo|<!-- should be ignored -->1 = foo}}
2405 !!html/parsoid
2406 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2407
2408 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2409
2410 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2411
2412 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2413 !!end
2414
2415 !! test
2416 Templates: Other wikitext in parameter names (bug 67657)
2417 !! wikitext
2418 {{echo|''1''=foo}}
2419 !!html/parsoid
2420 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2421 !!html/php
2422 <p>{{{1}}}
2423 </p>
2424 !!end
2425
2426 #--------------------------------------------------------------------
2427 # Transclusion parameter escaping tests
2428 #--------------------------------------------------------------------
2429 !! test
2430 Templates: Parsoid parameter escaping test 1
2431 !! options
2432 parsoid
2433 !! wikitext
2434 {{echo|[foo]|{{echo|[bar]}}}}
2435 !! html
2436 <p about="#mwt1" typeof="mw:Transclusion"
2437 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2438 !! end
2439
2440 !! test
2441 Parsoid: Pipes in external links in template parameter
2442 !! options
2443 parsoid
2444 !! wikitext
2445 {{echo|[{{echo|http://example.com}} link]}}
2446 !! html
2447 <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>
2448 !! end
2449
2450 !! test
2451 Parsoid: pipe in transclusion parameter
2452 !! options
2453 parsoid
2454 !! wikitext
2455 {{echo|http://foo.com/a&#124;b}}
2456 !! html
2457 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2458 typeof="mw:Transclusion"
2459 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>
2460 !! end
2461
2462 !! test
2463 Parsoid: Pipe in external link target and content in template parameter
2464 !! options
2465 parsoid=html2wt,wt2wt
2466 !! wikitext
2467 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2468 !! html
2469 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2470 typeof="mw:Transclusion"
2471 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2472 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2473 !! end
2474
2475 !! test
2476 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2477 !! options
2478 parsoid
2479 !! wikitext
2480 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2481 !! html
2482 <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>
2483 !! end
2484
2485 !! test
2486 Templates: Don't escape already nowiki-escaped text in template parameters
2487 !! options
2488 parsoid=html2wt,wt2wt
2489 !! wikitext
2490 {{echo|foo<nowiki>|</nowiki>bar}}
2491 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2492 {{echo|<nowiki></nowiki>}}
2493 !! html
2494 <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>
2495 <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>
2496 <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>
2497 </p>
2498 !! end
2499
2500 ## Bug 52824
2501 !! test
2502 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2503 !! options
2504 parsoid=html2wt,wt2wt
2505 !! wikitext
2506 {{echo|{{echo|1=bar}}}}
2507 !! html
2508 <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>
2509 !! end
2510
2511 ## Bug 56733
2512 !! test
2513 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2514 !! options
2515 parsoid
2516 !! wikitext
2517 {{echo|a : b}}
2518 !! html
2519 <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>
2520 !! end
2521
2522 ###
2523 ### Parsoid-centric tests for testing RT edge cases for pre
2524 ###
2525
2526 !!test
2527 1a. Indent-Pre and Comments
2528 !! wikitext
2529 a
2530 <!--a-->
2531 c
2532 !! html
2533 <pre>a
2534 </pre>
2535 <p>c
2536 </p>
2537 !!end
2538
2539 !!test
2540 1b. Indent-Pre and Comments
2541 !! wikitext
2542 a
2543 <!--a-->
2544 c
2545 !! html
2546 <pre>a
2547 </pre>
2548 <p>c
2549 </p>
2550 !!end
2551
2552 !!test
2553 1c. Indent-Pre and Comments
2554 !! wikitext
2555 <!--a--> a
2556
2557 <!--a--> a
2558 !! html
2559 <pre> a
2560 </pre>
2561 <pre> a
2562 </pre>
2563 !!end
2564
2565 !!test
2566 1d. Indent-Pre and Comments
2567 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2568 !! wikitext
2569 <!--a--> a
2570
2571 <!--b-->b
2572 !! html
2573 <pre>a
2574 </pre>
2575 <pre>b
2576 </pre>
2577 !!end
2578
2579 !!test
2580 2a. Indent-Pre and tables
2581 !! wikitext
2582 {|
2583 |-
2584 !h1!!h2
2585 |foo||bar
2586 |}
2587 !! html
2588 <table>
2589
2590 <tr>
2591 <th>h1</th>
2592 <th>h2
2593 </th>
2594 <td>foo</td>
2595 <td>bar
2596 </td></tr></table>
2597
2598 !!end
2599
2600 !!test
2601 2b. Indent-Pre and tables
2602 !! wikitext
2603 {|
2604 |-
2605 |foo
2606 |}
2607 !! html
2608 <table>
2609
2610 <tr>
2611 <td>foo
2612 </td></tr></table>
2613
2614 !!end
2615
2616 !!test
2617 2c. Indent-Pre and tables (bug 42252)
2618 !! wikitext
2619 {|
2620 |+ foo
2621 ! | bar
2622 |}
2623 !! html
2624 <table>
2625 <caption> foo
2626 </caption>
2627 <tr>
2628 <th> bar
2629 </th></tr></table>
2630
2631 !!end
2632
2633 !!test
2634 2d. Indent-Pre and tables
2635 !! wikitext
2636 a
2637 {|
2638 | b
2639 |}
2640 !! html/php
2641 <pre>a
2642 </pre>
2643 <table>
2644 <tr>
2645 <td> b
2646 </td></tr></table>
2647
2648 !! html/parsoid
2649 <pre>a</pre>
2650 <table>
2651 <tbody><tr><td> b</td></tr>
2652 </tbody></table>
2653 !!end
2654
2655 !!test
2656 2e. Indent-Pre and table-line syntax
2657 !! wikitext
2658 a
2659 | b
2660 | c
2661 !! html/php
2662 <pre>a
2663 | b
2664 | c
2665 </pre>
2666 !!end
2667
2668 !!test
2669 2f. Indent-pre started by table-line syntax
2670 !! wikitext
2671 a
2672 | b
2673 | c
2674 !! html/php
2675 <p>a
2676 </p>
2677 <pre>| b
2678 | c
2679 </pre>
2680 !! html/parsoid
2681 <p>a</p>
2682 <pre>
2683 | b
2684 | c</pre>
2685 !!end
2686
2687 !!test
2688 3a. Indent-Pre and block tags (single-line html)
2689 !! wikitext
2690 a <p> foo </p>
2691 b <div> foo </div>
2692 c <blockquote> foo </blockquote>
2693 <span> foo </span>
2694 !! html
2695 a <p> foo </p>
2696 b <div> foo </div>
2697 c <blockquote> foo </blockquote>
2698 <pre><span> foo </span>
2699 </pre>
2700 !! html/parsoid
2701 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
2702 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
2703 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
2704 <pre><span> foo </span>
2705 </pre>
2706 !! html+tidy
2707 <p>a</p>
2708 <p>foo</p>
2709 <p>b</p>
2710 <div>foo</div>
2711 <p>c</p>
2712 <blockquote>
2713 <p>foo</p>
2714 </blockquote>
2715 <pre>
2716 <span> foo </span>
2717 </pre>
2718 !! end
2719
2720 !!test
2721 3b. Indent-Pre and block tags (multi-line html)
2722 !! wikitext
2723 a <span>foo</span>
2724 b <div> foo </div>
2725 !! html
2726 <pre>a <span>foo</span>
2727 </pre>
2728 b <div> foo </div>
2729
2730 !! html/parsoid
2731 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
2732 b <div data-parsoid='{"stx":"html"}'> foo </div>
2733 !! html+tidy
2734 <pre>
2735 a <span>foo</span>
2736 </pre>
2737 <p>b</p>
2738 <div>foo</div>
2739 !!end
2740
2741 !!test
2742 3c. Indent-Pre and block tags (pre-content on separate line)
2743 !! wikitext
2744 <p>
2745 foo
2746 </p>
2747
2748 <div>
2749 foo
2750 </div>
2751
2752 <center>
2753 foo
2754 </center>
2755
2756 <blockquote>
2757 foo
2758 </blockquote>
2759
2760 <blockquote>
2761 <pre>
2762 foo
2763 </pre>
2764 </blockquote>
2765
2766 <table><tr><td>
2767 foo
2768 </td></tr></table>
2769
2770 <ul><li>
2771 foo
2772 </li></ul>
2773
2774 !! html
2775 <p>
2776 foo
2777 </p>
2778 <div>
2779 <pre>foo
2780 </pre>
2781 </div>
2782 <center>
2783 <pre>foo
2784 </pre>
2785 </center>
2786 <blockquote>
2787 <p> foo
2788 </p>
2789 </blockquote>
2790 <blockquote>
2791 <pre>
2792 foo
2793 </pre>
2794 </blockquote>
2795 <table><tr><td>
2796 <pre>foo
2797 </pre>
2798 </td></tr></table>
2799 <ul><li>
2800 foo
2801 </li></ul>
2802
2803 !!end
2804
2805 !!test
2806 4. Indent-Pre and extension tags
2807 !! wikitext
2808 a <gallery>
2809 File:foobar.jpg
2810 </gallery>
2811 !! html
2812 a <ul class="gallery mw-gallery-traditional">
2813 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2814 <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>
2815 <div class="gallerytext">
2816 </div>
2817 </div></li>
2818 </ul>
2819
2820 !! html+tidy
2821 <p>a</p>
2822 <ul class="gallery mw-gallery-traditional">
2823 <li class="gallerybox" style="width: 155px">
2824 <div style="width: 155px">
2825 <div class="thumb" style="width: 150px;">
2826 <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>
2827 </div>
2828 <div class="gallerytext"></div>
2829 </div>
2830 </li>
2831 </ul>
2832 !!end
2833
2834 !! test
2835 Table wikitext syntax outside wiki-tables
2836 !! wikitext
2837 a
2838 ! not a table heading
2839 |- not a table row
2840 | not a table cell
2841 | class="foo bar" | baz
2842 b
2843 |}
2844 |-
2845 c
2846 !! html
2847 <p>a
2848 ! not a table heading
2849 |- not a table row
2850 | not a table cell
2851 | class="foo bar" | baz
2852 b
2853 |}
2854 |-
2855 c
2856 </p>
2857 !! end
2858
2859 !!test
2860 Render paragraphs when indent-pre is suppressed in blocklevels
2861 !! wikitext
2862 <blockquote>
2863 foo
2864
2865 bar
2866 </blockquote>
2867 !! html
2868 <blockquote>
2869 <p> foo
2870 </p><p> bar
2871 </p>
2872 </blockquote>
2873
2874 !!end
2875
2876 !!test
2877 4. Multiple spaces at start-of-line
2878 !! wikitext
2879 <p> foo </p>
2880 foo
2881 {|
2882 |foo
2883 |}
2884 !! html
2885 <p> foo </p>
2886 <pre> foo
2887 </pre>
2888 <table>
2889 <tr>
2890 <td>foo
2891 </td></tr></table>
2892
2893 !!end
2894
2895 ## NOTE: the leading white-space chars on empty line are significant
2896 !! test
2897 5a. White-space in indent-pre
2898 !! wikitext
2899 a<br />
2900
2901 b
2902 !! html
2903 <pre>a<br />
2904
2905 b
2906 </pre>
2907 !! end
2908
2909 ## NOTE: the leading white-space chars on empty line are significant
2910 !! test
2911 5b. White-space in indent-pre
2912 !! wikitext
2913 a
2914
2915 b
2916
2917
2918 c
2919 !! html
2920 <pre>a
2921
2922 b
2923
2924
2925 c
2926 </pre>
2927 !! end
2928
2929 !! test
2930 5c. White-space in indent-pre
2931 !! wikitext
2932 ''a''
2933 ''b''
2934 ''c''
2935 !! html
2936 <pre><i>a</i>
2937 <i>b</i>
2938 <i>c</i>
2939 </pre>
2940 !! end
2941
2942 !! test
2943 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2944 !! wikitext
2945 a
2946
2947 <!-- continue -->
2948 b
2949
2950 c
2951
2952 d
2953 !! html
2954 <pre>a
2955
2956 b
2957 </pre>
2958 <pre>c
2959
2960 </pre>
2961 <p>d
2962 </p>
2963 !! end
2964
2965 !! test
2966 7a. Indent-pre and category links
2967 !! options
2968 parsoid=wt2html,wt2wt
2969 !! wikitext
2970 [[Category:foo]] <!-- No pre-wrapping -->
2971 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2972 !! html
2973 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2974 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2975 !! end
2976
2977 !! test
2978 7b. Indent-pre and category links
2979 !! options
2980 parsoid=wt2html,wt2wt
2981 !! wikitext
2982 [[Category:foo]] a
2983 [[Category:foo]] {{echo|b}}
2984 !! html
2985 <pre>
2986 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2987 <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>
2988 !! end
2989
2990 ###
2991 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2992 ###
2993
2994 !!test
2995 HTML-pre: 1. embedded newlines
2996 !! wikitext
2997 <pre>foo</pre>
2998
2999 <pre>
3000 foo
3001 </pre>
3002
3003 <pre>
3004
3005 foo
3006 </pre>
3007
3008 <pre>
3009
3010
3011 foo
3012 </pre>
3013 !! html
3014 <pre>foo</pre>
3015 <pre>
3016 foo
3017 </pre>
3018 <pre>
3019
3020 foo
3021 </pre>
3022 <pre>
3023
3024
3025 foo
3026 </pre>
3027
3028 !! html/parsoid
3029 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3030
3031 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3032 foo
3033 </pre>
3034
3035 <pre data-parsoid='{"stx":"html"}'>
3036
3037 foo
3038 </pre>
3039
3040 <pre data-parsoid='{"stx":"html"}'>
3041
3042
3043 foo
3044 </pre>
3045 !!end
3046
3047 !! test
3048 HTML-pre: big spaces
3049 !! wikitext
3050 <pre>
3051
3052
3053
3054
3055 haha
3056
3057
3058
3059
3060 haha
3061
3062
3063
3064
3065 </pre>
3066 !! html
3067 <pre>
3068
3069
3070
3071
3072 haha
3073
3074
3075
3076
3077 haha
3078
3079
3080
3081
3082 </pre>
3083
3084 !! html/parsoid
3085 <pre data-parsoid='{"stx":"html"}'>
3086
3087
3088
3089
3090 haha
3091
3092
3093
3094
3095 haha
3096
3097
3098
3099
3100 </pre>
3101 !! end
3102
3103 !!test
3104 HTML-pre: 2: indented text
3105 !! wikitext
3106 <pre>
3107 foo
3108 </pre>
3109 !! html
3110 <pre>
3111 foo
3112 </pre>
3113
3114 !!end
3115
3116 !!test
3117 HTML-pre: 3: other wikitext
3118 !! wikitext
3119 <pre>
3120 * foo
3121 # bar
3122 = no-h =
3123 '' no-italic ''
3124 [[ NoLink ]]
3125 </pre>
3126 !! html
3127 <pre>
3128 * foo
3129 # bar
3130 = no-h =
3131 '' no-italic ''
3132 [[ NoLink ]]
3133 </pre>
3134
3135 !!end
3136
3137 ###
3138 ### Definition lists
3139 ###
3140 !! test
3141 Simple definition
3142 !! wikitext
3143 ; name : Definition
3144 !! html
3145 <dl><dt> name&#160;</dt>
3146 <dd> Definition</dd></dl>
3147
3148 !! end
3149
3150 !! test
3151 Definition list for indentation only
3152 !! wikitext
3153 : Indented text
3154 !! html
3155 <dl><dd> Indented text</dd></dl>
3156
3157 !! end
3158
3159 !! test
3160 Definition list with no space
3161 !! wikitext
3162 ;name:Definition
3163 !! html
3164 <dl><dt>name</dt>
3165 <dd>Definition</dd></dl>
3166
3167 !!end
3168
3169 !! test
3170 Definition list with URL link
3171 !! wikitext
3172 ; http://example.com/ : definition
3173 !! html
3174 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3175 <dd> definition</dd></dl>
3176
3177 !! end
3178
3179 !! test
3180 Definition list with bracketed URL link
3181 !! wikitext
3182 ;[http://www.example.com/ Example]:Something about it
3183 !! html
3184 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3185 <dd>Something about it</dd></dl>
3186
3187 !! end
3188
3189 !! test
3190 Definition list with wikilink containing colon
3191 !! wikitext
3192 ; [[Help:FAQ]]: The least-read page on Wikipedia
3193 !! html
3194 <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>
3195 <dd> The least-read page on Wikipedia</dd></dl>
3196
3197 !! end
3198
3199 # At Brion's and JeLuF's insistence... :)
3200 !! test
3201 Definition list with news link containing colon
3202 !! wikitext
3203 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3204 !! html
3205 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3206 <dd> This isn't even a real newsgroup!</dd></dl>
3207
3208 !! end
3209
3210 !! test
3211 Malformed definition list with colon
3212 !! wikitext
3213 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3214 !! html
3215 <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>
3216
3217 !! end
3218
3219 !! test
3220 Definition lists: colon in external link text
3221 !! wikitext
3222 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3223 !! html
3224 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3225 <dd> OK, I made that up</dd></dl>
3226
3227 !! end
3228
3229 !! test
3230 Definition lists: colon in HTML attribute
3231 !! wikitext
3232 ;<b style="display: inline">bold</b>
3233 !! html
3234 <dl><dt><b style="display: inline">bold</b></dt></dl>
3235
3236 !! end
3237
3238 !! test
3239 Definition lists: self-closed tag
3240 !! wikitext
3241 ;one<br/>two : two-line fun
3242 !! html
3243 <dl><dt>one<br />two&#160;</dt>
3244 <dd> two-line fun</dd></dl>
3245
3246 !! end
3247
3248 !! test
3249 Bug 11748: Literal closing tags
3250 !! wikitext
3251 <dl>
3252 <dt>test 1</dt>
3253 <dd>test test test test test</dd>
3254 <dt>test 2</dt>
3255 <dd>test test test test test</dd>
3256 </dl>
3257 !! html
3258 <dl>
3259 <dt>test 1</dt>
3260 <dd>test test test test test</dd>
3261 <dt>test 2</dt>
3262 <dd>test test test test test</dd>
3263 </dl>
3264
3265 !! end
3266
3267 !! test
3268 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3269 !! wikitext
3270 <ul><li>
3271 ; term : description
3272 * unordered
3273 </li></ul>
3274 !! html
3275 <ul><li>
3276 <dl><dt> term&#160;</dt>
3277 <dd> description</dd></dl>
3278 <ul><li> unordered</li></ul>
3279 </li></ul>
3280
3281 !! end
3282
3283 !! test
3284
3285 Definition list with empty definition and following paragraph
3286 !! wikitext
3287 ; term:
3288 Paragraph text
3289 !! html
3290 <dl><dt> term</dt>
3291 <dd></dd></dl>
3292 <p>Paragraph text
3293 </p>
3294 !! end
3295
3296 !! test
3297 Nested definition lists using html syntax
3298 !! wikitext
3299 <dl><dt>x</dt>
3300 <dd>a</dd>
3301 <dd>b</dd></dl>
3302
3303 !! end
3304
3305 !! test
3306 Definition Lists: No nesting: Multiple dd's
3307 !! wikitext
3308 ;x
3309 :a
3310 :b
3311 !! html
3312 <dl><dt>x</dt>
3313 <dd>a</dd>
3314 <dd>b</dd></dl>
3315
3316 !! end
3317
3318 !! test
3319 Definition Lists: Indentation: Regular
3320 !! wikitext
3321 :i1
3322 ::i2
3323 :::i3
3324 !! html
3325 <dl><dd>i1
3326 <dl><dd>i2
3327 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3328
3329 !! end
3330
3331 !! test
3332 Definition Lists: Indentation: Missing 1st level
3333 !! wikitext
3334 ::i2
3335 :::i3
3336 !! html
3337 <dl><dd><dl><dd>i2
3338 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3339
3340 !! end
3341
3342 !! test
3343 Definition Lists: Indentation: Multi-level indent
3344 !! wikitext
3345 :::i3
3346 !! html
3347 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3348
3349 !! end
3350
3351 !! test
3352 Definition Lists: Hacky use to indent tables
3353 !! wikitext
3354 ::{|
3355 |foo
3356 |bar
3357 |}
3358 this text
3359 should be left alone
3360 !! html
3361 <dl><dd><dl><dd><table>
3362 <tr>
3363 <td>foo
3364 </td>
3365 <td>bar
3366 </td></tr></table></dd></dl></dd></dl>
3367 <p>this text
3368 should be left alone
3369 </p>
3370 !! end
3371
3372 !! test
3373 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3374 !! wikitext
3375 <!-- foo -->
3376 ::{|
3377 |foo
3378 |bar
3379 |}<!-- bar -->
3380 this text
3381 should be left alone
3382 !! html/parsoid
3383 <!-- foo -->
3384 <dl><dd><dl><dd><table><tr>
3385 <td>foo</td>
3386 <td>bar</td>
3387 </tr></table><!-- bar --></dd></dl></dd></dl>
3388 <p>this text
3389 should be left alone</p>
3390 !! end
3391
3392 !! test
3393 Definition Lists: Hacky use to indent tables, with comment before table
3394 !! wikitext
3395 ::<!-- foo -->{|
3396 |foo
3397 |}
3398 !! html/parsoid
3399 <dl><dd><dl><dd><!-- foo --><table><tr>
3400 <td>foo</td>
3401 </tr></table></dd></dl></dd></dl>
3402 !! end
3403
3404 # Bug 52473
3405 !! test
3406 Definition Lists: Hacky use to indent tables (WS-insensitive)
3407 !! options
3408 parsoid
3409 !! wikitext
3410 : {|
3411 |a
3412 |}
3413 !! html
3414 <dl>
3415 <dd> <table><tr><td>a</td></tr></table> </dd>
3416 </dl>
3417 !! end
3418 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3419 ## as an empty dt item. It also ignores all but the last ";" when followed
3420 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3421 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3422 ## ";"s.
3423 ##
3424 ## Ex: ";;t2 ::d2" is transformed into:
3425 ##
3426 ## <dl>
3427 ## <dt>t2 </dt>
3428 ## <dd>
3429 ## <dl>
3430 ## <dt></dt>
3431 ## <dd>d2</dd>
3432 ## </dl>
3433 ## </dd>
3434 ## </dl>
3435 ##
3436 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3437 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3438 ##
3439 ## <dl>
3440 ## <dt>
3441 ## <dl>
3442 ## <dt>t2 </dt>
3443 ## <dd>:d2</dd>
3444 ## </dl>
3445 ## </dt>
3446 ## </dl>
3447 ##
3448 ## All Parsoid only definition list tests have this difference.
3449 ##
3450 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3451 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3452
3453 !! test
3454 Table / list interaction: indented table with lists in table contents
3455 !! wikitext
3456 :{|
3457 |-
3458 | a
3459 * b
3460 |-
3461 | c
3462 * d
3463 |}
3464 !! html
3465 <dl><dd><table>
3466
3467 <tr>
3468 <td> a
3469 <ul><li> b</li></ul>
3470 </td></tr>
3471 <tr>
3472 <td> c
3473 <ul><li> d</li></ul>
3474 </td></tr></table></dd></dl>
3475
3476 !! end
3477
3478 !!test
3479 Table / list interaction: lists nested in tables nested in indented lists
3480 !! wikitext
3481 :{|
3482 |
3483 :a
3484 :b
3485 |
3486 *c
3487 *d
3488 |}
3489
3490 *e
3491 *f
3492 !! html
3493 <dl><dd><table>
3494 <tr>
3495 <td>
3496 <dl><dd>a</dd>
3497 <dd>b</dd></dl>
3498 </td>
3499 <td>
3500 <ul><li>c</li>
3501 <li>d</li></ul>
3502 </td></tr></table></dd></dl>
3503 <ul><li>e</li>
3504 <li>f</li></ul>
3505
3506 !!end
3507
3508 !! test
3509 Definition Lists: Nesting: Multi-level (Parsoid only)
3510 !! options
3511 parsoid
3512 !! wikitext
3513 ;t1 :d1
3514 ;;t2 ::d2
3515 ;;;t3 :::d3
3516 !! html
3517 <dl>
3518 <dt>t1 </dt>
3519 <dd>d1</dd>
3520 <dt>
3521 <dl>
3522 <dt>t2 </dt>
3523 <dd>:d2</dd>
3524 <dt>
3525 <dl>
3526 <dt>t3 </dt>
3527 <dd>::d3</dd>
3528 </dl>
3529 </dt>
3530 </dl>
3531 </dt>
3532 </dl>
3533
3534
3535 !! end
3536
3537
3538 !! test
3539 Definition Lists: Nesting: Test 2 (Parsoid only)
3540 !! options
3541 parsoid
3542 !! wikitext
3543 ;t1
3544 ::d2
3545 !! html
3546 <dl>
3547 <dt>t1</dt>
3548 <dd>
3549 <dl>
3550 <dd>d2</dd>
3551 </dl>
3552 </dd>
3553 </dl>
3554
3555 !! end
3556
3557
3558 !! test
3559 Definition Lists: Nesting: Test 3 (Parsoid only)
3560 !! options
3561 parsoid
3562 !! wikitext
3563 :;t1
3564 ::::d2
3565 !! html
3566 <dl>
3567 <dd>
3568 <dl>
3569 <dt>t1</dt>
3570 <dd>
3571 <dl>
3572 <dd>
3573 <dl>
3574 <dd>d2</dd>
3575 </dl>
3576 </dd>
3577 </dl>
3578 </dd>
3579 </dl>
3580 </dd>
3581 </dl>
3582
3583 !! end
3584
3585
3586 !! test
3587 Definition Lists: Nesting: Test 4
3588 !! wikitext
3589 ::;t3
3590 :::d3
3591 !! html
3592 <dl><dd><dl><dd><dl><dt>t3</dt>
3593 <dd>d3</dd></dl></dd></dl></dd></dl>
3594
3595 !! end
3596
3597
3598 ## The Parsoid team believes the following three test exposes a
3599 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3600 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3601 ## It also exposes a "misfeature" in tidy, which doesn't like
3602 ## <dl> tags with a single <dt> child; it converts the <dt> into
3603 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3604 !! test
3605 Definition Lists: Mixed Lists: Test 1
3606 !! wikitext
3607 :;* foo
3608 ::* bar
3609 :; baz
3610 !! html/php
3611 <dl><dd><dl><dt><ul><li> foo</li>
3612 <li> bar</li></ul></dt></dl>
3613 <dl><dt> baz</dt></dl></dd></dl>
3614
3615 !! html/php+tidy
3616 <dl>
3617 <dd>
3618 <dl>
3619 <dd>
3620 <ul>
3621 <li>foo</li>
3622 <li>bar</li>
3623 </ul>
3624 </dd>
3625 </dl>
3626 <dl>
3627 <dt>baz</dt>
3628 </dl>
3629 </dd>
3630 </dl>
3631 !! html/parsoid
3632 <dl>
3633 <dd><dl>
3634 <dt><ul>
3635 <li> foo
3636 </li>
3637 </ul></dt>
3638 <dd><ul>
3639 <li> bar
3640 </li>
3641 </ul></dd>
3642 <dt> baz</dt>
3643 </dl></dd>
3644 </dl>
3645 !! end
3646
3647 !! test
3648 Definition Lists: Mixed Lists: Test 2
3649 !! wikitext
3650 *: d1
3651 *: d2
3652 !! html
3653 <ul><li><dl><dd> d1</dd>
3654 <dd> d2</dd></dl></li></ul>
3655
3656 !! end
3657
3658
3659 !! test
3660 Definition Lists: Mixed Lists: Test 3
3661 !! wikitext
3662 *::: d1
3663 *::: d2
3664 !! html
3665 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3666 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3667
3668 !! end
3669
3670
3671 !! test
3672 Definition Lists: Mixed Lists: Test 4
3673 !! wikitext
3674 *;d1 :d2
3675 *;d3 :d4
3676 !! html
3677 <ul><li><dl><dt>d1&#160;</dt>
3678 <dd>d2</dd>
3679 <dt>d3&#160;</dt>
3680 <dd>d4</dd></dl></li></ul>
3681
3682 !! end
3683
3684
3685 !! test
3686 Definition Lists: Mixed Lists: Test 5
3687 !! wikitext
3688 *:d1
3689 *:: d2
3690 !! html
3691 <ul><li><dl><dd>d1
3692 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3693
3694 !! end
3695
3696
3697 !! test
3698 Definition Lists: Mixed Lists: Test 6
3699 !! wikitext
3700 #*:d1
3701 #*::: d3
3702 !! html
3703 <ol><li><ul><li><dl><dd>d1
3704 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3705
3706 !! end
3707
3708
3709 !! test
3710 Definition Lists: Mixed Lists: Test 7
3711 !! wikitext
3712 :* d1
3713 :* d2
3714 !! html
3715 <dl><dd><ul><li> d1</li>
3716 <li> d2</li></ul></dd></dl>
3717
3718 !! end
3719
3720
3721 !! test
3722 Definition Lists: Mixed Lists: Test 8
3723 !! wikitext
3724 :* d1
3725 ::* d2
3726 !! html
3727 <dl><dd><ul><li> d1</li></ul>
3728 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3729
3730 !! end
3731
3732
3733 !! test
3734 Definition Lists: Mixed Lists: Test 9
3735 !! wikitext
3736 *;foo :bar
3737 !! html
3738 <ul><li><dl><dt>foo&#160;</dt>
3739 <dd>bar</dd></dl></li></ul>
3740
3741 !! end
3742
3743
3744 !! test
3745 Definition Lists: Mixed Lists: Test 10
3746 !! wikitext
3747 *#;foo :bar
3748 !! html
3749 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3750 <dd>bar</dd></dl></li></ol></li></ul>
3751
3752 !! end
3753
3754 # The Parsoid team disagrees with the PHP parser's seemingly-random
3755 # rules regarding dd/dt on the next two tests. Parsoid is more
3756 # consistent, and recognizes the shared nesting and keeps the
3757 # still-open tags around until the nesting is complete.
3758 # (And tidy again converts <dt> to <dd> before 'bar'.)
3759
3760 !! test
3761 Definition Lists: Mixed Lists: Test 11
3762 !! wikitext
3763 *#*#;*;;foo :bar
3764 *#*#;boo :baz
3765 !! html/php
3766 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3767 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3768 <dl><dt>boo&#160;</dt>
3769 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3770
3771 !! html/php+tidy
3772 <ul>
3773 <li>
3774 <ol>
3775 <li>
3776 <ul>
3777 <li>
3778 <ol>
3779 <li>
3780 <dl>
3781 <dt>foo&#160;</dt>
3782 <dd>
3783 <ul>
3784 <li>
3785 <dl>
3786 <dd>
3787 <dl>
3788 <dt>bar</dt>
3789 </dl>
3790 </dd>
3791 </dl>
3792 </li>
3793 </ul>
3794 </dd>
3795 </dl>
3796 <dl>
3797 <dt>boo&#160;</dt>
3798 <dd>baz</dd>
3799 </dl>
3800 </li>
3801 </ol>
3802 </li>
3803 </ul>
3804 </li>
3805 </ol>
3806 </li>
3807 </ul>
3808 !! html/parsoid
3809 <ul>
3810 <li>
3811 <ol>
3812 <li>
3813 <ul>
3814 <li>
3815 <ol>
3816 <li>
3817 <dl>
3818 <dt>
3819 <ul>
3820 <li>
3821 <dl>
3822 <dt>
3823 <dl>
3824 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3825 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3826 </dl></dt>
3827 </dl></li>
3828 </ul></dt>
3829 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3830 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3831 </dl></li>
3832 </ol></li>
3833 </ul></li>
3834 </ol></li>
3835 </ul>
3836 !! end
3837
3838
3839 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
3840 !! test
3841 Definition Lists: Weird Ones: Test 1
3842 !! wikitext
3843 *#;*::;; foo : bar (who uses this?)
3844 !! html/php
3845 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3846 <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>
3847
3848 !! html/php+tidy
3849 <ul>
3850 <li>
3851 <ol>
3852 <li>
3853 <dl>
3854 <dt>foo&#160;</dt>
3855 <dd>
3856 <ul>
3857 <li>
3858 <dl>
3859 <dd>
3860 <dl>
3861 <dd>
3862 <dl>
3863 <dd>
3864 <dl>
3865 <dt>bar (who uses this?)</dt>
3866 </dl>
3867 </dd>
3868 </dl>
3869 </dd>
3870 </dl>
3871 </dd>
3872 </dl>
3873 </li>
3874 </ul>
3875 </dd>
3876 </dl>
3877 </li>
3878 </ol>
3879 </li>
3880 </ul>
3881 !! html/parsoid
3882 <ul>
3883 <li>
3884 <ol>
3885 <li>
3886 <dl>
3887 <dt>
3888 <ul>
3889 <li>
3890 <dl>
3891 <dd>
3892 <dl>
3893 <dd>
3894 <dl>
3895 <dt>
3896 <dl>
3897 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3898 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3899 </dl></dt>
3900 </dl></dd>
3901 </dl></dd>
3902 </dl></li>
3903 </ul></dt>
3904 </dl></li>
3905 </ol></li>
3906 </ul>
3907 !! end
3908
3909 !! test
3910 Definition Lists: colons occurring in tags
3911 !! wikitext
3912 ;a:b
3913 ;'''a:b'''
3914 ;<i>a:b</i>
3915 ;<span>a:b</span>
3916 ;<div>a:b</div>
3917 ;{{echo|a:b}}
3918 ;{{echo|''a:b''}}
3919 !! html
3920 <dl><dt>a</dt>
3921 <dd>b</dd>
3922 <dt><b>a:b</b></dt>
3923 <dt><i>a:b</i></dt>
3924 <dt><span>a:b</span></dt>
3925 <dt><div>a:b</div></dt>
3926 <dt>a</dt>
3927 <dd>b</dd>
3928 <dt><i>a:b</i></dt></dl>
3929
3930 !! end
3931
3932 !! test
3933 Definition Lists: colons and tables 1
3934 !! wikitext
3935 :{|
3936 | x
3937 |}
3938 :{|
3939 | y
3940 |}
3941 !! html
3942 <dl><dd><table>
3943 <tr>
3944 <td> x
3945 </td></tr></table></dd></dl>
3946 <dl><dd><table>
3947 <tr>
3948 <td> y
3949 </td></tr></table></dd></dl>
3950
3951 !! end
3952
3953 # Parsoid's output (as documented below) differs from php's in this case.
3954 # This is probably a bug. If we fixup parsoid to match php's output, the
3955 # above test should pass and the below test case can be removed. It is
3956 # unclear which output is more desirable.
3957
3958 !! test
3959 Definition Lists: colons and tables 2
3960 !! wikitext
3961 :{|
3962 | x
3963 |}
3964 :{|
3965 | y
3966 |}
3967 !! html/parsoid
3968 <dl><dd><table>
3969 <tr>
3970 <td> x
3971 </td></tr></table></dd>
3972 <dd><table>
3973 <tr>
3974 <td> y
3975 </td></tr></table></dd></dl>
3976 !! end
3977
3978
3979 ###
3980 ### External links
3981 ###
3982 !! test
3983 External links: non-bracketed
3984 !! wikitext
3985 Non-bracketed: http://example.com
3986 !! html
3987 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3988 </p>
3989 !! end
3990
3991 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3992 !! test
3993 External links: numbered
3994 !! wikitext
3995 Numbered: [http://example.com]
3996 Numbered: [http://example.net]
3997 Numbered: [http://example.com]
3998 !! html/php
3999 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4000 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4001 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4002 </p>
4003 !! html/parsoid
4004 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4005 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4006 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4007 !!end
4008
4009 !! test
4010 External links: specified text
4011 !! wikitext
4012 Specified text: [http://example.com link]
4013 !! html
4014 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4015 </p>
4016 !!end
4017
4018 !! test
4019 External links: trail
4020 !! wikitext
4021 Linktrails should not work for external links: [http://example.com link]s
4022 !! html
4023 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4024 </p>
4025 !! end
4026
4027 !! test
4028 External links: dollar sign in URL
4029 !! wikitext
4030 http://example.com/1$2345
4031 !! html
4032 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4033 </p>
4034 !! end
4035
4036 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4037 !! test
4038 External links: dollar sign in URL (autonumber)
4039 !! wikitext
4040 [http://example.com/1$2345]
4041 !! html/php
4042 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4043 </p>
4044 !! html/parsoid
4045 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4046 !!end
4047
4048 !! test
4049 External links: open square bracket forbidden in URL (bug 4377)
4050 !! options
4051 parsoid=wt2html,wt2wt,html2html
4052 !! wikitext
4053 http://example.com/1[2345
4054 !! html/php
4055 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4056 </p>
4057 !! html/parsoid
4058 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4059 !! end
4060
4061 !! test
4062 External links: open square bracket forbidden in URL (named) (bug 4377)
4063 !! options
4064 parsoid=wt2html,html2html
4065 !! wikitext
4066 [http://example.com/1[2345]
4067 !! html/php
4068 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4069 </p>
4070 !! html/parsoid
4071 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4072 !!end
4073
4074 # parsoid adds a space before the link name
4075 !! test
4076 External links: open square bracket forbidden in URL (named) (bug 4377)
4077 Parsoid variant.
4078 !! wikitext
4079 [http://example.com/1 [2345]
4080 !! html
4081 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4082 </p>
4083 !!end
4084
4085 !! test
4086 External links: nowiki in URL link text (bug 6230)
4087 !! wikitext
4088 [http://example.com/ <nowiki>''example site''</nowiki>]
4089 !! html
4090 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4091 </p>
4092 !! end
4093
4094 !! test
4095 External links: newline forbidden in text (bug 6230 regression check)
4096 !! wikitext
4097 [http://example.com/ first
4098 second]
4099 !! html
4100 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4101 second]
4102 </p>
4103 !!end
4104
4105 !! test
4106 External links: Pipe char between url and text
4107 !! wikitext
4108 [http://example.com | link]
4109 !! html
4110 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4111 </p>
4112 !!end
4113
4114 !! test
4115 External links: protocol-relative URL in brackets
4116 !! wikitext
4117 [//example.com/ Test]
4118 !! html
4119 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4120 </p>
4121 !! end
4122
4123 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4124 !! test
4125 External links: protocol-relative URL in brackets without text
4126 !! wikitext
4127 [//example.com]
4128 !! html/php
4129 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4130 </p>
4131 !! html/parsoid
4132 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4133 !! end
4134
4135 !! test
4136 External links: protocol-relative URL in free text is left alone
4137 !! wikitext
4138 //example.com/Foo
4139 !! html
4140 <p>//example.com/Foo
4141 </p>
4142 !!end
4143
4144 !! test
4145 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4146 !! wikitext
4147 foo//example.com/Foo
4148 !! html
4149 <p>foo//example.com/Foo
4150 </p>
4151 !! end
4152
4153 !! test
4154 External links: with no contents
4155 !! wikitext
4156 [http://en.wikipedia.org/wiki/Foo]
4157
4158 [[wikipedia:Foo|Bar]]
4159
4160 [[wikipedia:Foo|<span>Bar</span>]]
4161 !! html/php
4162 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4163 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4164 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4165 </p>
4166 !! html/parsoid
4167 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4168 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4169 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4170 !! end
4171
4172 !! test
4173 External links: Free with trailing punctuation
4174 !! wikitext
4175 http://example.com,
4176 http://example.com;
4177 http://example.com\
4178 http://example.com.
4179 http://example.com:
4180 http://example.com!
4181 http://example.com?
4182 http://example.com)
4183 http://example.com/url_with_(brackets)
4184 (http://example.com/url_without_brackets)
4185 http://example.com/url_with_entity&nbsp;
4186 http://example.com/url_with_entity&#xA0;
4187 http://example.com/url_with_entity&#160;
4188 http://example.com/url_with_entity&lt;
4189 http://example.com/url_with_entity&#x3C;
4190 http://example.com/url_with_entity&#60;
4191 !! html
4192 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4193 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4194 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4195 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4196 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4197 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4198 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4199 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4200 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4201 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4202 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4203 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4204 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4205 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4206 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4207 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4208 </p>
4209 !! end
4210
4211 !! test
4212 External links: No preceding word characters allowed (bug 65278)
4213 !! wikitext
4214 NOPEhttp://example.com
4215 N0http://example.com
4216 ok:http://example.com
4217 ok-http://example.com
4218 !! html
4219 <p>NOPEhttp://example.com
4220 N0http://example.com
4221 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4222 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4223 </p>
4224 !! end
4225
4226 !! test
4227 External image
4228 !! wikitext
4229 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4230 !! html
4231 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4232 </p>
4233 !! end
4234
4235 !! test
4236 External image from https
4237 !! wikitext
4238 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4239 !! html
4240 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4241 </p>
4242 !! end
4243
4244 !! test
4245 External image (when not allowed)
4246 !! options
4247 wgAllowExternalImages=0
4248 !! wikitext
4249 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4250 !! html
4251 <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>
4252 </p>
4253 !! end
4254
4255 !! test
4256 Link to non-http image, no img tag
4257 !! wikitext
4258 Link to non-http image, no img tag: ftp://example.com/test.jpg
4259 !! html
4260 <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>
4261 </p>
4262 !! end
4263
4264 !! test
4265 External links: terminating separator
4266 !! wikitext
4267 Terminating separator: http://example.com/thing,
4268 !! html
4269 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4270 </p>
4271 !! end
4272
4273 !! test
4274 External links: intervening separator
4275 !! wikitext
4276 Intervening separator: http://example.com/1,2,3
4277 !! html
4278 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4279 </p>
4280 !! end
4281
4282 !! test
4283 External links: old bug with URL in query
4284 !! wikitext
4285 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4286 !! html
4287 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4288 </p>
4289 !! end
4290
4291 !! test
4292 External links: old URL-in-URL bug, mixed protocols
4293 !! wikitext
4294 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4295 !! html
4296 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4297 </p>
4298 !!end
4299
4300 !! test
4301 External links: URL in text
4302 !! wikitext
4303 URL in text: [http://example.com http://example.com]
4304 !! html
4305 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4306 </p>
4307 !! end
4308
4309 !! test
4310 External links: Clickable images
4311 !! wikitext
4312 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4313 !! html
4314 <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>
4315 </p>
4316 !!end
4317
4318 !! test
4319 External links: raw ampersand
4320 !! wikitext
4321 Old &amp; use: http://x&y
4322 !! html
4323 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4324 </p>
4325 !! end
4326
4327 !! test
4328 External links: encoded ampersand
4329 !! wikitext
4330 Old &amp; use: http://x&amp;y
4331 !! html/php
4332 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4333 </p>
4334 !! html/parsoid
4335 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4336 !! end
4337
4338 !! test
4339 External links: encoded equals (bug 6102)
4340 !! wikitext
4341 http://example.com/?foo&#61;bar
4342 !! html/php
4343 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4344 </p>
4345 !! html/parsoid
4346 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4347 !! end
4348
4349 ##
4350 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4351 ## does it number them. As discussed in bug 53505, we can identify
4352 ## autonumbered links via CSS.
4353 ##
4354
4355 !! test
4356 External links: [raw ampersand]
4357 !! wikitext
4358 Old &amp; use: [http://x&y]
4359 !! html/php
4360 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4361 </p>
4362 !! html/parsoid
4363 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4364 !! end
4365
4366 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4367 # mode will return the [raw ampersand] wikitext
4368 !! test
4369 External links: [encoded ampersand]
4370 !! options
4371 parsoid=wt2html,wt2wt,html2html
4372 !! wikitext
4373 Old &amp; use: [http://x&amp;y]
4374 !! html/php
4375 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4376 </p>
4377 !! html/parsoid
4378 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4379 !! end
4380
4381 !! test
4382 External links: [raw equals]
4383 !! wikitext
4384 [http://example.com/?foo=bar]
4385 !! html/php
4386 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4387 </p>
4388 !! html/parsoid
4389 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4390 !! end
4391
4392 # note that parsoid html is identical to [raw equals] case; so html2wt
4393 # mode will return the [raw equals] wikitext
4394 !! test
4395 External links: [encoded equals] (bug 6102)
4396 !! options
4397 parsoid=wt2html,wt2wt,html2html
4398 !! wikitext
4399 [http://example.com/?foo&#61;bar]
4400 !! html/php
4401 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4402 </p>
4403 !! html/parsoid
4404 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4405 !! end
4406
4407 # xxx parsoid strips the IDN character, so the round-trip tests will
4408 # obviously fail and are disabled. --cscott
4409 !! test
4410 External links: [IDN ignored character reference in hostname; strip it right off]
4411 !! options
4412 parsoid=wt2html,wt2wt,html2html
4413 !! wikitext
4414 [http://e&zwnj;xample.com/]
4415 !! html/php
4416 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4417 </p>
4418 !! html/parsoid
4419 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4420 !! end
4421
4422 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4423 # Where an external link could easily circumvent the sanitization of the text of
4424 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4425 # test demands a higher standard. That's a bit strange.
4426 #
4427 # Example:
4428 #
4429 # http://e‌xample.com -> [http://example.com|http://example.com]
4430 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4431 #
4432 # The first example is sanitized, but the second is not. Any security benefits
4433 # from this production are trivial to circumvent. Either remove this test and
4434 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4435 # the test accordingly.
4436 #
4437 # All our love,
4438 # The Parsoid team.
4439 # xxx parsoid strips the IDN character, so the round-trip tests will
4440 # obviously fail and are disabled. --cscott
4441 !! test
4442 External links: IDN ignored character reference in hostname; strip it right off
4443 !! options
4444 parsoid=wt2html,html2html
4445 !! wikitext
4446 http://e&zwnj;xample.com/
4447 !! html/php
4448 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4449 </p>
4450 !! html/parsoid
4451 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4452 !! end
4453
4454 !! test
4455 External links: www.jpeg.org (bug 554)
4456 !! wikitext
4457 http://www.jpeg.org
4458 !! html
4459 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4460 </p>
4461 !! end
4462
4463 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4464 !! test
4465 External links: URL within URL (original bug 2)
4466 !! wikitext
4467 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4468 !! html/php
4469 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4470 </p>
4471 !! html/parsoid
4472 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4473 !! end
4474
4475 !! test
4476 BUG 361: URL inside bracketed URL
4477 !! wikitext
4478 [http://www.example.com/foo http://www.example.com/bar]
4479 !! html
4480 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4481 </p>
4482 !! end
4483
4484 !! test
4485 BUG 361: URL within URL, not bracketed
4486 !! wikitext
4487 http://www.example.com/foo?=http://www.example.com/bar
4488 !! html
4489 <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>
4490 </p>
4491 !! end
4492
4493 !! test
4494 BUG 289: ">"-token in URL-tail
4495 !! wikitext
4496 http://www.example.com/<hello>
4497 !! html
4498 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4499 </p>
4500 !!end
4501
4502 !! test
4503 BUG 289: literal ">"-token in URL-tail
4504 !! wikitext
4505 http://www.example.com/<b>html</b>
4506 !! html
4507 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4508 </p>
4509 !!end
4510
4511 !! test
4512 BUG 289: ">"-token in bracketed URL
4513 !! wikitext
4514 [http://www.example.com/<hello> stuff]
4515 !! html
4516 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4517 </p>
4518 !!end
4519
4520 !! test
4521 BUG 289: literal ">"-token in bracketed URL
4522 !! wikitext
4523 [http://www.example.com/<b>html</b> stuff]
4524 !! html
4525 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4526 </p>
4527 !!end
4528
4529 !! test
4530 BUG 289: literal double quote at end of URL
4531 !! wikitext
4532 http://www.example.com/"hello"
4533 !! html
4534 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4535 </p>
4536 !!end
4537
4538 !! test
4539 BUG 289: literal double quote in bracketed URL
4540 !! wikitext
4541 [http://www.example.com/"hello" stuff]
4542 !! html
4543 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4544 </p>
4545 !!end
4546
4547 !! test
4548 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4549 !! wikitext
4550 [http://www.example.com test]
4551 !! html
4552 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4553 </p>
4554 !! end
4555
4556 !! test
4557 External links: link text with spaces
4558 !! wikitext
4559 [http://www.example.com a b c]
4560 [http://www.example.com ''a'' ''b'']
4561 !! html
4562 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4563 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4564 </p>
4565 !! end
4566
4567 !! test
4568 External links: wiki links within external link (Bug 3695)
4569 !! wikitext
4570 [http://example.com [[wikilink]] embedded in ext link]
4571 !! html/php
4572 <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>
4573 </p>
4574 !! html/parsoid
4575 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
4576 !! end
4577
4578 !! test
4579 BUG 787: Links with one slash after the url protocol are invalid
4580 !! wikitext
4581 http:/example.com
4582
4583 [http:/example.com title]
4584 !! html
4585 <p>http:/example.com
4586 </p><p>[http:/example.com title]
4587 </p>
4588 !! end
4589
4590 !! test
4591 Bracketed external links with template-generated invalid target
4592 !! wikitext
4593 [{{echo|http:/example.com}} title]
4594 !! html
4595 <p>[http:/example.com title]
4596 </p>
4597 !! end
4598
4599 !! test
4600 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4601 !! wikitext
4602 ''[http://example.com text'']
4603 [http://example.com '''text]'''
4604 ''Something [http://example.com in italic'']
4605 ''Something [http://example.com mixed''''', even bold]'''
4606 '''''Now [http://example.com both''''']
4607 !! html
4608 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4609 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4610 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4611 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4612 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4613 </p>
4614 !! end
4615
4616
4617 !! test
4618 Bug 4781: %26 in URL
4619 !! wikitext
4620 http://www.example.com/?title=AT%26T
4621 !! html/php
4622 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4623 </p>
4624 !! html/parsoid
4625 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4626 !! end
4627
4628 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4629 # % is actually legal in HTML5. Any change in output would need testing though.
4630 !! test
4631 Bug 4781, 5267: %25 in URL
4632 !! wikitext
4633 http://www.example.com/?title=100%25_Bran
4634 !! html/php
4635 <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>
4636 </p>
4637 !! html/parsoid
4638 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4639 !! end
4640
4641 !! test
4642 Bug 4781, 5267: %28, %29 in URL
4643 !! wikitext
4644 http://www.example.com/?title=Ben-Hur_%281959_film%29
4645 !! html/php
4646 <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>
4647 </p>
4648 !! html/parsoid
4649 <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>
4650 !! end
4651
4652
4653 !! test
4654 Bug 4781: %26 in autonumber URL
4655 !! wikitext
4656 [http://www.example.com/?title=AT%26T]
4657 !! html/php
4658 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4659 </p>
4660 !! html/parsoid
4661 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4662 !! end
4663
4664 !! test
4665 Bug 4781, 5267: %26 in autonumber URL
4666 !! wikitext
4667 [http://www.example.com/?title=100%25_Bran]
4668 !! html/php
4669 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4670 </p>
4671 !! html/parsoid
4672 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4673 !! end
4674
4675 !! test
4676 Bug 4781, 5267: %28, %29 in autonumber URL
4677 !! wikitext
4678 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4679 !! html/php
4680 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4681 </p>
4682 !! html/parsoid
4683 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4684 !! end
4685
4686
4687 !! test
4688 Bug 4781: %26 in bracketed URL
4689 !! wikitext
4690 [http://www.example.com/?title=AT%26T link]
4691 !! html/php
4692 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4693 </p>
4694 !! html/parsoid
4695 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4696 !! end
4697
4698 !! test
4699 Bug 4781, 5267: %25 in bracketed URL
4700 !! wikitext
4701 [http://www.example.com/?title=100%25_Bran link]
4702 !! html
4703 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4704 </p>
4705 !! end
4706
4707 !! test
4708 Bug 4781, 5267: %28, %29 in bracketed URL
4709 !! wikitext
4710 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4711 !! html/php
4712 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4713 </p>
4714 !! html/parsoid
4715 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4716 !! end
4717
4718 !! test
4719 External link containing a period in the anchor. (bug 63947)
4720 !! wikitext
4721 [//foo.org/bar#baz. bang]
4722
4723 [//foo.org/bar. bang]
4724 !! html/php
4725 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4726 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4727 </p>
4728 !! html/parsoid
4729 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4730 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4731 !! end
4732
4733 !! test
4734 External link containing a single quote. (bug 63947)
4735 !! wikitext
4736 [//foo.org/bar'baz]
4737
4738 [//foo.org/bar'baz bang]
4739 !! html/php
4740 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4741 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4742 </p>
4743 !! html/parsoid
4744 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4745 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4746 !! end
4747
4748
4749 !! test
4750 External link containing a period in the anchor. (bug 63947)
4751 !! wikitext
4752 [//foo.org/bar#baz. bang]
4753
4754 [//foo.org/bar. bang]
4755 !! html/php
4756 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4757 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4758 </p>
4759 !! html/parsoid
4760 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4761 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4762 !! end
4763
4764 !! test
4765 External link containing a single quote. (bug 63947)
4766 !! wikitext
4767 [//foo.org/bar'baz]
4768
4769 [//foo.org/bar'baz bang]
4770 !! html/php
4771 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4772 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4773 </p>
4774 !! html/parsoid
4775 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4776 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4777 !! end
4778
4779
4780 !! test
4781 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4782 !! wikitext
4783 Some [http://example.com/ pretty ''italics'' and stuff]!
4784 !! html
4785 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4786 </p>
4787 !! end
4788
4789 !! test
4790 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4791 !! wikitext
4792 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4793 !! html
4794 <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>
4795 </p>
4796 !! end
4797
4798 !! test
4799 External link containing double-single-quotes with no space separating the url from text in italics
4800 !! wikitext
4801 [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]].]
4802 !! html/php
4803 <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>
4804 </p>
4805 !! html/php+tidy
4806 <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>
4807 !! html/parsoid
4808 <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)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
4809 !! end
4810
4811 !! test
4812 External link with comments in link text
4813 !! wikitext
4814 [http://www.google.com Google <!-- comment -->]
4815 !! html
4816 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4817 </p>
4818 !! end
4819
4820 !! test
4821 URL-encoding in URL functions (single parameter)
4822 !! wikitext
4823 {{localurl:Some page|amp=&}}
4824 !! html
4825 <p>/index.php?title=Some_page&amp;amp=&amp;
4826 </p>
4827 !! end
4828
4829 !! test
4830 URL-encoding in URL functions (multiple parameters)
4831 !! wikitext
4832 {{localurl:Some page|q=?&amp=&}}
4833 !! html
4834 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4835 </p>
4836 !! end
4837
4838 !! test
4839 Brackets in urls
4840 !! wikitext
4841 http://example.com/index.php?foozoid%5B%5D=bar
4842
4843 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4844 !! html/php
4845 <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>
4846 </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>
4847 </p>
4848 !! html/parsoid
4849 <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>
4850
4851 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4852 !! end
4853
4854 !! test
4855 IPv6 urls (bug 21261)
4856 !! options
4857 disabled
4858 !! wikitext
4859 http://[2404:130:0:1000::187:2]/index.php
4860 !! html
4861 <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>
4862 </p>
4863 !! end
4864
4865 !! test
4866 Non-extlinks in brackets
4867 !! wikitext
4868 [foo]
4869 [foo bar]
4870 [foo ''bar'']
4871 [fool's] errand
4872 [fool's errand]
4873 [{{echo|foo}}]
4874 [{{echo|foo}} bar]
4875 [{{echo|foo}} ''bar'']
4876 [{{echo|foo}}l's] errand
4877 [{{echo|foo}}l's errand]
4878 [url={{echo|foo}}]
4879 [url=http://example.com]
4880 !! html
4881 <p>[foo]
4882 [foo bar]
4883 [foo <i>bar</i>]
4884 [fool's] errand
4885 [fool's errand]
4886 [foo]
4887 [foo bar]
4888 [foo <i>bar</i>]
4889 [fool's] errand
4890 [fool's errand]
4891 [url=foo]
4892 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4893 </p>
4894 !! end
4895
4896 !! test
4897 Percent encoding in external links
4898 !! wikitext
4899 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4900 !! html/php
4901 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4902 </p>
4903 !! html/parsoid
4904 <p><a rel="mw:ExtLink"
4905 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4906 !! end
4907
4908 !! test
4909 Use url link syntax for links where the content is equal the link target
4910 !! wikitext
4911 http://example.com
4912 !! html/php
4913 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4914 </p>
4915 !! html/parsoid
4916 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4917 !! end
4918
4919 !! test
4920 Parenthesis in external links, especially URL links
4921 !! wikitext
4922 http://example.com)
4923
4924 http://example.com/test)
4925
4926 http://example.com/(test)
4927
4928 http://example.com/((test)
4929
4930 (http://example.com/(test))
4931
4932 (http://example.com/(test)))))
4933
4934 http://example.com/a)b
4935
4936 [http://example.com) foo]
4937 !! html/php
4938 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4939 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4940 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4941 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4942 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4943 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4944 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4945 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4946 </p>
4947 !! html/parsoid
4948 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4949 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4950 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4951 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4952 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4953 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4954 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4955 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4956 !! end
4957
4958 !! test
4959 Parenthesis in external links, w/ transclusion or comment
4960 !! wikitext
4961 (http://example.com/{{echo|hi}})
4962
4963 (http://example.com<!-- hi -->)
4964 !! html/php
4965 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4966 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4967 </p>
4968 !! html/parsoid
4969 <p>(<a 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}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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]}\" 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}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
4970
4971 <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>
4972 !! end
4973
4974 !! test
4975 Replace invalid link targets when serializing
4976 !! options
4977 parsoid=html2wt
4978 !! html
4979 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
4980 !! wikitext
4981 [[MediaWiki:Badtitletext|Manual]]
4982 !! end
4983
4984 ###
4985 ### Quotes
4986 ###
4987
4988 !! test
4989 Quotes
4990 !! wikitext
4991 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4992
4993 Normal text. '''''Bold italic text.''''' Normal text.
4994 !! html
4995 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4996 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4997 </p>
4998 !! end
4999
5000
5001 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5002 # parser strips. The wikitext contains just the first half of the bold
5003 # quote pair.
5004 !! test
5005 Unclosed and unmatched quotes
5006 !! wikitext
5007 '''''Bold italic text '''with bold deactivated''' in between.'''''
5008
5009 '''''Bold italic text ''with italic deactivated'' in between.'''''
5010
5011 '''Bold text..
5012
5013 ..spanning two paragraphs (should not work).'''
5014
5015 '''Bold tag left open
5016
5017 ''Italic tag left open
5018
5019 Normal text.
5020
5021 <!-- Unmatching number of opening, closing tags: -->
5022 '''This year''''s election ''should'' beat '''last year''''s.
5023
5024 ''Tom'''s car is bigger than ''Susan'''s.
5025
5026 Plain ''italic'''s plain
5027 !! html/php
5028 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5029 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5030 </p><p><b>Bold text..</b>
5031 </p><p>..spanning two paragraphs (should not work).
5032 </p><p><b>Bold tag left open</b>
5033 </p><p><i>Italic tag left open</i>
5034 </p><p>Normal text.
5035 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5036 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5037 </p><p>Plain <i>italic'</i>s plain
5038 </p>
5039 !! html/parsoid
5040 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5041 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5042 </p><p><b>Bold text..</b>
5043 </p><p>..spanning two paragraphs (should not work).<b></b>
5044 </p><p><b>Bold tag left open</b>
5045 </p><p><i>Italic tag left open</i>
5046 </p><p>Normal text.
5047 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5048 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5049 </p><p>Plain <i>italic'</i>s plain
5050 </p>
5051 !! end
5052
5053 ###
5054 ### Tables
5055 ###
5056 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5057 ###
5058
5059 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5060 # is the bare minimum required by the spec, see:
5061 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5062 # Parsoid team replies: empty table tags are legal in HTML5
5063 !! test
5064 A table with no data.
5065 !! options
5066 parsoid=wt2html
5067 !! wikitext
5068 {||}
5069 !! html/php
5070
5071 !! html/parsoid
5072 <table></table>
5073
5074 !! end
5075
5076 !! test
5077 A table with stray table end tags on start tag line (wt2html)
5078 !! options
5079 parsoid=wt2html
5080 !! wikitext
5081 {|style="color: red;"|}
5082
5083 {|style="color: red;" |}
5084 |foo
5085 |}
5086
5087 {|style="color: red;"|} id="foo"
5088 |foo
5089 |}
5090
5091 {|style="color: red;" |} id="foo"
5092 |foo
5093 |}
5094 !! html
5095 <table style="color: red;"></table>
5096
5097 <table style="color: red;">
5098 <tbody><tr>
5099 <td>foo</td>
5100 </tr></tbody>
5101 </table>
5102
5103 <table style="color: red;" id="foo">
5104 <tbody><tr>
5105 <td>foo</td>
5106 </tr></tbody>
5107 </table>
5108
5109 <table style="color: red;" id="foo">
5110 <tbody><tr>
5111 <td>foo</td>
5112 </tr></tbody>
5113 </table>
5114
5115 !! end
5116
5117 !! test
5118 A table with no data (take 2)
5119 !! wikitext
5120 {|
5121 |}
5122 !! html/parsoid
5123 <table></table>
5124 !! end
5125
5126 # A table with nothing but a caption is invalid XHTML, we might want to render
5127 # this as <p>caption</p>
5128 # Parsoid team replies: table with only a caption is legal in HTML5
5129 !! test
5130 A table with nothing but a caption
5131 !! wikitext
5132 {|
5133 |+ caption
5134 |}
5135 !! html/php
5136 <table>
5137 <caption> caption
5138 </caption><tr><td></td></tr></table>
5139
5140 !! html/parsoid
5141 <table><caption> caption</caption></table>
5142 !! end
5143
5144 !! test
5145 A table with caption with default-spaced attributes and a table row
5146 !! wikitext
5147 {|
5148 |+ style="color: red;" | caption1
5149 |-
5150 | foo
5151 |}
5152 !! html
5153 <table>
5154 <caption style="color: red;"> caption1
5155 </caption>
5156 <tr>
5157 <td> foo
5158 </td></tr></table>
5159
5160 !! end
5161
5162 !! test
5163 A table with captions with non-default spaced attributes and a table row
5164 !! wikitext
5165 {|
5166 |+style="color: red;"|caption2
5167 |+ style="color: red;"| caption3
5168 |-
5169 | foo
5170 |}
5171 !! html
5172 <table>
5173 <caption style="color: red;">caption2
5174 </caption>
5175 <caption style="color: red;"> caption3
5176 </caption>
5177 <tr>
5178 <td> foo
5179 </td></tr></table>
5180
5181 !! end
5182
5183 !! test
5184 Table td-cell syntax variations
5185 !! wikitext
5186 {|
5187 | foo bar foo | baz
5188 | foo bar foo || baz
5189 | style='color:red;' | baz
5190 | style='color:red;' || baz
5191 |}
5192 !! html
5193 <table>
5194 <tr>
5195 <td> baz
5196 </td>
5197 <td> foo bar foo </td>
5198 <td> baz
5199 </td>
5200 <td style="color:red;"> baz
5201 </td>
5202 <td> style='color:red;' </td>
5203 <td> baz
5204 </td></tr></table>
5205
5206 !! end
5207
5208 !! test
5209 Simple table
5210 !! wikitext
5211 {|
5212 | 1 || 2
5213 |-
5214 | 3 || 4
5215 |}
5216 !! html
5217 <table>
5218 <tr>
5219 <td> 1 </td>
5220 <td> 2
5221 </td></tr>
5222 <tr>
5223 <td> 3 </td>
5224 <td> 4
5225 </td></tr></table>
5226
5227 !! end
5228
5229 !! test
5230 Simple table but with multiple dashes for row wikitext
5231 !! wikitext
5232 {|
5233 | foo
5234 |-----
5235 | bar
5236 |}
5237 !! html
5238 <table>
5239 <tr>
5240 <td> foo
5241 </td></tr>
5242 <tr>
5243 <td> bar
5244 </td></tr></table>
5245
5246 !! end
5247 !! test
5248 Multiplication table
5249 !! wikitext
5250 {| border="1" cellpadding="2"
5251 |+Multiplication table
5252 |-
5253 ! &times; !! 1 !! 2 !! 3
5254 |-
5255 ! 1
5256 | 1 || 2 || 3
5257 |-
5258 ! 2
5259 | 2 || 4 || 6
5260 |-
5261 ! 3
5262 | 3 || 6 || 9
5263 |-
5264 ! 4
5265 | 4 || 8 || 12
5266 |-
5267 ! 5
5268 | 5 || 10 || 15
5269 |}
5270 !! html
5271 <table border="1" cellpadding="2">
5272 <caption>Multiplication table
5273 </caption>
5274 <tr>
5275 <th> &#215; </th>
5276 <th> 1 </th>
5277 <th> 2 </th>
5278 <th> 3
5279 </th></tr>
5280 <tr>
5281 <th> 1
5282 </th>
5283 <td> 1 </td>
5284 <td> 2 </td>
5285 <td> 3
5286 </td></tr>
5287 <tr>
5288 <th> 2
5289 </th>
5290 <td> 2 </td>
5291 <td> 4 </td>
5292 <td> 6
5293 </td></tr>
5294 <tr>
5295 <th> 3
5296 </th>
5297 <td> 3 </td>
5298 <td> 6 </td>
5299 <td> 9
5300 </td></tr>
5301 <tr>
5302 <th> 4
5303 </th>
5304 <td> 4 </td>
5305 <td> 8 </td>
5306 <td> 12
5307 </td></tr>
5308 <tr>
5309 <th> 5
5310 </th>
5311 <td> 5 </td>
5312 <td> 10 </td>
5313 <td> 15
5314 </td></tr></table>
5315
5316 !! end
5317
5318 !! test
5319 Accept "||" in table headings
5320 !! wikitext
5321 {|
5322 !h1 || h2
5323 |}
5324 !! html
5325 <table>
5326 <tr>
5327 <th>h1 </th>
5328 <th> h2
5329 </th></tr></table>
5330
5331 !! end
5332
5333 !! test
5334 Accept "!!" in table data
5335 !! wikitext
5336 {|
5337 | Foo!! ||
5338 |}
5339 !! html
5340 <table>
5341 <tr>
5342 <td> Foo!! </td>
5343 <td>
5344 </td></tr></table>
5345
5346 !! html/parsoid
5347 <table>
5348 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
5349 </tbody></table>
5350 !! end
5351
5352 !! test
5353 Accept "||" in indented table headings
5354 !! wikitext
5355 :{|
5356 !h1 || h2
5357 |}
5358 !! html
5359 <dl><dd><table>
5360 <tr>
5361 <th>h1 </th>
5362 <th> h2
5363 </th></tr></table></dd></dl>
5364
5365 !! end
5366
5367 !! test
5368 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5369 !! wikitext
5370 {|
5371 !| h1
5372 || a
5373 |}
5374 !! html
5375 <table>
5376 <tr>
5377 <th> h1
5378 </th>
5379 <td> a
5380 </td></tr></table>
5381
5382 !! end
5383
5384 !!test
5385 Accept "| !" at start of line in tables (ignore !-attribute)
5386 !! wikitext
5387 {|
5388 |-
5389 | !style="color:red" | bar
5390 |}
5391 !! html
5392 <table>
5393
5394 <tr>
5395 <td> bar
5396 </td></tr></table>
5397
5398 !!end
5399
5400 !!test
5401 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 +/-
5402 !! wikitext
5403 {|
5404 |-
5405 |style='color:red;'|+1
5406 |style='color:blue;'|-1
5407 |-
5408 | 1 || 2 || 3
5409 | 1 ||+2 ||-3
5410 |-
5411 | +1
5412 | -1
5413 |}
5414 !! html
5415 <table>
5416
5417 <tr>
5418 <td style="color:red;">+1
5419 </td>
5420 <td style="color:blue;">-1
5421 </td></tr>
5422 <tr>
5423 <td> 1 </td>
5424 <td> 2 </td>
5425 <td> 3
5426 </td>
5427 <td> 1 </td>
5428 <td>+2 </td>
5429 <td>-3
5430 </td></tr>
5431 <tr>
5432 <td> +1
5433 </td>
5434 <td> -1
5435 </td></tr></table>
5436
5437 !!end
5438
5439 !! test
5440 Table rowspan
5441 !! wikitext
5442 {| border=1
5443 | Cell 1, row 1
5444 |rowspan=2| Cell 2, row 1 (and 2)
5445 | Cell 3, row 1
5446 |-
5447 | Cell 1, row 2
5448 | Cell 3, row 2
5449 |}
5450 !! html
5451 <table border="1">
5452 <tr>
5453 <td> Cell 1, row 1
5454 </td>
5455 <td rowspan="2"> Cell 2, row 1 (and 2)
5456 </td>
5457 <td> Cell 3, row 1
5458 </td></tr>
5459 <tr>
5460 <td> Cell 1, row 2
5461 </td>
5462 <td> Cell 3, row 2
5463 </td></tr></table>
5464
5465 !! end
5466
5467 !! test
5468 Nested table
5469 !! wikitext
5470 {| border=1
5471 | &alpha;
5472 |
5473 {| bgcolor=#ABCDEF border=2
5474 |nested
5475 |-
5476 |table
5477 |}
5478 |the original table again
5479 |}
5480 !! html
5481 <table border="1">
5482 <tr>
5483 <td> &#945;
5484 </td>
5485 <td>
5486 <table bgcolor="#ABCDEF" border="2">
5487 <tr>
5488 <td>nested
5489 </td></tr>
5490 <tr>
5491 <td>table
5492 </td></tr></table>
5493 </td>
5494 <td>the original table again
5495 </td></tr></table>
5496
5497 !! end
5498
5499 !! test
5500 Invalid attributes in table cell (bug 1830)
5501 !! wikitext
5502 {|
5503 |Cell:|broken
5504 |}
5505 !! html
5506 <table>
5507 <tr>
5508 <td>broken
5509 </td></tr></table>
5510
5511 !! end
5512
5513
5514 # The "|}" to close the table is missing from the input, so parsoid's
5515 # *2wt modes will fail.
5516 !! test
5517 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5518 !! options
5519 parsoid=wt2html,html2html
5520 !! wikitext
5521 {|
5522 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5523 !! html/php
5524 <table>
5525 <tr>
5526 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5527 <td>]" onmouseover="alert(document.cookie)"&gt;test
5528 </td>
5529 </tr>
5530 </table>
5531
5532 !! html/parsoid
5533 <table><tbody>
5534 <tr>
5535 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5536 !! end
5537
5538
5539 !! test
5540 Indented table markup mixed with indented pre content (proposed in bug 6200)
5541 !! wikitext
5542 <table>
5543 <tr>
5544 <td>
5545 Text that should be rendered preformatted
5546 </td>
5547 </tr>
5548 </table>
5549 !! html
5550 <table>
5551 <tr>
5552 <td>
5553 <pre>Text that should be rendered preformatted
5554 </pre>
5555 </td>
5556 </tr>
5557 </table>
5558
5559 !! end
5560
5561 !! test
5562 Template-generated table cell attributes and cell content
5563 !! wikitext
5564 {|
5565 |{{table_attribs}}
5566 | {{table_attribs}}
5567 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
5568 |align=center {{table_attribs}}
5569 | <!--foo--> align=center <!--bar--> {{table_attribs}}
5570 |}
5571 !! html
5572 <table>
5573 <tr>
5574 <td style="color: red"> Foo
5575 </td>
5576 <td style="color: red"> Foo
5577 </td>
5578 <td style="color: red"> Foo
5579 </td>
5580 <td align="center" style="color: red"> Foo
5581 </td>
5582 <td align="center" style="color: red"> Foo
5583 </td></tr></table>
5584
5585 !! end
5586
5587 !! test
5588 Template-generated table cell attributes and cell content (2)
5589 !! wikitext
5590 {|
5591 |align=center {{table_cells}}
5592 |}
5593 !! html
5594 <table>
5595 <tr>
5596 <td align="center" style="color: red"> Foo </td>
5597 <td> Bar </td>
5598 <td> Baz
5599 </td></tr></table>
5600
5601 !! end
5602
5603 !! test
5604 Table with row followed by newlines and table heading
5605 !! wikitext
5606 {|
5607 |-
5608
5609 ! foo
5610 |}
5611 !! html
5612 <table>
5613
5614
5615 <tr>
5616 <th> foo
5617 </th></tr></table>
5618
5619 !! end
5620
5621 !! test
5622 Table with empty line following the start tag
5623 !! wikitext
5624 {|
5625
5626 |-
5627 | foo
5628 |}
5629 !! html
5630 <table>
5631
5632
5633 <tr>
5634 <td> foo
5635 </td></tr></table>
5636
5637 !! end
5638
5639 # FIXME: Preserve the attribute properly (with an empty string as value) in
5640 # the PHP parser. Parsoid implements the behavior below.
5641 !! test
5642 Table attributes with empty value
5643 !! wikitext
5644 {|
5645 | style=| hello
5646 |}
5647 !! html/parsoid
5648 <table>
5649 <tbody>
5650 <tr>
5651 <td style=""> hello
5652 </td></tr></tbody></table>
5653
5654 !! end
5655
5656 !! test
5657 Wikitext table with a lot of comments
5658 !! wikitext
5659 {|
5660 <!-- c0 -->
5661 | foo
5662 <!-- c1 -->
5663 |- <!-- c2 -->
5664 <!-- c3 -->
5665 |<!-- c4 -->
5666 <!-- c5 -->
5667 |}
5668 !! html
5669 <table>
5670 <tr>
5671 <td> foo
5672 </td></tr>
5673 <tr>
5674 <td>
5675 </td></tr></table>
5676
5677 !! end
5678
5679 !! test
5680 Wikitext table with double-line table cell
5681 !! wikitext
5682 {|
5683 |a
5684 b
5685 |}
5686 !! html
5687 <table>
5688 <tr>
5689 <td>a
5690 <p>b
5691 </p>
5692 </td></tr></table>
5693
5694 !! end
5695
5696 !! test
5697 Table cell with a single comment
5698 !! wikitext
5699 {|
5700 | <!-- c1 -->
5701 | a
5702 |}
5703 !! html
5704 <table>
5705 <tr>
5706 <td>
5707 </td>
5708 <td> a
5709 </td></tr></table>
5710
5711 !! end
5712
5713 !! test
5714 Table-cell after a comment-only-empty-line
5715 !! wikitext
5716 {|
5717 |a
5718 <!--c1-->
5719 <!--c2-->| b
5720 |}
5721 !! html
5722 <table>
5723 <tr>
5724 <td>a
5725 </td>
5726 <td> b
5727 </td></tr></table>
5728
5729 !! html/parsoid
5730 <table>
5731 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5732 <!--c1-->
5733 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5734 </tbody></table>
5735
5736 !! end
5737
5738 !! test
5739 Build table with {{!}}
5740 !! wikitext
5741 {{{!}} class="wikitable"
5742 ! header
5743 ! second header
5744 {{!}}- style="color:red;"
5745 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
5746 {{!}}}
5747 !! html
5748 <table class="wikitable">
5749 <tr>
5750 <th> header
5751 </th>
5752 <th> second header
5753 </th></tr>
5754 <tr style="color:red;">
5755 <td> data </td>
5756 <td style="color:red;"> second data
5757 </td></tr></table>
5758
5759 !! end
5760
5761 !! test
5762 Build table with pipe as data
5763 !! wikitext
5764 {| class="wikitable"
5765 ! header
5766 ! second header
5767 |- style="color:red;"
5768 | data || style="color:red;" | second data
5769 |-
5770 | style="color:red;" | data with | || style="color:red;" | second data with |
5771 |-
5772 || data with | ||| second data with |
5773 |}
5774 !! html
5775 <table class="wikitable">
5776 <tr>
5777 <th> header
5778 </th>
5779 <th> second header
5780 </th></tr>
5781 <tr style="color:red;">
5782 <td> data </td>
5783 <td style="color:red;"> second data
5784 </td></tr>
5785 <tr>
5786 <td style="color:red;"> data with | </td>
5787 <td style="color:red;"> second data with |
5788 </td></tr>
5789 <tr>
5790 <td> data with | </td>
5791 <td> second data with |
5792 </td></tr></table>
5793
5794 !! end
5795
5796 !! test
5797 Build table with wikilink
5798 !! wikitext
5799 {| class="wikitable"
5800 ! header || second header
5801 |- style="color:red;"
5802 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
5803 |-
5804 | data || second data [[Main Page|link|text with pipe]]
5805 |}
5806 !! html
5807 <table class="wikitable">
5808 <tr>
5809 <th> header </th>
5810 <th> second header
5811 </th></tr>
5812 <tr style="color:red;">
5813 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
5814 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
5815 </td></tr>
5816 <tr>
5817 <td> data </td>
5818 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
5819 </td></tr></table>
5820
5821 !! end
5822
5823 # The expected HTML structure in this test is debatable. The PHP parser does
5824 # not parse this kind of table at all. The main focus for Parsoid is on
5825 # round-tripping, so this output is ok for now. TODO: revisit!
5826 !! test
5827 Wikitext table with html-syntax row
5828 !! wikitext
5829 {|
5830 |-
5831 <td>foo</td>
5832 |}
5833 !! html/parsoid
5834 <table>
5835 <tbody>
5836 <tr>
5837 <td>foo</td></tr></tbody></table>
5838 !! end
5839
5840 ## Note that Parsoid output differs from PHP and PHP+tidy here.
5841 ## The lack of <tr> tags in the PHP output is arguably a bug in the
5842 ## PHP parser, which tidy then compounds by fostering the content
5843 ## entirely out of the table. Parsoid recognizes the table context
5844 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
5845 ## depends on PHP's treatment of broken table markup!
5846 !! test
5847 Implicit <td> after a |-
5848 !! options
5849 parsoid=wt2html,html2html
5850 !! wikitext
5851 {|
5852 |-
5853 a
5854 |}
5855 !! html/php
5856 <table>
5857
5858 a
5859 </table>
5860
5861 !! html/php+tidy
5862 <p>a</p>
5863 !! html/parsoid
5864 <table>
5865 <tr><td>a</td></tr>
5866 </table>
5867 !! end
5868
5869 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
5870 !! test
5871 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
5872 !! options
5873 parsoid=wt2html,html2html
5874 !! wikitext
5875 {|
5876 |-
5877 |
5878 a
5879 |-
5880 b
5881 |}
5882 !! html/php
5883 <table>
5884
5885 <tr>
5886 <td>
5887 <pre>a
5888 </pre>
5889 </td></tr>
5890 b
5891 </table>
5892
5893 !! html/php+tidy
5894 <p>b</p>
5895 <table>
5896 <tr>
5897 <td>
5898 <pre>
5899 a
5900 </pre></td>
5901 </tr>
5902 </table>
5903 !! html/parsoid
5904 <table>
5905 <tbody>
5906 <tr><td><pre>a</pre></td></tr>
5907 <tr><td> b</td></tr>
5908 </tbody>
5909 </table>
5910 !! end
5911
5912 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
5913 # Parsoid generates the missing <td>, so wt2wt won't succeed.
5914 !! test
5915 Lists should be recognized in an implicit <td> context
5916 !! options
5917 parsoid=wt2html,html2html
5918 !! wikitext
5919 {|
5920 |-
5921 *a
5922 |}
5923 !! html/php
5924 <table>
5925
5926 <ul><li>a</li></ul>
5927 </table>
5928
5929 !! html/php+tidy
5930 <ul>
5931 <li>a</li>
5932 </ul>
5933 !! html/parsoid
5934 <table>
5935 <tr>
5936 <td><ul>
5937 <li>a</li>
5938 </ul></td>
5939 </tr>
5940 </table>
5941 !! end
5942
5943 !! test
5944 Parsoid: Round-trip tables directly followed by content (bug 51219)
5945 !! options
5946 parsoid=wt2html,wt2wt
5947 !! wikitext
5948 {|
5949 |foo
5950 |} bar
5951
5952 {|
5953 |baz
5954 |}<b>quux</b>
5955 !! html+tidy
5956 <table>
5957 <tr>
5958 <td>foo</td>
5959 </tr>
5960 </table>
5961 <p>bar</p>
5962 <table>
5963 <tr>
5964 <td>baz</td>
5965 </tr>
5966 </table>
5967 <p><b>quux</b></p>
5968 !! end
5969
5970 !! test
5971 Parsoid: Default to a newline after tables in new content (bug 51219)
5972 !! options
5973 parsoid=html2wt
5974 !! wikitext
5975 {|
5976 |foo
5977 |}
5978 <nowiki> </nowiki>bar
5979 {|
5980 |baz
5981 |}
5982 '''quux'''
5983 !! html
5984 <table><tbody>
5985 <tr><td>foo</td></tr></tbody></table> bar
5986 <table><tbody>
5987 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5988 !! end
5989
5990 !! test
5991 Parsoid: newline inducing block nodes don't suppress <nowiki>
5992 !! options
5993 parsoid=html2wt
5994 !! wikitext
5995 <nowiki> </nowiki>a
5996
5997 = foo =
5998 !! html
5999 a<h1>foo</h1>
6000 !! end
6001
6002 !! test
6003 Parsoid: Row-syntax table headings followed by comment & table cells
6004 !! options
6005 parsoid=wt2html,wt2wt
6006 !! wikitext
6007 {|
6008 ! foo || bar
6009 <!-- foo --> || baz || quux
6010 |}
6011 !! html/php
6012 <table>
6013 <tr>
6014 <th> foo </th>
6015 <th> bar
6016 </th>
6017 <td> baz </td>
6018 <td> quux
6019 </td></tr></table>
6020
6021 !! html/parsoid
6022 <table>
6023 <tbody><tr><th> foo </th><th> bar
6024 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6025 </tbody></table>
6026 !! end
6027
6028
6029 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6030 # preserves it.
6031 !!test
6032 Parsoid: Recover better from broken table attributes
6033 !!options
6034 parsoid=wt2html
6035 !!wikitext
6036 {| class="foo
6037 | class="bar" |
6038 foo
6039 |}
6040 !!html/php+tidy
6041 <table>
6042 <tr>
6043 <td class="bar">
6044 <p>foo</p>
6045 </td>
6046 </tr>
6047 </table>
6048 !!html/parsoid
6049 <table class="foo">
6050 <tr>
6051 <td class="bar">
6052 <p>foo</p></td></tr>
6053 </tbody></table>
6054 !!end
6055
6056 !! test
6057 Strip unsupported table tags
6058 !! options
6059 parsoid=html2wt
6060 !! html
6061 <table>
6062 <thead>
6063 <tr>
6064 <th>Month</th>
6065 <th>Savings</th>
6066 </tr>
6067 </thead>
6068 <tbody>
6069 <tr>
6070 <td>January</td>
6071 <td>$100</td>
6072 </tr>
6073 <tr>
6074 <td>February</td>
6075 <td>$80</td>
6076 </tr>
6077 </tbody>
6078 <tfoot>
6079 <tr>
6080 <td>Sum</td>
6081 <td>$180</td>
6082 </tr>
6083 </tfoot>
6084 </table>
6085 !! wikitext
6086 {|
6087
6088 !Month
6089 !Savings
6090
6091 |January
6092 |$100
6093
6094 |-
6095 |February
6096 |$80
6097
6098 |Sum
6099 |$180
6100
6101 |}
6102 !! end
6103
6104 ###
6105 ### Internal links
6106 ###
6107 !! test
6108 Plain link, capitalized
6109 !! wikitext
6110 [[Main Page]]
6111 !! html
6112 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6113 </p>
6114 !! end
6115
6116 !! test
6117 Plain link, uncapitalized
6118 !! wikitext
6119 [[main Page]]
6120 !! html
6121 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6122 </p>
6123 !! end
6124
6125 !! test
6126 Piped link
6127 !! wikitext
6128 [[Main Page|The Main Page]]
6129 !! html
6130 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6131 </p>
6132 !! end
6133
6134 !! test
6135 Piped link with comment in link text
6136 !! wikitext
6137 [[Main Page|The Main<!--front--> Page]]
6138 !! html
6139 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6140 </p>
6141 !! end
6142
6143 !! test
6144 Piped link with multiple pipe characters in link text
6145 !! wikitext
6146 [[Main Page||The|Main|Page|]]
6147 !! html/php
6148 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6149 </p>
6150 !! html/parsoid
6151 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6152 !! end
6153
6154 !! test
6155 Broken link
6156 !! wikitext
6157 [[Zigzagzogzagzig]]
6158 !! html
6159 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6160 </p>
6161 !! end
6162
6163 !! test
6164 Broken link with fragment
6165 !! wikitext
6166 [[Zigzagzogzagzig#zug]]
6167 !! html
6168 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6169 </p>
6170 !! end
6171
6172 !! test
6173 Special page link with fragment
6174 !! wikitext
6175 [[Special:Version#anchor]]
6176 !! html
6177 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6178 </p>
6179 !! end
6180
6181 !! test
6182 Nonexistent special page link with fragment
6183 !! wikitext
6184 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6185 !! html
6186 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6187 </p>
6188 !! end
6189
6190 !! test
6191 Link with prefix
6192 !! wikitext
6193 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6194 !! html
6195 <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>
6196 </p>
6197 !! end
6198
6199 !! test
6200 Link with suffix
6201 !! wikitext
6202 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6203 !! html
6204 <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>!!!
6205 </p>
6206 !! end
6207
6208 !! article
6209 prefixed article
6210 !! text
6211 Some text
6212 !! endarticle
6213
6214 !! test
6215 Bug 43661: Piped links with identical prefixes
6216 !! wikitext
6217 [[prefixed article|prefixed articles with spaces]]
6218
6219 [[prefixed article|prefixed articlesaoeu]]
6220
6221 [[Main Page|Main Page test]]
6222 !! html
6223 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6224 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6225 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6226 </p>
6227 !! end
6228
6229
6230 !! test
6231 Link with HTML entity in suffix / tail
6232 !! wikitext
6233 [[Main Page]]&quot;, [[Main Page]]&#97;
6234 !! html
6235 <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;
6236 </p>
6237 !! end
6238
6239 !! test
6240 Link with 3 brackets
6241 !! wikitext
6242 [[[Main Page]]]
6243 !! html
6244 <p>[[[Main Page]]]
6245 </p>
6246 !! end
6247
6248 !! test
6249 Link with 4 brackets
6250 !! wikitext
6251 [[[[Main Page]]]]
6252 !! html
6253 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6254 </p>
6255 !! end
6256
6257 !! test
6258 Piped link with 3 brackets
6259 !! wikitext
6260 [[[main page|the main page]]]
6261 !! html
6262 <p>[[[main page|the main page]]]
6263 </p>
6264 !! end
6265
6266 !! test
6267 Piped link with extlink-like text
6268 !! wikitext
6269 [[Main Page|[bar]]]
6270 [[Main Page|This is a [bar]]]
6271 !! html
6272 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6273 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6274 </p>
6275 !! end
6276
6277 !! test
6278 Link with multiple pipes
6279 !! wikitext
6280 [[Main Page|The|Main|Page]]
6281 !! html
6282 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6283 </p>
6284 !! end
6285
6286 # Note that parsoid does not munge anchor text; all non-space
6287 # characters are valid in HTML5 ids.
6288 !! test
6289 Anchor containing a #. (bug 63430)
6290 !! wikitext
6291 [[Main Page#And#Link]]
6292 !! html/php
6293 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6294 </p>
6295 !! html/parsoid
6296 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6297 !! end
6298
6299 !! test
6300 Link to namespaces
6301 !! wikitext
6302 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6303 !! html
6304 <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>
6305 </p>
6306 !! end
6307
6308 !! test
6309 Link with space in namespace
6310 !! wikitext
6311 [[User talk:Foo bar]]
6312 !! html
6313 <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>
6314 </p>
6315 !! end
6316
6317 !! article
6318 MemoryAlpha:AlphaTest
6319 !! text
6320 This is an article in the MemoryAlpha namespace
6321 (which shadows the memoryalpha interwiki link).
6322 !! endarticle
6323
6324 !! test
6325 Namespace takes precedence over interwiki link (bug 51680)
6326 !! wikitext
6327 [[MemoryAlpha:AlphaTest]]
6328 !! html
6329 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6330 </p>
6331 !! end
6332
6333 # The previous test doesn't work correctly in html2*, due to not recognizing the
6334 # link as an internal one. This one checks for the correct behavior.
6335 !! test
6336 Link to namespace preferred over interwiki with correct rel attribute
6337 !! options
6338 parsoid=html2wt,html2html
6339 !! wikitext
6340 [[MemoryAlpha:AlphaTest]]
6341 !! html
6342 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6343 </p>
6344 !! end
6345
6346 !! test
6347 Piped link to namespace
6348 !! wikitext
6349 [[Meta:Disclaimers|The disclaimers]]
6350 !! html
6351 <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>
6352 </p>
6353 !! end
6354
6355 !! test
6356 Link containing }
6357 !! wikitext
6358 [[Usually caused by a typo (oops}]]
6359 !! html
6360 <p>[[Usually caused by a typo (oops}]]
6361 </p>
6362 !! end
6363
6364 !! article
6365 7% Solution
6366 !! text
6367 Just a test of an article title containing a percent.
6368 !! endarticle
6369
6370 !! test
6371 Link containing % (not as a hex sequence)
6372 !! wikitext
6373 [[7% Solution]]
6374 !! html/php
6375 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6376 </p>
6377 !! html/parsoid
6378 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6379 !! end
6380
6381 # note that the parsoid HTML is identical to the previous test output,
6382 # so the previous test ensures that the html2wt mode will generate the
6383 # "not as a hex sequence" wikitext.
6384 !! test
6385 Link containing % as a single hex sequence interpreted to char
6386 !! options
6387 parsoid=wt2wt,wt2html,html2html
6388 !! wikitext
6389 [[7%25 Solution]]
6390 !! html/php
6391 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6392 </p>
6393 !! html/parsoid
6394 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6395 !!end
6396
6397 !! test
6398 Link containing % as a double hex sequence interpreted to hex sequence
6399 !! wikitext
6400 [[7%2525 Solution]]
6401 !! html
6402 <p>[[7%2525 Solution]]
6403 </p>
6404 !!end
6405
6406 # note that parsoid does not munge anchor text; all non-space
6407 # characters are valid in HTML5 anchors.
6408 !! test
6409 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6410 Example for such a section: == < ==
6411 !! wikitext
6412 [[%23%3c]][[%23%3e]]
6413 !! html/php
6414 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6415 </p>
6416 !! html/parsoid
6417 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E" title="Main Page">#></a></p>
6418 !! end
6419
6420 !! test
6421 Link containing "<#" and ">#" as a hex sequences
6422 !! wikitext
6423 [[%3c%23]][[%3e%23]]
6424 !! html
6425 <p>[[%3c%23]][[%3e%23]]
6426 </p>
6427 !! end
6428
6429 !! test
6430 Link containing an equals sign
6431 !! wikitext
6432 [[Special:BookSources/isbn=4-00-026157-6]]
6433 !! html/php
6434 <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>
6435 </p>
6436 !! html/parsoid
6437 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
6438 !! end
6439
6440 !! article
6441 Foo~bar
6442 !! text
6443 Just a test of an article title containing a tilde.
6444 !! endarticle
6445
6446 # note that links containing signatures, like [[Foo~~~~]], are
6447 # massaged by the pre-save transform (PST) and so the tildes are never
6448 # seen by the parser.
6449 !! test
6450 Link containing a tilde
6451 !! wikitext
6452 [[Foo~bar]]
6453 !! html/php
6454 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6455 </p>
6456 !! html/parsoid
6457 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6458 !! end
6459
6460 !! test
6461 Link containing double-single-quotes '' (bug 4598)
6462 !! wikitext
6463 [[Lista d''e paise d''o munno]]
6464 !! html/php
6465 <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>
6466 </p>
6467 !! html/parsoid
6468 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
6469 !! end
6470
6471 !! test
6472 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6473 !! wikitext
6474 Some [[Link|pretty ''italics'' and stuff]]!
6475 !! html/php
6476 <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>!
6477 </p>
6478 !! html/parsoid
6479 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6480 !! end
6481
6482 !! test
6483 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6484 !! wikitext
6485 ''Some [[Link|pretty ''italics'' and stuff]]!''
6486 !! html
6487 <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>
6488 </p>
6489 !! end
6490
6491 !! test
6492 Link with double quotes in title part (literal) and alternate part (interpreted)
6493 !! wikitext
6494 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
6495
6496 [[''Pentecoste'']]
6497
6498 [[''Pentecoste''|Pentecoste]]
6499
6500 [[''Pentecoste''|''Pentecoste'']]
6501 !! html/php
6502 <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>
6503 </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>
6504 </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>
6505 </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>
6506 </p>
6507 !! html/parsoid
6508 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></span></p>
6509 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6510 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6511 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6512 !! end
6513
6514 !! test
6515 Broken image links with HTML captions (bug 39700)
6516 !! wikitext
6517 [[File:Nonexistent|<script></script>]]
6518 [[File:Nonexistent|100x100px|<script></script>]]
6519 [[File:Nonexistent|&lt;]]
6520 [[File:Nonexistent|a<i>b</i>c]]
6521 !! html/php
6522 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6523 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6524 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6525 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6526 </p>
6527 !! html/parsoid
6528 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&lt;/script>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
6529 <span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100"/></a></span>
6530 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
6531 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i>b&lt;/i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p>
6532 !! end
6533
6534 !! test
6535 Plain link to URL
6536 !! wikitext
6537 [[http://www.example.com]]
6538 !! html/php
6539 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6540 </p>
6541 !! html/parsoid
6542 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6543 !! end
6544
6545 !! test
6546 Plain link to URL with link text
6547 !! wikitext
6548 [[http://www.example.com Link text]]
6549 !! html
6550 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6551 </p>
6552 !! end
6553
6554 !! test
6555 Plain link to protocol-relative URL
6556 !! wikitext
6557 [[//www.example.com]]
6558 !! html/php
6559 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6560 </p>
6561 !! html/parsoid
6562 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6563 !! end
6564
6565 !! test
6566 Plain link to protocol-relative URL with link text
6567 !! wikitext
6568 [[//www.example.com Link text]]
6569 !! html
6570 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6571 </p>
6572 !! end
6573
6574 !! test
6575 Plain link to page with question mark in title
6576 !! wikitext
6577 [[A?b]]
6578
6579 [[A?b|Baz]]
6580 !! html
6581 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6582 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6583 </p>
6584 !! end
6585
6586
6587 # I'm fairly sure the expected result here is wrong.
6588 # We want these to be URL links, not pseudo-pages with URLs for titles....
6589 # However the current output is also pretty screwy.
6590 #
6591 # ----
6592 # I'm changing it to match the current output--it arguably makes more
6593 # sense in the light of the test above. Old expected result was:
6594 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6595 #</p>
6596 # But I think this test is bordering on "garbage in, garbage out" anyway.
6597 # -- wtm
6598 !! test
6599 Piped link to URL
6600 !! wikitext
6601 Piped link to URL: [[http://www.example.com|an example URL]]
6602 !! html/php
6603 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6604 </p>
6605 !! html/parsoid
6606 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6607 !! end
6608
6609 !! test
6610 BUG 2: [[page|http://url/]] should link to page, not http://url/
6611 !! wikitext
6612 [[Main Page|http://url/]]
6613 !! html/php
6614 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6615 </p>
6616 !! html/parsoid
6617 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6618 !! end
6619
6620 # Parsoid does not mark self-links, by design.
6621 !! test
6622 BUG 337: Escaped self-links should be bold
6623 !! options
6624 title=[[Bug462]]
6625 !! wikitext
6626 [[Bu&#103;462]] [[Bug462]]
6627 !! html/php
6628 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6629 </p>
6630 !! html/php+tidy
6631 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6632 !! html/parsoid
6633 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6634 !! end
6635
6636 !! test
6637 Self-link to section should not be bold
6638 !! options
6639 title=[[Main Page]]
6640 !! wikitext
6641 [[Main Page#section]]
6642 !! html
6643 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6644 </p>
6645 !! end
6646
6647 !! article
6648 00
6649 !! text
6650 This is 00.
6651 !! endarticle
6652
6653 !!test
6654 Self-link to numeric title
6655 !!options
6656 title=[[0]]
6657 !! wikitext
6658 [[0]]
6659 !! html
6660 <p><strong class="selflink">0</strong>
6661 </p>
6662 !!end
6663
6664 !!test
6665 Link to numeric-equivalent title
6666 !!options
6667 title=[[0]]
6668 !! wikitext
6669 [[00]]
6670 !! html
6671 <p><a href="/wiki/00" title="00">00</a>
6672 </p>
6673 !!end
6674
6675 !! test
6676 <nowiki> inside a link
6677 !! wikitext
6678 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6679 !! html
6680 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6681 </p>
6682 !! end
6683
6684 !! test
6685 Non-breaking spaces in title
6686 !! wikitext
6687 [[&nbsp; Main &nbsp; Page &nbsp;]]
6688 !! html
6689 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6690 </p>
6691 !!end
6692
6693 !! test
6694 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6695 !! options
6696 language=ca
6697 !! wikitext
6698 '''[[Main Page]]'''
6699 !! html
6700 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6701 </p>
6702 !! end
6703
6704 !! test
6705 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6706 !! options
6707 language=ca
6708 !! wikitext
6709 ''[[Main Page]]''
6710 !! html
6711 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6712 </p>
6713 !! end
6714
6715 !! test
6716 Internal link with en linktrail: no apostrophes (bug 27473)
6717 !! options
6718 language=en
6719 !! wikitext
6720 [[Something]]'nice
6721 !! html
6722 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6723 </p>
6724 !! end
6725
6726 !! test
6727 Internal link with ca linktrail with apostrophes (bug 27473)
6728 !! options
6729 language=ca
6730 !! wikitext
6731 [[Something]]'nice
6732 !! html
6733 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6734 </p>
6735 !! end
6736
6737 !! test
6738 Internal link with kaa linktrail with apostrophes (bug 27473)
6739 !! options
6740 language=kaa
6741 !! wikitext
6742 [[Something]]'nice
6743 !! html
6744 <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>
6745 </p>
6746 !! end
6747
6748 !! test
6749 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6750 !! wikitext
6751 [[User:Foo/Test/63636:Bar|Test]]
6752 !! html/php
6753 <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>
6754 </p>
6755 !! html/parsoid
6756 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
6757 !! end
6758
6759 !! test
6760 Purely hash wikilink
6761 !! options
6762 title=[[User:test/123]]
6763 !! wikitext
6764 [[#a|b]]
6765 !! html/php
6766 <p><a href="#a">b</a>
6767 </p>
6768 !! html/parsoid
6769 <p><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>
6770 !! end
6771
6772 !! test
6773 1. Interaction of linktrail and template encapsulation
6774 !! options
6775 parsoid
6776 !! wikitext
6777 {{echo|[[Foo]]}}l
6778 !! html
6779 <p><a rel="mw:WikiLink" href="Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
6780 !! end
6781
6782 !! test
6783 2. Interaction of linktrail and template encapsulation
6784 !! options
6785 parsoid
6786 !! wikitext
6787 {{echo|Some [[Fool]]}}s
6788 !! html
6789 <p><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" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
6790 !! end
6791
6792 !! test
6793 3. Interaction of linktrail and template encapsulation
6794 !! options
6795 parsoid
6796 !! wikitext
6797 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6798 !! html
6799 <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" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
6800 !! end
6801
6802 !! article
6803 Söfnuður
6804 !! text
6805 Test.
6806 !! endarticle
6807
6808 !! test
6809 Internal link with is link prefix
6810 !! options
6811 language=is
6812 !! wikitext
6813 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6814 !! html
6815 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6816 </p>
6817 !! end
6818
6819 !! article
6820 Mótmælendatrú
6821 !! text
6822 Test.
6823 !! endarticle
6824
6825 !! test
6826 Internal link with is link trail and link prefix
6827 !! options
6828 language=is
6829 !! wikitext
6830 [[mótmælendatrú|xxx]]ar
6831 [[mótmælendatrú]]ar
6832 mótmælenda[[söfnuður]]
6833 mótmælenda[[söfnuður|söfnuðir]]
6834 mótmælenda[[söfnuður|söfnuðir]]xxx
6835 !! html
6836 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6837 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6838 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6839 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6840 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6841 </p>
6842 !! end
6843
6844 !! test
6845 Parsoid link trail escaping
6846 !! options
6847 parsoid=html2wt,html2html
6848 !! wikitext
6849 [[apple]]<nowiki/>s
6850 !! html
6851 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
6852 !! end
6853
6854 !! test
6855 Parsoid link prefix escaping
6856 !! options
6857 language=is
6858 parsoid=html2wt,html2html
6859 !! wikitext
6860 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6861 !! html
6862 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
6863 !! end
6864
6865 !! test
6866 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6867 !! wikitext
6868 [[Foo| bar]]
6869
6870 [[Foo| ''bar'']]
6871
6872 [http://wp.org foo]
6873
6874 [http://wp.org ''foo'']
6875 !! html
6876 <p><a href="/wiki/Foo" title="Foo"> bar</a>
6877 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
6878 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6879 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6880 </p>
6881 !! end
6882
6883 !! test
6884 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6885 !! options
6886 parsoid
6887 !! wikitext
6888 [[Foo|{{echo|a}} b {{echo|c}}]]
6889 !! html
6890 <p><a rel="mw:WikiLink" href="Foo" title="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>
6891 !! end
6892
6893 !! test
6894 Link with angle bracket after anchor
6895 !! wikitext
6896 [[Foo#<bar>]]
6897 !! html/php
6898 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
6899 </p>
6900 !! html/parsoid
6901 <p><a rel="mw:WikiLink" href="./Foo#%3Cbar%3E" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#%3Cbar%3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
6902 !! end
6903
6904 ###
6905 ### Interwiki links (see maintenance/interwiki.sql)
6906 ###
6907
6908 !! test
6909 Inline interwiki link
6910 !! options
6911 parsoid=wt2html,wt2wt,html2html
6912 !! wikitext
6913 [[MeatBall:SoftSecurity]]
6914 !! html/php
6915 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6916 </p>
6917 !! html/parsoid
6918 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
6919 !! end
6920
6921 !! test
6922 Inline interwiki link with empty title (bug 2372)
6923 !! options
6924 parsoid=wt2html,wt2wt,html2html
6925 !! wikitext
6926 [[MeatBall:]]
6927 !! html/php
6928 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6929 </p>
6930 !! html/parsoid
6931 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
6932 !! end
6933
6934 !! test
6935 Interwiki link encoding conversion (bug 1636)
6936 !! wikitext
6937 *[[Wikipedia:ro:Olteni&#0355;a]]
6938 *[[Wikipedia:ro:Olteni&#355;a]]
6939 !! html
6940 <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>
6941 <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>
6942
6943 !! html+tidy
6944 <ul>
6945 <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>
6946 <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>
6947 </ul>
6948 !! end
6949
6950 !! test
6951 Interwiki link with fragment (bug 2130)
6952 !! wikitext
6953 [[MeatBall:SoftSecurity#foo]]
6954 !! html
6955 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6956 </p>
6957 !! end
6958
6959 # Ideally the wikipedia: prefix here should be proto-relative too
6960 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
6961 # define the 'en' prefix, and originally the test used 'wikipedia',
6962 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
6963 # article.
6964 !! test
6965 Different interwiki prefixes mapping to the same URL
6966 !! wikitext
6967 [[:en:Foo]]
6968
6969 [[:en:Foo|Foo]]
6970
6971 [[wikipedia:Foo]]
6972
6973 [[:wikipedia:Foo|Foo]]
6974
6975 [[wikipedia:en:Foo]]
6976
6977 [[:wikipedia:en:Foo]]
6978
6979 [[ wikiPEdia :Foo]]
6980 !! html/parsoid
6981 <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}' title="en:Foo">en:Foo</a></p>
6982
6983 <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}' title="en:Foo">Foo</a></p>
6984
6985 <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}' title="wikipedia:Foo">wikipedia:Foo</a></p>
6986
6987 <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}' title="wikipedia:Foo">Foo</a></p>
6988
6989 <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}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
6990
6991 <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}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
6992
6993 <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}' title="wikipedia:Foo"> wikiPEdia :Foo</a></p>
6994 !! end
6995
6996 !! test
6997 Interwiki links that cannot be represented in wiki syntax
6998 !! wikitext
6999 [[meatball:ok]]
7000 [[meatball:ok#foo|ok with fragment]]
7001 [[meatball:ok_as_well?|ok ending with ? mark]]
7002 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7003 [http://de.wikipedia.org/wiki/#foo is just fragment]
7004
7005 !! html/php
7006 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7007 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7008 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with ? mark</a>
7009 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7010 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7011 </p>
7012 !! html/parsoid
7013 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7014 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7015 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
7016 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7017 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7018 !! end
7019
7020 !! test
7021 Interwiki links: trail
7022 !! wikitext
7023 [[wikipedia:Foo|Ba]]r
7024 !! html/php
7025 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7026 </p>
7027 !! html/parsoid
7028 <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,"tail":"r"}' title="wikipedia:Foo">Bar</a></p>
7029 !! end
7030
7031 !! test
7032 Local interwiki link
7033 !! options
7034 parsoid=wt2html,wt2wt,html2html
7035 !! wikitext
7036 [[local:Template:Foo]]
7037 !! html/php
7038 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7039 </p>
7040 !! html/parsoid
7041 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7042 !! end
7043
7044 # Parsoid does not mark self-links, by design.
7045 !! test
7046 Local interwiki link: self-link to current page
7047 !! options
7048 title=[[Main Page]]
7049 parsoid=wt2html,wt2wt,html2html
7050 !! wikitext
7051 [[local:Main Page]]
7052 !! html/php
7053 <p><strong class="selflink">local:Main Page</strong>
7054 </p>
7055 !! html/parsoid
7056 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7057 !! end
7058
7059 !! test
7060 Local interwiki link: prefix only (bug 64167)
7061 !! options
7062 parsoid=wt2html,wt2wt,html2html
7063 !! wikitext
7064 [[local:]]
7065 !! html/php
7066 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7067 </p>
7068 !! html/parsoid
7069 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7070 !! end
7071
7072 !! test
7073 Local interwiki link: with additional interwiki prefix (bug 61357)
7074 !! options
7075 parsoid=wt2html,wt2wt,html2html
7076 !! wikitext
7077 [[local:meatball:Hello]]
7078 !! html/php
7079 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7080 </p>
7081 !! html/parsoid
7082 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7083 !! end
7084
7085 !! test
7086 Multiple local interwiki link prefixes
7087 !! wikitext
7088 [[local:local:local:local:mi:local:Foo]]
7089 !! options
7090 parsoid=wt2html,wt2wt,html2html
7091 !! html/php
7092 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7093 </p>
7094 !! html/parsoid
7095 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7096 !! end
7097
7098 ###
7099 ### Interlanguage links
7100 ### Language links (so that searching for '### language' matches..)
7101 ###
7102
7103 !! test
7104 Interlanguage link
7105 !! options
7106 parsoid=wt2html,wt2wt,html2html
7107 !! wikitext
7108 Blah blah blah
7109 [[zh:Chinese]]
7110 !! html/php
7111 <p>Blah blah blah
7112 </p>
7113 !! html/parsoid
7114 <p>Blah blah blah</p>
7115 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7116 !! end
7117
7118 !! test
7119 Interlanguage link with spacing
7120 !! options
7121 parsoid=wt2html,wt2wt,html2html
7122 !! wikitext
7123 Blah blah blah
7124 [[ zh : Chinese ]]
7125 !! html/php
7126 <p>Blah blah blah
7127 </p>
7128 !! html/parsoid
7129 <p>Blah blah blah</p>
7130 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7131 !! end
7132
7133 !! test
7134 Double interlanguage link
7135 !! options
7136 parsoid=wt2html,wt2wt,html2html
7137 !! wikitext
7138 Blah blah blah
7139 [[es:Spanish]]
7140 [[zh:Chinese]]
7141 !! html/php
7142 <p>Blah blah blah
7143 </p>
7144 !! html/parsoid
7145 <p>Blah blah blah</p>
7146 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7147 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7148 !! end
7149
7150 !! test
7151 Interlanguage link variations
7152 !! options
7153 parsoid=wt2html,wt2wt,html2html
7154 !! wikitext
7155 Blah blah blah
7156 [[ es :Spanish]]
7157 [[ ZH :Chinese]]
7158 [[es:Foo_bar]]
7159 [[es:Foo bar]]
7160 !! html/php
7161 <p>Blah blah blah
7162 </p>
7163 !! html/parsoid
7164 <p>Blah blah blah</p>
7165 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7166 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7167 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7168 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7169 !! end
7170
7171 !! test
7172 Interlanguage link, with prefix links
7173 !! options
7174 language=ln
7175 !! wikitext
7176 Blah blah blah
7177 [[zh:Chinese]]
7178 !! html/php
7179 <p>Blah blah blah
7180 </p>
7181 !! html/parsoid
7182 <p>Blah blah blah</p>
7183 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7184 !! end
7185
7186 !! test
7187 Double interlanguage link, with prefix links (bug 8897)
7188 !! options
7189 language=ln
7190 !! wikitext
7191 Blah blah blah
7192 [[es:Spanish]]
7193 [[zh:Chinese]]
7194 !! html/php
7195 <p>Blah blah blah
7196 </p>
7197 !! html/parsoid
7198 <p>Blah blah blah</p>
7199 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7200 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7201 !! end
7202
7203 !! test
7204 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7205 !! wikitext
7206 Blah blah blah
7207 [[mul:Article]]
7208 !! html/php
7209 <p>Blah blah blah
7210 </p>
7211 !! html/parsoid
7212 <p>Blah blah blah</p>
7213 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7214 !! end
7215
7216 !! test
7217 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7218 !! options
7219 language=ln
7220 !! wikitext
7221 [[WW&nbsp;II]]
7222 !! html
7223 <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>
7224 </p>
7225 !! end
7226
7227 !! test
7228 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7229 !! options
7230 parsoid=html2wt
7231 !! wikitext
7232 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7233
7234 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7235 !! html
7236 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7237 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7238 !! end
7239
7240 !! test
7241 Parsoid: handle constructor well
7242 !! wikitext
7243 [[constructor]]
7244
7245 [[constructor:foo]]
7246 !! html/php
7247 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7248 </p><p><a href="/index.php?title=Constructor:foo&amp;action=edit&amp;redlink=1" class="new" title="Constructor:foo (page does not exist)">constructor:foo</a>
7249 </p>
7250 !! html/parsoid
7251 <p><a rel="mw:WikiLink" href="./Constructor" title="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>
7252
7253 <p><a rel="mw:WikiLink" href="./Foo" title="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>
7254 !! end
7255
7256 !! article
7257 ko:
7258 !! text
7259 Test.
7260 !! endarticle
7261
7262 # Note that `ko` isn't a known interlanguage prefix
7263 !! test
7264 Parsoid: recognize interlanguage links without a target page
7265 !! options
7266 ill
7267 !! wikitext
7268 [[es:]]
7269
7270 [[ko:]]
7271 !! html/php
7272 es:
7273 !! html/parsoid
7274 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7275
7276 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7277 !! end
7278
7279 # Note that `ko` isn't a known interwiki prefix
7280 !! test
7281 Parsoid: recognize interwiki links without a target page
7282 !! options
7283 parsoid=wt2html,wt2wt,html2html
7284 !! wikitext
7285 [[:es:]]
7286
7287 [[:ko:]]
7288 !! html/php
7289 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7290 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7291 </p>
7292 !! html/parsoid
7293 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7294 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7295 !! end
7296
7297 !! test
7298 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7299 !! wikitext
7300 [[mi:Foo]]
7301 !! html/php
7302 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7303 </p>
7304 !! html/parsoid
7305 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7306 !! end
7307
7308 !! test
7309 Interlanguage link with preceding local interwiki link (bug 68085)
7310 !! options
7311 parsoid=wt2html,wt2wt,html2html
7312 !! wikitext
7313 Blah blah blah
7314 [[local:es:Spanish]]
7315 !! html/php
7316 <p>Blah blah blah
7317 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7318 </p>
7319 !! html/parsoid
7320 <p>Blah blah blah
7321 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7322 !! end
7323
7324 !! test
7325 Looks like an interlanguage link, but is actually a local interwiki
7326 !! options
7327 parsoid=wt2html,wt2wt,html2html
7328 !! wikitext
7329 Blah blah blah
7330 [[mi:Template:Foo]]
7331 !! html/php
7332 <p>Blah blah blah
7333 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7334 </p>
7335 !! html/parsoid
7336 <p>Blah blah blah
7337 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7338 !! end
7339
7340 ###
7341 ### Redirects, Parsoid-only
7342 ###
7343 !! test
7344 1. Simple redirect to page
7345 !! options
7346 parsoid
7347 !! wikitext
7348 #REDIRECT [[Main Page]]
7349 !! html
7350 <link rel="mw:PageProp/redirect" href="./Main_Page">
7351 !! end
7352
7353 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
7354 !! test
7355 2. Other redirect variants
7356 !! options
7357 parsoid=wt2html,wt2wt
7358 !! wikitext
7359 #REDIRECT [[Main_Page]]
7360 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
7361 !! html/parsoid
7362 <link rel="mw:PageProp/redirect" href="./Main_Page"><link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
7363 !! end
7364
7365 !! test
7366 Empty redirect
7367 !! options
7368 parsoid=wt2html,wt2wt
7369 !! wikitext
7370 #REDIRECT [[]]
7371 !! html
7372 <ol>
7373 <li>REDIRECT [[]]</li></ol>
7374 !! end
7375
7376 !! test
7377 Optional colon in #REDIRECT
7378 !! options
7379 # the colon is archaic syntax. we support it for wt2html, but we
7380 # don't care that it roundtrips back to the modern syntax.
7381 parsoid=wt2html,html2html
7382 !! wikitext
7383 #REDIRECT:[[Main Page]]
7384 !! html
7385 <link rel="mw:PageProp/redirect" href="./Main_Page">
7386 !! end
7387
7388 !! test
7389 Whitespace in #REDIRECT with optional colon
7390 !! options
7391 # the colon and gratuitous whitespace is archaic syntax. we support
7392 # it for wt2html, but we don't care that it roundtrips back to the
7393 # modern syntax (without extra whitespace)
7394 parsoid=wt2html,html2html
7395 !! wikitext
7396
7397 #REDIRECT
7398 :
7399 [[Main Page]]
7400 !! html
7401 <link rel="mw:PageProp/redirect" href="./Main_Page">
7402 !! end
7403
7404 !! test
7405 Piped link in #REDIRECT
7406 !! options
7407 # content after piped link is ignored. we support this syntax,
7408 # but don't care that the piped link is lost when we roundtrip this.
7409 parsoid=wt2html
7410 !! wikitext
7411 #REDIRECT [[Main Page|bar]]
7412 !! html
7413 <link rel="mw:PageProp/redirect" href="./Main_Page">
7414 !! end
7415
7416 !! test
7417 Redirect to category
7418 !! options
7419 parsoid=wt2html
7420 !! wikitext
7421 #REDIRECT [[Category:Foo]]
7422 !! html
7423 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7424 !! end
7425
7426 !! test
7427 Redirect to category with URL encoding
7428 !! options
7429 parsoid=wt2html
7430 !! wikitext
7431 #REDIRECT [[Category%3AFoo]]
7432 !! html
7433 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7434 !! end
7435
7436 !! test
7437 Redirect to category page
7438 !! options
7439 parsoid=wt2html,html2html
7440 !! wikitext
7441 #REDIRECT [[:Category:Foo]]
7442 !! html
7443 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7444 !! end
7445
7446 !! test
7447 Redirect to image page (1)
7448 !! options
7449 parsoid
7450 !! wikitext
7451 #REDIRECT [[File:Wiki.png]]
7452 !! html
7453 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7454 !! end
7455
7456 !! test
7457 Redirect to image page (2)
7458 !! options
7459 parsoid
7460 !! wikitext
7461 #REDIRECT [[Image:Wiki.png]]
7462 !! html
7463 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7464 !! end
7465
7466 !! test
7467 Redirect to language
7468 !! options
7469 parsoid
7470 !! wikitext
7471 #REDIRECT [[en:File:Wiki.png]]
7472 !! html
7473 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7474 !! end
7475
7476 !! test
7477 Redirect to interwiki
7478 !! options
7479 parsoid
7480 !! wikitext
7481 #REDIRECT [[meatball:File:Wiki.png]]
7482 !! html
7483 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7484 !! end
7485
7486 !! test
7487 Non-English #REDIRECT
7488 !! options
7489 parsoid
7490 language=is
7491 !! wikitext
7492 #TILVÍSUN [[Main Page]]
7493 !! html
7494 <link rel="mw:PageProp/redirect" href="./Main_Page">
7495 !! end
7496
7497 !! test
7498 New redirect
7499 !! options
7500 parsoid=html2wt
7501 !! wikitext
7502 Foo
7503 #REDIRECT [[Foo]]
7504 !! html
7505 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7506 !! end
7507
7508 ##
7509 ## XHTML tidiness
7510 ###
7511
7512 !! test
7513 <br> to <br />
7514 !! wikitext
7515 1<br>2<br />3
7516 !! html
7517 <p>1<br />2<br />3
7518 </p>
7519 !! end
7520
7521 !! test
7522 Broken br tag sanitization
7523 !! wikitext
7524 </br>
7525 !! html/php
7526 <p>&lt;/br&gt;
7527 </p>
7528 !! end
7529
7530 # TODO: Fix html2html mode (bug 51055)!
7531 # This </br> handling was added as part of bug 50831; but it
7532 # differs from how PHP+tidy handles this. We should investigate
7533 # this.
7534 !! test
7535 Parsoid: Broken br tag recognition
7536 !! options
7537 parsoid=wt2html
7538 !! wikitext
7539 </br>
7540
7541 <br/ >
7542 !! html/php+tidy
7543 <p>&lt;/br&gt;</p>
7544 <p><br /></p>
7545 !! html/parsoid
7546 <p><br></p>
7547 <p><br/></p>
7548 !! end
7549
7550 !! test
7551 Incorrecly removing closing slashes from correctly formed XHTML
7552 !! wikitext
7553 <br style="clear:both;" />
7554 !! html
7555 <p><br style="clear:both;" />
7556 </p>
7557 !! end
7558
7559 !! test
7560 Failing to transform badly formed HTML into correct XHTML
7561 !! wikitext
7562 <br style="clear: left;">
7563 <br style="clear: right;">
7564 <br style="clear: both;">
7565 !! html
7566 <p><br style="clear: left;" />
7567 <br style="clear: right;" />
7568 <br style="clear: both;" />
7569 </p>
7570 !!end
7571
7572 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
7573 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
7574 !! test
7575 Handling html with a div self-closing tag
7576 !! wikitext
7577 <div title />
7578 <div title/>
7579 <div title/ >
7580 <div title=bar />
7581 <div title=bar/>
7582 <div title=bar/ >
7583 !! html/php
7584 <p>&lt;div title /&gt;
7585 &lt;div title/&gt;
7586 </p>
7587 <div>
7588 <p>&lt;div title=bar /&gt;
7589 &lt;div title=bar/&gt;
7590 </p>
7591 <div title="bar/"></div>
7592 </div>
7593
7594 !! html/parsoid
7595 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7596 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7597 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
7598 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7599 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7600 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
7601 !! end
7602
7603 !! test
7604 Handling html with a br self-closing tag
7605 !! wikitext
7606 <br title />
7607 <br title/>
7608 <br title/ >
7609 <br title=bar />
7610 <br title=bar/>
7611 <br title=bar/ >
7612 !! html/php
7613 <p><br title="title" />
7614 <br title="title" />
7615 <br />
7616 <br title="bar" />
7617 <br title="bar" />
7618 <br title="bar/" />
7619 </p>
7620 !! html/parsoid
7621 <p><br title="" />
7622 <br title="" />
7623 <br title="" />
7624 <br title="bar" />
7625 <br title="bar" />
7626 <br title="bar/" />
7627 </p>
7628 !! end
7629
7630 !! test
7631 Horizontal ruler (should it add that extra space?)
7632 !! wikitext
7633 <hr>
7634 <hr >
7635 foo <hr
7636 > bar
7637 !! html+tidy
7638 <hr />
7639 <hr />
7640 <p>foo</p>
7641 <hr />
7642 <p>bar</p>
7643 !! end
7644
7645 !! test
7646 Horizontal ruler -- 4+ dashes render hr
7647 !! wikitext
7648 ----
7649 !! html
7650 <hr />
7651
7652 !! end
7653
7654 !! test
7655 Horizontal ruler -- eats additional dashes on the same line
7656 !! wikitext
7657 ---------
7658 !! html
7659 <hr />
7660
7661 !! end
7662
7663 !! test
7664 Horizontal ruler -- does not collapse dashes on consecutive lines
7665 !! wikitext
7666 ----
7667 ----
7668 !! html
7669 <hr />
7670 <hr />
7671
7672 !! end
7673
7674 !! test
7675 Horizontal ruler -- <4 dashes render as plain text
7676 !! wikitext
7677 ---
7678 !! html
7679 <p>---
7680 </p>
7681 !! end
7682
7683 !! test
7684 Horizontal ruler -- Supports content following dashes on same line
7685 !! wikitext
7686 ---- Foo
7687 !! html
7688 <hr /> Foo
7689
7690 !! html+tidy
7691 <hr />
7692 <p>Foo</p>
7693 !! end
7694
7695 ###
7696 ### Block-level elements
7697 ###
7698 !! test
7699 Common list
7700 !! wikitext
7701 *Common list
7702 * item 2
7703 *item 3
7704 !! html
7705 <ul><li>Common list</li>
7706 <li> item 2</li>
7707 <li>item 3</li></ul>
7708
7709 !! end
7710
7711 !! test
7712 Numbered list
7713 !! wikitext
7714 #Numbered list
7715 #item 2
7716 # item 3
7717 !! html
7718 <ol><li>Numbered list</li>
7719 <li>item 2</li>
7720 <li> item 3</li></ol>
7721
7722 !! end
7723
7724 !! test
7725 Mixed list
7726 !! wikitext
7727 *Mixed list
7728 *# with numbers
7729 ** and bullets
7730 *# and numbers
7731 *bullets again
7732 **bullet level 2
7733 ***bullet level 3
7734 ***#Number on level 4
7735 **bullet level 2
7736 **#Number on level 3
7737 **#Number on level 3
7738 *#number level 2
7739 *Level 1
7740 *** Level 3
7741 #** Level 3, but ordered
7742 !! html
7743 <ul><li>Mixed list
7744 <ol><li> with numbers</li></ol>
7745 <ul><li> and bullets</li></ul>
7746 <ol><li> and numbers</li></ol></li>
7747 <li>bullets again
7748 <ul><li>bullet level 2
7749 <ul><li>bullet level 3
7750 <ol><li>Number on level 4</li></ol></li></ul></li>
7751 <li>bullet level 2
7752 <ol><li>Number on level 3</li>
7753 <li>Number on level 3</li></ol></li></ul>
7754 <ol><li>number level 2</li></ol></li>
7755 <li>Level 1
7756 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7757 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7758
7759 !! end
7760
7761 !! test
7762 Nested lists 1
7763 !! wikitext
7764 *foo
7765 **bar
7766 !! html
7767 <ul><li>foo
7768 <ul><li>bar</li></ul></li></ul>
7769
7770 !! end
7771
7772 !! test
7773 Nested lists 2
7774 !! wikitext
7775 **foo
7776 *bar
7777 !! html
7778 <ul><li><ul><li>foo</li></ul></li>
7779 <li>bar</li></ul>
7780
7781 !! end
7782
7783 !! test
7784 Nested lists 3 (first element empty)
7785 !! wikitext
7786 *
7787 **bar
7788 !! html
7789 <ul><li>
7790 <ul><li>bar</li></ul></li></ul>
7791
7792 !! end
7793
7794 !! test
7795 Nested lists 4 (first element empty)
7796 !! wikitext
7797 **
7798 *bar
7799 !! html
7800 <ul><li><ul><li></li></ul></li>
7801 <li>bar</li></ul>
7802
7803 !! end
7804
7805 !! test
7806 Nested lists 5 (both elements empty)
7807 !! wikitext
7808 **
7809 *
7810 !! html
7811 <ul><li><ul><li></li></ul></li>
7812 <li></li></ul>
7813
7814 !! end
7815
7816 !! test
7817 Nested lists 6 (both elements empty)
7818 !! wikitext
7819 *
7820 **
7821 !! html
7822 <ul><li>
7823 <ul><li></li></ul></li></ul>
7824
7825 !! end
7826
7827 !! test
7828 Nested lists 7 (skip initial nesting levels)
7829 !! wikitext
7830 *** foo
7831 !! html
7832 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7833
7834 !! end
7835
7836 !! test
7837 Nested lists 8 (multiple nesting transitions)
7838 !! wikitext
7839 * foo
7840 *** bar
7841 ** baz
7842 * boo
7843 !! html
7844 <ul><li> foo
7845 <ul><li><ul><li> bar</li></ul></li>
7846 <li> baz</li></ul></li>
7847 <li> boo</li></ul>
7848
7849 !! end
7850
7851 !! test
7852 1. Lists with start-of-line-transparent tokens before bullets: Comments
7853 !! wikitext
7854 *foo
7855 *<!--cmt-->bar
7856 <!--cmt-->*baz
7857 !! html
7858 <ul><li>foo</li>
7859 <li>bar</li>
7860 <li>baz</li></ul>
7861
7862 !! end
7863
7864 !! test
7865 2. Lists with start-of-line-transparent tokens before bullets: Template close
7866 !! wikitext
7867 *foo {{echo|bar
7868 }}*baz
7869 !! html
7870 <ul><li>foo bar</li>
7871 <li>baz</li></ul>
7872
7873 !! end
7874
7875 !! test
7876 List items are not parsed correctly following a <pre> block (bug 785)
7877 !! wikitext
7878 * <pre>foo</pre>
7879 * <pre>bar</pre>
7880 * zar
7881 !! html
7882 <ul><li> <pre>foo</pre></li>
7883 <li> <pre>bar</pre></li>
7884 <li> zar</li></ul>
7885
7886 !! end
7887
7888 !! test
7889 List items from template
7890 !! wikitext
7891
7892 {{inner list}}
7893 * item 2
7894
7895 * item 0
7896 {{inner list}}
7897 * item 2
7898
7899 * item 0
7900 * notSOL{{inner list}}
7901 * item 2
7902 !! html
7903 <ul><li> item 1</li>
7904 <li> item 2</li></ul>
7905 <ul><li> item 0</li>
7906 <li> item 1</li>
7907 <li> item 2</li></ul>
7908 <ul><li> item 0</li>
7909 <li> notSOL</li>
7910 <li> item 1</li>
7911 <li> item 2</li></ul>
7912
7913 !! end
7914
7915 !! test
7916 List interrupted by empty line or heading
7917 !! wikitext
7918 * foo
7919
7920 ** bar
7921 == A heading ==
7922 * Another list item
7923 !! html
7924 <ul><li> foo</li></ul>
7925 <ul><li><ul><li> bar</li></ul></li></ul>
7926 <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>
7927 <ul><li> Another list item</li></ul>
7928
7929 !!end
7930
7931 !!test
7932 Multiple list tags generated by templates
7933 !! wikitext
7934 {{echo|<li>}}a
7935 {{echo|<li>}}b
7936 {{echo|<li>}}c
7937 !! html
7938 <li>a
7939 <li>b
7940 <li>c</li>
7941 </li>
7942 </li>
7943
7944 !! html+tidy
7945 <ul>
7946 <li>a</li>
7947 <li>b</li>
7948 <li>c</li>
7949 </ul>
7950 !!end
7951
7952 !!test
7953 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7954 !! wikitext
7955 *a
7956 <!--This line will NOT split the list-->
7957 *b
7958 <!--This line will NOT split the list either-->
7959 *c
7960 <!--foo--> <!----> <!--This line NOT split the list either-->
7961 *d
7962 !! html
7963 <ul><li>a</li>
7964 <li>b</li>
7965 <li>c</li>
7966 <li>d</li></ul>
7967
7968 !!end
7969
7970 !!test
7971 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7972 !! wikitext
7973 *a
7974 <!--This line will NOT split the list-->
7975 *b
7976 <!--This line will NOT split the list either-->
7977 *c
7978 <!--foo--> <!----> <!--This line NOT split the list
7979 either-->
7980 *d
7981 !! html
7982 <ul><li>a</li>
7983 <li>b</li>
7984 <li>c</li>
7985 <li>d</li></ul>
7986
7987 !!end
7988
7989 !!test
7990 Test the li-hack
7991 (The PHP parser relies on Tidy for the hack)
7992 !!options
7993 parsoid=wt2html,wt2wt
7994 !! wikitext
7995 * foo
7996 * <li>li-hack
7997 * {{echo|<li>templated li-hack}}
7998 * <!--foo--> <li> unsupported li-hack with preceding comments
7999
8000 <ul>
8001 <li><li>not a li-hack
8002 </li>
8003 </ul>
8004 !! html+tidy
8005 <ul>
8006 <li>foo</li>
8007 <li>li-hack</li>
8008 <li>templated li-hack</li>
8009 <li>unsupported li-hack with preceding comments</li>
8010 </ul>
8011 <ul>
8012 <li>not a li-hack</li>
8013 </ul>
8014 !!end
8015
8016 !! test
8017 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8018 !! options
8019 parsoid
8020 !! wikitext
8021 # foo
8022 ## bar
8023 * foo
8024 ** bar
8025 : foo
8026 :: bar
8027 !! html
8028 <ol>
8029 <li> foo<ol>
8030 <li> bar</li>
8031 </ol></li>
8032 </ol><ul>
8033 <li> foo<ul>
8034 <li> bar</li>
8035 </ul></li>
8036 </ul><dl>
8037 <dd> foo<dl>
8038 <dd> bar</dd>
8039 </dl></dd>
8040 </dl>
8041 !! end
8042
8043 !! test
8044 Parsoid: Test of whitespace serialization with Templated bullets
8045 !! options
8046 parsoid
8047 !! wikitext
8048 * {{bullet}}
8049 !! html
8050 <ul>
8051 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8052 </ul>
8053 !! end
8054
8055 # ------------------------------------------------------------------------
8056 # The next set of tests are about Parsoid's ability to handle badly nested
8057 # tags (parse, minimize scope of fixup, and roundtrip back)
8058 # ------------------------------------------------------------------------
8059
8060 !! test
8061 Unbalanced closing block tags break a list
8062 (php parser relies on Tidy to fix up)
8063 !! wikitext
8064 <div>
8065 *a</div><div>
8066 *b</div>
8067 !! html+tidy
8068 <div>
8069 <ul>
8070 <li>a</li>
8071 </ul>
8072 </div>
8073 <div>
8074 <ul>
8075 <li>b</li>
8076 </ul>
8077 </div>
8078 !! end
8079
8080 # Parsoid fails this test, but it might be tricky to support properly.
8081 # See bug 68395.
8082 !! test
8083 Unbalanced closing non-block tags don't break a list
8084 (php parser relies on Tidy to fix up)
8085 !! wikitext
8086 <span>
8087 *a</span><span>
8088 *b</span>
8089 !! html/php+tidy
8090 <ul>
8091 <li><span>a</span></li>
8092 <li><span>b</span></li>
8093 </ul>
8094 !! html/parsoid
8095 <span>
8096 <ul>
8097 <li>a<span></span>
8098 </li>
8099 <li>b
8100 </li>
8101 </ul>
8102 </span>
8103 !! end
8104
8105 !! test
8106 Unclosed formatting tags that straddle lists are closed and reopened
8107 (php parser relies on Tidy to fix up)
8108 !! options
8109 parsoid=wt2html,wt2wt,html2html
8110 !! wikitext
8111 # <s> a
8112 # b </s>
8113 !! html/php+tidy
8114 <ol>
8115 <li><s>a</s></li>
8116 <li><s>b</s></li>
8117 </ol>
8118 !! html/parsoid
8119 <ol><li> <s> a</s></li>
8120 <li><s> b </s></li></ol>
8121 !! end
8122
8123 # Parsoid fails this test, but it might be tricky to support properly.
8124 # See bug 68395.
8125 !!test
8126 List embedded in a non-block tag
8127 (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
8128 !! wikitext
8129 <small>
8130 * foo
8131 </small>
8132 !! html/php+tidy
8133 <ul>
8134 <li><small>foo</small></li>
8135 </ul>
8136 !! html/parsoid
8137 <small>
8138 <ul>
8139 <li> foo</li>
8140 </ul>
8141 </small>
8142 !!end
8143
8144 # This is a bug in the PHP parser + tidy combination.
8145 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8146 # and then fostered out of the table by tidy.)
8147 # We believe the Parsoid output to be correct.
8148 !! test
8149 Table with missing opening <tr> tag
8150 !! options
8151 parsoid=wt2html,wt2wt
8152 !! wikitext
8153 <table>
8154 <td>foo</td>
8155 </tr>
8156 </table>
8157 !! html/php+tidy
8158 <p>&lt;/tr&gt;</p>
8159 <table>
8160 <tr>
8161 <td>foo</td>
8162 </tr>
8163 </table>
8164 !! html/parsoid
8165 <table>
8166 <tr>
8167 <td>foo</td>
8168 </tr>
8169 </table>
8170 !! end
8171
8172 ###
8173 ### Magic Words
8174 ###
8175
8176 # Note that the current date is hard-coded as
8177 # 1970-01-01T00:02:03Z (a Thursday)
8178 # when running parser tests. The timezone is also fixed to GMT, so
8179 # local date will be identical to current date.
8180
8181 !! test
8182 Magic Word: {{CURRENTDAY}}
8183 !! wikitext
8184 {{CURRENTDAY}}
8185 !! html
8186 <p>1
8187 </p>
8188 !! end
8189
8190 !! test
8191 Magic Word: {{CURRENTDAY2}}
8192 !! wikitext
8193 {{CURRENTDAY2}}
8194 !! html
8195 <p>01
8196 </p>
8197 !! end
8198
8199 !! test
8200 Magic Word: {{CURRENTDAYNAME}}
8201 !! wikitext
8202 {{CURRENTDAYNAME}}
8203 !! html
8204 <p>Thursday
8205 </p>
8206 !! end
8207
8208 !! test
8209 Magic Word: {{CURRENTDOW}}
8210 !! wikitext
8211 {{CURRENTDOW}}
8212 !! html
8213 <p>4
8214 </p>
8215 !! end
8216
8217 !! test
8218 Magic Word: {{CURRENTMONTH}}
8219 !! wikitext
8220 {{CURRENTMONTH}}
8221 !! html
8222 <p>01
8223 </p>
8224 !! end
8225
8226 !! test
8227 Magic Word: {{CURRENTMONTH1}}
8228 !! wikitext
8229 {{CURRENTMONTH1}}
8230 !! html
8231 <p>1
8232 </p>
8233 !! end
8234
8235 !! test
8236 Magic Word: {{CURRENTMONTHABBREV}}
8237 !! wikitext
8238 {{CURRENTMONTHABBREV}}
8239 !! html
8240 <p>Jan
8241 </p>
8242 !! end
8243
8244 !! test
8245 Magic Word: {{CURRENTMONTHNAME}}
8246 !! wikitext
8247 {{CURRENTMONTHNAME}}
8248 !! html
8249 <p>January
8250 </p>
8251 !! end
8252
8253 !! test
8254 Magic Word: {{CURRENTMONTHNAMEGEN}}
8255 !! wikitext
8256 {{CURRENTMONTHNAMEGEN}}
8257 !! html
8258 <p>January
8259 </p>
8260 !! end
8261
8262 !! test
8263 Magic Word: {{CURRENTTIME}}
8264 !! wikitext
8265 {{CURRENTTIME}}
8266 !! html
8267 <p>00:02
8268 </p>
8269 !! end
8270
8271 !! test
8272 Magic Word: {{CURRENTHOUR}}
8273 !! wikitext
8274 {{CURRENTHOUR}}
8275 !! html
8276 <p>00
8277 </p>
8278 !! end
8279
8280 !! test
8281 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8282 !! wikitext
8283 {{CURRENTWEEK}}
8284 !! html
8285 <p>1
8286 </p>
8287 !! end
8288
8289 !! test
8290 Magic Word: {{CURRENTYEAR}}
8291 !! wikitext
8292 {{CURRENTYEAR}}
8293 !! html
8294 <p>1970
8295 </p>
8296 !! end
8297
8298 !! test
8299 Magic Word: {{CURRENTTIMESTAMP}}
8300 !! wikitext
8301 {{CURRENTTIMESTAMP}}
8302 !! html
8303 <p>19700101000203
8304 </p>
8305 !! end
8306
8307 !! test
8308 Magic Words LOCAL (UTC)
8309 !! wikitext
8310 * {{LOCALMONTH}}
8311 * {{LOCALMONTH1}}
8312 * {{LOCALMONTHNAME}}
8313 * {{LOCALMONTHNAMEGEN}}
8314 * {{LOCALMONTHABBREV}}
8315 * {{LOCALDAY}}
8316 * {{LOCALDAY2}}
8317 * {{LOCALDAYNAME}}
8318 * {{LOCALYEAR}}
8319 * {{LOCALTIME}}
8320 * {{LOCALHOUR}}
8321 * {{LOCALWEEK}}
8322 * {{LOCALDOW}}
8323 * {{LOCALTIMESTAMP}}
8324 !! html
8325 <ul><li> 01</li>
8326 <li> 1</li>
8327 <li> January</li>
8328 <li> January</li>
8329 <li> Jan</li>
8330 <li> 1</li>
8331 <li> 01</li>
8332 <li> Thursday</li>
8333 <li> 1970</li>
8334 <li> 00:02</li>
8335 <li> 00</li>
8336 <li> 1</li>
8337 <li> 4</li>
8338 <li> 19700101000203</li></ul>
8339
8340 !! end
8341
8342 !! test
8343 Magic Word: {{FULLPAGENAME}}
8344 !! options
8345 title=[[User:Ævar Arnfjörð Bjarmason]]
8346 !! wikitext
8347 {{FULLPAGENAME}}
8348 !! html
8349 <p>User:Ævar Arnfjörð Bjarmason
8350 </p>
8351 !! end
8352
8353 !! test
8354 Magic Word: {{FULLPAGENAMEE}}
8355 !! options
8356 title=[[User:Ævar Arnfjörð Bjarmason]]
8357 !! wikitext
8358 {{FULLPAGENAMEE}}
8359 !! html
8360 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8361 </p>
8362 !! end
8363
8364 !! test
8365 Magic Word: {{TALKSPACE}}
8366 !! options
8367 title=[[User:Ævar Arnfjörð Bjarmason]]
8368 !! wikitext
8369 {{TALKSPACE}}
8370 !! html
8371 <p>User talk
8372 </p>
8373 !! end
8374
8375 !! test
8376 Magic Word: {{TALKSPACE}}, same namespace
8377 !! options
8378 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8379 !! wikitext
8380 {{TALKSPACE}}
8381 !! html
8382 <p>User talk
8383 </p>
8384 !! end
8385
8386 !! test
8387 Magic Word: {{TALKSPACE}}, main namespace
8388 !! options
8389 title=[[Parser Test]]
8390 !! wikitext
8391 {{TALKSPACE}}
8392 !! html
8393 <p>Talk
8394 </p>
8395 !! end
8396
8397 !! test
8398 Magic Word: {{TALKSPACEE}}
8399 !! options
8400 title=[[User:Ævar Arnfjörð Bjarmason]]
8401 !! wikitext
8402 {{TALKSPACEE}}
8403 !! html
8404 <p>User_talk
8405 </p>
8406 !! end
8407
8408 !! test
8409 Magic Word: {{SUBJECTSPACE}}
8410 !! options
8411 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8412 !! wikitext
8413 {{SUBJECTSPACE}}
8414 !! html
8415 <p>User
8416 </p>
8417 !! end
8418
8419 !! test
8420 Magic Word: {{SUBJECTSPACE}}, same namespace
8421 !! options
8422 title=[[User:Ævar Arnfjörð Bjarmason]]
8423 !! wikitext
8424 {{SUBJECTSPACE}}
8425 !! html
8426 <p>User
8427 </p>
8428 !! end
8429
8430 !! test
8431 Magic Word: {{SUBJECTSPACE}}, main namespace
8432 !! options
8433 title=[[Parser Test]]
8434 !! wikitext
8435 {{SUBJECTSPACE}}
8436 !! html
8437
8438 !! end
8439
8440 !! test
8441 Magic Word: {{SUBJECTSPACEE}}
8442 !! options
8443 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8444 !! wikitext
8445 {{SUBJECTSPACEE}}
8446 !! html
8447 <p>User
8448 </p>
8449 !! end
8450
8451 !! test
8452 Magic Word: {{NAMESPACE}}
8453 !! options
8454 title=[[User:Ævar Arnfjörð Bjarmason]]
8455 !! wikitext
8456 {{NAMESPACE}}
8457 !! html
8458 <p>User
8459 </p>
8460 !! end
8461
8462 !! test
8463 Magic Word: {{NAMESPACEE}}
8464 !! options
8465 title=[[User:Ævar Arnfjörð Bjarmason]]
8466 !! wikitext
8467 {{NAMESPACEE}}
8468 !! html
8469 <p>User
8470 </p>
8471 !! end
8472
8473 !! test
8474 Magic Word: {{NAMESPACENUMBER}}
8475 !! options
8476 title=[[User:Ævar Arnfjörð Bjarmason]]
8477 !! wikitext
8478 {{NAMESPACENUMBER}}
8479 !! html
8480 <p>2
8481 </p>
8482 !! end
8483
8484 !! test
8485 Magic Word: {{SUBPAGENAME}}
8486 !! options
8487 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8488 !! wikitext
8489 {{SUBPAGENAME}}
8490 !! html
8491 <p>sub ö
8492 </p>
8493 !! end
8494
8495 !! test
8496 Magic Word: {{SUBPAGENAMEE}}
8497 !! options
8498 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8499 !! wikitext
8500 {{SUBPAGENAMEE}}
8501 !! html
8502 <p>sub_%C3%B6
8503 </p>
8504 !! end
8505
8506 !! test
8507 Magic Word: {{ROOTPAGENAME}}
8508 !! options
8509 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8510 !! wikitext
8511 {{ROOTPAGENAME}}
8512 !! html
8513 <p>Ævar Arnfjörð Bjarmason
8514 </p>
8515 !! end
8516
8517 !! test
8518 Magic Word: {{ROOTPAGENAMEE}}
8519 !! options
8520 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8521 !! wikitext
8522 {{ROOTPAGENAMEE}}
8523 !! html
8524 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8525 </p>
8526 !! end
8527
8528 !! test
8529 Magic Word: {{BASEPAGENAME}}
8530 !! options
8531 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8532 !! wikitext
8533 {{BASEPAGENAME}}
8534 !! html
8535 <p>Ævar Arnfjörð Bjarmason
8536 </p>
8537 !! end
8538
8539 !! test
8540 Magic Word: {{BASEPAGENAMEE}}
8541 !! options
8542 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8543 !! wikitext
8544 {{BASEPAGENAMEE}}
8545 !! html
8546 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8547 </p>
8548 !! end
8549
8550 !! test
8551 Magic Word: {{TALKPAGENAME}}
8552 !! options
8553 title=[[User:Ævar Arnfjörð Bjarmason]]
8554 !! wikitext
8555 {{TALKPAGENAME}}
8556 !! html
8557 <p>User talk:Ævar Arnfjörð Bjarmason
8558 </p>
8559 !! end
8560
8561 !! test
8562 Magic Word: {{TALKPAGENAMEE}}
8563 !! options
8564 title=[[User:Ævar Arnfjörð Bjarmason]]
8565 !! wikitext
8566 {{TALKPAGENAMEE}}
8567 !! html
8568 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8569 </p>
8570 !! end
8571
8572 !! test
8573 Magic Word: {{SUBJECTPAGENAME}}
8574 !! options
8575 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8576 !! wikitext
8577 {{SUBJECTPAGENAME}}
8578 !! html
8579 <p>User:Ævar Arnfjörð Bjarmason
8580 </p>
8581 !! end
8582
8583 !! test
8584 Magic Word: {{SUBJECTPAGENAMEE}}
8585 !! options
8586 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8587 !! wikitext
8588 {{SUBJECTPAGENAMEE}}
8589 !! html
8590 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8591 </p>
8592 !! end
8593
8594 !! test
8595 Magic Word: {{NUMBEROFFILES}}
8596 !! wikitext
8597 {{NUMBEROFFILES}}
8598 !! html
8599 <p>5
8600 </p>
8601 !! end
8602
8603 !! test
8604 Magic Word: {{PAGENAME}}
8605 !! options
8606 title=[[User:Ævar Arnfjörð Bjarmason]]
8607 !! wikitext
8608 {{PAGENAME}}
8609 !! html
8610 <p>Ævar Arnfjörð Bjarmason
8611 </p>
8612 !! end
8613
8614 !! test
8615 Magic Word: {{PAGENAME}} with metacharacters
8616 !! options
8617 title=[['foo & bar = baz']]
8618 !! wikitext
8619 ''{{PAGENAME}}''
8620 !! html/php
8621 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8622 </p>
8623 !! html+tidy
8624 <p><i>'foo &amp; bar = baz'</i></p>
8625 !! end
8626
8627 !! test
8628 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8629 !! options
8630 title=[[*RFC 1234 http://example.com/]]
8631 !! wikitext
8632 {{PAGENAME}}
8633 !! html/php
8634 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8635 </p>
8636 !! html+tidy
8637 <p>*RFC 1234 http://example.com/</p>
8638 !! end
8639
8640 !! test
8641 Magic Word: {{PAGENAMEE}}
8642 !! options
8643 title=[[User:Ævar Arnfjörð Bjarmason]]
8644 !! wikitext
8645 {{PAGENAMEE}}
8646 !! html
8647 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8648 </p>
8649 !! end
8650
8651 !! test
8652 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8653 !! options
8654 title=[[*RFC 1234 http://example.com/]]
8655 !! wikitext
8656 {{PAGENAMEE}}
8657 !! html/php
8658 <p>&#42;RFC_1234_http&#58;//example.com/
8659 </p>
8660 !! html+tidy
8661 <p>*RFC_1234_http://example.com/</p>
8662 !! end
8663
8664 !! test
8665 Magic Word: {{REVISIONID}}
8666 !! wikitext
8667 {{REVISIONID}}
8668 !! html
8669 <p>1337
8670 </p>
8671 !! end
8672
8673 !! test
8674 Magic Word: {{SCRIPTPATH}}
8675 !! wikitext
8676 {{SCRIPTPATH}}
8677 !! html
8678 <p>/
8679 </p>
8680 !! end
8681
8682 !! test
8683 Magic Word: {{STYLEPATH}}
8684 !! wikitext
8685 {{STYLEPATH}}
8686 !! html
8687 <p>/skins
8688 </p>
8689 !! end
8690
8691 !! test
8692 Magic Word: {{SERVER}}
8693 !! wikitext
8694 {{SERVER}}
8695 !! html
8696 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8697 </p>
8698 !! end
8699
8700 !! test
8701 Magic Word: {{SERVERNAME}}
8702 !! wikitext
8703 {{SERVERNAME}}
8704 !! html
8705 <p>example.org
8706 </p>
8707 !! end
8708
8709 !! test
8710 Magic Word: {{SITENAME}}
8711 !! wikitext
8712 {{SITENAME}}
8713 !! html
8714 <p>MediaWiki
8715 </p>
8716 !! end
8717
8718 !! test
8719 Case-sensitive magic words, when cased differently, should just be template transclusions
8720 !! wikitext
8721 {{CurrentMonth}}
8722 {{currentday}}
8723 {{cURreNTweEK}}
8724 {{currentHour}}
8725 !! html
8726 <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>
8727 <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>
8728 <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>
8729 <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>
8730 </p>
8731 !! end
8732
8733 !! test
8734 Case-insensitive magic words should still work with weird casing.
8735 !! wikitext
8736 {{sErVeRNaMe}}
8737 {{LCFirst:AOEU}}
8738 {{ucFIRST:aoeu}}
8739 {{SERver}}
8740 !! html
8741 <p>example.org
8742 aOEU
8743 Aoeu
8744 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8745 </p>
8746 !! end
8747
8748 !! test
8749 Namespace 1 {{ns:1}}
8750 !! wikitext
8751 {{ns:1}}
8752 !! html
8753 <p>Talk
8754 </p>
8755 !! end
8756
8757 !! test
8758 Namespace 1 {{ns:01}}
8759 !! wikitext
8760 {{ns:01}}
8761 !! html
8762 <p>Talk
8763 </p>
8764 !! end
8765
8766 !! test
8767 Namespace 0 {{ns:0}} (bug 4783)
8768 !! wikitext
8769 {{ns:0}}
8770 !! html
8771
8772 !! end
8773
8774 !! test
8775 Namespace 0 {{ns:00}} (bug 4783)
8776 !! wikitext
8777 {{ns:00}}
8778 !! html
8779
8780 !! end
8781
8782 !! test
8783 Namespace -1 {{ns:-1}}
8784 !! wikitext
8785 {{ns:-1}}
8786 !! html
8787 <p>Special
8788 </p>
8789 !! end
8790
8791 !! test
8792 Namespace User {{ns:User}}
8793 !! wikitext
8794 {{ns:User}}
8795 !! html
8796 <p>User
8797 </p>
8798 !! end
8799
8800 !! test
8801 Namespace User talk {{ns:User_talk}}
8802 !! wikitext
8803 {{ns:User_talk}}
8804 !! html
8805 <p>User talk
8806 </p>
8807 !! end
8808
8809 !! test
8810 Namespace User talk {{ns:uSeR tAlK}}
8811 !! wikitext
8812 {{ns:uSeR tAlK}}
8813 !! html
8814 <p>User talk
8815 </p>
8816 !! end
8817
8818 !! test
8819 Namespace File {{ns:File}}
8820 !! wikitext
8821 {{ns:File}}
8822 !! html
8823 <p>File
8824 </p>
8825 !! end
8826
8827 !! test
8828 Namespace File {{ns:Image}}
8829 !! wikitext
8830 {{ns:Image}}
8831 !! html
8832 <p>File
8833 </p>
8834 !! end
8835
8836 !! test
8837 Namespace (lang=de) Benutzer {{ns:User}}
8838 !! options
8839 language=de
8840 !! wikitext
8841 {{ns:User}}
8842 !! html
8843 <p>Benutzer
8844 </p>
8845 !! end
8846
8847 !! test
8848 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
8849 !! options
8850 language=de
8851 !! wikitext
8852 {{ns:3}}
8853 !! html
8854 <p>Benutzer Diskussion
8855 </p>
8856 !! end
8857
8858
8859 !! test
8860 Urlencode
8861 !! wikitext
8862 {{urlencode:hi world?!}}
8863 {{urlencode:hi world?!|WIKI}}
8864 {{urlencode:hi world?!|PATH}}
8865 {{urlencode:hi world?!|QUERY}}
8866 !! html
8867 <p>hi+world%3F%21
8868 hi_world%3F!
8869 hi%20world%3F%21
8870 hi+world%3F%21
8871 </p>
8872 !! end
8873
8874 !! test
8875 Magic Word: prioritize type info over data-parsoid
8876 !! options
8877 parsoid=html2wt
8878 !! wikitext
8879 __FORCETOC__
8880 !! html
8881 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
8882 !! end
8883
8884 !! test
8885 Magic Word: serialize on separate line (parsoid)
8886 !! options
8887 parsoid=wt2wt,html2wt
8888 !! wikitext
8889 foo
8890 __NOTOC__
8891 bar
8892 !! html
8893 foo<meta property="mw:PageProp/notoc"/>bar
8894 !! end
8895
8896 !! test
8897 Magic Word: rt non-english wikis
8898 !! options
8899 parsoid=wt2wt
8900 language=de
8901 !! wikitext
8902 __NOEDITSECTION__
8903 !! html
8904 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
8905 !! end
8906
8907 ###
8908 ### Magic links
8909 ###
8910 !! test
8911 Magic links: internal link to RFC (bug 479)
8912 !! wikitext
8913 [[RFC 123]]
8914 !! html
8915 <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>
8916 </p>
8917 !! end
8918
8919 !! test
8920 Magic links: RFC (bug 479)
8921 !! wikitext
8922 RFC 822
8923 !! html
8924 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8925 </p>
8926 !! end
8927
8928 !! test
8929 Magic links: RFC (bug 65278)
8930 !! wikitext
8931 This is RFC 822 but thisRFC 822 is not RFC 822linked.
8932 !! html
8933 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
8934 </p>
8935 !! end
8936
8937 !! test
8938 Magic links: ISBN (bug 1937)
8939 !! wikitext
8940 ISBN 0-306-40615-2
8941 !! html
8942 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8943 </p>
8944 !! end
8945
8946 !! test
8947 Magic links: ISBN (bug 65278)
8948 !! wikitext
8949 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
8950 !! html
8951 <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
8952 </p>
8953 !! end
8954
8955 !! test
8956 Magic links: PMID incorrectly converts space to underscore
8957 !! wikitext
8958 PMID 1234
8959 !! html
8960 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8961 </p>
8962 !! end
8963
8964 !! test
8965 Magic links: PMID (bug 65278)
8966 !! wikitext
8967 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
8968 !! html
8969 <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
8970 </p>
8971 !! end
8972
8973 ###
8974 ### Templates
8975 ####
8976
8977 !! test
8978 Nonexistent template
8979 !! wikitext
8980 {{thistemplatedoesnotexist}}
8981 !! html
8982 <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>
8983 </p>
8984 !! end
8985
8986 !! test
8987 Template with invalid target containing tags
8988 !! wikitext
8989 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8990 !! html
8991 <p>{{a<b>b</b>|foo|a=b|a = b}}
8992 </p>
8993 !! end
8994
8995 !! test
8996 Template with invalid target containing unclosed tag
8997 !! wikitext
8998 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8999 !! html
9000 <p>{{a<b>|foo|a=b|a = b}}</b>
9001 </p>
9002 !! end
9003
9004 !! test
9005 Template with invalid target containing wikilink
9006 !! wikitext
9007 {{[[Main Page]]}}
9008 !! html/php
9009 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
9010 </p>
9011 !! html/parsoid
9012 <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>
9013 !! end
9014
9015 !! test
9016 Template with just whitespace in it, bug #68421
9017 !! wikitext
9018 {{echo|{{ }}}}
9019 !! html/parsoid
9020 <p><span typeof="mw:Transclusion mw:Nowiki" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</span></p>
9021 !! end
9022
9023 !! article
9024 Template:test
9025 !! text
9026 This is a test template
9027 !! endarticle
9028
9029 !! test
9030 Simple template
9031 !! wikitext
9032 {{test}}
9033 !! html
9034 <p>This is a test template
9035 </p>
9036 !! end
9037
9038 !! test
9039 Template with explicit namespace
9040 !! wikitext
9041 {{Template:test}}
9042 !! html
9043 <p>This is a test template
9044 </p>
9045 !! end
9046
9047
9048 !! article
9049 Template:paramtest
9050 !! text
9051 This is a test template with parameter {{{param}}}
9052 !! endarticle
9053
9054 !! test
9055 Template parameter
9056 !! wikitext
9057 {{paramtest|param=foo}}
9058 !! html
9059 <p>This is a test template with parameter foo
9060 </p>
9061 !! end
9062
9063 !! article
9064 Template:paramtestnum
9065 !! text
9066 [[{{{1}}}|{{{2}}}]]
9067 !! endarticle
9068
9069 !! test
9070 Template unnamed parameter
9071 !! wikitext
9072 {{paramtestnum|Main Page|the main page}}
9073 !! html
9074 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9075 </p>
9076 !! end
9077
9078 !! article
9079 Template:templatesimple
9080 !! text
9081 (test)
9082 !! endarticle
9083
9084 !! article
9085 Template:templateredirect
9086 !! text
9087 #redirect [[Template:templatesimple]]
9088 !! endarticle
9089
9090 !! article
9091 Template:templateasargtestnum
9092 !! text
9093 {{{{{1}}}}}
9094 !! endarticle
9095
9096 !! article
9097 Template:templateasargtest
9098 !! text
9099 {{template{{{templ}}}}}
9100 !! endarticle
9101
9102 !! article
9103 Template:templateasargtest2
9104 !! text
9105 {{{{{templ}}}}}
9106 !! endarticle
9107
9108 !! test
9109 Template with template name as unnamed argument
9110 !! wikitext
9111 {{templateasargtestnum|templatesimple}}
9112 !! html
9113 <p>(test)
9114 </p>
9115 !! end
9116
9117 !! test
9118 Template with template name as argument
9119 !! wikitext
9120 {{templateasargtest|templ=simple}}
9121 !! html
9122 <p>(test)
9123 </p>
9124 !! end
9125
9126 !! test
9127 Template with template name as argument (2)
9128 !! wikitext
9129 {{templateasargtest2|templ=templatesimple}}
9130 !! html
9131 <p>(test)
9132 </p>
9133 !! end
9134
9135 !! article
9136 Template:templateasargtestdefault
9137 !! text
9138 {{{{{templ|templatesimple}}}}}
9139 !! endarticle
9140
9141 !! article
9142 Template:templa
9143 !! text
9144 '''templ'''
9145 !! endarticle
9146
9147 !! test
9148 Template with default value
9149 !! wikitext
9150 {{templateasargtestdefault}}
9151 !! html
9152 <p>(test)
9153 </p>
9154 !! end
9155
9156 !! test
9157 Template with default value (value set)
9158 !! wikitext
9159 {{templateasargtestdefault|templ=templa}}
9160 !! html
9161 <p><b>templ</b>
9162 </p>
9163 !! end
9164
9165 !! test
9166 Template redirect
9167 !! wikitext
9168 {{templateredirect}}
9169 !! html
9170 <p>(test)
9171 </p>
9172 !! end
9173
9174 !! test
9175 Template with argument in separate line
9176 !! wikitext
9177 {{ templateasargtest |
9178 templ = simple }}
9179 !! html
9180 <p>(test)
9181 </p>
9182 !! end
9183
9184 !! test
9185 Template with complex template as argument
9186 !! wikitext
9187 {{paramtest|
9188 param ={{ templateasargtest |
9189 templ = simple }}}}
9190 !! html
9191 <p>This is a test template with parameter (test)
9192 </p>
9193 !! end
9194
9195 !! test
9196 Template with thumb image (with link in description)
9197 !! wikitext
9198 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9199 !! html/php
9200 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>
9201
9202 !! html+tidy
9203 <p>This is a test template with parameter</p>
9204 <div class="thumb tright">
9205 <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>
9206 <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>
9207 </div>
9208 </div>
9209 !! html/parsoid
9210 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
9211 !! end
9212
9213 !! article
9214 Template:complextemplate
9215 !! text
9216 {{{1}}} {{paramtest|
9217 param ={{{param}}}}}
9218 !! endarticle
9219
9220 !! test
9221 Template with complex arguments
9222 !! wikitext
9223 {{complextemplate|
9224 param ={{ templateasargtest |
9225 templ = simple }}|[[Template:complextemplate|link]]}}
9226 !! html
9227 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
9228 </p>
9229 !! end
9230
9231 !! test
9232 BUG 553: link with two variables in a piped link
9233 !! wikitext
9234 {|
9235 |[[{{{1}}}|{{{2}}}]]
9236 |}
9237 !! html
9238 <table>
9239 <tr>
9240 <td>[[{{{1}}}|{{{2}}}]]
9241 </td></tr></table>
9242
9243 !! end
9244
9245 !! test
9246 Magic variable as template parameter
9247 !! wikitext
9248 {{paramtest|param={{SITENAME}}}}
9249 !! html
9250 <p>This is a test template with parameter MediaWiki
9251 </p>
9252 !! end
9253
9254 !! article
9255 Template:linktest
9256 !! text
9257 [[{{{param}}}|link]]
9258 !! endarticle
9259
9260 !! test
9261 Template parameter as link source
9262 !! wikitext
9263 {{linktest|param=Main Page}}
9264 !! html
9265 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
9266 </p>
9267 !! end
9268
9269 !!test
9270 Template-generated attribute string (k='v')
9271 !! wikitext
9272 <span {{attr_str|id|v1}}>bar</span>
9273 !! html
9274 <p><span id="v1">bar</span>
9275 </p>
9276 !!end
9277
9278 !!article
9279 Template:paramtest2
9280 !! text
9281 including another template, {{paramtest|param={{{arg}}}}}
9282 !! endarticle
9283
9284 !! test
9285 Template passing argument to another template
9286 !! wikitext
9287 {{paramtest2|arg='hmm'}}
9288 !! html
9289 <p>including another template, This is a test template with parameter 'hmm'
9290 </p>
9291 !! end
9292
9293 !! article
9294 Template:Linktest2
9295 !! text
9296 Main Page
9297 !! endarticle
9298
9299 !! test
9300 Template as link source
9301 !! wikitext
9302 [[{{linktest2}}]]
9303
9304 [[{{linktest2}}|Main Page]]
9305
9306 [[{{linktest2}}]]Page
9307 !! html
9308 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9309 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9310 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
9311 </p>
9312 !! end
9313
9314
9315 !! article
9316 Template:loop1
9317 !! text
9318 {{loop2}}
9319 !! endarticle
9320
9321 !! article
9322 Template:loop2
9323 !! text
9324 {{loop1}}
9325 !! endarticle
9326
9327 !! test
9328 Template infinite loop
9329 !! wikitext
9330 {{loop1}}
9331 !! html
9332 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
9333 </p>
9334 !! end
9335
9336 !! test
9337 Template from main namespace
9338 !! wikitext
9339 {{:Main Page}}
9340 !! html
9341 <p>blah blah
9342 </p>
9343 !! end
9344
9345 !! article
9346 Template:table
9347 !! text
9348 {|
9349 | 1 || 2
9350 |-
9351 | 3 || 4
9352 |}
9353 !! endarticle
9354
9355 !! test
9356 BUG 529: Template with table, not included at beginning of line
9357 !! wikitext
9358 foo {{table}}
9359 !! html
9360 <p>foo
9361 </p>
9362 <table>
9363 <tr>
9364 <td> 1 </td>
9365 <td> 2
9366 </td></tr>
9367 <tr>
9368 <td> 3 </td>
9369 <td> 4
9370 </td></tr></table>
9371
9372 !! end
9373
9374 !! test
9375 BUG 523: Template shouldn't eat newline (or add an extra one before table)
9376 !! wikitext
9377 foo
9378 {{table}}
9379 !! html
9380 <p>foo
9381 </p>
9382 <table>
9383 <tr>
9384 <td> 1 </td>
9385 <td> 2
9386 </td></tr>
9387 <tr>
9388 <td> 3 </td>
9389 <td> 4
9390 </td></tr></table>
9391
9392 !! end
9393
9394 !! test
9395 BUG 41: Template parameters shown as broken links
9396 !! wikitext
9397 {{{parameter}}}
9398 !! html
9399 <p>{{{parameter}}}
9400 </p>
9401 !! end
9402
9403 !! test
9404 Template with targets containing wikilinks
9405 !! wikitext
9406 {{[[foo]]}}
9407
9408 {{[[{{echo|foo}}]]}}
9409
9410 {{{{echo|[[foo}}]]}}
9411 !! html
9412 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9413 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9414 </p><p>{{[[foo}}]]
9415 </p>
9416 !! end
9417
9418 !! article
9419 Template:MSGNW test
9420 !! text
9421 ''None'' of '''this''' should be
9422 * interpreted
9423 but rather passed unmodified
9424 {{test}}
9425 <gallery>
9426 File:Foobar.jpg
9427 </gallery>
9428 !! endarticle
9429
9430 # hmm, fix this or just deprecate msgnw and document its behavior?
9431 !! test
9432 msgnw keyword
9433 !! wikitext
9434 {{msgnw:MSGNW test}}
9435 !! html
9436 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
9437 &#42; interpreted
9438 &#32;but rather passed unmodified
9439 &#123;&#123;test&#125;&#125;
9440 &#60;gallery&#62;
9441 File:Foobar.jpg
9442 &#60;/gallery&#62;
9443 </p>
9444 !! end
9445
9446 !! test
9447 int keyword
9448 !! wikitext
9449 {{int:youhavenewmessages|lots of money|not!}}
9450 !! html
9451 <p>You have lots of money (not!).
9452 </p>
9453 !! end
9454
9455 !! article
9456 Template:Includes
9457 !! text
9458 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9459 !! endarticle
9460
9461 !! test
9462 <includeonly> and <noinclude> being included
9463 !! wikitext
9464 {{Includes}}
9465 !! html
9466 <p>Foobar
9467 </p>
9468 !! end
9469
9470 !! article
9471 Template:Includes2
9472 !! text
9473 <onlyinclude>Foo</onlyinclude>bar
9474 !! endarticle
9475
9476 !! test
9477 <onlyinclude> being included
9478 !! wikitext
9479 {{Includes2}}
9480 !! html
9481 <p>Foo
9482 </p>
9483 !! end
9484
9485
9486 !! article
9487 Template:Includes3
9488 !! text
9489 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9490 !! endarticle
9491
9492 !! test
9493 <onlyinclude> and <includeonly> being included
9494 !! wikitext
9495 {{Includes3}}
9496 !! html
9497 <p>Foo
9498 </p>
9499 !! end
9500
9501 !! test
9502 <includeonly> and <noinclude> on a page
9503 !! wikitext
9504 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9505 !! html
9506 <p>Foozar
9507 </p>
9508 !! end
9509
9510 !! test
9511 Un-closed <noinclude>
9512 !! wikitext
9513 <noinclude>
9514 !! html
9515 !! end
9516
9517 !! test
9518 <onlyinclude> on a page
9519 !! wikitext
9520 <onlyinclude>Foo</onlyinclude>bar
9521 !! html
9522 <p>Foobar
9523 </p>
9524 !! end
9525
9526 !! test
9527 Un-closed <onlyinclude>
9528 !! wikitext
9529 <onlyinclude>
9530 !! html
9531 !! end
9532
9533 !!test
9534 Self-closed noinclude, includeonly, onlyinclude tags
9535 !! wikitext
9536 <noinclude />
9537 <includeonly />
9538 <onlyinclude />
9539 !! html
9540 <p><br />
9541 </p>
9542 !!end
9543
9544 !!test
9545 Unbalanced includeonly and noinclude tags
9546 !! wikitext
9547 {|
9548 |a</noinclude>
9549 |b</noinclude></noinclude>
9550 |c</noinclude></includeonly>
9551 |d</includeonly></includeonly>
9552 |}
9553 !! html
9554 <table>
9555 <tr>
9556 <td>a
9557 </td>
9558 <td>b
9559 </td>
9560 <td>c&lt;/includeonly&gt;
9561 </td>
9562 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9563 </td></tr></table>
9564
9565 !!end
9566
9567 !! article
9568 Template:Includeonly section
9569 !! text
9570 <includeonly>
9571 ==Includeonly section==
9572 </includeonly>
9573 ==Section T-1==
9574 !!endarticle
9575
9576 !! test
9577 Bug 6563: Edit link generation for section shown by <includeonly>
9578 !! wikitext
9579 {{includeonly section}}
9580 !! html
9581 <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>
9582 <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>
9583
9584 !! end
9585
9586 # Uses same input as the contents of [[Template:Includeonly section]]
9587 !! test
9588 Bug 6563: Section extraction for section shown by <includeonly>
9589 !! options
9590 section=T-2
9591 !! wikitext
9592 <includeonly>
9593 ==Includeonly section==
9594 </includeonly>
9595 ==Section T-2==
9596 !! html
9597 ==Section T-2==
9598 !! end
9599
9600 !! test
9601 Bug 6563: Edit link generation for section suppressed by <includeonly>
9602 !! wikitext
9603 <includeonly>
9604 ==Includeonly section==
9605 </includeonly>
9606 ==Section 1==
9607 !! html
9608 <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>
9609
9610 !! end
9611
9612 !! test
9613 Bug 6563: Section extraction for section suppressed by <includeonly>
9614 !! options
9615 section=1
9616 !! wikitext
9617 <includeonly>
9618 ==Includeonly section==
9619 </includeonly>
9620 ==Section 1==
9621 !! html
9622 ==Section 1==
9623 !! end
9624
9625 !! test
9626 Un-closed <includeonly>
9627 !! wikitext
9628 <includeonly>
9629 !! html
9630 !! end
9631
9632 !! test
9633 Includes and comments at SOL
9634 !! wikitext
9635 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
9636
9637 <noinclude>
9638 some
9639 </noinclude>* stuff
9640 * here
9641
9642 <includeonly>can have stuff</includeonly>=== here ===
9643
9644 !! html/php
9645 <h2><span class="mw-headline" id="hu">hu</span></h2>
9646 <p>some
9647 </p>
9648 <ul><li> stuff</li>
9649 <li> here</li></ul>
9650 <h3><span class="mw-headline" id="here">here</span></h3>
9651
9652 !! html/parsoid
9653 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment --><h2> hu </h2>
9654
9655 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
9656 <p>some</p>
9657 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
9658 <li> here</li></ul>
9659
9660 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3> here </h3>
9661
9662 !! end
9663
9664 # TODO: test with DOM fragment reuse!
9665 !! test
9666 Parsoid: DOM fragment reuse
9667 !! options
9668 parsoid=wt2wt,wt2html
9669 !! wikitext
9670 a{{echo|b<table></table>c}}d
9671
9672 a{{echo|b
9673 <table></table>
9674 c}}d
9675
9676 {{echo|a
9677
9678 <table></table>
9679
9680 b}}
9681 !! html
9682 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
9683
9684 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>ab</p><span about="#mwt2">
9685 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
9686 </span><p about="#mwt2">cd</p>
9687
9688 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>a</p><span about="#mwt3">
9689
9690 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
9691
9692 </span><p about="#mwt3">b</p>
9693 !! end
9694
9695 !! test
9696 Parsoid: Merge double tds (bug 50603)
9697 !! options
9698 parsoid
9699 !! wikitext
9700 {|
9701 |{{echo|{{!}} foo}}
9702 |}
9703 !! html
9704 <table><tbody>
9705 <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>
9706 </tbody></table>
9707 !! end
9708
9709 !! test
9710 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9711 !! options
9712 parsoid
9713 !! wikitext
9714 {{echo|<div>}}
9715 {|
9716 |{{echo|{{!}} foo}}
9717 |}
9718 {{echo|</div>}}
9719 !! html
9720 <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}}]}'>
9721 <table><tbody>
9722 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9723 </tbody></table>
9724 </div>
9725 !! end
9726
9727 ###
9728 ### <includeonly> and <noinclude> in attributes
9729 ###
9730 !!test
9731 0. includeonly around the entire attribute
9732 !! wikitext
9733 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9734 !! html
9735 <p><span id="v2">bar</span>
9736 </p>
9737 !!end
9738
9739 !!test
9740 1. includeonly in html attr key
9741 !! wikitext
9742 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9743 !! html
9744 <p><span id="foo">bar</span>
9745 </p>
9746 !!end
9747
9748 !!test
9749 2. includeonly in html attr value
9750 !! wikitext
9751 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9752 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9753 !! html
9754 <p><span id="v1">bar</span>
9755 <span id="v1">bar</span>
9756 </p>
9757 !!end
9758
9759 !!test
9760 3. includeonly in part of an attr value
9761 !! wikitext
9762 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9763 !! html
9764 <p><span style="color:red;">bar</span>
9765 </p>
9766 !!end
9767
9768 !!test
9769 4. includeonly in table attributes
9770 !! wikitext
9771 {|
9772 |- <noinclude>
9773 |-
9774 |a
9775 </noinclude>
9776 |- <includeonly>
9777 |-
9778 |b
9779 </includeonly>
9780 |}
9781 !! html
9782 <table>
9783
9784
9785 <tr>
9786 <td>a
9787 </td></tr>
9788 </table>
9789
9790 !!end
9791
9792 ###
9793 ### Token Stream Patcher tests
9794 ###
9795 ### These tests won't always pass wt2wt and other modes because
9796 ### on serialization, the table will be output on a new line.
9797 ### For now, we are blacklisting them, and using this to test selser.
9798 ###
9799
9800 !!test
9801 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
9802 !!options
9803 parsoid=wt2html,wt2wt
9804 !!wikitext
9805 {{echo|}}{| width = '100%'
9806 |foo
9807 |}
9808 !!html/parsoid
9809 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
9810 <tbody><tr><td>foo</td></tr>
9811 </tbody></table>
9812 !!end
9813
9814 !!test
9815 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
9816 !!options
9817 parsoid=wt2html,wt2wt
9818 !!wikitext
9819 <includeonly>a</includeonly>{| {{{b}}}
9820 |c
9821 |}
9822 !!html/parsoid
9823 <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}}}":""}}'>
9824 <tbody><tr><td>c</td></tr>
9825 </tbody></table>
9826
9827 !!end
9828
9829 ###
9830 ### Testing parsing of templates where a template arg
9831 ### has the same name as the template itself.
9832 ###
9833
9834 !! article
9835 Template:quote
9836 !! text
9837 {{{quote|{{{1}}}}}}
9838 !! endarticle
9839
9840 !!test
9841 Templates: Template Name/Arg clash: 1. Use of positional param
9842 !! wikitext
9843 {{quote|foo}}
9844 !! html
9845 <p>foo
9846 </p>
9847 !!end
9848
9849 !!test
9850 Templates: Template Name/Arg clash: 2. Use of named param
9851 !! wikitext
9852 {{quote|quote=foo}}
9853 !! html
9854 <p>foo
9855 </p>
9856 !!end
9857
9858 !!test
9859 Templates: Template Name/Arg clash: 3. Use of named param with empty input
9860 !! wikitext
9861 {{quote|quote}}
9862 !! html
9863 <p>quote
9864 </p>
9865 !!end
9866
9867 ###
9868 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
9869 ###
9870
9871 !!test
9872 Templates: 1. Simple use
9873 !! wikitext
9874 {{echo|Foo}}
9875 !! html
9876 <p>Foo
9877 </p>
9878 !!end
9879
9880 !!test
9881 Templates: 2. Inside a block tag
9882 !! wikitext
9883 <div>{{echo|Foo}}</div>
9884 <blockquote>{{echo|Foo}}</blockquote>
9885 !! html
9886 <div>Foo</div>
9887 <blockquote>Foo</blockquote>
9888
9889 !! html+tidy
9890 <div>Foo</div>
9891 <blockquote>
9892 <p>Foo</p>
9893 </blockquote>
9894 !!end
9895
9896 !!test
9897 Templates: P-wrapping: 1a. Templates on consecutive lines
9898 !! wikitext
9899 {{echo|Foo}}
9900 {{echo|bar}}
9901 !! html
9902 <p>Foo
9903 bar
9904 </p>
9905 !!end
9906
9907 !!test
9908 Templates: P-wrapping: 1b. Templates on consecutive lines
9909 !! wikitext
9910 Foo
9911
9912 {{echo|bar}}
9913 {{echo|baz}}
9914 !! html
9915 <p>Foo
9916 </p><p>bar
9917 baz
9918 </p>
9919 !!end
9920
9921 !!test
9922 Templates: P-wrapping: 1c. Templates on consecutive lines
9923 !! wikitext
9924 {{echo|Foo}}
9925 {{echo|bar}} <div>baz</div>
9926 !! html
9927 <p>Foo
9928 </p>
9929 bar <div>baz</div>
9930
9931 !! html+tidy
9932 <p>Foo</p>
9933 <p>bar</p>
9934 <div>baz</div>
9935 !! end
9936
9937 !!test
9938 Templates: P-wrapping: 1d. Template preceded by comment-only line
9939 !!options
9940 parsoid
9941 !! wikitext
9942 <!-- foo -->
9943 {{echo|Bar}}
9944 !! html
9945 <!-- foo -->
9946
9947 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
9948 !!end
9949
9950 !!test
9951 Templates: Inline Text: 1. Multiple template uses
9952 !! wikitext
9953 {{echo|Foo}}bar{{echo|baz}}
9954 !! html
9955 <p>Foobarbaz
9956 </p>
9957 !!end
9958
9959 !!test
9960 Templates: Inline Text: 2. Back-to-back template uses
9961 !! wikitext
9962 {{echo|Foo}}{{echo|bar}}
9963 !! html
9964 <p>Foobar
9965 </p>
9966 !!end
9967
9968 !!test
9969 Templates: Block Tags: 1. Multiple template uses
9970 !! wikitext
9971 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
9972 !! html
9973 <div>Foo</div><div>bar</div><div>baz</div>
9974
9975 !!end
9976
9977 !!test
9978 Templates: Block Tags: 2. Back-to-back template uses
9979 !! wikitext
9980 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
9981 !! html
9982 <div>Foo</div><div>bar</div>
9983
9984 !!end
9985
9986 # This is an edge case relating to paragraph wrapping.
9987 !!test
9988 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
9989 !! wikitext
9990 {{echo|a
9991 b</p>}}
9992 !! html/parsoid
9993 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\nb&lt;/p>"}},"i":0}}]}'>a
9994 b</p>
9995 !!end
9996
9997 !!test
9998 Templates: Links: 1. Simple example
9999 !! wikitext
10000 {{echo|[[Foo|bar]]}}
10001 !! html
10002 <p><a href="/wiki/Foo" title="Foo">bar</a>
10003 </p>
10004 !!end
10005
10006 !!test
10007 Templates: Links: 2. Generation of link href
10008 !! wikitext
10009 [[{{echo|Foo}}|bar]]
10010 !! html
10011 <p><a href="/wiki/Foo" title="Foo">bar</a>
10012 </p>
10013 !!end
10014
10015 !!test
10016 Templates: Links: 3. Generation of part of a link href
10017 !! wikitext
10018 [[Fo{{echo|o}}|bar]]
10019
10020 [[Foo{{echo|bar}}]]
10021
10022 [[Foo{{echo|bar}}baz]]
10023
10024 [[Foo{{echo|bar}}|bar]]
10025
10026 [[:Foo{{echo|bar}}]]
10027
10028 [[:Foo{{echo|bar}}|bar]]
10029 !! html
10030 <p><a href="/wiki/Foo" title="Foo">bar</a>
10031 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10032 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10033 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10034 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10035 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10036 </p>
10037 !!end
10038
10039 !!test
10040 Templates: Links: 4. Multiple templates generating link href
10041 !! wikitext
10042 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10043 !! html
10044 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10045 </p>
10046 !!end
10047
10048 !!test
10049 Templates: Links: 5. Generation of link text
10050 !! wikitext
10051 [[Foo|{{echo|bar}}]]
10052 !! html
10053 <p><a href="/wiki/Foo" title="Foo">bar</a>
10054 </p>
10055 !!end
10056
10057 !!test
10058 Templates: Links: 5. Nested templates (only outermost template should be marked)
10059 !! wikitext
10060 {{echo|[[{{echo|Foo}}|bar]]}}
10061 !! html
10062 <p><a href="/wiki/Foo" title="Foo">bar</a>
10063 </p>
10064 !!end
10065
10066 !!test
10067 Templates: HTML Tag: 1. Generation of HTML attr. key
10068 !! wikitext
10069 <div {{echo|style}}="color:red;">foo</div>
10070 !! html
10071 <div style="color:red;">foo</div>
10072
10073 !!end
10074
10075 !!test
10076 Templates: HTML Tag: 2. Generation of HTML attr. value
10077 !! wikitext
10078 <div style={{echo|'color:red;'}}>foo</div>
10079 !! html
10080 <div style="color:red;">foo</div>
10081
10082 !!end
10083
10084 !!test
10085 Templates: HTML Tag: 3. Generation of HTML attr key and value
10086 !! wikitext
10087 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10088 !! html
10089 <div style="color:red;">foo</div>
10090
10091 !!end
10092
10093 !!test
10094 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10095 !! wikitext
10096 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10097 !! html
10098 <div title="This is a long title with just one piece templated">foo</div>
10099
10100 !!end
10101
10102 !!test
10103 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10104 !! wikitext
10105 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10106 !! html
10107 <div title="This is a long title with just one piece templated">foo</div>
10108
10109 !!end
10110
10111 !!test
10112 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10113 !! wikitext
10114 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10115 !! html
10116 <div title="This is a long title with just one piece templated">foo</div>
10117
10118 !!end
10119
10120 !!test
10121 Templates: HTML Tag: 7. Generation of partial attribute key string
10122 !! wikitext
10123 <div st{{echo|yle}}="color:red;">foo</div>
10124 !! html
10125 <div style="color:red;">foo</div>
10126
10127 !!end
10128
10129 !!test
10130 Templates: HTML Tables: 1. Generating start of a HTML table
10131 !! wikitext
10132 {{echo|<table><tr><td>foo</td>}}</tr></table>
10133 !! html
10134 <table><tr><td>foo</td></tr></table>
10135
10136 !!end
10137
10138 !!test
10139 Templates: HTML Tables: 2a. Generating middle of a HTML table
10140 !! wikitext
10141 <table><tr>{{echo|<td>foo</td>}}</tr></table>
10142 !! html
10143 <table><tr><td>foo</td></tr></table>
10144
10145 !!end
10146
10147 !!test
10148 Templates: HTML Tables: 2b. Generating middle of a HTML table
10149 !! wikitext
10150 <table>{{echo|<tr><td>foo</td></tr>}}</table>
10151 !! html
10152 <table><tr><td>foo</td></tr></table>
10153
10154 !!end
10155
10156 !!test
10157 Templates: HTML Tables: 3. Generating end of a HTML table
10158 !! wikitext
10159 <table><tr>{{echo|<td>foo</td></tr></table>}}
10160 !! html
10161 <table><tr><td>foo</td></tr></table>
10162
10163 !!end
10164
10165 !!test
10166 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
10167 !! wikitext
10168 {{echo|<table>}}<tr><td>foo</td></tr></table>
10169 !! html
10170 <table><tr><td>foo</td></tr></table>
10171
10172 !!end
10173
10174 !!test
10175 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
10176 !! wikitext
10177 <table>{{echo|<tr>}}<td>foo</td></tr></table>
10178 !! html
10179 <table><tr><td>foo</td></tr></table>
10180
10181 !!end
10182
10183 !!test
10184 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
10185 !! wikitext
10186 <table><tr>{{echo|<td>}}foo</td></tr></table>
10187 !! html
10188 <table><tr><td>foo</td></tr></table>
10189
10190 !!end
10191
10192 !!test
10193 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
10194 !! wikitext
10195 <table><tr><td>foo{{echo|</td>}}</tr></table>
10196 !! html
10197 <table><tr><td>foo</td></tr></table>
10198
10199 !!end
10200
10201 !!test
10202 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
10203 !! wikitext
10204 <table><tr><td>foo</td>{{echo|</tr>}}</table>
10205 !! html
10206 <table><tr><td>foo</td></tr></table>
10207
10208 !!end
10209
10210 !!test
10211 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
10212 !! wikitext
10213 <table><tr><td>foo</td></tr>{{echo|</table>}}
10214 !! html
10215 <table><tr><td>foo</td></tr></table>
10216
10217 !!end
10218
10219 !!test
10220 Templates: HTML Tables: 5. Proper fostering of categories from inside
10221 !!options
10222 parsoid=wt2html,wt2wt
10223 !! wikitext
10224 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
10225 <!--Two categories (Bug 50330)-->
10226 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
10227 !! html
10228 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
10229 <!--Two categories (Bug 50330)-->
10230 <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>
10231 !!end
10232
10233 !!test
10234 Templates: Wiki Tables: 1a. Fostering of entire template content
10235 !! wikitext
10236 {|
10237 {{echo|a}}
10238 |}
10239 !! html
10240 <table>
10241 a
10242 <tr><td></td></tr></table>
10243
10244 !! html+tidy
10245 <p>a</p>
10246 <table>
10247 <tr>
10248 <td></td>
10249 </tr>
10250 </table>
10251 !! end
10252
10253 !!test
10254 Templates: Wiki Tables: 1b. Fostering of entire template content
10255 !! wikitext
10256 {|
10257 {{echo|<div>}}
10258 foo
10259 {{echo|</div>}}
10260 |}
10261 !! html
10262 <table>
10263 <div>
10264 <p>foo
10265 </p>
10266 </div>
10267 <tr><td></td></tr></table>
10268
10269 !! html+tidy
10270 <div>
10271 <p>foo</p>
10272 </div>
10273 <table>
10274 <tr>
10275 <td></td>
10276 </tr>
10277 </table>
10278 !! end
10279
10280 !!test
10281 Templates: Wiki Tables: 2. Fostering of partial template content
10282 !! wikitext
10283 {|
10284 {{echo|a
10285 <div>b</div>}}
10286 |}
10287 !! html
10288 <table>
10289 a
10290 <div>b</div>
10291 <tr><td></td></tr></table>
10292
10293 !! html+tidy
10294 <p>a</p>
10295 <div>b</div>
10296 <table>
10297 <tr>
10298 <td></td>
10299 </tr>
10300 </table>
10301 !! end
10302
10303 !!test
10304 Templates: Wiki Tables: 3. td-content via multiple templates
10305 !! wikitext
10306 {|
10307 {{echo|{{pipe}}a}}{{echo|b}}
10308 |}
10309 !! html
10310 <table>
10311 <tr>
10312 <td>ab
10313 </td></tr></table>
10314
10315 !!end
10316
10317 !!test
10318 Templates: Wiki Tables: 4. Templated tags, no content
10319 !! wikitext
10320 {{tbl-start}}
10321 {{tbl-end}}
10322 !! html
10323 <table>
10324 <tr><td></td></tr></table>
10325
10326 !!end
10327
10328 !!test
10329 Templates: Wiki Tables: 5. Templated tags, regular td-tags
10330 !! wikitext
10331 {{tbl-start}}
10332 |foo
10333 {{tbl-end}}
10334 !! html
10335 <table>
10336 <tr>
10337 <td>foo
10338 </td></tr></table>
10339
10340 !!end
10341
10342 !!test
10343 Templates: Wiki Tables: 6. Templated tags, templated td-tags
10344 !! wikitext
10345 {{tbl-start}}
10346 {{!}}foo
10347 {{tbl-end}}
10348 !! html
10349 <table>
10350 <tr>
10351 <td>foo
10352 </td></tr></table>
10353
10354 !!end
10355
10356 !!test
10357 Templates: Lists: Multi-line list-items via templates
10358 !! wikitext
10359 *{{echo|a {{nonexistent|
10360 unused}}}}
10361 *{{echo|b {{nonexistent|
10362 unused}}}}
10363 !! html
10364 <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>
10365 <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>
10366
10367 !!end
10368
10369 !!test
10370 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
10371 !! wikitext
10372 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
10373 !! html
10374 <p><i>ab</i>c<i>d</i>e
10375 </p>
10376 !!end
10377
10378 !!test
10379 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
10380 (PHP parser generates misnested html)
10381 !! wikitext
10382 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
10383 !! html/parsoid
10384 <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>
10385 !!end
10386
10387 !!test
10388 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
10389 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
10390 !! options
10391 parsoid=wt2html,wt2wt
10392 !! wikitext
10393 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
10394 !! html
10395 <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>
10396 <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>
10397 <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>
10398 !!end
10399
10400 !!test
10401 Templates: Ugly nesting: 4. Divs opened/closed across templates
10402 !! wikitext
10403 a<div>b{{echo|c</div>d}}e
10404 !! html
10405 a<div>bc</div>de
10406
10407 !! html+tidy
10408 <p>a</p>
10409 <div>bc</div>
10410 <p>de</p>
10411 !! end
10412
10413 !!test
10414 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10415 (Parsoid-centric)
10416 !! options
10417 parsoid
10418 !! wikitext
10419 {|
10420 |{{echo|foo</table>}}
10421 |bar
10422 |}
10423 !! html
10424 <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|}"]}'>
10425
10426 <tbody>
10427 <tr>
10428 <td>foo</td></tr></tbody></table><span about="#mwt1">
10429 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10430 |}</span>
10431 !!end
10432
10433 !!test
10434 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10435 (Parsoid-centric)
10436 !! options
10437 parsoid
10438 !! wikitext
10439 <table>
10440 <tr>
10441 <td>
10442 <table>
10443 <tr>
10444 <td>1. {{echo|foo </table>}}</td>
10445 <td> bar </td>
10446 <td>2. {{echo|baz </table>}}</td>
10447 </tr>
10448 <tr>
10449 <td>abc</td>
10450 </tr>
10451 </table>
10452 </td>
10453 </tr>
10454 <tr>
10455 <td>xyz</td>
10456 </tr>
10457 </table>
10458 !! html
10459 <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>"]}'>
10460 <tbody><tr>
10461 <td>
10462 <table>
10463 <tbody><tr>
10464 <td>1. foo </td></tr></tbody></table></td>
10465 <td> bar </td>
10466 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10467 </span><span about="#mwt2">
10468 </span><span about="#mwt2">
10469 </span><span about="#mwt2">abc</span><span about="#mwt2">
10470 </span><span about="#mwt2">
10471 </span><span about="#mwt2">
10472 </span><span about="#mwt2">
10473 </span><span about="#mwt2">
10474 </span><span about="#mwt2">
10475 </span><span about="#mwt2">xyz</span><span about="#mwt2">
10476 </span><span about="#mwt2">
10477 </span>
10478 !!end
10479
10480 !! test
10481 Templates: Ugly templates: 3. newline-only template parameter
10482 !! wikitext
10483 foo {{echo|
10484 }}
10485 !! html
10486 <p>foo
10487 </p>
10488 !! end
10489
10490 # This looks like a bug: a single newline triggers p/br for some reason.
10491 !! test
10492 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10493 !! wikitext
10494 {{echo|
10495 }}
10496 !! html
10497 <p><br />
10498 </p>
10499 !! end
10500
10501 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10502 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10503 !! test
10504 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10505 !! wikitext
10506 {{echo|<table>}}
10507 {{echo|<div>foo}}
10508 {{echo|</table>}}
10509 !! html/parsoid
10510 <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
10511 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10512 </table>
10513 !! end
10514
10515 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10516 # that are "identical" and generate nesting cycles in the algorithm
10517 !! test
10518 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
10519 !! wikitext
10520 {{echo|<table><tr><td><table>}}
10521 {{echo|<div>}}
10522 {{echo|</div>}}
10523 !! html/parsoid
10524 <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"}'>
10525 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10526 </table></td></tr></tbody></table>
10527 !! end
10528
10529 !!test
10530 Parser Functions: 1. Simple example
10531 !! wikitext
10532 {{uc:foo}}
10533 !! html
10534 <p>FOO
10535 </p>
10536 !!end
10537
10538 !!test
10539 Parser Functions: 2. Nested use (only outermost should be marked up)
10540 !! wikitext
10541 {{uc:{{lc:FOO}}}}
10542 !! html
10543 <p>FOO
10544 </p>
10545 !!end
10546
10547 ###
10548 ### Pre-save transform tests
10549 ###
10550 !! test
10551 pre-save transform: subst:
10552 !! options
10553 PST
10554 !! wikitext
10555 {{subst:test}}
10556 !! html
10557 This is a test template
10558 !! end
10559
10560 !! test
10561 pre-save transform: normal template
10562 !! options
10563 PST
10564 !! wikitext
10565 {{test}}
10566 !! html
10567 {{test}}
10568 !! end
10569
10570 !! test
10571 pre-save transform: nonexistent template
10572 !! options
10573 PST
10574 !! wikitext
10575 {{thistemplatedoesnotexist}}
10576 !! html
10577 {{thistemplatedoesnotexist}}
10578 !! end
10579
10580
10581 !! test
10582 pre-save transform: subst magic variables
10583 !! options
10584 PST
10585 !! wikitext
10586 {{subst:SITENAME}}
10587 !! html
10588 MediaWiki
10589 !! end
10590
10591 # This is bug 89, which I fixed. -- wtm
10592 !! test
10593 pre-save transform: subst: templates with parameters
10594 !! options
10595 pst
10596 !! wikitext
10597 {{subst:paramtest|param="something else"}}
10598 !! html
10599 This is a test template with parameter "something else"
10600 !! end
10601
10602 !! article
10603 Template:nowikitest
10604 !! text
10605 <nowiki>'''not wiki'''</nowiki>
10606 !! endarticle
10607
10608 !! test
10609 pre-save transform: nowiki in subst (bug 1188)
10610 !! options
10611 pst
10612 !! wikitext
10613 {{subst:nowikitest}}
10614 !! html
10615 <nowiki>'''not wiki'''</nowiki>
10616 !! end
10617
10618
10619 !! article
10620 Template:commenttest
10621 !! text
10622 This template has <!-- a comment --> in it.
10623 !! endarticle
10624
10625 !! test
10626 pre-save transform: comment in subst (bug 1936)
10627 !! options
10628 pst
10629 !! wikitext
10630 {{subst:commenttest}}
10631 !! html
10632 This template has <!-- a comment --> in it.
10633 !! end
10634
10635 !! test
10636 pre-save transform: unclosed tag
10637 !! options
10638 pst noxml
10639 !! wikitext
10640 <nowiki>'''not wiki'''
10641 !! html
10642 <nowiki>'''not wiki'''
10643 !! end
10644
10645 !! test
10646 pre-save transform: mixed tag case
10647 !! options
10648 pst noxml
10649 !! wikitext
10650 <NOwiki>'''not wiki'''</noWIKI>
10651 !! html
10652 <NOwiki>'''not wiki'''</noWIKI>
10653 !! end
10654
10655 !! test
10656 pre-save transform: unclosed comment in <nowiki>
10657 !! options
10658 pst noxml
10659 !! wikitext
10660 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10661 !! html
10662 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10663 !!end
10664
10665 # Leading @ in this template definition works around a limitation
10666 # in parsoid's parserTests which otherwise strips the <span> from the
10667 # result (confusing it for a template wrapper)
10668 !! article
10669 Template:dangerous
10670 !!text
10671 @<span onmouseover="alert('crap')">Oh no</span>
10672 !!endarticle
10673
10674 !!test
10675 (confirming safety of fix for subst bug 1936)
10676 !! wikitext
10677 {{Template:dangerous}}
10678 !! html
10679 <p>@<span>Oh no</span>
10680 </p>
10681 !! end
10682
10683 !! test
10684 pre-save transform: comment containing gallery (bug 5024)
10685 !! options
10686 pst
10687 !! wikitext
10688 <!-- <gallery>data</gallery> -->
10689 !! html
10690 <!-- <gallery>data</gallery> -->
10691 !!end
10692
10693 !! test
10694 pre-save transform: comment containing extension
10695 !! options
10696 pst
10697 !! wikitext
10698 <!-- <tag>data</tag> -->
10699 !! html
10700 <!-- <tag>data</tag> -->
10701 !!end
10702
10703 !! test
10704 pre-save transform: comment containing nowiki
10705 !! options
10706 pst
10707 !! wikitext
10708 <!-- <nowiki>data</nowiki> -->
10709 !! html
10710 <!-- <nowiki>data</nowiki> -->
10711 !!end
10712
10713 !! test
10714 pre-save transform: <noinclude> in subst (bug 3298)
10715 !! options
10716 pst
10717 !! wikitext
10718 {{subst:Includes}}
10719 !! html
10720 Foobar
10721 !! end
10722
10723 !! test
10724 pre-save transform: <onlyinclude> in subst (bug 3298)
10725 !! options
10726 pst
10727 !! wikitext
10728 {{subst:Includes2}}
10729 !! html
10730 Foo
10731 !! end
10732
10733 !! article
10734 Template:SubstTest
10735 !!text
10736 {{<includeonly>subst:</includeonly>Includes}}
10737 !! endarticle
10738
10739 !! article
10740 Template:SafeSubstTest
10741 !! text
10742 {{<includeonly>safesubst:</includeonly>Includes}}
10743 !! endarticle
10744
10745 !! test
10746 bug 22297: safesubst: works during PST
10747 !! options
10748 pst
10749 !! wikitext
10750 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
10751 !! html
10752 FoobarFoobar
10753 !! end
10754
10755 !! test
10756 bug 22297: safesubst: works during normal parse
10757 !! wikitext
10758 {{SafeSubstTest}}
10759 !! html
10760 <p>Foobar
10761 </p>
10762 !! end
10763
10764 !! test
10765 subst: does not work during normal parse
10766 !! wikitext
10767 {{SubstTest}}
10768 !! html
10769 <p>{{subst:Includes}}
10770 </p>
10771 !! end
10772
10773 !! test
10774 pre-save transform: context links ("pipe trick")
10775 !! options
10776 pst
10777 !! wikitext
10778 [[Article (context)|]]
10779 [[Bar:Article|]]
10780 [[:Bar:Article|]]
10781 [[Bar:Article (context)|]]
10782 [[:Bar:Article (context)|]]
10783 [[|Article]]
10784 [[|Article (context)]]
10785 [[Bar:X (Y) Z|]]
10786 [[:Bar:X (Y) Z|]]
10787 !! html
10788 [[Article (context)|Article]]
10789 [[Bar:Article|Article]]
10790 [[:Bar:Article|Article]]
10791 [[Bar:Article (context)|Article]]
10792 [[:Bar:Article (context)|Article]]
10793 [[Article]]
10794 [[Article (context)]]
10795 [[Bar:X (Y) Z|X (Y) Z]]
10796 [[:Bar:X (Y) Z|X (Y) Z]]
10797 !! end
10798
10799 !! test
10800 pre-save transform: context links ("pipe trick") with interwiki prefix
10801 !! options
10802 pst
10803 !! wikitext
10804 [[interwiki:Article|]]
10805 [[:interwiki:Article|]]
10806 [[interwiki:Bar:Article|]]
10807 [[:interwiki:Bar:Article|]]
10808 !! html
10809 [[interwiki:Article|Article]]
10810 [[:interwiki:Article|Article]]
10811 [[interwiki:Bar:Article|Bar:Article]]
10812 [[:interwiki:Bar:Article|Bar:Article]]
10813 !! end
10814
10815 !! test
10816 pre-save transform: context links ("pipe trick") with parens in title
10817 !! options
10818 pst title=[[Somearticle (context)]]
10819 !! wikitext
10820 [[|Article]]
10821 !! html
10822 [[Article (context)|Article]]
10823 !! end
10824
10825 !! test
10826 pre-save transform: context links ("pipe trick") with comma in title
10827 !! options
10828 pst title=[[Someplace, Somewhere]]
10829 !! wikitext
10830 [[|Otherplace]]
10831 [[Otherplace, Elsewhere|]]
10832 [[Otherplace, Elsewhere, Anywhere|]]
10833 !! html
10834 [[Otherplace, Somewhere|Otherplace]]
10835 [[Otherplace, Elsewhere|Otherplace]]
10836 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
10837 !! end
10838
10839 !! test
10840 pre-save transform: context links ("pipe trick") with parens and comma
10841 !! options
10842 pst title=[[Someplace (IGNORED), Somewhere]]
10843 !! wikitext
10844 [[|Otherplace]]
10845 [[Otherplace (place), Elsewhere|]]
10846 !! html
10847 [[Otherplace, Somewhere|Otherplace]]
10848 [[Otherplace (place), Elsewhere|Otherplace]]
10849 !! end
10850
10851 !! test
10852 pre-save transform: context links ("pipe trick") with comma and parens
10853 !! options
10854 pst title=[[Who, me? (context)]]
10855 !! wikitext
10856 [[|Yes, you.]]
10857 [[Me, Myself, and I (1937 song)|]]
10858 !! html
10859 [[Yes, you. (context)|Yes, you.]]
10860 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
10861 !! end
10862
10863 !! test
10864 pre-save transform: context links ("pipe trick") with namespace
10865 !! options
10866 pst title=[[Ns:Somearticle]]
10867 !! wikitext
10868 [[|Article]]
10869 !! html
10870 [[Ns:Article|Article]]
10871 !! end
10872
10873 !! test
10874 pre-save transform: context links ("pipe trick") with namespace and parens
10875 !! options
10876 pst title=[[Ns:Somearticle (context)]]
10877 !! wikitext
10878 [[|Article]]
10879 !! html
10880 [[Ns:Article (context)|Article]]
10881 !! end
10882
10883 !! test
10884 pre-save transform: context links ("pipe trick") with namespace and comma
10885 !! options
10886 pst title=[[Ns:Somearticle, Context, Whatever]]
10887 !! wikitext
10888 [[|Article]]
10889 !! html
10890 [[Ns:Article, Context, Whatever|Article]]
10891 !! end
10892
10893 !! test
10894 pre-save transform: context links ("pipe trick") with namespace, comma and parens
10895 !! options
10896 pst title=[[Ns:Somearticle, Context (context)]]
10897 !! wikitext
10898 [[|Article]]
10899 !! html
10900 [[Ns:Article (context)|Article]]
10901 !! end
10902
10903 !! test
10904 pre-save transform: context links ("pipe trick") with namespace, parens and comma
10905 !! options
10906 pst title=[[Ns:Somearticle (IGNORED), Context]]
10907 !! wikitext
10908 [[|Article]]
10909 !! html
10910 [[Ns:Article, Context|Article]]
10911 !! end
10912
10913 !! test
10914 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
10915 !! options
10916 pst
10917 !! wikitext
10918 [[Article(context)|]]
10919 [[Bar:Article(context)|]]
10920 [[:Bar:Article(context)|]]
10921 [[|Article(context)]]
10922 [[Bar:X(Y)Z|]]
10923 [[:Bar:X(Y)Z|]]
10924 !! html
10925 [[Article(context)|Article]]
10926 [[Bar:Article(context)|Article]]
10927 [[:Bar:Article(context)|Article]]
10928 [[Article(context)]]
10929 [[Bar:X(Y)Z|X(Y)Z]]
10930 [[:Bar:X(Y)Z|X(Y)Z]]
10931 !! end
10932
10933 !! test
10934 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
10935 !! options
10936 pst
10937 !! wikitext
10938 [[Article (context)|]]
10939 [[Bar:Article (context)|]]
10940 [[:Bar:Article (context)|]]
10941 [[|Article (context)]]
10942 [[Bar:X (Y) Z|]]
10943 [[:Bar:X (Y) Z|]]
10944 !! html
10945 [[Article (context)|Article]]
10946 [[Bar:Article (context)|Article]]
10947 [[:Bar:Article (context)|Article]]
10948 [[Article (context)]]
10949 [[Bar:X (Y) Z|X (Y) Z]]
10950 [[:Bar:X (Y) Z|X (Y) Z]]
10951 !! end
10952
10953 !! test
10954 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
10955 !! options
10956 pst
10957 !! wikitext
10958 [[Article(context)|]]
10959 [[Bar:Article(context)|]]
10960 [[:Bar:Article(context)|]]
10961 [[|Article(context)]]
10962 [[Bar:X(Y)Z|]]
10963 [[:Bar:X(Y)Z|]]
10964 !! html
10965 [[Article(context)|Article]]
10966 [[Bar:Article(context)|Article]]
10967 [[:Bar:Article(context)|Article]]
10968 [[Article(context)]]
10969 [[Bar:X(Y)Z|X(Y)Z]]
10970 [[:Bar:X(Y)Z|X(Y)Z]]
10971 !! end
10972
10973 !! test
10974 pre-save transform: context links ("pipe trick") with commas (bug 21660)
10975 !! options
10976 pst
10977 !! wikitext
10978 [[Article (context), context|]]
10979 [[Article (context),context|]]
10980 [[Bar:Article (context), context|]]
10981 [[Bar:Article (context),context|]]
10982 [[:Bar:Article (context), context|]]
10983 [[:Bar:Article (context),context|]]
10984 !! html
10985 [[Article (context), context|Article]]
10986 [[Article (context),context|Article]]
10987 [[Bar:Article (context), context|Article]]
10988 [[Bar:Article (context),context|Article]]
10989 [[:Bar:Article (context), context|Article]]
10990 [[:Bar:Article (context),context|Article]]
10991 !! end
10992
10993 !! test
10994 pre-save transform: trim trailing empty lines
10995 !! options
10996 pst
10997 !! wikitext
10998 Empty lines are trimmed
10999
11000
11001
11002
11003 !! html
11004 Empty lines are trimmed
11005 !! end
11006
11007 !! test
11008 pre-save transform: Signature expansion
11009 !! options
11010 pst
11011 !! wikitext
11012 * ~~~
11013 * <noinclude>~~~</noinclude>
11014 * <includeonly>~~~</includeonly>
11015 * <onlyinclude>~~~</onlyinclude>
11016 !! html
11017 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
11018 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
11019 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
11020 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
11021 !! end
11022
11023
11024 !! test
11025 pre-save transform: Signature expansion in nowiki tags (bug 93)
11026 !! options
11027 pst disabled
11028 !! wikitext
11029 Shall not expand:
11030
11031 <nowiki>~~~~</nowiki>
11032
11033 <includeonly><nowiki>~~~~</nowiki></includeonly>
11034
11035 <noinclude><nowiki>~~~~</nowiki></noinclude>
11036
11037 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11038
11039 {{subst:Foo}} shall be converted to FOO
11040
11041 As well as inside noinclude/onlyinclude
11042 <noinclude>{{subst:Foo}}</noinclude>
11043 <onlyinclude>{{subst:Foo}}</onlyinclude>
11044
11045 But not inside includeonly
11046 <includeonly>{{subst:Foo}}</includeonly>
11047 !! html
11048 Shall not expand:
11049
11050 <nowiki>~~~~</nowiki>
11051
11052 <includeonly><nowiki>~~~~</nowiki></includeonly>
11053
11054 <noinclude><nowiki>~~~~</nowiki></noinclude>
11055
11056 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11057
11058 FOO shall be converted to FOO
11059
11060 As well as inside noinclude/onlyinclude
11061 <noinclude>FOO</noinclude>
11062 <onlyinclude>FOO</onlyinclude>
11063
11064 But not inside includeonly
11065 <includeonly>{{subst:Foo}}</includeonly>
11066 !! end
11067
11068 !! test
11069 Parsoid: Recognize nowiki with trailing space in tags
11070 !! options
11071 parsoid=wt2html
11072 !! wikitext
11073 <nowiki ><div>[[foo]]</nowiki >
11074
11075 a<nowiki / >b
11076
11077 c<nowiki />d
11078
11079 e<nowiki/ >f
11080 !! html
11081 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11082 <p>ab</p>
11083 <p>cd</p>
11084 <p>ef</p>
11085 !! end
11086
11087 !! test
11088 Parsoid: Recognize nowiki with odd capitalization
11089 !! options
11090 parsoid=wt2html
11091 !! wikitext
11092 <noWikI ><div>[[foo]]</Nowiki >
11093 !! html
11094 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11095 !! end
11096
11097
11098 !! test
11099 Parsoid: Escape nowiki with trailing space in tags
11100 !! options
11101 parsoid=html2wt
11102 !! wikitext
11103 &lt;nowiki &gt; foo &lt;/nowiki &gt;
11104
11105 a&lt;nowiki /&gt;b
11106
11107 c&lt;nowiki/ &gt;d
11108 !! html
11109 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
11110 <p>a&lt;nowiki /&gt;b</p>
11111 <p>c&lt;nowiki/ &gt;d</p>
11112 !! end
11113
11114 !! test
11115 Parsoid: Escape weird noWikI capitalizations
11116 !! options
11117 parsoid=html2wt
11118 !! wikitext
11119 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
11120 !! html
11121 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
11122 !! end
11123
11124 ###
11125 ### Message transform tests
11126 ###
11127 !! test
11128 message transform: magic variables
11129 !! options
11130 msg
11131 !! wikitext
11132 {{SITENAME}}
11133 !! html
11134 MediaWiki
11135 !! end
11136
11137 !! test
11138 message transform: should not transform wiki markup
11139 !! options
11140 msg
11141 !! wikitext
11142 ''test''
11143 !! html
11144 ''test''
11145 !! end
11146
11147 !! test
11148 message transform: <noinclude> in transcluded template (bug 4926)
11149 !! options
11150 msg
11151 !! wikitext
11152 {{Includes}}
11153 !! html
11154 Foobar
11155 !! end
11156
11157 !! test
11158 message transform: <onlyinclude> in transcluded template (bug 4926)
11159 !! options
11160 msg
11161 !! wikitext
11162 {{Includes2}}
11163 !! html
11164 Foo
11165 !! end
11166
11167 !! test
11168 {{#special:}} page name, known
11169 !! options
11170 msg
11171 !! wikitext
11172 {{#special:Recentchanges}}
11173 !! html
11174 Special:RecentChanges
11175 !! end
11176
11177 !! test
11178 {{#special:}} page name with subpage, known
11179 !! options
11180 msg
11181 !! wikitext
11182 {{#special:Recentchanges/param}}
11183 !! html
11184 Special:RecentChanges/param
11185 !! end
11186
11187 !! test
11188 {{#special:}} page name, unknown
11189 !! options
11190 msg
11191 !! wikitext
11192 {{#special:foobar nonexistent}}
11193 !! html
11194 Special:Foobar nonexistent
11195 !! end
11196
11197 !! test
11198 {{#speciale:}} page name, known
11199 !! options
11200 msg
11201 !! wikitext
11202 {{#speciale:Recentchanges}}
11203 !! html
11204 Special:RecentChanges
11205 !! end
11206
11207 !! test
11208 {{#speciale:}} page name with subpage, known
11209 !! options
11210 msg
11211 !! wikitext
11212 {{#speciale:Recentchanges/param}}
11213 !! html
11214 Special:RecentChanges/param
11215 !! end
11216
11217 !! test
11218 {{#speciale:}} page name, unknown
11219 !! options
11220 msg
11221 !! wikitext
11222 {{#speciale:foobar nonexistent}}
11223 !! html
11224 Special:Foobar_nonexistent
11225 !! end
11226
11227 ###
11228 ### Images
11229 ###
11230 ### For Parsoid-specific tests, see
11231 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11232
11233 !! test
11234 Simple image
11235 !! options
11236 parsoid=wt2html,wt2wt,html2html
11237 !! wikitext
11238 [[Image:foobar.jpg]]
11239 !! html/php
11240 <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>
11241 </p>
11242 !! html/parsoid
11243 <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></p>
11244 !! end
11245
11246 !! test
11247 Simple image (using File: namespace, now canonical)
11248 !! wikitext
11249 [[File:Foobar.jpg]]
11250 !! html/php
11251 <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>
11252 </p>
11253 !! html/parsoid
11254 <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></p>
11255 !! end
11256
11257 !! test
11258 Right-aligned image
11259 !! wikitext
11260 [[File:Foobar.jpg|right]]
11261 !! html/php
11262 <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>
11263
11264 !! html/parsoid
11265 <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>
11266 !! end
11267
11268 !! test
11269 Image with caption
11270 !! wikitext
11271 [[File:Foobar.jpg|right|Caption text]]
11272 !! html/php
11273 <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>
11274
11275 !! html/parsoid
11276 <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>
11277 !! end
11278
11279 !! test
11280 Image with caption, bug 53312 #1
11281 !! wikitext
11282 [[File:Foobar.jpg|right|Caption page stuff]]
11283 !! html/php
11284 <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>
11285
11286 !! html/parsoid
11287 <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>
11288 !! end
11289
11290 !! test
11291 Image with caption, bug 53312 #2
11292 !! wikitext
11293 [[File:Foobar.jpg|right|Caption page=]]
11294 !! html/php
11295 <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>
11296
11297 !! html/parsoid
11298 <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>
11299 !! end
11300
11301 !! test
11302 Image with caption, bug 53312 #3
11303 !! wikitext
11304 [[File:Foobar.jpg|right|Caption page=stuff]]
11305 !! html/php
11306 <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>
11307
11308 !! html/parsoid
11309 <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>
11310 !! end
11311
11312 !! test
11313 Allow empty links in image captions (Bug 60753)
11314 !! options
11315 thumbsize=220
11316 !! wikitext
11317 [[File:Foobar.jpg|thumb|Caption [[Link1]]
11318 [[]]
11319 [[Link2]]
11320 ]]
11321 !! html/php
11322 <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>
11323
11324 !! html/parsoid
11325 <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"}]}'><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/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>Caption <a rel="mw:WikiLink" href="./Link1" title="Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"}}'>Link1</a>
11326 [[]]
11327 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
11328 </figcaption></figure>
11329 !! end
11330
11331 !! test
11332 Titles in unlinked images (T23454)
11333 !! wikitext
11334 [[File:Foobar.jpg|link=|stuff]]
11335 !! html/php
11336 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
11337 </p>
11338 !! end
11339
11340 !! test
11341 Link with empty target
11342 !! wikitext
11343 [[]]
11344 !! html
11345 <p>[[]]
11346 </p>
11347 !! end
11348
11349 !! test
11350 Image with empty attribute
11351 !! options
11352 parsoid=wt2html,wt2wt,html2html
11353 !! wikitext
11354 [[File:Foobar.jpg|right||Caption text]]
11355 !! html/php
11356 <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>
11357
11358 !! html/parsoid
11359 <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>
11360 !! end
11361
11362 !! test
11363 1. Block image with individual attributes from templates
11364 !! wikitext
11365 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
11366 !! html/php
11367 <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>
11368
11369 !! html/parsoid
11370 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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]}\" 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}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
11371 !! end
11372
11373 !! test
11374 2. Block Image with individual attributes from templates
11375 !! wikitext
11376 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
11377 !! html/php
11378 <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>
11379
11380 !! html/parsoid
11381 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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]}\" 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}}]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" 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]}\" 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}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
11382 !! end
11383
11384 !! test
11385 3. Inline image with individual attributes from templates
11386 !! wikitext
11387 [[File:Foobar.jpg|{{echo|50px}}]]
11388 !! html/php
11389 <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>
11390 </p>
11391 !! html/parsoid
11392 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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]}\" 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}}]}\">50px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50"/></a></span></p>
11393 !! end
11394
11395 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
11396 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
11397 !! test
11398 Image with multiple attributes from the same template
11399 !! wikitext
11400 [[File:Foobar.jpg|{{image_attribs}}]]
11401 !! html/php
11402 <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>
11403
11404 !! html/parsoid
11405 <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>
11406 !! end
11407
11408 !! test
11409 Image with link tails
11410 !! options
11411 thumbsize=220
11412 !! wikitext
11413 123[[File:Foobar.jpg]]456
11414 123[[File:Foobar.jpg|right]]456
11415 123[[File:Foobar.jpg|thumb]]456
11416 !! html/php
11417 <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
11418 </p>
11419 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
11420 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
11421
11422 !! html/php+tidy
11423 <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>
11424 <p>123</p>
11425 <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>
11426 <p>456 123</p>
11427 <div class="thumb tright">
11428 <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>
11429 <div class="thumbcaption">
11430 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11431 </div>
11432 </div>
11433 </div>
11434 <p>456</p>
11435 !! html/parsoid
11436 <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>
11437 <p>123</p><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><p>456</p>
11438 <p>123</p><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><p>456</p>
11439 !! end
11440
11441 !! test
11442 Image with multiple captions -- only last one is accepted
11443 !! wikitext
11444 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11445 !! html/php
11446 <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>
11447
11448 !! html/parsoid
11449 <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>
11450 !! end
11451
11452 !! test
11453 Image with multiple widths -- use last
11454 !! wikitext
11455 [[File:Foobar.jpg|200px|300px|caption]]
11456 !! html/php
11457 <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>
11458 </p>
11459 !! html/parsoid
11460 <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>
11461 !! end
11462
11463 !! test
11464 Image with multiple alignments -- use first (bug 48664)
11465 !! options
11466 thumbsize=220
11467 !! wikitext
11468 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11469
11470 [[File:Foobar.jpg|middle|text-top|caption]]
11471 !! html/php
11472 <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>
11473 <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>
11474 </p>
11475 !! html/parsoid
11476 <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>
11477 <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>
11478 !! end
11479
11480 !! test
11481 Image with width attribute at different positions
11482 !! wikitext
11483 [[File:Foobar.jpg|200px|right|Caption]]
11484 [[File:Foobar.jpg|right|200px|Caption]]
11485 [[File:Foobar.jpg|right|Caption|200px]]
11486 !! html/php
11487 <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>
11488 <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>
11489 <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>
11490
11491 !! html/parsoid
11492 <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>
11493 <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>
11494 <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>
11495 !! end
11496
11497 # a sad bit of backward-compatibility
11498 !! test
11499 Image with size specified with pxpx (bug 13500, 51628)
11500 !! options
11501 parsoid=wt2html,wt2wt,html2html
11502 !! wikitext
11503 [[File:Foobar.jpg|20pxpx]]
11504 [[File:Foobar.jpg|200x20pxpx]]
11505 !! html/php
11506 <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>
11507 <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>
11508 </p>
11509 !! html/parsoid
11510 <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>
11511 !! end
11512
11513 !! test
11514 Image with link parameter, wiki target
11515 !! wikitext
11516 [[File:Foobar.jpg|link=Main Page]]
11517 !! html/php
11518 <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>
11519 </p>
11520 !! html/parsoid
11521 <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>
11522 !! end
11523
11524 # parsoid bug 49293 (part 1)
11525 !! test
11526 Image with link parameter, URL target
11527 !! wikitext
11528 [[File:Foobar.jpg|link=http://example.com/]]
11529 !! html/php
11530 <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>
11531 </p>
11532 !! html/parsoid
11533 <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>
11534 !! end
11535
11536 # parsoid bug 49293 (part 2)
11537 !! test
11538 Image with link parameter, protocol-less URL target
11539 !! wikitext
11540 [[File:Foobar.jpg|link=//example.com/]]
11541 !! html/php
11542 <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>
11543 </p>
11544 !! html/parsoid
11545 <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>
11546 !! end
11547
11548 !! test
11549 Image with link parameter, wgExternalLinkTarget
11550 !! wikitext
11551 [[Image:foobar.jpg|link=http://example.com/]]
11552 !! config
11553 wgExternalLinkTarget='foobar'
11554 !! html
11555 <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>
11556 </p>
11557 !! end
11558
11559 !! test
11560 Image with link parameter, wgNoFollowLinks set to false
11561 !! wikitext
11562 [[Image:foobar.jpg|link=http://example.com/]]
11563 !! config
11564 wgNoFollowLinks=false
11565 !! html
11566 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11567 </p>
11568 !! end
11569
11570 !! test
11571 Image with link parameter, wgNoFollowDomainExceptions
11572 !! wikitext
11573 [[Image:foobar.jpg|link=http://example.com/]]
11574 !! config
11575 wgNoFollowDomainExceptions='example.com'
11576 !! html
11577 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11578 </p>
11579 !! end
11580
11581 !! test
11582 Image with link parameter, wgExternalLinkTarget, unnamed parameter
11583 !! wikitext
11584 [[Image:foobar.jpg|link=http://example.com/|Title]]
11585 !! config
11586 wgExternalLinkTarget='foobar'
11587 !! html
11588 <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>
11589 </p>
11590 !! end
11591
11592 !! test
11593 Image with empty link parameter
11594 !! wikitext
11595 [[File:Foobar.jpg|link=]]
11596 !! html/php
11597 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
11598 </p>
11599 !! html/parsoid
11600 <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>
11601 !! end
11602
11603 !! test
11604 Image with link parameter (wiki target) and unnamed parameter
11605 !! wikitext
11606 [[File:Foobar.jpg|link=Main_Page|Title]]
11607 !! html/php
11608 <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>
11609 </p>
11610 !! html/parsoid
11611 <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>
11612 !! end
11613
11614 !! test
11615 Image with link parameter (URL target) and unnamed parameter
11616 !! wikitext
11617 [[File:Foobar.jpg|link=http://example.com/|Title]]
11618 !! html/php
11619 <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>
11620 </p>
11621 !! html/parsoid
11622 <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>
11623 !! end
11624
11625 !! test
11626 Thumbnail image with link parameter
11627 !! options
11628 thumbsize=220
11629 parsoid=wt2html,wt2wt,html2html
11630 !! wikitext
11631 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
11632 !! html/php
11633 <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>
11634
11635 !! html/parsoid
11636 <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>
11637 !! end
11638
11639 !! test
11640 Manually-specified thumbnail image
11641 !! options
11642 thumbsize=220
11643 !! wikitext
11644 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
11645 !! html/php
11646 <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>
11647
11648 !! html/parsoid
11649 <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>
11650 !! end
11651
11652 !! test
11653 Manually-specified thumbnail image with explicit link to wiki page
11654 !! options
11655 thumbsize=220
11656 parsoid=wt2html,wt2wt,html2html
11657 !! wikitext
11658 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
11659 !! html/php
11660 <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>
11661
11662 !! html/parsoid
11663 <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>
11664 !! end
11665
11666 !! test
11667 Manually-specified thumbnail image with explicit link to url
11668 !! options
11669 thumbsize=220
11670 parsoid=wt2html,wt2wt,html2html
11671 !! wikitext
11672 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
11673 !! html/php
11674 <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>
11675
11676 !! html/parsoid
11677 <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>
11678 !! end
11679
11680 !! test
11681 Manually-specified thumbnail image with explicit no link
11682 !! options
11683 thumbsize=220
11684 parsoid=wt2html,wt2wt,html2html
11685 !! wikitext
11686 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
11687 !! html/php
11688 <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>
11689
11690 !! html/parsoid
11691 <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>
11692 !! end
11693
11694 !! test
11695 Manually-specified thumbnail image with explicit link and alt text
11696 !! options
11697 thumbsize=220
11698 parsoid=wt2html,wt2wt,html2html
11699 !! wikitext
11700 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
11701 !! html/php
11702 <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>
11703
11704 !! html/parsoid
11705 <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>
11706 !! end
11707
11708 !! test
11709 Image with frame and link
11710 !! options
11711 parsoid=wt2html,wt2wt,html2html
11712 !! wikitext
11713 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
11714 !! html/php
11715 <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>
11716
11717 !! html/parsoid
11718 <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" title="Main Page">Main Page</a></figcaption></figure>
11719 !! end
11720
11721 !! test
11722 Image with frame and link and explicit alt
11723 !! options
11724 parsoid=wt2html,wt2wt,html2html
11725 !! wikitext
11726 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
11727 !! html/php
11728 <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>
11729
11730 !! html/parsoid
11731 <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" title="Main Page">Main Page</a></figcaption></figure>
11732 !! end
11733
11734 !! test
11735 Image with wiki markup in implicit alt
11736 !! options
11737 parsoid=wt2html,wt2wt,html2html
11738 !! wikitext
11739 [[Image:Foobar.jpg|testing '''bold''' in alt]]
11740
11741 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
11742 !! html/php
11743 <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>
11744 </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>
11745 </p>
11746 !! html/parsoid
11747 <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>
11748 <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>
11749 !! end
11750
11751 ###################
11752 # Conflicting image format options.
11753 # First option specified should 'win'.
11754 # All three cases in each test should be identical.
11755
11756 !! test
11757 Image with 'frameless' first.
11758 !! options
11759 parsoid=wt2html,wt2wt,html2html
11760 !! wikitext
11761 [[File:Foobar.jpg|frameless|caption]]
11762
11763 [[File:Foobar.jpg|frameless|frame|caption]]
11764
11765 [[File:Foobar.jpg|frameless|thumb|caption]]
11766 !! html/php
11767 <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>
11768 </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>
11769 </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>
11770 </p>
11771 !! html/parsoid
11772 <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>
11773 <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>
11774 <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>
11775 !! end
11776
11777 !! test
11778 Image with 'frame' first.
11779 !! options
11780 parsoid=wt2html,wt2wt,html2html
11781 !! wikitext
11782 [[File:Foobar.jpg|frame|caption]]
11783 [[File:Foobar.jpg|frame|frameless|caption]]
11784 [[File:Foobar.jpg|frame|thumb|caption]]
11785 !! html/php
11786 <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>
11787 <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>
11788 <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>
11789
11790 !! html/parsoid
11791 <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>
11792 <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>
11793 <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>
11794 !! end
11795
11796 !! test
11797 Image with 'thumb' first.
11798 !! options
11799 parsoid=wt2html,wt2wt,html2html
11800 !! wikitext
11801 [[File:Foobar.jpg|thumb|caption]]
11802 [[File:Foobar.jpg|thumb|frameless|caption]]
11803 [[File:Foobar.jpg|thumb|frame|caption]]
11804 !! html/php
11805 <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>
11806 <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>
11807 <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>
11808
11809 !! html/parsoid
11810 <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>
11811 <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>
11812 <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>
11813 !! end
11814
11815 ###################
11816 # Image sizing.
11817 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
11818 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
11819 # Foobar has actual size of 1941x220
11820 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
11821 # a scalable format.
11822 # 2. Framed images always ignore size options; always render at default size.
11823 # 3. "Unspecified format" and border are the only types which can be
11824 # enlarged.
11825
11826 !! test
11827 Image: "unspecified format" and border enlarge
11828 !! options
11829 parsoid=wt2html,wt2wt,html2html
11830 !! wikitext
11831 [[File:Foobar.jpg|2000px]]
11832
11833 [[File:Foobar.jpg|border|2000px]]
11834 !! html/php
11835 <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>
11836 </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>
11837 </p>
11838 !! html/parsoid
11839 <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>
11840 <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>
11841 !! end
11842
11843 !! test
11844 Image: "unspecified format" and border reduce
11845 !! options
11846 parsoid=wt2html,wt2wt,html2html
11847 !! wikitext
11848 [[File:Foobar.jpg|1000px]]
11849
11850 [[File:Foobar.jpg|border|1000px]]
11851 !! html/php
11852 <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>
11853 </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>
11854 </p>
11855 !! html/parsoid
11856 <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>
11857 <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>
11858 !! end
11859
11860 !! test
11861 Image: thumbs reduce
11862 !! options
11863 parsoid=wt2html,wt2wt,html2html
11864 !! wikitext
11865 [[File:Foobar.jpg|thumb|50px]]
11866 !! html/php
11867 <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>
11868
11869 !! html/parsoid
11870 <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>
11871 !! end
11872
11873 !! test
11874 Image: bitmap thumbs can't be enlarged past original size, but vector can.
11875 !! options
11876 parsoid=wt2html,wt2wt,html2html
11877 !! wikitext
11878 [[File:Foobar.jpg|thumb|2000px]]
11879
11880 [[File:Foobar.svg|thumb|2000px]]
11881 !! html/php
11882 <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>
11883 <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>
11884
11885 !! html/parsoid
11886 <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>
11887 <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>
11888 !! end
11889
11890 !! test
11891 Image: frameless can reduce in size
11892 !! options
11893 parsoid=wt2html,wt2wt,html2html
11894 !! wikitext
11895 [[File:Foobar.jpg|frameless|50px]]
11896 !! html/php
11897 <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>
11898 </p>
11899 !! html/parsoid
11900 <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>
11901 !! end
11902
11903 !! test
11904 Image: bitmap frameless can't be enlarged past original size, but vector can
11905 !! options
11906 parsoid=wt2html,wt2wt,html2html
11907 !! wikitext
11908 [[File:Foobar.jpg|frameless|2000px]]
11909
11910 [[File:Foobar.svg|frameless|2000px]]
11911 !! html/php
11912 <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>
11913 </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>
11914 </p>
11915 !! html/parsoid
11916 <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>
11917 <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>
11918 !! end
11919
11920 !! test
11921 Image: framed images are always unscaled.
11922 !! options
11923 parsoid=wt2html,wt2wt,html2html
11924 !! wikitext
11925 [[File:Foobar.jpg|frame]]
11926
11927 [[File:Foobar.jpg|frame|50px]]
11928
11929 [[File:Foobar.jpg|frame|50x50px]]
11930
11931 [[File:Foobar.jpg|frame|2000px]]
11932 !! html/php
11933 <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>
11934 <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>
11935 <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>
11936 <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>
11937
11938 !! html/parsoid
11939 <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>
11940 <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>
11941 <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>
11942 <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>
11943 !! end
11944
11945 ###################
11946
11947 !! test
11948 Link to image page- image page normally doesn't exists, hence edit link
11949 Add test with existing image page
11950 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
11951 !! wikitext
11952 [[:Image:test]]
11953 !! html
11954 <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>
11955 </p>
11956 !! end
11957
11958 !! test
11959 bug 18784 Link to non-existent image page with caption should use caption as link text
11960 !! wikitext
11961 [[:Image:test|caption]]
11962 !! html
11963 <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>
11964 </p>
11965 !! end
11966
11967 !! test
11968 Frameless image caption with a free URL
11969 !! wikitext
11970 [[File:Foobar.jpg|http://example.com]]
11971 !! html/php
11972 <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>
11973 </p>
11974 !! html/parsoid
11975 <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>
11976 !! end
11977
11978 !! test
11979 Thumbnail image caption with a free URL
11980 !! options
11981 thumbsize=220
11982 !! wikitext
11983 [[File:Foobar.jpg|thumb|http://example.com]]
11984 !! html/php
11985 <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>
11986
11987 !! html/parsoid
11988 <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>
11989 !! end
11990
11991 !! test
11992 Thumbnail image caption with a free URL and explicit alt
11993 !! options
11994 thumbsize=220
11995 parsoid=wt2html,wt2wt,html2html
11996 !! wikitext
11997 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
11998 !! html/php
11999 <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>
12000
12001 !! html/parsoid
12002 <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>
12003 !! end
12004
12005 !! test
12006 SVG thumbnails with no language set
12007 !! options
12008 !! wikitext
12009 [[File:Foobar.svg|thumb|caption]]
12010 !! html/php
12011 <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>
12012
12013 !! html/parsoid
12014 <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>
12015 !! end
12016
12017 !! test
12018 SVG thumbnails with language de
12019 !! options
12020 parsoid=wt2html,wt2wt,html2html
12021 !! wikitext
12022 [[File:Foobar.svg|thumb|caption|lang=de]]
12023 !! html/php
12024 <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>
12025
12026 !! html/parsoid
12027 <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>
12028 !! end
12029
12030 !! test
12031 SVG thumbnails with invalid language code
12032 !! options
12033 parsoid=wt2html,wt2wt,html2html
12034 !! wikitext
12035 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
12036 !! html/php
12037 <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>
12038
12039 !! html/parsoid
12040 <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>
12041 !! end
12042
12043 !! test
12044 BUG 1887: A ISBN with a thumbnail
12045 !! wikitext
12046 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
12047 !! html/php
12048 <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>
12049
12050 !! html/parsoid
12051 <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>
12052 !! end
12053
12054 !! test
12055 BUG 1887: A RFC with a thumbnail
12056 !! wikitext
12057 [[File:Foobar.jpg|thumb|This is RFC 12354]]
12058 !! html/php
12059 <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>
12060
12061 !! html/parsoid
12062 <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>
12063 !! end
12064
12065 !! test
12066 BUG 1887: A mailto link with a thumbnail
12067 !! wikitext
12068 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
12069 !! html/php
12070 <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>
12071
12072 !! html/parsoid
12073 <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>
12074 !! end
12075
12076 # Pending resolution to bug 368
12077 !! test
12078 BUG 648: Frameless image caption with a link
12079 !! wikitext
12080 [[File:Foobar.jpg|text with a [[link]] in it]]
12081 !! html/php
12082 <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>
12083 </p>
12084 !! html/parsoid
12085 <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>
12086 !! end
12087
12088 !! test
12089 BUG 648: Frameless image caption with a link (suffix)
12090 !! wikitext
12091 [[File:Foobar.jpg|text with a [[link]]foo in it]]
12092 !! html/php
12093 <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>
12094 </p>
12095 !! html/parsoid
12096 <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>
12097 !! end
12098
12099 !! test
12100 BUG 648: Frameless image caption with an interwiki link
12101 !! wikitext
12102 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
12103 !! html/php
12104 <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>
12105 </p>
12106 !! html/parsoid
12107 <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>
12108 !! end
12109
12110 !! test
12111 BUG 648: Frameless image caption with a piped interwiki link
12112 !! wikitext
12113 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
12114 !! html/php
12115 <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>
12116 </p>
12117 !! html/parsoid
12118 <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>
12119 !! end
12120
12121 !! test
12122 Escape HTML special chars in image alt text
12123 !! wikitext
12124 [[File:Foobar.jpg|& < > "]]
12125 !! html/php
12126 <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>
12127 </p>
12128 !! html/parsoid
12129 <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>
12130 !! end
12131
12132 !! test
12133 BUG 499: Alt text should have &#1234;, not &amp;1234;
12134 !! wikitext
12135 [[File:Foobar.jpg|&#9792;]]
12136 !! html/php
12137 <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>
12138 </p>
12139 !! html/parsoid
12140 <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>
12141 !! end
12142
12143 !! test
12144 Broken image caption with link
12145 !! options
12146 parsoid=wt2html,wt2wt,html2html
12147 !! wikitext
12148 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
12149 !! html/php
12150 <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.
12151 </p>
12152 !! html/parsoid
12153 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a rel="mw:WikiLink" href="Main_Page" title="Main Page">this</a> is just an ordinary link.</p>
12154 !! end
12155
12156 !! test
12157 Image caption containing another image
12158 !! wikitext
12159 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
12160 !! html/php
12161 <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>
12162
12163 !! html/parsoid
12164 <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>
12165 !! end
12166
12167 !! test
12168 Image: caption containing a newline
12169 !! wikitext
12170 [[File:Foobar.jpg|This
12171 *is some text]]
12172 !! html/php
12173 <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>
12174 </p>
12175 !! html/parsoid
12176 <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>
12177 !!end
12178
12179 !!test
12180 Image: caption containing leading space
12181 (The leading space should not trigger nowiki escaping in wt2wt mode)
12182 !! wikitext
12183 [[File:Foobar.jpg|thumb| bar]]
12184 !! html/php
12185 <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>
12186
12187 !! html/parsoid
12188 <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>
12189 !!end
12190
12191 !! test
12192 Image: caption containing a table
12193 !! options
12194 parsoid=wt2html,wt2wt,html2html
12195 !! wikitext
12196 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
12197 {|
12198 ! Foo !! Bar
12199 |-
12200 | Foo1 || Bar1
12201 |}
12202 and some more text.]]
12203 !! html/php
12204 <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>
12205
12206 !! html/parsoid
12207 <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
12208 <table>
12209 <tbody>
12210 <tr><th>Foo </th><th>Bar</th></tr>
12211 <tr>
12212 <td>Foo1 </td>
12213 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
12214 !! end
12215
12216 !! test
12217 Bug 3090: External links other than http: in image captions
12218 !! wikitext
12219 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
12220 !! html/php
12221 <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>
12222
12223 !! html/parsoid
12224 <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>
12225 !! end
12226
12227 !! test
12228 Custom class
12229 !! options
12230 parsoid=wt2html,wt2wt,html2html
12231 !! wikitext
12232 [[Image:foobar.jpg|a|class=b]]
12233 !! html/php
12234 <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>
12235 </p>
12236 !! html/parsoid
12237 <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>
12238 !! end
12239
12240 !! test
12241 Localized image handling (1).
12242 !! options
12243 parsoid=wt2html,wt2wt,html2html
12244 language=es
12245 !! wikitext
12246 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
12247 !! html/php
12248 <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>
12249
12250 !! html/parsoid
12251 <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>
12252 !! end
12253
12254 !! test
12255 Localized image handling (2).
12256 !! options
12257 thumbsize=220
12258 parsoid=wt2html,wt2wt,html2html
12259 language=es
12260 !! wikitext
12261 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
12262 !! html/php
12263 <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>
12264
12265 !! html/parsoid
12266 <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>
12267 !! end
12268
12269 !! test
12270 "border", "frameless" and "class" attributes on an image.
12271 !! options
12272 thumbsize=220
12273 parsoid=wt2html,wt2wt,html2html
12274 !! wikitext
12275 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
12276 !! html/php
12277 <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>
12278 </p>
12279 !! html/parsoid
12280 <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>
12281 !! end
12282
12283 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
12284 !! test
12285 Invalid image attributes (bug 62500)
12286 !! options
12287 thumbsize=220
12288 parsoid=wt2html,wt2wt,html2html
12289 !! wikitext
12290 [[File:Foobar.jpg|thumb|float|left|caption]]
12291
12292 [[File:Foobar.jpg|thumb|righ|caption]]
12293
12294 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
12295 !! html/php
12296 <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>
12297 <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>
12298 <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>
12299
12300 !! html/parsoid
12301 <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>
12302 <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>
12303 <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>
12304 !! end
12305
12306 !! article
12307 File:Barfoo.jpg
12308 !! text
12309 #REDIRECT [[File:Barfoo.jpg]]
12310 !! endarticle
12311
12312 # FIXME: Parsoid should run this test -- but we'd need to teach the
12313 # mockAPI about the redirected Barfoo.jpg image.
12314 !! test
12315 Redirected image
12316 !! wikitext
12317 [[Image:Barfoo.jpg]]
12318 !! html/php
12319 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
12320 </p>
12321 !! end
12322
12323 !! test
12324 Missing image with uploads disabled
12325 !! options
12326 wgEnableUploads=0
12327 !! wikitext
12328 [[File:Foobaz.jpg]]
12329 !! html/php
12330 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
12331 </p>
12332 !! html/parsoid
12333 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="File:Foobaz.jpg"><img resource="./File:Foobaz.jpg" src="./Special:FilePath/Foobaz.jpg" height="220" width="220"/></a></span></p>
12334 !! end
12335
12336 # Parsoid-specific testing for images
12337 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12338 # Currently imperfect due to a flaw in the Parsoid testrunner
12339 # Work in progress
12340 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
12341 # image tests.
12342
12343 !! test
12344 Parsoid-specific image handling - simple image with size and middle alignment
12345 !! wikitext
12346 [[File:Foobar.jpg|middle|50px]]
12347 !! html/parsoid
12348 <p><span class="mw-valign-middle" typeof="mw:Image"><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"></a></span></p>
12349 !! end
12350
12351 !! test
12352 Parsoid-specific image handling - simple image with size, middle alignment,
12353 non-standard namespace alias
12354 !! options
12355 parsoid=wt2wt,wt2html,html2html
12356 !! wikitext
12357 [[Image:Foobar.jpg|middle|50px]]
12358 !! html/parsoid
12359 <p><span class="mw-valign-middle" typeof="mw:Image"><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"></a></span></p>
12360 !! end
12361
12362 !! test
12363 Parsoid-specific image handling - simple image with size and middle alignment
12364 (existing content)
12365 !! wikitext
12366 [[File:Foobar.jpg|50px|middle]]
12367 !! html/parsoid
12368 <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>
12369 !! end
12370
12371 !! test
12372 Parsoid-specific image handling - simple image with size and middle alignment
12373 and non-standard namespace name
12374 !! options
12375 parsoid=wt2html,wt2wt,html2html
12376 !! wikitext
12377 [[Image:Foobar.jpg|50px|middle]]
12378 !! html/parsoid
12379 <p><span class="mw-valign-middle" typeof="mw:Image"><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"></a></span></p>
12380 !! end
12381
12382 !! test
12383 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
12384 !! wikitext
12385 [[File:Foobar.jpg|500x10px|baseline|caption]]
12386 !! html/parsoid
12387 <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>
12388 !! end
12389
12390 !! test
12391 Parsoid-specific image handling - simple image with border and size spec
12392 !! wikitext
12393 [[File:Foobar.jpg|50px|border|caption]]
12394 !! html/parsoid
12395 <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>
12396 !! end
12397
12398 !! test
12399 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12400 !! wikitext
12401 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
12402 !! html/parsoid
12403 <figure class="mw-default-size mw-halign-left mw-valign-baseline" 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><figcaption>caption content</figcaption></figure>
12404 !! end
12405
12406 !! test
12407 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12408 (existing content)
12409 !! wikitext
12410 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12411 !! html/parsoid
12412 <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>
12413 !! end
12414
12415 !! test
12416 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12417 !! wikitext
12418 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12419 !! html/parsoid
12420 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb"><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" /></a><figcaption>caption</figcaption></figure>
12421 !! end
12422
12423 !! test
12424 Parsoid-specific image handling - thumbnail with specific size, halign,
12425 valign, and caption (existing content)
12426 !! wikitext
12427 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12428 !! html/parsoid
12429 <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>
12430 !! end
12431
12432 !! test
12433 Parsoid-specific image handling - framed image with specific size and caption
12434 (size is ignored)
12435 !! options
12436 parsoid=wt2html,wt2wt,html2html
12437 !! wikitext
12438 [[File:Foobar.jpg|frame|500x50px|caption]]
12439 !! html/parsoid
12440 <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><figcaption>caption</figcaption></figure>
12441 !! end
12442
12443 !! test
12444 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12445 (size is ignored)
12446 !! options
12447 parsoid=wt2html,wt2wt,html2html
12448 !! wikitext
12449 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12450 !! html/parsoid
12451 <figure class="mw-halign-left mw-valign-baseline" 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>
12452 !! end
12453
12454 !! test
12455 Parsoid-specific image handling - frameless image with specific size, border, and caption
12456 !! wikitext
12457 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12458 !! html/parsoid
12459 <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>
12460 !! end
12461
12462 !! test
12463 Parsoid-specific image handling - simple image with a formatted caption
12464 !! wikitext
12465 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12466 !! html/parsoid
12467 <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>"}'><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>
12468 !! end
12469
12470 !! test
12471 Parsoid-specific image handling - caption with a template in it
12472 !! wikitext
12473 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12474 !! html/parsoid
12475 <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>
12476 !! end
12477
12478 !! test
12479 Parsoid-specific image handling - caption with unbalanced tags in it
12480 !! options
12481 parsoid=wt2html,wt2wt,html2html
12482 !! wikitext
12483 foo
12484 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12485 bar
12486 !! html/parsoid
12487 <p>foo</p>
12488 <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>
12489 <p>bar</p>
12490 !! end
12491
12492 !! test
12493 Parsoid-specific image handling - empty caption (1)
12494 !! options
12495 parsoid=wt2html,wt2wt
12496 !! wikitext
12497 [[File:Foobar.jpg|thumb|]]
12498 !! html/parsoid
12499 <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>
12500 !! end
12501
12502 # empty captions don't get serialized unless we're in the "round trip" case
12503 !! test
12504 Parsoid-specific image handling - empty caption (2)
12505 !! options
12506 parsoid=html2wt
12507 !! html/parsoid
12508 <figure class="mw-default-size" typeof="mw:Image/Thumb">
12509 <a href="File:Foobar.jpg">
12510 <img resource="./File:Foobar.jpg"
12511 src="//example.com/images/3/3a/Foobar.jpg"
12512 height="25" width="220"/>
12513 </a>
12514 <figcaption></figcaption>
12515 </figure>
12516 !! wikitext
12517 [[File:Foobar.jpg|thumb]]
12518 !! end
12519
12520 !! test
12521 Parsoid-specific image handling - whitespace caption
12522 !! wikitext
12523 [[File:Foobar.jpg|thumb| ]]
12524 !! html/parsoid
12525 <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>
12526 !! end
12527
12528 !! test
12529 Parsoid-specific image handling - lang option
12530 !! wikitext
12531 foo
12532 [[File:Foobar.svg|lang=de|caption]]
12533 bar
12534 !! html/parsoid
12535 <p>foo
12536 <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>
12537 bar</p>
12538 !! end
12539
12540
12541 ###
12542 ### Subpages
12543 ###
12544 !! article
12545 Subpage test/subpage
12546 !! text
12547 foo
12548 !! endarticle
12549
12550 !! test
12551 Subpage link
12552 !! options
12553 subpage title=[[Subpage test]]
12554 !! wikitext
12555 [[/subpage]]
12556 !! html
12557 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
12558 </p>
12559 !! end
12560
12561 !! test
12562 Subpage noslash link
12563 !! options
12564 subpage title=[[Subpage test]]
12565 !! wikitext
12566 [[/subpage/]]
12567 !! html
12568 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
12569 </p>
12570 !! end
12571
12572 !! article
12573 Subpage test/1/2/subpage
12574 !! text
12575 blah
12576 !! endarticle
12577
12578 !! test
12579 Relative subpage noslash link
12580 !! options
12581 parsoid=wt2wt,wt2html,html2html
12582 subpage title=[[Subpage test/1/2/3/4]]
12583 !! wikitext
12584 [[../../subpage/]]
12585
12586 [[../../subpage]]
12587 !! html/php
12588 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
12589 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
12590 </p>
12591 !! html/parsoid
12592 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
12593 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
12594 !! end
12595
12596 !! test
12597 Parsoid: dot-slash prefixed wikilinks
12598 !! wikitext
12599 [[./foo]]
12600
12601 [[././bar]]
12602
12603 [[././baz/]]
12604 !! html/php
12605 <p>[[./foo]]
12606 </p><p>[[././bar]]
12607 </p><p>[[././baz/]]
12608 </p>
12609 !! html/parsoid
12610 <p>[[./foo]]
12611 </p><p>[[././bar]]
12612 </p><p>[[././baz/]]
12613 </p>
12614 !! end
12615
12616 !! test
12617 Render invalid page names as plain text (bug 51090)
12618 !! wikitext
12619 [[./../foo|bar]]
12620 [[foo�|bar]]
12621 [[foo/.|bar]]
12622 [[foo/..|bar]]
12623 [[foo~~~bar]]
12624 [[foo>bar]]
12625 [[foo[bar]]
12626 [[.]]
12627 [[..]]
12628 [[foo././bar]]
12629
12630 [[{{echo|./../foo}}|bar]]
12631 [[{{echo|foo/.}}|bar]]
12632 [[{{echo|foo/..}}|bar]]
12633 [[{{echo|foo~~~~bar}}]]
12634 [[{{echo|foo>bar}}]]
12635 [[{{echo|foo././bar}}]]
12636 [[{{echo|foo{bar}}]]
12637 [[{{echo|foo}bar}}]]
12638 [[{{echo|foo[bar}}]]
12639 [[{{echo|foo]bar}}]]
12640 [[{{echo|foo<bar}}]]
12641 !!html/php
12642 <p>[[./../foo|bar]]
12643 [[foo�|bar]]
12644 [[foo/.|bar]]
12645 [[foo/..|bar]]
12646 [[foo~~~bar]]
12647 [[foo&gt;bar]]
12648 [[foo[bar]]
12649 [[.]]
12650 [[..]]
12651 [[foo././bar]]
12652 </p><p>[[./../foo|bar]]
12653 [[foo/.|bar]]
12654 [[foo/..|bar]]
12655 [[foo~~~~bar]]
12656 [[foo&gt;bar]]
12657 [[foo././bar]]
12658 [[foo{bar]]
12659 [[foo}bar]]
12660 [[foo[bar]]
12661 [[foo]bar]]
12662 [[foo&lt;bar]]
12663 </p>
12664 !!html/parsoid
12665 <p>[[./../foo|bar]]
12666 [[foo�|bar]]
12667 [[foo/.|bar]]
12668 [[foo/..|bar]]
12669 [[foo~~~bar]]
12670 [[foo>bar]]
12671 [[foo[bar]]
12672 [[.]]
12673 [[..]]
12674 [[foo././bar]]</p>
12675
12676 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
12677 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
12678 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
12679 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
12680 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
12681 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
12682 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
12683 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
12684 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
12685 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
12686 [[<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>
12687 !!end
12688
12689 !! test
12690 Disabled subpages
12691 !! wikitext
12692 [[/subpage]]
12693 !! html
12694 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
12695 </p>
12696 !! end
12697
12698 !! test
12699 BUG 561: {{/Subpage}}
12700 !! options
12701 subpage title=[[Page]]
12702 !! wikitext
12703 {{/Subpage}}
12704 !! html
12705 <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>
12706 </p>
12707 !! end
12708
12709 ###
12710 ### Categories
12711 ###
12712 !! article
12713 Category:MediaWiki User's Guide
12714 !! text
12715 blah
12716 !! endarticle
12717
12718 !! test
12719 Link to category
12720 !! wikitext
12721 [[:Category:MediaWiki User's Guide]]
12722 !! html
12723 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
12724 </p>
12725 !! end
12726
12727 !! test
12728 Simple category
12729 !! options
12730 cat
12731 !! wikitext
12732 [[Category:MediaWiki User's Guide]]
12733 !! html
12734 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12735 !! end
12736
12737 !! test
12738 PAGESINCATEGORY invalid title fatal (r33546 fix)
12739 !! wikitext
12740 {{PAGESINCATEGORY:<bogus>}}
12741 !! html
12742 <p>0
12743 </p>
12744 !! end
12745
12746 !! test
12747 Category with different sort key
12748 !! options
12749 cat
12750 !! wikitext
12751 [[Category:MediaWiki User's Guide|Foo]]
12752 !! html
12753 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12754 !! end
12755
12756 !! test
12757 Category with identical sort key
12758 !! options
12759 cat
12760 !! wikitext
12761 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12762 !! html
12763 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12764 !! end
12765
12766 !! test
12767 Category with empty sort key
12768 !! options
12769 cat
12770 pst
12771 !! wikitext
12772 [[Category:MediaWiki User's Guide|]]
12773 !! html
12774 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12775 !! end
12776
12777 !! test
12778 Category with empty sort key and parentheses
12779 !! options
12780 cat
12781 pst
12782 !! wikitext
12783 [[Category:Foo (bar)|]]
12784 !! html
12785 [[Category:Foo (bar)|Foo]]
12786 !! end
12787
12788 !! test
12789 Category with link tail
12790 !! options
12791 cat
12792 pst
12793 !! wikitext
12794 123[[Category:Foo]]456
12795 !! html
12796 123[[Category:Foo]]456
12797 !! end
12798
12799 !! test
12800 Category with template
12801 !! options
12802 cat
12803 pst
12804 !! wikitext
12805 [[Category:{{echo|Foo}}]]
12806 !! html
12807 [[Category:{{echo|Foo}}]]
12808 !! end
12809
12810 !! test
12811 Category with template in sort key
12812 !! options
12813 cat
12814 pst
12815 !! wikitext
12816 [[Category:Foo|{{echo|Bar}}]]
12817 !! html
12818 [[Category:Foo|{{echo|Bar}}]]
12819 !! end
12820
12821 !! test
12822 Category with template in sort key and title
12823 !! options
12824 cat
12825 pst
12826 !! wikitext
12827 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12828 !! html
12829 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12830 !! end
12831
12832 !! test
12833 Category / paragraph interactions
12834 !! wikitext
12835 Foo [[Category:Baz]] Bar
12836
12837 Foo [[Category:Baz]]
12838 Bar
12839
12840 Foo
12841 [[Category:Baz]]
12842 Bar
12843
12844 Foo
12845 [[Category:Baz]] Bar
12846
12847 Foo
12848 [[Category:Baz]]
12849 [[Category:Baz]]
12850 [[Category:Baz]]
12851 Bar
12852
12853 [[Category:Baz]]
12854 [[Category:Baz]]
12855 [[Category:Baz]]
12856
12857 [[Category:Baz]]
12858 {{echo|[[Category:Baz]]}}
12859 [[Category:Baz]]
12860 !! html
12861 <p>Foo Bar
12862 </p><p>Foo
12863 Bar
12864 </p><p>Foo
12865 Bar
12866 </p><p>Foo Bar
12867 </p><p>Foo
12868 Bar
12869 </p>
12870 !! end
12871
12872 !! test
12873 Parsoid: Serialize link to category page with colon escape
12874 !! options
12875 parsoid
12876 !! wikitext
12877
12878 [[:Category:Foo]]
12879 [[:Category:Foo|Bar]]
12880 !! html
12881 <p>
12882 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
12883 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
12884 </p>
12885 !! end
12886
12887 !! test
12888 Parsoid: Link prefix/suffixes aren't applied to category links
12889 !! options
12890 parsoid=wt2html,wt2wt,html2html
12891 language=is
12892 !! wikitext
12893 x[[Category:Foo]]y
12894 !! html
12895 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
12896 !! end
12897
12898 !! test
12899 Parsoid: Serialize link to file page with colon escape
12900 !! options
12901 parsoid
12902 !! wikitext
12903
12904 [[:File:Foo.png]]
12905 [[:File:Foo.png|Bar]]
12906 !! html
12907 <p>
12908 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
12909 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
12910 </p>
12911 !! end
12912
12913 !! test
12914 Parsoid: Serialize a genuine category link without colon escape
12915 !! options
12916 parsoid
12917 !! wikitext
12918 [[Category:Foo]]
12919 [[Category:Foo|Bar]]
12920 !! html
12921 <link rel="mw:PageProp/Category" href="Category:Foo">
12922 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
12923 !! end
12924
12925 !! test
12926 Normalize hrefs properly before testing for invalid link targets (bug 70894)
12927 !! options
12928 parsoid=html2wt
12929 !! html
12930 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
12931 !! wikitext
12932 [[Category:Toxine bactérienne]]
12933 !! end
12934
12935 !! test
12936 Parsoid: Defaultsort
12937 !! options
12938 parsoid
12939 !! wikitext
12940 {{DEFAULTSORT:Foo}}
12941 !! html
12942 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
12943 !! end
12944
12945 ###
12946 ### Inter-language links
12947 ###
12948 !! test
12949 Interlanguage links
12950 !! options
12951 ill
12952 !! wikitext
12953 [[es:Alimento]]
12954 [[fr:Nourriture]]
12955 [[zh:食品]]
12956 !! html/php
12957 es:Alimento fr:Nourriture zh:食品
12958 !! html/parsoid
12959 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
12960 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
12961 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
12962 !! end
12963
12964 !! test
12965 Duplicate interlanguage links (bug 24502)
12966 !! options
12967 ill
12968 !! wikitext
12969 [[es:1]]
12970 [[es:2]]
12971 [[fr:1]]
12972 [[fr:2]]
12973 !! html/php
12974 es:1 fr:1
12975 !! html/parsoid
12976 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
12977 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
12978 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
12979 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
12980 !! end
12981
12982 ###
12983 ### Sections
12984 ###
12985 !! test
12986 Basic section headings
12987 !! wikitext
12988 == Headline 1 ==
12989 Some text
12990
12991 ==Headline 2==
12992 More
12993 ===Smaller headline===
12994 Blah blah
12995 !! html
12996 <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>
12997 <p>Some text
12998 </p>
12999 <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>
13000 <p>More
13001 </p>
13002 <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>
13003 <p>Blah blah
13004 </p>
13005 !! end
13006
13007 !! test
13008 Section headings with TOC
13009 !! wikitext
13010 == Headline 1 ==
13011 === Subheadline 1 ===
13012 ===== Skipping a level =====
13013 ====== Skipping a level ======
13014
13015 == Headline 2 ==
13016 Some text
13017 ===Another headline===
13018 !! html
13019 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13020 <ul>
13021 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
13022 <ul>
13023 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
13024 <ul>
13025 <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>
13026 <ul>
13027 <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>
13028 </ul>
13029 </li>
13030 </ul>
13031 </li>
13032 </ul>
13033 </li>
13034 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
13035 <ul>
13036 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
13037 </ul>
13038 </li>
13039 </ul>
13040 </div>
13041
13042 <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>
13043 <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>
13044 <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>
13045 <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>
13046 <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>
13047 <p>Some text
13048 </p>
13049 <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>
13050
13051 !! end
13052
13053 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
13054 !! test
13055 Handling of sections up to level 6 and beyond
13056 !! wikitext
13057 = Level 1 Heading=
13058 == Level 2 Heading==
13059 === Level 3 Heading===
13060 ==== Level 4 Heading====
13061 ===== Level 5 Heading=====
13062 ====== Level 6 Heading======
13063 ======= Level 7 Heading=======
13064 ======== Level 8 Heading========
13065 ========= Level 9 Heading=========
13066 ========== Level 10 Heading==========
13067 !! html
13068 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13069 <ul>
13070 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
13071 <ul>
13072 <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>
13073 <ul>
13074 <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>
13075 <ul>
13076 <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>
13077 <ul>
13078 <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>
13079 <ul>
13080 <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>
13081 <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>
13082 <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>
13083 <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>
13084 <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>
13085 </ul>
13086 </li>
13087 </ul>
13088 </li>
13089 </ul>
13090 </li>
13091 </ul>
13092 </li>
13093 </ul>
13094 </li>
13095 </ul>
13096 </div>
13097
13098 <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>
13099 <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>
13100 <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>
13101 <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>
13102 <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>
13103 <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>
13104 <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>
13105 <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>
13106 <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>
13107 <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>
13108
13109 !! end
13110
13111 !! test
13112 TOC regression (bug 9764)
13113 !! wikitext
13114 == title 1 ==
13115 === title 1.1 ===
13116 ==== title 1.1.1 ====
13117 === title 1.2 ===
13118 == title 2 ==
13119 === title 2.1 ===
13120 !! html
13121 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13122 <ul>
13123 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13124 <ul>
13125 <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>
13126 <ul>
13127 <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>
13128 </ul>
13129 </li>
13130 <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>
13131 </ul>
13132 </li>
13133 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13134 <ul>
13135 <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>
13136 </ul>
13137 </li>
13138 </ul>
13139 </div>
13140
13141 <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>
13142 <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>
13143 <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>
13144 <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>
13145 <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>
13146 <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>
13147
13148 !! end
13149
13150 !! test
13151 TOC with wgMaxTocLevel=3 (bug 6204)
13152 !! options
13153 wgMaxTocLevel=3
13154 !! wikitext
13155 == title 1 ==
13156 === title 1.1 ===
13157 ==== title 1.1.1 ====
13158 === title 1.2 ===
13159 == title 2 ==
13160 === title 2.1 ===
13161 !! html
13162 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13163 <ul>
13164 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13165 <ul>
13166 <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>
13167 <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>
13168 </ul>
13169 </li>
13170 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13171 <ul>
13172 <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>
13173 </ul>
13174 </li>
13175 </ul>
13176 </div>
13177
13178 <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>
13179 <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>
13180 <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>
13181 <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>
13182 <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>
13183 <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>
13184
13185 !! end
13186
13187 !! test
13188 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
13189 !! options
13190 wgMaxTocLevel=3
13191 !! wikitext
13192 ==Section 1==
13193 ===Section 1.1===
13194 ====Section 1.1.1====
13195 ====Section 1.1.1.1====
13196 ==Section 2==
13197 !! html
13198 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13199 <ul>
13200 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
13201 <ul>
13202 <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>
13203 </ul>
13204 </li>
13205 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
13206 </ul>
13207 </div>
13208
13209 <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>
13210 <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>
13211 <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>
13212 <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>
13213 <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>
13214
13215 !! end
13216
13217
13218 !! test
13219 Resolving duplicate section names
13220 !! wikitext
13221 == Foo bar ==
13222 == Foo bar ==
13223 !! html
13224 <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>
13225 <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>
13226
13227 !! end
13228
13229 !! test
13230 Resolving duplicate section names with differing case (bug 10721)
13231 !! wikitext
13232 == Foo bar ==
13233 == Foo Bar ==
13234 !! html
13235 <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>
13236 <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>
13237
13238 !! end
13239
13240 !! article
13241 Template:sections
13242 !! text
13243 ===Section 1===
13244 ==Section 2==
13245 !! endarticle
13246
13247 !! test
13248 Template with sections, __NOTOC__
13249 !! wikitext
13250 __NOTOC__
13251 ==Section 0==
13252 {{sections}}
13253 ==Section 4==
13254 !! html
13255 <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>
13256 <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>
13257 <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>
13258 <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>
13259
13260 !! end
13261
13262 !! test
13263 __NOEDITSECTION__ keyword
13264 !! wikitext
13265 __NOEDITSECTION__
13266 ==Section 1==
13267 ==Section 2==
13268 !! html
13269 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
13270 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
13271
13272 !! end
13273
13274 !! test
13275 Link inside a section heading
13276 !! wikitext
13277 ==Section with a [[Main Page|link]] in it==
13278 !! html
13279 <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>
13280
13281 !! end
13282
13283 !! test
13284 TOC regression (bug 12077)
13285 !! wikitext
13286 __TOC__
13287 == title 1 ==
13288 === title 1.1 ===
13289 == title 2 ==
13290 !! html
13291 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13292 <ul>
13293 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13294 <ul>
13295 <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>
13296 </ul>
13297 </li>
13298 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13299 </ul>
13300 </div>
13301
13302 <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>
13303 <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>
13304 <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>
13305
13306 !! end
13307
13308 !! test
13309 BUG 1219 URL next to image (good)
13310 !! wikitext
13311 http://example.com [[Image:foobar.jpg]]
13312 !! html
13313 <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>
13314 </p>
13315 !!end
13316
13317 !! test
13318 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13319 !! wikitext
13320 ===
13321 The line above must have a trailing space!
13322 === <!--
13323 --> <!-- -->
13324 But just in case it doesn't...
13325 !! html
13326 <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>
13327 <p>The line above must have a trailing space!
13328 </p>
13329 <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>
13330 <p>But just in case it doesn't...
13331 </p>
13332 !! end
13333
13334 !! test
13335 Header with special characters (bug 25462)
13336 !! wikitext
13337 The tooltips shall not show entities to the user (ie. be double escaped)
13338
13339 == text > text ==
13340 section 1
13341
13342 == text < text ==
13343 section 2
13344
13345 == text & text ==
13346 section 3
13347
13348 == text ' text ==
13349 section 4
13350
13351 == text " text ==
13352 section 5
13353 !! html
13354 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13355 </p>
13356 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13357 <ul>
13358 <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>
13359 <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>
13360 <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>
13361 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13362 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13363 </ul>
13364 </div>
13365
13366 <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>
13367 <p>section 1
13368 </p>
13369 <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>
13370 <p>section 2
13371 </p>
13372 <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>
13373 <p>section 3
13374 </p>
13375 <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>
13376 <p>section 4
13377 </p>
13378 <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>
13379 <p>section 5
13380 </p>
13381 !! end
13382
13383 !! test
13384 Header with space, plus and underscore as entity
13385 !! wikitext
13386 Id should not contain + for spaces
13387
13388 == Space between Text ==
13389 section 1
13390
13391 == Space-Entity&#32;between&#32;Text ==
13392 section 2
13393
13394 == Plus+between+Text ==
13395 section 3
13396
13397 == Plus-Entity&#43;between&#43;Text ==
13398 section 4
13399
13400 == Underscore_between_Text ==
13401 section 5
13402
13403 == Underscore-Entity&#95;between&#95;Text ==
13404 section 6
13405
13406 [[#Space between Text]]
13407 [[#Space-Entity&#32;between&#32;Text]]
13408 [[#Plus+between+Text]]
13409 [[#Plus-Entity&#43;between&#43;Text]]
13410 [[#Underscore_between_Text]]
13411 [[#Underscore-Entity&#95;between&#95;Text]]
13412 !! html
13413 <p>Id should not contain + for spaces
13414 </p>
13415 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13416 <ul>
13417 <li class="toclevel-1 tocsection-1"><a href="#Space_between_Text"><span class="tocnumber">1</span> <span class="toctext">Space between Text</span></a></li>
13418 <li class="toclevel-1 tocsection-2"><a href="#Space-Entity_between_Text"><span class="tocnumber">2</span> <span class="toctext">Space-Entity&#32;between&#32;Text</span></a></li>
13419 <li class="toclevel-1 tocsection-3"><a href="#Plus.2Bbetween.2BText"><span class="tocnumber">3</span> <span class="toctext">Plus+between+Text</span></a></li>
13420 <li class="toclevel-1 tocsection-4"><a href="#Plus-Entity.2Bbetween.2BText"><span class="tocnumber">4</span> <span class="toctext">Plus-Entity&#43;between&#43;Text</span></a></li>
13421 <li class="toclevel-1 tocsection-5"><a href="#Underscore_between_Text"><span class="tocnumber">5</span> <span class="toctext">Underscore_between_Text</span></a></li>
13422 <li class="toclevel-1 tocsection-6"><a href="#Underscore-Entity_between_Text"><span class="tocnumber">6</span> <span class="toctext">Underscore-Entity&#95;between&#95;Text</span></a></li>
13423 </ul>
13424 </div>
13425
13426 <h2><span class="mw-headline" id="Space_between_Text">Space between 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: Space between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13427 <p>section 1
13428 </p>
13429 <h2><span class="mw-headline" id="Space-Entity_between_Text">Space-Entity&#32;between&#32;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: Space-Entity between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13430 <p>section 2
13431 </p>
13432 <h2><span class="mw-headline" id="Plus.2Bbetween.2BText">Plus+between+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: Plus+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13433 <p>section 3
13434 </p>
13435 <h2><span class="mw-headline" id="Plus-Entity.2Bbetween.2BText">Plus-Entity&#43;between&#43;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: Plus-Entity+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13436 <p>section 4
13437 </p>
13438 <h2><span class="mw-headline" id="Underscore_between_Text">Underscore_between_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: Underscore between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13439 <p>section 5
13440 </p>
13441 <h2><span class="mw-headline" id="Underscore-Entity_between_Text">Underscore-Entity&#95;between&#95;Text</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: Underscore-Entity_between_Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13442 <p>section 6
13443 </p><p><a href="#Space_between_Text">#Space between Text</a>
13444 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
13445 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
13446 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
13447 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
13448 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
13449 </p>
13450 !! end
13451
13452 !! test
13453 Headers with excess '=' characters
13454 (Are similar tests necessary beyond the 1st level?)
13455 !! wikitext
13456 =foo==
13457 ==foo=
13458 =''italic'' heading==
13459 ==''italic'' heading=
13460 !! html
13461 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13462 <ul>
13463 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
13464 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
13465 <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>
13466 <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>
13467 </ul>
13468 </div>
13469
13470 <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>
13471 <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>
13472 <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>
13473 <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>
13474
13475 !! end
13476
13477 !! test
13478 HTML headers vs TOC (bug 23393)
13479 (__NOEDITSECTION__ for clearer output, doesn't matter here)
13480 !! wikitext
13481 <h1>Header 1</h1>
13482 == Header 1.1 ==
13483 == Header 1.2 ==
13484
13485 <h1>Header 2
13486 </h1>
13487 == Header 2.1 ==
13488 == Header 2.2 ==
13489 __NOEDITSECTION__
13490 !! html
13491 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13492 <ul>
13493 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
13494 <ul>
13495 <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>
13496 <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>
13497 </ul>
13498 </li>
13499 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
13500 <ul>
13501 <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>
13502 <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>
13503 </ul>
13504 </li>
13505 </ul>
13506 </div>
13507
13508 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
13509 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
13510 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
13511 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
13512 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
13513 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
13514
13515 !! end
13516
13517 !! test
13518 Single-line or multiline-comments can follow headings
13519 !! options
13520 parsoid=wt2html,wt2wt
13521 !! wikitext
13522 ==foo==<!---->
13523 ==bar==<!--c1-->
13524 ==baz==<!--
13525 c2
13526 c3-->
13527 !! html
13528 <h2><span class="mw-headline" id="foo">foo</span></h2>
13529 <h2><span class="mw-headline" id="bar">bar</span></h2>
13530 <h2><span class="mw-headline" id="baz">baz</span></h2>
13531
13532 !! end
13533
13534 !! test
13535 BUG 1219 URL next to image (broken)
13536 !! wikitext
13537 http://example.com[[Image:foobar.jpg]]
13538 !! html
13539 <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>
13540 </p>
13541 !!end
13542
13543 !! test
13544 Bug 1186 news: in the middle of text
13545 !! wikitext
13546 http://en.wikinews.org/wiki/Wikinews:Workplace
13547 !! html
13548 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
13549 </p>
13550 !!end
13551
13552
13553 !! test
13554 Namespaced link must have a title
13555 !! wikitext
13556 [[Project:]]
13557 !! html
13558 <p>[[Project:]]
13559 </p>
13560 !!end
13561
13562 !! test
13563 Namespaced link must have a title (bad fragment version)
13564 !! wikitext
13565 [[Project:#fragment]]
13566 !! html
13567 <p>[[Project:#fragment]]
13568 </p>
13569 !!end
13570
13571
13572 ###
13573 ### HTML tags and HTML attributes
13574 ###
13575
13576 !! test
13577 div with no attributes
13578 !! wikitext
13579 <div>HTML rocks</div>
13580 !! html
13581 <div>HTML rocks</div>
13582
13583 !! end
13584
13585 !! test
13586 div with double-quoted attribute
13587 !! wikitext
13588 <div id="rock">HTML rocks</div>
13589 !! html
13590 <div id="rock">HTML rocks</div>
13591
13592 !! end
13593
13594 !! test
13595 div with single-quoted attribute
13596 !! wikitext
13597 <div id='rock'>HTML rocks</div>
13598 !! html
13599 <div id="rock">HTML rocks</div>
13600
13601 !! end
13602
13603 !! test
13604 div with unquoted attribute
13605 !! wikitext
13606 <div id=rock>HTML rocks</div>
13607 !! html
13608 <div id="rock">HTML rocks</div>
13609
13610 !! end
13611
13612 !! test
13613 div with illegal double attributes
13614 !! wikitext
13615 <div id="a" id="b">HTML rocks</div>
13616 !! html
13617 <div id="b">HTML rocks</div>
13618
13619 !!end
13620
13621 # FIXME: produce empty string instead of "class" in the PHP parser, following
13622 # the HTML5 spec.
13623 !! test
13624 div with empty attribute value, space before equals
13625 !! options
13626 parsoid
13627 !! wikitext
13628 <div class =>HTML rocks</div>
13629 !! html
13630 <div class="">HTML rocks</div>
13631
13632 !! end
13633
13634 !! test
13635 div with multiple empty attribute values
13636 !! options
13637 parsoid
13638 !! wikitext
13639 <div id= title=>HTML rocks</div>
13640 !! html
13641 <div id="" title="">HTML rocks</div>
13642
13643 !! end
13644
13645 !! test
13646 table with multiple empty attribute values
13647 !! options
13648 parsoid
13649 !! wikitext
13650 {| title= id=
13651 | hi
13652 |}
13653 !! html
13654 <table title="" id="">
13655 <tbody><tr><td> hi</td></tr>
13656 </tbody></table>
13657 !! end
13658
13659 !! test
13660 div with braces in attribute value
13661 !! wikitext
13662 <div title="{}">Foo</div>
13663 !! html/php
13664 <div title="&#123;}">Foo</div>
13665
13666 !! html/parsoid
13667 <div title="{}">Foo</div>
13668 !! end
13669
13670 # This it very inconsistent in the PHP parser: it returns
13671 # class="class" if there is a space between the name and the equal sign (see
13672 # 'div with empty attribute value, space before equals'), but strips the
13673 # attribute completely if the space is missing. We hope that not much content
13674 # depends on this, so are implementing the behavior below in Parsoid for
13675 # consistencies' sake.
13676 # FIXME: fix this behavior in the PHP parser?
13677 !! test
13678 div with empty attribute value, no space before equals
13679 !! options
13680 parsoid=wt2html,html2html
13681 !! wikitext
13682 <div class=>HTML rocks</div>
13683 !! html/php
13684 <div>HTML rocks</div>
13685
13686 !! html/parsoid
13687 <div class="">HTML rocks</div>
13688 !! end
13689
13690 !! test
13691 HTML multiple attributes correction
13692 !! wikitext
13693 <p class="error" class="awesome">Awesome!</p>
13694 !! html
13695 <p class="awesome">Awesome!</p>
13696
13697 !!end
13698
13699 !! test
13700 Table multiple attributes correction
13701 !! wikitext
13702 {|
13703 !+ class="error" class="awesome"| status
13704 |}
13705 !! html
13706 <table>
13707 <tr>
13708 <th class="awesome"> status
13709 </th></tr></table>
13710
13711 !!end
13712
13713 !! test
13714 DIV IN UPPERCASE
13715 !! wikitext
13716 <DIV ID="x">HTML ROCKS</DIV>
13717 !! html
13718 <div id="x">HTML ROCKS</div>
13719
13720 !!end
13721
13722 !! test
13723 Non-ASCII pseudo-tags are rendered as text
13724 !! wikitext
13725 <khyô>
13726 !! html
13727 <p>&lt;khyô&gt;
13728 </p>
13729 !! end
13730
13731 !! test
13732 Pseudo-tag with URL 'name' renders as url link
13733 !! wikitext
13734 <http://example.com/>
13735 !! html
13736 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
13737 </p>
13738 !! end
13739
13740 !! test
13741 text with amp in the middle of nowhere
13742 !! wikitext
13743 Remember AT&T?
13744 !! html
13745 <p>Remember AT&amp;T?
13746 </p>
13747 !! end
13748
13749 !! test
13750 text with character entity: eacute
13751 !! wikitext
13752 I always thought &eacute; was a cute letter.
13753 !! html
13754 <p>I always thought &#233; was a cute letter.
13755 </p>
13756 !! html+tidy
13757 <p>I always thought é was a cute letter.</p>
13758 !! end
13759
13760 !! test
13761 text with entity-escaped character entity-like string: eacute
13762 !! wikitext
13763 I always thought &amp;eacute; was a cute letter.
13764 !! html
13765 <p>I always thought &amp;eacute; was a cute letter.
13766 </p>
13767 !! end
13768
13769 !! test
13770 text with undefined character entity: xacute
13771 !! wikitext
13772 I always thought &xacute; was a cute letter.
13773 !! html
13774 <p>I always thought &amp;xacute; was a cute letter.
13775 </p>
13776 !! end
13777
13778 # TODO: generalize to PHP parser?
13779 !! test
13780 HTML5 tags
13781 !! options
13782 parsoid
13783 !! wikitext
13784 <data value="5">five</data>
13785 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13786 <mark>This highlighted text</mark>
13787 !! html
13788 <p><data value="5">five</data>
13789 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13790 <mark>This highlighted text</mark></p>
13791 !! end
13792
13793 !! test
13794 HTML tag with leading space is parsed as text
13795 !! wikitext
13796 < div>foo< /div>
13797 !! html
13798 <p>&lt; div&gt;foo&lt; /div&gt;
13799 </p>
13800 !! end
13801
13802 ###
13803 ### Nesting tests (see bug 41545, 50604, 51081)
13804 ###
13805
13806 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
13807 # Note that html2wt is considerably more difficult if we use <b> in
13808 # the test case, instead of <big>
13809 !! test
13810 Ensure that HTML adoption agency algorithm is properly implemented.
13811 !! wikitext
13812 <big>X<big>Y</big>Z</big>
13813 !! html
13814 <p><big>X<big>Y</big>Z</big>
13815 </p>
13816 !! end
13817
13818 # This was bug 41545 in the PHP parser.
13819 # Note that tidy doesn't handle this correctly.
13820 !! test
13821 Nesting of <kbd>
13822 !! wikitext
13823 <kbd>X<kbd>Y</kbd>Z</kbd>
13824 !! html
13825 <p><kbd>X<kbd>Y</kbd>Z</kbd>
13826 </p>
13827 !! end
13828
13829 # The following cases were bug 51081 in the PHP parser.
13830 # Note that there are some other nestable tags (b, i, etc) which are
13831 # not covered; see bug 51081 for discussion.
13832
13833 # Note that tidy doesn't handle this correctly.
13834 !! test
13835 Nesting of <em>
13836 !! wikitext
13837 <em>X<em>Y</em>Z</em>
13838 !! html
13839 <p><em>X<em>Y</em>Z</em>
13840 </p>
13841 !! end
13842
13843 # Note that tidy doesn't handle this correctly.
13844 !! test
13845 Nesting of <strong>
13846 !! wikitext
13847 <strong>X<strong>Y</strong>Z</strong>
13848 !! html
13849 <p><strong>X<strong>Y</strong>Z</strong>
13850 </p>
13851 !! end
13852
13853 !! test
13854 Nesting of <q>
13855 !! wikitext
13856 <q>X<q>Y</q>Z</q>
13857 !! html+tidy
13858 <p><q>X<q>Y</q>Z</q></p>
13859 !! end
13860
13861 # Note that tidy doesn't handle this correctly.
13862 !! test
13863 Nesting of <ruby>
13864 !! wikitext
13865 <ruby>X<ruby>Y</ruby>Z</ruby>
13866 !! html
13867 <p><ruby>X<ruby>Y</ruby>Z</ruby>
13868 </p>
13869 !! end
13870
13871 # Note that tidy doesn't handle this correctly.
13872 !! test
13873 Nesting of <bdo>
13874 !! wikitext
13875 <bdo>X<bdo>Y</bdo>Z</bdo>
13876 !! html
13877 <p><bdo>X<bdo>Y</bdo>Z</bdo>
13878 </p>
13879 !! end
13880
13881
13882 ###
13883 ### Media links
13884 ###
13885
13886 !! test
13887 Media link
13888 !! wikitext
13889 [[Media:Foobar.jpg]]
13890 !! html
13891 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
13892 </p>
13893 !! end
13894
13895 !! test
13896 Media link with text
13897 !! wikitext
13898 [[Media:Foobar.jpg|A neat file to look at]]
13899 !! html
13900 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
13901 </p>
13902 !! end
13903
13904 # FIXME: this is still bad HTML tag nesting
13905 !! test
13906 Media link with nasty text
13907 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
13908 !! wikitext
13909 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
13910 !! html
13911 <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>
13912
13913 !! html+tidy
13914 <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>
13915 !! end
13916
13917 !! test
13918 Media link to nonexistent file (bug 1702)
13919 !! wikitext
13920 [[Media:No such.jpg]]
13921 !! html
13922 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
13923 </p>
13924 !! end
13925
13926 !! test
13927 Image link to nonexistent file (bug 1850 - good)
13928 !! wikitext
13929 [[File:No_such.jpg]]
13930 !! html/php
13931 <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>
13932 </p>
13933 !! html/parsoid
13934 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="File:No_such.jpg"><img resource="./File:No_such.jpg" src="./Special:FilePath/No_such.jpg" height="220" width="220"/></a></span></p>
13935 !! end
13936
13937 !! test
13938 :Image link to nonexistent file (bug 1850 - bad)
13939 !! wikitext
13940 [[:Image:No such.jpg]]
13941 !! html/php
13942 <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>
13943 </p>
13944 !! html/parsoid
13945 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
13946 !! end
13947
13948
13949
13950 !! test
13951 Character reference normalization in link text (bug 1938)
13952 !! wikitext
13953 [[Main Page|this&that]]
13954 !! html
13955 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
13956 </p>
13957 !!end
13958
13959 !! article
13960 אַ
13961 !! text
13962 Test for unicode normalization
13963
13964 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
13965 !! endarticle
13966
13967 !! test
13968 (bug 19451) Links should refer to the normalized form.
13969 !! wikitext
13970 [[&#xFB2E;]]
13971 [[&#x5d0;&#x5b7;]]
13972 [[&#x5d0;ַ]]
13973 [[א&#x5b7;]]
13974 [[אַ]]
13975 !! html
13976 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
13977 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
13978 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
13979 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
13980 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
13981 </p>
13982 !! end
13983
13984 !! test
13985 Empty attribute crash test (bug 2067)
13986 !! wikitext
13987 <font color="">foo</font>
13988 !! html
13989 <p><font color="">foo</font>
13990 </p>
13991 !! end
13992
13993 !! test
13994 Empty attribute crash test single-quotes (bug 2067)
13995 !! wikitext
13996 <font color=''>foo</font>
13997 !! html
13998 <p><font color="">foo</font>
13999 </p>
14000 !! end
14001
14002 !! test
14003 Attribute test: equals, then nothing
14004 !! wikitext
14005 <font color=>foo</font>
14006 !! html
14007 <p><font>foo</font>
14008 </p>
14009 !! end
14010
14011 !! test
14012 Attribute test: unquoted value
14013 !! wikitext
14014 <font color=x>foo</font>
14015 !! html
14016 <p><font color="x">foo</font>
14017 </p>
14018 !! end
14019
14020 !! test
14021 Attribute test: unquoted but illegal value (hash)
14022 !! wikitext
14023 <font color=#x>foo</font>
14024 !! html
14025 <p><font color="#x">foo</font>
14026 </p>
14027 !! end
14028
14029 !! test
14030 Attribute test: no value
14031 !! wikitext
14032 <font color>foo</font>
14033 !! html
14034 <p><font color="color">foo</font>
14035 </p>
14036 !! end
14037
14038 !! test
14039 Bug 2095: link with three closing brackets
14040 !! wikitext
14041 [[Main Page]]]
14042 !! html/php
14043 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
14044 </p>
14045 !! html/parsoid
14046 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
14047 !! end
14048
14049 !! test
14050 Bug 2095: link with pipe and three closing brackets
14051 !! wikitext
14052 [[Main Page|link]]]
14053 !! html/php
14054 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
14055 </p>
14056 !! html/parsoid
14057 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
14058 !! end
14059
14060 !! test
14061 Bug 2095: link with pipe and three closing brackets, version 2
14062 !! wikitext
14063 [[Main Page|[http://example.com/]]]
14064 !! html/php
14065 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
14066 </p>
14067 !! html/parsoid
14068 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
14069 !! end
14070
14071
14072 ###
14073 ### Safety
14074 ###
14075
14076 !! article
14077 Template:Dangerous attribute
14078 !! text
14079 " onmouseover="alert(document.cookie)
14080 !! endarticle
14081
14082 !! article
14083 Template:Dangerous style attribute
14084 !! text
14085 border-size: expression(alert(document.cookie))
14086 !! endarticle
14087
14088 !! article
14089 Template:Div style
14090 !! text
14091 <div style="float: right; {{{1}}}">Magic div</div>
14092 !! endarticle
14093
14094 !! test
14095 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
14096 !! wikitext
14097 <div title="{{test}}"></div>
14098 !! html
14099 <div title="This is a test template"></div>
14100
14101 !! end
14102
14103 # Parsoid has enough context to handle this case
14104 !! test
14105 Bug 2304: HTML attribute safety (dangerous template; 2309)
14106 !! wikitext
14107 <div title="{{dangerous attribute}}"></div>
14108 !! html/php
14109 <div title=""></div>
14110
14111 !! html/parsoid
14112 <div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[12,35,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;dangerous attribute&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Dangerous_attribute&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
14113 !! end
14114
14115 !! test
14116 Bug 2304: HTML attribute safety (dangerous style template; 2309)
14117 !! wikitext
14118 <div style="{{dangerous style attribute}}"></div>
14119 !! html
14120 <div style="/* insecure input */"></div>
14121
14122 !! end
14123
14124 !! test
14125 Bug 2304: HTML attribute safety (safe parameter; 2309)
14126 !! wikitext
14127 {{div style|width: 200px}}
14128 !! html
14129 <div style="float: right; width: 200px">Magic div</div>
14130
14131 !! end
14132
14133 !! test
14134 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
14135 !! wikitext
14136 {{div style|width: expression(alert(document.cookie))}}
14137 !! html
14138 <div style="/* insecure input */">Magic div</div>
14139
14140 !! end
14141
14142 !! test
14143 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
14144 !! wikitext
14145 {{div style|"><script>alert(document.cookie)</script>}}
14146 !! html
14147 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14148
14149 !! end
14150
14151 !! test
14152 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
14153 !! wikitext
14154 {{div style|" ><script>alert(document.cookie)</script>}}
14155 !! html
14156 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14157
14158 !! end
14159
14160 !! test
14161 Bug 2304: HTML attribute safety (link)
14162 !! wikitext
14163 <div title="[[Main Page]]"></div>
14164 !! html
14165 <div title="&#91;&#91;Main Page]]"></div>
14166
14167 !! end
14168
14169 !! test
14170 Bug 2304: HTML attribute safety (italics)
14171 !! wikitext
14172 <div title="''foobar''"></div>
14173 !! html
14174 <div title="&#39;&#39;foobar&#39;&#39;"></div>
14175
14176 !! end
14177
14178 !! test
14179 Bug 2304: HTML attribute safety (bold)
14180 !! wikitext
14181 <div title="'''foobar'''"></div>
14182 !! html
14183 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
14184
14185 !! end
14186
14187
14188 !! test
14189 Bug 2304: HTML attribute safety (ISBN)
14190 !! wikitext
14191 <div title="ISBN 1234567890"></div>
14192 !! html
14193 <div title="&#73;SBN 1234567890"></div>
14194
14195 !! end
14196
14197 !! test
14198 Bug 2304: HTML attribute safety (RFC)
14199 !! wikitext
14200 <div title="RFC 1234"></div>
14201 !! html
14202 <div title="&#82;FC 1234"></div>
14203
14204 !! end
14205
14206 !! test
14207 Bug 2304: HTML attribute safety (PMID)
14208 !! wikitext
14209 <div title="PMID 1234567890"></div>
14210 !! html
14211 <div title="&#80;MID 1234567890"></div>
14212
14213 !! end
14214
14215 !! test
14216 Bug 2304: HTML attribute safety (web link)
14217 !! wikitext
14218 <div title="http://example.com/"></div>
14219 !! html
14220 <div title="http&#58;//example.com/"></div>
14221
14222 !! end
14223
14224 !! test
14225 Bug 2304: HTML attribute safety (named web link)
14226 !! wikitext
14227 <div title="[http://example.com/ link]"></div>
14228 !! html
14229 <div title="&#91;http&#58;//example.com/ link]"></div>
14230
14231 !! end
14232
14233 !! test
14234 Bug 3244: HTML attribute safety (extension; safe)
14235 !! wikitext
14236 <div style="<nowiki>background:blue</nowiki>"></div>
14237 !! html
14238 <div style="background:blue"></div>
14239
14240 !! end
14241
14242 !! test
14243 Bug 3244: HTML attribute safety (extension; unsafe)
14244 !! wikitext
14245 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14246 !! html
14247 <div style="/* insecure input */"></div>
14248
14249 !! end
14250
14251 # More MSIE fun discovered by Tom Gilder
14252
14253 !! test
14254 MSIE CSS safety test: spurious slash
14255 !! wikitext
14256 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14257 !! html
14258 <div style="/* insecure input */">evil</div>
14259
14260 !! end
14261
14262 !! test
14263 MSIE CSS safety test: hex code
14264 !! wikitext
14265 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14266 !! html
14267 <div style="/* insecure input */">evil</div>
14268
14269 !! end
14270
14271 !! test
14272 MSIE CSS safety test: comment in url
14273 !! wikitext
14274 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14275 !! html
14276 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14277
14278 !! end
14279
14280 !! test
14281 MSIE CSS safety test: comment in expression
14282 !! wikitext
14283 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14284 !! html
14285 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14286
14287 !! end
14288
14289 !! test
14290 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14291 !! wikitext
14292 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14293 !! html
14294 <p style="/* invalid control char */">A</p>
14295
14296 !! end
14297
14298 !! test
14299 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14300 !! wikitext
14301 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14302 <div style="top:EXPRESSION(alert())">B</div>
14303 !! html
14304 <p style="/* insecure input */">A</p>
14305 <div style="/* insecure input */">B</div>
14306
14307 !! end
14308
14309 !! test
14310 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14311 !! wikitext
14312 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14313 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14314 !! html
14315 <div style="/* insecure input */">A</div>
14316 <p style="/* insecure input */">B</p>
14317
14318 !! end
14319
14320 !! test
14321 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14322 !! wikitext
14323 <div style="background-image:url⁽javascript:alert())">A</div>
14324 <div style="background-image:url₍javascript:alert())">B</div>
14325 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14326 !! html
14327 <div style="/* insecure input */">A</div>
14328 <div style="/* insecure input */">B</div>
14329 <p style="/* insecure input */">C</p>
14330
14331 !! end
14332
14333 !! test
14334 Opera -o-link CSS
14335 !! wikitext
14336 <div
14337 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;"
14338 style="-o-link:attr(title);-o-link-source:current">X</div>
14339 !! html
14340 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14341
14342 !! end
14343
14344 !! test
14345 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14346 !! wikitext
14347 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14348 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14349 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14350 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14351 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14352 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14353 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14354 !! html
14355 <p style="/* insecure input */">A</p>
14356 <p style="/* insecure input */">B</p>
14357 <p style="/* insecure input */">C</p>
14358 <p style="/* insecure input */">D</p>
14359 <p style="/* insecure input */">E</p>
14360 <p style="/* insecure input */">F</p>
14361 <p style="/* insecure input */">G</p>
14362
14363 !! end
14364
14365 !! test
14366 Table attribute legitimate extension
14367 !! wikitext
14368 {|
14369 !+ style="<nowiki>color:blue</nowiki>"| status
14370 |}
14371 !! html
14372 <table>
14373 <tr>
14374 <th style="color:blue"> status
14375 </th></tr></table>
14376
14377 !!end
14378
14379 !! test
14380 Table attribute safety
14381 !! wikitext
14382 {|
14383 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14384 |}
14385 !! html
14386 <table>
14387 <tr>
14388 <th style="/* insecure input */"> status
14389 </th></tr></table>
14390
14391 !! end
14392
14393 !! test
14394 CSS line continuation 1
14395 !! wikitext
14396 <div style="background-image: u\&#10;rl(test.jpg);"></div>
14397 !! html
14398 <div style="/* insecure input */"></div>
14399
14400 !! end
14401
14402 !! test
14403 CSS line continuation 2
14404 !! wikitext
14405 <div style="background-image: u\&#13;rl(test.jpg); "></div>
14406 !! html
14407 <div style="/* insecure input */"></div>
14408
14409 !! end
14410
14411 !! article
14412 Template:Identity
14413 !! text
14414 {{{1}}}
14415 !! endarticle
14416
14417 !! test
14418 Expansion of multi-line templates in attribute values (bug 6255)
14419 !! wikitext
14420 <div style="background: {{identity|#00FF00}}">-</div>
14421 !! html
14422 <div style="background: #00FF00">-</div>
14423
14424 !! end
14425
14426
14427 !! test
14428 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
14429 !! wikitext
14430 <div style="background:
14431 #00FF00">-</div>
14432 !! html/php
14433 <div style="background: #00FF00">-</div>
14434
14435 !! html/parsoid
14436 <div style="background:
14437 #00FF00">-</div>
14438 !! end
14439
14440 !! test
14441 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
14442 !! wikitext
14443 <div style="background: &#10;#00FF00">-</div>
14444 !! html
14445 <div style="background: &#10;#00FF00">-</div>
14446
14447 !! end
14448
14449 !! test
14450 evil <math>-wiki-tags without Extension:Math enabled
14451 !! wikitext
14452 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
14453 !! html+tidy
14454 <p>&lt;math&gt;&lt;img src="some evil external link"&gt;&lt;script&gt;some_evil_javascript();&lt;/script&gt;&lt;/math&gt;</p>
14455 !! end
14456
14457 ###
14458 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
14459 ###
14460 !! test
14461 Parser hook: empty input
14462 !! wikitext
14463 <tag></tag>
14464 !! html
14465 <pre>
14466 ''
14467 array (
14468 )
14469 </pre>
14470
14471 !! end
14472
14473 !! test
14474 Parser hook: empty input using terminated empty elements
14475 !! wikitext
14476 <tag/>
14477 !! html
14478 <pre>
14479 NULL
14480 array (
14481 )
14482 </pre>
14483
14484 !! end
14485
14486 !! test
14487 Parser hook: empty input using terminated empty elements (space before)
14488 !! wikitext
14489 <tag />
14490 !! html
14491 <pre>
14492 NULL
14493 array (
14494 )
14495 </pre>
14496
14497 !! end
14498
14499 !! test
14500 Parser hook: basic input
14501 !! wikitext
14502 <tag>input</tag>
14503 !! html
14504 <pre>
14505 'input'
14506 array (
14507 )
14508 </pre>
14509
14510 !! end
14511
14512
14513 !! test
14514 Parser hook: case insensitive
14515 !! wikitext
14516 <TAG>input</TAG>
14517 !! html
14518 <pre>
14519 'input'
14520 array (
14521 )
14522 </pre>
14523
14524 !! end
14525
14526
14527 !! test
14528 Parser hook: case insensitive, redux
14529 !! wikitext
14530 <TaG>input</TAg>
14531 !! html
14532 <pre>
14533 'input'
14534 array (
14535 )
14536 </pre>
14537
14538 !! end
14539
14540 !! test
14541 Parser hook: nested tags
14542 !! options
14543 noxml
14544 !! wikitext
14545 <tag><tag></tag></tag>
14546 !! html
14547 <pre>
14548 '<tag>'
14549 array (
14550 )
14551 </pre>&lt;/tag&gt;
14552
14553 !! end
14554
14555 !! test
14556 Parser hook: basic arguments
14557 !! wikitext
14558 <tag width=200 height = "100" depth = '50' square></tag>
14559 !! html
14560 <pre>
14561 ''
14562 array (
14563 'width' => '200',
14564 'height' => '100',
14565 'depth' => '50',
14566 'square' => 'square',
14567 )
14568 </pre>
14569
14570 !! end
14571
14572 !! test
14573 Parser hook: argument containing a forward slash (bug 5344)
14574 !! wikitext
14575 <tag filename='/tmp/bla'></tag>
14576 !! html
14577 <pre>
14578 ''
14579 array (
14580 'filename' => '/tmp/bla',
14581 )
14582 </pre>
14583
14584 !! end
14585
14586 !! test
14587 Parser hook: empty input using terminated empty elements (bug 2374)
14588 !! wikitext
14589 <tag foo=bar/>text
14590 !! html
14591 <pre>
14592 NULL
14593 array (
14594 'foo' => 'bar',
14595 )
14596 </pre>text
14597
14598 !! end
14599
14600 # </tag> should be output literally since there is no matching tag that begins it
14601 !! test
14602 Parser hook: basic arguments using terminated empty elements (bug 2374)
14603 !! wikitext
14604 <tag width=200 height = "100" depth = '50' square/>
14605 other stuff
14606 </tag>
14607 !! html
14608 <pre>
14609 NULL
14610 array (
14611 'width' => '200',
14612 'height' => '100',
14613 'depth' => '50',
14614 'square' => 'square',
14615 )
14616 </pre>
14617 <p>other stuff
14618 &lt;/tag&gt;
14619 </p>
14620 !! end
14621
14622 ###
14623 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14624 ###
14625
14626 !! test
14627 Parser hook: static parser hook not inside a comment
14628 !! wikitext
14629 <statictag>hello, world</statictag>
14630 <statictag action=flush/>
14631 !! html
14632 <p>hello, world
14633 </p>
14634 !! end
14635
14636
14637 !! test
14638 Parser hook: static parser hook inside a comment
14639 !! wikitext
14640 <!-- <statictag>hello, world</statictag> -->
14641 <statictag action=flush/>
14642 !! html
14643 <p><br />
14644 </p>
14645 !! end
14646
14647 # Nested template calls; this case was broken by Parser.php rev 1.506,
14648 # since reverted.
14649
14650 !! article
14651 Template:One-parameter
14652 !! text
14653 (My parameter is: {{{1}}})
14654 !! endarticle
14655
14656 !! article
14657 Template:Map-one-parameter
14658 !! text
14659 {{{{{1}}}|{{{2}}}}}
14660 !! endarticle
14661
14662 !! test
14663 Nested template calls
14664 !! wikitext
14665 {{Map-one-parameter|One-parameter|param}}
14666 !! html
14667 <p>(My parameter is: param)
14668 </p>
14669 !! end
14670
14671
14672 ###
14673 ### Sanitizer
14674 ###
14675
14676 # HTML+Tidy effectively strips out the empty tags completely
14677 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
14678 # which Tidy would have done for the PHP parser had there been content inside it.
14679 !! test
14680 Sanitizer: Closing of open tags
14681 !! wikitext
14682 <s></s><table></table>
14683 !! html
14684 <s></s><table></table>
14685
14686 !! html/parsoid
14687 <p><s></s></p><table></table>
14688 !! end
14689
14690 !! test
14691 Sanitizer: Closing of open but not closed tags
14692 !! wikitext
14693 <s>foo
14694 !! html
14695 <p><s>foo</s>
14696 </p>
14697 !! end
14698
14699 !! test
14700 Sanitizer: Closing of closed but not open tags
14701 !! wikitext
14702 </s>
14703 !! html
14704 <p>&lt;/s&gt;
14705 </p>
14706 !! end
14707
14708 !! test
14709 Sanitizer: Closing of closed but not open table tags
14710 !! wikitext
14711 Table not started</td></tr></table>
14712 !! html
14713 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
14714 </p>
14715 !! end
14716
14717 !! test
14718 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
14719 !! wikitext
14720 <span id="æ: v">byte</span>[[#æ: v|backlink]]
14721 !! html
14722 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
14723 </p>
14724 !! end
14725
14726 # In HTML5, the restrictions are that id must contain at least one character,
14727 # and must not contain any space characters.
14728 !! test
14729 Sanitizer: Validating the contents of the id attribute (bug 4515)
14730 !! options
14731 disabled
14732 !! wikitext
14733 <br id="" /><br id="a space" />
14734 !! html
14735 Something ...
14736 !! end
14737
14738 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
14739 !! test
14740 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
14741 !! options
14742 disabled
14743 !! wikitext
14744 <br id="foo" /><br id="foo" />
14745 !! html
14746 Something need to be done. foo-2 ?
14747 !! end
14748
14749 !! test
14750 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
14751 !! wikitext
14752 <div itemscope>
14753 <meta itemprop="hello" content="world">
14754 <meta http-equiv="refresh" content="5">
14755 <meta itemprop="hello" http-equiv="refresh" content="5">
14756 <link itemprop="hello" href="{{SERVER}}">
14757 <link rel="stylesheet" href="{{SERVER}}">
14758 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
14759 </div>
14760 !! html
14761 <div itemscope="itemscope">
14762 <p> <meta itemprop="hello" content="world" />
14763 &lt;meta http-equiv="refresh" content="5"&gt;
14764 <meta itemprop="hello" content="5" />
14765 </p>
14766 <link itemprop="hello" href="http&#58;//example.org" />
14767 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
14768 <link itemprop="hello" href="http&#58;//example.org" />
14769 </div>
14770
14771 !! end
14772
14773 !! test
14774 Language converter: output gets cut off unexpectedly (bug 5757)
14775 !! options
14776 language=zh
14777 !! wikitext
14778 this bit is safe: }-
14779
14780 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
14781
14782 then we get cut off here: }-
14783
14784 all additional text is vanished
14785 !! html
14786 <p>this bit is safe: }-
14787 </p><p>but if we add a conversion instance: xxx
14788 </p><p>then we get cut off here: }-
14789 </p><p>all additional text is vanished
14790 </p>
14791 !! end
14792
14793 !! test
14794 Self closed html pairs (bug 5487)
14795 !! options
14796 !! wikitext
14797 <center><font id="bug" />Centered text</center>
14798 <div><font id="bug2" />In div text</div>
14799 !! html
14800 <center>&lt;font id="bug" /&gt;Centered text</center>
14801 <div>&lt;font id="bug2" /&gt;In div text</div>
14802
14803 !! end
14804
14805 #
14806 #
14807 #
14808
14809 !! test
14810 Punctuation: nbsp before exclamation
14811 !! wikitext
14812 C'est grave !
14813 !! html
14814 <p>C'est grave&#160;!
14815 </p>
14816 !! end
14817
14818 !! test
14819 Punctuation: CSS !important (bug 11874)
14820 !! wikitext
14821 <div style="width:50% !important">important</div>
14822 !! html
14823 <div style="width:50% !important">important</div>
14824
14825 !!end
14826
14827 !! test
14828 Punctuation: CSS ! important (bug 11874; with space after)
14829 !! wikitext
14830 <div style="width:50% ! important">important</div>
14831 !! html
14832 <div style="width:50% ! important">important</div>
14833
14834 !!end
14835
14836
14837 !! test
14838 HTML bullet list, closed tags (bug 5497)
14839 !! wikitext
14840 <ul>
14841 <li>One</li>
14842 <li>Two</li>
14843 </ul>
14844 !! html/php
14845 <ul>
14846 <li>One</li>
14847 <li>Two</li>
14848 </ul>
14849
14850 !! html/parsoid
14851 <ul data-parsoid='{"stx":"html"}'>
14852 <li data-parsoid='{"stx":"html"}'>One</li>
14853 <li data-parsoid='{"stx":"html"}'>Two</li>
14854 </ul>
14855
14856 !! end
14857
14858 !! test
14859 HTML bullet list, unclosed tags (bug 5497)
14860 !! wikitext
14861 <ul>
14862 <li>One
14863 <li>Two
14864 </ul>
14865 !! html/php+tidy
14866 <ul>
14867 <li>One</li>
14868 <li>Two</li>
14869 </ul>
14870 !! html/parsoid
14871 <ul data-parsoid='{"stx":"html"}'>
14872 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
14873 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
14874 </ul>
14875
14876 !! end
14877
14878 !! test
14879 HTML ordered list, closed tags (bug 5497)
14880 !! wikitext
14881 <ol>
14882 <li>One</li>
14883 <li>Two</li>
14884 </ol>
14885 !! html/php
14886 <ol>
14887 <li>One</li>
14888 <li>Two</li>
14889 </ol>
14890
14891 !! html/parsoid
14892 <ol data-parsoid='{"stx":"html"}'>
14893 <li data-parsoid='{"stx":"html"}'>One</li>
14894 <li data-parsoid='{"stx":"html"}'>Two</li>
14895 </ol>
14896
14897 !! end
14898
14899 !! test
14900 HTML ordered list, unclosed tags (bug 5497)
14901 !! options
14902 !! wikitext
14903 <ol>
14904 <li>One
14905 <li>Two
14906 </ol>
14907 !! html/php+tidy
14908 <ol>
14909 <li>One</li>
14910 <li>Two</li>
14911 </ol>
14912 !! html/parsoid
14913 <ol data-parsoid='{"stx":"html"}'>
14914 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
14915 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
14916 </ol>
14917
14918 !! end
14919
14920 !! test
14921 HTML nested bullet list, closed tags (bug 5497)
14922 !! wikitext
14923 <ul>
14924 <li>One</li>
14925 <li>Two:
14926 <ul>
14927 <li>Sub-one</li>
14928 <li>Sub-two</li>
14929 </ul>
14930 </li>
14931 </ul>
14932 !! html
14933 <ul>
14934 <li>One</li>
14935 <li>Two:
14936 <ul>
14937 <li>Sub-one</li>
14938 <li>Sub-two</li>
14939 </ul>
14940 </li>
14941 </ul>
14942
14943 !! end
14944
14945 !! test
14946 HTML nested bullet list, open tags (bug 5497)
14947 !! wikitext
14948 <ul>
14949 <li>One
14950 <li>Two:
14951 <ul>
14952 <li>Sub-one
14953 <li>Sub-two
14954 </ul>
14955 </ul>
14956 !! html/php+tidy
14957 <ul>
14958 <li>One</li>
14959 <li>Two:
14960 <ul>
14961 <li>Sub-one</li>
14962 <li>Sub-two</li>
14963 </ul>
14964 </li>
14965 </ul>
14966 !! html/parsoid
14967 <ul>
14968 <li>One
14969 </li>
14970 <li>Two:
14971 <ul>
14972 <li>Sub-one
14973 </li>
14974 <li>Sub-two
14975 </li>
14976 </ul>
14977 </li>
14978 </ul>
14979
14980 !! end
14981
14982 !! test
14983 HTML nested ordered list, closed tags (bug 5497)
14984 !! wikitext
14985 <ol>
14986 <li>One</li>
14987 <li>Two:
14988 <ol>
14989 <li>Sub-one</li>
14990 <li>Sub-two</li>
14991 </ol>
14992 </li>
14993 </ol>
14994 !! html
14995 <ol>
14996 <li>One</li>
14997 <li>Two:
14998 <ol>
14999 <li>Sub-one</li>
15000 <li>Sub-two</li>
15001 </ol>
15002 </li>
15003 </ol>
15004
15005 !! end
15006
15007 !! test
15008 HTML nested ordered list, open tags (bug 5497)
15009 !! wikitext
15010 <ol>
15011 <li>One
15012 <li>Two:
15013 <ol>
15014 <li>Sub-one
15015 <li>Sub-two
15016 </ol>
15017 </ol>
15018 !! html/php
15019 <ol>
15020 <li>One
15021 <li>Two:
15022 <ol>
15023 <li>Sub-one
15024 <li>Sub-two
15025 </ol>
15026 </ol>
15027
15028 !! html/parsoid
15029 <ol>
15030 <li>One
15031 </li>
15032 <li>Two:
15033 <ol>
15034 <li>Sub-one
15035 </li>
15036 <li>Sub-two
15037 </li>
15038 </ol>
15039 </li>
15040 </ol>
15041
15042 !! end
15043
15044 !! test
15045 HTML ordered list item with parameters oddity
15046 !! wikitext
15047 <ol><li id="fragment">One</li>
15048 </ol>
15049 !! html
15050 <ol><li id="fragment">One</li>
15051 </ol>
15052
15053 !! end
15054
15055 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
15056 !!test
15057 bug 5918: autonumbering
15058 !! wikitext
15059 [http://first/] [http://second] [ftp://ftp]
15060
15061 ftp://inlineftp
15062
15063 [mailto:enclosed@mail.tld With target]
15064
15065 [mailto:enclosed@mail.tld]
15066
15067 mailto:inline@mail.tld
15068 !! html/php
15069 <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>
15070 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
15071 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
15072 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
15073 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
15074 </p>
15075 !! html/parsoid
15076 <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>
15077 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
15078 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
15079 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
15080 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
15081 !! end
15082
15083
15084 #
15085 # Security and HTML correctness
15086 # From Nick Jenkins' fuzz testing
15087 #
15088
15089 !! test
15090 Fuzz testing: Parser13
15091 !! wikitext
15092 {|
15093 | http://a|
15094 !! html
15095 <table>
15096 <tr>
15097 <td>
15098 </td>
15099 </tr>
15100 </table>
15101
15102 !! end
15103
15104 !! test
15105 Fuzz testing: Parser14
15106 !! wikitext
15107 == onmouseover= ==
15108 http://__TOC__
15109 !! html
15110 <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>
15111 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15112 <ul>
15113 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15114 </ul>
15115 </div>
15116
15117
15118 !! html+tidy
15119 <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>
15120 <p>http://</p>
15121 <div id="toc" class="toc">
15122 <div id="toctitle">
15123 <h2>Contents</h2>
15124 </div>
15125 <ul>
15126 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15127 </ul>
15128 </div>
15129 !! end
15130
15131 !! test
15132 Fuzz testing: Parser14-table
15133 !! wikitext
15134 ==a==
15135 {| STYLE=__TOC__
15136 !! html
15137 <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>
15138 <table style="&#95;_TOC&#95;_">
15139 <tr><td></td></tr>
15140 </table>
15141
15142 !! html+tidy
15143 <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>
15144 <table style="__TOC__">
15145 <tr>
15146 <td></td>
15147 </tr>
15148 </table>
15149 !! end
15150
15151 # Known to produce bogus xml (extra </td>)
15152 !! test
15153 Fuzz testing: Parser16
15154 !! options
15155 noxml
15156 !! wikitext
15157 {|
15158 !https://||||||
15159 !! html
15160 <table>
15161 <tr>
15162 <th>https://</th>
15163 <th></th>
15164 <th></th>
15165 <th>
15166 </td>
15167 </tr>
15168 </table>
15169
15170 !! html+tidy
15171 <table>
15172 <tr>
15173 <th>https://</th>
15174 <th></th>
15175 <th></th>
15176 <th></th>
15177 </tr>
15178 </table>
15179 !! end
15180
15181 !! test
15182 Fuzz testing: Parser21
15183 !! wikitext
15184 {|
15185 ! irc://{{ftp://a" onmouseover="alert('hello world');"
15186 |
15187 !! html
15188 <table>
15189 <tr>
15190 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
15191 </th>
15192 <td>
15193 </td>
15194 </tr>
15195 </table>
15196
15197 !! end
15198
15199 !! test
15200 Fuzz testing: Parser22
15201 !! wikitext
15202 http://===r:::https://b
15203
15204 {|
15205 !! html
15206 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
15207 </p>
15208 <table>
15209 <tr><td></td></tr>
15210 </table>
15211
15212 !! end
15213
15214 # Known to produce bad XML for now
15215 !! test
15216 Fuzz testing: Parser24
15217 !! options
15218 noxml
15219 !! wikitext
15220 {|
15221 {{{|
15222 <u CLASS=
15223 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
15224 <br style="onmouseover='alert(document.cookie);' " />
15225
15226 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15227 |
15228 !! html
15229 <table>
15230 {{{|
15231 <u class="&#124;">}}}} &gt;
15232 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
15233
15234 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15235 <tr>
15236 <td></u>
15237 </td>
15238 </tr>
15239 </table>
15240
15241 !! end
15242
15243 # Note: the current result listed for this is not what the original one was,
15244 # but the original bug was JavaScript injection, which is fixed in any case.
15245 # It's not clear that the original result listed was any more correct than the
15246 # current one. Original result:
15247 # <p>{{{|
15248 # </p>
15249 # <li class="&#124;&#124;">
15250 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15251 !!test
15252 Fuzz testing: Parser25 (bug 6055)
15253 !! wikitext
15254 {{{
15255 |
15256 <LI CLASS=||
15257 >
15258 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15259 !! html
15260 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15261 </p>
15262 !! end
15263
15264 !!test
15265 Fuzz testing: URL adjacent extension (with space, clean)
15266 !! wikitext
15267 http://example.com <nowiki>junk</nowiki>
15268 !! html
15269 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15270 </p>
15271 !!end
15272
15273 !!test
15274 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15275 !! wikitext
15276 http://example.com<nowiki>junk</nowiki>
15277 !! html
15278 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15279 </p>
15280 !!end
15281
15282 !!test
15283 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15284 !! wikitext
15285 http://example.com<pre>junk</pre>
15286 !! html
15287 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15288
15289 !! html+tidy
15290 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15291 <pre>
15292 junk
15293 </pre>
15294 !!end
15295
15296 !!test
15297 Fuzz testing: image with bogus manual thumbnail
15298 !! wikitext
15299 [[Image:foobar.jpg|thumbnail= ]]
15300 !! html/php
15301 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
15302
15303 !! html/parsoid
15304 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,2,2]}' data-mw='{"errors":[{"key":"missing-thumbnail","message":"This thumbnail does not exist.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{},"dsr":[2,30,null,null]}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
15305 !!end
15306
15307 !! test
15308 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15309 !! wikitext
15310 <pre dir="&#10;"></pre>
15311 !! html
15312 <pre dir="&#10;"></pre>
15313
15314 !! end
15315
15316 !! test
15317 Parsing optional HTML elements (Bug 6171)
15318 !! options
15319 !! wikitext
15320 <table>
15321 <tr>
15322 <td> Some tabular data</td>
15323 <td> More tabular data ...
15324 <td> And yet som tabular data</td>
15325 </tr>
15326 </table>
15327 !! html
15328 <table>
15329 <tr>
15330 <td> Some tabular data</td>
15331 <td> More tabular data ...
15332 </td><td> And yet som tabular data</td>
15333 </tr>
15334 </table>
15335
15336 !! end
15337
15338 !! test
15339 Correct handling of <td>, <tr> (Bug 6171)
15340 !! options
15341 !! wikitext
15342 <table>
15343 <tr>
15344 <td> Some tabular data</td>
15345 <td> More tabular data ...</td>
15346 <td> And yet som tabular data</td>
15347 </tr>
15348 </table>
15349 !! html
15350 <table>
15351 <tr>
15352 <td> Some tabular data</td>
15353 <td> More tabular data ...</td>
15354 <td> And yet som tabular data</td>
15355 </tr>
15356 </table>
15357
15358 !! end
15359
15360
15361 !! test
15362 Parsing crashing regression (fr:JavaScript)
15363 !! wikitext
15364 </body></x>
15365 !! html
15366 <p>&lt;/body&gt;&lt;/x&gt;
15367 </p>
15368 !! end
15369
15370 !! test
15371 Inline wiki vs wiki block nesting
15372 !! wikitext
15373 '''Bold paragraph
15374
15375 New wiki paragraph
15376 !! html
15377 <p><b>Bold paragraph</b>
15378 </p><p>New wiki paragraph
15379 </p>
15380 !! end
15381
15382 # FIXME: The current php output is documented
15383 # and desired output is the parsoid target.
15384 !! test
15385 Inline HTML vs wiki block nesting
15386 !! wikitext
15387 <b>Bold paragraph
15388
15389 New wiki paragraph
15390 !! html/php
15391 <p><b>Bold paragraph
15392 </p><p>New wiki paragraph</b>
15393 </p>
15394 !! html/parsoid
15395 <p><b>Bold paragraph</b>
15396 </p><p>New wiki paragraph
15397 </p>
15398 !! end
15399
15400 # Original result was this:
15401 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
15402 # </p>
15403 # While that might be marginally more intuitive, maybe, the six-apostrophe
15404 # construct is clearly pathological and the result stated here (which is what
15405 # the parser actually does) is about as reasonable as anything.
15406 !!test
15407 Mixing markup for italics and bold
15408 !! options
15409 !! wikitext
15410 '''bold''''''bold''bolditalics'''''
15411 !! html
15412 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
15413 </p>
15414 !! end
15415
15416
15417 !! article
15418 Xyzzyx
15419 !! text
15420 Article for special page transclusion test
15421 !! endarticle
15422
15423 !! test
15424 Special page transclusion
15425 !! options
15426 !! wikitext
15427 {{Special:Prefixindex/Xyzzyx}}
15428 !! html
15429 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15430
15431 !! end
15432
15433 !! test
15434 Special page transclusion twice (bug 5021)
15435 !! options
15436 !! wikitext
15437 {{Special:Prefixindex/Xyzzyx}}
15438 {{Special:Prefixindex/Xyzzyx}}
15439 !! html
15440 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15441 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15442
15443 !! end
15444
15445 !! test
15446 Transclusion of default MediaWiki message
15447 !! wikitext
15448 {{MediaWiki:Mainpage}}
15449 !! html
15450 <p>Main Page
15451 </p>
15452 !! end
15453
15454 !! test
15455 Transclusion of nonexistent MediaWiki message
15456 !! wikitext
15457 {{MediaWiki:Mainpagexxx}}
15458 !! html
15459 <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>
15460 </p>
15461 !! end
15462
15463 !! test
15464 Transclusion of MediaWiki message with underscore
15465 !! wikitext
15466 {{MediaWiki:history_short}}
15467 !! html
15468 <p>History
15469 </p>
15470 !! end
15471
15472 !! test
15473 Transclusion of MediaWiki message with space
15474 !! wikitext
15475 {{MediaWiki:history short}}
15476 !! html
15477 <p>History
15478 </p>
15479 !! end
15480
15481 !! test
15482 Invalid header with following text
15483 !! wikitext
15484 = x = y
15485 !! html
15486 <p>= x = y
15487 </p>
15488 !! end
15489
15490
15491 !! test
15492 Section extraction test (section 0)
15493 !! options
15494 section=0
15495 !! wikitext
15496 start
15497 ==a==
15498 ===aa===
15499 ====aaa====
15500 ==b==
15501 ===ba===
15502 ===bb===
15503 ====bba====
15504 ===bc===
15505 ==c==
15506 ===ca===
15507 !! html
15508 start
15509 !! end
15510
15511 !! test
15512 Section extraction test (section 1)
15513 !! options
15514 section=1
15515 !! wikitext
15516 start
15517 ==a==
15518 ===aa===
15519 ====aaa====
15520 ==b==
15521 ===ba===
15522 ===bb===
15523 ====bba====
15524 ===bc===
15525 ==c==
15526 ===ca===
15527 !! html
15528 ==a==
15529 ===aa===
15530 ====aaa====
15531 !! end
15532
15533 !! test
15534 Section extraction test (section 2)
15535 !! options
15536 section=2
15537 !! wikitext
15538 start
15539 ==a==
15540 ===aa===
15541 ====aaa====
15542 ==b==
15543 ===ba===
15544 ===bb===
15545 ====bba====
15546 ===bc===
15547 ==c==
15548 ===ca===
15549 !! html
15550 ===aa===
15551 ====aaa====
15552 !! end
15553
15554 !! test
15555 Section extraction test (section 3)
15556 !! options
15557 section=3
15558 !! wikitext
15559 start
15560 ==a==
15561 ===aa===
15562 ====aaa====
15563 ==b==
15564 ===ba===
15565 ===bb===
15566 ====bba====
15567 ===bc===
15568 ==c==
15569 ===ca===
15570 !! html
15571 ====aaa====
15572 !! end
15573
15574 !! test
15575 Section extraction test (section 4)
15576 !! options
15577 section=4
15578 !! wikitext
15579 start
15580 ==a==
15581 ===aa===
15582 ====aaa====
15583 ==b==
15584 ===ba===
15585 ===bb===
15586 ====bba====
15587 ===bc===
15588 ==c==
15589 ===ca===
15590 !! html
15591 ==b==
15592 ===ba===
15593 ===bb===
15594 ====bba====
15595 ===bc===
15596 !! end
15597
15598 !! test
15599 Section extraction test (section 5)
15600 !! options
15601 section=5
15602 !! wikitext
15603 start
15604 ==a==
15605 ===aa===
15606 ====aaa====
15607 ==b==
15608 ===ba===
15609 ===bb===
15610 ====bba====
15611 ===bc===
15612 ==c==
15613 ===ca===
15614 !! html
15615 ===ba===
15616 !! end
15617
15618 !! test
15619 Section extraction test (section 6)
15620 !! options
15621 section=6
15622 !! wikitext
15623 start
15624 ==a==
15625 ===aa===
15626 ====aaa====
15627 ==b==
15628 ===ba===
15629 ===bb===
15630 ====bba====
15631 ===bc===
15632 ==c==
15633 ===ca===
15634 !! html
15635 ===bb===
15636 ====bba====
15637 !! end
15638
15639 !! test
15640 Section extraction test (section 7)
15641 !! options
15642 section=7
15643 !! wikitext
15644 start
15645 ==a==
15646 ===aa===
15647 ====aaa====
15648 ==b==
15649 ===ba===
15650 ===bb===
15651 ====bba====
15652 ===bc===
15653 ==c==
15654 ===ca===
15655 !! html
15656 ====bba====
15657 !! end
15658
15659 !! test
15660 Section extraction test (section 8)
15661 !! options
15662 section=8
15663 !! wikitext
15664 start
15665 ==a==
15666 ===aa===
15667 ====aaa====
15668 ==b==
15669 ===ba===
15670 ===bb===
15671 ====bba====
15672 ===bc===
15673 ==c==
15674 ===ca===
15675 !! html
15676 ===bc===
15677 !! end
15678
15679 !! test
15680 Section extraction test (section 9)
15681 !! options
15682 section=9
15683 !! wikitext
15684 start
15685 ==a==
15686 ===aa===
15687 ====aaa====
15688 ==b==
15689 ===ba===
15690 ===bb===
15691 ====bba====
15692 ===bc===
15693 ==c==
15694 ===ca===
15695 !! html
15696 ==c==
15697 ===ca===
15698 !! end
15699
15700 !! test
15701 Section extraction test (section 10)
15702 !! options
15703 section=10
15704 !! wikitext
15705 start
15706 ==a==
15707 ===aa===
15708 ====aaa====
15709 ==b==
15710 ===ba===
15711 ===bb===
15712 ====bba====
15713 ===bc===
15714 ==c==
15715 ===ca===
15716 !! html
15717 ===ca===
15718 !! end
15719
15720 !! test
15721 Section extraction test (nonexistent section 11)
15722 !! options
15723 section=11
15724 !! wikitext
15725 start
15726 ==a==
15727 ===aa===
15728 ====aaa====
15729 ==b==
15730 ===ba===
15731 ===bb===
15732 ====bba====
15733 ===bc===
15734 ==c==
15735 ===ca===
15736 !! html
15737 !! end
15738
15739 !! test
15740 Section extraction test with bogus heading (section 1)
15741 !! options
15742 section=1
15743 !! wikitext
15744 ==a==
15745 ==bogus== not a legal section
15746 ==b==
15747 !! html
15748 ==a==
15749 ==bogus== not a legal section
15750 !! end
15751
15752 !! test
15753 Section extraction test with bogus heading (section 2)
15754 !! options
15755 section=2
15756 !! wikitext
15757 ==a==
15758 ==bogus== not a legal section
15759 ==b==
15760 !! html
15761 ==b==
15762 !! end
15763
15764 !! test
15765 Section extraction test with comment after heading (section 1)
15766 !! options
15767 section=1
15768 !! wikitext
15769 ==a==
15770 ==b== <!-- -->
15771 ==c==
15772 !! html
15773 ==a==
15774 !! end
15775
15776 !! test
15777 Section extraction test with comment after heading (section 2)
15778 !! options
15779 section=2
15780 !! wikitext
15781 ==a==
15782 ==b== <!-- -->
15783 ==c==
15784 !! html
15785 ==b== <!-- -->
15786 !! end
15787
15788 !! test
15789 Section extraction test with bogus <nowiki> heading (section 1)
15790 !! options
15791 section=1
15792 !! wikitext
15793 ==a==
15794 ==bogus== <nowiki>not a legal section</nowiki>
15795 ==b==
15796 !! html
15797 ==a==
15798 ==bogus== <nowiki>not a legal section</nowiki>
15799 !! end
15800
15801 !! test
15802 Section extraction test with bogus <nowiki> heading (section 2)
15803 !! options
15804 section=2
15805 !! wikitext
15806 ==a==
15807 ==bogus== <nowiki>not a legal section</nowiki>
15808 ==b==
15809 !! html
15810 ==b==
15811 !! end
15812
15813
15814 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
15815 # instead of respecting commented sections
15816 !! test
15817 Section extraction prefixed by comment (section 1)
15818 !! options
15819 section=1
15820 !! wikitext
15821 <!-- -->==sec1==
15822 ==sec2==
15823 !! html
15824 ==sec2==
15825 !!end
15826
15827 !! test
15828 Section extraction prefixed by comment (section 2)
15829 !! options
15830 section=2
15831 !! wikitext
15832 <!-- -->==sec1==
15833 ==sec2==
15834 !! html
15835
15836 !!end
15837
15838
15839 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
15840 # instead of respecting HTML-style headings
15841 !! test
15842 Section extraction, mixed wiki and html (section 1)
15843 !! options
15844 section=1
15845 !! wikitext
15846 <h2>unmarked</h2>
15847 unmarked
15848 ==1==
15849 one
15850 ==2==
15851 two
15852 !! html
15853 ==1==
15854 one
15855 !! end
15856
15857 !! test
15858 Section extraction, mixed wiki and html (section 2)
15859 !! options
15860 section=2
15861 !! wikitext
15862 <h2>unmarked</h2>
15863 unmarked
15864 ==1==
15865 one
15866 ==2==
15867 two
15868 !! html
15869 ==2==
15870 two
15871 !! end
15872
15873
15874 # Formerly testing for bug 3342
15875 !! test
15876 Section extraction, heading surrounded by <noinclude>
15877 !! options
15878 section=1
15879 !! wikitext
15880 <noinclude>==unmarked==</noinclude>
15881 ==marked==
15882 !! html
15883 ==marked==
15884 !!end
15885
15886 # Test behavior of bug 19910
15887 !! test
15888 Sectiion with all-equals
15889 !! options
15890 section=2
15891 !! wikitext
15892 ===
15893 The line above must have a trailing space
15894 === <!--
15895 --> <!-- -->
15896 But just in case it doesn't...
15897 !! html
15898 === <!--
15899 --> <!-- -->
15900 But just in case it doesn't...
15901 !! end
15902
15903 !! test
15904 Section replacement test (section 0)
15905 !! options
15906 replace=0,"xxx"
15907 !! wikitext
15908 start
15909 ==a==
15910 ===aa===
15911 ====aaa====
15912 ==b==
15913 ===ba===
15914 ===bb===
15915 ====bba====
15916 ===bc===
15917 ==c==
15918 ===ca===
15919 !! html
15920 xxx
15921
15922 ==a==
15923 ===aa===
15924 ====aaa====
15925 ==b==
15926 ===ba===
15927 ===bb===
15928 ====bba====
15929 ===bc===
15930 ==c==
15931 ===ca===
15932 !! end
15933
15934 !! test
15935 Section replacement test (section 1)
15936 !! options
15937 replace=1,"xxx"
15938 !! wikitext
15939 start
15940 ==a==
15941 ===aa===
15942 ====aaa====
15943 ==b==
15944 ===ba===
15945 ===bb===
15946 ====bba====
15947 ===bc===
15948 ==c==
15949 ===ca===
15950 !! html
15951 start
15952 xxx
15953
15954 ==b==
15955 ===ba===
15956 ===bb===
15957 ====bba====
15958 ===bc===
15959 ==c==
15960 ===ca===
15961 !! end
15962
15963 !! test
15964 Section replacement test (section 2)
15965 !! options
15966 replace=2,"xxx"
15967 !! wikitext
15968 start
15969 ==a==
15970 ===aa===
15971 ====aaa====
15972 ==b==
15973 ===ba===
15974 ===bb===
15975 ====bba====
15976 ===bc===
15977 ==c==
15978 ===ca===
15979 !! html
15980 start
15981 ==a==
15982 xxx
15983
15984 ==b==
15985 ===ba===
15986 ===bb===
15987 ====bba====
15988 ===bc===
15989 ==c==
15990 ===ca===
15991 !! end
15992
15993 !! test
15994 Section replacement test (section 3)
15995 !! options
15996 replace=3,"xxx"
15997 !! wikitext
15998 start
15999 ==a==
16000 ===aa===
16001 ====aaa====
16002 ==b==
16003 ===ba===
16004 ===bb===
16005 ====bba====
16006 ===bc===
16007 ==c==
16008 ===ca===
16009 !! html
16010 start
16011 ==a==
16012 ===aa===
16013 xxx
16014
16015 ==b==
16016 ===ba===
16017 ===bb===
16018 ====bba====
16019 ===bc===
16020 ==c==
16021 ===ca===
16022 !! end
16023
16024 !! test
16025 Section replacement test (section 4)
16026 !! options
16027 replace=4,"xxx"
16028 !! wikitext
16029 start
16030 ==a==
16031 ===aa===
16032 ====aaa====
16033 ==b==
16034 ===ba===
16035 ===bb===
16036 ====bba====
16037 ===bc===
16038 ==c==
16039 ===ca===
16040 !! html
16041 start
16042 ==a==
16043 ===aa===
16044 ====aaa====
16045 xxx
16046
16047 ==c==
16048 ===ca===
16049 !! end
16050
16051 !! test
16052 Section replacement test (section 5)
16053 !! options
16054 replace=5,"xxx"
16055 !! wikitext
16056 start
16057 ==a==
16058 ===aa===
16059 ====aaa====
16060 ==b==
16061 ===ba===
16062 ===bb===
16063 ====bba====
16064 ===bc===
16065 ==c==
16066 ===ca===
16067 !! html
16068 start
16069 ==a==
16070 ===aa===
16071 ====aaa====
16072 ==b==
16073 xxx
16074
16075 ===bb===
16076 ====bba====
16077 ===bc===
16078 ==c==
16079 ===ca===
16080 !! end
16081
16082 !! test
16083 Section replacement test (section 6)
16084 !! options
16085 replace=6,"xxx"
16086 !! wikitext
16087 start
16088 ==a==
16089 ===aa===
16090 ====aaa====
16091 ==b==
16092 ===ba===
16093 ===bb===
16094 ====bba====
16095 ===bc===
16096 ==c==
16097 ===ca===
16098 !! html
16099 start
16100 ==a==
16101 ===aa===
16102 ====aaa====
16103 ==b==
16104 ===ba===
16105 xxx
16106
16107 ===bc===
16108 ==c==
16109 ===ca===
16110 !! end
16111
16112 !! test
16113 Section replacement test (section 7)
16114 !! options
16115 replace=7,"xxx"
16116 !! wikitext
16117 start
16118 ==a==
16119 ===aa===
16120 ====aaa====
16121 ==b==
16122 ===ba===
16123 ===bb===
16124 ====bba====
16125 ===bc===
16126 ==c==
16127 ===ca===
16128 !! html
16129 start
16130 ==a==
16131 ===aa===
16132 ====aaa====
16133 ==b==
16134 ===ba===
16135 ===bb===
16136 xxx
16137
16138 ===bc===
16139 ==c==
16140 ===ca===
16141 !! end
16142
16143 !! test
16144 Section replacement test (section 8)
16145 !! options
16146 replace=8,"xxx"
16147 !! wikitext
16148 start
16149 ==a==
16150 ===aa===
16151 ====aaa====
16152 ==b==
16153 ===ba===
16154 ===bb===
16155 ====bba====
16156 ===bc===
16157 ==c==
16158 ===ca===
16159 !! html
16160 start
16161 ==a==
16162 ===aa===
16163 ====aaa====
16164 ==b==
16165 ===ba===
16166 ===bb===
16167 ====bba====
16168 xxx
16169
16170 ==c==
16171 ===ca===
16172 !!end
16173
16174 !! test
16175 Section replacement test (section 9)
16176 !! options
16177 replace=9,"xxx"
16178 !! wikitext
16179 start
16180 ==a==
16181 ===aa===
16182 ====aaa====
16183 ==b==
16184 ===ba===
16185 ===bb===
16186 ====bba====
16187 ===bc===
16188 ==c==
16189 ===ca===
16190 !! html
16191 start
16192 ==a==
16193 ===aa===
16194 ====aaa====
16195 ==b==
16196 ===ba===
16197 ===bb===
16198 ====bba====
16199 ===bc===
16200 xxx
16201 !! end
16202
16203 !! test
16204 Section replacement test (section 10)
16205 !! options
16206 replace=10,"xxx"
16207 !! wikitext
16208 start
16209 ==a==
16210 ===aa===
16211 ====aaa====
16212 ==b==
16213 ===ba===
16214 ===bb===
16215 ====bba====
16216 ===bc===
16217 ==c==
16218 ===ca===
16219 !! html
16220 start
16221 ==a==
16222 ===aa===
16223 ====aaa====
16224 ==b==
16225 ===ba===
16226 ===bb===
16227 ====bba====
16228 ===bc===
16229 ==c==
16230 xxx
16231 !! end
16232
16233 !! test
16234 Section replacement test with initial whitespace (bug 13728)
16235 !! options
16236 replace=2,"xxx"
16237 !! wikitext
16238 Preformatted initial line
16239 ==a==
16240 ===a===
16241 !! html
16242 Preformatted initial line
16243 ==a==
16244 xxx
16245 !! end
16246
16247
16248 !! test
16249 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16250 !! options
16251 section=1
16252 !! wikitext
16253 ==a==
16254 a
16255 !! html
16256 ==a==
16257 a
16258 !! end
16259
16260 !! test
16261 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16262 !! options
16263 section=1
16264 !! wikitext
16265 ==a==
16266 a
16267 !! html
16268 ==a==
16269 a
16270 !! end
16271
16272
16273 !! test
16274 Section extraction, <pre> around bogus header (bug 10309)
16275 !! options
16276 noxml section=2
16277 !! wikitext
16278 == Section One ==
16279 <pre>
16280 =======
16281 </pre>
16282
16283 == Section Two ==
16284 stuff
16285 !! html
16286 == Section Two ==
16287 stuff
16288 !! end
16289
16290 !! test
16291 Section replacement, <pre> around bogus header (bug 10309)
16292 !! options
16293 noxml replace=2,"xxx"
16294 !! wikitext
16295 == Section One ==
16296 <pre>
16297 =======
16298 </pre>
16299
16300 == Section Two ==
16301 stuff
16302 !! html
16303 == Section One ==
16304 <pre>
16305 =======
16306 </pre>
16307
16308 xxx
16309 !! end
16310
16311
16312
16313 !! test
16314 Handling of &#x0A; in URLs
16315 !! wikitext
16316 ** irc://&#x0A;a
16317 !! html/php
16318 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16319
16320 !! html/parsoid
16321 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16322 a">irc://
16323 a</a></li></ul></li></ul>
16324 !! end
16325
16326 !! test
16327 Handling of %0A in URLs
16328 !! wikitext
16329 ** irc://%0Aa
16330 !! html/php
16331 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16332
16333 !! html/parsoid
16334 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16335 !! end
16336
16337
16338 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16339 !! test
16340 5 quotes, code coverage +1 line
16341 !! options
16342 parsoid=wt2html
16343 !! wikitext
16344 '''''
16345 !! html/php
16346 !! html/parsoid
16347 <p><b><i></i></b></p>
16348 !! end
16349
16350 # same html as previous, but wikitext adjusted to match parsoid html2wt
16351 # note that wt2html and html2html will put the <i> before the <b>
16352 !! test
16353 5 quotes, code coverage +1 line w/ nowiki (1)
16354 !! options
16355 parsoid=wt2wt,html2wt
16356 !! wikitext
16357 '''''<nowiki/>'''''
16358 !! html/php
16359 <p><i></i>
16360 </p>
16361 !! html/parsoid
16362 <p><b><i></i></b></p>
16363 !! end
16364
16365 # same as previous, just swapping the <i> and <b>
16366 !! test
16367 5 quotes, code coverage +1 line w/ nowiki (2)
16368 !! wikitext
16369 '''''<nowiki/>'''''
16370 !! html/php
16371 <p><i></i>
16372 </p>
16373 !! html/parsoid
16374 <p><i><b></b></i></p>
16375 !! end
16376
16377 !! test
16378 Special:Search page linking.
16379 !! wikitext
16380 {{Special:search}}
16381 !! html
16382 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16383 </p>
16384 !! end
16385
16386 !! test
16387 {{!}} is a magic word
16388 !! wikitext
16389 {{!}} is a magic word there and {{!}} is still a magic word here
16390 !! html/php
16391 <p>| is a magic word there and | is still a magic word here
16392 </p>
16393 !! html/parsoid
16394 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is still a magic word here</p>
16395 !! end
16396
16397 !! test
16398 Say the magic word
16399 !! options
16400 title=[[Parser test]]
16401 !! wikitext
16402 * {{PAGENAME}}
16403 * {{PAGENAMEE}}
16404 * {{FULLPAGENAME}}
16405 * {{FULLPAGENAMEE}}
16406 * {{BASEPAGENAME}}
16407 * {{BASEPAGENAMEE}}
16408 * {{SUBPAGENAME}}
16409 * {{SUBPAGENAMEE}}
16410 * {{ROOTPAGENAME}}
16411 * {{ROOTPAGENAMEE}}
16412 * {{TALKPAGENAME}}
16413 * {{TALKPAGENAMEE}}
16414 * {{SUBJECTPAGENAME}}
16415 * {{SUBJECTPAGENAMEE}}
16416 * {{NAMESPACEE}}
16417 * {{NAMESPACE}}
16418 * {{NAMESPACENUMBER}}
16419 * {{TALKSPACE}}
16420 * {{TALKSPACEE}}
16421 * {{SUBJECTSPACE}}
16422 * {{SUBJECTSPACEE}}
16423 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
16424 !! html
16425 <ul><li> Parser test</li>
16426 <li> Parser_test</li>
16427 <li> Parser test</li>
16428 <li> Parser_test</li>
16429 <li> Parser test</li>
16430 <li> Parser_test</li>
16431 <li> Parser test</li>
16432 <li> Parser_test</li>
16433 <li> Parser test</li>
16434 <li> Parser_test</li>
16435 <li> Talk:Parser test</li>
16436 <li> Talk:Parser_test</li>
16437 <li> Parser test</li>
16438 <li> Parser_test</li>
16439 <li> </li>
16440 <li> </li>
16441 <li> 0</li>
16442 <li> Talk</li>
16443 <li> Talk</li>
16444 <li> </li>
16445 <li> </li>
16446 <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>
16447
16448 !! end
16449 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
16450
16451 !! test
16452 Gallery
16453 !! wikitext
16454 <gallery>
16455 image1.png |
16456 image2.gif|||||
16457
16458 image3|
16459 image4 |300px| centre
16460 image5.svg| http://///////
16461 [[x|xx]]]]
16462 * image6
16463 </gallery>
16464 !! html
16465 <ul class="gallery mw-gallery-traditional">
16466 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16467 <div class="thumb" style="height: 150px;">Image1.png</div>
16468 <div class="gallerytext">
16469 </div>
16470 </div></li>
16471 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16472 <div class="thumb" style="height: 150px;">Image2.gif</div>
16473 <div class="gallerytext">
16474 <p>||||
16475 </p>
16476 </div>
16477 </div></li>
16478 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16479 <div class="thumb" style="height: 150px;">Image3</div>
16480 <div class="gallerytext">
16481 </div>
16482 </div></li>
16483 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16484 <div class="thumb" style="height: 150px;">Image4</div>
16485 <div class="gallerytext">
16486 <p>300px| centre
16487 </p>
16488 </div>
16489 </div></li>
16490 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16491 <div class="thumb" style="height: 150px;">Image5.svg</div>
16492 <div class="gallerytext">
16493 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
16494 </p>
16495 </div>
16496 </div></li>
16497 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16498 <div class="thumb" style="height: 150px;">* image6</div>
16499 <div class="gallerytext">
16500 </div>
16501 </div></li>
16502 </ul>
16503
16504 !! end
16505
16506 !! test
16507 Gallery (with options)
16508 !! wikitext
16509 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
16510 File:Nonexistent.jpg|caption
16511 File:Nonexistent.jpg
16512 image:foobar.jpg|some '''caption''' [[Main Page]]
16513 image:foobar.jpg
16514 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
16515 </gallery>
16516 !! html
16517 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
16518 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
16519 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16520 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16521 <div class="gallerytext">
16522 <p>caption
16523 </p>
16524 </div>
16525 </div></li>
16526 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16527 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16528 <div class="gallerytext">
16529 </div>
16530 </div></li>
16531 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16532 <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>
16533 <div class="gallerytext">
16534 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16535 </p>
16536 </div>
16537 </div></li>
16538 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16539 <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>
16540 <div class="gallerytext">
16541 </div>
16542 </div></li>
16543 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16544 <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>
16545 <div class="gallerytext">
16546 <p>Blabla|blabla.
16547 </p>
16548 </div>
16549 </div></li>
16550 </ul>
16551
16552 !! end
16553
16554 !! test
16555 Gallery with link that has fragment
16556 !! wikitext
16557 <gallery>
16558 image:foobar.jpg|link=Main_Page
16559 image:foobar.jpg|link=Main_Page#section
16560 image:foobar.jpg|link=Main Page#section|caption
16561 </gallery>
16562 !! html
16563 <ul class="gallery mw-gallery-traditional">
16564 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16565 <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>
16566 <div class="gallerytext">
16567 </div>
16568 </div></li>
16569 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16570 <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>
16571 <div class="gallerytext">
16572 </div>
16573 </div></li>
16574 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16575 <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>
16576 <div class="gallerytext">
16577 <p>caption
16578 </p>
16579 </div>
16580 </div></li>
16581 </ul>
16582
16583 !! end
16584
16585 !! test
16586 Gallery with wikitext inside caption
16587 !! wikitext
16588 <gallery>
16589 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
16590 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
16591 </gallery>
16592 !! html
16593 <ul class="gallery mw-gallery-traditional">
16594 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16595 <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>
16596 <div class="gallerytext">
16597 <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>
16598 </p>
16599 </div>
16600 </div></li>
16601 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16602 <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>
16603 <div class="gallerytext">
16604 <p>This is a test template
16605 </p>
16606 </div>
16607 </div></li>
16608 </ul>
16609
16610 !! end
16611
16612 !! test
16613 gallery (with showfilename option)
16614 !! wikitext
16615 <gallery showfilename>
16616 File:Nonexistent.jpg|caption
16617 File:Nonexistent.jpg
16618 image:foobar.jpg|some '''caption''' [[Main Page]]
16619 File:Foobar.jpg
16620 </gallery>
16621 !! html
16622 <ul class="gallery mw-gallery-traditional">
16623 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16624 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16625 <div class="gallerytext">
16626 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16627 caption
16628 </p>
16629 </div>
16630 </div></li>
16631 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16632 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16633 <div class="gallerytext">
16634 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16635 </p>
16636 </div>
16637 </div></li>
16638 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16639 <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>
16640 <div class="gallerytext">
16641 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16642 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16643 </p>
16644 </div>
16645 </div></li>
16646 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16647 <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>
16648 <div class="gallerytext">
16649 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16650 </p>
16651 </div>
16652 </div></li>
16653 </ul>
16654
16655 !! end
16656
16657 !! test
16658 Gallery (with namespace-less filenames)
16659 !! wikitext
16660 <gallery>
16661 File:Nonexistent.jpg
16662 Nonexistent.jpg
16663 image:foobar.jpg
16664 foobar.jpg
16665 </gallery>
16666 !! html
16667 <ul class="gallery mw-gallery-traditional">
16668 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16669 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16670 <div class="gallerytext">
16671 </div>
16672 </div></li>
16673 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16674 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16675 <div class="gallerytext">
16676 </div>
16677 </div></li>
16678 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16679 <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>
16680 <div class="gallerytext">
16681 </div>
16682 </div></li>
16683 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16684 <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>
16685 <div class="gallerytext">
16686 </div>
16687 </div></li>
16688 </ul>
16689
16690 !! end
16691
16692 !! test
16693 HTML Hex character encoding (spells the word "JavaScript")
16694 !! options
16695 parsoid=wt2html,wt2wt,html2html
16696 !! wikitext
16697 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
16698 !! html/php
16699 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
16700 </p>
16701 !! html/php+tidy
16702 <p>JavaScript</p>
16703 !! html/parsoid
16704 <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>
16705 !! end
16706
16707 !! test
16708 HTML Hex character encoding bogus encoding (bug 26437 regression check)
16709 !! wikitext
16710 &#xsee;&#XSEE;
16711 !! html/php
16712 <p>&amp;#xsee;&amp;#XSEE;
16713 </p>
16714 !! html/parsoid
16715 <p>&amp;#xsee;&amp;#XSEE;</p>
16716 !! end
16717
16718 !! test
16719 HTML Hex character encoding mixed case
16720 !! options
16721 parsoid=wt2html,wt2wt,html2html
16722 !! wikitext
16723 &#xEE;&#Xee;
16724 !! html/php
16725 <p>&#xee;&#xee;
16726 </p>
16727 !! html/php+tidy
16728 <p>îî</p>
16729 !! html/parsoid
16730 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
16731 !! end
16732
16733 !! test
16734 __FORCETOC__ override
16735 !! wikitext
16736 __NEWSECTIONLINK__
16737 __FORCETOC__
16738 !! html
16739 <p><br />
16740 </p>
16741 !! end
16742
16743 !! test
16744 ISBN code coverage
16745 !! wikitext
16746 ISBN 978-0-1234-56&#x20;789
16747 !! html
16748 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
16749 </p>
16750 !! html+tidy
16751 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
16752 !! end
16753
16754 !! test
16755 ISBN followed by 5 spaces
16756 !! wikitext
16757 ISBN
16758 !! html
16759 <p>ISBN
16760 </p>
16761 !! end
16762
16763 !! test
16764 Double ISBN
16765 !! wikitext
16766 ISBN ISBN 1234567890
16767 !! html
16768 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16769 </p>
16770 !! end
16771
16772 !! test
16773 ISBN with an X
16774 !! wikitext
16775 ISBN 3-462-04561-X
16776 !! html
16777 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
16778 </p>
16779 !! end
16780
16781 !! test
16782 ISBN with empty prefix (parsoid test)
16783 !! wikitext
16784 ISBN 1234567890
16785 !! html/parsoid
16786 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
16787 !! end
16788
16789 !! test
16790 Bug 22905: <abbr> followed by ISBN followed by </a>
16791 !! wikitext
16792 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
16793 !! html
16794 <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>
16795 </p>
16796 !! end
16797
16798 !! test
16799 Double RFC
16800 !! wikitext
16801 RFC RFC 1234
16802 !! html
16803 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
16804 </p>
16805 !! end
16806
16807 !! test
16808 Double RFC with a wiki link
16809 !! wikitext
16810 RFC [[RFC 1234]]
16811 !! html
16812 <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>
16813 </p>
16814 !! end
16815
16816 !! test
16817 RFC code coverage
16818 !! wikitext
16819 RFC 983&#x20;987
16820 !! html
16821 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
16822 </p>
16823 !! html+tidy
16824 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
16825 !! end
16826
16827 !! test
16828 Centre-aligned image
16829 !! wikitext
16830 [[Image:foobar.jpg|centre]]
16831 !! html
16832 <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>
16833
16834 !!end
16835
16836 !! test
16837 None-aligned image
16838 !! wikitext
16839 [[Image:foobar.jpg|none]]
16840 !! html
16841 <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>
16842
16843 !!end
16844
16845 !! test
16846 Width + Height sized image (using px) (height is ignored)
16847 !! wikitext
16848 [[Image:foobar.jpg|640x480px]]
16849 !! html
16850 <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>
16851 </p>
16852 !!end
16853
16854 !! test
16855 Width-sized image (using px, no following whitespace)
16856 !! wikitext
16857 [[Image:foobar.jpg|640px]]
16858 !! html
16859 <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>
16860 </p>
16861 !!end
16862
16863 !! test
16864 Width-sized image (using px, with following whitespace - test regression from r39467)
16865 !! wikitext
16866 [[Image:foobar.jpg|640px ]]
16867 !! html
16868 <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>
16869 </p>
16870 !!end
16871
16872 !! test
16873 Width-sized image (using px, with preceding whitespace - test regression from r39467)
16874 !! wikitext
16875 [[Image:foobar.jpg| 640px]]
16876 !! html
16877 <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>
16878 </p>
16879 !!end
16880
16881 !! test
16882 Image with page parameter
16883 !! options
16884 djvu
16885 !! wikitext
16886 [[File:LoremIpsum.djvu|page=2]]
16887 !! html/php
16888 <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>
16889 </p>
16890 !! html/parsoid
16891 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"page","ak":"page=2"}]}'><a href="./File:LoremIpsum.djvu" data-parsoid='{"a":{"href":"./File:LoremIpsum.djvu"},"sa":{}}'><img resource="./File:LoremIpsum.djvu" src="//example.com/images/5/5f/LoremIpsum.djvu" height="3508" width="2480" data-parsoid='{"a":{"resource":"./File:LoremIpsum.djvu","height":"3508","width":"2480"},"sa":{"resource":"File:LoremIpsum.djvu"}}'/></a></span></p>
16892 !! end
16893
16894 !! test
16895 Another italics / bold test
16896 !! wikitext
16897 ''' ''x'
16898 !! html
16899 <pre>'<i> </i>x'
16900 </pre>
16901 !!end
16902
16903 # FIXME: The php output seems broken. It's interleaving some open/close tags.
16904 !! test
16905 dt/dd/dl test
16906 !! wikitext
16907 :;;;::
16908 !! html/php
16909 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
16910
16911 !! html/parsoid
16912 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
16913
16914 !!end
16915
16916
16917 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
16918 !! test
16919 Images with the "|" character in the comment
16920 !! wikitext
16921 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
16922 !! html/php
16923 <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>
16924
16925 !! html/parsoid
16926 <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>
16927 !! end
16928
16929 !! test
16930 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
16931 !! wikitext
16932 <html><script>alert(1);</script></html>
16933 !! html
16934 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
16935 </p>
16936 !! end
16937
16938 !! test
16939 HTML with raw HTML ($wgRawHtml==true)
16940 !! options
16941 wgRawHtml=1
16942 !! wikitext
16943 <html><script>alert(1);</script></html>
16944 !! html
16945 <p><script>alert(1);</script>
16946 </p>
16947 !! end
16948
16949 !! test
16950 Parents of subpages, one level up
16951 !! options
16952 subpage title=[[Subpage test/L1/L2/L3]]
16953 !! wikitext
16954 [[../|L2]]
16955 !! html
16956 <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>
16957 </p>
16958 !! end
16959
16960
16961 !! test
16962 Parents of subpages, one level up, not named
16963 !! options
16964 subpage title=[[Subpage test/L1/L2/L3]]
16965 !! wikitext
16966 [[../]]
16967 !! html
16968 <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>
16969 </p>
16970 !! end
16971
16972
16973
16974 !! test
16975 Parents of subpages, two levels up
16976 !! options
16977 subpage title=[[Subpage test/L1/L2/L3]]
16978 !! wikitext
16979 [[../../|L1]]2
16980
16981 [[../../|L1]]l
16982 !! html
16983 <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
16984 </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>
16985 </p>
16986 !! end
16987
16988 !! test
16989 Parents of subpages, two levels up, without trailing slash or name.
16990 !! options
16991 subpage title=[[Subpage test/L1/L2/L3]]
16992 !! wikitext
16993 [[../..]]
16994 !! html
16995 <p>[[../..]]
16996 </p>
16997 !! end
16998
16999 !! test
17000 Parents of subpages, two levels up, with lots of extra trailing slashes.
17001 !! options
17002 subpage title=[[Subpage test/L1/L2/L3]]
17003 !! wikitext
17004 [[../../////]]
17005 !! html
17006 <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)">Subpage test/L1</a>
17007 </p>
17008 !! end
17009
17010 !! article
17011 Subpage test/L1/L2/L3Sibling
17012 !! text
17013 Sibling article
17014 !! endarticle
17015
17016 !! test
17017 Transclusion of a sibling page (one level up)
17018 !! options
17019 subpage title=[[Subpage test/L1/L2/L3]]
17020 !! wikitext
17021 {{../L3Sibling}}
17022 !! html
17023 <p>Sibling article
17024 </p>
17025 !! end
17026
17027 !! test
17028 Transclusion of a child page
17029 !! options
17030 subpage title=[[Subpage test/L1/L2]]
17031 !! wikitext
17032 {{/L3Sibling}}
17033 !! html
17034 <p>Sibling article
17035 </p>
17036 !! end
17037
17038 !! test
17039 Non-transclusion because of too many up levels
17040 !! options
17041 subpage title=[[Subpage test/L1/L2/L3]]
17042 !! wikitext
17043 {{../../../../More than parent}}
17044 !! html
17045 <p>{{../../../../More than parent}}
17046 </p>
17047 !! end
17048
17049 !! test
17050 Definition list code coverage
17051 !! wikitext
17052 ; title : def
17053 ; title : def
17054 ;title: def
17055 !! html/php
17056 <dl><dt> title &#160;</dt>
17057 <dd> def</dd>
17058 <dt> title&#160;</dt>
17059 <dd> def</dd>
17060 <dt>title</dt>
17061 <dd> def</dd></dl>
17062
17063 !! html/parsoid
17064 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17065 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17066 <dt>title</dt><dd> def</dd></dl>
17067 !! end
17068
17069 !! test
17070 Don't fall for the self-closing div
17071 !! wikitext
17072 <div>hello world</div/>
17073 !! html
17074 <div>hello world</div>
17075
17076 !! end
17077
17078 !! test
17079 MSGNW magic word
17080 !! wikitext
17081 {{MSGNW:msg}}
17082 !! html
17083 <p>&#91;&#91;:Template:Msg&#93;&#93;
17084 </p>
17085 !! end
17086
17087 !! test
17088 RAW magic word
17089 !! wikitext
17090 {{RAW:QUERTY}}
17091 !! html
17092 <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>
17093 </p>
17094 !! end
17095
17096 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
17097 !! test
17098 Always escape literal '>' in output, not just after '<'
17099 !! wikitext
17100 ><>
17101 !! html
17102 <p>&gt;&lt;&gt;
17103 </p>
17104 !! end
17105
17106 !! test
17107 Template caching
17108 !! wikitext
17109 {{Test}}
17110 {{Test}}
17111 !! html
17112 <p>This is a test template
17113 This is a test template
17114 </p>
17115 !! end
17116
17117
17118 !! article
17119 MediaWiki:Fake
17120 !! text
17121 ==header==
17122 !! endarticle
17123
17124 !! test
17125 Inclusion of !userCanEdit() content
17126 !! wikitext
17127 {{MediaWiki:Fake}}
17128 !! html
17129 <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>
17130
17131 !! end
17132
17133
17134 !! test
17135 Out-of-order TOC heading levels
17136 !! wikitext
17137 ==2==
17138 ======6======
17139 ===3===
17140 =1=
17141 =====5=====
17142 ==2==
17143 !! html
17144 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17145 <ul>
17146 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
17147 <ul>
17148 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
17149 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
17150 </ul>
17151 </li>
17152 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
17153 <ul>
17154 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
17155 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
17156 </ul>
17157 </li>
17158 </ul>
17159 </div>
17160
17161 <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>
17162 <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>
17163 <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>
17164 <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>
17165 <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>
17166 <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>
17167
17168 !! end
17169
17170
17171 !! test
17172 ISBN with a dummy number
17173 !! wikitext
17174 ISBN ---
17175 !! html
17176 <p>ISBN ---
17177 </p>
17178 !! end
17179
17180
17181 !! test
17182 ISBN with space-delimited number
17183 !! wikitext
17184 ISBN 92 9017 032 8
17185 !! html
17186 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
17187 </p>
17188 !! end
17189
17190
17191 !! test
17192 ISBN with multiple spaces, no number
17193 !! wikitext
17194 ISBN foo
17195 !! html
17196 <p>ISBN foo
17197 </p>
17198 !! end
17199
17200
17201 !! test
17202 ISBN length
17203 !! wikitext
17204 ISBN 123456789
17205
17206 ISBN 1234567890
17207
17208 ISBN 12345678901
17209 !! html
17210 <p>ISBN 123456789
17211 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17212 </p><p>ISBN 12345678901
17213 </p>
17214 !! end
17215
17216
17217 !! test
17218 ISBN with trailing year (bug 8110)
17219 !! wikitext
17220 ISBN 1-234-56789-0 - 2006
17221
17222 ISBN 1 234 56789 0 - 2006
17223 !! html
17224 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
17225 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
17226 </p>
17227 !! end
17228
17229
17230 !! test
17231 anchorencode
17232 !! wikitext
17233 {{anchorencode:foo bar©#%n}}
17234 !! html
17235 <p>foo_bar.C2.A9.23.25n
17236 </p>
17237 !! end
17238
17239 !! test
17240 anchorencode trims spaces
17241 !! wikitext
17242 {{anchorencode: __pretty__please__}}
17243 !! html
17244 <p>pretty_please
17245 </p>
17246 !! end
17247
17248 !! test
17249 anchorencode deals with links
17250 !! wikitext
17251 {{anchorencode: [[hello|world]] [[hi]]}}
17252 !! html
17253 <p>world_hi
17254 </p>
17255 !! end
17256
17257 !! test
17258 anchorencode deals with templates
17259 !! wikitext
17260 {{anchorencode: {{Foo}} }}
17261 !! html
17262 <p>FOO
17263 </p>
17264 !! end
17265
17266 !! test
17267 anchorencode encodes like the TOC generator: (bug 18431)
17268 !! wikitext
17269 === _ +:.3A%3A&&amp;]] ===
17270 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17271 __NOEDITSECTION__
17272 !! html
17273 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17274 <p>.2B:.3A.253A.26.26.5D.5D
17275 </p>
17276 !! end
17277
17278 !! test
17279 Bug 6200: blockquotes and paragraph formatting
17280 !! wikitext
17281 <blockquote>
17282 foo
17283 </blockquote>
17284
17285 bar
17286
17287 baz
17288 !! html
17289 <blockquote>
17290 <p>foo
17291 </p>
17292 </blockquote>
17293 <p>bar
17294 </p>
17295 <pre>baz
17296 </pre>
17297 !! end
17298
17299 !! test
17300 Bug 8293: Use of center tag ruins paragraph formatting
17301 !! wikitext
17302 <center>
17303 foo
17304 </center>
17305
17306 bar
17307
17308 baz
17309 !! html
17310 <center>
17311 <p>foo
17312 </p>
17313 </center>
17314 <p>bar
17315 </p>
17316 <pre>baz
17317 </pre>
17318 !! end
17319
17320 !!test
17321 Parsing of overlapping (improperly nested) inline html tags
17322 !! wikitext
17323 <span><s>x</span></s>
17324 !! html/php
17325 <p><span><s>x&lt;/span&gt;</s></span>
17326 </p>
17327 !! html/parsoid
17328 <p><span><s>x</s></span>
17329 </p>
17330 !!end
17331
17332 ###
17333 ### Language variants related tests
17334 ###
17335 !! test
17336 Self-link in language variants
17337 !! options
17338 title=[[Dunav]] language=sr
17339 !! wikitext
17340 Both [[Dunav]] and [[Дунав]] are names for this river.
17341 !! html
17342 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17343 </p>
17344 !!end
17345
17346 !! article
17347 Дуна
17348 !! text
17349 content
17350 !! endarticle
17351
17352 !! test
17353 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17354 !! options
17355 title=[[Duna]] language=sr
17356 !! wikitext
17357 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17358 !! html
17359 <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.
17360 </p>
17361 !! end
17362
17363 !! test
17364 Link to a section of a variant of this title shouldn't be parsed as self-link
17365 !! options
17366 title=[[Duna]] language=sr
17367 !! wikitext
17368 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
17369 !! html
17370 <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.
17371 </p>
17372 !! end
17373
17374 !! test
17375 Link to pages in language variants
17376 !! options
17377 language=sr
17378 !! wikitext
17379 Main Page can be written as [[Маин Паге]]
17380 !! html
17381 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
17382 </p>
17383 !!end
17384
17385
17386 !! test
17387 Multiple links to pages in language variants
17388 !! options
17389 language=sr
17390 !! wikitext
17391 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
17392 !! html
17393 <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>.
17394 </p>
17395 !!end
17396
17397
17398 !! test
17399 Simple template in language variants
17400 !! options
17401 language=sr
17402 !! wikitext
17403 {{тест}}
17404 !! html
17405 <p>This is a test template
17406 </p>
17407 !! end
17408
17409
17410 !! test
17411 Template with explicit namespace in language variants
17412 !! options
17413 language=sr
17414 !! wikitext
17415 {{Template:тест}}
17416 !! html
17417 <p>This is a test template
17418 </p>
17419 !! end
17420
17421
17422 !! test
17423 Basic test for template parameter in language variants
17424 !! options
17425 language=sr
17426 !! wikitext
17427 {{парамтест|param=foo}}
17428 !! html
17429 <p>This is a test template with parameter foo
17430 </p>
17431 !! end
17432
17433
17434 !! test
17435 Simple category in language variants
17436 !! options
17437 language=sr cat
17438 !! wikitext
17439 [[Category:МедиаWики Усер'с Гуиде]]
17440 !! html
17441 <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>
17442 !! end
17443
17444
17445 !! article
17446 Category:分类
17447 !! text
17448 blah
17449 !! endarticle
17450
17451 !! article
17452 Category:分類
17453 !! text
17454 blah
17455 !! endarticle
17456
17457 !! test
17458 Don't convert blue categorylinks to another variant (bug 33210)
17459 !! options
17460 language=zh cat
17461 !! wikitext
17462 [[A]][[Category:分类]]
17463 !! html
17464 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
17465 !! end
17466
17467
17468 !! test
17469 Stripping -{}- tags (language variants)
17470 !! options
17471 language=sr
17472 !! wikitext
17473 Latin proverb: -{Ne nuntium necare}-
17474 !! html
17475 <p>Latin proverb: Ne nuntium necare
17476 </p>
17477 !! end
17478
17479
17480 !! test
17481 Prevent conversion with -{}- tags (language variants)
17482 !! options
17483 language=sr variant=sr-ec
17484 !! wikitext
17485 Latinski: -{Ne nuntium necare}-
17486 !! html
17487 <p>Латински: Ne nuntium necare
17488 </p>
17489 !! end
17490
17491
17492 !! test
17493 Prevent conversion of text with -{}- tags (language variants)
17494 !! options
17495 language=sr variant=sr-ec
17496 !! wikitext
17497 Latinski: -{Ne nuntium necare}-
17498 !! html
17499 <p>Латински: Ne nuntium necare
17500 </p>
17501 !! end
17502
17503
17504 !! test
17505 Prevent conversion of links with -{}- tags (language variants)
17506 !! options
17507 language=sr variant=sr-ec
17508 !! wikitext
17509 -{[[Main Page]]}-
17510 !! html
17511 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17512 </p>
17513 !! end
17514
17515
17516 !! test
17517 -{}- tags within headlines (within html for parserConvert())
17518 !! options
17519 language=sr variant=sr-ec
17520 !! wikitext
17521 == -{Naslov}- ==
17522 !! html
17523 <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>
17524
17525 !! end
17526
17527
17528 !! test
17529 Explicit definition of language variant alternatives
17530 !! options
17531 language=zh variant=zh-tw
17532 !! wikitext
17533 -{zh:China;zh-tw:Taiwan}-, not China
17534 !! html
17535 <p>Taiwan, not China
17536 </p>
17537 !! end
17538
17539
17540 !! test
17541 Conversion around HTML tags
17542 !! options
17543 language=sr variant=sr-ec
17544 !! wikitext
17545 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
17546 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
17547 !! html
17548 <p>
17549 <span title="ЛаCтин">ски</span>
17550 </p>
17551 !! end
17552
17553
17554 !! test
17555 Explicit session-wise language variant mapping (A flag and - flag)
17556 !! options
17557 language=zh variant=zh-tw
17558 !! wikitext
17559 Taiwan is not China.
17560 But -{A|zh:China;zh-tw:Taiwan}- is China,
17561 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
17562 and -{China}- is China.
17563 !! html
17564 <p>Taiwan is not China.
17565 But Taiwan is Taiwan,
17566 (This should be stripped!)
17567 and China is China.
17568 </p>
17569 !! end
17570
17571 !! test
17572 Explicit session-wise language variant mapping (H flag for hide)
17573 !! options
17574 language=zh variant=zh-tw
17575 !! wikitext
17576 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
17577 Taiwan is China.
17578 !! html
17579 <p>(This should be stripped!)
17580 Taiwan is Taiwan.
17581 </p>
17582 !! end
17583
17584 !! test
17585 Adding explicit conversion rule for title (T flag)
17586 !! options
17587 language=zh variant=zh-tw showtitle
17588 !! wikitext
17589 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17590 !! html
17591 Taiwan
17592 <p>Should be stripped!
17593 </p>
17594 !! end
17595
17596 !! test
17597 Testing that changing the language variant here in the tests actually works
17598 !! options
17599 language=zh variant=zh showtitle
17600 !! wikitext
17601 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17602 !! html
17603 China
17604 <p>Should be stripped!
17605 </p>
17606 !! end
17607
17608 !! test
17609 Recursive conversion of alt and title attrs shouldn't clear converter state
17610 !! options
17611 language=zh variant=zh-cn showtitle
17612 !! wikitext
17613 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
17614 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
17615 !! html
17616 China
17617 <p>
17618 Should be stripped<span title="Exclamation">!</span>
17619 </p>
17620 !! end
17621
17622 !! test
17623 Bug 24072: more test on conversion rule for title
17624 !! options
17625 language=zh variant=zh-tw showtitle
17626 !! wikitext
17627 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17628 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
17629 !! html
17630 Taiwan
17631 <p>This should be stripped!
17632 This won't take interferes with the title rule.
17633 </p>
17634 !! end
17635
17636 !! test
17637 Partly disable title conversion if variant == main language code
17638 !! options
17639 language=zh variant=zh title=[[ZH]] showtitle
17640 !! wikitext
17641 -{T|zh-cn:CN;zh-tw:TW}-
17642 !! html
17643 ZH
17644 <p>
17645 </p>
17646 !! end
17647
17648 !! test
17649 Partly disable title conversion if variant == main language code, more
17650 !! options
17651 language=zh variant=zh title=[[ZH]] showtitle
17652 !! wikitext
17653 -{T|TW}-
17654 !! html
17655 ZH
17656 <p>
17657 </p>
17658 !! end
17659
17660 !! test
17661 Raw output of variant escape tags (R flag)
17662 !! options
17663 language=zh variant=zh-tw
17664 !! wikitext
17665 Raw: -{R|zh:China;zh-tw:Taiwan}-
17666 !! html
17667 <p>Raw: zh:China;zh-tw:Taiwan
17668 </p>
17669 !! end
17670
17671 !! test
17672 Nested using of manual convert syntax
17673 !! options
17674 language=zh variant=zh-hk
17675 !! wikitext
17676 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
17677 !! html
17678 <p>Nested: Hello Hong Kong!
17679 </p>
17680 !! end
17681
17682 !! test
17683 Proper conversion of text in external links
17684 !! options
17685 language=sr variant=sr-ec
17686 !! wikitext
17687 http://www.google.com
17688 gopher://www.google.com
17689 [http://www.google.com http://www.google.com]
17690 [gopher://www.google.com gopher://www.google.com]
17691 [https://www.google.com irc://www.google.com]
17692 [ftp://www.google.com www.google.com/ftp://dir]
17693 [//www.google.com www.google.com]
17694 !! html
17695 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17696 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17697 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17698 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17699 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
17700 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
17701 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
17702 </p>
17703 !! end
17704
17705 !! test
17706 Do not convert roman numbers to language variants
17707 !! options
17708 language=sr variant=sr-ec
17709 !! wikitext
17710 Fridrih IV je car.
17711 !! html
17712 <p>Фридрих IV је цар.
17713 </p>
17714 !! end
17715
17716 !! test
17717 Unclosed language converter markup "-{"
17718 !! options
17719 language=sr
17720 !! wikitext
17721 -{T|hello
17722 !! html
17723 <p>-{T|hello
17724 </p>
17725 !! end
17726
17727 !! test
17728 Don't convert raw rule "-{R|=&gt;}-" to "=>"
17729 !! options
17730 language=sr
17731 !! wikitext
17732 -{R|=&gt;}-
17733 !! html
17734 <p>=&gt;
17735 </p>
17736 !!end
17737
17738 !! test
17739 Don't break link parsing if language converter markup is in the caption.
17740 !! options
17741 language=sr variant=sr-ec
17742 !! wikitext
17743 [[Main Page|-{R|main page}-]]
17744 !! html
17745 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
17746 </p>
17747 !! end
17748
17749 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17750 !! test
17751 Don't break image parsing if language converter markup is in the caption.
17752 !! options
17753 language=sr
17754 !! wikitext
17755 [[File:Foobar.jpg|-{R|caption}-]]
17756 !! html/parsoid
17757 <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>
17758 </p>
17759 !! end
17760
17761 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17762 !! test
17763 Don't break list handling if language converter markup is in the item.
17764 !! options
17765 language=zh variant=zh-cn
17766 !! wikitext
17767 ;-{zh-cn:AAA;zh-tw:BBB}-
17768 !! html/php
17769 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
17770
17771 !! html/parsoid
17772 <dl><dt>AAA
17773 </dt></dl>
17774 !! end
17775
17776 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17777 !! test
17778 Don't break table handling if language converter markup is in the cell.
17779 !! options
17780 language=sr variant=sr-ec
17781 !! wikitext
17782 {|
17783 |-
17784 | -{R|B}-
17785 |}
17786 !! html/php
17787 <table>
17788
17789 <tr>
17790 <td>Б}-
17791 </td></tr></table>
17792
17793 !! html/parsoid
17794 <table>
17795
17796 <tr>
17797 <td> B
17798 </td></tr></table>
17799
17800 !! end
17801
17802 !! test
17803 Bug 529: Uncovered bullet
17804 !! wikitext
17805 * Foo {{bullet}}
17806 !! html
17807 <ul><li> Foo </li>
17808 <li> Bar</li></ul>
17809
17810 !! end
17811
17812 # Plain MediaWiki does not remove empty lists, but tidy actually does.
17813 # Templates in Wikipedia rely on this behavior, as tidy has always been
17814 # enabled there. These tests are normally run *without* tidy, so specify the
17815 # full output here.
17816 # To test realistic parsing behavior, apply a tidy-like transformation to both
17817 # the expected output and your parser's output.
17818 !! test
17819 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
17820 !! wikitext
17821 ******* Foo {{bullet}}
17822 !! html
17823 <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>
17824 <li> Bar</li></ul>
17825
17826 !! end
17827
17828 !! test
17829 Bug 529: Uncovered table already at line-start
17830 !! wikitext
17831 x
17832
17833 {{table}}
17834 y
17835 !! html
17836 <p>x
17837 </p>
17838 <table>
17839 <tr>
17840 <td> 1 </td>
17841 <td> 2
17842 </td></tr>
17843 <tr>
17844 <td> 3 </td>
17845 <td> 4
17846 </td></tr></table>
17847 <p>y
17848 </p>
17849 !! end
17850
17851 !! test
17852 Bug 529: Uncovered bullet in parser function result
17853 !! wikitext
17854 * Foo {{lc:{{bullet}} }}
17855 !! html
17856 <ul><li> Foo </li>
17857 <li> bar</li></ul>
17858
17859 !! end
17860
17861 !! test
17862 Bug 5678: Double-parsed template argument
17863 !! wikitext
17864 {{lc:{{{1}}}|hello}}
17865 !! html
17866 <p>{{{1}}}
17867 </p>
17868 !! end
17869
17870 !! test
17871 Bug 5678: Double-parsed template invocation
17872 !! wikitext
17873 {{lc:{{paramtest {{!}} param = hello }} }}
17874 !! html
17875 <p>{{paramtest | param = hello }}
17876 </p>
17877 !! end
17878
17879 !! test
17880 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
17881 !! options
17882 language=cs
17883 title=[[Main Page]]
17884 !! wikitext
17885 {{PRVNÍVELKÉ:ěščř}}
17886 {{prvnívelké:ěščř}}
17887 {{PRVNÍMALÉ:ěščř}}
17888 {{prvnímalé:ěščř}}
17889 {{MALÁ:ěščř}}
17890 {{malá:ěščř}}
17891 {{VELKÁ:ěščř}}
17892 {{velká:ěščř}}
17893 !! html
17894 <p>Ěščř
17895 Ěščř
17896 ěščř
17897 ěščř
17898 ěščř
17899 ěščř
17900 ĚŠČŘ
17901 ĚŠČŘ
17902 </p>
17903 !! end
17904
17905 !! test
17906 Morwen/13: Unclosed link followed by heading
17907 !! wikitext
17908 [[link
17909 ==heading==
17910 !! html
17911 <p>[[link
17912 </p>
17913 <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>
17914
17915 !! end
17916
17917 !! test
17918 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
17919 !! wikitext
17920 {{foo|
17921 =heading=
17922 !! html
17923 <p>{{foo|
17924 </p>
17925 <h1><span class="mw-headline" id="heading">heading</span></h1>
17926
17927 !! end
17928
17929 !! test
17930 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
17931 !! wikitext
17932 {{foo|
17933 ==heading==
17934 !! html
17935 <p>{{foo|
17936 </p>
17937 <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>
17938
17939 !! end
17940
17941 !! test
17942 Tildes in comments
17943 !! options
17944 pst
17945 !! wikitext
17946 <!-- ~~~~ -->
17947 !! html
17948 <!-- ~~~~ -->
17949 !! end
17950
17951 !! test
17952 Paragraphs inside divs (no extra line breaks)
17953 !! wikitext
17954 <div>Line one
17955
17956 Line two</div>
17957 !! html
17958 <div>Line one
17959 Line two</div>
17960
17961 !! end
17962
17963 !! test
17964 Paragraphs inside divs (extra line break on open)
17965 !! wikitext
17966 <div>
17967 Line one
17968
17969 Line two</div>
17970 !! html
17971 <div>
17972 <p>Line one
17973 </p>
17974 Line two</div>
17975
17976 !! end
17977
17978 !! test
17979 Paragraphs inside divs (extra line break on close)
17980 !! wikitext
17981 <div>Line one
17982
17983 Line two
17984 </div>
17985 !! html
17986 <div>Line one
17987 <p>Line two
17988 </p>
17989 </div>
17990
17991 !! end
17992
17993 !! test
17994 Paragraphs inside divs (extra line break on open and close)
17995 !! wikitext
17996 <div>
17997 Line one
17998
17999 Line two
18000 </div>
18001 !! html
18002 <div>
18003 <p>Line one
18004 </p><p>Line two
18005 </p>
18006 </div>
18007
18008 !! end
18009
18010 !! test
18011 Nesting tags, paragraphs on lines which begin with <div>
18012 !! wikitext
18013 <div></div><strong>A
18014 B</strong>
18015 !! html/php+tidy
18016 <p><strong>A</strong></p>
18017 <p><strong>B</strong></p>
18018 !! html/parsoid
18019 <div></div>
18020 <p><strong>A
18021 B</strong>
18022 </p>
18023 !! end
18024
18025 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
18026 !! test
18027 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
18028 !! wikitext
18029 <blockquote>Line one
18030
18031 Line two</blockquote>
18032 !! html
18033 <blockquote>Line one
18034 Line two</blockquote>
18035
18036 !! html+tidy
18037 <blockquote>
18038 <p>Line one Line two</p>
18039 </blockquote>
18040 !! end
18041
18042 !! test
18043 Bug 6200: paragraphs inside blockquotes (extra line break on open)
18044 !! wikitext
18045 <blockquote>
18046 Line one
18047
18048 Line two</blockquote>
18049 !! html
18050 <blockquote>
18051 <p>Line one
18052 </p>
18053 Line two</blockquote>
18054
18055 !! html+tidy
18056 <blockquote>
18057 <p>Line one</p>
18058 Line two</blockquote>
18059 !! end
18060
18061 !! test
18062 Bug 6200: paragraphs inside blockquotes (extra line break on close)
18063 !! wikitext
18064 <blockquote>Line one
18065
18066 Line two
18067 </blockquote>
18068 !! html
18069 <blockquote>Line one
18070 <p>Line two
18071 </p>
18072 </blockquote>
18073
18074 !! html+tidy
18075 <blockquote>
18076 <p>Line one</p>
18077 <p>Line two</p>
18078 </blockquote>
18079 !! end
18080
18081 !! test
18082 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
18083 !! wikitext
18084 <blockquote>
18085 Line one
18086
18087 Line two
18088 </blockquote>
18089 !! html
18090 <blockquote>
18091 <p>Line one
18092 </p><p>Line two
18093 </p>
18094 </blockquote>
18095
18096 !! html+tidy
18097 <blockquote>
18098 <p>Line one</p>
18099 <p>Line two</p>
18100 </blockquote>
18101 !! end
18102
18103 !! test
18104 Paragraphs inside blockquotes/divs (no extra line breaks)
18105 !! wikitext
18106 <blockquote><div>Line one
18107
18108 Line two</div></blockquote>
18109 !! html
18110 <blockquote><div>Line one
18111 Line two</div></blockquote>
18112
18113 !! end
18114
18115 !! test
18116 Paragraphs inside blockquotes/divs (extra line break on open)
18117 !! wikitext
18118 <blockquote><div>
18119 Line one
18120
18121 Line two</div></blockquote>
18122 !! html
18123 <blockquote><div>
18124 <p>Line one
18125 </p>
18126 Line two</div></blockquote>
18127
18128 !! end
18129
18130 !! test
18131 Paragraphs inside blockquotes/divs (extra line break on close)
18132 !! wikitext
18133 <blockquote><div>Line one
18134
18135 Line two
18136 </div></blockquote>
18137 !! html
18138 <blockquote><div>Line one
18139 <p>Line two
18140 </p>
18141 </div></blockquote>
18142
18143 !! end
18144
18145 !! test
18146 Paragraphs inside blockquotes/divs (extra line break on open and close)
18147 !! wikitext
18148 <blockquote><div>
18149 Line one
18150
18151 Line two
18152 </div></blockquote>
18153 !! html
18154 <blockquote><div>
18155 <p>Line one
18156 </p><p>Line two
18157 </p>
18158 </div></blockquote>
18159
18160 !! end
18161
18162 !! test
18163 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
18164 !! options
18165 wgLinkHolderBatchSize=0
18166 !! wikitext
18167 [[meatball:1]]
18168 [[meatball:2]]
18169 [[meatball:3]]
18170 !! html
18171 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
18172 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
18173 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
18174 </p>
18175 !! end
18176
18177 !! test
18178 Free external link invading image caption
18179 !! wikitext
18180 [[Image:Foobar.jpg|thumb|http://x|hello]]
18181 !! html
18182 <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>
18183
18184 !! end
18185
18186 !! test
18187 Bug 15196: localised external link numbers
18188 !! options
18189 language=fa
18190 !! wikitext
18191 [http://en.wikipedia.org/]
18192 !! html/php
18193 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
18194 </p>
18195 !! html/parsoid
18196 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
18197 !! end
18198
18199 !! test
18200 Multibyte character in padleft
18201 !! wikitext
18202 {{padleft:-Hello|7|Æ}}
18203 !! html
18204 <p>Æ-Hello
18205 </p>
18206 !! end
18207
18208 !! test
18209 Multibyte character in padright
18210 !! wikitext
18211 {{padright:Hello-|7|Æ}}
18212 !! html
18213 <p>Hello-Æ
18214 </p>
18215 !! end
18216
18217 !!test
18218 formatdate parser function
18219 !! wikitext
18220 {{#formatdate:2009-03-24}}
18221 !! html
18222 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
18223 </p>
18224 !! end
18225
18226 !!test
18227 formatdate parser function, with default format
18228 !! wikitext
18229 {{#formatdate:2009-03-24|mdy}}
18230 !! html
18231 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
18232 </p>
18233 !! end
18234
18235 !! test
18236 Spacing of numbers in formatted dates
18237 !! wikitext
18238 {{#formatdate:January 15}}
18239 !! html
18240 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18241 </p>
18242 !! end
18243
18244 !! test
18245 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
18246 !! options
18247 language=nl title=[[MediaWiki:Common.css]]
18248 !! wikitext
18249 {{#formatdate:2009-03-24|dmy}}
18250 !! html
18251 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18252 </p>
18253 !! end
18254
18255 #
18256 #
18257 #
18258
18259 #
18260 # Edit comments
18261 #
18262
18263 !! test
18264 Edit comment with link
18265 !! options
18266 comment
18267 !! wikitext
18268 I like the [[Main Page]] a lot
18269 !! html
18270 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18271 !!end
18272
18273 !! test
18274 Edit comment with link and link text
18275 !! options
18276 comment
18277 !! wikitext
18278 I like the [[Main Page|best pages]] a lot
18279 !! html
18280 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18281 !!end
18282
18283 !! test
18284 Edit comment with link and link text with suffix
18285 !! options
18286 comment
18287 !! wikitext
18288 I like the [[Main Page|best page]]s a lot
18289 !! html
18290 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18291 !!end
18292
18293 !! test
18294 Edit comment with section link (non-local, eg in history list)
18295 !! options
18296 comment title=[[Main Page]]
18297 !! wikitext
18298 /* External links */ removed bogus entries
18299 !! html
18300 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18301 !!end
18302
18303 !! test
18304 Edit comment with section link and text before it (non-local, eg in history list)
18305 !! options
18306 comment title=[[Main Page]]
18307 !! wikitext
18308 pre-comment text /* External links */ removed bogus entries
18309 !! html
18310 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>
18311 !!end
18312
18313 !! test
18314 Edit comment with section link (local, eg in diff view)
18315 !! options
18316 comment local title=[[Main Page]]
18317 !! wikitext
18318 /* External links */ removed bogus entries
18319 !! html
18320 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18321 !!end
18322
18323 !! test
18324 Edit comment with subpage link (bug 14080)
18325 !! options
18326 comment
18327 subpage
18328 title=[[Subpage test]]
18329 !! wikitext
18330 Poked at a [[/subpage]] here...
18331 !! html
18332 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
18333 !!end
18334
18335 !! test
18336 Edit comment with subpage link and link text (bug 14080)
18337 !! options
18338 comment
18339 subpage
18340 title=[[Subpage test]]
18341 !! wikitext
18342 Poked at a [[/subpage|neat little page]] here...
18343 !! html
18344 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
18345 !!end
18346
18347 !! test
18348 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
18349 !! options
18350 comment
18351 title=[[Subpage test]]
18352 !! wikitext
18353 Poked at a [[/subpage]] here...
18354 !! html
18355 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...
18356 !!end
18357
18358 !! test
18359 Edit comment with bare anchor link (local, as on diff)
18360 !! options
18361 comment
18362 local
18363 title=[[Main Page]]
18364 !! wikitext
18365 [[#section]]
18366 !! html
18367 <a href="#section">#section</a>
18368 !! end
18369
18370 !! test
18371 Edit comment with bare anchor link (non-local, as on history)
18372 !! options
18373 comment
18374 title=[[Main Page]]
18375 !! wikitext
18376 [[#section]]
18377 !! html
18378 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
18379 !! end
18380
18381 !! test
18382 Anchor starting with underscore
18383 !! wikitext
18384 [[#_ref|One]]
18385 !! html
18386 <p><a href="#_ref">One</a>
18387 </p>
18388 !! end
18389
18390 !! test
18391 Id starting with underscore
18392 !! wikitext
18393 <div id="_ref"></div>
18394 !! html
18395 <div id="_ref"></div>
18396
18397 !! end
18398
18399 !! test
18400 Space normalisation on autocomment (bug 22784)
18401 !! options
18402 comment
18403 title=[[Main Page]]
18404 !! wikitext
18405 /* __hello__world__ */
18406 !! html
18407 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
18408 !! end
18409
18410 !! test
18411 percent-encoding and + signs in comments (Bug 26410)
18412 !! options
18413 comment
18414 !! wikitext
18415 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
18416 !! html
18417 <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>
18418 !! end
18419
18420 # Parsoid doesn't support this yet: see bug 73581
18421 # but it *should* omit the 'src' attribute if the image is bad.
18422 # PHP side of tests was disabled in
18423 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
18424 # because of issues in the PHP parserTests infrastructure
18425 # (but the output below is indeed what the PHP side emits)
18426 !! test
18427 Bad images - basic functionality
18428 !! wikitext
18429 [[File:Bad.jpg]]
18430 !! DISABLED/html/php
18431 !! html/parsoid
18432 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span></p>
18433 !! end
18434
18435 !! test
18436 Bad images - bug 16039: text after bad image disappears
18437 !! wikitext
18438 Foo bar
18439 [[File:Bad.jpg]]
18440 Bar foo
18441 !! DISABLED/html/php
18442 <p>Foo bar
18443 </p><p>Bar foo
18444 </p>
18445 !! html/parsoid
18446 <p>Foo bar
18447 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span>
18448 Bar foo</p>
18449 !! end
18450
18451 !! test
18452 Verify that displaytitle works (bug #22501) no displaytitle
18453 !! options
18454 showtitle
18455 !! config
18456 wgAllowDisplayTitle=true
18457 wgRestrictDisplayTitle=false
18458 !! wikitext
18459 this is not the the title
18460 !! html
18461 Parser test
18462 <p>this is not the the title
18463 </p>
18464 !! end
18465
18466 !! test
18467 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
18468 !! options
18469 showtitle
18470 title=[[Screen]]
18471 !! config
18472 wgAllowDisplayTitle=true
18473 wgRestrictDisplayTitle=false
18474 !! wikitext
18475 this is not the the title
18476 {{DISPLAYTITLE:whatever}}
18477 !! html
18478 whatever
18479 <p>this is not the the title
18480 </p>
18481 !! end
18482
18483 !! test
18484 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
18485 !! options
18486 showtitle
18487 title=[[Screen]]
18488 !! config
18489 wgAllowDisplayTitle=true
18490 wgRestrictDisplayTitle=true
18491 !! wikitext
18492 this is not the the title
18493 {{DISPLAYTITLE:whatever}}
18494 !! html
18495 Screen
18496 <p>this is not the the title
18497 </p>
18498 !! end
18499
18500 !! test
18501 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
18502 !! options
18503 showtitle
18504 title=[[Screen]]
18505 !! config
18506 wgAllowDisplayTitle=true
18507 wgRestrictDisplayTitle=true
18508 !! wikitext
18509 this is not the the title
18510 {{DISPLAYTITLE:screen}}
18511 !! html
18512 screen
18513 <p>this is not the the title
18514 </p>
18515 !! end
18516
18517 !! test
18518 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
18519 !! options
18520 showtitle
18521 title=[[Screen]]
18522 !! config
18523 wgAllowDisplayTitle=false
18524 !! wikitext
18525 this is not the the title
18526 {{DISPLAYTITLE:screen}}
18527 !! html
18528 Screen
18529 <p>this is not the the title
18530 <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>
18531 </p>
18532 !! end
18533
18534 !! test
18535 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
18536 !! options
18537 showtitle
18538 title=[[Screen]]
18539 !! config
18540 wgAllowDisplayTitle=false
18541 !! wikitext
18542 this is not the the title
18543 !! html
18544 Screen
18545 <p>this is not the the title
18546 </p>
18547 !! end
18548
18549 !! test
18550 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
18551 !! options
18552 showtitle
18553 title=[[Screen]]
18554 !! config
18555 wgAllowDisplayTitle=true
18556 wgRestrictDisplayTitle=true
18557 !! wikitext
18558 this is not the the title
18559 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
18560 !! html
18561 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
18562 <p>this is not the the title
18563 </p>
18564 !! end
18565
18566 !! test
18567 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
18568 !! options
18569 showtitle
18570 title=[[Screen]]
18571 !! config
18572 wgAllowDisplayTitle=true
18573 wgRestrictDisplayTitle=true
18574 !! wikitext
18575 this is not the the title
18576 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
18577 !! html
18578 <span style="color: red;">s</span>creen
18579 <p>this is not the the title
18580 </p>
18581 !! end
18582
18583 !! test
18584 preload: check <noinclude> and <includeonly>
18585 !! options
18586 preload
18587 !! wikitext
18588 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
18589 !! html
18590 Hello kind world.
18591 !! end
18592
18593 !! test
18594 preload: check <onlyinclude>
18595 !! options
18596 preload
18597 !! wikitext
18598 Goodbye <onlyinclude>Hello world</onlyinclude>
18599 !! html
18600 Hello world
18601 !! end
18602
18603 !! test
18604 preload: can pass tags through if we want to
18605 !! options
18606 preload
18607 !! wikitext
18608 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
18609 !! html
18610 <includeonly>Hello world</includeonly>
18611 !! end
18612
18613 !! test
18614 preload: check that it doesn't try to do tricks
18615 !! options
18616 preload
18617 !! wikitext
18618 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18619 !! html
18620 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18621 !! end
18622
18623 !! test
18624 Play a bit with r67090 and bug 3158
18625 !! wikitext
18626 <div style="width:50% !important">&nbsp;</div>
18627 <div style="width:50%&nbsp;!important">&nbsp;</div>
18628 <div style="width:50%&#160;!important">&nbsp;</div>
18629 <div style="border : solid;">&nbsp;</div>
18630 !! html/php
18631 <div style="width:50% !important">&#160;</div>
18632 <div style="width:50% !important">&#160;</div>
18633 <div style="width:50% !important">&#160;</div>
18634 <div style="border&#160;: solid;">&#160;</div>
18635
18636 !! html/parsoid
18637 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18638 <div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&amp;nbsp;!important"}}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18639 <div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&amp;#160;!important"}}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18640 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18641
18642 !! end
18643
18644 !! test
18645 HTML5 data attributes
18646 !! wikitext
18647 <span data-foo="bar">Baz</span>
18648 <p data-abc-def_hij="">Quuz</p>
18649 !! html
18650 <p><span data-foo="bar">Baz</span>
18651 </p>
18652 <p data-abc-def_hij="">Quuz</p>
18653
18654 !! end
18655
18656 !! test
18657 percent-encoding and + signs in internal links (Bug 26410)
18658 !! wikitext
18659 [[User:+%]] [[Page+title%]]
18660 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
18661 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
18662 [[%33%45]] [[%33%45+]]
18663 !! html/php
18664 <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>
18665 <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>
18666 <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>
18667 <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>
18668 </p>
18669 !! html/parsoid
18670 <p><a rel="mw:WikiLink" href="User:+%" title="User:+%">User:+%</a> <a rel="mw:WikiLink" href="Page+title%" title="Page+title%">Page+title%</a> <a rel="mw:WikiLink" href="%+" title="%+">%+</a> <a rel="mw:WikiLink" href="%+" title="%+">%20</a> <a rel="mw:WikiLink" href="%+" title="%+">%+ </a> <a rel="mw:WikiLink" href="%+r" title="%+r">%+r</a> <a rel="mw:WikiLink" href="%" title="%">%</a> <a rel="mw:WikiLink" href="+" title="+">+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"[[bar]]"}'><a href="File:%+abc9"><img resource="./File:%25+abc9" src="./Special:FilePath/%+abc9" height="220" width="220"/></a></span> <a rel="mw:WikiLink" href="3E" title="3E">3E</a> <a rel="mw:WikiLink" href="3E+" title="3E+">3E+</a></p>
18671 !! end
18672
18673 !! test
18674 Special characters in embedded file links (bug 27679)
18675 !! wikitext
18676 [[File:Contains & ampersand.jpg]]
18677 [[File:Does not exist.jpg|Title with & ampersand]]
18678 !! html/php
18679 <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>
18680 <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>
18681 </p>
18682 !! html/parsoid
18683 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="File:Contains_&amp;_ampersand.jpg"><img resource="./File:Contains_&amp;_ampersand.jpg" src="./Special:FilePath/Contains_&amp;_ampersand.jpg" height="220" width="220"/></a></span>
18684 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"Title with &amp; ampersand"}'><a href="File:Does_not_exist.jpg"><img resource="./File:Does_not_exist.jpg" src="./Special:FilePath/Does_not_exist.jpg" height="220" width="220"/></a></span></p>
18685 !! end
18686
18687 !! test
18688 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
18689 !! wikitext
18690 Text&apos;s been normalized?
18691 !! html
18692 <p>Text&#39;s been normalized?
18693 </p>
18694 !! end
18695
18696 !! test
18697 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
18698 !! wikitext
18699 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
18700 !! html
18701 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
18702 </p>
18703 !! end
18704
18705 !! test
18706 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
18707 !! wikitext
18708 [http://www.example.org/ ideograms]
18709 !! html
18710 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
18711 </p>
18712 !! end
18713
18714 !! test
18715 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
18716 !! wikitext
18717 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
18718 !! html
18719 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
18720 </p>
18721 !! end
18722
18723 !! article
18724 Mediawiki:loop1
18725 !! text
18726 {{Identical|A}}
18727 !! endarticle
18728
18729 !! article
18730 Mediawiki:loop2
18731 !! text
18732 {{Identical|B}}
18733 !! endarticle
18734
18735 !! article
18736 Template:Identical
18737 !! text
18738 {{int:loop1}}
18739 {{int:loop2}}
18740 !! endarticle
18741
18742 !! test
18743 Bug 31098 Template which includes system messages which includes the template
18744 !! wikitext
18745 {{Identical}}
18746 !! html
18747 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18748 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18749 </p>
18750 !! end
18751
18752 !! test
18753 Bug31490 Turkish: ucfirst 'blah'
18754 !! options
18755 language=tr
18756 !! wikitext
18757 {{ucfirst:blah}}
18758 !! html
18759 <p>Blah
18760 </p>
18761 !! end
18762
18763 !! test
18764 Bug31490 Turkish: ucfirst 'ix'
18765 !! options
18766 language=tr
18767 !! wikitext
18768 {{ucfirst:ix}}
18769 !! html
18770 <p>İx
18771 </p>
18772 !! end
18773
18774 !! test
18775 Bug31490 Turkish: lcfirst 'BLAH'
18776 !! options
18777 language=tr
18778 !! wikitext
18779 {{lcfirst:BLAH}}
18780 !! html
18781 <p>bLAH
18782 </p>
18783 !! end
18784
18785 !! test
18786 Bug31490 Turkish: ucfırst (with a dotless i)
18787 !! options
18788 language=tr
18789 !! wikitext
18790 {{ucfırst:blah}}
18791 !! html
18792 <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>
18793 </p>
18794 !! end
18795
18796 !! test
18797 Bug31490 ucfırst (with a dotless i) with English language
18798 !! options
18799 language=en
18800 !! wikitext
18801 {{ucfırst:blah}}
18802 !! html
18803 <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>
18804 </p>
18805 !! end
18806
18807 !! test
18808 Bug 26375: TOC with italics
18809 !! options
18810 title=[[Main Page]]
18811 !! wikitext
18812 __TOC__
18813 == ''Lost'' episodes ==
18814 !! html
18815 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18816 <ul>
18817 <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>
18818 </ul>
18819 </div>
18820
18821 <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>
18822
18823 !! end
18824
18825 !! test
18826 Bug 26375: TOC with bold
18827 !! options
18828 title=[[Main Page]]
18829 !! wikitext
18830 __TOC__
18831 == '''should be bold''' then normal text ==
18832 !! html
18833 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18834 <ul>
18835 <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>
18836 </ul>
18837 </div>
18838
18839 <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>
18840
18841 !! end
18842
18843 !! test
18844 Bug 33845: Headings become cursive in TOC when they contain an image
18845 !! options
18846 title=[[Main Page]]
18847 !! wikitext
18848 __TOC__
18849 == Image [[Image:foobar.jpg]] ==
18850 !! html
18851 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18852 <ul>
18853 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
18854 </ul>
18855 </div>
18856
18857 <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>
18858
18859 !! end
18860
18861 !! test
18862 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
18863 !! options
18864 title=[[Main Page]]
18865 !! wikitext
18866 __TOC__
18867 == <blockquote>Quote</blockquote> ==
18868 !! html
18869 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18870 <ul>
18871 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18872 </ul>
18873 </div>
18874
18875 <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>
18876
18877 !! html+tidy
18878 <div id="toc" class="toc">
18879 <div id="toctitle">
18880 <h2>Contents</h2>
18881 </div>
18882 <ul>
18883 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18884 </ul>
18885 </div>
18886 <h2><span class="mw-headline" id="Quote"></span></h2>
18887 <blockquote>
18888 <p><span class="mw-headline" id="Quote">Quote</span></p>
18889 </blockquote>
18890 <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>
18891 !! end
18892
18893 !! test
18894 Unclosed tags in TOC
18895 !! options
18896 title=[[Main Page]]
18897 !! wikitext
18898 __TOC__
18899 == Proof: 2 < 3 ==
18900 <small>Hanc marginis exiguitas non caperet.</small>
18901 QED
18902 !! html
18903 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18904 <ul>
18905 <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>
18906 </ul>
18907 </div>
18908
18909 <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>
18910 <p><small>Hanc marginis exiguitas non caperet.</small>
18911 QED
18912 </p>
18913 !! end
18914
18915 !! test
18916 Multiple tags in TOC
18917 !! wikitext
18918 __TOC__
18919 == <i>Foo</i> <b>Bar</b> ==
18920
18921 == <i>Foo</i> <blockquote>Bar</blockquote> ==
18922 !! html
18923 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18924 <ul>
18925 <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>
18926 <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>
18927 </ul>
18928 </div>
18929
18930 <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>
18931 <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>
18932
18933 !! html+tidy
18934 <div id="toc" class="toc">
18935 <div id="toctitle">
18936 <h2>Contents</h2>
18937 </div>
18938 <ul>
18939 <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>
18940 <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>
18941 </ul>
18942 </div>
18943 <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>
18944 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
18945 <blockquote>
18946 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
18947 </blockquote>
18948 <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>
18949 !! end
18950
18951 !! test
18952 Tags with parameters in TOC
18953 !! wikitext
18954 __TOC__
18955 == <sup class="in-h2">Hello</sup> ==
18956
18957 == <sup class="a > b">Evilbye</sup> ==
18958 !! html
18959 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18960 <ul>
18961 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
18962 <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>
18963 </ul>
18964 </div>
18965
18966 <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>
18967 <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>
18968
18969 !! end
18970
18971 !! test
18972 span tags with directionality in TOC
18973 !! wikitext
18974 __TOC__
18975 == <span dir="ltr">C++</span> ==
18976
18977 == <span dir="rtl">זבנג!</span> ==
18978
18979 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
18980
18981 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
18982
18983 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
18984 !! html
18985 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18986 <ul>
18987 <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>
18988 <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>
18989 <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>
18990 <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>
18991 <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>
18992 </ul>
18993 </div>
18994
18995 <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>
18996 <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>
18997 <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>
18998 <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>
18999 <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>
19000
19001 !! end
19002
19003 !! article
19004 MediaWiki:Bug32057
19005 !! text
19006 == {{int:headline_sample}} ==
19007 !! endarticle
19008
19009 !! test
19010 Bug 32057: Title needed when expanding <h> nodes.
19011 !! options
19012 title=[[Main Page]]
19013 !! wikitext
19014 {{int:Bug32057}}
19015 !! html
19016 <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>
19017
19018 !! end
19019
19020 !! test
19021 Strip marker in urlencode
19022 !! wikitext
19023 {{urlencode:x<nowiki/>y}}
19024 {{urlencode:x<nowiki/>y|wiki}}
19025 {{urlencode:x<nowiki/>y|path}}
19026 !! html
19027 <p>xy
19028 xy
19029 xy
19030 </p>
19031 !! end
19032
19033 !! test
19034 Strip marker in lc
19035 !! wikitext
19036 {{lc:x<nowiki/>y}}
19037 !! html
19038 <p>xy
19039 </p>
19040 !! end
19041
19042 !! test
19043 Strip marker in uc
19044 !! wikitext
19045 {{uc:x<nowiki/>y}}
19046 !! html
19047 <p>XY
19048 </p>
19049 !! end
19050
19051 !! test
19052 Strip marker in formatNum
19053 !! wikitext
19054 {{formatnum:1<nowiki/>2}}
19055 {{formatnum:1<nowiki/>2|R}}
19056 !! html
19057 <p>12
19058 12
19059 </p>
19060 !! end
19061
19062 !! test
19063 Check noCommafy in formatNum
19064 !! options
19065 language=be-tarask
19066 !! wikitext
19067 {{formatnum:123456.78}}
19068 {{formatnum:123456.78|NOSEP}}
19069 !! html
19070 <p>123 456,78
19071 123456.78
19072 </p>
19073 !! end
19074
19075 !! test
19076 Wrong option for formatNum (bug 56199)
19077 !! wikitext
19078 {{formatnum:1,234.56|Random}}
19079 {{formatnum:1,234.56|EVERYTHING}}
19080 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
19081 !! html
19082 <p>1,234.56
19083 1,234.56
19084 1,234.56
19085 </p>
19086 !! end
19087
19088 !! test
19089 Strip marker in grammar
19090 !! options
19091 language=fi
19092 !! wikitext
19093 {{grammar:elative|foo<nowiki/>bar}}
19094 !! html
19095 <p>foobarista
19096 </p>
19097 !! end
19098
19099 !! test
19100 Strip marker in padleft
19101 !! wikitext
19102 {{padleft:|2|x<nowiki/>y}}
19103 !! html
19104 <p>xy
19105 </p>
19106 !! end
19107
19108 !! test
19109 Strip marker in padright
19110 !! wikitext
19111 {{padright:|2|x<nowiki/>y}}
19112 !! html
19113 <p>xy
19114 </p>
19115 !! end
19116
19117 !! test
19118 Strip marker in anchorencode
19119 !! wikitext
19120 {{anchorencode:x<nowiki/>y}}
19121 !! html
19122 <p>xy
19123 </p>
19124 !! end
19125
19126 !! test
19127 nowiki inside link inside heading (bug 18295)
19128 !! wikitext
19129 ==[[foo|x<nowiki>y</nowiki>z]]==
19130 !! html
19131 <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>
19132
19133 !! end
19134
19135 !! test
19136 new support for bdi element (bug 31817)
19137 !! wikitext
19138 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19139 !! html
19140 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19141
19142 !!end
19143
19144 !! test
19145 Ignore pipe between table row attributes
19146 !! wikitext
19147 {|
19148 | quux
19149 |- id=foo | style='color: red'
19150 | bar
19151 |}
19152 !! html
19153 <table>
19154 <tr>
19155 <td> quux
19156 </td></tr>
19157 <tr id="foo" style="color: red">
19158 <td> bar
19159 </td></tr></table>
19160
19161 !! end
19162
19163 !!test
19164 Gallery override link with WikiLink (bug 34852)
19165 !! wikitext
19166 <gallery>
19167 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
19168 </gallery>
19169 !! html
19170 <ul class="gallery mw-gallery-traditional">
19171 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19172 <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>
19173 <div class="gallerytext">
19174 <p>caption
19175 </p>
19176 </div>
19177 </div></li>
19178 </ul>
19179
19180 !! end
19181
19182 !!test
19183 Gallery override link with absolute external link (bug 34852)
19184 !! wikitext
19185 <gallery>
19186 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19187 </gallery>
19188 !! html
19189 <ul class="gallery mw-gallery-traditional">
19190 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19191 <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>
19192 <div class="gallerytext">
19193 <p>caption
19194 </p>
19195 </div>
19196 </div></li>
19197 </ul>
19198
19199 !! end
19200
19201 !!test
19202 Gallery override link with malicious javascript (bug 34852)
19203 !! wikitext
19204 <gallery>
19205 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19206 </gallery>
19207 !! html
19208 <ul class="gallery mw-gallery-traditional">
19209 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19210 <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>
19211 <div class="gallerytext">
19212 <p>caption
19213 </p>
19214 </div>
19215 </div></li>
19216 </ul>
19217
19218 !! end
19219
19220 !!test
19221 Gallery with invalid title as link (bug 43964)
19222 !! wikitext
19223 <gallery>
19224 File:foobar.jpg|link=<
19225 </gallery>
19226 !! html
19227 <ul class="gallery mw-gallery-traditional">
19228 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19229 <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>
19230 <div class="gallerytext">
19231 </div>
19232 </div></li>
19233 </ul>
19234
19235 !! end
19236
19237 !!test
19238 Language parser function
19239 !! wikitext
19240 {{#language:ar}}
19241 !! html
19242 <p>العربية
19243 </p>
19244 !! end
19245
19246 !!test
19247 Padleft and padright as substr
19248 !! wikitext
19249 {{padleft:|3|abcde}}
19250 {{padright:|3|abcde}}
19251 !! html
19252 <p>abc
19253 abc
19254 </p>
19255 !! end
19256
19257 !!test
19258 Special parser function
19259 !! wikitext
19260 {{#special:RandomPage}}
19261 {{#special:BaDtItLe}}
19262 {{#special:Foobar}}
19263 !! html
19264 <p>Special:Random
19265 Special:Badtitle
19266 Special:Foobar
19267 </p>
19268 !! end
19269
19270 !!test
19271 Bug 34939 - Case insensitive link parsing ([HttP://])
19272 !! wikitext
19273 [HttP://MediaWiki.Org/]
19274 !! html/php
19275 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
19276 </p>
19277 !! html/parsoid
19278 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
19279 !! end
19280
19281 !!test
19282 Bug 34939 - Case insensitive link parsing ([HttP:// title])
19283 !! wikitext
19284 [HttP://MediaWiki.Org/ MediaWiki]
19285 !! html
19286 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
19287 </p>
19288 !! end
19289
19290 !!test
19291 Bug 34939 - Case insensitive link parsing (HttP://)
19292 !! wikitext
19293 HttP://MediaWiki.Org/
19294 !! html/php
19295 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
19296 </p>
19297 !! html/parsoid
19298 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
19299 !! end
19300
19301 !!test
19302 Disable TOC
19303 !! options
19304 notoc
19305 !! wikitext
19306 Lead
19307 == Section 1 ==
19308 == Section 2 ==
19309 == Section 3 ==
19310 == Section 4 ==
19311 == Section 5 ==
19312 !! html
19313 <p>Lead
19314 </p>
19315
19316 <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>
19317 <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>
19318 <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>
19319 <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>
19320 <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>
19321
19322 !! end
19323
19324
19325 ###
19326 ### Parsoid-specific tests
19327 ### Parsoid-PHP parser incompatibilities
19328 ###
19329 !!test
19330 1. SOL-sensitive wikitext tokens as template-args
19331 !!options
19332 parsoid=wt2html,wt2wt
19333 !! wikitext
19334 {{echo|*a}}
19335 {{echo|#a}}
19336 {{echo|:a}}
19337 !! html
19338 <span about="#mwt1" typeof="mw:Transclusion">
19339 </span><ul about="#mwt1"><li>a</li>
19340 </ul>
19341 <span about="#mwt2" typeof="mw:Transclusion">
19342 </span><ol about="#mwt2"><li>a</li>
19343 </ol>
19344 <span about="#mwt3" typeof="mw:Transclusion">
19345 </span><dl about="#mwt3"><dd>a</dd>
19346 </dl>
19347 !!end
19348
19349 #### -----------------------------------------------------------------
19350 #### Parsoid-specific functionality tests
19351 #### -----------------------------------------------------------------
19352
19353 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
19354 # We know wt2wt will fail, but we expect selser to pass.
19355 # Due to the nature of our testing, wt2wt and selser tests will enter the
19356 # blacklist and we'll catch selser regressions based on changes to the
19357 # blacklist entries for selser tests.
19358 !! test
19359 1. Bad treebuilder fixup of formatting elt is cleaned up
19360 !! options
19361 parsoid=wt2html,wt2wt
19362 !! wikitext
19363 {|
19364 |
19365 <small>
19366 [[Image:Foobar.jpg|right|Test]]
19367 </small>
19368 |}
19369 !! html/parsoid
19370 <table>
19371 <tbody><tr><td>
19372 <small>
19373 <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>Test</figcaption></figure>
19374 </small>
19375 </td></tr>
19376 </tbody></table>
19377 !! end
19378
19379 !! test
19380 2. Bad treebuilder fixup of formatting elt is cleaned up
19381 !! options
19382 parsoid=wt2html,wt2wt
19383 !! wikitext
19384 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
19385
19386 <small>[[Image:Foobar.jpg|right|300px]]</small>
19387 !! html/parsoid
19388 <p><b>foo</b></p>
19389 <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><b>caption</b></figcaption></figure>
19390 <p><b>bar</b></p>
19391 <small><figure class="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="34" width="300"/></a></figure></small>
19392 !! end
19393
19394 #### ----------------------------------------------------------------
19395 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
19396 #### tags. Parsoid's output for these tags differs from that of the
19397 #### PHP parser.
19398 #### ----------------------------------------------------------------
19399
19400 !!test
19401 Ref: 1. ref-location should be replaced with an index span
19402 !!options
19403 parsoid
19404 !! wikitext
19405 A <ref>foo</ref>
19406 B <ref name="x">foo</ref>
19407 C <ref name="y" />
19408 !! html
19409 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
19410 B <span about="#mwt4" class="reference" id="cite_ref-x-2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}'><a href="#cite_note-x-2">[2]</a></span>
19411 C <span about="#mwt6" class="reference" id="cite_ref-y-3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"y"}}'><a href="#cite_note-y-3">[3]</a></span></p>
19412 !!end
19413
19414 !!test
19415 Ref: 2. ref-tags with identical names should all get the same index
19416 !!options
19417 parsoid
19418 !! wikitext
19419 A <ref name="x">foo</ref>
19420 B <ref name="x" />
19421 !! html
19422 <p>A <span about="#mwt2" class="reference" id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span>
19423 B <span about="#mwt4" class="reference" id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span></p>
19424 !!end
19425
19426 !!test
19427 Ref: 3. spaces in ref-names should be ignored
19428 !!options
19429 parsoid
19430 !! wikitext
19431 A <ref name="x">foo</ref>
19432 B <ref name=" x " />
19433 C <ref name= x />
19434 !! html
19435 <p>A <span about="#mwt2" class="reference" id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span>
19436 B <span about="#mwt4" class="reference" id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span>
19437 C <span about="#mwt6" class="reference" id="cite_ref-x-1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span></p>
19438 !!end
19439
19440 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
19441 !!test
19442 Ref: 4. 'constructor' should be accepted as a valid ref-name
19443 !!options
19444 parsoid
19445 !! wikitext
19446 A <ref name="constructor">foo</ref>
19447 !! html
19448 <p>A <span about="#mwt2" class="reference" id="cite_ref-constructor-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"constructor"}}'><a href="#cite_note-constructor-1">[1]</a></span></p>
19449 !!end
19450
19451 !!test
19452 Ref: 5. body should accept generic wikitext
19453 !!options
19454 parsoid
19455 !! wikitext
19456 A <ref>
19457 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
19458 </ref>
19459
19460 <references />
19461 !! html
19462 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" 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\" title=\"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-parsoid=&#39;{\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]],\"dsr\":[55,76,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"transclusion\"}},\"i\":0}}]}&#39;>transclusion&lt;/span>\n"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19463
19464 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19465 <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" title="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>
19466 </li>
19467 </ol>
19468 !!end
19469
19470 !!test
19471 Ref: 6. indent-pres should not be output in ref-body
19472 !!options
19473 parsoid
19474 !! wikitext
19475 A <ref>
19476 foo
19477 bar
19478 baz
19479 </ref>
19480
19481 <references />
19482 !! html
19483 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo\n bar\n baz\n"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19484
19485 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19486 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
19487 bar
19488 baz
19489 </li>
19490 </ol>
19491 !!end
19492
19493 !!test
19494 Ref: 7. No p-wrapping in ref-body
19495 !!options
19496 parsoid
19497 !! wikitext
19498 A <ref>
19499 foo
19500
19501 bar
19502
19503
19504 baz
19505
19506
19507
19508 booz
19509 </ref>
19510
19511 <references />
19512 !! html
19513 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo\n\nbar\n\n\nbaz\n\n\n\nbooz\n"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19514
19515 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19516 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
19517
19518 bar
19519
19520
19521 baz
19522
19523
19524
19525 booz
19526 </li>
19527 </ol>
19528 !!end
19529
19530 !!test
19531 Ref: 8. transclusion wikitext has lower precedence
19532 !!options
19533 parsoid
19534 !! wikitext
19535 A <ref> foo {{echo|</ref> B C}}
19536
19537 <references />
19538 !! html
19539 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo &lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"src\":\"{{\",\"dsr\":[12,14,0,0]}&#39;>{{&lt;/span>echo|"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C<span typeof="mw:Nowiki">}}</span></p>
19540 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19541 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <span typeof="mw:Nowiki">{{</span>echo|</li>
19542 </ol>
19543 !!end
19544
19545 !!test
19546 Ref: 9. unclosed comments should not leak out of ref-body
19547 !!options
19548 parsoid
19549 !! wikitext
19550 A <ref> foo <!--</ref> B C
19551 <references />
19552 !! html
19553 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo &lt;!---->"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C</p>
19554 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19555 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li>
19556 </ol>
19557 !!end
19558
19559 !!test
19560 Ref: 10. Unclosed HTML tags should not leak out of ref-body
19561 !!options
19562 parsoid
19563 !! wikitext
19564 A <ref> <b> foo </ref> B C
19565
19566 <references />
19567 !! html
19568 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" 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":{}}'><a href="#cite_note-1">[1]</a></span> B C</p>
19569
19570
19571 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19572 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> <b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></li>
19573 </ol>
19574 !!end
19575
19576 !!test
19577 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
19578 !!options
19579 parsoid
19580 !! wikitext
19581 A <ref>foo</ref> B
19582 C <ref>bar</ref> D
19583 !! html
19584 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B
19585 C <span about="#mwt4" class="reference" id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}'><a href="#cite_note-2">[2]</a></span> D</p>
19586 !!end
19587
19588 !!test
19589 Ref: 12. ref-tags act as trailing newline migration barrier
19590 !!options
19591 parsoid
19592 !! wikitext
19593 <!--the newline at the end of this line moves out of the p-tag-->a
19594
19595 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
19596 <ref />
19597
19598 c
19599 !! html
19600 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
19601
19602
19603 <p>b<!--the newline at the end of this line stays inside the p-tag--> <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-1">[1]</a></span>
19604 <span about="#mwt4" class="reference" id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-2">[2]</a></span></p>
19605
19606 <p>c</p>
19607 !!end
19608
19609 !!test
19610 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
19611 !!options
19612 parsoid
19613 !! wikitext
19614 <ref>foo</ref> A
19615 <ref>bar
19616 </ref> B
19617 !! html
19618 <p><span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> A
19619 <span about="#mwt4" class="reference" id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar\n"},"attrs":{}}'><a href="#cite_note-2">[2]</a></span> B</p>
19620 !!end
19621
19622 !!test
19623 Ref: 14. A nested ref-tag should be emitted as plain text
19624 !!options
19625 parsoid
19626 !! wikitext
19627 <ref>foo <ref>bar</ref> baz</ref>
19628
19629 <references />
19630 !! html
19631 <p><span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo &amp;lt;ref>bar&amp;lt;/ref> baz"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19632
19633 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19634 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo &lt;ref>bar&lt;/ref> baz</li>
19635 </ol>
19636 !!end
19637
19638 !!test
19639 Ref: 15. ref-tags with identical names should get identical indexes
19640 !!options
19641 parsoid
19642 !! wikitext
19643 A1 <ref name="a">foo</ref> A2 <ref name="a" />
19644 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
19645
19646 <references />
19647 !! html
19648 <p>A1 <span about="#mwt3" class="reference" id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a"}}'><a href="#cite_note-a-1">[1]</a></span> A2 <span about="#mwt4" class="reference" id="cite_ref-a-1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="#cite_note-a-1">[1]</a></span>
19649 B1 <span about="#mwt7" class="reference" id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span> B2 <span about="#mwt8" class="reference" id="cite_ref-b-2-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span></p>
19650
19651 <ol class="references" typeof="mw:Extension/references" about="#mwt10" 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>
19652 </ol>
19653 !!end
19654
19655 ## We don't bother wt2wt-ing non-standard whitespace
19656 !!test
19657 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
19658 !!options
19659 parsoid=wt2html
19660 !! wikitext
19661 A <ref >foo</ref >
19662
19663 <references />
19664 !! html
19665 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19666
19667 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19668 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19669 !!end
19670
19671 !!test
19672 Ref: 17. Generate valid HTML5 id/about attributes
19673 !!options
19674 parsoid
19675 !!wikitext
19676 <ref name="a b">foo</ref>
19677
19678 <references />
19679 !!html
19680 <p><span class="reference" id="cite_ref-a_b-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a b"}}'><a href="#cite_note-a_b-1">[1]</a></span>
19681 </p>
19682
19683 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19684 <li id="cite_note-a_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_b-1-0">↑</a></span> foo</li>
19685 !!end
19686
19687 !!test
19688 References: 1. references tag without any refs should be handled properly
19689 !!options
19690 parsoid
19691 !! wikitext
19692 <references />
19693 !! html
19694 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
19695 !!end
19696
19697 !!test
19698 References: 2. references tag with group only outputs references from that group
19699 !!options
19700 parsoid
19701 !! wikitext
19702 A <ref group="a">foo</ref>
19703 B <ref group="b">bar</ref>
19704
19705 <references group="a" />
19706 !! html
19707 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
19708 B <span about="#mwt4" class="reference" id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"group":"b"}}'><a href="#cite_note-2">[b 1]</a></span></p>
19709
19710 <ol class="references" typeof="mw:Extension/references" about="#mwt6" 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>
19711 </ol>
19712 !!end
19713
19714 !!test
19715 References: 3. ref list should be cleared after processing references
19716 !!options
19717 parsoid
19718 !! wikitext
19719 A <ref>foo</ref>
19720
19721 <references />
19722
19723 B <ref>bar</ref>
19724
19725 <references />
19726 !! html
19727 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19728
19729 <ol class="references" typeof="mw:Extension/references" about="#mwt4" 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>
19730 </ol>
19731
19732 <p>B <span about="#mwt6" class="reference" id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}'><a href="#cite_note-2">[1]</a></span></p>
19733
19734 <ol class="references" typeof="mw:Extension/references" about="#mwt8" 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>
19735 </ol>
19736 !!end
19737
19738 !!test
19739 References: 4. only referenced group should be cleared after processing references
19740 !!options
19741 parsoid
19742 !! wikitext
19743 A <ref group="a">afoo</ref>
19744 B <ref>bfoo</ref>
19745
19746 <references group="a" />
19747
19748 C <ref>cfoo</ref>
19749
19750 <references />
19751 !! html
19752 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"afoo"},"attrs":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
19753 B <span about="#mwt4" class="reference" id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bfoo"},"attrs":{}}'><a href="#cite_note-2">[1]</a></span></p>
19754
19755 <ol class="references" typeof="mw:Extension/references" about="#mwt6" 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>
19756 </ol>
19757
19758 <p>C <span about="#mwt8" class="reference" id="cite_ref-3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"cfoo"},"attrs":{}}'><a href="#cite_note-3">[2]</a></span></p>
19759
19760 <ol class="references" typeof="mw:Extension/references" about="#mwt10" 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>
19761 </ol>
19762 !!end
19763
19764 !!test
19765 References: 5. ref tags in references should be processed while ignoring all other content
19766 !!options
19767 parsoid
19768 !! wikitext
19769 A <ref name="a" />
19770 B <ref name="b">bar</ref>
19771
19772 <references>
19773 <ref name="a">foo</ref>
19774 This should just get lost.
19775 </references>
19776 !! html
19777 <p>A <span about="#mwt2" class="reference" id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="#cite_note-a-1">[1]</a></span>
19778 B <span about="#mwt4" class="reference" id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span></p>
19779
19780
19781 <ol class="references" typeof="mw:Extension/references" about="#mwt6" 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\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"src\":\"&amp;lt;ref name=\\\"a\\\">foo&amp;lt;/ref>\",\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"#cite_note-a-1\">[1]&lt;/a>&lt;/span>\n"},"attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a-1-0">↑</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">↑</a></span> bar</li>
19782 </ol>
19783 !!end
19784
19785 !!test
19786 References: 6. <references /> from a transclusion
19787 !!options
19788 parsoid
19789 !! wikitext
19790 <ref>Foo</ref> {{echo|<references />}}
19791 !! html
19792 <p><span about="#mwt3" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"Foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p> <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>
19793 !!end
19794
19795 !! test
19796 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
19797 !! options
19798 parsoid
19799 !! wikitext
19800 A <ref>foo bar for a</ref>
19801 B <ref group="X" name="b" />
19802
19803 <references />
19804
19805 <references group="X">
19806 <ref name="b">foo</ref>
19807 </references>
19808 !! html
19809 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
19810 B <span about="#mwt4" class="reference" id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}'><a href="#cite_note-b-2">[X 1]</a></span></p>
19811
19812 <ol class="references" typeof="mw:Extension/references" about="#mwt6" 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 bar for a</li></ol>
19813
19814 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"b\">foo&lt;/ref>","html":"\n&lt;span about=\"#mwt10\" class=\"reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"src\":\"&amp;lt;ref name=\\\"b\\\">foo&amp;lt;/ref>\",\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"b\"}}&#39;>&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"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> foo</li></ol>
19815 !! end
19816
19817 !! test
19818 Entities in ref name
19819 !! options
19820 parsoid
19821 !! wikitext
19822 <ref name="test &amp; me">hi</ref>
19823 !! html
19824 <p><span about="#mwt2" class="reference" 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>"}' data-mw='{"name":"ref","body":{"html":"hi"},"attrs":{"name":"test &amp; me"}}'><a href="#cite_note-test_&amp;_me-1">[1]</a></span></p>
19825 !! end
19826
19827 # This test is wt2html only because we're permitting the serializer to produce
19828 # dirty diffs, normalizing the unclosed references to the self-closed version.
19829 !! test
19830 Generate references for unclosed references tag
19831 !! options
19832 parsoid=wt2html
19833 !! wikitext
19834 a<ref>foo</ref>
19835
19836 <references>
19837 !! html
19838 <p>a<span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19839
19840
19841 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19842 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19843 !! end
19844
19845 !! test
19846 New reference serializes on its own line
19847 !! options
19848 parsoid=wt2wt,html2wt
19849 !! wikitext
19850 foo
19851 <references />
19852 !! html
19853 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
19854 !! end
19855
19856 #--------- Test stripping of empty nodes in template content ----------
19857 !!test
19858 Empty LI and TR nodes should be stripped from template content
19859 !!wikitext
19860 {{EmptyLITest}}
19861 {{EmptyTRTest}}
19862 !!html/parsoid
19863 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
19864 <li>a</li>
19865 <li>b</li>
19866 </ul>
19867 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
19868 <tbody>
19869 <tr>
19870 <td>foo</td>
19871 </tr>
19872 <tr>
19873 <td>bar</td>
19874 </tr>
19875 </tbody>
19876 </table>
19877 !!end
19878
19879 !!test
19880 Empty LI and TR nodes should not be stripped from top-level content
19881 !!wikitext
19882 * a
19883 *
19884 * b
19885 {|
19886 |-
19887 |-
19888 |foo
19889 |}
19890 !!html/parsoid
19891 <ul>
19892 <li> a</li>
19893 <li></li>
19894 <li> b</li>
19895 </ul>
19896 <table>
19897 <tbody>
19898 <tr></tr>
19899 <tr>
19900 <td>foo</td>
19901 </tr>
19902 </tbody>
19903 </table>
19904 !!end
19905
19906 !!test
19907 Empty TR nodes should not be stripped if they have any attributes set
19908 !!wikitext
19909 {{EmptyTRWithHTMLAttrTest}}
19910 !!html/parsoid
19911 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
19912 <tr align="center"></tr>
19913 <tr><td>foo</td></tr>
19914 <tr align="center"></tr>
19915 <tr><td>bar</td></tr>
19916 </table>
19917 !!end
19918
19919 #### ----------------------------------------------------------------
19920 #### The following section of tests are primarily to test
19921 #### wikitext escaping capabilities of Parsoid. Given that
19922 #### escaping can be done any number of ways, the wikitext (input)
19923 #### is always adjusted to reflect how Parsoid adds nowiki
19924 #### escape tags.
19925 ####
19926 #### We are marking several tests as parsoid-only since the
19927 #### HTML in the result section is different from what the
19928 #### PHP parser generates for it.
19929 #### ----------------------------------------------------------------
19930
19931
19932 #### --------------- Headings ---------------
19933 #### 0. Unnested
19934 #### 1. Nested inside html <h1>=foo=</h1>
19935 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
19936 #### 3. Nested inside html with wikitext split by html tags
19937 #### 4. No escape needed
19938 #### 5. Empty headings <h1></h1>
19939 #### 6. Heading chars in SOL context
19940 #### ----------------------------------------
19941 !! test
19942 Headings: 0. Unnested
19943 !! options
19944 parsoid
19945 !! wikitext
19946 <nowiki>=foo=</nowiki>
19947
19948 <nowiki> =foo= </nowiki>
19949 <!--cmt-->
19950 <nowiki>=foo=</nowiki>
19951
19952 =foo''a''<nowiki>=</nowiki>
19953 !! html
19954 <p><span typeof="mw:Nowiki">=foo=</span></p>
19955
19956 <p><span typeof="mw:Nowiki"> =foo= </span>
19957 <!--cmt-->
19958 <span typeof="mw:Nowiki">=foo=</span></p>
19959
19960 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
19961 !!end
19962
19963 # New headings and existing headings are handled differently
19964 !! test
19965 Headings: 1. Nested inside html
19966 !! options
19967 parsoid=html2wt
19968 !! wikitext
19969 = =foo= =
19970
19971 == =foo= ==
19972
19973 === =foo= ===
19974
19975 =<nowiki>=foo=</nowiki>=
19976 ==<nowiki>=foo=</nowiki>==
19977 ===<nowiki>=foo=</nowiki>===
19978 ====<nowiki>=foo=</nowiki>====
19979 =====<nowiki>=foo=</nowiki>=====
19980 ======<nowiki>=foo=</nowiki>======
19981
19982 !! html
19983 <h1>=foo=</h1>
19984 <h2>=foo=</h2>
19985 <h3>=foo=</h3>
19986
19987 <h1 data-parsoid=''>=foo=</h1>
19988 <h2 data-parsoid=''>=foo=</h2>
19989 <h3 data-parsoid=''>=foo=</h3>
19990 <h4 data-parsoid=''>=foo=</h4>
19991 <h5 data-parsoid=''>=foo=</h5>
19992 <h6 data-parsoid=''>=foo=</h6>
19993 !!end
19994
19995 !! test
19996 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
19997 !! options
19998 parsoid=html2wt
19999 !! wikitext
20000 = foo =
20001 <nowiki>*</nowiki>bar
20002
20003 = foo =
20004 =bar
20005
20006 = foo =
20007 <nowiki>=bar=</nowiki>
20008 !! html
20009 <h1>foo</h1>*bar
20010 <h1>foo</h1>=bar
20011 <h1>foo</h1>=bar=
20012 !!end
20013
20014 !! test
20015 Headings: 3. Nested inside html with wikitext split by html tags
20016 !! options
20017 parsoid=html2wt,wt2wt
20018 !! wikitext
20019 = ='''bold'''<nowiki>foo=</nowiki> =
20020 !! html/parsoid
20021 <h1>=<b>bold</b>foo=</h1>
20022 !!end
20023
20024 !! test
20025 Headings: 4a. No escaping needed (testing just h1 and h2)
20026 !! wikitext
20027 = =foo =
20028
20029 = foo= =
20030
20031 = =foo= =
20032
20033 = =foo= bar =
20034
20035 == =foo ==
20036
20037 == foo= ==
20038
20039 = = =
20040 !! html/parsoid
20041 <h1>=foo</h1>
20042 <h1>foo=</h1>
20043 <h1> =foo= </h1>
20044 <h1>=foo= bar</h1>
20045 <h2>=foo</h2>
20046 <h2>foo=</h2>
20047 <h1>=</h1>
20048 !!end
20049
20050 !! test
20051 Headings: 4a'. No escaping needed (Parsoid bug T84903)
20052 !! wikitext
20053 = ''=''foo= =
20054 !! html/php
20055 <h1><span class="mw-headline" id=".3Dfoo.3D"><i>=</i>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>
20056
20057 !! html/parsoid
20058 <h1><i>=</i>foo=</h1>
20059 !! end
20060
20061 !! test
20062 Headings: 4b. No escaping needed (inside p-tags)
20063 !! options
20064 parsoid=html2wt
20065 !! wikitext
20066 ===
20067 =foo= x
20068 =foo= <s></s>
20069 !! html
20070 <p>===
20071 =foo= x
20072 =foo= <s></s>
20073 </p>
20074 !!end
20075
20076 !! test
20077 Headings: 5. Empty headings
20078 !! options
20079 parsoid
20080 !! wikitext
20081 =<nowiki/>=
20082
20083 ==<nowiki/>==
20084
20085 ===<nowiki/>===
20086
20087 ====<nowiki/>====
20088
20089 =====<nowiki/>=====
20090
20091 ======<nowiki/>======
20092 !! html
20093 <h1></h1>
20094 <h2></h2>
20095 <h3></h3>
20096 <h4></h4>
20097 <h5></h5>
20098 <h6></h6>
20099 !!end
20100
20101 !! test
20102 Headings: 6a. Heading chars in SOL context (with trailing spaces)
20103 !! options
20104 parsoid
20105 !! wikitext
20106 <nowiki>=a=</nowiki>
20107
20108 <nowiki>=a=</nowiki>
20109
20110 <nowiki>=a=</nowiki>
20111
20112 <nowiki>=a=</nowiki>
20113 !! html
20114 <p>=a=</p>
20115 <p>=a= </p>
20116 <p>=a= </p>
20117 <p>=a= </p>
20118 !!end
20119
20120 !! test
20121 Headings: 6b. Heading chars in SOL context (with trailing newlines)
20122 !! options
20123 parsoid
20124 !! wikitext
20125 <nowiki>=a=
20126 b</nowiki>
20127
20128 <nowiki>=a=
20129 b</nowiki>
20130
20131 <nowiki>=a=
20132 b</nowiki>
20133
20134 <nowiki>=a=
20135 b</nowiki>
20136 !! html
20137 <p>=a=
20138 b</p>
20139 <p>=a=
20140 b</p>
20141 <p>=a=
20142 b</p>
20143 <p>=a=
20144 b</p>
20145 </p>
20146 !!end
20147
20148 !! test
20149 Headings: 6c. Heading chars in SOL context (leading newline break)
20150 !! options
20151 parsoid
20152 !! wikitext
20153 a
20154 <nowiki>=b=</nowiki>
20155 !! html
20156 <p>a
20157 =b=</p>
20158 !!end
20159
20160 !! test
20161 Headings: 6d. Heading chars in SOL context (with interspersed comments)
20162 !! options
20163 parsoid
20164 !! wikitext
20165 <!--c0--><nowiki>=a=</nowiki>
20166
20167 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
20168 !! html
20169 <p><!--c0-->=a=</p>
20170 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
20171 !!end
20172
20173 !! test
20174 Headings: 6d. Heading chars in SOL context (No escaping needed)
20175 !! options
20176 parsoid=html2wt
20177 !! wikitext
20178 =a=<div>b</div>
20179 !! html
20180 =a=<div>b</div>
20181 !!end
20182
20183 #### --------------- Lists ---------------
20184 #### 0. Outside nests (*foo, etc.)
20185 #### 1. Nested inside html <ul><li>*foo</li></ul>
20186 #### 2. Inside definition lists
20187 #### 3. Only bullets at start should be escaped
20188 #### 4. No escapes needed
20189 #### 5. No unnecessary escapes
20190 #### 6. Escape bullets in SOL position
20191 #### 7. Escape bullets in a multi-line context
20192 #### ----------------------------------------
20193
20194 !! test
20195 Lists: 0. Outside nests
20196 !! wikitext
20197 <nowiki>*</nowiki>foo
20198
20199 <nowiki>#</nowiki>foo
20200
20201 <nowiki>;Foo:</nowiki>bar
20202 !! html
20203 <p>*foo
20204 </p><p>#foo
20205 </p><p>;Foo:bar
20206 </p>
20207 !!end
20208
20209 !! test
20210 Lists: 1. Nested inside html
20211 !! wikitext
20212 *<nowiki>*foo</nowiki>
20213
20214 *<nowiki>#foo</nowiki>
20215
20216 *<nowiki>:foo</nowiki>
20217
20218 *<nowiki>;foo</nowiki>
20219
20220 #<nowiki>*foo</nowiki>
20221
20222 #<nowiki>#foo</nowiki>
20223
20224 #<nowiki>:foo</nowiki>
20225
20226 #<nowiki>;foo</nowiki>
20227 !! html
20228 <ul><li>*foo</li></ul>
20229 <ul><li>#foo</li></ul>
20230 <ul><li>:foo</li></ul>
20231 <ul><li>;foo</li></ul>
20232 <ol><li>*foo</li></ol>
20233 <ol><li>#foo</li></ol>
20234 <ol><li>:foo</li></ol>
20235 <ol><li>;foo</li></ol>
20236
20237 !!end
20238
20239 !! test
20240 Lists: 2. Inside definition lists
20241 !! wikitext
20242 ;<nowiki>;foo</nowiki>
20243
20244 ;<nowiki>:foo</nowiki>
20245
20246 ;<nowiki>:foo</nowiki>
20247 :bar
20248
20249 :<nowiki>:foo</nowiki>
20250 !! html
20251 <dl><dt>;foo</dt></dl>
20252 <dl><dt>:foo</dt></dl>
20253 <dl><dt>:foo</dt>
20254 <dd>bar</dd></dl>
20255 <dl><dd>:foo</dd></dl>
20256
20257 !!end
20258
20259 !! test
20260 Lists: 3. Only bullets at start of text should be escaped
20261 !! wikitext
20262 *<nowiki>*foo*bar</nowiki>
20263
20264 *<nowiki>*foo</nowiki>''it''*bar
20265 !! html
20266 <ul><li>*foo*bar</li></ul>
20267 <ul><li>*foo<i>it</i>*bar</li></ul>
20268
20269 !!end
20270
20271 !! test
20272 Lists: 4. No escapes needed
20273 !! options
20274 parsoid
20275 !! wikitext
20276 *foo*bar
20277
20278 *''foo''*bar
20279
20280 *[[Foo]]: bar
20281
20282 *[[Foo]]*bar
20283 !! html
20284 <ul>
20285 <li>foo*bar
20286 </li>
20287 </ul>
20288 <ul>
20289 <li><i>foo</i>*bar
20290 </li>
20291 </ul>
20292 <ul>
20293 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
20294 </li>
20295 </ul>
20296 <ul>
20297 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
20298 </li>
20299 </ul>
20300 !!end
20301
20302 !! test
20303 Lists: 5. No unnecessary escapes
20304 !! wikitext
20305 * bar <span><nowiki>[[foo]]</nowiki></span>
20306
20307 * =bar <span><nowiki>[[foo]]</nowiki></span>
20308
20309 * [[bar <span><nowiki>[[foo]]</nowiki></span>
20310
20311 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
20312
20313 * =bar <span>foo]]</span>=
20314
20315 * <s></s>: a
20316
20317 * ''* foo''
20318 !! html
20319 <ul><li> bar <span>[[foo]]</span></li></ul>
20320 <ul><li> =bar <span>[[foo]]</span></li></ul>
20321 <ul><li> [[bar <span>[[foo]]</span></li></ul>
20322 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
20323 <ul><li> =bar <span>foo]]</span>=</li></ul>
20324 <ul><li> <s></s>: a</li></ul>
20325 <ul><li> <i>* foo</i></li></ul>
20326
20327 !!end
20328
20329 !! test
20330 Lists: 6. Escape bullets in SOL position
20331 !! options
20332 parsoid=html2wt
20333 !! wikitext
20334 <!--cmt--><nowiki>*</nowiki>foo
20335 !! html
20336 <p><!--cmt-->*foo</p>
20337 !!end
20338
20339 !! test
20340 Lists: 7. Escape bullets in a multi-line context
20341 !! wikitext
20342 a
20343 <nowiki>*</nowiki>b
20344 !! html
20345 <p>a
20346 *b
20347 </p>
20348 !!end
20349
20350 !! test
20351 Lists: 8. Escape colons only if not present in tags
20352 !! options
20353 parsoid=html2wt
20354 !! wikitext
20355 ; <nowiki>a:b</nowiki>''c:d''
20356 !! html
20357 <dl><dt>a:b<i>c:d</i></dt></dl>
20358 !! end
20359
20360 #### --------------- HRs ---------------
20361 #### 1. Single line
20362 #### -----------------------------------
20363
20364 !! test
20365 HRs: 1. Single line
20366 !! wikitext
20367 ----<nowiki>----</nowiki>
20368 ----=foo=
20369 ----*foo
20370 !! html+tidy
20371 <hr />
20372 <p>----</p>
20373 <hr />
20374 <p>=foo=</p>
20375 <hr />
20376 <p>*foo</p>
20377 !! end
20378
20379 #### --------------- Tables ---------------
20380 #### 1a. Simple example
20381 #### 1b. No escaping needed (!foo)
20382 #### 1c. No escaping needed (|foo)
20383 #### 1d. No escaping needed (|}foo)
20384 ####
20385 #### 2a. Nested in td (<td>foo|bar</td>)
20386 #### 2b. Nested in td (<td>foo||bar</td>)
20387 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
20388 ####
20389 #### 3a. Nested in th (<th>foo!bar</th>)
20390 #### 3b. Nested in th (<th>foo!!bar</th>)
20391 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
20392 ####
20393 #### 4a. Escape -
20394 #### 4b. Escape +
20395 #### 4c. No escaping needed
20396 #### --------------------------------------
20397
20398 !! test
20399 Tables: 1a. Simple example
20400 !! wikitext
20401 <nowiki>{|
20402 |}</nowiki>
20403 !! html
20404 <p>{|
20405 |}
20406 </p>
20407 !! end
20408
20409 !! test
20410 Tables: 1b. No escaping needed
20411 !! wikitext
20412 !foo
20413 !! html
20414 <p>!foo
20415 </p>
20416 !! end
20417
20418 !! test
20419 Tables: 1c. No escaping needed
20420 !! wikitext
20421 |foo
20422 !! html
20423 <p>|foo
20424 </p>
20425 !! end
20426
20427 !! test
20428 Tables: 1d. No escaping needed
20429 !! wikitext
20430 |}foo
20431 !! html
20432 <p>|}foo
20433 </p>
20434 !! end
20435
20436 !! test
20437 Tables: 2a. Nested in td
20438 !! options
20439 parsoid=html2wt
20440 !! html/parsoid
20441 <table><tbody><tr>
20442 <td>foo|bar</td></tr>
20443 <tr><td>x<div>a|b</div></td>
20444 </tbody></table>
20445 !! wikitext
20446 {|
20447 |<nowiki>foo|bar</nowiki>
20448 |-
20449 |x<div><nowiki>a|b</nowiki></div>
20450 |}
20451 !! html/php+tidy
20452 <table>
20453 <tr>
20454 <td>foo|bar</td>
20455 </tr>
20456 <tr>
20457 <td>x
20458 <div>a|b</div>
20459 </td>
20460 </tr>
20461 </table>
20462 !! end
20463
20464 !! test
20465 Tables: 2b. Nested in td
20466 !! options
20467 parsoid=html2wt
20468 !! html/parsoid
20469 <table><tbody><tr>
20470 <td>foo||bar</td>
20471 <td>a<i>b||c</i></td>
20472 <td>a<i><div>b||c</div></i></td>
20473 </tr></tbody></table>
20474 !! wikitext
20475 {|
20476 |<nowiki>foo||bar</nowiki>
20477 |a''<nowiki>b||c</nowiki>''
20478 |a''<div><nowiki>b||c</nowiki></div>''
20479 |}
20480 !! html/php
20481 <table>
20482 <tr>
20483 <td>foo||bar
20484 </td>
20485 <td>a<i>b||c</i>
20486 </td>
20487 <td>a<i><div>b||c</div></i>
20488 </td></tr></table>
20489
20490 !! end
20491
20492 !! test
20493 Tables: 2c. Nested in td -- no escaping needed
20494 !! wikitext
20495 {|
20496
20497 |foo!!bar
20498 |}
20499 !! html/*
20500 <table>
20501
20502 <tr>
20503 <td>foo!!bar
20504 </td></tr></table>
20505
20506 !! end
20507
20508 !! test
20509 Tables: 3a. Nested in th
20510 !! wikitext
20511 {|
20512
20513 !foo!bar
20514 |}
20515 !! html/*
20516 <table>
20517
20518 <tr>
20519 <th>foo!bar
20520 </th></tr></table>
20521
20522 !! end
20523
20524 !! test
20525 Tables: 3b. Nested in th
20526 !! options
20527 parsoid=html2wt
20528 !! html/parsoid
20529 <table><tbody>
20530 <tr><th>foo!!bar</th>
20531 <th><i>foo|bar</i></th>
20532 <th><i>foo!!bar</i></th>
20533 <th><i><span>foo!!bar</span></i></th>
20534 </tr></tbody></table>
20535 !! wikitext
20536 {|
20537 !<nowiki>foo!!bar</nowiki>
20538 !''<nowiki>foo|bar</nowiki>''
20539 !''<nowiki>foo!!bar</nowiki>''
20540 !''<span><nowiki>foo!!bar</nowiki></span>''
20541 |}
20542 !! html/php
20543 <table>
20544 <tr>
20545 <th>foo!!bar
20546 </th>
20547 <th><i>foo|bar</i>
20548 </th>
20549 <th><i>foo!!bar</i>
20550 </th>
20551 <th><i><span>foo!!bar</span></i>
20552 </th></tr></table>
20553
20554 !! end
20555
20556 !! test
20557 Tables: 3c. Nested in th
20558 !! options
20559 parsoid=html2wt
20560 !! html/parsoid
20561 <table><tbody>
20562 <tr><th>foo||bar</th>
20563 <th><span typeof="mw:Nowiki">foo||bar</span></th>
20564 </tr></tbody></table>
20565 !! wikitext
20566 {|
20567 !<nowiki>foo||bar</nowiki>
20568 !<nowiki>foo||bar</nowiki>
20569 |}
20570 !! html/php
20571 <table>
20572 <tr>
20573 <th>foo||bar
20574 </th>
20575 <th>foo||bar
20576 </th></tr></table>
20577
20578 !! end
20579
20580 !! test
20581 Tables: 4a. Escape -
20582 !! options
20583 parsoid=html2wt
20584 !! wikitext
20585 {|
20586
20587 !-bar
20588
20589 |-
20590 |<nowiki>-bar</nowiki>
20591 |}
20592 !! html/*
20593 <table>
20594
20595 <tr>
20596 <th>-bar
20597 </th></tr>
20598 <tr>
20599 <td>-bar
20600 </td></tr></table>
20601
20602 !! end
20603
20604 !! test
20605 Tables: 4b. Escape +
20606 !! options
20607 parsoid=html2wt
20608 !! wikitext
20609 {|
20610
20611 !+bar
20612
20613 |-
20614 |<nowiki>+bar</nowiki>
20615 |}
20616 !! html/*
20617 <table>
20618
20619 <tr>
20620 <th>+bar
20621 </th></tr>
20622 <tr>
20623 <td>+bar
20624 </td></tr></table>
20625
20626 !! end
20627
20628 !! test
20629 Tables: 4c. No escaping needed
20630 !! wikitext
20631 {|
20632 |foo-bar
20633 |foo+bar
20634 |-
20635 |''foo''-bar
20636 |''foo''+bar
20637 |-
20638 |foo
20639 bar|baz
20640 +bar
20641 -bar
20642 |-
20643 |x
20644 <div>a|b</div>
20645 |}
20646 !! html/php
20647 <table>
20648 <tr>
20649 <td>foo-bar
20650 </td>
20651 <td>foo+bar
20652 </td></tr>
20653 <tr>
20654 <td><i>foo</i>-bar
20655 </td>
20656 <td><i>foo</i>+bar
20657 </td></tr>
20658 <tr>
20659 <td>foo
20660 <p>bar|baz
20661 +bar
20662 -bar
20663 </p>
20664 </td></tr>
20665 <tr>
20666 <td>x
20667 <div>a|b</div>
20668 </td></tr></table>
20669
20670 !! html/parsoid
20671 <table><tbody>
20672 <tr><td>foo-bar</td><td>foo+bar</td></tr>
20673 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
20674 <tr><td>foo
20675 <p>bar|baz
20676 +bar
20677 -bar</p></td></tr>
20678 <tr><td>x
20679 <div>a|b</div></td>
20680 </tbody></table>
20681 !! end
20682
20683 !! test
20684 Tables: 4d. No escaping needed
20685 !! wikitext
20686 {|
20687 |[[Foo]]-bar
20688 ||+1
20689 ||-2
20690 |}
20691 !! html/php
20692 <table>
20693 <tr>
20694 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
20695 </td>
20696 <td>+1
20697 </td>
20698 <td>-2
20699 </td></tr></table>
20700
20701 !! html/parsoid
20702 <table>
20703 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
20704 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
20705 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
20706 </tbody></table>
20707 !! end
20708
20709 !! test
20710 Tables: Digest broken attributes on table and tr tag
20711 !! options
20712 parsoid=wt2html
20713 !! wikitext
20714 {| || |} ++
20715 |- || || ++ --
20716 |- > [
20717 |}
20718 !! html
20719 <table>
20720 <tbody>
20721 <tr></tr>
20722 <tr></tr>
20723 </tbody></table>
20724 !! end
20725
20726 #### --------------- Links ----------------
20727 #### 1. Quote marks in link text
20728 #### 2. Wikilinks: Escapes needed
20729 #### 3. Wikilinks: No escapes needed
20730 #### 4. Extlinks: Escapes needed
20731 #### 5. Extlinks: No escapes needed
20732 #### --------------------------------------
20733 !! test
20734 Links 1. Quote marks in link text
20735 !! options
20736 parsoid
20737 !! wikitext
20738 [[Foo|Foo<nowiki>''boo''</nowiki>]]
20739 !! html
20740 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
20741 !! end
20742
20743 !! test
20744 Links 2. WikiLinks: Escapes needed
20745 !! options
20746 parsoid
20747 !! wikitext
20748 [[Foo|[Foobar]]]
20749 [[Foo|<nowiki>Foobar]</nowiki>]]
20750 [[Foo|x [Foobar] x]]
20751 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
20752 [[Foo|<nowiki>[[Bar]]</nowiki>]]
20753 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
20754 [[Foo|<nowiki>|Bar</nowiki>]]
20755 [[Foo|<nowiki>]]bar</nowiki>]]
20756 [[Foo|<nowiki>[[bar</nowiki>]]
20757 [[Foo|<nowiki>x [[ y</nowiki>]]
20758 [[Foo|<nowiki>x ]] y</nowiki>]]
20759 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
20760 !! html
20761 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
20762 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
20763 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
20764 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
20765 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
20766 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
20767 <a href="Foo" rel="mw:WikiLink">|Bar</a>
20768 <a href="Foo" rel="mw:WikiLink">]]bar</a>
20769 <a href="Foo" rel="mw:WikiLink">[[bar</a>
20770 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
20771 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
20772 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
20773 !! end
20774
20775 !! test
20776 Links 3. WikiLinks: No escapes needed
20777 !! options
20778 parsoid
20779 !! wikitext
20780 [[Foo|[Foobar]]
20781 [[Foo|foo|bar]]
20782 !! html
20783 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
20784 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
20785 !! end
20786
20787 !! test
20788 Links 4. ExtLinks: Escapes needed
20789 !! options
20790 parsoid
20791 !! wikitext
20792 [http://google.com <nowiki>[google]</nowiki>]
20793 [http://google.com <nowiki>google]</nowiki>]
20794
20795 <nowiki>[http://google.com]</nowiki>
20796
20797 <nowiki>[http://google.com google]</nowiki>
20798
20799 !! html
20800 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
20801 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
20802 <p>[http://google.com]</p>
20803 <p>[http://google.com google]</p>
20804 !! end
20805
20806 !! test
20807 Links 5. ExtLinks: No escapes needed
20808 !! options
20809 parsoid
20810 !! wikitext
20811 [http://google.com [google]
20812 !! html
20813 <a href="http://google.com" rel="mw:ExtLink">[google</a>
20814 !! end
20815
20816 !! test
20817 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
20818 !! html/parsoid
20819 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
20820 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
20821 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
20822 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
20823 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
20824 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
20825 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20826 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
20827 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20828 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
20829 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
20830 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
20831 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
20832 </p>
20833 !! wikitext
20834 x<nowiki/>http://example.com<nowiki/>y
20835 http://example.com<nowiki/>?x
20836 http://example.com<nowiki/>&x
20837 http://example.com<nowiki/>'x
20838 http://example.com<nowiki/>,x
20839 http://example.com<nowiki/>.x
20840 http://example.com<nowiki/>;x
20841 http://example.com<nowiki/>:x
20842 http://example.com<nowiki/>;x
20843 http://example.com<nowiki/>!x
20844 http://example.com<nowiki/>=x
20845 http://example.com<nowiki/>(x)
20846 http://example.com(x<nowiki/>)
20847 !! end
20848
20849 !! test
20850 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20851 !! html/parsoid
20852 <p>x
20853 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
20854 y
20855 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
20856 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
20857 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
20858 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
20859 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
20860 </p>
20861 !! wikitext
20862 x
20863 http://example.com
20864 y
20865 "http://example.com"
20866 (http://example.com)
20867 (http://example.com) foo
20868 http://example.com,
20869 http://example.com, foo
20870 !! end
20871
20872 ## Parsoid currently fails wt2html on this one!
20873 !! test
20874 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20875 !! html/parsoid
20876 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
20877 !! wikitext
20878 http://example.com.,;:!?
20879 !! end
20880
20881 !! test
20882 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
20883 !! html/parsoid
20884 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
20885 !! wikitext
20886 RFC 123<nowiki/>4
20887 !! end
20888
20889 !! test
20890 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
20891 !! html/parsoid
20892 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20893 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20894 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
20895 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
20896 </p>
20897 !! wikitext
20898 xRFC 123y
20899 XRFC 123y
20900 RFC 123?foo
20901 RFC 123&foo
20902 !! end
20903
20904 !! test
20905 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
20906 !! html/parsoid
20907 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
20908 !! wikitext
20909 PMID 123<nowiki/>4
20910 !! end
20911
20912 !! test
20913 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
20914 !! html/parsoid
20915 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20916 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20917 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
20918 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
20919 </p>
20920 !! wikitext
20921 xPMID 123y
20922 XPMID 123y
20923 PMID 123?foo
20924 PMID 123&foo
20925 !! end
20926
20927 !! test
20928 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
20929 !! html/parsoid
20930 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
20931 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
20932 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
20933 </p>
20934 !! wikitext
20935 ISBN 1234567890<nowiki/>1
20936 ISBN 1234567890<nowiki/>x
20937 ISBN 1234567890<nowiki/>b
20938 !! end
20939
20940 !! test
20941 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
20942 !! html/parsoid
20943 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
20944 !! wikitext
20945 ISBN 1234567890's
20946 !! end
20947
20948 !! test
20949 Links 13: Protect link-like plain text. (Parsoid bug T78425)
20950 !! options
20951 parsoid=html2wt
20952 !! html/*
20953 <p>this is not a link: http://example.com
20954 </p>
20955 !! wikitext
20956 this is not a link: <nowiki>http://example.com</nowiki>
20957 !! end
20958
20959
20960 #### --------------- Quotes ---------------
20961 #### 1. Quotes inside <b> and <i>
20962 #### 2. Link fragments separated by <i> and <b> tags
20963 #### 3. Link fragments inside <i> and <b>
20964 #### 4. No escaping needed
20965 #### --------------------------------------
20966 !! test
20967 1a. Quotes inside <b> and <i>
20968 !! options
20969 parsoid=html2wt,wt2wt
20970 !! wikitext
20971 ''<nowiki/>'foo'<nowiki/>''
20972 ''<nowiki>''foo''</nowiki>''
20973 ''<nowiki>'''foo'''</nowiki>''
20974 ''foo''<nowiki/>'s
20975 '''<nowiki/>'foo'<nowiki/>'''
20976 '''<nowiki>''foo''</nowiki>'''
20977 '''<nowiki>'''foo'''</nowiki>'''
20978 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
20979 '''foo'''<nowiki/>'s
20980 '''foo''
20981 ''foo''<nowiki/>'
20982 ''foo'<nowiki/>''<nowiki/>'
20983 '<nowiki/>''foo''<nowiki/>'
20984 ''''foo'''
20985 '''foo'''<nowiki/>'
20986 '<nowiki/>'''foo'''<nowiki/>'
20987 ''fools'<span> errand</span>''
20988 ''<span>fool</span>'s errand''
20989 a|!*#-:;+-~[]{}b'''x''
20990 !! html/*
20991 <p><i>'foo'</i>
20992 <i>''foo''</i>
20993 <i>'''foo'''</i>
20994 <i>foo</i>'s
20995 <b>'foo'</b>
20996 <b>''foo''</b>
20997 <b>'''foo'''</b>
20998 <b>foo'<i>bar'</i>baz</b>
20999 <b>foo</b>'s
21000 '<i>foo</i>
21001 <i>foo</i>'
21002 <i>foo'</i>'
21003 '<i>foo</i>'
21004 '<b>foo</b>
21005 <b>foo</b>'
21006 '<b>foo</b>'
21007 <i>fools'<span> errand</span></i>
21008 <i><span>fool</span>'s errand</i>
21009 a|!*#-:;+-~[]{}b'<i>x</i>
21010 </p>
21011 !! end
21012
21013 !! test
21014 1b. Quotes inside <b> and <i> with other chars
21015 !! options
21016 parsoid=html2wt,wt2wt
21017 !! wikitext
21018 '''a'' foo ''[[bar]]''
21019 ''a''' foo ''[[bar]]''
21020 ''a''' foo '''{{echo|[[bar]]}}'''
21021 [[foo]] x'''[[bar]]''
21022 !! html
21023 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21024 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21025 <i>a'</i> foo <b><a rel="mw:WikiLink" href="Bar" title="Bar" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[bar]]"}},"i":0}}]}'>bar</a></b>
21026 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
21027 !! end
21028
21029 !! test
21030 2. Link fragments separated by <i> and <b> tags
21031 !! wikitext
21032 [[''foo''<nowiki>hello]]</nowiki>
21033
21034 [['''foo'''<nowiki>hello]]</nowiki>
21035 !! html
21036 <p>[[<i>foo</i>hello]]
21037 </p><p>[[<b>foo</b>hello]]
21038 </p>
21039 !! end
21040
21041 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
21042 # this is one of the shortcomings of this format
21043 !! test
21044 3. Link fragments inside <i> and <b>
21045 !! wikitext
21046 ''[[foo''<nowiki>]]</nowiki>
21047
21048 '''[[foo'''<nowiki>]]</nowiki>
21049 !! html
21050 <p><i>[[foo</i>]]
21051 </p><p><b>[[foo</b>]]
21052 </p>
21053 !! end
21054
21055 !! test
21056 4. No escaping needed
21057 !! wikitext
21058 '<span>''bar''</span>'
21059 '<span>'''bar'''</span>'
21060 'a:b'foo
21061 !! html
21062 <p>'<span><i>bar</i></span>'
21063 '<span><b>bar</b></span>'
21064 'a:b'foo
21065 </p>
21066 !! end
21067
21068 #### ----------- Paragraphs ---------------
21069 #### 1. No unnecessary escapes
21070 #### --------------------------------------
21071
21072 !! test
21073 1. No unnecessary escapes
21074 !! wikitext
21075 bar <span><nowiki>[[foo]]</nowiki></span>
21076
21077 =bar <span><nowiki>[[foo]]</nowiki></span>
21078
21079 [[bar <span><nowiki>[[foo]]</nowiki></span>
21080
21081 ]]bar <span><nowiki>[[foo]]</nowiki></span>
21082
21083 =bar <span>foo]]</span><nowiki>=</nowiki>
21084 !! html
21085 <p>bar <span>[[foo]]</span>
21086 </p><p>=bar <span>[[foo]]</span>
21087 </p><p>[[bar <span>[[foo]]</span>
21088 </p><p>]]bar <span>[[foo]]</span>
21089 </p><p>=bar <span>foo]]</span>=
21090 </p>
21091 !!end
21092
21093 #### ----------------------- PRE --------------------------
21094 #### 1. Leading whitespace in SOL context should be escaped
21095 #### ------------------------------------------------------
21096 !! test
21097 1. Leading whitespace in SOL context should be escaped
21098 !! options
21099 parsoid
21100 !! wikitext
21101 <nowiki> </nowiki>a
21102
21103 <nowiki> </nowiki> a
21104
21105 <nowiki> </nowiki>a(tab)
21106
21107 <nowiki> </nowiki> a
21108 <!--cmt-->
21109 <nowiki> </nowiki> a
21110
21111 a
21112 <nowiki> </nowiki>b
21113
21114 a
21115 <nowiki> </nowiki>b
21116
21117 a
21118 <nowiki> </nowiki> b
21119 !! html
21120 <p> a</p>
21121 <p> a</p>
21122 <p> a(tab)</p>
21123 <p> a</p>
21124 <p><!--cmt--> a</p>
21125 <p>a
21126 b</p>
21127 <p>a
21128 b</p>
21129 <p>a
21130 b</p>
21131 !! end
21132
21133 !! test
21134 2. Leading whitespace in non-indent-pre contexts should not be escaped
21135 !! options
21136 parsoid
21137 !! wikitext
21138 foo <ref>''a''
21139 b</ref>
21140 !! html
21141 <p>foo <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[9,14,2,2]}&#39;>a&lt;/i>\n b"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
21142 !! end
21143
21144 !! test
21145 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
21146 !! options
21147 parsoid
21148 !! wikitext
21149 <blockquote>
21150 a
21151 <span>b</span>
21152 c
21153 </blockquote>
21154 !! html
21155 <blockquote>
21156 <p>
21157 a
21158 <span>b</span>
21159 c</p>
21160 </blockquote>
21161 !! end
21162
21163 !! test
21164 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
21165 !! options
21166 parsoid
21167 !! wikitext
21168 [[File:Foobar.jpg|thumb|caption]]
21169 !! html
21170 !! html/parsoid
21171 <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>
21172 !! end
21173
21174 !! test
21175 5. Nowiki escaping should account for indent-pres
21176 !! options
21177 parsoid=html2wt
21178 !! html
21179 <pre>==foo==</pre>
21180 !! wikitext
21181 ==foo==
21182 !! end
21183
21184 #### --------------- Behavior Switches --------------------
21185 !! test
21186 1. Valid behavior switches should be escaped
21187 !! options
21188 parsoid=html2wt
21189 !! wikitext
21190 <nowiki>__TOC__</nowiki>
21191 ''<nowiki>__TOC__</nowiki>''
21192 !! html
21193 __TOC__
21194 <i>__TOC__</i>
21195 !! end
21196
21197 !! test
21198 2. Invalid behavior switches should not be escaped
21199 !! options
21200 parsoid=html2wt
21201 !! wikitext
21202 __TOO__
21203 __|__
21204 !! html
21205 __TOO__
21206 __|__
21207 !! end
21208
21209 #### --------------- HTML tags ---------------
21210 #### 1. a tags
21211 #### 2. other tags
21212 #### 3. multi-line html tag
21213 #### 4. extension tags
21214 #### -----------------------------------------
21215 !! test
21216 1. a tags
21217 !! options
21218 parsoid
21219 !! wikitext
21220 <a href="http://google.com">google</a>
21221 !! html
21222 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
21223 !! end
21224
21225 !! test
21226 2. other tags
21227 !! wikitext
21228 <nowiki><div>foo</div>
21229 <div style="color:red">foo</div></nowiki>
21230 !! html
21231 <p>&lt;div&gt;foo&lt;/div&gt;
21232 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
21233 </p>
21234 !! end
21235
21236 !! test
21237 3. multi-line html tag
21238 !! wikitext
21239 <nowiki><div
21240 >foo</div
21241 ></nowiki>
21242 !! html
21243 <p>&lt;div
21244 &gt;foo&lt;/div
21245 &gt;
21246 </p>
21247 !! end
21248
21249 !! test
21250 4. extension tags
21251 !! wikitext
21252 <nowiki><ref>foo</ref></nowiki>
21253
21254 <nowiki><ref>bar</nowiki>
21255
21256 baz<nowiki></ref></nowiki>
21257 !! html
21258 <p>&lt;ref&gt;foo&lt;/ref&gt;
21259 </p><p>&lt;ref&gt;bar
21260 </p><p>baz&lt;/ref&gt;
21261 </p>
21262 !! end
21263
21264 #### --------------- Others ---------------
21265 !! test
21266 Escaping nowikis
21267 !! wikitext
21268 &lt;nowiki&gt;foo&lt;/nowiki&gt;
21269 !! html
21270 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
21271 </p>
21272 !! end
21273
21274 ## The quote-char in the input is necessary for triggering the bug
21275 !! test
21276 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
21277 !! options
21278 parsoid=wt2wt,html2wt
21279 !! wikitext
21280 foo's bar :
21281 !! html
21282 <p>foo's bar :</p>
21283 !! end
21284
21285 !! test
21286
21287 Tag-like HTML structures are passed through as text
21288 !! wikitext
21289 <x y>
21290
21291 <x.y>
21292
21293 <x-y>
21294
21295 1>2
21296
21297 x<y
21298
21299 a>b
21300
21301 1<d e>f
21302 !! html
21303 <p>&lt;x y&gt;
21304 </p><p>&lt;x.y&gt;
21305 </p><p>&lt;x-y&gt;
21306 </p><p>1&gt;2
21307 </p><p>x&lt;y
21308 </p><p>a&gt;b
21309 </p><p>1&lt;d e&gt;f
21310 </p>
21311 !! end
21312
21313
21314 # This was a bug in the PHP parser (see bug 17663 and its dups,
21315 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
21316 !! test
21317 Tag names followed by punctuation should not be recognized as tags
21318 !! wikitext
21319 <s.ome> text
21320 !! html
21321 <p>&lt;s.ome&gt; text
21322 </p>
21323 !! end
21324
21325 !! test
21326 HTML tag with necessary entities in attributes
21327 !! wikitext
21328 <span title="&amp;amp;">foo</span>
21329 !! html
21330 <p><span title="&amp;amp;">foo</span>
21331 </p>
21332 !! end
21333
21334 !! test
21335 HTML tag with 'unnecessary' entity encoding in attributes
21336 !! wikitext
21337 <span title="&amp;">foo</span>
21338 !! html
21339 <p><span title="&amp;">foo</span>
21340 </p>
21341 !! end
21342
21343 !! test
21344 HTML tag with broken attribute value quoting
21345 !! wikitext
21346 <span title="Hello world>Foo</span>
21347 !! html/php
21348 <p><span>Foo</span>
21349 </p>
21350 !! html/parsoid
21351 <p><span title="Hello world">Foo</span>
21352 </p>
21353 !! end
21354
21355 !! test
21356 Parsoid-only: HTML tag with broken attribute value quoting
21357 !! options
21358 parsoid
21359 !! wikitext
21360 <span title="Hello world>Foo</span>
21361 !! html
21362 <p><span title="Hello world">Foo</span>
21363 </p>
21364 !! end
21365
21366 !! test
21367 Table with broken attribute value quoting
21368 !! wikitext
21369 {|
21370 | title="Hello world|Foo
21371 |}
21372 !! html/php
21373 <table>
21374 <tr>
21375 <td>Foo
21376 </td></tr></table>
21377
21378 !! html/parsoid
21379 <table>
21380 <tr>
21381 <td title="Hello world">Foo
21382 </td></tr></table>
21383
21384 !! end
21385
21386 !! test
21387 Table with broken attribute value quoting on consecutive lines
21388 !! wikitext
21389 {|
21390 | title="Hello world|Foo
21391 | style="color:red|Bar
21392 |}
21393 !! html/php
21394 <table>
21395 <tr>
21396 <td>Foo
21397 </td>
21398 <td>Bar
21399 </td></tr></table>
21400
21401 !! html/parsoid
21402 <table><tbody>
21403 <tr>
21404 <td title="Hello world">Foo
21405 </td><td style="color: red">Bar
21406 </td></tr></tbody></table>
21407
21408 !! end
21409
21410 !! test
21411 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21412 !! options
21413 parsoid
21414 !! wikitext
21415 {{}}
21416 !! html
21417 {{}}
21418 !! end
21419
21420 !! test
21421 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21422 !! options
21423 parsoid
21424 !! wikitext
21425 }}{{
21426 !! html
21427 }}{{
21428 !! end
21429
21430 !!test
21431 Accept empty td cell attribute
21432 !! wikitext
21433 {|
21434 | align="center" | foo || |
21435 |}
21436 !! html
21437 <table>
21438 <tr>
21439 <td align="center"> foo </td>
21440 <td>
21441 </td></tr></table>
21442
21443 !!end
21444
21445 !!test
21446 Non-empty attributes in th-cells
21447 !! wikitext
21448 {|
21449 ! Foo !! style="color: red" | Bar
21450 |}
21451 !! html
21452 <table>
21453 <tr>
21454 <th> Foo </th>
21455 <th style="color: red"> Bar
21456 </th></tr></table>
21457
21458 !!end
21459
21460 !!test
21461 Accept empty attributes in th-cells
21462 !! wikitext
21463 {|
21464 !| foo !!| bar
21465 |}
21466 !! html
21467 <table>
21468 <tr>
21469 <th> foo </th>
21470 <th> bar
21471 </th></tr></table>
21472
21473 !!end
21474
21475 !!test
21476 Empty table rows go away
21477 !! wikitext
21478 {|
21479 | Hello
21480 | there
21481 |- class="foo"
21482 |-
21483 |}
21484 !! html
21485 <table>
21486 <tr>
21487 <td> Hello
21488 </td>
21489 <td> there
21490 </td></tr>
21491
21492 </table>
21493
21494 !! end
21495
21496 ###
21497 ### Parsoid-centric tests for testing RTing of inter-element separators
21498 ### Edge cases not tested by existing parser tests and specific to
21499 ### Parsoid-specific serialization strategies.
21500 ###
21501
21502 !!test
21503 RT-ed inter-element separators should be valid separators
21504 !! wikitext
21505 {|
21506 |- [[foo]]
21507 |}
21508 !! html
21509 <table>
21510
21511 </table>
21512
21513 !!end
21514
21515 # Parsoid-only since PHP parser relies on Tidy for correct output
21516 !!test
21517 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
21518 !!options
21519 parsoid
21520 !! wikitext
21521 {|
21522 |<small>foo
21523 bar
21524 |}
21525
21526 {|
21527 |<small>foo<small>
21528 |}
21529 !! html
21530 <table>
21531 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
21532 <p>bar</p></small></td></tr>
21533 </tbody></table>
21534
21535 <table>
21536 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo<small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></small></td></tr>
21537 </tbody></table>
21538 !!end
21539
21540 !!test
21541 Empty TD followed by TD with tpl-generated attribute
21542 !! wikitext
21543 {|
21544 |-
21545 |
21546 |{{echo|style='color:red'}}|foo
21547 |}
21548 !! html
21549 <table>
21550
21551 <tr>
21552 <td>
21553 </td>
21554 <td>foo
21555 </td></tr></table>
21556
21557 !!end
21558
21559 !!test
21560 Indented table with an empty td
21561 !! wikitext
21562 {|
21563 |-
21564 |
21565 |foo
21566 |}
21567 !! html
21568 <table>
21569
21570 <tr>
21571 <td>
21572 </td>
21573 <td>foo
21574 </td></tr></table>
21575
21576 !!end
21577
21578 !!test
21579 Indented block & table
21580 !! wikitext
21581 <div>foo</div>
21582 {|
21583 |foo
21584 |}
21585 !! html/php
21586 <div>foo</div>
21587 <table>
21588 <tr>
21589 <td>foo
21590 </td></tr></table>
21591
21592 !! html/parsoid
21593 <div data-parsoid='{"stx":"html"}'>foo</div>
21594 <table><tbody>
21595 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
21596 </tbody></table>
21597 !!end
21598
21599 !! test
21600 Indent and comment before table row
21601 !! wikitext
21602 {|
21603 <!--hi-->|-
21604 | there
21605 |}
21606 !! html/php
21607 <table>
21608
21609 <tr>
21610 <td> there
21611 </td></tr></table>
21612
21613 !! html/parsoid
21614 <table>
21615 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
21616 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
21617 </tbody></table>
21618 !! end
21619
21620 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
21621 !!test
21622 Empty TR followed by a template-generated TR
21623 !!options
21624 parsoid
21625 !! wikitext
21626 {|
21627 |-
21628 {{echo|<tr><td>foo</td></tr>}}
21629 |}
21630 !! html
21631 <table>
21632 <tbody>
21633 <tr></tr>
21634 <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}}]}'>
21635 <td>foo</td></tr>
21636 </tbody></table>
21637 !!end
21638
21639 ## PHP and parsoid output differ for this, and since this is primarily
21640 ## for testing Parsoid's serializer, marking this Parsoid only
21641 !!test
21642 Empty TR followed by mixed-ws-comment line should RT correctly
21643 !!options
21644 parsoid
21645 !! wikitext
21646 {|
21647 |-
21648 <!--c-->
21649 |-
21650 <!--c--> <!--d-->
21651 |}
21652 !! html
21653 <table>
21654 <tbody>
21655 <tr></tr>
21656 <!--c-->
21657 <tr>
21658 <!--c--> </tr><!--d-->
21659 </tbody></table>
21660
21661 !!end
21662
21663 !!test
21664 Multi-line image caption generated by templates with/without trailing newlines
21665 !! wikitext
21666 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
21667 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
21668 !! html/parsoid
21669 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" height="34" width="300"/></a><figcaption>foo\n<span about="#mwt9" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"A"}},"i":0}}]}'>A</span>\n<span about="#mwt10" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"B"}},"i":0}}]}'>B</span>\n<span about="#mwt11" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"C"}},"i":0}}]}'>C</span></figcaption></figure>
21670 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" height="34" width="300"/></a><figcaption>foo\n<span about="#mwt12" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"A"}},"i":0}}]}'>A</span>\n<span about="#mwt13" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"B"}},"i":0}}]}'>B</span>\n<span about="#mwt14" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"C"}},"i":0}}]}'>C</span>\n\n</figcaption></figure>
21671 !!end
21672
21673 !! test
21674 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
21675 !! options
21676 parsoid=html2wt
21677 !! wikitext
21678 <includeonly>foo</includeonly>
21679 new para
21680
21681 [[./Category:Foo]]
21682
21683 = new heading =
21684 !! html
21685 <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>
21686
21687 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
21688 !! end
21689
21690 ## PHP emits broken html for this, and since this is primarily
21691 ## a Parsoid serializer test, marking this Parsoid only
21692 !!test
21693 Improperly nested inline or quotes tags with whitespace in between
21694 !!options
21695 parsoid
21696 !! wikitext
21697 <span> <s>x</span> </s>
21698 ''' ''x''' ''
21699 !! html
21700 <p><span> <s>x</s></span><s> </s>
21701 <b> <i>x</i></b><i> </i>
21702 </p>
21703 !!end
21704
21705 !!test
21706 Encapsulate protected attributes from wt
21707 !!options
21708 parsoid
21709 !! wikitext
21710 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
21711 !! html
21712 <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>
21713 </body>
21714 !!end
21715
21716 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
21717 ## Having nested or stray pre tags results in the attempt to add duplicates,
21718 ## causing an assertion fail. This test tries to prevent that situation.
21719 !!test
21720 Ensure ParagraphWrapper can deal with stray closing pre tags
21721 !!options
21722 parsoid=wt2html
21723 !! wikitext
21724 plain text</pre>
21725 !! html
21726 plain text
21727 !!end
21728
21729 !!test
21730 1. Ensure fostered text content is wrapped in element nodes
21731 !!options
21732 parsoid=wt2html
21733 !! wikitext
21734 <table>hi</table><table>ho</table>
21735 !! html
21736 <p>hi</p>
21737 <table></table>
21738 <p>ho</p>
21739 <table></table>
21740 !!end
21741
21742 !!test
21743 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
21744 !!options
21745 parsoid=wt2html,wt2wt
21746 !! wikitext
21747 <table>
21748 <tr> || ||
21749 <td> a
21750 </table>
21751 !! html
21752 <p> || ||
21753 </p><table>
21754 <tbody><tr><td> a</td></tr>
21755 </tbody></table>
21756 !!end
21757
21758 !!test
21759 Encapsulation properly handles null DSR information from foster box
21760 !!options
21761 parsoid=wt2html,wt2wt
21762 !! wikitext
21763 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
21764 !! html
21765 <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;<table>foo<tr><td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span><table><tbody><tr><td>bar</td></tr></tbody></table>
21766 !!end
21767
21768 !!test
21769 1. Encapsulate foster-parented transclusion content
21770 !!options
21771 parsoid=wt2wt,wt2html
21772 !! wikitext
21773 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
21774 !! html
21775 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<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<tr><td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</p><table>
21776 <tbody>
21777 <tr>
21778 <td>bar</td>
21779 </tr>
21780 </tbody>
21781 </table>
21782 !!end
21783
21784 !!test
21785 2. Encapsulate foster-parented transclusion content
21786 !!options
21787 parsoid=wt2wt,wt2html
21788 !! wikitext
21789 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
21790 !! html
21791 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><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><tr><td>bar</td></tr></table>&quot;]}">foo</div>
21792 <table>
21793 <tbody>
21794 <tr>
21795 <td>bar</td>
21796 </tr>
21797 </tbody>
21798 </table>
21799 !!end
21800
21801 !!test
21802 3. Encapsulate foster-parented transclusion content
21803 !!options
21804 parsoid=wt2wt,wt2html
21805 !! wikitext
21806 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21807 !! html
21808 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div><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><tr><td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
21809 <p>foo</p>
21810 </div>
21811 <table>
21812 <tbody>
21813 <tr>
21814 <td>bar</td>
21815 </tr>
21816 </tbody>
21817 </table>
21818 !!end
21819
21820 !!test
21821 4. Encapsulate foster-parented transclusion content
21822 !!options
21823 parsoid=wt2wt,wt2html
21824 !! wikitext
21825 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21826 !! html
21827 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div><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><tr><td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
21828 <p>foo</p>
21829 </div>
21830 <table>
21831 <tbody>
21832 <tr>
21833 <td>bar</td>
21834 </tr>
21835 </tbody>
21836 </table>
21837 !!end
21838
21839 !!test
21840 5. Encapsulate foster-parented transclusion content
21841 !!options
21842 parsoid=wt2wt,wt2html
21843 !! wikitext
21844 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
21845 !! html
21846 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><tr><td><div><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</p>
21847 <table>
21848 <tbody>
21849 <tr>
21850 <td>
21851 <div>
21852 <p>foo</p>
21853 </div>
21854 </td>
21855 </tr>
21856 </tbody>
21857 </table>
21858 !!end
21859
21860 !!test
21861 6. Encapsulate foster-parented transclusion content
21862 !!options
21863 parsoid=wt2wt,wt2html
21864 !! wikitext
21865 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
21866 !! html
21867 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><tr><td><div><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</p>
21868 <table>
21869 <tbody>
21870 <tr>
21871 <td>
21872 <div>
21873 <p>foo</p>
21874 </div>
21875 </td>
21876 </tr>
21877 </tbody>
21878 </table>
21879 <p>ok</p>
21880 !!end
21881
21882 !!test
21883 7. Encapsulate foster-parented transclusion content
21884 !!options
21885 parsoid=wt2wt,wt2html
21886 !! wikitext
21887 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
21888 !! html
21889 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<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;<p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;<td>bar</td></table>&quot;]}">foo</p>
21890 <table>
21891 <tbody>
21892 <tr>
21893 <td>bar</td>
21894 </tr>
21895 </tbody>
21896 </table>
21897 !!end
21898
21899 !!test
21900 8. Encapsulate foster-parented transclusion content
21901 !!options
21902 parsoid=wt2wt,wt2html
21903 !! wikitext
21904 {{echo|a
21905 }}{|{{echo|style='color:red'}}
21906 |-
21907 |b
21908 |}
21909 !! html
21910 <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><p 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}}}</p><table>
21911 <tbody>
21912 <tr>
21913 <td>b</td>
21914 </tr>
21915 </tbody>
21916 </table>
21917 !!end
21918
21919 !!test
21920 9. Encapsulate foster-parented transclusion content
21921 !!options
21922 parsoid=wt2wt,wt2html
21923 !! wikitext
21924 <table>{{echo|hi</table>hello}}
21925 !! html
21926 <p 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</p><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><p about="#mwt2">hello</p>
21927 !!end
21928
21929 !!test
21930 Table in fosterable position
21931 !!options
21932 parsoid=wt2html,wt2wt
21933 !! wikitext
21934 {{OpenTable}}
21935 <div>
21936 {|
21937 |}
21938 </div>
21939 |}
21940 !! html
21941 <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">
21942 </span>
21943 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
21944
21945 <table>
21946 </table>
21947 !!end
21948
21949 # Parsoid only for bug 64747
21950 !! test
21951 Properly encapsulate empty-content transclusions in fosterable positions
21952 !! wikitext
21953 <table>
21954 {{#if:|
21955 <td>foo</td>
21956 }}
21957 </table>
21958 !! html/parsoid
21959 <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>"}'>
21960
21961 </table>
21962 !! end
21963
21964 !!test
21965 Support <object> element with .data attribute
21966 !!options
21967 parsoid=html2wt
21968 !! wikitext
21969 <object data="test.swf"></object>
21970 !! html
21971 <object data="test.swf"></object>
21972 !!end
21973
21974 !! test
21975 Don't block XML namespace declaration
21976 !! wikitext
21977 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
21978 !! html/php
21979 <p><span>MediaWiki</span>
21980 </p>
21981 !! html/parsoid
21982 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
21983 !! end
21984
21985 # -----------------------------------------------------------------
21986 # The following section of tests are primarily to spec requirements
21987 # around serialization of new/edited content.
21988 #
21989 # All these tests are marked Parsoid html2wt and html2html only
21990 # ----------------------------------------------------------------
21991
21992 # 'mi' is a localinterwiki prefix as well as a language
21993 !! test
21994 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
21995 !! options
21996 parsoid=html2wt
21997 !! wikitext
21998 [[Foo]]
21999 !! html
22000 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
22001 !! end
22002
22003 !! test
22004 New wiki links (href variations)
22005 !! options
22006 parsoid=html2wt
22007 !! html
22008 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22009 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
22010 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
22011 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
22012 !! wikitext
22013 [[Foo_bar]]
22014 [[Foo_bar]]
22015 [[Foo_bar]]
22016 [[Toxine bactérienne]]
22017 !! end
22018
22019 !! test
22020 New wiki links (content string variations)
22021 !! options
22022 parsoid=html2wt
22023 !! html
22024 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22025 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
22026 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
22027 !! wikitext
22028 [[Foo_bar]]
22029 [[Foo bar]]
22030 [[Foo_bar|./Foo_bar]]
22031 !! end
22032
22033 !! test
22034 New category links (href variations)
22035 !! options
22036 parsoid=html2wt
22037 !! html
22038 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
22039 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
22040 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
22041 !! wikitext
22042 [[Category:Toxine bactérienne]]
22043 [[Category:Toxine bactérienne]]
22044 [[Category:Toxine bactérienne]]
22045 !! end
22046
22047 !! test
22048 New interlanguage links (href variations)
22049 !! options
22050 parsoid=html2wt
22051 !! html
22052 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
22053 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
22054 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
22055 !! wikitext
22056 [[es:Toxine bactérienne]]
22057 [[es:Toxine_bactérienne]]
22058 [[es:Toxine_bactérienne]]
22059 !! end
22060
22061 !! test
22062 Image: Modifying size of an image (1)
22063 !! options
22064 parsoid={
22065 "modes": ["wt2wt"],
22066 "changes": [
22067 ["img[height]", "attr", "height", "22"],
22068 ["img[width]", "attr", "width", "200"]
22069 ]
22070 }
22071 !! wikitext
22072 [[Image:Foobar.jpg|230x230px]]
22073 !! wikitext/edited
22074 [[Image:Foobar.jpg|200x200px]]
22075 !!end
22076
22077 !! test
22078 Image: Modifying size of an image (2)
22079 !! options
22080 parsoid={
22081 "modes": ["wt2wt"],
22082 "changes": [
22083 ["img[height]", "attr", "height", "100"],
22084 ["img[width]", "attr", "width", "500"]
22085 ]
22086 }
22087 !! wikitext
22088 [[Image:Foobar.jpg|230x230px]]
22089 !! wikitext/edited
22090 [[Image:Foobar.jpg|500x500px]]
22091 !!end
22092
22093 # Change in size is ignored so long as class='mw-default-size'
22094 !! test
22095 Image: Modifying size of an image (3)
22096 !! options
22097 parsoid={
22098 "modes": ["wt2wt"],
22099 "changes": [
22100 ["figure[class]", "removeClass", "mw-default-size"],
22101 ["figure img", "attr", "height", "19"],
22102 ["figure img", "attr", "width", "170"]
22103 ]
22104 }
22105 !! wikitext
22106 [[Image:Foobar.jpg|thumb]]
22107 !! wikitext/edited
22108 [[Image:Foobar.jpg|thumb|170x170px]]
22109 !!end
22110
22111 !! test
22112 Image: Modifying alignment of an image (bug 48665)
22113 !! options
22114 parsoid={
22115 "modes": ["wt2wt"],
22116 "changes": [
22117 ["figure[class]", "removeClass", "mw-halign-right"],
22118 ["figure[class]", "addClass", "mw-halign-left"]
22119 ]
22120 }
22121 !! wikitext
22122 [[Image:Foobar.jpg|thumb|caption|right]]
22123 !! wikitext/edited
22124 [[Image:Foobar.jpg|thumb|caption|left]]
22125 !! end
22126
22127 !! test
22128 Image: Modifying mw-default-size of an frameless image (bug 62805)
22129 !! options
22130 parsoid={
22131 "modes": ["wt2wt"],
22132 "changes": [
22133 ["figure.mw-default-size", "removeClass", "mw-default-size"]
22134 ]
22135 }
22136 !! wikitext
22137 [[Image:Foobar.jpg|frameless|right]]
22138 !! wikitext/edited
22139 [[Image:Foobar.jpg|frameless|right|220x220px]]
22140 !! end
22141
22142 !! test
22143 Image: Modifying valign of an image (bug 49221)
22144 !! options
22145 parsoid={
22146 "modes": ["wt2wt"],
22147 "changes": [
22148 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
22149 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
22150 ]
22151 }
22152 !! wikitext
22153 [[File:Foobar.jpg|20px|middle]]
22154 !! wikitext/edited
22155 [[File:Foobar.jpg|20px|text-top]]
22156 !! end
22157
22158 !! test
22159 Image: Modifying alt attribute of an image (bug 56400)
22160 !! options
22161 parsoid={
22162 "modes": ["wt2wt"],
22163 "changes": [
22164 ["img[alt]", "attr", "alt", "some alternate edited text"]
22165 ]
22166 }
22167 !! wikitext
22168 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
22169 !! wikitext/edited
22170 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
22171 !!end
22172
22173 !! test
22174 Image: Modifying caption of an image
22175 !! options
22176 parsoid={
22177 "modes": ["wt2wt"],
22178 "changes": [
22179 ["figcaption", "text", "new caption"]
22180 ]
22181 }
22182 !! wikitext
22183 [[Image:Foobar.jpg|thumb|original caption]]
22184 !! wikitext/edited
22185 [[Image:Foobar.jpg|thumb|new caption]]
22186 !!end
22187
22188 !! test
22189 Image: empty alt attribute (bug 48924)
22190 !! options
22191 parsoid
22192 !! wikitext
22193 [[File:Foobar.jpg|thumb|alt=|bar]]
22194 !! html
22195 <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>
22196 !! end
22197
22198 #!! test
22199 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
22200 #!! options
22201 #parsoid=html2wt
22202 #language=ar
22203 #!! wikitext
22204 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
22205 #!! html
22206 #<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>
22207 #!! end
22208
22209 !! test
22210 Image: Block level image should have \n before and after
22211 !! wikitext
22212 123
22213 [[File:Foobar.jpg|right|thumb|150x150px]]
22214 456
22215 !! html/parsoid
22216 <p>123</p>
22217 <figure class="mw-halign-right" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="17" width="150"/></a></figure>
22218 <p>456</p>
22219 !!end
22220
22221 !! test
22222 Image: New block level image should have \n before and after (existing content)
22223 !! wikitext
22224 123
22225 [[File:Foobar.jpg|right|thumb|150x150px]]
22226 456
22227 !! html/parsoid
22228 <p>123</p>
22229 <figure class="mw-halign-right" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"right","ak":"right"},{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"150x150px"}]}'><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/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>
22230 <p>456</p>
22231 !!end
22232
22233 !! test
22234 Image: upright option (parsoid)
22235 !! options
22236 parsoid
22237 !! wikitext
22238 [[File:Foobar.jpg|thumb|upright|caption]]
22239 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
22240 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
22241 !! html
22242 <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>
22243 <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>
22244 <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>
22245 !!end
22246
22247 !! test
22248 Image: upright option is ignored on inline and frame images (parsoid)
22249 !! options
22250 parsoid
22251 !! wikitext
22252 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
22253 !! html
22254 <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>
22255 !!end
22256
22257 !! test
22258 Image: from basic HTML (1)
22259 !! options
22260 parsoid=html2wt
22261 !! html/parsoid
22262 <span typeof="mw:Image">
22263 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22264 </span>
22265 !! wikitext
22266 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22267 !! end
22268
22269 !! test
22270 Image: from basic HTML (2)
22271 !! options
22272 parsoid=html2wt
22273 !! html/parsoid
22274 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22275 !! wikitext
22276 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22277 !! end
22278
22279 !! test
22280 Image: from basic HTML (3)
22281 !! options
22282 parsoid=html2wt
22283 !! html/parsoid
22284 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
22285 !! wikitext
22286 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
22287 !! end
22288
22289 !! test
22290 Image: from basic HTML (4)
22291 !! options
22292 parsoid=html2wt
22293 !! html/parsoid
22294 <img src="File:Foobar.jpg">
22295 !! wikitext
22296 [[File:Foobar.jpg|link=]]
22297 !! end
22298
22299 !! test
22300 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
22301 !! options
22302 parsoid=html2wt
22303 !! wikitext
22304 * foo
22305 !! html
22306 <ul>
22307 <li><p>foo</p></li>
22308 </ul>
22309 !! end
22310
22311 !! test
22312 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
22313 !! options
22314 parsoid=html2wt
22315 !! wikitext
22316 * foo
22317 !! html
22318 <ul> <li>foo</li></ul>
22319 !! end
22320
22321 !! test
22322 Don't strip leading whitespace when handling indent-pre suppressing tags
22323 !! options
22324 parsoid=html2wt
22325 !! wikitext
22326 {|
22327 | indented row
22328 |}
22329 <blockquote>
22330 '''This is very bold of you!'''
22331
22332 {|
22333 |
22334 indented cell (no pre-wrapping!)
22335 |}
22336 </blockquote>
22337 foo
22338 <div>bar</div>
22339 !! html
22340 <table>
22341 <tr><td> indented row</td></tr>
22342 </table>
22343 <blockquote><p>
22344 <b>This is very bold of you!</b>
22345 </p>
22346 <table><tr><td>
22347 indented cell (no pre-wrapping!)
22348 </td></tr></table>
22349 </blockquote>
22350 <p>foo</p>
22351 <div>bar</div>
22352 !! end
22353
22354 !! test
22355 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
22356 !! options
22357 parsoid=html2wt
22358 !! wikitext
22359 foo
22360 <nowiki> </nowiki><span>bar</span>
22361
22362 <span>foo2
22363 <nowiki> </nowiki></span>bar2
22364
22365 <div>foo</div>
22366 <nowiki> </nowiki><span>bar</span>
22367
22368 <div>
22369 <nowiki> </nowiki><span>foo</span>
22370 </div>
22371 !! html
22372 <p>foo</p>
22373 <span>bar</span>
22374
22375 <span>foo2
22376 </span>bar2
22377
22378 <div>foo</div>
22379 <span>bar</span>
22380
22381 <div>
22382 <span>foo</span>
22383 </div>
22384 !! end
22385
22386 !! test
22387 Lists: Add space after bullets
22388 !! options
22389 parsoid=html2wt
22390 !! wikitext
22391 * foo
22392 * bar
22393 * <span> baz</span>
22394 !! html
22395 <ul>
22396 <li>foo</li>
22397 <li> bar</li>
22398 <li><span> baz</span></li>
22399 </ul>
22400 !! end
22401
22402 !! test
22403 Lists: Dont insert newlines in a serialized list item.
22404 !! options
22405 parsoid=html2wt
22406 !! wikitext
22407 * a<br>b
22408 * c
22409 !! html
22410 <ul><li>a<br>b</li><li>c</li></ul>
22411 !! end
22412
22413 !! test
22414 Headings: Add space before/after == (Bug 51744)
22415 !! options
22416 parsoid=html2wt
22417 !! wikitext
22418 == foo ==
22419
22420 == bar ==
22421
22422 == baz ==
22423
22424 == <span> baz</span> ==
22425 !! html
22426 <h2>foo</h2>
22427 <h2> bar</h2>
22428 <h2>baz </h2>
22429 <h2><span> baz</span></h2>
22430 !! end
22431
22432 !! test
22433 Parsoid: Serialize positional parameters with = in them as named parameter
22434 !! options
22435 parsoid=html2wt
22436 !! wikitext
22437 {{echo|1 = f=oo}}
22438
22439 {{echo|1 = f=oo|2 = bar}}
22440
22441 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22442 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22443 {{echo|<nowiki>f=oo</nowiki>|bar}}
22444 !! html
22445 <p about="#mwt1" typeof="mw:Transclusion"
22446 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
22447
22448 <p about="#mwt1" typeof="mw:Transclusion"
22449 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
22450
22451 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22452 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22453 <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>
22454 !! end
22455
22456 !! test
22457 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
22458 !! options
22459 parsoid=html2wt
22460 !! wikitext
22461 <div>a
22462 b
22463 </div>
22464 <div>a
22465 b
22466 </div>
22467 <div>
22468 a
22469
22470 b
22471 </div>
22472 !! html
22473 <div>a<p>b</p></div>
22474 <div>a
22475 <p>b</p></div>
22476 <div>
22477 a
22478 <p>b</p></div>
22479 !! end
22480
22481 !! test
22482 Substrings resembling wikitext in hrefs should not get nowiki escapes
22483 !! options
22484 parsoid=html2wt
22485 !! wikitext
22486 [[Foo''bar''baz]]
22487 !! html
22488 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
22489 !! end
22490
22491 #-----------------------------
22492 # I/B quote minimization tests
22493 #-----------------------------
22494
22495 !! test
22496 1. I/B quote minimization: wikitext-only tags should be combined
22497 !! options
22498 parsoid=html2wt
22499 !! wikitext
22500 ''AB''
22501
22502 '''AB'''
22503
22504 ''A'''B'''''
22505
22506 '''A''B'''''
22507
22508 '''A''BC''D'''
22509
22510 '''''AB'''''
22511
22512 '''''AB'''''
22513
22514 '''''AB'''''
22515 !! html
22516 <p><i>A</i><i>B</i></p>
22517 <p><b>A</b><b>B</b></p>
22518 <p><i>A</i><b><i>B</i></b></p>
22519 <p><b>A</b><i><b>B</b></i></p>
22520 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
22521 <p><i><b>A</b></i><i><b>B</b></i></p>
22522 <p><i><b>A</b></i><b><i>B</i></b></p>
22523 <p><b><i>A</i></b><i><b>B</b></i></p>
22524 !! end
22525
22526 !! test
22527 2. I/B quote minimization: wikitext and html tags should not be combined
22528 !! options
22529 parsoid=html2wt
22530 !! wikitext
22531 ''A''<i>B</i>
22532
22533 ''A''<nowiki/>'''<i>B</i>'''
22534 !! html
22535 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
22536 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
22537 !! end
22538
22539 !! test
22540 3. I/B quote minimization: templated content stops minimization
22541 !! options
22542 parsoid=html2wt
22543 !! wikitext
22544 ''A''{{echo|''B''}}
22545
22546 ''A''{{echo|'''''B'''''}}
22547 !! html
22548 <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>
22549 <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>
22550 !! end
22551
22552 !! test
22553 4. I/B quote minimization: new content should be mimimized with adjacent old content
22554 !! options
22555 parsoid=html2wt
22556 !! wikitext
22557 ''AB''
22558
22559 '''AB'''
22560
22561 ''A'''B'''''
22562 !! html
22563 <p><i>A</i><i>B</i></p>
22564 <p><b>A</b><b>B</b></p>
22565 <p><i>A</i><b><i>B</i></b></p>
22566 !! end
22567
22568 !! test
22569 5a. Merge adjacent quote nodes if they've been edited
22570 !! options
22571 parsoid={
22572 "modes": ["wt2wt"],
22573 "changes": [
22574 ["p", "contents", "remove", ":contains('b')"]
22575 ]
22576 }
22577 !! wikitext
22578 ''a''b''c''
22579 !! wikitext/edited
22580 ''ac''
22581 !! end
22582
22583 !! test
22584 5b. Merge adjacent quote nodes if they've been edited
22585 !! options
22586 parsoid={
22587 "modes": ["wt2wt"],
22588 "changes": [
22589 ["#x", "remove"]
22590 ]
22591 }
22592 !! wikitext
22593 ''a''<span id="x">b</span>''c''
22594 !! wikitext/edited
22595 ''ac''
22596 !! end
22597
22598 #------------------------------------
22599 # End of I/B quote minimization tests
22600 #------------------------------------
22601
22602 !!test
22603 Bug 54262: New entities
22604 !! options
22605 parsoid=html2wt
22606 !! wikitext
22607 &nbsp;
22608 !! html
22609 <span typeof="mw:Entity">&nbsp;</span>
22610 !! end
22611
22612 ## Note that there is no wikitext output for 'unknownproperty' ##
22613 ## Unknown magic words are silently dropped ##
22614
22615 !! test
22616 Magic words
22617 !! options
22618 parsoid=html2wt
22619 !! wikitext
22620 __TOC__
22621 __NOTOC__
22622 __FORCETOC__
22623 __INDEX__
22624 __NOINDEX__
22625 __NOGALLERY__
22626 __NOEDITSECTION__
22627 __NOTITLECONVERT__
22628 __NOCONTENTCONVERT__
22629 !! html
22630 <meta property='mw:PageProp/toc' />
22631 <meta property='mw:PageProp/notoc' />
22632 <meta property='mw:PageProp/forcetoc' />
22633 <meta property='mw:PageProp/index' />
22634 <meta property='mw:PageProp/noindex' />
22635 <meta property='mw:PageProp/nogallery' />
22636 <meta property='mw:PageProp/noeditsection' />
22637 <meta property='mw:PageProp/notitleconvert' />
22638 <meta property='mw:PageProp/nocontentconvert' />
22639 <meta property='mw:PageProp/unknownproperty' />
22640 !! end
22641
22642 !! test
22643 Consecutive <pre>s should not get merged
22644 !! options
22645 parsoid=html2wt,html2html
22646 !! wikitext
22647 a
22648
22649 b
22650
22651 c
22652
22653 d
22654
22655 e
22656
22657
22658
22659 f
22660 !! html
22661 <pre>a</pre><pre>b</pre>
22662
22663 <pre>c
22664 </pre><pre>
22665 d</pre>
22666
22667 <pre>e
22668
22669 </pre><pre>
22670
22671 f</pre>
22672 !! end
22673
22674 !! test
22675 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
22676 !! options
22677 parsoid=html2wt
22678 !! wikitext
22679 [[Special:BookSources/1234567890|ISBN 1234567895]]
22680 !! html
22681 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
22682 !! end
22683
22684 !! test
22685 Edited RFC links not serializable as RFC links should serialize as extlinks
22686 !! options
22687 parsoid=html2wt
22688 !! wikitext
22689 [//tools.ietf.org/html/rfc123 New RFC]
22690 !! html
22691 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
22692 !! end
22693
22694 !! test
22695 Edited PMID links not serializable as PMID links should serialize as extlinks
22696 !! options
22697 parsoid=html2wt
22698 !! wikitext
22699 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
22700 !! html
22701 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
22702 !! end
22703
22704 !! test
22705 Edited Redirect link should emit a non-piped wikitext link
22706 !! options
22707 parsoid=html2wt
22708 !! wikitext
22709 #REDIRECT [[Bar]]
22710 !! html
22711 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
22712 !! end
22713
22714 !! test
22715 T75121: Infer extension name from typeOf if data-mw is not present
22716 !! options
22717 parsoid=html2wt
22718 !! wikitext
22719 <foo />
22720 !! html
22721 <div typeOf="mw:Extension/foo"></div>
22722 !! end
22723
22724 # -----------------------------------------------------------------
22725 # End of section for Parsoid-only html2wt tests for serialization
22726 # of new content
22727 # -----------------------------------------------------------------
22728
22729 TODO:
22730 more images
22731 more tables
22732 character entities
22733 and much more
22734 Try for 100% code coverage