Don't break autolinks by stripping the final semicolon from an entity.
[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 !! options
544 parsoid=wt2html
545 !! wikitext
546 ''foo'''
547 !! html/*
548 <p><i>foo'</i>
549 </p>
550 !!end
551
552 # same html as previous, but wikitext adjusted to match parsoid html2wt
553 !! test
554 Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki
555 !! wikitext
556 ''foo'<nowiki/>''
557 !! html
558 <p><i>foo'</i>
559 </p>
560 !! end
561
562 !! test
563 Italics and bold: 2-quote opening sequence: (2,4)
564 !! options
565 parsoid=wt2html
566 !! wikitext
567 ''foo''''
568 !! html/*
569 <p><i>foo''</i>
570 </p>
571 !!end
572
573 # same html as previous, but wikitext adjusted to match parsoid html2wt
574 !! test
575 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
576 !! wikitext
577 ''foo<nowiki>''</nowiki>''
578 !! html
579 <p><i>foo''</i>
580 </p>
581 !! end
582
583 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
584 !! test
585 Italics and bold: 2-quote opening sequence: (2,5)
586 !! options
587 parsoid=wt2html
588 !! wikitext
589 ''foo'''''
590 !! html/php
591 <p><i>foo</i>
592 </p>
593 !! html/parsoid
594 <p><i>foo</i><b></b>
595 </p>
596 !!end
597
598 # same html as previous, but wikitext adjusted to match parsoid html2wt
599 !! test
600 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
601 !! wikitext
602 ''foo'''''<nowiki/>'''
603 !! html/php
604 <p><i>foo</i>
605 </p>
606 !! html/parsoid
607 <p><i>foo</i><b></b>
608 </p>
609 !! end
610
611
612 ###
613 ### 3-quote opening sequence tests
614 ###
615
616 !! test
617 Italics and bold: 3-quote opening sequence: (3,2)
618 !! options
619 parsoid=wt2html
620 !! wikitext
621 '''foo''
622 !! html/*
623 <p>'<i>foo</i>
624 </p>
625 !!end
626
627 # same html as previous, but wikitext adjusted to match parsoid html2wt
628 !! test
629 Italics and bold: 3-quote opening sequence: (3,2) w/ nowiki
630 !! wikitext
631 '<nowiki/>''foo''
632 !! html
633 <p>'<i>foo</i>
634 </p>
635 !!end
636
637 !! test
638 Italics and bold: 3-quote opening sequence: (3,3)
639 !! wikitext
640 '''foo'''
641 !! html
642 <p><b>foo</b>
643 </p>
644 !!end
645
646 !! test
647 Italics and bold: 3-quote opening sequence: (3,4)
648 !! options
649 parsoid=wt2html
650 !! wikitext
651 '''foo''''
652 !! html/*
653 <p><b>foo'</b>
654 </p>
655 !!end
656
657 # same html as previous, but wikitext adjusted to match parsoid html2wt
658 !! test
659 Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki
660 !! wikitext
661 '''foo'<nowiki/>'''
662 !! html
663 <p><b>foo'</b>
664 </p>
665 !! end
666
667 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
668 !! test
669 Italics and bold: 3-quote opening sequence: (3,5)
670 !! options
671 parsoid=wt2html
672 !! wikitext
673 '''foo'''''
674 !! html/php
675 <p><b>foo</b>
676 </p>
677 !! html/parsoid
678 <p><b>foo</b><i></i>
679 </p>
680 !!end
681
682 # same html as previous, but wikitext adjusted to match parsoid html2wt
683 !! test
684 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
685 !! wikitext
686 '''foo'''''<nowiki/>''
687 !! html/php
688 <p><b>foo</b>
689 </p>
690 !! html/parsoid
691 <p><b>foo</b><i></i>
692 </p>
693 !! end
694
695
696 ###
697 ### 4-quote opening sequence tests
698 ###
699
700 !! test
701 Italics and bold: 4-quote opening sequence: (4,2)
702 !! options
703 parsoid=wt2html
704 !! wikitext
705 ''''foo''
706 !! html/*
707 <p>''<i>foo</i>
708 </p>
709 !!end
710
711 # same html as previous, but wikitext adjusted to match parsoid html2wt
712 !! test
713 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
714 !! wikitext
715 <nowiki>''</nowiki>''foo''
716 !! html
717 <p>''<i>foo</i>
718 </p>
719 !! end
720
721 !! test
722 Italics and bold: 4-quote opening sequence: (4,3)
723 !! options
724 parsoid=wt2html
725 !! wikitext
726 ''''foo'''
727 !! html/*
728 <p>'<b>foo</b>
729 </p>
730 !!end
731
732 # same html as previous, but wikitext adjusted to match parsoid html2wt
733 !! test
734 Italics and bold: 4-quote opening sequence: (4,3) w/ nowiki
735 !! wikitext
736 '<nowiki/>'''foo'''
737 !! html
738 <p>'<b>foo</b>
739 </p>
740 !!end
741
742 !! test
743 Italics and bold: 4-quote opening sequence: (4,4)
744 !! options
745 parsoid=wt2html
746 !! wikitext
747 ''''foo''''
748 !! html/*
749 <p>'<b>foo'</b>
750 </p>
751 !!end
752
753 # same html as previous, but wikitext adjusted to match parsoid html2wt
754 !! test
755 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
756 !! wikitext
757 '<nowiki/>'''foo'<nowiki/>'''
758 !! html
759 <p>'<b>foo'</b>
760 </p>
761 !! end
762
763 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
764 !! test
765 Italics and bold: 4-quote opening sequence: (4,5)
766 !! options
767 parsoid=wt2html
768 !! wikitext
769 ''''foo'''''
770 !! html/php
771 <p>'<b>foo</b>
772 </p>
773 !! html/parsoid
774 <p>'<b>foo</b><i></i>
775 </p>
776 !!end
777
778 # same html as previous, but wikitext adjusted to match parsoid html2wt
779 !! test
780 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
781 !! wikitext
782 '<nowiki/>'''foo'''''<nowiki/>''
783 !! html/php
784 <p>'<b>foo</b>
785 </p>
786 !! html/parsoid
787 <p>'<b>foo</b><i></i>
788 </p>
789 !! end
790
791
792 ###
793 ### 5-quote opening sequence tests
794 ###
795
796 !! test
797 Italics and bold: 5-quote opening sequence: (5,2)
798 !! options
799 parsoid=wt2html
800 !! wikitext
801 '''''foo''
802 !! html/*
803 <p><b><i>foo</i></b>
804 </p>
805 !!end
806
807 # same html as previous, but wikitext adjusted to match parsoid html2wt
808 # skipping wt2html and html2html because it wants to put <i> before <b>
809 !! test
810 Italics and bold: 5-quote opening sequence: (5,2+3)
811 !! options
812 parsoid=wt2wt,html2wt
813 !! wikitext
814 '''''foo'''''
815 !! html
816 <p><b><i>foo</i></b>
817 </p>
818 !! end
819
820 !! test
821 Italics and bold: 5-quote opening sequence: (5,3)
822 !! options
823 parsoid=wt2html
824 !! wikitext
825 '''''foo'''
826 !! html/*
827 <p><i><b>foo</b></i>
828 </p>
829 !!end
830
831 # same html as previous, but wikitext adjusted to match parsoid html2wt
832 !! test
833 Italics and bold: 5-quote opening sequence: (5,3+2)
834 !! wikitext
835 '''''foo'''''
836 !! html
837 <p><i><b>foo</b></i>
838 </p>
839 !! end
840
841 !! test
842 Italics and bold: 5-quote opening sequence: (5,4)
843 !! options
844 parsoid=wt2html
845 !! wikitext
846 '''''foo''''
847 !! html/*
848 <p><i><b>foo'</b></i>
849 </p>
850 !!end
851
852 # same html as previous, but wikitext adjusted to match parsoid html2wt
853 !! test
854 Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki
855 !! wikitext
856 '''''foo'<nowiki/>'''''
857 !! html
858 <p><i><b>foo'</b></i>
859 </p>
860 !! end
861
862 !! test
863 Italics and bold: 5-quote opening sequence: (5,5)
864 !! wikitext
865 '''''foo'''''
866 !! html
867 <p><i><b>foo</b></i>
868 </p>
869 !!end
870
871 ###
872 ### multiple quote sequences in a line
873 ###
874 !! test
875 Italics and bold: multiple quote sequences: (2,4,2)
876 !! options
877 parsoid=wt2html
878 !! wikitext
879 ''foo''''bar''
880 !! html/*
881 <p><i>foo'<b>bar</b></i>
882 </p>
883 !!end
884
885
886 # same html as previous, but wikitext adjusted to match parsoid html2wt
887 !! test
888 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
889 !! wikitext
890 ''foo'<nowiki/>'''bar'''''
891 !! html
892 <p><i>foo'<b>bar</b></i>
893 </p>
894 !! end
895
896
897 !! test
898 Italics and bold: multiple quote sequences: (2,4,3)
899 !! options
900 parsoid=wt2html
901 !! wikitext
902 ''foo''''bar'''
903 !! html/*
904 <p><i>foo'<b>bar</b></i>
905 </p>
906 !!end
907
908
909 # same html as previous, but wikitext adjusted to match parsoid html2wt
910 !! test
911 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
912 !! wikitext
913 ''foo'<nowiki/>'''bar'''''
914 !! html
915 <p><i>foo'<b>bar</b></i>
916 </p>
917 !! end
918
919
920 !! test
921 Italics and bold: multiple quote sequences: (2,4,4)
922 !! options
923 parsoid=wt2html
924 !! wikitext
925 ''foo''''bar''''
926 !! html/*
927 <p><i>foo'<b>bar'</b></i>
928 </p>
929 !!end
930
931
932 # same html as previous, but wikitext adjusted to match parsoid html2wt
933 !! test
934 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
935 !! wikitext
936 ''foo'<nowiki/>'''bar'<nowiki/>'''''
937 !! html
938 <p><i>foo'<b>bar'</b></i>
939 </p>
940 !! end
941
942
943 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
944 !! test
945 Italics and bold: multiple quote sequences: (3,4,2)
946 !! options
947 parsoid=wt2html
948 !! wikitext
949 '''foo''''bar''
950 !! html/php
951 <p><b>foo'</b>bar
952 </p>
953 !! html/parsoid
954 <p><b>foo'</b>bar<i></i>
955 </p>
956 !!end
957
958 # same html as previous, but wikitext adjusted to match parsoid html2wt
959 !! test
960 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
961 !! options
962 parsoid
963 !! wikitext
964 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
965 !! html/php
966 <p><b>foo'</b>bar
967 </p>
968 !! html/parsoid
969 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
970 </p>
971 !! end
972
973
974 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
975 !! test
976 Italics and bold: multiple quote sequences: (3,4,3)
977 !! options
978 parsoid=wt2html
979 !! wikitext
980 '''foo''''bar'''
981 !! html/php
982 <p><b>foo'</b>bar
983 </p>
984 !! html/parsoid
985 <p><b>foo'</b>bar<b></b>
986 </p>
987 !!end
988
989 # same html as previous, but wikitext adjusted to match parsoid html2wt
990 !! test
991 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
992 !! wikitext
993 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
994 !! html/php
995 <p><b>foo'</b>bar
996 </p>
997 !! html/parsoid
998 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
999 </p>
1000 !! end
1001
1002 ###
1003 ### other quote tests
1004 ###
1005 !! test
1006 Italics and bold: other quote tests: (2,3,5)
1007 !! wikitext
1008 ''this is about '''foo's family'''''
1009 !! html
1010 <p><i>this is about <b>foo's family</b></i>
1011 </p>
1012 !!end
1013
1014
1015 !! test
1016 Italics and bold: other quote tests: (2,(3,3),2)
1017 !! wikitext
1018 ''this is about '''foo's''' family''
1019 !! html
1020 <p><i>this is about <b>foo's</b> family</i>
1021 </p>
1022 !!end
1023
1024
1025 !! test
1026 Italics and bold: other quote tests: (3,2,3,2)
1027 !! options
1028 parsoid=wt2html
1029 !! wikitext
1030 '''this is about ''foo'''s family''
1031 !! html/*
1032 <p><b>this is about <i>foo</i></b><i>s family</i>
1033 </p>
1034 !!end
1035
1036
1037 # same html as previous, but wikitext adjusted to match parsoid html2wt
1038 !! test
1039 Italics and bold: other quote tests: (3,2,3+2+2,2)
1040 !! wikitext
1041 '''this is about ''foo'''''<nowiki/>''s family''
1042 !! html
1043 <p><b>this is about <i>foo</i></b><i>s family</i>
1044 </p>
1045 !! end
1046
1047
1048 !! test
1049 Italics and bold: other quote tests: (3,2,3,3)
1050 !! options
1051 parsoid=wt2html
1052 !! wikitext
1053 '''this is about ''foo'''s family'''
1054 !! html/*
1055 <p>'<i>this is about </i>foo<b>s family</b>
1056 </p>
1057 !!end
1058
1059
1060 # same html as previous, but wikitext adjusted to match parsoid html2wt
1061 !! test
1062 Italics and bold: other quote tests: (3,2,3,3) w/ nowiki
1063 !! wikitext
1064 '<nowiki/>''this is about ''foo'''s family'''
1065 !! html
1066 <p>'<i>this is about </i>foo<b>s family</b>
1067 </p>
1068 !!end
1069
1070
1071 !! test
1072 Italics and bold: other quote tests: (3,(2,2),3)
1073 !! wikitext
1074 '''this is about ''foo's'' family'''
1075 !! html
1076 <p><b>this is about <i>foo's</i> family</b>
1077 </p>
1078 !!end
1079
1080
1081 !! test
1082 Italicized possessive
1083 !! wikitext
1084 The ''[[Main Page]]'''s talk page.
1085 !! html
1086 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1087 </p>
1088 !! end
1089
1090 !! test
1091 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1092 (Requires tidy for PHP parser output to be fixed up)
1093 !! options
1094 parsoid=wt2html,wt2wt
1095 !! wikitext
1096 {|
1097 !''a!!''b
1098 |''a||''b
1099 |}
1100 !! html/php+tidy
1101 <table>
1102 <tr>
1103 <th><i>a</i></th>
1104 <th><i>b</i></th>
1105 <td><i>a</i></td>
1106 <td><i>b</i></td>
1107 </tr>
1108 </table>
1109 !! html/parsoid
1110 <table>
1111 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1112 <td><i>a</i></td><td><i>b</i></td></tr>
1113 </tbody></table>
1114 !! end
1115
1116 ###
1117 ### Non-html5 tags
1118 ###
1119
1120 !! test
1121 Non-html5 tags should be accepted
1122 !! wikitext
1123 <center>''foo''</center>
1124 <big>''foo''</big>
1125 <font>''foo''</font>
1126 <strike>''foo''</strike>
1127 <tt>''foo''</tt>
1128 !! html
1129 <center><i>foo</i></center>
1130 <p><big><i>foo</i></big>
1131 <font><i>foo</i></font>
1132 <strike><i>foo</i></strike>
1133 <tt><i>foo</i></tt>
1134 </p>
1135 !! end
1136
1137 !! test
1138 <wbr> is valid wikitext (bug 52468)
1139 !! wikitext
1140 <wbr>
1141 !! html
1142 <p><wbr />
1143 </p>
1144 !! end
1145
1146 # <strike> is HTML4, <s> is HTML4/5.
1147 !! test
1148 <s> or <strike> for strikethrough
1149 !! wikitext
1150 <strike>strike</strike>
1151
1152 <s>s</s>
1153 !! html
1154 <p><strike>strike</strike>
1155 </p><p><s>s</s>
1156 </p>
1157 !! end
1158
1159 ## a not permitted
1160 ## i,b,br omitted
1161 !! test
1162 Text-level semantic html elements in wikitext
1163 !! wikitext
1164 <em>text</em>
1165 <strong>text</strong>
1166 <small>text</small>
1167 <s>text</s>
1168 <cite>text</cite>
1169 <q>text</q>
1170 <dfn>text</dfn>
1171 <abbr>text</abbr>
1172 <data>text</data>
1173 <time>text</time>
1174 <code>text</code>
1175 <var>text</var>
1176 <samp>text</samp>
1177 <kbd>text</kbd>
1178 <sub>text</sub>
1179 <u>text</u>
1180 <mark>text</mark>
1181 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1182 <bdi>text</bdi>
1183 <bdo>text</bdo>
1184 <span>text</span>
1185 <wbr />
1186 !! html
1187 <p><em>text</em>
1188 <strong>text</strong>
1189 <small>text</small>
1190 <s>text</s>
1191 <cite>text</cite>
1192 <q>text</q>
1193 <dfn>text</dfn>
1194 <abbr>text</abbr>
1195 <data>text</data>
1196 <time>text</time>
1197 <code>text</code>
1198 <var>text</var>
1199 <samp>text</samp>
1200 <kbd>text</kbd>
1201 <sub>text</sub>
1202 <u>text</u>
1203 <mark>text</mark>
1204 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1205 <bdi>text</bdi>
1206 <bdo>text</bdo>
1207 <span>text</span>
1208 <wbr />
1209 </p>
1210 !! end
1211
1212 # test cases taken from
1213 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1214 !! test
1215 Ruby markup (W3C-style)
1216 !! wikitext
1217 ; Mono-ruby for individual base characters
1218 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1219 ; Group ruby
1220 : <ruby>今日<rt>きょう</rt></ruby>
1221 ; Jukugo ruby
1222 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1223 ; Inline ruby
1224 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1225 ; Double-sided ruby
1226 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1227 <ruby>
1228 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1229 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1230 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1231 </ruby>
1232 !! html
1233 <dl><dt> Mono-ruby for individual base characters</dt>
1234 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1235 <dt> Group ruby</dt>
1236 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1237 <dt> Jukugo ruby</dt>
1238 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1239 <dt> Inline ruby</dt>
1240 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1241 <dt> Double-sided ruby</dt>
1242 <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>
1243 <p><ruby>
1244 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1245 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1246 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1247 </ruby>
1248 </p>
1249 !! end
1250
1251 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1252 !! test
1253 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1254 !! wikitext
1255 <b→> doesn't work! </b→>
1256
1257 <bä> doesn't work! </bä>
1258
1259 <boo> works fine </boo>
1260
1261 <s.foo>s.foo</s.foo>
1262
1263 <sub-ID#1>
1264 !! html
1265 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1266 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1267 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1268 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1269 </p><p>&lt;sub-ID#1&gt;
1270 </p>
1271 !! end
1272
1273 !! test
1274 Isolated close tags should be treated as literal text (bug 52760)
1275 !! wikitext
1276 </b>
1277
1278 <s.foo>s</s>
1279 !! html
1280 <p>&lt;/b&gt;
1281 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1282 </p>
1283 !! end
1284
1285 ###
1286 ### Special characters
1287 ###
1288
1289 !! test
1290 Bare pipe character (bug 52363)
1291 !! wikitext
1292 |
1293 !! html
1294 <p>|
1295 </p>
1296 !! end
1297
1298 !! test
1299 Bare pipe character from a template (bug 52363)
1300 !! wikitext
1301 {{pipe}}
1302 !! html
1303 <p>|
1304 </p>
1305 !! end
1306
1307 ###
1308 ### <nowiki> test cases
1309 ###
1310
1311 !! test
1312 <nowiki> unordered list
1313 !! wikitext
1314 <nowiki>* This is not an unordered list item.</nowiki>
1315 !! html
1316 <p>* This is not an unordered list item.
1317 </p>
1318 !! end
1319
1320 !! test
1321 <nowiki> spacing
1322 !! wikitext
1323 <nowiki>Lorem ipsum dolor
1324
1325 sed abit.
1326 sed nullum.
1327
1328 :and a colon
1329 </nowiki>
1330 !! html
1331 <p>Lorem ipsum dolor
1332
1333 sed abit.
1334 sed nullum.
1335
1336 :and a colon
1337
1338 </p>
1339 !! end
1340
1341 !! test
1342 nowiki 3
1343 !! wikitext
1344 :There is not nowiki.
1345 :There is <nowiki>nowiki</nowiki>.
1346
1347 #There is not nowiki.
1348 #There is <nowiki>nowiki</nowiki>.
1349
1350 *There is not nowiki.
1351 *There is <nowiki>nowiki</nowiki>.
1352 !! html
1353 <dl><dd>There is not nowiki.</dd>
1354 <dd>There is nowiki.</dd></dl>
1355 <ol><li>There is not nowiki.</li>
1356 <li>There is nowiki.</li></ol>
1357 <ul><li>There is not nowiki.</li>
1358 <li>There is nowiki.</li></ul>
1359
1360 !! end
1361
1362 !! test
1363 Entities inside <nowiki>
1364 !! wikitext
1365 <nowiki>&lt;</nowiki>
1366 !! html
1367 <p>&lt;
1368 </p>
1369 !! end
1370
1371 !! test
1372 Entities inside template parameters
1373 !! options
1374 parsoid
1375 !! wikitext
1376 {{echo|&ndash;}}
1377 !! html
1378 <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>
1379 !! end
1380
1381 !! test
1382 Properly escape nowiki when combined with other wiki markup
1383 !! options
1384 parsoid=html2wt
1385 !! wikitext
1386 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1387 !! html
1388 <p>* &lt;/nowiki&gt; tag</p>
1389 !! end
1390
1391 ###
1392 ### Comments
1393 ###
1394 !! test
1395 Comments and Indent-Pre
1396 !! wikitext
1397 <!-- comment 1 --> asdf
1398
1399 <!-- comment 1 --> asdf
1400 <!-- comment 2 -->
1401
1402 <!-- comment 1 --> asdf
1403 <!-- comment 2 -->xyz
1404
1405 <!-- comment 1 --> asdf
1406 <!-- comment 2 --> xyz
1407 !! html
1408 <pre>asdf
1409 </pre>
1410 <pre>asdf
1411 </pre>
1412 <pre>asdf
1413 </pre>
1414 <p>xyz
1415 </p>
1416 <pre>asdf
1417 xyz
1418 </pre>
1419 !! end
1420
1421 !! test
1422 Comment test 2a
1423 !! wikitext
1424 asdf
1425 <!-- comment 1 -->
1426 jkl
1427 !! html
1428 <p>asdf
1429 jkl
1430 </p>
1431 !! end
1432
1433 !! test
1434 Comment test 2b
1435 !! wikitext
1436 asdf
1437 <!-- comment 1 -->
1438
1439 jkl
1440 !! html
1441 <p>asdf
1442 </p><p>jkl
1443 </p>
1444 !! end
1445
1446 !! test
1447 Comment test 3
1448 !! wikitext
1449 asdf
1450 <!-- comment 1 -->
1451 <!-- comment 2 -->
1452 jkl
1453 !! html
1454 <p>asdf
1455 jkl
1456 </p>
1457 !! end
1458
1459 !! test
1460 Comment test 4
1461 !! wikitext
1462 asdf<!-- comment 1 -->jkl
1463 !! html
1464 <p>asdfjkl
1465 </p>
1466 !! end
1467
1468 !! test
1469 Comment spacing
1470 !! wikitext
1471 a
1472 <!-- foo --> b <!-- bar -->
1473 c
1474 !! html
1475 <p>a
1476 </p>
1477 <pre> b
1478 </pre>
1479 <p>c
1480 </p>
1481 !! end
1482
1483 !! test
1484 Comment whitespace
1485 !! wikitext
1486 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1487 !! html
1488
1489 !! end
1490
1491 !! test
1492 Comment semantics and delimiters
1493 !! wikitext
1494 <!-- --><!----><!-----><!------>
1495 !! html
1496
1497 !! end
1498
1499 !! test
1500 Comment semantics and delimiters, redux
1501 !! wikitext
1502 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1503 -- foo -- funky huh? ... -->
1504 !! html
1505
1506 !! end
1507
1508 !! test
1509 Comment semantics and delimiters: directors cut
1510 !! wikitext
1511 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1512 everything starting with < followed by !-- until the first -- and > we see,
1513 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1514 -->-->
1515 !! html
1516 <p>--&gt;
1517 </p>
1518 !! end
1519
1520 !! test
1521 Comment semantics: nesting
1522 !! wikitext
1523 <!--<!-- no, we're not going to do anything fancy here -->-->
1524 !! html
1525 <p>--&gt;
1526 </p>
1527 !! end
1528
1529 !! test
1530 Comment semantics: unclosed comment at end
1531 !! wikitext
1532 <!--This comment will run out to the end of the document
1533 !! html
1534
1535 !! end
1536
1537 # Bug 58184: document parsoid's behaviour
1538 !! test
1539 Suppress comment closing tag in lenient browsers
1540 !! options
1541 parsoid=wt2html,html2html
1542 !! wikitext
1543 <!-- Browsers--!> think this is closed -->
1544 !! html/php
1545
1546 !! html/parsoid
1547 <!-- Browsers--¡> think this is closed -->
1548 !! end
1549
1550 !! test
1551 Comment in template title
1552 !! wikitext
1553 {{f<!---->oo}}
1554 !! html
1555 <p>FOO
1556 </p>
1557 !! end
1558
1559 !! test
1560 Comment on its own line post-expand
1561 !! wikitext
1562 a
1563 {{blank}}<!---->
1564 b
1565 !! html
1566 <p>a
1567 </p><p>b
1568 </p>
1569 !! end
1570
1571 !! test
1572 Comment on its own line post-expand with non-significant whitespace
1573 !! wikitext
1574 a
1575 {{blank}} <!---->
1576 b
1577 !! html
1578 <p>a
1579 </p><p>b
1580 </p>
1581 !! end
1582
1583 !! test
1584 Multiple comments should still parse as SOL-transparent
1585 !! options
1586 parsoid=wt2html,wt2wt
1587 !! wikitext
1588 <!--c1-->*a
1589 <!--c2--><!--c3--><!--c4-->*b
1590 !! html
1591 <ul>
1592 <li>a
1593 </li>
1594 <li>b
1595 </li>
1596 </ul>
1597 !! end
1598
1599 ###
1600 ### paragraph wrapping tests
1601 ###
1602 !! test
1603 No block tags
1604 !! wikitext
1605 a
1606
1607 b
1608 !! html
1609 <p>a
1610 </p><p>b
1611 </p>
1612 !! end
1613
1614 !! test
1615 Block tag on one line (<div>)
1616 !! wikitext
1617 a <div>foo</div>
1618
1619 b
1620 !! html
1621 a <div>foo</div>
1622 <p>b
1623 </p>
1624 !! html+tidy
1625 <p>a</p>
1626 <div>foo</div>
1627 <p>b</p>
1628 !! end
1629
1630 !! test
1631 Block tag on one line (<blockquote>)
1632 !! wikitext
1633 a <blockquote>foo</blockquote>
1634
1635 b
1636 !! html
1637 a <blockquote>foo</blockquote>
1638 <p>b
1639 </p>
1640 !! html+tidy
1641 <p>a</p>
1642 <blockquote>
1643 <p>foo</p>
1644 </blockquote>
1645 <p>b</p>
1646 !! end
1647
1648 !! test
1649 Block tag on both lines (<div>)
1650 !! wikitext
1651 a <div>foo</div>
1652
1653 b <div>foo</div>
1654 !! html
1655 a <div>foo</div>
1656 b <div>foo</div>
1657
1658 !! html+tidy
1659 <p>a</p>
1660 <div>foo</div>
1661 <p>b</p>
1662 <div>foo</div>
1663 !! end
1664
1665 !! test
1666 Block tag on both lines (<blockquote>)
1667 !! wikitext
1668 a <blockquote>foo</blockquote>
1669
1670 b <blockquote>foo</blockquote>
1671 !! html
1672 a <blockquote>foo</blockquote>
1673 b <blockquote>foo</blockquote>
1674
1675 !! html+tidy
1676 <p>a</p>
1677 <blockquote>
1678 <p>foo</p>
1679 </blockquote>
1680 <p>b</p>
1681 <blockquote>
1682 <p>foo</p>
1683 </blockquote>
1684 !! end
1685
1686 !! test
1687 Multiple lines without block tags
1688 !! wikitext
1689 <div>foo</div> a
1690 b
1691 c
1692 d<!--foo--> e
1693 x <div>foo</div> z
1694 !! html
1695 <div>foo</div> a
1696 <p>b
1697 c
1698 d e
1699 </p>
1700 x <div>foo</div> z
1701
1702 !! html+tidy
1703 <div>foo</div>
1704 <p>a</p>
1705 <p>b c d e</p>
1706 <p>x</p>
1707 <div>foo</div>
1708 <p>z</p>
1709 !! end
1710
1711 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1712 # So, we have a separate section for Parsoid. We don't want
1713 # to mimic this stripping behavior in Parsoid. It affects
1714 # editing experience and also requires us to maintain additional
1715 # info for RT-ing.
1716 !! test
1717 Empty lines between lines with block tags
1718 !! wikitext
1719 <div></div>
1720
1721
1722 <div></div>a
1723
1724 b
1725 <div>a</div>b
1726
1727 <div>b</div>d
1728
1729
1730 <div>e</div>
1731 !! html
1732 <div></div>
1733 <p><br />
1734 </p>
1735 <div></div>a
1736 <p>b
1737 </p>
1738 <div>a</div>b
1739 <div>b</div>d
1740 <p><br />
1741 </p>
1742 <div>e</div>
1743
1744 !! html+tidy
1745 <p><br /></p>
1746 <p>a</p>
1747 <p>b</p>
1748 <div>a</div>
1749 <p>b</p>
1750 <div>b</div>
1751 <p>d</p>
1752 <p><br /></p>
1753 <div>e</div>
1754 !! html/parsoid
1755 <div data-parsoid='{"stx":"html"}'></div>
1756
1757 <p><br /></p>
1758 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1759
1760 <p>b</p>
1761 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1762
1763 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1764
1765 <p><br /></p>
1766 <div data-parsoid='{"stx":"html"}'>e</div>
1767 !! end
1768
1769 ## PHP parser emits output which is broken
1770 ## XXX The parsoid output doesn't match the tidy output.
1771 !! test
1772 Unclosed HTML p-tags should be handled properly
1773 !! wikitext
1774 <div><p>foo</div>
1775 a
1776
1777 b
1778 !! html/php+tidy
1779 <div>
1780 <p>foo&lt;/div&gt;</p>
1781 <p>a</p>
1782 b</div>
1783 !! html/parsoid
1784 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1785 <p>a</p>
1786 <p>b</p>
1787 !! end
1788
1789 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
1790 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
1791 ## them for now.
1792 !! test
1793 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
1794 !! options
1795 parsoid=wt2html
1796 !! wikitext
1797 a [[Category:A1]] [[Category:A2]]
1798 [[Category:A3]]
1799 [[Category:A4]]
1800 !! html/parsoid
1801 <p>a</p>
1802 <link href="Category:A1"/> <link href="Category:A2"/> <link href="Category:A3"/> <link href="Category:A4"/>
1803 !! end
1804
1805 !! test
1806 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
1807 !! options
1808 parsoid=wt2html
1809 !! wikitext
1810 [[Category:A1]]a
1811 !! html/parsoid
1812 <link href="Category:A1"/><p>a</p>
1813 !! end
1814
1815 ###
1816 ### Preformatted text
1817 ###
1818 !! test
1819 Preformatted text
1820 !! wikitext
1821 This is some
1822 Preformatted text
1823 With ''italic''
1824 And '''bold'''
1825 And a [[Main Page|link]]
1826 !! html
1827 <pre>This is some
1828 Preformatted text
1829 With <i>italic</i>
1830 And <b>bold</b>
1831 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1832 </pre>
1833 !! end
1834
1835 !! test
1836 Tabs don't trigger preformatted text
1837 !! wikitext
1838 This is not
1839 preformatted text.
1840 This is preformatted text.
1841 So is this.
1842 !! html
1843 <p> This is not
1844 preformatted text.
1845 </p>
1846 <pre>This is preformatted text.
1847 So is this.
1848 </pre>
1849 !! end
1850
1851 !! test
1852 Ident preformatting with inline content
1853 !! wikitext
1854 a
1855 ''b''
1856 !! html
1857 <pre>a
1858 <i>b</i>
1859 </pre>
1860 !! end
1861
1862 !! test
1863 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1864 !! wikitext
1865 <pre><nowiki>
1866 <b>
1867 <cite>
1868 <em>
1869 </nowiki></pre>
1870 !! html
1871 <pre>
1872 &lt;b&gt;
1873 &lt;cite&gt;
1874 &lt;em&gt;
1875 </pre>
1876
1877 !! end
1878
1879 !! test
1880 Regression with preformatted in <center>
1881 !! wikitext
1882 <center>
1883 Blah
1884 </center>
1885 !! html
1886 <center>
1887 <pre>Blah
1888 </pre>
1889 </center>
1890
1891 !! end
1892
1893 !! test
1894 Bug 52763: Preformatted in <blockquote>
1895 !! wikitext
1896 <blockquote>
1897 Blah
1898 {|
1899 |
1900 indented cell (no pre-wrapping!)
1901 |}
1902 </blockquote>
1903 !! html
1904 <blockquote>
1905 <p> Blah
1906 </p>
1907 <table>
1908 <tr>
1909 <td>
1910 <p> indented cell (no pre-wrapping!)
1911 </p>
1912 </td></tr></table>
1913 </blockquote>
1914
1915 !! end
1916
1917 !! test
1918 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1919 !! wikitext
1920 <blockquote>
1921 Foo
1922
1923 Bar
1924 </blockquote>
1925 !! html
1926 <blockquote>
1927 <p>Foo
1928 </p><p>Bar
1929 </p>
1930 </blockquote>
1931
1932 !! end
1933
1934 !! test
1935 Bug 15491: <ins>/<del> in blockquote
1936 !! wikitext
1937 <blockquote>
1938 Foo <del>bar</del> <ins>baz</ins> quux
1939 </blockquote>
1940 !! html
1941 <blockquote>
1942 <p>Foo <del>bar</del> <ins>baz</ins> quux
1943 </p>
1944 </blockquote>
1945
1946 !! end
1947
1948 # Note that the p-wrapping is newline sensitive, which could be
1949 # considered a bug: tidy will wrap only the 'Foo' in the example
1950 # below in a <p> tag. (see comment 23-25 of bug #6200)
1951 !! test
1952 Bug 15491: <ins>/<del> in blockquote (2)
1953 !! wikitext
1954 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1955 </blockquote>
1956 !! html
1957 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1958 </blockquote>
1959
1960 !! html+tidy
1961 <blockquote>
1962 <p>Foo</p>
1963 <del>bar</del> <ins>baz</ins> quux</blockquote>
1964 !! end
1965
1966 !! test
1967 <pre> with attributes (bug 3202)
1968 !! wikitext
1969 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1970 !! html
1971 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1972
1973 !! end
1974
1975 !! test
1976 <pre> with width attribute (bug 3202)
1977 !! wikitext
1978 <pre width="8">Narrow screen goodies</pre>
1979 !! html
1980 <pre width="8">Narrow screen goodies</pre>
1981
1982 !! end
1983
1984 !! test
1985 <pre> with forbidden attribute (bug 3202)
1986 !! wikitext
1987 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1988 !! html
1989 <pre width="8">Narrow screen goodies</pre>
1990
1991 !! end
1992
1993 !! test
1994 Entities inside <pre>
1995 !! wikitext
1996 <pre>&lt;</pre>
1997 !! html
1998 <pre>&lt;</pre>
1999
2000 !! end
2001
2002 !! test
2003 <pre> with forbidden attribute values (bug 3202)
2004 !! wikitext
2005 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2006 !! html
2007 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2008
2009 !! end
2010
2011 !! test
2012 <nowiki> inside <pre> (bug 13238)
2013 !! wikitext
2014 <pre>
2015 <nowiki>
2016 </pre>
2017 <pre>
2018 <nowiki></nowiki>
2019 </pre>
2020 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2021 !! html
2022 <pre>
2023 &lt;nowiki&gt;
2024 </pre>
2025 <pre>
2026
2027 </pre>
2028 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2029
2030 !! end
2031
2032 !! test
2033 <nowiki> and <pre> preference (first one wins)
2034 !! wikitext
2035 <pre>
2036 <nowiki>
2037 </pre>
2038 </nowiki>
2039 </pre>
2040
2041 <nowiki>
2042 <pre>
2043 <nowiki>
2044 </pre>
2045 </nowiki>
2046 </pre>
2047
2048 !! html
2049 <pre>
2050 &lt;nowiki&gt;
2051 </pre>
2052 <p>&lt;/nowiki&gt;
2053 &lt;/pre&gt;
2054 </p><p>
2055 &lt;pre&gt;
2056 &lt;nowiki&gt;
2057 &lt;/pre&gt;
2058
2059 &lt;/pre&gt;
2060 </p>
2061 !! end
2062
2063 !! test
2064 </pre> inside nowiki
2065 !! wikitext
2066 <nowiki></pre></nowiki>
2067 !! html
2068 <p>&lt;/pre&gt;
2069 </p>
2070 !! end
2071
2072 # Parsoid doesn't strip empty tags, like Tidy does.
2073 !! test
2074 Empty pre; pre inside other HTML tags (bug 54946)
2075 !! options
2076 parsoid=wt2html,wt2wt
2077 !! wikitext
2078 a
2079
2080 <div><pre>
2081 foo
2082 </pre></div>
2083 <pre></pre>
2084 !! html/php
2085 <p>a
2086 </p>
2087 <div><pre>
2088 foo
2089 </pre></div>
2090 <pre></pre>
2091
2092 !! html/php+tidy
2093 <p>a</p>
2094 <div>
2095 <pre>
2096 foo
2097 </pre></div>
2098 !! html/parsoid
2099 <p>a</p>
2100
2101 <div><pre>foo
2102 </pre></div>
2103 <pre></pre>
2104 !! end
2105
2106 !! test
2107 HTML pre followed by indent-pre
2108 !! wikitext
2109 <pre>foo</pre>
2110 bar
2111 !! html
2112 <pre>foo</pre>
2113 <pre>bar
2114 </pre>
2115 !! end
2116
2117 !!test
2118 Block tag pre
2119 !!options
2120 parsoid
2121 !! wikitext
2122 <p><pre>foo</pre></p>
2123 !! html
2124 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2125 !!end
2126
2127 !!test
2128 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2129 !! wikitext
2130 {{echo|}}
2131 !! html
2132
2133 !!end
2134
2135 !!test
2136 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2137 !! wikitext
2138 {{echo|
2139 foo}}
2140 !! html
2141 <p>foo
2142 </p>
2143 !!end
2144
2145 !! test
2146 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2147 !! wikitext
2148 {{echo|a
2149 b}}
2150 !! html
2151 <pre>a
2152 </pre>
2153 <p>b
2154 </p>
2155 !!end
2156
2157 !! test
2158 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2159 !! wikitext
2160 {{echo|a
2161 b
2162 c
2163 d
2164 e
2165 }}
2166 !! html
2167 <pre>a
2168 </pre>
2169 <p>b
2170 c
2171 </p>
2172 <pre>d
2173 </pre>
2174 <p>e
2175 </p>
2176 !!end
2177
2178 !!test
2179 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2180 !! wikitext
2181 {{echo| foo}}
2182
2183 {{echo| foo}}{{echo| bar}}
2184
2185 {{echo| foo}}
2186 {{echo| bar}}
2187
2188 {{echo|<!--cmt--> foo}}
2189
2190 <!--cmt-->{{echo| foo}}
2191
2192 {{echo|{{echo| }}bar}}
2193 !! html
2194 <pre>foo
2195 </pre>
2196 <pre>foo bar
2197 </pre>
2198 <pre>foo
2199 bar
2200 </pre>
2201 <pre>foo
2202 </pre>
2203 <pre>foo
2204 </pre>
2205 <pre>bar
2206 </pre>
2207 !!end
2208
2209 !! test
2210 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2211 !! wikitext
2212 {{echo| }}a
2213
2214 {{echo|
2215 }}a
2216
2217 {{echo|
2218 b}}
2219
2220 {{echo|a
2221 }}b
2222
2223 {{echo|a
2224 }} b
2225 !! html
2226 <pre>a
2227 </pre>
2228 <p><br />
2229 </p>
2230 <pre>a
2231 </pre>
2232 <p><br />
2233 </p>
2234 <pre>b
2235 </pre>
2236 <p>a
2237 </p>
2238 <pre>b
2239 </pre>
2240 <p>a
2241 </p>
2242 <pre>b
2243 </pre>
2244 !!end
2245
2246 !! test
2247 Things that look like <pre> tags aren't treated as such
2248 !! wikitext
2249 Barack Obama <President> of the United States
2250 <President></President>
2251 !! html
2252 <p>Barack Obama &lt;President&gt; of the United States
2253 &lt;President&gt;&lt;/President&gt;
2254 </p>
2255 !! end
2256
2257 ## PHP parser discards the "<pre " string
2258 !! test
2259 Handle broken pre-like tags (bug 64025)
2260 !! options
2261 parsoid=wt2html
2262 !! wikitext
2263 {{echo|<pre <pre>x</pre>}}
2264
2265 <table><pre </table>
2266 !! html/php
2267 <pre>x</pre>
2268 <table><pre></pre></table>
2269
2270 !! html/parsoid
2271 <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>
2272
2273
2274 <p>&lt;pre </p>
2275
2276 <table></table>
2277 !! end
2278
2279 !! test
2280 Parsoid: handle pre with space after attribute
2281 !! options
2282 parsoid=wt2html
2283 !! wikitext
2284 <pre style="width:50%;" >{{echo|foo}}</pre>
2285 !! html
2286 <pre style="width:50%;">{{echo|foo}}</pre>
2287 !! end
2288
2289 # TODO / maybe: fix wt2wt for this
2290 !! test
2291 Parsoid: Don't paragraph-wrap fosterable content
2292 !! options
2293 parsoid=wt2html
2294 !! wikitext
2295 {|
2296 <td></td>
2297 <td></td>
2298
2299
2300
2301 |}
2302 !! html
2303 <table>
2304
2305 <tbody>
2306 <tr>
2307 <td></td>
2308
2309 <td></td></tr>
2310
2311
2312
2313 </tbody></table>
2314 !! end
2315
2316 !! test
2317 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2318 !! options
2319 parsoid=wt2html
2320 !! wikitext
2321 {|
2322 <td>
2323 <td>
2324 </td>
2325
2326
2327
2328 |}
2329 !! html
2330 <table>
2331
2332 <tbody>
2333 <tr>
2334 <td></td>
2335
2336 <td>
2337 </td></tr>
2338
2339
2340
2341 </tbody></table>
2342 !! end
2343
2344
2345 #--------------------------------------------------------------------
2346 # Transclusion parameter whitespace stripping tests
2347 # Behavior is different for positional and named parameters
2348 #--------------------------------------------------------------------
2349 !! test
2350 Templates: Strip leading and trailing whitespace from named-param values
2351 !! wikitext
2352 {{echo|1= a }}
2353
2354 {{echo|1= {{echo|b}} }}
2355
2356 {{echo| 1 =
2357 c }}
2358
2359 {{echo| 1 =
2360 * d
2361 }}
2362 !! html
2363 <p>a
2364 </p><p>b
2365 </p><p>c
2366 </p>
2367 <ul><li> d</li></ul>
2368
2369 !! end
2370
2371 !! test
2372 Templates: Don't strip whitespace from positional-param values
2373 !! wikitext
2374 {{echo|a }}
2375
2376 {{echo|{{echo|b}} }}
2377
2378 {{echo| c
2379 }}
2380
2381 {{echo| {{echo|d}}
2382 }}
2383
2384 {{echo|
2385 e}}
2386
2387 {{echo|
2388 * f}}
2389
2390 {{echo|
2391 }}g
2392 !! html
2393 <p>a
2394 </p><p>b
2395 </p>
2396 <pre>c
2397 </pre>
2398 <p><br />
2399 </p>
2400 <pre>d
2401 </pre>
2402 <p><br />
2403 </p>
2404 <pre>e
2405 </pre>
2406 <p><br />
2407 </p>
2408 <ul><li> f</li></ul>
2409 <p><br />
2410 </p>
2411 <pre>g
2412 </pre>
2413 !! end
2414
2415 !! test
2416 Templates: Handle empty comment-and-ws-only lines correctly
2417 !! wikitext
2418 {{echo|foo
2419 <!--should be ignored-->
2420 <!--should be ignored as well-->
2421 bar}}
2422 !! html
2423 <p>foo
2424 bar
2425 </p>
2426 !! end
2427
2428 !! test
2429 Templates: Handle comments in the target
2430 !! wikitext
2431 {{echo
2432 <!-- should be ignored -->
2433 |foo}}
2434
2435 {{echo<!-- should be ignored -->
2436 |foo}}
2437
2438 {{echo<!-- should be ignored -->|foo}}
2439
2440 {{<!-- should be ignored -->echo|foo}}
2441 !!html/parsoid
2442 <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>
2443
2444 <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>
2445
2446 <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>
2447
2448 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2449 !!end
2450
2451 !! test
2452 Templates: Handle comments in parameter names (bug 67657)
2453 !! wikitext
2454 {{echo|1
2455 <!-- should be ignored -->
2456 =foo}}
2457
2458 {{echo|
2459 <!-- should be ignored -->
2460 1 = foo}}
2461
2462 {{echo|1<!-- should be ignored --> = foo}}
2463
2464 {{echo|<!-- should be ignored -->1 = foo}}
2465 !!html/parsoid
2466 <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>
2467
2468 <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>
2469
2470 <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>
2471
2472 <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>
2473 !!end
2474
2475 !! test
2476 Templates: Other wikitext in parameter names (bug 67657)
2477 !! wikitext
2478 {{echo|''1''=foo}}
2479 !!html/parsoid
2480 <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>
2481 !!html/php
2482 <p>{{{1}}}
2483 </p>
2484 !!end
2485
2486 #--------------------------------------------------------------------
2487 # Transclusion parameter escaping tests
2488 #--------------------------------------------------------------------
2489 !! test
2490 Templates: Parsoid parameter escaping test 1
2491 !! options
2492 parsoid
2493 !! wikitext
2494 {{echo|[foo]|{{echo|[bar]}}}}
2495 !! html
2496 <p about="#mwt1" typeof="mw:Transclusion"
2497 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2498 !! end
2499
2500 !! test
2501 Parsoid: Pipes in external links in template parameter
2502 !! options
2503 parsoid
2504 !! wikitext
2505 {{echo|[{{echo|http://example.com}} link]}}
2506 !! html
2507 <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>
2508 !! end
2509
2510 !! test
2511 Parsoid: pipe in transclusion parameter
2512 !! options
2513 parsoid
2514 !! wikitext
2515 {{echo|http://foo.com/a&#124;b}}
2516 !! html
2517 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2518 typeof="mw:Transclusion"
2519 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>
2520 !! end
2521
2522 !! test
2523 Parsoid: Pipe in external link target and content in template parameter
2524 !! options
2525 parsoid=html2wt,wt2wt
2526 !! wikitext
2527 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2528 !! html
2529 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2530 typeof="mw:Transclusion"
2531 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2532 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2533 !! end
2534
2535 !! test
2536 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2537 !! options
2538 parsoid
2539 !! wikitext
2540 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2541 !! html
2542 <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>
2543 !! end
2544
2545 !! test
2546 Templates: Don't escape already nowiki-escaped text in template parameters
2547 !! options
2548 parsoid=html2wt,wt2wt
2549 !! wikitext
2550 {{echo|foo<nowiki>|</nowiki>bar}}
2551 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2552 {{echo|<nowiki></nowiki>}}
2553 !! html
2554 <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>
2555 <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>
2556 <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>
2557 </p>
2558 !! end
2559
2560 ## Bug 52824
2561 !! test
2562 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2563 !! options
2564 parsoid=html2wt,wt2wt
2565 !! wikitext
2566 {{echo|{{echo|1=bar}}}}
2567 !! html
2568 <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>
2569 !! end
2570
2571 ## Bug 56733
2572 !! test
2573 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2574 !! options
2575 parsoid
2576 !! wikitext
2577 {{echo|a : b}}
2578 !! html
2579 <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>
2580 !! end
2581
2582 ###
2583 ### Parsoid-centric tests for testing RT edge cases for pre
2584 ###
2585
2586 !!test
2587 1a. Indent-Pre and Comments
2588 !! wikitext
2589 a
2590 <!--a-->
2591 c
2592 !! html
2593 <pre>a
2594 </pre>
2595 <p>c
2596 </p>
2597 !!end
2598
2599 !!test
2600 1b. Indent-Pre and Comments
2601 !! wikitext
2602 a
2603 <!--a-->
2604 c
2605 !! html
2606 <pre>a
2607 </pre>
2608 <p>c
2609 </p>
2610 !!end
2611
2612 !!test
2613 1c. Indent-Pre and Comments
2614 !! wikitext
2615 <!--a--> a
2616
2617 <!--a--> a
2618 !! html
2619 <pre> a
2620 </pre>
2621 <pre> a
2622 </pre>
2623 !!end
2624
2625 !!test
2626 1d. Indent-Pre and Comments
2627 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2628 !! wikitext
2629 <!--a--> a
2630
2631 <!--b-->b
2632 !! html
2633 <pre>a
2634 </pre>
2635 <pre>b
2636 </pre>
2637 !!end
2638
2639 !!test
2640 2a. Indent-Pre and tables
2641 !! wikitext
2642 {|
2643 |-
2644 !h1!!h2
2645 |foo||bar
2646 |}
2647 !! html
2648 <table>
2649
2650 <tr>
2651 <th>h1</th>
2652 <th>h2
2653 </th>
2654 <td>foo</td>
2655 <td>bar
2656 </td></tr></table>
2657
2658 !!end
2659
2660 !!test
2661 2b. Indent-Pre and tables
2662 !! wikitext
2663 {|
2664 |-
2665 |foo
2666 |}
2667 !! html
2668 <table>
2669
2670 <tr>
2671 <td>foo
2672 </td></tr></table>
2673
2674 !!end
2675
2676 !!test
2677 2c. Indent-Pre and tables (bug 42252)
2678 !! wikitext
2679 {|
2680 |+ foo
2681 ! | bar
2682 |}
2683 !! html
2684 <table>
2685 <caption> foo
2686 </caption>
2687 <tr>
2688 <th> bar
2689 </th></tr></table>
2690
2691 !!end
2692
2693 !!test
2694 2d. Indent-Pre and tables
2695 !! wikitext
2696 a
2697 {|
2698 | b
2699 |}
2700 !! html/php
2701 <pre>a
2702 </pre>
2703 <table>
2704 <tr>
2705 <td> b
2706 </td></tr></table>
2707
2708 !! html/parsoid
2709 <pre>a</pre>
2710 <table>
2711 <tbody><tr><td> b</td></tr>
2712 </tbody></table>
2713 !!end
2714
2715 !!test
2716 2e. Indent-Pre and table-line syntax
2717 !! wikitext
2718 a
2719 | b
2720 | c
2721 !! html/php
2722 <pre>a
2723 | b
2724 | c
2725 </pre>
2726 !!end
2727
2728 !!test
2729 2f. Indent-pre started by table-line syntax
2730 !! wikitext
2731 a
2732 | b
2733 | c
2734 !! html/php
2735 <p>a
2736 </p>
2737 <pre>| b
2738 | c
2739 </pre>
2740 !! html/parsoid
2741 <p>a</p>
2742 <pre>
2743 | b
2744 | c</pre>
2745 !!end
2746
2747 !!test
2748 3a. Indent-Pre and block tags (single-line html)
2749 !! wikitext
2750 a <p> foo </p>
2751 b <div> foo </div>
2752 c <blockquote> foo </blockquote>
2753 <span> foo </span>
2754 !! html
2755 a <p> foo </p>
2756 b <div> foo </div>
2757 c <blockquote> foo </blockquote>
2758 <pre><span> foo </span>
2759 </pre>
2760 !! html/parsoid
2761 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
2762 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
2763 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
2764 <pre><span> foo </span>
2765 </pre>
2766 !! html+tidy
2767 <p>a</p>
2768 <p>foo</p>
2769 <p>b</p>
2770 <div>foo</div>
2771 <p>c</p>
2772 <blockquote>
2773 <p>foo</p>
2774 </blockquote>
2775 <pre>
2776 <span> foo </span>
2777 </pre>
2778 !! end
2779
2780 !!test
2781 3b. Indent-Pre and block tags (multi-line html)
2782 !! wikitext
2783 a <span>foo</span>
2784 b <div> foo </div>
2785 !! html
2786 <pre>a <span>foo</span>
2787 </pre>
2788 b <div> foo </div>
2789
2790 !! html/parsoid
2791 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
2792 b <div data-parsoid='{"stx":"html"}'> foo </div>
2793 !! html+tidy
2794 <pre>
2795 a <span>foo</span>
2796 </pre>
2797 <p>b</p>
2798 <div>foo</div>
2799 !!end
2800
2801 !!test
2802 3c. Indent-Pre and block tags (pre-content on separate line)
2803 !! wikitext
2804 <p>
2805 foo
2806 </p>
2807
2808 <div>
2809 foo
2810 </div>
2811
2812 <center>
2813 foo
2814 </center>
2815
2816 <blockquote>
2817 foo
2818 </blockquote>
2819
2820 <blockquote>
2821 <pre>
2822 foo
2823 </pre>
2824 </blockquote>
2825
2826 <table><tr><td>
2827 foo
2828 </td></tr></table>
2829
2830 <ul><li>
2831 foo
2832 </li></ul>
2833
2834 !! html
2835 <p>
2836 foo
2837 </p>
2838 <div>
2839 <pre>foo
2840 </pre>
2841 </div>
2842 <center>
2843 <pre>foo
2844 </pre>
2845 </center>
2846 <blockquote>
2847 <p> foo
2848 </p>
2849 </blockquote>
2850 <blockquote>
2851 <pre>
2852 foo
2853 </pre>
2854 </blockquote>
2855 <table><tr><td>
2856 <pre>foo
2857 </pre>
2858 </td></tr></table>
2859 <ul><li>
2860 foo
2861 </li></ul>
2862
2863 !!end
2864
2865 !!test
2866 4. Indent-Pre and extension tags
2867 !! wikitext
2868 a <gallery>
2869 File:foobar.jpg
2870 </gallery>
2871 !! html
2872 a <ul class="gallery mw-gallery-traditional">
2873 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2874 <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>
2875 <div class="gallerytext">
2876 </div>
2877 </div></li>
2878 </ul>
2879
2880 !! html+tidy
2881 <p>a</p>
2882 <ul class="gallery mw-gallery-traditional">
2883 <li class="gallerybox" style="width: 155px">
2884 <div style="width: 155px">
2885 <div class="thumb" style="width: 150px;">
2886 <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>
2887 </div>
2888 <div class="gallerytext"></div>
2889 </div>
2890 </li>
2891 </ul>
2892 !!end
2893
2894 !! test
2895 Table wikitext syntax outside wiki-tables
2896 !! wikitext
2897 a
2898 ! not a table heading
2899 |- not a table row
2900 | not a table cell
2901 | class="foo bar" | baz
2902 b
2903 |}
2904 |-
2905 c
2906 !! html
2907 <p>a
2908 ! not a table heading
2909 |- not a table row
2910 | not a table cell
2911 | class="foo bar" | baz
2912 b
2913 |}
2914 |-
2915 c
2916 </p>
2917 !! end
2918
2919 !!test
2920 Render paragraphs when indent-pre is suppressed in blocklevels
2921 !! wikitext
2922 <blockquote>
2923 foo
2924
2925 bar
2926 </blockquote>
2927 !! html
2928 <blockquote>
2929 <p> foo
2930 </p><p> bar
2931 </p>
2932 </blockquote>
2933
2934 !!end
2935
2936 !!test
2937 4. Multiple spaces at start-of-line
2938 !! wikitext
2939 <p> foo </p>
2940 foo
2941 {|
2942 |foo
2943 |}
2944 !! html
2945 <p> foo </p>
2946 <pre> foo
2947 </pre>
2948 <table>
2949 <tr>
2950 <td>foo
2951 </td></tr></table>
2952
2953 !!end
2954
2955 ## NOTE: the leading white-space chars on empty line are significant
2956 !! test
2957 5a. White-space in indent-pre
2958 !! wikitext
2959 a<br />
2960
2961 b
2962 !! html
2963 <pre>a<br />
2964
2965 b
2966 </pre>
2967 !! end
2968
2969 ## NOTE: the leading white-space chars on empty line are significant
2970 !! test
2971 5b. White-space in indent-pre
2972 !! wikitext
2973 a
2974
2975 b
2976
2977
2978 c
2979 !! html
2980 <pre>a
2981
2982 b
2983
2984
2985 c
2986 </pre>
2987 !! end
2988
2989 !! test
2990 5c. White-space in indent-pre
2991 !! wikitext
2992 ''a''
2993 ''b''
2994 ''c''
2995 !! html
2996 <pre><i>a</i>
2997 <i>b</i>
2998 <i>c</i>
2999 </pre>
3000 !! end
3001
3002 !! test
3003 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3004 !! wikitext
3005 a
3006
3007 <!-- continue -->
3008 b
3009
3010 c
3011
3012 d
3013 !! html
3014 <pre>a
3015
3016 b
3017 </pre>
3018 <pre>c
3019
3020 </pre>
3021 <p>d
3022 </p>
3023 !! end
3024
3025 !! test
3026 7a. Indent-pre and category links
3027 !! options
3028 parsoid=wt2html,wt2wt
3029 !! wikitext
3030 [[Category:foo]] <!-- No pre-wrapping -->
3031 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3032 !! html
3033 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
3034 <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 -->
3035 !! end
3036
3037 !! test
3038 7b. Indent-pre and category links
3039 !! options
3040 parsoid=wt2html,wt2wt
3041 !! wikitext
3042 [[Category:foo]] a
3043 [[Category:foo]] {{echo|b}}
3044 !! html
3045 <pre>
3046 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
3047 <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>
3048 !! end
3049
3050 ###
3051 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3052 ###
3053
3054 !!test
3055 HTML-pre: 1. embedded newlines
3056 !! wikitext
3057 <pre>foo</pre>
3058
3059 <pre>
3060 foo
3061 </pre>
3062
3063 <pre>
3064
3065 foo
3066 </pre>
3067
3068 <pre>
3069
3070
3071 foo
3072 </pre>
3073 !! html
3074 <pre>foo</pre>
3075 <pre>
3076 foo
3077 </pre>
3078 <pre>
3079
3080 foo
3081 </pre>
3082 <pre>
3083
3084
3085 foo
3086 </pre>
3087
3088 !! html/parsoid
3089 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3090
3091 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3092 foo
3093 </pre>
3094
3095 <pre data-parsoid='{"stx":"html"}'>
3096
3097 foo
3098 </pre>
3099
3100 <pre data-parsoid='{"stx":"html"}'>
3101
3102
3103 foo
3104 </pre>
3105 !!end
3106
3107 !! test
3108 HTML-pre: big spaces
3109 !! wikitext
3110 <pre>
3111
3112
3113
3114
3115 haha
3116
3117
3118
3119
3120 haha
3121
3122
3123
3124
3125 </pre>
3126 !! html
3127 <pre>
3128
3129
3130
3131
3132 haha
3133
3134
3135
3136
3137 haha
3138
3139
3140
3141
3142 </pre>
3143
3144 !! html/parsoid
3145 <pre data-parsoid='{"stx":"html"}'>
3146
3147
3148
3149
3150 haha
3151
3152
3153
3154
3155 haha
3156
3157
3158
3159
3160 </pre>
3161 !! end
3162
3163 !!test
3164 HTML-pre: 2: indented text
3165 !! wikitext
3166 <pre>
3167 foo
3168 </pre>
3169 !! html
3170 <pre>
3171 foo
3172 </pre>
3173
3174 !!end
3175
3176 !!test
3177 HTML-pre: 3: other wikitext
3178 !! wikitext
3179 <pre>
3180 * foo
3181 # bar
3182 = no-h =
3183 '' no-italic ''
3184 [[ NoLink ]]
3185 </pre>
3186 !! html
3187 <pre>
3188 * foo
3189 # bar
3190 = no-h =
3191 '' no-italic ''
3192 [[ NoLink ]]
3193 </pre>
3194
3195 !!end
3196
3197 ###
3198 ### Definition lists
3199 ###
3200 !! test
3201 Simple definition
3202 !! wikitext
3203 ; name : Definition
3204 !! html
3205 <dl><dt> name&#160;</dt>
3206 <dd> Definition</dd></dl>
3207
3208 !! end
3209
3210 !! test
3211 Definition list for indentation only
3212 !! wikitext
3213 : Indented text
3214 !! html
3215 <dl><dd> Indented text</dd></dl>
3216
3217 !! end
3218
3219 !! test
3220 Definition list with no space
3221 !! wikitext
3222 ;name:Definition
3223 !! html
3224 <dl><dt>name</dt>
3225 <dd>Definition</dd></dl>
3226
3227 !!end
3228
3229 !! test
3230 Definition list with URL link
3231 !! wikitext
3232 ; http://example.com/ : definition
3233 !! html
3234 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3235 <dd> definition</dd></dl>
3236
3237 !! end
3238
3239 !! test
3240 Definition list with bracketed URL link
3241 !! wikitext
3242 ;[http://www.example.com/ Example]:Something about it
3243 !! html
3244 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3245 <dd>Something about it</dd></dl>
3246
3247 !! end
3248
3249 !! test
3250 Definition list with wikilink containing colon
3251 !! wikitext
3252 ; [[Help:FAQ]]: The least-read page on Wikipedia
3253 !! html
3254 <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>
3255 <dd> The least-read page on Wikipedia</dd></dl>
3256
3257 !! end
3258
3259 # At Brion's and JeLuF's insistence... :)
3260 !! test
3261 Definition list with news link containing colon
3262 !! wikitext
3263 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3264 !! html
3265 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3266 <dd> This isn't even a real newsgroup!</dd></dl>
3267
3268 !! end
3269
3270 !! test
3271 Malformed definition list with colon
3272 !! wikitext
3273 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3274 !! html
3275 <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>
3276
3277 !! end
3278
3279 !! test
3280 Definition lists: colon in external link text
3281 !! wikitext
3282 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3283 !! html
3284 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3285 <dd> OK, I made that up</dd></dl>
3286
3287 !! end
3288
3289 !! test
3290 Definition lists: colon in HTML attribute
3291 !! wikitext
3292 ;<b style="display: inline">bold</b>
3293 !! html
3294 <dl><dt><b style="display: inline">bold</b></dt></dl>
3295
3296 !! end
3297
3298 !! test
3299 Definition lists: self-closed tag
3300 !! wikitext
3301 ;one<br/>two : two-line fun
3302 !! html
3303 <dl><dt>one<br />two&#160;</dt>
3304 <dd> two-line fun</dd></dl>
3305
3306 !! end
3307
3308 !! test
3309 Bug 11748: Literal closing tags
3310 !! wikitext
3311 <dl>
3312 <dt>test 1</dt>
3313 <dd>test test test test test</dd>
3314 <dt>test 2</dt>
3315 <dd>test test test test test</dd>
3316 </dl>
3317 !! html
3318 <dl>
3319 <dt>test 1</dt>
3320 <dd>test test test test test</dd>
3321 <dt>test 2</dt>
3322 <dd>test test test test test</dd>
3323 </dl>
3324
3325 !! end
3326
3327 !! test
3328 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3329 !! wikitext
3330 <ul><li>
3331 ; term : description
3332 * unordered
3333 </li></ul>
3334 !! html
3335 <ul><li>
3336 <dl><dt> term&#160;</dt>
3337 <dd> description</dd></dl>
3338 <ul><li> unordered</li></ul>
3339 </li></ul>
3340
3341 !! end
3342
3343 !! test
3344
3345 Definition list with empty definition and following paragraph
3346 !! wikitext
3347 ; term:
3348 Paragraph text
3349 !! html
3350 <dl><dt> term</dt>
3351 <dd></dd></dl>
3352 <p>Paragraph text
3353 </p>
3354 !! end
3355
3356 !! test
3357 Nested definition lists using html syntax
3358 !! wikitext
3359 <dl><dt>x</dt>
3360 <dd>a</dd>
3361 <dd>b</dd></dl>
3362
3363 !! end
3364
3365 !! test
3366 Definition Lists: No nesting: Multiple dd's
3367 !! wikitext
3368 ;x
3369 :a
3370 :b
3371 !! html
3372 <dl><dt>x</dt>
3373 <dd>a</dd>
3374 <dd>b</dd></dl>
3375
3376 !! end
3377
3378 !! test
3379 Definition Lists: Indentation: Regular
3380 !! wikitext
3381 :i1
3382 ::i2
3383 :::i3
3384 !! html
3385 <dl><dd>i1
3386 <dl><dd>i2
3387 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3388
3389 !! end
3390
3391 !! test
3392 Definition Lists: Indentation: Missing 1st level
3393 !! wikitext
3394 ::i2
3395 :::i3
3396 !! html
3397 <dl><dd><dl><dd>i2
3398 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3399
3400 !! end
3401
3402 !! test
3403 Definition Lists: Indentation: Multi-level indent
3404 !! wikitext
3405 :::i3
3406 !! html
3407 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3408
3409 !! end
3410
3411 !! test
3412 Definition Lists: Hacky use to indent tables
3413 !! wikitext
3414 ::{|
3415 |foo
3416 |bar
3417 |}
3418 this text
3419 should be left alone
3420 !! html
3421 <dl><dd><dl><dd><table>
3422 <tr>
3423 <td>foo
3424 </td>
3425 <td>bar
3426 </td></tr></table></dd></dl></dd></dl>
3427 <p>this text
3428 should be left alone
3429 </p>
3430 !! end
3431
3432 !! test
3433 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3434 !! wikitext
3435 <!-- foo -->
3436 ::{|
3437 |foo
3438 |bar
3439 |}<!-- bar -->
3440 this text
3441 should be left alone
3442 !! html/parsoid
3443 <!-- foo -->
3444 <dl><dd><dl><dd><table><tr>
3445 <td>foo</td>
3446 <td>bar</td>
3447 </tr></table><!-- bar --></dd></dl></dd></dl>
3448 <p>this text
3449 should be left alone</p>
3450 !! end
3451
3452 !! test
3453 Definition Lists: Hacky use to indent tables, with comment before table
3454 !! wikitext
3455 ::<!-- foo -->{|
3456 |foo
3457 |}
3458 !! html/parsoid
3459 <dl><dd><dl><dd><!-- foo --><table><tr>
3460 <td>foo</td>
3461 </tr></table></dd></dl></dd></dl>
3462 !! end
3463
3464 # Bug 52473
3465 !! test
3466 Definition Lists: Hacky use to indent tables (WS-insensitive)
3467 !! options
3468 parsoid
3469 !! wikitext
3470 : {|
3471 |a
3472 |}
3473 !! html
3474 <dl>
3475 <dd> <table><tr><td>a</td></tr></table> </dd>
3476 </dl>
3477 !! end
3478 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3479 ## as an empty dt item. It also ignores all but the last ";" when followed
3480 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3481 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3482 ## ";"s.
3483 ##
3484 ## Ex: ";;t2 ::d2" is transformed into:
3485 ##
3486 ## <dl>
3487 ## <dt>t2 </dt>
3488 ## <dd>
3489 ## <dl>
3490 ## <dt></dt>
3491 ## <dd>d2</dd>
3492 ## </dl>
3493 ## </dd>
3494 ## </dl>
3495 ##
3496 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3497 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3498 ##
3499 ## <dl>
3500 ## <dt>
3501 ## <dl>
3502 ## <dt>t2 </dt>
3503 ## <dd>:d2</dd>
3504 ## </dl>
3505 ## </dt>
3506 ## </dl>
3507 ##
3508 ## All Parsoid only definition list tests have this difference.
3509 ##
3510 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3511 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3512
3513 !! test
3514 Table / list interaction: indented table with lists in table contents
3515 !! wikitext
3516 :{|
3517 |-
3518 | a
3519 * b
3520 |-
3521 | c
3522 * d
3523 |}
3524 !! html
3525 <dl><dd><table>
3526
3527 <tr>
3528 <td> a
3529 <ul><li> b</li></ul>
3530 </td></tr>
3531 <tr>
3532 <td> c
3533 <ul><li> d</li></ul>
3534 </td></tr></table></dd></dl>
3535
3536 !! end
3537
3538 !!test
3539 Table / list interaction: lists nested in tables nested in indented lists
3540 !! wikitext
3541 :{|
3542 |
3543 :a
3544 :b
3545 |
3546 *c
3547 *d
3548 |}
3549
3550 *e
3551 *f
3552 !! html
3553 <dl><dd><table>
3554 <tr>
3555 <td>
3556 <dl><dd>a</dd>
3557 <dd>b</dd></dl>
3558 </td>
3559 <td>
3560 <ul><li>c</li>
3561 <li>d</li></ul>
3562 </td></tr></table></dd></dl>
3563 <ul><li>e</li>
3564 <li>f</li></ul>
3565
3566 !!end
3567
3568 !! test
3569 Definition Lists: Nesting: Multi-level (Parsoid only)
3570 !! options
3571 parsoid
3572 !! wikitext
3573 ;t1 :d1
3574 ;;t2 ::d2
3575 ;;;t3 :::d3
3576 !! html
3577 <dl>
3578 <dt>t1 </dt>
3579 <dd>d1</dd>
3580 <dt>
3581 <dl>
3582 <dt>t2 </dt>
3583 <dd>:d2</dd>
3584 <dt>
3585 <dl>
3586 <dt>t3 </dt>
3587 <dd>::d3</dd>
3588 </dl>
3589 </dt>
3590 </dl>
3591 </dt>
3592 </dl>
3593
3594
3595 !! end
3596
3597
3598 !! test
3599 Definition Lists: Nesting: Test 2 (Parsoid only)
3600 !! options
3601 parsoid
3602 !! wikitext
3603 ;t1
3604 ::d2
3605 !! html
3606 <dl>
3607 <dt>t1</dt>
3608 <dd>
3609 <dl>
3610 <dd>d2</dd>
3611 </dl>
3612 </dd>
3613 </dl>
3614
3615 !! end
3616
3617
3618 !! test
3619 Definition Lists: Nesting: Test 3 (Parsoid only)
3620 !! options
3621 parsoid
3622 !! wikitext
3623 :;t1
3624 ::::d2
3625 !! html
3626 <dl>
3627 <dd>
3628 <dl>
3629 <dt>t1</dt>
3630 <dd>
3631 <dl>
3632 <dd>
3633 <dl>
3634 <dd>d2</dd>
3635 </dl>
3636 </dd>
3637 </dl>
3638 </dd>
3639 </dl>
3640 </dd>
3641 </dl>
3642
3643 !! end
3644
3645
3646 !! test
3647 Definition Lists: Nesting: Test 4
3648 !! wikitext
3649 ::;t3
3650 :::d3
3651 !! html
3652 <dl><dd><dl><dd><dl><dt>t3</dt>
3653 <dd>d3</dd></dl></dd></dl></dd></dl>
3654
3655 !! end
3656
3657
3658 ## The Parsoid team believes the following three test exposes a
3659 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3660 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3661 ## It also exposes a "misfeature" in tidy, which doesn't like
3662 ## <dl> tags with a single <dt> child; it converts the <dt> into
3663 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3664 !! test
3665 Definition Lists: Mixed Lists: Test 1
3666 !! wikitext
3667 :;* foo
3668 ::* bar
3669 :; baz
3670 !! html/php
3671 <dl><dd><dl><dt><ul><li> foo</li>
3672 <li> bar</li></ul></dt></dl>
3673 <dl><dt> baz</dt></dl></dd></dl>
3674
3675 !! html/php+tidy
3676 <dl>
3677 <dd>
3678 <dl>
3679 <dd>
3680 <ul>
3681 <li>foo</li>
3682 <li>bar</li>
3683 </ul>
3684 </dd>
3685 </dl>
3686 <dl>
3687 <dt>baz</dt>
3688 </dl>
3689 </dd>
3690 </dl>
3691 !! html/parsoid
3692 <dl>
3693 <dd><dl>
3694 <dt><ul>
3695 <li> foo
3696 </li>
3697 </ul></dt>
3698 <dd><ul>
3699 <li> bar
3700 </li>
3701 </ul></dd>
3702 <dt> baz</dt>
3703 </dl></dd>
3704 </dl>
3705 !! end
3706
3707 !! test
3708 Definition Lists: Mixed Lists: Test 2
3709 !! wikitext
3710 *: d1
3711 *: d2
3712 !! html
3713 <ul><li><dl><dd> d1</dd>
3714 <dd> d2</dd></dl></li></ul>
3715
3716 !! end
3717
3718
3719 !! test
3720 Definition Lists: Mixed Lists: Test 3
3721 !! wikitext
3722 *::: d1
3723 *::: d2
3724 !! html
3725 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3726 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3727
3728 !! end
3729
3730
3731 !! test
3732 Definition Lists: Mixed Lists: Test 4
3733 !! wikitext
3734 *;d1 :d2
3735 *;d3 :d4
3736 !! html
3737 <ul><li><dl><dt>d1&#160;</dt>
3738 <dd>d2</dd>
3739 <dt>d3&#160;</dt>
3740 <dd>d4</dd></dl></li></ul>
3741
3742 !! end
3743
3744
3745 !! test
3746 Definition Lists: Mixed Lists: Test 5
3747 !! wikitext
3748 *:d1
3749 *:: d2
3750 !! html
3751 <ul><li><dl><dd>d1
3752 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3753
3754 !! end
3755
3756
3757 !! test
3758 Definition Lists: Mixed Lists: Test 6
3759 !! wikitext
3760 #*:d1
3761 #*::: d3
3762 !! html
3763 <ol><li><ul><li><dl><dd>d1
3764 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3765
3766 !! end
3767
3768
3769 !! test
3770 Definition Lists: Mixed Lists: Test 7
3771 !! wikitext
3772 :* d1
3773 :* d2
3774 !! html
3775 <dl><dd><ul><li> d1</li>
3776 <li> d2</li></ul></dd></dl>
3777
3778 !! end
3779
3780
3781 !! test
3782 Definition Lists: Mixed Lists: Test 8
3783 !! wikitext
3784 :* d1
3785 ::* d2
3786 !! html
3787 <dl><dd><ul><li> d1</li></ul>
3788 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3789
3790 !! end
3791
3792
3793 !! test
3794 Definition Lists: Mixed Lists: Test 9
3795 !! wikitext
3796 *;foo :bar
3797 !! html
3798 <ul><li><dl><dt>foo&#160;</dt>
3799 <dd>bar</dd></dl></li></ul>
3800
3801 !! end
3802
3803
3804 !! test
3805 Definition Lists: Mixed Lists: Test 10
3806 !! wikitext
3807 *#;foo :bar
3808 !! html
3809 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3810 <dd>bar</dd></dl></li></ol></li></ul>
3811
3812 !! end
3813
3814 # The Parsoid team disagrees with the PHP parser's seemingly-random
3815 # rules regarding dd/dt on the next two tests. Parsoid is more
3816 # consistent, and recognizes the shared nesting and keeps the
3817 # still-open tags around until the nesting is complete.
3818 # (And tidy again converts <dt> to <dd> before 'bar'.)
3819
3820 !! test
3821 Definition Lists: Mixed Lists: Test 11
3822 !! wikitext
3823 *#*#;*;;foo :bar
3824 *#*#;boo :baz
3825 !! html/php
3826 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3827 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3828 <dl><dt>boo&#160;</dt>
3829 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3830
3831 !! html/php+tidy
3832 <ul>
3833 <li>
3834 <ol>
3835 <li>
3836 <ul>
3837 <li>
3838 <ol>
3839 <li>
3840 <dl>
3841 <dt>foo&#160;</dt>
3842 <dd>
3843 <ul>
3844 <li>
3845 <dl>
3846 <dd>
3847 <dl>
3848 <dt>bar</dt>
3849 </dl>
3850 </dd>
3851 </dl>
3852 </li>
3853 </ul>
3854 </dd>
3855 </dl>
3856 <dl>
3857 <dt>boo&#160;</dt>
3858 <dd>baz</dd>
3859 </dl>
3860 </li>
3861 </ol>
3862 </li>
3863 </ul>
3864 </li>
3865 </ol>
3866 </li>
3867 </ul>
3868 !! html/parsoid
3869 <ul>
3870 <li>
3871 <ol>
3872 <li>
3873 <ul>
3874 <li>
3875 <ol>
3876 <li>
3877 <dl>
3878 <dt>
3879 <ul>
3880 <li>
3881 <dl>
3882 <dt>
3883 <dl>
3884 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3885 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3886 </dl></dt>
3887 </dl></li>
3888 </ul></dt>
3889 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3890 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3891 </dl></li>
3892 </ol></li>
3893 </ul></li>
3894 </ol></li>
3895 </ul>
3896 !! end
3897
3898
3899 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
3900 !! test
3901 Definition Lists: Weird Ones: Test 1
3902 !! wikitext
3903 *#;*::;; foo : bar (who uses this?)
3904 !! html/php
3905 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3906 <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>
3907
3908 !! html/php+tidy
3909 <ul>
3910 <li>
3911 <ol>
3912 <li>
3913 <dl>
3914 <dt>foo&#160;</dt>
3915 <dd>
3916 <ul>
3917 <li>
3918 <dl>
3919 <dd>
3920 <dl>
3921 <dd>
3922 <dl>
3923 <dd>
3924 <dl>
3925 <dt>bar (who uses this?)</dt>
3926 </dl>
3927 </dd>
3928 </dl>
3929 </dd>
3930 </dl>
3931 </dd>
3932 </dl>
3933 </li>
3934 </ul>
3935 </dd>
3936 </dl>
3937 </li>
3938 </ol>
3939 </li>
3940 </ul>
3941 !! html/parsoid
3942 <ul>
3943 <li>
3944 <ol>
3945 <li>
3946 <dl>
3947 <dt>
3948 <ul>
3949 <li>
3950 <dl>
3951 <dd>
3952 <dl>
3953 <dd>
3954 <dl>
3955 <dt>
3956 <dl>
3957 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3958 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3959 </dl></dt>
3960 </dl></dd>
3961 </dl></dd>
3962 </dl></li>
3963 </ul></dt>
3964 </dl></li>
3965 </ol></li>
3966 </ul>
3967 !! end
3968
3969 ###
3970 ### External links
3971 ###
3972 !! test
3973 External links: non-bracketed
3974 !! wikitext
3975 Non-bracketed: http://example.com
3976 !! html
3977 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3978 </p>
3979 !! end
3980
3981 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3982 !! test
3983 External links: numbered
3984 !! wikitext
3985 Numbered: [http://example.com]
3986 Numbered: [http://example.net]
3987 Numbered: [http://example.com]
3988 !! html/php
3989 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3990 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3991 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3992 </p>
3993 !! html/parsoid
3994 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
3995 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
3996 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
3997 !!end
3998
3999 !! test
4000 External links: specified text
4001 !! wikitext
4002 Specified text: [http://example.com link]
4003 !! html
4004 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4005 </p>
4006 !!end
4007
4008 !! test
4009 External links: trail
4010 !! wikitext
4011 Linktrails should not work for external links: [http://example.com link]s
4012 !! html
4013 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4014 </p>
4015 !! end
4016
4017 !! test
4018 External links: dollar sign in URL
4019 !! wikitext
4020 http://example.com/1$2345
4021 !! html
4022 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4023 </p>
4024 !! end
4025
4026 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4027 !! test
4028 External links: dollar sign in URL (autonumber)
4029 !! wikitext
4030 [http://example.com/1$2345]
4031 !! html/php
4032 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4033 </p>
4034 !! html/parsoid
4035 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4036 !!end
4037
4038 !! test
4039 External links: open square bracket forbidden in URL (bug 4377)
4040 !! options
4041 parsoid=wt2html,wt2wt,html2html
4042 !! wikitext
4043 http://example.com/1[2345
4044 !! html/php
4045 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4046 </p>
4047 !! html/parsoid
4048 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4049 !! end
4050
4051 !! test
4052 External links: open square bracket forbidden in URL (named) (bug 4377)
4053 !! options
4054 parsoid=wt2html,html2html
4055 !! wikitext
4056 [http://example.com/1[2345]
4057 !! html/php
4058 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4059 </p>
4060 !! html/parsoid
4061 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4062 !!end
4063
4064 # parsoid adds a space before the link name
4065 !! test
4066 External links: open square bracket forbidden in URL (named) (bug 4377)
4067 Parsoid variant.
4068 !! wikitext
4069 [http://example.com/1 [2345]
4070 !! html
4071 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4072 </p>
4073 !!end
4074
4075 !! test
4076 External links: nowiki in URL link text (bug 6230)
4077 !! wikitext
4078 [http://example.com/ <nowiki>''example site''</nowiki>]
4079 !! html
4080 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4081 </p>
4082 !! end
4083
4084 !! test
4085 External links: newline forbidden in text (bug 6230 regression check)
4086 !! wikitext
4087 [http://example.com/ first
4088 second]
4089 !! html
4090 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4091 second]
4092 </p>
4093 !!end
4094
4095 !! test
4096 External links: Pipe char between url and text
4097 !! wikitext
4098 [http://example.com | link]
4099 !! html
4100 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4101 </p>
4102 !!end
4103
4104 !! test
4105 External links: protocol-relative URL in brackets
4106 !! wikitext
4107 [//example.com/ Test]
4108 !! html
4109 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4110 </p>
4111 !! end
4112
4113 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4114 !! test
4115 External links: protocol-relative URL in brackets without text
4116 !! wikitext
4117 [//example.com]
4118 !! html/php
4119 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4120 </p>
4121 !! html/parsoid
4122 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4123 !! end
4124
4125 !! test
4126 External links: protocol-relative URL in free text is left alone
4127 !! wikitext
4128 //example.com/Foo
4129 !! html
4130 <p>//example.com/Foo
4131 </p>
4132 !!end
4133
4134 !! test
4135 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4136 !! wikitext
4137 foo//example.com/Foo
4138 !! html
4139 <p>foo//example.com/Foo
4140 </p>
4141 !! end
4142
4143 !! test
4144 External links: with no contents
4145 !! wikitext
4146 [http://en.wikipedia.org/wiki/Foo]
4147
4148 [[wikipedia:Foo|Bar]]
4149
4150 [[wikipedia:Foo|<span>Bar</span>]]
4151 !! html/php
4152 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4153 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4154 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4155 </p>
4156 !! html/parsoid
4157 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4158 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4159 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4160 !! end
4161
4162 !! test
4163 External links: Free with trailing punctuation
4164 !! wikitext
4165 http://example.com,
4166 http://example.com;
4167 http://example.com\
4168 http://example.com.
4169 http://example.com:
4170 http://example.com!
4171 http://example.com?
4172 http://example.com)
4173 http://example.com/url_with_(brackets)
4174 (http://example.com/url_without_brackets)
4175 http://example.com/url_with_entity&nbsp;
4176 http://example.com/url_with_entity&#xA0;
4177 http://example.com/url_with_entity&#160;
4178 http://example.com/url_with_entity&lt;
4179 http://example.com/url_with_entity&#x3C;
4180 http://example.com/url_with_entity&#60;
4181 !! html
4182 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4183 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4184 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4185 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4186 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4187 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4188 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4189 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4190 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4191 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4192 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4193 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4194 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4195 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4196 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4197 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4198 </p>
4199 !! end
4200
4201 !! test
4202 External links: No preceding word characters allowed (bug 65278)
4203 !! wikitext
4204 NOPEhttp://example.com
4205 N0http://example.com
4206 ok:http://example.com
4207 ok-http://example.com
4208 !! html
4209 <p>NOPEhttp://example.com
4210 N0http://example.com
4211 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4212 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4213 </p>
4214 !! end
4215
4216 !! test
4217 External image
4218 !! wikitext
4219 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4220 !! html
4221 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4222 </p>
4223 !! end
4224
4225 !! test
4226 External image from https
4227 !! wikitext
4228 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4229 !! html
4230 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4231 </p>
4232 !! end
4233
4234 !! test
4235 External image (when not allowed)
4236 !! options
4237 wgAllowExternalImages=0
4238 !! wikitext
4239 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4240 !! html
4241 <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>
4242 </p>
4243 !! end
4244
4245 !! test
4246 Link to non-http image, no img tag
4247 !! wikitext
4248 Link to non-http image, no img tag: ftp://example.com/test.jpg
4249 !! html
4250 <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>
4251 </p>
4252 !! end
4253
4254 !! test
4255 External links: terminating separator
4256 !! wikitext
4257 Terminating separator: http://example.com/thing,
4258 !! html
4259 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4260 </p>
4261 !! end
4262
4263 !! test
4264 External links: intervening separator
4265 !! wikitext
4266 Intervening separator: http://example.com/1,2,3
4267 !! html
4268 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4269 </p>
4270 !! end
4271
4272 !! test
4273 External links: old bug with URL in query
4274 !! wikitext
4275 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4276 !! html
4277 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4278 </p>
4279 !! end
4280
4281 !! test
4282 External links: old URL-in-URL bug, mixed protocols
4283 !! wikitext
4284 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4285 !! html
4286 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4287 </p>
4288 !!end
4289
4290 !! test
4291 External links: URL in text
4292 !! wikitext
4293 URL in text: [http://example.com http://example.com]
4294 !! html
4295 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4296 </p>
4297 !! end
4298
4299 !! test
4300 External links: Clickable images
4301 !! wikitext
4302 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4303 !! html
4304 <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>
4305 </p>
4306 !!end
4307
4308 !! test
4309 External links: raw ampersand
4310 !! wikitext
4311 Old &amp; use: http://x&y
4312 !! html
4313 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4314 </p>
4315 !! end
4316
4317 !! test
4318 External links: encoded ampersand
4319 !! wikitext
4320 Old &amp; use: http://x&amp;y
4321 !! html/php
4322 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4323 </p>
4324 !! html/parsoid
4325 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4326 !! end
4327
4328 !! test
4329 External links: encoded equals (bug 6102)
4330 !! wikitext
4331 http://example.com/?foo&#61;bar
4332 !! html/php
4333 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4334 </p>
4335 !! html/parsoid
4336 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4337 !! end
4338
4339 ##
4340 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4341 ## does it number them. As discussed in bug 53505, we can identify
4342 ## autonumbered links via CSS.
4343 ##
4344
4345 !! test
4346 External links: [raw ampersand]
4347 !! wikitext
4348 Old &amp; use: [http://x&y]
4349 !! html/php
4350 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4351 </p>
4352 !! html/parsoid
4353 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4354 !! end
4355
4356 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4357 # mode will return the [raw ampersand] wikitext
4358 !! test
4359 External links: [encoded ampersand]
4360 !! options
4361 parsoid=wt2html,wt2wt,html2html
4362 !! wikitext
4363 Old &amp; use: [http://x&amp;y]
4364 !! html/php
4365 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4366 </p>
4367 !! html/parsoid
4368 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4369 !! end
4370
4371 !! test
4372 External links: [raw equals]
4373 !! wikitext
4374 [http://example.com/?foo=bar]
4375 !! html/php
4376 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4377 </p>
4378 !! html/parsoid
4379 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4380 !! end
4381
4382 # note that parsoid html is identical to [raw equals] case; so html2wt
4383 # mode will return the [raw equals] wikitext
4384 !! test
4385 External links: [encoded equals] (bug 6102)
4386 !! options
4387 parsoid=wt2html,wt2wt,html2html
4388 !! wikitext
4389 [http://example.com/?foo&#61;bar]
4390 !! html/php
4391 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4392 </p>
4393 !! html/parsoid
4394 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4395 !! end
4396
4397 # xxx parsoid strips the IDN character, so the round-trip tests will
4398 # obviously fail and are disabled. --cscott
4399 !! test
4400 External links: [IDN ignored character reference in hostname; strip it right off]
4401 !! options
4402 parsoid=wt2html,wt2wt,html2html
4403 !! wikitext
4404 [http://e&zwnj;xample.com/]
4405 !! html/php
4406 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4407 </p>
4408 !! html/parsoid
4409 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4410 !! end
4411
4412 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4413 # Where an external link could easily circumvent the sanitization of the text of
4414 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4415 # test demands a higher standard. That's a bit strange.
4416 #
4417 # Example:
4418 #
4419 # http://e‌xample.com -> [http://example.com|http://example.com]
4420 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4421 #
4422 # The first example is sanitized, but the second is not. Any security benefits
4423 # from this production are trivial to circumvent. Either remove this test and
4424 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4425 # the test accordingly.
4426 #
4427 # All our love,
4428 # The Parsoid team.
4429 # xxx parsoid strips the IDN character, so the round-trip tests will
4430 # obviously fail and are disabled. --cscott
4431 !! test
4432 External links: IDN ignored character reference in hostname; strip it right off
4433 !! options
4434 parsoid=wt2html,html2html
4435 !! wikitext
4436 http://e&zwnj;xample.com/
4437 !! html/php
4438 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4439 </p>
4440 !! html/parsoid
4441 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4442 !! end
4443
4444 !! test
4445 External links: www.jpeg.org (bug 554)
4446 !! wikitext
4447 http://www.jpeg.org
4448 !! html
4449 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4450 </p>
4451 !! end
4452
4453 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4454 !! test
4455 External links: URL within URL (original bug 2)
4456 !! wikitext
4457 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4458 !! html/php
4459 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4460 </p>
4461 !! html/parsoid
4462 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4463 !! end
4464
4465 !! test
4466 BUG 361: URL inside bracketed URL
4467 !! wikitext
4468 [http://www.example.com/foo http://www.example.com/bar]
4469 !! html
4470 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4471 </p>
4472 !! end
4473
4474 !! test
4475 BUG 361: URL within URL, not bracketed
4476 !! wikitext
4477 http://www.example.com/foo?=http://www.example.com/bar
4478 !! html
4479 <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>
4480 </p>
4481 !! end
4482
4483 !! test
4484 BUG 289: ">"-token in URL-tail
4485 !! wikitext
4486 http://www.example.com/<hello>
4487 !! html
4488 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4489 </p>
4490 !!end
4491
4492 !! test
4493 BUG 289: literal ">"-token in URL-tail
4494 !! wikitext
4495 http://www.example.com/<b>html</b>
4496 !! html
4497 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4498 </p>
4499 !!end
4500
4501 !! test
4502 BUG 289: ">"-token in bracketed URL
4503 !! wikitext
4504 [http://www.example.com/<hello> stuff]
4505 !! html
4506 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4507 </p>
4508 !!end
4509
4510 !! test
4511 BUG 289: literal ">"-token in bracketed URL
4512 !! wikitext
4513 [http://www.example.com/<b>html</b> stuff]
4514 !! html
4515 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4516 </p>
4517 !!end
4518
4519 !! test
4520 BUG 289: literal double quote at end of URL
4521 !! wikitext
4522 http://www.example.com/"hello"
4523 !! html
4524 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4525 </p>
4526 !!end
4527
4528 !! test
4529 BUG 289: literal double quote in bracketed URL
4530 !! wikitext
4531 [http://www.example.com/"hello" stuff]
4532 !! html
4533 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4534 </p>
4535 !!end
4536
4537 !! test
4538 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4539 !! wikitext
4540 [http://www.example.com test]
4541 !! html
4542 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4543 </p>
4544 !! end
4545
4546 !! test
4547 External links: link text with spaces
4548 !! wikitext
4549 [http://www.example.com a b c]
4550 [http://www.example.com ''a'' ''b'']
4551 !! html
4552 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4553 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4554 </p>
4555 !! end
4556
4557 !! test
4558 External links: wiki links within external link (Bug 3695)
4559 !! wikitext
4560 [http://example.com [[wikilink]] embedded in ext link]
4561 !! html/php
4562 <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>
4563 </p>
4564 !! html/parsoid
4565 <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>
4566 !! end
4567
4568 !! test
4569 BUG 787: Links with one slash after the url protocol are invalid
4570 !! wikitext
4571 http:/example.com
4572
4573 [http:/example.com title]
4574 !! html
4575 <p>http:/example.com
4576 </p><p>[http:/example.com title]
4577 </p>
4578 !! end
4579
4580 !! test
4581 Bracketed external links with template-generated invalid target
4582 !! wikitext
4583 [{{echo|http:/example.com}} title]
4584 !! html
4585 <p>[http:/example.com title]
4586 </p>
4587 !! end
4588
4589 !! test
4590 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4591 !! wikitext
4592 ''[http://example.com text'']
4593 [http://example.com '''text]'''
4594 ''Something [http://example.com in italic'']
4595 ''Something [http://example.com mixed''''', even bold]'''
4596 '''''Now [http://example.com both''''']
4597 !! html
4598 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4599 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4600 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4601 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4602 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4603 </p>
4604 !! end
4605
4606
4607 !! test
4608 Bug 4781: %26 in URL
4609 !! wikitext
4610 http://www.example.com/?title=AT%26T
4611 !! html/php
4612 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4613 </p>
4614 !! html/parsoid
4615 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4616 !! end
4617
4618 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4619 # % is actually legal in HTML5. Any change in output would need testing though.
4620 !! test
4621 Bug 4781, 5267: %25 in URL
4622 !! wikitext
4623 http://www.example.com/?title=100%25_Bran
4624 !! html/php
4625 <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>
4626 </p>
4627 !! html/parsoid
4628 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4629 !! end
4630
4631 !! test
4632 Bug 4781, 5267: %28, %29 in URL
4633 !! wikitext
4634 http://www.example.com/?title=Ben-Hur_%281959_film%29
4635 !! html/php
4636 <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>
4637 </p>
4638 !! html/parsoid
4639 <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>
4640 !! end
4641
4642
4643 !! test
4644 Bug 4781: %26 in autonumber URL
4645 !! wikitext
4646 [http://www.example.com/?title=AT%26T]
4647 !! html/php
4648 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4649 </p>
4650 !! html/parsoid
4651 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4652 !! end
4653
4654 !! test
4655 Bug 4781, 5267: %26 in autonumber URL
4656 !! wikitext
4657 [http://www.example.com/?title=100%25_Bran]
4658 !! html/php
4659 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4660 </p>
4661 !! html/parsoid
4662 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4663 !! end
4664
4665 !! test
4666 Bug 4781, 5267: %28, %29 in autonumber URL
4667 !! wikitext
4668 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4669 !! html/php
4670 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4671 </p>
4672 !! html/parsoid
4673 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4674 !! end
4675
4676
4677 !! test
4678 Bug 4781: %26 in bracketed URL
4679 !! wikitext
4680 [http://www.example.com/?title=AT%26T link]
4681 !! html/php
4682 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4683 </p>
4684 !! html/parsoid
4685 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4686 !! end
4687
4688 !! test
4689 Bug 4781, 5267: %25 in bracketed URL
4690 !! wikitext
4691 [http://www.example.com/?title=100%25_Bran link]
4692 !! html
4693 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4694 </p>
4695 !! end
4696
4697 !! test
4698 Bug 4781, 5267: %28, %29 in bracketed URL
4699 !! wikitext
4700 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4701 !! html/php
4702 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4703 </p>
4704 !! html/parsoid
4705 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4706 !! end
4707
4708 !! test
4709 External link containing a period in the anchor. (bug 63947)
4710 !! wikitext
4711 [//foo.org/bar#baz. bang]
4712
4713 [//foo.org/bar. bang]
4714 !! html/php
4715 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4716 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4717 </p>
4718 !! html/parsoid
4719 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4720 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4721 !! end
4722
4723 !! test
4724 External link containing a single quote. (bug 63947)
4725 !! wikitext
4726 [//foo.org/bar'baz]
4727
4728 [//foo.org/bar'baz bang]
4729 !! html/php
4730 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4731 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4732 </p>
4733 !! html/parsoid
4734 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4735 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4736 !! end
4737
4738
4739 !! test
4740 External link containing a period in the anchor. (bug 63947)
4741 !! wikitext
4742 [//foo.org/bar#baz. bang]
4743
4744 [//foo.org/bar. bang]
4745 !! html/php
4746 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4747 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4748 </p>
4749 !! html/parsoid
4750 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4751 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4752 !! end
4753
4754 !! test
4755 External link containing a single quote. (bug 63947)
4756 !! wikitext
4757 [//foo.org/bar'baz]
4758
4759 [//foo.org/bar'baz bang]
4760 !! html/php
4761 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4762 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4763 </p>
4764 !! html/parsoid
4765 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4766 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4767 !! end
4768
4769
4770 !! test
4771 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4772 !! wikitext
4773 Some [http://example.com/ pretty ''italics'' and stuff]!
4774 !! html
4775 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4776 </p>
4777 !! end
4778
4779 !! test
4780 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4781 !! wikitext
4782 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4783 !! html
4784 <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>
4785 </p>
4786 !! end
4787
4788 !! test
4789 External link containing double-single-quotes with no space separating the url from text in italics
4790 !! wikitext
4791 [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]].]
4792 !! html/php
4793 <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>
4794 </p>
4795 !! html/php+tidy
4796 <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>
4797 !! html/parsoid
4798 <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>
4799 !! end
4800
4801 !! test
4802 External link with comments in link text
4803 !! wikitext
4804 [http://www.google.com Google <!-- comment -->]
4805 !! html
4806 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4807 </p>
4808 !! end
4809
4810 !! test
4811 URL-encoding in URL functions (single parameter)
4812 !! wikitext
4813 {{localurl:Some page|amp=&}}
4814 !! html
4815 <p>/index.php?title=Some_page&amp;amp=&amp;
4816 </p>
4817 !! end
4818
4819 !! test
4820 URL-encoding in URL functions (multiple parameters)
4821 !! wikitext
4822 {{localurl:Some page|q=?&amp=&}}
4823 !! html
4824 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4825 </p>
4826 !! end
4827
4828 !! test
4829 Brackets in urls
4830 !! wikitext
4831 http://example.com/index.php?foozoid%5B%5D=bar
4832
4833 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4834 !! html/php
4835 <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>
4836 </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>
4837 </p>
4838 !! html/parsoid
4839 <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>
4840
4841 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4842 !! end
4843
4844 !! test
4845 IPv6 urls (bug 21261)
4846 !! options
4847 disabled
4848 !! wikitext
4849 http://[2404:130:0:1000::187:2]/index.php
4850 !! html
4851 <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>
4852 </p>
4853 !! end
4854
4855 !! test
4856 Non-extlinks in brackets
4857 !! wikitext
4858 [foo]
4859 [foo bar]
4860 [foo ''bar'']
4861 [fool's] errand
4862 [fool's errand]
4863 [{{echo|foo}}]
4864 [{{echo|foo}} bar]
4865 [{{echo|foo}} ''bar'']
4866 [{{echo|foo}}l's] errand
4867 [{{echo|foo}}l's errand]
4868 [url={{echo|foo}}]
4869 [url=http://example.com]
4870 !! html
4871 <p>[foo]
4872 [foo bar]
4873 [foo <i>bar</i>]
4874 [fool's] errand
4875 [fool's errand]
4876 [foo]
4877 [foo bar]
4878 [foo <i>bar</i>]
4879 [fool's] errand
4880 [fool's errand]
4881 [url=foo]
4882 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4883 </p>
4884 !! end
4885
4886 !! test
4887 Percent encoding in external links
4888 !! wikitext
4889 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4890 !! html/php
4891 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4892 </p>
4893 !! html/parsoid
4894 <p><a rel="mw:ExtLink"
4895 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4896 !! end
4897
4898 !! test
4899 Use url link syntax for links where the content is equal the link target
4900 !! wikitext
4901 http://example.com
4902 !! html/php
4903 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4904 </p>
4905 !! html/parsoid
4906 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4907 !! end
4908
4909 !! test
4910 Parenthesis in external links, especially URL links
4911 !! wikitext
4912 http://example.com)
4913
4914 http://example.com/test)
4915
4916 http://example.com/(test)
4917
4918 http://example.com/((test)
4919
4920 (http://example.com/(test))
4921
4922 (http://example.com/(test)))))
4923
4924 http://example.com/a)b
4925
4926 [http://example.com) foo]
4927 !! html/php
4928 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4929 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4930 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4931 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4932 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4933 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4934 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4935 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4936 </p>
4937 !! html/parsoid
4938 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4939 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4940 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4941 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4942 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4943 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4944 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4945 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4946 !! end
4947
4948 !! test
4949 Parenthesis in external links, w/ transclusion or comment
4950 !! wikitext
4951 (http://example.com/{{echo|hi}})
4952
4953 (http://example.com<!-- hi -->)
4954 !! html/php
4955 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4956 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4957 </p>
4958 !! html/parsoid
4959 <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>
4960
4961 <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>
4962 !! end
4963
4964 !! test
4965 Replace invalid link targets when serializing
4966 !! options
4967 parsoid=html2wt
4968 !! html
4969 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
4970 !! wikitext
4971 [[MediaWiki:Badtitletext|Manual]]
4972 !! end
4973
4974 ###
4975 ### Quotes
4976 ###
4977
4978 !! test
4979 Quotes
4980 !! wikitext
4981 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4982
4983 Normal text. '''''Bold italic text.''''' Normal text.
4984 !! html
4985 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4986 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4987 </p>
4988 !! end
4989
4990
4991 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4992 # parser strips. The wikitext contains just the first half of the bold
4993 # quote pair.
4994 !! test
4995 Unclosed and unmatched quotes
4996 !! wikitext
4997 '''''Bold italic text '''with bold deactivated''' in between.'''''
4998
4999 '''''Bold italic text ''with italic deactivated'' in between.'''''
5000
5001 '''Bold text..
5002
5003 ..spanning two paragraphs (should not work).'''
5004
5005 '''Bold tag left open
5006
5007 ''Italic tag left open
5008
5009 Normal text.
5010
5011 <!-- Unmatching number of opening, closing tags: -->
5012 '''This year''''s election ''should'' beat '''last year''''s.
5013
5014 ''Tom'''s car is bigger than ''Susan'''s.
5015
5016 Plain ''italic'''s plain
5017 !! html/php
5018 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5019 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5020 </p><p><b>Bold text..</b>
5021 </p><p>..spanning two paragraphs (should not work).
5022 </p><p><b>Bold tag left open</b>
5023 </p><p><i>Italic tag left open</i>
5024 </p><p>Normal text.
5025 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5026 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5027 </p><p>Plain <i>italic'</i>s plain
5028 </p>
5029 !! html/parsoid
5030 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5031 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5032 </p><p><b>Bold text..</b>
5033 </p><p>..spanning two paragraphs (should not work).<b></b>
5034 </p><p><b>Bold tag left open</b>
5035 </p><p><i>Italic tag left open</i>
5036 </p><p>Normal text.
5037 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5038 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5039 </p><p>Plain <i>italic'</i>s plain
5040 </p>
5041 !! end
5042
5043 ###
5044 ### Tables
5045 ###
5046 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5047 ###
5048
5049 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5050 # is the bare minimum required by the spec, see:
5051 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5052 # Parsoid team replies: empty table tags are legal in HTML5
5053 !! test
5054 A table with no data.
5055 !! options
5056 parsoid=wt2html
5057 !! wikitext
5058 {||}
5059 !! html/php
5060
5061 !! html/parsoid
5062 <table></table>
5063
5064 !! end
5065
5066 !! test
5067 A table with stray table end tags on start tag line (wt2html)
5068 !! options
5069 parsoid=wt2html
5070 !! wikitext
5071 {|style="color: red;"|}
5072
5073 {|style="color: red;" |}
5074 |foo
5075 |}
5076
5077 {|style="color: red;"|} id="foo"
5078 |foo
5079 |}
5080
5081 {|style="color: red;" |} id="foo"
5082 |foo
5083 |}
5084 !! html
5085 <table style="color: red;"></table>
5086
5087 <table style="color: red;">
5088 <tbody><tr>
5089 <td>foo</td>
5090 </tr></tbody>
5091 </table>
5092
5093 <table style="color: red;" id="foo">
5094 <tbody><tr>
5095 <td>foo</td>
5096 </tr></tbody>
5097 </table>
5098
5099 <table style="color: red;" id="foo">
5100 <tbody><tr>
5101 <td>foo</td>
5102 </tr></tbody>
5103 </table>
5104
5105 !! end
5106
5107 !! test
5108 A table with no data (take 2)
5109 !! wikitext
5110 {|
5111 |}
5112 !! html/parsoid
5113 <table></table>
5114 !! end
5115
5116 # A table with nothing but a caption is invalid XHTML, we might want to render
5117 # this as <p>caption</p>
5118 # Parsoid team replies: table with only a caption is legal in HTML5
5119 !! test
5120 A table with nothing but a caption
5121 !! wikitext
5122 {|
5123 |+ caption
5124 |}
5125 !! html/php
5126 <table>
5127 <caption> caption
5128 </caption><tr><td></td></tr></table>
5129
5130 !! html/parsoid
5131 <table><caption> caption</caption></table>
5132 !! end
5133
5134 !! test
5135 A table with caption with default-spaced attributes and a table row
5136 !! wikitext
5137 {|
5138 |+ style="color: red;" | caption1
5139 |-
5140 | foo
5141 |}
5142 !! html
5143 <table>
5144 <caption style="color: red;"> caption1
5145 </caption>
5146 <tr>
5147 <td> foo
5148 </td></tr></table>
5149
5150 !! end
5151
5152 !! test
5153 A table with captions with non-default spaced attributes and a table row
5154 !! wikitext
5155 {|
5156 |+style="color: red;"|caption2
5157 |+ style="color: red;"| caption3
5158 |-
5159 | foo
5160 |}
5161 !! html
5162 <table>
5163 <caption style="color: red;">caption2
5164 </caption>
5165 <caption style="color: red;"> caption3
5166 </caption>
5167 <tr>
5168 <td> foo
5169 </td></tr></table>
5170
5171 !! end
5172
5173 !! test
5174 Table td-cell syntax variations
5175 !! wikitext
5176 {|
5177 | foo bar foo | baz
5178 | foo bar foo || baz
5179 | style='color:red;' | baz
5180 | style='color:red;' || baz
5181 |}
5182 !! html
5183 <table>
5184 <tr>
5185 <td> baz
5186 </td>
5187 <td> foo bar foo </td>
5188 <td> baz
5189 </td>
5190 <td style="color:red;"> baz
5191 </td>
5192 <td> style='color:red;' </td>
5193 <td> baz
5194 </td></tr></table>
5195
5196 !! end
5197
5198 !! test
5199 Simple table
5200 !! wikitext
5201 {|
5202 | 1 || 2
5203 |-
5204 | 3 || 4
5205 |}
5206 !! html
5207 <table>
5208 <tr>
5209 <td> 1 </td>
5210 <td> 2
5211 </td></tr>
5212 <tr>
5213 <td> 3 </td>
5214 <td> 4
5215 </td></tr></table>
5216
5217 !! end
5218
5219 !! test
5220 Simple table but with multiple dashes for row wikitext
5221 !! wikitext
5222 {|
5223 | foo
5224 |-----
5225 | bar
5226 |}
5227 !! html
5228 <table>
5229 <tr>
5230 <td> foo
5231 </td></tr>
5232 <tr>
5233 <td> bar
5234 </td></tr></table>
5235
5236 !! end
5237 !! test
5238 Multiplication table
5239 !! wikitext
5240 {| border="1" cellpadding="2"
5241 |+Multiplication table
5242 |-
5243 ! &times; !! 1 !! 2 !! 3
5244 |-
5245 ! 1
5246 | 1 || 2 || 3
5247 |-
5248 ! 2
5249 | 2 || 4 || 6
5250 |-
5251 ! 3
5252 | 3 || 6 || 9
5253 |-
5254 ! 4
5255 | 4 || 8 || 12
5256 |-
5257 ! 5
5258 | 5 || 10 || 15
5259 |}
5260 !! html
5261 <table border="1" cellpadding="2">
5262 <caption>Multiplication table
5263 </caption>
5264 <tr>
5265 <th> &#215; </th>
5266 <th> 1 </th>
5267 <th> 2 </th>
5268 <th> 3
5269 </th></tr>
5270 <tr>
5271 <th> 1
5272 </th>
5273 <td> 1 </td>
5274 <td> 2 </td>
5275 <td> 3
5276 </td></tr>
5277 <tr>
5278 <th> 2
5279 </th>
5280 <td> 2 </td>
5281 <td> 4 </td>
5282 <td> 6
5283 </td></tr>
5284 <tr>
5285 <th> 3
5286 </th>
5287 <td> 3 </td>
5288 <td> 6 </td>
5289 <td> 9
5290 </td></tr>
5291 <tr>
5292 <th> 4
5293 </th>
5294 <td> 4 </td>
5295 <td> 8 </td>
5296 <td> 12
5297 </td></tr>
5298 <tr>
5299 <th> 5
5300 </th>
5301 <td> 5 </td>
5302 <td> 10 </td>
5303 <td> 15
5304 </td></tr></table>
5305
5306 !! end
5307
5308 !! test
5309 Accept "||" in table headings
5310 !! wikitext
5311 {|
5312 !h1 || h2
5313 |}
5314 !! html
5315 <table>
5316 <tr>
5317 <th>h1 </th>
5318 <th> h2
5319 </th></tr></table>
5320
5321 !! end
5322
5323 !! test
5324 Accept "!!" in table data
5325 !! wikitext
5326 {|
5327 | Foo!! ||
5328 |}
5329 !! html
5330 <table>
5331 <tr>
5332 <td> Foo!! </td>
5333 <td>
5334 </td></tr></table>
5335
5336 !! html/parsoid
5337 <table>
5338 <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>
5339 </tbody></table>
5340 !! end
5341
5342 !! test
5343 Accept "||" in indented table headings
5344 !! wikitext
5345 :{|
5346 !h1 || h2
5347 |}
5348 !! html
5349 <dl><dd><table>
5350 <tr>
5351 <th>h1 </th>
5352 <th> h2
5353 </th></tr></table></dd></dl>
5354
5355 !! end
5356
5357 !! test
5358 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5359 !! wikitext
5360 {|
5361 !| h1
5362 || a
5363 |}
5364 !! html
5365 <table>
5366 <tr>
5367 <th> h1
5368 </th>
5369 <td> a
5370 </td></tr></table>
5371
5372 !! end
5373
5374 !!test
5375 Accept "| !" at start of line in tables (ignore !-attribute)
5376 !! wikitext
5377 {|
5378 |-
5379 | !style="color:red" | bar
5380 |}
5381 !! html
5382 <table>
5383
5384 <tr>
5385 <td> bar
5386 </td></tr></table>
5387
5388 !!end
5389
5390 !!test
5391 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 +/-
5392 !! wikitext
5393 {|
5394 |-
5395 |style='color:red;'|+1
5396 |style='color:blue;'|-1
5397 |-
5398 | 1 || 2 || 3
5399 | 1 ||+2 ||-3
5400 |-
5401 | +1
5402 | -1
5403 |}
5404 !! html
5405 <table>
5406
5407 <tr>
5408 <td style="color:red;">+1
5409 </td>
5410 <td style="color:blue;">-1
5411 </td></tr>
5412 <tr>
5413 <td> 1 </td>
5414 <td> 2 </td>
5415 <td> 3
5416 </td>
5417 <td> 1 </td>
5418 <td>+2 </td>
5419 <td>-3
5420 </td></tr>
5421 <tr>
5422 <td> +1
5423 </td>
5424 <td> -1
5425 </td></tr></table>
5426
5427 !!end
5428
5429 !! test
5430 Table rowspan
5431 !! wikitext
5432 {| border=1
5433 | Cell 1, row 1
5434 |rowspan=2| Cell 2, row 1 (and 2)
5435 | Cell 3, row 1
5436 |-
5437 | Cell 1, row 2
5438 | Cell 3, row 2
5439 |}
5440 !! html
5441 <table border="1">
5442 <tr>
5443 <td> Cell 1, row 1
5444 </td>
5445 <td rowspan="2"> Cell 2, row 1 (and 2)
5446 </td>
5447 <td> Cell 3, row 1
5448 </td></tr>
5449 <tr>
5450 <td> Cell 1, row 2
5451 </td>
5452 <td> Cell 3, row 2
5453 </td></tr></table>
5454
5455 !! end
5456
5457 !! test
5458 Nested table
5459 !! wikitext
5460 {| border=1
5461 | &alpha;
5462 |
5463 {| bgcolor=#ABCDEF border=2
5464 |nested
5465 |-
5466 |table
5467 |}
5468 |the original table again
5469 |}
5470 !! html
5471 <table border="1">
5472 <tr>
5473 <td> &#945;
5474 </td>
5475 <td>
5476 <table bgcolor="#ABCDEF" border="2">
5477 <tr>
5478 <td>nested
5479 </td></tr>
5480 <tr>
5481 <td>table
5482 </td></tr></table>
5483 </td>
5484 <td>the original table again
5485 </td></tr></table>
5486
5487 !! end
5488
5489 !! test
5490 Invalid attributes in table cell (bug 1830)
5491 !! wikitext
5492 {|
5493 |Cell:|broken
5494 |}
5495 !! html
5496 <table>
5497 <tr>
5498 <td>broken
5499 </td></tr></table>
5500
5501 !! end
5502
5503
5504 # The "|}" to close the table is missing from the input, so parsoid's
5505 # *2wt modes will fail.
5506 !! test
5507 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5508 !! options
5509 parsoid=wt2html,html2html
5510 !! wikitext
5511 {|
5512 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5513 !! html/php
5514 <table>
5515 <tr>
5516 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5517 <td>]" onmouseover="alert(document.cookie)"&gt;test
5518 </td>
5519 </tr>
5520 </table>
5521
5522 !! html/parsoid
5523 <table><tbody>
5524 <tr>
5525 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5526 !! end
5527
5528
5529 !! test
5530 Indented table markup mixed with indented pre content (proposed in bug 6200)
5531 !! wikitext
5532 <table>
5533 <tr>
5534 <td>
5535 Text that should be rendered preformatted
5536 </td>
5537 </tr>
5538 </table>
5539 !! html
5540 <table>
5541 <tr>
5542 <td>
5543 <pre>Text that should be rendered preformatted
5544 </pre>
5545 </td>
5546 </tr>
5547 </table>
5548
5549 !! end
5550
5551 !! test
5552 Template-generated table cell attributes and cell content
5553 !! wikitext
5554 {|
5555 |{{table_attribs}}
5556 | {{table_attribs}}
5557 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
5558 |align=center {{table_attribs}}
5559 | <!--foo--> align=center <!--bar--> {{table_attribs}}
5560 |}
5561 !! html
5562 <table>
5563 <tr>
5564 <td style="color: red"> Foo
5565 </td>
5566 <td style="color: red"> Foo
5567 </td>
5568 <td style="color: red"> Foo
5569 </td>
5570 <td align="center" style="color: red"> Foo
5571 </td>
5572 <td align="center" style="color: red"> Foo
5573 </td></tr></table>
5574
5575 !! end
5576
5577 !! test
5578 Template-generated table cell attributes and cell content (2)
5579 !! wikitext
5580 {|
5581 |align=center {{table_cells}}
5582 |}
5583 !! html
5584 <table>
5585 <tr>
5586 <td align="center" style="color: red"> Foo </td>
5587 <td> Bar </td>
5588 <td> Baz
5589 </td></tr></table>
5590
5591 !! end
5592
5593 !! test
5594 Table with row followed by newlines and table heading
5595 !! wikitext
5596 {|
5597 |-
5598
5599 ! foo
5600 |}
5601 !! html
5602 <table>
5603
5604
5605 <tr>
5606 <th> foo
5607 </th></tr></table>
5608
5609 !! end
5610
5611 !! test
5612 Table with empty line following the start tag
5613 !! wikitext
5614 {|
5615
5616 |-
5617 | foo
5618 |}
5619 !! html
5620 <table>
5621
5622
5623 <tr>
5624 <td> foo
5625 </td></tr></table>
5626
5627 !! end
5628
5629 # FIXME: Preserve the attribute properly (with an empty string as value) in
5630 # the PHP parser. Parsoid implements the behavior below.
5631 !! test
5632 Table attributes with empty value
5633 !! wikitext
5634 {|
5635 | style=| hello
5636 |}
5637 !! html/parsoid
5638 <table>
5639 <tbody>
5640 <tr>
5641 <td style=""> hello
5642 </td></tr></tbody></table>
5643
5644 !! end
5645
5646 !! test
5647 Wikitext table with a lot of comments
5648 !! wikitext
5649 {|
5650 <!-- c0 -->
5651 | foo
5652 <!-- c1 -->
5653 |- <!-- c2 -->
5654 <!-- c3 -->
5655 |<!-- c4 -->
5656 <!-- c5 -->
5657 |}
5658 !! html
5659 <table>
5660 <tr>
5661 <td> foo
5662 </td></tr>
5663 <tr>
5664 <td>
5665 </td></tr></table>
5666
5667 !! end
5668
5669 !! test
5670 Wikitext table with double-line table cell
5671 !! wikitext
5672 {|
5673 |a
5674 b
5675 |}
5676 !! html
5677 <table>
5678 <tr>
5679 <td>a
5680 <p>b
5681 </p>
5682 </td></tr></table>
5683
5684 !! end
5685
5686 !! test
5687 Table cell with a single comment
5688 !! wikitext
5689 {|
5690 | <!-- c1 -->
5691 | a
5692 |}
5693 !! html
5694 <table>
5695 <tr>
5696 <td>
5697 </td>
5698 <td> a
5699 </td></tr></table>
5700
5701 !! end
5702
5703 !! test
5704 Table-cell after a comment-only-empty-line
5705 !! wikitext
5706 {|
5707 |a
5708 <!--c1-->
5709 <!--c2-->| b
5710 |}
5711 !! html
5712 <table>
5713 <tr>
5714 <td>a
5715 </td>
5716 <td> b
5717 </td></tr></table>
5718
5719 !! html/parsoid
5720 <table>
5721 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5722 <!--c1-->
5723 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5724 </tbody></table>
5725
5726 !! end
5727
5728 !! test
5729 Build table with {{!}}
5730 !! wikitext
5731 {{{!}} class="wikitable"
5732 ! header
5733 ! second header
5734 {{!}}- style="color:red;"
5735 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
5736 {{!}}}
5737 !! html
5738 <table class="wikitable">
5739 <tr>
5740 <th> header
5741 </th>
5742 <th> second header
5743 </th></tr>
5744 <tr style="color:red;">
5745 <td> data </td>
5746 <td style="color:red;"> second data
5747 </td></tr></table>
5748
5749 !! end
5750
5751 !! test
5752 Build table with pipe as data
5753 !! wikitext
5754 {| class="wikitable"
5755 ! header
5756 ! second header
5757 |- style="color:red;"
5758 | data || style="color:red;" | second data
5759 |-
5760 | style="color:red;" | data with | || style="color:red;" | second data with |
5761 |-
5762 || data with | ||| second data with |
5763 |}
5764 !! html
5765 <table class="wikitable">
5766 <tr>
5767 <th> header
5768 </th>
5769 <th> second header
5770 </th></tr>
5771 <tr style="color:red;">
5772 <td> data </td>
5773 <td style="color:red;"> second data
5774 </td></tr>
5775 <tr>
5776 <td style="color:red;"> data with | </td>
5777 <td style="color:red;"> second data with |
5778 </td></tr>
5779 <tr>
5780 <td> data with | </td>
5781 <td> second data with |
5782 </td></tr></table>
5783
5784 !! end
5785
5786 !! test
5787 Build table with wikilink
5788 !! wikitext
5789 {| class="wikitable"
5790 ! header || second header
5791 |- style="color:red;"
5792 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
5793 |-
5794 | data || second data [[Main Page|link|text with pipe]]
5795 |}
5796 !! html
5797 <table class="wikitable">
5798 <tr>
5799 <th> header </th>
5800 <th> second header
5801 </th></tr>
5802 <tr style="color:red;">
5803 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
5804 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
5805 </td></tr>
5806 <tr>
5807 <td> data </td>
5808 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
5809 </td></tr></table>
5810
5811 !! end
5812
5813 # The expected HTML structure in this test is debatable. The PHP parser does
5814 # not parse this kind of table at all. The main focus for Parsoid is on
5815 # round-tripping, so this output is ok for now. TODO: revisit!
5816 !! test
5817 Wikitext table with html-syntax row
5818 !! wikitext
5819 {|
5820 |-
5821 <td>foo</td>
5822 |}
5823 !! html/parsoid
5824 <table>
5825 <tbody>
5826 <tr>
5827 <td>foo</td></tr></tbody></table>
5828 !! end
5829
5830 ## Note that Parsoid output differs from PHP and PHP+tidy here.
5831 ## The lack of <tr> tags in the PHP output is arguably a bug in the
5832 ## PHP parser, which tidy then compounds by fostering the content
5833 ## entirely out of the table. Parsoid recognizes the table context
5834 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
5835 ## depends on PHP's treatment of broken table markup!
5836 !! test
5837 Implicit <td> after a |-
5838 !! options
5839 parsoid=wt2html,html2html
5840 !! wikitext
5841 {|
5842 |-
5843 a
5844 |}
5845 !! html/php
5846 <table>
5847
5848 a
5849 </table>
5850
5851 !! html/php+tidy
5852 <p>a</p>
5853 !! html/parsoid
5854 <table>
5855 <tr><td>a</td></tr>
5856 </table>
5857 !! end
5858
5859 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
5860 !! test
5861 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
5862 !! options
5863 parsoid=wt2html,html2html
5864 !! wikitext
5865 {|
5866 |-
5867 |
5868 a
5869 |-
5870 b
5871 |}
5872 !! html/php
5873 <table>
5874
5875 <tr>
5876 <td>
5877 <pre>a
5878 </pre>
5879 </td></tr>
5880 b
5881 </table>
5882
5883 !! html/php+tidy
5884 <p>b</p>
5885 <table>
5886 <tr>
5887 <td>
5888 <pre>
5889 a
5890 </pre></td>
5891 </tr>
5892 </table>
5893 !! html/parsoid
5894 <table>
5895 <tbody>
5896 <tr><td><pre>a</pre></td></tr>
5897 <tr><td> b</td></tr>
5898 </tbody>
5899 </table>
5900 !! end
5901
5902 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
5903 # Parsoid generates the missing <td>, so wt2wt won't succeed.
5904 !! test
5905 Lists should be recognized in an implicit <td> context
5906 !! options
5907 parsoid=wt2html,html2html
5908 !! wikitext
5909 {|
5910 |-
5911 *a
5912 |}
5913 !! html/php
5914 <table>
5915
5916 <ul><li>a</li></ul>
5917 </table>
5918
5919 !! html/php+tidy
5920 <ul>
5921 <li>a</li>
5922 </ul>
5923 !! html/parsoid
5924 <table>
5925 <tr>
5926 <td><ul>
5927 <li>a</li>
5928 </ul></td>
5929 </tr>
5930 </table>
5931 !! end
5932
5933 !! test
5934 Parsoid: Round-trip tables directly followed by content (bug 51219)
5935 !! options
5936 parsoid=wt2html,wt2wt
5937 !! wikitext
5938 {|
5939 |foo
5940 |} bar
5941
5942 {|
5943 |baz
5944 |}<b>quux</b>
5945 !! html+tidy
5946 <table>
5947 <tr>
5948 <td>foo</td>
5949 </tr>
5950 </table>
5951 <p>bar</p>
5952 <table>
5953 <tr>
5954 <td>baz</td>
5955 </tr>
5956 </table>
5957 <p><b>quux</b></p>
5958 !! end
5959
5960 !! test
5961 Parsoid: Default to a newline after tables in new content (bug 51219)
5962 !! options
5963 parsoid=html2wt
5964 !! wikitext
5965 {|
5966 |foo
5967 |}
5968 <nowiki> </nowiki>bar
5969 {|
5970 |baz
5971 |}
5972 '''quux'''
5973 !! html
5974 <table><tbody>
5975 <tr><td>foo</td></tr></tbody></table> bar
5976 <table><tbody>
5977 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5978 !! end
5979
5980 !! test
5981 Parsoid: newline inducing block nodes don't suppress <nowiki>
5982 !! options
5983 parsoid=html2wt
5984 !! wikitext
5985 <nowiki> </nowiki>a
5986
5987 = foo =
5988 !! html
5989 a<h1>foo</h1>
5990 !! end
5991
5992 !! test
5993 Parsoid: Row-syntax table headings followed by comment & table cells
5994 !! options
5995 parsoid=wt2html,wt2wt
5996 !! wikitext
5997 {|
5998 ! foo || bar
5999 <!-- foo --> || baz || quux
6000 |}
6001 !! html/php
6002 <table>
6003 <tr>
6004 <th> foo </th>
6005 <th> bar
6006 </th>
6007 <td> baz </td>
6008 <td> quux
6009 </td></tr></table>
6010
6011 !! html/parsoid
6012 <table>
6013 <tbody><tr><th> foo </th><th> bar
6014 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6015 </tbody></table>
6016 !! end
6017
6018
6019 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6020 # preserves it.
6021 !!test
6022 Parsoid: Recover better from broken table attributes
6023 !!options
6024 parsoid=wt2html
6025 !!wikitext
6026 {| class="foo
6027 | class="bar" |
6028 foo
6029 |}
6030 !!html/php+tidy
6031 <table>
6032 <tr>
6033 <td class="bar">
6034 <p>foo</p>
6035 </td>
6036 </tr>
6037 </table>
6038 !!html/parsoid
6039 <table class="foo">
6040 <tr>
6041 <td class="bar">
6042 <p>foo</p></td></tr>
6043 </tbody></table>
6044 !!end
6045
6046 !! test
6047 Strip unsupported table tags
6048 !! options
6049 parsoid=html2wt
6050 !! html
6051 <table>
6052 <thead>
6053 <tr>
6054 <th>Month</th>
6055 <th>Savings</th>
6056 </tr>
6057 </thead>
6058 <tbody>
6059 <tr>
6060 <td>January</td>
6061 <td>$100</td>
6062 </tr>
6063 <tr>
6064 <td>February</td>
6065 <td>$80</td>
6066 </tr>
6067 </tbody>
6068 <tfoot>
6069 <tr>
6070 <td>Sum</td>
6071 <td>$180</td>
6072 </tr>
6073 </tfoot>
6074 </table>
6075 !! wikitext
6076 {|
6077
6078 !Month
6079 !Savings
6080
6081 |January
6082 |$100
6083
6084 |-
6085 |February
6086 |$80
6087
6088 |Sum
6089 |$180
6090
6091 |}
6092 !! end
6093
6094 ###
6095 ### Internal links
6096 ###
6097 !! test
6098 Plain link, capitalized
6099 !! wikitext
6100 [[Main Page]]
6101 !! html
6102 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6103 </p>
6104 !! end
6105
6106 !! test
6107 Plain link, uncapitalized
6108 !! wikitext
6109 [[main Page]]
6110 !! html
6111 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6112 </p>
6113 !! end
6114
6115 !! test
6116 Piped link
6117 !! wikitext
6118 [[Main Page|The Main Page]]
6119 !! html
6120 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6121 </p>
6122 !! end
6123
6124 !! test
6125 Piped link with comment in link text
6126 !! wikitext
6127 [[Main Page|The Main<!--front--> Page]]
6128 !! html
6129 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6130 </p>
6131 !! end
6132
6133 !! test
6134 Piped link with multiple pipe characters in link text
6135 !! wikitext
6136 [[Main Page||The|Main|Page|]]
6137 !! html/php
6138 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6139 </p>
6140 !! html/parsoid
6141 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6142 !! end
6143
6144 !! test
6145 Broken link
6146 !! wikitext
6147 [[Zigzagzogzagzig]]
6148 !! html
6149 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6150 </p>
6151 !! end
6152
6153 !! test
6154 Broken link with fragment
6155 !! wikitext
6156 [[Zigzagzogzagzig#zug]]
6157 !! html
6158 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6159 </p>
6160 !! end
6161
6162 !! test
6163 Special page link with fragment
6164 !! wikitext
6165 [[Special:Version#anchor]]
6166 !! html
6167 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6168 </p>
6169 !! end
6170
6171 !! test
6172 Nonexistent special page link with fragment
6173 !! wikitext
6174 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6175 !! html
6176 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6177 </p>
6178 !! end
6179
6180 !! test
6181 Link with prefix
6182 !! wikitext
6183 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6184 !! html
6185 <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>
6186 </p>
6187 !! end
6188
6189 !! test
6190 Link with suffix
6191 !! wikitext
6192 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6193 !! html
6194 <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>!!!
6195 </p>
6196 !! end
6197
6198 !! article
6199 prefixed article
6200 !! text
6201 Some text
6202 !! endarticle
6203
6204 !! test
6205 Bug 43661: Piped links with identical prefixes
6206 !! wikitext
6207 [[prefixed article|prefixed articles with spaces]]
6208
6209 [[prefixed article|prefixed articlesaoeu]]
6210
6211 [[Main Page|Main Page test]]
6212 !! html
6213 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6214 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6215 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6216 </p>
6217 !! end
6218
6219
6220 !! test
6221 Link with HTML entity in suffix / tail
6222 !! wikitext
6223 [[Main Page]]&quot;, [[Main Page]]&#97;
6224 !! html
6225 <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;
6226 </p>
6227 !! end
6228
6229 !! test
6230 Link with 3 brackets
6231 !! wikitext
6232 [[[Main Page]]]
6233 !! html
6234 <p>[[[Main Page]]]
6235 </p>
6236 !! end
6237
6238 !! test
6239 Link with 4 brackets
6240 !! wikitext
6241 [[[[Main Page]]]]
6242 !! html
6243 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6244 </p>
6245 !! end
6246
6247 !! test
6248 Piped link with 3 brackets
6249 !! wikitext
6250 [[[main page|the main page]]]
6251 !! html
6252 <p>[[[main page|the main page]]]
6253 </p>
6254 !! end
6255
6256 !! test
6257 Piped link with extlink-like text
6258 !! wikitext
6259 [[Main Page|[bar]]]
6260 [[Main Page|This is a [bar]]]
6261 !! html
6262 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6263 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6264 </p>
6265 !! end
6266
6267 !! test
6268 Link with multiple pipes
6269 !! wikitext
6270 [[Main Page|The|Main|Page]]
6271 !! html
6272 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6273 </p>
6274 !! end
6275
6276 # Note that parsoid does not munge anchor text; all non-space
6277 # characters are valid in HTML5 ids.
6278 !! test
6279 Anchor containing a #. (bug 63430)
6280 !! wikitext
6281 [[Main Page#And#Link]]
6282 !! html/php
6283 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6284 </p>
6285 !! html/parsoid
6286 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6287 !! end
6288
6289 !! test
6290 Link to namespaces
6291 !! wikitext
6292 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6293 !! html
6294 <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>
6295 </p>
6296 !! end
6297
6298 !! test
6299 Link with space in namespace
6300 !! wikitext
6301 [[User talk:Foo bar]]
6302 !! html
6303 <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>
6304 </p>
6305 !! end
6306
6307 !! article
6308 MemoryAlpha:AlphaTest
6309 !! text
6310 This is an article in the MemoryAlpha namespace
6311 (which shadows the memoryalpha interwiki link).
6312 !! endarticle
6313
6314 !! test
6315 Namespace takes precedence over interwiki link (bug 51680)
6316 !! wikitext
6317 [[MemoryAlpha:AlphaTest]]
6318 !! html
6319 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6320 </p>
6321 !! end
6322
6323 # The previous test doesn't work correctly in html2*, due to not recognizing the
6324 # link as an internal one. This one checks for the correct behavior.
6325 !! test
6326 Link to namespace preferred over interwiki with correct rel attribute
6327 !! options
6328 parsoid=html2wt,html2html
6329 !! wikitext
6330 [[MemoryAlpha:AlphaTest]]
6331 !! html
6332 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6333 </p>
6334 !! end
6335
6336 !! test
6337 Piped link to namespace
6338 !! wikitext
6339 [[Meta:Disclaimers|The disclaimers]]
6340 !! html
6341 <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>
6342 </p>
6343 !! end
6344
6345 !! test
6346 Link containing }
6347 !! wikitext
6348 [[Usually caused by a typo (oops}]]
6349 !! html
6350 <p>[[Usually caused by a typo (oops}]]
6351 </p>
6352 !! end
6353
6354 !! article
6355 7% Solution
6356 !! text
6357 Just a test of an article title containing a percent.
6358 !! endarticle
6359
6360 !! test
6361 Link containing % (not as a hex sequence)
6362 !! wikitext
6363 [[7% Solution]]
6364 !! html/php
6365 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6366 </p>
6367 !! html/parsoid
6368 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6369 !! end
6370
6371 # note that the parsoid HTML is identical to the previous test output,
6372 # so the previous test ensures that the html2wt mode will generate the
6373 # "not as a hex sequence" wikitext.
6374 !! test
6375 Link containing % as a single hex sequence interpreted to char
6376 !! options
6377 parsoid=wt2wt,wt2html,html2html
6378 !! wikitext
6379 [[7%25 Solution]]
6380 !! html/php
6381 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6382 </p>
6383 !! html/parsoid
6384 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6385 !!end
6386
6387 !! test
6388 Link containing % as a double hex sequence interpreted to hex sequence
6389 !! wikitext
6390 [[7%2525 Solution]]
6391 !! html
6392 <p>[[7%2525 Solution]]
6393 </p>
6394 !!end
6395
6396 # note that parsoid does not munge anchor text; all non-space
6397 # characters are valid in HTML5 anchors.
6398 !! test
6399 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6400 Example for such a section: == < ==
6401 !! wikitext
6402 [[%23%3c]][[%23%3e]]
6403 !! html/php
6404 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6405 </p>
6406 !! html/parsoid
6407 <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>
6408 !! end
6409
6410 !! test
6411 Link containing "<#" and ">#" as a hex sequences
6412 !! wikitext
6413 [[%3c%23]][[%3e%23]]
6414 !! html
6415 <p>[[%3c%23]][[%3e%23]]
6416 </p>
6417 !! end
6418
6419 !! test
6420 Link containing an equals sign
6421 !! wikitext
6422 [[Special:BookSources/isbn=4-00-026157-6]]
6423 !! html/php
6424 <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>
6425 </p>
6426 !! html/parsoid
6427 <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>
6428 !! end
6429
6430 !! article
6431 Foo~bar
6432 !! text
6433 Just a test of an article title containing a tilde.
6434 !! endarticle
6435
6436 # note that links containing signatures, like [[Foo~~~~]], are
6437 # massaged by the pre-save transform (PST) and so the tildes are never
6438 # seen by the parser.
6439 !! test
6440 Link containing a tilde
6441 !! wikitext
6442 [[Foo~bar]]
6443 !! html/php
6444 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6445 </p>
6446 !! html/parsoid
6447 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6448 !! end
6449
6450 !! test
6451 Link containing double-single-quotes '' (bug 4598)
6452 !! wikitext
6453 [[Lista d''e paise d''o munno]]
6454 !! html/php
6455 <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>
6456 </p>
6457 !! html/parsoid
6458 <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>
6459 !! end
6460
6461 !! test
6462 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6463 !! wikitext
6464 Some [[Link|pretty ''italics'' and stuff]]!
6465 !! html/php
6466 <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>!
6467 </p>
6468 !! html/parsoid
6469 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6470 !! end
6471
6472 !! test
6473 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6474 !! wikitext
6475 ''Some [[Link|pretty ''italics'' and stuff]]!''
6476 !! html
6477 <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>
6478 </p>
6479 !! end
6480
6481 !! test
6482 Link with double quotes in title part (literal) and alternate part (interpreted)
6483 !! wikitext
6484 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
6485
6486 [[''Pentecoste'']]
6487
6488 [[''Pentecoste''|Pentecoste]]
6489
6490 [[''Pentecoste''|''Pentecoste'']]
6491 !! html/php
6492 <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>
6493 </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>
6494 </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>
6495 </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>
6496 </p>
6497 !! html/parsoid
6498 <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>
6499 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6500 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6501 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6502 !! end
6503
6504 !! test
6505 Broken image links with HTML captions (bug 39700)
6506 !! wikitext
6507 [[File:Nonexistent|<script></script>]]
6508 [[File:Nonexistent|100x100px|<script></script>]]
6509 [[File:Nonexistent|&lt;]]
6510 [[File:Nonexistent|a<i>b</i>c]]
6511 !! html/php
6512 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6513 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6514 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6515 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6516 </p>
6517 !! html/parsoid
6518 <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>
6519 <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>
6520 <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>
6521 <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>
6522 !! end
6523
6524 !! test
6525 Plain link to URL
6526 !! wikitext
6527 [[http://www.example.com]]
6528 !! html/php
6529 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6530 </p>
6531 !! html/parsoid
6532 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6533 !! end
6534
6535 !! test
6536 Plain link to URL with link text
6537 !! wikitext
6538 [[http://www.example.com Link text]]
6539 !! html
6540 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6541 </p>
6542 !! end
6543
6544 !! test
6545 Plain link to protocol-relative URL
6546 !! wikitext
6547 [[//www.example.com]]
6548 !! html/php
6549 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6550 </p>
6551 !! html/parsoid
6552 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6553 !! end
6554
6555 !! test
6556 Plain link to protocol-relative URL with link text
6557 !! wikitext
6558 [[//www.example.com Link text]]
6559 !! html
6560 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6561 </p>
6562 !! end
6563
6564 !! test
6565 Plain link to page with question mark in title
6566 !! wikitext
6567 [[A?b]]
6568
6569 [[A?b|Baz]]
6570 !! html
6571 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6572 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6573 </p>
6574 !! end
6575
6576
6577 # I'm fairly sure the expected result here is wrong.
6578 # We want these to be URL links, not pseudo-pages with URLs for titles....
6579 # However the current output is also pretty screwy.
6580 #
6581 # ----
6582 # I'm changing it to match the current output--it arguably makes more
6583 # sense in the light of the test above. Old expected result was:
6584 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6585 #</p>
6586 # But I think this test is bordering on "garbage in, garbage out" anyway.
6587 # -- wtm
6588 !! test
6589 Piped link to URL
6590 !! wikitext
6591 Piped link to URL: [[http://www.example.com|an example URL]]
6592 !! html/php
6593 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6594 </p>
6595 !! html/parsoid
6596 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6597 !! end
6598
6599 !! test
6600 BUG 2: [[page|http://url/]] should link to page, not http://url/
6601 !! wikitext
6602 [[Main Page|http://url/]]
6603 !! html/php
6604 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6605 </p>
6606 !! html/parsoid
6607 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6608 !! end
6609
6610 # Parsoid does not mark self-links, by design.
6611 !! test
6612 BUG 337: Escaped self-links should be bold
6613 !! options
6614 title=[[Bug462]]
6615 !! wikitext
6616 [[Bu&#103;462]] [[Bug462]]
6617 !! html/php
6618 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6619 </p>
6620 !! html/php+tidy
6621 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6622 !! html/parsoid
6623 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6624 !! end
6625
6626 !! test
6627 Self-link to section should not be bold
6628 !! options
6629 title=[[Main Page]]
6630 !! wikitext
6631 [[Main Page#section]]
6632 !! html
6633 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6634 </p>
6635 !! end
6636
6637 !! article
6638 00
6639 !! text
6640 This is 00.
6641 !! endarticle
6642
6643 !!test
6644 Self-link to numeric title
6645 !!options
6646 title=[[0]]
6647 !! wikitext
6648 [[0]]
6649 !! html
6650 <p><strong class="selflink">0</strong>
6651 </p>
6652 !!end
6653
6654 !!test
6655 Link to numeric-equivalent title
6656 !!options
6657 title=[[0]]
6658 !! wikitext
6659 [[00]]
6660 !! html
6661 <p><a href="/wiki/00" title="00">00</a>
6662 </p>
6663 !!end
6664
6665 !! test
6666 <nowiki> inside a link
6667 !! wikitext
6668 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6669 !! html
6670 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6671 </p>
6672 !! end
6673
6674 !! test
6675 Non-breaking spaces in title
6676 !! wikitext
6677 [[&nbsp; Main &nbsp; Page &nbsp;]]
6678 !! html
6679 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6680 </p>
6681 !!end
6682
6683 !! test
6684 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6685 !! options
6686 language=ca
6687 !! wikitext
6688 '''[[Main Page]]'''
6689 !! html
6690 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6691 </p>
6692 !! end
6693
6694 !! test
6695 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6696 !! options
6697 language=ca
6698 !! wikitext
6699 ''[[Main Page]]''
6700 !! html
6701 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6702 </p>
6703 !! end
6704
6705 !! test
6706 Internal link with en linktrail: no apostrophes (bug 27473)
6707 !! options
6708 language=en
6709 !! wikitext
6710 [[Something]]'nice
6711 !! html
6712 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6713 </p>
6714 !! end
6715
6716 !! test
6717 Internal link with ca linktrail with apostrophes (bug 27473)
6718 !! options
6719 language=ca
6720 !! wikitext
6721 [[Something]]'nice
6722 !! html
6723 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6724 </p>
6725 !! end
6726
6727 !! test
6728 Internal link with kaa linktrail with apostrophes (bug 27473)
6729 !! options
6730 language=kaa
6731 !! wikitext
6732 [[Something]]'nice
6733 !! html
6734 <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>
6735 </p>
6736 !! end
6737
6738 !! test
6739 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6740 !! wikitext
6741 [[User:Foo/Test/63636:Bar|Test]]
6742 !! html/php
6743 <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>
6744 </p>
6745 !! html/parsoid
6746 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
6747 !! end
6748
6749 !! test
6750 Purely hash wikilink
6751 !! options
6752 title=[[User:test/123]]
6753 !! wikitext
6754 [[#a|b]]
6755 !! html/php
6756 <p><a href="#a">b</a>
6757 </p>
6758 !! html/parsoid
6759 <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>
6760 !! end
6761
6762 !! test
6763 1. Interaction of linktrail and template encapsulation
6764 !! options
6765 parsoid
6766 !! wikitext
6767 {{echo|[[Foo]]}}l
6768 !! html
6769 <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>
6770 !! end
6771
6772 !! test
6773 2. Interaction of linktrail and template encapsulation
6774 !! options
6775 parsoid
6776 !! wikitext
6777 {{echo|Some [[Fool]]}}s
6778 !! html
6779 <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>
6780 !! end
6781
6782 !! test
6783 3. Interaction of linktrail and template encapsulation
6784 !! options
6785 parsoid
6786 !! wikitext
6787 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6788 !! html
6789 <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>
6790 !! end
6791
6792 !! article
6793 Söfnuður
6794 !! text
6795 Test.
6796 !! endarticle
6797
6798 !! test
6799 Internal link with is link prefix
6800 !! options
6801 language=is
6802 !! wikitext
6803 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6804 !! html
6805 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6806 </p>
6807 !! end
6808
6809 !! article
6810 Mótmælendatrú
6811 !! text
6812 Test.
6813 !! endarticle
6814
6815 !! test
6816 Internal link with is link trail and link prefix
6817 !! options
6818 language=is
6819 !! wikitext
6820 [[mótmælendatrú|xxx]]ar
6821 [[mótmælendatrú]]ar
6822 mótmælenda[[söfnuður]]
6823 mótmælenda[[söfnuður|söfnuðir]]
6824 mótmælenda[[söfnuður|söfnuðir]]xxx
6825 !! html
6826 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6827 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6828 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6829 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6830 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6831 </p>
6832 !! end
6833
6834 !! test
6835 Parsoid link trail escaping
6836 !! options
6837 parsoid=html2wt,html2html
6838 !! wikitext
6839 [[apple]]<nowiki/>s
6840 !! html
6841 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
6842 !! end
6843
6844 !! test
6845 Parsoid link prefix escaping
6846 !! options
6847 language=is
6848 parsoid=html2wt,html2html
6849 !! wikitext
6850 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6851 !! html
6852 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
6853 !! end
6854
6855 !! test
6856 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6857 !! wikitext
6858 [[Foo| bar]]
6859
6860 [[Foo| ''bar'']]
6861
6862 [http://wp.org foo]
6863
6864 [http://wp.org ''foo'']
6865 !! html
6866 <p><a href="/wiki/Foo" title="Foo"> bar</a>
6867 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
6868 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6869 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6870 </p>
6871 !! end
6872
6873 !! test
6874 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6875 !! options
6876 parsoid
6877 !! wikitext
6878 [[Foo|{{echo|a}} b {{echo|c}}]]
6879 !! html
6880 <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>
6881 !! end
6882
6883 !! test
6884 Link with angle bracket after anchor
6885 !! wikitext
6886 [[Foo#<bar>]]
6887 !! html/php
6888 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
6889 </p>
6890 !! html/parsoid
6891 <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>
6892 !! end
6893
6894 ###
6895 ### Interwiki links (see maintenance/interwiki.sql)
6896 ###
6897
6898 !! test
6899 Inline interwiki link
6900 !! options
6901 parsoid=wt2html,wt2wt,html2html
6902 !! wikitext
6903 [[MeatBall:SoftSecurity]]
6904 !! html/php
6905 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6906 </p>
6907 !! html/parsoid
6908 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
6909 !! end
6910
6911 !! test
6912 Inline interwiki link with empty title (bug 2372)
6913 !! options
6914 parsoid=wt2html,wt2wt,html2html
6915 !! wikitext
6916 [[MeatBall:]]
6917 !! html/php
6918 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6919 </p>
6920 !! html/parsoid
6921 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
6922 !! end
6923
6924 !! test
6925 Interwiki link encoding conversion (bug 1636)
6926 !! wikitext
6927 *[[Wikipedia:ro:Olteni&#0355;a]]
6928 *[[Wikipedia:ro:Olteni&#355;a]]
6929 !! html
6930 <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>
6931 <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>
6932
6933 !! html+tidy
6934 <ul>
6935 <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>
6936 <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>
6937 </ul>
6938 !! end
6939
6940 !! test
6941 Interwiki link with fragment (bug 2130)
6942 !! wikitext
6943 [[MeatBall:SoftSecurity#foo]]
6944 !! html
6945 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6946 </p>
6947 !! end
6948
6949 # Ideally the wikipedia: prefix here should be proto-relative too
6950 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
6951 # define the 'en' prefix, and originally the test used 'wikipedia',
6952 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
6953 # article.
6954 !! test
6955 Different interwiki prefixes mapping to the same URL
6956 !! wikitext
6957 [[:en:Foo]]
6958
6959 [[:en:Foo|Foo]]
6960
6961 [[wikipedia:Foo]]
6962
6963 [[:wikipedia:Foo|Foo]]
6964
6965 [[wikipedia:en:Foo]]
6966
6967 [[:wikipedia:en:Foo]]
6968
6969 [[ wikiPEdia :Foo]]
6970 !! html/parsoid
6971 <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>
6972
6973 <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>
6974
6975 <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>
6976
6977 <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>
6978
6979 <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>
6980
6981 <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>
6982
6983 <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>
6984 !! end
6985
6986 !! test
6987 Interwiki links that cannot be represented in wiki syntax
6988 !! wikitext
6989 [[meatball:ok]]
6990 [[meatball:ok#foo|ok with fragment]]
6991 [[meatball:ok_as_well?|ok ending with ? mark]]
6992 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6993 [http://de.wikipedia.org/wiki/#foo is just fragment]
6994
6995 !! html/php
6996 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
6997 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
6998 <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>
6999 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7000 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7001 </p>
7002 !! html/parsoid
7003 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7004 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7005 <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>
7006 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7007 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7008 !! end
7009
7010 !! test
7011 Interwiki links: trail
7012 !! wikitext
7013 [[wikipedia:Foo|Ba]]r
7014 !! html/php
7015 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7016 </p>
7017 !! html/parsoid
7018 <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>
7019 !! end
7020
7021 !! test
7022 Local interwiki link
7023 !! options
7024 parsoid=wt2html,wt2wt,html2html
7025 !! wikitext
7026 [[local:Template:Foo]]
7027 !! html/php
7028 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7029 </p>
7030 !! html/parsoid
7031 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7032 !! end
7033
7034 # Parsoid does not mark self-links, by design.
7035 !! test
7036 Local interwiki link: self-link to current page
7037 !! options
7038 title=[[Main Page]]
7039 parsoid=wt2html,wt2wt,html2html
7040 !! wikitext
7041 [[local:Main Page]]
7042 !! html/php
7043 <p><strong class="selflink">local:Main Page</strong>
7044 </p>
7045 !! html/parsoid
7046 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7047 !! end
7048
7049 !! test
7050 Local interwiki link: prefix only (bug 64167)
7051 !! options
7052 parsoid=wt2html,wt2wt,html2html
7053 !! wikitext
7054 [[local:]]
7055 !! html/php
7056 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7057 </p>
7058 !! html/parsoid
7059 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7060 !! end
7061
7062 !! test
7063 Local interwiki link: with additional interwiki prefix (bug 61357)
7064 !! options
7065 parsoid=wt2html,wt2wt,html2html
7066 !! wikitext
7067 [[local:meatball:Hello]]
7068 !! html/php
7069 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7070 </p>
7071 !! html/parsoid
7072 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7073 !! end
7074
7075 !! test
7076 Multiple local interwiki link prefixes
7077 !! wikitext
7078 [[local:local:local:local:mi:local:Foo]]
7079 !! options
7080 parsoid=wt2html,wt2wt,html2html
7081 !! html/php
7082 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7083 </p>
7084 !! html/parsoid
7085 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7086 !! end
7087
7088 ###
7089 ### Interlanguage links
7090 ### Language links (so that searching for '### language' matches..)
7091 ###
7092
7093 !! test
7094 Interlanguage link
7095 !! options
7096 parsoid=wt2html,wt2wt,html2html
7097 !! wikitext
7098 Blah blah blah
7099 [[zh:Chinese]]
7100 !! html/php
7101 <p>Blah blah blah
7102 </p>
7103 !! html/parsoid
7104 <p>Blah blah blah</p>
7105 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7106 !! end
7107
7108 !! test
7109 Interlanguage link with spacing
7110 !! options
7111 parsoid=wt2html,wt2wt,html2html
7112 !! wikitext
7113 Blah blah blah
7114 [[ zh : Chinese ]]
7115 !! html/php
7116 <p>Blah blah blah
7117 </p>
7118 !! html/parsoid
7119 <p>Blah blah blah</p>
7120 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7121 !! end
7122
7123 !! test
7124 Double interlanguage link
7125 !! options
7126 parsoid=wt2html,wt2wt,html2html
7127 !! wikitext
7128 Blah blah blah
7129 [[es:Spanish]]
7130 [[zh:Chinese]]
7131 !! html/php
7132 <p>Blah blah blah
7133 </p>
7134 !! html/parsoid
7135 <p>Blah blah blah</p>
7136 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7137 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7138 !! end
7139
7140 !! test
7141 Interlanguage link variations
7142 !! options
7143 parsoid=wt2html,wt2wt,html2html
7144 !! wikitext
7145 Blah blah blah
7146 [[ es :Spanish]]
7147 [[ ZH :Chinese]]
7148 [[es:Foo_bar]]
7149 [[es:Foo bar]]
7150 !! html/php
7151 <p>Blah blah blah
7152 </p>
7153 !! html/parsoid
7154 <p>Blah blah blah</p>
7155 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7156 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7157 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7158 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7159 !! end
7160
7161 !! test
7162 Interlanguage link, with prefix links
7163 !! options
7164 language=ln
7165 !! wikitext
7166 Blah blah blah
7167 [[zh:Chinese]]
7168 !! html/php
7169 <p>Blah blah blah
7170 </p>
7171 !! html/parsoid
7172 <p>Blah blah blah</p>
7173 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7174 !! end
7175
7176 !! test
7177 Double interlanguage link, with prefix links (bug 8897)
7178 !! options
7179 language=ln
7180 !! wikitext
7181 Blah blah blah
7182 [[es:Spanish]]
7183 [[zh:Chinese]]
7184 !! html/php
7185 <p>Blah blah blah
7186 </p>
7187 !! html/parsoid
7188 <p>Blah blah blah</p>
7189 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7190 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7191 !! end
7192
7193 !! test
7194 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7195 !! wikitext
7196 Blah blah blah
7197 [[mul:Article]]
7198 !! html/php
7199 <p>Blah blah blah
7200 </p>
7201 !! html/parsoid
7202 <p>Blah blah blah</p>
7203 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7204 !! end
7205
7206 !! test
7207 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7208 !! options
7209 language=ln
7210 !! wikitext
7211 [[WW&nbsp;II]]
7212 !! html
7213 <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>
7214 </p>
7215 !! end
7216
7217 !! test
7218 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7219 !! options
7220 parsoid=html2wt
7221 !! wikitext
7222 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7223
7224 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7225 !! html
7226 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7227 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7228 !! end
7229
7230 !! test
7231 Parsoid: handle constructor well
7232 !! wikitext
7233 [[constructor]]
7234
7235 [[constructor:foo]]
7236 !! html/php
7237 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7238 </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>
7239 </p>
7240 !! html/parsoid
7241 <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>
7242
7243 <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>
7244 !! end
7245
7246 !! article
7247 ko:
7248 !! text
7249 Test.
7250 !! endarticle
7251
7252 # Note that `ko` isn't a known interlanguage prefix
7253 !! test
7254 Parsoid: recognize interlanguage links without a target page
7255 !! options
7256 ill
7257 !! wikitext
7258 [[es:]]
7259
7260 [[ko:]]
7261 !! html/php
7262 es:
7263 !! html/parsoid
7264 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7265
7266 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7267 !! end
7268
7269 # Note that `ko` isn't a known interwiki prefix
7270 !! test
7271 Parsoid: recognize interwiki links without a target page
7272 !! options
7273 parsoid=wt2html,wt2wt,html2html
7274 !! wikitext
7275 [[:es:]]
7276
7277 [[:ko:]]
7278 !! html/php
7279 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7280 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7281 </p>
7282 !! html/parsoid
7283 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7284 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7285 !! end
7286
7287 !! test
7288 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7289 !! wikitext
7290 [[mi:Foo]]
7291 !! html/php
7292 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7293 </p>
7294 !! html/parsoid
7295 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7296 !! end
7297
7298 !! test
7299 Interlanguage link with preceding local interwiki link (bug 68085)
7300 !! options
7301 parsoid=wt2html,wt2wt,html2html
7302 !! wikitext
7303 Blah blah blah
7304 [[local:es:Spanish]]
7305 !! html/php
7306 <p>Blah blah blah
7307 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7308 </p>
7309 !! html/parsoid
7310 <p>Blah blah blah
7311 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7312 !! end
7313
7314 !! test
7315 Looks like an interlanguage link, but is actually a local interwiki
7316 !! options
7317 parsoid=wt2html,wt2wt,html2html
7318 !! wikitext
7319 Blah blah blah
7320 [[mi:Template:Foo]]
7321 !! html/php
7322 <p>Blah blah blah
7323 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7324 </p>
7325 !! html/parsoid
7326 <p>Blah blah blah
7327 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7328 !! end
7329
7330 ###
7331 ### Redirects, Parsoid-only
7332 ###
7333 !! test
7334 1. Simple redirect to page
7335 !! options
7336 parsoid
7337 !! wikitext
7338 #REDIRECT [[Main Page]]
7339 !! html
7340 <link rel="mw:PageProp/redirect" href="./Main_Page">
7341 !! end
7342
7343 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
7344 !! test
7345 2. Other redirect variants
7346 !! options
7347 parsoid=wt2html,wt2wt
7348 !! wikitext
7349 #REDIRECT [[Main_Page]]
7350 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
7351 !! html/parsoid
7352 <link rel="mw:PageProp/redirect" href="./Main_Page"><link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
7353 !! end
7354
7355 !! test
7356 Empty redirect
7357 !! options
7358 parsoid=wt2html,wt2wt
7359 !! wikitext
7360 #REDIRECT [[]]
7361 !! html
7362 <ol>
7363 <li>REDIRECT [[]]</li></ol>
7364 !! end
7365
7366 !! test
7367 Optional colon in #REDIRECT
7368 !! options
7369 # the colon is archaic syntax. we support it for wt2html, but we
7370 # don't care that it roundtrips back to the modern syntax.
7371 parsoid=wt2html,html2html
7372 !! wikitext
7373 #REDIRECT:[[Main Page]]
7374 !! html
7375 <link rel="mw:PageProp/redirect" href="./Main_Page">
7376 !! end
7377
7378 !! test
7379 Whitespace in #REDIRECT with optional colon
7380 !! options
7381 # the colon and gratuitous whitespace is archaic syntax. we support
7382 # it for wt2html, but we don't care that it roundtrips back to the
7383 # modern syntax (without extra whitespace)
7384 parsoid=wt2html,html2html
7385 !! wikitext
7386
7387 #REDIRECT
7388 :
7389 [[Main Page]]
7390 !! html
7391 <link rel="mw:PageProp/redirect" href="./Main_Page">
7392 !! end
7393
7394 !! test
7395 Piped link in #REDIRECT
7396 !! options
7397 # content after piped link is ignored. we support this syntax,
7398 # but don't care that the piped link is lost when we roundtrip this.
7399 parsoid=wt2html
7400 !! wikitext
7401 #REDIRECT [[Main Page|bar]]
7402 !! html
7403 <link rel="mw:PageProp/redirect" href="./Main_Page">
7404 !! end
7405
7406 !! test
7407 Redirect to category
7408 !! options
7409 parsoid=wt2html
7410 !! wikitext
7411 #REDIRECT [[Category:Foo]]
7412 !! html
7413 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7414 !! end
7415
7416 !! test
7417 Redirect to category with URL encoding
7418 !! options
7419 parsoid=wt2html
7420 !! wikitext
7421 #REDIRECT [[Category%3AFoo]]
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 page
7428 !! options
7429 parsoid=wt2html,html2html
7430 !! wikitext
7431 #REDIRECT [[:Category:Foo]]
7432 !! html
7433 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7434 !! end
7435
7436 !! test
7437 Redirect to image page (1)
7438 !! options
7439 parsoid
7440 !! wikitext
7441 #REDIRECT [[File:Wiki.png]]
7442 !! html
7443 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7444 !! end
7445
7446 !! test
7447 Redirect to image page (2)
7448 !! options
7449 parsoid
7450 !! wikitext
7451 #REDIRECT [[Image:Wiki.png]]
7452 !! html
7453 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7454 !! end
7455
7456 !! test
7457 Redirect to language
7458 !! options
7459 parsoid
7460 !! wikitext
7461 #REDIRECT [[en:File:Wiki.png]]
7462 !! html
7463 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7464 !! end
7465
7466 !! test
7467 Redirect to interwiki
7468 !! options
7469 parsoid
7470 !! wikitext
7471 #REDIRECT [[meatball:File:Wiki.png]]
7472 !! html
7473 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7474 !! end
7475
7476 !! test
7477 Non-English #REDIRECT
7478 !! options
7479 parsoid
7480 language=is
7481 !! wikitext
7482 #TILVÍSUN [[Main Page]]
7483 !! html
7484 <link rel="mw:PageProp/redirect" href="./Main_Page">
7485 !! end
7486
7487 !! test
7488 New redirect
7489 !! options
7490 parsoid=html2wt
7491 !! wikitext
7492 Foo
7493 #REDIRECT [[Foo]]
7494 !! html
7495 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7496 !! end
7497
7498 ##
7499 ## XHTML tidiness
7500 ###
7501
7502 !! test
7503 <br> to <br />
7504 !! wikitext
7505 1<br>2<br />3
7506 !! html
7507 <p>1<br />2<br />3
7508 </p>
7509 !! end
7510
7511 !! test
7512 Broken br tag sanitization
7513 !! wikitext
7514 </br>
7515 !! html/php
7516 <p>&lt;/br&gt;
7517 </p>
7518 !! end
7519
7520 # TODO: Fix html2html mode (bug 51055)!
7521 # This </br> handling was added as part of bug 50831; but it
7522 # differs from how PHP+tidy handles this. We should investigate
7523 # this.
7524 !! test
7525 Parsoid: Broken br tag recognition
7526 !! options
7527 parsoid=wt2html
7528 !! wikitext
7529 </br>
7530
7531 <br/ >
7532 !! html/php+tidy
7533 <p>&lt;/br&gt;</p>
7534 <p><br /></p>
7535 !! html/parsoid
7536 <p><br></p>
7537 <p><br/></p>
7538 !! end
7539
7540 !! test
7541 Incorrecly removing closing slashes from correctly formed XHTML
7542 !! wikitext
7543 <br style="clear:both;" />
7544 !! html
7545 <p><br style="clear:both;" />
7546 </p>
7547 !! end
7548
7549 !! test
7550 Failing to transform badly formed HTML into correct XHTML
7551 !! wikitext
7552 <br style="clear: left;">
7553 <br style="clear: right;">
7554 <br style="clear: both;">
7555 !! html
7556 <p><br style="clear: left;" />
7557 <br style="clear: right;" />
7558 <br style="clear: both;" />
7559 </p>
7560 !!end
7561
7562 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
7563 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
7564 !! test
7565 Handling html with a div self-closing tag
7566 !! wikitext
7567 <div title />
7568 <div title/>
7569 <div title/ >
7570 <div title=bar />
7571 <div title=bar/>
7572 <div title=bar/ >
7573 !! html/php
7574 <p>&lt;div title /&gt;
7575 &lt;div title/&gt;
7576 </p>
7577 <div>
7578 <p>&lt;div title=bar /&gt;
7579 &lt;div title=bar/&gt;
7580 </p>
7581 <div title="bar/"></div>
7582 </div>
7583
7584 !! html/parsoid
7585 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7586 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7587 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
7588 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7589 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7590 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
7591 !! end
7592
7593 !! test
7594 Handling html with a br self-closing tag
7595 !! wikitext
7596 <br title />
7597 <br title/>
7598 <br title/ >
7599 <br title=bar />
7600 <br title=bar/>
7601 <br title=bar/ >
7602 !! html/php
7603 <p><br title="title" />
7604 <br title="title" />
7605 <br />
7606 <br title="bar" />
7607 <br title="bar" />
7608 <br title="bar/" />
7609 </p>
7610 !! html/parsoid
7611 <p><br title="" />
7612 <br title="" />
7613 <br title="" />
7614 <br title="bar" />
7615 <br title="bar" />
7616 <br title="bar/" />
7617 </p>
7618 !! end
7619
7620 !! test
7621 Horizontal ruler (should it add that extra space?)
7622 !! wikitext
7623 <hr>
7624 <hr >
7625 foo <hr
7626 > bar
7627 !! html+tidy
7628 <hr />
7629 <hr />
7630 <p>foo</p>
7631 <hr />
7632 <p>bar</p>
7633 !! end
7634
7635 !! test
7636 Horizontal ruler -- 4+ dashes render hr
7637 !! wikitext
7638 ----
7639 !! html
7640 <hr />
7641
7642 !! end
7643
7644 !! test
7645 Horizontal ruler -- eats additional dashes on the same line
7646 !! wikitext
7647 ---------
7648 !! html
7649 <hr />
7650
7651 !! end
7652
7653 !! test
7654 Horizontal ruler -- does not collapse dashes on consecutive lines
7655 !! wikitext
7656 ----
7657 ----
7658 !! html
7659 <hr />
7660 <hr />
7661
7662 !! end
7663
7664 !! test
7665 Horizontal ruler -- <4 dashes render as plain text
7666 !! wikitext
7667 ---
7668 !! html
7669 <p>---
7670 </p>
7671 !! end
7672
7673 !! test
7674 Horizontal ruler -- Supports content following dashes on same line
7675 !! wikitext
7676 ---- Foo
7677 !! html
7678 <hr /> Foo
7679
7680 !! html+tidy
7681 <hr />
7682 <p>Foo</p>
7683 !! end
7684
7685 ###
7686 ### Block-level elements
7687 ###
7688 !! test
7689 Common list
7690 !! wikitext
7691 *Common list
7692 * item 2
7693 *item 3
7694 !! html
7695 <ul><li>Common list</li>
7696 <li> item 2</li>
7697 <li>item 3</li></ul>
7698
7699 !! end
7700
7701 !! test
7702 Numbered list
7703 !! wikitext
7704 #Numbered list
7705 #item 2
7706 # item 3
7707 !! html
7708 <ol><li>Numbered list</li>
7709 <li>item 2</li>
7710 <li> item 3</li></ol>
7711
7712 !! end
7713
7714 !! test
7715 Mixed list
7716 !! wikitext
7717 *Mixed list
7718 *# with numbers
7719 ** and bullets
7720 *# and numbers
7721 *bullets again
7722 **bullet level 2
7723 ***bullet level 3
7724 ***#Number on level 4
7725 **bullet level 2
7726 **#Number on level 3
7727 **#Number on level 3
7728 *#number level 2
7729 *Level 1
7730 *** Level 3
7731 #** Level 3, but ordered
7732 !! html
7733 <ul><li>Mixed list
7734 <ol><li> with numbers</li></ol>
7735 <ul><li> and bullets</li></ul>
7736 <ol><li> and numbers</li></ol></li>
7737 <li>bullets again
7738 <ul><li>bullet level 2
7739 <ul><li>bullet level 3
7740 <ol><li>Number on level 4</li></ol></li></ul></li>
7741 <li>bullet level 2
7742 <ol><li>Number on level 3</li>
7743 <li>Number on level 3</li></ol></li></ul>
7744 <ol><li>number level 2</li></ol></li>
7745 <li>Level 1
7746 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7747 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7748
7749 !! end
7750
7751 !! test
7752 Nested lists 1
7753 !! wikitext
7754 *foo
7755 **bar
7756 !! html
7757 <ul><li>foo
7758 <ul><li>bar</li></ul></li></ul>
7759
7760 !! end
7761
7762 !! test
7763 Nested lists 2
7764 !! wikitext
7765 **foo
7766 *bar
7767 !! html
7768 <ul><li><ul><li>foo</li></ul></li>
7769 <li>bar</li></ul>
7770
7771 !! end
7772
7773 !! test
7774 Nested lists 3 (first element empty)
7775 !! wikitext
7776 *
7777 **bar
7778 !! html
7779 <ul><li>
7780 <ul><li>bar</li></ul></li></ul>
7781
7782 !! end
7783
7784 !! test
7785 Nested lists 4 (first element empty)
7786 !! wikitext
7787 **
7788 *bar
7789 !! html
7790 <ul><li><ul><li></li></ul></li>
7791 <li>bar</li></ul>
7792
7793 !! end
7794
7795 !! test
7796 Nested lists 5 (both elements empty)
7797 !! wikitext
7798 **
7799 *
7800 !! html
7801 <ul><li><ul><li></li></ul></li>
7802 <li></li></ul>
7803
7804 !! end
7805
7806 !! test
7807 Nested lists 6 (both elements empty)
7808 !! wikitext
7809 *
7810 **
7811 !! html
7812 <ul><li>
7813 <ul><li></li></ul></li></ul>
7814
7815 !! end
7816
7817 !! test
7818 Nested lists 7 (skip initial nesting levels)
7819 !! wikitext
7820 *** foo
7821 !! html
7822 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7823
7824 !! end
7825
7826 !! test
7827 Nested lists 8 (multiple nesting transitions)
7828 !! wikitext
7829 * foo
7830 *** bar
7831 ** baz
7832 * boo
7833 !! html
7834 <ul><li> foo
7835 <ul><li><ul><li> bar</li></ul></li>
7836 <li> baz</li></ul></li>
7837 <li> boo</li></ul>
7838
7839 !! end
7840
7841 !! test
7842 1. Lists with start-of-line-transparent tokens before bullets: Comments
7843 !! wikitext
7844 *foo
7845 *<!--cmt-->bar
7846 <!--cmt-->*baz
7847 !! html
7848 <ul><li>foo</li>
7849 <li>bar</li>
7850 <li>baz</li></ul>
7851
7852 !! end
7853
7854 !! test
7855 2. Lists with start-of-line-transparent tokens before bullets: Template close
7856 !! wikitext
7857 *foo {{echo|bar
7858 }}*baz
7859 !! html
7860 <ul><li>foo bar</li>
7861 <li>baz</li></ul>
7862
7863 !! end
7864
7865 !! test
7866 List items are not parsed correctly following a <pre> block (bug 785)
7867 !! wikitext
7868 * <pre>foo</pre>
7869 * <pre>bar</pre>
7870 * zar
7871 !! html
7872 <ul><li> <pre>foo</pre></li>
7873 <li> <pre>bar</pre></li>
7874 <li> zar</li></ul>
7875
7876 !! end
7877
7878 !! test
7879 List items from template
7880 !! wikitext
7881
7882 {{inner list}}
7883 * item 2
7884
7885 * item 0
7886 {{inner list}}
7887 * item 2
7888
7889 * item 0
7890 * notSOL{{inner list}}
7891 * item 2
7892 !! html
7893 <ul><li> item 1</li>
7894 <li> item 2</li></ul>
7895 <ul><li> item 0</li>
7896 <li> item 1</li>
7897 <li> item 2</li></ul>
7898 <ul><li> item 0</li>
7899 <li> notSOL</li>
7900 <li> item 1</li>
7901 <li> item 2</li></ul>
7902
7903 !! end
7904
7905 !! test
7906 List interrupted by empty line or heading
7907 !! wikitext
7908 * foo
7909
7910 ** bar
7911 == A heading ==
7912 * Another list item
7913 !! html
7914 <ul><li> foo</li></ul>
7915 <ul><li><ul><li> bar</li></ul></li></ul>
7916 <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>
7917 <ul><li> Another list item</li></ul>
7918
7919 !!end
7920
7921 !!test
7922 Multiple list tags generated by templates
7923 !! wikitext
7924 {{echo|<li>}}a
7925 {{echo|<li>}}b
7926 {{echo|<li>}}c
7927 !! html
7928 <li>a
7929 <li>b
7930 <li>c</li>
7931 </li>
7932 </li>
7933
7934 !! html+tidy
7935 <ul>
7936 <li>a</li>
7937 <li>b</li>
7938 <li>c</li>
7939 </ul>
7940 !!end
7941
7942 !!test
7943 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7944 !! wikitext
7945 *a
7946 <!--This line will NOT split the list-->
7947 *b
7948 <!--This line will NOT split the list either-->
7949 *c
7950 <!--foo--> <!----> <!--This line NOT split the list either-->
7951 *d
7952 !! html
7953 <ul><li>a</li>
7954 <li>b</li>
7955 <li>c</li>
7956 <li>d</li></ul>
7957
7958 !!end
7959
7960 !!test
7961 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7962 !! wikitext
7963 *a
7964 <!--This line will NOT split the list-->
7965 *b
7966 <!--This line will NOT split the list either-->
7967 *c
7968 <!--foo--> <!----> <!--This line NOT split the list
7969 either-->
7970 *d
7971 !! html
7972 <ul><li>a</li>
7973 <li>b</li>
7974 <li>c</li>
7975 <li>d</li></ul>
7976
7977 !!end
7978
7979 !!test
7980 Test the li-hack
7981 (The PHP parser relies on Tidy for the hack)
7982 !!options
7983 parsoid=wt2html,wt2wt
7984 !! wikitext
7985 * foo
7986 * <li>li-hack
7987 * {{echo|<li>templated li-hack}}
7988 * <!--foo--> <li> unsupported li-hack with preceding comments
7989
7990 <ul>
7991 <li><li>not a li-hack
7992 </li>
7993 </ul>
7994 !! html+tidy
7995 <ul>
7996 <li>foo</li>
7997 <li>li-hack</li>
7998 <li>templated li-hack</li>
7999 <li>unsupported li-hack with preceding comments</li>
8000 </ul>
8001 <ul>
8002 <li>not a li-hack</li>
8003 </ul>
8004 !!end
8005
8006 !! test
8007 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8008 !! options
8009 parsoid
8010 !! wikitext
8011 # foo
8012 ## bar
8013 * foo
8014 ** bar
8015 : foo
8016 :: bar
8017 !! html
8018 <ol>
8019 <li> foo<ol>
8020 <li> bar</li>
8021 </ol></li>
8022 </ol><ul>
8023 <li> foo<ul>
8024 <li> bar</li>
8025 </ul></li>
8026 </ul><dl>
8027 <dd> foo<dl>
8028 <dd> bar</dd>
8029 </dl></dd>
8030 </dl>
8031 !! end
8032
8033 !! test
8034 Parsoid: Test of whitespace serialization with Templated bullets
8035 !! options
8036 parsoid
8037 !! wikitext
8038 * {{bullet}}
8039 !! html
8040 <ul>
8041 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8042 </ul>
8043 !! end
8044
8045 # ------------------------------------------------------------------------
8046 # The next set of tests are about Parsoid's ability to handle badly nested
8047 # tags (parse, minimize scope of fixup, and roundtrip back)
8048 # ------------------------------------------------------------------------
8049
8050 !! test
8051 Unbalanced closing block tags break a list
8052 (php parser relies on Tidy to fix up)
8053 !! wikitext
8054 <div>
8055 *a</div><div>
8056 *b</div>
8057 !! html+tidy
8058 <div>
8059 <ul>
8060 <li>a</li>
8061 </ul>
8062 </div>
8063 <div>
8064 <ul>
8065 <li>b</li>
8066 </ul>
8067 </div>
8068 !! end
8069
8070 # Parsoid fails this test, but it might be tricky to support properly.
8071 # See bug 68395.
8072 !! test
8073 Unbalanced closing non-block tags don't break a list
8074 (php parser relies on Tidy to fix up)
8075 !! wikitext
8076 <span>
8077 *a</span><span>
8078 *b</span>
8079 !! html/php+tidy
8080 <ul>
8081 <li><span>a</span></li>
8082 <li><span>b</span></li>
8083 </ul>
8084 !! html/parsoid
8085 <span>
8086 <ul>
8087 <li>a<span></span>
8088 </li>
8089 <li>b
8090 </li>
8091 </ul>
8092 </span>
8093 !! end
8094
8095 !! test
8096 Unclosed formatting tags that straddle lists are closed and reopened
8097 (php parser relies on Tidy to fix up)
8098 !! options
8099 parsoid=wt2html,wt2wt,html2html
8100 !! wikitext
8101 # <s> a
8102 # b </s>
8103 !! html/php+tidy
8104 <ol>
8105 <li><s>a</s></li>
8106 <li><s>b</s></li>
8107 </ol>
8108 !! html/parsoid
8109 <ol><li> <s> a</s></li>
8110 <li><s> b </s></li></ol>
8111 !! end
8112
8113 # Parsoid fails this test, but it might be tricky to support properly.
8114 # See bug 68395.
8115 !!test
8116 List embedded in a non-block tag
8117 (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
8118 !! wikitext
8119 <small>
8120 * foo
8121 </small>
8122 !! html/php+tidy
8123 <ul>
8124 <li><small>foo</small></li>
8125 </ul>
8126 !! html/parsoid
8127 <small>
8128 <ul>
8129 <li> foo</li>
8130 </ul>
8131 </small>
8132 !!end
8133
8134 # This is a bug in the PHP parser + tidy combination.
8135 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8136 # and then fostered out of the table by tidy.)
8137 # We believe the Parsoid output to be correct.
8138 !! test
8139 Table with missing opening <tr> tag
8140 !! options
8141 parsoid=wt2html,wt2wt
8142 !! wikitext
8143 <table>
8144 <td>foo</td>
8145 </tr>
8146 </table>
8147 !! html/php+tidy
8148 <p>&lt;/tr&gt;</p>
8149 <table>
8150 <tr>
8151 <td>foo</td>
8152 </tr>
8153 </table>
8154 !! html/parsoid
8155 <table>
8156 <tr>
8157 <td>foo</td>
8158 </tr>
8159 </table>
8160 !! end
8161
8162 ###
8163 ### Magic Words
8164 ###
8165
8166 # Note that the current date is hard-coded as
8167 # 1970-01-01T00:02:03Z (a Thursday)
8168 # when running parser tests. The timezone is also fixed to GMT, so
8169 # local date will be identical to current date.
8170
8171 !! test
8172 Magic Word: {{CURRENTDAY}}
8173 !! wikitext
8174 {{CURRENTDAY}}
8175 !! html
8176 <p>1
8177 </p>
8178 !! end
8179
8180 !! test
8181 Magic Word: {{CURRENTDAY2}}
8182 !! wikitext
8183 {{CURRENTDAY2}}
8184 !! html
8185 <p>01
8186 </p>
8187 !! end
8188
8189 !! test
8190 Magic Word: {{CURRENTDAYNAME}}
8191 !! wikitext
8192 {{CURRENTDAYNAME}}
8193 !! html
8194 <p>Thursday
8195 </p>
8196 !! end
8197
8198 !! test
8199 Magic Word: {{CURRENTDOW}}
8200 !! wikitext
8201 {{CURRENTDOW}}
8202 !! html
8203 <p>4
8204 </p>
8205 !! end
8206
8207 !! test
8208 Magic Word: {{CURRENTMONTH}}
8209 !! wikitext
8210 {{CURRENTMONTH}}
8211 !! html
8212 <p>01
8213 </p>
8214 !! end
8215
8216 !! test
8217 Magic Word: {{CURRENTMONTH1}}
8218 !! wikitext
8219 {{CURRENTMONTH1}}
8220 !! html
8221 <p>1
8222 </p>
8223 !! end
8224
8225 !! test
8226 Magic Word: {{CURRENTMONTHABBREV}}
8227 !! wikitext
8228 {{CURRENTMONTHABBREV}}
8229 !! html
8230 <p>Jan
8231 </p>
8232 !! end
8233
8234 !! test
8235 Magic Word: {{CURRENTMONTHNAME}}
8236 !! wikitext
8237 {{CURRENTMONTHNAME}}
8238 !! html
8239 <p>January
8240 </p>
8241 !! end
8242
8243 !! test
8244 Magic Word: {{CURRENTMONTHNAMEGEN}}
8245 !! wikitext
8246 {{CURRENTMONTHNAMEGEN}}
8247 !! html
8248 <p>January
8249 </p>
8250 !! end
8251
8252 !! test
8253 Magic Word: {{CURRENTTIME}}
8254 !! wikitext
8255 {{CURRENTTIME}}
8256 !! html
8257 <p>00:02
8258 </p>
8259 !! end
8260
8261 !! test
8262 Magic Word: {{CURRENTHOUR}}
8263 !! wikitext
8264 {{CURRENTHOUR}}
8265 !! html
8266 <p>00
8267 </p>
8268 !! end
8269
8270 !! test
8271 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8272 !! wikitext
8273 {{CURRENTWEEK}}
8274 !! html
8275 <p>1
8276 </p>
8277 !! end
8278
8279 !! test
8280 Magic Word: {{CURRENTYEAR}}
8281 !! wikitext
8282 {{CURRENTYEAR}}
8283 !! html
8284 <p>1970
8285 </p>
8286 !! end
8287
8288 !! test
8289 Magic Word: {{CURRENTTIMESTAMP}}
8290 !! wikitext
8291 {{CURRENTTIMESTAMP}}
8292 !! html
8293 <p>19700101000203
8294 </p>
8295 !! end
8296
8297 !! test
8298 Magic Words LOCAL (UTC)
8299 !! wikitext
8300 * {{LOCALMONTH}}
8301 * {{LOCALMONTH1}}
8302 * {{LOCALMONTHNAME}}
8303 * {{LOCALMONTHNAMEGEN}}
8304 * {{LOCALMONTHABBREV}}
8305 * {{LOCALDAY}}
8306 * {{LOCALDAY2}}
8307 * {{LOCALDAYNAME}}
8308 * {{LOCALYEAR}}
8309 * {{LOCALTIME}}
8310 * {{LOCALHOUR}}
8311 * {{LOCALWEEK}}
8312 * {{LOCALDOW}}
8313 * {{LOCALTIMESTAMP}}
8314 !! html
8315 <ul><li> 01</li>
8316 <li> 1</li>
8317 <li> January</li>
8318 <li> January</li>
8319 <li> Jan</li>
8320 <li> 1</li>
8321 <li> 01</li>
8322 <li> Thursday</li>
8323 <li> 1970</li>
8324 <li> 00:02</li>
8325 <li> 00</li>
8326 <li> 1</li>
8327 <li> 4</li>
8328 <li> 19700101000203</li></ul>
8329
8330 !! end
8331
8332 !! test
8333 Magic Word: {{FULLPAGENAME}}
8334 !! options
8335 title=[[User:Ævar Arnfjörð Bjarmason]]
8336 !! wikitext
8337 {{FULLPAGENAME}}
8338 !! html
8339 <p>User:Ævar Arnfjörð Bjarmason
8340 </p>
8341 !! end
8342
8343 !! test
8344 Magic Word: {{FULLPAGENAMEE}}
8345 !! options
8346 title=[[User:Ævar Arnfjörð Bjarmason]]
8347 !! wikitext
8348 {{FULLPAGENAMEE}}
8349 !! html
8350 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8351 </p>
8352 !! end
8353
8354 !! test
8355 Magic Word: {{TALKSPACE}}
8356 !! options
8357 title=[[User:Ævar Arnfjörð Bjarmason]]
8358 !! wikitext
8359 {{TALKSPACE}}
8360 !! html
8361 <p>User talk
8362 </p>
8363 !! end
8364
8365 !! test
8366 Magic Word: {{TALKSPACE}}, same namespace
8367 !! options
8368 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8369 !! wikitext
8370 {{TALKSPACE}}
8371 !! html
8372 <p>User talk
8373 </p>
8374 !! end
8375
8376 !! test
8377 Magic Word: {{TALKSPACE}}, main namespace
8378 !! options
8379 title=[[Parser Test]]
8380 !! wikitext
8381 {{TALKSPACE}}
8382 !! html
8383 <p>Talk
8384 </p>
8385 !! end
8386
8387 !! test
8388 Magic Word: {{TALKSPACEE}}
8389 !! options
8390 title=[[User:Ævar Arnfjörð Bjarmason]]
8391 !! wikitext
8392 {{TALKSPACEE}}
8393 !! html
8394 <p>User_talk
8395 </p>
8396 !! end
8397
8398 !! test
8399 Magic Word: {{SUBJECTSPACE}}
8400 !! options
8401 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8402 !! wikitext
8403 {{SUBJECTSPACE}}
8404 !! html
8405 <p>User
8406 </p>
8407 !! end
8408
8409 !! test
8410 Magic Word: {{SUBJECTSPACE}}, same namespace
8411 !! options
8412 title=[[User:Ævar Arnfjörð Bjarmason]]
8413 !! wikitext
8414 {{SUBJECTSPACE}}
8415 !! html
8416 <p>User
8417 </p>
8418 !! end
8419
8420 !! test
8421 Magic Word: {{SUBJECTSPACE}}, main namespace
8422 !! options
8423 title=[[Parser Test]]
8424 !! wikitext
8425 {{SUBJECTSPACE}}
8426 !! html
8427
8428 !! end
8429
8430 !! test
8431 Magic Word: {{SUBJECTSPACEE}}
8432 !! options
8433 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8434 !! wikitext
8435 {{SUBJECTSPACEE}}
8436 !! html
8437 <p>User
8438 </p>
8439 !! end
8440
8441 !! test
8442 Magic Word: {{NAMESPACE}}
8443 !! options
8444 title=[[User:Ævar Arnfjörð Bjarmason]]
8445 !! wikitext
8446 {{NAMESPACE}}
8447 !! html
8448 <p>User
8449 </p>
8450 !! end
8451
8452 !! test
8453 Magic Word: {{NAMESPACEE}}
8454 !! options
8455 title=[[User:Ævar Arnfjörð Bjarmason]]
8456 !! wikitext
8457 {{NAMESPACEE}}
8458 !! html
8459 <p>User
8460 </p>
8461 !! end
8462
8463 !! test
8464 Magic Word: {{NAMESPACENUMBER}}
8465 !! options
8466 title=[[User:Ævar Arnfjörð Bjarmason]]
8467 !! wikitext
8468 {{NAMESPACENUMBER}}
8469 !! html
8470 <p>2
8471 </p>
8472 !! end
8473
8474 !! test
8475 Magic Word: {{SUBPAGENAME}}
8476 !! options
8477 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8478 !! wikitext
8479 {{SUBPAGENAME}}
8480 !! html
8481 <p>sub ö
8482 </p>
8483 !! end
8484
8485 !! test
8486 Magic Word: {{SUBPAGENAMEE}}
8487 !! options
8488 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8489 !! wikitext
8490 {{SUBPAGENAMEE}}
8491 !! html
8492 <p>sub_%C3%B6
8493 </p>
8494 !! end
8495
8496 !! test
8497 Magic Word: {{ROOTPAGENAME}}
8498 !! options
8499 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8500 !! wikitext
8501 {{ROOTPAGENAME}}
8502 !! html
8503 <p>Ævar Arnfjörð Bjarmason
8504 </p>
8505 !! end
8506
8507 !! test
8508 Magic Word: {{ROOTPAGENAMEE}}
8509 !! options
8510 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8511 !! wikitext
8512 {{ROOTPAGENAMEE}}
8513 !! html
8514 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8515 </p>
8516 !! end
8517
8518 !! test
8519 Magic Word: {{BASEPAGENAME}}
8520 !! options
8521 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8522 !! wikitext
8523 {{BASEPAGENAME}}
8524 !! html
8525 <p>Ævar Arnfjörð Bjarmason
8526 </p>
8527 !! end
8528
8529 !! test
8530 Magic Word: {{BASEPAGENAMEE}}
8531 !! options
8532 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8533 !! wikitext
8534 {{BASEPAGENAMEE}}
8535 !! html
8536 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8537 </p>
8538 !! end
8539
8540 !! test
8541 Magic Word: {{TALKPAGENAME}}
8542 !! options
8543 title=[[User:Ævar Arnfjörð Bjarmason]]
8544 !! wikitext
8545 {{TALKPAGENAME}}
8546 !! html
8547 <p>User talk:Ævar Arnfjörð Bjarmason
8548 </p>
8549 !! end
8550
8551 !! test
8552 Magic Word: {{TALKPAGENAMEE}}
8553 !! options
8554 title=[[User:Ævar Arnfjörð Bjarmason]]
8555 !! wikitext
8556 {{TALKPAGENAMEE}}
8557 !! html
8558 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8559 </p>
8560 !! end
8561
8562 !! test
8563 Magic Word: {{SUBJECTPAGENAME}}
8564 !! options
8565 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8566 !! wikitext
8567 {{SUBJECTPAGENAME}}
8568 !! html
8569 <p>User:Ævar Arnfjörð Bjarmason
8570 </p>
8571 !! end
8572
8573 !! test
8574 Magic Word: {{SUBJECTPAGENAMEE}}
8575 !! options
8576 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8577 !! wikitext
8578 {{SUBJECTPAGENAMEE}}
8579 !! html
8580 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8581 </p>
8582 !! end
8583
8584 !! test
8585 Magic Word: {{NUMBEROFFILES}}
8586 !! wikitext
8587 {{NUMBEROFFILES}}
8588 !! html
8589 <p>5
8590 </p>
8591 !! end
8592
8593 !! test
8594 Magic Word: {{PAGENAME}}
8595 !! options
8596 title=[[User:Ævar Arnfjörð Bjarmason]]
8597 !! wikitext
8598 {{PAGENAME}}
8599 !! html
8600 <p>Ævar Arnfjörð Bjarmason
8601 </p>
8602 !! end
8603
8604 !! test
8605 Magic Word: {{PAGENAME}} with metacharacters
8606 !! options
8607 title=[['foo & bar = baz']]
8608 !! wikitext
8609 ''{{PAGENAME}}''
8610 !! html/php
8611 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8612 </p>
8613 !! html+tidy
8614 <p><i>'foo &amp; bar = baz'</i></p>
8615 !! end
8616
8617 !! test
8618 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8619 !! options
8620 title=[[*RFC 1234 http://example.com/]]
8621 !! wikitext
8622 {{PAGENAME}}
8623 !! html/php
8624 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8625 </p>
8626 !! html+tidy
8627 <p>*RFC 1234 http://example.com/</p>
8628 !! end
8629
8630 !! test
8631 Magic Word: {{PAGENAMEE}}
8632 !! options
8633 title=[[User:Ævar Arnfjörð Bjarmason]]
8634 !! wikitext
8635 {{PAGENAMEE}}
8636 !! html
8637 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8638 </p>
8639 !! end
8640
8641 !! test
8642 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8643 !! options
8644 title=[[*RFC 1234 http://example.com/]]
8645 !! wikitext
8646 {{PAGENAMEE}}
8647 !! html/php
8648 <p>&#42;RFC_1234_http&#58;//example.com/
8649 </p>
8650 !! html+tidy
8651 <p>*RFC_1234_http://example.com/</p>
8652 !! end
8653
8654 !! test
8655 Magic Word: {{REVISIONID}}
8656 !! wikitext
8657 {{REVISIONID}}
8658 !! html
8659 <p>1337
8660 </p>
8661 !! end
8662
8663 !! test
8664 Magic Word: {{SCRIPTPATH}}
8665 !! wikitext
8666 {{SCRIPTPATH}}
8667 !! html
8668 <p>/
8669 </p>
8670 !! end
8671
8672 !! test
8673 Magic Word: {{STYLEPATH}}
8674 !! wikitext
8675 {{STYLEPATH}}
8676 !! html
8677 <p>/skins
8678 </p>
8679 !! end
8680
8681 !! test
8682 Magic Word: {{SERVER}}
8683 !! wikitext
8684 {{SERVER}}
8685 !! html
8686 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8687 </p>
8688 !! end
8689
8690 !! test
8691 Magic Word: {{SERVERNAME}}
8692 !! wikitext
8693 {{SERVERNAME}}
8694 !! html
8695 <p>example.org
8696 </p>
8697 !! end
8698
8699 !! test
8700 Magic Word: {{SITENAME}}
8701 !! wikitext
8702 {{SITENAME}}
8703 !! html
8704 <p>MediaWiki
8705 </p>
8706 !! end
8707
8708 !! test
8709 Case-sensitive magic words, when cased differently, should just be template transclusions
8710 !! wikitext
8711 {{CurrentMonth}}
8712 {{currentday}}
8713 {{cURreNTweEK}}
8714 {{currentHour}}
8715 !! html
8716 <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>
8717 <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>
8718 <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>
8719 <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>
8720 </p>
8721 !! end
8722
8723 !! test
8724 Case-insensitive magic words should still work with weird casing.
8725 !! wikitext
8726 {{sErVeRNaMe}}
8727 {{LCFirst:AOEU}}
8728 {{ucFIRST:aoeu}}
8729 {{SERver}}
8730 !! html
8731 <p>example.org
8732 aOEU
8733 Aoeu
8734 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8735 </p>
8736 !! end
8737
8738 !! test
8739 Namespace 1 {{ns:1}}
8740 !! wikitext
8741 {{ns:1}}
8742 !! html
8743 <p>Talk
8744 </p>
8745 !! end
8746
8747 !! test
8748 Namespace 1 {{ns:01}}
8749 !! wikitext
8750 {{ns:01}}
8751 !! html
8752 <p>Talk
8753 </p>
8754 !! end
8755
8756 !! test
8757 Namespace 0 {{ns:0}} (bug 4783)
8758 !! wikitext
8759 {{ns:0}}
8760 !! html
8761
8762 !! end
8763
8764 !! test
8765 Namespace 0 {{ns:00}} (bug 4783)
8766 !! wikitext
8767 {{ns:00}}
8768 !! html
8769
8770 !! end
8771
8772 !! test
8773 Namespace -1 {{ns:-1}}
8774 !! wikitext
8775 {{ns:-1}}
8776 !! html
8777 <p>Special
8778 </p>
8779 !! end
8780
8781 !! test
8782 Namespace User {{ns:User}}
8783 !! wikitext
8784 {{ns:User}}
8785 !! html
8786 <p>User
8787 </p>
8788 !! end
8789
8790 !! test
8791 Namespace User talk {{ns:User_talk}}
8792 !! wikitext
8793 {{ns:User_talk}}
8794 !! html
8795 <p>User talk
8796 </p>
8797 !! end
8798
8799 !! test
8800 Namespace User talk {{ns:uSeR tAlK}}
8801 !! wikitext
8802 {{ns:uSeR tAlK}}
8803 !! html
8804 <p>User talk
8805 </p>
8806 !! end
8807
8808 !! test
8809 Namespace File {{ns:File}}
8810 !! wikitext
8811 {{ns:File}}
8812 !! html
8813 <p>File
8814 </p>
8815 !! end
8816
8817 !! test
8818 Namespace File {{ns:Image}}
8819 !! wikitext
8820 {{ns:Image}}
8821 !! html
8822 <p>File
8823 </p>
8824 !! end
8825
8826 !! test
8827 Namespace (lang=de) Benutzer {{ns:User}}
8828 !! options
8829 language=de
8830 !! wikitext
8831 {{ns:User}}
8832 !! html
8833 <p>Benutzer
8834 </p>
8835 !! end
8836
8837 !! test
8838 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
8839 !! options
8840 language=de
8841 !! wikitext
8842 {{ns:3}}
8843 !! html
8844 <p>Benutzer Diskussion
8845 </p>
8846 !! end
8847
8848
8849 !! test
8850 Urlencode
8851 !! wikitext
8852 {{urlencode:hi world?!}}
8853 {{urlencode:hi world?!|WIKI}}
8854 {{urlencode:hi world?!|PATH}}
8855 {{urlencode:hi world?!|QUERY}}
8856 !! html
8857 <p>hi+world%3F%21
8858 hi_world%3F!
8859 hi%20world%3F%21
8860 hi+world%3F%21
8861 </p>
8862 !! end
8863
8864 !! test
8865 Magic Word: prioritize type info over data-parsoid
8866 !! options
8867 parsoid=html2wt
8868 !! wikitext
8869 __FORCETOC__
8870 !! html
8871 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
8872 !! end
8873
8874 !! test
8875 Magic Word: serialize on separate line (parsoid)
8876 !! options
8877 parsoid=wt2wt,html2wt
8878 !! wikitext
8879 foo
8880 __NOTOC__
8881 bar
8882 !! html
8883 foo<meta property="mw:PageProp/notoc"/>bar
8884 !! end
8885
8886 !! test
8887 Magic Word: rt non-english wikis
8888 !! options
8889 parsoid=wt2wt
8890 language=de
8891 !! wikitext
8892 __NOEDITSECTION__
8893 !! html
8894 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
8895 !! end
8896
8897 ###
8898 ### Magic links
8899 ###
8900 !! test
8901 Magic links: internal link to RFC (bug 479)
8902 !! wikitext
8903 [[RFC 123]]
8904 !! html
8905 <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>
8906 </p>
8907 !! end
8908
8909 !! test
8910 Magic links: RFC (bug 479)
8911 !! wikitext
8912 RFC 822
8913 !! html
8914 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8915 </p>
8916 !! end
8917
8918 !! test
8919 Magic links: RFC (bug 65278)
8920 !! wikitext
8921 This is RFC 822 but thisRFC 822 is not RFC 822linked.
8922 !! html
8923 <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.
8924 </p>
8925 !! end
8926
8927 !! test
8928 Magic links: ISBN (bug 1937)
8929 !! wikitext
8930 ISBN 0-306-40615-2
8931 !! html
8932 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8933 </p>
8934 !! end
8935
8936 !! test
8937 Magic links: ISBN (bug 65278)
8938 !! wikitext
8939 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
8940 !! html
8941 <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.
8942 </p>
8943 !! end
8944
8945 !! test
8946 Magic links: PMID incorrectly converts space to underscore
8947 !! wikitext
8948 PMID 1234
8949 !! html
8950 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8951 </p>
8952 !! end
8953
8954 !! test
8955 Magic links: PMID (bug 65278)
8956 !! wikitext
8957 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
8958 !! html
8959 <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.
8960 </p>
8961 !! end
8962
8963 ###
8964 ### Templates
8965 ####
8966
8967 !! test
8968 Nonexistent template
8969 !! wikitext
8970 {{thistemplatedoesnotexist}}
8971 !! html
8972 <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>
8973 </p>
8974 !! end
8975
8976 !! test
8977 Template with invalid target containing tags
8978 !! wikitext
8979 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8980 !! html
8981 <p>{{a<b>b</b>|foo|a=b|a = b}}
8982 </p>
8983 !! end
8984
8985 !! test
8986 Template with invalid target containing unclosed tag
8987 !! wikitext
8988 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8989 !! html
8990 <p>{{a<b>|foo|a=b|a = b}}</b>
8991 </p>
8992 !! end
8993
8994 !! test
8995 Template with invalid target containing wikilink
8996 !! wikitext
8997 {{[[Main Page]]}}
8998 !! html/php
8999 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
9000 </p>
9001 !! html/parsoid
9002 <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>
9003 !! end
9004
9005 !! test
9006 Template with just whitespace in it, bug #68421
9007 !! wikitext
9008 {{echo|{{ }}}}
9009 !! html/parsoid
9010 <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>
9011 !! end
9012
9013 !! article
9014 Template:test
9015 !! text
9016 This is a test template
9017 !! endarticle
9018
9019 !! test
9020 Simple template
9021 !! wikitext
9022 {{test}}
9023 !! html
9024 <p>This is a test template
9025 </p>
9026 !! end
9027
9028 !! test
9029 Template with explicit namespace
9030 !! wikitext
9031 {{Template:test}}
9032 !! html
9033 <p>This is a test template
9034 </p>
9035 !! end
9036
9037
9038 !! article
9039 Template:paramtest
9040 !! text
9041 This is a test template with parameter {{{param}}}
9042 !! endarticle
9043
9044 !! test
9045 Template parameter
9046 !! wikitext
9047 {{paramtest|param=foo}}
9048 !! html
9049 <p>This is a test template with parameter foo
9050 </p>
9051 !! end
9052
9053 !! article
9054 Template:paramtestnum
9055 !! text
9056 [[{{{1}}}|{{{2}}}]]
9057 !! endarticle
9058
9059 !! test
9060 Template unnamed parameter
9061 !! wikitext
9062 {{paramtestnum|Main Page|the main page}}
9063 !! html
9064 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9065 </p>
9066 !! end
9067
9068 !! article
9069 Template:templatesimple
9070 !! text
9071 (test)
9072 !! endarticle
9073
9074 !! article
9075 Template:templateredirect
9076 !! text
9077 #redirect [[Template:templatesimple]]
9078 !! endarticle
9079
9080 !! article
9081 Template:templateasargtestnum
9082 !! text
9083 {{{{{1}}}}}
9084 !! endarticle
9085
9086 !! article
9087 Template:templateasargtest
9088 !! text
9089 {{template{{{templ}}}}}
9090 !! endarticle
9091
9092 !! article
9093 Template:templateasargtest2
9094 !! text
9095 {{{{{templ}}}}}
9096 !! endarticle
9097
9098 !! test
9099 Template with template name as unnamed argument
9100 !! wikitext
9101 {{templateasargtestnum|templatesimple}}
9102 !! html
9103 <p>(test)
9104 </p>
9105 !! end
9106
9107 !! test
9108 Template with template name as argument
9109 !! wikitext
9110 {{templateasargtest|templ=simple}}
9111 !! html
9112 <p>(test)
9113 </p>
9114 !! end
9115
9116 !! test
9117 Template with template name as argument (2)
9118 !! wikitext
9119 {{templateasargtest2|templ=templatesimple}}
9120 !! html
9121 <p>(test)
9122 </p>
9123 !! end
9124
9125 !! article
9126 Template:templateasargtestdefault
9127 !! text
9128 {{{{{templ|templatesimple}}}}}
9129 !! endarticle
9130
9131 !! article
9132 Template:templa
9133 !! text
9134 '''templ'''
9135 !! endarticle
9136
9137 !! test
9138 Template with default value
9139 !! wikitext
9140 {{templateasargtestdefault}}
9141 !! html
9142 <p>(test)
9143 </p>
9144 !! end
9145
9146 !! test
9147 Template with default value (value set)
9148 !! wikitext
9149 {{templateasargtestdefault|templ=templa}}
9150 !! html
9151 <p><b>templ</b>
9152 </p>
9153 !! end
9154
9155 !! test
9156 Template redirect
9157 !! wikitext
9158 {{templateredirect}}
9159 !! html
9160 <p>(test)
9161 </p>
9162 !! end
9163
9164 !! test
9165 Template with argument in separate line
9166 !! wikitext
9167 {{ templateasargtest |
9168 templ = simple }}
9169 !! html
9170 <p>(test)
9171 </p>
9172 !! end
9173
9174 !! test
9175 Template with complex template as argument
9176 !! wikitext
9177 {{paramtest|
9178 param ={{ templateasargtest |
9179 templ = simple }}}}
9180 !! html
9181 <p>This is a test template with parameter (test)
9182 </p>
9183 !! end
9184
9185 !! test
9186 Template with thumb image (with link in description)
9187 !! wikitext
9188 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9189 !! html/php
9190 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>
9191
9192 !! html+tidy
9193 <p>This is a test template with parameter</p>
9194 <div class="thumb tright">
9195 <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>
9196 <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>
9197 </div>
9198 </div>
9199 !! html/parsoid
9200 <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>
9201 !! end
9202
9203 !! article
9204 Template:complextemplate
9205 !! text
9206 {{{1}}} {{paramtest|
9207 param ={{{param}}}}}
9208 !! endarticle
9209
9210 !! test
9211 Template with complex arguments
9212 !! wikitext
9213 {{complextemplate|
9214 param ={{ templateasargtest |
9215 templ = simple }}|[[Template:complextemplate|link]]}}
9216 !! html
9217 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
9218 </p>
9219 !! end
9220
9221 !! test
9222 BUG 553: link with two variables in a piped link
9223 !! wikitext
9224 {|
9225 |[[{{{1}}}|{{{2}}}]]
9226 |}
9227 !! html
9228 <table>
9229 <tr>
9230 <td>[[{{{1}}}|{{{2}}}]]
9231 </td></tr></table>
9232
9233 !! end
9234
9235 !! test
9236 Magic variable as template parameter
9237 !! wikitext
9238 {{paramtest|param={{SITENAME}}}}
9239 !! html
9240 <p>This is a test template with parameter MediaWiki
9241 </p>
9242 !! end
9243
9244 !! article
9245 Template:linktest
9246 !! text
9247 [[{{{param}}}|link]]
9248 !! endarticle
9249
9250 !! test
9251 Template parameter as link source
9252 !! wikitext
9253 {{linktest|param=Main Page}}
9254 !! html
9255 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
9256 </p>
9257 !! end
9258
9259 !!test
9260 Template-generated attribute string (k='v')
9261 !! wikitext
9262 <span {{attr_str|id|v1}}>bar</span>
9263 !! html
9264 <p><span id="v1">bar</span>
9265 </p>
9266 !!end
9267
9268 !!article
9269 Template:paramtest2
9270 !! text
9271 including another template, {{paramtest|param={{{arg}}}}}
9272 !! endarticle
9273
9274 !! test
9275 Template passing argument to another template
9276 !! wikitext
9277 {{paramtest2|arg='hmm'}}
9278 !! html
9279 <p>including another template, This is a test template with parameter 'hmm'
9280 </p>
9281 !! end
9282
9283 !! article
9284 Template:Linktest2
9285 !! text
9286 Main Page
9287 !! endarticle
9288
9289 !! test
9290 Template as link source
9291 !! wikitext
9292 [[{{linktest2}}]]
9293
9294 [[{{linktest2}}|Main Page]]
9295
9296 [[{{linktest2}}]]Page
9297 !! html
9298 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9299 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9300 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
9301 </p>
9302 !! end
9303
9304
9305 !! article
9306 Template:loop1
9307 !! text
9308 {{loop2}}
9309 !! endarticle
9310
9311 !! article
9312 Template:loop2
9313 !! text
9314 {{loop1}}
9315 !! endarticle
9316
9317 !! test
9318 Template infinite loop
9319 !! wikitext
9320 {{loop1}}
9321 !! html
9322 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
9323 </p>
9324 !! end
9325
9326 !! test
9327 Template from main namespace
9328 !! wikitext
9329 {{:Main Page}}
9330 !! html
9331 <p>blah blah
9332 </p>
9333 !! end
9334
9335 !! article
9336 Template:table
9337 !! text
9338 {|
9339 | 1 || 2
9340 |-
9341 | 3 || 4
9342 |}
9343 !! endarticle
9344
9345 !! test
9346 BUG 529: Template with table, not included at beginning of line
9347 !! wikitext
9348 foo {{table}}
9349 !! html
9350 <p>foo
9351 </p>
9352 <table>
9353 <tr>
9354 <td> 1 </td>
9355 <td> 2
9356 </td></tr>
9357 <tr>
9358 <td> 3 </td>
9359 <td> 4
9360 </td></tr></table>
9361
9362 !! end
9363
9364 !! test
9365 BUG 523: Template shouldn't eat newline (or add an extra one before table)
9366 !! wikitext
9367 foo
9368 {{table}}
9369 !! html
9370 <p>foo
9371 </p>
9372 <table>
9373 <tr>
9374 <td> 1 </td>
9375 <td> 2
9376 </td></tr>
9377 <tr>
9378 <td> 3 </td>
9379 <td> 4
9380 </td></tr></table>
9381
9382 !! end
9383
9384 !! test
9385 BUG 41: Template parameters shown as broken links
9386 !! wikitext
9387 {{{parameter}}}
9388 !! html
9389 <p>{{{parameter}}}
9390 </p>
9391 !! end
9392
9393 !! test
9394 Template with targets containing wikilinks
9395 !! wikitext
9396 {{[[foo]]}}
9397
9398 {{[[{{echo|foo}}]]}}
9399
9400 {{{{echo|[[foo}}]]}}
9401 !! html
9402 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9403 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9404 </p><p>{{[[foo}}]]
9405 </p>
9406 !! end
9407
9408 !! article
9409 Template:MSGNW test
9410 !! text
9411 ''None'' of '''this''' should be
9412 * interpreted
9413 but rather passed unmodified
9414 {{test}}
9415 <gallery>
9416 File:Foobar.jpg
9417 </gallery>
9418 !! endarticle
9419
9420 # hmm, fix this or just deprecate msgnw and document its behavior?
9421 !! test
9422 msgnw keyword
9423 !! wikitext
9424 {{msgnw:MSGNW test}}
9425 !! html
9426 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
9427 &#42; interpreted
9428 &#32;but rather passed unmodified
9429 &#123;&#123;test&#125;&#125;
9430 &#60;gallery&#62;
9431 File:Foobar.jpg
9432 &#60;/gallery&#62;
9433 </p>
9434 !! end
9435
9436 !! test
9437 int keyword
9438 !! wikitext
9439 {{int:youhavenewmessages|lots of money|not!}}
9440 !! html
9441 <p>You have lots of money (not!).
9442 </p>
9443 !! end
9444
9445 !! article
9446 Template:Includes
9447 !! text
9448 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9449 !! endarticle
9450
9451 !! test
9452 <includeonly> and <noinclude> being included
9453 !! wikitext
9454 {{Includes}}
9455 !! html
9456 <p>Foobar
9457 </p>
9458 !! end
9459
9460 !! article
9461 Template:Includes2
9462 !! text
9463 <onlyinclude>Foo</onlyinclude>bar
9464 !! endarticle
9465
9466 !! test
9467 <onlyinclude> being included
9468 !! wikitext
9469 {{Includes2}}
9470 !! html
9471 <p>Foo
9472 </p>
9473 !! end
9474
9475
9476 !! article
9477 Template:Includes3
9478 !! text
9479 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9480 !! endarticle
9481
9482 !! test
9483 <onlyinclude> and <includeonly> being included
9484 !! wikitext
9485 {{Includes3}}
9486 !! html
9487 <p>Foo
9488 </p>
9489 !! end
9490
9491 !! test
9492 <includeonly> and <noinclude> on a page
9493 !! wikitext
9494 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9495 !! html
9496 <p>Foozar
9497 </p>
9498 !! end
9499
9500 !! test
9501 Un-closed <noinclude>
9502 !! wikitext
9503 <noinclude>
9504 !! html
9505 !! end
9506
9507 !! test
9508 <onlyinclude> on a page
9509 !! wikitext
9510 <onlyinclude>Foo</onlyinclude>bar
9511 !! html
9512 <p>Foobar
9513 </p>
9514 !! end
9515
9516 !! test
9517 Un-closed <onlyinclude>
9518 !! wikitext
9519 <onlyinclude>
9520 !! html
9521 !! end
9522
9523 !!test
9524 Self-closed noinclude, includeonly, onlyinclude tags
9525 !! wikitext
9526 <noinclude />
9527 <includeonly />
9528 <onlyinclude />
9529 !! html
9530 <p><br />
9531 </p>
9532 !!end
9533
9534 !!test
9535 Unbalanced includeonly and noinclude tags
9536 !! wikitext
9537 {|
9538 |a</noinclude>
9539 |b</noinclude></noinclude>
9540 |c</noinclude></includeonly>
9541 |d</includeonly></includeonly>
9542 |}
9543 !! html
9544 <table>
9545 <tr>
9546 <td>a
9547 </td>
9548 <td>b
9549 </td>
9550 <td>c&lt;/includeonly&gt;
9551 </td>
9552 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9553 </td></tr></table>
9554
9555 !!end
9556
9557 !! article
9558 Template:Includeonly section
9559 !! text
9560 <includeonly>
9561 ==Includeonly section==
9562 </includeonly>
9563 ==Section T-1==
9564 !!endarticle
9565
9566 !! test
9567 Bug 6563: Edit link generation for section shown by <includeonly>
9568 !! wikitext
9569 {{includeonly section}}
9570 !! html
9571 <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>
9572 <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>
9573
9574 !! end
9575
9576 # Uses same input as the contents of [[Template:Includeonly section]]
9577 !! test
9578 Bug 6563: Section extraction for section shown by <includeonly>
9579 !! options
9580 section=T-2
9581 !! wikitext
9582 <includeonly>
9583 ==Includeonly section==
9584 </includeonly>
9585 ==Section T-2==
9586 !! html
9587 ==Section T-2==
9588 !! end
9589
9590 !! test
9591 Bug 6563: Edit link generation for section suppressed by <includeonly>
9592 !! wikitext
9593 <includeonly>
9594 ==Includeonly section==
9595 </includeonly>
9596 ==Section 1==
9597 !! html
9598 <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>
9599
9600 !! end
9601
9602 !! test
9603 Bug 6563: Section extraction for section suppressed by <includeonly>
9604 !! options
9605 section=1
9606 !! wikitext
9607 <includeonly>
9608 ==Includeonly section==
9609 </includeonly>
9610 ==Section 1==
9611 !! html
9612 ==Section 1==
9613 !! end
9614
9615 !! test
9616 Un-closed <includeonly>
9617 !! wikitext
9618 <includeonly>
9619 !! html
9620 !! end
9621
9622 !! test
9623 Includes and comments at SOL
9624 !! wikitext
9625 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
9626
9627 <noinclude>
9628 some
9629 </noinclude>* stuff
9630 * here
9631
9632 <includeonly>can have stuff</includeonly>=== here ===
9633
9634 !! html/php
9635 <h2><span class="mw-headline" id="hu">hu</span></h2>
9636 <p>some
9637 </p>
9638 <ul><li> stuff</li>
9639 <li> here</li></ul>
9640 <h3><span class="mw-headline" id="here">here</span></h3>
9641
9642 !! html/parsoid
9643 <!-- 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>
9644
9645 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
9646 <p>some</p>
9647 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
9648 <li> here</li></ul>
9649
9650 <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>
9651
9652 !! end
9653
9654 # TODO: test with DOM fragment reuse!
9655 !! test
9656 Parsoid: DOM fragment reuse
9657 !! options
9658 parsoid=wt2wt,wt2html
9659 !! wikitext
9660 a{{echo|b<table></table>c}}d
9661
9662 a{{echo|b
9663 <table></table>
9664 c}}d
9665
9666 {{echo|a
9667
9668 <table></table>
9669
9670 b}}
9671 !! html
9672 <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>
9673
9674 <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">
9675 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
9676 </span><p about="#mwt2">cd</p>
9677
9678 <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">
9679
9680 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
9681
9682 </span><p about="#mwt3">b</p>
9683 !! end
9684
9685 !! test
9686 Parsoid: Merge double tds (bug 50603)
9687 !! options
9688 parsoid
9689 !! wikitext
9690 {|
9691 |{{echo|{{!}} foo}}
9692 |}
9693 !! html
9694 <table><tbody>
9695 <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>
9696 </tbody></table>
9697 !! end
9698
9699 !! test
9700 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9701 !! options
9702 parsoid
9703 !! wikitext
9704 {{echo|<div>}}
9705 {|
9706 |{{echo|{{!}} foo}}
9707 |}
9708 {{echo|</div>}}
9709 !! html
9710 <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}}]}'>
9711 <table><tbody>
9712 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9713 </tbody></table>
9714 </div>
9715 !! end
9716
9717 ###
9718 ### <includeonly> and <noinclude> in attributes
9719 ###
9720 !!test
9721 0. includeonly around the entire attribute
9722 !! wikitext
9723 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9724 !! html
9725 <p><span id="v2">bar</span>
9726 </p>
9727 !!end
9728
9729 !!test
9730 1. includeonly in html attr key
9731 !! wikitext
9732 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9733 !! html
9734 <p><span id="foo">bar</span>
9735 </p>
9736 !!end
9737
9738 !!test
9739 2. includeonly in html attr value
9740 !! wikitext
9741 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9742 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9743 !! html
9744 <p><span id="v1">bar</span>
9745 <span id="v1">bar</span>
9746 </p>
9747 !!end
9748
9749 !!test
9750 3. includeonly in part of an attr value
9751 !! wikitext
9752 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9753 !! html
9754 <p><span style="color:red;">bar</span>
9755 </p>
9756 !!end
9757
9758 !!test
9759 4. includeonly in table attributes
9760 !! wikitext
9761 {|
9762 |- <noinclude>
9763 |-
9764 |a
9765 </noinclude>
9766 |- <includeonly>
9767 |-
9768 |b
9769 </includeonly>
9770 |}
9771 !! html
9772 <table>
9773
9774
9775 <tr>
9776 <td>a
9777 </td></tr>
9778 </table>
9779
9780 !!end
9781
9782 ###
9783 ### Token Stream Patcher tests
9784 ###
9785 ### These tests won't always pass wt2wt and other modes because
9786 ### on serialization, the table will be output on a new line.
9787 ### For now, we are blacklisting them, and using this to test selser.
9788 ###
9789
9790 !!test
9791 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
9792 !!options
9793 parsoid=wt2html,wt2wt
9794 !!wikitext
9795 {{echo|}}{| width = '100%'
9796 |foo
9797 |}
9798 !!html/parsoid
9799 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
9800 <tbody><tr><td>foo</td></tr>
9801 </tbody></table>
9802 !!end
9803
9804 !!test
9805 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
9806 !!options
9807 parsoid=wt2html,wt2wt
9808 !!wikitext
9809 <includeonly>a</includeonly>{| {{{b}}}
9810 |c
9811 |}
9812 !!html/parsoid
9813 <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}}}":""}}'>
9814 <tbody><tr><td>c</td></tr>
9815 </tbody></table>
9816
9817 !!end
9818
9819 ###
9820 ### Testing parsing of templates where a template arg
9821 ### has the same name as the template itself.
9822 ###
9823
9824 !! article
9825 Template:quote
9826 !! text
9827 {{{quote|{{{1}}}}}}
9828 !! endarticle
9829
9830 !!test
9831 Templates: Template Name/Arg clash: 1. Use of positional param
9832 !! wikitext
9833 {{quote|foo}}
9834 !! html
9835 <p>foo
9836 </p>
9837 !!end
9838
9839 !!test
9840 Templates: Template Name/Arg clash: 2. Use of named param
9841 !! wikitext
9842 {{quote|quote=foo}}
9843 !! html
9844 <p>foo
9845 </p>
9846 !!end
9847
9848 !!test
9849 Templates: Template Name/Arg clash: 3. Use of named param with empty input
9850 !! wikitext
9851 {{quote|quote}}
9852 !! html
9853 <p>quote
9854 </p>
9855 !!end
9856
9857 ###
9858 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
9859 ###
9860
9861 !!test
9862 Templates: 1. Simple use
9863 !! wikitext
9864 {{echo|Foo}}
9865 !! html
9866 <p>Foo
9867 </p>
9868 !!end
9869
9870 !!test
9871 Templates: 2. Inside a block tag
9872 !! wikitext
9873 <div>{{echo|Foo}}</div>
9874 <blockquote>{{echo|Foo}}</blockquote>
9875 !! html
9876 <div>Foo</div>
9877 <blockquote>Foo</blockquote>
9878
9879 !! html+tidy
9880 <div>Foo</div>
9881 <blockquote>
9882 <p>Foo</p>
9883 </blockquote>
9884 !!end
9885
9886 !!test
9887 Templates: P-wrapping: 1a. Templates on consecutive lines
9888 !! wikitext
9889 {{echo|Foo}}
9890 {{echo|bar}}
9891 !! html
9892 <p>Foo
9893 bar
9894 </p>
9895 !!end
9896
9897 !!test
9898 Templates: P-wrapping: 1b. Templates on consecutive lines
9899 !! wikitext
9900 Foo
9901
9902 {{echo|bar}}
9903 {{echo|baz}}
9904 !! html
9905 <p>Foo
9906 </p><p>bar
9907 baz
9908 </p>
9909 !!end
9910
9911 !!test
9912 Templates: P-wrapping: 1c. Templates on consecutive lines
9913 !! wikitext
9914 {{echo|Foo}}
9915 {{echo|bar}} <div>baz</div>
9916 !! html
9917 <p>Foo
9918 </p>
9919 bar <div>baz</div>
9920
9921 !! html+tidy
9922 <p>Foo</p>
9923 <p>bar</p>
9924 <div>baz</div>
9925 !! end
9926
9927 !!test
9928 Templates: P-wrapping: 1d. Template preceded by comment-only line
9929 !!options
9930 parsoid
9931 !! wikitext
9932 <!-- foo -->
9933 {{echo|Bar}}
9934 !! html
9935 <!-- foo -->
9936
9937 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
9938 !!end
9939
9940 !!test
9941 Templates: Inline Text: 1. Multiple template uses
9942 !! wikitext
9943 {{echo|Foo}}bar{{echo|baz}}
9944 !! html
9945 <p>Foobarbaz
9946 </p>
9947 !!end
9948
9949 !!test
9950 Templates: Inline Text: 2. Back-to-back template uses
9951 !! wikitext
9952 {{echo|Foo}}{{echo|bar}}
9953 !! html
9954 <p>Foobar
9955 </p>
9956 !!end
9957
9958 !!test
9959 Templates: Block Tags: 1. Multiple template uses
9960 !! wikitext
9961 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
9962 !! html
9963 <div>Foo</div><div>bar</div><div>baz</div>
9964
9965 !!end
9966
9967 !!test
9968 Templates: Block Tags: 2. Back-to-back template uses
9969 !! wikitext
9970 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
9971 !! html
9972 <div>Foo</div><div>bar</div>
9973
9974 !!end
9975
9976 # This is an edge case relating to paragraph wrapping.
9977 !!test
9978 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
9979 !! wikitext
9980 {{echo|a
9981 b</p>}}
9982 !! html/parsoid
9983 <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
9984 b</p>
9985 !!end
9986
9987 !!test
9988 Templates: Links: 1. Simple example
9989 !! wikitext
9990 {{echo|[[Foo|bar]]}}
9991 !! html
9992 <p><a href="/wiki/Foo" title="Foo">bar</a>
9993 </p>
9994 !!end
9995
9996 !!test
9997 Templates: Links: 2. Generation of link href
9998 !! wikitext
9999 [[{{echo|Foo}}|bar]]
10000 !! html
10001 <p><a href="/wiki/Foo" title="Foo">bar</a>
10002 </p>
10003 !!end
10004
10005 !!test
10006 Templates: Links: 3. Generation of part of a link href
10007 !! wikitext
10008 [[Fo{{echo|o}}|bar]]
10009
10010 [[Foo{{echo|bar}}]]
10011
10012 [[Foo{{echo|bar}}baz]]
10013
10014 [[Foo{{echo|bar}}|bar]]
10015
10016 [[:Foo{{echo|bar}}]]
10017
10018 [[:Foo{{echo|bar}}|bar]]
10019 !! html
10020 <p><a href="/wiki/Foo" title="Foo">bar</a>
10021 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10022 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10023 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10024 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10025 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10026 </p>
10027 !!end
10028
10029 !!test
10030 Templates: Links: 4. Multiple templates generating link href
10031 !! wikitext
10032 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10033 !! html
10034 <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>
10036 !!end
10037
10038 !!test
10039 Templates: Links: 5. Generation of link text
10040 !! wikitext
10041 [[Foo|{{echo|bar}}]]
10042 !! html
10043 <p><a href="/wiki/Foo" title="Foo">bar</a>
10044 </p>
10045 !!end
10046
10047 !!test
10048 Templates: Links: 5. Nested templates (only outermost template should be marked)
10049 !! wikitext
10050 {{echo|[[{{echo|Foo}}|bar]]}}
10051 !! html
10052 <p><a href="/wiki/Foo" title="Foo">bar</a>
10053 </p>
10054 !!end
10055
10056 !!test
10057 Templates: HTML Tag: 1. Generation of HTML attr. key
10058 !! wikitext
10059 <div {{echo|style}}="color:red;">foo</div>
10060 !! html
10061 <div style="color:red;">foo</div>
10062
10063 !!end
10064
10065 !!test
10066 Templates: HTML Tag: 2. Generation of HTML attr. value
10067 !! wikitext
10068 <div style={{echo|'color:red;'}}>foo</div>
10069 !! html
10070 <div style="color:red;">foo</div>
10071
10072 !!end
10073
10074 !!test
10075 Templates: HTML Tag: 3. Generation of HTML attr key and value
10076 !! wikitext
10077 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10078 !! html
10079 <div style="color:red;">foo</div>
10080
10081 !!end
10082
10083 !!test
10084 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10085 !! wikitext
10086 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10087 !! html
10088 <div title="This is a long title with just one piece templated">foo</div>
10089
10090 !!end
10091
10092 !!test
10093 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10094 !! wikitext
10095 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10096 !! html
10097 <div title="This is a long title with just one piece templated">foo</div>
10098
10099 !!end
10100
10101 !!test
10102 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10103 !! wikitext
10104 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10105 !! html
10106 <div title="This is a long title with just one piece templated">foo</div>
10107
10108 !!end
10109
10110 !!test
10111 Templates: HTML Tag: 7. Generation of partial attribute key string
10112 !! wikitext
10113 <div st{{echo|yle}}="color:red;">foo</div>
10114 !! html
10115 <div style="color:red;">foo</div>
10116
10117 !!end
10118
10119 !!test
10120 Templates: HTML Tables: 1. Generating start of a HTML table
10121 !! wikitext
10122 {{echo|<table><tr><td>foo</td>}}</tr></table>
10123 !! html
10124 <table><tr><td>foo</td></tr></table>
10125
10126 !!end
10127
10128 !!test
10129 Templates: HTML Tables: 2a. Generating middle of a HTML table
10130 !! wikitext
10131 <table><tr>{{echo|<td>foo</td>}}</tr></table>
10132 !! html
10133 <table><tr><td>foo</td></tr></table>
10134
10135 !!end
10136
10137 !!test
10138 Templates: HTML Tables: 2b. Generating middle of a HTML table
10139 !! wikitext
10140 <table>{{echo|<tr><td>foo</td></tr>}}</table>
10141 !! html
10142 <table><tr><td>foo</td></tr></table>
10143
10144 !!end
10145
10146 !!test
10147 Templates: HTML Tables: 3. Generating end of a HTML table
10148 !! wikitext
10149 <table><tr>{{echo|<td>foo</td></tr></table>}}
10150 !! html
10151 <table><tr><td>foo</td></tr></table>
10152
10153 !!end
10154
10155 !!test
10156 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
10157 !! wikitext
10158 {{echo|<table>}}<tr><td>foo</td></tr></table>
10159 !! html
10160 <table><tr><td>foo</td></tr></table>
10161
10162 !!end
10163
10164 !!test
10165 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
10166 !! wikitext
10167 <table>{{echo|<tr>}}<td>foo</td></tr></table>
10168 !! html
10169 <table><tr><td>foo</td></tr></table>
10170
10171 !!end
10172
10173 !!test
10174 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
10175 !! wikitext
10176 <table><tr>{{echo|<td>}}foo</td></tr></table>
10177 !! html
10178 <table><tr><td>foo</td></tr></table>
10179
10180 !!end
10181
10182 !!test
10183 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
10184 !! wikitext
10185 <table><tr><td>foo{{echo|</td>}}</tr></table>
10186 !! html
10187 <table><tr><td>foo</td></tr></table>
10188
10189 !!end
10190
10191 !!test
10192 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
10193 !! wikitext
10194 <table><tr><td>foo</td>{{echo|</tr>}}</table>
10195 !! html
10196 <table><tr><td>foo</td></tr></table>
10197
10198 !!end
10199
10200 !!test
10201 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
10202 !! wikitext
10203 <table><tr><td>foo</td></tr>{{echo|</table>}}
10204 !! html
10205 <table><tr><td>foo</td></tr></table>
10206
10207 !!end
10208
10209 !!test
10210 Templates: HTML Tables: 5. Proper fostering of categories from inside
10211 !!options
10212 parsoid=wt2html,wt2wt
10213 !! wikitext
10214 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
10215 <!--Two categories (Bug 50330)-->
10216 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
10217 !! html
10218 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
10219 <!--Two categories (Bug 50330)-->
10220 <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>
10221 !!end
10222
10223 !!test
10224 Templates: Wiki Tables: 1a. Fostering of entire template content
10225 !! wikitext
10226 {|
10227 {{echo|a}}
10228 |}
10229 !! html
10230 <table>
10231 a
10232 <tr><td></td></tr></table>
10233
10234 !! html+tidy
10235 <p>a</p>
10236 <table>
10237 <tr>
10238 <td></td>
10239 </tr>
10240 </table>
10241 !! end
10242
10243 !!test
10244 Templates: Wiki Tables: 1b. Fostering of entire template content
10245 !! wikitext
10246 {|
10247 {{echo|<div>}}
10248 foo
10249 {{echo|</div>}}
10250 |}
10251 !! html
10252 <table>
10253 <div>
10254 <p>foo
10255 </p>
10256 </div>
10257 <tr><td></td></tr></table>
10258
10259 !! html+tidy
10260 <div>
10261 <p>foo</p>
10262 </div>
10263 <table>
10264 <tr>
10265 <td></td>
10266 </tr>
10267 </table>
10268 !! end
10269
10270 !!test
10271 Templates: Wiki Tables: 2. Fostering of partial template content
10272 !! wikitext
10273 {|
10274 {{echo|a
10275 <div>b</div>}}
10276 |}
10277 !! html
10278 <table>
10279 a
10280 <div>b</div>
10281 <tr><td></td></tr></table>
10282
10283 !! html+tidy
10284 <p>a</p>
10285 <div>b</div>
10286 <table>
10287 <tr>
10288 <td></td>
10289 </tr>
10290 </table>
10291 !! end
10292
10293 !!test
10294 Templates: Wiki Tables: 3. td-content via multiple templates
10295 !! wikitext
10296 {|
10297 {{echo|{{pipe}}a}}{{echo|b}}
10298 |}
10299 !! html
10300 <table>
10301 <tr>
10302 <td>ab
10303 </td></tr></table>
10304
10305 !!end
10306
10307 !!test
10308 Templates: Wiki Tables: 4. Templated tags, no content
10309 !! wikitext
10310 {{tbl-start}}
10311 {{tbl-end}}
10312 !! html
10313 <table>
10314 <tr><td></td></tr></table>
10315
10316 !!end
10317
10318 !!test
10319 Templates: Wiki Tables: 5. Templated tags, regular td-tags
10320 !! wikitext
10321 {{tbl-start}}
10322 |foo
10323 {{tbl-end}}
10324 !! html
10325 <table>
10326 <tr>
10327 <td>foo
10328 </td></tr></table>
10329
10330 !!end
10331
10332 !!test
10333 Templates: Wiki Tables: 6. Templated tags, templated td-tags
10334 !! wikitext
10335 {{tbl-start}}
10336 {{!}}foo
10337 {{tbl-end}}
10338 !! html
10339 <table>
10340 <tr>
10341 <td>foo
10342 </td></tr></table>
10343
10344 !!end
10345
10346 !!test
10347 Templates: Lists: Multi-line list-items via templates
10348 !! wikitext
10349 *{{echo|a {{nonexistent|
10350 unused}}}}
10351 *{{echo|b {{nonexistent|
10352 unused}}}}
10353 !! html
10354 <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>
10355 <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>
10356
10357 !!end
10358
10359 !!test
10360 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
10361 !! wikitext
10362 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
10363 !! html
10364 <p><i>ab</i>c<i>d</i>e
10365 </p>
10366 !!end
10367
10368 !!test
10369 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
10370 (PHP parser generates misnested html)
10371 !! wikitext
10372 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
10373 !! html/parsoid
10374 <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>
10375 !!end
10376
10377 !!test
10378 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
10379 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
10380 !! options
10381 parsoid=wt2html,wt2wt
10382 !! wikitext
10383 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
10384 !! html
10385 <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>
10386 <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>
10387 <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>
10388 !!end
10389
10390 !!test
10391 Templates: Ugly nesting: 4. Divs opened/closed across templates
10392 !! wikitext
10393 a<div>b{{echo|c</div>d}}e
10394 !! html
10395 a<div>bc</div>de
10396
10397 !! html+tidy
10398 <p>a</p>
10399 <div>bc</div>
10400 <p>de</p>
10401 !! end
10402
10403 !!test
10404 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10405 (Parsoid-centric)
10406 !! options
10407 parsoid
10408 !! wikitext
10409 {|
10410 |{{echo|foo</table>}}
10411 |bar
10412 |}
10413 !! html
10414 <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|}"]}'>
10415
10416 <tbody>
10417 <tr>
10418 <td>foo</td></tr></tbody></table><span about="#mwt1">
10419 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10420 |}</span>
10421 !!end
10422
10423 !!test
10424 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10425 (Parsoid-centric)
10426 !! options
10427 parsoid
10428 !! wikitext
10429 <table>
10430 <tr>
10431 <td>
10432 <table>
10433 <tr>
10434 <td>1. {{echo|foo </table>}}</td>
10435 <td> bar </td>
10436 <td>2. {{echo|baz </table>}}</td>
10437 </tr>
10438 <tr>
10439 <td>abc</td>
10440 </tr>
10441 </table>
10442 </td>
10443 </tr>
10444 <tr>
10445 <td>xyz</td>
10446 </tr>
10447 </table>
10448 !! html
10449 <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>"]}'>
10450 <tbody><tr>
10451 <td>
10452 <table>
10453 <tbody><tr>
10454 <td>1. foo </td></tr></tbody></table></td>
10455 <td> bar </td>
10456 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10457 </span><span about="#mwt2">
10458 </span><span about="#mwt2">
10459 </span><span about="#mwt2">abc</span><span about="#mwt2">
10460 </span><span about="#mwt2">
10461 </span><span about="#mwt2">
10462 </span><span about="#mwt2">
10463 </span><span about="#mwt2">
10464 </span><span about="#mwt2">
10465 </span><span about="#mwt2">xyz</span><span about="#mwt2">
10466 </span><span about="#mwt2">
10467 </span>
10468 !!end
10469
10470 !! test
10471 Templates: Ugly templates: 3. newline-only template parameter
10472 !! wikitext
10473 foo {{echo|
10474 }}
10475 !! html
10476 <p>foo
10477 </p>
10478 !! end
10479
10480 # This looks like a bug: a single newline triggers p/br for some reason.
10481 !! test
10482 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10483 !! wikitext
10484 {{echo|
10485 }}
10486 !! html
10487 <p><br />
10488 </p>
10489 !! end
10490
10491 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10492 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10493 !! test
10494 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10495 !! wikitext
10496 {{echo|<table>}}
10497 {{echo|<div>foo}}
10498 {{echo|</table>}}
10499 !! html/parsoid
10500 <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
10501 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10502 </table>
10503 !! end
10504
10505 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10506 # that are "identical" and generate nesting cycles in the algorithm
10507 !! test
10508 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
10509 !! wikitext
10510 {{echo|<table><tr><td><table>}}
10511 {{echo|<div>}}
10512 {{echo|</div>}}
10513 !! html/parsoid
10514 <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"}'>
10515 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10516 </table></td></tr></tbody></table>
10517 !! end
10518
10519 !!test
10520 Parser Functions: 1. Simple example
10521 !! wikitext
10522 {{uc:foo}}
10523 !! html
10524 <p>FOO
10525 </p>
10526 !!end
10527
10528 !!test
10529 Parser Functions: 2. Nested use (only outermost should be marked up)
10530 !! wikitext
10531 {{uc:{{lc:FOO}}}}
10532 !! html
10533 <p>FOO
10534 </p>
10535 !!end
10536
10537 ###
10538 ### Pre-save transform tests
10539 ###
10540 !! test
10541 pre-save transform: subst:
10542 !! options
10543 PST
10544 !! wikitext
10545 {{subst:test}}
10546 !! html
10547 This is a test template
10548 !! end
10549
10550 !! test
10551 pre-save transform: normal template
10552 !! options
10553 PST
10554 !! wikitext
10555 {{test}}
10556 !! html
10557 {{test}}
10558 !! end
10559
10560 !! test
10561 pre-save transform: nonexistent template
10562 !! options
10563 PST
10564 !! wikitext
10565 {{thistemplatedoesnotexist}}
10566 !! html
10567 {{thistemplatedoesnotexist}}
10568 !! end
10569
10570
10571 !! test
10572 pre-save transform: subst magic variables
10573 !! options
10574 PST
10575 !! wikitext
10576 {{subst:SITENAME}}
10577 !! html
10578 MediaWiki
10579 !! end
10580
10581 # This is bug 89, which I fixed. -- wtm
10582 !! test
10583 pre-save transform: subst: templates with parameters
10584 !! options
10585 pst
10586 !! wikitext
10587 {{subst:paramtest|param="something else"}}
10588 !! html
10589 This is a test template with parameter "something else"
10590 !! end
10591
10592 !! article
10593 Template:nowikitest
10594 !! text
10595 <nowiki>'''not wiki'''</nowiki>
10596 !! endarticle
10597
10598 !! test
10599 pre-save transform: nowiki in subst (bug 1188)
10600 !! options
10601 pst
10602 !! wikitext
10603 {{subst:nowikitest}}
10604 !! html
10605 <nowiki>'''not wiki'''</nowiki>
10606 !! end
10607
10608
10609 !! article
10610 Template:commenttest
10611 !! text
10612 This template has <!-- a comment --> in it.
10613 !! endarticle
10614
10615 !! test
10616 pre-save transform: comment in subst (bug 1936)
10617 !! options
10618 pst
10619 !! wikitext
10620 {{subst:commenttest}}
10621 !! html
10622 This template has <!-- a comment --> in it.
10623 !! end
10624
10625 !! test
10626 pre-save transform: unclosed tag
10627 !! options
10628 pst noxml
10629 !! wikitext
10630 <nowiki>'''not wiki'''
10631 !! html
10632 <nowiki>'''not wiki'''
10633 !! end
10634
10635 !! test
10636 pre-save transform: mixed tag case
10637 !! options
10638 pst noxml
10639 !! wikitext
10640 <NOwiki>'''not wiki'''</noWIKI>
10641 !! html
10642 <NOwiki>'''not wiki'''</noWIKI>
10643 !! end
10644
10645 !! test
10646 pre-save transform: unclosed comment in <nowiki>
10647 !! options
10648 pst noxml
10649 !! wikitext
10650 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10651 !! html
10652 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10653 !!end
10654
10655 # Leading @ in this template definition works around a limitation
10656 # in parsoid's parserTests which otherwise strips the <span> from the
10657 # result (confusing it for a template wrapper)
10658 !! article
10659 Template:dangerous
10660 !!text
10661 @<span onmouseover="alert('crap')">Oh no</span>
10662 !!endarticle
10663
10664 !!test
10665 (confirming safety of fix for subst bug 1936)
10666 !! wikitext
10667 {{Template:dangerous}}
10668 !! html
10669 <p>@<span>Oh no</span>
10670 </p>
10671 !! end
10672
10673 !! test
10674 pre-save transform: comment containing gallery (bug 5024)
10675 !! options
10676 pst
10677 !! wikitext
10678 <!-- <gallery>data</gallery> -->
10679 !! html
10680 <!-- <gallery>data</gallery> -->
10681 !!end
10682
10683 !! test
10684 pre-save transform: comment containing extension
10685 !! options
10686 pst
10687 !! wikitext
10688 <!-- <tag>data</tag> -->
10689 !! html
10690 <!-- <tag>data</tag> -->
10691 !!end
10692
10693 !! test
10694 pre-save transform: comment containing nowiki
10695 !! options
10696 pst
10697 !! wikitext
10698 <!-- <nowiki>data</nowiki> -->
10699 !! html
10700 <!-- <nowiki>data</nowiki> -->
10701 !!end
10702
10703 !! test
10704 pre-save transform: <noinclude> in subst (bug 3298)
10705 !! options
10706 pst
10707 !! wikitext
10708 {{subst:Includes}}
10709 !! html
10710 Foobar
10711 !! end
10712
10713 !! test
10714 pre-save transform: <onlyinclude> in subst (bug 3298)
10715 !! options
10716 pst
10717 !! wikitext
10718 {{subst:Includes2}}
10719 !! html
10720 Foo
10721 !! end
10722
10723 !! article
10724 Template:SubstTest
10725 !!text
10726 {{<includeonly>subst:</includeonly>Includes}}
10727 !! endarticle
10728
10729 !! article
10730 Template:SafeSubstTest
10731 !! text
10732 {{<includeonly>safesubst:</includeonly>Includes}}
10733 !! endarticle
10734
10735 !! test
10736 bug 22297: safesubst: works during PST
10737 !! options
10738 pst
10739 !! wikitext
10740 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
10741 !! html
10742 FoobarFoobar
10743 !! end
10744
10745 !! test
10746 bug 22297: safesubst: works during normal parse
10747 !! wikitext
10748 {{SafeSubstTest}}
10749 !! html
10750 <p>Foobar
10751 </p>
10752 !! end
10753
10754 !! test
10755 subst: does not work during normal parse
10756 !! wikitext
10757 {{SubstTest}}
10758 !! html
10759 <p>{{subst:Includes}}
10760 </p>
10761 !! end
10762
10763 !! test
10764 pre-save transform: context links ("pipe trick")
10765 !! options
10766 pst
10767 !! wikitext
10768 [[Article (context)|]]
10769 [[Bar:Article|]]
10770 [[:Bar:Article|]]
10771 [[Bar:Article (context)|]]
10772 [[:Bar:Article (context)|]]
10773 [[|Article]]
10774 [[|Article (context)]]
10775 [[Bar:X (Y) Z|]]
10776 [[:Bar:X (Y) Z|]]
10777 !! html
10778 [[Article (context)|Article]]
10779 [[Bar:Article|Article]]
10780 [[:Bar:Article|Article]]
10781 [[Bar:Article (context)|Article]]
10782 [[:Bar:Article (context)|Article]]
10783 [[Article]]
10784 [[Article (context)]]
10785 [[Bar:X (Y) Z|X (Y) Z]]
10786 [[:Bar:X (Y) Z|X (Y) Z]]
10787 !! end
10788
10789 !! test
10790 pre-save transform: context links ("pipe trick") with interwiki prefix
10791 !! options
10792 pst
10793 !! wikitext
10794 [[interwiki:Article|]]
10795 [[:interwiki:Article|]]
10796 [[interwiki:Bar:Article|]]
10797 [[:interwiki:Bar:Article|]]
10798 !! html
10799 [[interwiki:Article|Article]]
10800 [[:interwiki:Article|Article]]
10801 [[interwiki:Bar:Article|Bar:Article]]
10802 [[:interwiki:Bar:Article|Bar:Article]]
10803 !! end
10804
10805 !! test
10806 pre-save transform: context links ("pipe trick") with parens in title
10807 !! options
10808 pst title=[[Somearticle (context)]]
10809 !! wikitext
10810 [[|Article]]
10811 !! html
10812 [[Article (context)|Article]]
10813 !! end
10814
10815 !! test
10816 pre-save transform: context links ("pipe trick") with comma in title
10817 !! options
10818 pst title=[[Someplace, Somewhere]]
10819 !! wikitext
10820 [[|Otherplace]]
10821 [[Otherplace, Elsewhere|]]
10822 [[Otherplace, Elsewhere, Anywhere|]]
10823 !! html
10824 [[Otherplace, Somewhere|Otherplace]]
10825 [[Otherplace, Elsewhere|Otherplace]]
10826 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
10827 !! end
10828
10829 !! test
10830 pre-save transform: context links ("pipe trick") with parens and comma
10831 !! options
10832 pst title=[[Someplace (IGNORED), Somewhere]]
10833 !! wikitext
10834 [[|Otherplace]]
10835 [[Otherplace (place), Elsewhere|]]
10836 !! html
10837 [[Otherplace, Somewhere|Otherplace]]
10838 [[Otherplace (place), Elsewhere|Otherplace]]
10839 !! end
10840
10841 !! test
10842 pre-save transform: context links ("pipe trick") with comma and parens
10843 !! options
10844 pst title=[[Who, me? (context)]]
10845 !! wikitext
10846 [[|Yes, you.]]
10847 [[Me, Myself, and I (1937 song)|]]
10848 !! html
10849 [[Yes, you. (context)|Yes, you.]]
10850 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
10851 !! end
10852
10853 !! test
10854 pre-save transform: context links ("pipe trick") with namespace
10855 !! options
10856 pst title=[[Ns:Somearticle]]
10857 !! wikitext
10858 [[|Article]]
10859 !! html
10860 [[Ns:Article|Article]]
10861 !! end
10862
10863 !! test
10864 pre-save transform: context links ("pipe trick") with namespace and parens
10865 !! options
10866 pst title=[[Ns:Somearticle (context)]]
10867 !! wikitext
10868 [[|Article]]
10869 !! html
10870 [[Ns:Article (context)|Article]]
10871 !! end
10872
10873 !! test
10874 pre-save transform: context links ("pipe trick") with namespace and comma
10875 !! options
10876 pst title=[[Ns:Somearticle, Context, Whatever]]
10877 !! wikitext
10878 [[|Article]]
10879 !! html
10880 [[Ns:Article, Context, Whatever|Article]]
10881 !! end
10882
10883 !! test
10884 pre-save transform: context links ("pipe trick") with namespace, comma and parens
10885 !! options
10886 pst title=[[Ns:Somearticle, Context (context)]]
10887 !! wikitext
10888 [[|Article]]
10889 !! html
10890 [[Ns:Article (context)|Article]]
10891 !! end
10892
10893 !! test
10894 pre-save transform: context links ("pipe trick") with namespace, parens and comma
10895 !! options
10896 pst title=[[Ns:Somearticle (IGNORED), 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 full-width parens and no space (Japanese and Chinese style, bug 30149)
10905 !! options
10906 pst
10907 !! wikitext
10908 [[Article(context)|]]
10909 [[Bar:Article(context)|]]
10910 [[:Bar:Article(context)|]]
10911 [[|Article(context)]]
10912 [[Bar:X(Y)Z|]]
10913 [[:Bar:X(Y)Z|]]
10914 !! html
10915 [[Article(context)|Article]]
10916 [[Bar:Article(context)|Article]]
10917 [[:Bar:Article(context)|Article]]
10918 [[Article(context)]]
10919 [[Bar:X(Y)Z|X(Y)Z]]
10920 [[:Bar:X(Y)Z|X(Y)Z]]
10921 !! end
10922
10923 !! test
10924 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
10925 !! options
10926 pst
10927 !! wikitext
10928 [[Article (context)|]]
10929 [[Bar:Article (context)|]]
10930 [[:Bar:Article (context)|]]
10931 [[|Article (context)]]
10932 [[Bar:X (Y) Z|]]
10933 [[:Bar:X (Y) Z|]]
10934 !! html
10935 [[Article (context)|Article]]
10936 [[Bar:Article (context)|Article]]
10937 [[:Bar:Article (context)|Article]]
10938 [[Article (context)]]
10939 [[Bar:X (Y) Z|X (Y) Z]]
10940 [[:Bar:X (Y) Z|X (Y) Z]]
10941 !! end
10942
10943 !! test
10944 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
10945 !! options
10946 pst
10947 !! wikitext
10948 [[Article(context)|]]
10949 [[Bar:Article(context)|]]
10950 [[:Bar:Article(context)|]]
10951 [[|Article(context)]]
10952 [[Bar:X(Y)Z|]]
10953 [[:Bar:X(Y)Z|]]
10954 !! html
10955 [[Article(context)|Article]]
10956 [[Bar:Article(context)|Article]]
10957 [[:Bar:Article(context)|Article]]
10958 [[Article(context)]]
10959 [[Bar:X(Y)Z|X(Y)Z]]
10960 [[:Bar:X(Y)Z|X(Y)Z]]
10961 !! end
10962
10963 !! test
10964 pre-save transform: context links ("pipe trick") with commas (bug 21660)
10965 !! options
10966 pst
10967 !! wikitext
10968 [[Article (context), context|]]
10969 [[Article (context),context|]]
10970 [[Bar:Article (context), context|]]
10971 [[Bar:Article (context),context|]]
10972 [[:Bar:Article (context), context|]]
10973 [[:Bar:Article (context),context|]]
10974 !! html
10975 [[Article (context), context|Article]]
10976 [[Article (context),context|Article]]
10977 [[Bar:Article (context), context|Article]]
10978 [[Bar:Article (context),context|Article]]
10979 [[:Bar:Article (context), context|Article]]
10980 [[:Bar:Article (context),context|Article]]
10981 !! end
10982
10983 !! test
10984 pre-save transform: trim trailing empty lines
10985 !! options
10986 pst
10987 !! wikitext
10988 Empty lines are trimmed
10989
10990
10991
10992
10993 !! html
10994 Empty lines are trimmed
10995 !! end
10996
10997 !! test
10998 pre-save transform: Signature expansion
10999 !! options
11000 pst
11001 !! wikitext
11002 * ~~~
11003 * <noinclude>~~~</noinclude>
11004 * <includeonly>~~~</includeonly>
11005 * <onlyinclude>~~~</onlyinclude>
11006 !! html
11007 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
11008 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
11009 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
11010 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
11011 !! end
11012
11013
11014 !! test
11015 pre-save transform: Signature expansion in nowiki tags (bug 93)
11016 !! options
11017 pst disabled
11018 !! wikitext
11019 Shall not expand:
11020
11021 <nowiki>~~~~</nowiki>
11022
11023 <includeonly><nowiki>~~~~</nowiki></includeonly>
11024
11025 <noinclude><nowiki>~~~~</nowiki></noinclude>
11026
11027 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11028
11029 {{subst:Foo}} shall be converted to FOO
11030
11031 As well as inside noinclude/onlyinclude
11032 <noinclude>{{subst:Foo}}</noinclude>
11033 <onlyinclude>{{subst:Foo}}</onlyinclude>
11034
11035 But not inside includeonly
11036 <includeonly>{{subst:Foo}}</includeonly>
11037 !! html
11038 Shall not expand:
11039
11040 <nowiki>~~~~</nowiki>
11041
11042 <includeonly><nowiki>~~~~</nowiki></includeonly>
11043
11044 <noinclude><nowiki>~~~~</nowiki></noinclude>
11045
11046 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11047
11048 FOO shall be converted to FOO
11049
11050 As well as inside noinclude/onlyinclude
11051 <noinclude>FOO</noinclude>
11052 <onlyinclude>FOO</onlyinclude>
11053
11054 But not inside includeonly
11055 <includeonly>{{subst:Foo}}</includeonly>
11056 !! end
11057
11058 !! test
11059 Parsoid: Recognize nowiki with trailing space in tags
11060 !! options
11061 parsoid=wt2html
11062 !! wikitext
11063 <nowiki ><div>[[foo]]</nowiki >
11064
11065 a<nowiki / >b
11066
11067 c<nowiki />d
11068
11069 e<nowiki/ >f
11070 !! html
11071 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11072 <p>ab</p>
11073 <p>cd</p>
11074 <p>ef</p>
11075 !! end
11076
11077 !! test
11078 Parsoid: Recognize nowiki with odd capitalization
11079 !! options
11080 parsoid=wt2html
11081 !! wikitext
11082 <noWikI ><div>[[foo]]</Nowiki >
11083 !! html
11084 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11085 !! end
11086
11087
11088 !! test
11089 Parsoid: Escape nowiki with trailing space in tags
11090 !! options
11091 parsoid=html2wt
11092 !! wikitext
11093 &lt;nowiki &gt; foo &lt;/nowiki &gt;
11094
11095 a&lt;nowiki /&gt;b
11096
11097 c&lt;nowiki/ &gt;d
11098 !! html
11099 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
11100 <p>a&lt;nowiki /&gt;b</p>
11101 <p>c&lt;nowiki/ &gt;d</p>
11102 !! end
11103
11104 !! test
11105 Parsoid: Escape weird noWikI capitalizations
11106 !! options
11107 parsoid=html2wt
11108 !! wikitext
11109 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
11110 !! html
11111 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
11112 !! end
11113
11114 ###
11115 ### Message transform tests
11116 ###
11117 !! test
11118 message transform: magic variables
11119 !! options
11120 msg
11121 !! wikitext
11122 {{SITENAME}}
11123 !! html
11124 MediaWiki
11125 !! end
11126
11127 !! test
11128 message transform: should not transform wiki markup
11129 !! options
11130 msg
11131 !! wikitext
11132 ''test''
11133 !! html
11134 ''test''
11135 !! end
11136
11137 !! test
11138 message transform: <noinclude> in transcluded template (bug 4926)
11139 !! options
11140 msg
11141 !! wikitext
11142 {{Includes}}
11143 !! html
11144 Foobar
11145 !! end
11146
11147 !! test
11148 message transform: <onlyinclude> in transcluded template (bug 4926)
11149 !! options
11150 msg
11151 !! wikitext
11152 {{Includes2}}
11153 !! html
11154 Foo
11155 !! end
11156
11157 !! test
11158 {{#special:}} page name, known
11159 !! options
11160 msg
11161 !! wikitext
11162 {{#special:Recentchanges}}
11163 !! html
11164 Special:RecentChanges
11165 !! end
11166
11167 !! test
11168 {{#special:}} page name with subpage, known
11169 !! options
11170 msg
11171 !! wikitext
11172 {{#special:Recentchanges/param}}
11173 !! html
11174 Special:RecentChanges/param
11175 !! end
11176
11177 !! test
11178 {{#special:}} page name, unknown
11179 !! options
11180 msg
11181 !! wikitext
11182 {{#special:foobar nonexistent}}
11183 !! html
11184 Special:Foobar nonexistent
11185 !! end
11186
11187 !! test
11188 {{#speciale:}} page name, known
11189 !! options
11190 msg
11191 !! wikitext
11192 {{#speciale:Recentchanges}}
11193 !! html
11194 Special:RecentChanges
11195 !! end
11196
11197 !! test
11198 {{#speciale:}} page name with subpage, known
11199 !! options
11200 msg
11201 !! wikitext
11202 {{#speciale:Recentchanges/param}}
11203 !! html
11204 Special:RecentChanges/param
11205 !! end
11206
11207 !! test
11208 {{#speciale:}} page name, unknown
11209 !! options
11210 msg
11211 !! wikitext
11212 {{#speciale:foobar nonexistent}}
11213 !! html
11214 Special:Foobar_nonexistent
11215 !! end
11216
11217 ###
11218 ### Images
11219 ###
11220 ### For Parsoid-specific tests, see
11221 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11222
11223 !! test
11224 Simple image
11225 !! options
11226 parsoid=wt2html,wt2wt,html2html
11227 !! wikitext
11228 [[Image:foobar.jpg]]
11229 !! html/php
11230 <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>
11231 </p>
11232 !! html/parsoid
11233 <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>
11234 !! end
11235
11236 !! test
11237 Simple image (using File: namespace, now canonical)
11238 !! wikitext
11239 [[File:Foobar.jpg]]
11240 !! html/php
11241 <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>
11242 </p>
11243 !! html/parsoid
11244 <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>
11245 !! end
11246
11247 !! test
11248 Right-aligned image
11249 !! wikitext
11250 [[File:Foobar.jpg|right]]
11251 !! html/php
11252 <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>
11253
11254 !! html/parsoid
11255 <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>
11256 !! end
11257
11258 !! test
11259 Image with caption
11260 !! wikitext
11261 [[File:Foobar.jpg|right|Caption text]]
11262 !! html/php
11263 <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>
11264
11265 !! html/parsoid
11266 <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>
11267 !! end
11268
11269 !! test
11270 Image with caption, bug 53312 #1
11271 !! wikitext
11272 [[File:Foobar.jpg|right|Caption page stuff]]
11273 !! html/php
11274 <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>
11275
11276 !! html/parsoid
11277 <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>
11278 !! end
11279
11280 !! test
11281 Image with caption, bug 53312 #2
11282 !! wikitext
11283 [[File:Foobar.jpg|right|Caption page=]]
11284 !! html/php
11285 <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>
11286
11287 !! html/parsoid
11288 <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>
11289 !! end
11290
11291 !! test
11292 Image with caption, bug 53312 #3
11293 !! wikitext
11294 [[File:Foobar.jpg|right|Caption page=stuff]]
11295 !! html/php
11296 <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>
11297
11298 !! html/parsoid
11299 <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>
11300 !! end
11301
11302 !! test
11303 Allow empty links in image captions (Bug 60753)
11304 !! options
11305 thumbsize=220
11306 !! wikitext
11307 [[File:Foobar.jpg|thumb|Caption [[Link1]]
11308 [[]]
11309 [[Link2]]
11310 ]]
11311 !! html/php
11312 <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>
11313
11314 !! html/parsoid
11315 <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>
11316 [[]]
11317 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
11318 </figcaption></figure>
11319 !! end
11320
11321 !! test
11322 Titles in unlinked images (T23454)
11323 !! wikitext
11324 [[File:Foobar.jpg|link=|stuff]]
11325 !! html/php
11326 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
11327 </p>
11328 !! end
11329
11330 !! test
11331 Link with empty target
11332 !! wikitext
11333 [[]]
11334 !! html
11335 <p>[[]]
11336 </p>
11337 !! end
11338
11339 !! test
11340 Image with empty attribute
11341 !! options
11342 parsoid=wt2html,wt2wt,html2html
11343 !! wikitext
11344 [[File:Foobar.jpg|right||Caption text]]
11345 !! html/php
11346 <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>
11347
11348 !! html/parsoid
11349 <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>
11350 !! end
11351
11352 !! test
11353 1. Block image with individual attributes from templates
11354 !! wikitext
11355 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
11356 !! html/php
11357 <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>
11358
11359 !! html/parsoid
11360 <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>
11361 !! end
11362
11363 !! test
11364 2. Block Image with individual attributes from templates
11365 !! wikitext
11366 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
11367 !! html/php
11368 <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>
11369
11370 !! html/parsoid
11371 <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>
11372 !! end
11373
11374 !! test
11375 3. Inline image with individual attributes from templates
11376 !! wikitext
11377 [[File:Foobar.jpg|{{echo|50px}}]]
11378 !! html/php
11379 <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>
11380 </p>
11381 !! html/parsoid
11382 <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>
11383 !! end
11384
11385 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
11386 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
11387 !! test
11388 Image with multiple attributes from the same template
11389 !! wikitext
11390 [[File:Foobar.jpg|{{image_attribs}}]]
11391 !! html/php
11392 <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>
11393
11394 !! html/parsoid
11395 <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>
11396 !! end
11397
11398 !! test
11399 Image with link tails
11400 !! options
11401 thumbsize=220
11402 !! wikitext
11403 123[[File:Foobar.jpg]]456
11404 123[[File:Foobar.jpg|right]]456
11405 123[[File:Foobar.jpg|thumb]]456
11406 !! html/php
11407 <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
11408 </p>
11409 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
11410 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
11411
11412 !! html/php+tidy
11413 <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>
11414 <p>123</p>
11415 <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>
11416 <p>456 123</p>
11417 <div class="thumb tright">
11418 <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>
11419 <div class="thumbcaption">
11420 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11421 </div>
11422 </div>
11423 </div>
11424 <p>456</p>
11425 !! html/parsoid
11426 <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>
11427 <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>
11428 <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>
11429 !! end
11430
11431 !! test
11432 Image with multiple captions -- only last one is accepted
11433 !! wikitext
11434 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11435 !! html/php
11436 <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>
11437
11438 !! html/parsoid
11439 <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>
11440 !! end
11441
11442 !! test
11443 Image with multiple widths -- use last
11444 !! wikitext
11445 [[File:Foobar.jpg|200px|300px|caption]]
11446 !! html/php
11447 <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>
11448 </p>
11449 !! html/parsoid
11450 <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>
11451 !! end
11452
11453 !! test
11454 Image with multiple alignments -- use first (bug 48664)
11455 !! options
11456 thumbsize=220
11457 !! wikitext
11458 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11459
11460 [[File:Foobar.jpg|middle|text-top|caption]]
11461 !! html/php
11462 <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>
11463 <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>
11464 </p>
11465 !! html/parsoid
11466 <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>
11467 <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>
11468 !! end
11469
11470 !! test
11471 Image with width attribute at different positions
11472 !! wikitext
11473 [[File:Foobar.jpg|200px|right|Caption]]
11474 [[File:Foobar.jpg|right|200px|Caption]]
11475 [[File:Foobar.jpg|right|Caption|200px]]
11476 !! html/php
11477 <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>
11478 <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>
11479 <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>
11480
11481 !! html/parsoid
11482 <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>
11483 <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>
11484 <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>
11485 !! end
11486
11487 # a sad bit of backward-compatibility
11488 !! test
11489 Image with size specified with pxpx (bug 13500, 51628)
11490 !! options
11491 parsoid=wt2html,wt2wt,html2html
11492 !! wikitext
11493 [[File:Foobar.jpg|20pxpx]]
11494 [[File:Foobar.jpg|200x20pxpx]]
11495 !! html/php
11496 <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>
11497 <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>
11498 </p>
11499 !! html/parsoid
11500 <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>
11501 !! end
11502
11503 !! test
11504 Image with link parameter, wiki target
11505 !! wikitext
11506 [[File:Foobar.jpg|link=Main Page]]
11507 !! html/php
11508 <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>
11509 </p>
11510 !! html/parsoid
11511 <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>
11512 !! end
11513
11514 # parsoid bug 49293 (part 1)
11515 !! test
11516 Image with link parameter, URL target
11517 !! wikitext
11518 [[File:Foobar.jpg|link=http://example.com/]]
11519 !! html/php
11520 <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>
11521 </p>
11522 !! html/parsoid
11523 <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>
11524 !! end
11525
11526 # parsoid bug 49293 (part 2)
11527 !! test
11528 Image with link parameter, protocol-less URL target
11529 !! wikitext
11530 [[File:Foobar.jpg|link=//example.com/]]
11531 !! html/php
11532 <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>
11533 </p>
11534 !! html/parsoid
11535 <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>
11536 !! end
11537
11538 !! test
11539 Image with link parameter, wgExternalLinkTarget
11540 !! wikitext
11541 [[Image:foobar.jpg|link=http://example.com/]]
11542 !! config
11543 wgExternalLinkTarget='foobar'
11544 !! html
11545 <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>
11546 </p>
11547 !! end
11548
11549 !! test
11550 Image with link parameter, wgNoFollowLinks set to false
11551 !! wikitext
11552 [[Image:foobar.jpg|link=http://example.com/]]
11553 !! config
11554 wgNoFollowLinks=false
11555 !! html
11556 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11557 </p>
11558 !! end
11559
11560 !! test
11561 Image with link parameter, wgNoFollowDomainExceptions
11562 !! wikitext
11563 [[Image:foobar.jpg|link=http://example.com/]]
11564 !! config
11565 wgNoFollowDomainExceptions='example.com'
11566 !! html
11567 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11568 </p>
11569 !! end
11570
11571 !! test
11572 Image with link parameter, wgExternalLinkTarget, unnamed parameter
11573 !! wikitext
11574 [[Image:foobar.jpg|link=http://example.com/|Title]]
11575 !! config
11576 wgExternalLinkTarget='foobar'
11577 !! html
11578 <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>
11579 </p>
11580 !! end
11581
11582 !! test
11583 Image with empty link parameter
11584 !! wikitext
11585 [[File:Foobar.jpg|link=]]
11586 !! html/php
11587 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
11588 </p>
11589 !! html/parsoid
11590 <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>
11591 !! end
11592
11593 !! test
11594 Image with link parameter (wiki target) and unnamed parameter
11595 !! wikitext
11596 [[File:Foobar.jpg|link=Main_Page|Title]]
11597 !! html/php
11598 <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>
11599 </p>
11600 !! html/parsoid
11601 <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>
11602 !! end
11603
11604 !! test
11605 Image with link parameter (URL target) and unnamed parameter
11606 !! wikitext
11607 [[File:Foobar.jpg|link=http://example.com/|Title]]
11608 !! html/php
11609 <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>
11610 </p>
11611 !! html/parsoid
11612 <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>
11613 !! end
11614
11615 !! test
11616 Thumbnail image with link parameter
11617 !! options
11618 thumbsize=220
11619 parsoid=wt2html,wt2wt,html2html
11620 !! wikitext
11621 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
11622 !! html/php
11623 <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>
11624
11625 !! html/parsoid
11626 <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>
11627 !! end
11628
11629 !! test
11630 Manually-specified thumbnail image
11631 !! options
11632 thumbsize=220
11633 !! wikitext
11634 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
11635 !! html/php
11636 <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>
11637
11638 !! html/parsoid
11639 <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>
11640 !! end
11641
11642 !! test
11643 Manually-specified thumbnail image with explicit link to wiki page
11644 !! options
11645 thumbsize=220
11646 parsoid=wt2html,wt2wt,html2html
11647 !! wikitext
11648 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
11649 !! html/php
11650 <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>
11651
11652 !! html/parsoid
11653 <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>
11654 !! end
11655
11656 !! test
11657 Manually-specified thumbnail image with explicit link to url
11658 !! options
11659 thumbsize=220
11660 parsoid=wt2html,wt2wt,html2html
11661 !! wikitext
11662 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
11663 !! html/php
11664 <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>
11665
11666 !! html/parsoid
11667 <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>
11668 !! end
11669
11670 !! test
11671 Manually-specified thumbnail image with explicit no link
11672 !! options
11673 thumbsize=220
11674 parsoid=wt2html,wt2wt,html2html
11675 !! wikitext
11676 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
11677 !! html/php
11678 <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>
11679
11680 !! html/parsoid
11681 <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>
11682 !! end
11683
11684 !! test
11685 Manually-specified thumbnail image with explicit link and alt text
11686 !! options
11687 thumbsize=220
11688 parsoid=wt2html,wt2wt,html2html
11689 !! wikitext
11690 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
11691 !! html/php
11692 <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>
11693
11694 !! html/parsoid
11695 <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>
11696 !! end
11697
11698 !! test
11699 Image with frame and link
11700 !! options
11701 parsoid=wt2html,wt2wt,html2html
11702 !! wikitext
11703 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
11704 !! html/php
11705 <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>
11706
11707 !! html/parsoid
11708 <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>
11709 !! end
11710
11711 !! test
11712 Image with frame and link and explicit alt
11713 !! options
11714 parsoid=wt2html,wt2wt,html2html
11715 !! wikitext
11716 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
11717 !! html/php
11718 <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>
11719
11720 !! html/parsoid
11721 <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>
11722 !! end
11723
11724 !! test
11725 Image with wiki markup in implicit alt
11726 !! options
11727 parsoid=wt2html,wt2wt,html2html
11728 !! wikitext
11729 [[Image:Foobar.jpg|testing '''bold''' in alt]]
11730
11731 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
11732 !! html/php
11733 <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>
11734 </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>
11735 </p>
11736 !! html/parsoid
11737 <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>
11738 <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>
11739 !! end
11740
11741 ###################
11742 # Conflicting image format options.
11743 # First option specified should 'win'.
11744 # All three cases in each test should be identical.
11745
11746 !! test
11747 Image with 'frameless' first.
11748 !! options
11749 parsoid=wt2html,wt2wt,html2html
11750 !! wikitext
11751 [[File:Foobar.jpg|frameless|caption]]
11752
11753 [[File:Foobar.jpg|frameless|frame|caption]]
11754
11755 [[File:Foobar.jpg|frameless|thumb|caption]]
11756 !! html/php
11757 <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>
11758 </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>
11759 </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>
11760 </p>
11761 !! html/parsoid
11762 <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>
11763 <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>
11764 <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>
11765 !! end
11766
11767 !! test
11768 Image with 'frame' first.
11769 !! options
11770 parsoid=wt2html,wt2wt,html2html
11771 !! wikitext
11772 [[File:Foobar.jpg|frame|caption]]
11773 [[File:Foobar.jpg|frame|frameless|caption]]
11774 [[File:Foobar.jpg|frame|thumb|caption]]
11775 !! html/php
11776 <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>
11777 <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>
11778 <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>
11779
11780 !! html/parsoid
11781 <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>
11782 <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>
11783 <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>
11784 !! end
11785
11786 !! test
11787 Image with 'thumb' first.
11788 !! options
11789 parsoid=wt2html,wt2wt,html2html
11790 !! wikitext
11791 [[File:Foobar.jpg|thumb|caption]]
11792 [[File:Foobar.jpg|thumb|frameless|caption]]
11793 [[File:Foobar.jpg|thumb|frame|caption]]
11794 !! html/php
11795 <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>
11796 <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>
11797 <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>
11798
11799 !! html/parsoid
11800 <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>
11801 <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>
11802 <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>
11803 !! end
11804
11805 ###################
11806 # Image sizing.
11807 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
11808 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
11809 # Foobar has actual size of 1941x220
11810 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
11811 # a scalable format.
11812 # 2. Framed images always ignore size options; always render at default size.
11813 # 3. "Unspecified format" and border are the only types which can be
11814 # enlarged.
11815
11816 !! test
11817 Image: "unspecified format" and border enlarge
11818 !! options
11819 parsoid=wt2html,wt2wt,html2html
11820 !! wikitext
11821 [[File:Foobar.jpg|2000px]]
11822
11823 [[File:Foobar.jpg|border|2000px]]
11824 !! html/php
11825 <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>
11826 </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>
11827 </p>
11828 !! html/parsoid
11829 <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>
11830 <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>
11831 !! end
11832
11833 !! test
11834 Image: "unspecified format" and border reduce
11835 !! options
11836 parsoid=wt2html,wt2wt,html2html
11837 !! wikitext
11838 [[File:Foobar.jpg|1000px]]
11839
11840 [[File:Foobar.jpg|border|1000px]]
11841 !! html/php
11842 <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>
11843 </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>
11844 </p>
11845 !! html/parsoid
11846 <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>
11847 <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>
11848 !! end
11849
11850 !! test
11851 Image: thumbs reduce
11852 !! options
11853 parsoid=wt2html,wt2wt,html2html
11854 !! wikitext
11855 [[File:Foobar.jpg|thumb|50px]]
11856 !! html/php
11857 <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>
11858
11859 !! html/parsoid
11860 <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>
11861 !! end
11862
11863 !! test
11864 Image: bitmap thumbs can't be enlarged past original size, but vector can.
11865 !! options
11866 parsoid=wt2html,wt2wt,html2html
11867 !! wikitext
11868 [[File:Foobar.jpg|thumb|2000px]]
11869
11870 [[File:Foobar.svg|thumb|2000px]]
11871 !! html/php
11872 <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>
11873 <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>
11874
11875 !! html/parsoid
11876 <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>
11877 <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>
11878 !! end
11879
11880 !! test
11881 Image: frameless can reduce in size
11882 !! options
11883 parsoid=wt2html,wt2wt,html2html
11884 !! wikitext
11885 [[File:Foobar.jpg|frameless|50px]]
11886 !! html/php
11887 <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>
11888 </p>
11889 !! html/parsoid
11890 <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>
11891 !! end
11892
11893 !! test
11894 Image: bitmap frameless can't be enlarged past original size, but vector can
11895 !! options
11896 parsoid=wt2html,wt2wt,html2html
11897 !! wikitext
11898 [[File:Foobar.jpg|frameless|2000px]]
11899
11900 [[File:Foobar.svg|frameless|2000px]]
11901 !! html/php
11902 <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>
11903 </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>
11904 </p>
11905 !! html/parsoid
11906 <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>
11907 <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>
11908 !! end
11909
11910 !! test
11911 Image: framed images are always unscaled.
11912 !! options
11913 parsoid=wt2html,wt2wt,html2html
11914 !! wikitext
11915 [[File:Foobar.jpg|frame]]
11916
11917 [[File:Foobar.jpg|frame|50px]]
11918
11919 [[File:Foobar.jpg|frame|50x50px]]
11920
11921 [[File:Foobar.jpg|frame|2000px]]
11922 !! html/php
11923 <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>
11924 <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>
11925 <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>
11926 <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>
11927
11928 !! html/parsoid
11929 <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>
11930 <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>
11931 <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>
11932 <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>
11933 !! end
11934
11935 ###################
11936
11937 !! test
11938 Link to image page- image page normally doesn't exists, hence edit link
11939 Add test with existing image page
11940 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
11941 !! wikitext
11942 [[:Image:test]]
11943 !! html
11944 <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>
11945 </p>
11946 !! end
11947
11948 !! test
11949 bug 18784 Link to non-existent image page with caption should use caption as link text
11950 !! wikitext
11951 [[:Image:test|caption]]
11952 !! html
11953 <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>
11954 </p>
11955 !! end
11956
11957 !! test
11958 Frameless image caption with a free URL
11959 !! wikitext
11960 [[File:Foobar.jpg|http://example.com]]
11961 !! html/php
11962 <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>
11963 </p>
11964 !! html/parsoid
11965 <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>
11966 !! end
11967
11968 !! test
11969 Thumbnail image caption with a free URL
11970 !! options
11971 thumbsize=220
11972 !! wikitext
11973 [[File:Foobar.jpg|thumb|http://example.com]]
11974 !! html/php
11975 <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>
11976
11977 !! html/parsoid
11978 <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>
11979 !! end
11980
11981 !! test
11982 Thumbnail image caption with a free URL and explicit alt
11983 !! options
11984 thumbsize=220
11985 parsoid=wt2html,wt2wt,html2html
11986 !! wikitext
11987 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
11988 !! html/php
11989 <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>
11990
11991 !! html/parsoid
11992 <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>
11993 !! end
11994
11995 !! test
11996 SVG thumbnails with no language set
11997 !! options
11998 !! wikitext
11999 [[File:Foobar.svg|thumb|caption]]
12000 !! html/php
12001 <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>
12002
12003 !! html/parsoid
12004 <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>
12005 !! end
12006
12007 !! test
12008 SVG thumbnails with language de
12009 !! options
12010 parsoid=wt2html,wt2wt,html2html
12011 !! wikitext
12012 [[File:Foobar.svg|thumb|caption|lang=de]]
12013 !! html/php
12014 <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>
12015
12016 !! html/parsoid
12017 <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>
12018 !! end
12019
12020 !! test
12021 SVG thumbnails with invalid language code
12022 !! options
12023 parsoid=wt2html,wt2wt,html2html
12024 !! wikitext
12025 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
12026 !! html/php
12027 <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>
12028
12029 !! html/parsoid
12030 <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>
12031 !! end
12032
12033 !! test
12034 BUG 1887: A ISBN with a thumbnail
12035 !! wikitext
12036 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
12037 !! html/php
12038 <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>
12039
12040 !! html/parsoid
12041 <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>
12042 !! end
12043
12044 !! test
12045 BUG 1887: A RFC with a thumbnail
12046 !! wikitext
12047 [[File:Foobar.jpg|thumb|This is RFC 12354]]
12048 !! html/php
12049 <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>
12050
12051 !! html/parsoid
12052 <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>
12053 !! end
12054
12055 !! test
12056 BUG 1887: A mailto link with a thumbnail
12057 !! wikitext
12058 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
12059 !! html/php
12060 <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>
12061
12062 !! html/parsoid
12063 <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>
12064 !! end
12065
12066 # Pending resolution to bug 368
12067 !! test
12068 BUG 648: Frameless image caption with a link
12069 !! wikitext
12070 [[File:Foobar.jpg|text with a [[link]] in it]]
12071 !! html/php
12072 <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>
12073 </p>
12074 !! html/parsoid
12075 <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>
12076 !! end
12077
12078 !! test
12079 BUG 648: Frameless image caption with a link (suffix)
12080 !! wikitext
12081 [[File:Foobar.jpg|text with a [[link]]foo in it]]
12082 !! html/php
12083 <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>
12084 </p>
12085 !! html/parsoid
12086 <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>
12087 !! end
12088
12089 !! test
12090 BUG 648: Frameless image caption with an interwiki link
12091 !! wikitext
12092 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
12093 !! html/php
12094 <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>
12095 </p>
12096 !! html/parsoid
12097 <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>
12098 !! end
12099
12100 !! test
12101 BUG 648: Frameless image caption with a piped interwiki link
12102 !! wikitext
12103 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
12104 !! html/php
12105 <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>
12106 </p>
12107 !! html/parsoid
12108 <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>
12109 !! end
12110
12111 !! test
12112 Escape HTML special chars in image alt text
12113 !! wikitext
12114 [[File:Foobar.jpg|& < > "]]
12115 !! html/php
12116 <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>
12117 </p>
12118 !! html/parsoid
12119 <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>
12120 !! end
12121
12122 !! test
12123 BUG 499: Alt text should have &#1234;, not &amp;1234;
12124 !! wikitext
12125 [[File:Foobar.jpg|&#9792;]]
12126 !! html/php
12127 <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>
12128 </p>
12129 !! html/parsoid
12130 <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>
12131 !! end
12132
12133 !! test
12134 Broken image caption with link
12135 !! options
12136 parsoid=wt2html,wt2wt,html2html
12137 !! wikitext
12138 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
12139 !! html/php
12140 <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.
12141 </p>
12142 !! html/parsoid
12143 <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>
12144 !! end
12145
12146 !! test
12147 Image caption containing another image
12148 !! wikitext
12149 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
12150 !! html/php
12151 <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>
12152
12153 !! html/parsoid
12154 <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>
12155 !! end
12156
12157 !! test
12158 Image: caption containing a newline
12159 !! wikitext
12160 [[File:Foobar.jpg|This
12161 *is some text]]
12162 !! html/php
12163 <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>
12164 </p>
12165 !! html/parsoid
12166 <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>
12167 !!end
12168
12169 !!test
12170 Image: caption containing leading space
12171 (The leading space should not trigger nowiki escaping in wt2wt mode)
12172 !! wikitext
12173 [[File:Foobar.jpg|thumb| bar]]
12174 !! html/php
12175 <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>
12176
12177 !! html/parsoid
12178 <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>
12179 !!end
12180
12181 !! test
12182 Image: caption containing a table
12183 !! options
12184 parsoid=wt2html,wt2wt,html2html
12185 !! wikitext
12186 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
12187 {|
12188 ! Foo !! Bar
12189 |-
12190 | Foo1 || Bar1
12191 |}
12192 and some more text.]]
12193 !! html/php
12194 <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>
12195
12196 !! html/parsoid
12197 <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
12198 <table>
12199 <tbody>
12200 <tr><th>Foo </th><th>Bar</th></tr>
12201 <tr>
12202 <td>Foo1 </td>
12203 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
12204 !! end
12205
12206 !! test
12207 Bug 3090: External links other than http: in image captions
12208 !! wikitext
12209 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
12210 !! html/php
12211 <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>
12212
12213 !! html/parsoid
12214 <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>
12215 !! end
12216
12217 !! test
12218 Custom class
12219 !! options
12220 parsoid=wt2html,wt2wt,html2html
12221 !! wikitext
12222 [[Image:foobar.jpg|a|class=b]]
12223 !! html/php
12224 <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>
12225 </p>
12226 !! html/parsoid
12227 <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>
12228 !! end
12229
12230 !! test
12231 Localized image handling (1).
12232 !! options
12233 parsoid=wt2html,wt2wt,html2html
12234 language=es
12235 !! wikitext
12236 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
12237 !! html/php
12238 <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>
12239
12240 !! html/parsoid
12241 <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>
12242 !! end
12243
12244 !! test
12245 Localized image handling (2).
12246 !! options
12247 thumbsize=220
12248 parsoid=wt2html,wt2wt,html2html
12249 language=es
12250 !! wikitext
12251 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
12252 !! html/php
12253 <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>
12254
12255 !! html/parsoid
12256 <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>
12257 !! end
12258
12259 !! test
12260 "border", "frameless" and "class" attributes on an image.
12261 !! options
12262 thumbsize=220
12263 parsoid=wt2html,wt2wt,html2html
12264 !! wikitext
12265 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
12266 !! html/php
12267 <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>
12268 </p>
12269 !! html/parsoid
12270 <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>
12271 !! end
12272
12273 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
12274 !! test
12275 Invalid image attributes (bug 62500)
12276 !! options
12277 thumbsize=220
12278 parsoid=wt2html,wt2wt,html2html
12279 !! wikitext
12280 [[File:Foobar.jpg|thumb|float|left|caption]]
12281
12282 [[File:Foobar.jpg|thumb|righ|caption]]
12283
12284 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
12285 !! html/php
12286 <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>
12287 <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>
12288 <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>
12289
12290 !! html/parsoid
12291 <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>
12292 <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>
12293 <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>
12294 !! end
12295
12296 !! article
12297 File:Barfoo.jpg
12298 !! text
12299 #REDIRECT [[File:Barfoo.jpg]]
12300 !! endarticle
12301
12302 # FIXME: Parsoid should run this test -- but we'd need to teach the
12303 # mockAPI about the redirected Barfoo.jpg image.
12304 !! test
12305 Redirected image
12306 !! wikitext
12307 [[Image:Barfoo.jpg]]
12308 !! html/php
12309 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
12310 </p>
12311 !! end
12312
12313 !! test
12314 Missing image with uploads disabled
12315 !! options
12316 wgEnableUploads=0
12317 !! wikitext
12318 [[File:Foobaz.jpg]]
12319 !! html/php
12320 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
12321 </p>
12322 !! html/parsoid
12323 <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>
12324 !! end
12325
12326 # Parsoid-specific testing for images
12327 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12328 # Currently imperfect due to a flaw in the Parsoid testrunner
12329 # Work in progress
12330 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
12331 # image tests.
12332
12333 !! test
12334 Parsoid-specific image handling - simple image with size and middle alignment
12335 !! wikitext
12336 [[File:Foobar.jpg|middle|50px]]
12337 !! html/parsoid
12338 <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>
12339 !! end
12340
12341 !! test
12342 Parsoid-specific image handling - simple image with size, middle alignment,
12343 non-standard namespace alias
12344 !! options
12345 parsoid=wt2wt,wt2html,html2html
12346 !! wikitext
12347 [[Image:Foobar.jpg|middle|50px]]
12348 !! html/parsoid
12349 <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>
12350 !! end
12351
12352 !! test
12353 Parsoid-specific image handling - simple image with size and middle alignment
12354 (existing content)
12355 !! wikitext
12356 [[File:Foobar.jpg|50px|middle]]
12357 !! html/parsoid
12358 <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>
12359 !! end
12360
12361 !! test
12362 Parsoid-specific image handling - simple image with size and middle alignment
12363 and non-standard namespace name
12364 !! options
12365 parsoid=wt2html,wt2wt,html2html
12366 !! wikitext
12367 [[Image:Foobar.jpg|50px|middle]]
12368 !! html/parsoid
12369 <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>
12370 !! end
12371
12372 !! test
12373 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
12374 !! wikitext
12375 [[File:Foobar.jpg|500x10px|baseline|caption]]
12376 !! html/parsoid
12377 <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>
12378 !! end
12379
12380 !! test
12381 Parsoid-specific image handling - simple image with border and size spec
12382 !! wikitext
12383 [[File:Foobar.jpg|50px|border|caption]]
12384 !! html/parsoid
12385 <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>
12386 !! end
12387
12388 !! test
12389 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12390 !! wikitext
12391 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
12392 !! html/parsoid
12393 <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>
12394 !! end
12395
12396 !! test
12397 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12398 (existing content)
12399 !! wikitext
12400 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12401 !! html/parsoid
12402 <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>
12403 !! end
12404
12405 !! test
12406 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12407 !! wikitext
12408 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12409 !! html/parsoid
12410 <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>
12411 !! end
12412
12413 !! test
12414 Parsoid-specific image handling - thumbnail with specific size, halign,
12415 valign, and caption (existing content)
12416 !! wikitext
12417 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12418 !! html/parsoid
12419 <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>
12420 !! end
12421
12422 !! test
12423 Parsoid-specific image handling - framed image with specific size and caption
12424 (size is ignored)
12425 !! options
12426 parsoid=wt2html,wt2wt,html2html
12427 !! wikitext
12428 [[File:Foobar.jpg|frame|500x50px|caption]]
12429 !! html/parsoid
12430 <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>
12431 !! end
12432
12433 !! test
12434 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12435 (size is ignored)
12436 !! options
12437 parsoid=wt2html,wt2wt,html2html
12438 !! wikitext
12439 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12440 !! html/parsoid
12441 <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>
12442 !! end
12443
12444 !! test
12445 Parsoid-specific image handling - frameless image with specific size, border, and caption
12446 !! wikitext
12447 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12448 !! html/parsoid
12449 <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>
12450 !! end
12451
12452 !! test
12453 Parsoid-specific image handling - simple image with a formatted caption
12454 !! wikitext
12455 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12456 !! html/parsoid
12457 <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>
12458 !! end
12459
12460 !! test
12461 Parsoid-specific image handling - caption with a template in it
12462 !! wikitext
12463 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12464 !! html/parsoid
12465 <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>
12466 !! end
12467
12468 !! test
12469 Parsoid-specific image handling - caption with unbalanced tags in it
12470 !! options
12471 parsoid=wt2html,wt2wt,html2html
12472 !! wikitext
12473 foo
12474 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12475 bar
12476 !! html/parsoid
12477 <p>foo</p>
12478 <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>
12479 <p>bar</p>
12480 !! end
12481
12482 !! test
12483 Parsoid-specific image handling - empty caption (1)
12484 !! options
12485 parsoid=wt2html,wt2wt
12486 !! wikitext
12487 [[File:Foobar.jpg|thumb|]]
12488 !! html/parsoid
12489 <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>
12490 !! end
12491
12492 # empty captions don't get serialized unless we're in the "round trip" case
12493 !! test
12494 Parsoid-specific image handling - empty caption (2)
12495 !! options
12496 parsoid=html2wt
12497 !! html/parsoid
12498 <figure class="mw-default-size" typeof="mw:Image/Thumb">
12499 <a href="File:Foobar.jpg">
12500 <img resource="./File:Foobar.jpg"
12501 src="//example.com/images/3/3a/Foobar.jpg"
12502 height="25" width="220"/>
12503 </a>
12504 <figcaption></figcaption>
12505 </figure>
12506 !! wikitext
12507 [[File:Foobar.jpg|thumb]]
12508 !! end
12509
12510 !! test
12511 Parsoid-specific image handling - whitespace caption
12512 !! wikitext
12513 [[File:Foobar.jpg|thumb| ]]
12514 !! html/parsoid
12515 <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>
12516 !! end
12517
12518 !! test
12519 Parsoid-specific image handling - lang option
12520 !! wikitext
12521 foo
12522 [[File:Foobar.svg|lang=de|caption]]
12523 bar
12524 !! html/parsoid
12525 <p>foo
12526 <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>
12527 bar</p>
12528 !! end
12529
12530
12531 ###
12532 ### Subpages
12533 ###
12534 !! article
12535 Subpage test/subpage
12536 !! text
12537 foo
12538 !! endarticle
12539
12540 !! test
12541 Subpage link
12542 !! options
12543 subpage title=[[Subpage test]]
12544 !! wikitext
12545 [[/subpage]]
12546 !! html
12547 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
12548 </p>
12549 !! end
12550
12551 !! test
12552 Subpage noslash link
12553 !! options
12554 subpage title=[[Subpage test]]
12555 !! wikitext
12556 [[/subpage/]]
12557 !! html
12558 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
12559 </p>
12560 !! end
12561
12562 !! article
12563 Subpage test/1/2/subpage
12564 !! text
12565 blah
12566 !! endarticle
12567
12568 !! test
12569 Relative subpage noslash link
12570 !! options
12571 parsoid=wt2wt,wt2html,html2html
12572 subpage title=[[Subpage test/1/2/3/4]]
12573 !! wikitext
12574 [[../../subpage/]]
12575
12576 [[../../subpage]]
12577 !! html/php
12578 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
12579 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
12580 </p>
12581 !! html/parsoid
12582 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
12583 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
12584 !! end
12585
12586 !! test
12587 Parsoid: dot-slash prefixed wikilinks
12588 !! wikitext
12589 [[./foo]]
12590
12591 [[././bar]]
12592
12593 [[././baz/]]
12594 !! html/php
12595 <p>[[./foo]]
12596 </p><p>[[././bar]]
12597 </p><p>[[././baz/]]
12598 </p>
12599 !! html/parsoid
12600 <p>[[./foo]]
12601 </p><p>[[././bar]]
12602 </p><p>[[././baz/]]
12603 </p>
12604 !! end
12605
12606 !! test
12607 Render invalid page names as plain text (bug 51090)
12608 !! wikitext
12609 [[./../foo|bar]]
12610 [[foo�|bar]]
12611 [[foo/.|bar]]
12612 [[foo/..|bar]]
12613 [[foo~~~bar]]
12614 [[foo>bar]]
12615 [[foo[bar]]
12616 [[.]]
12617 [[..]]
12618 [[foo././bar]]
12619
12620 [[{{echo|./../foo}}|bar]]
12621 [[{{echo|foo/.}}|bar]]
12622 [[{{echo|foo/..}}|bar]]
12623 [[{{echo|foo~~~~bar}}]]
12624 [[{{echo|foo>bar}}]]
12625 [[{{echo|foo././bar}}]]
12626 [[{{echo|foo{bar}}]]
12627 [[{{echo|foo}bar}}]]
12628 [[{{echo|foo[bar}}]]
12629 [[{{echo|foo]bar}}]]
12630 [[{{echo|foo<bar}}]]
12631 !!html/php
12632 <p>[[./../foo|bar]]
12633 [[foo�|bar]]
12634 [[foo/.|bar]]
12635 [[foo/..|bar]]
12636 [[foo~~~bar]]
12637 [[foo&gt;bar]]
12638 [[foo[bar]]
12639 [[.]]
12640 [[..]]
12641 [[foo././bar]]
12642 </p><p>[[./../foo|bar]]
12643 [[foo/.|bar]]
12644 [[foo/..|bar]]
12645 [[foo~~~~bar]]
12646 [[foo&gt;bar]]
12647 [[foo././bar]]
12648 [[foo{bar]]
12649 [[foo}bar]]
12650 [[foo[bar]]
12651 [[foo]bar]]
12652 [[foo&lt;bar]]
12653 </p>
12654 !!html/parsoid
12655 <p>[[./../foo|bar]]
12656 [[foo�|bar]]
12657 [[foo/.|bar]]
12658 [[foo/..|bar]]
12659 [[foo~~~bar]]
12660 [[foo>bar]]
12661 [[foo[bar]]
12662 [[.]]
12663 [[..]]
12664 [[foo././bar]]</p>
12665
12666 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
12667 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
12668 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
12669 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
12670 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
12671 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
12672 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
12673 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
12674 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
12675 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
12676 [[<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>
12677 !!end
12678
12679 !! test
12680 Disabled subpages
12681 !! wikitext
12682 [[/subpage]]
12683 !! html
12684 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
12685 </p>
12686 !! end
12687
12688 !! test
12689 BUG 561: {{/Subpage}}
12690 !! options
12691 subpage title=[[Page]]
12692 !! wikitext
12693 {{/Subpage}}
12694 !! html
12695 <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>
12696 </p>
12697 !! end
12698
12699 ###
12700 ### Categories
12701 ###
12702 !! article
12703 Category:MediaWiki User's Guide
12704 !! text
12705 blah
12706 !! endarticle
12707
12708 !! test
12709 Link to category
12710 !! wikitext
12711 [[:Category:MediaWiki User's Guide]]
12712 !! html
12713 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
12714 </p>
12715 !! end
12716
12717 !! test
12718 Simple category
12719 !! options
12720 cat
12721 !! wikitext
12722 [[Category:MediaWiki User's Guide]]
12723 !! html
12724 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12725 !! end
12726
12727 !! test
12728 PAGESINCATEGORY invalid title fatal (r33546 fix)
12729 !! wikitext
12730 {{PAGESINCATEGORY:<bogus>}}
12731 !! html
12732 <p>0
12733 </p>
12734 !! end
12735
12736 !! test
12737 Category with different sort key
12738 !! options
12739 cat
12740 !! wikitext
12741 [[Category:MediaWiki User's Guide|Foo]]
12742 !! html
12743 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12744 !! end
12745
12746 !! test
12747 Category with identical sort key
12748 !! options
12749 cat
12750 !! wikitext
12751 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
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 empty sort key
12758 !! options
12759 cat
12760 pst
12761 !! wikitext
12762 [[Category:MediaWiki User's Guide|]]
12763 !! html
12764 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12765 !! end
12766
12767 !! test
12768 Category with empty sort key and parentheses
12769 !! options
12770 cat
12771 pst
12772 !! wikitext
12773 [[Category:Foo (bar)|]]
12774 !! html
12775 [[Category:Foo (bar)|Foo]]
12776 !! end
12777
12778 !! test
12779 Category with link tail
12780 !! options
12781 cat
12782 pst
12783 !! wikitext
12784 123[[Category:Foo]]456
12785 !! html
12786 123[[Category:Foo]]456
12787 !! end
12788
12789 !! test
12790 Category with template
12791 !! options
12792 cat
12793 pst
12794 !! wikitext
12795 [[Category:{{echo|Foo}}]]
12796 !! html
12797 [[Category:{{echo|Foo}}]]
12798 !! end
12799
12800 !! test
12801 Category with template in sort key
12802 !! options
12803 cat
12804 pst
12805 !! wikitext
12806 [[Category:Foo|{{echo|Bar}}]]
12807 !! html
12808 [[Category:Foo|{{echo|Bar}}]]
12809 !! end
12810
12811 !! test
12812 Category with template in sort key and title
12813 !! options
12814 cat
12815 pst
12816 !! wikitext
12817 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12818 !! html
12819 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12820 !! end
12821
12822 !! test
12823 Category / paragraph interactions
12824 !! wikitext
12825 Foo [[Category:Baz]] Bar
12826
12827 Foo [[Category:Baz]]
12828 Bar
12829
12830 Foo
12831 [[Category:Baz]]
12832 Bar
12833
12834 Foo
12835 [[Category:Baz]] Bar
12836
12837 Foo
12838 [[Category:Baz]]
12839 [[Category:Baz]]
12840 [[Category:Baz]]
12841 Bar
12842
12843 [[Category:Baz]]
12844 [[Category:Baz]]
12845 [[Category:Baz]]
12846
12847 [[Category:Baz]]
12848 {{echo|[[Category:Baz]]}}
12849 [[Category:Baz]]
12850 !! html
12851 <p>Foo Bar
12852 </p><p>Foo
12853 Bar
12854 </p><p>Foo
12855 Bar
12856 </p><p>Foo Bar
12857 </p><p>Foo
12858 Bar
12859 </p>
12860 !! end
12861
12862 !! test
12863 Parsoid: Serialize link to category page with colon escape
12864 !! options
12865 parsoid
12866 !! wikitext
12867
12868 [[:Category:Foo]]
12869 [[:Category:Foo|Bar]]
12870 !! html
12871 <p>
12872 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
12873 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
12874 </p>
12875 !! end
12876
12877 !! test
12878 Parsoid: Link prefix/suffixes aren't applied to category links
12879 !! options
12880 parsoid=wt2html,wt2wt,html2html
12881 language=is
12882 !! wikitext
12883 x[[Category:Foo]]y
12884 !! html
12885 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
12886 !! end
12887
12888 !! test
12889 Parsoid: Serialize link to file page with colon escape
12890 !! options
12891 parsoid
12892 !! wikitext
12893
12894 [[:File:Foo.png]]
12895 [[:File:Foo.png|Bar]]
12896 !! html
12897 <p>
12898 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
12899 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
12900 </p>
12901 !! end
12902
12903 !! test
12904 Parsoid: Serialize a genuine category link without colon escape
12905 !! options
12906 parsoid
12907 !! wikitext
12908 [[Category:Foo]]
12909 [[Category:Foo|Bar]]
12910 !! html
12911 <link rel="mw:PageProp/Category" href="Category:Foo">
12912 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
12913 !! end
12914
12915 !! test
12916 Normalize hrefs properly before testing for invalid link targets (bug 70894)
12917 !! options
12918 parsoid=html2wt
12919 !! html
12920 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
12921 !! wikitext
12922 [[Category:Toxine bactérienne]]
12923 !! end
12924
12925 !! test
12926 Parsoid: Defaultsort
12927 !! options
12928 parsoid
12929 !! wikitext
12930 {{DEFAULTSORT:Foo}}
12931 !! html
12932 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
12933 !! end
12934
12935 ###
12936 ### Inter-language links
12937 ###
12938 !! test
12939 Interlanguage links
12940 !! options
12941 ill
12942 !! wikitext
12943 [[es:Alimento]]
12944 [[fr:Nourriture]]
12945 [[zh:食品]]
12946 !! html/php
12947 es:Alimento fr:Nourriture zh:食品
12948 !! html/parsoid
12949 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
12950 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
12951 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
12952 !! end
12953
12954 !! test
12955 Duplicate interlanguage links (bug 24502)
12956 !! options
12957 ill
12958 !! wikitext
12959 [[es:1]]
12960 [[es:2]]
12961 [[fr:1]]
12962 [[fr:2]]
12963 !! html/php
12964 es:1 fr:1
12965 !! html/parsoid
12966 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
12967 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
12968 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
12969 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
12970 !! end
12971
12972 ###
12973 ### Sections
12974 ###
12975 !! test
12976 Basic section headings
12977 !! wikitext
12978 == Headline 1 ==
12979 Some text
12980
12981 ==Headline 2==
12982 More
12983 ===Smaller headline===
12984 Blah blah
12985 !! html
12986 <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>
12987 <p>Some text
12988 </p>
12989 <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>
12990 <p>More
12991 </p>
12992 <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>
12993 <p>Blah blah
12994 </p>
12995 !! end
12996
12997 !! test
12998 Section headings with TOC
12999 !! wikitext
13000 == Headline 1 ==
13001 === Subheadline 1 ===
13002 ===== Skipping a level =====
13003 ====== Skipping a level ======
13004
13005 == Headline 2 ==
13006 Some text
13007 ===Another headline===
13008 !! html
13009 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13010 <ul>
13011 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
13012 <ul>
13013 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
13014 <ul>
13015 <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>
13016 <ul>
13017 <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>
13018 </ul>
13019 </li>
13020 </ul>
13021 </li>
13022 </ul>
13023 </li>
13024 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
13025 <ul>
13026 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
13027 </ul>
13028 </li>
13029 </ul>
13030 </div>
13031
13032 <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>
13033 <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>
13034 <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>
13035 <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>
13036 <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>
13037 <p>Some text
13038 </p>
13039 <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>
13040
13041 !! end
13042
13043 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
13044 !! test
13045 Handling of sections up to level 6 and beyond
13046 !! wikitext
13047 = Level 1 Heading=
13048 == Level 2 Heading==
13049 === Level 3 Heading===
13050 ==== Level 4 Heading====
13051 ===== Level 5 Heading=====
13052 ====== Level 6 Heading======
13053 ======= Level 7 Heading=======
13054 ======== Level 8 Heading========
13055 ========= Level 9 Heading=========
13056 ========== Level 10 Heading==========
13057 !! html
13058 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13059 <ul>
13060 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
13061 <ul>
13062 <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>
13063 <ul>
13064 <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>
13065 <ul>
13066 <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>
13067 <ul>
13068 <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>
13069 <ul>
13070 <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>
13071 <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>
13072 <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>
13073 <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>
13074 <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>
13075 </ul>
13076 </li>
13077 </ul>
13078 </li>
13079 </ul>
13080 </li>
13081 </ul>
13082 </li>
13083 </ul>
13084 </li>
13085 </ul>
13086 </div>
13087
13088 <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>
13089 <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>
13090 <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>
13091 <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>
13092 <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>
13093 <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>
13094 <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>
13095 <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>
13096 <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>
13097 <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>
13098
13099 !! end
13100
13101 !! test
13102 TOC regression (bug 9764)
13103 !! wikitext
13104 == title 1 ==
13105 === title 1.1 ===
13106 ==== title 1.1.1 ====
13107 === title 1.2 ===
13108 == title 2 ==
13109 === title 2.1 ===
13110 !! html
13111 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13112 <ul>
13113 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13114 <ul>
13115 <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>
13116 <ul>
13117 <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>
13118 </ul>
13119 </li>
13120 <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>
13121 </ul>
13122 </li>
13123 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13124 <ul>
13125 <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>
13126 </ul>
13127 </li>
13128 </ul>
13129 </div>
13130
13131 <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>
13132 <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>
13133 <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>
13134 <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>
13135 <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>
13136 <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>
13137
13138 !! end
13139
13140 !! test
13141 TOC with wgMaxTocLevel=3 (bug 6204)
13142 !! options
13143 wgMaxTocLevel=3
13144 !! wikitext
13145 == title 1 ==
13146 === title 1.1 ===
13147 ==== title 1.1.1 ====
13148 === title 1.2 ===
13149 == title 2 ==
13150 === title 2.1 ===
13151 !! html
13152 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13153 <ul>
13154 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13155 <ul>
13156 <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>
13157 <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>
13158 </ul>
13159 </li>
13160 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13161 <ul>
13162 <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>
13163 </ul>
13164 </li>
13165 </ul>
13166 </div>
13167
13168 <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>
13169 <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>
13170 <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>
13171 <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>
13172 <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>
13173 <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>
13174
13175 !! end
13176
13177 !! test
13178 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
13179 !! options
13180 wgMaxTocLevel=3
13181 !! wikitext
13182 ==Section 1==
13183 ===Section 1.1===
13184 ====Section 1.1.1====
13185 ====Section 1.1.1.1====
13186 ==Section 2==
13187 !! html
13188 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13189 <ul>
13190 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
13191 <ul>
13192 <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>
13193 </ul>
13194 </li>
13195 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
13196 </ul>
13197 </div>
13198
13199 <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>
13200 <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>
13201 <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>
13202 <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>
13203 <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>
13204
13205 !! end
13206
13207
13208 !! test
13209 Resolving duplicate section names
13210 !! wikitext
13211 == Foo bar ==
13212 == Foo bar ==
13213 !! html
13214 <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>
13215 <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>
13216
13217 !! end
13218
13219 !! test
13220 Resolving duplicate section names with differing case (bug 10721)
13221 !! wikitext
13222 == Foo bar ==
13223 == Foo Bar ==
13224 !! html
13225 <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>
13226 <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>
13227
13228 !! end
13229
13230 !! article
13231 Template:sections
13232 !! text
13233 ===Section 1===
13234 ==Section 2==
13235 !! endarticle
13236
13237 !! test
13238 Template with sections, __NOTOC__
13239 !! wikitext
13240 __NOTOC__
13241 ==Section 0==
13242 {{sections}}
13243 ==Section 4==
13244 !! html
13245 <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>
13246 <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>
13247 <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>
13248 <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>
13249
13250 !! end
13251
13252 !! test
13253 __NOEDITSECTION__ keyword
13254 !! wikitext
13255 __NOEDITSECTION__
13256 ==Section 1==
13257 ==Section 2==
13258 !! html
13259 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
13260 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
13261
13262 !! end
13263
13264 !! test
13265 Link inside a section heading
13266 !! wikitext
13267 ==Section with a [[Main Page|link]] in it==
13268 !! html
13269 <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>
13270
13271 !! end
13272
13273 !! test
13274 TOC regression (bug 12077)
13275 !! wikitext
13276 __TOC__
13277 == title 1 ==
13278 === title 1.1 ===
13279 == title 2 ==
13280 !! html
13281 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13282 <ul>
13283 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13284 <ul>
13285 <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>
13286 </ul>
13287 </li>
13288 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13289 </ul>
13290 </div>
13291
13292 <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>
13293 <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>
13294 <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>
13295
13296 !! end
13297
13298 !! test
13299 BUG 1219 URL next to image (good)
13300 !! wikitext
13301 http://example.com [[Image:foobar.jpg]]
13302 !! html
13303 <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>
13304 </p>
13305 !!end
13306
13307 !! test
13308 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13309 !! wikitext
13310 ===
13311 The line above must have a trailing space!
13312 === <!--
13313 --> <!-- -->
13314 But just in case it doesn't...
13315 !! html
13316 <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>
13317 <p>The line above must have a trailing space!
13318 </p>
13319 <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>
13320 <p>But just in case it doesn't...
13321 </p>
13322 !! end
13323
13324 !! test
13325 Header with special characters (bug 25462)
13326 !! wikitext
13327 The tooltips shall not show entities to the user (ie. be double escaped)
13328
13329 == text > text ==
13330 section 1
13331
13332 == text < text ==
13333 section 2
13334
13335 == text & text ==
13336 section 3
13337
13338 == text ' text ==
13339 section 4
13340
13341 == text " text ==
13342 section 5
13343 !! html
13344 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13345 </p>
13346 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13347 <ul>
13348 <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>
13349 <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>
13350 <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>
13351 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13352 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13353 </ul>
13354 </div>
13355
13356 <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>
13357 <p>section 1
13358 </p>
13359 <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>
13360 <p>section 2
13361 </p>
13362 <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>
13363 <p>section 3
13364 </p>
13365 <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>
13366 <p>section 4
13367 </p>
13368 <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>
13369 <p>section 5
13370 </p>
13371 !! end
13372
13373 !! test
13374 Header with space, plus and underscore as entity
13375 !! wikitext
13376 Id should not contain + for spaces
13377
13378 == Space between Text ==
13379 section 1
13380
13381 == Space-Entity&#32;between&#32;Text ==
13382 section 2
13383
13384 == Plus+between+Text ==
13385 section 3
13386
13387 == Plus-Entity&#43;between&#43;Text ==
13388 section 4
13389
13390 == Underscore_between_Text ==
13391 section 5
13392
13393 == Underscore-Entity&#95;between&#95;Text ==
13394 section 6
13395
13396 [[#Space between Text]]
13397 [[#Space-Entity&#32;between&#32;Text]]
13398 [[#Plus+between+Text]]
13399 [[#Plus-Entity&#43;between&#43;Text]]
13400 [[#Underscore_between_Text]]
13401 [[#Underscore-Entity&#95;between&#95;Text]]
13402 !! html
13403 <p>Id should not contain + for spaces
13404 </p>
13405 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13406 <ul>
13407 <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>
13408 <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>
13409 <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>
13410 <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>
13411 <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>
13412 <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>
13413 </ul>
13414 </div>
13415
13416 <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>
13417 <p>section 1
13418 </p>
13419 <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>
13420 <p>section 2
13421 </p>
13422 <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>
13423 <p>section 3
13424 </p>
13425 <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>
13426 <p>section 4
13427 </p>
13428 <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>
13429 <p>section 5
13430 </p>
13431 <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>
13432 <p>section 6
13433 </p><p><a href="#Space_between_Text">#Space between Text</a>
13434 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
13435 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
13436 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
13437 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
13438 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
13439 </p>
13440 !! end
13441
13442 !! test
13443 Headers with excess '=' characters
13444 (Are similar tests necessary beyond the 1st level?)
13445 !! wikitext
13446 =foo==
13447 ==foo=
13448 =''italic'' heading==
13449 ==''italic'' heading=
13450 !! html
13451 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13452 <ul>
13453 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
13454 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
13455 <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>
13456 <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>
13457 </ul>
13458 </div>
13459
13460 <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>
13461 <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>
13462 <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>
13463 <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>
13464
13465 !! end
13466
13467 !! test
13468 HTML headers vs TOC (bug 23393)
13469 (__NOEDITSECTION__ for clearer output, doesn't matter here)
13470 !! wikitext
13471 <h1>Header 1</h1>
13472 == Header 1.1 ==
13473 == Header 1.2 ==
13474
13475 <h1>Header 2
13476 </h1>
13477 == Header 2.1 ==
13478 == Header 2.2 ==
13479 __NOEDITSECTION__
13480 !! html
13481 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13482 <ul>
13483 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
13484 <ul>
13485 <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>
13486 <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>
13487 </ul>
13488 </li>
13489 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
13490 <ul>
13491 <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>
13492 <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>
13493 </ul>
13494 </li>
13495 </ul>
13496 </div>
13497
13498 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
13499 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
13500 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
13501 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
13502 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
13503 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
13504
13505 !! end
13506
13507 !! test
13508 Single-line or multiline-comments can follow headings
13509 !! options
13510 parsoid=wt2html,wt2wt
13511 !! wikitext
13512 ==foo==<!---->
13513 ==bar==<!--c1-->
13514 ==baz==<!--
13515 c2
13516 c3-->
13517 !! html
13518 <h2><span class="mw-headline" id="foo">foo</span></h2>
13519 <h2><span class="mw-headline" id="bar">bar</span></h2>
13520 <h2><span class="mw-headline" id="baz">baz</span></h2>
13521
13522 !! end
13523
13524 !! test
13525 BUG 1219 URL next to image (broken)
13526 !! wikitext
13527 http://example.com[[Image:foobar.jpg]]
13528 !! html
13529 <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>
13530 </p>
13531 !!end
13532
13533 !! test
13534 Bug 1186 news: in the middle of text
13535 !! wikitext
13536 http://en.wikinews.org/wiki/Wikinews:Workplace
13537 !! html
13538 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
13539 </p>
13540 !!end
13541
13542
13543 !! test
13544 Namespaced link must have a title
13545 !! wikitext
13546 [[Project:]]
13547 !! html
13548 <p>[[Project:]]
13549 </p>
13550 !!end
13551
13552 !! test
13553 Namespaced link must have a title (bad fragment version)
13554 !! wikitext
13555 [[Project:#fragment]]
13556 !! html
13557 <p>[[Project:#fragment]]
13558 </p>
13559 !!end
13560
13561
13562 ###
13563 ### HTML tags and HTML attributes
13564 ###
13565
13566 !! test
13567 div with no attributes
13568 !! wikitext
13569 <div>HTML rocks</div>
13570 !! html
13571 <div>HTML rocks</div>
13572
13573 !! end
13574
13575 !! test
13576 div with double-quoted attribute
13577 !! wikitext
13578 <div id="rock">HTML rocks</div>
13579 !! html
13580 <div id="rock">HTML rocks</div>
13581
13582 !! end
13583
13584 !! test
13585 div with single-quoted attribute
13586 !! wikitext
13587 <div id='rock'>HTML rocks</div>
13588 !! html
13589 <div id="rock">HTML rocks</div>
13590
13591 !! end
13592
13593 !! test
13594 div with unquoted attribute
13595 !! wikitext
13596 <div id=rock>HTML rocks</div>
13597 !! html
13598 <div id="rock">HTML rocks</div>
13599
13600 !! end
13601
13602 !! test
13603 div with illegal double attributes
13604 !! wikitext
13605 <div id="a" id="b">HTML rocks</div>
13606 !! html
13607 <div id="b">HTML rocks</div>
13608
13609 !!end
13610
13611 # FIXME: produce empty string instead of "class" in the PHP parser, following
13612 # the HTML5 spec.
13613 !! test
13614 div with empty attribute value, space before equals
13615 !! options
13616 parsoid
13617 !! wikitext
13618 <div class =>HTML rocks</div>
13619 !! html
13620 <div class="">HTML rocks</div>
13621
13622 !! end
13623
13624 !! test
13625 div with multiple empty attribute values
13626 !! options
13627 parsoid
13628 !! wikitext
13629 <div id= title=>HTML rocks</div>
13630 !! html
13631 <div id="" title="">HTML rocks</div>
13632
13633 !! end
13634
13635 !! test
13636 table with multiple empty attribute values
13637 !! options
13638 parsoid
13639 !! wikitext
13640 {| title= id=
13641 | hi
13642 |}
13643 !! html
13644 <table title="" id="">
13645 <tbody><tr><td> hi</td></tr>
13646 </tbody></table>
13647 !! end
13648
13649 !! test
13650 div with braces in attribute value
13651 !! wikitext
13652 <div title="{}">Foo</div>
13653 !! html/php
13654 <div title="&#123;}">Foo</div>
13655
13656 !! html/parsoid
13657 <div title="{}">Foo</div>
13658 !! end
13659
13660 # This it very inconsistent in the PHP parser: it returns
13661 # class="class" if there is a space between the name and the equal sign (see
13662 # 'div with empty attribute value, space before equals'), but strips the
13663 # attribute completely if the space is missing. We hope that not much content
13664 # depends on this, so are implementing the behavior below in Parsoid for
13665 # consistencies' sake.
13666 # FIXME: fix this behavior in the PHP parser?
13667 !! test
13668 div with empty attribute value, no space before equals
13669 !! options
13670 parsoid=wt2html,html2html
13671 !! wikitext
13672 <div class=>HTML rocks</div>
13673 !! html/php
13674 <div>HTML rocks</div>
13675
13676 !! html/parsoid
13677 <div class="">HTML rocks</div>
13678 !! end
13679
13680 !! test
13681 HTML multiple attributes correction
13682 !! wikitext
13683 <p class="error" class="awesome">Awesome!</p>
13684 !! html
13685 <p class="awesome">Awesome!</p>
13686
13687 !!end
13688
13689 !! test
13690 Table multiple attributes correction
13691 !! wikitext
13692 {|
13693 !+ class="error" class="awesome"| status
13694 |}
13695 !! html
13696 <table>
13697 <tr>
13698 <th class="awesome"> status
13699 </th></tr></table>
13700
13701 !!end
13702
13703 !! test
13704 DIV IN UPPERCASE
13705 !! wikitext
13706 <DIV ID="x">HTML ROCKS</DIV>
13707 !! html
13708 <div id="x">HTML ROCKS</div>
13709
13710 !!end
13711
13712 !! test
13713 Non-ASCII pseudo-tags are rendered as text
13714 !! wikitext
13715 <khyô>
13716 !! html
13717 <p>&lt;khyô&gt;
13718 </p>
13719 !! end
13720
13721 !! test
13722 Pseudo-tag with URL 'name' renders as url link
13723 !! wikitext
13724 <http://example.com/>
13725 !! html
13726 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
13727 </p>
13728 !! end
13729
13730 !! test
13731 text with amp in the middle of nowhere
13732 !! wikitext
13733 Remember AT&T?
13734 !! html
13735 <p>Remember AT&amp;T?
13736 </p>
13737 !! end
13738
13739 !! test
13740 text with character entity: eacute
13741 !! wikitext
13742 I always thought &eacute; was a cute letter.
13743 !! html
13744 <p>I always thought &#233; was a cute letter.
13745 </p>
13746 !! html+tidy
13747 <p>I always thought é was a cute letter.</p>
13748 !! end
13749
13750 !! test
13751 text with entity-escaped character entity-like string: eacute
13752 !! wikitext
13753 I always thought &amp;eacute; was a cute letter.
13754 !! html
13755 <p>I always thought &amp;eacute; was a cute letter.
13756 </p>
13757 !! end
13758
13759 !! test
13760 text with undefined character entity: xacute
13761 !! wikitext
13762 I always thought &xacute; was a cute letter.
13763 !! html
13764 <p>I always thought &amp;xacute; was a cute letter.
13765 </p>
13766 !! end
13767
13768 # TODO: generalize to PHP parser?
13769 !! test
13770 HTML5 tags
13771 !! options
13772 parsoid
13773 !! wikitext
13774 <data value="5">five</data>
13775 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13776 <mark>This highlighted text</mark>
13777 !! html
13778 <p><data value="5">five</data>
13779 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13780 <mark>This highlighted text</mark></p>
13781 !! end
13782
13783 !! test
13784 HTML tag with leading space is parsed as text
13785 !! wikitext
13786 < div>foo< /div>
13787 !! html
13788 <p>&lt; div&gt;foo&lt; /div&gt;
13789 </p>
13790 !! end
13791
13792 ###
13793 ### Nesting tests (see bug 41545, 50604, 51081)
13794 ###
13795
13796 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
13797 # Note that html2wt is considerably more difficult if we use <b> in
13798 # the test case, instead of <big>
13799 !! test
13800 Ensure that HTML adoption agency algorithm is properly implemented.
13801 !! wikitext
13802 <big>X<big>Y</big>Z</big>
13803 !! html
13804 <p><big>X<big>Y</big>Z</big>
13805 </p>
13806 !! end
13807
13808 # This was bug 41545 in the PHP parser.
13809 # Note that tidy doesn't handle this correctly.
13810 !! test
13811 Nesting of <kbd>
13812 !! wikitext
13813 <kbd>X<kbd>Y</kbd>Z</kbd>
13814 !! html
13815 <p><kbd>X<kbd>Y</kbd>Z</kbd>
13816 </p>
13817 !! end
13818
13819 # The following cases were bug 51081 in the PHP parser.
13820 # Note that there are some other nestable tags (b, i, etc) which are
13821 # not covered; see bug 51081 for discussion.
13822
13823 # Note that tidy doesn't handle this correctly.
13824 !! test
13825 Nesting of <em>
13826 !! wikitext
13827 <em>X<em>Y</em>Z</em>
13828 !! html
13829 <p><em>X<em>Y</em>Z</em>
13830 </p>
13831 !! end
13832
13833 # Note that tidy doesn't handle this correctly.
13834 !! test
13835 Nesting of <strong>
13836 !! wikitext
13837 <strong>X<strong>Y</strong>Z</strong>
13838 !! html
13839 <p><strong>X<strong>Y</strong>Z</strong>
13840 </p>
13841 !! end
13842
13843 !! test
13844 Nesting of <q>
13845 !! wikitext
13846 <q>X<q>Y</q>Z</q>
13847 !! html+tidy
13848 <p><q>X<q>Y</q>Z</q></p>
13849 !! end
13850
13851 # Note that tidy doesn't handle this correctly.
13852 !! test
13853 Nesting of <ruby>
13854 !! wikitext
13855 <ruby>X<ruby>Y</ruby>Z</ruby>
13856 !! html
13857 <p><ruby>X<ruby>Y</ruby>Z</ruby>
13858 </p>
13859 !! end
13860
13861 # Note that tidy doesn't handle this correctly.
13862 !! test
13863 Nesting of <bdo>
13864 !! wikitext
13865 <bdo>X<bdo>Y</bdo>Z</bdo>
13866 !! html
13867 <p><bdo>X<bdo>Y</bdo>Z</bdo>
13868 </p>
13869 !! end
13870
13871
13872 ###
13873 ### Media links
13874 ###
13875
13876 !! test
13877 Media link
13878 !! wikitext
13879 [[Media:Foobar.jpg]]
13880 !! html
13881 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
13882 </p>
13883 !! end
13884
13885 !! test
13886 Media link with text
13887 !! wikitext
13888 [[Media:Foobar.jpg|A neat file to look at]]
13889 !! html
13890 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
13891 </p>
13892 !! end
13893
13894 # FIXME: this is still bad HTML tag nesting
13895 !! test
13896 Media link with nasty text
13897 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
13898 !! wikitext
13899 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
13900 !! html
13901 <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>
13902
13903 !! html+tidy
13904 <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>
13905 !! end
13906
13907 !! test
13908 Media link to nonexistent file (bug 1702)
13909 !! wikitext
13910 [[Media:No such.jpg]]
13911 !! html
13912 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
13913 </p>
13914 !! end
13915
13916 !! test
13917 Image link to nonexistent file (bug 1850 - good)
13918 !! wikitext
13919 [[File:No_such.jpg]]
13920 !! html/php
13921 <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>
13922 </p>
13923 !! html/parsoid
13924 <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>
13925 !! end
13926
13927 !! test
13928 :Image link to nonexistent file (bug 1850 - bad)
13929 !! wikitext
13930 [[:Image:No such.jpg]]
13931 !! html/php
13932 <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>
13933 </p>
13934 !! html/parsoid
13935 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
13936 !! end
13937
13938
13939
13940 !! test
13941 Character reference normalization in link text (bug 1938)
13942 !! wikitext
13943 [[Main Page|this&that]]
13944 !! html
13945 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
13946 </p>
13947 !!end
13948
13949 !! article
13950 אַ
13951 !! text
13952 Test for unicode normalization
13953
13954 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
13955 !! endarticle
13956
13957 !! test
13958 (bug 19451) Links should refer to the normalized form.
13959 !! wikitext
13960 [[&#xFB2E;]]
13961 [[&#x5d0;&#x5b7;]]
13962 [[&#x5d0;ַ]]
13963 [[א&#x5b7;]]
13964 [[אַ]]
13965 !! html
13966 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
13967 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
13968 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
13969 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
13970 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
13971 </p>
13972 !! end
13973
13974 !! test
13975 Empty attribute crash test (bug 2067)
13976 !! wikitext
13977 <font color="">foo</font>
13978 !! html
13979 <p><font color="">foo</font>
13980 </p>
13981 !! end
13982
13983 !! test
13984 Empty attribute crash test single-quotes (bug 2067)
13985 !! wikitext
13986 <font color=''>foo</font>
13987 !! html
13988 <p><font color="">foo</font>
13989 </p>
13990 !! end
13991
13992 !! test
13993 Attribute test: equals, then nothing
13994 !! wikitext
13995 <font color=>foo</font>
13996 !! html
13997 <p><font>foo</font>
13998 </p>
13999 !! end
14000
14001 !! test
14002 Attribute test: unquoted value
14003 !! wikitext
14004 <font color=x>foo</font>
14005 !! html
14006 <p><font color="x">foo</font>
14007 </p>
14008 !! end
14009
14010 !! test
14011 Attribute test: unquoted but illegal value (hash)
14012 !! wikitext
14013 <font color=#x>foo</font>
14014 !! html
14015 <p><font color="#x">foo</font>
14016 </p>
14017 !! end
14018
14019 !! test
14020 Attribute test: no value
14021 !! wikitext
14022 <font color>foo</font>
14023 !! html
14024 <p><font color="color">foo</font>
14025 </p>
14026 !! end
14027
14028 !! test
14029 Bug 2095: link with three closing brackets
14030 !! wikitext
14031 [[Main Page]]]
14032 !! html/php
14033 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
14034 </p>
14035 !! html/parsoid
14036 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
14037 !! end
14038
14039 !! test
14040 Bug 2095: link with pipe and three closing brackets
14041 !! wikitext
14042 [[Main Page|link]]]
14043 !! html/php
14044 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
14045 </p>
14046 !! html/parsoid
14047 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
14048 !! end
14049
14050 !! test
14051 Bug 2095: link with pipe and three closing brackets, version 2
14052 !! wikitext
14053 [[Main Page|[http://example.com/]]]
14054 !! html/php
14055 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
14056 </p>
14057 !! html/parsoid
14058 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
14059 !! end
14060
14061
14062 ###
14063 ### Safety
14064 ###
14065
14066 !! article
14067 Template:Dangerous attribute
14068 !! text
14069 " onmouseover="alert(document.cookie)
14070 !! endarticle
14071
14072 !! article
14073 Template:Dangerous style attribute
14074 !! text
14075 border-size: expression(alert(document.cookie))
14076 !! endarticle
14077
14078 !! article
14079 Template:Div style
14080 !! text
14081 <div style="float: right; {{{1}}}">Magic div</div>
14082 !! endarticle
14083
14084 !! test
14085 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
14086 !! wikitext
14087 <div title="{{test}}"></div>
14088 !! html
14089 <div title="This is a test template"></div>
14090
14091 !! end
14092
14093 # Parsoid has enough context to handle this case
14094 !! test
14095 Bug 2304: HTML attribute safety (dangerous template; 2309)
14096 !! wikitext
14097 <div title="{{dangerous attribute}}"></div>
14098 !! html/php
14099 <div title=""></div>
14100
14101 !! html/parsoid
14102 <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>
14103 !! end
14104
14105 !! test
14106 Bug 2304: HTML attribute safety (dangerous style template; 2309)
14107 !! wikitext
14108 <div style="{{dangerous style attribute}}"></div>
14109 !! html
14110 <div style="/* insecure input */"></div>
14111
14112 !! end
14113
14114 !! test
14115 Bug 2304: HTML attribute safety (safe parameter; 2309)
14116 !! wikitext
14117 {{div style|width: 200px}}
14118 !! html
14119 <div style="float: right; width: 200px">Magic div</div>
14120
14121 !! end
14122
14123 !! test
14124 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
14125 !! wikitext
14126 {{div style|width: expression(alert(document.cookie))}}
14127 !! html
14128 <div style="/* insecure input */">Magic div</div>
14129
14130 !! end
14131
14132 !! test
14133 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
14134 !! wikitext
14135 {{div style|"><script>alert(document.cookie)</script>}}
14136 !! html
14137 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14138
14139 !! end
14140
14141 !! test
14142 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
14143 !! wikitext
14144 {{div style|" ><script>alert(document.cookie)</script>}}
14145 !! html
14146 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14147
14148 !! end
14149
14150 !! test
14151 Bug 2304: HTML attribute safety (link)
14152 !! wikitext
14153 <div title="[[Main Page]]"></div>
14154 !! html
14155 <div title="&#91;&#91;Main Page]]"></div>
14156
14157 !! end
14158
14159 !! test
14160 Bug 2304: HTML attribute safety (italics)
14161 !! wikitext
14162 <div title="''foobar''"></div>
14163 !! html
14164 <div title="&#39;&#39;foobar&#39;&#39;"></div>
14165
14166 !! end
14167
14168 !! test
14169 Bug 2304: HTML attribute safety (bold)
14170 !! wikitext
14171 <div title="'''foobar'''"></div>
14172 !! html
14173 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
14174
14175 !! end
14176
14177
14178 !! test
14179 Bug 2304: HTML attribute safety (ISBN)
14180 !! wikitext
14181 <div title="ISBN 1234567890"></div>
14182 !! html
14183 <div title="&#73;SBN 1234567890"></div>
14184
14185 !! end
14186
14187 !! test
14188 Bug 2304: HTML attribute safety (RFC)
14189 !! wikitext
14190 <div title="RFC 1234"></div>
14191 !! html
14192 <div title="&#82;FC 1234"></div>
14193
14194 !! end
14195
14196 !! test
14197 Bug 2304: HTML attribute safety (PMID)
14198 !! wikitext
14199 <div title="PMID 1234567890"></div>
14200 !! html
14201 <div title="&#80;MID 1234567890"></div>
14202
14203 !! end
14204
14205 !! test
14206 Bug 2304: HTML attribute safety (web link)
14207 !! wikitext
14208 <div title="http://example.com/"></div>
14209 !! html
14210 <div title="http&#58;//example.com/"></div>
14211
14212 !! end
14213
14214 !! test
14215 Bug 2304: HTML attribute safety (named web link)
14216 !! wikitext
14217 <div title="[http://example.com/ link]"></div>
14218 !! html
14219 <div title="&#91;http&#58;//example.com/ link]"></div>
14220
14221 !! end
14222
14223 !! test
14224 Bug 3244: HTML attribute safety (extension; safe)
14225 !! wikitext
14226 <div style="<nowiki>background:blue</nowiki>"></div>
14227 !! html
14228 <div style="background:blue"></div>
14229
14230 !! end
14231
14232 !! test
14233 Bug 3244: HTML attribute safety (extension; unsafe)
14234 !! wikitext
14235 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14236 !! html
14237 <div style="/* insecure input */"></div>
14238
14239 !! end
14240
14241 # More MSIE fun discovered by Tom Gilder
14242
14243 !! test
14244 MSIE CSS safety test: spurious slash
14245 !! wikitext
14246 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14247 !! html
14248 <div style="/* insecure input */">evil</div>
14249
14250 !! end
14251
14252 !! test
14253 MSIE CSS safety test: hex code
14254 !! wikitext
14255 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14256 !! html
14257 <div style="/* insecure input */">evil</div>
14258
14259 !! end
14260
14261 !! test
14262 MSIE CSS safety test: comment in url
14263 !! wikitext
14264 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14265 !! html
14266 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14267
14268 !! end
14269
14270 !! test
14271 MSIE CSS safety test: comment in expression
14272 !! wikitext
14273 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14274 !! html
14275 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14276
14277 !! end
14278
14279 !! test
14280 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14281 !! wikitext
14282 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14283 !! html
14284 <p style="/* invalid control char */">A</p>
14285
14286 !! end
14287
14288 !! test
14289 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14290 !! wikitext
14291 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14292 <div style="top:EXPRESSION(alert())">B</div>
14293 !! html
14294 <p style="/* insecure input */">A</p>
14295 <div style="/* insecure input */">B</div>
14296
14297 !! end
14298
14299 !! test
14300 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14301 !! wikitext
14302 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14303 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14304 !! html
14305 <div style="/* insecure input */">A</div>
14306 <p style="/* insecure input */">B</p>
14307
14308 !! end
14309
14310 !! test
14311 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14312 !! wikitext
14313 <div style="background-image:url⁽javascript:alert())">A</div>
14314 <div style="background-image:url₍javascript:alert())">B</div>
14315 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14316 !! html
14317 <div style="/* insecure input */">A</div>
14318 <div style="/* insecure input */">B</div>
14319 <p style="/* insecure input */">C</p>
14320
14321 !! end
14322
14323 !! test
14324 Opera -o-link CSS
14325 !! wikitext
14326 <div
14327 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;"
14328 style="-o-link:attr(title);-o-link-source:current">X</div>
14329 !! html
14330 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14331
14332 !! end
14333
14334 !! test
14335 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14336 !! wikitext
14337 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14338 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14339 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14340 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14341 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14342 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14343 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14344 !! html
14345 <p style="/* insecure input */">A</p>
14346 <p style="/* insecure input */">B</p>
14347 <p style="/* insecure input */">C</p>
14348 <p style="/* insecure input */">D</p>
14349 <p style="/* insecure input */">E</p>
14350 <p style="/* insecure input */">F</p>
14351 <p style="/* insecure input */">G</p>
14352
14353 !! end
14354
14355 !! test
14356 Table attribute legitimate extension
14357 !! wikitext
14358 {|
14359 !+ style="<nowiki>color:blue</nowiki>"| status
14360 |}
14361 !! html
14362 <table>
14363 <tr>
14364 <th style="color:blue"> status
14365 </th></tr></table>
14366
14367 !!end
14368
14369 !! test
14370 Table attribute safety
14371 !! wikitext
14372 {|
14373 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14374 |}
14375 !! html
14376 <table>
14377 <tr>
14378 <th style="/* insecure input */"> status
14379 </th></tr></table>
14380
14381 !! end
14382
14383 !! test
14384 CSS line continuation 1
14385 !! wikitext
14386 <div style="background-image: u\&#10;rl(test.jpg);"></div>
14387 !! html
14388 <div style="/* insecure input */"></div>
14389
14390 !! end
14391
14392 !! test
14393 CSS line continuation 2
14394 !! wikitext
14395 <div style="background-image: u\&#13;rl(test.jpg); "></div>
14396 !! html
14397 <div style="/* insecure input */"></div>
14398
14399 !! end
14400
14401 !! article
14402 Template:Identity
14403 !! text
14404 {{{1}}}
14405 !! endarticle
14406
14407 !! test
14408 Expansion of multi-line templates in attribute values (bug 6255)
14409 !! wikitext
14410 <div style="background: {{identity|#00FF00}}">-</div>
14411 !! html
14412 <div style="background: #00FF00">-</div>
14413
14414 !! end
14415
14416
14417 !! test
14418 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
14419 !! wikitext
14420 <div style="background:
14421 #00FF00">-</div>
14422 !! html/php
14423 <div style="background: #00FF00">-</div>
14424
14425 !! html/parsoid
14426 <div style="background:
14427 #00FF00">-</div>
14428 !! end
14429
14430 !! test
14431 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
14432 !! wikitext
14433 <div style="background: &#10;#00FF00">-</div>
14434 !! html
14435 <div style="background: &#10;#00FF00">-</div>
14436
14437 !! end
14438
14439 !! test
14440 evil <math>-wiki-tags without Extension:Math enabled
14441 !! wikitext
14442 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
14443 !! html+tidy
14444 <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>
14445 !! end
14446
14447 ###
14448 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
14449 ###
14450 !! test
14451 Parser hook: empty input
14452 !! wikitext
14453 <tag></tag>
14454 !! html
14455 <pre>
14456 ''
14457 array (
14458 )
14459 </pre>
14460
14461 !! end
14462
14463 !! test
14464 Parser hook: empty input using terminated empty elements
14465 !! wikitext
14466 <tag/>
14467 !! html
14468 <pre>
14469 NULL
14470 array (
14471 )
14472 </pre>
14473
14474 !! end
14475
14476 !! test
14477 Parser hook: empty input using terminated empty elements (space before)
14478 !! wikitext
14479 <tag />
14480 !! html
14481 <pre>
14482 NULL
14483 array (
14484 )
14485 </pre>
14486
14487 !! end
14488
14489 !! test
14490 Parser hook: basic input
14491 !! wikitext
14492 <tag>input</tag>
14493 !! html
14494 <pre>
14495 'input'
14496 array (
14497 )
14498 </pre>
14499
14500 !! end
14501
14502
14503 !! test
14504 Parser hook: case insensitive
14505 !! wikitext
14506 <TAG>input</TAG>
14507 !! html
14508 <pre>
14509 'input'
14510 array (
14511 )
14512 </pre>
14513
14514 !! end
14515
14516
14517 !! test
14518 Parser hook: case insensitive, redux
14519 !! wikitext
14520 <TaG>input</TAg>
14521 !! html
14522 <pre>
14523 'input'
14524 array (
14525 )
14526 </pre>
14527
14528 !! end
14529
14530 !! test
14531 Parser hook: nested tags
14532 !! options
14533 noxml
14534 !! wikitext
14535 <tag><tag></tag></tag>
14536 !! html
14537 <pre>
14538 '<tag>'
14539 array (
14540 )
14541 </pre>&lt;/tag&gt;
14542
14543 !! end
14544
14545 !! test
14546 Parser hook: basic arguments
14547 !! wikitext
14548 <tag width=200 height = "100" depth = '50' square></tag>
14549 !! html
14550 <pre>
14551 ''
14552 array (
14553 'width' => '200',
14554 'height' => '100',
14555 'depth' => '50',
14556 'square' => 'square',
14557 )
14558 </pre>
14559
14560 !! end
14561
14562 !! test
14563 Parser hook: argument containing a forward slash (bug 5344)
14564 !! wikitext
14565 <tag filename='/tmp/bla'></tag>
14566 !! html
14567 <pre>
14568 ''
14569 array (
14570 'filename' => '/tmp/bla',
14571 )
14572 </pre>
14573
14574 !! end
14575
14576 !! test
14577 Parser hook: empty input using terminated empty elements (bug 2374)
14578 !! wikitext
14579 <tag foo=bar/>text
14580 !! html
14581 <pre>
14582 NULL
14583 array (
14584 'foo' => 'bar',
14585 )
14586 </pre>text
14587
14588 !! end
14589
14590 # </tag> should be output literally since there is no matching tag that begins it
14591 !! test
14592 Parser hook: basic arguments using terminated empty elements (bug 2374)
14593 !! wikitext
14594 <tag width=200 height = "100" depth = '50' square/>
14595 other stuff
14596 </tag>
14597 !! html
14598 <pre>
14599 NULL
14600 array (
14601 'width' => '200',
14602 'height' => '100',
14603 'depth' => '50',
14604 'square' => 'square',
14605 )
14606 </pre>
14607 <p>other stuff
14608 &lt;/tag&gt;
14609 </p>
14610 !! end
14611
14612 ###
14613 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14614 ###
14615
14616 !! test
14617 Parser hook: static parser hook not inside a comment
14618 !! wikitext
14619 <statictag>hello, world</statictag>
14620 <statictag action=flush/>
14621 !! html
14622 <p>hello, world
14623 </p>
14624 !! end
14625
14626
14627 !! test
14628 Parser hook: static parser hook inside a comment
14629 !! wikitext
14630 <!-- <statictag>hello, world</statictag> -->
14631 <statictag action=flush/>
14632 !! html
14633 <p><br />
14634 </p>
14635 !! end
14636
14637 # Nested template calls; this case was broken by Parser.php rev 1.506,
14638 # since reverted.
14639
14640 !! article
14641 Template:One-parameter
14642 !! text
14643 (My parameter is: {{{1}}})
14644 !! endarticle
14645
14646 !! article
14647 Template:Map-one-parameter
14648 !! text
14649 {{{{{1}}}|{{{2}}}}}
14650 !! endarticle
14651
14652 !! test
14653 Nested template calls
14654 !! wikitext
14655 {{Map-one-parameter|One-parameter|param}}
14656 !! html
14657 <p>(My parameter is: param)
14658 </p>
14659 !! end
14660
14661
14662 ###
14663 ### Sanitizer
14664 ###
14665
14666 # HTML+Tidy effectively strips out the empty tags completely
14667 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
14668 # which Tidy would have done for the PHP parser had there been content inside it.
14669 !! test
14670 Sanitizer: Closing of open tags
14671 !! wikitext
14672 <s></s><table></table>
14673 !! html
14674 <s></s><table></table>
14675
14676 !! html/parsoid
14677 <p><s></s></p><table></table>
14678 !! end
14679
14680 !! test
14681 Sanitizer: Closing of open but not closed tags
14682 !! wikitext
14683 <s>foo
14684 !! html
14685 <p><s>foo</s>
14686 </p>
14687 !! end
14688
14689 !! test
14690 Sanitizer: Closing of closed but not open tags
14691 !! wikitext
14692 </s>
14693 !! html
14694 <p>&lt;/s&gt;
14695 </p>
14696 !! end
14697
14698 !! test
14699 Sanitizer: Closing of closed but not open table tags
14700 !! wikitext
14701 Table not started</td></tr></table>
14702 !! html
14703 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
14704 </p>
14705 !! end
14706
14707 !! test
14708 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
14709 !! wikitext
14710 <span id="æ: v">byte</span>[[#æ: v|backlink]]
14711 !! html
14712 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
14713 </p>
14714 !! end
14715
14716 # In HTML5, the restrictions are that id must contain at least one character,
14717 # and must not contain any space characters.
14718 !! test
14719 Sanitizer: Validating the contents of the id attribute (bug 4515)
14720 !! options
14721 disabled
14722 !! wikitext
14723 <br id="" /><br id="a space" />
14724 !! html
14725 Something ...
14726 !! end
14727
14728 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
14729 !! test
14730 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
14731 !! options
14732 disabled
14733 !! wikitext
14734 <br id="foo" /><br id="foo" />
14735 !! html
14736 Something need to be done. foo-2 ?
14737 !! end
14738
14739 !! test
14740 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
14741 !! wikitext
14742 <div itemscope>
14743 <meta itemprop="hello" content="world">
14744 <meta http-equiv="refresh" content="5">
14745 <meta itemprop="hello" http-equiv="refresh" content="5">
14746 <link itemprop="hello" href="{{SERVER}}">
14747 <link rel="stylesheet" href="{{SERVER}}">
14748 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
14749 </div>
14750 !! html
14751 <div itemscope="itemscope">
14752 <p> <meta itemprop="hello" content="world" />
14753 &lt;meta http-equiv="refresh" content="5"&gt;
14754 <meta itemprop="hello" content="5" />
14755 </p>
14756 <link itemprop="hello" href="http&#58;//example.org" />
14757 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
14758 <link itemprop="hello" href="http&#58;//example.org" />
14759 </div>
14760
14761 !! end
14762
14763 !! test
14764 Language converter: output gets cut off unexpectedly (bug 5757)
14765 !! options
14766 language=zh
14767 !! wikitext
14768 this bit is safe: }-
14769
14770 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
14771
14772 then we get cut off here: }-
14773
14774 all additional text is vanished
14775 !! html
14776 <p>this bit is safe: }-
14777 </p><p>but if we add a conversion instance: xxx
14778 </p><p>then we get cut off here: }-
14779 </p><p>all additional text is vanished
14780 </p>
14781 !! end
14782
14783 !! test
14784 Self closed html pairs (bug 5487)
14785 !! options
14786 !! wikitext
14787 <center><font id="bug" />Centered text</center>
14788 <div><font id="bug2" />In div text</div>
14789 !! html
14790 <center>&lt;font id="bug" /&gt;Centered text</center>
14791 <div>&lt;font id="bug2" /&gt;In div text</div>
14792
14793 !! end
14794
14795 #
14796 #
14797 #
14798
14799 !! test
14800 Punctuation: nbsp before exclamation
14801 !! wikitext
14802 C'est grave !
14803 !! html
14804 <p>C'est grave&#160;!
14805 </p>
14806 !! end
14807
14808 !! test
14809 Punctuation: CSS !important (bug 11874)
14810 !! wikitext
14811 <div style="width:50% !important">important</div>
14812 !! html
14813 <div style="width:50% !important">important</div>
14814
14815 !!end
14816
14817 !! test
14818 Punctuation: CSS ! important (bug 11874; with space after)
14819 !! wikitext
14820 <div style="width:50% ! important">important</div>
14821 !! html
14822 <div style="width:50% ! important">important</div>
14823
14824 !!end
14825
14826
14827 !! test
14828 HTML bullet list, closed tags (bug 5497)
14829 !! wikitext
14830 <ul>
14831 <li>One</li>
14832 <li>Two</li>
14833 </ul>
14834 !! html/php
14835 <ul>
14836 <li>One</li>
14837 <li>Two</li>
14838 </ul>
14839
14840 !! html/parsoid
14841 <ul data-parsoid='{"stx":"html"}'>
14842 <li data-parsoid='{"stx":"html"}'>One</li>
14843 <li data-parsoid='{"stx":"html"}'>Two</li>
14844 </ul>
14845
14846 !! end
14847
14848 !! test
14849 HTML bullet list, unclosed tags (bug 5497)
14850 !! wikitext
14851 <ul>
14852 <li>One
14853 <li>Two
14854 </ul>
14855 !! html/php+tidy
14856 <ul>
14857 <li>One</li>
14858 <li>Two</li>
14859 </ul>
14860 !! html/parsoid
14861 <ul data-parsoid='{"stx":"html"}'>
14862 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
14863 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
14864 </ul>
14865
14866 !! end
14867
14868 !! test
14869 HTML ordered list, closed tags (bug 5497)
14870 !! wikitext
14871 <ol>
14872 <li>One</li>
14873 <li>Two</li>
14874 </ol>
14875 !! html/php
14876 <ol>
14877 <li>One</li>
14878 <li>Two</li>
14879 </ol>
14880
14881 !! html/parsoid
14882 <ol data-parsoid='{"stx":"html"}'>
14883 <li data-parsoid='{"stx":"html"}'>One</li>
14884 <li data-parsoid='{"stx":"html"}'>Two</li>
14885 </ol>
14886
14887 !! end
14888
14889 !! test
14890 HTML ordered list, unclosed tags (bug 5497)
14891 !! options
14892 !! wikitext
14893 <ol>
14894 <li>One
14895 <li>Two
14896 </ol>
14897 !! html/php+tidy
14898 <ol>
14899 <li>One</li>
14900 <li>Two</li>
14901 </ol>
14902 !! html/parsoid
14903 <ol data-parsoid='{"stx":"html"}'>
14904 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
14905 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
14906 </ol>
14907
14908 !! end
14909
14910 !! test
14911 HTML nested bullet list, closed tags (bug 5497)
14912 !! wikitext
14913 <ul>
14914 <li>One</li>
14915 <li>Two:
14916 <ul>
14917 <li>Sub-one</li>
14918 <li>Sub-two</li>
14919 </ul>
14920 </li>
14921 </ul>
14922 !! html
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
14933 !! end
14934
14935 !! test
14936 HTML nested bullet list, open tags (bug 5497)
14937 !! wikitext
14938 <ul>
14939 <li>One
14940 <li>Two:
14941 <ul>
14942 <li>Sub-one
14943 <li>Sub-two
14944 </ul>
14945 </ul>
14946 !! html/php+tidy
14947 <ul>
14948 <li>One</li>
14949 <li>Two:
14950 <ul>
14951 <li>Sub-one</li>
14952 <li>Sub-two</li>
14953 </ul>
14954 </li>
14955 </ul>
14956 !! html/parsoid
14957 <ul>
14958 <li>One
14959 </li>
14960 <li>Two:
14961 <ul>
14962 <li>Sub-one
14963 </li>
14964 <li>Sub-two
14965 </li>
14966 </ul>
14967 </li>
14968 </ul>
14969
14970 !! end
14971
14972 !! test
14973 HTML nested ordered list, closed tags (bug 5497)
14974 !! wikitext
14975 <ol>
14976 <li>One</li>
14977 <li>Two:
14978 <ol>
14979 <li>Sub-one</li>
14980 <li>Sub-two</li>
14981 </ol>
14982 </li>
14983 </ol>
14984 !! html
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
14995 !! end
14996
14997 !! test
14998 HTML nested ordered list, open tags (bug 5497)
14999 !! wikitext
15000 <ol>
15001 <li>One
15002 <li>Two:
15003 <ol>
15004 <li>Sub-one
15005 <li>Sub-two
15006 </ol>
15007 </ol>
15008 !! html/php
15009 <ol>
15010 <li>One
15011 <li>Two:
15012 <ol>
15013 <li>Sub-one
15014 <li>Sub-two
15015 </ol>
15016 </ol>
15017
15018 !! html/parsoid
15019 <ol>
15020 <li>One
15021 </li>
15022 <li>Two:
15023 <ol>
15024 <li>Sub-one
15025 </li>
15026 <li>Sub-two
15027 </li>
15028 </ol>
15029 </li>
15030 </ol>
15031
15032 !! end
15033
15034 !! test
15035 HTML ordered list item with parameters oddity
15036 !! wikitext
15037 <ol><li id="fragment">One</li>
15038 </ol>
15039 !! html
15040 <ol><li id="fragment">One</li>
15041 </ol>
15042
15043 !! end
15044
15045 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
15046 !!test
15047 bug 5918: autonumbering
15048 !! wikitext
15049 [http://first/] [http://second] [ftp://ftp]
15050
15051 ftp://inlineftp
15052
15053 [mailto:enclosed@mail.tld With target]
15054
15055 [mailto:enclosed@mail.tld]
15056
15057 mailto:inline@mail.tld
15058 !! html/php
15059 <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>
15060 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
15061 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
15062 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
15063 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
15064 </p>
15065 !! html/parsoid
15066 <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>
15067 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
15068 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
15069 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
15070 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
15071 !! end
15072
15073
15074 #
15075 # Security and HTML correctness
15076 # From Nick Jenkins' fuzz testing
15077 #
15078
15079 !! test
15080 Fuzz testing: Parser13
15081 !! wikitext
15082 {|
15083 | http://a|
15084 !! html
15085 <table>
15086 <tr>
15087 <td>
15088 </td>
15089 </tr>
15090 </table>
15091
15092 !! end
15093
15094 !! test
15095 Fuzz testing: Parser14
15096 !! wikitext
15097 == onmouseover= ==
15098 http://__TOC__
15099 !! html
15100 <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>
15101 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15102 <ul>
15103 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15104 </ul>
15105 </div>
15106
15107
15108 !! html+tidy
15109 <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>
15110 <p>http://</p>
15111 <div id="toc" class="toc">
15112 <div id="toctitle">
15113 <h2>Contents</h2>
15114 </div>
15115 <ul>
15116 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15117 </ul>
15118 </div>
15119 !! end
15120
15121 !! test
15122 Fuzz testing: Parser14-table
15123 !! wikitext
15124 ==a==
15125 {| STYLE=__TOC__
15126 !! html
15127 <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>
15128 <table style="&#95;_TOC&#95;_">
15129 <tr><td></td></tr>
15130 </table>
15131
15132 !! html+tidy
15133 <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>
15134 <table style="__TOC__">
15135 <tr>
15136 <td></td>
15137 </tr>
15138 </table>
15139 !! end
15140
15141 # Known to produce bogus xml (extra </td>)
15142 !! test
15143 Fuzz testing: Parser16
15144 !! options
15145 noxml
15146 !! wikitext
15147 {|
15148 !https://||||||
15149 !! html
15150 <table>
15151 <tr>
15152 <th>https://</th>
15153 <th></th>
15154 <th></th>
15155 <th>
15156 </td>
15157 </tr>
15158 </table>
15159
15160 !! html+tidy
15161 <table>
15162 <tr>
15163 <th>https://</th>
15164 <th></th>
15165 <th></th>
15166 <th></th>
15167 </tr>
15168 </table>
15169 !! end
15170
15171 !! test
15172 Fuzz testing: Parser21
15173 !! wikitext
15174 {|
15175 ! irc://{{ftp://a" onmouseover="alert('hello world');"
15176 |
15177 !! html
15178 <table>
15179 <tr>
15180 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
15181 </th>
15182 <td>
15183 </td>
15184 </tr>
15185 </table>
15186
15187 !! end
15188
15189 !! test
15190 Fuzz testing: Parser22
15191 !! wikitext
15192 http://===r:::https://b
15193
15194 {|
15195 !! html
15196 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
15197 </p>
15198 <table>
15199 <tr><td></td></tr>
15200 </table>
15201
15202 !! end
15203
15204 # Known to produce bad XML for now
15205 !! test
15206 Fuzz testing: Parser24
15207 !! options
15208 noxml
15209 !! wikitext
15210 {|
15211 {{{|
15212 <u CLASS=
15213 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
15214 <br style="onmouseover='alert(document.cookie);' " />
15215
15216 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15217 |
15218 !! html
15219 <table>
15220 {{{|
15221 <u class="&#124;">}}}} &gt;
15222 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
15223
15224 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15225 <tr>
15226 <td></u>
15227 </td>
15228 </tr>
15229 </table>
15230
15231 !! end
15232
15233 # Note: the current result listed for this is not what the original one was,
15234 # but the original bug was JavaScript injection, which is fixed in any case.
15235 # It's not clear that the original result listed was any more correct than the
15236 # current one. Original result:
15237 # <p>{{{|
15238 # </p>
15239 # <li class="&#124;&#124;">
15240 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15241 !!test
15242 Fuzz testing: Parser25 (bug 6055)
15243 !! wikitext
15244 {{{
15245 |
15246 <LI CLASS=||
15247 >
15248 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15249 !! html
15250 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15251 </p>
15252 !! end
15253
15254 !!test
15255 Fuzz testing: URL adjacent extension (with space, clean)
15256 !! wikitext
15257 http://example.com <nowiki>junk</nowiki>
15258 !! html
15259 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15260 </p>
15261 !!end
15262
15263 !!test
15264 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15265 !! wikitext
15266 http://example.com<nowiki>junk</nowiki>
15267 !! html
15268 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15269 </p>
15270 !!end
15271
15272 !!test
15273 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15274 !! wikitext
15275 http://example.com<pre>junk</pre>
15276 !! html
15277 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15278
15279 !! html+tidy
15280 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15281 <pre>
15282 junk
15283 </pre>
15284 !!end
15285
15286 !!test
15287 Fuzz testing: image with bogus manual thumbnail
15288 !! wikitext
15289 [[Image:foobar.jpg|thumbnail= ]]
15290 !! html/php
15291 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
15292
15293 !! html/parsoid
15294 <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>
15295 !!end
15296
15297 !! test
15298 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15299 !! wikitext
15300 <pre dir="&#10;"></pre>
15301 !! html
15302 <pre dir="&#10;"></pre>
15303
15304 !! end
15305
15306 !! test
15307 Parsing optional HTML elements (Bug 6171)
15308 !! options
15309 !! wikitext
15310 <table>
15311 <tr>
15312 <td> Some tabular data</td>
15313 <td> More tabular data ...
15314 <td> And yet som tabular data</td>
15315 </tr>
15316 </table>
15317 !! html
15318 <table>
15319 <tr>
15320 <td> Some tabular data</td>
15321 <td> More tabular data ...
15322 </td><td> And yet som tabular data</td>
15323 </tr>
15324 </table>
15325
15326 !! end
15327
15328 !! test
15329 Correct handling of <td>, <tr> (Bug 6171)
15330 !! options
15331 !! wikitext
15332 <table>
15333 <tr>
15334 <td> Some tabular data</td>
15335 <td> More tabular data ...</td>
15336 <td> And yet som tabular data</td>
15337 </tr>
15338 </table>
15339 !! html
15340 <table>
15341 <tr>
15342 <td> Some tabular data</td>
15343 <td> More tabular data ...</td>
15344 <td> And yet som tabular data</td>
15345 </tr>
15346 </table>
15347
15348 !! end
15349
15350
15351 !! test
15352 Parsing crashing regression (fr:JavaScript)
15353 !! wikitext
15354 </body></x>
15355 !! html
15356 <p>&lt;/body&gt;&lt;/x&gt;
15357 </p>
15358 !! end
15359
15360 !! test
15361 Inline wiki vs wiki block nesting
15362 !! wikitext
15363 '''Bold paragraph
15364
15365 New wiki paragraph
15366 !! html
15367 <p><b>Bold paragraph</b>
15368 </p><p>New wiki paragraph
15369 </p>
15370 !! end
15371
15372 # FIXME: The current php output is documented
15373 # and desired output is the parsoid target.
15374 !! test
15375 Inline HTML vs wiki block nesting
15376 !! wikitext
15377 <b>Bold paragraph
15378
15379 New wiki paragraph
15380 !! html/php
15381 <p><b>Bold paragraph
15382 </p><p>New wiki paragraph</b>
15383 </p>
15384 !! html/parsoid
15385 <p><b>Bold paragraph</b>
15386 </p><p>New wiki paragraph
15387 </p>
15388 !! end
15389
15390 # Original result was this:
15391 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
15392 # </p>
15393 # While that might be marginally more intuitive, maybe, the six-apostrophe
15394 # construct is clearly pathological and the result stated here (which is what
15395 # the parser actually does) is about as reasonable as anything.
15396 !!test
15397 Mixing markup for italics and bold
15398 !! options
15399 !! wikitext
15400 '''bold''''''bold''bolditalics'''''
15401 !! html
15402 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
15403 </p>
15404 !! end
15405
15406
15407 !! article
15408 Xyzzyx
15409 !! text
15410 Article for special page transclusion test
15411 !! endarticle
15412
15413 !! test
15414 Special page transclusion
15415 !! options
15416 !! wikitext
15417 {{Special:Prefixindex/Xyzzyx}}
15418 !! html
15419 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15420
15421 !! end
15422
15423 !! test
15424 Special page transclusion twice (bug 5021)
15425 !! options
15426 !! wikitext
15427 {{Special:Prefixindex/Xyzzyx}}
15428 {{Special:Prefixindex/Xyzzyx}}
15429 !! html
15430 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15431 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15432
15433 !! end
15434
15435 !! test
15436 Transclusion of default MediaWiki message
15437 !! wikitext
15438 {{MediaWiki:Mainpage}}
15439 !! html
15440 <p>Main Page
15441 </p>
15442 !! end
15443
15444 !! test
15445 Transclusion of nonexistent MediaWiki message
15446 !! wikitext
15447 {{MediaWiki:Mainpagexxx}}
15448 !! html
15449 <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>
15450 </p>
15451 !! end
15452
15453 !! test
15454 Transclusion of MediaWiki message with underscore
15455 !! wikitext
15456 {{MediaWiki:history_short}}
15457 !! html
15458 <p>History
15459 </p>
15460 !! end
15461
15462 !! test
15463 Transclusion of MediaWiki message with space
15464 !! wikitext
15465 {{MediaWiki:history short}}
15466 !! html
15467 <p>History
15468 </p>
15469 !! end
15470
15471 !! test
15472 Invalid header with following text
15473 !! wikitext
15474 = x = y
15475 !! html
15476 <p>= x = y
15477 </p>
15478 !! end
15479
15480
15481 !! test
15482 Section extraction test (section 0)
15483 !! options
15484 section=0
15485 !! wikitext
15486 start
15487 ==a==
15488 ===aa===
15489 ====aaa====
15490 ==b==
15491 ===ba===
15492 ===bb===
15493 ====bba====
15494 ===bc===
15495 ==c==
15496 ===ca===
15497 !! html
15498 start
15499 !! end
15500
15501 !! test
15502 Section extraction test (section 1)
15503 !! options
15504 section=1
15505 !! wikitext
15506 start
15507 ==a==
15508 ===aa===
15509 ====aaa====
15510 ==b==
15511 ===ba===
15512 ===bb===
15513 ====bba====
15514 ===bc===
15515 ==c==
15516 ===ca===
15517 !! html
15518 ==a==
15519 ===aa===
15520 ====aaa====
15521 !! end
15522
15523 !! test
15524 Section extraction test (section 2)
15525 !! options
15526 section=2
15527 !! wikitext
15528 start
15529 ==a==
15530 ===aa===
15531 ====aaa====
15532 ==b==
15533 ===ba===
15534 ===bb===
15535 ====bba====
15536 ===bc===
15537 ==c==
15538 ===ca===
15539 !! html
15540 ===aa===
15541 ====aaa====
15542 !! end
15543
15544 !! test
15545 Section extraction test (section 3)
15546 !! options
15547 section=3
15548 !! wikitext
15549 start
15550 ==a==
15551 ===aa===
15552 ====aaa====
15553 ==b==
15554 ===ba===
15555 ===bb===
15556 ====bba====
15557 ===bc===
15558 ==c==
15559 ===ca===
15560 !! html
15561 ====aaa====
15562 !! end
15563
15564 !! test
15565 Section extraction test (section 4)
15566 !! options
15567 section=4
15568 !! wikitext
15569 start
15570 ==a==
15571 ===aa===
15572 ====aaa====
15573 ==b==
15574 ===ba===
15575 ===bb===
15576 ====bba====
15577 ===bc===
15578 ==c==
15579 ===ca===
15580 !! html
15581 ==b==
15582 ===ba===
15583 ===bb===
15584 ====bba====
15585 ===bc===
15586 !! end
15587
15588 !! test
15589 Section extraction test (section 5)
15590 !! options
15591 section=5
15592 !! wikitext
15593 start
15594 ==a==
15595 ===aa===
15596 ====aaa====
15597 ==b==
15598 ===ba===
15599 ===bb===
15600 ====bba====
15601 ===bc===
15602 ==c==
15603 ===ca===
15604 !! html
15605 ===ba===
15606 !! end
15607
15608 !! test
15609 Section extraction test (section 6)
15610 !! options
15611 section=6
15612 !! wikitext
15613 start
15614 ==a==
15615 ===aa===
15616 ====aaa====
15617 ==b==
15618 ===ba===
15619 ===bb===
15620 ====bba====
15621 ===bc===
15622 ==c==
15623 ===ca===
15624 !! html
15625 ===bb===
15626 ====bba====
15627 !! end
15628
15629 !! test
15630 Section extraction test (section 7)
15631 !! options
15632 section=7
15633 !! wikitext
15634 start
15635 ==a==
15636 ===aa===
15637 ====aaa====
15638 ==b==
15639 ===ba===
15640 ===bb===
15641 ====bba====
15642 ===bc===
15643 ==c==
15644 ===ca===
15645 !! html
15646 ====bba====
15647 !! end
15648
15649 !! test
15650 Section extraction test (section 8)
15651 !! options
15652 section=8
15653 !! wikitext
15654 start
15655 ==a==
15656 ===aa===
15657 ====aaa====
15658 ==b==
15659 ===ba===
15660 ===bb===
15661 ====bba====
15662 ===bc===
15663 ==c==
15664 ===ca===
15665 !! html
15666 ===bc===
15667 !! end
15668
15669 !! test
15670 Section extraction test (section 9)
15671 !! options
15672 section=9
15673 !! wikitext
15674 start
15675 ==a==
15676 ===aa===
15677 ====aaa====
15678 ==b==
15679 ===ba===
15680 ===bb===
15681 ====bba====
15682 ===bc===
15683 ==c==
15684 ===ca===
15685 !! html
15686 ==c==
15687 ===ca===
15688 !! end
15689
15690 !! test
15691 Section extraction test (section 10)
15692 !! options
15693 section=10
15694 !! wikitext
15695 start
15696 ==a==
15697 ===aa===
15698 ====aaa====
15699 ==b==
15700 ===ba===
15701 ===bb===
15702 ====bba====
15703 ===bc===
15704 ==c==
15705 ===ca===
15706 !! html
15707 ===ca===
15708 !! end
15709
15710 !! test
15711 Section extraction test (nonexistent section 11)
15712 !! options
15713 section=11
15714 !! wikitext
15715 start
15716 ==a==
15717 ===aa===
15718 ====aaa====
15719 ==b==
15720 ===ba===
15721 ===bb===
15722 ====bba====
15723 ===bc===
15724 ==c==
15725 ===ca===
15726 !! html
15727 !! end
15728
15729 !! test
15730 Section extraction test with bogus heading (section 1)
15731 !! options
15732 section=1
15733 !! wikitext
15734 ==a==
15735 ==bogus== not a legal section
15736 ==b==
15737 !! html
15738 ==a==
15739 ==bogus== not a legal section
15740 !! end
15741
15742 !! test
15743 Section extraction test with bogus heading (section 2)
15744 !! options
15745 section=2
15746 !! wikitext
15747 ==a==
15748 ==bogus== not a legal section
15749 ==b==
15750 !! html
15751 ==b==
15752 !! end
15753
15754 !! test
15755 Section extraction test with comment after heading (section 1)
15756 !! options
15757 section=1
15758 !! wikitext
15759 ==a==
15760 ==b== <!-- -->
15761 ==c==
15762 !! html
15763 ==a==
15764 !! end
15765
15766 !! test
15767 Section extraction test with comment after heading (section 2)
15768 !! options
15769 section=2
15770 !! wikitext
15771 ==a==
15772 ==b== <!-- -->
15773 ==c==
15774 !! html
15775 ==b== <!-- -->
15776 !! end
15777
15778 !! test
15779 Section extraction test with bogus <nowiki> heading (section 1)
15780 !! options
15781 section=1
15782 !! wikitext
15783 ==a==
15784 ==bogus== <nowiki>not a legal section</nowiki>
15785 ==b==
15786 !! html
15787 ==a==
15788 ==bogus== <nowiki>not a legal section</nowiki>
15789 !! end
15790
15791 !! test
15792 Section extraction test with bogus <nowiki> heading (section 2)
15793 !! options
15794 section=2
15795 !! wikitext
15796 ==a==
15797 ==bogus== <nowiki>not a legal section</nowiki>
15798 ==b==
15799 !! html
15800 ==b==
15801 !! end
15802
15803
15804 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
15805 # instead of respecting commented sections
15806 !! test
15807 Section extraction prefixed by comment (section 1)
15808 !! options
15809 section=1
15810 !! wikitext
15811 <!-- -->==sec1==
15812 ==sec2==
15813 !! html
15814 ==sec2==
15815 !!end
15816
15817 !! test
15818 Section extraction prefixed by comment (section 2)
15819 !! options
15820 section=2
15821 !! wikitext
15822 <!-- -->==sec1==
15823 ==sec2==
15824 !! html
15825
15826 !!end
15827
15828
15829 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
15830 # instead of respecting HTML-style headings
15831 !! test
15832 Section extraction, mixed wiki and html (section 1)
15833 !! options
15834 section=1
15835 !! wikitext
15836 <h2>unmarked</h2>
15837 unmarked
15838 ==1==
15839 one
15840 ==2==
15841 two
15842 !! html
15843 ==1==
15844 one
15845 !! end
15846
15847 !! test
15848 Section extraction, mixed wiki and html (section 2)
15849 !! options
15850 section=2
15851 !! wikitext
15852 <h2>unmarked</h2>
15853 unmarked
15854 ==1==
15855 one
15856 ==2==
15857 two
15858 !! html
15859 ==2==
15860 two
15861 !! end
15862
15863
15864 # Formerly testing for bug 3342
15865 !! test
15866 Section extraction, heading surrounded by <noinclude>
15867 !! options
15868 section=1
15869 !! wikitext
15870 <noinclude>==unmarked==</noinclude>
15871 ==marked==
15872 !! html
15873 ==marked==
15874 !!end
15875
15876 # Test behavior of bug 19910
15877 !! test
15878 Sectiion with all-equals
15879 !! options
15880 section=2
15881 !! wikitext
15882 ===
15883 The line above must have a trailing space
15884 === <!--
15885 --> <!-- -->
15886 But just in case it doesn't...
15887 !! html
15888 === <!--
15889 --> <!-- -->
15890 But just in case it doesn't...
15891 !! end
15892
15893 !! test
15894 Section replacement test (section 0)
15895 !! options
15896 replace=0,"xxx"
15897 !! wikitext
15898 start
15899 ==a==
15900 ===aa===
15901 ====aaa====
15902 ==b==
15903 ===ba===
15904 ===bb===
15905 ====bba====
15906 ===bc===
15907 ==c==
15908 ===ca===
15909 !! html
15910 xxx
15911
15912 ==a==
15913 ===aa===
15914 ====aaa====
15915 ==b==
15916 ===ba===
15917 ===bb===
15918 ====bba====
15919 ===bc===
15920 ==c==
15921 ===ca===
15922 !! end
15923
15924 !! test
15925 Section replacement test (section 1)
15926 !! options
15927 replace=1,"xxx"
15928 !! wikitext
15929 start
15930 ==a==
15931 ===aa===
15932 ====aaa====
15933 ==b==
15934 ===ba===
15935 ===bb===
15936 ====bba====
15937 ===bc===
15938 ==c==
15939 ===ca===
15940 !! html
15941 start
15942 xxx
15943
15944 ==b==
15945 ===ba===
15946 ===bb===
15947 ====bba====
15948 ===bc===
15949 ==c==
15950 ===ca===
15951 !! end
15952
15953 !! test
15954 Section replacement test (section 2)
15955 !! options
15956 replace=2,"xxx"
15957 !! wikitext
15958 start
15959 ==a==
15960 ===aa===
15961 ====aaa====
15962 ==b==
15963 ===ba===
15964 ===bb===
15965 ====bba====
15966 ===bc===
15967 ==c==
15968 ===ca===
15969 !! html
15970 start
15971 ==a==
15972 xxx
15973
15974 ==b==
15975 ===ba===
15976 ===bb===
15977 ====bba====
15978 ===bc===
15979 ==c==
15980 ===ca===
15981 !! end
15982
15983 !! test
15984 Section replacement test (section 3)
15985 !! options
15986 replace=3,"xxx"
15987 !! wikitext
15988 start
15989 ==a==
15990 ===aa===
15991 ====aaa====
15992 ==b==
15993 ===ba===
15994 ===bb===
15995 ====bba====
15996 ===bc===
15997 ==c==
15998 ===ca===
15999 !! html
16000 start
16001 ==a==
16002 ===aa===
16003 xxx
16004
16005 ==b==
16006 ===ba===
16007 ===bb===
16008 ====bba====
16009 ===bc===
16010 ==c==
16011 ===ca===
16012 !! end
16013
16014 !! test
16015 Section replacement test (section 4)
16016 !! options
16017 replace=4,"xxx"
16018 !! wikitext
16019 start
16020 ==a==
16021 ===aa===
16022 ====aaa====
16023 ==b==
16024 ===ba===
16025 ===bb===
16026 ====bba====
16027 ===bc===
16028 ==c==
16029 ===ca===
16030 !! html
16031 start
16032 ==a==
16033 ===aa===
16034 ====aaa====
16035 xxx
16036
16037 ==c==
16038 ===ca===
16039 !! end
16040
16041 !! test
16042 Section replacement test (section 5)
16043 !! options
16044 replace=5,"xxx"
16045 !! wikitext
16046 start
16047 ==a==
16048 ===aa===
16049 ====aaa====
16050 ==b==
16051 ===ba===
16052 ===bb===
16053 ====bba====
16054 ===bc===
16055 ==c==
16056 ===ca===
16057 !! html
16058 start
16059 ==a==
16060 ===aa===
16061 ====aaa====
16062 ==b==
16063 xxx
16064
16065 ===bb===
16066 ====bba====
16067 ===bc===
16068 ==c==
16069 ===ca===
16070 !! end
16071
16072 !! test
16073 Section replacement test (section 6)
16074 !! options
16075 replace=6,"xxx"
16076 !! wikitext
16077 start
16078 ==a==
16079 ===aa===
16080 ====aaa====
16081 ==b==
16082 ===ba===
16083 ===bb===
16084 ====bba====
16085 ===bc===
16086 ==c==
16087 ===ca===
16088 !! html
16089 start
16090 ==a==
16091 ===aa===
16092 ====aaa====
16093 ==b==
16094 ===ba===
16095 xxx
16096
16097 ===bc===
16098 ==c==
16099 ===ca===
16100 !! end
16101
16102 !! test
16103 Section replacement test (section 7)
16104 !! options
16105 replace=7,"xxx"
16106 !! wikitext
16107 start
16108 ==a==
16109 ===aa===
16110 ====aaa====
16111 ==b==
16112 ===ba===
16113 ===bb===
16114 ====bba====
16115 ===bc===
16116 ==c==
16117 ===ca===
16118 !! html
16119 start
16120 ==a==
16121 ===aa===
16122 ====aaa====
16123 ==b==
16124 ===ba===
16125 ===bb===
16126 xxx
16127
16128 ===bc===
16129 ==c==
16130 ===ca===
16131 !! end
16132
16133 !! test
16134 Section replacement test (section 8)
16135 !! options
16136 replace=8,"xxx"
16137 !! wikitext
16138 start
16139 ==a==
16140 ===aa===
16141 ====aaa====
16142 ==b==
16143 ===ba===
16144 ===bb===
16145 ====bba====
16146 ===bc===
16147 ==c==
16148 ===ca===
16149 !! html
16150 start
16151 ==a==
16152 ===aa===
16153 ====aaa====
16154 ==b==
16155 ===ba===
16156 ===bb===
16157 ====bba====
16158 xxx
16159
16160 ==c==
16161 ===ca===
16162 !!end
16163
16164 !! test
16165 Section replacement test (section 9)
16166 !! options
16167 replace=9,"xxx"
16168 !! wikitext
16169 start
16170 ==a==
16171 ===aa===
16172 ====aaa====
16173 ==b==
16174 ===ba===
16175 ===bb===
16176 ====bba====
16177 ===bc===
16178 ==c==
16179 ===ca===
16180 !! html
16181 start
16182 ==a==
16183 ===aa===
16184 ====aaa====
16185 ==b==
16186 ===ba===
16187 ===bb===
16188 ====bba====
16189 ===bc===
16190 xxx
16191 !! end
16192
16193 !! test
16194 Section replacement test (section 10)
16195 !! options
16196 replace=10,"xxx"
16197 !! wikitext
16198 start
16199 ==a==
16200 ===aa===
16201 ====aaa====
16202 ==b==
16203 ===ba===
16204 ===bb===
16205 ====bba====
16206 ===bc===
16207 ==c==
16208 ===ca===
16209 !! html
16210 start
16211 ==a==
16212 ===aa===
16213 ====aaa====
16214 ==b==
16215 ===ba===
16216 ===bb===
16217 ====bba====
16218 ===bc===
16219 ==c==
16220 xxx
16221 !! end
16222
16223 !! test
16224 Section replacement test with initial whitespace (bug 13728)
16225 !! options
16226 replace=2,"xxx"
16227 !! wikitext
16228 Preformatted initial line
16229 ==a==
16230 ===a===
16231 !! html
16232 Preformatted initial line
16233 ==a==
16234 xxx
16235 !! end
16236
16237
16238 !! test
16239 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16240 !! options
16241 section=1
16242 !! wikitext
16243 ==a==
16244 a
16245 !! html
16246 ==a==
16247 a
16248 !! end
16249
16250 !! test
16251 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16252 !! options
16253 section=1
16254 !! wikitext
16255 ==a==
16256 a
16257 !! html
16258 ==a==
16259 a
16260 !! end
16261
16262
16263 !! test
16264 Section extraction, <pre> around bogus header (bug 10309)
16265 !! options
16266 noxml section=2
16267 !! wikitext
16268 == Section One ==
16269 <pre>
16270 =======
16271 </pre>
16272
16273 == Section Two ==
16274 stuff
16275 !! html
16276 == Section Two ==
16277 stuff
16278 !! end
16279
16280 !! test
16281 Section replacement, <pre> around bogus header (bug 10309)
16282 !! options
16283 noxml replace=2,"xxx"
16284 !! wikitext
16285 == Section One ==
16286 <pre>
16287 =======
16288 </pre>
16289
16290 == Section Two ==
16291 stuff
16292 !! html
16293 == Section One ==
16294 <pre>
16295 =======
16296 </pre>
16297
16298 xxx
16299 !! end
16300
16301
16302
16303 !! test
16304 Handling of &#x0A; in URLs
16305 !! wikitext
16306 ** irc://&#x0A;a
16307 !! html/php
16308 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16309
16310 !! html/parsoid
16311 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16312 a">irc://
16313 a</a></li></ul></li></ul>
16314 !! end
16315
16316 !! test
16317 Handling of %0A in URLs
16318 !! wikitext
16319 ** irc://%0Aa
16320 !! html/php
16321 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16322
16323 !! html/parsoid
16324 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16325 !! end
16326
16327
16328 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16329 !! test
16330 5 quotes, code coverage +1 line
16331 !! options
16332 parsoid=wt2html
16333 !! wikitext
16334 '''''
16335 !! html/php
16336 !! html/parsoid
16337 <p><b><i></i></b></p>
16338 !! end
16339
16340 # same html as previous, but wikitext adjusted to match parsoid html2wt
16341 # note that wt2html and html2html will put the <i> before the <b>
16342 !! test
16343 5 quotes, code coverage +1 line w/ nowiki (1)
16344 !! options
16345 parsoid=wt2wt,html2wt
16346 !! wikitext
16347 '''''<nowiki/>'''''
16348 !! html/php
16349 <p><i></i>
16350 </p>
16351 !! html/parsoid
16352 <p><b><i></i></b></p>
16353 !! end
16354
16355 # same as previous, just swapping the <i> and <b>
16356 !! test
16357 5 quotes, code coverage +1 line w/ nowiki (2)
16358 !! wikitext
16359 '''''<nowiki/>'''''
16360 !! html/php
16361 <p><i></i>
16362 </p>
16363 !! html/parsoid
16364 <p><i><b></b></i></p>
16365 !! end
16366
16367 !! test
16368 Special:Search page linking.
16369 !! wikitext
16370 {{Special:search}}
16371 !! html
16372 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16373 </p>
16374 !! end
16375
16376 !! test
16377 {{!}} is a magic word
16378 !! wikitext
16379 {{!}} is a magic word there and {{!}} is still a magic word here
16380 !! html/php
16381 <p>| is a magic word there and | is still a magic word here
16382 </p>
16383 !! html/parsoid
16384 <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>
16385 !! end
16386
16387 !! test
16388 Say the magic word
16389 !! options
16390 title=[[Parser test]]
16391 !! wikitext
16392 * {{PAGENAME}}
16393 * {{PAGENAMEE}}
16394 * {{FULLPAGENAME}}
16395 * {{FULLPAGENAMEE}}
16396 * {{BASEPAGENAME}}
16397 * {{BASEPAGENAMEE}}
16398 * {{SUBPAGENAME}}
16399 * {{SUBPAGENAMEE}}
16400 * {{ROOTPAGENAME}}
16401 * {{ROOTPAGENAMEE}}
16402 * {{TALKPAGENAME}}
16403 * {{TALKPAGENAMEE}}
16404 * {{SUBJECTPAGENAME}}
16405 * {{SUBJECTPAGENAMEE}}
16406 * {{NAMESPACEE}}
16407 * {{NAMESPACE}}
16408 * {{NAMESPACENUMBER}}
16409 * {{TALKSPACE}}
16410 * {{TALKSPACEE}}
16411 * {{SUBJECTSPACE}}
16412 * {{SUBJECTSPACEE}}
16413 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
16414 !! html
16415 <ul><li> Parser test</li>
16416 <li> Parser_test</li>
16417 <li> Parser test</li>
16418 <li> Parser_test</li>
16419 <li> Parser test</li>
16420 <li> Parser_test</li>
16421 <li> Parser test</li>
16422 <li> Parser_test</li>
16423 <li> Parser test</li>
16424 <li> Parser_test</li>
16425 <li> Talk:Parser test</li>
16426 <li> Talk:Parser_test</li>
16427 <li> Parser test</li>
16428 <li> Parser_test</li>
16429 <li> </li>
16430 <li> </li>
16431 <li> 0</li>
16432 <li> Talk</li>
16433 <li> Talk</li>
16434 <li> </li>
16435 <li> </li>
16436 <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>
16437
16438 !! end
16439 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
16440
16441 !! test
16442 Gallery
16443 !! wikitext
16444 <gallery>
16445 image1.png |
16446 image2.gif|||||
16447
16448 image3|
16449 image4 |300px| centre
16450 image5.svg| http://///////
16451 [[x|xx]]]]
16452 * image6
16453 </gallery>
16454 !! html
16455 <ul class="gallery mw-gallery-traditional">
16456 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16457 <div class="thumb" style="height: 150px;">Image1.png</div>
16458 <div class="gallerytext">
16459 </div>
16460 </div></li>
16461 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16462 <div class="thumb" style="height: 150px;">Image2.gif</div>
16463 <div class="gallerytext">
16464 <p>||||
16465 </p>
16466 </div>
16467 </div></li>
16468 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16469 <div class="thumb" style="height: 150px;">Image3</div>
16470 <div class="gallerytext">
16471 </div>
16472 </div></li>
16473 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16474 <div class="thumb" style="height: 150px;">Image4</div>
16475 <div class="gallerytext">
16476 <p>300px| centre
16477 </p>
16478 </div>
16479 </div></li>
16480 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16481 <div class="thumb" style="height: 150px;">Image5.svg</div>
16482 <div class="gallerytext">
16483 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
16484 </p>
16485 </div>
16486 </div></li>
16487 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16488 <div class="thumb" style="height: 150px;">* image6</div>
16489 <div class="gallerytext">
16490 </div>
16491 </div></li>
16492 </ul>
16493
16494 !! end
16495
16496 !! test
16497 Gallery (with options)
16498 !! wikitext
16499 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
16500 File:Nonexistent.jpg|caption
16501 File:Nonexistent.jpg
16502 image:foobar.jpg|some '''caption''' [[Main Page]]
16503 image:foobar.jpg
16504 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
16505 </gallery>
16506 !! html
16507 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
16508 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
16509 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16510 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16511 <div class="gallerytext">
16512 <p>caption
16513 </p>
16514 </div>
16515 </div></li>
16516 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16517 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16518 <div class="gallerytext">
16519 </div>
16520 </div></li>
16521 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16522 <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>
16523 <div class="gallerytext">
16524 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16525 </p>
16526 </div>
16527 </div></li>
16528 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16529 <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>
16530 <div class="gallerytext">
16531 </div>
16532 </div></li>
16533 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16534 <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>
16535 <div class="gallerytext">
16536 <p>Blabla|blabla.
16537 </p>
16538 </div>
16539 </div></li>
16540 </ul>
16541
16542 !! end
16543
16544 !! test
16545 Gallery with link that has fragment
16546 !! wikitext
16547 <gallery>
16548 image:foobar.jpg|link=Main_Page
16549 image:foobar.jpg|link=Main_Page#section
16550 image:foobar.jpg|link=Main Page#section|caption
16551 </gallery>
16552 !! html
16553 <ul class="gallery mw-gallery-traditional">
16554 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16555 <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>
16556 <div class="gallerytext">
16557 </div>
16558 </div></li>
16559 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16560 <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>
16561 <div class="gallerytext">
16562 </div>
16563 </div></li>
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#section"><img alt="" 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 <p>caption
16568 </p>
16569 </div>
16570 </div></li>
16571 </ul>
16572
16573 !! end
16574
16575 !! test
16576 Gallery with wikitext inside caption
16577 !! wikitext
16578 <gallery>
16579 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
16580 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
16581 </gallery>
16582 !! html
16583 <ul class="gallery mw-gallery-traditional">
16584 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16585 <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>
16586 <div class="gallerytext">
16587 <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>
16588 </p>
16589 </div>
16590 </div></li>
16591 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16592 <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>
16593 <div class="gallerytext">
16594 <p>This is a test template
16595 </p>
16596 </div>
16597 </div></li>
16598 </ul>
16599
16600 !! end
16601
16602 !! test
16603 gallery (with showfilename option)
16604 !! wikitext
16605 <gallery showfilename>
16606 File:Nonexistent.jpg|caption
16607 File:Nonexistent.jpg
16608 image:foobar.jpg|some '''caption''' [[Main Page]]
16609 File:Foobar.jpg
16610 </gallery>
16611 !! html
16612 <ul class="gallery mw-gallery-traditional">
16613 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16614 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16615 <div class="gallerytext">
16616 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16617 caption
16618 </p>
16619 </div>
16620 </div></li>
16621 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16622 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16623 <div class="gallerytext">
16624 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16625 </p>
16626 </div>
16627 </div></li>
16628 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16629 <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>
16630 <div class="gallerytext">
16631 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16632 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16633 </p>
16634 </div>
16635 </div></li>
16636 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16637 <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>
16638 <div class="gallerytext">
16639 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16640 </p>
16641 </div>
16642 </div></li>
16643 </ul>
16644
16645 !! end
16646
16647 !! test
16648 Gallery (with namespace-less filenames)
16649 !! wikitext
16650 <gallery>
16651 File:Nonexistent.jpg
16652 Nonexistent.jpg
16653 image:foobar.jpg
16654 foobar.jpg
16655 </gallery>
16656 !! html
16657 <ul class="gallery mw-gallery-traditional">
16658 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16659 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16660 <div class="gallerytext">
16661 </div>
16662 </div></li>
16663 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16664 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16665 <div class="gallerytext">
16666 </div>
16667 </div></li>
16668 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16669 <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>
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="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>
16675 <div class="gallerytext">
16676 </div>
16677 </div></li>
16678 </ul>
16679
16680 !! end
16681
16682 !! test
16683 HTML Hex character encoding (spells the word "JavaScript")
16684 !! options
16685 parsoid=wt2html,wt2wt,html2html
16686 !! wikitext
16687 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
16688 !! html/php
16689 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
16690 </p>
16691 !! html/php+tidy
16692 <p>JavaScript</p>
16693 !! html/parsoid
16694 <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>
16695 !! end
16696
16697 !! test
16698 HTML Hex character encoding bogus encoding (bug 26437 regression check)
16699 !! wikitext
16700 &#xsee;&#XSEE;
16701 !! html/php
16702 <p>&amp;#xsee;&amp;#XSEE;
16703 </p>
16704 !! html/parsoid
16705 <p>&amp;#xsee;&amp;#XSEE;</p>
16706 !! end
16707
16708 !! test
16709 HTML Hex character encoding mixed case
16710 !! options
16711 parsoid=wt2html,wt2wt,html2html
16712 !! wikitext
16713 &#xEE;&#Xee;
16714 !! html/php
16715 <p>&#xee;&#xee;
16716 </p>
16717 !! html/php+tidy
16718 <p>îî</p>
16719 !! html/parsoid
16720 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
16721 !! end
16722
16723 !! test
16724 __FORCETOC__ override
16725 !! wikitext
16726 __NEWSECTIONLINK__
16727 __FORCETOC__
16728 !! html
16729 <p><br />
16730 </p>
16731 !! end
16732
16733 !! test
16734 ISBN code coverage
16735 !! wikitext
16736 ISBN 978-0-1234-56&#x20;789
16737 !! html
16738 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
16739 </p>
16740 !! html+tidy
16741 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
16742 !! end
16743
16744 !! test
16745 ISBN followed by 5 spaces
16746 !! wikitext
16747 ISBN
16748 !! html
16749 <p>ISBN
16750 </p>
16751 !! end
16752
16753 !! test
16754 Double ISBN
16755 !! wikitext
16756 ISBN ISBN 1234567890
16757 !! html
16758 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16759 </p>
16760 !! end
16761
16762 !! test
16763 ISBN with an X
16764 !! wikitext
16765 ISBN 3-462-04561-X
16766 !! html
16767 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
16768 </p>
16769 !! end
16770
16771 !! test
16772 ISBN with empty prefix (parsoid test)
16773 !! wikitext
16774 ISBN 1234567890
16775 !! html/parsoid
16776 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
16777 !! end
16778
16779 !! test
16780 Bug 22905: <abbr> followed by ISBN followed by </a>
16781 !! wikitext
16782 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
16783 !! html
16784 <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>
16785 </p>
16786 !! end
16787
16788 !! test
16789 Double RFC
16790 !! wikitext
16791 RFC RFC 1234
16792 !! html
16793 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
16794 </p>
16795 !! end
16796
16797 !! test
16798 Double RFC with a wiki link
16799 !! wikitext
16800 RFC [[RFC 1234]]
16801 !! html
16802 <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>
16803 </p>
16804 !! end
16805
16806 !! test
16807 RFC code coverage
16808 !! wikitext
16809 RFC 983&#x20;987
16810 !! html
16811 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
16812 </p>
16813 !! html+tidy
16814 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
16815 !! end
16816
16817 !! test
16818 Centre-aligned image
16819 !! wikitext
16820 [[Image:foobar.jpg|centre]]
16821 !! html
16822 <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>
16823
16824 !!end
16825
16826 !! test
16827 None-aligned image
16828 !! wikitext
16829 [[Image:foobar.jpg|none]]
16830 !! html
16831 <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>
16832
16833 !!end
16834
16835 !! test
16836 Width + Height sized image (using px) (height is ignored)
16837 !! wikitext
16838 [[Image:foobar.jpg|640x480px]]
16839 !! html
16840 <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>
16841 </p>
16842 !!end
16843
16844 !! test
16845 Width-sized image (using px, no following whitespace)
16846 !! wikitext
16847 [[Image:foobar.jpg|640px]]
16848 !! html
16849 <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>
16850 </p>
16851 !!end
16852
16853 !! test
16854 Width-sized image (using px, with following whitespace - test regression from r39467)
16855 !! wikitext
16856 [[Image:foobar.jpg|640px ]]
16857 !! html
16858 <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>
16859 </p>
16860 !!end
16861
16862 !! test
16863 Width-sized image (using px, with preceding whitespace - test regression from r39467)
16864 !! wikitext
16865 [[Image:foobar.jpg| 640px]]
16866 !! html
16867 <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>
16868 </p>
16869 !!end
16870
16871 !! test
16872 Image with page parameter
16873 !! options
16874 djvu
16875 !! wikitext
16876 [[File:LoremIpsum.djvu|page=2]]
16877 !! html/php
16878 <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>
16879 </p>
16880 !! html/parsoid
16881 <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>
16882 !! end
16883
16884 !! test
16885 Another italics / bold test
16886 !! wikitext
16887 ''' ''x'
16888 !! html
16889 <pre>'<i> </i>x'
16890 </pre>
16891 !!end
16892
16893 # FIXME: The php output seems broken. It's interleaving some open/close tags.
16894 !! test
16895 dt/dd/dl test
16896 !! wikitext
16897 :;;;::
16898 !! html/php
16899 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
16900
16901 !! html/parsoid
16902 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
16903
16904 !!end
16905
16906
16907 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
16908 !! test
16909 Images with the "|" character in the comment
16910 !! wikitext
16911 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
16912 !! html/php
16913 <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>
16914
16915 !! html/parsoid
16916 <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>
16917 !! end
16918
16919 !! test
16920 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
16921 !! wikitext
16922 <html><script>alert(1);</script></html>
16923 !! html
16924 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
16925 </p>
16926 !! end
16927
16928 !! test
16929 HTML with raw HTML ($wgRawHtml==true)
16930 !! options
16931 wgRawHtml=1
16932 !! wikitext
16933 <html><script>alert(1);</script></html>
16934 !! html
16935 <p><script>alert(1);</script>
16936 </p>
16937 !! end
16938
16939 !! test
16940 Parents of subpages, one level up
16941 !! options
16942 subpage title=[[Subpage test/L1/L2/L3]]
16943 !! wikitext
16944 [[../|L2]]
16945 !! html
16946 <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>
16947 </p>
16948 !! end
16949
16950
16951 !! test
16952 Parents of subpages, one level up, not named
16953 !! options
16954 subpage title=[[Subpage test/L1/L2/L3]]
16955 !! wikitext
16956 [[../]]
16957 !! html
16958 <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>
16959 </p>
16960 !! end
16961
16962
16963
16964 !! test
16965 Parents of subpages, two levels up
16966 !! options
16967 subpage title=[[Subpage test/L1/L2/L3]]
16968 !! wikitext
16969 [[../../|L1]]2
16970
16971 [[../../|L1]]l
16972 !! html
16973 <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
16974 </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>
16975 </p>
16976 !! end
16977
16978 !! test
16979 Parents of subpages, two levels up, without trailing slash or name.
16980 !! options
16981 subpage title=[[Subpage test/L1/L2/L3]]
16982 !! wikitext
16983 [[../..]]
16984 !! html
16985 <p>[[../..]]
16986 </p>
16987 !! end
16988
16989 !! test
16990 Parents of subpages, two levels up, with lots of extra trailing slashes.
16991 !! options
16992 subpage title=[[Subpage test/L1/L2/L3]]
16993 !! wikitext
16994 [[../../////]]
16995 !! html
16996 <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>
16997 </p>
16998 !! end
16999
17000 !! article
17001 Subpage test/L1/L2/L3Sibling
17002 !! text
17003 Sibling article
17004 !! endarticle
17005
17006 !! test
17007 Transclusion of a sibling page (one level up)
17008 !! options
17009 subpage title=[[Subpage test/L1/L2/L3]]
17010 !! wikitext
17011 {{../L3Sibling}}
17012 !! html
17013 <p>Sibling article
17014 </p>
17015 !! end
17016
17017 !! test
17018 Transclusion of a child page
17019 !! options
17020 subpage title=[[Subpage test/L1/L2]]
17021 !! wikitext
17022 {{/L3Sibling}}
17023 !! html
17024 <p>Sibling article
17025 </p>
17026 !! end
17027
17028 !! test
17029 Non-transclusion because of too many up levels
17030 !! options
17031 subpage title=[[Subpage test/L1/L2/L3]]
17032 !! wikitext
17033 {{../../../../More than parent}}
17034 !! html
17035 <p>{{../../../../More than parent}}
17036 </p>
17037 !! end
17038
17039 !! test
17040 Definition list code coverage
17041 !! wikitext
17042 ; title : def
17043 ; title : def
17044 ;title: def
17045 !! html/php
17046 <dl><dt> title &#160;</dt>
17047 <dd> def</dd>
17048 <dt> title&#160;</dt>
17049 <dd> def</dd>
17050 <dt>title</dt>
17051 <dd> def</dd></dl>
17052
17053 !! html/parsoid
17054 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17055 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17056 <dt>title</dt><dd> def</dd></dl>
17057 !! end
17058
17059 !! test
17060 Don't fall for the self-closing div
17061 !! wikitext
17062 <div>hello world</div/>
17063 !! html
17064 <div>hello world</div>
17065
17066 !! end
17067
17068 !! test
17069 MSGNW magic word
17070 !! wikitext
17071 {{MSGNW:msg}}
17072 !! html
17073 <p>&#91;&#91;:Template:Msg&#93;&#93;
17074 </p>
17075 !! end
17076
17077 !! test
17078 RAW magic word
17079 !! wikitext
17080 {{RAW:QUERTY}}
17081 !! html
17082 <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>
17083 </p>
17084 !! end
17085
17086 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
17087 !! test
17088 Always escape literal '>' in output, not just after '<'
17089 !! wikitext
17090 ><>
17091 !! html
17092 <p>&gt;&lt;&gt;
17093 </p>
17094 !! end
17095
17096 !! test
17097 Template caching
17098 !! wikitext
17099 {{Test}}
17100 {{Test}}
17101 !! html
17102 <p>This is a test template
17103 This is a test template
17104 </p>
17105 !! end
17106
17107
17108 !! article
17109 MediaWiki:Fake
17110 !! text
17111 ==header==
17112 !! endarticle
17113
17114 !! test
17115 Inclusion of !userCanEdit() content
17116 !! wikitext
17117 {{MediaWiki:Fake}}
17118 !! html
17119 <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>
17120
17121 !! end
17122
17123
17124 !! test
17125 Out-of-order TOC heading levels
17126 !! wikitext
17127 ==2==
17128 ======6======
17129 ===3===
17130 =1=
17131 =====5=====
17132 ==2==
17133 !! html
17134 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17135 <ul>
17136 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
17137 <ul>
17138 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
17139 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
17140 </ul>
17141 </li>
17142 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
17143 <ul>
17144 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
17145 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
17146 </ul>
17147 </li>
17148 </ul>
17149 </div>
17150
17151 <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>
17152 <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>
17153 <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>
17154 <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>
17155 <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>
17156 <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>
17157
17158 !! end
17159
17160
17161 !! test
17162 ISBN with a dummy number
17163 !! wikitext
17164 ISBN ---
17165 !! html
17166 <p>ISBN ---
17167 </p>
17168 !! end
17169
17170
17171 !! test
17172 ISBN with space-delimited number
17173 !! wikitext
17174 ISBN 92 9017 032 8
17175 !! html
17176 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
17177 </p>
17178 !! end
17179
17180
17181 !! test
17182 ISBN with multiple spaces, no number
17183 !! wikitext
17184 ISBN foo
17185 !! html
17186 <p>ISBN foo
17187 </p>
17188 !! end
17189
17190
17191 !! test
17192 ISBN length
17193 !! wikitext
17194 ISBN 123456789
17195
17196 ISBN 1234567890
17197
17198 ISBN 12345678901
17199 !! html
17200 <p>ISBN 123456789
17201 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17202 </p><p>ISBN 12345678901
17203 </p>
17204 !! end
17205
17206
17207 !! test
17208 ISBN with trailing year (bug 8110)
17209 !! wikitext
17210 ISBN 1-234-56789-0 - 2006
17211
17212 ISBN 1 234 56789 0 - 2006
17213 !! html
17214 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
17215 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
17216 </p>
17217 !! end
17218
17219
17220 !! test
17221 anchorencode
17222 !! wikitext
17223 {{anchorencode:foo bar©#%n}}
17224 !! html
17225 <p>foo_bar.C2.A9.23.25n
17226 </p>
17227 !! end
17228
17229 !! test
17230 anchorencode trims spaces
17231 !! wikitext
17232 {{anchorencode: __pretty__please__}}
17233 !! html
17234 <p>pretty_please
17235 </p>
17236 !! end
17237
17238 !! test
17239 anchorencode deals with links
17240 !! wikitext
17241 {{anchorencode: [[hello|world]] [[hi]]}}
17242 !! html
17243 <p>world_hi
17244 </p>
17245 !! end
17246
17247 !! test
17248 anchorencode deals with templates
17249 !! wikitext
17250 {{anchorencode: {{Foo}} }}
17251 !! html
17252 <p>FOO
17253 </p>
17254 !! end
17255
17256 !! test
17257 anchorencode encodes like the TOC generator: (bug 18431)
17258 !! wikitext
17259 === _ +:.3A%3A&&amp;]] ===
17260 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17261 __NOEDITSECTION__
17262 !! html
17263 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17264 <p>.2B:.3A.253A.26.26.5D.5D
17265 </p>
17266 !! end
17267
17268 !! test
17269 Bug 6200: blockquotes and paragraph formatting
17270 !! wikitext
17271 <blockquote>
17272 foo
17273 </blockquote>
17274
17275 bar
17276
17277 baz
17278 !! html
17279 <blockquote>
17280 <p>foo
17281 </p>
17282 </blockquote>
17283 <p>bar
17284 </p>
17285 <pre>baz
17286 </pre>
17287 !! end
17288
17289 !! test
17290 Bug 8293: Use of center tag ruins paragraph formatting
17291 !! wikitext
17292 <center>
17293 foo
17294 </center>
17295
17296 bar
17297
17298 baz
17299 !! html
17300 <center>
17301 <p>foo
17302 </p>
17303 </center>
17304 <p>bar
17305 </p>
17306 <pre>baz
17307 </pre>
17308 !! end
17309
17310 !!test
17311 Parsing of overlapping (improperly nested) inline html tags
17312 !! wikitext
17313 <span><s>x</span></s>
17314 !! html/php
17315 <p><span><s>x&lt;/span&gt;</s></span>
17316 </p>
17317 !! html/parsoid
17318 <p><span><s>x</s></span>
17319 </p>
17320 !!end
17321
17322 ###
17323 ### Language variants related tests
17324 ###
17325 !! test
17326 Self-link in language variants
17327 !! options
17328 title=[[Dunav]] language=sr
17329 !! wikitext
17330 Both [[Dunav]] and [[Дунав]] are names for this river.
17331 !! html
17332 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17333 </p>
17334 !!end
17335
17336 !! article
17337 Дуна
17338 !! text
17339 content
17340 !! endarticle
17341
17342 !! test
17343 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17344 !! options
17345 title=[[Duna]] language=sr
17346 !! wikitext
17347 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17348 !! html
17349 <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.
17350 </p>
17351 !! end
17352
17353 !! test
17354 Link to a section of a variant of this title shouldn't be parsed as self-link
17355 !! options
17356 title=[[Duna]] language=sr
17357 !! wikitext
17358 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
17359 !! html
17360 <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.
17361 </p>
17362 !! end
17363
17364 !! test
17365 Link to pages in language variants
17366 !! options
17367 language=sr
17368 !! wikitext
17369 Main Page can be written as [[Маин Паге]]
17370 !! html
17371 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
17372 </p>
17373 !!end
17374
17375
17376 !! test
17377 Multiple links to pages in language variants
17378 !! options
17379 language=sr
17380 !! wikitext
17381 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
17382 !! html
17383 <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>.
17384 </p>
17385 !!end
17386
17387
17388 !! test
17389 Simple template in language variants
17390 !! options
17391 language=sr
17392 !! wikitext
17393 {{тест}}
17394 !! html
17395 <p>This is a test template
17396 </p>
17397 !! end
17398
17399
17400 !! test
17401 Template with explicit namespace in language variants
17402 !! options
17403 language=sr
17404 !! wikitext
17405 {{Template:тест}}
17406 !! html
17407 <p>This is a test template
17408 </p>
17409 !! end
17410
17411
17412 !! test
17413 Basic test for template parameter in language variants
17414 !! options
17415 language=sr
17416 !! wikitext
17417 {{парамтест|param=foo}}
17418 !! html
17419 <p>This is a test template with parameter foo
17420 </p>
17421 !! end
17422
17423
17424 !! test
17425 Simple category in language variants
17426 !! options
17427 language=sr cat
17428 !! wikitext
17429 [[Category:МедиаWики Усер'с Гуиде]]
17430 !! html
17431 <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>
17432 !! end
17433
17434
17435 !! article
17436 Category:分类
17437 !! text
17438 blah
17439 !! endarticle
17440
17441 !! article
17442 Category:分類
17443 !! text
17444 blah
17445 !! endarticle
17446
17447 !! test
17448 Don't convert blue categorylinks to another variant (bug 33210)
17449 !! options
17450 language=zh cat
17451 !! wikitext
17452 [[A]][[Category:分类]]
17453 !! html
17454 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
17455 !! end
17456
17457
17458 !! test
17459 Stripping -{}- tags (language variants)
17460 !! options
17461 language=sr
17462 !! wikitext
17463 Latin proverb: -{Ne nuntium necare}-
17464 !! html
17465 <p>Latin proverb: Ne nuntium necare
17466 </p>
17467 !! end
17468
17469
17470 !! test
17471 Prevent conversion with -{}- tags (language variants)
17472 !! options
17473 language=sr variant=sr-ec
17474 !! wikitext
17475 Latinski: -{Ne nuntium necare}-
17476 !! html
17477 <p>Латински: Ne nuntium necare
17478 </p>
17479 !! end
17480
17481
17482 !! test
17483 Prevent conversion of text with -{}- tags (language variants)
17484 !! options
17485 language=sr variant=sr-ec
17486 !! wikitext
17487 Latinski: -{Ne nuntium necare}-
17488 !! html
17489 <p>Латински: Ne nuntium necare
17490 </p>
17491 !! end
17492
17493
17494 !! test
17495 Prevent conversion of links with -{}- tags (language variants)
17496 !! options
17497 language=sr variant=sr-ec
17498 !! wikitext
17499 -{[[Main Page]]}-
17500 !! html
17501 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17502 </p>
17503 !! end
17504
17505
17506 !! test
17507 -{}- tags within headlines (within html for parserConvert())
17508 !! options
17509 language=sr variant=sr-ec
17510 !! wikitext
17511 == -{Naslov}- ==
17512 !! html
17513 <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>
17514
17515 !! end
17516
17517
17518 !! test
17519 Explicit definition of language variant alternatives
17520 !! options
17521 language=zh variant=zh-tw
17522 !! wikitext
17523 -{zh:China;zh-tw:Taiwan}-, not China
17524 !! html
17525 <p>Taiwan, not China
17526 </p>
17527 !! end
17528
17529
17530 !! test
17531 Conversion around HTML tags
17532 !! options
17533 language=sr variant=sr-ec
17534 !! wikitext
17535 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
17536 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
17537 !! html
17538 <p>
17539 <span title="ЛаCтин">ски</span>
17540 </p>
17541 !! end
17542
17543
17544 !! test
17545 Explicit session-wise language variant mapping (A flag and - flag)
17546 !! options
17547 language=zh variant=zh-tw
17548 !! wikitext
17549 Taiwan is not China.
17550 But -{A|zh:China;zh-tw:Taiwan}- is China,
17551 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
17552 and -{China}- is China.
17553 !! html
17554 <p>Taiwan is not China.
17555 But Taiwan is Taiwan,
17556 (This should be stripped!)
17557 and China is China.
17558 </p>
17559 !! end
17560
17561 !! test
17562 Explicit session-wise language variant mapping (H flag for hide)
17563 !! options
17564 language=zh variant=zh-tw
17565 !! wikitext
17566 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
17567 Taiwan is China.
17568 !! html
17569 <p>(This should be stripped!)
17570 Taiwan is Taiwan.
17571 </p>
17572 !! end
17573
17574 !! test
17575 Adding explicit conversion rule for title (T flag)
17576 !! options
17577 language=zh variant=zh-tw showtitle
17578 !! wikitext
17579 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17580 !! html
17581 Taiwan
17582 <p>Should be stripped!
17583 </p>
17584 !! end
17585
17586 !! test
17587 Testing that changing the language variant here in the tests actually works
17588 !! options
17589 language=zh variant=zh showtitle
17590 !! wikitext
17591 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17592 !! html
17593 China
17594 <p>Should be stripped!
17595 </p>
17596 !! end
17597
17598 !! test
17599 Recursive conversion of alt and title attrs shouldn't clear converter state
17600 !! options
17601 language=zh variant=zh-cn showtitle
17602 !! wikitext
17603 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
17604 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
17605 !! html
17606 China
17607 <p>
17608 Should be stripped<span title="Exclamation">!</span>
17609 </p>
17610 !! end
17611
17612 !! test
17613 Bug 24072: more test on conversion rule for title
17614 !! options
17615 language=zh variant=zh-tw showtitle
17616 !! wikitext
17617 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17618 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
17619 !! html
17620 Taiwan
17621 <p>This should be stripped!
17622 This won't take interferes with the title rule.
17623 </p>
17624 !! end
17625
17626 !! test
17627 Partly disable title conversion if variant == main language code
17628 !! options
17629 language=zh variant=zh title=[[ZH]] showtitle
17630 !! wikitext
17631 -{T|zh-cn:CN;zh-tw:TW}-
17632 !! html
17633 ZH
17634 <p>
17635 </p>
17636 !! end
17637
17638 !! test
17639 Partly disable title conversion if variant == main language code, more
17640 !! options
17641 language=zh variant=zh title=[[ZH]] showtitle
17642 !! wikitext
17643 -{T|TW}-
17644 !! html
17645 ZH
17646 <p>
17647 </p>
17648 !! end
17649
17650 !! test
17651 Raw output of variant escape tags (R flag)
17652 !! options
17653 language=zh variant=zh-tw
17654 !! wikitext
17655 Raw: -{R|zh:China;zh-tw:Taiwan}-
17656 !! html
17657 <p>Raw: zh:China;zh-tw:Taiwan
17658 </p>
17659 !! end
17660
17661 !! test
17662 Nested using of manual convert syntax
17663 !! options
17664 language=zh variant=zh-hk
17665 !! wikitext
17666 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
17667 !! html
17668 <p>Nested: Hello Hong Kong!
17669 </p>
17670 !! end
17671
17672 !! test
17673 Proper conversion of text in external links
17674 !! options
17675 language=sr variant=sr-ec
17676 !! wikitext
17677 http://www.google.com
17678 gopher://www.google.com
17679 [http://www.google.com http://www.google.com]
17680 [gopher://www.google.com gopher://www.google.com]
17681 [https://www.google.com irc://www.google.com]
17682 [ftp://www.google.com www.google.com/ftp://dir]
17683 [//www.google.com www.google.com]
17684 !! html
17685 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17686 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17687 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17688 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17689 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
17690 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
17691 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
17692 </p>
17693 !! end
17694
17695 !! test
17696 Do not convert roman numbers to language variants
17697 !! options
17698 language=sr variant=sr-ec
17699 !! wikitext
17700 Fridrih IV je car.
17701 !! html
17702 <p>Фридрих IV је цар.
17703 </p>
17704 !! end
17705
17706 !! test
17707 Unclosed language converter markup "-{"
17708 !! options
17709 language=sr
17710 !! wikitext
17711 -{T|hello
17712 !! html
17713 <p>-{T|hello
17714 </p>
17715 !! end
17716
17717 !! test
17718 Don't convert raw rule "-{R|=&gt;}-" to "=>"
17719 !! options
17720 language=sr
17721 !! wikitext
17722 -{R|=&gt;}-
17723 !! html
17724 <p>=&gt;
17725 </p>
17726 !!end
17727
17728 !! test
17729 Don't break link parsing if language converter markup is in the caption.
17730 !! options
17731 language=sr variant=sr-ec
17732 !! wikitext
17733 [[Main Page|-{R|main page}-]]
17734 !! html
17735 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
17736 </p>
17737 !! end
17738
17739 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17740 !! test
17741 Don't break image parsing if language converter markup is in the caption.
17742 !! options
17743 language=sr
17744 !! wikitext
17745 [[File:Foobar.jpg|-{R|caption}-]]
17746 !! html/parsoid
17747 <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>
17748 </p>
17749 !! end
17750
17751 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17752 !! test
17753 Don't break list handling if language converter markup is in the item.
17754 !! options
17755 language=zh variant=zh-cn
17756 !! wikitext
17757 ;-{zh-cn:AAA;zh-tw:BBB}-
17758 !! html/php
17759 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
17760
17761 !! html/parsoid
17762 <dl><dt>AAA
17763 </dt></dl>
17764 !! end
17765
17766 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17767 !! test
17768 Don't break table handling if language converter markup is in the cell.
17769 !! options
17770 language=sr variant=sr-ec
17771 !! wikitext
17772 {|
17773 |-
17774 | -{R|B}-
17775 |}
17776 !! html/php
17777 <table>
17778
17779 <tr>
17780 <td>Б}-
17781 </td></tr></table>
17782
17783 !! html/parsoid
17784 <table>
17785
17786 <tr>
17787 <td> B
17788 </td></tr></table>
17789
17790 !! end
17791
17792 !! test
17793 Bug 529: Uncovered bullet
17794 !! wikitext
17795 * Foo {{bullet}}
17796 !! html
17797 <ul><li> Foo </li>
17798 <li> Bar</li></ul>
17799
17800 !! end
17801
17802 # Plain MediaWiki does not remove empty lists, but tidy actually does.
17803 # Templates in Wikipedia rely on this behavior, as tidy has always been
17804 # enabled there. These tests are normally run *without* tidy, so specify the
17805 # full output here.
17806 # To test realistic parsing behavior, apply a tidy-like transformation to both
17807 # the expected output and your parser's output.
17808 !! test
17809 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
17810 !! wikitext
17811 ******* Foo {{bullet}}
17812 !! html
17813 <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>
17814 <li> Bar</li></ul>
17815
17816 !! end
17817
17818 !! test
17819 Bug 529: Uncovered table already at line-start
17820 !! wikitext
17821 x
17822
17823 {{table}}
17824 y
17825 !! html
17826 <p>x
17827 </p>
17828 <table>
17829 <tr>
17830 <td> 1 </td>
17831 <td> 2
17832 </td></tr>
17833 <tr>
17834 <td> 3 </td>
17835 <td> 4
17836 </td></tr></table>
17837 <p>y
17838 </p>
17839 !! end
17840
17841 !! test
17842 Bug 529: Uncovered bullet in parser function result
17843 !! wikitext
17844 * Foo {{lc:{{bullet}} }}
17845 !! html
17846 <ul><li> Foo </li>
17847 <li> bar</li></ul>
17848
17849 !! end
17850
17851 !! test
17852 Bug 5678: Double-parsed template argument
17853 !! wikitext
17854 {{lc:{{{1}}}|hello}}
17855 !! html
17856 <p>{{{1}}}
17857 </p>
17858 !! end
17859
17860 !! test
17861 Bug 5678: Double-parsed template invocation
17862 !! wikitext
17863 {{lc:{{paramtest {{!}} param = hello }} }}
17864 !! html
17865 <p>{{paramtest | param = hello }}
17866 </p>
17867 !! end
17868
17869 !! test
17870 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
17871 !! options
17872 language=cs
17873 title=[[Main Page]]
17874 !! wikitext
17875 {{PRVNÍVELKÉ:ěščř}}
17876 {{prvnívelké:ěščř}}
17877 {{PRVNÍMALÉ:ěščř}}
17878 {{prvnímalé:ěščř}}
17879 {{MALÁ:ěščř}}
17880 {{malá:ěščř}}
17881 {{VELKÁ:ěščř}}
17882 {{velká:ěščř}}
17883 !! html
17884 <p>Ěščř
17885 Ěščř
17886 ěščř
17887 ěščř
17888 ěščř
17889 ěščř
17890 ĚŠČŘ
17891 ĚŠČŘ
17892 </p>
17893 !! end
17894
17895 !! test
17896 Morwen/13: Unclosed link followed by heading
17897 !! wikitext
17898 [[link
17899 ==heading==
17900 !! html
17901 <p>[[link
17902 </p>
17903 <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>
17904
17905 !! end
17906
17907 !! test
17908 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
17909 !! wikitext
17910 {{foo|
17911 =heading=
17912 !! html
17913 <p>{{foo|
17914 </p>
17915 <h1><span class="mw-headline" id="heading">heading</span></h1>
17916
17917 !! end
17918
17919 !! test
17920 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
17921 !! wikitext
17922 {{foo|
17923 ==heading==
17924 !! html
17925 <p>{{foo|
17926 </p>
17927 <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>
17928
17929 !! end
17930
17931 !! test
17932 Tildes in comments
17933 !! options
17934 pst
17935 !! wikitext
17936 <!-- ~~~~ -->
17937 !! html
17938 <!-- ~~~~ -->
17939 !! end
17940
17941 !! test
17942 Paragraphs inside divs (no extra line breaks)
17943 !! wikitext
17944 <div>Line one
17945
17946 Line two</div>
17947 !! html
17948 <div>Line one
17949 Line two</div>
17950
17951 !! end
17952
17953 !! test
17954 Paragraphs inside divs (extra line break on open)
17955 !! wikitext
17956 <div>
17957 Line one
17958
17959 Line two</div>
17960 !! html
17961 <div>
17962 <p>Line one
17963 </p>
17964 Line two</div>
17965
17966 !! end
17967
17968 !! test
17969 Paragraphs inside divs (extra line break on close)
17970 !! wikitext
17971 <div>Line one
17972
17973 Line two
17974 </div>
17975 !! html
17976 <div>Line one
17977 <p>Line two
17978 </p>
17979 </div>
17980
17981 !! end
17982
17983 !! test
17984 Paragraphs inside divs (extra line break on open and close)
17985 !! wikitext
17986 <div>
17987 Line one
17988
17989 Line two
17990 </div>
17991 !! html
17992 <div>
17993 <p>Line one
17994 </p><p>Line two
17995 </p>
17996 </div>
17997
17998 !! end
17999
18000 !! test
18001 Nesting tags, paragraphs on lines which begin with <div>
18002 !! wikitext
18003 <div></div><strong>A
18004 B</strong>
18005 !! html/php+tidy
18006 <p><strong>A</strong></p>
18007 <p><strong>B</strong></p>
18008 !! html/parsoid
18009 <div></div>
18010 <p><strong>A
18011 B</strong>
18012 </p>
18013 !! end
18014
18015 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
18016 !! test
18017 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
18018 !! wikitext
18019 <blockquote>Line one
18020
18021 Line two</blockquote>
18022 !! html
18023 <blockquote>Line one
18024 Line two</blockquote>
18025
18026 !! html+tidy
18027 <blockquote>
18028 <p>Line one Line two</p>
18029 </blockquote>
18030 !! end
18031
18032 !! test
18033 Bug 6200: paragraphs inside blockquotes (extra line break on open)
18034 !! wikitext
18035 <blockquote>
18036 Line one
18037
18038 Line two</blockquote>
18039 !! html
18040 <blockquote>
18041 <p>Line one
18042 </p>
18043 Line two</blockquote>
18044
18045 !! html+tidy
18046 <blockquote>
18047 <p>Line one</p>
18048 Line two</blockquote>
18049 !! end
18050
18051 !! test
18052 Bug 6200: paragraphs inside blockquotes (extra line break on close)
18053 !! wikitext
18054 <blockquote>Line one
18055
18056 Line two
18057 </blockquote>
18058 !! html
18059 <blockquote>Line one
18060 <p>Line two
18061 </p>
18062 </blockquote>
18063
18064 !! html+tidy
18065 <blockquote>
18066 <p>Line one</p>
18067 <p>Line two</p>
18068 </blockquote>
18069 !! end
18070
18071 !! test
18072 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
18073 !! wikitext
18074 <blockquote>
18075 Line one
18076
18077 Line two
18078 </blockquote>
18079 !! html
18080 <blockquote>
18081 <p>Line one
18082 </p><p>Line two
18083 </p>
18084 </blockquote>
18085
18086 !! html+tidy
18087 <blockquote>
18088 <p>Line one</p>
18089 <p>Line two</p>
18090 </blockquote>
18091 !! end
18092
18093 !! test
18094 Paragraphs inside blockquotes/divs (no extra line breaks)
18095 !! wikitext
18096 <blockquote><div>Line one
18097
18098 Line two</div></blockquote>
18099 !! html
18100 <blockquote><div>Line one
18101 Line two</div></blockquote>
18102
18103 !! end
18104
18105 !! test
18106 Paragraphs inside blockquotes/divs (extra line break on open)
18107 !! wikitext
18108 <blockquote><div>
18109 Line one
18110
18111 Line two</div></blockquote>
18112 !! html
18113 <blockquote><div>
18114 <p>Line one
18115 </p>
18116 Line two</div></blockquote>
18117
18118 !! end
18119
18120 !! test
18121 Paragraphs inside blockquotes/divs (extra line break on close)
18122 !! wikitext
18123 <blockquote><div>Line one
18124
18125 Line two
18126 </div></blockquote>
18127 !! html
18128 <blockquote><div>Line one
18129 <p>Line two
18130 </p>
18131 </div></blockquote>
18132
18133 !! end
18134
18135 !! test
18136 Paragraphs inside blockquotes/divs (extra line break on open and close)
18137 !! wikitext
18138 <blockquote><div>
18139 Line one
18140
18141 Line two
18142 </div></blockquote>
18143 !! html
18144 <blockquote><div>
18145 <p>Line one
18146 </p><p>Line two
18147 </p>
18148 </div></blockquote>
18149
18150 !! end
18151
18152 !! test
18153 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
18154 !! options
18155 wgLinkHolderBatchSize=0
18156 !! wikitext
18157 [[meatball:1]]
18158 [[meatball:2]]
18159 [[meatball:3]]
18160 !! html
18161 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
18162 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
18163 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
18164 </p>
18165 !! end
18166
18167 !! test
18168 Free external link invading image caption
18169 !! wikitext
18170 [[Image:Foobar.jpg|thumb|http://x|hello]]
18171 !! html
18172 <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>
18173
18174 !! end
18175
18176 !! test
18177 Bug 15196: localised external link numbers
18178 !! options
18179 language=fa
18180 !! wikitext
18181 [http://en.wikipedia.org/]
18182 !! html/php
18183 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
18184 </p>
18185 !! html/parsoid
18186 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
18187 !! end
18188
18189 !! test
18190 Multibyte character in padleft
18191 !! wikitext
18192 {{padleft:-Hello|7|Æ}}
18193 !! html
18194 <p>Æ-Hello
18195 </p>
18196 !! end
18197
18198 !! test
18199 Multibyte character in padright
18200 !! wikitext
18201 {{padright:Hello-|7|Æ}}
18202 !! html
18203 <p>Hello-Æ
18204 </p>
18205 !! end
18206
18207 !!test
18208 formatdate parser function
18209 !! wikitext
18210 {{#formatdate:2009-03-24}}
18211 !! html
18212 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
18213 </p>
18214 !! end
18215
18216 !!test
18217 formatdate parser function, with default format
18218 !! wikitext
18219 {{#formatdate:2009-03-24|mdy}}
18220 !! html
18221 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
18222 </p>
18223 !! end
18224
18225 !! test
18226 Spacing of numbers in formatted dates
18227 !! wikitext
18228 {{#formatdate:January 15}}
18229 !! html
18230 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18231 </p>
18232 !! end
18233
18234 !! test
18235 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
18236 !! options
18237 language=nl title=[[MediaWiki:Common.css]]
18238 !! wikitext
18239 {{#formatdate:2009-03-24|dmy}}
18240 !! html
18241 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18242 </p>
18243 !! end
18244
18245 #
18246 #
18247 #
18248
18249 #
18250 # Edit comments
18251 #
18252
18253 !! test
18254 Edit comment with link
18255 !! options
18256 comment
18257 !! wikitext
18258 I like the [[Main Page]] a lot
18259 !! html
18260 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18261 !!end
18262
18263 !! test
18264 Edit comment with link and link text
18265 !! options
18266 comment
18267 !! wikitext
18268 I like the [[Main Page|best pages]] a lot
18269 !! html
18270 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18271 !!end
18272
18273 !! test
18274 Edit comment with link and link text with suffix
18275 !! options
18276 comment
18277 !! wikitext
18278 I like the [[Main Page|best page]]s 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 section link (non-local, eg in history list)
18285 !! options
18286 comment title=[[Main Page]]
18287 !! wikitext
18288 /* External links */ removed bogus entries
18289 !! html
18290 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18291 !!end
18292
18293 !! test
18294 Edit comment with section link and text before it (non-local, eg in history list)
18295 !! options
18296 comment title=[[Main Page]]
18297 !! wikitext
18298 pre-comment text /* External links */ removed bogus entries
18299 !! html
18300 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>
18301 !!end
18302
18303 !! test
18304 Edit comment with section link (local, eg in diff view)
18305 !! options
18306 comment local title=[[Main Page]]
18307 !! wikitext
18308 /* External links */ removed bogus entries
18309 !! html
18310 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18311 !!end
18312
18313 !! test
18314 Edit comment with subpage link (bug 14080)
18315 !! options
18316 comment
18317 subpage
18318 title=[[Subpage test]]
18319 !! wikitext
18320 Poked at a [[/subpage]] here...
18321 !! html
18322 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
18323 !!end
18324
18325 !! test
18326 Edit comment with subpage link and link text (bug 14080)
18327 !! options
18328 comment
18329 subpage
18330 title=[[Subpage test]]
18331 !! wikitext
18332 Poked at a [[/subpage|neat little page]] here...
18333 !! html
18334 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
18335 !!end
18336
18337 !! test
18338 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
18339 !! options
18340 comment
18341 title=[[Subpage test]]
18342 !! wikitext
18343 Poked at a [[/subpage]] here...
18344 !! html
18345 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...
18346 !!end
18347
18348 !! test
18349 Edit comment with bare anchor link (local, as on diff)
18350 !! options
18351 comment
18352 local
18353 title=[[Main Page]]
18354 !! wikitext
18355 [[#section]]
18356 !! html
18357 <a href="#section">#section</a>
18358 !! end
18359
18360 !! test
18361 Edit comment with bare anchor link (non-local, as on history)
18362 !! options
18363 comment
18364 title=[[Main Page]]
18365 !! wikitext
18366 [[#section]]
18367 !! html
18368 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
18369 !! end
18370
18371 !! test
18372 Anchor starting with underscore
18373 !! wikitext
18374 [[#_ref|One]]
18375 !! html
18376 <p><a href="#_ref">One</a>
18377 </p>
18378 !! end
18379
18380 !! test
18381 Id starting with underscore
18382 !! wikitext
18383 <div id="_ref"></div>
18384 !! html
18385 <div id="_ref"></div>
18386
18387 !! end
18388
18389 !! test
18390 Space normalisation on autocomment (bug 22784)
18391 !! options
18392 comment
18393 title=[[Main Page]]
18394 !! wikitext
18395 /* __hello__world__ */
18396 !! html
18397 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
18398 !! end
18399
18400 !! test
18401 percent-encoding and + signs in comments (Bug 26410)
18402 !! options
18403 comment
18404 !! wikitext
18405 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
18406 !! html
18407 <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>
18408 !! end
18409
18410 # Parsoid doesn't support this yet: see bug 73581
18411 # but it *should* omit the 'src' attribute if the image is bad.
18412 # PHP side of tests was disabled in
18413 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
18414 # because of issues in the PHP parserTests infrastructure
18415 # (but the output below is indeed what the PHP side emits)
18416 !! test
18417 Bad images - basic functionality
18418 !! wikitext
18419 [[File:Bad.jpg]]
18420 !! DISABLED/html/php
18421 !! html/parsoid
18422 <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>
18423 !! end
18424
18425 !! test
18426 Bad images - bug 16039: text after bad image disappears
18427 !! wikitext
18428 Foo bar
18429 [[File:Bad.jpg]]
18430 Bar foo
18431 !! DISABLED/html/php
18432 <p>Foo bar
18433 </p><p>Bar foo
18434 </p>
18435 !! html/parsoid
18436 <p>Foo bar
18437 <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>
18438 Bar foo</p>
18439 !! end
18440
18441 !! test
18442 Verify that displaytitle works (bug #22501) no displaytitle
18443 !! options
18444 showtitle
18445 !! config
18446 wgAllowDisplayTitle=true
18447 wgRestrictDisplayTitle=false
18448 !! wikitext
18449 this is not the the title
18450 !! html
18451 Parser test
18452 <p>this is not the the title
18453 </p>
18454 !! end
18455
18456 !! test
18457 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
18458 !! options
18459 showtitle
18460 title=[[Screen]]
18461 !! config
18462 wgAllowDisplayTitle=true
18463 wgRestrictDisplayTitle=false
18464 !! wikitext
18465 this is not the the title
18466 {{DISPLAYTITLE:whatever}}
18467 !! html
18468 whatever
18469 <p>this is not the the title
18470 </p>
18471 !! end
18472
18473 !! test
18474 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
18475 !! options
18476 showtitle
18477 title=[[Screen]]
18478 !! config
18479 wgAllowDisplayTitle=true
18480 wgRestrictDisplayTitle=true
18481 !! wikitext
18482 this is not the the title
18483 {{DISPLAYTITLE:whatever}}
18484 !! html
18485 Screen
18486 <p>this is not the the title
18487 </p>
18488 !! end
18489
18490 !! test
18491 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
18492 !! options
18493 showtitle
18494 title=[[Screen]]
18495 !! config
18496 wgAllowDisplayTitle=true
18497 wgRestrictDisplayTitle=true
18498 !! wikitext
18499 this is not the the title
18500 {{DISPLAYTITLE:screen}}
18501 !! html
18502 screen
18503 <p>this is not the the title
18504 </p>
18505 !! end
18506
18507 !! test
18508 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
18509 !! options
18510 showtitle
18511 title=[[Screen]]
18512 !! config
18513 wgAllowDisplayTitle=false
18514 !! wikitext
18515 this is not the the title
18516 {{DISPLAYTITLE:screen}}
18517 !! html
18518 Screen
18519 <p>this is not the the title
18520 <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>
18521 </p>
18522 !! end
18523
18524 !! test
18525 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
18526 !! options
18527 showtitle
18528 title=[[Screen]]
18529 !! config
18530 wgAllowDisplayTitle=false
18531 !! wikitext
18532 this is not the the title
18533 !! html
18534 Screen
18535 <p>this is not the the title
18536 </p>
18537 !! end
18538
18539 !! test
18540 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
18541 !! options
18542 showtitle
18543 title=[[Screen]]
18544 !! config
18545 wgAllowDisplayTitle=true
18546 wgRestrictDisplayTitle=true
18547 !! wikitext
18548 this is not the the title
18549 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
18550 !! html
18551 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
18552 <p>this is not the the title
18553 </p>
18554 !! end
18555
18556 !! test
18557 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
18558 !! options
18559 showtitle
18560 title=[[Screen]]
18561 !! config
18562 wgAllowDisplayTitle=true
18563 wgRestrictDisplayTitle=true
18564 !! wikitext
18565 this is not the the title
18566 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
18567 !! html
18568 <span style="color: red;">s</span>creen
18569 <p>this is not the the title
18570 </p>
18571 !! end
18572
18573 !! test
18574 preload: check <noinclude> and <includeonly>
18575 !! options
18576 preload
18577 !! wikitext
18578 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
18579 !! html
18580 Hello kind world.
18581 !! end
18582
18583 !! test
18584 preload: check <onlyinclude>
18585 !! options
18586 preload
18587 !! wikitext
18588 Goodbye <onlyinclude>Hello world</onlyinclude>
18589 !! html
18590 Hello world
18591 !! end
18592
18593 !! test
18594 preload: can pass tags through if we want to
18595 !! options
18596 preload
18597 !! wikitext
18598 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
18599 !! html
18600 <includeonly>Hello world</includeonly>
18601 !! end
18602
18603 !! test
18604 preload: check that it doesn't try to do tricks
18605 !! options
18606 preload
18607 !! wikitext
18608 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18609 !! html
18610 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18611 !! end
18612
18613 !! test
18614 Play a bit with r67090 and bug 3158
18615 !! wikitext
18616 <div style="width:50% !important">&nbsp;</div>
18617 <div style="width:50%&nbsp;!important">&nbsp;</div>
18618 <div style="width:50%&#160;!important">&nbsp;</div>
18619 <div style="border : solid;">&nbsp;</div>
18620 !! html/php
18621 <div style="width:50% !important">&#160;</div>
18622 <div style="width:50% !important">&#160;</div>
18623 <div style="width:50% !important">&#160;</div>
18624 <div style="border&#160;: solid;">&#160;</div>
18625
18626 !! html/parsoid
18627 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18628 <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>
18629 <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>
18630 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18631
18632 !! end
18633
18634 !! test
18635 HTML5 data attributes
18636 !! wikitext
18637 <span data-foo="bar">Baz</span>
18638 <p data-abc-def_hij="">Quuz</p>
18639 !! html
18640 <p><span data-foo="bar">Baz</span>
18641 </p>
18642 <p data-abc-def_hij="">Quuz</p>
18643
18644 !! end
18645
18646 !! test
18647 percent-encoding and + signs in internal links (Bug 26410)
18648 !! wikitext
18649 [[User:+%]] [[Page+title%]]
18650 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
18651 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
18652 [[%33%45]] [[%33%45+]]
18653 !! html/php
18654 <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>
18655 <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>
18656 <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>
18657 <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>
18658 </p>
18659 !! html/parsoid
18660 <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>
18661 !! end
18662
18663 !! test
18664 Special characters in embedded file links (bug 27679)
18665 !! wikitext
18666 [[File:Contains & ampersand.jpg]]
18667 [[File:Does not exist.jpg|Title with & ampersand]]
18668 !! html/php
18669 <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>
18670 <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>
18671 </p>
18672 !! html/parsoid
18673 <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>
18674 <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>
18675 !! end
18676
18677 !! test
18678 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
18679 !! wikitext
18680 Text&apos;s been normalized?
18681 !! html
18682 <p>Text&#39;s been normalized?
18683 </p>
18684 !! end
18685
18686 !! test
18687 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
18688 !! wikitext
18689 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
18690 !! html
18691 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
18692 </p>
18693 !! end
18694
18695 !! test
18696 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
18697 !! wikitext
18698 [http://www.example.org/ ideograms]
18699 !! html
18700 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
18701 </p>
18702 !! end
18703
18704 !! test
18705 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
18706 !! wikitext
18707 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
18708 !! html
18709 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
18710 </p>
18711 !! end
18712
18713 !! article
18714 Mediawiki:loop1
18715 !! text
18716 {{Identical|A}}
18717 !! endarticle
18718
18719 !! article
18720 Mediawiki:loop2
18721 !! text
18722 {{Identical|B}}
18723 !! endarticle
18724
18725 !! article
18726 Template:Identical
18727 !! text
18728 {{int:loop1}}
18729 {{int:loop2}}
18730 !! endarticle
18731
18732 !! test
18733 Bug 31098 Template which includes system messages which includes the template
18734 !! wikitext
18735 {{Identical}}
18736 !! html
18737 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18738 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18739 </p>
18740 !! end
18741
18742 !! test
18743 Bug31490 Turkish: ucfirst 'blah'
18744 !! options
18745 language=tr
18746 !! wikitext
18747 {{ucfirst:blah}}
18748 !! html
18749 <p>Blah
18750 </p>
18751 !! end
18752
18753 !! test
18754 Bug31490 Turkish: ucfirst 'ix'
18755 !! options
18756 language=tr
18757 !! wikitext
18758 {{ucfirst:ix}}
18759 !! html
18760 <p>İx
18761 </p>
18762 !! end
18763
18764 !! test
18765 Bug31490 Turkish: lcfirst 'BLAH'
18766 !! options
18767 language=tr
18768 !! wikitext
18769 {{lcfirst:BLAH}}
18770 !! html
18771 <p>bLAH
18772 </p>
18773 !! end
18774
18775 !! test
18776 Bug31490 Turkish: ucfırst (with a dotless i)
18777 !! options
18778 language=tr
18779 !! wikitext
18780 {{ucfırst:blah}}
18781 !! html
18782 <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>
18783 </p>
18784 !! end
18785
18786 !! test
18787 Bug31490 ucfırst (with a dotless i) with English language
18788 !! options
18789 language=en
18790 !! wikitext
18791 {{ucfırst:blah}}
18792 !! html
18793 <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>
18794 </p>
18795 !! end
18796
18797 !! test
18798 Bug 26375: TOC with italics
18799 !! options
18800 title=[[Main Page]]
18801 !! wikitext
18802 __TOC__
18803 == ''Lost'' episodes ==
18804 !! html
18805 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18806 <ul>
18807 <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>
18808 </ul>
18809 </div>
18810
18811 <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>
18812
18813 !! end
18814
18815 !! test
18816 Bug 26375: TOC with bold
18817 !! options
18818 title=[[Main Page]]
18819 !! wikitext
18820 __TOC__
18821 == '''should be bold''' then normal text ==
18822 !! html
18823 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18824 <ul>
18825 <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>
18826 </ul>
18827 </div>
18828
18829 <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>
18830
18831 !! end
18832
18833 !! test
18834 Bug 33845: Headings become cursive in TOC when they contain an image
18835 !! options
18836 title=[[Main Page]]
18837 !! wikitext
18838 __TOC__
18839 == Image [[Image:foobar.jpg]] ==
18840 !! html
18841 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18842 <ul>
18843 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
18844 </ul>
18845 </div>
18846
18847 <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>
18848
18849 !! end
18850
18851 !! test
18852 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
18853 !! options
18854 title=[[Main Page]]
18855 !! wikitext
18856 __TOC__
18857 == <blockquote>Quote</blockquote> ==
18858 !! html
18859 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18860 <ul>
18861 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18862 </ul>
18863 </div>
18864
18865 <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>
18866
18867 !! html+tidy
18868 <div id="toc" class="toc">
18869 <div id="toctitle">
18870 <h2>Contents</h2>
18871 </div>
18872 <ul>
18873 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18874 </ul>
18875 </div>
18876 <h2><span class="mw-headline" id="Quote"></span></h2>
18877 <blockquote>
18878 <p><span class="mw-headline" id="Quote">Quote</span></p>
18879 </blockquote>
18880 <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>
18881 !! end
18882
18883 !! test
18884 Unclosed tags in TOC
18885 !! options
18886 title=[[Main Page]]
18887 !! wikitext
18888 __TOC__
18889 == Proof: 2 < 3 ==
18890 <small>Hanc marginis exiguitas non caperet.</small>
18891 QED
18892 !! html
18893 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18894 <ul>
18895 <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>
18896 </ul>
18897 </div>
18898
18899 <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>
18900 <p><small>Hanc marginis exiguitas non caperet.</small>
18901 QED
18902 </p>
18903 !! end
18904
18905 !! test
18906 Multiple tags in TOC
18907 !! wikitext
18908 __TOC__
18909 == <i>Foo</i> <b>Bar</b> ==
18910
18911 == <i>Foo</i> <blockquote>Bar</blockquote> ==
18912 !! html
18913 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18914 <ul>
18915 <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>
18916 <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>
18917 </ul>
18918 </div>
18919
18920 <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>
18921 <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>
18922
18923 !! html+tidy
18924 <div id="toc" class="toc">
18925 <div id="toctitle">
18926 <h2>Contents</h2>
18927 </div>
18928 <ul>
18929 <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>
18930 <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>
18931 </ul>
18932 </div>
18933 <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>
18934 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
18935 <blockquote>
18936 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
18937 </blockquote>
18938 <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>
18939 !! end
18940
18941 !! test
18942 Tags with parameters in TOC
18943 !! wikitext
18944 __TOC__
18945 == <sup class="in-h2">Hello</sup> ==
18946
18947 == <sup class="a > b">Evilbye</sup> ==
18948 !! html
18949 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18950 <ul>
18951 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
18952 <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>
18953 </ul>
18954 </div>
18955
18956 <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>
18957 <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>
18958
18959 !! end
18960
18961 !! test
18962 span tags with directionality in TOC
18963 !! wikitext
18964 __TOC__
18965 == <span dir="ltr">C++</span> ==
18966
18967 == <span dir="rtl">זבנג!</span> ==
18968
18969 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
18970
18971 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
18972
18973 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
18974 !! html
18975 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18976 <ul>
18977 <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>
18978 <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>
18979 <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>
18980 <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>
18981 <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>
18982 </ul>
18983 </div>
18984
18985 <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>
18986 <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>
18987 <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>
18988 <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>
18989 <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>
18990
18991 !! end
18992
18993 !! article
18994 MediaWiki:Bug32057
18995 !! text
18996 == {{int:headline_sample}} ==
18997 !! endarticle
18998
18999 !! test
19000 Bug 32057: Title needed when expanding <h> nodes.
19001 !! options
19002 title=[[Main Page]]
19003 !! wikitext
19004 {{int:Bug32057}}
19005 !! html
19006 <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>
19007
19008 !! end
19009
19010 !! test
19011 Strip marker in urlencode
19012 !! wikitext
19013 {{urlencode:x<nowiki/>y}}
19014 {{urlencode:x<nowiki/>y|wiki}}
19015 {{urlencode:x<nowiki/>y|path}}
19016 !! html
19017 <p>xy
19018 xy
19019 xy
19020 </p>
19021 !! end
19022
19023 !! test
19024 Strip marker in lc
19025 !! wikitext
19026 {{lc:x<nowiki/>y}}
19027 !! html
19028 <p>xy
19029 </p>
19030 !! end
19031
19032 !! test
19033 Strip marker in uc
19034 !! wikitext
19035 {{uc:x<nowiki/>y}}
19036 !! html
19037 <p>XY
19038 </p>
19039 !! end
19040
19041 !! test
19042 Strip marker in formatNum
19043 !! wikitext
19044 {{formatnum:1<nowiki/>2}}
19045 {{formatnum:1<nowiki/>2|R}}
19046 !! html
19047 <p>12
19048 12
19049 </p>
19050 !! end
19051
19052 !! test
19053 Check noCommafy in formatNum
19054 !! options
19055 language=be-tarask
19056 !! wikitext
19057 {{formatnum:123456.78}}
19058 {{formatnum:123456.78|NOSEP}}
19059 !! html
19060 <p>123 456,78
19061 123456.78
19062 </p>
19063 !! end
19064
19065 !! test
19066 Wrong option for formatNum (bug 56199)
19067 !! wikitext
19068 {{formatnum:1,234.56|Random}}
19069 {{formatnum:1,234.56|EVERYTHING}}
19070 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
19071 !! html
19072 <p>1,234.56
19073 1,234.56
19074 1,234.56
19075 </p>
19076 !! end
19077
19078 !! test
19079 Strip marker in grammar
19080 !! options
19081 language=fi
19082 !! wikitext
19083 {{grammar:elative|foo<nowiki/>bar}}
19084 !! html
19085 <p>foobarista
19086 </p>
19087 !! end
19088
19089 !! test
19090 Strip marker in padleft
19091 !! wikitext
19092 {{padleft:|2|x<nowiki/>y}}
19093 !! html
19094 <p>xy
19095 </p>
19096 !! end
19097
19098 !! test
19099 Strip marker in padright
19100 !! wikitext
19101 {{padright:|2|x<nowiki/>y}}
19102 !! html
19103 <p>xy
19104 </p>
19105 !! end
19106
19107 !! test
19108 Strip marker in anchorencode
19109 !! wikitext
19110 {{anchorencode:x<nowiki/>y}}
19111 !! html
19112 <p>xy
19113 </p>
19114 !! end
19115
19116 !! test
19117 nowiki inside link inside heading (bug 18295)
19118 !! wikitext
19119 ==[[foo|x<nowiki>y</nowiki>z]]==
19120 !! html
19121 <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>
19122
19123 !! end
19124
19125 !! test
19126 new support for bdi element (bug 31817)
19127 !! wikitext
19128 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19129 !! html
19130 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19131
19132 !!end
19133
19134 !! test
19135 Ignore pipe between table row attributes
19136 !! wikitext
19137 {|
19138 | quux
19139 |- id=foo | style='color: red'
19140 | bar
19141 |}
19142 !! html
19143 <table>
19144 <tr>
19145 <td> quux
19146 </td></tr>
19147 <tr id="foo" style="color: red">
19148 <td> bar
19149 </td></tr></table>
19150
19151 !! end
19152
19153 !!test
19154 Gallery override link with WikiLink (bug 34852)
19155 !! wikitext
19156 <gallery>
19157 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
19158 </gallery>
19159 !! html
19160 <ul class="gallery mw-gallery-traditional">
19161 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19162 <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>
19163 <div class="gallerytext">
19164 <p>caption
19165 </p>
19166 </div>
19167 </div></li>
19168 </ul>
19169
19170 !! end
19171
19172 !!test
19173 Gallery override link with absolute external link (bug 34852)
19174 !! wikitext
19175 <gallery>
19176 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19177 </gallery>
19178 !! html
19179 <ul class="gallery mw-gallery-traditional">
19180 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19181 <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>
19182 <div class="gallerytext">
19183 <p>caption
19184 </p>
19185 </div>
19186 </div></li>
19187 </ul>
19188
19189 !! end
19190
19191 !!test
19192 Gallery override link with malicious javascript (bug 34852)
19193 !! wikitext
19194 <gallery>
19195 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19196 </gallery>
19197 !! html
19198 <ul class="gallery mw-gallery-traditional">
19199 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19200 <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>
19201 <div class="gallerytext">
19202 <p>caption
19203 </p>
19204 </div>
19205 </div></li>
19206 </ul>
19207
19208 !! end
19209
19210 !!test
19211 Gallery with invalid title as link (bug 43964)
19212 !! wikitext
19213 <gallery>
19214 File:foobar.jpg|link=<
19215 </gallery>
19216 !! html
19217 <ul class="gallery mw-gallery-traditional">
19218 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19219 <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>
19220 <div class="gallerytext">
19221 </div>
19222 </div></li>
19223 </ul>
19224
19225 !! end
19226
19227 !!test
19228 Language parser function
19229 !! wikitext
19230 {{#language:ar}}
19231 !! html
19232 <p>العربية
19233 </p>
19234 !! end
19235
19236 !!test
19237 Padleft and padright as substr
19238 !! wikitext
19239 {{padleft:|3|abcde}}
19240 {{padright:|3|abcde}}
19241 !! html
19242 <p>abc
19243 abc
19244 </p>
19245 !! end
19246
19247 !!test
19248 Special parser function
19249 !! wikitext
19250 {{#special:RandomPage}}
19251 {{#special:BaDtItLe}}
19252 {{#special:Foobar}}
19253 !! html
19254 <p>Special:Random
19255 Special:Badtitle
19256 Special:Foobar
19257 </p>
19258 !! end
19259
19260 !!test
19261 Bug 34939 - Case insensitive link parsing ([HttP://])
19262 !! wikitext
19263 [HttP://MediaWiki.Org/]
19264 !! html/php
19265 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
19266 </p>
19267 !! html/parsoid
19268 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
19269 !! end
19270
19271 !!test
19272 Bug 34939 - Case insensitive link parsing ([HttP:// title])
19273 !! wikitext
19274 [HttP://MediaWiki.Org/ MediaWiki]
19275 !! html
19276 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
19277 </p>
19278 !! end
19279
19280 !!test
19281 Bug 34939 - Case insensitive link parsing (HttP://)
19282 !! wikitext
19283 HttP://MediaWiki.Org/
19284 !! html/php
19285 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
19286 </p>
19287 !! html/parsoid
19288 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
19289 !! end
19290
19291 !!test
19292 Disable TOC
19293 !! options
19294 notoc
19295 !! wikitext
19296 Lead
19297 == Section 1 ==
19298 == Section 2 ==
19299 == Section 3 ==
19300 == Section 4 ==
19301 == Section 5 ==
19302 !! html
19303 <p>Lead
19304 </p>
19305
19306 <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>
19307 <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>
19308 <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>
19309 <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>
19310 <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>
19311
19312 !! end
19313
19314
19315 ###
19316 ### Parsoid-specific tests
19317 ### Parsoid-PHP parser incompatibilities
19318 ###
19319 !!test
19320 1. SOL-sensitive wikitext tokens as template-args
19321 !!options
19322 parsoid=wt2html,wt2wt
19323 !! wikitext
19324 {{echo|*a}}
19325 {{echo|#a}}
19326 {{echo|:a}}
19327 !! html
19328 <span about="#mwt1" typeof="mw:Transclusion">
19329 </span><ul about="#mwt1"><li>a</li>
19330 </ul>
19331 <span about="#mwt2" typeof="mw:Transclusion">
19332 </span><ol about="#mwt2"><li>a</li>
19333 </ol>
19334 <span about="#mwt3" typeof="mw:Transclusion">
19335 </span><dl about="#mwt3"><dd>a</dd>
19336 </dl>
19337 !!end
19338
19339 #### -----------------------------------------------------------------
19340 #### Parsoid-specific functionality tests
19341 #### -----------------------------------------------------------------
19342
19343 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
19344 # We know wt2wt will fail, but we expect selser to pass.
19345 # Due to the nature of our testing, wt2wt and selser tests will enter the
19346 # blacklist and we'll catch selser regressions based on changes to the
19347 # blacklist entries for selser tests.
19348 !! test
19349 1. Bad treebuilder fixup of formatting elt is cleaned up
19350 !! options
19351 parsoid=wt2html,wt2wt
19352 !! wikitext
19353 {|
19354 |
19355 <small>
19356 [[Image:Foobar.jpg|right|Test]]
19357 </small>
19358 |}
19359 !! html/parsoid
19360 <table>
19361 <tbody><tr><td>
19362 <small>
19363 <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>
19364 </small>
19365 </td></tr>
19366 </tbody></table>
19367 !! end
19368
19369 !! test
19370 2. Bad treebuilder fixup of formatting elt is cleaned up
19371 !! options
19372 parsoid=wt2html,wt2wt
19373 !! wikitext
19374 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
19375
19376 <small>[[Image:Foobar.jpg|right|300px]]</small>
19377 !! html/parsoid
19378 <p><b>foo</b></p>
19379 <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>
19380 <p><b>bar</b></p>
19381 <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>
19382 !! end
19383
19384 #### ----------------------------------------------------------------
19385 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
19386 #### tags. Parsoid's output for these tags differs from that of the
19387 #### PHP parser.
19388 #### ----------------------------------------------------------------
19389
19390 !!test
19391 Ref: 1. ref-location should be replaced with an index span
19392 !!options
19393 parsoid
19394 !! wikitext
19395 A <ref>foo</ref>
19396 B <ref name="x">foo</ref>
19397 C <ref name="y" />
19398 !! html
19399 <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>
19400 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>
19401 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>
19402 !!end
19403
19404 !!test
19405 Ref: 2. ref-tags with identical names should all get the same index
19406 !!options
19407 parsoid
19408 !! wikitext
19409 A <ref name="x">foo</ref>
19410 B <ref name="x" />
19411 !! html
19412 <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>
19413 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>
19414 !!end
19415
19416 !!test
19417 Ref: 3. spaces in ref-names should be ignored
19418 !!options
19419 parsoid
19420 !! wikitext
19421 A <ref name="x">foo</ref>
19422 B <ref name=" x " />
19423 C <ref name= x />
19424 !! html
19425 <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>
19426 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>
19427 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>
19428 !!end
19429
19430 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
19431 !!test
19432 Ref: 4. 'constructor' should be accepted as a valid ref-name
19433 !!options
19434 parsoid
19435 !! wikitext
19436 A <ref name="constructor">foo</ref>
19437 !! html
19438 <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>
19439 !!end
19440
19441 !!test
19442 Ref: 5. body should accept generic wikitext
19443 !!options
19444 parsoid
19445 !! wikitext
19446 A <ref>
19447 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
19448 </ref>
19449
19450 <references />
19451 !! html
19452 <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>
19453
19454 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19455 <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>
19456 </li>
19457 </ol>
19458 !!end
19459
19460 !!test
19461 Ref: 6. indent-pres should not be output in ref-body
19462 !!options
19463 parsoid
19464 !! wikitext
19465 A <ref>
19466 foo
19467 bar
19468 baz
19469 </ref>
19470
19471 <references />
19472 !! html
19473 <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>
19474
19475 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19476 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
19477 bar
19478 baz
19479 </li>
19480 </ol>
19481 !!end
19482
19483 !!test
19484 Ref: 7. No p-wrapping in ref-body
19485 !!options
19486 parsoid
19487 !! wikitext
19488 A <ref>
19489 foo
19490
19491 bar
19492
19493
19494 baz
19495
19496
19497
19498 booz
19499 </ref>
19500
19501 <references />
19502 !! html
19503 <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>
19504
19505 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19506 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
19507
19508 bar
19509
19510
19511 baz
19512
19513
19514
19515 booz
19516 </li>
19517 </ol>
19518 !!end
19519
19520 !!test
19521 Ref: 8. transclusion wikitext has lower precedence
19522 !!options
19523 parsoid
19524 !! wikitext
19525 A <ref> foo {{echo|</ref> B C}}
19526
19527 <references />
19528 !! html
19529 <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>
19530 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19531 <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>
19532 </ol>
19533 !!end
19534
19535 !!test
19536 Ref: 9. unclosed comments should not leak out of ref-body
19537 !!options
19538 parsoid
19539 !! wikitext
19540 A <ref> foo <!--</ref> B C
19541 <references />
19542 !! html
19543 <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>
19544 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19545 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li>
19546 </ol>
19547 !!end
19548
19549 !!test
19550 Ref: 10. Unclosed HTML tags should not leak out of ref-body
19551 !!options
19552 parsoid
19553 !! wikitext
19554 A <ref> <b> foo </ref> B C
19555
19556 <references />
19557 !! html
19558 <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>
19559
19560
19561 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19562 <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>
19563 </ol>
19564 !!end
19565
19566 !!test
19567 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
19568 !!options
19569 parsoid
19570 !! wikitext
19571 A <ref>foo</ref> B
19572 C <ref>bar</ref> D
19573 !! html
19574 <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
19575 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>
19576 !!end
19577
19578 !!test
19579 Ref: 12. ref-tags act as trailing newline migration barrier
19580 !!options
19581 parsoid
19582 !! wikitext
19583 <!--the newline at the end of this line moves out of the p-tag-->a
19584
19585 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
19586 <ref />
19587
19588 c
19589 !! html
19590 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
19591
19592
19593 <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>
19594 <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>
19595
19596 <p>c</p>
19597 !!end
19598
19599 !!test
19600 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
19601 !!options
19602 parsoid
19603 !! wikitext
19604 <ref>foo</ref> A
19605 <ref>bar
19606 </ref> B
19607 !! html
19608 <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
19609 <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>
19610 !!end
19611
19612 !!test
19613 Ref: 14. A nested ref-tag should be emitted as plain text
19614 !!options
19615 parsoid
19616 !! wikitext
19617 <ref>foo <ref>bar</ref> baz</ref>
19618
19619 <references />
19620 !! html
19621 <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>
19622
19623 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19624 <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>
19625 </ol>
19626 !!end
19627
19628 !!test
19629 Ref: 15. ref-tags with identical names should get identical indexes
19630 !!options
19631 parsoid
19632 !! wikitext
19633 A1 <ref name="a">foo</ref> A2 <ref name="a" />
19634 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
19635
19636 <references />
19637 !! html
19638 <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>
19639 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>
19640
19641 <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>
19642 </ol>
19643 !!end
19644
19645 ## We don't bother wt2wt-ing non-standard whitespace
19646 !!test
19647 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
19648 !!options
19649 parsoid=wt2html
19650 !! wikitext
19651 A <ref >foo</ref >
19652
19653 <references />
19654 !! html
19655 <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>
19656
19657 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19658 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19659 !!end
19660
19661 !!test
19662 Ref: 17. Generate valid HTML5 id/about attributes
19663 !!options
19664 parsoid
19665 !!wikitext
19666 <ref name="a b">foo</ref>
19667
19668 <references />
19669 !!html
19670 <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>
19671 </p>
19672
19673 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19674 <li id="cite_note-a_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_b-1-0">↑</a></span> foo</li>
19675 !!end
19676
19677 !!test
19678 References: 1. references tag without any refs should be handled properly
19679 !!options
19680 parsoid
19681 !! wikitext
19682 <references />
19683 !! html
19684 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
19685 !!end
19686
19687 !!test
19688 References: 2. references tag with group only outputs references from that group
19689 !!options
19690 parsoid
19691 !! wikitext
19692 A <ref group="a">foo</ref>
19693 B <ref group="b">bar</ref>
19694
19695 <references group="a" />
19696 !! html
19697 <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>
19698 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>
19699
19700 <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>
19701 </ol>
19702 !!end
19703
19704 !!test
19705 References: 3. ref list should be cleared after processing references
19706 !!options
19707 parsoid
19708 !! wikitext
19709 A <ref>foo</ref>
19710
19711 <references />
19712
19713 B <ref>bar</ref>
19714
19715 <references />
19716 !! html
19717 <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>
19718
19719 <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>
19720 </ol>
19721
19722 <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>
19723
19724 <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>
19725 </ol>
19726 !!end
19727
19728 !!test
19729 References: 4. only referenced group should be cleared after processing references
19730 !!options
19731 parsoid
19732 !! wikitext
19733 A <ref group="a">afoo</ref>
19734 B <ref>bfoo</ref>
19735
19736 <references group="a" />
19737
19738 C <ref>cfoo</ref>
19739
19740 <references />
19741 !! html
19742 <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>
19743 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>
19744
19745 <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>
19746 </ol>
19747
19748 <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>
19749
19750 <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>
19751 </ol>
19752 !!end
19753
19754 !!test
19755 References: 5. ref tags in references should be processed while ignoring all other content
19756 !!options
19757 parsoid
19758 !! wikitext
19759 A <ref name="a" />
19760 B <ref name="b">bar</ref>
19761
19762 <references>
19763 <ref name="a">foo</ref>
19764 This should just get lost.
19765 </references>
19766 !! html
19767 <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>
19768 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>
19769
19770
19771 <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>
19772 </ol>
19773 !!end
19774
19775 !!test
19776 References: 6. <references /> from a transclusion
19777 !!options
19778 parsoid
19779 !! wikitext
19780 <ref>Foo</ref> {{echo|<references />}}
19781 !! html
19782 <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>
19783 !!end
19784
19785 !! test
19786 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
19787 !! options
19788 parsoid
19789 !! wikitext
19790 A <ref>foo bar for a</ref>
19791 B <ref group="X" name="b" />
19792
19793 <references />
19794
19795 <references group="X">
19796 <ref name="b">foo</ref>
19797 </references>
19798 !! html
19799 <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>
19800 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>
19801
19802 <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>
19803
19804 <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>
19805 !! end
19806
19807 !! test
19808 Entities in ref name
19809 !! options
19810 parsoid
19811 !! wikitext
19812 <ref name="test &amp; me">hi</ref>
19813 !! html
19814 <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>
19815 !! end
19816
19817 # This test is wt2html only because we're permitting the serializer to produce
19818 # dirty diffs, normalizing the unclosed references to the self-closed version.
19819 !! test
19820 Generate references for unclosed references tag
19821 !! options
19822 parsoid=wt2html
19823 !! wikitext
19824 a<ref>foo</ref>
19825
19826 <references>
19827 !! html
19828 <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>
19829
19830
19831 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19832 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19833 !! end
19834
19835 !! test
19836 New reference serializes on its own line
19837 !! options
19838 parsoid=wt2wt,html2wt
19839 !! wikitext
19840 foo
19841 <references />
19842 !! html
19843 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
19844 !! end
19845
19846 #--------- Test stripping of empty nodes in template content ----------
19847 !!test
19848 Empty LI and TR nodes should be stripped from template content
19849 !!wikitext
19850 {{EmptyLITest}}
19851 {{EmptyTRTest}}
19852 !!html/parsoid
19853 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
19854 <li>a</li>
19855 <li>b</li>
19856 </ul>
19857 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
19858 <tbody>
19859 <tr>
19860 <td>foo</td>
19861 </tr>
19862 <tr>
19863 <td>bar</td>
19864 </tr>
19865 </tbody>
19866 </table>
19867 !!end
19868
19869 !!test
19870 Empty LI and TR nodes should not be stripped from top-level content
19871 !!wikitext
19872 * a
19873 *
19874 * b
19875 {|
19876 |-
19877 |-
19878 |foo
19879 |}
19880 !!html/parsoid
19881 <ul>
19882 <li> a</li>
19883 <li></li>
19884 <li> b</li>
19885 </ul>
19886 <table>
19887 <tbody>
19888 <tr></tr>
19889 <tr>
19890 <td>foo</td>
19891 </tr>
19892 </tbody>
19893 </table>
19894 !!end
19895
19896 !!test
19897 Empty TR nodes should not be stripped if they have any attributes set
19898 !!wikitext
19899 {{EmptyTRWithHTMLAttrTest}}
19900 !!html/parsoid
19901 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
19902 <tr align="center"></tr>
19903 <tr><td>foo</td></tr>
19904 <tr align="center"></tr>
19905 <tr><td>bar</td></tr>
19906 </table>
19907 !!end
19908
19909 #### ----------------------------------------------------------------
19910 #### The following section of tests are primarily to test
19911 #### wikitext escaping capabilities of Parsoid. Given that
19912 #### escaping can be done any number of ways, the wikitext (input)
19913 #### is always adjusted to reflect how Parsoid adds nowiki
19914 #### escape tags.
19915 ####
19916 #### We are marking several tests as parsoid-only since the
19917 #### HTML in the result section is different from what the
19918 #### PHP parser generates for it.
19919 #### ----------------------------------------------------------------
19920
19921
19922 #### --------------- Headings ---------------
19923 #### 0. Unnested
19924 #### 1. Nested inside html <h1>=foo=</h1>
19925 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
19926 #### 3. Nested inside html with wikitext split by html tags
19927 #### 4. No escape needed
19928 #### 5. Empty headings <h1></h1>
19929 #### 6. Heading chars in SOL context
19930 #### ----------------------------------------
19931 !! test
19932 Headings: 0. Unnested
19933 !! options
19934 parsoid
19935 !! wikitext
19936 <nowiki>=foo=</nowiki>
19937
19938 <nowiki> =foo= </nowiki>
19939 <!--cmt-->
19940 <nowiki>=foo=</nowiki>
19941
19942 =foo''a''<nowiki>=</nowiki>
19943 !! html
19944 <p><span typeof="mw:Nowiki">=foo=</span></p>
19945
19946 <p><span typeof="mw:Nowiki"> =foo= </span>
19947 <!--cmt-->
19948 <span typeof="mw:Nowiki">=foo=</span></p>
19949
19950 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
19951 !!end
19952
19953 # New headings and existing headings are handled differently
19954 !! test
19955 Headings: 1. Nested inside html
19956 !! options
19957 parsoid=html2wt
19958 !! wikitext
19959 = =foo= =
19960
19961 == =foo= ==
19962
19963 === =foo= ===
19964
19965 =<nowiki>=foo=</nowiki>=
19966 ==<nowiki>=foo=</nowiki>==
19967 ===<nowiki>=foo=</nowiki>===
19968 ====<nowiki>=foo=</nowiki>====
19969 =====<nowiki>=foo=</nowiki>=====
19970 ======<nowiki>=foo=</nowiki>======
19971
19972 !! html
19973 <h1>=foo=</h1>
19974 <h2>=foo=</h2>
19975 <h3>=foo=</h3>
19976
19977 <h1 data-parsoid=''>=foo=</h1>
19978 <h2 data-parsoid=''>=foo=</h2>
19979 <h3 data-parsoid=''>=foo=</h3>
19980 <h4 data-parsoid=''>=foo=</h4>
19981 <h5 data-parsoid=''>=foo=</h5>
19982 <h6 data-parsoid=''>=foo=</h6>
19983 !!end
19984
19985 !! test
19986 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
19987 !! options
19988 parsoid=html2wt
19989 !! wikitext
19990 = foo =
19991 <nowiki>*</nowiki>bar
19992
19993 = foo =
19994 =bar
19995
19996 = foo =
19997 <nowiki>=bar=</nowiki>
19998 !! html
19999 <h1>foo</h1>*bar
20000 <h1>foo</h1>=bar
20001 <h1>foo</h1>=bar=
20002 !!end
20003
20004 !! test
20005 Headings: 3. Nested inside html with wikitext split by html tags
20006 !! options
20007 parsoid=html2wt
20008 !! wikitext
20009 = ='''bold'''<nowiki>foo=</nowiki> =
20010 !! html
20011 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
20012 !!end
20013
20014 !! test
20015 Headings: 4a. No escaping needed (testing just h1 and h2)
20016 !! options
20017 parsoid=html2wt
20018 !! wikitext
20019 = =foo =
20020
20021 = foo= =
20022
20023 = =foo= =
20024
20025 = =foo= bar =
20026
20027 == =foo ==
20028
20029 == foo= ==
20030
20031 = ''=''foo= =
20032
20033 = <nowiki>=</nowiki> =
20034 !! html
20035 <h1>=foo</h1>
20036 <h1>foo=</h1>
20037 <h1> =foo= </h1>
20038 <h1>=foo= bar</h1>
20039 <h2>=foo</h2>
20040 <h2>foo=</h2>
20041 <h1><i>=</i>foo=</h1>
20042 <h1><span typeof="mw:Nowiki">=</span></h1>
20043 !!end
20044
20045 !! test
20046 Headings: 4b. No escaping needed (inside p-tags)
20047 !! options
20048 parsoid=html2wt
20049 !! wikitext
20050 ===
20051 =foo= x
20052 =foo= <s></s>
20053 !! html
20054 <p>===
20055 =foo= x
20056 =foo= <s></s>
20057 </p>
20058 !!end
20059
20060 !! test
20061 Headings: 5. Empty headings
20062 !! options
20063 parsoid
20064 !! wikitext
20065 =<nowiki/>=
20066
20067 ==<nowiki/>==
20068
20069 ===<nowiki/>===
20070
20071 ====<nowiki/>====
20072
20073 =====<nowiki/>=====
20074
20075 ======<nowiki/>======
20076 !! html
20077 <h1></h1>
20078 <h2></h2>
20079 <h3></h3>
20080 <h4></h4>
20081 <h5></h5>
20082 <h6></h6>
20083 !!end
20084
20085 !! test
20086 Headings: 6a. Heading chars in SOL context (with trailing spaces)
20087 !! options
20088 parsoid
20089 !! wikitext
20090 <nowiki>=a=</nowiki>
20091
20092 <nowiki>=a=</nowiki>
20093
20094 <nowiki>=a=</nowiki>
20095
20096 <nowiki>=a=</nowiki>
20097 !! html
20098 <p>=a=</p>
20099 <p>=a= </p>
20100 <p>=a= </p>
20101 <p>=a= </p>
20102 !!end
20103
20104 !! test
20105 Headings: 6b. Heading chars in SOL context (with trailing newlines)
20106 !! options
20107 parsoid
20108 !! wikitext
20109 <nowiki>=a=
20110 b</nowiki>
20111
20112 <nowiki>=a=
20113 b</nowiki>
20114
20115 <nowiki>=a=
20116 b</nowiki>
20117
20118 <nowiki>=a=
20119 b</nowiki>
20120 !! html
20121 <p>=a=
20122 b</p>
20123 <p>=a=
20124 b</p>
20125 <p>=a=
20126 b</p>
20127 <p>=a=
20128 b</p>
20129 </p>
20130 !!end
20131
20132 !! test
20133 Headings: 6c. Heading chars in SOL context (leading newline break)
20134 !! options
20135 parsoid
20136 !! wikitext
20137 a
20138 <nowiki>=b=</nowiki>
20139 !! html
20140 <p>a
20141 =b=</p>
20142 !!end
20143
20144 !! test
20145 Headings: 6d. Heading chars in SOL context (with interspersed comments)
20146 !! options
20147 parsoid
20148 !! wikitext
20149 <!--c0--><nowiki>=a=</nowiki>
20150
20151 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
20152 !! html
20153 <p><!--c0-->=a=</p>
20154 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
20155 !!end
20156
20157 !! test
20158 Headings: 6d. Heading chars in SOL context (No escaping needed)
20159 !! options
20160 parsoid=html2wt
20161 !! wikitext
20162 =a=<div>b</div>
20163 !! html
20164 =a=<div>b</div>
20165 !!end
20166
20167 #### --------------- Lists ---------------
20168 #### 0. Outside nests (*foo, etc.)
20169 #### 1. Nested inside html <ul><li>*foo</li></ul>
20170 #### 2. Inside definition lists
20171 #### 3. Only bullets at start should be escaped
20172 #### 4. No escapes needed
20173 #### 5. No unnecessary escapes
20174 #### 6. Escape bullets in SOL position
20175 #### 7. Escape bullets in a multi-line context
20176 #### ----------------------------------------
20177
20178 !! test
20179 Lists: 0. Outside nests
20180 !! wikitext
20181 <nowiki>*</nowiki>foo
20182
20183 <nowiki>#</nowiki>foo
20184
20185 <nowiki>;Foo:</nowiki>bar
20186 !! html
20187 <p>*foo
20188 </p><p>#foo
20189 </p><p>;Foo:bar
20190 </p>
20191 !!end
20192
20193 !! test
20194 Lists: 1. Nested inside html
20195 !! wikitext
20196 *<nowiki>*foo</nowiki>
20197
20198 *<nowiki>#foo</nowiki>
20199
20200 *<nowiki>:foo</nowiki>
20201
20202 *<nowiki>;foo</nowiki>
20203
20204 #<nowiki>*foo</nowiki>
20205
20206 #<nowiki>#foo</nowiki>
20207
20208 #<nowiki>:foo</nowiki>
20209
20210 #<nowiki>;foo</nowiki>
20211 !! html
20212 <ul><li>*foo</li></ul>
20213 <ul><li>#foo</li></ul>
20214 <ul><li>:foo</li></ul>
20215 <ul><li>;foo</li></ul>
20216 <ol><li>*foo</li></ol>
20217 <ol><li>#foo</li></ol>
20218 <ol><li>:foo</li></ol>
20219 <ol><li>;foo</li></ol>
20220
20221 !!end
20222
20223 !! test
20224 Lists: 2. Inside definition lists
20225 !! wikitext
20226 ;<nowiki>;foo</nowiki>
20227
20228 ;<nowiki>:foo</nowiki>
20229
20230 ;<nowiki>:foo</nowiki>
20231 :bar
20232
20233 :<nowiki>:foo</nowiki>
20234 !! html
20235 <dl><dt>;foo</dt></dl>
20236 <dl><dt>:foo</dt></dl>
20237 <dl><dt>:foo</dt>
20238 <dd>bar</dd></dl>
20239 <dl><dd>:foo</dd></dl>
20240
20241 !!end
20242
20243 !! test
20244 Lists: 3. Only bullets at start of text should be escaped
20245 !! wikitext
20246 *<nowiki>*foo*bar</nowiki>
20247
20248 *<nowiki>*foo</nowiki>''it''*bar
20249 !! html
20250 <ul><li>*foo*bar</li></ul>
20251 <ul><li>*foo<i>it</i>*bar</li></ul>
20252
20253 !!end
20254
20255 !! test
20256 Lists: 4. No escapes needed
20257 !! options
20258 parsoid
20259 !! wikitext
20260 *foo*bar
20261
20262 *''foo''*bar
20263
20264 *[[Foo]]: bar
20265
20266 *[[Foo]]*bar
20267 !! html
20268 <ul>
20269 <li>foo*bar
20270 </li>
20271 </ul>
20272 <ul>
20273 <li><i>foo</i>*bar
20274 </li>
20275 </ul>
20276 <ul>
20277 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
20278 </li>
20279 </ul>
20280 <ul>
20281 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
20282 </li>
20283 </ul>
20284 !!end
20285
20286 !! test
20287 Lists: 5. No unnecessary escapes
20288 !! wikitext
20289 * bar <span><nowiki>[[foo]]</nowiki></span>
20290
20291 *=bar <span><nowiki>[[foo]]</nowiki></span>
20292
20293 *[[bar <span><nowiki>[[foo]]</nowiki></span>
20294
20295 *]]bar <span><nowiki>[[foo]]</nowiki></span>
20296
20297 *=bar <span>foo]]</span>=
20298
20299 * <s></s>: a
20300 !! html
20301 <ul><li> bar <span>[[foo]]</span></li></ul>
20302 <ul><li>=bar <span>[[foo]]</span></li></ul>
20303 <ul><li>[[bar <span>[[foo]]</span></li></ul>
20304 <ul><li>]]bar <span>[[foo]]</span></li></ul>
20305 <ul><li>=bar <span>foo]]</span>=</li></ul>
20306 <ul><li> <s></s>: a</li></ul>
20307
20308 !!end
20309
20310 !! test
20311 Lists: 6. Escape bullets in SOL position
20312 !! options
20313 parsoid
20314 !! wikitext
20315 <!--cmt--><nowiki>*foo</nowiki>
20316 !! html
20317 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
20318 !!end
20319
20320 !! test
20321 Lists: 7. Escape bullets in a multi-line context
20322 !! wikitext
20323 a
20324 <nowiki>*</nowiki>b
20325 !! html
20326 <p>a
20327 *b
20328 </p>
20329 !!end
20330
20331 #### --------------- HRs ---------------
20332 #### 1. Single line
20333 #### -----------------------------------
20334
20335 !! test
20336 HRs: 1. Single line
20337 !! options
20338 parsoid
20339 !! wikitext
20340 ----<nowiki>----</nowiki>
20341 ----=foo=
20342 ----*foo
20343 !! html
20344 <hr><p><span typeof="mw:Nowiki">----</span></p>
20345 <hr><p>=foo=</p>
20346 <hr><p>*foo</p>
20347 !! end
20348
20349 #### --------------- Tables ---------------
20350 #### 1a. Simple example
20351 #### 1b. No escaping needed (!foo)
20352 #### 1c. No escaping needed (|foo)
20353 #### 1d. No escaping needed (|}foo)
20354 ####
20355 #### 2a. Nested in td (<td>foo|bar</td>)
20356 #### 2b. Nested in td (<td>foo||bar</td>)
20357 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
20358 ####
20359 #### 3a. Nested in th (<th>foo!bar</th>)
20360 #### 3b. Nested in th (<th>foo!!bar</th>)
20361 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
20362 ####
20363 #### 4a. Escape -
20364 #### 4b. Escape +
20365 #### 4c. No escaping needed
20366 #### --------------------------------------
20367
20368 !! test
20369 Tables: 1a. Simple example
20370 !! wikitext
20371 <nowiki>{|
20372 |}</nowiki>
20373 !! html
20374 <p>{|
20375 |}
20376 </p>
20377 !! end
20378
20379 !! test
20380 Tables: 1b. No escaping needed
20381 !! wikitext
20382 !foo
20383 !! html
20384 <p>!foo
20385 </p>
20386 !! end
20387
20388 !! test
20389 Tables: 1c. No escaping needed
20390 !! wikitext
20391 |foo
20392 !! html
20393 <p>|foo
20394 </p>
20395 !! end
20396
20397 !! test
20398 Tables: 1d. No escaping needed
20399 !! wikitext
20400 |}foo
20401 !! html
20402 <p>|}foo
20403 </p>
20404 !! end
20405
20406 !! test
20407 Tables: 2a. Nested in td
20408 !! options
20409 parsoid=html2wt
20410 !! wikitext
20411 {|
20412 |<nowiki>foo|bar</nowiki>
20413 |-
20414 |x<div><nowiki>a|b</nowiki></div>
20415 |}
20416 !! html
20417 <table><tbody><tr>
20418 <td>foo|bar</td></tr>
20419 <tr><td>x<div>a|b</div></td>
20420 </tbody></table>
20421 !! end
20422
20423 !! test
20424 Tables: 2b. Nested in td
20425 !! options
20426 parsoid
20427 !! wikitext
20428 {|
20429 |<nowiki>foo||bar</nowiki>
20430 |''it''<nowiki>foo||bar</nowiki>
20431 |}
20432 !! html
20433 <table><tbody><tr>
20434 <td><span typeof="mw:Nowiki">foo||bar</span></td>
20435 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
20436 !! end
20437
20438 !! test
20439 Tables: 2c. Nested in td -- no escaping needed
20440 !! options
20441 parsoid
20442 !! wikitext
20443 {|
20444 |foo!!bar
20445 |}
20446 !! html
20447 <table><tbody><tr><td>foo!!bar
20448 </td></tr></tbody></table>
20449
20450 !! end
20451
20452 !! test
20453 Tables: 3a. Nested in th
20454 !! options
20455 parsoid
20456 !! wikitext
20457 {|
20458 !foo!bar
20459 |}
20460 !! html
20461 <table><tbody><tr><th>foo!bar
20462 </th></tr></tbody></table>
20463
20464 !! end
20465
20466 !! test
20467 Tables: 3b. Nested in th
20468 !! options
20469 parsoid
20470 !! wikitext
20471 {|
20472 !<nowiki>foo!!bar</nowiki>
20473 |}
20474 !! html
20475 <table>
20476 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
20477 </tbody></table>
20478 !! end
20479
20480 !! test
20481 Tables: 3c. Nested in th -- no escaping needed
20482 !! options
20483 parsoid
20484 !! wikitext
20485 {|
20486 !<nowiki>foo||bar</nowiki>
20487 |}
20488 !! html
20489 <table><tbody><tr>
20490 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
20491 !! end
20492
20493 !! test
20494 Tables: 4a. Escape -
20495 !! options
20496 parsoid
20497 !! wikitext
20498 {|
20499 !-bar
20500 |-
20501 |<nowiki>-bar</nowiki>
20502 |}
20503 !! html
20504 <table><tbody>
20505 <tr><th>-bar</th></tr>
20506 <tr>
20507 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
20508 !! end
20509
20510 !! test
20511 Tables: 4b. Escape +
20512 !! options
20513 parsoid
20514 !! wikitext
20515 {|
20516 !+bar
20517 |-
20518 |<nowiki>+bar</nowiki>
20519 |}
20520 !! html
20521 <table><tbody>
20522 <tr><th>+bar</th></tr>
20523 <tr>
20524 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
20525 !! end
20526
20527 !! test
20528 Tables: 4c. No escaping needed
20529 !! options
20530 parsoid
20531 !! wikitext
20532 {|
20533 |foo-bar
20534 |foo+bar
20535 |-
20536 |''foo''-bar
20537 |''foo''+bar
20538 |-
20539 |foo
20540 bar|baz
20541 +bar
20542 -bar
20543 |-
20544 |x
20545 <div>a|b</div>
20546 |}
20547 !! html
20548 <table><tbody>
20549 <tr><td>foo-bar</td><td>foo+bar</td></tr>
20550 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
20551 <tr><td>foo
20552 <p>bar|baz
20553 +bar
20554 -bar</p></td></tr>
20555 <tr><td>x
20556 <div>a|b</div></td>
20557 </tbody></table>
20558 !! end
20559
20560 !! test
20561 Tables: 4d. No escaping needed
20562 !! options
20563 parsoid
20564 !! wikitext
20565 {|
20566 |[[Foo]]-bar
20567 ||+1
20568 ||-2
20569 |}
20570 !! html
20571 <table>
20572 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
20573 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
20574 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
20575 </tbody></table>
20576 !! end
20577
20578 !! test
20579 Tables: Digest broken attributes on table and tr tag
20580 !! options
20581 parsoid=wt2html
20582 !! wikitext
20583 {| || |} ++
20584 |- || || ++ --
20585 |- > [
20586 |}
20587 !! html
20588 <table>
20589 <tbody>
20590 <tr></tr>
20591 <tr></tr>
20592 </tbody></table>
20593 !! end
20594
20595 #### --------------- Links ----------------
20596 #### 1. Quote marks in link text
20597 #### 2. Wikilinks: Escapes needed
20598 #### 3. Wikilinks: No escapes needed
20599 #### 4. Extlinks: Escapes needed
20600 #### 5. Extlinks: No escapes needed
20601 #### --------------------------------------
20602 !! test
20603 Links 1. Quote marks in link text
20604 !! options
20605 parsoid
20606 !! wikitext
20607 [[Foo|Foo<nowiki>''boo''</nowiki>]]
20608 !! html
20609 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
20610 !! end
20611
20612 !! test
20613 Links 2. WikiLinks: Escapes needed
20614 !! options
20615 parsoid
20616 !! wikitext
20617 [[Foo|[Foobar]]]
20618 [[Foo|<nowiki>Foobar]</nowiki>]]
20619 [[Foo|x [Foobar] x]]
20620 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
20621 [[Foo|<nowiki>[[Bar]]</nowiki>]]
20622 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
20623 [[Foo|<nowiki>|Bar</nowiki>]]
20624 [[Foo|<nowiki>]]bar</nowiki>]]
20625 [[Foo|<nowiki>[[bar</nowiki>]]
20626 [[Foo|<nowiki>x [[ y</nowiki>]]
20627 [[Foo|<nowiki>x ]] y</nowiki>]]
20628 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
20629 !! html
20630 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
20631 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
20632 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
20633 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
20634 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
20635 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
20636 <a href="Foo" rel="mw:WikiLink">|Bar</a>
20637 <a href="Foo" rel="mw:WikiLink">]]bar</a>
20638 <a href="Foo" rel="mw:WikiLink">[[bar</a>
20639 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
20640 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
20641 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
20642 !! end
20643
20644 !! test
20645 Links 3. WikiLinks: No escapes needed
20646 !! options
20647 parsoid
20648 !! wikitext
20649 [[Foo|[Foobar]]
20650 [[Foo|foo|bar]]
20651 !! html
20652 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
20653 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
20654 !! end
20655
20656 !! test
20657 Links 4. ExtLinks: Escapes needed
20658 !! options
20659 parsoid
20660 !! wikitext
20661 [http://google.com <nowiki>[google]</nowiki>]
20662 [http://google.com <nowiki>google]</nowiki>]
20663
20664 <nowiki>[http://google.com]</nowiki>
20665
20666 <nowiki>[http://google.com google]</nowiki>
20667
20668 !! html
20669 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
20670 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
20671 <p>[http://google.com]</p>
20672 <p>[http://google.com google]</p>
20673 !! end
20674
20675 !! test
20676 Links 5. ExtLinks: No escapes needed
20677 !! options
20678 parsoid
20679 !! wikitext
20680 [http://google.com [google]
20681 !! html
20682 <a href="http://google.com" rel="mw:ExtLink">[google</a>
20683 !! end
20684
20685 !! test
20686 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
20687 !! html/parsoid
20688 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
20689 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
20690 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
20691 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
20692 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
20693 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
20694 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20695 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
20696 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20697 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
20698 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
20699 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
20700 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
20701 </p>
20702 !! wikitext
20703 x<nowiki/>http://example.com<nowiki/>y
20704 http://example.com<nowiki/>?x
20705 http://example.com<nowiki/>&x
20706 http://example.com<nowiki/>'x
20707 http://example.com<nowiki/>,x
20708 http://example.com<nowiki/>.x
20709 http://example.com<nowiki/>;x
20710 http://example.com<nowiki/>:x
20711 http://example.com<nowiki/>;x
20712 http://example.com<nowiki/>!x
20713 http://example.com<nowiki/>=x
20714 http://example.com<nowiki/>(x)
20715 http://example.com(x<nowiki/>)
20716 !! end
20717
20718 !! test
20719 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20720 !! html/parsoid
20721 <p>x
20722 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
20723 y
20724 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
20725 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
20726 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
20727 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
20728 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
20729 </p>
20730 !! wikitext
20731 x
20732 http://example.com
20733 y
20734 "http://example.com"
20735 (http://example.com)
20736 (http://example.com) foo
20737 http://example.com,
20738 http://example.com, foo
20739 !! end
20740
20741 ## Parsoid currently fails wt2html on this one!
20742 !! test
20743 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20744 !! html/parsoid
20745 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
20746 !! wikitext
20747 http://example.com.,;:!?
20748 !! end
20749
20750 !! test
20751 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
20752 !! html/parsoid
20753 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
20754 !! wikitext
20755 RFC 123<nowiki/>4
20756 !! end
20757
20758 !! test
20759 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
20760 !! html/parsoid
20761 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20762 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20763 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
20764 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
20765 </p>
20766 !! wikitext
20767 xRFC 123y
20768 XRFC 123y
20769 RFC 123?foo
20770 RFC 123&foo
20771 !! end
20772
20773 !! test
20774 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
20775 !! html/parsoid
20776 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
20777 !! wikitext
20778 PMID 123<nowiki/>4
20779 !! end
20780
20781 !! test
20782 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
20783 !! html/parsoid
20784 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20785 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20786 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
20787 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
20788 </p>
20789 !! wikitext
20790 xPMID 123y
20791 XPMID 123y
20792 PMID 123?foo
20793 PMID 123&foo
20794 !! end
20795
20796 !! test
20797 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
20798 !! html/parsoid
20799 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
20800 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
20801 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
20802 </p>
20803 !! wikitext
20804 ISBN 1234567890<nowiki/>1
20805 ISBN 1234567890<nowiki/>x
20806 ISBN 1234567890<nowiki/>b
20807 !! end
20808
20809 !! test
20810 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
20811 !! html/parsoid
20812 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
20813 !! wikitext
20814 ISBN 1234567890's
20815 !! end
20816
20817 #### --------------- Quotes ---------------
20818 #### 1. Quotes inside <b> and <i>
20819 #### 2. Link fragments separated by <i> and <b> tags
20820 #### 3. Link fragments inside <i> and <b>
20821 #### 4. No escaping needed
20822 #### --------------------------------------
20823 !! test
20824 1. Quotes inside <b> and <i>
20825 !! options
20826 parsoid=html2wt,wt2wt
20827 !! wikitext
20828 ''<nowiki/>'foo'<nowiki/>''
20829 ''<nowiki>''foo''</nowiki>''
20830 ''<nowiki>'''foo'''</nowiki>''
20831 ''foo''<nowiki/>'s
20832 '''<nowiki/>'foo'<nowiki/>'''
20833 '''<nowiki>''foo''</nowiki>'''
20834 '''<nowiki>'''foo'''</nowiki>'''
20835 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
20836 '''foo'''<nowiki/>'s
20837 '<nowiki/>''foo''
20838 ''foo''<nowiki/>'
20839 '<nowiki/>''foo''<nowiki/>'
20840 '<nowiki/>'''foo'''
20841 '''foo'''<nowiki/>'
20842 '<nowiki/>'''foo'''<nowiki/>'
20843 ''fools'<span> errand</span>''
20844 ''<span>fool</span>'s errand''
20845 !! html/*
20846 <p><i>'foo'</i>
20847 <i>''foo''</i>
20848 <i>'''foo'''</i>
20849 <i>foo</i>'s
20850 <b>'foo'</b>
20851 <b>''foo''</b>
20852 <b>'''foo'''</b>
20853 <b>foo'<i>bar'</i>baz</b>
20854 <b>foo</b>'s
20855 '<i>foo</i>
20856 <i>foo</i>'
20857 '<i>foo</i>'
20858 '<b>foo</b>
20859 <b>foo</b>'
20860 '<b>foo</b>'
20861 <i>fools'<span> errand</span></i>
20862 <i><span>fool</span>'s errand</i>
20863 </p>
20864 !! end
20865
20866 !! test
20867 2. Link fragments separated by <i> and <b> tags
20868 !! wikitext
20869 [[''foo''<nowiki>hello]]</nowiki>
20870
20871 [['''foo'''<nowiki>hello]]</nowiki>
20872 !! html
20873 <p>[[<i>foo</i>hello]]
20874 </p><p>[[<b>foo</b>hello]]
20875 </p>
20876 !! end
20877
20878 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
20879 # this is one of the shortcomings of this format
20880 !! test
20881 3. Link fragments inside <i> and <b>
20882 !! wikitext
20883 ''[[foo''<nowiki>]]</nowiki>
20884
20885 '''[[foo'''<nowiki>]]</nowiki>
20886 !! html
20887 <p><i>[[foo</i>]]
20888 </p><p><b>[[foo</b>]]
20889 </p>
20890 !! end
20891
20892 !! test
20893 4. No escaping needed
20894 !! wikitext
20895 '<span>''bar''</span>'
20896 '<span>'''bar'''</span>'
20897 !! html
20898 <p>'<span><i>bar</i></span>'
20899 '<span><b>bar</b></span>'
20900 </p>
20901 !! end
20902
20903 #### ----------- Paragraphs ---------------
20904 #### 1. No unnecessary escapes
20905 #### --------------------------------------
20906
20907 !! test
20908 1. No unnecessary escapes
20909 !! wikitext
20910 bar <span><nowiki>[[foo]]</nowiki></span>
20911
20912 =bar <span><nowiki>[[foo]]</nowiki></span>
20913
20914 [[bar <span><nowiki>[[foo]]</nowiki></span>
20915
20916 ]]bar <span><nowiki>[[foo]]</nowiki></span>
20917
20918 =bar <span>foo]]</span><nowiki>=</nowiki>
20919 !! html
20920 <p>bar <span>[[foo]]</span>
20921 </p><p>=bar <span>[[foo]]</span>
20922 </p><p>[[bar <span>[[foo]]</span>
20923 </p><p>]]bar <span>[[foo]]</span>
20924 </p><p>=bar <span>foo]]</span>=
20925 </p>
20926 !!end
20927
20928 #### ----------------------- PRE --------------------------
20929 #### 1. Leading whitespace in SOL context should be escaped
20930 #### ------------------------------------------------------
20931 !! test
20932 1. Leading whitespace in SOL context should be escaped
20933 !! options
20934 parsoid
20935 !! wikitext
20936 <nowiki> </nowiki>a
20937
20938 <nowiki> </nowiki> a
20939
20940 <nowiki> </nowiki>a(tab)
20941
20942 <nowiki> </nowiki> a
20943 <!--cmt-->
20944 <nowiki> </nowiki> a
20945
20946 a
20947 <nowiki> </nowiki>b
20948
20949 a
20950 <nowiki> </nowiki>b
20951
20952 a
20953 <nowiki> </nowiki> b
20954 !! html
20955 <p> a</p>
20956 <p> a</p>
20957 <p> a(tab)</p>
20958 <p> a</p>
20959 <p><!--cmt--> a</p>
20960 <p>a
20961 b</p>
20962 <p>a
20963 b</p>
20964 <p>a
20965 b</p>
20966 !! end
20967
20968 !! test
20969 2. Leading whitespace in non-indent-pre contexts should not be escaped
20970 !! options
20971 parsoid
20972 !! wikitext
20973 foo <ref>''a''
20974 b</ref>
20975 !! html
20976 <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>
20977 !! end
20978
20979 !! test
20980 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
20981 !! options
20982 parsoid
20983 !! wikitext
20984 <blockquote>
20985 a
20986 <span>b</span>
20987 c
20988 </blockquote>
20989 !! html
20990 <blockquote>
20991 <p>
20992 a
20993 <span>b</span>
20994 c</p>
20995 </blockquote>
20996 !! end
20997
20998 !! test
20999 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
21000 !! options
21001 parsoid
21002 !! wikitext
21003 [[File:Foobar.jpg|thumb|caption]]
21004 !! html
21005 !! html/parsoid
21006 <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>
21007 !! end
21008
21009 !! test
21010 5. Nowiki escaping should account for indent-pres
21011 !! options
21012 parsoid=html2wt
21013 !! html
21014 <pre>==foo==</pre>
21015 !! wikitext
21016 ==foo==
21017 !! end
21018
21019 #### --------------- Behavior Switches --------------------
21020 !! test
21021 1. Valid behavior switches should be escaped
21022 !! options
21023 parsoid=html2wt
21024 !! wikitext
21025 <nowiki>__TOC__</nowiki>
21026 ''<nowiki>__TOC__</nowiki>''
21027 !! html
21028 __TOC__
21029 <i>__TOC__</i>
21030 !! end
21031
21032 !! test
21033 2. Invalid behavior switches should not be escaped
21034 !! options
21035 parsoid=html2wt
21036 !! wikitext
21037 __TOO__
21038 __|__
21039 !! html
21040 __TOO__
21041 __|__
21042 !! end
21043
21044 #### --------------- HTML tags ---------------
21045 #### 1. a tags
21046 #### 2. other tags
21047 #### 3. multi-line html tag
21048 #### 4. extension tags
21049 #### -----------------------------------------
21050 !! test
21051 1. a tags
21052 !! options
21053 parsoid
21054 !! wikitext
21055 <a href="http://google.com">google</a>
21056 !! html
21057 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
21058 !! end
21059
21060 !! test
21061 2. other tags
21062 !! wikitext
21063 <nowiki><div>foo</div>
21064 <div style="color:red">foo</div></nowiki>
21065 !! html
21066 <p>&lt;div&gt;foo&lt;/div&gt;
21067 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
21068 </p>
21069 !! end
21070
21071 !! test
21072 3. multi-line html tag
21073 !! wikitext
21074 <nowiki><div
21075 >foo</div
21076 ></nowiki>
21077 !! html
21078 <p>&lt;div
21079 &gt;foo&lt;/div
21080 &gt;
21081 </p>
21082 !! end
21083
21084 !! test
21085 4. extension tags
21086 !! wikitext
21087 <nowiki><ref>foo</ref></nowiki>
21088
21089 <nowiki><ref>bar</nowiki>
21090
21091 baz<nowiki></ref></nowiki>
21092 !! html
21093 <p>&lt;ref&gt;foo&lt;/ref&gt;
21094 </p><p>&lt;ref&gt;bar
21095 </p><p>baz&lt;/ref&gt;
21096 </p>
21097 !! end
21098
21099 #### --------------- Others ---------------
21100 !! test
21101 Escaping nowikis
21102 !! wikitext
21103 &lt;nowiki&gt;foo&lt;/nowiki&gt;
21104 !! html
21105 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
21106 </p>
21107 !! end
21108
21109 ## The quote-char in the input is necessary for triggering the bug
21110 !! test
21111 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
21112 !! options
21113 parsoid=wt2wt,html2wt
21114 !! wikitext
21115 foo's bar :
21116 !! html
21117 <p>foo's bar :</p>
21118 !! end
21119
21120 !! test
21121
21122 Tag-like HTML structures are passed through as text
21123 !! wikitext
21124 <x y>
21125
21126 <x.y>
21127
21128 <x-y>
21129
21130 1>2
21131
21132 x<y
21133
21134 a>b
21135
21136 1<d e>f
21137 !! html
21138 <p>&lt;x y&gt;
21139 </p><p>&lt;x.y&gt;
21140 </p><p>&lt;x-y&gt;
21141 </p><p>1&gt;2
21142 </p><p>x&lt;y
21143 </p><p>a&gt;b
21144 </p><p>1&lt;d e&gt;f
21145 </p>
21146 !! end
21147
21148
21149 # This was a bug in the PHP parser (see bug 17663 and its dups,
21150 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
21151 !! test
21152 Tag names followed by punctuation should not be recognized as tags
21153 !! wikitext
21154 <s.ome> text
21155 !! html
21156 <p>&lt;s.ome&gt; text
21157 </p>
21158 !! end
21159
21160 !! test
21161 HTML tag with necessary entities in attributes
21162 !! wikitext
21163 <span title="&amp;amp;">foo</span>
21164 !! html
21165 <p><span title="&amp;amp;">foo</span>
21166 </p>
21167 !! end
21168
21169 !! test
21170 HTML tag with 'unnecessary' entity encoding in attributes
21171 !! wikitext
21172 <span title="&amp;">foo</span>
21173 !! html
21174 <p><span title="&amp;">foo</span>
21175 </p>
21176 !! end
21177
21178 !! test
21179 HTML tag with broken attribute value quoting
21180 !! wikitext
21181 <span title="Hello world>Foo</span>
21182 !! html/php
21183 <p><span>Foo</span>
21184 </p>
21185 !! html/parsoid
21186 <p><span title="Hello world">Foo</span>
21187 </p>
21188 !! end
21189
21190 !! test
21191 Parsoid-only: HTML tag with broken attribute value quoting
21192 !! options
21193 parsoid
21194 !! wikitext
21195 <span title="Hello world>Foo</span>
21196 !! html
21197 <p><span title="Hello world">Foo</span>
21198 </p>
21199 !! end
21200
21201 !! test
21202 Table with broken attribute value quoting
21203 !! wikitext
21204 {|
21205 | title="Hello world|Foo
21206 |}
21207 !! html/php
21208 <table>
21209 <tr>
21210 <td>Foo
21211 </td></tr></table>
21212
21213 !! html/parsoid
21214 <table>
21215 <tr>
21216 <td title="Hello world">Foo
21217 </td></tr></table>
21218
21219 !! end
21220
21221 !! test
21222 Table with broken attribute value quoting on consecutive lines
21223 !! wikitext
21224 {|
21225 | title="Hello world|Foo
21226 | style="color:red|Bar
21227 |}
21228 !! html/php
21229 <table>
21230 <tr>
21231 <td>Foo
21232 </td>
21233 <td>Bar
21234 </td></tr></table>
21235
21236 !! html/parsoid
21237 <table><tbody>
21238 <tr>
21239 <td title="Hello world">Foo
21240 </td><td style="color: red">Bar
21241 </td></tr></tbody></table>
21242
21243 !! end
21244
21245 !! test
21246 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21247 !! options
21248 parsoid
21249 !! wikitext
21250 {{}}
21251 !! html
21252 {{}}
21253 !! end
21254
21255 !! test
21256 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21257 !! options
21258 parsoid
21259 !! wikitext
21260 }}{{
21261 !! html
21262 }}{{
21263 !! end
21264
21265 !!test
21266 Accept empty td cell attribute
21267 !! wikitext
21268 {|
21269 | align="center" | foo || |
21270 |}
21271 !! html
21272 <table>
21273 <tr>
21274 <td align="center"> foo </td>
21275 <td>
21276 </td></tr></table>
21277
21278 !!end
21279
21280 !!test
21281 Non-empty attributes in th-cells
21282 !! wikitext
21283 {|
21284 ! Foo !! style="color: red" | Bar
21285 |}
21286 !! html
21287 <table>
21288 <tr>
21289 <th> Foo </th>
21290 <th style="color: red"> Bar
21291 </th></tr></table>
21292
21293 !!end
21294
21295 !!test
21296 Accept empty attributes in th-cells
21297 !! wikitext
21298 {|
21299 !| foo !!| bar
21300 |}
21301 !! html
21302 <table>
21303 <tr>
21304 <th> foo </th>
21305 <th> bar
21306 </th></tr></table>
21307
21308 !!end
21309
21310 !!test
21311 Empty table rows go away
21312 !! wikitext
21313 {|
21314 | Hello
21315 | there
21316 |- class="foo"
21317 |-
21318 |}
21319 !! html
21320 <table>
21321 <tr>
21322 <td> Hello
21323 </td>
21324 <td> there
21325 </td></tr>
21326
21327 </table>
21328
21329 !! end
21330
21331 ###
21332 ### Parsoid-centric tests for testing RTing of inter-element separators
21333 ### Edge cases not tested by existing parser tests and specific to
21334 ### Parsoid-specific serialization strategies.
21335 ###
21336
21337 !!test
21338 RT-ed inter-element separators should be valid separators
21339 !! wikitext
21340 {|
21341 |- [[foo]]
21342 |}
21343 !! html
21344 <table>
21345
21346 </table>
21347
21348 !!end
21349
21350 # Parsoid-only since PHP parser relies on Tidy for correct output
21351 !!test
21352 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
21353 !!options
21354 parsoid
21355 !! wikitext
21356 {|
21357 |<small>foo
21358 bar
21359 |}
21360
21361 {|
21362 |<small>foo<small>
21363 |}
21364 !! html
21365 <table>
21366 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
21367 <p>bar</p></small></td></tr>
21368 </tbody></table>
21369
21370 <table>
21371 <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>
21372 </tbody></table>
21373 !!end
21374
21375 !!test
21376 Empty TD followed by TD with tpl-generated attribute
21377 !! wikitext
21378 {|
21379 |-
21380 |
21381 |{{echo|style='color:red'}}|foo
21382 |}
21383 !! html
21384 <table>
21385
21386 <tr>
21387 <td>
21388 </td>
21389 <td>foo
21390 </td></tr></table>
21391
21392 !!end
21393
21394 !!test
21395 Indented table with an empty td
21396 !! wikitext
21397 {|
21398 |-
21399 |
21400 |foo
21401 |}
21402 !! html
21403 <table>
21404
21405 <tr>
21406 <td>
21407 </td>
21408 <td>foo
21409 </td></tr></table>
21410
21411 !!end
21412
21413 !!test
21414 Indented block & table
21415 !! wikitext
21416 <div>foo</div>
21417 {|
21418 |foo
21419 |}
21420 !! html/php
21421 <div>foo</div>
21422 <table>
21423 <tr>
21424 <td>foo
21425 </td></tr></table>
21426
21427 !! html/parsoid
21428 <div data-parsoid='{"stx":"html"}'>foo</div>
21429 <table><tbody>
21430 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
21431 </tbody></table>
21432 !!end
21433
21434 !! test
21435 Indent and comment before table row
21436 !! wikitext
21437 {|
21438 <!--hi-->|-
21439 | there
21440 |}
21441 !! html/php
21442 <table>
21443
21444 <tr>
21445 <td> there
21446 </td></tr></table>
21447
21448 !! html/parsoid
21449 <table>
21450 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
21451 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
21452 </tbody></table>
21453 !! end
21454
21455 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
21456 !!test
21457 Empty TR followed by a template-generated TR
21458 !!options
21459 parsoid
21460 !! wikitext
21461 {|
21462 |-
21463 {{echo|<tr><td>foo</td></tr>}}
21464 |}
21465 !! html
21466 <table>
21467 <tbody>
21468 <tr></tr>
21469 <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}}]}'>
21470 <td>foo</td></tr>
21471 </tbody></table>
21472 !!end
21473
21474 ## PHP and parsoid output differ for this, and since this is primarily
21475 ## for testing Parsoid's serializer, marking this Parsoid only
21476 !!test
21477 Empty TR followed by mixed-ws-comment line should RT correctly
21478 !!options
21479 parsoid
21480 !! wikitext
21481 {|
21482 |-
21483 <!--c-->
21484 |-
21485 <!--c--> <!--d-->
21486 |}
21487 !! html
21488 <table>
21489 <tbody>
21490 <tr></tr>
21491 <!--c-->
21492 <tr>
21493 <!--c--> </tr><!--d-->
21494 </tbody></table>
21495
21496 !!end
21497
21498 !!test
21499 Multi-line image caption generated by templates with/without trailing newlines
21500 !! wikitext
21501 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
21502 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
21503 !! html/parsoid
21504 <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>
21505 <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>
21506 !!end
21507
21508 !! test
21509 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
21510 !! options
21511 parsoid=html2wt
21512 !! wikitext
21513 <includeonly>foo</includeonly>
21514 new para
21515
21516 [[./Category:Foo]]
21517
21518 = new heading =
21519 !! html
21520 <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>
21521
21522 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
21523 !! end
21524
21525 ## PHP emits broken html for this, and since this is primarily
21526 ## a Parsoid serializer test, marking this Parsoid only
21527 !!test
21528 Improperly nested inline or quotes tags with whitespace in between
21529 !!options
21530 parsoid
21531 !! wikitext
21532 <span> <s>x</span> </s>
21533 ''' ''x''' ''
21534 !! html
21535 <p><span> <s>x</s></span><s> </s>
21536 <b> <i>x</i></b><i> </i>
21537 </p>
21538 !!end
21539
21540 !!test
21541 Encapsulate protected attributes from wt
21542 !!options
21543 parsoid
21544 !! wikitext
21545 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
21546 !! html
21547 <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>
21548 </body>
21549 !!end
21550
21551 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
21552 ## Having nested or stray pre tags results in the attempt to add duplicates,
21553 ## causing an assertion fail. This test tries to prevent that situation.
21554 !!test
21555 Ensure ParagraphWrapper can deal with stray closing pre tags
21556 !!options
21557 parsoid=wt2html
21558 !! wikitext
21559 plain text</pre>
21560 !! html
21561 plain text
21562 !!end
21563
21564 !!test
21565 1. Ensure fostered text content is wrapped in element nodes
21566 !!options
21567 parsoid=wt2html
21568 !! wikitext
21569 <table>hi</table><table>ho</table>
21570 !! html
21571 <p>hi</p>
21572 <table></table>
21573 <p>ho</p>
21574 <table></table>
21575 !!end
21576
21577 !!test
21578 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
21579 !!options
21580 parsoid=wt2html,wt2wt
21581 !! wikitext
21582 <table>
21583 <tr> || ||
21584 <td> a
21585 </table>
21586 !! html
21587 <p> || ||
21588 </p><table>
21589 <tbody><tr><td> a</td></tr>
21590 </tbody></table>
21591 !!end
21592
21593 !!test
21594 Encapsulation properly handles null DSR information from foster box
21595 !!options
21596 parsoid=wt2html,wt2wt
21597 !! wikitext
21598 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
21599 !! html
21600 <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>
21601 !!end
21602
21603 !!test
21604 1. Encapsulate foster-parented transclusion content
21605 !!options
21606 parsoid=wt2wt,wt2html
21607 !! wikitext
21608 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
21609 !! html
21610 <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>
21611 <tbody>
21612 <tr>
21613 <td>bar</td>
21614 </tr>
21615 </tbody>
21616 </table>
21617 !!end
21618
21619 !!test
21620 2. Encapsulate foster-parented transclusion content
21621 !!options
21622 parsoid=wt2wt,wt2html
21623 !! wikitext
21624 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
21625 !! html
21626 <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>
21627 <table>
21628 <tbody>
21629 <tr>
21630 <td>bar</td>
21631 </tr>
21632 </tbody>
21633 </table>
21634 !!end
21635
21636 !!test
21637 3. Encapsulate foster-parented transclusion content
21638 !!options
21639 parsoid=wt2wt,wt2html
21640 !! wikitext
21641 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21642 !! html
21643 <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;]}">
21644 <p>foo</p>
21645 </div>
21646 <table>
21647 <tbody>
21648 <tr>
21649 <td>bar</td>
21650 </tr>
21651 </tbody>
21652 </table>
21653 !!end
21654
21655 !!test
21656 4. Encapsulate foster-parented transclusion content
21657 !!options
21658 parsoid=wt2wt,wt2html
21659 !! wikitext
21660 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21661 !! html
21662 <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;]}">
21663 <p>foo</p>
21664 </div>
21665 <table>
21666 <tbody>
21667 <tr>
21668 <td>bar</td>
21669 </tr>
21670 </tbody>
21671 </table>
21672 !!end
21673
21674 !!test
21675 5. Encapsulate foster-parented transclusion content
21676 !!options
21677 parsoid=wt2wt,wt2html
21678 !! wikitext
21679 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
21680 !! html
21681 <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>
21682 <table>
21683 <tbody>
21684 <tr>
21685 <td>
21686 <div>
21687 <p>foo</p>
21688 </div>
21689 </td>
21690 </tr>
21691 </tbody>
21692 </table>
21693 !!end
21694
21695 !!test
21696 6. Encapsulate foster-parented transclusion content
21697 !!options
21698 parsoid=wt2wt,wt2html
21699 !! wikitext
21700 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
21701 !! html
21702 <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>
21703 <table>
21704 <tbody>
21705 <tr>
21706 <td>
21707 <div>
21708 <p>foo</p>
21709 </div>
21710 </td>
21711 </tr>
21712 </tbody>
21713 </table>
21714 <p>ok</p>
21715 !!end
21716
21717 !!test
21718 7. Encapsulate foster-parented transclusion content
21719 !!options
21720 parsoid=wt2wt,wt2html
21721 !! wikitext
21722 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
21723 !! html
21724 <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>
21725 <table>
21726 <tbody>
21727 <tr>
21728 <td>bar</td>
21729 </tr>
21730 </tbody>
21731 </table>
21732 !!end
21733
21734 !!test
21735 8. Encapsulate foster-parented transclusion content
21736 !!options
21737 parsoid=wt2wt,wt2html
21738 !! wikitext
21739 {{echo|a
21740 }}{|{{echo|style='color:red'}}
21741 |-
21742 |b
21743 |}
21744 !! html
21745 <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>
21746 <tbody>
21747 <tr>
21748 <td>b</td>
21749 </tr>
21750 </tbody>
21751 </table>
21752 !!end
21753
21754 !!test
21755 9. Encapsulate foster-parented transclusion content
21756 !!options
21757 parsoid=wt2wt,wt2html
21758 !! wikitext
21759 <table>{{echo|hi</table>hello}}
21760 !! html
21761 <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>
21762 !!end
21763
21764 !!test
21765 Table in fosterable position
21766 !!options
21767 parsoid=wt2html,wt2wt
21768 !! wikitext
21769 {{OpenTable}}
21770 <div>
21771 {|
21772 |}
21773 </div>
21774 |}
21775 !! html
21776 <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">
21777 </span>
21778 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
21779
21780 <table>
21781 </table>
21782 !!end
21783
21784 # Parsoid only for bug 64747
21785 !! test
21786 Properly encapsulate empty-content transclusions in fosterable positions
21787 !! wikitext
21788 <table>
21789 {{#if:|
21790 <td>foo</td>
21791 }}
21792 </table>
21793 !! html/parsoid
21794 <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>"}'>
21795
21796 </table>
21797 !! end
21798
21799 !!test
21800 Support <object> element with .data attribute
21801 !!options
21802 parsoid=html2wt
21803 !! wikitext
21804 <object data="test.swf"></object>
21805 !! html
21806 <object data="test.swf"></object>
21807 !!end
21808
21809 !! test
21810 Don't block XML namespace declaration
21811 !! wikitext
21812 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
21813 !! html/php
21814 <p><span>MediaWiki</span>
21815 </p>
21816 !! html/parsoid
21817 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
21818 !! end
21819
21820 # -----------------------------------------------------------------
21821 # The following section of tests are primarily to spec requirements
21822 # around serialization of new/edited content.
21823 #
21824 # All these tests are marked Parsoid html2wt and html2html only
21825 # ----------------------------------------------------------------
21826
21827 # 'mi' is a localinterwiki prefix as well as a language
21828 !! test
21829 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
21830 !! options
21831 parsoid=html2wt
21832 !! wikitext
21833 [[Foo]]
21834 !! html
21835 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
21836 !! end
21837
21838 !! test
21839 New wiki links (href variations)
21840 !! options
21841 parsoid=html2wt
21842 !! html
21843 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
21844 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
21845 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
21846 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
21847 !! wikitext
21848 [[Foo_bar]]
21849 [[Foo_bar]]
21850 [[Foo_bar]]
21851 [[Toxine bactérienne]]
21852 !! end
21853
21854 !! test
21855 New wiki links (content string variations)
21856 !! options
21857 parsoid=html2wt
21858 !! html
21859 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
21860 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
21861 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
21862 !! wikitext
21863 [[Foo_bar]]
21864 [[Foo bar]]
21865 [[Foo_bar|./Foo_bar]]
21866 !! end
21867
21868 !! test
21869 New category links (href variations)
21870 !! options
21871 parsoid=html2wt
21872 !! html
21873 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
21874 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
21875 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
21876 !! wikitext
21877 [[Category:Toxine bactérienne]]
21878 [[Category:Toxine bactérienne]]
21879 [[Category:Toxine bactérienne]]
21880 !! end
21881
21882 !! test
21883 New interlanguage links (href variations)
21884 !! options
21885 parsoid=html2wt
21886 !! html
21887 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
21888 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
21889 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
21890 !! wikitext
21891 [[es:Toxine bactérienne]]
21892 [[es:Toxine_bactérienne]]
21893 [[es:Toxine_bactérienne]]
21894 !! end
21895
21896 !! test
21897 Image: Modifying size of an image (1)
21898 !! options
21899 parsoid={
21900 "modes": ["wt2wt"],
21901 "changes": [
21902 ["img[height]", "attr", "height", "22"],
21903 ["img[width]", "attr", "width", "200"]
21904 ]
21905 }
21906 !! wikitext
21907 [[Image:Foobar.jpg|230x230px]]
21908 !! wikitext/edited
21909 [[Image:Foobar.jpg|200x200px]]
21910 !!end
21911
21912 !! test
21913 Image: Modifying size of an image (2)
21914 !! options
21915 parsoid={
21916 "modes": ["wt2wt"],
21917 "changes": [
21918 ["img[height]", "attr", "height", "100"],
21919 ["img[width]", "attr", "width", "500"]
21920 ]
21921 }
21922 !! wikitext
21923 [[Image:Foobar.jpg|230x230px]]
21924 !! wikitext/edited
21925 [[Image:Foobar.jpg|500x500px]]
21926 !!end
21927
21928 # Change in size is ignored so long as class='mw-default-size'
21929 !! test
21930 Image: Modifying size of an image (3)
21931 !! options
21932 parsoid={
21933 "modes": ["wt2wt"],
21934 "changes": [
21935 ["figure[class]", "removeClass", "mw-default-size"],
21936 ["figure img", "attr", "height", "19"],
21937 ["figure img", "attr", "width", "170"]
21938 ]
21939 }
21940 !! wikitext
21941 [[Image:Foobar.jpg|thumb]]
21942 !! wikitext/edited
21943 [[Image:Foobar.jpg|thumb|170x170px]]
21944 !!end
21945
21946 !! test
21947 Image: Modifying alignment of an image (bug 48665)
21948 !! options
21949 parsoid={
21950 "modes": ["wt2wt"],
21951 "changes": [
21952 ["figure[class]", "removeClass", "mw-halign-right"],
21953 ["figure[class]", "addClass", "mw-halign-left"]
21954 ]
21955 }
21956 !! wikitext
21957 [[Image:Foobar.jpg|thumb|caption|right]]
21958 !! wikitext/edited
21959 [[Image:Foobar.jpg|thumb|caption|left]]
21960 !! end
21961
21962 !! test
21963 Image: Modifying mw-default-size of an frameless image (bug 62805)
21964 !! options
21965 parsoid={
21966 "modes": ["wt2wt"],
21967 "changes": [
21968 ["figure.mw-default-size", "removeClass", "mw-default-size"]
21969 ]
21970 }
21971 !! wikitext
21972 [[Image:Foobar.jpg|frameless|right]]
21973 !! wikitext/edited
21974 [[Image:Foobar.jpg|frameless|right|220x220px]]
21975 !! end
21976
21977 !! test
21978 Image: Modifying valign of an image (bug 49221)
21979 !! options
21980 parsoid={
21981 "modes": ["wt2wt"],
21982 "changes": [
21983 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
21984 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
21985 ]
21986 }
21987 !! wikitext
21988 [[File:Foobar.jpg|20px|middle]]
21989 !! wikitext/edited
21990 [[File:Foobar.jpg|20px|text-top]]
21991 !! end
21992
21993 !! test
21994 Image: Modifying alt attribute of an image (bug 56400)
21995 !! options
21996 parsoid={
21997 "modes": ["wt2wt"],
21998 "changes": [
21999 ["img[alt]", "attr", "alt", "some alternate edited text"]
22000 ]
22001 }
22002 !! wikitext
22003 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
22004 !! wikitext/edited
22005 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
22006 !!end
22007
22008 !! test
22009 Image: Modifying caption of an image
22010 !! options
22011 parsoid={
22012 "modes": ["wt2wt"],
22013 "changes": [
22014 ["figcaption", "text", "new caption"]
22015 ]
22016 }
22017 !! wikitext
22018 [[Image:Foobar.jpg|thumb|original caption]]
22019 !! wikitext/edited
22020 [[Image:Foobar.jpg|thumb|new caption]]
22021 !!end
22022
22023 !! test
22024 Image: empty alt attribute (bug 48924)
22025 !! options
22026 parsoid
22027 !! wikitext
22028 [[File:Foobar.jpg|thumb|alt=|bar]]
22029 !! html
22030 <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>
22031 !! end
22032
22033 #!! test
22034 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
22035 #!! options
22036 #parsoid=html2wt
22037 #language=ar
22038 #!! wikitext
22039 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
22040 #!! html
22041 #<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>
22042 #!! end
22043
22044 !! test
22045 Image: Block level image should have \n before and after
22046 !! wikitext
22047 123
22048 [[File:Foobar.jpg|right|thumb|150x150px]]
22049 456
22050 !! html/parsoid
22051 <p>123</p>
22052 <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>
22053 <p>456</p>
22054 !!end
22055
22056 !! test
22057 Image: New block level image should have \n before and after (existing content)
22058 !! wikitext
22059 123
22060 [[File:Foobar.jpg|right|thumb|150x150px]]
22061 456
22062 !! html/parsoid
22063 <p>123</p>
22064 <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>
22065 <p>456</p>
22066 !!end
22067
22068 !! test
22069 Image: upright option (parsoid)
22070 !! options
22071 parsoid
22072 !! wikitext
22073 [[File:Foobar.jpg|thumb|upright|caption]]
22074 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
22075 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
22076 !! html
22077 <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>
22078 <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>
22079 <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>
22080 !!end
22081
22082 !! test
22083 Image: upright option is ignored on inline and frame images (parsoid)
22084 !! options
22085 parsoid
22086 !! wikitext
22087 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
22088 !! html
22089 <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>
22090 !!end
22091
22092 !! test
22093 Image: from basic HTML (1)
22094 !! options
22095 parsoid=html2wt
22096 !! html/parsoid
22097 <span typeof="mw:Image">
22098 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22099 </span>
22100 !! wikitext
22101 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22102 !! end
22103
22104 !! test
22105 Image: from basic HTML (2)
22106 !! options
22107 parsoid=html2wt
22108 !! html/parsoid
22109 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22110 !! wikitext
22111 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22112 !! end
22113
22114 !! test
22115 Image: from basic HTML (3)
22116 !! options
22117 parsoid=html2wt
22118 !! html/parsoid
22119 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
22120 !! wikitext
22121 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
22122 !! end
22123
22124 !! test
22125 Image: from basic HTML (4)
22126 !! options
22127 parsoid=html2wt
22128 !! html/parsoid
22129 <img src="File:Foobar.jpg">
22130 !! wikitext
22131 [[File:Foobar.jpg|link=]]
22132 !! end
22133
22134 !! test
22135 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
22136 !! options
22137 parsoid=html2wt
22138 !! wikitext
22139 * foo
22140 !! html
22141 <ul>
22142 <li><p>foo</p></li>
22143 </ul>
22144 !! end
22145
22146 !! test
22147 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
22148 !! options
22149 parsoid=html2wt
22150 !! wikitext
22151 * foo
22152 !! html
22153 <ul> <li>foo</li></ul>
22154 !! end
22155
22156 !! test
22157 Don't strip leading whitespace when handling indent-pre suppressing tags
22158 !! options
22159 parsoid=html2wt
22160 !! wikitext
22161 {|
22162 | indented row
22163 |}
22164 <blockquote>
22165 '''This is very bold of you!'''
22166
22167 {|
22168 |
22169 indented cell (no pre-wrapping!)
22170 |}
22171 </blockquote>
22172 foo
22173 <div>bar</div>
22174 !! html
22175 <table>
22176 <tr><td> indented row</td></tr>
22177 </table>
22178 <blockquote><p>
22179 <b>This is very bold of you!</b>
22180 </p>
22181 <table><tr><td>
22182 indented cell (no pre-wrapping!)
22183 </td></tr></table>
22184 </blockquote>
22185 <p>foo</p>
22186 <div>bar</div>
22187 !! end
22188
22189 !! test
22190 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
22191 !! options
22192 parsoid=html2wt
22193 !! wikitext
22194 foo
22195 <nowiki> </nowiki><span>bar</span>
22196
22197 <span>foo2
22198 <nowiki> </nowiki></span>bar2
22199
22200 <div>foo</div>
22201 <nowiki> </nowiki><span>bar</span>
22202
22203 <div>
22204 <nowiki> </nowiki><span>foo</span>
22205 </div>
22206 !! html
22207 <p>foo</p>
22208 <span>bar</span>
22209
22210 <span>foo2
22211 </span>bar2
22212
22213 <div>foo</div>
22214 <span>bar</span>
22215
22216 <div>
22217 <span>foo</span>
22218 </div>
22219 !! end
22220
22221 !! test
22222 Lists: Add space after bullets
22223 !! options
22224 parsoid=html2wt
22225 !! wikitext
22226 * foo
22227 * bar
22228 * <span> baz</span>
22229 !! html
22230 <ul>
22231 <li>foo</li>
22232 <li> bar</li>
22233 <li><span> baz</span></li>
22234 </ul>
22235 !! end
22236
22237 !! test
22238 Lists: Dont insert newlines in a serialized list item.
22239 !! options
22240 parsoid=html2wt
22241 !! wikitext
22242 * a<br>b
22243 * c
22244 !! html
22245 <ul><li>a<br>b</li><li>c</li></ul>
22246 !! end
22247
22248 !! test
22249 Headings: Add space before/after == (Bug 51744)
22250 !! options
22251 parsoid=html2wt
22252 !! wikitext
22253 == foo ==
22254
22255 == bar ==
22256
22257 == baz ==
22258
22259 == <span> baz</span> ==
22260 !! html
22261 <h2>foo</h2>
22262 <h2> bar</h2>
22263 <h2>baz </h2>
22264 <h2><span> baz</span></h2>
22265 !! end
22266
22267 !! test
22268 Parsoid: Serialize positional parameters with = in them as named parameter
22269 !! options
22270 parsoid=html2wt
22271 !! wikitext
22272 {{echo|1 = f=oo}}
22273
22274 {{echo|1 = f=oo|2 = bar}}
22275
22276 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22277 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22278 {{echo|<nowiki>f=oo</nowiki>|bar}}
22279 !! html
22280 <p about="#mwt1" typeof="mw:Transclusion"
22281 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
22282
22283 <p about="#mwt1" typeof="mw:Transclusion"
22284 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
22285
22286 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22287 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22288 <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>
22289 !! end
22290
22291 !! test
22292 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
22293 !! options
22294 parsoid=html2wt
22295 !! wikitext
22296 <div>a
22297 b
22298 </div>
22299 <div>a
22300 b
22301 </div>
22302 <div>
22303 a
22304
22305 b
22306 </div>
22307 !! html
22308 <div>a<p>b</p></div>
22309 <div>a
22310 <p>b</p></div>
22311 <div>
22312 a
22313 <p>b</p></div>
22314 !! end
22315
22316 !! test
22317 Substrings resembling wikitext in hrefs should not get nowiki escapes
22318 !! options
22319 parsoid=html2wt
22320 !! wikitext
22321 [[Foo''bar''baz]]
22322 !! html
22323 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
22324 !! end
22325
22326 #-----------------------------
22327 # I/B quote minimization tests
22328 #-----------------------------
22329
22330 !! test
22331 1. I/B quote minimization: wikitext-only tags should be combined
22332 !! options
22333 parsoid=html2wt
22334 !! wikitext
22335 ''AB''
22336
22337 '''AB'''
22338
22339 ''A'''B'''''
22340
22341 '''A''B'''''
22342
22343 '''A''BC''D'''
22344
22345 '''''AB'''''
22346
22347 '''''AB'''''
22348
22349 '''''AB'''''
22350 !! html
22351 <p><i>A</i><i>B</i></p>
22352 <p><b>A</b><b>B</b></p>
22353 <p><i>A</i><b><i>B</i></b></p>
22354 <p><b>A</b><i><b>B</b></i></p>
22355 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
22356 <p><i><b>A</b></i><i><b>B</b></i></p>
22357 <p><i><b>A</b></i><b><i>B</i></b></p>
22358 <p><b><i>A</i></b><i><b>B</b></i></p>
22359 !! end
22360
22361 !! test
22362 2. I/B quote minimization: wikitext and html tags should not be combined
22363 !! options
22364 parsoid=html2wt
22365 !! wikitext
22366 ''A''<i>B</i>
22367
22368 ''A''<nowiki/>'''<i>B</i>'''
22369 !! html
22370 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
22371 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
22372 !! end
22373
22374 !! test
22375 3. I/B quote minimization: templated content stops minimization
22376 !! options
22377 parsoid=html2wt
22378 !! wikitext
22379 ''A''{{echo|''B''}}
22380
22381 ''A''{{echo|'''''B'''''}}
22382 !! html
22383 <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>
22384 <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>
22385 !! end
22386
22387 !! test
22388 4. I/B quote minimization: new content should be mimimized with adjacent old content
22389 !! options
22390 parsoid=html2wt
22391 !! wikitext
22392 ''AB''
22393
22394 '''AB'''
22395
22396 ''A'''B'''''
22397 !! html
22398 <p><i>A</i><i>B</i></p>
22399 <p><b>A</b><b>B</b></p>
22400 <p><i>A</i><b><i>B</i></b></p>
22401 !! end
22402
22403 #------------------------------------
22404 # End of I/B quote minimization tests
22405 #------------------------------------
22406
22407 !!test
22408 Bug 54262: New entities
22409 !! options
22410 parsoid=html2wt
22411 !! wikitext
22412 &nbsp;
22413 !! html
22414 <span typeof="mw:Entity">&nbsp;</span>
22415 !! end
22416
22417 ## Note that there is no wikitext output for 'unknownproperty' ##
22418 ## Unknown magic words are silently dropped ##
22419
22420 !! test
22421 Magic words
22422 !! options
22423 parsoid=html2wt
22424 !! wikitext
22425 __TOC__
22426 __NOTOC__
22427 __FORCETOC__
22428 __INDEX__
22429 __NOINDEX__
22430 __NOGALLERY__
22431 __NOEDITSECTION__
22432 __NOTITLECONVERT__
22433 __NOCONTENTCONVERT__
22434 !! html
22435 <meta property='mw:PageProp/toc' />
22436 <meta property='mw:PageProp/notoc' />
22437 <meta property='mw:PageProp/forcetoc' />
22438 <meta property='mw:PageProp/index' />
22439 <meta property='mw:PageProp/noindex' />
22440 <meta property='mw:PageProp/nogallery' />
22441 <meta property='mw:PageProp/noeditsection' />
22442 <meta property='mw:PageProp/notitleconvert' />
22443 <meta property='mw:PageProp/nocontentconvert' />
22444 <meta property='mw:PageProp/unknownproperty' />
22445 !! end
22446
22447 !! test
22448 Consecutive <pre>s should not get merged
22449 !! options
22450 parsoid=html2wt,html2html
22451 !! wikitext
22452 a
22453
22454 b
22455
22456 c
22457
22458 d
22459
22460 e
22461
22462
22463
22464 f
22465 !! html
22466 <pre>a</pre><pre>b</pre>
22467
22468 <pre>c
22469 </pre><pre>
22470 d</pre>
22471
22472 <pre>e
22473
22474 </pre><pre>
22475
22476 f</pre>
22477 !! end
22478
22479 !! test
22480 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
22481 !! options
22482 parsoid=html2wt
22483 !! wikitext
22484 [[Special:BookSources/1234567890|ISBN 1234567895]]
22485 !! html
22486 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
22487 !! end
22488
22489 !! test
22490 Edited RFC links not serializable as RFC links should serialize as extlinks
22491 !! options
22492 parsoid=html2wt
22493 !! wikitext
22494 [//tools.ietf.org/html/rfc123 New RFC]
22495 !! html
22496 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
22497 !! end
22498
22499 !! test
22500 Edited PMID links not serializable as PMID links should serialize as extlinks
22501 !! options
22502 parsoid=html2wt
22503 !! wikitext
22504 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
22505 !! html
22506 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
22507 !! end
22508
22509 !! test
22510 Edited Redirect link should emit a non-piped wikitext link
22511 !! options
22512 parsoid=html2wt
22513 !! wikitext
22514 #REDIRECT [[Bar]]
22515 !! html
22516 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
22517 !! end
22518
22519 !! test
22520 T75121: Infer extension name from typeOf if data-mw is not present
22521 !! options
22522 parsoid=html2wt
22523 !! wikitext
22524 <foo />
22525 !! html
22526 <div typeOf="mw:Extension/foo"></div>
22527 !! end
22528
22529 # -----------------------------------------------------------------
22530 # End of section for Parsoid-only html2wt tests for serialization
22531 # of new content
22532 # -----------------------------------------------------------------
22533
22534 TODO:
22535 more images
22536 more tables
22537 character entities
22538 and much more
22539 Try for 100% code coverage