c7fc380adbaae746b289c46935461a5ab0a98791
[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 !! html
4175 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4176 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4177 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4178 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4179 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4180 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4181 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4182 <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/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4184 </p>
4185 !! end
4186
4187 !! test
4188 External links: No preceding word characters allowed (bug 65278)
4189 !! wikitext
4190 NOPEhttp://example.com
4191 N0http://example.com
4192 ok:http://example.com
4193 ok-http://example.com
4194 !! html
4195 <p>NOPEhttp://example.com
4196 N0http://example.com
4197 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4198 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4199 </p>
4200 !! end
4201
4202 !! test
4203 External image
4204 !! wikitext
4205 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4206 !! html
4207 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4208 </p>
4209 !! end
4210
4211 !! test
4212 External image from https
4213 !! wikitext
4214 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4215 !! html
4216 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4217 </p>
4218 !! end
4219
4220 !! test
4221 External image (when not allowed)
4222 !! options
4223 wgAllowExternalImages=0
4224 !! wikitext
4225 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4226 !! html
4227 <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>
4228 </p>
4229 !! end
4230
4231 !! test
4232 Link to non-http image, no img tag
4233 !! wikitext
4234 Link to non-http image, no img tag: ftp://example.com/test.jpg
4235 !! html
4236 <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>
4237 </p>
4238 !! end
4239
4240 !! test
4241 External links: terminating separator
4242 !! wikitext
4243 Terminating separator: http://example.com/thing,
4244 !! html
4245 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4246 </p>
4247 !! end
4248
4249 !! test
4250 External links: intervening separator
4251 !! wikitext
4252 Intervening separator: http://example.com/1,2,3
4253 !! html
4254 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4255 </p>
4256 !! end
4257
4258 !! test
4259 External links: old bug with URL in query
4260 !! wikitext
4261 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4262 !! html
4263 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4264 </p>
4265 !! end
4266
4267 !! test
4268 External links: old URL-in-URL bug, mixed protocols
4269 !! wikitext
4270 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4271 !! html
4272 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4273 </p>
4274 !!end
4275
4276 !! test
4277 External links: URL in text
4278 !! wikitext
4279 URL in text: [http://example.com http://example.com]
4280 !! html
4281 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4282 </p>
4283 !! end
4284
4285 !! test
4286 External links: Clickable images
4287 !! wikitext
4288 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4289 !! html
4290 <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>
4291 </p>
4292 !!end
4293
4294 !! test
4295 External links: raw ampersand
4296 !! wikitext
4297 Old &amp; use: http://x&y
4298 !! html
4299 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4300 </p>
4301 !! end
4302
4303 !! test
4304 External links: encoded ampersand
4305 !! wikitext
4306 Old &amp; use: http://x&amp;y
4307 !! html/php
4308 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4309 </p>
4310 !! html/parsoid
4311 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4312 !! end
4313
4314 !! test
4315 External links: encoded equals (bug 6102)
4316 !! wikitext
4317 http://example.com/?foo&#61;bar
4318 !! html/php
4319 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4320 </p>
4321 !! html/parsoid
4322 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4323 !! end
4324
4325 ##
4326 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4327 ## does it number them. As discussed in bug 53505, we can identify
4328 ## autonumbered links via CSS.
4329 ##
4330
4331 !! test
4332 External links: [raw ampersand]
4333 !! wikitext
4334 Old &amp; use: [http://x&y]
4335 !! html/php
4336 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4337 </p>
4338 !! html/parsoid
4339 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4340 !! end
4341
4342 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4343 # mode will return the [raw ampersand] wikitext
4344 !! test
4345 External links: [encoded ampersand]
4346 !! options
4347 parsoid=wt2html,wt2wt,html2html
4348 !! wikitext
4349 Old &amp; use: [http://x&amp;y]
4350 !! html/php
4351 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4352 </p>
4353 !! html/parsoid
4354 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4355 !! end
4356
4357 !! test
4358 External links: [raw equals]
4359 !! wikitext
4360 [http://example.com/?foo=bar]
4361 !! html/php
4362 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4363 </p>
4364 !! html/parsoid
4365 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4366 !! end
4367
4368 # note that parsoid html is identical to [raw equals] case; so html2wt
4369 # mode will return the [raw equals] wikitext
4370 !! test
4371 External links: [encoded equals] (bug 6102)
4372 !! options
4373 parsoid=wt2html,wt2wt,html2html
4374 !! wikitext
4375 [http://example.com/?foo&#61;bar]
4376 !! html/php
4377 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4378 </p>
4379 !! html/parsoid
4380 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4381 !! end
4382
4383 # xxx parsoid strips the IDN character, so the round-trip tests will
4384 # obviously fail and are disabled. --cscott
4385 !! test
4386 External links: [IDN ignored character reference in hostname; strip it right off]
4387 !! options
4388 parsoid=wt2html,wt2wt,html2html
4389 !! wikitext
4390 [http://e&zwnj;xample.com/]
4391 !! html/php
4392 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4393 </p>
4394 !! html/parsoid
4395 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4396 !! end
4397
4398 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4399 # Where an external link could easily circumvent the sanitization of the text of
4400 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4401 # test demands a higher standard. That's a bit strange.
4402 #
4403 # Example:
4404 #
4405 # http://e‌xample.com -> [http://example.com|http://example.com]
4406 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4407 #
4408 # The first example is sanitized, but the second is not. Any security benefits
4409 # from this production are trivial to circumvent. Either remove this test and
4410 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4411 # the test accordingly.
4412 #
4413 # All our love,
4414 # The Parsoid team.
4415 # xxx parsoid strips the IDN character, so the round-trip tests will
4416 # obviously fail and are disabled. --cscott
4417 !! test
4418 External links: IDN ignored character reference in hostname; strip it right off
4419 !! options
4420 parsoid=wt2html,html2html
4421 !! wikitext
4422 http://e&zwnj;xample.com/
4423 !! html/php
4424 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4425 </p>
4426 !! html/parsoid
4427 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4428 !! end
4429
4430 !! test
4431 External links: www.jpeg.org (bug 554)
4432 !! wikitext
4433 http://www.jpeg.org
4434 !! html
4435 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4436 </p>
4437 !! end
4438
4439 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4440 !! test
4441 External links: URL within URL (original bug 2)
4442 !! wikitext
4443 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4444 !! html/php
4445 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4446 </p>
4447 !! html/parsoid
4448 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4449 !! end
4450
4451 !! test
4452 BUG 361: URL inside bracketed URL
4453 !! wikitext
4454 [http://www.example.com/foo http://www.example.com/bar]
4455 !! html
4456 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4457 </p>
4458 !! end
4459
4460 !! test
4461 BUG 361: URL within URL, not bracketed
4462 !! wikitext
4463 http://www.example.com/foo?=http://www.example.com/bar
4464 !! html
4465 <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>
4466 </p>
4467 !! end
4468
4469 !! test
4470 BUG 289: ">"-token in URL-tail
4471 !! wikitext
4472 http://www.example.com/<hello>
4473 !! html
4474 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4475 </p>
4476 !!end
4477
4478 !! test
4479 BUG 289: literal ">"-token in URL-tail
4480 !! wikitext
4481 http://www.example.com/<b>html</b>
4482 !! html
4483 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4484 </p>
4485 !!end
4486
4487 !! test
4488 BUG 289: ">"-token in bracketed URL
4489 !! wikitext
4490 [http://www.example.com/<hello> stuff]
4491 !! html
4492 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4493 </p>
4494 !!end
4495
4496 !! test
4497 BUG 289: literal ">"-token in bracketed URL
4498 !! wikitext
4499 [http://www.example.com/<b>html</b> stuff]
4500 !! html
4501 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4502 </p>
4503 !!end
4504
4505 !! test
4506 BUG 289: literal double quote at end of URL
4507 !! wikitext
4508 http://www.example.com/"hello"
4509 !! html
4510 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4511 </p>
4512 !!end
4513
4514 !! test
4515 BUG 289: literal double quote in bracketed URL
4516 !! wikitext
4517 [http://www.example.com/"hello" stuff]
4518 !! html
4519 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4520 </p>
4521 !!end
4522
4523 !! test
4524 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4525 !! wikitext
4526 [http://www.example.com test]
4527 !! html
4528 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4529 </p>
4530 !! end
4531
4532 !! test
4533 External links: link text with spaces
4534 !! wikitext
4535 [http://www.example.com a b c]
4536 [http://www.example.com ''a'' ''b'']
4537 !! html
4538 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4539 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4540 </p>
4541 !! end
4542
4543 !! test
4544 External links: wiki links within external link (Bug 3695)
4545 !! wikitext
4546 [http://example.com [[wikilink]] embedded in ext link]
4547 !! html/php
4548 <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>
4549 </p>
4550 !! html/parsoid
4551 <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>
4552 !! end
4553
4554 !! test
4555 BUG 787: Links with one slash after the url protocol are invalid
4556 !! wikitext
4557 http:/example.com
4558
4559 [http:/example.com title]
4560 !! html
4561 <p>http:/example.com
4562 </p><p>[http:/example.com title]
4563 </p>
4564 !! end
4565
4566 !! test
4567 Bracketed external links with template-generated invalid target
4568 !! wikitext
4569 [{{echo|http:/example.com}} title]
4570 !! html
4571 <p>[http:/example.com title]
4572 </p>
4573 !! end
4574
4575 !! test
4576 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4577 !! wikitext
4578 ''[http://example.com text'']
4579 [http://example.com '''text]'''
4580 ''Something [http://example.com in italic'']
4581 ''Something [http://example.com mixed''''', even bold]'''
4582 '''''Now [http://example.com both''''']
4583 !! html
4584 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4585 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4586 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4587 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4588 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4589 </p>
4590 !! end
4591
4592
4593 !! test
4594 Bug 4781: %26 in URL
4595 !! wikitext
4596 http://www.example.com/?title=AT%26T
4597 !! html/php
4598 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4599 </p>
4600 !! html/parsoid
4601 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4602 !! end
4603
4604 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4605 # % is actually legal in HTML5. Any change in output would need testing though.
4606 !! test
4607 Bug 4781, 5267: %25 in URL
4608 !! wikitext
4609 http://www.example.com/?title=100%25_Bran
4610 !! html/php
4611 <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>
4612 </p>
4613 !! html/parsoid
4614 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4615 !! end
4616
4617 !! test
4618 Bug 4781, 5267: %28, %29 in URL
4619 !! wikitext
4620 http://www.example.com/?title=Ben-Hur_%281959_film%29
4621 !! html/php
4622 <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>
4623 </p>
4624 !! html/parsoid
4625 <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>
4626 !! end
4627
4628
4629 !! test
4630 Bug 4781: %26 in autonumber URL
4631 !! wikitext
4632 [http://www.example.com/?title=AT%26T]
4633 !! html/php
4634 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4635 </p>
4636 !! html/parsoid
4637 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4638 !! end
4639
4640 !! test
4641 Bug 4781, 5267: %26 in autonumber URL
4642 !! wikitext
4643 [http://www.example.com/?title=100%25_Bran]
4644 !! html/php
4645 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4646 </p>
4647 !! html/parsoid
4648 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4649 !! end
4650
4651 !! test
4652 Bug 4781, 5267: %28, %29 in autonumber URL
4653 !! wikitext
4654 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4655 !! html/php
4656 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4657 </p>
4658 !! html/parsoid
4659 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4660 !! end
4661
4662
4663 !! test
4664 Bug 4781: %26 in bracketed URL
4665 !! wikitext
4666 [http://www.example.com/?title=AT%26T link]
4667 !! html/php
4668 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4669 </p>
4670 !! html/parsoid
4671 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4672 !! end
4673
4674 !! test
4675 Bug 4781, 5267: %25 in bracketed URL
4676 !! wikitext
4677 [http://www.example.com/?title=100%25_Bran link]
4678 !! html
4679 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4680 </p>
4681 !! end
4682
4683 !! test
4684 Bug 4781, 5267: %28, %29 in bracketed URL
4685 !! wikitext
4686 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4687 !! html/php
4688 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4689 </p>
4690 !! html/parsoid
4691 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4692 !! end
4693
4694 !! test
4695 External link containing a period in the anchor. (bug 63947)
4696 !! wikitext
4697 [//foo.org/bar#baz. bang]
4698
4699 [//foo.org/bar. bang]
4700 !! html/php
4701 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4702 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4703 </p>
4704 !! html/parsoid
4705 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4706 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4707 !! end
4708
4709 !! test
4710 External link containing a single quote. (bug 63947)
4711 !! wikitext
4712 [//foo.org/bar'baz]
4713
4714 [//foo.org/bar'baz bang]
4715 !! html/php
4716 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4717 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4718 </p>
4719 !! html/parsoid
4720 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4721 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4722 !! end
4723
4724
4725 !! test
4726 External link containing a period in the anchor. (bug 63947)
4727 !! wikitext
4728 [//foo.org/bar#baz. bang]
4729
4730 [//foo.org/bar. bang]
4731 !! html/php
4732 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4733 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4734 </p>
4735 !! html/parsoid
4736 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4737 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4738 !! end
4739
4740 !! test
4741 External link containing a single quote. (bug 63947)
4742 !! wikitext
4743 [//foo.org/bar'baz]
4744
4745 [//foo.org/bar'baz bang]
4746 !! html/php
4747 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4748 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4749 </p>
4750 !! html/parsoid
4751 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4752 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4753 !! end
4754
4755
4756 !! test
4757 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4758 !! wikitext
4759 Some [http://example.com/ pretty ''italics'' and stuff]!
4760 !! html
4761 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4762 </p>
4763 !! end
4764
4765 !! test
4766 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4767 !! wikitext
4768 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4769 !! html
4770 <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>
4771 </p>
4772 !! end
4773
4774 !! test
4775 External link containing double-single-quotes with no space separating the url from text in italics
4776 !! wikitext
4777 [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]].]
4778 !! html/php
4779 <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>
4780 </p>
4781 !! html/php+tidy
4782 <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>
4783 !! html/parsoid
4784 <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>
4785 !! end
4786
4787 !! test
4788 External link with comments in link text
4789 !! wikitext
4790 [http://www.google.com Google <!-- comment -->]
4791 !! html
4792 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4793 </p>
4794 !! end
4795
4796 !! test
4797 URL-encoding in URL functions (single parameter)
4798 !! wikitext
4799 {{localurl:Some page|amp=&}}
4800 !! html
4801 <p>/index.php?title=Some_page&amp;amp=&amp;
4802 </p>
4803 !! end
4804
4805 !! test
4806 URL-encoding in URL functions (multiple parameters)
4807 !! wikitext
4808 {{localurl:Some page|q=?&amp=&}}
4809 !! html
4810 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4811 </p>
4812 !! end
4813
4814 !! test
4815 Brackets in urls
4816 !! wikitext
4817 http://example.com/index.php?foozoid%5B%5D=bar
4818
4819 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4820 !! html/php
4821 <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>
4822 </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>
4823 </p>
4824 !! html/parsoid
4825 <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>
4826
4827 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4828 !! end
4829
4830 !! test
4831 IPv6 urls (bug 21261)
4832 !! options
4833 disabled
4834 !! wikitext
4835 http://[2404:130:0:1000::187:2]/index.php
4836 !! html
4837 <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>
4838 </p>
4839 !! end
4840
4841 !! test
4842 Non-extlinks in brackets
4843 !! wikitext
4844 [foo]
4845 [foo bar]
4846 [foo ''bar'']
4847 [fool's] errand
4848 [fool's errand]
4849 [{{echo|foo}}]
4850 [{{echo|foo}} bar]
4851 [{{echo|foo}} ''bar'']
4852 [{{echo|foo}}l's] errand
4853 [{{echo|foo}}l's errand]
4854 [url={{echo|foo}}]
4855 [url=http://example.com]
4856 !! html
4857 <p>[foo]
4858 [foo bar]
4859 [foo <i>bar</i>]
4860 [fool's] errand
4861 [fool's errand]
4862 [foo]
4863 [foo bar]
4864 [foo <i>bar</i>]
4865 [fool's] errand
4866 [fool's errand]
4867 [url=foo]
4868 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4869 </p>
4870 !! end
4871
4872 !! test
4873 Percent encoding in external links
4874 !! wikitext
4875 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4876 !! html/php
4877 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4878 </p>
4879 !! html/parsoid
4880 <p><a rel="mw:ExtLink"
4881 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4882 !! end
4883
4884 !! test
4885 Use url link syntax for links where the content is equal the link target
4886 !! wikitext
4887 http://example.com
4888 !! html/php
4889 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4890 </p>
4891 !! html/parsoid
4892 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4893 !! end
4894
4895 !! test
4896 Parenthesis in external links, especially URL links
4897 !! wikitext
4898 http://example.com)
4899
4900 http://example.com/test)
4901
4902 http://example.com/(test)
4903
4904 http://example.com/((test)
4905
4906 (http://example.com/(test))
4907
4908 (http://example.com/(test)))))
4909
4910 http://example.com/a)b
4911
4912 [http://example.com) foo]
4913 !! html/php
4914 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4915 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4916 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4917 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4918 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4919 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4920 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4921 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4922 </p>
4923 !! html/parsoid
4924 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4925 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4926 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4927 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4928 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4929 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4930 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4931 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4932 !! end
4933
4934 !! test
4935 Parenthesis in external links, w/ transclusion or comment
4936 !! wikitext
4937 (http://example.com/{{echo|hi}})
4938
4939 (http://example.com<!-- hi -->)
4940 !! html/php
4941 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4942 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4943 </p>
4944 !! html/parsoid
4945 <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>
4946
4947 <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>
4948 !! end
4949
4950 !! test
4951 Replace invalid link targets when serializing
4952 !! options
4953 parsoid=html2wt
4954 !! html
4955 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
4956 !! wikitext
4957 [[MediaWiki:Badtitletext|Manual]]
4958 !! end
4959
4960 ###
4961 ### Quotes
4962 ###
4963
4964 !! test
4965 Quotes
4966 !! wikitext
4967 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4968
4969 Normal text. '''''Bold italic text.''''' Normal text.
4970 !! html
4971 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4972 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4973 </p>
4974 !! end
4975
4976
4977 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4978 # parser strips. The wikitext contains just the first half of the bold
4979 # quote pair.
4980 !! test
4981 Unclosed and unmatched quotes
4982 !! wikitext
4983 '''''Bold italic text '''with bold deactivated''' in between.'''''
4984
4985 '''''Bold italic text ''with italic deactivated'' in between.'''''
4986
4987 '''Bold text..
4988
4989 ..spanning two paragraphs (should not work).'''
4990
4991 '''Bold tag left open
4992
4993 ''Italic tag left open
4994
4995 Normal text.
4996
4997 <!-- Unmatching number of opening, closing tags: -->
4998 '''This year''''s election ''should'' beat '''last year''''s.
4999
5000 ''Tom'''s car is bigger than ''Susan'''s.
5001
5002 Plain ''italic'''s plain
5003 !! html/php
5004 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5005 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5006 </p><p><b>Bold text..</b>
5007 </p><p>..spanning two paragraphs (should not work).
5008 </p><p><b>Bold tag left open</b>
5009 </p><p><i>Italic tag left open</i>
5010 </p><p>Normal text.
5011 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5012 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5013 </p><p>Plain <i>italic'</i>s plain
5014 </p>
5015 !! html/parsoid
5016 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5017 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5018 </p><p><b>Bold text..</b>
5019 </p><p>..spanning two paragraphs (should not work).<b></b>
5020 </p><p><b>Bold tag left open</b>
5021 </p><p><i>Italic tag left open</i>
5022 </p><p>Normal text.
5023 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5024 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5025 </p><p>Plain <i>italic'</i>s plain
5026 </p>
5027 !! end
5028
5029 ###
5030 ### Tables
5031 ###
5032 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5033 ###
5034
5035 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5036 # is the bare minimum required by the spec, see:
5037 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5038 # Parsoid team replies: empty table tags are legal in HTML5
5039 !! test
5040 A table with no data.
5041 !! options
5042 parsoid=wt2html
5043 !! wikitext
5044 {||}
5045 !! html/php
5046
5047 !! html/parsoid
5048 <table></table>
5049
5050 !! end
5051
5052 !! test
5053 A table with stray table end tags on start tag line (wt2html)
5054 !! options
5055 parsoid=wt2html
5056 !! wikitext
5057 {|style="color: red;"|}
5058
5059 {|style="color: red;" |}
5060 |foo
5061 |}
5062
5063 {|style="color: red;"|} id="foo"
5064 |foo
5065 |}
5066
5067 {|style="color: red;" |} id="foo"
5068 |foo
5069 |}
5070 !! html
5071 <table style="color: red;"></table>
5072
5073 <table style="color: red;">
5074 <tbody><tr>
5075 <td>foo</td>
5076 </tr></tbody>
5077 </table>
5078
5079 <table style="color: red;" id="foo">
5080 <tbody><tr>
5081 <td>foo</td>
5082 </tr></tbody>
5083 </table>
5084
5085 <table style="color: red;" id="foo">
5086 <tbody><tr>
5087 <td>foo</td>
5088 </tr></tbody>
5089 </table>
5090
5091 !! end
5092
5093 !! test
5094 A table with no data (take 2)
5095 !! wikitext
5096 {|
5097 |}
5098 !! html/parsoid
5099 <table></table>
5100 !! end
5101
5102 # A table with nothing but a caption is invalid XHTML, we might want to render
5103 # this as <p>caption</p>
5104 # Parsoid team replies: table with only a caption is legal in HTML5
5105 !! test
5106 A table with nothing but a caption
5107 !! wikitext
5108 {|
5109 |+ caption
5110 |}
5111 !! html/php
5112 <table>
5113 <caption> caption
5114 </caption><tr><td></td></tr></table>
5115
5116 !! html/parsoid
5117 <table><caption> caption</caption></table>
5118 !! end
5119
5120 !! test
5121 A table with caption with default-spaced attributes and a table row
5122 !! wikitext
5123 {|
5124 |+ style="color: red;" | caption1
5125 |-
5126 | foo
5127 |}
5128 !! html
5129 <table>
5130 <caption style="color: red;"> caption1
5131 </caption>
5132 <tr>
5133 <td> foo
5134 </td></tr></table>
5135
5136 !! end
5137
5138 !! test
5139 A table with captions with non-default spaced attributes and a table row
5140 !! wikitext
5141 {|
5142 |+style="color: red;"|caption2
5143 |+ style="color: red;"| caption3
5144 |-
5145 | foo
5146 |}
5147 !! html
5148 <table>
5149 <caption style="color: red;">caption2
5150 </caption>
5151 <caption style="color: red;"> caption3
5152 </caption>
5153 <tr>
5154 <td> foo
5155 </td></tr></table>
5156
5157 !! end
5158
5159 !! test
5160 Table td-cell syntax variations
5161 !! wikitext
5162 {|
5163 | foo bar foo | baz
5164 | foo bar foo || baz
5165 | style='color:red;' | baz
5166 | style='color:red;' || baz
5167 |}
5168 !! html
5169 <table>
5170 <tr>
5171 <td> baz
5172 </td>
5173 <td> foo bar foo </td>
5174 <td> baz
5175 </td>
5176 <td style="color:red;"> baz
5177 </td>
5178 <td> style='color:red;' </td>
5179 <td> baz
5180 </td></tr></table>
5181
5182 !! end
5183
5184 !! test
5185 Simple table
5186 !! wikitext
5187 {|
5188 | 1 || 2
5189 |-
5190 | 3 || 4
5191 |}
5192 !! html
5193 <table>
5194 <tr>
5195 <td> 1 </td>
5196 <td> 2
5197 </td></tr>
5198 <tr>
5199 <td> 3 </td>
5200 <td> 4
5201 </td></tr></table>
5202
5203 !! end
5204
5205 !! test
5206 Simple table but with multiple dashes for row wikitext
5207 !! wikitext
5208 {|
5209 | foo
5210 |-----
5211 | bar
5212 |}
5213 !! html
5214 <table>
5215 <tr>
5216 <td> foo
5217 </td></tr>
5218 <tr>
5219 <td> bar
5220 </td></tr></table>
5221
5222 !! end
5223 !! test
5224 Multiplication table
5225 !! wikitext
5226 {| border="1" cellpadding="2"
5227 |+Multiplication table
5228 |-
5229 ! &times; !! 1 !! 2 !! 3
5230 |-
5231 ! 1
5232 | 1 || 2 || 3
5233 |-
5234 ! 2
5235 | 2 || 4 || 6
5236 |-
5237 ! 3
5238 | 3 || 6 || 9
5239 |-
5240 ! 4
5241 | 4 || 8 || 12
5242 |-
5243 ! 5
5244 | 5 || 10 || 15
5245 |}
5246 !! html
5247 <table border="1" cellpadding="2">
5248 <caption>Multiplication table
5249 </caption>
5250 <tr>
5251 <th> &#215; </th>
5252 <th> 1 </th>
5253 <th> 2 </th>
5254 <th> 3
5255 </th></tr>
5256 <tr>
5257 <th> 1
5258 </th>
5259 <td> 1 </td>
5260 <td> 2 </td>
5261 <td> 3
5262 </td></tr>
5263 <tr>
5264 <th> 2
5265 </th>
5266 <td> 2 </td>
5267 <td> 4 </td>
5268 <td> 6
5269 </td></tr>
5270 <tr>
5271 <th> 3
5272 </th>
5273 <td> 3 </td>
5274 <td> 6 </td>
5275 <td> 9
5276 </td></tr>
5277 <tr>
5278 <th> 4
5279 </th>
5280 <td> 4 </td>
5281 <td> 8 </td>
5282 <td> 12
5283 </td></tr>
5284 <tr>
5285 <th> 5
5286 </th>
5287 <td> 5 </td>
5288 <td> 10 </td>
5289 <td> 15
5290 </td></tr></table>
5291
5292 !! end
5293
5294 !! test
5295 Accept "||" in table headings
5296 !! wikitext
5297 {|
5298 !h1 || h2
5299 |}
5300 !! html
5301 <table>
5302 <tr>
5303 <th>h1 </th>
5304 <th> h2
5305 </th></tr></table>
5306
5307 !! end
5308
5309 !! test
5310 Accept "!!" in table data
5311 !! wikitext
5312 {|
5313 | Foo!! ||
5314 |}
5315 !! html
5316 <table>
5317 <tr>
5318 <td> Foo!! </td>
5319 <td>
5320 </td></tr></table>
5321
5322 !! html/parsoid
5323 <table>
5324 <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>
5325 </tbody></table>
5326 !! end
5327
5328 !! test
5329 Accept "||" in indented table headings
5330 !! wikitext
5331 :{|
5332 !h1 || h2
5333 |}
5334 !! html
5335 <dl><dd><table>
5336 <tr>
5337 <th>h1 </th>
5338 <th> h2
5339 </th></tr></table></dd></dl>
5340
5341 !! end
5342
5343 !! test
5344 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5345 !! wikitext
5346 {|
5347 !| h1
5348 || a
5349 |}
5350 !! html
5351 <table>
5352 <tr>
5353 <th> h1
5354 </th>
5355 <td> a
5356 </td></tr></table>
5357
5358 !! end
5359
5360 !!test
5361 Accept "| !" at start of line in tables (ignore !-attribute)
5362 !! wikitext
5363 {|
5364 |-
5365 | !style="color:red" | bar
5366 |}
5367 !! html
5368 <table>
5369
5370 <tr>
5371 <td> bar
5372 </td></tr></table>
5373
5374 !!end
5375
5376 !!test
5377 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 +/-
5378 !! wikitext
5379 {|
5380 |-
5381 |style='color:red;'|+1
5382 |style='color:blue;'|-1
5383 |-
5384 | 1 || 2 || 3
5385 | 1 ||+2 ||-3
5386 |-
5387 | +1
5388 | -1
5389 |}
5390 !! html
5391 <table>
5392
5393 <tr>
5394 <td style="color:red;">+1
5395 </td>
5396 <td style="color:blue;">-1
5397 </td></tr>
5398 <tr>
5399 <td> 1 </td>
5400 <td> 2 </td>
5401 <td> 3
5402 </td>
5403 <td> 1 </td>
5404 <td>+2 </td>
5405 <td>-3
5406 </td></tr>
5407 <tr>
5408 <td> +1
5409 </td>
5410 <td> -1
5411 </td></tr></table>
5412
5413 !!end
5414
5415 !! test
5416 Table rowspan
5417 !! wikitext
5418 {| border=1
5419 | Cell 1, row 1
5420 |rowspan=2| Cell 2, row 1 (and 2)
5421 | Cell 3, row 1
5422 |-
5423 | Cell 1, row 2
5424 | Cell 3, row 2
5425 |}
5426 !! html
5427 <table border="1">
5428 <tr>
5429 <td> Cell 1, row 1
5430 </td>
5431 <td rowspan="2"> Cell 2, row 1 (and 2)
5432 </td>
5433 <td> Cell 3, row 1
5434 </td></tr>
5435 <tr>
5436 <td> Cell 1, row 2
5437 </td>
5438 <td> Cell 3, row 2
5439 </td></tr></table>
5440
5441 !! end
5442
5443 !! test
5444 Nested table
5445 !! wikitext
5446 {| border=1
5447 | &alpha;
5448 |
5449 {| bgcolor=#ABCDEF border=2
5450 |nested
5451 |-
5452 |table
5453 |}
5454 |the original table again
5455 |}
5456 !! html
5457 <table border="1">
5458 <tr>
5459 <td> &#945;
5460 </td>
5461 <td>
5462 <table bgcolor="#ABCDEF" border="2">
5463 <tr>
5464 <td>nested
5465 </td></tr>
5466 <tr>
5467 <td>table
5468 </td></tr></table>
5469 </td>
5470 <td>the original table again
5471 </td></tr></table>
5472
5473 !! end
5474
5475 !! test
5476 Invalid attributes in table cell (bug 1830)
5477 !! wikitext
5478 {|
5479 |Cell:|broken
5480 |}
5481 !! html
5482 <table>
5483 <tr>
5484 <td>broken
5485 </td></tr></table>
5486
5487 !! end
5488
5489
5490 # The "|}" to close the table is missing from the input, so parsoid's
5491 # *2wt modes will fail.
5492 !! test
5493 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5494 !! options
5495 parsoid=wt2html,html2html
5496 !! wikitext
5497 {|
5498 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5499 !! html/php
5500 <table>
5501 <tr>
5502 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5503 <td>]" onmouseover="alert(document.cookie)"&gt;test
5504 </td>
5505 </tr>
5506 </table>
5507
5508 !! html/parsoid
5509 <table><tbody>
5510 <tr>
5511 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5512 !! end
5513
5514
5515 !! test
5516 Indented table markup mixed with indented pre content (proposed in bug 6200)
5517 !! wikitext
5518 <table>
5519 <tr>
5520 <td>
5521 Text that should be rendered preformatted
5522 </td>
5523 </tr>
5524 </table>
5525 !! html
5526 <table>
5527 <tr>
5528 <td>
5529 <pre>Text that should be rendered preformatted
5530 </pre>
5531 </td>
5532 </tr>
5533 </table>
5534
5535 !! end
5536
5537 !! test
5538 Template-generated table cell attributes and cell content
5539 !! wikitext
5540 {|
5541 |{{table_attribs}}
5542 | {{table_attribs}}
5543 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
5544 |align=center {{table_attribs}}
5545 | <!--foo--> align=center <!--bar--> {{table_attribs}}
5546 |}
5547 !! html
5548 <table>
5549 <tr>
5550 <td style="color: red"> Foo
5551 </td>
5552 <td style="color: red"> Foo
5553 </td>
5554 <td style="color: red"> Foo
5555 </td>
5556 <td align="center" style="color: red"> Foo
5557 </td>
5558 <td align="center" style="color: red"> Foo
5559 </td></tr></table>
5560
5561 !! end
5562
5563 !! test
5564 Template-generated table cell attributes and cell content (2)
5565 !! wikitext
5566 {|
5567 |align=center {{table_cells}}
5568 |}
5569 !! html
5570 <table>
5571 <tr>
5572 <td align="center" style="color: red"> Foo </td>
5573 <td> Bar </td>
5574 <td> Baz
5575 </td></tr></table>
5576
5577 !! end
5578
5579 !! test
5580 Table with row followed by newlines and table heading
5581 !! wikitext
5582 {|
5583 |-
5584
5585 ! foo
5586 |}
5587 !! html
5588 <table>
5589
5590
5591 <tr>
5592 <th> foo
5593 </th></tr></table>
5594
5595 !! end
5596
5597 !! test
5598 Table with empty line following the start tag
5599 !! wikitext
5600 {|
5601
5602 |-
5603 | foo
5604 |}
5605 !! html
5606 <table>
5607
5608
5609 <tr>
5610 <td> foo
5611 </td></tr></table>
5612
5613 !! end
5614
5615 # FIXME: Preserve the attribute properly (with an empty string as value) in
5616 # the PHP parser. Parsoid implements the behavior below.
5617 !! test
5618 Table attributes with empty value
5619 !! wikitext
5620 {|
5621 | style=| hello
5622 |}
5623 !! html/parsoid
5624 <table>
5625 <tbody>
5626 <tr>
5627 <td style=""> hello
5628 </td></tr></tbody></table>
5629
5630 !! end
5631
5632 !! test
5633 Wikitext table with a lot of comments
5634 !! wikitext
5635 {|
5636 <!-- c0 -->
5637 | foo
5638 <!-- c1 -->
5639 |- <!-- c2 -->
5640 <!-- c3 -->
5641 |<!-- c4 -->
5642 <!-- c5 -->
5643 |}
5644 !! html
5645 <table>
5646 <tr>
5647 <td> foo
5648 </td></tr>
5649 <tr>
5650 <td>
5651 </td></tr></table>
5652
5653 !! end
5654
5655 !! test
5656 Wikitext table with double-line table cell
5657 !! wikitext
5658 {|
5659 |a
5660 b
5661 |}
5662 !! html
5663 <table>
5664 <tr>
5665 <td>a
5666 <p>b
5667 </p>
5668 </td></tr></table>
5669
5670 !! end
5671
5672 !! test
5673 Table cell with a single comment
5674 !! wikitext
5675 {|
5676 | <!-- c1 -->
5677 | a
5678 |}
5679 !! html
5680 <table>
5681 <tr>
5682 <td>
5683 </td>
5684 <td> a
5685 </td></tr></table>
5686
5687 !! end
5688
5689 !! test
5690 Table-cell after a comment-only-empty-line
5691 !! wikitext
5692 {|
5693 |a
5694 <!--c1-->
5695 <!--c2-->| b
5696 |}
5697 !! html
5698 <table>
5699 <tr>
5700 <td>a
5701 </td>
5702 <td> b
5703 </td></tr></table>
5704
5705 !! html/parsoid
5706 <table>
5707 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5708 <!--c1-->
5709 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5710 </tbody></table>
5711
5712 !! end
5713
5714 !! test
5715 Build table with {{!}}
5716 !! wikitext
5717 {{{!}} class="wikitable"
5718 ! header
5719 ! second header
5720 {{!}}- style="color:red;"
5721 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
5722 {{!}}}
5723 !! html
5724 <table class="wikitable">
5725 <tr>
5726 <th> header
5727 </th>
5728 <th> second header
5729 </th></tr>
5730 <tr style="color:red;">
5731 <td> data </td>
5732 <td style="color:red;"> second data
5733 </td></tr></table>
5734
5735 !! end
5736
5737 !! test
5738 Build table with pipe as data
5739 !! wikitext
5740 {| class="wikitable"
5741 ! header
5742 ! second header
5743 |- style="color:red;"
5744 | data || style="color:red;" | second data
5745 |-
5746 | style="color:red;" | data with | || style="color:red;" | second data with |
5747 |-
5748 || data with | ||| second data with |
5749 |}
5750 !! html
5751 <table class="wikitable">
5752 <tr>
5753 <th> header
5754 </th>
5755 <th> second header
5756 </th></tr>
5757 <tr style="color:red;">
5758 <td> data </td>
5759 <td style="color:red;"> second data
5760 </td></tr>
5761 <tr>
5762 <td style="color:red;"> data with | </td>
5763 <td style="color:red;"> second data with |
5764 </td></tr>
5765 <tr>
5766 <td> data with | </td>
5767 <td> second data with |
5768 </td></tr></table>
5769
5770 !! end
5771
5772 !! test
5773 Build table with wikilink
5774 !! wikitext
5775 {| class="wikitable"
5776 ! header || second header
5777 |- style="color:red;"
5778 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
5779 |-
5780 | data || second data [[Main Page|link|text with pipe]]
5781 |}
5782 !! html
5783 <table class="wikitable">
5784 <tr>
5785 <th> header </th>
5786 <th> second header
5787 </th></tr>
5788 <tr style="color:red;">
5789 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
5790 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
5791 </td></tr>
5792 <tr>
5793 <td> data </td>
5794 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
5795 </td></tr></table>
5796
5797 !! end
5798
5799 # The expected HTML structure in this test is debatable. The PHP parser does
5800 # not parse this kind of table at all. The main focus for Parsoid is on
5801 # round-tripping, so this output is ok for now. TODO: revisit!
5802 !! test
5803 Wikitext table with html-syntax row
5804 !! wikitext
5805 {|
5806 |-
5807 <td>foo</td>
5808 |}
5809 !! html/parsoid
5810 <table>
5811 <tbody>
5812 <tr>
5813 <td>foo</td></tr></tbody></table>
5814 !! end
5815
5816 ## Note that Parsoid output differs from PHP and PHP+tidy here.
5817 ## The lack of <tr> tags in the PHP output is arguably a bug in the
5818 ## PHP parser, which tidy then compounds by fostering the content
5819 ## entirely out of the table. Parsoid recognizes the table context
5820 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
5821 ## depends on PHP's treatment of broken table markup!
5822 !! test
5823 Implicit <td> after a |-
5824 !! options
5825 parsoid=wt2html,html2html
5826 !! wikitext
5827 {|
5828 |-
5829 a
5830 |}
5831 !! html/php
5832 <table>
5833
5834 a
5835 </table>
5836
5837 !! html/php+tidy
5838 <p>a</p>
5839 !! html/parsoid
5840 <table>
5841 <tr><td>a</td></tr>
5842 </table>
5843 !! end
5844
5845 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
5846 !! test
5847 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
5848 !! options
5849 parsoid=wt2html,html2html
5850 !! wikitext
5851 {|
5852 |-
5853 |
5854 a
5855 |-
5856 b
5857 |}
5858 !! html/php
5859 <table>
5860
5861 <tr>
5862 <td>
5863 <pre>a
5864 </pre>
5865 </td></tr>
5866 b
5867 </table>
5868
5869 !! html/php+tidy
5870 <p>b</p>
5871 <table>
5872 <tr>
5873 <td>
5874 <pre>
5875 a
5876 </pre></td>
5877 </tr>
5878 </table>
5879 !! html/parsoid
5880 <table>
5881 <tbody>
5882 <tr><td><pre>a</pre></td></tr>
5883 <tr><td> b</td></tr>
5884 </tbody>
5885 </table>
5886 !! end
5887
5888 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
5889 # Parsoid generates the missing <td>, so wt2wt won't succeed.
5890 !! test
5891 Lists should be recognized in an implicit <td> context
5892 !! options
5893 parsoid=wt2html,html2html
5894 !! wikitext
5895 {|
5896 |-
5897 *a
5898 |}
5899 !! html/php
5900 <table>
5901
5902 <ul><li>a</li></ul>
5903 </table>
5904
5905 !! html/php+tidy
5906 <ul>
5907 <li>a</li>
5908 </ul>
5909 !! html/parsoid
5910 <table>
5911 <tr>
5912 <td><ul>
5913 <li>a</li>
5914 </ul></td>
5915 </tr>
5916 </table>
5917 !! end
5918
5919 !! test
5920 Parsoid: Round-trip tables directly followed by content (bug 51219)
5921 !! options
5922 parsoid=wt2html,wt2wt
5923 !! wikitext
5924 {|
5925 |foo
5926 |} bar
5927
5928 {|
5929 |baz
5930 |}<b>quux</b>
5931 !! html+tidy
5932 <table>
5933 <tr>
5934 <td>foo</td>
5935 </tr>
5936 </table>
5937 <p>bar</p>
5938 <table>
5939 <tr>
5940 <td>baz</td>
5941 </tr>
5942 </table>
5943 <p><b>quux</b></p>
5944 !! end
5945
5946 !! test
5947 Parsoid: Default to a newline after tables in new content (bug 51219)
5948 !! options
5949 parsoid=html2wt
5950 !! wikitext
5951 {|
5952 |foo
5953 |}
5954 <nowiki> </nowiki>bar
5955 {|
5956 |baz
5957 |}
5958 '''quux'''
5959 !! html
5960 <table><tbody>
5961 <tr><td>foo</td></tr></tbody></table> bar
5962 <table><tbody>
5963 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5964 !! end
5965
5966 !! test
5967 Parsoid: newline inducing block nodes don't suppress <nowiki>
5968 !! options
5969 parsoid=html2wt
5970 !! wikitext
5971 <nowiki> </nowiki>a
5972
5973 = foo =
5974 !! html
5975 a<h1>foo</h1>
5976 !! end
5977
5978 !! test
5979 Parsoid: Row-syntax table headings followed by comment & table cells
5980 !! options
5981 parsoid=wt2html,wt2wt
5982 !! wikitext
5983 {|
5984 ! foo || bar
5985 <!-- foo --> || baz || quux
5986 |}
5987 !! html/php
5988 <table>
5989 <tr>
5990 <th> foo </th>
5991 <th> bar
5992 </th>
5993 <td> baz </td>
5994 <td> quux
5995 </td></tr></table>
5996
5997 !! html/parsoid
5998 <table>
5999 <tbody><tr><th> foo </th><th> bar
6000 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6001 </tbody></table>
6002 !! end
6003
6004
6005 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6006 # preserves it.
6007 !!test
6008 Parsoid: Recover better from broken table attributes
6009 !!options
6010 parsoid=wt2html
6011 !!wikitext
6012 {| class="foo
6013 | class="bar" |
6014 foo
6015 |}
6016 !!html/php+tidy
6017 <table>
6018 <tr>
6019 <td class="bar">
6020 <p>foo</p>
6021 </td>
6022 </tr>
6023 </table>
6024 !!html/parsoid
6025 <table class="foo">
6026 <tr>
6027 <td class="bar">
6028 <p>foo</p></td></tr>
6029 </tbody></table>
6030 !!end
6031
6032 !! test
6033 Strip unsupported table tags
6034 !! options
6035 parsoid=html2wt
6036 !! html
6037 <table>
6038 <thead>
6039 <tr>
6040 <th>Month</th>
6041 <th>Savings</th>
6042 </tr>
6043 </thead>
6044 <tbody>
6045 <tr>
6046 <td>January</td>
6047 <td>$100</td>
6048 </tr>
6049 <tr>
6050 <td>February</td>
6051 <td>$80</td>
6052 </tr>
6053 </tbody>
6054 <tfoot>
6055 <tr>
6056 <td>Sum</td>
6057 <td>$180</td>
6058 </tr>
6059 </tfoot>
6060 </table>
6061 !! wikitext
6062 {|
6063
6064 !Month
6065 !Savings
6066
6067 |January
6068 |$100
6069
6070 |-
6071 |February
6072 |$80
6073
6074 |Sum
6075 |$180
6076
6077 |}
6078 !! end
6079
6080 ###
6081 ### Internal links
6082 ###
6083 !! test
6084 Plain link, capitalized
6085 !! wikitext
6086 [[Main Page]]
6087 !! html
6088 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6089 </p>
6090 !! end
6091
6092 !! test
6093 Plain link, uncapitalized
6094 !! wikitext
6095 [[main Page]]
6096 !! html
6097 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6098 </p>
6099 !! end
6100
6101 !! test
6102 Piped link
6103 !! wikitext
6104 [[Main Page|The Main Page]]
6105 !! html
6106 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6107 </p>
6108 !! end
6109
6110 !! test
6111 Piped link with comment in link text
6112 !! wikitext
6113 [[Main Page|The Main<!--front--> Page]]
6114 !! html
6115 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6116 </p>
6117 !! end
6118
6119 !! test
6120 Piped link with multiple pipe characters in link text
6121 !! wikitext
6122 [[Main Page||The|Main|Page|]]
6123 !! html/php
6124 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6125 </p>
6126 !! html/parsoid
6127 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6128 !! end
6129
6130 !! test
6131 Broken link
6132 !! wikitext
6133 [[Zigzagzogzagzig]]
6134 !! html
6135 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6136 </p>
6137 !! end
6138
6139 !! test
6140 Broken link with fragment
6141 !! wikitext
6142 [[Zigzagzogzagzig#zug]]
6143 !! html
6144 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6145 </p>
6146 !! end
6147
6148 !! test
6149 Special page link with fragment
6150 !! wikitext
6151 [[Special:Version#anchor]]
6152 !! html
6153 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6154 </p>
6155 !! end
6156
6157 !! test
6158 Nonexistent special page link with fragment
6159 !! wikitext
6160 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6161 !! html
6162 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6163 </p>
6164 !! end
6165
6166 !! test
6167 Link with prefix
6168 !! wikitext
6169 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6170 !! html
6171 <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>
6172 </p>
6173 !! end
6174
6175 !! test
6176 Link with suffix
6177 !! wikitext
6178 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6179 !! html
6180 <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>!!!
6181 </p>
6182 !! end
6183
6184 !! article
6185 prefixed article
6186 !! text
6187 Some text
6188 !! endarticle
6189
6190 !! test
6191 Bug 43661: Piped links with identical prefixes
6192 !! wikitext
6193 [[prefixed article|prefixed articles with spaces]]
6194
6195 [[prefixed article|prefixed articlesaoeu]]
6196
6197 [[Main Page|Main Page test]]
6198 !! html
6199 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6200 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6201 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6202 </p>
6203 !! end
6204
6205
6206 !! test
6207 Link with HTML entity in suffix / tail
6208 !! wikitext
6209 [[Main Page]]&quot;, [[Main Page]]&#97;
6210 !! html
6211 <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;
6212 </p>
6213 !! end
6214
6215 !! test
6216 Link with 3 brackets
6217 !! wikitext
6218 [[[Main Page]]]
6219 !! html
6220 <p>[[[Main Page]]]
6221 </p>
6222 !! end
6223
6224 !! test
6225 Link with 4 brackets
6226 !! wikitext
6227 [[[[Main Page]]]]
6228 !! html
6229 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6230 </p>
6231 !! end
6232
6233 !! test
6234 Piped link with 3 brackets
6235 !! wikitext
6236 [[[main page|the main page]]]
6237 !! html
6238 <p>[[[main page|the main page]]]
6239 </p>
6240 !! end
6241
6242 !! test
6243 Piped link with extlink-like text
6244 !! wikitext
6245 [[Main Page|[bar]]]
6246 [[Main Page|This is a [bar]]]
6247 !! html
6248 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6249 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6250 </p>
6251 !! end
6252
6253 !! test
6254 Link with multiple pipes
6255 !! wikitext
6256 [[Main Page|The|Main|Page]]
6257 !! html
6258 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6259 </p>
6260 !! end
6261
6262 # Note that parsoid does not munge anchor text; all non-space
6263 # characters are valid in HTML5 ids.
6264 !! test
6265 Anchor containing a #. (bug 63430)
6266 !! wikitext
6267 [[Main Page#And#Link]]
6268 !! html/php
6269 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6270 </p>
6271 !! html/parsoid
6272 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6273 !! end
6274
6275 !! test
6276 Link to namespaces
6277 !! wikitext
6278 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6279 !! html
6280 <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>
6281 </p>
6282 !! end
6283
6284 !! test
6285 Link with space in namespace
6286 !! wikitext
6287 [[User talk:Foo bar]]
6288 !! html
6289 <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>
6290 </p>
6291 !! end
6292
6293 !! article
6294 MemoryAlpha:AlphaTest
6295 !! text
6296 This is an article in the MemoryAlpha namespace
6297 (which shadows the memoryalpha interwiki link).
6298 !! endarticle
6299
6300 !! test
6301 Namespace takes precedence over interwiki link (bug 51680)
6302 !! wikitext
6303 [[MemoryAlpha:AlphaTest]]
6304 !! html
6305 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6306 </p>
6307 !! end
6308
6309 # The previous test doesn't work correctly in html2*, due to not recognizing the
6310 # link as an internal one. This one checks for the correct behavior.
6311 !! test
6312 Link to namespace preferred over interwiki with correct rel attribute
6313 !! options
6314 parsoid=html2wt,html2html
6315 !! wikitext
6316 [[MemoryAlpha:AlphaTest]]
6317 !! html
6318 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6319 </p>
6320 !! end
6321
6322 !! test
6323 Piped link to namespace
6324 !! wikitext
6325 [[Meta:Disclaimers|The disclaimers]]
6326 !! html
6327 <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>
6328 </p>
6329 !! end
6330
6331 !! test
6332 Link containing }
6333 !! wikitext
6334 [[Usually caused by a typo (oops}]]
6335 !! html
6336 <p>[[Usually caused by a typo (oops}]]
6337 </p>
6338 !! end
6339
6340 !! article
6341 7% Solution
6342 !! text
6343 Just a test of an article title containing a percent.
6344 !! endarticle
6345
6346 !! test
6347 Link containing % (not as a hex sequence)
6348 !! wikitext
6349 [[7% Solution]]
6350 !! html/php
6351 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6352 </p>
6353 !! html/parsoid
6354 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6355 !! end
6356
6357 # note that the parsoid HTML is identical to the previous test output,
6358 # so the previous test ensures that the html2wt mode will generate the
6359 # "not as a hex sequence" wikitext.
6360 !! test
6361 Link containing % as a single hex sequence interpreted to char
6362 !! options
6363 parsoid=wt2wt,wt2html,html2html
6364 !! wikitext
6365 [[7%25 Solution]]
6366 !! html/php
6367 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6368 </p>
6369 !! html/parsoid
6370 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6371 !!end
6372
6373 !! test
6374 Link containing % as a double hex sequence interpreted to hex sequence
6375 !! wikitext
6376 [[7%2525 Solution]]
6377 !! html
6378 <p>[[7%2525 Solution]]
6379 </p>
6380 !!end
6381
6382 # note that parsoid does not munge anchor text; all non-space
6383 # characters are valid in HTML5 anchors.
6384 !! test
6385 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6386 Example for such a section: == < ==
6387 !! wikitext
6388 [[%23%3c]][[%23%3e]]
6389 !! html/php
6390 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6391 </p>
6392 !! html/parsoid
6393 <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>
6394 !! end
6395
6396 !! test
6397 Link containing "<#" and ">#" as a hex sequences
6398 !! wikitext
6399 [[%3c%23]][[%3e%23]]
6400 !! html
6401 <p>[[%3c%23]][[%3e%23]]
6402 </p>
6403 !! end
6404
6405 !! test
6406 Link containing an equals sign
6407 !! wikitext
6408 [[Special:BookSources/isbn=4-00-026157-6]]
6409 !! html/php
6410 <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>
6411 </p>
6412 !! html/parsoid
6413 <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>
6414 !! end
6415
6416 !! article
6417 Foo~bar
6418 !! text
6419 Just a test of an article title containing a tilde.
6420 !! endarticle
6421
6422 # note that links containing signatures, like [[Foo~~~~]], are
6423 # massaged by the pre-save transform (PST) and so the tildes are never
6424 # seen by the parser.
6425 !! test
6426 Link containing a tilde
6427 !! wikitext
6428 [[Foo~bar]]
6429 !! html/php
6430 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6431 </p>
6432 !! html/parsoid
6433 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6434 !! end
6435
6436 !! test
6437 Link containing double-single-quotes '' (bug 4598)
6438 !! wikitext
6439 [[Lista d''e paise d''o munno]]
6440 !! html/php
6441 <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>
6442 </p>
6443 !! html/parsoid
6444 <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>
6445 !! end
6446
6447 !! test
6448 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6449 !! wikitext
6450 Some [[Link|pretty ''italics'' and stuff]]!
6451 !! html/php
6452 <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>!
6453 </p>
6454 !! html/parsoid
6455 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6456 !! end
6457
6458 !! test
6459 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6460 !! wikitext
6461 ''Some [[Link|pretty ''italics'' and stuff]]!''
6462 !! html
6463 <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>
6464 </p>
6465 !! end
6466
6467 !! test
6468 Link with double quotes in title part (literal) and alternate part (interpreted)
6469 !! wikitext
6470 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
6471
6472 [[''Pentecoste'']]
6473
6474 [[''Pentecoste''|Pentecoste]]
6475
6476 [[''Pentecoste''|''Pentecoste'']]
6477 !! html/php
6478 <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>
6479 </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>
6480 </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>
6481 </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>
6482 </p>
6483 !! html/parsoid
6484 <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>
6485 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6486 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6487 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6488 !! end
6489
6490 !! test
6491 Broken image links with HTML captions (bug 39700)
6492 !! wikitext
6493 [[File:Nonexistent|<script></script>]]
6494 [[File:Nonexistent|100x100px|<script></script>]]
6495 [[File:Nonexistent|&lt;]]
6496 [[File:Nonexistent|a<i>b</i>c]]
6497 !! html/php
6498 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6499 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6500 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6501 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6502 </p>
6503 !! html/parsoid
6504 <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>
6505 <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>
6506 <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>
6507 <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>
6508 !! end
6509
6510 !! test
6511 Plain link to URL
6512 !! wikitext
6513 [[http://www.example.com]]
6514 !! html/php
6515 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6516 </p>
6517 !! html/parsoid
6518 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6519 !! end
6520
6521 !! test
6522 Plain link to URL with link text
6523 !! wikitext
6524 [[http://www.example.com Link text]]
6525 !! html
6526 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6527 </p>
6528 !! end
6529
6530 !! test
6531 Plain link to protocol-relative URL
6532 !! wikitext
6533 [[//www.example.com]]
6534 !! html/php
6535 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6536 </p>
6537 !! html/parsoid
6538 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6539 !! end
6540
6541 !! test
6542 Plain link to protocol-relative URL with link text
6543 !! wikitext
6544 [[//www.example.com Link text]]
6545 !! html
6546 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6547 </p>
6548 !! end
6549
6550 !! test
6551 Plain link to page with question mark in title
6552 !! wikitext
6553 [[A?b]]
6554
6555 [[A?b|Baz]]
6556 !! html
6557 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6558 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6559 </p>
6560 !! end
6561
6562
6563 # I'm fairly sure the expected result here is wrong.
6564 # We want these to be URL links, not pseudo-pages with URLs for titles....
6565 # However the current output is also pretty screwy.
6566 #
6567 # ----
6568 # I'm changing it to match the current output--it arguably makes more
6569 # sense in the light of the test above. Old expected result was:
6570 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6571 #</p>
6572 # But I think this test is bordering on "garbage in, garbage out" anyway.
6573 # -- wtm
6574 !! test
6575 Piped link to URL
6576 !! wikitext
6577 Piped link to URL: [[http://www.example.com|an example URL]]
6578 !! html/php
6579 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6580 </p>
6581 !! html/parsoid
6582 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6583 !! end
6584
6585 !! test
6586 BUG 2: [[page|http://url/]] should link to page, not http://url/
6587 !! wikitext
6588 [[Main Page|http://url/]]
6589 !! html/php
6590 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6591 </p>
6592 !! html/parsoid
6593 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6594 !! end
6595
6596 # Parsoid does not mark self-links, by design.
6597 !! test
6598 BUG 337: Escaped self-links should be bold
6599 !! options
6600 title=[[Bug462]]
6601 !! wikitext
6602 [[Bu&#103;462]] [[Bug462]]
6603 !! html/php
6604 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6605 </p>
6606 !! html/php+tidy
6607 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6608 !! html/parsoid
6609 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6610 !! end
6611
6612 !! test
6613 Self-link to section should not be bold
6614 !! options
6615 title=[[Main Page]]
6616 !! wikitext
6617 [[Main Page#section]]
6618 !! html
6619 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6620 </p>
6621 !! end
6622
6623 !! article
6624 00
6625 !! text
6626 This is 00.
6627 !! endarticle
6628
6629 !!test
6630 Self-link to numeric title
6631 !!options
6632 title=[[0]]
6633 !! wikitext
6634 [[0]]
6635 !! html
6636 <p><strong class="selflink">0</strong>
6637 </p>
6638 !!end
6639
6640 !!test
6641 Link to numeric-equivalent title
6642 !!options
6643 title=[[0]]
6644 !! wikitext
6645 [[00]]
6646 !! html
6647 <p><a href="/wiki/00" title="00">00</a>
6648 </p>
6649 !!end
6650
6651 !! test
6652 <nowiki> inside a link
6653 !! wikitext
6654 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6655 !! html
6656 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6657 </p>
6658 !! end
6659
6660 !! test
6661 Non-breaking spaces in title
6662 !! wikitext
6663 [[&nbsp; Main &nbsp; Page &nbsp;]]
6664 !! html
6665 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6666 </p>
6667 !!end
6668
6669 !! test
6670 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6671 !! options
6672 language=ca
6673 !! wikitext
6674 '''[[Main Page]]'''
6675 !! html
6676 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6677 </p>
6678 !! end
6679
6680 !! test
6681 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6682 !! options
6683 language=ca
6684 !! wikitext
6685 ''[[Main Page]]''
6686 !! html
6687 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6688 </p>
6689 !! end
6690
6691 !! test
6692 Internal link with en linktrail: no apostrophes (bug 27473)
6693 !! options
6694 language=en
6695 !! wikitext
6696 [[Something]]'nice
6697 !! html
6698 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6699 </p>
6700 !! end
6701
6702 !! test
6703 Internal link with ca linktrail with apostrophes (bug 27473)
6704 !! options
6705 language=ca
6706 !! wikitext
6707 [[Something]]'nice
6708 !! html
6709 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6710 </p>
6711 !! end
6712
6713 !! test
6714 Internal link with kaa linktrail with apostrophes (bug 27473)
6715 !! options
6716 language=kaa
6717 !! wikitext
6718 [[Something]]'nice
6719 !! html
6720 <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>
6721 </p>
6722 !! end
6723
6724 !! test
6725 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6726 !! wikitext
6727 [[User:Foo/Test/63636:Bar|Test]]
6728 !! html/php
6729 <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>
6730 </p>
6731 !! html/parsoid
6732 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
6733 !! end
6734
6735 !! test
6736 Purely hash wikilink
6737 !! options
6738 title=[[User:test/123]]
6739 !! wikitext
6740 [[#a|b]]
6741 !! html/php
6742 <p><a href="#a">b</a>
6743 </p>
6744 !! html/parsoid
6745 <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>
6746 !! end
6747
6748 !! test
6749 1. Interaction of linktrail and template encapsulation
6750 !! options
6751 parsoid
6752 !! wikitext
6753 {{echo|[[Foo]]}}l
6754 !! html
6755 <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>
6756 !! end
6757
6758 !! test
6759 2. Interaction of linktrail and template encapsulation
6760 !! options
6761 parsoid
6762 !! wikitext
6763 {{echo|Some [[Fool]]}}s
6764 !! html
6765 <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>
6766 !! end
6767
6768 !! test
6769 3. Interaction of linktrail and template encapsulation
6770 !! options
6771 parsoid
6772 !! wikitext
6773 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6774 !! html
6775 <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>
6776 !! end
6777
6778 !! article
6779 Söfnuður
6780 !! text
6781 Test.
6782 !! endarticle
6783
6784 !! test
6785 Internal link with is link prefix
6786 !! options
6787 language=is
6788 !! wikitext
6789 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6790 !! html
6791 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6792 </p>
6793 !! end
6794
6795 !! article
6796 Mótmælendatrú
6797 !! text
6798 Test.
6799 !! endarticle
6800
6801 !! test
6802 Internal link with is link trail and link prefix
6803 !! options
6804 language=is
6805 !! wikitext
6806 [[mótmælendatrú|xxx]]ar
6807 [[mótmælendatrú]]ar
6808 mótmælenda[[söfnuður]]
6809 mótmælenda[[söfnuður|söfnuðir]]
6810 mótmælenda[[söfnuður|söfnuðir]]xxx
6811 !! html
6812 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6813 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6814 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6815 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6816 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6817 </p>
6818 !! end
6819
6820 !! test
6821 Parsoid link trail escaping
6822 !! options
6823 parsoid=html2wt,html2html
6824 !! wikitext
6825 [[apple]]<nowiki/>s
6826 !! html
6827 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
6828 !! end
6829
6830 !! test
6831 Parsoid link prefix escaping
6832 !! options
6833 language=is
6834 parsoid=html2wt,html2html
6835 !! wikitext
6836 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6837 !! html
6838 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
6839 !! end
6840
6841 !! test
6842 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6843 !! wikitext
6844 [[Foo| bar]]
6845
6846 [[Foo| ''bar'']]
6847
6848 [http://wp.org foo]
6849
6850 [http://wp.org ''foo'']
6851 !! html
6852 <p><a href="/wiki/Foo" title="Foo"> bar</a>
6853 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
6854 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6855 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6856 </p>
6857 !! end
6858
6859 !! test
6860 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6861 !! options
6862 parsoid
6863 !! wikitext
6864 [[Foo|{{echo|a}} b {{echo|c}}]]
6865 !! html
6866 <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>
6867 !! end
6868
6869 !! test
6870 Link with angle bracket after anchor
6871 !! wikitext
6872 [[Foo#<bar>]]
6873 !! html/php
6874 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
6875 </p>
6876 !! html/parsoid
6877 <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>
6878 !! end
6879
6880 ###
6881 ### Interwiki links (see maintenance/interwiki.sql)
6882 ###
6883
6884 !! test
6885 Inline interwiki link
6886 !! options
6887 parsoid=wt2html,wt2wt,html2html
6888 !! wikitext
6889 [[MeatBall:SoftSecurity]]
6890 !! html/php
6891 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6892 </p>
6893 !! html/parsoid
6894 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
6895 !! end
6896
6897 !! test
6898 Inline interwiki link with empty title (bug 2372)
6899 !! options
6900 parsoid=wt2html,wt2wt,html2html
6901 !! wikitext
6902 [[MeatBall:]]
6903 !! html/php
6904 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6905 </p>
6906 !! html/parsoid
6907 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
6908 !! end
6909
6910 !! test
6911 Interwiki link encoding conversion (bug 1636)
6912 !! wikitext
6913 *[[Wikipedia:ro:Olteni&#0355;a]]
6914 *[[Wikipedia:ro:Olteni&#355;a]]
6915 !! html
6916 <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>
6917 <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>
6918
6919 !! html+tidy
6920 <ul>
6921 <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>
6922 <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>
6923 </ul>
6924 !! end
6925
6926 !! test
6927 Interwiki link with fragment (bug 2130)
6928 !! wikitext
6929 [[MeatBall:SoftSecurity#foo]]
6930 !! html
6931 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6932 </p>
6933 !! end
6934
6935 # Ideally the wikipedia: prefix here should be proto-relative too
6936 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
6937 # define the 'en' prefix, and originally the test used 'wikipedia',
6938 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
6939 # article.
6940 !! test
6941 Different interwiki prefixes mapping to the same URL
6942 !! wikitext
6943 [[:en:Foo]]
6944
6945 [[:en:Foo|Foo]]
6946
6947 [[wikipedia:Foo]]
6948
6949 [[:wikipedia:Foo|Foo]]
6950
6951 [[wikipedia:en:Foo]]
6952
6953 [[:wikipedia:en:Foo]]
6954
6955 [[ wikiPEdia :Foo]]
6956 !! html/parsoid
6957 <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>
6958
6959 <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>
6960
6961 <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>
6962
6963 <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>
6964
6965 <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>
6966
6967 <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>
6968
6969 <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>
6970 !! end
6971
6972 !! test
6973 Interwiki links that cannot be represented in wiki syntax
6974 !! wikitext
6975 [[meatball:ok]]
6976 [[meatball:ok#foo|ok with fragment]]
6977 [[meatball:ok_as_well?|ok ending with ? mark]]
6978 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6979 [http://de.wikipedia.org/wiki/#foo is just fragment]
6980
6981 !! html/php
6982 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
6983 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
6984 <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>
6985 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6986 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
6987 </p>
6988 !! html/parsoid
6989 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
6990 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
6991 <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>
6992 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6993 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6994 !! end
6995
6996 !! test
6997 Interwiki links: trail
6998 !! wikitext
6999 [[wikipedia:Foo|Ba]]r
7000 !! html/php
7001 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7002 </p>
7003 !! html/parsoid
7004 <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>
7005 !! end
7006
7007 !! test
7008 Local interwiki link
7009 !! options
7010 parsoid=wt2html,wt2wt,html2html
7011 !! wikitext
7012 [[local:Template:Foo]]
7013 !! html/php
7014 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7015 </p>
7016 !! html/parsoid
7017 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7018 !! end
7019
7020 # Parsoid does not mark self-links, by design.
7021 !! test
7022 Local interwiki link: self-link to current page
7023 !! options
7024 title=[[Main Page]]
7025 parsoid=wt2html,wt2wt,html2html
7026 !! wikitext
7027 [[local:Main Page]]
7028 !! html/php
7029 <p><strong class="selflink">local:Main Page</strong>
7030 </p>
7031 !! html/parsoid
7032 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7033 !! end
7034
7035 !! test
7036 Local interwiki link: prefix only (bug 64167)
7037 !! options
7038 parsoid=wt2html,wt2wt,html2html
7039 !! wikitext
7040 [[local:]]
7041 !! html/php
7042 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7043 </p>
7044 !! html/parsoid
7045 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7046 !! end
7047
7048 !! test
7049 Local interwiki link: with additional interwiki prefix (bug 61357)
7050 !! options
7051 parsoid=wt2html,wt2wt,html2html
7052 !! wikitext
7053 [[local:meatball:Hello]]
7054 !! html/php
7055 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7056 </p>
7057 !! html/parsoid
7058 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7059 !! end
7060
7061 !! test
7062 Multiple local interwiki link prefixes
7063 !! wikitext
7064 [[local:local:local:local:mi:local:Foo]]
7065 !! options
7066 parsoid=wt2html,wt2wt,html2html
7067 !! html/php
7068 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7069 </p>
7070 !! html/parsoid
7071 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7072 !! end
7073
7074 ###
7075 ### Interlanguage links
7076 ### Language links (so that searching for '### language' matches..)
7077 ###
7078
7079 !! test
7080 Interlanguage link
7081 !! options
7082 parsoid=wt2html,wt2wt,html2html
7083 !! wikitext
7084 Blah blah blah
7085 [[zh:Chinese]]
7086 !! html/php
7087 <p>Blah blah blah
7088 </p>
7089 !! html/parsoid
7090 <p>Blah blah blah</p>
7091 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7092 !! end
7093
7094 !! test
7095 Interlanguage link with spacing
7096 !! options
7097 parsoid=wt2html,wt2wt,html2html
7098 !! wikitext
7099 Blah blah blah
7100 [[ zh : Chinese ]]
7101 !! html/php
7102 <p>Blah blah blah
7103 </p>
7104 !! html/parsoid
7105 <p>Blah blah blah</p>
7106 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7107 !! end
7108
7109 !! test
7110 Double interlanguage link
7111 !! options
7112 parsoid=wt2html,wt2wt,html2html
7113 !! wikitext
7114 Blah blah blah
7115 [[es:Spanish]]
7116 [[zh:Chinese]]
7117 !! html/php
7118 <p>Blah blah blah
7119 </p>
7120 !! html/parsoid
7121 <p>Blah blah blah</p>
7122 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7123 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7124 !! end
7125
7126 !! test
7127 Interlanguage link variations
7128 !! options
7129 parsoid=wt2html,wt2wt,html2html
7130 !! wikitext
7131 Blah blah blah
7132 [[ es :Spanish]]
7133 [[ ZH :Chinese]]
7134 [[es:Foo_bar]]
7135 [[es:Foo bar]]
7136 !! html/php
7137 <p>Blah blah blah
7138 </p>
7139 !! html/parsoid
7140 <p>Blah blah blah</p>
7141 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7142 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7143 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7144 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7145 !! end
7146
7147 !! test
7148 Interlanguage link, with prefix links
7149 !! options
7150 language=ln
7151 !! wikitext
7152 Blah blah blah
7153 [[zh:Chinese]]
7154 !! html/php
7155 <p>Blah blah blah
7156 </p>
7157 !! html/parsoid
7158 <p>Blah blah blah</p>
7159 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7160 !! end
7161
7162 !! test
7163 Double interlanguage link, with prefix links (bug 8897)
7164 !! options
7165 language=ln
7166 !! wikitext
7167 Blah blah blah
7168 [[es:Spanish]]
7169 [[zh:Chinese]]
7170 !! html/php
7171 <p>Blah blah blah
7172 </p>
7173 !! html/parsoid
7174 <p>Blah blah blah</p>
7175 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7176 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7177 !! end
7178
7179 !! test
7180 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7181 !! wikitext
7182 Blah blah blah
7183 [[mul:Article]]
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" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7190 !! end
7191
7192 !! test
7193 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7194 !! options
7195 language=ln
7196 !! wikitext
7197 [[WW&nbsp;II]]
7198 !! html
7199 <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>
7200 </p>
7201 !! end
7202
7203 !! test
7204 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7205 !! options
7206 parsoid=html2wt
7207 !! wikitext
7208 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7209
7210 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7211 !! html
7212 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7213 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7214 !! end
7215
7216 !! test
7217 Parsoid: handle constructor well
7218 !! wikitext
7219 [[constructor]]
7220
7221 [[constructor:foo]]
7222 !! html/php
7223 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7224 </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>
7225 </p>
7226 !! html/parsoid
7227 <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>
7228
7229 <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>
7230 !! end
7231
7232 !! article
7233 ko:
7234 !! text
7235 Test.
7236 !! endarticle
7237
7238 # Note that `ko` isn't a known interlanguage prefix
7239 !! test
7240 Parsoid: recognize interlanguage links without a target page
7241 !! options
7242 ill
7243 !! wikitext
7244 [[es:]]
7245
7246 [[ko:]]
7247 !! html/php
7248 es:
7249 !! html/parsoid
7250 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7251
7252 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7253 !! end
7254
7255 # Note that `ko` isn't a known interwiki prefix
7256 !! test
7257 Parsoid: recognize interwiki links without a target page
7258 !! options
7259 parsoid=wt2html,wt2wt,html2html
7260 !! wikitext
7261 [[:es:]]
7262
7263 [[:ko:]]
7264 !! html/php
7265 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7266 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7267 </p>
7268 !! html/parsoid
7269 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7270 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7271 !! end
7272
7273 !! test
7274 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7275 !! wikitext
7276 [[mi:Foo]]
7277 !! html/php
7278 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7279 </p>
7280 !! html/parsoid
7281 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7282 !! end
7283
7284 !! test
7285 Interlanguage link with preceding local interwiki link (bug 68085)
7286 !! options
7287 parsoid=wt2html,wt2wt,html2html
7288 !! wikitext
7289 Blah blah blah
7290 [[local:es:Spanish]]
7291 !! html/php
7292 <p>Blah blah blah
7293 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7294 </p>
7295 !! html/parsoid
7296 <p>Blah blah blah
7297 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7298 !! end
7299
7300 !! test
7301 Looks like an interlanguage link, but is actually a local interwiki
7302 !! options
7303 parsoid=wt2html,wt2wt,html2html
7304 !! wikitext
7305 Blah blah blah
7306 [[mi:Template:Foo]]
7307 !! html/php
7308 <p>Blah blah blah
7309 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7310 </p>
7311 !! html/parsoid
7312 <p>Blah blah blah
7313 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7314 !! end
7315
7316 ###
7317 ### Redirects, Parsoid-only
7318 ###
7319 !! test
7320 1. Simple redirect to page
7321 !! options
7322 parsoid
7323 !! wikitext
7324 #REDIRECT [[Main Page]]
7325 !! html
7326 <link rel="mw:PageProp/redirect" href="./Main_Page">
7327 !! end
7328
7329 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
7330 !! test
7331 2. Other redirect variants
7332 !! options
7333 parsoid=wt2html,wt2wt
7334 !! wikitext
7335 #REDIRECT [[Main_Page]]
7336 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
7337 !! html/parsoid
7338 <link rel="mw:PageProp/redirect" href="./Main_Page"><link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
7339 !! end
7340
7341 !! test
7342 Empty redirect
7343 !! options
7344 parsoid=wt2html,wt2wt
7345 !! wikitext
7346 #REDIRECT [[]]
7347 !! html
7348 <ol>
7349 <li>REDIRECT [[]]</li></ol>
7350 !! end
7351
7352 !! test
7353 Optional colon in #REDIRECT
7354 !! options
7355 # the colon is archaic syntax. we support it for wt2html, but we
7356 # don't care that it roundtrips back to the modern syntax.
7357 parsoid=wt2html,html2html
7358 !! wikitext
7359 #REDIRECT:[[Main Page]]
7360 !! html
7361 <link rel="mw:PageProp/redirect" href="./Main_Page">
7362 !! end
7363
7364 !! test
7365 Whitespace in #REDIRECT with optional colon
7366 !! options
7367 # the colon and gratuitous whitespace is archaic syntax. we support
7368 # it for wt2html, but we don't care that it roundtrips back to the
7369 # modern syntax (without extra whitespace)
7370 parsoid=wt2html,html2html
7371 !! wikitext
7372
7373 #REDIRECT
7374 :
7375 [[Main Page]]
7376 !! html
7377 <link rel="mw:PageProp/redirect" href="./Main_Page">
7378 !! end
7379
7380 !! test
7381 Piped link in #REDIRECT
7382 !! options
7383 # content after piped link is ignored. we support this syntax,
7384 # but don't care that the piped link is lost when we roundtrip this.
7385 parsoid=wt2html
7386 !! wikitext
7387 #REDIRECT [[Main Page|bar]]
7388 !! html
7389 <link rel="mw:PageProp/redirect" href="./Main_Page">
7390 !! end
7391
7392 !! test
7393 Redirect to category
7394 !! options
7395 parsoid=wt2html
7396 !! wikitext
7397 #REDIRECT [[Category:Foo]]
7398 !! html
7399 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7400 !! end
7401
7402 !! test
7403 Redirect to category with URL encoding
7404 !! options
7405 parsoid=wt2html
7406 !! wikitext
7407 #REDIRECT [[Category%3AFoo]]
7408 !! html
7409 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7410 !! end
7411
7412 !! test
7413 Redirect to category page
7414 !! options
7415 parsoid=wt2html,html2html
7416 !! wikitext
7417 #REDIRECT [[:Category:Foo]]
7418 !! html
7419 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7420 !! end
7421
7422 !! test
7423 Redirect to image page (1)
7424 !! options
7425 parsoid
7426 !! wikitext
7427 #REDIRECT [[File:Wiki.png]]
7428 !! html
7429 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7430 !! end
7431
7432 !! test
7433 Redirect to image page (2)
7434 !! options
7435 parsoid
7436 !! wikitext
7437 #REDIRECT [[Image:Wiki.png]]
7438 !! html
7439 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7440 !! end
7441
7442 !! test
7443 Redirect to language
7444 !! options
7445 parsoid
7446 !! wikitext
7447 #REDIRECT [[en:File:Wiki.png]]
7448 !! html
7449 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7450 !! end
7451
7452 !! test
7453 Redirect to interwiki
7454 !! options
7455 parsoid
7456 !! wikitext
7457 #REDIRECT [[meatball:File:Wiki.png]]
7458 !! html
7459 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7460 !! end
7461
7462 !! test
7463 Non-English #REDIRECT
7464 !! options
7465 parsoid
7466 language=is
7467 !! wikitext
7468 #TILVÍSUN [[Main Page]]
7469 !! html
7470 <link rel="mw:PageProp/redirect" href="./Main_Page">
7471 !! end
7472
7473 !! test
7474 New redirect
7475 !! options
7476 parsoid=html2wt
7477 !! wikitext
7478 Foo
7479 #REDIRECT [[Foo]]
7480 !! html
7481 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7482 !! end
7483
7484 ##
7485 ## XHTML tidiness
7486 ###
7487
7488 !! test
7489 <br> to <br />
7490 !! wikitext
7491 1<br>2<br />3
7492 !! html
7493 <p>1<br />2<br />3
7494 </p>
7495 !! end
7496
7497 !! test
7498 Broken br tag sanitization
7499 !! wikitext
7500 </br>
7501 !! html/php
7502 <p>&lt;/br&gt;
7503 </p>
7504 !! end
7505
7506 # TODO: Fix html2html mode (bug 51055)!
7507 # This </br> handling was added as part of bug 50831; but it
7508 # differs from how PHP+tidy handles this. We should investigate
7509 # this.
7510 !! test
7511 Parsoid: Broken br tag recognition
7512 !! options
7513 parsoid=wt2html
7514 !! wikitext
7515 </br>
7516
7517 <br/ >
7518 !! html/php+tidy
7519 <p>&lt;/br&gt;</p>
7520 <p><br /></p>
7521 !! html/parsoid
7522 <p><br></p>
7523 <p><br/></p>
7524 !! end
7525
7526 !! test
7527 Incorrecly removing closing slashes from correctly formed XHTML
7528 !! wikitext
7529 <br style="clear:both;" />
7530 !! html
7531 <p><br style="clear:both;" />
7532 </p>
7533 !! end
7534
7535 !! test
7536 Failing to transform badly formed HTML into correct XHTML
7537 !! wikitext
7538 <br style="clear: left;">
7539 <br style="clear: right;">
7540 <br style="clear: both;">
7541 !! html
7542 <p><br style="clear: left;" />
7543 <br style="clear: right;" />
7544 <br style="clear: both;" />
7545 </p>
7546 !!end
7547
7548 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
7549 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
7550 !! test
7551 Handling html with a div self-closing tag
7552 !! wikitext
7553 <div title />
7554 <div title/>
7555 <div title/ >
7556 <div title=bar />
7557 <div title=bar/>
7558 <div title=bar/ >
7559 !! html/php
7560 <p>&lt;div title /&gt;
7561 &lt;div title/&gt;
7562 </p>
7563 <div>
7564 <p>&lt;div title=bar /&gt;
7565 &lt;div title=bar/&gt;
7566 </p>
7567 <div title="bar/"></div>
7568 </div>
7569
7570 !! html/parsoid
7571 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7572 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7573 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
7574 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7575 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7576 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
7577 !! end
7578
7579 !! test
7580 Handling html with a br self-closing tag
7581 !! wikitext
7582 <br title />
7583 <br title/>
7584 <br title/ >
7585 <br title=bar />
7586 <br title=bar/>
7587 <br title=bar/ >
7588 !! html/php
7589 <p><br title="title" />
7590 <br title="title" />
7591 <br />
7592 <br title="bar" />
7593 <br title="bar" />
7594 <br title="bar/" />
7595 </p>
7596 !! html/parsoid
7597 <p><br title="" />
7598 <br title="" />
7599 <br title="" />
7600 <br title="bar" />
7601 <br title="bar" />
7602 <br title="bar/" />
7603 </p>
7604 !! end
7605
7606 !! test
7607 Horizontal ruler (should it add that extra space?)
7608 !! wikitext
7609 <hr>
7610 <hr >
7611 foo <hr
7612 > bar
7613 !! html+tidy
7614 <hr />
7615 <hr />
7616 <p>foo</p>
7617 <hr />
7618 <p>bar</p>
7619 !! end
7620
7621 !! test
7622 Horizontal ruler -- 4+ dashes render hr
7623 !! wikitext
7624 ----
7625 !! html
7626 <hr />
7627
7628 !! end
7629
7630 !! test
7631 Horizontal ruler -- eats additional dashes on the same line
7632 !! wikitext
7633 ---------
7634 !! html
7635 <hr />
7636
7637 !! end
7638
7639 !! test
7640 Horizontal ruler -- does not collapse dashes on consecutive lines
7641 !! wikitext
7642 ----
7643 ----
7644 !! html
7645 <hr />
7646 <hr />
7647
7648 !! end
7649
7650 !! test
7651 Horizontal ruler -- <4 dashes render as plain text
7652 !! wikitext
7653 ---
7654 !! html
7655 <p>---
7656 </p>
7657 !! end
7658
7659 !! test
7660 Horizontal ruler -- Supports content following dashes on same line
7661 !! wikitext
7662 ---- Foo
7663 !! html
7664 <hr /> Foo
7665
7666 !! html+tidy
7667 <hr />
7668 <p>Foo</p>
7669 !! end
7670
7671 ###
7672 ### Block-level elements
7673 ###
7674 !! test
7675 Common list
7676 !! wikitext
7677 *Common list
7678 * item 2
7679 *item 3
7680 !! html
7681 <ul><li>Common list</li>
7682 <li> item 2</li>
7683 <li>item 3</li></ul>
7684
7685 !! end
7686
7687 !! test
7688 Numbered list
7689 !! wikitext
7690 #Numbered list
7691 #item 2
7692 # item 3
7693 !! html
7694 <ol><li>Numbered list</li>
7695 <li>item 2</li>
7696 <li> item 3</li></ol>
7697
7698 !! end
7699
7700 !! test
7701 Mixed list
7702 !! wikitext
7703 *Mixed list
7704 *# with numbers
7705 ** and bullets
7706 *# and numbers
7707 *bullets again
7708 **bullet level 2
7709 ***bullet level 3
7710 ***#Number on level 4
7711 **bullet level 2
7712 **#Number on level 3
7713 **#Number on level 3
7714 *#number level 2
7715 *Level 1
7716 *** Level 3
7717 #** Level 3, but ordered
7718 !! html
7719 <ul><li>Mixed list
7720 <ol><li> with numbers</li></ol>
7721 <ul><li> and bullets</li></ul>
7722 <ol><li> and numbers</li></ol></li>
7723 <li>bullets again
7724 <ul><li>bullet level 2
7725 <ul><li>bullet level 3
7726 <ol><li>Number on level 4</li></ol></li></ul></li>
7727 <li>bullet level 2
7728 <ol><li>Number on level 3</li>
7729 <li>Number on level 3</li></ol></li></ul>
7730 <ol><li>number level 2</li></ol></li>
7731 <li>Level 1
7732 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7733 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7734
7735 !! end
7736
7737 !! test
7738 Nested lists 1
7739 !! wikitext
7740 *foo
7741 **bar
7742 !! html
7743 <ul><li>foo
7744 <ul><li>bar</li></ul></li></ul>
7745
7746 !! end
7747
7748 !! test
7749 Nested lists 2
7750 !! wikitext
7751 **foo
7752 *bar
7753 !! html
7754 <ul><li><ul><li>foo</li></ul></li>
7755 <li>bar</li></ul>
7756
7757 !! end
7758
7759 !! test
7760 Nested lists 3 (first element empty)
7761 !! wikitext
7762 *
7763 **bar
7764 !! html
7765 <ul><li>
7766 <ul><li>bar</li></ul></li></ul>
7767
7768 !! end
7769
7770 !! test
7771 Nested lists 4 (first element empty)
7772 !! wikitext
7773 **
7774 *bar
7775 !! html
7776 <ul><li><ul><li></li></ul></li>
7777 <li>bar</li></ul>
7778
7779 !! end
7780
7781 !! test
7782 Nested lists 5 (both elements empty)
7783 !! wikitext
7784 **
7785 *
7786 !! html
7787 <ul><li><ul><li></li></ul></li>
7788 <li></li></ul>
7789
7790 !! end
7791
7792 !! test
7793 Nested lists 6 (both elements empty)
7794 !! wikitext
7795 *
7796 **
7797 !! html
7798 <ul><li>
7799 <ul><li></li></ul></li></ul>
7800
7801 !! end
7802
7803 !! test
7804 Nested lists 7 (skip initial nesting levels)
7805 !! wikitext
7806 *** foo
7807 !! html
7808 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7809
7810 !! end
7811
7812 !! test
7813 Nested lists 8 (multiple nesting transitions)
7814 !! wikitext
7815 * foo
7816 *** bar
7817 ** baz
7818 * boo
7819 !! html
7820 <ul><li> foo
7821 <ul><li><ul><li> bar</li></ul></li>
7822 <li> baz</li></ul></li>
7823 <li> boo</li></ul>
7824
7825 !! end
7826
7827 !! test
7828 1. Lists with start-of-line-transparent tokens before bullets: Comments
7829 !! wikitext
7830 *foo
7831 *<!--cmt-->bar
7832 <!--cmt-->*baz
7833 !! html
7834 <ul><li>foo</li>
7835 <li>bar</li>
7836 <li>baz</li></ul>
7837
7838 !! end
7839
7840 !! test
7841 2. Lists with start-of-line-transparent tokens before bullets: Template close
7842 !! wikitext
7843 *foo {{echo|bar
7844 }}*baz
7845 !! html
7846 <ul><li>foo bar</li>
7847 <li>baz</li></ul>
7848
7849 !! end
7850
7851 !! test
7852 List items are not parsed correctly following a <pre> block (bug 785)
7853 !! wikitext
7854 * <pre>foo</pre>
7855 * <pre>bar</pre>
7856 * zar
7857 !! html
7858 <ul><li> <pre>foo</pre></li>
7859 <li> <pre>bar</pre></li>
7860 <li> zar</li></ul>
7861
7862 !! end
7863
7864 !! test
7865 List items from template
7866 !! wikitext
7867
7868 {{inner list}}
7869 * item 2
7870
7871 * item 0
7872 {{inner list}}
7873 * item 2
7874
7875 * item 0
7876 * notSOL{{inner list}}
7877 * item 2
7878 !! html
7879 <ul><li> item 1</li>
7880 <li> item 2</li></ul>
7881 <ul><li> item 0</li>
7882 <li> item 1</li>
7883 <li> item 2</li></ul>
7884 <ul><li> item 0</li>
7885 <li> notSOL</li>
7886 <li> item 1</li>
7887 <li> item 2</li></ul>
7888
7889 !! end
7890
7891 !! test
7892 List interrupted by empty line or heading
7893 !! wikitext
7894 * foo
7895
7896 ** bar
7897 == A heading ==
7898 * Another list item
7899 !! html
7900 <ul><li> foo</li></ul>
7901 <ul><li><ul><li> bar</li></ul></li></ul>
7902 <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>
7903 <ul><li> Another list item</li></ul>
7904
7905 !!end
7906
7907 !!test
7908 Multiple list tags generated by templates
7909 !! wikitext
7910 {{echo|<li>}}a
7911 {{echo|<li>}}b
7912 {{echo|<li>}}c
7913 !! html
7914 <li>a
7915 <li>b
7916 <li>c</li>
7917 </li>
7918 </li>
7919
7920 !! html+tidy
7921 <ul>
7922 <li>a</li>
7923 <li>b</li>
7924 <li>c</li>
7925 </ul>
7926 !!end
7927
7928 !!test
7929 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7930 !! wikitext
7931 *a
7932 <!--This line will NOT split the list-->
7933 *b
7934 <!--This line will NOT split the list either-->
7935 *c
7936 <!--foo--> <!----> <!--This line NOT split the list either-->
7937 *d
7938 !! html
7939 <ul><li>a</li>
7940 <li>b</li>
7941 <li>c</li>
7942 <li>d</li></ul>
7943
7944 !!end
7945
7946 !!test
7947 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7948 !! wikitext
7949 *a
7950 <!--This line will NOT split the list-->
7951 *b
7952 <!--This line will NOT split the list either-->
7953 *c
7954 <!--foo--> <!----> <!--This line NOT split the list
7955 either-->
7956 *d
7957 !! html
7958 <ul><li>a</li>
7959 <li>b</li>
7960 <li>c</li>
7961 <li>d</li></ul>
7962
7963 !!end
7964
7965 !!test
7966 Test the li-hack
7967 (The PHP parser relies on Tidy for the hack)
7968 !!options
7969 parsoid=wt2html,wt2wt
7970 !! wikitext
7971 * foo
7972 * <li>li-hack
7973 * {{echo|<li>templated li-hack}}
7974 * <!--foo--> <li> unsupported li-hack with preceding comments
7975
7976 <ul>
7977 <li><li>not a li-hack
7978 </li>
7979 </ul>
7980 !! html+tidy
7981 <ul>
7982 <li>foo</li>
7983 <li>li-hack</li>
7984 <li>templated li-hack</li>
7985 <li>unsupported li-hack with preceding comments</li>
7986 </ul>
7987 <ul>
7988 <li>not a li-hack</li>
7989 </ul>
7990 !!end
7991
7992 !! test
7993 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
7994 !! options
7995 parsoid
7996 !! wikitext
7997 # foo
7998 ## bar
7999 * foo
8000 ** bar
8001 : foo
8002 :: bar
8003 !! html
8004 <ol>
8005 <li> foo<ol>
8006 <li> bar</li>
8007 </ol></li>
8008 </ol><ul>
8009 <li> foo<ul>
8010 <li> bar</li>
8011 </ul></li>
8012 </ul><dl>
8013 <dd> foo<dl>
8014 <dd> bar</dd>
8015 </dl></dd>
8016 </dl>
8017 !! end
8018
8019 !! test
8020 Parsoid: Test of whitespace serialization with Templated bullets
8021 !! options
8022 parsoid
8023 !! wikitext
8024 * {{bullet}}
8025 !! html
8026 <ul>
8027 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8028 </ul>
8029 !! end
8030
8031 # ------------------------------------------------------------------------
8032 # The next set of tests are about Parsoid's ability to handle badly nested
8033 # tags (parse, minimize scope of fixup, and roundtrip back)
8034 # ------------------------------------------------------------------------
8035
8036 !! test
8037 Unbalanced closing block tags break a list
8038 (php parser relies on Tidy to fix up)
8039 !! wikitext
8040 <div>
8041 *a</div><div>
8042 *b</div>
8043 !! html+tidy
8044 <div>
8045 <ul>
8046 <li>a</li>
8047 </ul>
8048 </div>
8049 <div>
8050 <ul>
8051 <li>b</li>
8052 </ul>
8053 </div>
8054 !! end
8055
8056 # Parsoid fails this test, but it might be tricky to support properly.
8057 # See bug 68395.
8058 !! test
8059 Unbalanced closing non-block tags don't break a list
8060 (php parser relies on Tidy to fix up)
8061 !! wikitext
8062 <span>
8063 *a</span><span>
8064 *b</span>
8065 !! html/php+tidy
8066 <ul>
8067 <li><span>a</span></li>
8068 <li><span>b</span></li>
8069 </ul>
8070 !! html/parsoid
8071 <span>
8072 <ul>
8073 <li>a<span></span>
8074 </li>
8075 <li>b
8076 </li>
8077 </ul>
8078 </span>
8079 !! end
8080
8081 !! test
8082 Unclosed formatting tags that straddle lists are closed and reopened
8083 (php parser relies on Tidy to fix up)
8084 !! options
8085 parsoid=wt2html,wt2wt,html2html
8086 !! wikitext
8087 # <s> a
8088 # b </s>
8089 !! html/php+tidy
8090 <ol>
8091 <li><s>a</s></li>
8092 <li><s>b</s></li>
8093 </ol>
8094 !! html/parsoid
8095 <ol><li> <s> a</s></li>
8096 <li><s> b </s></li></ol>
8097 !! end
8098
8099 # Parsoid fails this test, but it might be tricky to support properly.
8100 # See bug 68395.
8101 !!test
8102 List embedded in a non-block tag
8103 (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
8104 !! wikitext
8105 <small>
8106 * foo
8107 </small>
8108 !! html/php+tidy
8109 <ul>
8110 <li><small>foo</small></li>
8111 </ul>
8112 !! html/parsoid
8113 <small>
8114 <ul>
8115 <li> foo</li>
8116 </ul>
8117 </small>
8118 !!end
8119
8120 # This is a bug in the PHP parser + tidy combination.
8121 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8122 # and then fostered out of the table by tidy.)
8123 # We believe the Parsoid output to be correct.
8124 !! test
8125 Table with missing opening <tr> tag
8126 !! options
8127 parsoid=wt2html,wt2wt
8128 !! wikitext
8129 <table>
8130 <td>foo</td>
8131 </tr>
8132 </table>
8133 !! html/php+tidy
8134 <p>&lt;/tr&gt;</p>
8135 <table>
8136 <tr>
8137 <td>foo</td>
8138 </tr>
8139 </table>
8140 !! html/parsoid
8141 <table>
8142 <tr>
8143 <td>foo</td>
8144 </tr>
8145 </table>
8146 !! end
8147
8148 ###
8149 ### Magic Words
8150 ###
8151
8152 # Note that the current date is hard-coded as
8153 # 1970-01-01T00:02:03Z (a Thursday)
8154 # when running parser tests. The timezone is also fixed to GMT, so
8155 # local date will be identical to current date.
8156
8157 !! test
8158 Magic Word: {{CURRENTDAY}}
8159 !! wikitext
8160 {{CURRENTDAY}}
8161 !! html
8162 <p>1
8163 </p>
8164 !! end
8165
8166 !! test
8167 Magic Word: {{CURRENTDAY2}}
8168 !! wikitext
8169 {{CURRENTDAY2}}
8170 !! html
8171 <p>01
8172 </p>
8173 !! end
8174
8175 !! test
8176 Magic Word: {{CURRENTDAYNAME}}
8177 !! wikitext
8178 {{CURRENTDAYNAME}}
8179 !! html
8180 <p>Thursday
8181 </p>
8182 !! end
8183
8184 !! test
8185 Magic Word: {{CURRENTDOW}}
8186 !! wikitext
8187 {{CURRENTDOW}}
8188 !! html
8189 <p>4
8190 </p>
8191 !! end
8192
8193 !! test
8194 Magic Word: {{CURRENTMONTH}}
8195 !! wikitext
8196 {{CURRENTMONTH}}
8197 !! html
8198 <p>01
8199 </p>
8200 !! end
8201
8202 !! test
8203 Magic Word: {{CURRENTMONTH1}}
8204 !! wikitext
8205 {{CURRENTMONTH1}}
8206 !! html
8207 <p>1
8208 </p>
8209 !! end
8210
8211 !! test
8212 Magic Word: {{CURRENTMONTHABBREV}}
8213 !! wikitext
8214 {{CURRENTMONTHABBREV}}
8215 !! html
8216 <p>Jan
8217 </p>
8218 !! end
8219
8220 !! test
8221 Magic Word: {{CURRENTMONTHNAME}}
8222 !! wikitext
8223 {{CURRENTMONTHNAME}}
8224 !! html
8225 <p>January
8226 </p>
8227 !! end
8228
8229 !! test
8230 Magic Word: {{CURRENTMONTHNAMEGEN}}
8231 !! wikitext
8232 {{CURRENTMONTHNAMEGEN}}
8233 !! html
8234 <p>January
8235 </p>
8236 !! end
8237
8238 !! test
8239 Magic Word: {{CURRENTTIME}}
8240 !! wikitext
8241 {{CURRENTTIME}}
8242 !! html
8243 <p>00:02
8244 </p>
8245 !! end
8246
8247 !! test
8248 Magic Word: {{CURRENTHOUR}}
8249 !! wikitext
8250 {{CURRENTHOUR}}
8251 !! html
8252 <p>00
8253 </p>
8254 !! end
8255
8256 !! test
8257 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8258 !! wikitext
8259 {{CURRENTWEEK}}
8260 !! html
8261 <p>1
8262 </p>
8263 !! end
8264
8265 !! test
8266 Magic Word: {{CURRENTYEAR}}
8267 !! wikitext
8268 {{CURRENTYEAR}}
8269 !! html
8270 <p>1970
8271 </p>
8272 !! end
8273
8274 !! test
8275 Magic Word: {{CURRENTTIMESTAMP}}
8276 !! wikitext
8277 {{CURRENTTIMESTAMP}}
8278 !! html
8279 <p>19700101000203
8280 </p>
8281 !! end
8282
8283 !! test
8284 Magic Words LOCAL (UTC)
8285 !! wikitext
8286 * {{LOCALMONTH}}
8287 * {{LOCALMONTH1}}
8288 * {{LOCALMONTHNAME}}
8289 * {{LOCALMONTHNAMEGEN}}
8290 * {{LOCALMONTHABBREV}}
8291 * {{LOCALDAY}}
8292 * {{LOCALDAY2}}
8293 * {{LOCALDAYNAME}}
8294 * {{LOCALYEAR}}
8295 * {{LOCALTIME}}
8296 * {{LOCALHOUR}}
8297 * {{LOCALWEEK}}
8298 * {{LOCALDOW}}
8299 * {{LOCALTIMESTAMP}}
8300 !! html
8301 <ul><li> 01</li>
8302 <li> 1</li>
8303 <li> January</li>
8304 <li> January</li>
8305 <li> Jan</li>
8306 <li> 1</li>
8307 <li> 01</li>
8308 <li> Thursday</li>
8309 <li> 1970</li>
8310 <li> 00:02</li>
8311 <li> 00</li>
8312 <li> 1</li>
8313 <li> 4</li>
8314 <li> 19700101000203</li></ul>
8315
8316 !! end
8317
8318 !! test
8319 Magic Word: {{FULLPAGENAME}}
8320 !! options
8321 title=[[User:Ævar Arnfjörð Bjarmason]]
8322 !! wikitext
8323 {{FULLPAGENAME}}
8324 !! html
8325 <p>User:Ævar Arnfjörð Bjarmason
8326 </p>
8327 !! end
8328
8329 !! test
8330 Magic Word: {{FULLPAGENAMEE}}
8331 !! options
8332 title=[[User:Ævar Arnfjörð Bjarmason]]
8333 !! wikitext
8334 {{FULLPAGENAMEE}}
8335 !! html
8336 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8337 </p>
8338 !! end
8339
8340 !! test
8341 Magic Word: {{TALKSPACE}}
8342 !! options
8343 title=[[User:Ævar Arnfjörð Bjarmason]]
8344 !! wikitext
8345 {{TALKSPACE}}
8346 !! html
8347 <p>User talk
8348 </p>
8349 !! end
8350
8351 !! test
8352 Magic Word: {{TALKSPACE}}, same namespace
8353 !! options
8354 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8355 !! wikitext
8356 {{TALKSPACE}}
8357 !! html
8358 <p>User talk
8359 </p>
8360 !! end
8361
8362 !! test
8363 Magic Word: {{TALKSPACE}}, main namespace
8364 !! options
8365 title=[[Parser Test]]
8366 !! wikitext
8367 {{TALKSPACE}}
8368 !! html
8369 <p>Talk
8370 </p>
8371 !! end
8372
8373 !! test
8374 Magic Word: {{TALKSPACEE}}
8375 !! options
8376 title=[[User:Ævar Arnfjörð Bjarmason]]
8377 !! wikitext
8378 {{TALKSPACEE}}
8379 !! html
8380 <p>User_talk
8381 </p>
8382 !! end
8383
8384 !! test
8385 Magic Word: {{SUBJECTSPACE}}
8386 !! options
8387 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8388 !! wikitext
8389 {{SUBJECTSPACE}}
8390 !! html
8391 <p>User
8392 </p>
8393 !! end
8394
8395 !! test
8396 Magic Word: {{SUBJECTSPACE}}, same namespace
8397 !! options
8398 title=[[User:Ævar Arnfjörð Bjarmason]]
8399 !! wikitext
8400 {{SUBJECTSPACE}}
8401 !! html
8402 <p>User
8403 </p>
8404 !! end
8405
8406 !! test
8407 Magic Word: {{SUBJECTSPACE}}, main namespace
8408 !! options
8409 title=[[Parser Test]]
8410 !! wikitext
8411 {{SUBJECTSPACE}}
8412 !! html
8413
8414 !! end
8415
8416 !! test
8417 Magic Word: {{SUBJECTSPACEE}}
8418 !! options
8419 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8420 !! wikitext
8421 {{SUBJECTSPACEE}}
8422 !! html
8423 <p>User
8424 </p>
8425 !! end
8426
8427 !! test
8428 Magic Word: {{NAMESPACE}}
8429 !! options
8430 title=[[User:Ævar Arnfjörð Bjarmason]]
8431 !! wikitext
8432 {{NAMESPACE}}
8433 !! html
8434 <p>User
8435 </p>
8436 !! end
8437
8438 !! test
8439 Magic Word: {{NAMESPACEE}}
8440 !! options
8441 title=[[User:Ævar Arnfjörð Bjarmason]]
8442 !! wikitext
8443 {{NAMESPACEE}}
8444 !! html
8445 <p>User
8446 </p>
8447 !! end
8448
8449 !! test
8450 Magic Word: {{NAMESPACENUMBER}}
8451 !! options
8452 title=[[User:Ævar Arnfjörð Bjarmason]]
8453 !! wikitext
8454 {{NAMESPACENUMBER}}
8455 !! html
8456 <p>2
8457 </p>
8458 !! end
8459
8460 !! test
8461 Magic Word: {{SUBPAGENAME}}
8462 !! options
8463 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8464 !! wikitext
8465 {{SUBPAGENAME}}
8466 !! html
8467 <p>sub ö
8468 </p>
8469 !! end
8470
8471 !! test
8472 Magic Word: {{SUBPAGENAMEE}}
8473 !! options
8474 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8475 !! wikitext
8476 {{SUBPAGENAMEE}}
8477 !! html
8478 <p>sub_%C3%B6
8479 </p>
8480 !! end
8481
8482 !! test
8483 Magic Word: {{ROOTPAGENAME}}
8484 !! options
8485 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8486 !! wikitext
8487 {{ROOTPAGENAME}}
8488 !! html
8489 <p>Ævar Arnfjörð Bjarmason
8490 </p>
8491 !! end
8492
8493 !! test
8494 Magic Word: {{ROOTPAGENAMEE}}
8495 !! options
8496 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8497 !! wikitext
8498 {{ROOTPAGENAMEE}}
8499 !! html
8500 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8501 </p>
8502 !! end
8503
8504 !! test
8505 Magic Word: {{BASEPAGENAME}}
8506 !! options
8507 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8508 !! wikitext
8509 {{BASEPAGENAME}}
8510 !! html
8511 <p>Ævar Arnfjörð Bjarmason
8512 </p>
8513 !! end
8514
8515 !! test
8516 Magic Word: {{BASEPAGENAMEE}}
8517 !! options
8518 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8519 !! wikitext
8520 {{BASEPAGENAMEE}}
8521 !! html
8522 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8523 </p>
8524 !! end
8525
8526 !! test
8527 Magic Word: {{TALKPAGENAME}}
8528 !! options
8529 title=[[User:Ævar Arnfjörð Bjarmason]]
8530 !! wikitext
8531 {{TALKPAGENAME}}
8532 !! html
8533 <p>User talk:Ævar Arnfjörð Bjarmason
8534 </p>
8535 !! end
8536
8537 !! test
8538 Magic Word: {{TALKPAGENAMEE}}
8539 !! options
8540 title=[[User:Ævar Arnfjörð Bjarmason]]
8541 !! wikitext
8542 {{TALKPAGENAMEE}}
8543 !! html
8544 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8545 </p>
8546 !! end
8547
8548 !! test
8549 Magic Word: {{SUBJECTPAGENAME}}
8550 !! options
8551 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8552 !! wikitext
8553 {{SUBJECTPAGENAME}}
8554 !! html
8555 <p>User:Ævar Arnfjörð Bjarmason
8556 </p>
8557 !! end
8558
8559 !! test
8560 Magic Word: {{SUBJECTPAGENAMEE}}
8561 !! options
8562 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8563 !! wikitext
8564 {{SUBJECTPAGENAMEE}}
8565 !! html
8566 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8567 </p>
8568 !! end
8569
8570 !! test
8571 Magic Word: {{NUMBEROFFILES}}
8572 !! wikitext
8573 {{NUMBEROFFILES}}
8574 !! html
8575 <p>5
8576 </p>
8577 !! end
8578
8579 !! test
8580 Magic Word: {{PAGENAME}}
8581 !! options
8582 title=[[User:Ævar Arnfjörð Bjarmason]]
8583 !! wikitext
8584 {{PAGENAME}}
8585 !! html
8586 <p>Ævar Arnfjörð Bjarmason
8587 </p>
8588 !! end
8589
8590 !! test
8591 Magic Word: {{PAGENAME}} with metacharacters
8592 !! options
8593 title=[['foo & bar = baz']]
8594 !! wikitext
8595 ''{{PAGENAME}}''
8596 !! html/php
8597 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8598 </p>
8599 !! html+tidy
8600 <p><i>'foo &amp; bar = baz'</i></p>
8601 !! end
8602
8603 !! test
8604 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8605 !! options
8606 title=[[*RFC 1234 http://example.com/]]
8607 !! wikitext
8608 {{PAGENAME}}
8609 !! html/php
8610 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8611 </p>
8612 !! html+tidy
8613 <p>*RFC 1234 http://example.com/</p>
8614 !! end
8615
8616 !! test
8617 Magic Word: {{PAGENAMEE}}
8618 !! options
8619 title=[[User:Ævar Arnfjörð Bjarmason]]
8620 !! wikitext
8621 {{PAGENAMEE}}
8622 !! html
8623 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8624 </p>
8625 !! end
8626
8627 !! test
8628 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8629 !! options
8630 title=[[*RFC 1234 http://example.com/]]
8631 !! wikitext
8632 {{PAGENAMEE}}
8633 !! html/php
8634 <p>&#42;RFC_1234_http&#58;//example.com/
8635 </p>
8636 !! html+tidy
8637 <p>*RFC_1234_http://example.com/</p>
8638 !! end
8639
8640 !! test
8641 Magic Word: {{REVISIONID}}
8642 !! wikitext
8643 {{REVISIONID}}
8644 !! html
8645 <p>1337
8646 </p>
8647 !! end
8648
8649 !! test
8650 Magic Word: {{SCRIPTPATH}}
8651 !! wikitext
8652 {{SCRIPTPATH}}
8653 !! html
8654 <p>/
8655 </p>
8656 !! end
8657
8658 !! test
8659 Magic Word: {{STYLEPATH}}
8660 !! wikitext
8661 {{STYLEPATH}}
8662 !! html
8663 <p>/skins
8664 </p>
8665 !! end
8666
8667 !! test
8668 Magic Word: {{SERVER}}
8669 !! wikitext
8670 {{SERVER}}
8671 !! html
8672 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8673 </p>
8674 !! end
8675
8676 !! test
8677 Magic Word: {{SERVERNAME}}
8678 !! wikitext
8679 {{SERVERNAME}}
8680 !! html
8681 <p>example.org
8682 </p>
8683 !! end
8684
8685 !! test
8686 Magic Word: {{SITENAME}}
8687 !! wikitext
8688 {{SITENAME}}
8689 !! html
8690 <p>MediaWiki
8691 </p>
8692 !! end
8693
8694 !! test
8695 Case-sensitive magic words, when cased differently, should just be template transclusions
8696 !! wikitext
8697 {{CurrentMonth}}
8698 {{currentday}}
8699 {{cURreNTweEK}}
8700 {{currentHour}}
8701 !! html
8702 <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>
8703 <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>
8704 <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>
8705 <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>
8706 </p>
8707 !! end
8708
8709 !! test
8710 Case-insensitive magic words should still work with weird casing.
8711 !! wikitext
8712 {{sErVeRNaMe}}
8713 {{LCFirst:AOEU}}
8714 {{ucFIRST:aoeu}}
8715 {{SERver}}
8716 !! html
8717 <p>example.org
8718 aOEU
8719 Aoeu
8720 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8721 </p>
8722 !! end
8723
8724 !! test
8725 Namespace 1 {{ns:1}}
8726 !! wikitext
8727 {{ns:1}}
8728 !! html
8729 <p>Talk
8730 </p>
8731 !! end
8732
8733 !! test
8734 Namespace 1 {{ns:01}}
8735 !! wikitext
8736 {{ns:01}}
8737 !! html
8738 <p>Talk
8739 </p>
8740 !! end
8741
8742 !! test
8743 Namespace 0 {{ns:0}} (bug 4783)
8744 !! wikitext
8745 {{ns:0}}
8746 !! html
8747
8748 !! end
8749
8750 !! test
8751 Namespace 0 {{ns:00}} (bug 4783)
8752 !! wikitext
8753 {{ns:00}}
8754 !! html
8755
8756 !! end
8757
8758 !! test
8759 Namespace -1 {{ns:-1}}
8760 !! wikitext
8761 {{ns:-1}}
8762 !! html
8763 <p>Special
8764 </p>
8765 !! end
8766
8767 !! test
8768 Namespace User {{ns:User}}
8769 !! wikitext
8770 {{ns:User}}
8771 !! html
8772 <p>User
8773 </p>
8774 !! end
8775
8776 !! test
8777 Namespace User talk {{ns:User_talk}}
8778 !! wikitext
8779 {{ns:User_talk}}
8780 !! html
8781 <p>User talk
8782 </p>
8783 !! end
8784
8785 !! test
8786 Namespace User talk {{ns:uSeR tAlK}}
8787 !! wikitext
8788 {{ns:uSeR tAlK}}
8789 !! html
8790 <p>User talk
8791 </p>
8792 !! end
8793
8794 !! test
8795 Namespace File {{ns:File}}
8796 !! wikitext
8797 {{ns:File}}
8798 !! html
8799 <p>File
8800 </p>
8801 !! end
8802
8803 !! test
8804 Namespace File {{ns:Image}}
8805 !! wikitext
8806 {{ns:Image}}
8807 !! html
8808 <p>File
8809 </p>
8810 !! end
8811
8812 !! test
8813 Namespace (lang=de) Benutzer {{ns:User}}
8814 !! options
8815 language=de
8816 !! wikitext
8817 {{ns:User}}
8818 !! html
8819 <p>Benutzer
8820 </p>
8821 !! end
8822
8823 !! test
8824 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
8825 !! options
8826 language=de
8827 !! wikitext
8828 {{ns:3}}
8829 !! html
8830 <p>Benutzer Diskussion
8831 </p>
8832 !! end
8833
8834
8835 !! test
8836 Urlencode
8837 !! wikitext
8838 {{urlencode:hi world?!}}
8839 {{urlencode:hi world?!|WIKI}}
8840 {{urlencode:hi world?!|PATH}}
8841 {{urlencode:hi world?!|QUERY}}
8842 !! html
8843 <p>hi+world%3F%21
8844 hi_world%3F!
8845 hi%20world%3F%21
8846 hi+world%3F%21
8847 </p>
8848 !! end
8849
8850 !! test
8851 Magic Word: prioritize type info over data-parsoid
8852 !! options
8853 parsoid=html2wt
8854 !! wikitext
8855 __FORCETOC__
8856 !! html
8857 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
8858 !! end
8859
8860 !! test
8861 Magic Word: serialize on separate line (parsoid)
8862 !! options
8863 parsoid=wt2wt,html2wt
8864 !! wikitext
8865 foo
8866 __NOTOC__
8867 bar
8868 !! html
8869 foo<meta property="mw:PageProp/notoc"/>bar
8870 !! end
8871
8872 !! test
8873 Magic Word: rt non-english wikis
8874 !! options
8875 parsoid=wt2wt
8876 language=de
8877 !! wikitext
8878 __NOEDITSECTION__
8879 !! html
8880 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
8881 !! end
8882
8883 ###
8884 ### Magic links
8885 ###
8886 !! test
8887 Magic links: internal link to RFC (bug 479)
8888 !! wikitext
8889 [[RFC 123]]
8890 !! html
8891 <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>
8892 </p>
8893 !! end
8894
8895 !! test
8896 Magic links: RFC (bug 479)
8897 !! wikitext
8898 RFC 822
8899 !! html
8900 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8901 </p>
8902 !! end
8903
8904 !! test
8905 Magic links: RFC (bug 65278)
8906 !! wikitext
8907 This is RFC 822 but thisRFC 822 is not RFC 822linked.
8908 !! html
8909 <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.
8910 </p>
8911 !! end
8912
8913 !! test
8914 Magic links: ISBN (bug 1937)
8915 !! wikitext
8916 ISBN 0-306-40615-2
8917 !! html
8918 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8919 </p>
8920 !! end
8921
8922 !! test
8923 Magic links: ISBN (bug 65278)
8924 !! wikitext
8925 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
8926 !! html
8927 <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.
8928 </p>
8929 !! end
8930
8931 !! test
8932 Magic links: PMID incorrectly converts space to underscore
8933 !! wikitext
8934 PMID 1234
8935 !! html
8936 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8937 </p>
8938 !! end
8939
8940 !! test
8941 Magic links: PMID (bug 65278)
8942 !! wikitext
8943 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
8944 !! html
8945 <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.
8946 </p>
8947 !! end
8948
8949 ###
8950 ### Templates
8951 ####
8952
8953 !! test
8954 Nonexistent template
8955 !! wikitext
8956 {{thistemplatedoesnotexist}}
8957 !! html
8958 <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>
8959 </p>
8960 !! end
8961
8962 !! test
8963 Template with invalid target containing tags
8964 !! wikitext
8965 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8966 !! html
8967 <p>{{a<b>b</b>|foo|a=b|a = b}}
8968 </p>
8969 !! end
8970
8971 !! test
8972 Template with invalid target containing unclosed tag
8973 !! wikitext
8974 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8975 !! html
8976 <p>{{a<b>|foo|a=b|a = b}}</b>
8977 </p>
8978 !! end
8979
8980 !! test
8981 Template with invalid target containing wikilink
8982 !! wikitext
8983 {{[[Main Page]]}}
8984 !! html/php
8985 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
8986 </p>
8987 !! html/parsoid
8988 <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>
8989 !! end
8990
8991 !! test
8992 Template with just whitespace in it, bug #68421
8993 !! wikitext
8994 {{echo|{{ }}}}
8995 !! html/parsoid
8996 <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>
8997 !! end
8998
8999 !! article
9000 Template:test
9001 !! text
9002 This is a test template
9003 !! endarticle
9004
9005 !! test
9006 Simple template
9007 !! wikitext
9008 {{test}}
9009 !! html
9010 <p>This is a test template
9011 </p>
9012 !! end
9013
9014 !! test
9015 Template with explicit namespace
9016 !! wikitext
9017 {{Template:test}}
9018 !! html
9019 <p>This is a test template
9020 </p>
9021 !! end
9022
9023
9024 !! article
9025 Template:paramtest
9026 !! text
9027 This is a test template with parameter {{{param}}}
9028 !! endarticle
9029
9030 !! test
9031 Template parameter
9032 !! wikitext
9033 {{paramtest|param=foo}}
9034 !! html
9035 <p>This is a test template with parameter foo
9036 </p>
9037 !! end
9038
9039 !! article
9040 Template:paramtestnum
9041 !! text
9042 [[{{{1}}}|{{{2}}}]]
9043 !! endarticle
9044
9045 !! test
9046 Template unnamed parameter
9047 !! wikitext
9048 {{paramtestnum|Main Page|the main page}}
9049 !! html
9050 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9051 </p>
9052 !! end
9053
9054 !! article
9055 Template:templatesimple
9056 !! text
9057 (test)
9058 !! endarticle
9059
9060 !! article
9061 Template:templateredirect
9062 !! text
9063 #redirect [[Template:templatesimple]]
9064 !! endarticle
9065
9066 !! article
9067 Template:templateasargtestnum
9068 !! text
9069 {{{{{1}}}}}
9070 !! endarticle
9071
9072 !! article
9073 Template:templateasargtest
9074 !! text
9075 {{template{{{templ}}}}}
9076 !! endarticle
9077
9078 !! article
9079 Template:templateasargtest2
9080 !! text
9081 {{{{{templ}}}}}
9082 !! endarticle
9083
9084 !! test
9085 Template with template name as unnamed argument
9086 !! wikitext
9087 {{templateasargtestnum|templatesimple}}
9088 !! html
9089 <p>(test)
9090 </p>
9091 !! end
9092
9093 !! test
9094 Template with template name as argument
9095 !! wikitext
9096 {{templateasargtest|templ=simple}}
9097 !! html
9098 <p>(test)
9099 </p>
9100 !! end
9101
9102 !! test
9103 Template with template name as argument (2)
9104 !! wikitext
9105 {{templateasargtest2|templ=templatesimple}}
9106 !! html
9107 <p>(test)
9108 </p>
9109 !! end
9110
9111 !! article
9112 Template:templateasargtestdefault
9113 !! text
9114 {{{{{templ|templatesimple}}}}}
9115 !! endarticle
9116
9117 !! article
9118 Template:templa
9119 !! text
9120 '''templ'''
9121 !! endarticle
9122
9123 !! test
9124 Template with default value
9125 !! wikitext
9126 {{templateasargtestdefault}}
9127 !! html
9128 <p>(test)
9129 </p>
9130 !! end
9131
9132 !! test
9133 Template with default value (value set)
9134 !! wikitext
9135 {{templateasargtestdefault|templ=templa}}
9136 !! html
9137 <p><b>templ</b>
9138 </p>
9139 !! end
9140
9141 !! test
9142 Template redirect
9143 !! wikitext
9144 {{templateredirect}}
9145 !! html
9146 <p>(test)
9147 </p>
9148 !! end
9149
9150 !! test
9151 Template with argument in separate line
9152 !! wikitext
9153 {{ templateasargtest |
9154 templ = simple }}
9155 !! html
9156 <p>(test)
9157 </p>
9158 !! end
9159
9160 !! test
9161 Template with complex template as argument
9162 !! wikitext
9163 {{paramtest|
9164 param ={{ templateasargtest |
9165 templ = simple }}}}
9166 !! html
9167 <p>This is a test template with parameter (test)
9168 </p>
9169 !! end
9170
9171 !! test
9172 Template with thumb image (with link in description)
9173 !! wikitext
9174 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9175 !! html/php
9176 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>
9177
9178 !! html+tidy
9179 <p>This is a test template with parameter</p>
9180 <div class="thumb tright">
9181 <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>
9182 <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>
9183 </div>
9184 </div>
9185 !! html/parsoid
9186 <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>
9187 !! end
9188
9189 !! article
9190 Template:complextemplate
9191 !! text
9192 {{{1}}} {{paramtest|
9193 param ={{{param}}}}}
9194 !! endarticle
9195
9196 !! test
9197 Template with complex arguments
9198 !! wikitext
9199 {{complextemplate|
9200 param ={{ templateasargtest |
9201 templ = simple }}|[[Template:complextemplate|link]]}}
9202 !! html
9203 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
9204 </p>
9205 !! end
9206
9207 !! test
9208 BUG 553: link with two variables in a piped link
9209 !! wikitext
9210 {|
9211 |[[{{{1}}}|{{{2}}}]]
9212 |}
9213 !! html
9214 <table>
9215 <tr>
9216 <td>[[{{{1}}}|{{{2}}}]]
9217 </td></tr></table>
9218
9219 !! end
9220
9221 !! test
9222 Magic variable as template parameter
9223 !! wikitext
9224 {{paramtest|param={{SITENAME}}}}
9225 !! html
9226 <p>This is a test template with parameter MediaWiki
9227 </p>
9228 !! end
9229
9230 !! article
9231 Template:linktest
9232 !! text
9233 [[{{{param}}}|link]]
9234 !! endarticle
9235
9236 !! test
9237 Template parameter as link source
9238 !! wikitext
9239 {{linktest|param=Main Page}}
9240 !! html
9241 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
9242 </p>
9243 !! end
9244
9245 !!test
9246 Template-generated attribute string (k='v')
9247 !! wikitext
9248 <span {{attr_str|id|v1}}>bar</span>
9249 !! html
9250 <p><span id="v1">bar</span>
9251 </p>
9252 !!end
9253
9254 !!article
9255 Template:paramtest2
9256 !! text
9257 including another template, {{paramtest|param={{{arg}}}}}
9258 !! endarticle
9259
9260 !! test
9261 Template passing argument to another template
9262 !! wikitext
9263 {{paramtest2|arg='hmm'}}
9264 !! html
9265 <p>including another template, This is a test template with parameter 'hmm'
9266 </p>
9267 !! end
9268
9269 !! article
9270 Template:Linktest2
9271 !! text
9272 Main Page
9273 !! endarticle
9274
9275 !! test
9276 Template as link source
9277 !! wikitext
9278 [[{{linktest2}}]]
9279
9280 [[{{linktest2}}|Main Page]]
9281
9282 [[{{linktest2}}]]Page
9283 !! html
9284 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9285 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9286 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
9287 </p>
9288 !! end
9289
9290
9291 !! article
9292 Template:loop1
9293 !! text
9294 {{loop2}}
9295 !! endarticle
9296
9297 !! article
9298 Template:loop2
9299 !! text
9300 {{loop1}}
9301 !! endarticle
9302
9303 !! test
9304 Template infinite loop
9305 !! wikitext
9306 {{loop1}}
9307 !! html
9308 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
9309 </p>
9310 !! end
9311
9312 !! test
9313 Template from main namespace
9314 !! wikitext
9315 {{:Main Page}}
9316 !! html
9317 <p>blah blah
9318 </p>
9319 !! end
9320
9321 !! article
9322 Template:table
9323 !! text
9324 {|
9325 | 1 || 2
9326 |-
9327 | 3 || 4
9328 |}
9329 !! endarticle
9330
9331 !! test
9332 BUG 529: Template with table, not included at beginning of line
9333 !! wikitext
9334 foo {{table}}
9335 !! html
9336 <p>foo
9337 </p>
9338 <table>
9339 <tr>
9340 <td> 1 </td>
9341 <td> 2
9342 </td></tr>
9343 <tr>
9344 <td> 3 </td>
9345 <td> 4
9346 </td></tr></table>
9347
9348 !! end
9349
9350 !! test
9351 BUG 523: Template shouldn't eat newline (or add an extra one before table)
9352 !! wikitext
9353 foo
9354 {{table}}
9355 !! html
9356 <p>foo
9357 </p>
9358 <table>
9359 <tr>
9360 <td> 1 </td>
9361 <td> 2
9362 </td></tr>
9363 <tr>
9364 <td> 3 </td>
9365 <td> 4
9366 </td></tr></table>
9367
9368 !! end
9369
9370 !! test
9371 BUG 41: Template parameters shown as broken links
9372 !! wikitext
9373 {{{parameter}}}
9374 !! html
9375 <p>{{{parameter}}}
9376 </p>
9377 !! end
9378
9379 !! test
9380 Template with targets containing wikilinks
9381 !! wikitext
9382 {{[[foo]]}}
9383
9384 {{[[{{echo|foo}}]]}}
9385
9386 {{{{echo|[[foo}}]]}}
9387 !! html
9388 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9389 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9390 </p><p>{{[[foo}}]]
9391 </p>
9392 !! end
9393
9394 !! article
9395 Template:MSGNW test
9396 !! text
9397 ''None'' of '''this''' should be
9398 * interpreted
9399 but rather passed unmodified
9400 {{test}}
9401 <gallery>
9402 File:Foobar.jpg
9403 </gallery>
9404 !! endarticle
9405
9406 # hmm, fix this or just deprecate msgnw and document its behavior?
9407 !! test
9408 msgnw keyword
9409 !! wikitext
9410 {{msgnw:MSGNW test}}
9411 !! html
9412 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
9413 &#42; interpreted
9414 &#32;but rather passed unmodified
9415 &#123;&#123;test&#125;&#125;
9416 &#60;gallery&#62;
9417 File:Foobar.jpg
9418 &#60;/gallery&#62;
9419 </p>
9420 !! end
9421
9422 !! test
9423 int keyword
9424 !! wikitext
9425 {{int:youhavenewmessages|lots of money|not!}}
9426 !! html
9427 <p>You have lots of money (not!).
9428 </p>
9429 !! end
9430
9431 !! article
9432 Template:Includes
9433 !! text
9434 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9435 !! endarticle
9436
9437 !! test
9438 <includeonly> and <noinclude> being included
9439 !! wikitext
9440 {{Includes}}
9441 !! html
9442 <p>Foobar
9443 </p>
9444 !! end
9445
9446 !! article
9447 Template:Includes2
9448 !! text
9449 <onlyinclude>Foo</onlyinclude>bar
9450 !! endarticle
9451
9452 !! test
9453 <onlyinclude> being included
9454 !! wikitext
9455 {{Includes2}}
9456 !! html
9457 <p>Foo
9458 </p>
9459 !! end
9460
9461
9462 !! article
9463 Template:Includes3
9464 !! text
9465 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9466 !! endarticle
9467
9468 !! test
9469 <onlyinclude> and <includeonly> being included
9470 !! wikitext
9471 {{Includes3}}
9472 !! html
9473 <p>Foo
9474 </p>
9475 !! end
9476
9477 !! test
9478 <includeonly> and <noinclude> on a page
9479 !! wikitext
9480 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9481 !! html
9482 <p>Foozar
9483 </p>
9484 !! end
9485
9486 !! test
9487 Un-closed <noinclude>
9488 !! wikitext
9489 <noinclude>
9490 !! html
9491 !! end
9492
9493 !! test
9494 <onlyinclude> on a page
9495 !! wikitext
9496 <onlyinclude>Foo</onlyinclude>bar
9497 !! html
9498 <p>Foobar
9499 </p>
9500 !! end
9501
9502 !! test
9503 Un-closed <onlyinclude>
9504 !! wikitext
9505 <onlyinclude>
9506 !! html
9507 !! end
9508
9509 !!test
9510 Self-closed noinclude, includeonly, onlyinclude tags
9511 !! wikitext
9512 <noinclude />
9513 <includeonly />
9514 <onlyinclude />
9515 !! html
9516 <p><br />
9517 </p>
9518 !!end
9519
9520 !!test
9521 Unbalanced includeonly and noinclude tags
9522 !! wikitext
9523 {|
9524 |a</noinclude>
9525 |b</noinclude></noinclude>
9526 |c</noinclude></includeonly>
9527 |d</includeonly></includeonly>
9528 |}
9529 !! html
9530 <table>
9531 <tr>
9532 <td>a
9533 </td>
9534 <td>b
9535 </td>
9536 <td>c&lt;/includeonly&gt;
9537 </td>
9538 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9539 </td></tr></table>
9540
9541 !!end
9542
9543 !! article
9544 Template:Includeonly section
9545 !! text
9546 <includeonly>
9547 ==Includeonly section==
9548 </includeonly>
9549 ==Section T-1==
9550 !!endarticle
9551
9552 !! test
9553 Bug 6563: Edit link generation for section shown by <includeonly>
9554 !! wikitext
9555 {{includeonly section}}
9556 !! html
9557 <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>
9558 <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>
9559
9560 !! end
9561
9562 # Uses same input as the contents of [[Template:Includeonly section]]
9563 !! test
9564 Bug 6563: Section extraction for section shown by <includeonly>
9565 !! options
9566 section=T-2
9567 !! wikitext
9568 <includeonly>
9569 ==Includeonly section==
9570 </includeonly>
9571 ==Section T-2==
9572 !! html
9573 ==Section T-2==
9574 !! end
9575
9576 !! test
9577 Bug 6563: Edit link generation for section suppressed by <includeonly>
9578 !! wikitext
9579 <includeonly>
9580 ==Includeonly section==
9581 </includeonly>
9582 ==Section 1==
9583 !! html
9584 <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>
9585
9586 !! end
9587
9588 !! test
9589 Bug 6563: Section extraction for section suppressed by <includeonly>
9590 !! options
9591 section=1
9592 !! wikitext
9593 <includeonly>
9594 ==Includeonly section==
9595 </includeonly>
9596 ==Section 1==
9597 !! html
9598 ==Section 1==
9599 !! end
9600
9601 !! test
9602 Un-closed <includeonly>
9603 !! wikitext
9604 <includeonly>
9605 !! html
9606 !! end
9607
9608 !! test
9609 Includes and comments at SOL
9610 !! wikitext
9611 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
9612
9613 <noinclude>
9614 some
9615 </noinclude>* stuff
9616 * here
9617
9618 <includeonly>can have stuff</includeonly>=== here ===
9619
9620 !! html/php
9621 <h2><span class="mw-headline" id="hu">hu</span></h2>
9622 <p>some
9623 </p>
9624 <ul><li> stuff</li>
9625 <li> here</li></ul>
9626 <h3><span class="mw-headline" id="here">here</span></h3>
9627
9628 !! html/parsoid
9629 <!-- 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>
9630
9631 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
9632 <p>some</p>
9633 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
9634 <li> here</li></ul>
9635
9636 <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>
9637
9638 !! end
9639
9640 # TODO: test with DOM fragment reuse!
9641 !! test
9642 Parsoid: DOM fragment reuse
9643 !! options
9644 parsoid=wt2wt,wt2html
9645 !! wikitext
9646 a{{echo|b<table></table>c}}d
9647
9648 a{{echo|b
9649 <table></table>
9650 c}}d
9651
9652 {{echo|a
9653
9654 <table></table>
9655
9656 b}}
9657 !! html
9658 <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>
9659
9660 <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">
9661 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
9662 </span><p about="#mwt2">cd</p>
9663
9664 <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">
9665
9666 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
9667
9668 </span><p about="#mwt3">b</p>
9669 !! end
9670
9671 !! test
9672 Parsoid: Merge double tds (bug 50603)
9673 !! options
9674 parsoid
9675 !! wikitext
9676 {|
9677 |{{echo|{{!}} foo}}
9678 |}
9679 !! html
9680 <table><tbody>
9681 <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>
9682 </tbody></table>
9683 !! end
9684
9685 !! test
9686 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9687 !! options
9688 parsoid
9689 !! wikitext
9690 {{echo|<div>}}
9691 {|
9692 |{{echo|{{!}} foo}}
9693 |}
9694 {{echo|</div>}}
9695 !! html
9696 <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}}]}'>
9697 <table><tbody>
9698 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9699 </tbody></table>
9700 </div>
9701 !! end
9702
9703 ###
9704 ### <includeonly> and <noinclude> in attributes
9705 ###
9706 !!test
9707 0. includeonly around the entire attribute
9708 !! wikitext
9709 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9710 !! html
9711 <p><span id="v2">bar</span>
9712 </p>
9713 !!end
9714
9715 !!test
9716 1. includeonly in html attr key
9717 !! wikitext
9718 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9719 !! html
9720 <p><span id="foo">bar</span>
9721 </p>
9722 !!end
9723
9724 !!test
9725 2. includeonly in html attr value
9726 !! wikitext
9727 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9728 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9729 !! html
9730 <p><span id="v1">bar</span>
9731 <span id="v1">bar</span>
9732 </p>
9733 !!end
9734
9735 !!test
9736 3. includeonly in part of an attr value
9737 !! wikitext
9738 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9739 !! html
9740 <p><span style="color:red;">bar</span>
9741 </p>
9742 !!end
9743
9744 !!test
9745 4. includeonly in table attributes
9746 !! wikitext
9747 {|
9748 |- <noinclude>
9749 |-
9750 |a
9751 </noinclude>
9752 |- <includeonly>
9753 |-
9754 |b
9755 </includeonly>
9756 |}
9757 !! html
9758 <table>
9759
9760
9761 <tr>
9762 <td>a
9763 </td></tr>
9764 </table>
9765
9766 !!end
9767
9768 ###
9769 ### Token Stream Patcher tests
9770 ###
9771 ### These tests won't always pass wt2wt and other modes because
9772 ### on serialization, the table will be output on a new line.
9773 ### For now, we are blacklisting them, and using this to test selser.
9774 ###
9775
9776 !!test
9777 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
9778 !!options
9779 parsoid=wt2html,wt2wt
9780 !!wikitext
9781 {{echo|}}{| width = '100%'
9782 |foo
9783 |}
9784 !!html/parsoid
9785 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
9786 <tbody><tr><td>foo</td></tr>
9787 </tbody></table>
9788 !!end
9789
9790 !!test
9791 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
9792 !!options
9793 parsoid=wt2html,wt2wt
9794 !!wikitext
9795 <includeonly>a</includeonly>{| {{{b}}}
9796 |c
9797 |}
9798 !!html/parsoid
9799 <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}}}":""}}'>
9800 <tbody><tr><td>c</td></tr>
9801 </tbody></table>
9802
9803 !!end
9804
9805 ###
9806 ### Testing parsing of templates where a template arg
9807 ### has the same name as the template itself.
9808 ###
9809
9810 !! article
9811 Template:quote
9812 !! text
9813 {{{quote|{{{1}}}}}}
9814 !! endarticle
9815
9816 !!test
9817 Templates: Template Name/Arg clash: 1. Use of positional param
9818 !! wikitext
9819 {{quote|foo}}
9820 !! html
9821 <p>foo
9822 </p>
9823 !!end
9824
9825 !!test
9826 Templates: Template Name/Arg clash: 2. Use of named param
9827 !! wikitext
9828 {{quote|quote=foo}}
9829 !! html
9830 <p>foo
9831 </p>
9832 !!end
9833
9834 !!test
9835 Templates: Template Name/Arg clash: 3. Use of named param with empty input
9836 !! wikitext
9837 {{quote|quote}}
9838 !! html
9839 <p>quote
9840 </p>
9841 !!end
9842
9843 ###
9844 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
9845 ###
9846
9847 !!test
9848 Templates: 1. Simple use
9849 !! wikitext
9850 {{echo|Foo}}
9851 !! html
9852 <p>Foo
9853 </p>
9854 !!end
9855
9856 !!test
9857 Templates: 2. Inside a block tag
9858 !! wikitext
9859 <div>{{echo|Foo}}</div>
9860 <blockquote>{{echo|Foo}}</blockquote>
9861 !! html
9862 <div>Foo</div>
9863 <blockquote>Foo</blockquote>
9864
9865 !! html+tidy
9866 <div>Foo</div>
9867 <blockquote>
9868 <p>Foo</p>
9869 </blockquote>
9870 !!end
9871
9872 !!test
9873 Templates: P-wrapping: 1a. Templates on consecutive lines
9874 !! wikitext
9875 {{echo|Foo}}
9876 {{echo|bar}}
9877 !! html
9878 <p>Foo
9879 bar
9880 </p>
9881 !!end
9882
9883 !!test
9884 Templates: P-wrapping: 1b. Templates on consecutive lines
9885 !! wikitext
9886 Foo
9887
9888 {{echo|bar}}
9889 {{echo|baz}}
9890 !! html
9891 <p>Foo
9892 </p><p>bar
9893 baz
9894 </p>
9895 !!end
9896
9897 !!test
9898 Templates: P-wrapping: 1c. Templates on consecutive lines
9899 !! wikitext
9900 {{echo|Foo}}
9901 {{echo|bar}} <div>baz</div>
9902 !! html
9903 <p>Foo
9904 </p>
9905 bar <div>baz</div>
9906
9907 !! html+tidy
9908 <p>Foo</p>
9909 <p>bar</p>
9910 <div>baz</div>
9911 !! end
9912
9913 !!test
9914 Templates: P-wrapping: 1d. Template preceded by comment-only line
9915 !!options
9916 parsoid
9917 !! wikitext
9918 <!-- foo -->
9919 {{echo|Bar}}
9920 !! html
9921 <!-- foo -->
9922
9923 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
9924 !!end
9925
9926 !!test
9927 Templates: Inline Text: 1. Multiple template uses
9928 !! wikitext
9929 {{echo|Foo}}bar{{echo|baz}}
9930 !! html
9931 <p>Foobarbaz
9932 </p>
9933 !!end
9934
9935 !!test
9936 Templates: Inline Text: 2. Back-to-back template uses
9937 !! wikitext
9938 {{echo|Foo}}{{echo|bar}}
9939 !! html
9940 <p>Foobar
9941 </p>
9942 !!end
9943
9944 !!test
9945 Templates: Block Tags: 1. Multiple template uses
9946 !! wikitext
9947 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
9948 !! html
9949 <div>Foo</div><div>bar</div><div>baz</div>
9950
9951 !!end
9952
9953 !!test
9954 Templates: Block Tags: 2. Back-to-back template uses
9955 !! wikitext
9956 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
9957 !! html
9958 <div>Foo</div><div>bar</div>
9959
9960 !!end
9961
9962 # This is an edge case relating to paragraph wrapping.
9963 !!test
9964 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
9965 !! wikitext
9966 {{echo|a
9967 b</p>}}
9968 !! html/parsoid
9969 <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
9970 b</p>
9971 !!end
9972
9973 !!test
9974 Templates: Links: 1. Simple example
9975 !! wikitext
9976 {{echo|[[Foo|bar]]}}
9977 !! html
9978 <p><a href="/wiki/Foo" title="Foo">bar</a>
9979 </p>
9980 !!end
9981
9982 !!test
9983 Templates: Links: 2. Generation of link href
9984 !! wikitext
9985 [[{{echo|Foo}}|bar]]
9986 !! html
9987 <p><a href="/wiki/Foo" title="Foo">bar</a>
9988 </p>
9989 !!end
9990
9991 !!test
9992 Templates: Links: 3. Generation of part of a link href
9993 !! wikitext
9994 [[Fo{{echo|o}}|bar]]
9995
9996 [[Foo{{echo|bar}}]]
9997
9998 [[Foo{{echo|bar}}baz]]
9999
10000 [[Foo{{echo|bar}}|bar]]
10001
10002 [[:Foo{{echo|bar}}]]
10003
10004 [[:Foo{{echo|bar}}|bar]]
10005 !! html
10006 <p><a href="/wiki/Foo" title="Foo">bar</a>
10007 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10008 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10009 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10010 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10011 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10012 </p>
10013 !!end
10014
10015 !!test
10016 Templates: Links: 4. Multiple templates generating link href
10017 !! wikitext
10018 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10019 !! html
10020 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10021 </p>
10022 !!end
10023
10024 !!test
10025 Templates: Links: 5. Generation of link text
10026 !! wikitext
10027 [[Foo|{{echo|bar}}]]
10028 !! html
10029 <p><a href="/wiki/Foo" title="Foo">bar</a>
10030 </p>
10031 !!end
10032
10033 !!test
10034 Templates: Links: 5. Nested templates (only outermost template should be marked)
10035 !! wikitext
10036 {{echo|[[{{echo|Foo}}|bar]]}}
10037 !! html
10038 <p><a href="/wiki/Foo" title="Foo">bar</a>
10039 </p>
10040 !!end
10041
10042 !!test
10043 Templates: HTML Tag: 1. Generation of HTML attr. key
10044 !! wikitext
10045 <div {{echo|style}}="color:red;">foo</div>
10046 !! html
10047 <div style="color:red;">foo</div>
10048
10049 !!end
10050
10051 !!test
10052 Templates: HTML Tag: 2. Generation of HTML attr. value
10053 !! wikitext
10054 <div style={{echo|'color:red;'}}>foo</div>
10055 !! html
10056 <div style="color:red;">foo</div>
10057
10058 !!end
10059
10060 !!test
10061 Templates: HTML Tag: 3. Generation of HTML attr key and value
10062 !! wikitext
10063 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10064 !! html
10065 <div style="color:red;">foo</div>
10066
10067 !!end
10068
10069 !!test
10070 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10071 !! wikitext
10072 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10073 !! html
10074 <div title="This is a long title with just one piece templated">foo</div>
10075
10076 !!end
10077
10078 !!test
10079 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10080 !! wikitext
10081 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10082 !! html
10083 <div title="This is a long title with just one piece templated">foo</div>
10084
10085 !!end
10086
10087 !!test
10088 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10089 !! wikitext
10090 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10091 !! html
10092 <div title="This is a long title with just one piece templated">foo</div>
10093
10094 !!end
10095
10096 !!test
10097 Templates: HTML Tag: 7. Generation of partial attribute key string
10098 !! wikitext
10099 <div st{{echo|yle}}="color:red;">foo</div>
10100 !! html
10101 <div style="color:red;">foo</div>
10102
10103 !!end
10104
10105 !!test
10106 Templates: HTML Tables: 1. Generating start of a HTML table
10107 !! wikitext
10108 {{echo|<table><tr><td>foo</td>}}</tr></table>
10109 !! html
10110 <table><tr><td>foo</td></tr></table>
10111
10112 !!end
10113
10114 !!test
10115 Templates: HTML Tables: 2a. Generating middle of a HTML table
10116 !! wikitext
10117 <table><tr>{{echo|<td>foo</td>}}</tr></table>
10118 !! html
10119 <table><tr><td>foo</td></tr></table>
10120
10121 !!end
10122
10123 !!test
10124 Templates: HTML Tables: 2b. Generating middle of a HTML table
10125 !! wikitext
10126 <table>{{echo|<tr><td>foo</td></tr>}}</table>
10127 !! html
10128 <table><tr><td>foo</td></tr></table>
10129
10130 !!end
10131
10132 !!test
10133 Templates: HTML Tables: 3. Generating end of a HTML table
10134 !! wikitext
10135 <table><tr>{{echo|<td>foo</td></tr></table>}}
10136 !! html
10137 <table><tr><td>foo</td></tr></table>
10138
10139 !!end
10140
10141 !!test
10142 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
10143 !! wikitext
10144 {{echo|<table>}}<tr><td>foo</td></tr></table>
10145 !! html
10146 <table><tr><td>foo</td></tr></table>
10147
10148 !!end
10149
10150 !!test
10151 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
10152 !! wikitext
10153 <table>{{echo|<tr>}}<td>foo</td></tr></table>
10154 !! html
10155 <table><tr><td>foo</td></tr></table>
10156
10157 !!end
10158
10159 !!test
10160 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
10161 !! wikitext
10162 <table><tr>{{echo|<td>}}foo</td></tr></table>
10163 !! html
10164 <table><tr><td>foo</td></tr></table>
10165
10166 !!end
10167
10168 !!test
10169 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
10170 !! wikitext
10171 <table><tr><td>foo{{echo|</td>}}</tr></table>
10172 !! html
10173 <table><tr><td>foo</td></tr></table>
10174
10175 !!end
10176
10177 !!test
10178 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
10179 !! wikitext
10180 <table><tr><td>foo</td>{{echo|</tr>}}</table>
10181 !! html
10182 <table><tr><td>foo</td></tr></table>
10183
10184 !!end
10185
10186 !!test
10187 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
10188 !! wikitext
10189 <table><tr><td>foo</td></tr>{{echo|</table>}}
10190 !! html
10191 <table><tr><td>foo</td></tr></table>
10192
10193 !!end
10194
10195 !!test
10196 Templates: HTML Tables: 5. Proper fostering of categories from inside
10197 !!options
10198 parsoid=wt2html,wt2wt
10199 !! wikitext
10200 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
10201 <!--Two categories (Bug 50330)-->
10202 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
10203 !! html
10204 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
10205 <!--Two categories (Bug 50330)-->
10206 <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>
10207 !!end
10208
10209 !!test
10210 Templates: Wiki Tables: 1a. Fostering of entire template content
10211 !! wikitext
10212 {|
10213 {{echo|a}}
10214 |}
10215 !! html
10216 <table>
10217 a
10218 <tr><td></td></tr></table>
10219
10220 !! html+tidy
10221 <p>a</p>
10222 <table>
10223 <tr>
10224 <td></td>
10225 </tr>
10226 </table>
10227 !! end
10228
10229 !!test
10230 Templates: Wiki Tables: 1b. Fostering of entire template content
10231 !! wikitext
10232 {|
10233 {{echo|<div>}}
10234 foo
10235 {{echo|</div>}}
10236 |}
10237 !! html
10238 <table>
10239 <div>
10240 <p>foo
10241 </p>
10242 </div>
10243 <tr><td></td></tr></table>
10244
10245 !! html+tidy
10246 <div>
10247 <p>foo</p>
10248 </div>
10249 <table>
10250 <tr>
10251 <td></td>
10252 </tr>
10253 </table>
10254 !! end
10255
10256 !!test
10257 Templates: Wiki Tables: 2. Fostering of partial template content
10258 !! wikitext
10259 {|
10260 {{echo|a
10261 <div>b</div>}}
10262 |}
10263 !! html
10264 <table>
10265 a
10266 <div>b</div>
10267 <tr><td></td></tr></table>
10268
10269 !! html+tidy
10270 <p>a</p>
10271 <div>b</div>
10272 <table>
10273 <tr>
10274 <td></td>
10275 </tr>
10276 </table>
10277 !! end
10278
10279 !!test
10280 Templates: Wiki Tables: 3. td-content via multiple templates
10281 !! wikitext
10282 {|
10283 {{echo|{{pipe}}a}}{{echo|b}}
10284 |}
10285 !! html
10286 <table>
10287 <tr>
10288 <td>ab
10289 </td></tr></table>
10290
10291 !!end
10292
10293 !!test
10294 Templates: Wiki Tables: 4. Templated tags, no content
10295 !! wikitext
10296 {{tbl-start}}
10297 {{tbl-end}}
10298 !! html
10299 <table>
10300 <tr><td></td></tr></table>
10301
10302 !!end
10303
10304 !!test
10305 Templates: Wiki Tables: 5. Templated tags, regular td-tags
10306 !! wikitext
10307 {{tbl-start}}
10308 |foo
10309 {{tbl-end}}
10310 !! html
10311 <table>
10312 <tr>
10313 <td>foo
10314 </td></tr></table>
10315
10316 !!end
10317
10318 !!test
10319 Templates: Wiki Tables: 6. Templated tags, templated 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: Lists: Multi-line list-items via templates
10334 !! wikitext
10335 *{{echo|a {{nonexistent|
10336 unused}}}}
10337 *{{echo|b {{nonexistent|
10338 unused}}}}
10339 !! html
10340 <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>
10341 <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>
10342
10343 !!end
10344
10345 !!test
10346 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
10347 !! wikitext
10348 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
10349 !! html
10350 <p><i>ab</i>c<i>d</i>e
10351 </p>
10352 !!end
10353
10354 !!test
10355 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
10356 (PHP parser generates misnested html)
10357 !! wikitext
10358 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
10359 !! html/parsoid
10360 <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>
10361 !!end
10362
10363 !!test
10364 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
10365 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
10366 !! options
10367 parsoid=wt2html,wt2wt
10368 !! wikitext
10369 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
10370 !! html
10371 <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>
10372 <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>
10373 <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>
10374 !!end
10375
10376 !!test
10377 Templates: Ugly nesting: 4. Divs opened/closed across templates
10378 !! wikitext
10379 a<div>b{{echo|c</div>d}}e
10380 !! html
10381 a<div>bc</div>de
10382
10383 !! html+tidy
10384 <p>a</p>
10385 <div>bc</div>
10386 <p>de</p>
10387 !! end
10388
10389 !!test
10390 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10391 (Parsoid-centric)
10392 !! options
10393 parsoid
10394 !! wikitext
10395 {|
10396 |{{echo|foo</table>}}
10397 |bar
10398 |}
10399 !! html
10400 <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|}"]}'>
10401
10402 <tbody>
10403 <tr>
10404 <td>foo</td></tr></tbody></table><span about="#mwt1">
10405 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10406 |}</span>
10407 !!end
10408
10409 !!test
10410 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10411 (Parsoid-centric)
10412 !! options
10413 parsoid
10414 !! wikitext
10415 <table>
10416 <tr>
10417 <td>
10418 <table>
10419 <tr>
10420 <td>1. {{echo|foo </table>}}</td>
10421 <td> bar </td>
10422 <td>2. {{echo|baz </table>}}</td>
10423 </tr>
10424 <tr>
10425 <td>abc</td>
10426 </tr>
10427 </table>
10428 </td>
10429 </tr>
10430 <tr>
10431 <td>xyz</td>
10432 </tr>
10433 </table>
10434 !! html
10435 <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>"]}'>
10436 <tbody><tr>
10437 <td>
10438 <table>
10439 <tbody><tr>
10440 <td>1. foo </td></tr></tbody></table></td>
10441 <td> bar </td>
10442 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10443 </span><span about="#mwt2">
10444 </span><span about="#mwt2">
10445 </span><span about="#mwt2">abc</span><span about="#mwt2">
10446 </span><span about="#mwt2">
10447 </span><span about="#mwt2">
10448 </span><span about="#mwt2">
10449 </span><span about="#mwt2">
10450 </span><span about="#mwt2">
10451 </span><span about="#mwt2">xyz</span><span about="#mwt2">
10452 </span><span about="#mwt2">
10453 </span>
10454 !!end
10455
10456 !! test
10457 Templates: Ugly templates: 3. newline-only template parameter
10458 !! wikitext
10459 foo {{echo|
10460 }}
10461 !! html
10462 <p>foo
10463 </p>
10464 !! end
10465
10466 # This looks like a bug: a single newline triggers p/br for some reason.
10467 !! test
10468 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10469 !! wikitext
10470 {{echo|
10471 }}
10472 !! html
10473 <p><br />
10474 </p>
10475 !! end
10476
10477 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10478 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10479 !! test
10480 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10481 !! wikitext
10482 {{echo|<table>}}
10483 {{echo|<div>foo}}
10484 {{echo|</table>}}
10485 !! html/parsoid
10486 <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
10487 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10488 </table>
10489 !! end
10490
10491 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10492 # that are "identical" and generate nesting cycles in the algorithm
10493 !! test
10494 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
10495 !! wikitext
10496 {{echo|<table><tr><td><table>}}
10497 {{echo|<div>}}
10498 {{echo|</div>}}
10499 !! html/parsoid
10500 <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"}'>
10501 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10502 </table></td></tr></tbody></table>
10503 !! end
10504
10505 !!test
10506 Parser Functions: 1. Simple example
10507 !! wikitext
10508 {{uc:foo}}
10509 !! html
10510 <p>FOO
10511 </p>
10512 !!end
10513
10514 !!test
10515 Parser Functions: 2. Nested use (only outermost should be marked up)
10516 !! wikitext
10517 {{uc:{{lc:FOO}}}}
10518 !! html
10519 <p>FOO
10520 </p>
10521 !!end
10522
10523 ###
10524 ### Pre-save transform tests
10525 ###
10526 !! test
10527 pre-save transform: subst:
10528 !! options
10529 PST
10530 !! wikitext
10531 {{subst:test}}
10532 !! html
10533 This is a test template
10534 !! end
10535
10536 !! test
10537 pre-save transform: normal template
10538 !! options
10539 PST
10540 !! wikitext
10541 {{test}}
10542 !! html
10543 {{test}}
10544 !! end
10545
10546 !! test
10547 pre-save transform: nonexistent template
10548 !! options
10549 PST
10550 !! wikitext
10551 {{thistemplatedoesnotexist}}
10552 !! html
10553 {{thistemplatedoesnotexist}}
10554 !! end
10555
10556
10557 !! test
10558 pre-save transform: subst magic variables
10559 !! options
10560 PST
10561 !! wikitext
10562 {{subst:SITENAME}}
10563 !! html
10564 MediaWiki
10565 !! end
10566
10567 # This is bug 89, which I fixed. -- wtm
10568 !! test
10569 pre-save transform: subst: templates with parameters
10570 !! options
10571 pst
10572 !! wikitext
10573 {{subst:paramtest|param="something else"}}
10574 !! html
10575 This is a test template with parameter "something else"
10576 !! end
10577
10578 !! article
10579 Template:nowikitest
10580 !! text
10581 <nowiki>'''not wiki'''</nowiki>
10582 !! endarticle
10583
10584 !! test
10585 pre-save transform: nowiki in subst (bug 1188)
10586 !! options
10587 pst
10588 !! wikitext
10589 {{subst:nowikitest}}
10590 !! html
10591 <nowiki>'''not wiki'''</nowiki>
10592 !! end
10593
10594
10595 !! article
10596 Template:commenttest
10597 !! text
10598 This template has <!-- a comment --> in it.
10599 !! endarticle
10600
10601 !! test
10602 pre-save transform: comment in subst (bug 1936)
10603 !! options
10604 pst
10605 !! wikitext
10606 {{subst:commenttest}}
10607 !! html
10608 This template has <!-- a comment --> in it.
10609 !! end
10610
10611 !! test
10612 pre-save transform: unclosed tag
10613 !! options
10614 pst noxml
10615 !! wikitext
10616 <nowiki>'''not wiki'''
10617 !! html
10618 <nowiki>'''not wiki'''
10619 !! end
10620
10621 !! test
10622 pre-save transform: mixed tag case
10623 !! options
10624 pst noxml
10625 !! wikitext
10626 <NOwiki>'''not wiki'''</noWIKI>
10627 !! html
10628 <NOwiki>'''not wiki'''</noWIKI>
10629 !! end
10630
10631 !! test
10632 pre-save transform: unclosed comment in <nowiki>
10633 !! options
10634 pst noxml
10635 !! wikitext
10636 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10637 !! html
10638 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10639 !!end
10640
10641 # Leading @ in this template definition works around a limitation
10642 # in parsoid's parserTests which otherwise strips the <span> from the
10643 # result (confusing it for a template wrapper)
10644 !! article
10645 Template:dangerous
10646 !!text
10647 @<span onmouseover="alert('crap')">Oh no</span>
10648 !!endarticle
10649
10650 !!test
10651 (confirming safety of fix for subst bug 1936)
10652 !! wikitext
10653 {{Template:dangerous}}
10654 !! html
10655 <p>@<span>Oh no</span>
10656 </p>
10657 !! end
10658
10659 !! test
10660 pre-save transform: comment containing gallery (bug 5024)
10661 !! options
10662 pst
10663 !! wikitext
10664 <!-- <gallery>data</gallery> -->
10665 !! html
10666 <!-- <gallery>data</gallery> -->
10667 !!end
10668
10669 !! test
10670 pre-save transform: comment containing extension
10671 !! options
10672 pst
10673 !! wikitext
10674 <!-- <tag>data</tag> -->
10675 !! html
10676 <!-- <tag>data</tag> -->
10677 !!end
10678
10679 !! test
10680 pre-save transform: comment containing nowiki
10681 !! options
10682 pst
10683 !! wikitext
10684 <!-- <nowiki>data</nowiki> -->
10685 !! html
10686 <!-- <nowiki>data</nowiki> -->
10687 !!end
10688
10689 !! test
10690 pre-save transform: <noinclude> in subst (bug 3298)
10691 !! options
10692 pst
10693 !! wikitext
10694 {{subst:Includes}}
10695 !! html
10696 Foobar
10697 !! end
10698
10699 !! test
10700 pre-save transform: <onlyinclude> in subst (bug 3298)
10701 !! options
10702 pst
10703 !! wikitext
10704 {{subst:Includes2}}
10705 !! html
10706 Foo
10707 !! end
10708
10709 !! article
10710 Template:SubstTest
10711 !!text
10712 {{<includeonly>subst:</includeonly>Includes}}
10713 !! endarticle
10714
10715 !! article
10716 Template:SafeSubstTest
10717 !! text
10718 {{<includeonly>safesubst:</includeonly>Includes}}
10719 !! endarticle
10720
10721 !! test
10722 bug 22297: safesubst: works during PST
10723 !! options
10724 pst
10725 !! wikitext
10726 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
10727 !! html
10728 FoobarFoobar
10729 !! end
10730
10731 !! test
10732 bug 22297: safesubst: works during normal parse
10733 !! wikitext
10734 {{SafeSubstTest}}
10735 !! html
10736 <p>Foobar
10737 </p>
10738 !! end
10739
10740 !! test
10741 subst: does not work during normal parse
10742 !! wikitext
10743 {{SubstTest}}
10744 !! html
10745 <p>{{subst:Includes}}
10746 </p>
10747 !! end
10748
10749 !! test
10750 pre-save transform: context links ("pipe trick")
10751 !! options
10752 pst
10753 !! wikitext
10754 [[Article (context)|]]
10755 [[Bar:Article|]]
10756 [[:Bar:Article|]]
10757 [[Bar:Article (context)|]]
10758 [[:Bar:Article (context)|]]
10759 [[|Article]]
10760 [[|Article (context)]]
10761 [[Bar:X (Y) Z|]]
10762 [[:Bar:X (Y) Z|]]
10763 !! html
10764 [[Article (context)|Article]]
10765 [[Bar:Article|Article]]
10766 [[:Bar:Article|Article]]
10767 [[Bar:Article (context)|Article]]
10768 [[:Bar:Article (context)|Article]]
10769 [[Article]]
10770 [[Article (context)]]
10771 [[Bar:X (Y) Z|X (Y) Z]]
10772 [[:Bar:X (Y) Z|X (Y) Z]]
10773 !! end
10774
10775 !! test
10776 pre-save transform: context links ("pipe trick") with interwiki prefix
10777 !! options
10778 pst
10779 !! wikitext
10780 [[interwiki:Article|]]
10781 [[:interwiki:Article|]]
10782 [[interwiki:Bar:Article|]]
10783 [[:interwiki:Bar:Article|]]
10784 !! html
10785 [[interwiki:Article|Article]]
10786 [[:interwiki:Article|Article]]
10787 [[interwiki:Bar:Article|Bar:Article]]
10788 [[:interwiki:Bar:Article|Bar:Article]]
10789 !! end
10790
10791 !! test
10792 pre-save transform: context links ("pipe trick") with parens in title
10793 !! options
10794 pst title=[[Somearticle (context)]]
10795 !! wikitext
10796 [[|Article]]
10797 !! html
10798 [[Article (context)|Article]]
10799 !! end
10800
10801 !! test
10802 pre-save transform: context links ("pipe trick") with comma in title
10803 !! options
10804 pst title=[[Someplace, Somewhere]]
10805 !! wikitext
10806 [[|Otherplace]]
10807 [[Otherplace, Elsewhere|]]
10808 [[Otherplace, Elsewhere, Anywhere|]]
10809 !! html
10810 [[Otherplace, Somewhere|Otherplace]]
10811 [[Otherplace, Elsewhere|Otherplace]]
10812 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
10813 !! end
10814
10815 !! test
10816 pre-save transform: context links ("pipe trick") with parens and comma
10817 !! options
10818 pst title=[[Someplace (IGNORED), Somewhere]]
10819 !! wikitext
10820 [[|Otherplace]]
10821 [[Otherplace (place), Elsewhere|]]
10822 !! html
10823 [[Otherplace, Somewhere|Otherplace]]
10824 [[Otherplace (place), Elsewhere|Otherplace]]
10825 !! end
10826
10827 !! test
10828 pre-save transform: context links ("pipe trick") with comma and parens
10829 !! options
10830 pst title=[[Who, me? (context)]]
10831 !! wikitext
10832 [[|Yes, you.]]
10833 [[Me, Myself, and I (1937 song)|]]
10834 !! html
10835 [[Yes, you. (context)|Yes, you.]]
10836 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
10837 !! end
10838
10839 !! test
10840 pre-save transform: context links ("pipe trick") with namespace
10841 !! options
10842 pst title=[[Ns:Somearticle]]
10843 !! wikitext
10844 [[|Article]]
10845 !! html
10846 [[Ns:Article|Article]]
10847 !! end
10848
10849 !! test
10850 pre-save transform: context links ("pipe trick") with namespace and parens
10851 !! options
10852 pst title=[[Ns:Somearticle (context)]]
10853 !! wikitext
10854 [[|Article]]
10855 !! html
10856 [[Ns:Article (context)|Article]]
10857 !! end
10858
10859 !! test
10860 pre-save transform: context links ("pipe trick") with namespace and comma
10861 !! options
10862 pst title=[[Ns:Somearticle, Context, Whatever]]
10863 !! wikitext
10864 [[|Article]]
10865 !! html
10866 [[Ns:Article, Context, Whatever|Article]]
10867 !! end
10868
10869 !! test
10870 pre-save transform: context links ("pipe trick") with namespace, comma and parens
10871 !! options
10872 pst title=[[Ns:Somearticle, Context (context)]]
10873 !! wikitext
10874 [[|Article]]
10875 !! html
10876 [[Ns:Article (context)|Article]]
10877 !! end
10878
10879 !! test
10880 pre-save transform: context links ("pipe trick") with namespace, parens and comma
10881 !! options
10882 pst title=[[Ns:Somearticle (IGNORED), Context]]
10883 !! wikitext
10884 [[|Article]]
10885 !! html
10886 [[Ns:Article, Context|Article]]
10887 !! end
10888
10889 !! test
10890 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
10891 !! options
10892 pst
10893 !! wikitext
10894 [[Article(context)|]]
10895 [[Bar:Article(context)|]]
10896 [[:Bar:Article(context)|]]
10897 [[|Article(context)]]
10898 [[Bar:X(Y)Z|]]
10899 [[:Bar:X(Y)Z|]]
10900 !! html
10901 [[Article(context)|Article]]
10902 [[Bar:Article(context)|Article]]
10903 [[:Bar:Article(context)|Article]]
10904 [[Article(context)]]
10905 [[Bar:X(Y)Z|X(Y)Z]]
10906 [[:Bar:X(Y)Z|X(Y)Z]]
10907 !! end
10908
10909 !! test
10910 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
10911 !! options
10912 pst
10913 !! wikitext
10914 [[Article (context)|]]
10915 [[Bar:Article (context)|]]
10916 [[:Bar:Article (context)|]]
10917 [[|Article (context)]]
10918 [[Bar:X (Y) Z|]]
10919 [[:Bar:X (Y) Z|]]
10920 !! html
10921 [[Article (context)|Article]]
10922 [[Bar:Article (context)|Article]]
10923 [[:Bar:Article (context)|Article]]
10924 [[Article (context)]]
10925 [[Bar:X (Y) Z|X (Y) Z]]
10926 [[:Bar:X (Y) Z|X (Y) Z]]
10927 !! end
10928
10929 !! test
10930 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
10931 !! options
10932 pst
10933 !! wikitext
10934 [[Article(context)|]]
10935 [[Bar:Article(context)|]]
10936 [[:Bar:Article(context)|]]
10937 [[|Article(context)]]
10938 [[Bar:X(Y)Z|]]
10939 [[:Bar:X(Y)Z|]]
10940 !! html
10941 [[Article(context)|Article]]
10942 [[Bar:Article(context)|Article]]
10943 [[:Bar:Article(context)|Article]]
10944 [[Article(context)]]
10945 [[Bar:X(Y)Z|X(Y)Z]]
10946 [[:Bar:X(Y)Z|X(Y)Z]]
10947 !! end
10948
10949 !! test
10950 pre-save transform: context links ("pipe trick") with commas (bug 21660)
10951 !! options
10952 pst
10953 !! wikitext
10954 [[Article (context), context|]]
10955 [[Article (context),context|]]
10956 [[Bar:Article (context), context|]]
10957 [[Bar:Article (context),context|]]
10958 [[:Bar:Article (context), context|]]
10959 [[:Bar:Article (context),context|]]
10960 !! html
10961 [[Article (context), context|Article]]
10962 [[Article (context),context|Article]]
10963 [[Bar:Article (context), context|Article]]
10964 [[Bar:Article (context),context|Article]]
10965 [[:Bar:Article (context), context|Article]]
10966 [[:Bar:Article (context),context|Article]]
10967 !! end
10968
10969 !! test
10970 pre-save transform: trim trailing empty lines
10971 !! options
10972 pst
10973 !! wikitext
10974 Empty lines are trimmed
10975
10976
10977
10978
10979 !! html
10980 Empty lines are trimmed
10981 !! end
10982
10983 !! test
10984 pre-save transform: Signature expansion
10985 !! options
10986 pst
10987 !! wikitext
10988 * ~~~
10989 * <noinclude>~~~</noinclude>
10990 * <includeonly>~~~</includeonly>
10991 * <onlyinclude>~~~</onlyinclude>
10992 !! html
10993 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
10994 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
10995 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
10996 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
10997 !! end
10998
10999
11000 !! test
11001 pre-save transform: Signature expansion in nowiki tags (bug 93)
11002 !! options
11003 pst disabled
11004 !! wikitext
11005 Shall not expand:
11006
11007 <nowiki>~~~~</nowiki>
11008
11009 <includeonly><nowiki>~~~~</nowiki></includeonly>
11010
11011 <noinclude><nowiki>~~~~</nowiki></noinclude>
11012
11013 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11014
11015 {{subst:Foo}} shall be converted to FOO
11016
11017 As well as inside noinclude/onlyinclude
11018 <noinclude>{{subst:Foo}}</noinclude>
11019 <onlyinclude>{{subst:Foo}}</onlyinclude>
11020
11021 But not inside includeonly
11022 <includeonly>{{subst:Foo}}</includeonly>
11023 !! html
11024 Shall not expand:
11025
11026 <nowiki>~~~~</nowiki>
11027
11028 <includeonly><nowiki>~~~~</nowiki></includeonly>
11029
11030 <noinclude><nowiki>~~~~</nowiki></noinclude>
11031
11032 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11033
11034 FOO shall be converted to FOO
11035
11036 As well as inside noinclude/onlyinclude
11037 <noinclude>FOO</noinclude>
11038 <onlyinclude>FOO</onlyinclude>
11039
11040 But not inside includeonly
11041 <includeonly>{{subst:Foo}}</includeonly>
11042 !! end
11043
11044 !! test
11045 Parsoid: Recognize nowiki with trailing space in tags
11046 !! options
11047 parsoid=wt2html
11048 !! wikitext
11049 <nowiki ><div>[[foo]]</nowiki >
11050
11051 a<nowiki / >b
11052
11053 c<nowiki />d
11054
11055 e<nowiki/ >f
11056 !! html
11057 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11058 <p>ab</p>
11059 <p>cd</p>
11060 <p>ef</p>
11061 !! end
11062
11063 !! test
11064 Parsoid: Recognize nowiki with odd capitalization
11065 !! options
11066 parsoid=wt2html
11067 !! wikitext
11068 <noWikI ><div>[[foo]]</Nowiki >
11069 !! html
11070 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11071 !! end
11072
11073
11074 !! test
11075 Parsoid: Escape nowiki with trailing space in tags
11076 !! options
11077 parsoid=html2wt
11078 !! wikitext
11079 &lt;nowiki &gt; foo &lt;/nowiki &gt;
11080
11081 a&lt;nowiki /&gt;b
11082
11083 c&lt;nowiki/ &gt;d
11084 !! html
11085 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
11086 <p>a&lt;nowiki /&gt;b</p>
11087 <p>c&lt;nowiki/ &gt;d</p>
11088 !! end
11089
11090 !! test
11091 Parsoid: Escape weird noWikI capitalizations
11092 !! options
11093 parsoid=html2wt
11094 !! wikitext
11095 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
11096 !! html
11097 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
11098 !! end
11099
11100 ###
11101 ### Message transform tests
11102 ###
11103 !! test
11104 message transform: magic variables
11105 !! options
11106 msg
11107 !! wikitext
11108 {{SITENAME}}
11109 !! html
11110 MediaWiki
11111 !! end
11112
11113 !! test
11114 message transform: should not transform wiki markup
11115 !! options
11116 msg
11117 !! wikitext
11118 ''test''
11119 !! html
11120 ''test''
11121 !! end
11122
11123 !! test
11124 message transform: <noinclude> in transcluded template (bug 4926)
11125 !! options
11126 msg
11127 !! wikitext
11128 {{Includes}}
11129 !! html
11130 Foobar
11131 !! end
11132
11133 !! test
11134 message transform: <onlyinclude> in transcluded template (bug 4926)
11135 !! options
11136 msg
11137 !! wikitext
11138 {{Includes2}}
11139 !! html
11140 Foo
11141 !! end
11142
11143 !! test
11144 {{#special:}} page name, known
11145 !! options
11146 msg
11147 !! wikitext
11148 {{#special:Recentchanges}}
11149 !! html
11150 Special:RecentChanges
11151 !! end
11152
11153 !! test
11154 {{#special:}} page name with subpage, known
11155 !! options
11156 msg
11157 !! wikitext
11158 {{#special:Recentchanges/param}}
11159 !! html
11160 Special:RecentChanges/param
11161 !! end
11162
11163 !! test
11164 {{#special:}} page name, unknown
11165 !! options
11166 msg
11167 !! wikitext
11168 {{#special:foobar nonexistent}}
11169 !! html
11170 Special:Foobar nonexistent
11171 !! end
11172
11173 !! test
11174 {{#speciale:}} page name, known
11175 !! options
11176 msg
11177 !! wikitext
11178 {{#speciale:Recentchanges}}
11179 !! html
11180 Special:RecentChanges
11181 !! end
11182
11183 !! test
11184 {{#speciale:}} page name with subpage, known
11185 !! options
11186 msg
11187 !! wikitext
11188 {{#speciale:Recentchanges/param}}
11189 !! html
11190 Special:RecentChanges/param
11191 !! end
11192
11193 !! test
11194 {{#speciale:}} page name, unknown
11195 !! options
11196 msg
11197 !! wikitext
11198 {{#speciale:foobar nonexistent}}
11199 !! html
11200 Special:Foobar_nonexistent
11201 !! end
11202
11203 ###
11204 ### Images
11205 ###
11206 ### For Parsoid-specific tests, see
11207 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11208
11209 !! test
11210 Simple image
11211 !! options
11212 parsoid=wt2html,wt2wt,html2html
11213 !! wikitext
11214 [[Image:foobar.jpg]]
11215 !! html/php
11216 <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>
11217 </p>
11218 !! html/parsoid
11219 <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>
11220 !! end
11221
11222 !! test
11223 Simple image (using File: namespace, now canonical)
11224 !! wikitext
11225 [[File:Foobar.jpg]]
11226 !! html/php
11227 <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>
11228 </p>
11229 !! html/parsoid
11230 <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>
11231 !! end
11232
11233 !! test
11234 Right-aligned image
11235 !! wikitext
11236 [[File:Foobar.jpg|right]]
11237 !! html/php
11238 <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>
11239
11240 !! html/parsoid
11241 <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>
11242 !! end
11243
11244 !! test
11245 Image with caption
11246 !! wikitext
11247 [[File:Foobar.jpg|right|Caption text]]
11248 !! html/php
11249 <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>
11250
11251 !! html/parsoid
11252 <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>
11253 !! end
11254
11255 !! test
11256 Image with caption, bug 53312 #1
11257 !! wikitext
11258 [[File:Foobar.jpg|right|Caption page stuff]]
11259 !! html/php
11260 <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>
11261
11262 !! html/parsoid
11263 <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>
11264 !! end
11265
11266 !! test
11267 Image with caption, bug 53312 #2
11268 !! wikitext
11269 [[File:Foobar.jpg|right|Caption page=]]
11270 !! html/php
11271 <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>
11272
11273 !! html/parsoid
11274 <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>
11275 !! end
11276
11277 !! test
11278 Image with caption, bug 53312 #3
11279 !! wikitext
11280 [[File:Foobar.jpg|right|Caption page=stuff]]
11281 !! html/php
11282 <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>
11283
11284 !! html/parsoid
11285 <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>
11286 !! end
11287
11288 !! test
11289 Allow empty links in image captions (Bug 60753)
11290 !! options
11291 thumbsize=220
11292 !! wikitext
11293 [[File:Foobar.jpg|thumb|Caption [[Link1]]
11294 [[]]
11295 [[Link2]]
11296 ]]
11297 !! html/php
11298 <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>
11299
11300 !! html/parsoid
11301 <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>
11302 [[]]
11303 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
11304 </figcaption></figure>
11305 !! end
11306
11307 !! test
11308 Titles in unlinked images (T23454)
11309 !! wikitext
11310 [[File:Foobar.jpg|link=|stuff]]
11311 !! html/php
11312 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
11313 </p>
11314 !! end
11315
11316 !! test
11317 Link with empty target
11318 !! wikitext
11319 [[]]
11320 !! html
11321 <p>[[]]
11322 </p>
11323 !! end
11324
11325 !! test
11326 Image with empty attribute
11327 !! options
11328 parsoid=wt2html,wt2wt,html2html
11329 !! wikitext
11330 [[File:Foobar.jpg|right||Caption text]]
11331 !! html/php
11332 <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>
11333
11334 !! html/parsoid
11335 <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>
11336 !! end
11337
11338 !! test
11339 1. Block image with individual attributes from templates
11340 !! wikitext
11341 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
11342 !! html/php
11343 <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>
11344
11345 !! html/parsoid
11346 <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>
11347 !! end
11348
11349 !! test
11350 2. Block Image with individual attributes from templates
11351 !! wikitext
11352 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
11353 !! html/php
11354 <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>
11355
11356 !! html/parsoid
11357 <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>
11358 !! end
11359
11360 !! test
11361 3. Inline image with individual attributes from templates
11362 !! wikitext
11363 [[File:Foobar.jpg|{{echo|50px}}]]
11364 !! html/php
11365 <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>
11366 </p>
11367 !! html/parsoid
11368 <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>
11369 !! end
11370
11371 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
11372 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
11373 !! test
11374 Image with multiple attributes from the same template
11375 !! wikitext
11376 [[File:Foobar.jpg|{{image_attribs}}]]
11377 !! html/php
11378 <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>
11379
11380 !! html/parsoid
11381 <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>
11382 !! end
11383
11384 !! test
11385 Image with link tails
11386 !! options
11387 thumbsize=220
11388 !! wikitext
11389 123[[File:Foobar.jpg]]456
11390 123[[File:Foobar.jpg|right]]456
11391 123[[File:Foobar.jpg|thumb]]456
11392 !! html/php
11393 <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
11394 </p>
11395 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
11396 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
11397
11398 !! html/php+tidy
11399 <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>
11400 <p>123</p>
11401 <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>
11402 <p>456 123</p>
11403 <div class="thumb tright">
11404 <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>
11405 <div class="thumbcaption">
11406 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11407 </div>
11408 </div>
11409 </div>
11410 <p>456</p>
11411 !! html/parsoid
11412 <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>
11413 <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>
11414 <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>
11415 !! end
11416
11417 !! test
11418 Image with multiple captions -- only last one is accepted
11419 !! wikitext
11420 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11421 !! html/php
11422 <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>
11423
11424 !! html/parsoid
11425 <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>
11426 !! end
11427
11428 !! test
11429 Image with multiple widths -- use last
11430 !! wikitext
11431 [[File:Foobar.jpg|200px|300px|caption]]
11432 !! html/php
11433 <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>
11434 </p>
11435 !! html/parsoid
11436 <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>
11437 !! end
11438
11439 !! test
11440 Image with multiple alignments -- use first (bug 48664)
11441 !! options
11442 thumbsize=220
11443 !! wikitext
11444 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11445
11446 [[File:Foobar.jpg|middle|text-top|caption]]
11447 !! html/php
11448 <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>
11449 <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>
11450 </p>
11451 !! html/parsoid
11452 <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>
11453 <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>
11454 !! end
11455
11456 !! test
11457 Image with width attribute at different positions
11458 !! wikitext
11459 [[File:Foobar.jpg|200px|right|Caption]]
11460 [[File:Foobar.jpg|right|200px|Caption]]
11461 [[File:Foobar.jpg|right|Caption|200px]]
11462 !! html/php
11463 <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>
11464 <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>
11465 <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>
11466
11467 !! html/parsoid
11468 <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>
11469 <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>
11470 <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>
11471 !! end
11472
11473 # a sad bit of backward-compatibility
11474 !! test
11475 Image with size specified with pxpx (bug 13500, 51628)
11476 !! options
11477 parsoid=wt2html,wt2wt,html2html
11478 !! wikitext
11479 [[File:Foobar.jpg|20pxpx]]
11480 [[File:Foobar.jpg|200x20pxpx]]
11481 !! html/php
11482 <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>
11483 <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>
11484 </p>
11485 !! html/parsoid
11486 <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>
11487 !! end
11488
11489 !! test
11490 Image with link parameter, wiki target
11491 !! wikitext
11492 [[File:Foobar.jpg|link=Main Page]]
11493 !! html/php
11494 <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>
11495 </p>
11496 !! html/parsoid
11497 <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>
11498 !! end
11499
11500 # parsoid bug 49293 (part 1)
11501 !! test
11502 Image with link parameter, URL target
11503 !! wikitext
11504 [[File:Foobar.jpg|link=http://example.com/]]
11505 !! html/php
11506 <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>
11507 </p>
11508 !! html/parsoid
11509 <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>
11510 !! end
11511
11512 # parsoid bug 49293 (part 2)
11513 !! test
11514 Image with link parameter, protocol-less URL target
11515 !! wikitext
11516 [[File:Foobar.jpg|link=//example.com/]]
11517 !! html/php
11518 <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>
11519 </p>
11520 !! html/parsoid
11521 <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>
11522 !! end
11523
11524 !! test
11525 Image with link parameter, wgExternalLinkTarget
11526 !! wikitext
11527 [[Image:foobar.jpg|link=http://example.com/]]
11528 !! config
11529 wgExternalLinkTarget='foobar'
11530 !! html
11531 <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>
11532 </p>
11533 !! end
11534
11535 !! test
11536 Image with link parameter, wgNoFollowLinks set to false
11537 !! wikitext
11538 [[Image:foobar.jpg|link=http://example.com/]]
11539 !! config
11540 wgNoFollowLinks=false
11541 !! html
11542 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11543 </p>
11544 !! end
11545
11546 !! test
11547 Image with link parameter, wgNoFollowDomainExceptions
11548 !! wikitext
11549 [[Image:foobar.jpg|link=http://example.com/]]
11550 !! config
11551 wgNoFollowDomainExceptions='example.com'
11552 !! html
11553 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11554 </p>
11555 !! end
11556
11557 !! test
11558 Image with link parameter, wgExternalLinkTarget, unnamed parameter
11559 !! wikitext
11560 [[Image:foobar.jpg|link=http://example.com/|Title]]
11561 !! config
11562 wgExternalLinkTarget='foobar'
11563 !! html
11564 <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>
11565 </p>
11566 !! end
11567
11568 !! test
11569 Image with empty link parameter
11570 !! wikitext
11571 [[File:Foobar.jpg|link=]]
11572 !! html/php
11573 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
11574 </p>
11575 !! html/parsoid
11576 <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>
11577 !! end
11578
11579 !! test
11580 Image with link parameter (wiki target) and unnamed parameter
11581 !! wikitext
11582 [[File:Foobar.jpg|link=Main_Page|Title]]
11583 !! html/php
11584 <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>
11585 </p>
11586 !! html/parsoid
11587 <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>
11588 !! end
11589
11590 !! test
11591 Image with link parameter (URL target) and unnamed parameter
11592 !! wikitext
11593 [[File:Foobar.jpg|link=http://example.com/|Title]]
11594 !! html/php
11595 <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>
11596 </p>
11597 !! html/parsoid
11598 <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>
11599 !! end
11600
11601 !! test
11602 Thumbnail image with link parameter
11603 !! options
11604 thumbsize=220
11605 parsoid=wt2html,wt2wt,html2html
11606 !! wikitext
11607 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
11608 !! html/php
11609 <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>
11610
11611 !! html/parsoid
11612 <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>
11613 !! end
11614
11615 !! test
11616 Manually-specified thumbnail image
11617 !! options
11618 thumbsize=220
11619 !! wikitext
11620 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
11621 !! html/php
11622 <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>
11623
11624 !! html/parsoid
11625 <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>
11626 !! end
11627
11628 !! test
11629 Manually-specified thumbnail image with explicit link to wiki page
11630 !! options
11631 thumbsize=220
11632 parsoid=wt2html,wt2wt,html2html
11633 !! wikitext
11634 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
11635 !! html/php
11636 <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>
11637
11638 !! html/parsoid
11639 <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>
11640 !! end
11641
11642 !! test
11643 Manually-specified thumbnail image with explicit link to url
11644 !! options
11645 thumbsize=220
11646 parsoid=wt2html,wt2wt,html2html
11647 !! wikitext
11648 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
11649 !! html/php
11650 <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>
11651
11652 !! html/parsoid
11653 <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>
11654 !! end
11655
11656 !! test
11657 Manually-specified thumbnail image with explicit no link
11658 !! options
11659 thumbsize=220
11660 parsoid=wt2html,wt2wt,html2html
11661 !! wikitext
11662 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
11663 !! html/php
11664 <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>
11665
11666 !! html/parsoid
11667 <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>
11668 !! end
11669
11670 !! test
11671 Manually-specified thumbnail image with explicit link and alt text
11672 !! options
11673 thumbsize=220
11674 parsoid=wt2html,wt2wt,html2html
11675 !! wikitext
11676 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
11677 !! html/php
11678 <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>
11679
11680 !! html/parsoid
11681 <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>
11682 !! end
11683
11684 !! test
11685 Image with frame and link
11686 !! options
11687 parsoid=wt2html,wt2wt,html2html
11688 !! wikitext
11689 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
11690 !! html/php
11691 <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>
11692
11693 !! html/parsoid
11694 <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>
11695 !! end
11696
11697 !! test
11698 Image with frame and link and explicit alt
11699 !! options
11700 parsoid=wt2html,wt2wt,html2html
11701 !! wikitext
11702 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
11703 !! html/php
11704 <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>
11705
11706 !! html/parsoid
11707 <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>
11708 !! end
11709
11710 !! test
11711 Image with wiki markup in implicit alt
11712 !! options
11713 parsoid=wt2html,wt2wt,html2html
11714 !! wikitext
11715 [[Image:Foobar.jpg|testing '''bold''' in alt]]
11716
11717 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
11718 !! html/php
11719 <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>
11720 </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>
11721 </p>
11722 !! html/parsoid
11723 <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>
11724 <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>
11725 !! end
11726
11727 ###################
11728 # Conflicting image format options.
11729 # First option specified should 'win'.
11730 # All three cases in each test should be identical.
11731
11732 !! test
11733 Image with 'frameless' first.
11734 !! options
11735 parsoid=wt2html,wt2wt,html2html
11736 !! wikitext
11737 [[File:Foobar.jpg|frameless|caption]]
11738
11739 [[File:Foobar.jpg|frameless|frame|caption]]
11740
11741 [[File:Foobar.jpg|frameless|thumb|caption]]
11742 !! html/php
11743 <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>
11744 </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>
11745 </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>
11746 </p>
11747 !! html/parsoid
11748 <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>
11749 <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>
11750 <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>
11751 !! end
11752
11753 !! test
11754 Image with 'frame' first.
11755 !! options
11756 parsoid=wt2html,wt2wt,html2html
11757 !! wikitext
11758 [[File:Foobar.jpg|frame|caption]]
11759 [[File:Foobar.jpg|frame|frameless|caption]]
11760 [[File:Foobar.jpg|frame|thumb|caption]]
11761 !! html/php
11762 <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>
11763 <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>
11764 <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>
11765
11766 !! html/parsoid
11767 <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>
11768 <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>
11769 <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>
11770 !! end
11771
11772 !! test
11773 Image with 'thumb' first.
11774 !! options
11775 parsoid=wt2html,wt2wt,html2html
11776 !! wikitext
11777 [[File:Foobar.jpg|thumb|caption]]
11778 [[File:Foobar.jpg|thumb|frameless|caption]]
11779 [[File:Foobar.jpg|thumb|frame|caption]]
11780 !! html/php
11781 <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>
11782 <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>
11783 <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>
11784
11785 !! html/parsoid
11786 <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>
11787 <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>
11788 <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>
11789 !! end
11790
11791 ###################
11792 # Image sizing.
11793 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
11794 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
11795 # Foobar has actual size of 1941x220
11796 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
11797 # a scalable format.
11798 # 2. Framed images always ignore size options; always render at default size.
11799 # 3. "Unspecified format" and border are the only types which can be
11800 # enlarged.
11801
11802 !! test
11803 Image: "unspecified format" and border enlarge
11804 !! options
11805 parsoid=wt2html,wt2wt,html2html
11806 !! wikitext
11807 [[File:Foobar.jpg|2000px]]
11808
11809 [[File:Foobar.jpg|border|2000px]]
11810 !! html/php
11811 <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>
11812 </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>
11813 </p>
11814 !! html/parsoid
11815 <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>
11816 <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>
11817 !! end
11818
11819 !! test
11820 Image: "unspecified format" and border reduce
11821 !! options
11822 parsoid=wt2html,wt2wt,html2html
11823 !! wikitext
11824 [[File:Foobar.jpg|1000px]]
11825
11826 [[File:Foobar.jpg|border|1000px]]
11827 !! html/php
11828 <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>
11829 </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>
11830 </p>
11831 !! html/parsoid
11832 <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>
11833 <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>
11834 !! end
11835
11836 !! test
11837 Image: thumbs reduce
11838 !! options
11839 parsoid=wt2html,wt2wt,html2html
11840 !! wikitext
11841 [[File:Foobar.jpg|thumb|50px]]
11842 !! html/php
11843 <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>
11844
11845 !! html/parsoid
11846 <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>
11847 !! end
11848
11849 !! test
11850 Image: bitmap thumbs can't be enlarged past original size, but vector can.
11851 !! options
11852 parsoid=wt2html,wt2wt,html2html
11853 !! wikitext
11854 [[File:Foobar.jpg|thumb|2000px]]
11855
11856 [[File:Foobar.svg|thumb|2000px]]
11857 !! html/php
11858 <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>
11859 <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>
11860
11861 !! html/parsoid
11862 <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>
11863 <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>
11864 !! end
11865
11866 !! test
11867 Image: frameless can reduce in size
11868 !! options
11869 parsoid=wt2html,wt2wt,html2html
11870 !! wikitext
11871 [[File:Foobar.jpg|frameless|50px]]
11872 !! html/php
11873 <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>
11874 </p>
11875 !! html/parsoid
11876 <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>
11877 !! end
11878
11879 !! test
11880 Image: bitmap frameless can't be enlarged past original size, but vector can
11881 !! options
11882 parsoid=wt2html,wt2wt,html2html
11883 !! wikitext
11884 [[File:Foobar.jpg|frameless|2000px]]
11885
11886 [[File:Foobar.svg|frameless|2000px]]
11887 !! html/php
11888 <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>
11889 </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>
11890 </p>
11891 !! html/parsoid
11892 <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>
11893 <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>
11894 !! end
11895
11896 !! test
11897 Image: framed images are always unscaled.
11898 !! options
11899 parsoid=wt2html,wt2wt,html2html
11900 !! wikitext
11901 [[File:Foobar.jpg|frame]]
11902
11903 [[File:Foobar.jpg|frame|50px]]
11904
11905 [[File:Foobar.jpg|frame|50x50px]]
11906
11907 [[File:Foobar.jpg|frame|2000px]]
11908 !! html/php
11909 <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>
11910 <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>
11911 <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>
11912 <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>
11913
11914 !! html/parsoid
11915 <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>
11916 <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>
11917 <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>
11918 <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>
11919 !! end
11920
11921 ###################
11922
11923 !! test
11924 Link to image page- image page normally doesn't exists, hence edit link
11925 Add test with existing image page
11926 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
11927 !! wikitext
11928 [[:Image:test]]
11929 !! html
11930 <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>
11931 </p>
11932 !! end
11933
11934 !! test
11935 bug 18784 Link to non-existent image page with caption should use caption as link text
11936 !! wikitext
11937 [[:Image:test|caption]]
11938 !! html
11939 <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>
11940 </p>
11941 !! end
11942
11943 !! test
11944 Frameless image caption with a free URL
11945 !! wikitext
11946 [[File:Foobar.jpg|http://example.com]]
11947 !! html/php
11948 <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>
11949 </p>
11950 !! html/parsoid
11951 <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>
11952 !! end
11953
11954 !! test
11955 Thumbnail image caption with a free URL
11956 !! options
11957 thumbsize=220
11958 !! wikitext
11959 [[File:Foobar.jpg|thumb|http://example.com]]
11960 !! html/php
11961 <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>
11962
11963 !! html/parsoid
11964 <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>
11965 !! end
11966
11967 !! test
11968 Thumbnail image caption with a free URL and explicit alt
11969 !! options
11970 thumbsize=220
11971 parsoid=wt2html,wt2wt,html2html
11972 !! wikitext
11973 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
11974 !! html/php
11975 <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>
11976
11977 !! html/parsoid
11978 <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>
11979 !! end
11980
11981 !! test
11982 SVG thumbnails with no language set
11983 !! options
11984 !! wikitext
11985 [[File:Foobar.svg|thumb|caption]]
11986 !! html/php
11987 <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>
11988
11989 !! html/parsoid
11990 <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>
11991 !! end
11992
11993 !! test
11994 SVG thumbnails with language de
11995 !! options
11996 parsoid=wt2html,wt2wt,html2html
11997 !! wikitext
11998 [[File:Foobar.svg|thumb|caption|lang=de]]
11999 !! html/php
12000 <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>
12001
12002 !! html/parsoid
12003 <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>
12004 !! end
12005
12006 !! test
12007 SVG thumbnails with invalid language code
12008 !! options
12009 parsoid=wt2html,wt2wt,html2html
12010 !! wikitext
12011 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
12012 !! html/php
12013 <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>
12014
12015 !! html/parsoid
12016 <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>
12017 !! end
12018
12019 !! test
12020 BUG 1887: A ISBN with a thumbnail
12021 !! wikitext
12022 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
12023 !! html/php
12024 <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>
12025
12026 !! html/parsoid
12027 <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>
12028 !! end
12029
12030 !! test
12031 BUG 1887: A RFC with a thumbnail
12032 !! wikitext
12033 [[File:Foobar.jpg|thumb|This is RFC 12354]]
12034 !! html/php
12035 <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>
12036
12037 !! html/parsoid
12038 <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>
12039 !! end
12040
12041 !! test
12042 BUG 1887: A mailto link with a thumbnail
12043 !! wikitext
12044 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
12045 !! html/php
12046 <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>
12047
12048 !! html/parsoid
12049 <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>
12050 !! end
12051
12052 # Pending resolution to bug 368
12053 !! test
12054 BUG 648: Frameless image caption with a link
12055 !! wikitext
12056 [[File:Foobar.jpg|text with a [[link]] in it]]
12057 !! html/php
12058 <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>
12059 </p>
12060 !! html/parsoid
12061 <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>
12062 !! end
12063
12064 !! test
12065 BUG 648: Frameless image caption with a link (suffix)
12066 !! wikitext
12067 [[File:Foobar.jpg|text with a [[link]]foo in it]]
12068 !! html/php
12069 <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>
12070 </p>
12071 !! html/parsoid
12072 <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>
12073 !! end
12074
12075 !! test
12076 BUG 648: Frameless image caption with an interwiki link
12077 !! wikitext
12078 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
12079 !! html/php
12080 <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>
12081 </p>
12082 !! html/parsoid
12083 <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>
12084 !! end
12085
12086 !! test
12087 BUG 648: Frameless image caption with a piped interwiki link
12088 !! wikitext
12089 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
12090 !! html/php
12091 <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>
12092 </p>
12093 !! html/parsoid
12094 <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>
12095 !! end
12096
12097 !! test
12098 Escape HTML special chars in image alt text
12099 !! wikitext
12100 [[File:Foobar.jpg|& < > "]]
12101 !! html/php
12102 <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>
12103 </p>
12104 !! html/parsoid
12105 <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>
12106 !! end
12107
12108 !! test
12109 BUG 499: Alt text should have &#1234;, not &amp;1234;
12110 !! wikitext
12111 [[File:Foobar.jpg|&#9792;]]
12112 !! html/php
12113 <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>
12114 </p>
12115 !! html/parsoid
12116 <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>
12117 !! end
12118
12119 !! test
12120 Broken image caption with link
12121 !! options
12122 parsoid=wt2html,wt2wt,html2html
12123 !! wikitext
12124 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
12125 !! html/php
12126 <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.
12127 </p>
12128 !! html/parsoid
12129 <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>
12130 !! end
12131
12132 !! test
12133 Image caption containing another image
12134 !! wikitext
12135 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
12136 !! html/php
12137 <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>
12138
12139 !! html/parsoid
12140 <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>
12141 !! end
12142
12143 !! test
12144 Image: caption containing a newline
12145 !! wikitext
12146 [[File:Foobar.jpg|This
12147 *is some text]]
12148 !! html/php
12149 <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>
12150 </p>
12151 !! html/parsoid
12152 <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>
12153 !!end
12154
12155 !!test
12156 Image: caption containing leading space
12157 (The leading space should not trigger nowiki escaping in wt2wt mode)
12158 !! wikitext
12159 [[File:Foobar.jpg|thumb| bar]]
12160 !! html/php
12161 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>bar</div></div></div>
12162
12163 !! html/parsoid
12164 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
12165 !!end
12166
12167 !! test
12168 Image: caption containing a table
12169 !! options
12170 parsoid=wt2html,wt2wt,html2html
12171 !! wikitext
12172 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
12173 {|
12174 ! Foo !! Bar
12175 |-
12176 | Foo1 || Bar1
12177 |}
12178 and some more text.]]
12179 !! html/php
12180 <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>
12181
12182 !! html/parsoid
12183 <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
12184 <table>
12185 <tbody>
12186 <tr><th>Foo </th><th>Bar</th></tr>
12187 <tr>
12188 <td>Foo1 </td>
12189 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
12190 !! end
12191
12192 !! test
12193 Bug 3090: External links other than http: in image captions
12194 !! wikitext
12195 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
12196 !! html/php
12197 <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>
12198
12199 !! html/parsoid
12200 <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>
12201 !! end
12202
12203 !! test
12204 Custom class
12205 !! options
12206 parsoid=wt2html,wt2wt,html2html
12207 !! wikitext
12208 [[Image:foobar.jpg|a|class=b]]
12209 !! html/php
12210 <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>
12211 </p>
12212 !! html/parsoid
12213 <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>
12214 !! end
12215
12216 !! test
12217 Localized image handling (1).
12218 !! options
12219 parsoid=wt2html,wt2wt,html2html
12220 language=es
12221 !! wikitext
12222 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
12223 !! html/php
12224 <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>
12225
12226 !! html/parsoid
12227 <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>
12228 !! end
12229
12230 !! test
12231 Localized image handling (2).
12232 !! options
12233 thumbsize=220
12234 parsoid=wt2html,wt2wt,html2html
12235 language=es
12236 !! wikitext
12237 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
12238 !! html/php
12239 <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>
12240
12241 !! html/parsoid
12242 <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>
12243 !! end
12244
12245 !! test
12246 "border", "frameless" and "class" attributes on an image.
12247 !! options
12248 thumbsize=220
12249 parsoid=wt2html,wt2wt,html2html
12250 !! wikitext
12251 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
12252 !! html/php
12253 <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>
12254 </p>
12255 !! html/parsoid
12256 <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>
12257 !! end
12258
12259 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
12260 !! test
12261 Invalid image attributes (bug 62500)
12262 !! options
12263 thumbsize=220
12264 parsoid=wt2html,wt2wt,html2html
12265 !! wikitext
12266 [[File:Foobar.jpg|thumb|float|left|caption]]
12267
12268 [[File:Foobar.jpg|thumb|righ|caption]]
12269
12270 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
12271 !! html/php
12272 <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>
12273 <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>
12274 <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>
12275
12276 !! html/parsoid
12277 <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>
12278 <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>
12279 <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>
12280 !! end
12281
12282 !! article
12283 File:Barfoo.jpg
12284 !! text
12285 #REDIRECT [[File:Barfoo.jpg]]
12286 !! endarticle
12287
12288 # FIXME: Parsoid should run this test -- but we'd need to teach the
12289 # mockAPI about the redirected Barfoo.jpg image.
12290 !! test
12291 Redirected image
12292 !! wikitext
12293 [[Image:Barfoo.jpg]]
12294 !! html/php
12295 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
12296 </p>
12297 !! end
12298
12299 !! test
12300 Missing image with uploads disabled
12301 !! options
12302 wgEnableUploads=0
12303 !! wikitext
12304 [[File:Foobaz.jpg]]
12305 !! html/php
12306 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
12307 </p>
12308 !! html/parsoid
12309 <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>
12310 !! end
12311
12312 # Parsoid-specific testing for images
12313 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12314 # Currently imperfect due to a flaw in the Parsoid testrunner
12315 # Work in progress
12316 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
12317 # image tests.
12318
12319 !! test
12320 Parsoid-specific image handling - simple image with size and middle alignment
12321 !! wikitext
12322 [[File:Foobar.jpg|middle|50px]]
12323 !! html/parsoid
12324 <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>
12325 !! end
12326
12327 !! test
12328 Parsoid-specific image handling - simple image with size, middle alignment,
12329 non-standard namespace alias
12330 !! options
12331 parsoid=wt2wt,wt2html,html2html
12332 !! wikitext
12333 [[Image:Foobar.jpg|middle|50px]]
12334 !! html/parsoid
12335 <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>
12336 !! end
12337
12338 !! test
12339 Parsoid-specific image handling - simple image with size and middle alignment
12340 (existing content)
12341 !! wikitext
12342 [[File:Foobar.jpg|50px|middle]]
12343 !! html/parsoid
12344 <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>
12345 !! end
12346
12347 !! test
12348 Parsoid-specific image handling - simple image with size and middle alignment
12349 and non-standard namespace name
12350 !! options
12351 parsoid=wt2html,wt2wt,html2html
12352 !! wikitext
12353 [[Image:Foobar.jpg|50px|middle]]
12354 !! html/parsoid
12355 <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>
12356 !! end
12357
12358 !! test
12359 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
12360 !! wikitext
12361 [[File:Foobar.jpg|500x10px|baseline|caption]]
12362 !! html/parsoid
12363 <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>
12364 !! end
12365
12366 !! test
12367 Parsoid-specific image handling - simple image with border and size spec
12368 !! wikitext
12369 [[File:Foobar.jpg|50px|border|caption]]
12370 !! html/parsoid
12371 <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>
12372 !! end
12373
12374 !! test
12375 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12376 !! wikitext
12377 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
12378 !! html/parsoid
12379 <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>
12380 !! end
12381
12382 !! test
12383 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12384 (existing content)
12385 !! wikitext
12386 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12387 !! html/parsoid
12388 <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>
12389 !! end
12390
12391 !! test
12392 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12393 !! wikitext
12394 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12395 !! html/parsoid
12396 <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>
12397 !! end
12398
12399 !! test
12400 Parsoid-specific image handling - thumbnail with specific size, halign,
12401 valign, and caption (existing content)
12402 !! wikitext
12403 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12404 !! html/parsoid
12405 <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>
12406 !! end
12407
12408 !! test
12409 Parsoid-specific image handling - framed image with specific size and caption
12410 (size is ignored)
12411 !! options
12412 parsoid=wt2html,wt2wt,html2html
12413 !! wikitext
12414 [[File:Foobar.jpg|frame|500x50px|caption]]
12415 !! html/parsoid
12416 <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>
12417 !! end
12418
12419 !! test
12420 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12421 (size is ignored)
12422 !! options
12423 parsoid=wt2html,wt2wt,html2html
12424 !! wikitext
12425 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12426 !! html/parsoid
12427 <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>
12428 !! end
12429
12430 !! test
12431 Parsoid-specific image handling - frameless image with specific size, border, and caption
12432 !! wikitext
12433 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12434 !! html/parsoid
12435 <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>
12436 !! end
12437
12438 !! test
12439 Parsoid-specific image handling - simple image with a formatted caption
12440 !! wikitext
12441 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12442 !! html/parsoid
12443 <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>
12444 !! end
12445
12446 !! test
12447 Parsoid-specific image handling - caption with a template in it
12448 !! wikitext
12449 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12450 !! html/parsoid
12451 <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>
12452 !! end
12453
12454 !! test
12455 Parsoid-specific image handling - caption with unbalanced tags in it
12456 !! options
12457 parsoid=wt2html,wt2wt,html2html
12458 !! wikitext
12459 foo
12460 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12461 bar
12462 !! html/parsoid
12463 <p>foo</p>
12464 <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>
12465 <p>bar</p>
12466 !! end
12467
12468 !! test
12469 Parsoid-specific image handling - empty caption (1)
12470 !! options
12471 parsoid=wt2html,wt2wt
12472 !! wikitext
12473 [[File:Foobar.jpg|thumb|]]
12474 !! html/parsoid
12475 <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>
12476 !! end
12477
12478 # empty captions don't get serialized unless we're in the "round trip" case
12479 !! test
12480 Parsoid-specific image handling - empty caption (2)
12481 !! options
12482 parsoid=html2wt
12483 !! html/parsoid
12484 <figure class="mw-default-size" typeof="mw:Image/Thumb">
12485 <a href="File:Foobar.jpg">
12486 <img resource="./File:Foobar.jpg"
12487 src="//example.com/images/3/3a/Foobar.jpg"
12488 height="25" width="220"/>
12489 </a>
12490 <figcaption></figcaption>
12491 </figure>
12492 !! wikitext
12493 [[File:Foobar.jpg|thumb]]
12494 !! end
12495
12496 !! test
12497 Parsoid-specific image handling - whitespace caption
12498 !! wikitext
12499 [[File:Foobar.jpg|thumb| ]]
12500 !! html/parsoid
12501 <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>
12502 !! end
12503
12504 !! test
12505 Parsoid-specific image handling - lang option
12506 !! wikitext
12507 foo
12508 [[File:Foobar.svg|lang=de|caption]]
12509 bar
12510 !! html/parsoid
12511 <p>foo
12512 <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>
12513 bar</p>
12514 !! end
12515
12516
12517 ###
12518 ### Subpages
12519 ###
12520 !! article
12521 Subpage test/subpage
12522 !! text
12523 foo
12524 !! endarticle
12525
12526 !! test
12527 Subpage link
12528 !! options
12529 subpage title=[[Subpage test]]
12530 !! wikitext
12531 [[/subpage]]
12532 !! html
12533 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
12534 </p>
12535 !! end
12536
12537 !! test
12538 Subpage noslash link
12539 !! options
12540 subpage title=[[Subpage test]]
12541 !! wikitext
12542 [[/subpage/]]
12543 !! html
12544 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
12545 </p>
12546 !! end
12547
12548 !! article
12549 Subpage test/1/2/subpage
12550 !! text
12551 blah
12552 !! endarticle
12553
12554 !! test
12555 Relative subpage noslash link
12556 !! options
12557 parsoid=wt2wt,wt2html,html2html
12558 subpage title=[[Subpage test/1/2/3/4]]
12559 !! wikitext
12560 [[../../subpage/]]
12561
12562 [[../../subpage]]
12563 !! html/php
12564 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
12565 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
12566 </p>
12567 !! html/parsoid
12568 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
12569 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
12570 !! end
12571
12572 !! test
12573 Parsoid: dot-slash prefixed wikilinks
12574 !! wikitext
12575 [[./foo]]
12576
12577 [[././bar]]
12578
12579 [[././baz/]]
12580 !! html/php
12581 <p>[[./foo]]
12582 </p><p>[[././bar]]
12583 </p><p>[[././baz/]]
12584 </p>
12585 !! html/parsoid
12586 <p>[[./foo]]
12587 </p><p>[[././bar]]
12588 </p><p>[[././baz/]]
12589 </p>
12590 !! end
12591
12592 !! test
12593 Render invalid page names as plain text (bug 51090)
12594 !! wikitext
12595 [[./../foo|bar]]
12596 [[foo�|bar]]
12597 [[foo/.|bar]]
12598 [[foo/..|bar]]
12599 [[foo~~~bar]]
12600 [[foo>bar]]
12601 [[foo[bar]]
12602 [[.]]
12603 [[..]]
12604 [[foo././bar]]
12605
12606 [[{{echo|./../foo}}|bar]]
12607 [[{{echo|foo/.}}|bar]]
12608 [[{{echo|foo/..}}|bar]]
12609 [[{{echo|foo~~~~bar}}]]
12610 [[{{echo|foo>bar}}]]
12611 [[{{echo|foo././bar}}]]
12612 [[{{echo|foo{bar}}]]
12613 [[{{echo|foo}bar}}]]
12614 [[{{echo|foo[bar}}]]
12615 [[{{echo|foo]bar}}]]
12616 [[{{echo|foo<bar}}]]
12617 !!html/php
12618 <p>[[./../foo|bar]]
12619 [[foo�|bar]]
12620 [[foo/.|bar]]
12621 [[foo/..|bar]]
12622 [[foo~~~bar]]
12623 [[foo&gt;bar]]
12624 [[foo[bar]]
12625 [[.]]
12626 [[..]]
12627 [[foo././bar]]
12628 </p><p>[[./../foo|bar]]
12629 [[foo/.|bar]]
12630 [[foo/..|bar]]
12631 [[foo~~~~bar]]
12632 [[foo&gt;bar]]
12633 [[foo././bar]]
12634 [[foo{bar]]
12635 [[foo}bar]]
12636 [[foo[bar]]
12637 [[foo]bar]]
12638 [[foo&lt;bar]]
12639 </p>
12640 !!html/parsoid
12641 <p>[[./../foo|bar]]
12642 [[foo�|bar]]
12643 [[foo/.|bar]]
12644 [[foo/..|bar]]
12645 [[foo~~~bar]]
12646 [[foo>bar]]
12647 [[foo[bar]]
12648 [[.]]
12649 [[..]]
12650 [[foo././bar]]</p>
12651
12652 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
12653 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
12654 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
12655 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
12656 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
12657 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
12658 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
12659 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
12660 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
12661 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
12662 [[<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>
12663 !!end
12664
12665 !! test
12666 Disabled subpages
12667 !! wikitext
12668 [[/subpage]]
12669 !! html
12670 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
12671 </p>
12672 !! end
12673
12674 !! test
12675 BUG 561: {{/Subpage}}
12676 !! options
12677 subpage title=[[Page]]
12678 !! wikitext
12679 {{/Subpage}}
12680 !! html
12681 <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>
12682 </p>
12683 !! end
12684
12685 ###
12686 ### Categories
12687 ###
12688 !! article
12689 Category:MediaWiki User's Guide
12690 !! text
12691 blah
12692 !! endarticle
12693
12694 !! test
12695 Link to category
12696 !! wikitext
12697 [[:Category:MediaWiki User's Guide]]
12698 !! html
12699 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
12700 </p>
12701 !! end
12702
12703 !! test
12704 Simple category
12705 !! options
12706 cat
12707 !! wikitext
12708 [[Category:MediaWiki User's Guide]]
12709 !! html
12710 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12711 !! end
12712
12713 !! test
12714 PAGESINCATEGORY invalid title fatal (r33546 fix)
12715 !! wikitext
12716 {{PAGESINCATEGORY:<bogus>}}
12717 !! html
12718 <p>0
12719 </p>
12720 !! end
12721
12722 !! test
12723 Category with different sort key
12724 !! options
12725 cat
12726 !! wikitext
12727 [[Category:MediaWiki User's Guide|Foo]]
12728 !! html
12729 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12730 !! end
12731
12732 !! test
12733 Category with identical sort key
12734 !! options
12735 cat
12736 !! wikitext
12737 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12738 !! html
12739 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12740 !! end
12741
12742 !! test
12743 Category with empty sort key
12744 !! options
12745 cat
12746 pst
12747 !! wikitext
12748 [[Category:MediaWiki User's Guide|]]
12749 !! html
12750 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12751 !! end
12752
12753 !! test
12754 Category with empty sort key and parentheses
12755 !! options
12756 cat
12757 pst
12758 !! wikitext
12759 [[Category:Foo (bar)|]]
12760 !! html
12761 [[Category:Foo (bar)|Foo]]
12762 !! end
12763
12764 !! test
12765 Category with link tail
12766 !! options
12767 cat
12768 pst
12769 !! wikitext
12770 123[[Category:Foo]]456
12771 !! html
12772 123[[Category:Foo]]456
12773 !! end
12774
12775 !! test
12776 Category with template
12777 !! options
12778 cat
12779 pst
12780 !! wikitext
12781 [[Category:{{echo|Foo}}]]
12782 !! html
12783 [[Category:{{echo|Foo}}]]
12784 !! end
12785
12786 !! test
12787 Category with template in sort key
12788 !! options
12789 cat
12790 pst
12791 !! wikitext
12792 [[Category:Foo|{{echo|Bar}}]]
12793 !! html
12794 [[Category:Foo|{{echo|Bar}}]]
12795 !! end
12796
12797 !! test
12798 Category with template in sort key and title
12799 !! options
12800 cat
12801 pst
12802 !! wikitext
12803 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12804 !! html
12805 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12806 !! end
12807
12808 !! test
12809 Category / paragraph interactions
12810 !! wikitext
12811 Foo [[Category:Baz]] Bar
12812
12813 Foo [[Category:Baz]]
12814 Bar
12815
12816 Foo
12817 [[Category:Baz]]
12818 Bar
12819
12820 Foo
12821 [[Category:Baz]] Bar
12822
12823 Foo
12824 [[Category:Baz]]
12825 [[Category:Baz]]
12826 [[Category:Baz]]
12827 Bar
12828
12829 [[Category:Baz]]
12830 [[Category:Baz]]
12831 [[Category:Baz]]
12832
12833 [[Category:Baz]]
12834 {{echo|[[Category:Baz]]}}
12835 [[Category:Baz]]
12836 !! html
12837 <p>Foo Bar
12838 </p><p>Foo
12839 Bar
12840 </p><p>Foo
12841 Bar
12842 </p><p>Foo Bar
12843 </p><p>Foo
12844 Bar
12845 </p>
12846 !! end
12847
12848 !! test
12849 Parsoid: Serialize link to category page with colon escape
12850 !! options
12851 parsoid
12852 !! wikitext
12853
12854 [[:Category:Foo]]
12855 [[:Category:Foo|Bar]]
12856 !! html
12857 <p>
12858 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
12859 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
12860 </p>
12861 !! end
12862
12863 !! test
12864 Parsoid: Link prefix/suffixes aren't applied to category links
12865 !! options
12866 parsoid=wt2html,wt2wt,html2html
12867 language=is
12868 !! wikitext
12869 x[[Category:Foo]]y
12870 !! html
12871 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
12872 !! end
12873
12874 !! test
12875 Parsoid: Serialize link to file page with colon escape
12876 !! options
12877 parsoid
12878 !! wikitext
12879
12880 [[:File:Foo.png]]
12881 [[:File:Foo.png|Bar]]
12882 !! html
12883 <p>
12884 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
12885 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
12886 </p>
12887 !! end
12888
12889 !! test
12890 Parsoid: Serialize a genuine category link without colon escape
12891 !! options
12892 parsoid
12893 !! wikitext
12894 [[Category:Foo]]
12895 [[Category:Foo|Bar]]
12896 !! html
12897 <link rel="mw:PageProp/Category" href="Category:Foo">
12898 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
12899 !! end
12900
12901 !! test
12902 Normalize hrefs properly before testing for invalid link targets (bug 70894)
12903 !! options
12904 parsoid=html2wt
12905 !! html
12906 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
12907 !! wikitext
12908 [[Category:Toxine bactérienne]]
12909 !! end
12910
12911 !! test
12912 Parsoid: Defaultsort
12913 !! options
12914 parsoid
12915 !! wikitext
12916 {{DEFAULTSORT:Foo}}
12917 !! html
12918 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
12919 !! end
12920
12921 ###
12922 ### Inter-language links
12923 ###
12924 !! test
12925 Interlanguage links
12926 !! options
12927 ill
12928 !! wikitext
12929 [[es:Alimento]]
12930 [[fr:Nourriture]]
12931 [[zh:食品]]
12932 !! html/php
12933 es:Alimento fr:Nourriture zh:食品
12934 !! html/parsoid
12935 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
12936 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
12937 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
12938 !! end
12939
12940 !! test
12941 Duplicate interlanguage links (bug 24502)
12942 !! options
12943 ill
12944 !! wikitext
12945 [[es:1]]
12946 [[es:2]]
12947 [[fr:1]]
12948 [[fr:2]]
12949 !! html/php
12950 es:1 fr:1
12951 !! html/parsoid
12952 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
12953 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
12954 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
12955 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
12956 !! end
12957
12958 ###
12959 ### Sections
12960 ###
12961 !! test
12962 Basic section headings
12963 !! wikitext
12964 == Headline 1 ==
12965 Some text
12966
12967 ==Headline 2==
12968 More
12969 ===Smaller headline===
12970 Blah blah
12971 !! html
12972 <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>
12973 <p>Some text
12974 </p>
12975 <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>
12976 <p>More
12977 </p>
12978 <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>
12979 <p>Blah blah
12980 </p>
12981 !! end
12982
12983 !! test
12984 Section headings with TOC
12985 !! wikitext
12986 == Headline 1 ==
12987 === Subheadline 1 ===
12988 ===== Skipping a level =====
12989 ====== Skipping a level ======
12990
12991 == Headline 2 ==
12992 Some text
12993 ===Another headline===
12994 !! html
12995 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12996 <ul>
12997 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
12998 <ul>
12999 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
13000 <ul>
13001 <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>
13002 <ul>
13003 <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>
13004 </ul>
13005 </li>
13006 </ul>
13007 </li>
13008 </ul>
13009 </li>
13010 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
13011 <ul>
13012 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
13013 </ul>
13014 </li>
13015 </ul>
13016 </div>
13017
13018 <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>
13019 <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>
13020 <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>
13021 <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>
13022 <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>
13023 <p>Some text
13024 </p>
13025 <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>
13026
13027 !! end
13028
13029 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
13030 !! test
13031 Handling of sections up to level 6 and beyond
13032 !! wikitext
13033 = Level 1 Heading=
13034 == Level 2 Heading==
13035 === Level 3 Heading===
13036 ==== Level 4 Heading====
13037 ===== Level 5 Heading=====
13038 ====== Level 6 Heading======
13039 ======= Level 7 Heading=======
13040 ======== Level 8 Heading========
13041 ========= Level 9 Heading=========
13042 ========== Level 10 Heading==========
13043 !! html
13044 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13045 <ul>
13046 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
13047 <ul>
13048 <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>
13049 <ul>
13050 <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>
13051 <ul>
13052 <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>
13053 <ul>
13054 <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>
13055 <ul>
13056 <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>
13057 <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>
13058 <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>
13059 <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>
13060 <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>
13061 </ul>
13062 </li>
13063 </ul>
13064 </li>
13065 </ul>
13066 </li>
13067 </ul>
13068 </li>
13069 </ul>
13070 </li>
13071 </ul>
13072 </div>
13073
13074 <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>
13075 <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>
13076 <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>
13077 <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>
13078 <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>
13079 <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>
13080 <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>
13081 <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>
13082 <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>
13083 <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>
13084
13085 !! end
13086
13087 !! test
13088 TOC regression (bug 9764)
13089 !! wikitext
13090 == title 1 ==
13091 === title 1.1 ===
13092 ==== title 1.1.1 ====
13093 === title 1.2 ===
13094 == title 2 ==
13095 === title 2.1 ===
13096 !! html
13097 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13098 <ul>
13099 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13100 <ul>
13101 <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>
13102 <ul>
13103 <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>
13104 </ul>
13105 </li>
13106 <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>
13107 </ul>
13108 </li>
13109 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13110 <ul>
13111 <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>
13112 </ul>
13113 </li>
13114 </ul>
13115 </div>
13116
13117 <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>
13118 <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>
13119 <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>
13120 <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>
13121 <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>
13122 <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>
13123
13124 !! end
13125
13126 !! test
13127 TOC with wgMaxTocLevel=3 (bug 6204)
13128 !! options
13129 wgMaxTocLevel=3
13130 !! wikitext
13131 == title 1 ==
13132 === title 1.1 ===
13133 ==== title 1.1.1 ====
13134 === title 1.2 ===
13135 == title 2 ==
13136 === title 2.1 ===
13137 !! html
13138 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13139 <ul>
13140 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13141 <ul>
13142 <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>
13143 <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>
13144 </ul>
13145 </li>
13146 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13147 <ul>
13148 <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>
13149 </ul>
13150 </li>
13151 </ul>
13152 </div>
13153
13154 <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>
13155 <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>
13156 <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>
13157 <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>
13158 <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>
13159 <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>
13160
13161 !! end
13162
13163 !! test
13164 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
13165 !! options
13166 wgMaxTocLevel=3
13167 !! wikitext
13168 ==Section 1==
13169 ===Section 1.1===
13170 ====Section 1.1.1====
13171 ====Section 1.1.1.1====
13172 ==Section 2==
13173 !! html
13174 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13175 <ul>
13176 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
13177 <ul>
13178 <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>
13179 </ul>
13180 </li>
13181 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
13182 </ul>
13183 </div>
13184
13185 <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>
13186 <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>
13187 <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>
13188 <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>
13189 <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>
13190
13191 !! end
13192
13193
13194 !! test
13195 Resolving duplicate section names
13196 !! wikitext
13197 == Foo bar ==
13198 == Foo bar ==
13199 !! html
13200 <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>
13201 <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>
13202
13203 !! end
13204
13205 !! test
13206 Resolving duplicate section names with differing case (bug 10721)
13207 !! wikitext
13208 == Foo bar ==
13209 == Foo Bar ==
13210 !! html
13211 <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>
13212 <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>
13213
13214 !! end
13215
13216 !! article
13217 Template:sections
13218 !! text
13219 ===Section 1===
13220 ==Section 2==
13221 !! endarticle
13222
13223 !! test
13224 Template with sections, __NOTOC__
13225 !! wikitext
13226 __NOTOC__
13227 ==Section 0==
13228 {{sections}}
13229 ==Section 4==
13230 !! html
13231 <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>
13232 <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>
13233 <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>
13234 <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>
13235
13236 !! end
13237
13238 !! test
13239 __NOEDITSECTION__ keyword
13240 !! wikitext
13241 __NOEDITSECTION__
13242 ==Section 1==
13243 ==Section 2==
13244 !! html
13245 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
13246 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
13247
13248 !! end
13249
13250 !! test
13251 Link inside a section heading
13252 !! wikitext
13253 ==Section with a [[Main Page|link]] in it==
13254 !! html
13255 <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>
13256
13257 !! end
13258
13259 !! test
13260 TOC regression (bug 12077)
13261 !! wikitext
13262 __TOC__
13263 == title 1 ==
13264 === title 1.1 ===
13265 == title 2 ==
13266 !! html
13267 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13268 <ul>
13269 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13270 <ul>
13271 <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>
13272 </ul>
13273 </li>
13274 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13275 </ul>
13276 </div>
13277
13278 <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>
13279 <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>
13280 <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>
13281
13282 !! end
13283
13284 !! test
13285 BUG 1219 URL next to image (good)
13286 !! wikitext
13287 http://example.com [[Image:foobar.jpg]]
13288 !! html
13289 <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>
13290 </p>
13291 !!end
13292
13293 !! test
13294 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13295 !! wikitext
13296 ===
13297 The line above must have a trailing space!
13298 === <!--
13299 --> <!-- -->
13300 But just in case it doesn't...
13301 !! html
13302 <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>
13303 <p>The line above must have a trailing space!
13304 </p>
13305 <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>
13306 <p>But just in case it doesn't...
13307 </p>
13308 !! end
13309
13310 !! test
13311 Header with special characters (bug 25462)
13312 !! wikitext
13313 The tooltips shall not show entities to the user (ie. be double escaped)
13314
13315 == text > text ==
13316 section 1
13317
13318 == text < text ==
13319 section 2
13320
13321 == text & text ==
13322 section 3
13323
13324 == text ' text ==
13325 section 4
13326
13327 == text " text ==
13328 section 5
13329 !! html
13330 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13331 </p>
13332 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13333 <ul>
13334 <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>
13335 <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>
13336 <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>
13337 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13338 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13339 </ul>
13340 </div>
13341
13342 <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>
13343 <p>section 1
13344 </p>
13345 <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>
13346 <p>section 2
13347 </p>
13348 <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>
13349 <p>section 3
13350 </p>
13351 <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>
13352 <p>section 4
13353 </p>
13354 <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>
13355 <p>section 5
13356 </p>
13357 !! end
13358
13359 !! test
13360 Header with space, plus and underscore as entity
13361 !! wikitext
13362 Id should not contain + for spaces
13363
13364 == Space between Text ==
13365 section 1
13366
13367 == Space-Entity&#32;between&#32;Text ==
13368 section 2
13369
13370 == Plus+between+Text ==
13371 section 3
13372
13373 == Plus-Entity&#43;between&#43;Text ==
13374 section 4
13375
13376 == Underscore_between_Text ==
13377 section 5
13378
13379 == Underscore-Entity&#95;between&#95;Text ==
13380 section 6
13381
13382 [[#Space between Text]]
13383 [[#Space-Entity&#32;between&#32;Text]]
13384 [[#Plus+between+Text]]
13385 [[#Plus-Entity&#43;between&#43;Text]]
13386 [[#Underscore_between_Text]]
13387 [[#Underscore-Entity&#95;between&#95;Text]]
13388 !! html
13389 <p>Id should not contain + for spaces
13390 </p>
13391 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13392 <ul>
13393 <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>
13394 <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>
13395 <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>
13396 <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>
13397 <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>
13398 <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>
13399 </ul>
13400 </div>
13401
13402 <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>
13403 <p>section 1
13404 </p>
13405 <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>
13406 <p>section 2
13407 </p>
13408 <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>
13409 <p>section 3
13410 </p>
13411 <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>
13412 <p>section 4
13413 </p>
13414 <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>
13415 <p>section 5
13416 </p>
13417 <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>
13418 <p>section 6
13419 </p><p><a href="#Space_between_Text">#Space between Text</a>
13420 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
13421 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
13422 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
13423 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
13424 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
13425 </p>
13426 !! end
13427
13428 !! test
13429 Headers with excess '=' characters
13430 (Are similar tests necessary beyond the 1st level?)
13431 !! wikitext
13432 =foo==
13433 ==foo=
13434 =''italic'' heading==
13435 ==''italic'' heading=
13436 !! html
13437 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13438 <ul>
13439 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
13440 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
13441 <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>
13442 <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>
13443 </ul>
13444 </div>
13445
13446 <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>
13447 <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>
13448 <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>
13449 <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>
13450
13451 !! end
13452
13453 !! test
13454 HTML headers vs TOC (bug 23393)
13455 (__NOEDITSECTION__ for clearer output, doesn't matter here)
13456 !! wikitext
13457 <h1>Header 1</h1>
13458 == Header 1.1 ==
13459 == Header 1.2 ==
13460
13461 <h1>Header 2
13462 </h1>
13463 == Header 2.1 ==
13464 == Header 2.2 ==
13465 __NOEDITSECTION__
13466 !! html
13467 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13468 <ul>
13469 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
13470 <ul>
13471 <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>
13472 <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>
13473 </ul>
13474 </li>
13475 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
13476 <ul>
13477 <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>
13478 <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>
13479 </ul>
13480 </li>
13481 </ul>
13482 </div>
13483
13484 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
13485 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
13486 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
13487 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
13488 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
13489 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
13490
13491 !! end
13492
13493 !! test
13494 Single-line or multiline-comments can follow headings
13495 !! options
13496 parsoid=wt2html,wt2wt
13497 !! wikitext
13498 ==foo==<!---->
13499 ==bar==<!--c1-->
13500 ==baz==<!--
13501 c2
13502 c3-->
13503 !! html
13504 <h2><span class="mw-headline" id="foo">foo</span></h2>
13505 <h2><span class="mw-headline" id="bar">bar</span></h2>
13506 <h2><span class="mw-headline" id="baz">baz</span></h2>
13507
13508 !! end
13509
13510 !! test
13511 BUG 1219 URL next to image (broken)
13512 !! wikitext
13513 http://example.com[[Image:foobar.jpg]]
13514 !! html
13515 <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>
13516 </p>
13517 !!end
13518
13519 !! test
13520 Bug 1186 news: in the middle of text
13521 !! wikitext
13522 http://en.wikinews.org/wiki/Wikinews:Workplace
13523 !! html
13524 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
13525 </p>
13526 !!end
13527
13528
13529 !! test
13530 Namespaced link must have a title
13531 !! wikitext
13532 [[Project:]]
13533 !! html
13534 <p>[[Project:]]
13535 </p>
13536 !!end
13537
13538 !! test
13539 Namespaced link must have a title (bad fragment version)
13540 !! wikitext
13541 [[Project:#fragment]]
13542 !! html
13543 <p>[[Project:#fragment]]
13544 </p>
13545 !!end
13546
13547
13548 ###
13549 ### HTML tags and HTML attributes
13550 ###
13551
13552 !! test
13553 div with no attributes
13554 !! wikitext
13555 <div>HTML rocks</div>
13556 !! html
13557 <div>HTML rocks</div>
13558
13559 !! end
13560
13561 !! test
13562 div with double-quoted attribute
13563 !! wikitext
13564 <div id="rock">HTML rocks</div>
13565 !! html
13566 <div id="rock">HTML rocks</div>
13567
13568 !! end
13569
13570 !! test
13571 div with single-quoted attribute
13572 !! wikitext
13573 <div id='rock'>HTML rocks</div>
13574 !! html
13575 <div id="rock">HTML rocks</div>
13576
13577 !! end
13578
13579 !! test
13580 div with unquoted attribute
13581 !! wikitext
13582 <div id=rock>HTML rocks</div>
13583 !! html
13584 <div id="rock">HTML rocks</div>
13585
13586 !! end
13587
13588 !! test
13589 div with illegal double attributes
13590 !! wikitext
13591 <div id="a" id="b">HTML rocks</div>
13592 !! html
13593 <div id="b">HTML rocks</div>
13594
13595 !!end
13596
13597 # FIXME: produce empty string instead of "class" in the PHP parser, following
13598 # the HTML5 spec.
13599 !! test
13600 div with empty attribute value, space before equals
13601 !! options
13602 parsoid
13603 !! wikitext
13604 <div class =>HTML rocks</div>
13605 !! html
13606 <div class="">HTML rocks</div>
13607
13608 !! end
13609
13610 !! test
13611 div with multiple empty attribute values
13612 !! options
13613 parsoid
13614 !! wikitext
13615 <div id= title=>HTML rocks</div>
13616 !! html
13617 <div id="" title="">HTML rocks</div>
13618
13619 !! end
13620
13621 !! test
13622 table with multiple empty attribute values
13623 !! options
13624 parsoid
13625 !! wikitext
13626 {| title= id=
13627 | hi
13628 |}
13629 !! html
13630 <table title="" id="">
13631 <tbody><tr><td> hi</td></tr>
13632 </tbody></table>
13633 !! end
13634
13635 !! test
13636 div with braces in attribute value
13637 !! wikitext
13638 <div title="{}">Foo</div>
13639 !! html/php
13640 <div title="&#123;}">Foo</div>
13641
13642 !! html/parsoid
13643 <div title="{}">Foo</div>
13644 !! end
13645
13646 # This it very inconsistent in the PHP parser: it returns
13647 # class="class" if there is a space between the name and the equal sign (see
13648 # 'div with empty attribute value, space before equals'), but strips the
13649 # attribute completely if the space is missing. We hope that not much content
13650 # depends on this, so are implementing the behavior below in Parsoid for
13651 # consistencies' sake.
13652 # FIXME: fix this behavior in the PHP parser?
13653 !! test
13654 div with empty attribute value, no space before equals
13655 !! options
13656 parsoid=wt2html,html2html
13657 !! wikitext
13658 <div class=>HTML rocks</div>
13659 !! html/php
13660 <div>HTML rocks</div>
13661
13662 !! html/parsoid
13663 <div class="">HTML rocks</div>
13664 !! end
13665
13666 !! test
13667 HTML multiple attributes correction
13668 !! wikitext
13669 <p class="error" class="awesome">Awesome!</p>
13670 !! html
13671 <p class="awesome">Awesome!</p>
13672
13673 !!end
13674
13675 !! test
13676 Table multiple attributes correction
13677 !! wikitext
13678 {|
13679 !+ class="error" class="awesome"| status
13680 |}
13681 !! html
13682 <table>
13683 <tr>
13684 <th class="awesome"> status
13685 </th></tr></table>
13686
13687 !!end
13688
13689 !! test
13690 DIV IN UPPERCASE
13691 !! wikitext
13692 <DIV ID="x">HTML ROCKS</DIV>
13693 !! html
13694 <div id="x">HTML ROCKS</div>
13695
13696 !!end
13697
13698 !! test
13699 Non-ASCII pseudo-tags are rendered as text
13700 !! wikitext
13701 <khyô>
13702 !! html
13703 <p>&lt;khyô&gt;
13704 </p>
13705 !! end
13706
13707 !! test
13708 Pseudo-tag with URL 'name' renders as url link
13709 !! wikitext
13710 <http://example.com/>
13711 !! html
13712 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
13713 </p>
13714 !! end
13715
13716 !! test
13717 text with amp in the middle of nowhere
13718 !! wikitext
13719 Remember AT&T?
13720 !! html
13721 <p>Remember AT&amp;T?
13722 </p>
13723 !! end
13724
13725 !! test
13726 text with character entity: eacute
13727 !! wikitext
13728 I always thought &eacute; was a cute letter.
13729 !! html
13730 <p>I always thought &#233; was a cute letter.
13731 </p>
13732 !! html+tidy
13733 <p>I always thought é was a cute letter.</p>
13734 !! end
13735
13736 !! test
13737 text with entity-escaped character entity-like string: eacute
13738 !! wikitext
13739 I always thought &amp;eacute; was a cute letter.
13740 !! html
13741 <p>I always thought &amp;eacute; was a cute letter.
13742 </p>
13743 !! end
13744
13745 !! test
13746 text with undefined character entity: xacute
13747 !! wikitext
13748 I always thought &xacute; was a cute letter.
13749 !! html
13750 <p>I always thought &amp;xacute; was a cute letter.
13751 </p>
13752 !! end
13753
13754 # TODO: generalize to PHP parser?
13755 !! test
13756 HTML5 tags
13757 !! options
13758 parsoid
13759 !! wikitext
13760 <data value="5">five</data>
13761 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13762 <mark>This highlighted text</mark>
13763 !! html
13764 <p><data value="5">five</data>
13765 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13766 <mark>This highlighted text</mark></p>
13767 !! end
13768
13769 !! test
13770 HTML tag with leading space is parsed as text
13771 !! wikitext
13772 < div>foo< /div>
13773 !! html
13774 <p>&lt; div&gt;foo&lt; /div&gt;
13775 </p>
13776 !! end
13777
13778 ###
13779 ### Nesting tests (see bug 41545, 50604, 51081)
13780 ###
13781
13782 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
13783 # Note that html2wt is considerably more difficult if we use <b> in
13784 # the test case, instead of <big>
13785 !! test
13786 Ensure that HTML adoption agency algorithm is properly implemented.
13787 !! wikitext
13788 <big>X<big>Y</big>Z</big>
13789 !! html
13790 <p><big>X<big>Y</big>Z</big>
13791 </p>
13792 !! end
13793
13794 # This was bug 41545 in the PHP parser.
13795 # Note that tidy doesn't handle this correctly.
13796 !! test
13797 Nesting of <kbd>
13798 !! wikitext
13799 <kbd>X<kbd>Y</kbd>Z</kbd>
13800 !! html
13801 <p><kbd>X<kbd>Y</kbd>Z</kbd>
13802 </p>
13803 !! end
13804
13805 # The following cases were bug 51081 in the PHP parser.
13806 # Note that there are some other nestable tags (b, i, etc) which are
13807 # not covered; see bug 51081 for discussion.
13808
13809 # Note that tidy doesn't handle this correctly.
13810 !! test
13811 Nesting of <em>
13812 !! wikitext
13813 <em>X<em>Y</em>Z</em>
13814 !! html
13815 <p><em>X<em>Y</em>Z</em>
13816 </p>
13817 !! end
13818
13819 # Note that tidy doesn't handle this correctly.
13820 !! test
13821 Nesting of <strong>
13822 !! wikitext
13823 <strong>X<strong>Y</strong>Z</strong>
13824 !! html
13825 <p><strong>X<strong>Y</strong>Z</strong>
13826 </p>
13827 !! end
13828
13829 !! test
13830 Nesting of <q>
13831 !! wikitext
13832 <q>X<q>Y</q>Z</q>
13833 !! html+tidy
13834 <p><q>X<q>Y</q>Z</q></p>
13835 !! end
13836
13837 # Note that tidy doesn't handle this correctly.
13838 !! test
13839 Nesting of <ruby>
13840 !! wikitext
13841 <ruby>X<ruby>Y</ruby>Z</ruby>
13842 !! html
13843 <p><ruby>X<ruby>Y</ruby>Z</ruby>
13844 </p>
13845 !! end
13846
13847 # Note that tidy doesn't handle this correctly.
13848 !! test
13849 Nesting of <bdo>
13850 !! wikitext
13851 <bdo>X<bdo>Y</bdo>Z</bdo>
13852 !! html
13853 <p><bdo>X<bdo>Y</bdo>Z</bdo>
13854 </p>
13855 !! end
13856
13857
13858 ###
13859 ### Media links
13860 ###
13861
13862 !! test
13863 Media link
13864 !! wikitext
13865 [[Media:Foobar.jpg]]
13866 !! html
13867 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
13868 </p>
13869 !! end
13870
13871 !! test
13872 Media link with text
13873 !! wikitext
13874 [[Media:Foobar.jpg|A neat file to look at]]
13875 !! html
13876 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
13877 </p>
13878 !! end
13879
13880 # FIXME: this is still bad HTML tag nesting
13881 !! test
13882 Media link with nasty text
13883 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
13884 !! wikitext
13885 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
13886 !! html
13887 <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>
13888
13889 !! html+tidy
13890 <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>
13891 !! end
13892
13893 !! test
13894 Media link to nonexistent file (bug 1702)
13895 !! wikitext
13896 [[Media:No such.jpg]]
13897 !! html
13898 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
13899 </p>
13900 !! end
13901
13902 !! test
13903 Image link to nonexistent file (bug 1850 - good)
13904 !! wikitext
13905 [[File:No_such.jpg]]
13906 !! html/php
13907 <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>
13908 </p>
13909 !! html/parsoid
13910 <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>
13911 !! end
13912
13913 !! test
13914 :Image link to nonexistent file (bug 1850 - bad)
13915 !! wikitext
13916 [[:Image:No such.jpg]]
13917 !! html/php
13918 <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>
13919 </p>
13920 !! html/parsoid
13921 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
13922 !! end
13923
13924
13925
13926 !! test
13927 Character reference normalization in link text (bug 1938)
13928 !! wikitext
13929 [[Main Page|this&that]]
13930 !! html
13931 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
13932 </p>
13933 !!end
13934
13935 !! article
13936 אַ
13937 !! text
13938 Test for unicode normalization
13939
13940 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
13941 !! endarticle
13942
13943 !! test
13944 (bug 19451) Links should refer to the normalized form.
13945 !! wikitext
13946 [[&#xFB2E;]]
13947 [[&#x5d0;&#x5b7;]]
13948 [[&#x5d0;ַ]]
13949 [[א&#x5b7;]]
13950 [[אַ]]
13951 !! html
13952 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
13953 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
13954 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
13955 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
13956 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
13957 </p>
13958 !! end
13959
13960 !! test
13961 Empty attribute crash test (bug 2067)
13962 !! wikitext
13963 <font color="">foo</font>
13964 !! html
13965 <p><font color="">foo</font>
13966 </p>
13967 !! end
13968
13969 !! test
13970 Empty attribute crash test single-quotes (bug 2067)
13971 !! wikitext
13972 <font color=''>foo</font>
13973 !! html
13974 <p><font color="">foo</font>
13975 </p>
13976 !! end
13977
13978 !! test
13979 Attribute test: equals, then nothing
13980 !! wikitext
13981 <font color=>foo</font>
13982 !! html
13983 <p><font>foo</font>
13984 </p>
13985 !! end
13986
13987 !! test
13988 Attribute test: unquoted value
13989 !! wikitext
13990 <font color=x>foo</font>
13991 !! html
13992 <p><font color="x">foo</font>
13993 </p>
13994 !! end
13995
13996 !! test
13997 Attribute test: unquoted but illegal value (hash)
13998 !! wikitext
13999 <font color=#x>foo</font>
14000 !! html
14001 <p><font color="#x">foo</font>
14002 </p>
14003 !! end
14004
14005 !! test
14006 Attribute test: no value
14007 !! wikitext
14008 <font color>foo</font>
14009 !! html
14010 <p><font color="color">foo</font>
14011 </p>
14012 !! end
14013
14014 !! test
14015 Bug 2095: link with three closing brackets
14016 !! wikitext
14017 [[Main Page]]]
14018 !! html/php
14019 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
14020 </p>
14021 !! html/parsoid
14022 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
14023 !! end
14024
14025 !! test
14026 Bug 2095: link with pipe and three closing brackets
14027 !! wikitext
14028 [[Main Page|link]]]
14029 !! html/php
14030 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
14031 </p>
14032 !! html/parsoid
14033 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
14034 !! end
14035
14036 !! test
14037 Bug 2095: link with pipe and three closing brackets, version 2
14038 !! wikitext
14039 [[Main Page|[http://example.com/]]]
14040 !! html/php
14041 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
14042 </p>
14043 !! html/parsoid
14044 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
14045 !! end
14046
14047
14048 ###
14049 ### Safety
14050 ###
14051
14052 !! article
14053 Template:Dangerous attribute
14054 !! text
14055 " onmouseover="alert(document.cookie)
14056 !! endarticle
14057
14058 !! article
14059 Template:Dangerous style attribute
14060 !! text
14061 border-size: expression(alert(document.cookie))
14062 !! endarticle
14063
14064 !! article
14065 Template:Div style
14066 !! text
14067 <div style="float: right; {{{1}}}">Magic div</div>
14068 !! endarticle
14069
14070 !! test
14071 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
14072 !! wikitext
14073 <div title="{{test}}"></div>
14074 !! html
14075 <div title="This is a test template"></div>
14076
14077 !! end
14078
14079 # Parsoid has enough context to handle this case
14080 !! test
14081 Bug 2304: HTML attribute safety (dangerous template; 2309)
14082 !! wikitext
14083 <div title="{{dangerous attribute}}"></div>
14084 !! html/php
14085 <div title=""></div>
14086
14087 !! html/parsoid
14088 <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>
14089 !! end
14090
14091 !! test
14092 Bug 2304: HTML attribute safety (dangerous style template; 2309)
14093 !! wikitext
14094 <div style="{{dangerous style attribute}}"></div>
14095 !! html
14096 <div style="/* insecure input */"></div>
14097
14098 !! end
14099
14100 !! test
14101 Bug 2304: HTML attribute safety (safe parameter; 2309)
14102 !! wikitext
14103 {{div style|width: 200px}}
14104 !! html
14105 <div style="float: right; width: 200px">Magic div</div>
14106
14107 !! end
14108
14109 !! test
14110 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
14111 !! wikitext
14112 {{div style|width: expression(alert(document.cookie))}}
14113 !! html
14114 <div style="/* insecure input */">Magic div</div>
14115
14116 !! end
14117
14118 !! test
14119 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
14120 !! wikitext
14121 {{div style|"><script>alert(document.cookie)</script>}}
14122 !! html
14123 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14124
14125 !! end
14126
14127 !! test
14128 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
14129 !! wikitext
14130 {{div style|" ><script>alert(document.cookie)</script>}}
14131 !! html
14132 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14133
14134 !! end
14135
14136 !! test
14137 Bug 2304: HTML attribute safety (link)
14138 !! wikitext
14139 <div title="[[Main Page]]"></div>
14140 !! html
14141 <div title="&#91;&#91;Main Page]]"></div>
14142
14143 !! end
14144
14145 !! test
14146 Bug 2304: HTML attribute safety (italics)
14147 !! wikitext
14148 <div title="''foobar''"></div>
14149 !! html
14150 <div title="&#39;&#39;foobar&#39;&#39;"></div>
14151
14152 !! end
14153
14154 !! test
14155 Bug 2304: HTML attribute safety (bold)
14156 !! wikitext
14157 <div title="'''foobar'''"></div>
14158 !! html
14159 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
14160
14161 !! end
14162
14163
14164 !! test
14165 Bug 2304: HTML attribute safety (ISBN)
14166 !! wikitext
14167 <div title="ISBN 1234567890"></div>
14168 !! html
14169 <div title="&#73;SBN 1234567890"></div>
14170
14171 !! end
14172
14173 !! test
14174 Bug 2304: HTML attribute safety (RFC)
14175 !! wikitext
14176 <div title="RFC 1234"></div>
14177 !! html
14178 <div title="&#82;FC 1234"></div>
14179
14180 !! end
14181
14182 !! test
14183 Bug 2304: HTML attribute safety (PMID)
14184 !! wikitext
14185 <div title="PMID 1234567890"></div>
14186 !! html
14187 <div title="&#80;MID 1234567890"></div>
14188
14189 !! end
14190
14191 !! test
14192 Bug 2304: HTML attribute safety (web link)
14193 !! wikitext
14194 <div title="http://example.com/"></div>
14195 !! html
14196 <div title="http&#58;//example.com/"></div>
14197
14198 !! end
14199
14200 !! test
14201 Bug 2304: HTML attribute safety (named web link)
14202 !! wikitext
14203 <div title="[http://example.com/ link]"></div>
14204 !! html
14205 <div title="&#91;http&#58;//example.com/ link]"></div>
14206
14207 !! end
14208
14209 !! test
14210 Bug 3244: HTML attribute safety (extension; safe)
14211 !! wikitext
14212 <div style="<nowiki>background:blue</nowiki>"></div>
14213 !! html
14214 <div style="background:blue"></div>
14215
14216 !! end
14217
14218 !! test
14219 Bug 3244: HTML attribute safety (extension; unsafe)
14220 !! wikitext
14221 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14222 !! html
14223 <div style="/* insecure input */"></div>
14224
14225 !! end
14226
14227 # More MSIE fun discovered by Tom Gilder
14228
14229 !! test
14230 MSIE CSS safety test: spurious slash
14231 !! wikitext
14232 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14233 !! html
14234 <div style="/* insecure input */">evil</div>
14235
14236 !! end
14237
14238 !! test
14239 MSIE CSS safety test: hex code
14240 !! wikitext
14241 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14242 !! html
14243 <div style="/* insecure input */">evil</div>
14244
14245 !! end
14246
14247 !! test
14248 MSIE CSS safety test: comment in url
14249 !! wikitext
14250 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14251 !! html
14252 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14253
14254 !! end
14255
14256 !! test
14257 MSIE CSS safety test: comment in expression
14258 !! wikitext
14259 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14260 !! html
14261 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14262
14263 !! end
14264
14265 !! test
14266 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14267 !! wikitext
14268 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14269 !! html
14270 <p style="/* invalid control char */">A</p>
14271
14272 !! end
14273
14274 !! test
14275 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14276 !! wikitext
14277 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14278 <div style="top:EXPRESSION(alert())">B</div>
14279 !! html
14280 <p style="/* insecure input */">A</p>
14281 <div style="/* insecure input */">B</div>
14282
14283 !! end
14284
14285 !! test
14286 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14287 !! wikitext
14288 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14289 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14290 !! html
14291 <div style="/* insecure input */">A</div>
14292 <p style="/* insecure input */">B</p>
14293
14294 !! end
14295
14296 !! test
14297 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14298 !! wikitext
14299 <div style="background-image:url⁽javascript:alert())">A</div>
14300 <div style="background-image:url₍javascript:alert())">B</div>
14301 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14302 !! html
14303 <div style="/* insecure input */">A</div>
14304 <div style="/* insecure input */">B</div>
14305 <p style="/* insecure input */">C</p>
14306
14307 !! end
14308
14309 !! test
14310 Opera -o-link CSS
14311 !! wikitext
14312 <div
14313 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;"
14314 style="-o-link:attr(title);-o-link-source:current">X</div>
14315 !! html
14316 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14317
14318 !! end
14319
14320 !! test
14321 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14322 !! wikitext
14323 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14324 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14325 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14326 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14327 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14328 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14329 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14330 !! html
14331 <p style="/* insecure input */">A</p>
14332 <p style="/* insecure input */">B</p>
14333 <p style="/* insecure input */">C</p>
14334 <p style="/* insecure input */">D</p>
14335 <p style="/* insecure input */">E</p>
14336 <p style="/* insecure input */">F</p>
14337 <p style="/* insecure input */">G</p>
14338
14339 !! end
14340
14341 !! test
14342 Table attribute legitimate extension
14343 !! wikitext
14344 {|
14345 !+ style="<nowiki>color:blue</nowiki>"| status
14346 |}
14347 !! html
14348 <table>
14349 <tr>
14350 <th style="color:blue"> status
14351 </th></tr></table>
14352
14353 !!end
14354
14355 !! test
14356 Table attribute safety
14357 !! wikitext
14358 {|
14359 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14360 |}
14361 !! html
14362 <table>
14363 <tr>
14364 <th style="/* insecure input */"> status
14365 </th></tr></table>
14366
14367 !! end
14368
14369 !! test
14370 CSS line continuation 1
14371 !! wikitext
14372 <div style="background-image: u\&#10;rl(test.jpg);"></div>
14373 !! html
14374 <div style="/* insecure input */"></div>
14375
14376 !! end
14377
14378 !! test
14379 CSS line continuation 2
14380 !! wikitext
14381 <div style="background-image: u\&#13;rl(test.jpg); "></div>
14382 !! html
14383 <div style="/* insecure input */"></div>
14384
14385 !! end
14386
14387 !! article
14388 Template:Identity
14389 !! text
14390 {{{1}}}
14391 !! endarticle
14392
14393 !! test
14394 Expansion of multi-line templates in attribute values (bug 6255)
14395 !! wikitext
14396 <div style="background: {{identity|#00FF00}}">-</div>
14397 !! html
14398 <div style="background: #00FF00">-</div>
14399
14400 !! end
14401
14402
14403 !! test
14404 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
14405 !! wikitext
14406 <div style="background:
14407 #00FF00">-</div>
14408 !! html/php
14409 <div style="background: #00FF00">-</div>
14410
14411 !! html/parsoid
14412 <div style="background:
14413 #00FF00">-</div>
14414 !! end
14415
14416 !! test
14417 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
14418 !! wikitext
14419 <div style="background: &#10;#00FF00">-</div>
14420 !! html
14421 <div style="background: &#10;#00FF00">-</div>
14422
14423 !! end
14424
14425 !! test
14426 evil <math>-wiki-tags without Extension:Math enabled
14427 !! wikitext
14428 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
14429 !! html+tidy
14430 <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>
14431 !! end
14432
14433 ###
14434 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
14435 ###
14436 !! test
14437 Parser hook: empty input
14438 !! wikitext
14439 <tag></tag>
14440 !! html
14441 <pre>
14442 ''
14443 array (
14444 )
14445 </pre>
14446
14447 !! end
14448
14449 !! test
14450 Parser hook: empty input using terminated empty elements
14451 !! wikitext
14452 <tag/>
14453 !! html
14454 <pre>
14455 NULL
14456 array (
14457 )
14458 </pre>
14459
14460 !! end
14461
14462 !! test
14463 Parser hook: empty input using terminated empty elements (space before)
14464 !! wikitext
14465 <tag />
14466 !! html
14467 <pre>
14468 NULL
14469 array (
14470 )
14471 </pre>
14472
14473 !! end
14474
14475 !! test
14476 Parser hook: basic input
14477 !! wikitext
14478 <tag>input</tag>
14479 !! html
14480 <pre>
14481 'input'
14482 array (
14483 )
14484 </pre>
14485
14486 !! end
14487
14488
14489 !! test
14490 Parser hook: case insensitive
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, redux
14505 !! wikitext
14506 <TaG>input</TAg>
14507 !! html
14508 <pre>
14509 'input'
14510 array (
14511 )
14512 </pre>
14513
14514 !! end
14515
14516 !! test
14517 Parser hook: nested tags
14518 !! options
14519 noxml
14520 !! wikitext
14521 <tag><tag></tag></tag>
14522 !! html
14523 <pre>
14524 '<tag>'
14525 array (
14526 )
14527 </pre>&lt;/tag&gt;
14528
14529 !! end
14530
14531 !! test
14532 Parser hook: basic arguments
14533 !! wikitext
14534 <tag width=200 height = "100" depth = '50' square></tag>
14535 !! html
14536 <pre>
14537 ''
14538 array (
14539 'width' => '200',
14540 'height' => '100',
14541 'depth' => '50',
14542 'square' => 'square',
14543 )
14544 </pre>
14545
14546 !! end
14547
14548 !! test
14549 Parser hook: argument containing a forward slash (bug 5344)
14550 !! wikitext
14551 <tag filename='/tmp/bla'></tag>
14552 !! html
14553 <pre>
14554 ''
14555 array (
14556 'filename' => '/tmp/bla',
14557 )
14558 </pre>
14559
14560 !! end
14561
14562 !! test
14563 Parser hook: empty input using terminated empty elements (bug 2374)
14564 !! wikitext
14565 <tag foo=bar/>text
14566 !! html
14567 <pre>
14568 NULL
14569 array (
14570 'foo' => 'bar',
14571 )
14572 </pre>text
14573
14574 !! end
14575
14576 # </tag> should be output literally since there is no matching tag that begins it
14577 !! test
14578 Parser hook: basic arguments using terminated empty elements (bug 2374)
14579 !! wikitext
14580 <tag width=200 height = "100" depth = '50' square/>
14581 other stuff
14582 </tag>
14583 !! html
14584 <pre>
14585 NULL
14586 array (
14587 'width' => '200',
14588 'height' => '100',
14589 'depth' => '50',
14590 'square' => 'square',
14591 )
14592 </pre>
14593 <p>other stuff
14594 &lt;/tag&gt;
14595 </p>
14596 !! end
14597
14598 ###
14599 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14600 ###
14601
14602 !! test
14603 Parser hook: static parser hook not inside a comment
14604 !! wikitext
14605 <statictag>hello, world</statictag>
14606 <statictag action=flush/>
14607 !! html
14608 <p>hello, world
14609 </p>
14610 !! end
14611
14612
14613 !! test
14614 Parser hook: static parser hook inside a comment
14615 !! wikitext
14616 <!-- <statictag>hello, world</statictag> -->
14617 <statictag action=flush/>
14618 !! html
14619 <p><br />
14620 </p>
14621 !! end
14622
14623 # Nested template calls; this case was broken by Parser.php rev 1.506,
14624 # since reverted.
14625
14626 !! article
14627 Template:One-parameter
14628 !! text
14629 (My parameter is: {{{1}}})
14630 !! endarticle
14631
14632 !! article
14633 Template:Map-one-parameter
14634 !! text
14635 {{{{{1}}}|{{{2}}}}}
14636 !! endarticle
14637
14638 !! test
14639 Nested template calls
14640 !! wikitext
14641 {{Map-one-parameter|One-parameter|param}}
14642 !! html
14643 <p>(My parameter is: param)
14644 </p>
14645 !! end
14646
14647
14648 ###
14649 ### Sanitizer
14650 ###
14651
14652 # HTML+Tidy effectively strips out the empty tags completely
14653 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
14654 # which Tidy would have done for the PHP parser had there been content inside it.
14655 !! test
14656 Sanitizer: Closing of open tags
14657 !! wikitext
14658 <s></s><table></table>
14659 !! html
14660 <s></s><table></table>
14661
14662 !! html/parsoid
14663 <p><s></s></p><table></table>
14664 !! end
14665
14666 !! test
14667 Sanitizer: Closing of open but not closed tags
14668 !! wikitext
14669 <s>foo
14670 !! html
14671 <p><s>foo</s>
14672 </p>
14673 !! end
14674
14675 !! test
14676 Sanitizer: Closing of closed but not open tags
14677 !! wikitext
14678 </s>
14679 !! html
14680 <p>&lt;/s&gt;
14681 </p>
14682 !! end
14683
14684 !! test
14685 Sanitizer: Closing of closed but not open table tags
14686 !! wikitext
14687 Table not started</td></tr></table>
14688 !! html
14689 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
14690 </p>
14691 !! end
14692
14693 !! test
14694 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
14695 !! wikitext
14696 <span id="æ: v">byte</span>[[#æ: v|backlink]]
14697 !! html
14698 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
14699 </p>
14700 !! end
14701
14702 # In HTML5, the restrictions are that id must contain at least one character,
14703 # and must not contain any space characters.
14704 !! test
14705 Sanitizer: Validating the contents of the id attribute (bug 4515)
14706 !! options
14707 disabled
14708 !! wikitext
14709 <br id="" /><br id="a space" />
14710 !! html
14711 Something ...
14712 !! end
14713
14714 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
14715 !! test
14716 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
14717 !! options
14718 disabled
14719 !! wikitext
14720 <br id="foo" /><br id="foo" />
14721 !! html
14722 Something need to be done. foo-2 ?
14723 !! end
14724
14725 !! test
14726 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
14727 !! wikitext
14728 <div itemscope>
14729 <meta itemprop="hello" content="world">
14730 <meta http-equiv="refresh" content="5">
14731 <meta itemprop="hello" http-equiv="refresh" content="5">
14732 <link itemprop="hello" href="{{SERVER}}">
14733 <link rel="stylesheet" href="{{SERVER}}">
14734 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
14735 </div>
14736 !! html
14737 <div itemscope="itemscope">
14738 <p> <meta itemprop="hello" content="world" />
14739 &lt;meta http-equiv="refresh" content="5"&gt;
14740 <meta itemprop="hello" content="5" />
14741 </p>
14742 <link itemprop="hello" href="http&#58;//example.org" />
14743 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
14744 <link itemprop="hello" href="http&#58;//example.org" />
14745 </div>
14746
14747 !! end
14748
14749 !! test
14750 Language converter: output gets cut off unexpectedly (bug 5757)
14751 !! options
14752 language=zh
14753 !! wikitext
14754 this bit is safe: }-
14755
14756 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
14757
14758 then we get cut off here: }-
14759
14760 all additional text is vanished
14761 !! html
14762 <p>this bit is safe: }-
14763 </p><p>but if we add a conversion instance: xxx
14764 </p><p>then we get cut off here: }-
14765 </p><p>all additional text is vanished
14766 </p>
14767 !! end
14768
14769 !! test
14770 Self closed html pairs (bug 5487)
14771 !! options
14772 !! wikitext
14773 <center><font id="bug" />Centered text</center>
14774 <div><font id="bug2" />In div text</div>
14775 !! html
14776 <center>&lt;font id="bug" /&gt;Centered text</center>
14777 <div>&lt;font id="bug2" /&gt;In div text</div>
14778
14779 !! end
14780
14781 #
14782 #
14783 #
14784
14785 !! test
14786 Punctuation: nbsp before exclamation
14787 !! wikitext
14788 C'est grave !
14789 !! html
14790 <p>C'est grave&#160;!
14791 </p>
14792 !! end
14793
14794 !! test
14795 Punctuation: CSS !important (bug 11874)
14796 !! wikitext
14797 <div style="width:50% !important">important</div>
14798 !! html
14799 <div style="width:50% !important">important</div>
14800
14801 !!end
14802
14803 !! test
14804 Punctuation: CSS ! important (bug 11874; with space after)
14805 !! wikitext
14806 <div style="width:50% ! important">important</div>
14807 !! html
14808 <div style="width:50% ! important">important</div>
14809
14810 !!end
14811
14812
14813 !! test
14814 HTML bullet list, closed tags (bug 5497)
14815 !! wikitext
14816 <ul>
14817 <li>One</li>
14818 <li>Two</li>
14819 </ul>
14820 !! html/php
14821 <ul>
14822 <li>One</li>
14823 <li>Two</li>
14824 </ul>
14825
14826 !! html/parsoid
14827 <ul data-parsoid='{"stx":"html"}'>
14828 <li data-parsoid='{"stx":"html"}'>One</li>
14829 <li data-parsoid='{"stx":"html"}'>Two</li>
14830 </ul>
14831
14832 !! end
14833
14834 !! test
14835 HTML bullet list, unclosed tags (bug 5497)
14836 !! wikitext
14837 <ul>
14838 <li>One
14839 <li>Two
14840 </ul>
14841 !! html/php+tidy
14842 <ul>
14843 <li>One</li>
14844 <li>Two</li>
14845 </ul>
14846 !! html/parsoid
14847 <ul data-parsoid='{"stx":"html"}'>
14848 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
14849 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
14850 </ul>
14851
14852 !! end
14853
14854 !! test
14855 HTML ordered list, closed tags (bug 5497)
14856 !! wikitext
14857 <ol>
14858 <li>One</li>
14859 <li>Two</li>
14860 </ol>
14861 !! html/php
14862 <ol>
14863 <li>One</li>
14864 <li>Two</li>
14865 </ol>
14866
14867 !! html/parsoid
14868 <ol data-parsoid='{"stx":"html"}'>
14869 <li data-parsoid='{"stx":"html"}'>One</li>
14870 <li data-parsoid='{"stx":"html"}'>Two</li>
14871 </ol>
14872
14873 !! end
14874
14875 !! test
14876 HTML ordered list, unclosed tags (bug 5497)
14877 !! options
14878 !! wikitext
14879 <ol>
14880 <li>One
14881 <li>Two
14882 </ol>
14883 !! html/php+tidy
14884 <ol>
14885 <li>One</li>
14886 <li>Two</li>
14887 </ol>
14888 !! html/parsoid
14889 <ol data-parsoid='{"stx":"html"}'>
14890 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
14891 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
14892 </ol>
14893
14894 !! end
14895
14896 !! test
14897 HTML nested bullet list, closed tags (bug 5497)
14898 !! wikitext
14899 <ul>
14900 <li>One</li>
14901 <li>Two:
14902 <ul>
14903 <li>Sub-one</li>
14904 <li>Sub-two</li>
14905 </ul>
14906 </li>
14907 </ul>
14908 !! html
14909 <ul>
14910 <li>One</li>
14911 <li>Two:
14912 <ul>
14913 <li>Sub-one</li>
14914 <li>Sub-two</li>
14915 </ul>
14916 </li>
14917 </ul>
14918
14919 !! end
14920
14921 !! test
14922 HTML nested bullet list, open tags (bug 5497)
14923 !! wikitext
14924 <ul>
14925 <li>One
14926 <li>Two:
14927 <ul>
14928 <li>Sub-one
14929 <li>Sub-two
14930 </ul>
14931 </ul>
14932 !! html/php+tidy
14933 <ul>
14934 <li>One</li>
14935 <li>Two:
14936 <ul>
14937 <li>Sub-one</li>
14938 <li>Sub-two</li>
14939 </ul>
14940 </li>
14941 </ul>
14942 !! html/parsoid
14943 <ul>
14944 <li>One
14945 </li>
14946 <li>Two:
14947 <ul>
14948 <li>Sub-one
14949 </li>
14950 <li>Sub-two
14951 </li>
14952 </ul>
14953 </li>
14954 </ul>
14955
14956 !! end
14957
14958 !! test
14959 HTML nested ordered list, closed tags (bug 5497)
14960 !! wikitext
14961 <ol>
14962 <li>One</li>
14963 <li>Two:
14964 <ol>
14965 <li>Sub-one</li>
14966 <li>Sub-two</li>
14967 </ol>
14968 </li>
14969 </ol>
14970 !! html
14971 <ol>
14972 <li>One</li>
14973 <li>Two:
14974 <ol>
14975 <li>Sub-one</li>
14976 <li>Sub-two</li>
14977 </ol>
14978 </li>
14979 </ol>
14980
14981 !! end
14982
14983 !! test
14984 HTML nested ordered list, open tags (bug 5497)
14985 !! wikitext
14986 <ol>
14987 <li>One
14988 <li>Two:
14989 <ol>
14990 <li>Sub-one
14991 <li>Sub-two
14992 </ol>
14993 </ol>
14994 !! html/php
14995 <ol>
14996 <li>One
14997 <li>Two:
14998 <ol>
14999 <li>Sub-one
15000 <li>Sub-two
15001 </ol>
15002 </ol>
15003
15004 !! html/parsoid
15005 <ol>
15006 <li>One
15007 </li>
15008 <li>Two:
15009 <ol>
15010 <li>Sub-one
15011 </li>
15012 <li>Sub-two
15013 </li>
15014 </ol>
15015 </li>
15016 </ol>
15017
15018 !! end
15019
15020 !! test
15021 HTML ordered list item with parameters oddity
15022 !! wikitext
15023 <ol><li id="fragment">One</li>
15024 </ol>
15025 !! html
15026 <ol><li id="fragment">One</li>
15027 </ol>
15028
15029 !! end
15030
15031 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
15032 !!test
15033 bug 5918: autonumbering
15034 !! wikitext
15035 [http://first/] [http://second] [ftp://ftp]
15036
15037 ftp://inlineftp
15038
15039 [mailto:enclosed@mail.tld With target]
15040
15041 [mailto:enclosed@mail.tld]
15042
15043 mailto:inline@mail.tld
15044 !! html/php
15045 <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>
15046 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
15047 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
15048 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
15049 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
15050 </p>
15051 !! html/parsoid
15052 <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>
15053 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
15054 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
15055 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
15056 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
15057 !! end
15058
15059
15060 #
15061 # Security and HTML correctness
15062 # From Nick Jenkins' fuzz testing
15063 #
15064
15065 !! test
15066 Fuzz testing: Parser13
15067 !! wikitext
15068 {|
15069 | http://a|
15070 !! html
15071 <table>
15072 <tr>
15073 <td>
15074 </td>
15075 </tr>
15076 </table>
15077
15078 !! end
15079
15080 !! test
15081 Fuzz testing: Parser14
15082 !! wikitext
15083 == onmouseover= ==
15084 http://__TOC__
15085 !! html
15086 <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>
15087 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15088 <ul>
15089 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15090 </ul>
15091 </div>
15092
15093
15094 !! html+tidy
15095 <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>
15096 <p>http://</p>
15097 <div id="toc" class="toc">
15098 <div id="toctitle">
15099 <h2>Contents</h2>
15100 </div>
15101 <ul>
15102 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15103 </ul>
15104 </div>
15105 !! end
15106
15107 !! test
15108 Fuzz testing: Parser14-table
15109 !! wikitext
15110 ==a==
15111 {| STYLE=__TOC__
15112 !! html
15113 <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>
15114 <table style="&#95;_TOC&#95;_">
15115 <tr><td></td></tr>
15116 </table>
15117
15118 !! html+tidy
15119 <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>
15120 <table style="__TOC__">
15121 <tr>
15122 <td></td>
15123 </tr>
15124 </table>
15125 !! end
15126
15127 # Known to produce bogus xml (extra </td>)
15128 !! test
15129 Fuzz testing: Parser16
15130 !! options
15131 noxml
15132 !! wikitext
15133 {|
15134 !https://||||||
15135 !! html
15136 <table>
15137 <tr>
15138 <th>https://</th>
15139 <th></th>
15140 <th></th>
15141 <th>
15142 </td>
15143 </tr>
15144 </table>
15145
15146 !! html+tidy
15147 <table>
15148 <tr>
15149 <th>https://</th>
15150 <th></th>
15151 <th></th>
15152 <th></th>
15153 </tr>
15154 </table>
15155 !! end
15156
15157 !! test
15158 Fuzz testing: Parser21
15159 !! wikitext
15160 {|
15161 ! irc://{{ftp://a" onmouseover="alert('hello world');"
15162 |
15163 !! html
15164 <table>
15165 <tr>
15166 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
15167 </th>
15168 <td>
15169 </td>
15170 </tr>
15171 </table>
15172
15173 !! end
15174
15175 !! test
15176 Fuzz testing: Parser22
15177 !! wikitext
15178 http://===r:::https://b
15179
15180 {|
15181 !! html
15182 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
15183 </p>
15184 <table>
15185 <tr><td></td></tr>
15186 </table>
15187
15188 !! end
15189
15190 # Known to produce bad XML for now
15191 !! test
15192 Fuzz testing: Parser24
15193 !! options
15194 noxml
15195 !! wikitext
15196 {|
15197 {{{|
15198 <u CLASS=
15199 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
15200 <br style="onmouseover='alert(document.cookie);' " />
15201
15202 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15203 |
15204 !! html
15205 <table>
15206 {{{|
15207 <u class="&#124;">}}}} &gt;
15208 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
15209
15210 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15211 <tr>
15212 <td></u>
15213 </td>
15214 </tr>
15215 </table>
15216
15217 !! end
15218
15219 # Note: the current result listed for this is not what the original one was,
15220 # but the original bug was JavaScript injection, which is fixed in any case.
15221 # It's not clear that the original result listed was any more correct than the
15222 # current one. Original result:
15223 # <p>{{{|
15224 # </p>
15225 # <li class="&#124;&#124;">
15226 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15227 !!test
15228 Fuzz testing: Parser25 (bug 6055)
15229 !! wikitext
15230 {{{
15231 |
15232 <LI CLASS=||
15233 >
15234 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15235 !! html
15236 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15237 </p>
15238 !! end
15239
15240 !!test
15241 Fuzz testing: URL adjacent extension (with space, clean)
15242 !! wikitext
15243 http://example.com <nowiki>junk</nowiki>
15244 !! html
15245 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15246 </p>
15247 !!end
15248
15249 !!test
15250 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15251 !! wikitext
15252 http://example.com<nowiki>junk</nowiki>
15253 !! html
15254 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15255 </p>
15256 !!end
15257
15258 !!test
15259 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15260 !! wikitext
15261 http://example.com<pre>junk</pre>
15262 !! html
15263 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15264
15265 !! html+tidy
15266 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15267 <pre>
15268 junk
15269 </pre>
15270 !!end
15271
15272 !!test
15273 Fuzz testing: image with bogus manual thumbnail
15274 !! wikitext
15275 [[Image:foobar.jpg|thumbnail= ]]
15276 !! html/php
15277 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
15278
15279 !! html/parsoid
15280 <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>
15281 !!end
15282
15283 !! test
15284 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15285 !! wikitext
15286 <pre dir="&#10;"></pre>
15287 !! html
15288 <pre dir="&#10;"></pre>
15289
15290 !! end
15291
15292 !! test
15293 Parsing optional HTML elements (Bug 6171)
15294 !! options
15295 !! wikitext
15296 <table>
15297 <tr>
15298 <td> Some tabular data</td>
15299 <td> More tabular data ...
15300 <td> And yet som tabular data</td>
15301 </tr>
15302 </table>
15303 !! html
15304 <table>
15305 <tr>
15306 <td> Some tabular data</td>
15307 <td> More tabular data ...
15308 </td><td> And yet som tabular data</td>
15309 </tr>
15310 </table>
15311
15312 !! end
15313
15314 !! test
15315 Correct handling of <td>, <tr> (Bug 6171)
15316 !! options
15317 !! wikitext
15318 <table>
15319 <tr>
15320 <td> Some tabular data</td>
15321 <td> More tabular data ...</td>
15322 <td> And yet som tabular data</td>
15323 </tr>
15324 </table>
15325 !! html
15326 <table>
15327 <tr>
15328 <td> Some tabular data</td>
15329 <td> More tabular data ...</td>
15330 <td> And yet som tabular data</td>
15331 </tr>
15332 </table>
15333
15334 !! end
15335
15336
15337 !! test
15338 Parsing crashing regression (fr:JavaScript)
15339 !! wikitext
15340 </body></x>
15341 !! html
15342 <p>&lt;/body&gt;&lt;/x&gt;
15343 </p>
15344 !! end
15345
15346 !! test
15347 Inline wiki vs wiki block nesting
15348 !! wikitext
15349 '''Bold paragraph
15350
15351 New wiki paragraph
15352 !! html
15353 <p><b>Bold paragraph</b>
15354 </p><p>New wiki paragraph
15355 </p>
15356 !! end
15357
15358 # FIXME: The current php output is documented
15359 # and desired output is the parsoid target.
15360 !! test
15361 Inline HTML vs wiki block nesting
15362 !! wikitext
15363 <b>Bold paragraph
15364
15365 New wiki paragraph
15366 !! html/php
15367 <p><b>Bold paragraph
15368 </p><p>New wiki paragraph</b>
15369 </p>
15370 !! html/parsoid
15371 <p><b>Bold paragraph</b>
15372 </p><p>New wiki paragraph
15373 </p>
15374 !! end
15375
15376 # Original result was this:
15377 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
15378 # </p>
15379 # While that might be marginally more intuitive, maybe, the six-apostrophe
15380 # construct is clearly pathological and the result stated here (which is what
15381 # the parser actually does) is about as reasonable as anything.
15382 !!test
15383 Mixing markup for italics and bold
15384 !! options
15385 !! wikitext
15386 '''bold''''''bold''bolditalics'''''
15387 !! html
15388 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
15389 </p>
15390 !! end
15391
15392
15393 !! article
15394 Xyzzyx
15395 !! text
15396 Article for special page transclusion test
15397 !! endarticle
15398
15399 !! test
15400 Special page transclusion
15401 !! options
15402 !! wikitext
15403 {{Special:Prefixindex/Xyzzyx}}
15404 !! html
15405 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15406
15407 !! end
15408
15409 !! test
15410 Special page transclusion twice (bug 5021)
15411 !! options
15412 !! wikitext
15413 {{Special:Prefixindex/Xyzzyx}}
15414 {{Special:Prefixindex/Xyzzyx}}
15415 !! html
15416 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15417 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15418
15419 !! end
15420
15421 !! test
15422 Transclusion of default MediaWiki message
15423 !! wikitext
15424 {{MediaWiki:Mainpage}}
15425 !! html
15426 <p>Main Page
15427 </p>
15428 !! end
15429
15430 !! test
15431 Transclusion of nonexistent MediaWiki message
15432 !! wikitext
15433 {{MediaWiki:Mainpagexxx}}
15434 !! html
15435 <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>
15436 </p>
15437 !! end
15438
15439 !! test
15440 Transclusion of MediaWiki message with underscore
15441 !! wikitext
15442 {{MediaWiki:history_short}}
15443 !! html
15444 <p>History
15445 </p>
15446 !! end
15447
15448 !! test
15449 Transclusion of MediaWiki message with space
15450 !! wikitext
15451 {{MediaWiki:history short}}
15452 !! html
15453 <p>History
15454 </p>
15455 !! end
15456
15457 !! test
15458 Invalid header with following text
15459 !! wikitext
15460 = x = y
15461 !! html
15462 <p>= x = y
15463 </p>
15464 !! end
15465
15466
15467 !! test
15468 Section extraction test (section 0)
15469 !! options
15470 section=0
15471 !! wikitext
15472 start
15473 ==a==
15474 ===aa===
15475 ====aaa====
15476 ==b==
15477 ===ba===
15478 ===bb===
15479 ====bba====
15480 ===bc===
15481 ==c==
15482 ===ca===
15483 !! html
15484 start
15485 !! end
15486
15487 !! test
15488 Section extraction test (section 1)
15489 !! options
15490 section=1
15491 !! wikitext
15492 start
15493 ==a==
15494 ===aa===
15495 ====aaa====
15496 ==b==
15497 ===ba===
15498 ===bb===
15499 ====bba====
15500 ===bc===
15501 ==c==
15502 ===ca===
15503 !! html
15504 ==a==
15505 ===aa===
15506 ====aaa====
15507 !! end
15508
15509 !! test
15510 Section extraction test (section 2)
15511 !! options
15512 section=2
15513 !! wikitext
15514 start
15515 ==a==
15516 ===aa===
15517 ====aaa====
15518 ==b==
15519 ===ba===
15520 ===bb===
15521 ====bba====
15522 ===bc===
15523 ==c==
15524 ===ca===
15525 !! html
15526 ===aa===
15527 ====aaa====
15528 !! end
15529
15530 !! test
15531 Section extraction test (section 3)
15532 !! options
15533 section=3
15534 !! wikitext
15535 start
15536 ==a==
15537 ===aa===
15538 ====aaa====
15539 ==b==
15540 ===ba===
15541 ===bb===
15542 ====bba====
15543 ===bc===
15544 ==c==
15545 ===ca===
15546 !! html
15547 ====aaa====
15548 !! end
15549
15550 !! test
15551 Section extraction test (section 4)
15552 !! options
15553 section=4
15554 !! wikitext
15555 start
15556 ==a==
15557 ===aa===
15558 ====aaa====
15559 ==b==
15560 ===ba===
15561 ===bb===
15562 ====bba====
15563 ===bc===
15564 ==c==
15565 ===ca===
15566 !! html
15567 ==b==
15568 ===ba===
15569 ===bb===
15570 ====bba====
15571 ===bc===
15572 !! end
15573
15574 !! test
15575 Section extraction test (section 5)
15576 !! options
15577 section=5
15578 !! wikitext
15579 start
15580 ==a==
15581 ===aa===
15582 ====aaa====
15583 ==b==
15584 ===ba===
15585 ===bb===
15586 ====bba====
15587 ===bc===
15588 ==c==
15589 ===ca===
15590 !! html
15591 ===ba===
15592 !! end
15593
15594 !! test
15595 Section extraction test (section 6)
15596 !! options
15597 section=6
15598 !! wikitext
15599 start
15600 ==a==
15601 ===aa===
15602 ====aaa====
15603 ==b==
15604 ===ba===
15605 ===bb===
15606 ====bba====
15607 ===bc===
15608 ==c==
15609 ===ca===
15610 !! html
15611 ===bb===
15612 ====bba====
15613 !! end
15614
15615 !! test
15616 Section extraction test (section 7)
15617 !! options
15618 section=7
15619 !! wikitext
15620 start
15621 ==a==
15622 ===aa===
15623 ====aaa====
15624 ==b==
15625 ===ba===
15626 ===bb===
15627 ====bba====
15628 ===bc===
15629 ==c==
15630 ===ca===
15631 !! html
15632 ====bba====
15633 !! end
15634
15635 !! test
15636 Section extraction test (section 8)
15637 !! options
15638 section=8
15639 !! wikitext
15640 start
15641 ==a==
15642 ===aa===
15643 ====aaa====
15644 ==b==
15645 ===ba===
15646 ===bb===
15647 ====bba====
15648 ===bc===
15649 ==c==
15650 ===ca===
15651 !! html
15652 ===bc===
15653 !! end
15654
15655 !! test
15656 Section extraction test (section 9)
15657 !! options
15658 section=9
15659 !! wikitext
15660 start
15661 ==a==
15662 ===aa===
15663 ====aaa====
15664 ==b==
15665 ===ba===
15666 ===bb===
15667 ====bba====
15668 ===bc===
15669 ==c==
15670 ===ca===
15671 !! html
15672 ==c==
15673 ===ca===
15674 !! end
15675
15676 !! test
15677 Section extraction test (section 10)
15678 !! options
15679 section=10
15680 !! wikitext
15681 start
15682 ==a==
15683 ===aa===
15684 ====aaa====
15685 ==b==
15686 ===ba===
15687 ===bb===
15688 ====bba====
15689 ===bc===
15690 ==c==
15691 ===ca===
15692 !! html
15693 ===ca===
15694 !! end
15695
15696 !! test
15697 Section extraction test (nonexistent section 11)
15698 !! options
15699 section=11
15700 !! wikitext
15701 start
15702 ==a==
15703 ===aa===
15704 ====aaa====
15705 ==b==
15706 ===ba===
15707 ===bb===
15708 ====bba====
15709 ===bc===
15710 ==c==
15711 ===ca===
15712 !! html
15713 !! end
15714
15715 !! test
15716 Section extraction test with bogus heading (section 1)
15717 !! options
15718 section=1
15719 !! wikitext
15720 ==a==
15721 ==bogus== not a legal section
15722 ==b==
15723 !! html
15724 ==a==
15725 ==bogus== not a legal section
15726 !! end
15727
15728 !! test
15729 Section extraction test with bogus heading (section 2)
15730 !! options
15731 section=2
15732 !! wikitext
15733 ==a==
15734 ==bogus== not a legal section
15735 ==b==
15736 !! html
15737 ==b==
15738 !! end
15739
15740 !! test
15741 Section extraction test with comment after heading (section 1)
15742 !! options
15743 section=1
15744 !! wikitext
15745 ==a==
15746 ==b== <!-- -->
15747 ==c==
15748 !! html
15749 ==a==
15750 !! end
15751
15752 !! test
15753 Section extraction test with comment after heading (section 2)
15754 !! options
15755 section=2
15756 !! wikitext
15757 ==a==
15758 ==b== <!-- -->
15759 ==c==
15760 !! html
15761 ==b== <!-- -->
15762 !! end
15763
15764 !! test
15765 Section extraction test with bogus <nowiki> heading (section 1)
15766 !! options
15767 section=1
15768 !! wikitext
15769 ==a==
15770 ==bogus== <nowiki>not a legal section</nowiki>
15771 ==b==
15772 !! html
15773 ==a==
15774 ==bogus== <nowiki>not a legal section</nowiki>
15775 !! end
15776
15777 !! test
15778 Section extraction test with bogus <nowiki> heading (section 2)
15779 !! options
15780 section=2
15781 !! wikitext
15782 ==a==
15783 ==bogus== <nowiki>not a legal section</nowiki>
15784 ==b==
15785 !! html
15786 ==b==
15787 !! end
15788
15789
15790 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
15791 # instead of respecting commented sections
15792 !! test
15793 Section extraction prefixed by comment (section 1)
15794 !! options
15795 section=1
15796 !! wikitext
15797 <!-- -->==sec1==
15798 ==sec2==
15799 !! html
15800 ==sec2==
15801 !!end
15802
15803 !! test
15804 Section extraction prefixed by comment (section 2)
15805 !! options
15806 section=2
15807 !! wikitext
15808 <!-- -->==sec1==
15809 ==sec2==
15810 !! html
15811
15812 !!end
15813
15814
15815 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
15816 # instead of respecting HTML-style headings
15817 !! test
15818 Section extraction, mixed wiki and html (section 1)
15819 !! options
15820 section=1
15821 !! wikitext
15822 <h2>unmarked</h2>
15823 unmarked
15824 ==1==
15825 one
15826 ==2==
15827 two
15828 !! html
15829 ==1==
15830 one
15831 !! end
15832
15833 !! test
15834 Section extraction, mixed wiki and html (section 2)
15835 !! options
15836 section=2
15837 !! wikitext
15838 <h2>unmarked</h2>
15839 unmarked
15840 ==1==
15841 one
15842 ==2==
15843 two
15844 !! html
15845 ==2==
15846 two
15847 !! end
15848
15849
15850 # Formerly testing for bug 3342
15851 !! test
15852 Section extraction, heading surrounded by <noinclude>
15853 !! options
15854 section=1
15855 !! wikitext
15856 <noinclude>==unmarked==</noinclude>
15857 ==marked==
15858 !! html
15859 ==marked==
15860 !!end
15861
15862 # Test behavior of bug 19910
15863 !! test
15864 Sectiion with all-equals
15865 !! options
15866 section=2
15867 !! wikitext
15868 ===
15869 The line above must have a trailing space
15870 === <!--
15871 --> <!-- -->
15872 But just in case it doesn't...
15873 !! html
15874 === <!--
15875 --> <!-- -->
15876 But just in case it doesn't...
15877 !! end
15878
15879 !! test
15880 Section replacement test (section 0)
15881 !! options
15882 replace=0,"xxx"
15883 !! wikitext
15884 start
15885 ==a==
15886 ===aa===
15887 ====aaa====
15888 ==b==
15889 ===ba===
15890 ===bb===
15891 ====bba====
15892 ===bc===
15893 ==c==
15894 ===ca===
15895 !! html
15896 xxx
15897
15898 ==a==
15899 ===aa===
15900 ====aaa====
15901 ==b==
15902 ===ba===
15903 ===bb===
15904 ====bba====
15905 ===bc===
15906 ==c==
15907 ===ca===
15908 !! end
15909
15910 !! test
15911 Section replacement test (section 1)
15912 !! options
15913 replace=1,"xxx"
15914 !! wikitext
15915 start
15916 ==a==
15917 ===aa===
15918 ====aaa====
15919 ==b==
15920 ===ba===
15921 ===bb===
15922 ====bba====
15923 ===bc===
15924 ==c==
15925 ===ca===
15926 !! html
15927 start
15928 xxx
15929
15930 ==b==
15931 ===ba===
15932 ===bb===
15933 ====bba====
15934 ===bc===
15935 ==c==
15936 ===ca===
15937 !! end
15938
15939 !! test
15940 Section replacement test (section 2)
15941 !! options
15942 replace=2,"xxx"
15943 !! wikitext
15944 start
15945 ==a==
15946 ===aa===
15947 ====aaa====
15948 ==b==
15949 ===ba===
15950 ===bb===
15951 ====bba====
15952 ===bc===
15953 ==c==
15954 ===ca===
15955 !! html
15956 start
15957 ==a==
15958 xxx
15959
15960 ==b==
15961 ===ba===
15962 ===bb===
15963 ====bba====
15964 ===bc===
15965 ==c==
15966 ===ca===
15967 !! end
15968
15969 !! test
15970 Section replacement test (section 3)
15971 !! options
15972 replace=3,"xxx"
15973 !! wikitext
15974 start
15975 ==a==
15976 ===aa===
15977 ====aaa====
15978 ==b==
15979 ===ba===
15980 ===bb===
15981 ====bba====
15982 ===bc===
15983 ==c==
15984 ===ca===
15985 !! html
15986 start
15987 ==a==
15988 ===aa===
15989 xxx
15990
15991 ==b==
15992 ===ba===
15993 ===bb===
15994 ====bba====
15995 ===bc===
15996 ==c==
15997 ===ca===
15998 !! end
15999
16000 !! test
16001 Section replacement test (section 4)
16002 !! options
16003 replace=4,"xxx"
16004 !! wikitext
16005 start
16006 ==a==
16007 ===aa===
16008 ====aaa====
16009 ==b==
16010 ===ba===
16011 ===bb===
16012 ====bba====
16013 ===bc===
16014 ==c==
16015 ===ca===
16016 !! html
16017 start
16018 ==a==
16019 ===aa===
16020 ====aaa====
16021 xxx
16022
16023 ==c==
16024 ===ca===
16025 !! end
16026
16027 !! test
16028 Section replacement test (section 5)
16029 !! options
16030 replace=5,"xxx"
16031 !! wikitext
16032 start
16033 ==a==
16034 ===aa===
16035 ====aaa====
16036 ==b==
16037 ===ba===
16038 ===bb===
16039 ====bba====
16040 ===bc===
16041 ==c==
16042 ===ca===
16043 !! html
16044 start
16045 ==a==
16046 ===aa===
16047 ====aaa====
16048 ==b==
16049 xxx
16050
16051 ===bb===
16052 ====bba====
16053 ===bc===
16054 ==c==
16055 ===ca===
16056 !! end
16057
16058 !! test
16059 Section replacement test (section 6)
16060 !! options
16061 replace=6,"xxx"
16062 !! wikitext
16063 start
16064 ==a==
16065 ===aa===
16066 ====aaa====
16067 ==b==
16068 ===ba===
16069 ===bb===
16070 ====bba====
16071 ===bc===
16072 ==c==
16073 ===ca===
16074 !! html
16075 start
16076 ==a==
16077 ===aa===
16078 ====aaa====
16079 ==b==
16080 ===ba===
16081 xxx
16082
16083 ===bc===
16084 ==c==
16085 ===ca===
16086 !! end
16087
16088 !! test
16089 Section replacement test (section 7)
16090 !! options
16091 replace=7,"xxx"
16092 !! wikitext
16093 start
16094 ==a==
16095 ===aa===
16096 ====aaa====
16097 ==b==
16098 ===ba===
16099 ===bb===
16100 ====bba====
16101 ===bc===
16102 ==c==
16103 ===ca===
16104 !! html
16105 start
16106 ==a==
16107 ===aa===
16108 ====aaa====
16109 ==b==
16110 ===ba===
16111 ===bb===
16112 xxx
16113
16114 ===bc===
16115 ==c==
16116 ===ca===
16117 !! end
16118
16119 !! test
16120 Section replacement test (section 8)
16121 !! options
16122 replace=8,"xxx"
16123 !! wikitext
16124 start
16125 ==a==
16126 ===aa===
16127 ====aaa====
16128 ==b==
16129 ===ba===
16130 ===bb===
16131 ====bba====
16132 ===bc===
16133 ==c==
16134 ===ca===
16135 !! html
16136 start
16137 ==a==
16138 ===aa===
16139 ====aaa====
16140 ==b==
16141 ===ba===
16142 ===bb===
16143 ====bba====
16144 xxx
16145
16146 ==c==
16147 ===ca===
16148 !!end
16149
16150 !! test
16151 Section replacement test (section 9)
16152 !! options
16153 replace=9,"xxx"
16154 !! wikitext
16155 start
16156 ==a==
16157 ===aa===
16158 ====aaa====
16159 ==b==
16160 ===ba===
16161 ===bb===
16162 ====bba====
16163 ===bc===
16164 ==c==
16165 ===ca===
16166 !! html
16167 start
16168 ==a==
16169 ===aa===
16170 ====aaa====
16171 ==b==
16172 ===ba===
16173 ===bb===
16174 ====bba====
16175 ===bc===
16176 xxx
16177 !! end
16178
16179 !! test
16180 Section replacement test (section 10)
16181 !! options
16182 replace=10,"xxx"
16183 !! wikitext
16184 start
16185 ==a==
16186 ===aa===
16187 ====aaa====
16188 ==b==
16189 ===ba===
16190 ===bb===
16191 ====bba====
16192 ===bc===
16193 ==c==
16194 ===ca===
16195 !! html
16196 start
16197 ==a==
16198 ===aa===
16199 ====aaa====
16200 ==b==
16201 ===ba===
16202 ===bb===
16203 ====bba====
16204 ===bc===
16205 ==c==
16206 xxx
16207 !! end
16208
16209 !! test
16210 Section replacement test with initial whitespace (bug 13728)
16211 !! options
16212 replace=2,"xxx"
16213 !! wikitext
16214 Preformatted initial line
16215 ==a==
16216 ===a===
16217 !! html
16218 Preformatted initial line
16219 ==a==
16220 xxx
16221 !! end
16222
16223
16224 !! test
16225 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16226 !! options
16227 section=1
16228 !! wikitext
16229 ==a==
16230 a
16231 !! html
16232 ==a==
16233 a
16234 !! end
16235
16236 !! test
16237 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16238 !! options
16239 section=1
16240 !! wikitext
16241 ==a==
16242 a
16243 !! html
16244 ==a==
16245 a
16246 !! end
16247
16248
16249 !! test
16250 Section extraction, <pre> around bogus header (bug 10309)
16251 !! options
16252 noxml section=2
16253 !! wikitext
16254 == Section One ==
16255 <pre>
16256 =======
16257 </pre>
16258
16259 == Section Two ==
16260 stuff
16261 !! html
16262 == Section Two ==
16263 stuff
16264 !! end
16265
16266 !! test
16267 Section replacement, <pre> around bogus header (bug 10309)
16268 !! options
16269 noxml replace=2,"xxx"
16270 !! wikitext
16271 == Section One ==
16272 <pre>
16273 =======
16274 </pre>
16275
16276 == Section Two ==
16277 stuff
16278 !! html
16279 == Section One ==
16280 <pre>
16281 =======
16282 </pre>
16283
16284 xxx
16285 !! end
16286
16287
16288
16289 !! test
16290 Handling of &#x0A; in URLs
16291 !! wikitext
16292 ** irc://&#x0A;a
16293 !! html/php
16294 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16295
16296 !! html/parsoid
16297 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16298 a">irc://
16299 a</a></li></ul></li></ul>
16300 !! end
16301
16302 !! test
16303 Handling of %0A in URLs
16304 !! wikitext
16305 ** irc://%0Aa
16306 !! html/php
16307 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16308
16309 !! html/parsoid
16310 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16311 !! end
16312
16313
16314 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16315 !! test
16316 5 quotes, code coverage +1 line
16317 !! options
16318 parsoid=wt2html
16319 !! wikitext
16320 '''''
16321 !! html/php
16322 !! html/parsoid
16323 <p><b><i></i></b></p>
16324 !! end
16325
16326 # same html as previous, but wikitext adjusted to match parsoid html2wt
16327 # note that wt2html and html2html will put the <i> before the <b>
16328 !! test
16329 5 quotes, code coverage +1 line w/ nowiki (1)
16330 !! options
16331 parsoid=wt2wt,html2wt
16332 !! wikitext
16333 '''''<nowiki/>'''''
16334 !! html/php
16335 <p><i></i>
16336 </p>
16337 !! html/parsoid
16338 <p><b><i></i></b></p>
16339 !! end
16340
16341 # same as previous, just swapping the <i> and <b>
16342 !! test
16343 5 quotes, code coverage +1 line w/ nowiki (2)
16344 !! wikitext
16345 '''''<nowiki/>'''''
16346 !! html/php
16347 <p><i></i>
16348 </p>
16349 !! html/parsoid
16350 <p><i><b></b></i></p>
16351 !! end
16352
16353 !! test
16354 Special:Search page linking.
16355 !! wikitext
16356 {{Special:search}}
16357 !! html
16358 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16359 </p>
16360 !! end
16361
16362 !! test
16363 {{!}} is a magic word
16364 !! wikitext
16365 {{!}} is a magic word there and {{!}} is still a magic word here
16366 !! html/php
16367 <p>| is a magic word there and | is still a magic word here
16368 </p>
16369 !! html/parsoid
16370 <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>
16371 !! end
16372
16373 !! test
16374 Say the magic word
16375 !! options
16376 title=[[Parser test]]
16377 !! wikitext
16378 * {{PAGENAME}}
16379 * {{PAGENAMEE}}
16380 * {{FULLPAGENAME}}
16381 * {{FULLPAGENAMEE}}
16382 * {{BASEPAGENAME}}
16383 * {{BASEPAGENAMEE}}
16384 * {{SUBPAGENAME}}
16385 * {{SUBPAGENAMEE}}
16386 * {{ROOTPAGENAME}}
16387 * {{ROOTPAGENAMEE}}
16388 * {{TALKPAGENAME}}
16389 * {{TALKPAGENAMEE}}
16390 * {{SUBJECTPAGENAME}}
16391 * {{SUBJECTPAGENAMEE}}
16392 * {{NAMESPACEE}}
16393 * {{NAMESPACE}}
16394 * {{NAMESPACENUMBER}}
16395 * {{TALKSPACE}}
16396 * {{TALKSPACEE}}
16397 * {{SUBJECTSPACE}}
16398 * {{SUBJECTSPACEE}}
16399 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
16400 !! html
16401 <ul><li> Parser test</li>
16402 <li> Parser_test</li>
16403 <li> Parser test</li>
16404 <li> Parser_test</li>
16405 <li> Parser test</li>
16406 <li> Parser_test</li>
16407 <li> Parser test</li>
16408 <li> Parser_test</li>
16409 <li> Parser test</li>
16410 <li> Parser_test</li>
16411 <li> Talk:Parser test</li>
16412 <li> Talk:Parser_test</li>
16413 <li> Parser test</li>
16414 <li> Parser_test</li>
16415 <li> </li>
16416 <li> </li>
16417 <li> 0</li>
16418 <li> Talk</li>
16419 <li> Talk</li>
16420 <li> </li>
16421 <li> </li>
16422 <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>
16423
16424 !! end
16425 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
16426
16427 !! test
16428 Gallery
16429 !! wikitext
16430 <gallery>
16431 image1.png |
16432 image2.gif|||||
16433
16434 image3|
16435 image4 |300px| centre
16436 image5.svg| http://///////
16437 [[x|xx]]]]
16438 * image6
16439 </gallery>
16440 !! html
16441 <ul class="gallery mw-gallery-traditional">
16442 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16443 <div class="thumb" style="height: 150px;">Image1.png</div>
16444 <div class="gallerytext">
16445 </div>
16446 </div></li>
16447 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16448 <div class="thumb" style="height: 150px;">Image2.gif</div>
16449 <div class="gallerytext">
16450 <p>||||
16451 </p>
16452 </div>
16453 </div></li>
16454 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16455 <div class="thumb" style="height: 150px;">Image3</div>
16456 <div class="gallerytext">
16457 </div>
16458 </div></li>
16459 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16460 <div class="thumb" style="height: 150px;">Image4</div>
16461 <div class="gallerytext">
16462 <p>300px| centre
16463 </p>
16464 </div>
16465 </div></li>
16466 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16467 <div class="thumb" style="height: 150px;">Image5.svg</div>
16468 <div class="gallerytext">
16469 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
16470 </p>
16471 </div>
16472 </div></li>
16473 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16474 <div class="thumb" style="height: 150px;">* image6</div>
16475 <div class="gallerytext">
16476 </div>
16477 </div></li>
16478 </ul>
16479
16480 !! end
16481
16482 !! test
16483 Gallery (with options)
16484 !! wikitext
16485 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
16486 File:Nonexistent.jpg|caption
16487 File:Nonexistent.jpg
16488 image:foobar.jpg|some '''caption''' [[Main Page]]
16489 image:foobar.jpg
16490 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
16491 </gallery>
16492 !! html
16493 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
16494 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
16495 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16496 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16497 <div class="gallerytext">
16498 <p>caption
16499 </p>
16500 </div>
16501 </div></li>
16502 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16503 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16504 <div class="gallerytext">
16505 </div>
16506 </div></li>
16507 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16508 <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>
16509 <div class="gallerytext">
16510 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16511 </p>
16512 </div>
16513 </div></li>
16514 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16515 <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>
16516 <div class="gallerytext">
16517 </div>
16518 </div></li>
16519 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16520 <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>
16521 <div class="gallerytext">
16522 <p>Blabla|blabla.
16523 </p>
16524 </div>
16525 </div></li>
16526 </ul>
16527
16528 !! end
16529
16530 !! test
16531 Gallery with link that has fragment
16532 !! wikitext
16533 <gallery>
16534 image:foobar.jpg|link=Main_Page
16535 image:foobar.jpg|link=Main_Page#section
16536 image:foobar.jpg|link=Main Page#section|caption
16537 </gallery>
16538 !! html
16539 <ul class="gallery mw-gallery-traditional">
16540 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16541 <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>
16542 <div class="gallerytext">
16543 </div>
16544 </div></li>
16545 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16546 <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>
16547 <div class="gallerytext">
16548 </div>
16549 </div></li>
16550 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16551 <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>
16552 <div class="gallerytext">
16553 <p>caption
16554 </p>
16555 </div>
16556 </div></li>
16557 </ul>
16558
16559 !! end
16560
16561 !! test
16562 Gallery with wikitext inside caption
16563 !! wikitext
16564 <gallery>
16565 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
16566 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
16567 </gallery>
16568 !! html
16569 <ul class="gallery mw-gallery-traditional">
16570 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16571 <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>
16572 <div class="gallerytext">
16573 <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>
16574 </p>
16575 </div>
16576 </div></li>
16577 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16578 <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>
16579 <div class="gallerytext">
16580 <p>This is a test template
16581 </p>
16582 </div>
16583 </div></li>
16584 </ul>
16585
16586 !! end
16587
16588 !! test
16589 gallery (with showfilename option)
16590 !! wikitext
16591 <gallery showfilename>
16592 File:Nonexistent.jpg|caption
16593 File:Nonexistent.jpg
16594 image:foobar.jpg|some '''caption''' [[Main Page]]
16595 File:Foobar.jpg
16596 </gallery>
16597 !! html
16598 <ul class="gallery mw-gallery-traditional">
16599 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16600 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16601 <div class="gallerytext">
16602 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16603 caption
16604 </p>
16605 </div>
16606 </div></li>
16607 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16608 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16609 <div class="gallerytext">
16610 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16611 </p>
16612 </div>
16613 </div></li>
16614 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16615 <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>
16616 <div class="gallerytext">
16617 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16618 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16619 </p>
16620 </div>
16621 </div></li>
16622 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16623 <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>
16624 <div class="gallerytext">
16625 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16626 </p>
16627 </div>
16628 </div></li>
16629 </ul>
16630
16631 !! end
16632
16633 !! test
16634 Gallery (with namespace-less filenames)
16635 !! wikitext
16636 <gallery>
16637 File:Nonexistent.jpg
16638 Nonexistent.jpg
16639 image:foobar.jpg
16640 foobar.jpg
16641 </gallery>
16642 !! html
16643 <ul class="gallery mw-gallery-traditional">
16644 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16645 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16646 <div class="gallerytext">
16647 </div>
16648 </div></li>
16649 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16650 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16651 <div class="gallerytext">
16652 </div>
16653 </div></li>
16654 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16655 <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>
16656 <div class="gallerytext">
16657 </div>
16658 </div></li>
16659 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16660 <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>
16661 <div class="gallerytext">
16662 </div>
16663 </div></li>
16664 </ul>
16665
16666 !! end
16667
16668 !! test
16669 HTML Hex character encoding (spells the word "JavaScript")
16670 !! options
16671 parsoid=wt2html,wt2wt,html2html
16672 !! wikitext
16673 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
16674 !! html/php
16675 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
16676 </p>
16677 !! html/php+tidy
16678 <p>JavaScript</p>
16679 !! html/parsoid
16680 <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>
16681 !! end
16682
16683 !! test
16684 HTML Hex character encoding bogus encoding (bug 26437 regression check)
16685 !! wikitext
16686 &#xsee;&#XSEE;
16687 !! html/php
16688 <p>&amp;#xsee;&amp;#XSEE;
16689 </p>
16690 !! html/parsoid
16691 <p>&amp;#xsee;&amp;#XSEE;</p>
16692 !! end
16693
16694 !! test
16695 HTML Hex character encoding mixed case
16696 !! options
16697 parsoid=wt2html,wt2wt,html2html
16698 !! wikitext
16699 &#xEE;&#Xee;
16700 !! html/php
16701 <p>&#xee;&#xee;
16702 </p>
16703 !! html/php+tidy
16704 <p>îî</p>
16705 !! html/parsoid
16706 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
16707 !! end
16708
16709 !! test
16710 __FORCETOC__ override
16711 !! wikitext
16712 __NEWSECTIONLINK__
16713 __FORCETOC__
16714 !! html
16715 <p><br />
16716 </p>
16717 !! end
16718
16719 !! test
16720 ISBN code coverage
16721 !! wikitext
16722 ISBN 978-0-1234-56&#x20;789
16723 !! html
16724 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
16725 </p>
16726 !! html+tidy
16727 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
16728 !! end
16729
16730 !! test
16731 ISBN followed by 5 spaces
16732 !! wikitext
16733 ISBN
16734 !! html
16735 <p>ISBN
16736 </p>
16737 !! end
16738
16739 !! test
16740 Double ISBN
16741 !! wikitext
16742 ISBN ISBN 1234567890
16743 !! html
16744 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16745 </p>
16746 !! end
16747
16748 !! test
16749 ISBN with an X
16750 !! wikitext
16751 ISBN 3-462-04561-X
16752 !! html
16753 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
16754 </p>
16755 !! end
16756
16757 !! test
16758 ISBN with empty prefix (parsoid test)
16759 !! wikitext
16760 ISBN 1234567890
16761 !! html/parsoid
16762 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
16763 !! end
16764
16765 !! test
16766 Bug 22905: <abbr> followed by ISBN followed by </a>
16767 !! wikitext
16768 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
16769 !! html
16770 <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>
16771 </p>
16772 !! end
16773
16774 !! test
16775 Double RFC
16776 !! wikitext
16777 RFC RFC 1234
16778 !! html
16779 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
16780 </p>
16781 !! end
16782
16783 !! test
16784 Double RFC with a wiki link
16785 !! wikitext
16786 RFC [[RFC 1234]]
16787 !! html
16788 <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>
16789 </p>
16790 !! end
16791
16792 !! test
16793 RFC code coverage
16794 !! wikitext
16795 RFC 983&#x20;987
16796 !! html
16797 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
16798 </p>
16799 !! html+tidy
16800 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
16801 !! end
16802
16803 !! test
16804 Centre-aligned image
16805 !! wikitext
16806 [[Image:foobar.jpg|centre]]
16807 !! html
16808 <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>
16809
16810 !!end
16811
16812 !! test
16813 None-aligned image
16814 !! wikitext
16815 [[Image:foobar.jpg|none]]
16816 !! html
16817 <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>
16818
16819 !!end
16820
16821 !! test
16822 Width + Height sized image (using px) (height is ignored)
16823 !! wikitext
16824 [[Image:foobar.jpg|640x480px]]
16825 !! html
16826 <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>
16827 </p>
16828 !!end
16829
16830 !! test
16831 Width-sized image (using px, no following whitespace)
16832 !! wikitext
16833 [[Image:foobar.jpg|640px]]
16834 !! html
16835 <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>
16836 </p>
16837 !!end
16838
16839 !! test
16840 Width-sized image (using px, with following whitespace - test regression from r39467)
16841 !! wikitext
16842 [[Image:foobar.jpg|640px ]]
16843 !! html
16844 <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>
16845 </p>
16846 !!end
16847
16848 !! test
16849 Width-sized image (using px, with preceding whitespace - test regression from r39467)
16850 !! wikitext
16851 [[Image:foobar.jpg| 640px]]
16852 !! html
16853 <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>
16854 </p>
16855 !!end
16856
16857 !! test
16858 Image with page parameter
16859 !! options
16860 djvu
16861 !! wikitext
16862 [[File:LoremIpsum.djvu|page=2]]
16863 !! html/php
16864 <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>
16865 </p>
16866 !! html/parsoid
16867 <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>
16868 !! end
16869
16870 !! test
16871 Another italics / bold test
16872 !! wikitext
16873 ''' ''x'
16874 !! html
16875 <pre>'<i> </i>x'
16876 </pre>
16877 !!end
16878
16879 # FIXME: The php output seems broken. It's interleaving some open/close tags.
16880 !! test
16881 dt/dd/dl test
16882 !! wikitext
16883 :;;;::
16884 !! html/php
16885 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
16886
16887 !! html/parsoid
16888 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
16889
16890 !!end
16891
16892
16893 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
16894 !! test
16895 Images with the "|" character in the comment
16896 !! wikitext
16897 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
16898 !! html/php
16899 <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>
16900
16901 !! html/parsoid
16902 <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>
16903 !! end
16904
16905 !! test
16906 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
16907 !! wikitext
16908 <html><script>alert(1);</script></html>
16909 !! html
16910 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
16911 </p>
16912 !! end
16913
16914 !! test
16915 HTML with raw HTML ($wgRawHtml==true)
16916 !! options
16917 wgRawHtml=1
16918 !! wikitext
16919 <html><script>alert(1);</script></html>
16920 !! html
16921 <p><script>alert(1);</script>
16922 </p>
16923 !! end
16924
16925 !! test
16926 Parents of subpages, one level up
16927 !! options
16928 subpage title=[[Subpage test/L1/L2/L3]]
16929 !! wikitext
16930 [[../|L2]]
16931 !! html
16932 <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>
16933 </p>
16934 !! end
16935
16936
16937 !! test
16938 Parents of subpages, one level up, not named
16939 !! options
16940 subpage title=[[Subpage test/L1/L2/L3]]
16941 !! wikitext
16942 [[../]]
16943 !! html
16944 <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>
16945 </p>
16946 !! end
16947
16948
16949
16950 !! test
16951 Parents of subpages, two levels up
16952 !! options
16953 subpage title=[[Subpage test/L1/L2/L3]]
16954 !! wikitext
16955 [[../../|L1]]2
16956
16957 [[../../|L1]]l
16958 !! html
16959 <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
16960 </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>
16961 </p>
16962 !! end
16963
16964 !! test
16965 Parents of subpages, two levels up, without trailing slash or name.
16966 !! options
16967 subpage title=[[Subpage test/L1/L2/L3]]
16968 !! wikitext
16969 [[../..]]
16970 !! html
16971 <p>[[../..]]
16972 </p>
16973 !! end
16974
16975 !! test
16976 Parents of subpages, two levels up, with lots of extra trailing slashes.
16977 !! options
16978 subpage title=[[Subpage test/L1/L2/L3]]
16979 !! wikitext
16980 [[../../////]]
16981 !! html
16982 <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>
16983 </p>
16984 !! end
16985
16986 !! article
16987 Subpage test/L1/L2/L3Sibling
16988 !! text
16989 Sibling article
16990 !! endarticle
16991
16992 !! test
16993 Transclusion of a sibling page (one level up)
16994 !! options
16995 subpage title=[[Subpage test/L1/L2/L3]]
16996 !! wikitext
16997 {{../L3Sibling}}
16998 !! html
16999 <p>Sibling article
17000 </p>
17001 !! end
17002
17003 !! test
17004 Transclusion of a child page
17005 !! options
17006 subpage title=[[Subpage test/L1/L2]]
17007 !! wikitext
17008 {{/L3Sibling}}
17009 !! html
17010 <p>Sibling article
17011 </p>
17012 !! end
17013
17014 !! test
17015 Non-transclusion because of too many up levels
17016 !! options
17017 subpage title=[[Subpage test/L1/L2/L3]]
17018 !! wikitext
17019 {{../../../../More than parent}}
17020 !! html
17021 <p>{{../../../../More than parent}}
17022 </p>
17023 !! end
17024
17025 !! test
17026 Definition list code coverage
17027 !! wikitext
17028 ; title : def
17029 ; title : def
17030 ;title: def
17031 !! html/php
17032 <dl><dt> title &#160;</dt>
17033 <dd> def</dd>
17034 <dt> title&#160;</dt>
17035 <dd> def</dd>
17036 <dt>title</dt>
17037 <dd> def</dd></dl>
17038
17039 !! html/parsoid
17040 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17041 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17042 <dt>title</dt><dd> def</dd></dl>
17043 !! end
17044
17045 !! test
17046 Don't fall for the self-closing div
17047 !! wikitext
17048 <div>hello world</div/>
17049 !! html
17050 <div>hello world</div>
17051
17052 !! end
17053
17054 !! test
17055 MSGNW magic word
17056 !! wikitext
17057 {{MSGNW:msg}}
17058 !! html
17059 <p>&#91;&#91;:Template:Msg&#93;&#93;
17060 </p>
17061 !! end
17062
17063 !! test
17064 RAW magic word
17065 !! wikitext
17066 {{RAW:QUERTY}}
17067 !! html
17068 <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>
17069 </p>
17070 !! end
17071
17072 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
17073 !! test
17074 Always escape literal '>' in output, not just after '<'
17075 !! wikitext
17076 ><>
17077 !! html
17078 <p>&gt;&lt;&gt;
17079 </p>
17080 !! end
17081
17082 !! test
17083 Template caching
17084 !! wikitext
17085 {{Test}}
17086 {{Test}}
17087 !! html
17088 <p>This is a test template
17089 This is a test template
17090 </p>
17091 !! end
17092
17093
17094 !! article
17095 MediaWiki:Fake
17096 !! text
17097 ==header==
17098 !! endarticle
17099
17100 !! test
17101 Inclusion of !userCanEdit() content
17102 !! wikitext
17103 {{MediaWiki:Fake}}
17104 !! html
17105 <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>
17106
17107 !! end
17108
17109
17110 !! test
17111 Out-of-order TOC heading levels
17112 !! wikitext
17113 ==2==
17114 ======6======
17115 ===3===
17116 =1=
17117 =====5=====
17118 ==2==
17119 !! html
17120 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17121 <ul>
17122 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
17123 <ul>
17124 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
17125 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
17126 </ul>
17127 </li>
17128 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
17129 <ul>
17130 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
17131 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
17132 </ul>
17133 </li>
17134 </ul>
17135 </div>
17136
17137 <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>
17138 <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>
17139 <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>
17140 <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>
17141 <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>
17142 <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>
17143
17144 !! end
17145
17146
17147 !! test
17148 ISBN with a dummy number
17149 !! wikitext
17150 ISBN ---
17151 !! html
17152 <p>ISBN ---
17153 </p>
17154 !! end
17155
17156
17157 !! test
17158 ISBN with space-delimited number
17159 !! wikitext
17160 ISBN 92 9017 032 8
17161 !! html
17162 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
17163 </p>
17164 !! end
17165
17166
17167 !! test
17168 ISBN with multiple spaces, no number
17169 !! wikitext
17170 ISBN foo
17171 !! html
17172 <p>ISBN foo
17173 </p>
17174 !! end
17175
17176
17177 !! test
17178 ISBN length
17179 !! wikitext
17180 ISBN 123456789
17181
17182 ISBN 1234567890
17183
17184 ISBN 12345678901
17185 !! html
17186 <p>ISBN 123456789
17187 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17188 </p><p>ISBN 12345678901
17189 </p>
17190 !! end
17191
17192
17193 !! test
17194 ISBN with trailing year (bug 8110)
17195 !! wikitext
17196 ISBN 1-234-56789-0 - 2006
17197
17198 ISBN 1 234 56789 0 - 2006
17199 !! html
17200 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
17201 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
17202 </p>
17203 !! end
17204
17205
17206 !! test
17207 anchorencode
17208 !! wikitext
17209 {{anchorencode:foo bar©#%n}}
17210 !! html
17211 <p>foo_bar.C2.A9.23.25n
17212 </p>
17213 !! end
17214
17215 !! test
17216 anchorencode trims spaces
17217 !! wikitext
17218 {{anchorencode: __pretty__please__}}
17219 !! html
17220 <p>pretty_please
17221 </p>
17222 !! end
17223
17224 !! test
17225 anchorencode deals with links
17226 !! wikitext
17227 {{anchorencode: [[hello|world]] [[hi]]}}
17228 !! html
17229 <p>world_hi
17230 </p>
17231 !! end
17232
17233 !! test
17234 anchorencode deals with templates
17235 !! wikitext
17236 {{anchorencode: {{Foo}} }}
17237 !! html
17238 <p>FOO
17239 </p>
17240 !! end
17241
17242 !! test
17243 anchorencode encodes like the TOC generator: (bug 18431)
17244 !! wikitext
17245 === _ +:.3A%3A&&amp;]] ===
17246 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17247 __NOEDITSECTION__
17248 !! html
17249 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17250 <p>.2B:.3A.253A.26.26.5D.5D
17251 </p>
17252 !! end
17253
17254 !! test
17255 Bug 6200: blockquotes and paragraph formatting
17256 !! wikitext
17257 <blockquote>
17258 foo
17259 </blockquote>
17260
17261 bar
17262
17263 baz
17264 !! html
17265 <blockquote>
17266 <p>foo
17267 </p>
17268 </blockquote>
17269 <p>bar
17270 </p>
17271 <pre>baz
17272 </pre>
17273 !! end
17274
17275 !! test
17276 Bug 8293: Use of center tag ruins paragraph formatting
17277 !! wikitext
17278 <center>
17279 foo
17280 </center>
17281
17282 bar
17283
17284 baz
17285 !! html
17286 <center>
17287 <p>foo
17288 </p>
17289 </center>
17290 <p>bar
17291 </p>
17292 <pre>baz
17293 </pre>
17294 !! end
17295
17296 !!test
17297 Parsing of overlapping (improperly nested) inline html tags
17298 !! wikitext
17299 <span><s>x</span></s>
17300 !! html/php
17301 <p><span><s>x&lt;/span&gt;</s></span>
17302 </p>
17303 !! html/parsoid
17304 <p><span><s>x</s></span>
17305 </p>
17306 !!end
17307
17308 ###
17309 ### Language variants related tests
17310 ###
17311 !! test
17312 Self-link in language variants
17313 !! options
17314 title=[[Dunav]] language=sr
17315 !! wikitext
17316 Both [[Dunav]] and [[Дунав]] are names for this river.
17317 !! html
17318 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17319 </p>
17320 !!end
17321
17322 !! article
17323 Дуна
17324 !! text
17325 content
17326 !! endarticle
17327
17328 !! test
17329 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17330 !! options
17331 title=[[Duna]] language=sr
17332 !! wikitext
17333 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17334 !! html
17335 <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.
17336 </p>
17337 !! end
17338
17339 !! test
17340 Link to a section of a variant of this title shouldn't be parsed as self-link
17341 !! options
17342 title=[[Duna]] language=sr
17343 !! wikitext
17344 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
17345 !! html
17346 <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.
17347 </p>
17348 !! end
17349
17350 !! test
17351 Link to pages in language variants
17352 !! options
17353 language=sr
17354 !! wikitext
17355 Main Page can be written as [[Маин Паге]]
17356 !! html
17357 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
17358 </p>
17359 !!end
17360
17361
17362 !! test
17363 Multiple links to pages in language variants
17364 !! options
17365 language=sr
17366 !! wikitext
17367 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
17368 !! html
17369 <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>.
17370 </p>
17371 !!end
17372
17373
17374 !! test
17375 Simple template in language variants
17376 !! options
17377 language=sr
17378 !! wikitext
17379 {{тест}}
17380 !! html
17381 <p>This is a test template
17382 </p>
17383 !! end
17384
17385
17386 !! test
17387 Template with explicit namespace in language variants
17388 !! options
17389 language=sr
17390 !! wikitext
17391 {{Template:тест}}
17392 !! html
17393 <p>This is a test template
17394 </p>
17395 !! end
17396
17397
17398 !! test
17399 Basic test for template parameter in language variants
17400 !! options
17401 language=sr
17402 !! wikitext
17403 {{парамтест|param=foo}}
17404 !! html
17405 <p>This is a test template with parameter foo
17406 </p>
17407 !! end
17408
17409
17410 !! test
17411 Simple category in language variants
17412 !! options
17413 language=sr cat
17414 !! wikitext
17415 [[Category:МедиаWики Усер'с Гуиде]]
17416 !! html
17417 <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>
17418 !! end
17419
17420
17421 !! article
17422 Category:分类
17423 !! text
17424 blah
17425 !! endarticle
17426
17427 !! article
17428 Category:分類
17429 !! text
17430 blah
17431 !! endarticle
17432
17433 !! test
17434 Don't convert blue categorylinks to another variant (bug 33210)
17435 !! options
17436 language=zh cat
17437 !! wikitext
17438 [[A]][[Category:分类]]
17439 !! html
17440 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
17441 !! end
17442
17443
17444 !! test
17445 Stripping -{}- tags (language variants)
17446 !! options
17447 language=sr
17448 !! wikitext
17449 Latin proverb: -{Ne nuntium necare}-
17450 !! html
17451 <p>Latin proverb: Ne nuntium necare
17452 </p>
17453 !! end
17454
17455
17456 !! test
17457 Prevent conversion with -{}- tags (language variants)
17458 !! options
17459 language=sr variant=sr-ec
17460 !! wikitext
17461 Latinski: -{Ne nuntium necare}-
17462 !! html
17463 <p>Латински: Ne nuntium necare
17464 </p>
17465 !! end
17466
17467
17468 !! test
17469 Prevent conversion of text with -{}- tags (language variants)
17470 !! options
17471 language=sr variant=sr-ec
17472 !! wikitext
17473 Latinski: -{Ne nuntium necare}-
17474 !! html
17475 <p>Латински: Ne nuntium necare
17476 </p>
17477 !! end
17478
17479
17480 !! test
17481 Prevent conversion of links with -{}- tags (language variants)
17482 !! options
17483 language=sr variant=sr-ec
17484 !! wikitext
17485 -{[[Main Page]]}-
17486 !! html
17487 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17488 </p>
17489 !! end
17490
17491
17492 !! test
17493 -{}- tags within headlines (within html for parserConvert())
17494 !! options
17495 language=sr variant=sr-ec
17496 !! wikitext
17497 == -{Naslov}- ==
17498 !! html
17499 <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>
17500
17501 !! end
17502
17503
17504 !! test
17505 Explicit definition of language variant alternatives
17506 !! options
17507 language=zh variant=zh-tw
17508 !! wikitext
17509 -{zh:China;zh-tw:Taiwan}-, not China
17510 !! html
17511 <p>Taiwan, not China
17512 </p>
17513 !! end
17514
17515
17516 !! test
17517 Conversion around HTML tags
17518 !! options
17519 language=sr variant=sr-ec
17520 !! wikitext
17521 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
17522 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
17523 !! html
17524 <p>
17525 <span title="ЛаCтин">ски</span>
17526 </p>
17527 !! end
17528
17529
17530 !! test
17531 Explicit session-wise language variant mapping (A flag and - flag)
17532 !! options
17533 language=zh variant=zh-tw
17534 !! wikitext
17535 Taiwan is not China.
17536 But -{A|zh:China;zh-tw:Taiwan}- is China,
17537 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
17538 and -{China}- is China.
17539 !! html
17540 <p>Taiwan is not China.
17541 But Taiwan is Taiwan,
17542 (This should be stripped!)
17543 and China is China.
17544 </p>
17545 !! end
17546
17547 !! test
17548 Explicit session-wise language variant mapping (H flag for hide)
17549 !! options
17550 language=zh variant=zh-tw
17551 !! wikitext
17552 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
17553 Taiwan is China.
17554 !! html
17555 <p>(This should be stripped!)
17556 Taiwan is Taiwan.
17557 </p>
17558 !! end
17559
17560 !! test
17561 Adding explicit conversion rule for title (T flag)
17562 !! options
17563 language=zh variant=zh-tw showtitle
17564 !! wikitext
17565 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17566 !! html
17567 Taiwan
17568 <p>Should be stripped!
17569 </p>
17570 !! end
17571
17572 !! test
17573 Testing that changing the language variant here in the tests actually works
17574 !! options
17575 language=zh variant=zh showtitle
17576 !! wikitext
17577 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17578 !! html
17579 China
17580 <p>Should be stripped!
17581 </p>
17582 !! end
17583
17584 !! test
17585 Recursive conversion of alt and title attrs shouldn't clear converter state
17586 !! options
17587 language=zh variant=zh-cn showtitle
17588 !! wikitext
17589 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
17590 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
17591 !! html
17592 China
17593 <p>
17594 Should be stripped<span title="Exclamation">!</span>
17595 </p>
17596 !! end
17597
17598 !! test
17599 Bug 24072: more test on conversion rule for title
17600 !! options
17601 language=zh variant=zh-tw showtitle
17602 !! wikitext
17603 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17604 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
17605 !! html
17606 Taiwan
17607 <p>This should be stripped!
17608 This won't take interferes with the title rule.
17609 </p>
17610 !! end
17611
17612 !! test
17613 Partly disable title conversion if variant == main language code
17614 !! options
17615 language=zh variant=zh title=[[ZH]] showtitle
17616 !! wikitext
17617 -{T|zh-cn:CN;zh-tw:TW}-
17618 !! html
17619 ZH
17620 <p>
17621 </p>
17622 !! end
17623
17624 !! test
17625 Partly disable title conversion if variant == main language code, more
17626 !! options
17627 language=zh variant=zh title=[[ZH]] showtitle
17628 !! wikitext
17629 -{T|TW}-
17630 !! html
17631 ZH
17632 <p>
17633 </p>
17634 !! end
17635
17636 !! test
17637 Raw output of variant escape tags (R flag)
17638 !! options
17639 language=zh variant=zh-tw
17640 !! wikitext
17641 Raw: -{R|zh:China;zh-tw:Taiwan}-
17642 !! html
17643 <p>Raw: zh:China;zh-tw:Taiwan
17644 </p>
17645 !! end
17646
17647 !! test
17648 Nested using of manual convert syntax
17649 !! options
17650 language=zh variant=zh-hk
17651 !! wikitext
17652 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
17653 !! html
17654 <p>Nested: Hello Hong Kong!
17655 </p>
17656 !! end
17657
17658 !! test
17659 Proper conversion of text in external links
17660 !! options
17661 language=sr variant=sr-ec
17662 !! wikitext
17663 http://www.google.com
17664 gopher://www.google.com
17665 [http://www.google.com http://www.google.com]
17666 [gopher://www.google.com gopher://www.google.com]
17667 [https://www.google.com irc://www.google.com]
17668 [ftp://www.google.com www.google.com/ftp://dir]
17669 [//www.google.com www.google.com]
17670 !! html
17671 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17672 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17673 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17674 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17675 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
17676 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
17677 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
17678 </p>
17679 !! end
17680
17681 !! test
17682 Do not convert roman numbers to language variants
17683 !! options
17684 language=sr variant=sr-ec
17685 !! wikitext
17686 Fridrih IV je car.
17687 !! html
17688 <p>Фридрих IV је цар.
17689 </p>
17690 !! end
17691
17692 !! test
17693 Unclosed language converter markup "-{"
17694 !! options
17695 language=sr
17696 !! wikitext
17697 -{T|hello
17698 !! html
17699 <p>-{T|hello
17700 </p>
17701 !! end
17702
17703 !! test
17704 Don't convert raw rule "-{R|=&gt;}-" to "=>"
17705 !! options
17706 language=sr
17707 !! wikitext
17708 -{R|=&gt;}-
17709 !! html
17710 <p>=&gt;
17711 </p>
17712 !!end
17713
17714 !! test
17715 Don't break link parsing if language converter markup is in the caption.
17716 !! options
17717 language=sr variant=sr-ec
17718 !! wikitext
17719 [[Main Page|-{R|main page}-]]
17720 !! html
17721 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
17722 </p>
17723 !! end
17724
17725 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17726 !! test
17727 Don't break image parsing if language converter markup is in the caption.
17728 !! options
17729 language=sr
17730 !! wikitext
17731 [[File:Foobar.jpg|-{R|caption}-]]
17732 !! html/parsoid
17733 <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>
17734 </p>
17735 !! end
17736
17737 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17738 !! test
17739 Don't break list handling if language converter markup is in the item.
17740 !! options
17741 language=zh variant=zh-cn
17742 !! wikitext
17743 ;-{zh-cn:AAA;zh-tw:BBB}-
17744 !! html/php
17745 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
17746
17747 !! html/parsoid
17748 <dl><dt>AAA
17749 </dt></dl>
17750 !! end
17751
17752 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17753 !! test
17754 Don't break table handling if language converter markup is in the cell.
17755 !! options
17756 language=sr variant=sr-ec
17757 !! wikitext
17758 {|
17759 |-
17760 | -{R|B}-
17761 |}
17762 !! html/php
17763 <table>
17764
17765 <tr>
17766 <td>Б}-
17767 </td></tr></table>
17768
17769 !! html/parsoid
17770 <table>
17771
17772 <tr>
17773 <td> B
17774 </td></tr></table>
17775
17776 !! end
17777
17778 !! test
17779 Bug 529: Uncovered bullet
17780 !! wikitext
17781 * Foo {{bullet}}
17782 !! html
17783 <ul><li> Foo </li>
17784 <li> Bar</li></ul>
17785
17786 !! end
17787
17788 # Plain MediaWiki does not remove empty lists, but tidy actually does.
17789 # Templates in Wikipedia rely on this behavior, as tidy has always been
17790 # enabled there. These tests are normally run *without* tidy, so specify the
17791 # full output here.
17792 # To test realistic parsing behavior, apply a tidy-like transformation to both
17793 # the expected output and your parser's output.
17794 !! test
17795 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
17796 !! wikitext
17797 ******* Foo {{bullet}}
17798 !! html
17799 <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>
17800 <li> Bar</li></ul>
17801
17802 !! end
17803
17804 !! test
17805 Bug 529: Uncovered table already at line-start
17806 !! wikitext
17807 x
17808
17809 {{table}}
17810 y
17811 !! html
17812 <p>x
17813 </p>
17814 <table>
17815 <tr>
17816 <td> 1 </td>
17817 <td> 2
17818 </td></tr>
17819 <tr>
17820 <td> 3 </td>
17821 <td> 4
17822 </td></tr></table>
17823 <p>y
17824 </p>
17825 !! end
17826
17827 !! test
17828 Bug 529: Uncovered bullet in parser function result
17829 !! wikitext
17830 * Foo {{lc:{{bullet}} }}
17831 !! html
17832 <ul><li> Foo </li>
17833 <li> bar</li></ul>
17834
17835 !! end
17836
17837 !! test
17838 Bug 5678: Double-parsed template argument
17839 !! wikitext
17840 {{lc:{{{1}}}|hello}}
17841 !! html
17842 <p>{{{1}}}
17843 </p>
17844 !! end
17845
17846 !! test
17847 Bug 5678: Double-parsed template invocation
17848 !! wikitext
17849 {{lc:{{paramtest {{!}} param = hello }} }}
17850 !! html
17851 <p>{{paramtest | param = hello }}
17852 </p>
17853 !! end
17854
17855 !! test
17856 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
17857 !! options
17858 language=cs
17859 title=[[Main Page]]
17860 !! wikitext
17861 {{PRVNÍVELKÉ:ěščř}}
17862 {{prvnívelké:ěščř}}
17863 {{PRVNÍMALÉ:ěščř}}
17864 {{prvnímalé:ěščř}}
17865 {{MALÁ:ěščř}}
17866 {{malá:ěščř}}
17867 {{VELKÁ:ěščř}}
17868 {{velká:ěščř}}
17869 !! html
17870 <p>Ěščř
17871 Ěščř
17872 ěščř
17873 ěščř
17874 ěščř
17875 ěščř
17876 ĚŠČŘ
17877 ĚŠČŘ
17878 </p>
17879 !! end
17880
17881 !! test
17882 Morwen/13: Unclosed link followed by heading
17883 !! wikitext
17884 [[link
17885 ==heading==
17886 !! html
17887 <p>[[link
17888 </p>
17889 <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>
17890
17891 !! end
17892
17893 !! test
17894 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
17895 !! wikitext
17896 {{foo|
17897 =heading=
17898 !! html
17899 <p>{{foo|
17900 </p>
17901 <h1><span class="mw-headline" id="heading">heading</span></h1>
17902
17903 !! end
17904
17905 !! test
17906 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
17907 !! wikitext
17908 {{foo|
17909 ==heading==
17910 !! html
17911 <p>{{foo|
17912 </p>
17913 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17914
17915 !! end
17916
17917 !! test
17918 Tildes in comments
17919 !! options
17920 pst
17921 !! wikitext
17922 <!-- ~~~~ -->
17923 !! html
17924 <!-- ~~~~ -->
17925 !! end
17926
17927 !! test
17928 Paragraphs inside divs (no extra line breaks)
17929 !! wikitext
17930 <div>Line one
17931
17932 Line two</div>
17933 !! html
17934 <div>Line one
17935 Line two</div>
17936
17937 !! end
17938
17939 !! test
17940 Paragraphs inside divs (extra line break on open)
17941 !! wikitext
17942 <div>
17943 Line one
17944
17945 Line two</div>
17946 !! html
17947 <div>
17948 <p>Line one
17949 </p>
17950 Line two</div>
17951
17952 !! end
17953
17954 !! test
17955 Paragraphs inside divs (extra line break on close)
17956 !! wikitext
17957 <div>Line one
17958
17959 Line two
17960 </div>
17961 !! html
17962 <div>Line one
17963 <p>Line two
17964 </p>
17965 </div>
17966
17967 !! end
17968
17969 !! test
17970 Paragraphs inside divs (extra line break on open and close)
17971 !! wikitext
17972 <div>
17973 Line one
17974
17975 Line two
17976 </div>
17977 !! html
17978 <div>
17979 <p>Line one
17980 </p><p>Line two
17981 </p>
17982 </div>
17983
17984 !! end
17985
17986 !! test
17987 Nesting tags, paragraphs on lines which begin with <div>
17988 !! wikitext
17989 <div></div><strong>A
17990 B</strong>
17991 !! html/php+tidy
17992 <p><strong>A</strong></p>
17993 <p><strong>B</strong></p>
17994 !! html/parsoid
17995 <div></div>
17996 <p><strong>A
17997 B</strong>
17998 </p>
17999 !! end
18000
18001 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
18002 !! test
18003 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
18004 !! wikitext
18005 <blockquote>Line one
18006
18007 Line two</blockquote>
18008 !! html
18009 <blockquote>Line one
18010 Line two</blockquote>
18011
18012 !! html+tidy
18013 <blockquote>
18014 <p>Line one Line two</p>
18015 </blockquote>
18016 !! end
18017
18018 !! test
18019 Bug 6200: paragraphs inside blockquotes (extra line break on open)
18020 !! wikitext
18021 <blockquote>
18022 Line one
18023
18024 Line two</blockquote>
18025 !! html
18026 <blockquote>
18027 <p>Line one
18028 </p>
18029 Line two</blockquote>
18030
18031 !! html+tidy
18032 <blockquote>
18033 <p>Line one</p>
18034 Line two</blockquote>
18035 !! end
18036
18037 !! test
18038 Bug 6200: paragraphs inside blockquotes (extra line break on close)
18039 !! wikitext
18040 <blockquote>Line one
18041
18042 Line two
18043 </blockquote>
18044 !! html
18045 <blockquote>Line one
18046 <p>Line two
18047 </p>
18048 </blockquote>
18049
18050 !! html+tidy
18051 <blockquote>
18052 <p>Line one</p>
18053 <p>Line two</p>
18054 </blockquote>
18055 !! end
18056
18057 !! test
18058 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
18059 !! wikitext
18060 <blockquote>
18061 Line one
18062
18063 Line two
18064 </blockquote>
18065 !! html
18066 <blockquote>
18067 <p>Line one
18068 </p><p>Line two
18069 </p>
18070 </blockquote>
18071
18072 !! html+tidy
18073 <blockquote>
18074 <p>Line one</p>
18075 <p>Line two</p>
18076 </blockquote>
18077 !! end
18078
18079 !! test
18080 Paragraphs inside blockquotes/divs (no extra line breaks)
18081 !! wikitext
18082 <blockquote><div>Line one
18083
18084 Line two</div></blockquote>
18085 !! html
18086 <blockquote><div>Line one
18087 Line two</div></blockquote>
18088
18089 !! end
18090
18091 !! test
18092 Paragraphs inside blockquotes/divs (extra line break on open)
18093 !! wikitext
18094 <blockquote><div>
18095 Line one
18096
18097 Line two</div></blockquote>
18098 !! html
18099 <blockquote><div>
18100 <p>Line one
18101 </p>
18102 Line two</div></blockquote>
18103
18104 !! end
18105
18106 !! test
18107 Paragraphs inside blockquotes/divs (extra line break on close)
18108 !! wikitext
18109 <blockquote><div>Line one
18110
18111 Line two
18112 </div></blockquote>
18113 !! html
18114 <blockquote><div>Line one
18115 <p>Line two
18116 </p>
18117 </div></blockquote>
18118
18119 !! end
18120
18121 !! test
18122 Paragraphs inside blockquotes/divs (extra line break on open and close)
18123 !! wikitext
18124 <blockquote><div>
18125 Line one
18126
18127 Line two
18128 </div></blockquote>
18129 !! html
18130 <blockquote><div>
18131 <p>Line one
18132 </p><p>Line two
18133 </p>
18134 </div></blockquote>
18135
18136 !! end
18137
18138 !! test
18139 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
18140 !! options
18141 wgLinkHolderBatchSize=0
18142 !! wikitext
18143 [[meatball:1]]
18144 [[meatball:2]]
18145 [[meatball:3]]
18146 !! html
18147 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
18148 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
18149 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
18150 </p>
18151 !! end
18152
18153 !! test
18154 Free external link invading image caption
18155 !! wikitext
18156 [[Image:Foobar.jpg|thumb|http://x|hello]]
18157 !! html
18158 <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>
18159
18160 !! end
18161
18162 !! test
18163 Bug 15196: localised external link numbers
18164 !! options
18165 language=fa
18166 !! wikitext
18167 [http://en.wikipedia.org/]
18168 !! html/php
18169 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
18170 </p>
18171 !! html/parsoid
18172 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
18173 !! end
18174
18175 !! test
18176 Multibyte character in padleft
18177 !! wikitext
18178 {{padleft:-Hello|7|Æ}}
18179 !! html
18180 <p>Æ-Hello
18181 </p>
18182 !! end
18183
18184 !! test
18185 Multibyte character in padright
18186 !! wikitext
18187 {{padright:Hello-|7|Æ}}
18188 !! html
18189 <p>Hello-Æ
18190 </p>
18191 !! end
18192
18193 !!test
18194 formatdate parser function
18195 !! wikitext
18196 {{#formatdate:2009-03-24}}
18197 !! html
18198 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
18199 </p>
18200 !! end
18201
18202 !!test
18203 formatdate parser function, with default format
18204 !! wikitext
18205 {{#formatdate:2009-03-24|mdy}}
18206 !! html
18207 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
18208 </p>
18209 !! end
18210
18211 !! test
18212 Spacing of numbers in formatted dates
18213 !! wikitext
18214 {{#formatdate:January 15}}
18215 !! html
18216 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18217 </p>
18218 !! end
18219
18220 !! test
18221 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
18222 !! options
18223 language=nl title=[[MediaWiki:Common.css]]
18224 !! wikitext
18225 {{#formatdate:2009-03-24|dmy}}
18226 !! html
18227 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18228 </p>
18229 !! end
18230
18231 #
18232 #
18233 #
18234
18235 #
18236 # Edit comments
18237 #
18238
18239 !! test
18240 Edit comment with link
18241 !! options
18242 comment
18243 !! wikitext
18244 I like the [[Main Page]] a lot
18245 !! html
18246 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18247 !!end
18248
18249 !! test
18250 Edit comment with link and link text
18251 !! options
18252 comment
18253 !! wikitext
18254 I like the [[Main Page|best pages]] a lot
18255 !! html
18256 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18257 !!end
18258
18259 !! test
18260 Edit comment with link and link text with suffix
18261 !! options
18262 comment
18263 !! wikitext
18264 I like the [[Main Page|best page]]s a lot
18265 !! html
18266 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18267 !!end
18268
18269 !! test
18270 Edit comment with section link (non-local, eg in history list)
18271 !! options
18272 comment title=[[Main Page]]
18273 !! wikitext
18274 /* External links */ removed bogus entries
18275 !! html
18276 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18277 !!end
18278
18279 !! test
18280 Edit comment with section link and text before it (non-local, eg in history list)
18281 !! options
18282 comment title=[[Main Page]]
18283 !! wikitext
18284 pre-comment text /* External links */ removed bogus entries
18285 !! html
18286 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>
18287 !!end
18288
18289 !! test
18290 Edit comment with section link (local, eg in diff view)
18291 !! options
18292 comment local title=[[Main Page]]
18293 !! wikitext
18294 /* External links */ removed bogus entries
18295 !! html
18296 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18297 !!end
18298
18299 !! test
18300 Edit comment with subpage link (bug 14080)
18301 !! options
18302 comment
18303 subpage
18304 title=[[Subpage test]]
18305 !! wikitext
18306 Poked at a [[/subpage]] here...
18307 !! html
18308 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
18309 !!end
18310
18311 !! test
18312 Edit comment with subpage link and link text (bug 14080)
18313 !! options
18314 comment
18315 subpage
18316 title=[[Subpage test]]
18317 !! wikitext
18318 Poked at a [[/subpage|neat little page]] here...
18319 !! html
18320 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
18321 !!end
18322
18323 !! test
18324 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
18325 !! options
18326 comment
18327 title=[[Subpage test]]
18328 !! wikitext
18329 Poked at a [[/subpage]] here...
18330 !! html
18331 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...
18332 !!end
18333
18334 !! test
18335 Edit comment with bare anchor link (local, as on diff)
18336 !! options
18337 comment
18338 local
18339 title=[[Main Page]]
18340 !! wikitext
18341 [[#section]]
18342 !! html
18343 <a href="#section">#section</a>
18344 !! end
18345
18346 !! test
18347 Edit comment with bare anchor link (non-local, as on history)
18348 !! options
18349 comment
18350 title=[[Main Page]]
18351 !! wikitext
18352 [[#section]]
18353 !! html
18354 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
18355 !! end
18356
18357 !! test
18358 Anchor starting with underscore
18359 !! wikitext
18360 [[#_ref|One]]
18361 !! html
18362 <p><a href="#_ref">One</a>
18363 </p>
18364 !! end
18365
18366 !! test
18367 Id starting with underscore
18368 !! wikitext
18369 <div id="_ref"></div>
18370 !! html
18371 <div id="_ref"></div>
18372
18373 !! end
18374
18375 !! test
18376 Space normalisation on autocomment (bug 22784)
18377 !! options
18378 comment
18379 title=[[Main Page]]
18380 !! wikitext
18381 /* __hello__world__ */
18382 !! html
18383 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
18384 !! end
18385
18386 !! test
18387 percent-encoding and + signs in comments (Bug 26410)
18388 !! options
18389 comment
18390 !! wikitext
18391 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
18392 !! html
18393 <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>
18394 !! end
18395
18396 # Parsoid doesn't support this yet: see bug 73581
18397 # but it *should* omit the 'src' attribute if the image is bad.
18398 # PHP side of tests was disabled in
18399 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
18400 # because of issues in the PHP parserTests infrastructure
18401 # (but the output below is indeed what the PHP side emits)
18402 !! test
18403 Bad images - basic functionality
18404 !! wikitext
18405 [[File:Bad.jpg]]
18406 !! DISABLED/html/php
18407 !! html/parsoid
18408 <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>
18409 !! end
18410
18411 !! test
18412 Bad images - bug 16039: text after bad image disappears
18413 !! wikitext
18414 Foo bar
18415 [[File:Bad.jpg]]
18416 Bar foo
18417 !! DISABLED/html/php
18418 <p>Foo bar
18419 </p><p>Bar foo
18420 </p>
18421 !! html/parsoid
18422 <p>Foo bar
18423 <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>
18424 Bar foo</p>
18425 !! end
18426
18427 !! test
18428 Verify that displaytitle works (bug #22501) no displaytitle
18429 !! options
18430 showtitle
18431 !! config
18432 wgAllowDisplayTitle=true
18433 wgRestrictDisplayTitle=false
18434 !! wikitext
18435 this is not the the title
18436 !! html
18437 Parser test
18438 <p>this is not the the title
18439 </p>
18440 !! end
18441
18442 !! test
18443 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
18444 !! options
18445 showtitle
18446 title=[[Screen]]
18447 !! config
18448 wgAllowDisplayTitle=true
18449 wgRestrictDisplayTitle=false
18450 !! wikitext
18451 this is not the the title
18452 {{DISPLAYTITLE:whatever}}
18453 !! html
18454 whatever
18455 <p>this is not the the title
18456 </p>
18457 !! end
18458
18459 !! test
18460 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
18461 !! options
18462 showtitle
18463 title=[[Screen]]
18464 !! config
18465 wgAllowDisplayTitle=true
18466 wgRestrictDisplayTitle=true
18467 !! wikitext
18468 this is not the the title
18469 {{DISPLAYTITLE:whatever}}
18470 !! html
18471 Screen
18472 <p>this is not the the title
18473 </p>
18474 !! end
18475
18476 !! test
18477 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
18478 !! options
18479 showtitle
18480 title=[[Screen]]
18481 !! config
18482 wgAllowDisplayTitle=true
18483 wgRestrictDisplayTitle=true
18484 !! wikitext
18485 this is not the the title
18486 {{DISPLAYTITLE:screen}}
18487 !! html
18488 screen
18489 <p>this is not the the title
18490 </p>
18491 !! end
18492
18493 !! test
18494 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
18495 !! options
18496 showtitle
18497 title=[[Screen]]
18498 !! config
18499 wgAllowDisplayTitle=false
18500 !! wikitext
18501 this is not the the title
18502 {{DISPLAYTITLE:screen}}
18503 !! html
18504 Screen
18505 <p>this is not the the title
18506 <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>
18507 </p>
18508 !! end
18509
18510 !! test
18511 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
18512 !! options
18513 showtitle
18514 title=[[Screen]]
18515 !! config
18516 wgAllowDisplayTitle=false
18517 !! wikitext
18518 this is not the the title
18519 !! html
18520 Screen
18521 <p>this is not the the title
18522 </p>
18523 !! end
18524
18525 !! test
18526 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
18527 !! options
18528 showtitle
18529 title=[[Screen]]
18530 !! config
18531 wgAllowDisplayTitle=true
18532 wgRestrictDisplayTitle=true
18533 !! wikitext
18534 this is not the the title
18535 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
18536 !! html
18537 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
18538 <p>this is not the the title
18539 </p>
18540 !! end
18541
18542 !! test
18543 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
18544 !! options
18545 showtitle
18546 title=[[Screen]]
18547 !! config
18548 wgAllowDisplayTitle=true
18549 wgRestrictDisplayTitle=true
18550 !! wikitext
18551 this is not the the title
18552 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
18553 !! html
18554 <span style="color: red;">s</span>creen
18555 <p>this is not the the title
18556 </p>
18557 !! end
18558
18559 !! test
18560 preload: check <noinclude> and <includeonly>
18561 !! options
18562 preload
18563 !! wikitext
18564 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
18565 !! html
18566 Hello kind world.
18567 !! end
18568
18569 !! test
18570 preload: check <onlyinclude>
18571 !! options
18572 preload
18573 !! wikitext
18574 Goodbye <onlyinclude>Hello world</onlyinclude>
18575 !! html
18576 Hello world
18577 !! end
18578
18579 !! test
18580 preload: can pass tags through if we want to
18581 !! options
18582 preload
18583 !! wikitext
18584 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
18585 !! html
18586 <includeonly>Hello world</includeonly>
18587 !! end
18588
18589 !! test
18590 preload: check that it doesn't try to do tricks
18591 !! options
18592 preload
18593 !! wikitext
18594 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18595 !! html
18596 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18597 !! end
18598
18599 !! test
18600 Play a bit with r67090 and bug 3158
18601 !! wikitext
18602 <div style="width:50% !important">&nbsp;</div>
18603 <div style="width:50%&nbsp;!important">&nbsp;</div>
18604 <div style="width:50%&#160;!important">&nbsp;</div>
18605 <div style="border : solid;">&nbsp;</div>
18606 !! html/php
18607 <div style="width:50% !important">&#160;</div>
18608 <div style="width:50% !important">&#160;</div>
18609 <div style="width:50% !important">&#160;</div>
18610 <div style="border&#160;: solid;">&#160;</div>
18611
18612 !! html/parsoid
18613 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18614 <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>
18615 <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>
18616 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18617
18618 !! end
18619
18620 !! test
18621 HTML5 data attributes
18622 !! wikitext
18623 <span data-foo="bar">Baz</span>
18624 <p data-abc-def_hij="">Quuz</p>
18625 !! html
18626 <p><span data-foo="bar">Baz</span>
18627 </p>
18628 <p data-abc-def_hij="">Quuz</p>
18629
18630 !! end
18631
18632 !! test
18633 percent-encoding and + signs in internal links (Bug 26410)
18634 !! wikitext
18635 [[User:+%]] [[Page+title%]]
18636 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
18637 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
18638 [[%33%45]] [[%33%45+]]
18639 !! html/php
18640 <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>
18641 <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>
18642 <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>
18643 <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>
18644 </p>
18645 !! html/parsoid
18646 <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>
18647 !! end
18648
18649 !! test
18650 Special characters in embedded file links (bug 27679)
18651 !! wikitext
18652 [[File:Contains & ampersand.jpg]]
18653 [[File:Does not exist.jpg|Title with & ampersand]]
18654 !! html/php
18655 <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>
18656 <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>
18657 </p>
18658 !! html/parsoid
18659 <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>
18660 <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>
18661 !! end
18662
18663 !! test
18664 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
18665 !! wikitext
18666 Text&apos;s been normalized?
18667 !! html
18668 <p>Text&#39;s been normalized?
18669 </p>
18670 !! end
18671
18672 !! test
18673 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
18674 !! wikitext
18675 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
18676 !! html
18677 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
18678 </p>
18679 !! end
18680
18681 !! test
18682 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
18683 !! wikitext
18684 [http://www.example.org/ ideograms]
18685 !! html
18686 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
18687 </p>
18688 !! end
18689
18690 !! test
18691 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
18692 !! wikitext
18693 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
18694 !! html
18695 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
18696 </p>
18697 !! end
18698
18699 !! article
18700 Mediawiki:loop1
18701 !! text
18702 {{Identical|A}}
18703 !! endarticle
18704
18705 !! article
18706 Mediawiki:loop2
18707 !! text
18708 {{Identical|B}}
18709 !! endarticle
18710
18711 !! article
18712 Template:Identical
18713 !! text
18714 {{int:loop1}}
18715 {{int:loop2}}
18716 !! endarticle
18717
18718 !! test
18719 Bug 31098 Template which includes system messages which includes the template
18720 !! wikitext
18721 {{Identical}}
18722 !! html
18723 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18724 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18725 </p>
18726 !! end
18727
18728 !! test
18729 Bug31490 Turkish: ucfirst 'blah'
18730 !! options
18731 language=tr
18732 !! wikitext
18733 {{ucfirst:blah}}
18734 !! html
18735 <p>Blah
18736 </p>
18737 !! end
18738
18739 !! test
18740 Bug31490 Turkish: ucfirst 'ix'
18741 !! options
18742 language=tr
18743 !! wikitext
18744 {{ucfirst:ix}}
18745 !! html
18746 <p>İx
18747 </p>
18748 !! end
18749
18750 !! test
18751 Bug31490 Turkish: lcfirst 'BLAH'
18752 !! options
18753 language=tr
18754 !! wikitext
18755 {{lcfirst:BLAH}}
18756 !! html
18757 <p>bLAH
18758 </p>
18759 !! end
18760
18761 !! test
18762 Bug31490 Turkish: ucfırst (with a dotless i)
18763 !! options
18764 language=tr
18765 !! wikitext
18766 {{ucfırst:blah}}
18767 !! html
18768 <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>
18769 </p>
18770 !! end
18771
18772 !! test
18773 Bug31490 ucfırst (with a dotless i) with English language
18774 !! options
18775 language=en
18776 !! wikitext
18777 {{ucfırst:blah}}
18778 !! html
18779 <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>
18780 </p>
18781 !! end
18782
18783 !! test
18784 Bug 26375: TOC with italics
18785 !! options
18786 title=[[Main Page]]
18787 !! wikitext
18788 __TOC__
18789 == ''Lost'' episodes ==
18790 !! html
18791 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18792 <ul>
18793 <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>
18794 </ul>
18795 </div>
18796
18797 <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>
18798
18799 !! end
18800
18801 !! test
18802 Bug 26375: TOC with bold
18803 !! options
18804 title=[[Main Page]]
18805 !! wikitext
18806 __TOC__
18807 == '''should be bold''' then normal text ==
18808 !! html
18809 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18810 <ul>
18811 <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>
18812 </ul>
18813 </div>
18814
18815 <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>
18816
18817 !! end
18818
18819 !! test
18820 Bug 33845: Headings become cursive in TOC when they contain an image
18821 !! options
18822 title=[[Main Page]]
18823 !! wikitext
18824 __TOC__
18825 == Image [[Image:foobar.jpg]] ==
18826 !! html
18827 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18828 <ul>
18829 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
18830 </ul>
18831 </div>
18832
18833 <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>
18834
18835 !! end
18836
18837 !! test
18838 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
18839 !! options
18840 title=[[Main Page]]
18841 !! wikitext
18842 __TOC__
18843 == <blockquote>Quote</blockquote> ==
18844 !! html
18845 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18846 <ul>
18847 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18848 </ul>
18849 </div>
18850
18851 <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>
18852
18853 !! html+tidy
18854 <div id="toc" class="toc">
18855 <div id="toctitle">
18856 <h2>Contents</h2>
18857 </div>
18858 <ul>
18859 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18860 </ul>
18861 </div>
18862 <h2><span class="mw-headline" id="Quote"></span></h2>
18863 <blockquote>
18864 <p><span class="mw-headline" id="Quote">Quote</span></p>
18865 </blockquote>
18866 <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>
18867 !! end
18868
18869 !! test
18870 Unclosed tags in TOC
18871 !! options
18872 title=[[Main Page]]
18873 !! wikitext
18874 __TOC__
18875 == Proof: 2 < 3 ==
18876 <small>Hanc marginis exiguitas non caperet.</small>
18877 QED
18878 !! html
18879 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18880 <ul>
18881 <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>
18882 </ul>
18883 </div>
18884
18885 <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>
18886 <p><small>Hanc marginis exiguitas non caperet.</small>
18887 QED
18888 </p>
18889 !! end
18890
18891 !! test
18892 Multiple tags in TOC
18893 !! wikitext
18894 __TOC__
18895 == <i>Foo</i> <b>Bar</b> ==
18896
18897 == <i>Foo</i> <blockquote>Bar</blockquote> ==
18898 !! html
18899 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18900 <ul>
18901 <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>
18902 <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>
18903 </ul>
18904 </div>
18905
18906 <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>
18907 <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>
18908
18909 !! html+tidy
18910 <div id="toc" class="toc">
18911 <div id="toctitle">
18912 <h2>Contents</h2>
18913 </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 <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>
18920 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
18921 <blockquote>
18922 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
18923 </blockquote>
18924 <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>
18925 !! end
18926
18927 !! test
18928 Tags with parameters in TOC
18929 !! wikitext
18930 __TOC__
18931 == <sup class="in-h2">Hello</sup> ==
18932
18933 == <sup class="a > b">Evilbye</sup> ==
18934 !! html
18935 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18936 <ul>
18937 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
18938 <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>
18939 </ul>
18940 </div>
18941
18942 <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>
18943 <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>
18944
18945 !! end
18946
18947 !! test
18948 span tags with directionality in TOC
18949 !! wikitext
18950 __TOC__
18951 == <span dir="ltr">C++</span> ==
18952
18953 == <span dir="rtl">זבנג!</span> ==
18954
18955 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
18956
18957 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
18958
18959 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
18960 !! html
18961 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18962 <ul>
18963 <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>
18964 <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>
18965 <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>
18966 <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>
18967 <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>
18968 </ul>
18969 </div>
18970
18971 <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>
18972 <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>
18973 <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>
18974 <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>
18975 <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>
18976
18977 !! end
18978
18979 !! article
18980 MediaWiki:Bug32057
18981 !! text
18982 == {{int:headline_sample}} ==
18983 !! endarticle
18984
18985 !! test
18986 Bug 32057: Title needed when expanding <h> nodes.
18987 !! options
18988 title=[[Main Page]]
18989 !! wikitext
18990 {{int:Bug32057}}
18991 !! html
18992 <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>
18993
18994 !! end
18995
18996 !! test
18997 Strip marker in urlencode
18998 !! wikitext
18999 {{urlencode:x<nowiki/>y}}
19000 {{urlencode:x<nowiki/>y|wiki}}
19001 {{urlencode:x<nowiki/>y|path}}
19002 !! html
19003 <p>xy
19004 xy
19005 xy
19006 </p>
19007 !! end
19008
19009 !! test
19010 Strip marker in lc
19011 !! wikitext
19012 {{lc:x<nowiki/>y}}
19013 !! html
19014 <p>xy
19015 </p>
19016 !! end
19017
19018 !! test
19019 Strip marker in uc
19020 !! wikitext
19021 {{uc:x<nowiki/>y}}
19022 !! html
19023 <p>XY
19024 </p>
19025 !! end
19026
19027 !! test
19028 Strip marker in formatNum
19029 !! wikitext
19030 {{formatnum:1<nowiki/>2}}
19031 {{formatnum:1<nowiki/>2|R}}
19032 !! html
19033 <p>12
19034 12
19035 </p>
19036 !! end
19037
19038 !! test
19039 Check noCommafy in formatNum
19040 !! options
19041 language=be-tarask
19042 !! wikitext
19043 {{formatnum:123456.78}}
19044 {{formatnum:123456.78|NOSEP}}
19045 !! html
19046 <p>123 456,78
19047 123456.78
19048 </p>
19049 !! end
19050
19051 !! test
19052 Wrong option for formatNum (bug 56199)
19053 !! wikitext
19054 {{formatnum:1,234.56|Random}}
19055 {{formatnum:1,234.56|EVERYTHING}}
19056 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
19057 !! html
19058 <p>1,234.56
19059 1,234.56
19060 1,234.56
19061 </p>
19062 !! end
19063
19064 !! test
19065 Strip marker in grammar
19066 !! options
19067 language=fi
19068 !! wikitext
19069 {{grammar:elative|foo<nowiki/>bar}}
19070 !! html
19071 <p>foobarista
19072 </p>
19073 !! end
19074
19075 !! test
19076 Strip marker in padleft
19077 !! wikitext
19078 {{padleft:|2|x<nowiki/>y}}
19079 !! html
19080 <p>xy
19081 </p>
19082 !! end
19083
19084 !! test
19085 Strip marker in padright
19086 !! wikitext
19087 {{padright:|2|x<nowiki/>y}}
19088 !! html
19089 <p>xy
19090 </p>
19091 !! end
19092
19093 !! test
19094 Strip marker in anchorencode
19095 !! wikitext
19096 {{anchorencode:x<nowiki/>y}}
19097 !! html
19098 <p>xy
19099 </p>
19100 !! end
19101
19102 !! test
19103 nowiki inside link inside heading (bug 18295)
19104 !! wikitext
19105 ==[[foo|x<nowiki>y</nowiki>z]]==
19106 !! html
19107 <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>
19108
19109 !! end
19110
19111 !! test
19112 new support for bdi element (bug 31817)
19113 !! wikitext
19114 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19115 !! html
19116 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19117
19118 !!end
19119
19120 !! test
19121 Ignore pipe between table row attributes
19122 !! wikitext
19123 {|
19124 | quux
19125 |- id=foo | style='color: red'
19126 | bar
19127 |}
19128 !! html
19129 <table>
19130 <tr>
19131 <td> quux
19132 </td></tr>
19133 <tr id="foo" style="color: red">
19134 <td> bar
19135 </td></tr></table>
19136
19137 !! end
19138
19139 !!test
19140 Gallery override link with WikiLink (bug 34852)
19141 !! wikitext
19142 <gallery>
19143 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
19144 </gallery>
19145 !! html
19146 <ul class="gallery mw-gallery-traditional">
19147 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19148 <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>
19149 <div class="gallerytext">
19150 <p>caption
19151 </p>
19152 </div>
19153 </div></li>
19154 </ul>
19155
19156 !! end
19157
19158 !!test
19159 Gallery override link with absolute external link (bug 34852)
19160 !! wikitext
19161 <gallery>
19162 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19163 </gallery>
19164 !! html
19165 <ul class="gallery mw-gallery-traditional">
19166 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19167 <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>
19168 <div class="gallerytext">
19169 <p>caption
19170 </p>
19171 </div>
19172 </div></li>
19173 </ul>
19174
19175 !! end
19176
19177 !!test
19178 Gallery override link with malicious javascript (bug 34852)
19179 !! wikitext
19180 <gallery>
19181 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19182 </gallery>
19183 !! html
19184 <ul class="gallery mw-gallery-traditional">
19185 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19186 <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>
19187 <div class="gallerytext">
19188 <p>caption
19189 </p>
19190 </div>
19191 </div></li>
19192 </ul>
19193
19194 !! end
19195
19196 !!test
19197 Gallery with invalid title as link (bug 43964)
19198 !! wikitext
19199 <gallery>
19200 File:foobar.jpg|link=<
19201 </gallery>
19202 !! html
19203 <ul class="gallery mw-gallery-traditional">
19204 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19205 <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>
19206 <div class="gallerytext">
19207 </div>
19208 </div></li>
19209 </ul>
19210
19211 !! end
19212
19213 !!test
19214 Language parser function
19215 !! wikitext
19216 {{#language:ar}}
19217 !! html
19218 <p>العربية
19219 </p>
19220 !! end
19221
19222 !!test
19223 Padleft and padright as substr
19224 !! wikitext
19225 {{padleft:|3|abcde}}
19226 {{padright:|3|abcde}}
19227 !! html
19228 <p>abc
19229 abc
19230 </p>
19231 !! end
19232
19233 !!test
19234 Special parser function
19235 !! wikitext
19236 {{#special:RandomPage}}
19237 {{#special:BaDtItLe}}
19238 {{#special:Foobar}}
19239 !! html
19240 <p>Special:Random
19241 Special:Badtitle
19242 Special:Foobar
19243 </p>
19244 !! end
19245
19246 !!test
19247 Bug 34939 - Case insensitive link parsing ([HttP://])
19248 !! wikitext
19249 [HttP://MediaWiki.Org/]
19250 !! html/php
19251 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
19252 </p>
19253 !! html/parsoid
19254 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
19255 !! end
19256
19257 !!test
19258 Bug 34939 - Case insensitive link parsing ([HttP:// title])
19259 !! wikitext
19260 [HttP://MediaWiki.Org/ MediaWiki]
19261 !! html
19262 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
19263 </p>
19264 !! end
19265
19266 !!test
19267 Bug 34939 - Case insensitive link parsing (HttP://)
19268 !! wikitext
19269 HttP://MediaWiki.Org/
19270 !! html/php
19271 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
19272 </p>
19273 !! html/parsoid
19274 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
19275 !! end
19276
19277 !!test
19278 Disable TOC
19279 !! options
19280 notoc
19281 !! wikitext
19282 Lead
19283 == Section 1 ==
19284 == Section 2 ==
19285 == Section 3 ==
19286 == Section 4 ==
19287 == Section 5 ==
19288 !! html
19289 <p>Lead
19290 </p>
19291
19292 <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>
19293 <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>
19294 <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>
19295 <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>
19296 <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>
19297
19298 !! end
19299
19300
19301 ###
19302 ### Parsoid-specific tests
19303 ### Parsoid-PHP parser incompatibilities
19304 ###
19305 !!test
19306 1. SOL-sensitive wikitext tokens as template-args
19307 !!options
19308 parsoid=wt2html,wt2wt
19309 !! wikitext
19310 {{echo|*a}}
19311 {{echo|#a}}
19312 {{echo|:a}}
19313 !! html
19314 <span about="#mwt1" typeof="mw:Transclusion">
19315 </span><ul about="#mwt1"><li>a</li>
19316 </ul>
19317 <span about="#mwt2" typeof="mw:Transclusion">
19318 </span><ol about="#mwt2"><li>a</li>
19319 </ol>
19320 <span about="#mwt3" typeof="mw:Transclusion">
19321 </span><dl about="#mwt3"><dd>a</dd>
19322 </dl>
19323 !!end
19324
19325 #### -----------------------------------------------------------------
19326 #### Parsoid-specific functionality tests
19327 #### -----------------------------------------------------------------
19328
19329 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
19330 # We know wt2wt will fail, but we expect selser to pass.
19331 # Due to the nature of our testing, wt2wt and selser tests will enter the
19332 # blacklist and we'll catch selser regressions based on changes to the
19333 # blacklist entries for selser tests.
19334 !! test
19335 1. Bad treebuilder fixup of formatting elt is cleaned up
19336 !! options
19337 parsoid=wt2html,wt2wt
19338 !! wikitext
19339 {|
19340 |
19341 <small>
19342 [[Image:Foobar.jpg|right|Test]]
19343 </small>
19344 |}
19345 !! html/parsoid
19346 <table>
19347 <tbody><tr><td>
19348 <small>
19349 <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>
19350 </small>
19351 </td></tr>
19352 </tbody></table>
19353 !! end
19354
19355 !! test
19356 2. Bad treebuilder fixup of formatting elt is cleaned up
19357 !! options
19358 parsoid=wt2html,wt2wt
19359 !! wikitext
19360 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
19361
19362 <small>[[Image:Foobar.jpg|right|300px]]</small>
19363 !! html/parsoid
19364 <p><b>foo</b></p>
19365 <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>
19366 <p><b>bar</b></p>
19367 <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>
19368 !! end
19369
19370 #### ----------------------------------------------------------------
19371 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
19372 #### tags. Parsoid's output for these tags differs from that of the
19373 #### PHP parser.
19374 #### ----------------------------------------------------------------
19375
19376 !!test
19377 Ref: 1. ref-location should be replaced with an index span
19378 !!options
19379 parsoid
19380 !! wikitext
19381 A <ref>foo</ref>
19382 B <ref name="x">foo</ref>
19383 C <ref name="y" />
19384 !! html
19385 <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>
19386 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>
19387 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>
19388 !!end
19389
19390 !!test
19391 Ref: 2. ref-tags with identical names should all get the same index
19392 !!options
19393 parsoid
19394 !! wikitext
19395 A <ref name="x">foo</ref>
19396 B <ref name="x" />
19397 !! html
19398 <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>
19399 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>
19400 !!end
19401
19402 !!test
19403 Ref: 3. spaces in ref-names should be ignored
19404 !!options
19405 parsoid
19406 !! wikitext
19407 A <ref name="x">foo</ref>
19408 B <ref name=" x " />
19409 C <ref name= x />
19410 !! html
19411 <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>
19412 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>
19413 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>
19414 !!end
19415
19416 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
19417 !!test
19418 Ref: 4. 'constructor' should be accepted as a valid ref-name
19419 !!options
19420 parsoid
19421 !! wikitext
19422 A <ref name="constructor">foo</ref>
19423 !! html
19424 <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>
19425 !!end
19426
19427 !!test
19428 Ref: 5. body should accept generic wikitext
19429 !!options
19430 parsoid
19431 !! wikitext
19432 A <ref>
19433 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
19434 </ref>
19435
19436 <references />
19437 !! html
19438 <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>
19439
19440 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19441 <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>
19442 </li>
19443 </ol>
19444 !!end
19445
19446 !!test
19447 Ref: 6. indent-pres should not be output in ref-body
19448 !!options
19449 parsoid
19450 !! wikitext
19451 A <ref>
19452 foo
19453 bar
19454 baz
19455 </ref>
19456
19457 <references />
19458 !! html
19459 <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>
19460
19461 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19462 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
19463 bar
19464 baz
19465 </li>
19466 </ol>
19467 !!end
19468
19469 !!test
19470 Ref: 7. No p-wrapping in ref-body
19471 !!options
19472 parsoid
19473 !! wikitext
19474 A <ref>
19475 foo
19476
19477 bar
19478
19479
19480 baz
19481
19482
19483
19484 booz
19485 </ref>
19486
19487 <references />
19488 !! html
19489 <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>
19490
19491 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19492 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
19493
19494 bar
19495
19496
19497 baz
19498
19499
19500
19501 booz
19502 </li>
19503 </ol>
19504 !!end
19505
19506 !!test
19507 Ref: 8. transclusion wikitext has lower precedence
19508 !!options
19509 parsoid
19510 !! wikitext
19511 A <ref> foo {{echo|</ref> B C}}
19512
19513 <references />
19514 !! html
19515 <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>
19516 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19517 <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>
19518 </ol>
19519 !!end
19520
19521 !!test
19522 Ref: 9. unclosed comments should not leak out of ref-body
19523 !!options
19524 parsoid
19525 !! wikitext
19526 A <ref> foo <!--</ref> B C
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;!---->"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C</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 <!----></li>
19532 </ol>
19533 !!end
19534
19535 !!test
19536 Ref: 10. Unclosed HTML tags should not leak out of ref-body
19537 !!options
19538 parsoid
19539 !! wikitext
19540 A <ref> <b> foo </ref> B C
19541
19542 <references />
19543 !! html
19544 <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>
19545
19546
19547 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19548 <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>
19549 </ol>
19550 !!end
19551
19552 !!test
19553 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
19554 !!options
19555 parsoid
19556 !! wikitext
19557 A <ref>foo</ref> B
19558 C <ref>bar</ref> D
19559 !! html
19560 <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
19561 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>
19562 !!end
19563
19564 !!test
19565 Ref: 12. ref-tags act as trailing newline migration barrier
19566 !!options
19567 parsoid
19568 !! wikitext
19569 <!--the newline at the end of this line moves out of the p-tag-->a
19570
19571 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
19572 <ref />
19573
19574 c
19575 !! html
19576 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
19577
19578
19579 <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>
19580 <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>
19581
19582 <p>c</p>
19583 !!end
19584
19585 !!test
19586 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
19587 !!options
19588 parsoid
19589 !! wikitext
19590 <ref>foo</ref> A
19591 <ref>bar
19592 </ref> B
19593 !! html
19594 <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
19595 <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>
19596 !!end
19597
19598 !!test
19599 Ref: 14. A nested ref-tag should be emitted as plain text
19600 !!options
19601 parsoid
19602 !! wikitext
19603 <ref>foo <ref>bar</ref> baz</ref>
19604
19605 <references />
19606 !! html
19607 <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>
19608
19609 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19610 <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>
19611 </ol>
19612 !!end
19613
19614 !!test
19615 Ref: 15. ref-tags with identical names should get identical indexes
19616 !!options
19617 parsoid
19618 !! wikitext
19619 A1 <ref name="a">foo</ref> A2 <ref name="a" />
19620 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
19621
19622 <references />
19623 !! html
19624 <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>
19625 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>
19626
19627 <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>
19628 </ol>
19629 !!end
19630
19631 ## We don't bother wt2wt-ing non-standard whitespace
19632 !!test
19633 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
19634 !!options
19635 parsoid=wt2html
19636 !! wikitext
19637 A <ref >foo</ref >
19638
19639 <references />
19640 !! html
19641 <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>
19642
19643 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19644 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19645 !!end
19646
19647 !!test
19648 Ref: 17. Generate valid HTML5 id/about attributes
19649 !!options
19650 parsoid
19651 !!wikitext
19652 <ref name="a b">foo</ref>
19653
19654 <references />
19655 !!html
19656 <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>
19657 </p>
19658
19659 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19660 <li id="cite_note-a_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_b-1-0">↑</a></span> foo</li>
19661 !!end
19662
19663 !!test
19664 References: 1. references tag without any refs should be handled properly
19665 !!options
19666 parsoid
19667 !! wikitext
19668 <references />
19669 !! html
19670 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
19671 !!end
19672
19673 !!test
19674 References: 2. references tag with group only outputs references from that group
19675 !!options
19676 parsoid
19677 !! wikitext
19678 A <ref group="a">foo</ref>
19679 B <ref group="b">bar</ref>
19680
19681 <references group="a" />
19682 !! html
19683 <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>
19684 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>
19685
19686 <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>
19687 </ol>
19688 !!end
19689
19690 !!test
19691 References: 3. ref list should be cleared after processing references
19692 !!options
19693 parsoid
19694 !! wikitext
19695 A <ref>foo</ref>
19696
19697 <references />
19698
19699 B <ref>bar</ref>
19700
19701 <references />
19702 !! html
19703 <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>
19704
19705 <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>
19706 </ol>
19707
19708 <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>
19709
19710 <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>
19711 </ol>
19712 !!end
19713
19714 !!test
19715 References: 4. only referenced group should be cleared after processing references
19716 !!options
19717 parsoid
19718 !! wikitext
19719 A <ref group="a">afoo</ref>
19720 B <ref>bfoo</ref>
19721
19722 <references group="a" />
19723
19724 C <ref>cfoo</ref>
19725
19726 <references />
19727 !! html
19728 <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>
19729 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>
19730
19731 <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>
19732 </ol>
19733
19734 <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>
19735
19736 <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>
19737 </ol>
19738 !!end
19739
19740 !!test
19741 References: 5. ref tags in references should be processed while ignoring all other content
19742 !!options
19743 parsoid
19744 !! wikitext
19745 A <ref name="a" />
19746 B <ref name="b">bar</ref>
19747
19748 <references>
19749 <ref name="a">foo</ref>
19750 This should just get lost.
19751 </references>
19752 !! html
19753 <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>
19754 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>
19755
19756
19757 <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>
19758 </ol>
19759 !!end
19760
19761 !!test
19762 References: 6. <references /> from a transclusion
19763 !!options
19764 parsoid
19765 !! wikitext
19766 <ref>Foo</ref> {{echo|<references />}}
19767 !! html
19768 <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>
19769 !!end
19770
19771 !! test
19772 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
19773 !! options
19774 parsoid
19775 !! wikitext
19776 A <ref>foo bar for a</ref>
19777 B <ref group="X" name="b" />
19778
19779 <references />
19780
19781 <references group="X">
19782 <ref name="b">foo</ref>
19783 </references>
19784 !! html
19785 <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>
19786 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>
19787
19788 <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>
19789
19790 <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>
19791 !! end
19792
19793 !! test
19794 Entities in ref name
19795 !! options
19796 parsoid
19797 !! wikitext
19798 <ref name="test &amp; me">hi</ref>
19799 !! html
19800 <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>
19801 !! end
19802
19803 # This test is wt2html only because we're permitting the serializer to produce
19804 # dirty diffs, normalizing the unclosed references to the self-closed version.
19805 !! test
19806 Generate references for unclosed references tag
19807 !! options
19808 parsoid=wt2html
19809 !! wikitext
19810 a<ref>foo</ref>
19811
19812 <references>
19813 !! html
19814 <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>
19815
19816
19817 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19818 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19819 !! end
19820
19821 !! test
19822 New reference serializes on its own line
19823 !! options
19824 parsoid=wt2wt,html2wt
19825 !! wikitext
19826 foo
19827 <references />
19828 !! html
19829 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
19830 !! end
19831
19832 #--------- Test stripping of empty nodes in template content ----------
19833 !!test
19834 Empty LI and TR nodes should be stripped from template content
19835 !!wikitext
19836 {{EmptyLITest}}
19837 {{EmptyTRTest}}
19838 !!html/parsoid
19839 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
19840 <li>a</li>
19841 <li>b</li>
19842 </ul>
19843 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
19844 <tbody>
19845 <tr>
19846 <td>foo</td>
19847 </tr>
19848 <tr>
19849 <td>bar</td>
19850 </tr>
19851 </tbody>
19852 </table>
19853 !!end
19854
19855 !!test
19856 Empty LI and TR nodes should not be stripped from top-level content
19857 !!wikitext
19858 * a
19859 *
19860 * b
19861 {|
19862 |-
19863 |-
19864 |foo
19865 |}
19866 !!html/parsoid
19867 <ul>
19868 <li> a</li>
19869 <li></li>
19870 <li> b</li>
19871 </ul>
19872 <table>
19873 <tbody>
19874 <tr></tr>
19875 <tr>
19876 <td>foo</td>
19877 </tr>
19878 </tbody>
19879 </table>
19880 !!end
19881
19882 !!test
19883 Empty TR nodes should not be stripped if they have any attributes set
19884 !!wikitext
19885 {{EmptyTRWithHTMLAttrTest}}
19886 !!html/parsoid
19887 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
19888 <tr align="center"></tr>
19889 <tr><td>foo</td></tr>
19890 <tr align="center"></tr>
19891 <tr><td>bar</td></tr>
19892 </table>
19893 !!end
19894
19895 #### ----------------------------------------------------------------
19896 #### The following section of tests are primarily to test
19897 #### wikitext escaping capabilities of Parsoid. Given that
19898 #### escaping can be done any number of ways, the wikitext (input)
19899 #### is always adjusted to reflect how Parsoid adds nowiki
19900 #### escape tags.
19901 ####
19902 #### We are marking several tests as parsoid-only since the
19903 #### HTML in the result section is different from what the
19904 #### PHP parser generates for it.
19905 #### ----------------------------------------------------------------
19906
19907
19908 #### --------------- Headings ---------------
19909 #### 0. Unnested
19910 #### 1. Nested inside html <h1>=foo=</h1>
19911 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
19912 #### 3. Nested inside html with wikitext split by html tags
19913 #### 4. No escape needed
19914 #### 5. Empty headings <h1></h1>
19915 #### 6. Heading chars in SOL context
19916 #### ----------------------------------------
19917 !! test
19918 Headings: 0. Unnested
19919 !! options
19920 parsoid
19921 !! wikitext
19922 <nowiki>=foo=</nowiki>
19923
19924 <nowiki> =foo= </nowiki>
19925 <!--cmt-->
19926 <nowiki>=foo=</nowiki>
19927
19928 =foo''a''<nowiki>=</nowiki>
19929 !! html
19930 <p><span typeof="mw:Nowiki">=foo=</span></p>
19931
19932 <p><span typeof="mw:Nowiki"> =foo= </span>
19933 <!--cmt-->
19934 <span typeof="mw:Nowiki">=foo=</span></p>
19935
19936 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
19937 !!end
19938
19939 # New headings and existing headings are handled differently
19940 !! test
19941 Headings: 1. Nested inside html
19942 !! options
19943 parsoid=html2wt
19944 !! wikitext
19945 = =foo= =
19946
19947 == =foo= ==
19948
19949 === =foo= ===
19950
19951 =<nowiki>=foo=</nowiki>=
19952 ==<nowiki>=foo=</nowiki>==
19953 ===<nowiki>=foo=</nowiki>===
19954 ====<nowiki>=foo=</nowiki>====
19955 =====<nowiki>=foo=</nowiki>=====
19956 ======<nowiki>=foo=</nowiki>======
19957
19958 !! html
19959 <h1>=foo=</h1>
19960 <h2>=foo=</h2>
19961 <h3>=foo=</h3>
19962
19963 <h1 data-parsoid=''>=foo=</h1>
19964 <h2 data-parsoid=''>=foo=</h2>
19965 <h3 data-parsoid=''>=foo=</h3>
19966 <h4 data-parsoid=''>=foo=</h4>
19967 <h5 data-parsoid=''>=foo=</h5>
19968 <h6 data-parsoid=''>=foo=</h6>
19969 !!end
19970
19971 !! test
19972 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
19973 !! options
19974 parsoid=html2wt
19975 !! wikitext
19976 = foo =
19977 <nowiki>*</nowiki>bar
19978
19979 = foo =
19980 =bar
19981
19982 = foo =
19983 <nowiki>=bar=</nowiki>
19984 !! html
19985 <h1>foo</h1>*bar
19986 <h1>foo</h1>=bar
19987 <h1>foo</h1>=bar=
19988 !!end
19989
19990 !! test
19991 Headings: 3. Nested inside html with wikitext split by html tags
19992 !! options
19993 parsoid=html2wt
19994 !! wikitext
19995 = ='''bold'''<nowiki>foo=</nowiki> =
19996 !! html
19997 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
19998 !!end
19999
20000 !! test
20001 Headings: 4a. No escaping needed (testing just h1 and h2)
20002 !! options
20003 parsoid=html2wt
20004 !! wikitext
20005 = =foo =
20006
20007 = foo= =
20008
20009 = =foo= =
20010
20011 = =foo= bar =
20012
20013 == =foo ==
20014
20015 == foo= ==
20016
20017 = ''=''foo= =
20018
20019 = <nowiki>=</nowiki> =
20020 !! html
20021 <h1>=foo</h1>
20022 <h1>foo=</h1>
20023 <h1> =foo= </h1>
20024 <h1>=foo= bar</h1>
20025 <h2>=foo</h2>
20026 <h2>foo=</h2>
20027 <h1><i>=</i>foo=</h1>
20028 <h1><span typeof="mw:Nowiki">=</span></h1>
20029 !!end
20030
20031 !! test
20032 Headings: 4b. No escaping needed (inside p-tags)
20033 !! options
20034 parsoid=html2wt
20035 !! wikitext
20036 ===
20037 =foo= x
20038 =foo= <s></s>
20039 !! html
20040 <p>===
20041 =foo= x
20042 =foo= <s></s>
20043 </p>
20044 !!end
20045
20046 !! test
20047 Headings: 5. Empty headings
20048 !! options
20049 parsoid
20050 !! wikitext
20051 =<nowiki/>=
20052
20053 ==<nowiki/>==
20054
20055 ===<nowiki/>===
20056
20057 ====<nowiki/>====
20058
20059 =====<nowiki/>=====
20060
20061 ======<nowiki/>======
20062 !! html
20063 <h1></h1>
20064 <h2></h2>
20065 <h3></h3>
20066 <h4></h4>
20067 <h5></h5>
20068 <h6></h6>
20069 !!end
20070
20071 !! test
20072 Headings: 6a. Heading chars in SOL context (with trailing spaces)
20073 !! options
20074 parsoid
20075 !! wikitext
20076 <nowiki>=a=</nowiki>
20077
20078 <nowiki>=a=</nowiki>
20079
20080 <nowiki>=a=</nowiki>
20081
20082 <nowiki>=a=</nowiki>
20083 !! html
20084 <p>=a=</p>
20085 <p>=a= </p>
20086 <p>=a= </p>
20087 <p>=a= </p>
20088 !!end
20089
20090 !! test
20091 Headings: 6b. Heading chars in SOL context (with trailing newlines)
20092 !! options
20093 parsoid
20094 !! wikitext
20095 <nowiki>=a=
20096 b</nowiki>
20097
20098 <nowiki>=a=
20099 b</nowiki>
20100
20101 <nowiki>=a=
20102 b</nowiki>
20103
20104 <nowiki>=a=
20105 b</nowiki>
20106 !! html
20107 <p>=a=
20108 b</p>
20109 <p>=a=
20110 b</p>
20111 <p>=a=
20112 b</p>
20113 <p>=a=
20114 b</p>
20115 </p>
20116 !!end
20117
20118 !! test
20119 Headings: 6c. Heading chars in SOL context (leading newline break)
20120 !! options
20121 parsoid
20122 !! wikitext
20123 a
20124 <nowiki>=b=</nowiki>
20125 !! html
20126 <p>a
20127 =b=</p>
20128 !!end
20129
20130 !! test
20131 Headings: 6d. Heading chars in SOL context (with interspersed comments)
20132 !! options
20133 parsoid
20134 !! wikitext
20135 <!--c0--><nowiki>=a=</nowiki>
20136
20137 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
20138 !! html
20139 <p><!--c0-->=a=</p>
20140 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
20141 !!end
20142
20143 !! test
20144 Headings: 6d. Heading chars in SOL context (No escaping needed)
20145 !! options
20146 parsoid=html2wt
20147 !! wikitext
20148 =a=<div>b</div>
20149 !! html
20150 =a=<div>b</div>
20151 !!end
20152
20153 #### --------------- Lists ---------------
20154 #### 0. Outside nests (*foo, etc.)
20155 #### 1. Nested inside html <ul><li>*foo</li></ul>
20156 #### 2. Inside definition lists
20157 #### 3. Only bullets at start should be escaped
20158 #### 4. No escapes needed
20159 #### 5. No unnecessary escapes
20160 #### 6. Escape bullets in SOL position
20161 #### 7. Escape bullets in a multi-line context
20162 #### ----------------------------------------
20163
20164 !! test
20165 Lists: 0. Outside nests
20166 !! wikitext
20167 <nowiki>*</nowiki>foo
20168
20169 <nowiki>#</nowiki>foo
20170
20171 <nowiki>;Foo:</nowiki>bar
20172 !! html
20173 <p>*foo
20174 </p><p>#foo
20175 </p><p>;Foo:bar
20176 </p>
20177 !!end
20178
20179 !! test
20180 Lists: 1. Nested inside html
20181 !! wikitext
20182 *<nowiki>*foo</nowiki>
20183
20184 *<nowiki>#foo</nowiki>
20185
20186 *<nowiki>:foo</nowiki>
20187
20188 *<nowiki>;foo</nowiki>
20189
20190 #<nowiki>*foo</nowiki>
20191
20192 #<nowiki>#foo</nowiki>
20193
20194 #<nowiki>:foo</nowiki>
20195
20196 #<nowiki>;foo</nowiki>
20197 !! html
20198 <ul><li>*foo</li></ul>
20199 <ul><li>#foo</li></ul>
20200 <ul><li>:foo</li></ul>
20201 <ul><li>;foo</li></ul>
20202 <ol><li>*foo</li></ol>
20203 <ol><li>#foo</li></ol>
20204 <ol><li>:foo</li></ol>
20205 <ol><li>;foo</li></ol>
20206
20207 !!end
20208
20209 !! test
20210 Lists: 2. Inside definition lists
20211 !! wikitext
20212 ;<nowiki>;foo</nowiki>
20213
20214 ;<nowiki>:foo</nowiki>
20215
20216 ;<nowiki>:foo</nowiki>
20217 :bar
20218
20219 :<nowiki>:foo</nowiki>
20220 !! html
20221 <dl><dt>;foo</dt></dl>
20222 <dl><dt>:foo</dt></dl>
20223 <dl><dt>:foo</dt>
20224 <dd>bar</dd></dl>
20225 <dl><dd>:foo</dd></dl>
20226
20227 !!end
20228
20229 !! test
20230 Lists: 3. Only bullets at start of text should be escaped
20231 !! wikitext
20232 *<nowiki>*foo*bar</nowiki>
20233
20234 *<nowiki>*foo</nowiki>''it''*bar
20235 !! html
20236 <ul><li>*foo*bar</li></ul>
20237 <ul><li>*foo<i>it</i>*bar</li></ul>
20238
20239 !!end
20240
20241 !! test
20242 Lists: 4. No escapes needed
20243 !! options
20244 parsoid
20245 !! wikitext
20246 *foo*bar
20247
20248 *''foo''*bar
20249
20250 *[[Foo]]: bar
20251
20252 *[[Foo]]*bar
20253 !! html
20254 <ul>
20255 <li>foo*bar
20256 </li>
20257 </ul>
20258 <ul>
20259 <li><i>foo</i>*bar
20260 </li>
20261 </ul>
20262 <ul>
20263 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
20264 </li>
20265 </ul>
20266 <ul>
20267 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
20268 </li>
20269 </ul>
20270 !!end
20271
20272 !! test
20273 Lists: 5. No unnecessary escapes
20274 !! wikitext
20275 * bar <span><nowiki>[[foo]]</nowiki></span>
20276
20277 *=bar <span><nowiki>[[foo]]</nowiki></span>
20278
20279 *[[bar <span><nowiki>[[foo]]</nowiki></span>
20280
20281 *]]bar <span><nowiki>[[foo]]</nowiki></span>
20282
20283 *=bar <span>foo]]</span>=
20284
20285 * <s></s>: a
20286 !! html
20287 <ul><li> bar <span>[[foo]]</span></li></ul>
20288 <ul><li>=bar <span>[[foo]]</span></li></ul>
20289 <ul><li>[[bar <span>[[foo]]</span></li></ul>
20290 <ul><li>]]bar <span>[[foo]]</span></li></ul>
20291 <ul><li>=bar <span>foo]]</span>=</li></ul>
20292 <ul><li> <s></s>: a</li></ul>
20293
20294 !!end
20295
20296 !! test
20297 Lists: 6. Escape bullets in SOL position
20298 !! options
20299 parsoid
20300 !! wikitext
20301 <!--cmt--><nowiki>*foo</nowiki>
20302 !! html
20303 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
20304 !!end
20305
20306 !! test
20307 Lists: 7. Escape bullets in a multi-line context
20308 !! wikitext
20309 a
20310 <nowiki>*</nowiki>b
20311 !! html
20312 <p>a
20313 *b
20314 </p>
20315 !!end
20316
20317 #### --------------- HRs ---------------
20318 #### 1. Single line
20319 #### -----------------------------------
20320
20321 !! test
20322 HRs: 1. Single line
20323 !! options
20324 parsoid
20325 !! wikitext
20326 ----<nowiki>----</nowiki>
20327 ----=foo=
20328 ----*foo
20329 !! html
20330 <hr><p><span typeof="mw:Nowiki">----</span></p>
20331 <hr><p>=foo=</p>
20332 <hr><p>*foo</p>
20333 !! end
20334
20335 #### --------------- Tables ---------------
20336 #### 1a. Simple example
20337 #### 1b. No escaping needed (!foo)
20338 #### 1c. No escaping needed (|foo)
20339 #### 1d. No escaping needed (|}foo)
20340 ####
20341 #### 2a. Nested in td (<td>foo|bar</td>)
20342 #### 2b. Nested in td (<td>foo||bar</td>)
20343 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
20344 ####
20345 #### 3a. Nested in th (<th>foo!bar</th>)
20346 #### 3b. Nested in th (<th>foo!!bar</th>)
20347 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
20348 ####
20349 #### 4a. Escape -
20350 #### 4b. Escape +
20351 #### 4c. No escaping needed
20352 #### --------------------------------------
20353
20354 !! test
20355 Tables: 1a. Simple example
20356 !! wikitext
20357 <nowiki>{|
20358 |}</nowiki>
20359 !! html
20360 <p>{|
20361 |}
20362 </p>
20363 !! end
20364
20365 !! test
20366 Tables: 1b. No escaping needed
20367 !! wikitext
20368 !foo
20369 !! html
20370 <p>!foo
20371 </p>
20372 !! end
20373
20374 !! test
20375 Tables: 1c. No escaping needed
20376 !! wikitext
20377 |foo
20378 !! html
20379 <p>|foo
20380 </p>
20381 !! end
20382
20383 !! test
20384 Tables: 1d. No escaping needed
20385 !! wikitext
20386 |}foo
20387 !! html
20388 <p>|}foo
20389 </p>
20390 !! end
20391
20392 !! test
20393 Tables: 2a. Nested in td
20394 !! options
20395 parsoid=html2wt
20396 !! wikitext
20397 {|
20398 |<nowiki>foo|bar</nowiki>
20399 |-
20400 |x<div><nowiki>a|b</nowiki></div>
20401 |}
20402 !! html
20403 <table><tbody><tr>
20404 <td>foo|bar</td></tr>
20405 <tr><td>x<div>a|b</div></td>
20406 </tbody></table>
20407 !! end
20408
20409 !! test
20410 Tables: 2b. Nested in td
20411 !! options
20412 parsoid
20413 !! wikitext
20414 {|
20415 |<nowiki>foo||bar</nowiki>
20416 |''it''<nowiki>foo||bar</nowiki>
20417 |}
20418 !! html
20419 <table><tbody><tr>
20420 <td><span typeof="mw:Nowiki">foo||bar</span></td>
20421 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
20422 !! end
20423
20424 !! test
20425 Tables: 2c. Nested in td -- no escaping needed
20426 !! options
20427 parsoid
20428 !! wikitext
20429 {|
20430 |foo!!bar
20431 |}
20432 !! html
20433 <table><tbody><tr><td>foo!!bar
20434 </td></tr></tbody></table>
20435
20436 !! end
20437
20438 !! test
20439 Tables: 3a. Nested in th
20440 !! options
20441 parsoid
20442 !! wikitext
20443 {|
20444 !foo!bar
20445 |}
20446 !! html
20447 <table><tbody><tr><th>foo!bar
20448 </th></tr></tbody></table>
20449
20450 !! end
20451
20452 !! test
20453 Tables: 3b. Nested in th
20454 !! options
20455 parsoid
20456 !! wikitext
20457 {|
20458 !<nowiki>foo!!bar</nowiki>
20459 |}
20460 !! html
20461 <table>
20462 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
20463 </tbody></table>
20464 !! end
20465
20466 !! test
20467 Tables: 3c. Nested in th -- no escaping needed
20468 !! options
20469 parsoid
20470 !! wikitext
20471 {|
20472 !<nowiki>foo||bar</nowiki>
20473 |}
20474 !! html
20475 <table><tbody><tr>
20476 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
20477 !! end
20478
20479 !! test
20480 Tables: 4a. Escape -
20481 !! options
20482 parsoid
20483 !! wikitext
20484 {|
20485 !-bar
20486 |-
20487 |<nowiki>-bar</nowiki>
20488 |}
20489 !! html
20490 <table><tbody>
20491 <tr><th>-bar</th></tr>
20492 <tr>
20493 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
20494 !! end
20495
20496 !! test
20497 Tables: 4b. Escape +
20498 !! options
20499 parsoid
20500 !! wikitext
20501 {|
20502 !+bar
20503 |-
20504 |<nowiki>+bar</nowiki>
20505 |}
20506 !! html
20507 <table><tbody>
20508 <tr><th>+bar</th></tr>
20509 <tr>
20510 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
20511 !! end
20512
20513 !! test
20514 Tables: 4c. No escaping needed
20515 !! options
20516 parsoid
20517 !! wikitext
20518 {|
20519 |foo-bar
20520 |foo+bar
20521 |-
20522 |''foo''-bar
20523 |''foo''+bar
20524 |-
20525 |foo
20526 bar|baz
20527 +bar
20528 -bar
20529 |-
20530 |x
20531 <div>a|b</div>
20532 |}
20533 !! html
20534 <table><tbody>
20535 <tr><td>foo-bar</td><td>foo+bar</td></tr>
20536 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
20537 <tr><td>foo
20538 <p>bar|baz
20539 +bar
20540 -bar</p></td></tr>
20541 <tr><td>x
20542 <div>a|b</div></td>
20543 </tbody></table>
20544 !! end
20545
20546 !! test
20547 Tables: 4d. No escaping needed
20548 !! options
20549 parsoid
20550 !! wikitext
20551 {|
20552 |[[Foo]]-bar
20553 ||+1
20554 ||-2
20555 |}
20556 !! html
20557 <table>
20558 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
20559 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
20560 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
20561 </tbody></table>
20562 !! end
20563
20564 !! test
20565 Tables: Digest broken attributes on table and tr tag
20566 !! options
20567 parsoid=wt2html
20568 !! wikitext
20569 {| || |} ++
20570 |- || || ++ --
20571 |- > [
20572 |}
20573 !! html
20574 <table>
20575 <tbody>
20576 <tr></tr>
20577 <tr></tr>
20578 </tbody></table>
20579 !! end
20580
20581 #### --------------- Links ----------------
20582 #### 1. Quote marks in link text
20583 #### 2. Wikilinks: Escapes needed
20584 #### 3. Wikilinks: No escapes needed
20585 #### 4. Extlinks: Escapes needed
20586 #### 5. Extlinks: No escapes needed
20587 #### --------------------------------------
20588 !! test
20589 Links 1. Quote marks in link text
20590 !! options
20591 parsoid
20592 !! wikitext
20593 [[Foo|Foo<nowiki>''boo''</nowiki>]]
20594 !! html
20595 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
20596 !! end
20597
20598 !! test
20599 Links 2. WikiLinks: Escapes needed
20600 !! options
20601 parsoid
20602 !! wikitext
20603 [[Foo|[Foobar]]]
20604 [[Foo|<nowiki>Foobar]</nowiki>]]
20605 [[Foo|x [Foobar] x]]
20606 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
20607 [[Foo|<nowiki>[[Bar]]</nowiki>]]
20608 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
20609 [[Foo|<nowiki>|Bar</nowiki>]]
20610 [[Foo|<nowiki>]]bar</nowiki>]]
20611 [[Foo|<nowiki>[[bar</nowiki>]]
20612 [[Foo|<nowiki>x [[ y</nowiki>]]
20613 [[Foo|<nowiki>x ]] y</nowiki>]]
20614 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
20615 !! html
20616 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
20617 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
20618 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
20619 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
20620 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
20621 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
20622 <a href="Foo" rel="mw:WikiLink">|Bar</a>
20623 <a href="Foo" rel="mw:WikiLink">]]bar</a>
20624 <a href="Foo" rel="mw:WikiLink">[[bar</a>
20625 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
20626 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
20627 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
20628 !! end
20629
20630 !! test
20631 Links 3. WikiLinks: No escapes needed
20632 !! options
20633 parsoid
20634 !! wikitext
20635 [[Foo|[Foobar]]
20636 [[Foo|foo|bar]]
20637 !! html
20638 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
20639 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
20640 !! end
20641
20642 !! test
20643 Links 4. ExtLinks: Escapes needed
20644 !! options
20645 parsoid
20646 !! wikitext
20647 [http://google.com <nowiki>[google]</nowiki>]
20648 [http://google.com <nowiki>google]</nowiki>]
20649
20650 <nowiki>[http://google.com]</nowiki>
20651
20652 <nowiki>[http://google.com google]</nowiki>
20653
20654 !! html
20655 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
20656 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
20657 <p>[http://google.com]</p>
20658 <p>[http://google.com google]</p>
20659 !! end
20660
20661 !! test
20662 Links 5. ExtLinks: No escapes needed
20663 !! options
20664 parsoid
20665 !! wikitext
20666 [http://google.com [google]
20667 !! html
20668 <a href="http://google.com" rel="mw:ExtLink">[google</a>
20669 !! end
20670
20671 !! test
20672 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
20673 !! html/parsoid
20674 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
20675 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
20676 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
20677 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
20678 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
20679 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
20680 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20681 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
20682 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20683 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
20684 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
20685 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
20686 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
20687 </p>
20688 !! wikitext
20689 x<nowiki/>http://example.com<nowiki/>y
20690 http://example.com<nowiki/>?x
20691 http://example.com<nowiki/>&x
20692 http://example.com<nowiki/>'x
20693 http://example.com<nowiki/>,x
20694 http://example.com<nowiki/>.x
20695 http://example.com<nowiki/>;x
20696 http://example.com<nowiki/>:x
20697 http://example.com<nowiki/>;x
20698 http://example.com<nowiki/>!x
20699 http://example.com<nowiki/>=x
20700 http://example.com<nowiki/>(x)
20701 http://example.com(x<nowiki/>)
20702 !! end
20703
20704 !! test
20705 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20706 !! html/parsoid
20707 <p>x
20708 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
20709 y
20710 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
20711 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
20712 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
20713 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
20714 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
20715 </p>
20716 !! wikitext
20717 x
20718 http://example.com
20719 y
20720 "http://example.com"
20721 (http://example.com)
20722 (http://example.com) foo
20723 http://example.com,
20724 http://example.com, foo
20725 !! end
20726
20727 ## Parsoid currently fails wt2html on this one!
20728 !! test
20729 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20730 !! html/parsoid
20731 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
20732 !! wikitext
20733 http://example.com.,;:!?
20734 !! end
20735
20736 !! test
20737 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
20738 !! html/parsoid
20739 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
20740 !! wikitext
20741 RFC 123<nowiki/>4
20742 !! end
20743
20744 !! test
20745 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
20746 !! html/parsoid
20747 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20748 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20749 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
20750 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
20751 </p>
20752 !! wikitext
20753 xRFC 123y
20754 XRFC 123y
20755 RFC 123?foo
20756 RFC 123&foo
20757 !! end
20758
20759 !! test
20760 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
20761 !! html/parsoid
20762 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
20763 !! wikitext
20764 PMID 123<nowiki/>4
20765 !! end
20766
20767 !! test
20768 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
20769 !! html/parsoid
20770 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20771 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20772 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
20773 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
20774 </p>
20775 !! wikitext
20776 xPMID 123y
20777 XPMID 123y
20778 PMID 123?foo
20779 PMID 123&foo
20780 !! end
20781
20782 !! test
20783 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
20784 !! html/parsoid
20785 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
20786 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
20787 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
20788 </p>
20789 !! wikitext
20790 ISBN 1234567890<nowiki/>1
20791 ISBN 1234567890<nowiki/>x
20792 ISBN 1234567890<nowiki/>b
20793 !! end
20794
20795 !! test
20796 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
20797 !! html/parsoid
20798 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
20799 !! wikitext
20800 ISBN 1234567890's
20801 !! end
20802
20803 #### --------------- Quotes ---------------
20804 #### 1. Quotes inside <b> and <i>
20805 #### 2. Link fragments separated by <i> and <b> tags
20806 #### 3. Link fragments inside <i> and <b>
20807 #### 4. No escaping needed
20808 #### --------------------------------------
20809 !! test
20810 1. Quotes inside <b> and <i>
20811 !! options
20812 parsoid=html2wt,wt2wt
20813 !! wikitext
20814 ''<nowiki/>'foo'<nowiki/>''
20815 ''<nowiki>''foo''</nowiki>''
20816 ''<nowiki>'''foo'''</nowiki>''
20817 ''foo''<nowiki/>'s
20818 '''<nowiki/>'foo'<nowiki/>'''
20819 '''<nowiki>''foo''</nowiki>'''
20820 '''<nowiki>'''foo'''</nowiki>'''
20821 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
20822 '''foo'''<nowiki/>'s
20823 '<nowiki/>''foo''
20824 ''foo''<nowiki/>'
20825 '<nowiki/>''foo''<nowiki/>'
20826 '<nowiki/>'''foo'''
20827 '''foo'''<nowiki/>'
20828 '<nowiki/>'''foo'''<nowiki/>'
20829 ''fools'<span> errand</span>''
20830 ''<span>fool</span>'s errand''
20831 !! html/*
20832 <p><i>'foo'</i>
20833 <i>''foo''</i>
20834 <i>'''foo'''</i>
20835 <i>foo</i>'s
20836 <b>'foo'</b>
20837 <b>''foo''</b>
20838 <b>'''foo'''</b>
20839 <b>foo'<i>bar'</i>baz</b>
20840 <b>foo</b>'s
20841 '<i>foo</i>
20842 <i>foo</i>'
20843 '<i>foo</i>'
20844 '<b>foo</b>
20845 <b>foo</b>'
20846 '<b>foo</b>'
20847 <i>fools'<span> errand</span></i>
20848 <i><span>fool</span>'s errand</i>
20849 </p>
20850 !! end
20851
20852 !! test
20853 2. Link fragments separated by <i> and <b> tags
20854 !! wikitext
20855 [[''foo''<nowiki>hello]]</nowiki>
20856
20857 [['''foo'''<nowiki>hello]]</nowiki>
20858 !! html
20859 <p>[[<i>foo</i>hello]]
20860 </p><p>[[<b>foo</b>hello]]
20861 </p>
20862 !! end
20863
20864 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
20865 # this is one of the shortcomings of this format
20866 !! test
20867 3. Link fragments inside <i> and <b>
20868 !! wikitext
20869 ''[[foo''<nowiki>]]</nowiki>
20870
20871 '''[[foo'''<nowiki>]]</nowiki>
20872 !! html
20873 <p><i>[[foo</i>]]
20874 </p><p><b>[[foo</b>]]
20875 </p>
20876 !! end
20877
20878 !! test
20879 4. No escaping needed
20880 !! wikitext
20881 '<span>''bar''</span>'
20882 '<span>'''bar'''</span>'
20883 !! html
20884 <p>'<span><i>bar</i></span>'
20885 '<span><b>bar</b></span>'
20886 </p>
20887 !! end
20888
20889 #### ----------- Paragraphs ---------------
20890 #### 1. No unnecessary escapes
20891 #### --------------------------------------
20892
20893 !! test
20894 1. No unnecessary escapes
20895 !! wikitext
20896 bar <span><nowiki>[[foo]]</nowiki></span>
20897
20898 =bar <span><nowiki>[[foo]]</nowiki></span>
20899
20900 [[bar <span><nowiki>[[foo]]</nowiki></span>
20901
20902 ]]bar <span><nowiki>[[foo]]</nowiki></span>
20903
20904 =bar <span>foo]]</span><nowiki>=</nowiki>
20905 !! html
20906 <p>bar <span>[[foo]]</span>
20907 </p><p>=bar <span>[[foo]]</span>
20908 </p><p>[[bar <span>[[foo]]</span>
20909 </p><p>]]bar <span>[[foo]]</span>
20910 </p><p>=bar <span>foo]]</span>=
20911 </p>
20912 !!end
20913
20914 #### ----------------------- PRE --------------------------
20915 #### 1. Leading whitespace in SOL context should be escaped
20916 #### ------------------------------------------------------
20917 !! test
20918 1. Leading whitespace in SOL context should be escaped
20919 !! options
20920 parsoid
20921 !! wikitext
20922 <nowiki> </nowiki>a
20923
20924 <nowiki> </nowiki> a
20925
20926 <nowiki> </nowiki>a(tab)
20927
20928 <nowiki> </nowiki> a
20929 <!--cmt-->
20930 <nowiki> </nowiki> a
20931
20932 a
20933 <nowiki> </nowiki>b
20934
20935 a
20936 <nowiki> </nowiki>b
20937
20938 a
20939 <nowiki> </nowiki> b
20940 !! html
20941 <p> a</p>
20942 <p> a</p>
20943 <p> a(tab)</p>
20944 <p> a</p>
20945 <p><!--cmt--> a</p>
20946 <p>a
20947 b</p>
20948 <p>a
20949 b</p>
20950 <p>a
20951 b</p>
20952 !! end
20953
20954 !! test
20955 2. Leading whitespace in non-indent-pre contexts should not be escaped
20956 !! options
20957 parsoid
20958 !! wikitext
20959 foo <ref>''a''
20960 b</ref>
20961 !! html
20962 <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>
20963 !! end
20964
20965 !! test
20966 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
20967 !! options
20968 parsoid
20969 !! wikitext
20970 <blockquote>
20971 a
20972 <span>b</span>
20973 c
20974 </blockquote>
20975 !! html
20976 <blockquote>
20977 <p>
20978 a
20979 <span>b</span>
20980 c</p>
20981 </blockquote>
20982 !! end
20983
20984 !! test
20985 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
20986 !! options
20987 parsoid
20988 !! wikitext
20989 [[File:Foobar.jpg|thumb|caption]]
20990 !! html
20991 !! html/parsoid
20992 <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>
20993 !! end
20994
20995 !! test
20996 5. Nowiki escaping should account for indent-pres
20997 !! options
20998 parsoid=html2wt
20999 !! html
21000 <pre>==foo==</pre>
21001 !! wikitext
21002 ==foo==
21003 !! end
21004
21005 #### --------------- Behavior Switches --------------------
21006 !! test
21007 1. Valid behavior switches should be escaped
21008 !! options
21009 parsoid=html2wt
21010 !! wikitext
21011 <nowiki>__TOC__</nowiki>
21012 ''<nowiki>__TOC__</nowiki>''
21013 !! html
21014 __TOC__
21015 <i>__TOC__</i>
21016 !! end
21017
21018 !! test
21019 2. Invalid behavior switches should not be escaped
21020 !! options
21021 parsoid=html2wt
21022 !! wikitext
21023 __TOO__
21024 __|__
21025 !! html
21026 __TOO__
21027 __|__
21028 !! end
21029
21030 #### --------------- HTML tags ---------------
21031 #### 1. a tags
21032 #### 2. other tags
21033 #### 3. multi-line html tag
21034 #### 4. extension tags
21035 #### -----------------------------------------
21036 !! test
21037 1. a tags
21038 !! options
21039 parsoid
21040 !! wikitext
21041 <a href="http://google.com">google</a>
21042 !! html
21043 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
21044 !! end
21045
21046 !! test
21047 2. other tags
21048 !! wikitext
21049 <nowiki><div>foo</div>
21050 <div style="color:red">foo</div></nowiki>
21051 !! html
21052 <p>&lt;div&gt;foo&lt;/div&gt;
21053 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
21054 </p>
21055 !! end
21056
21057 !! test
21058 3. multi-line html tag
21059 !! wikitext
21060 <nowiki><div
21061 >foo</div
21062 ></nowiki>
21063 !! html
21064 <p>&lt;div
21065 &gt;foo&lt;/div
21066 &gt;
21067 </p>
21068 !! end
21069
21070 !! test
21071 4. extension tags
21072 !! wikitext
21073 <nowiki><ref>foo</ref></nowiki>
21074
21075 <nowiki><ref>bar</nowiki>
21076
21077 baz<nowiki></ref></nowiki>
21078 !! html
21079 <p>&lt;ref&gt;foo&lt;/ref&gt;
21080 </p><p>&lt;ref&gt;bar
21081 </p><p>baz&lt;/ref&gt;
21082 </p>
21083 !! end
21084
21085 #### --------------- Others ---------------
21086 !! test
21087 Escaping nowikis
21088 !! wikitext
21089 &lt;nowiki&gt;foo&lt;/nowiki&gt;
21090 !! html
21091 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
21092 </p>
21093 !! end
21094
21095 ## The quote-char in the input is necessary for triggering the bug
21096 !! test
21097 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
21098 !! options
21099 parsoid=wt2wt,html2wt
21100 !! wikitext
21101 foo's bar :
21102 !! html
21103 <p>foo's bar :</p>
21104 !! end
21105
21106 !! test
21107
21108 Tag-like HTML structures are passed through as text
21109 !! wikitext
21110 <x y>
21111
21112 <x.y>
21113
21114 <x-y>
21115
21116 1>2
21117
21118 x<y
21119
21120 a>b
21121
21122 1<d e>f
21123 !! html
21124 <p>&lt;x y&gt;
21125 </p><p>&lt;x.y&gt;
21126 </p><p>&lt;x-y&gt;
21127 </p><p>1&gt;2
21128 </p><p>x&lt;y
21129 </p><p>a&gt;b
21130 </p><p>1&lt;d e&gt;f
21131 </p>
21132 !! end
21133
21134
21135 # This was a bug in the PHP parser (see bug 17663 and its dups,
21136 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
21137 !! test
21138 Tag names followed by punctuation should not be recognized as tags
21139 !! wikitext
21140 <s.ome> text
21141 !! html
21142 <p>&lt;s.ome&gt; text
21143 </p>
21144 !! end
21145
21146 !! test
21147 HTML tag with necessary entities in attributes
21148 !! wikitext
21149 <span title="&amp;amp;">foo</span>
21150 !! html
21151 <p><span title="&amp;amp;">foo</span>
21152 </p>
21153 !! end
21154
21155 !! test
21156 HTML tag with 'unnecessary' entity encoding in attributes
21157 !! wikitext
21158 <span title="&amp;">foo</span>
21159 !! html
21160 <p><span title="&amp;">foo</span>
21161 </p>
21162 !! end
21163
21164 !! test
21165 HTML tag with broken attribute value quoting
21166 !! wikitext
21167 <span title="Hello world>Foo</span>
21168 !! html/php
21169 <p><span>Foo</span>
21170 </p>
21171 !! html/parsoid
21172 <p><span title="Hello world">Foo</span>
21173 </p>
21174 !! end
21175
21176 !! test
21177 Parsoid-only: HTML tag with broken attribute value quoting
21178 !! options
21179 parsoid
21180 !! wikitext
21181 <span title="Hello world>Foo</span>
21182 !! html
21183 <p><span title="Hello world">Foo</span>
21184 </p>
21185 !! end
21186
21187 !! test
21188 Table with broken attribute value quoting
21189 !! wikitext
21190 {|
21191 | title="Hello world|Foo
21192 |}
21193 !! html/php
21194 <table>
21195 <tr>
21196 <td>Foo
21197 </td></tr></table>
21198
21199 !! html/parsoid
21200 <table>
21201 <tr>
21202 <td title="Hello world">Foo
21203 </td></tr></table>
21204
21205 !! end
21206
21207 !! test
21208 Table with broken attribute value quoting on consecutive lines
21209 !! wikitext
21210 {|
21211 | title="Hello world|Foo
21212 | style="color:red|Bar
21213 |}
21214 !! html/php
21215 <table>
21216 <tr>
21217 <td>Foo
21218 </td>
21219 <td>Bar
21220 </td></tr></table>
21221
21222 !! html/parsoid
21223 <table><tbody>
21224 <tr>
21225 <td title="Hello world">Foo
21226 </td><td style="color: red">Bar
21227 </td></tr></tbody></table>
21228
21229 !! end
21230
21231 !! test
21232 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21233 !! options
21234 parsoid
21235 !! wikitext
21236 {{}}
21237 !! html
21238 {{}}
21239 !! end
21240
21241 !! test
21242 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21243 !! options
21244 parsoid
21245 !! wikitext
21246 }}{{
21247 !! html
21248 }}{{
21249 !! end
21250
21251 !!test
21252 Accept empty td cell attribute
21253 !! wikitext
21254 {|
21255 | align="center" | foo || |
21256 |}
21257 !! html
21258 <table>
21259 <tr>
21260 <td align="center"> foo </td>
21261 <td>
21262 </td></tr></table>
21263
21264 !!end
21265
21266 !!test
21267 Non-empty attributes in th-cells
21268 !! wikitext
21269 {|
21270 ! Foo !! style="color: red" | Bar
21271 |}
21272 !! html
21273 <table>
21274 <tr>
21275 <th> Foo </th>
21276 <th style="color: red"> Bar
21277 </th></tr></table>
21278
21279 !!end
21280
21281 !!test
21282 Accept empty attributes in th-cells
21283 !! wikitext
21284 {|
21285 !| foo !!| bar
21286 |}
21287 !! html
21288 <table>
21289 <tr>
21290 <th> foo </th>
21291 <th> bar
21292 </th></tr></table>
21293
21294 !!end
21295
21296 !!test
21297 Empty table rows go away
21298 !! wikitext
21299 {|
21300 | Hello
21301 | there
21302 |- class="foo"
21303 |-
21304 |}
21305 !! html
21306 <table>
21307 <tr>
21308 <td> Hello
21309 </td>
21310 <td> there
21311 </td></tr>
21312
21313 </table>
21314
21315 !! end
21316
21317 ###
21318 ### Parsoid-centric tests for testing RTing of inter-element separators
21319 ### Edge cases not tested by existing parser tests and specific to
21320 ### Parsoid-specific serialization strategies.
21321 ###
21322
21323 !!test
21324 RT-ed inter-element separators should be valid separators
21325 !! wikitext
21326 {|
21327 |- [[foo]]
21328 |}
21329 !! html
21330 <table>
21331
21332 </table>
21333
21334 !!end
21335
21336 # Parsoid-only since PHP parser relies on Tidy for correct output
21337 !!test
21338 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
21339 !!options
21340 parsoid
21341 !! wikitext
21342 {|
21343 |<small>foo
21344 bar
21345 |}
21346
21347 {|
21348 |<small>foo<small>
21349 |}
21350 !! html
21351 <table>
21352 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
21353 <p>bar</p></small></td></tr>
21354 </tbody></table>
21355
21356 <table>
21357 <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>
21358 </tbody></table>
21359 !!end
21360
21361 !!test
21362 Empty TD followed by TD with tpl-generated attribute
21363 !! wikitext
21364 {|
21365 |-
21366 |
21367 |{{echo|style='color:red'}}|foo
21368 |}
21369 !! html
21370 <table>
21371
21372 <tr>
21373 <td>
21374 </td>
21375 <td>foo
21376 </td></tr></table>
21377
21378 !!end
21379
21380 !!test
21381 Indented table with an empty td
21382 !! wikitext
21383 {|
21384 |-
21385 |
21386 |foo
21387 |}
21388 !! html
21389 <table>
21390
21391 <tr>
21392 <td>
21393 </td>
21394 <td>foo
21395 </td></tr></table>
21396
21397 !!end
21398
21399 !!test
21400 Indented block & table
21401 !! wikitext
21402 <div>foo</div>
21403 {|
21404 |foo
21405 |}
21406 !! html/php
21407 <div>foo</div>
21408 <table>
21409 <tr>
21410 <td>foo
21411 </td></tr></table>
21412
21413 !! html/parsoid
21414 <div data-parsoid='{"stx":"html"}'>foo</div>
21415 <table><tbody>
21416 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
21417 </tbody></table>
21418 !!end
21419
21420 !! test
21421 Indent and comment before table row
21422 !! wikitext
21423 {|
21424 <!--hi-->|-
21425 | there
21426 |}
21427 !! html/php
21428 <table>
21429
21430 <tr>
21431 <td> there
21432 </td></tr></table>
21433
21434 !! html/parsoid
21435 <table>
21436 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
21437 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
21438 </tbody></table>
21439 !! end
21440
21441 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
21442 !!test
21443 Empty TR followed by a template-generated TR
21444 !!options
21445 parsoid
21446 !! wikitext
21447 {|
21448 |-
21449 {{echo|<tr><td>foo</td></tr>}}
21450 |}
21451 !! html
21452 <table>
21453 <tbody>
21454 <tr></tr>
21455 <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}}]}'>
21456 <td>foo</td></tr>
21457 </tbody></table>
21458 !!end
21459
21460 ## PHP and parsoid output differ for this, and since this is primarily
21461 ## for testing Parsoid's serializer, marking this Parsoid only
21462 !!test
21463 Empty TR followed by mixed-ws-comment line should RT correctly
21464 !!options
21465 parsoid
21466 !! wikitext
21467 {|
21468 |-
21469 <!--c-->
21470 |-
21471 <!--c--> <!--d-->
21472 |}
21473 !! html
21474 <table>
21475 <tbody>
21476 <tr></tr>
21477 <!--c-->
21478 <tr>
21479 <!--c--> </tr><!--d-->
21480 </tbody></table>
21481
21482 !!end
21483
21484 !!test
21485 Multi-line image caption generated by templates with/without trailing newlines
21486 !! wikitext
21487 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
21488 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
21489 !! html/parsoid
21490 <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>
21491 <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>
21492 !!end
21493
21494 !! test
21495 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
21496 !! options
21497 parsoid=html2wt
21498 !! wikitext
21499 <includeonly>foo</includeonly>
21500 new para
21501
21502 [[./Category:Foo]]
21503
21504 = new heading =
21505 !! html
21506 <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>
21507
21508 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
21509 !! end
21510
21511 ## PHP emits broken html for this, and since this is primarily
21512 ## a Parsoid serializer test, marking this Parsoid only
21513 !!test
21514 Improperly nested inline or quotes tags with whitespace in between
21515 !!options
21516 parsoid
21517 !! wikitext
21518 <span> <s>x</span> </s>
21519 ''' ''x''' ''
21520 !! html
21521 <p><span> <s>x</s></span><s> </s>
21522 <b> <i>x</i></b><i> </i>
21523 </p>
21524 !!end
21525
21526 !!test
21527 Encapsulate protected attributes from wt
21528 !!options
21529 parsoid
21530 !! wikitext
21531 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
21532 !! html
21533 <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>
21534 </body>
21535 !!end
21536
21537 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
21538 ## Having nested or stray pre tags results in the attempt to add duplicates,
21539 ## causing an assertion fail. This test tries to prevent that situation.
21540 !!test
21541 Ensure ParagraphWrapper can deal with stray closing pre tags
21542 !!options
21543 parsoid=wt2html
21544 !! wikitext
21545 plain text</pre>
21546 !! html
21547 plain text
21548 !!end
21549
21550 !!test
21551 1. Ensure fostered text content is wrapped in element nodes
21552 !!options
21553 parsoid=wt2html
21554 !! wikitext
21555 <table>hi</table><table>ho</table>
21556 !! html
21557 <p>hi</p>
21558 <table></table>
21559 <p>ho</p>
21560 <table></table>
21561 !!end
21562
21563 !!test
21564 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
21565 !!options
21566 parsoid=wt2html,wt2wt
21567 !! wikitext
21568 <table>
21569 <tr> || ||
21570 <td> a
21571 </table>
21572 !! html
21573 <p> || ||
21574 </p><table>
21575 <tbody><tr><td> a</td></tr>
21576 </tbody></table>
21577 !!end
21578
21579 !!test
21580 Encapsulation properly handles null DSR information from foster box
21581 !!options
21582 parsoid=wt2html,wt2wt
21583 !! wikitext
21584 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
21585 !! html
21586 <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>
21587 !!end
21588
21589 !!test
21590 1. Encapsulate foster-parented transclusion content
21591 !!options
21592 parsoid=wt2wt,wt2html
21593 !! wikitext
21594 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
21595 !! html
21596 <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>
21597 <tbody>
21598 <tr>
21599 <td>bar</td>
21600 </tr>
21601 </tbody>
21602 </table>
21603 !!end
21604
21605 !!test
21606 2. Encapsulate foster-parented transclusion content
21607 !!options
21608 parsoid=wt2wt,wt2html
21609 !! wikitext
21610 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
21611 !! html
21612 <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>
21613 <table>
21614 <tbody>
21615 <tr>
21616 <td>bar</td>
21617 </tr>
21618 </tbody>
21619 </table>
21620 !!end
21621
21622 !!test
21623 3. Encapsulate foster-parented transclusion content
21624 !!options
21625 parsoid=wt2wt,wt2html
21626 !! wikitext
21627 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21628 !! html
21629 <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;]}">
21630 <p>foo</p>
21631 </div>
21632 <table>
21633 <tbody>
21634 <tr>
21635 <td>bar</td>
21636 </tr>
21637 </tbody>
21638 </table>
21639 !!end
21640
21641 !!test
21642 4. Encapsulate foster-parented transclusion content
21643 !!options
21644 parsoid=wt2wt,wt2html
21645 !! wikitext
21646 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21647 !! html
21648 <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;]}">
21649 <p>foo</p>
21650 </div>
21651 <table>
21652 <tbody>
21653 <tr>
21654 <td>bar</td>
21655 </tr>
21656 </tbody>
21657 </table>
21658 !!end
21659
21660 !!test
21661 5. Encapsulate foster-parented transclusion content
21662 !!options
21663 parsoid=wt2wt,wt2html
21664 !! wikitext
21665 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
21666 !! html
21667 <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>
21668 <table>
21669 <tbody>
21670 <tr>
21671 <td>
21672 <div>
21673 <p>foo</p>
21674 </div>
21675 </td>
21676 </tr>
21677 </tbody>
21678 </table>
21679 !!end
21680
21681 !!test
21682 6. Encapsulate foster-parented transclusion content
21683 !!options
21684 parsoid=wt2wt,wt2html
21685 !! wikitext
21686 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
21687 !! html
21688 <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>
21689 <table>
21690 <tbody>
21691 <tr>
21692 <td>
21693 <div>
21694 <p>foo</p>
21695 </div>
21696 </td>
21697 </tr>
21698 </tbody>
21699 </table>
21700 <p>ok</p>
21701 !!end
21702
21703 !!test
21704 7. Encapsulate foster-parented transclusion content
21705 !!options
21706 parsoid=wt2wt,wt2html
21707 !! wikitext
21708 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
21709 !! html
21710 <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>
21711 <table>
21712 <tbody>
21713 <tr>
21714 <td>bar</td>
21715 </tr>
21716 </tbody>
21717 </table>
21718 !!end
21719
21720 !!test
21721 8. Encapsulate foster-parented transclusion content
21722 !!options
21723 parsoid=wt2wt,wt2html
21724 !! wikitext
21725 {{echo|a
21726 }}{|{{echo|style='color:red'}}
21727 |-
21728 |b
21729 |}
21730 !! html
21731 <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>
21732 <tbody>
21733 <tr>
21734 <td>b</td>
21735 </tr>
21736 </tbody>
21737 </table>
21738 !!end
21739
21740 !!test
21741 9. Encapsulate foster-parented transclusion content
21742 !!options
21743 parsoid=wt2wt,wt2html
21744 !! wikitext
21745 <table>{{echo|hi</table>hello}}
21746 !! html
21747 <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>
21748 !!end
21749
21750 !!test
21751 Table in fosterable position
21752 !!options
21753 parsoid=wt2html,wt2wt
21754 !! wikitext
21755 {{OpenTable}}
21756 <div>
21757 {|
21758 |}
21759 </div>
21760 |}
21761 !! html
21762 <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">
21763 </span>
21764 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
21765
21766 <table>
21767 </table>
21768 !!end
21769
21770 # Parsoid only for bug 64747
21771 !! test
21772 Properly encapsulate empty-content transclusions in fosterable positions
21773 !! wikitext
21774 <table>
21775 {{#if:|
21776 <td>foo</td>
21777 }}
21778 </table>
21779 !! html/parsoid
21780 <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>"}'>
21781
21782 </table>
21783 !! end
21784
21785 !!test
21786 Support <object> element with .data attribute
21787 !!options
21788 parsoid=html2wt
21789 !! wikitext
21790 <object data="test.swf"></object>
21791 !! html
21792 <object data="test.swf"></object>
21793 !!end
21794
21795 !! test
21796 Don't block XML namespace declaration
21797 !! wikitext
21798 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
21799 !! html/php
21800 <p><span>MediaWiki</span>
21801 </p>
21802 !! html/parsoid
21803 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
21804 !! end
21805
21806 # -----------------------------------------------------------------
21807 # The following section of tests are primarily to spec requirements
21808 # around serialization of new/edited content.
21809 #
21810 # All these tests are marked Parsoid html2wt and html2html only
21811 # ----------------------------------------------------------------
21812
21813 # 'mi' is a localinterwiki prefix as well as a language
21814 !! test
21815 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
21816 !! options
21817 parsoid=html2wt
21818 !! wikitext
21819 [[Foo]]
21820 !! html
21821 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
21822 !! end
21823
21824 !! test
21825 New wiki links (href variations)
21826 !! options
21827 parsoid=html2wt
21828 !! html
21829 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
21830 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
21831 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
21832 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
21833 !! wikitext
21834 [[Foo_bar]]
21835 [[Foo_bar]]
21836 [[Foo_bar]]
21837 [[Toxine bactérienne]]
21838 !! end
21839
21840 !! test
21841 New wiki links (content string variations)
21842 !! options
21843 parsoid=html2wt
21844 !! html
21845 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
21846 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
21847 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
21848 !! wikitext
21849 [[Foo_bar]]
21850 [[Foo bar]]
21851 [[Foo_bar|./Foo_bar]]
21852 !! end
21853
21854 !! test
21855 New category links (href variations)
21856 !! options
21857 parsoid=html2wt
21858 !! html
21859 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
21860 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
21861 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
21862 !! wikitext
21863 [[Category:Toxine bactérienne]]
21864 [[Category:Toxine bactérienne]]
21865 [[Category:Toxine bactérienne]]
21866 !! end
21867
21868 !! test
21869 New interlanguage links (href variations)
21870 !! options
21871 parsoid=html2wt
21872 !! html
21873 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
21874 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
21875 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
21876 !! wikitext
21877 [[es:Toxine bactérienne]]
21878 [[es:Toxine_bactérienne]]
21879 [[es:Toxine_bactérienne]]
21880 !! end
21881
21882 !! test
21883 Image: Modifying size of an image (1)
21884 !! options
21885 parsoid={
21886 "modes": ["wt2wt"],
21887 "changes": [
21888 ["img[height]", "attr", "height", "22"],
21889 ["img[width]", "attr", "width", "200"]
21890 ]
21891 }
21892 !! wikitext
21893 [[Image:Foobar.jpg|230x230px]]
21894 !! wikitext/edited
21895 [[Image:Foobar.jpg|200x200px]]
21896 !!end
21897
21898 !! test
21899 Image: Modifying size of an image (2)
21900 !! options
21901 parsoid={
21902 "modes": ["wt2wt"],
21903 "changes": [
21904 ["img[height]", "attr", "height", "100"],
21905 ["img[width]", "attr", "width", "500"]
21906 ]
21907 }
21908 !! wikitext
21909 [[Image:Foobar.jpg|230x230px]]
21910 !! wikitext/edited
21911 [[Image:Foobar.jpg|500x500px]]
21912 !!end
21913
21914 # Change in size is ignored so long as class='mw-default-size'
21915 !! test
21916 Image: Modifying size of an image (3)
21917 !! options
21918 parsoid={
21919 "modes": ["wt2wt"],
21920 "changes": [
21921 ["figure[class]", "removeClass", "mw-default-size"],
21922 ["figure img", "attr", "height", "19"],
21923 ["figure img", "attr", "width", "170"]
21924 ]
21925 }
21926 !! wikitext
21927 [[Image:Foobar.jpg|thumb]]
21928 !! wikitext/edited
21929 [[Image:Foobar.jpg|thumb|170x170px]]
21930 !!end
21931
21932 !! test
21933 Image: Modifying alignment of an image (bug 48665)
21934 !! options
21935 parsoid={
21936 "modes": ["wt2wt"],
21937 "changes": [
21938 ["figure[class]", "removeClass", "mw-halign-right"],
21939 ["figure[class]", "addClass", "mw-halign-left"]
21940 ]
21941 }
21942 !! wikitext
21943 [[Image:Foobar.jpg|thumb|caption|right]]
21944 !! wikitext/edited
21945 [[Image:Foobar.jpg|thumb|caption|left]]
21946 !! end
21947
21948 !! test
21949 Image: Modifying mw-default-size of an frameless image (bug 62805)
21950 !! options
21951 parsoid={
21952 "modes": ["wt2wt"],
21953 "changes": [
21954 ["figure.mw-default-size", "removeClass", "mw-default-size"]
21955 ]
21956 }
21957 !! wikitext
21958 [[Image:Foobar.jpg|frameless|right]]
21959 !! wikitext/edited
21960 [[Image:Foobar.jpg|frameless|right|220x220px]]
21961 !! end
21962
21963 !! test
21964 Image: Modifying valign of an image (bug 49221)
21965 !! options
21966 parsoid={
21967 "modes": ["wt2wt"],
21968 "changes": [
21969 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
21970 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
21971 ]
21972 }
21973 !! wikitext
21974 [[File:Foobar.jpg|20px|middle]]
21975 !! wikitext/edited
21976 [[File:Foobar.jpg|20px|text-top]]
21977 !! end
21978
21979 !! test
21980 Image: Modifying alt attribute of an image (bug 56400)
21981 !! options
21982 parsoid={
21983 "modes": ["wt2wt"],
21984 "changes": [
21985 ["img[alt]", "attr", "alt", "some alternate edited text"]
21986 ]
21987 }
21988 !! wikitext
21989 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
21990 !! wikitext/edited
21991 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
21992 !!end
21993
21994 !! test
21995 Image: Modifying caption of an image
21996 !! options
21997 parsoid={
21998 "modes": ["wt2wt"],
21999 "changes": [
22000 ["figcaption", "text", "new caption"]
22001 ]
22002 }
22003 !! wikitext
22004 [[Image:Foobar.jpg|thumb|original caption]]
22005 !! wikitext/edited
22006 [[Image:Foobar.jpg|thumb|new caption]]
22007 !!end
22008
22009 !! test
22010 Image: empty alt attribute (bug 48924)
22011 !! options
22012 parsoid
22013 !! wikitext
22014 [[File:Foobar.jpg|thumb|alt=|bar]]
22015 !! html
22016 <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>
22017 !! end
22018
22019 #!! test
22020 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
22021 #!! options
22022 #parsoid=html2wt
22023 #language=ar
22024 #!! wikitext
22025 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
22026 #!! html
22027 #<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>
22028 #!! end
22029
22030 !! test
22031 Image: Block level image should have \n before and after
22032 !! wikitext
22033 123
22034 [[File:Foobar.jpg|right|thumb|150x150px]]
22035 456
22036 !! html/parsoid
22037 <p>123</p>
22038 <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>
22039 <p>456</p>
22040 !!end
22041
22042 !! test
22043 Image: New block level image should have \n before and after (existing content)
22044 !! wikitext
22045 123
22046 [[File:Foobar.jpg|right|thumb|150x150px]]
22047 456
22048 !! html/parsoid
22049 <p>123</p>
22050 <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>
22051 <p>456</p>
22052 !!end
22053
22054 !! test
22055 Image: upright option (parsoid)
22056 !! options
22057 parsoid
22058 !! wikitext
22059 [[File:Foobar.jpg|thumb|upright|caption]]
22060 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
22061 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
22062 !! html
22063 <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>
22064 <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>
22065 <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>
22066 !!end
22067
22068 !! test
22069 Image: upright option is ignored on inline and frame images (parsoid)
22070 !! options
22071 parsoid
22072 !! wikitext
22073 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
22074 !! html
22075 <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>
22076 !!end
22077
22078 !! test
22079 Image: from basic HTML (1)
22080 !! options
22081 parsoid=html2wt
22082 !! html/parsoid
22083 <span typeof="mw:Image">
22084 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22085 </span>
22086 !! wikitext
22087 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22088 !! end
22089
22090 !! test
22091 Image: from basic HTML (2)
22092 !! options
22093 parsoid=html2wt
22094 !! html/parsoid
22095 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22096 !! wikitext
22097 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22098 !! end
22099
22100 !! test
22101 Image: from basic HTML (3)
22102 !! options
22103 parsoid=html2wt
22104 !! html/parsoid
22105 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
22106 !! wikitext
22107 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
22108 !! end
22109
22110 !! test
22111 Image: from basic HTML (4)
22112 !! options
22113 parsoid=html2wt
22114 !! html/parsoid
22115 <img src="File:Foobar.jpg">
22116 !! wikitext
22117 [[File:Foobar.jpg|link=]]
22118 !! end
22119
22120 !! test
22121 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
22122 !! options
22123 parsoid=html2wt
22124 !! wikitext
22125 * foo
22126 !! html
22127 <ul>
22128 <li><p>foo</p></li>
22129 </ul>
22130 !! end
22131
22132 !! test
22133 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
22134 !! options
22135 parsoid=html2wt
22136 !! wikitext
22137 * foo
22138 !! html
22139 <ul> <li>foo</li></ul>
22140 !! end
22141
22142 !! test
22143 Don't strip leading whitespace when handling indent-pre suppressing tags
22144 !! options
22145 parsoid=html2wt
22146 !! wikitext
22147 {|
22148 | indented row
22149 |}
22150 <blockquote>
22151 '''This is very bold of you!'''
22152
22153 {|
22154 |
22155 indented cell (no pre-wrapping!)
22156 |}
22157 </blockquote>
22158 foo
22159 <div>bar</div>
22160 !! html
22161 <table>
22162 <tr><td> indented row</td></tr>
22163 </table>
22164 <blockquote><p>
22165 <b>This is very bold of you!</b>
22166 </p>
22167 <table><tr><td>
22168 indented cell (no pre-wrapping!)
22169 </td></tr></table>
22170 </blockquote>
22171 <p>foo</p>
22172 <div>bar</div>
22173 !! end
22174
22175 !! test
22176 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
22177 !! options
22178 parsoid=html2wt
22179 !! wikitext
22180 foo
22181 <nowiki> </nowiki><span>bar</span>
22182
22183 <span>foo2
22184 <nowiki> </nowiki></span>bar2
22185
22186 <div>foo</div>
22187 <nowiki> </nowiki><span>bar</span>
22188
22189 <div>
22190 <nowiki> </nowiki><span>foo</span>
22191 </div>
22192 !! html
22193 <p>foo</p>
22194 <span>bar</span>
22195
22196 <span>foo2
22197 </span>bar2
22198
22199 <div>foo</div>
22200 <span>bar</span>
22201
22202 <div>
22203 <span>foo</span>
22204 </div>
22205 !! end
22206
22207 !! test
22208 Lists: Add space after bullets
22209 !! options
22210 parsoid=html2wt
22211 !! wikitext
22212 * foo
22213 * bar
22214 * <span> baz</span>
22215 !! html
22216 <ul>
22217 <li>foo</li>
22218 <li> bar</li>
22219 <li><span> baz</span></li>
22220 </ul>
22221 !! end
22222
22223 !! test
22224 Lists: Dont insert newlines in a serialized list item.
22225 !! options
22226 parsoid=html2wt
22227 !! wikitext
22228 * a<br>b
22229 * c
22230 !! html
22231 <ul><li>a<br>b</li><li>c</li></ul>
22232 !! end
22233
22234 !! test
22235 Headings: Add space before/after == (Bug 51744)
22236 !! options
22237 parsoid=html2wt
22238 !! wikitext
22239 == foo ==
22240
22241 == bar ==
22242
22243 == baz ==
22244
22245 == <span> baz</span> ==
22246 !! html
22247 <h2>foo</h2>
22248 <h2> bar</h2>
22249 <h2>baz </h2>
22250 <h2><span> baz</span></h2>
22251 !! end
22252
22253 !! test
22254 Parsoid: Serialize positional parameters with = in them as named parameter
22255 !! options
22256 parsoid=html2wt
22257 !! wikitext
22258 {{echo|1 = f=oo}}
22259
22260 {{echo|1 = f=oo|2 = bar}}
22261
22262 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22263 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22264 {{echo|<nowiki>f=oo</nowiki>|bar}}
22265 !! html
22266 <p about="#mwt1" typeof="mw:Transclusion"
22267 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
22268
22269 <p about="#mwt1" typeof="mw:Transclusion"
22270 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
22271
22272 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22273 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22274 <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>
22275 !! end
22276
22277 !! test
22278 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
22279 !! options
22280 parsoid=html2wt
22281 !! wikitext
22282 <div>a
22283 b
22284 </div>
22285 <div>a
22286 b
22287 </div>
22288 <div>
22289 a
22290
22291 b
22292 </div>
22293 !! html
22294 <div>a<p>b</p></div>
22295 <div>a
22296 <p>b</p></div>
22297 <div>
22298 a
22299 <p>b</p></div>
22300 !! end
22301
22302 !! test
22303 Substrings resembling wikitext in hrefs should not get nowiki escapes
22304 !! options
22305 parsoid=html2wt
22306 !! wikitext
22307 [[Foo''bar''baz]]
22308 !! html
22309 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
22310 !! end
22311
22312 #-----------------------------
22313 # I/B quote minimization tests
22314 #-----------------------------
22315
22316 !! test
22317 1. I/B quote minimization: wikitext-only tags should be combined
22318 !! options
22319 parsoid=html2wt
22320 !! wikitext
22321 ''AB''
22322
22323 '''AB'''
22324
22325 ''A'''B'''''
22326
22327 '''A''B'''''
22328
22329 '''A''BC''D'''
22330
22331 '''''AB'''''
22332
22333 '''''AB'''''
22334
22335 '''''AB'''''
22336 !! html
22337 <p><i>A</i><i>B</i></p>
22338 <p><b>A</b><b>B</b></p>
22339 <p><i>A</i><b><i>B</i></b></p>
22340 <p><b>A</b><i><b>B</b></i></p>
22341 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
22342 <p><i><b>A</b></i><i><b>B</b></i></p>
22343 <p><i><b>A</b></i><b><i>B</i></b></p>
22344 <p><b><i>A</i></b><i><b>B</b></i></p>
22345 !! end
22346
22347 !! test
22348 2. I/B quote minimization: wikitext and html tags should not be combined
22349 !! options
22350 parsoid=html2wt
22351 !! wikitext
22352 ''A''<i>B</i>
22353
22354 ''A''<nowiki/>'''<i>B</i>'''
22355 !! html
22356 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
22357 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
22358 !! end
22359
22360 !! test
22361 3. I/B quote minimization: templated content stops minimization
22362 !! options
22363 parsoid=html2wt
22364 !! wikitext
22365 ''A''{{echo|''B''}}
22366
22367 ''A''{{echo|'''''B'''''}}
22368 !! html
22369 <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>
22370 <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>
22371 !! end
22372
22373 !! test
22374 4. I/B quote minimization: new content should be mimimized with adjacent old content
22375 !! options
22376 parsoid=html2wt
22377 !! wikitext
22378 ''AB''
22379
22380 '''AB'''
22381
22382 ''A'''B'''''
22383 !! html
22384 <p><i>A</i><i>B</i></p>
22385 <p><b>A</b><b>B</b></p>
22386 <p><i>A</i><b><i>B</i></b></p>
22387 !! end
22388
22389 #------------------------------------
22390 # End of I/B quote minimization tests
22391 #------------------------------------
22392
22393 !!test
22394 Bug 54262: New entities
22395 !! options
22396 parsoid=html2wt
22397 !! wikitext
22398 &nbsp;
22399 !! html
22400 <span typeof="mw:Entity">&nbsp;</span>
22401 !! end
22402
22403 ## Note that there is no wikitext output for 'unknownproperty' ##
22404 ## Unknown magic words are silently dropped ##
22405
22406 !! test
22407 Magic words
22408 !! options
22409 parsoid=html2wt
22410 !! wikitext
22411 __TOC__
22412 __NOTOC__
22413 __FORCETOC__
22414 __INDEX__
22415 __NOINDEX__
22416 __NOGALLERY__
22417 __NOEDITSECTION__
22418 __NOTITLECONVERT__
22419 __NOCONTENTCONVERT__
22420 !! html
22421 <meta property='mw:PageProp/toc' />
22422 <meta property='mw:PageProp/notoc' />
22423 <meta property='mw:PageProp/forcetoc' />
22424 <meta property='mw:PageProp/index' />
22425 <meta property='mw:PageProp/noindex' />
22426 <meta property='mw:PageProp/nogallery' />
22427 <meta property='mw:PageProp/noeditsection' />
22428 <meta property='mw:PageProp/notitleconvert' />
22429 <meta property='mw:PageProp/nocontentconvert' />
22430 <meta property='mw:PageProp/unknownproperty' />
22431 !! end
22432
22433 !! test
22434 Consecutive <pre>s should not get merged
22435 !! options
22436 parsoid=html2wt,html2html
22437 !! wikitext
22438 a
22439
22440 b
22441
22442 c
22443
22444 d
22445
22446 e
22447
22448
22449
22450 f
22451 !! html
22452 <pre>a</pre><pre>b</pre>
22453
22454 <pre>c
22455 </pre><pre>
22456 d</pre>
22457
22458 <pre>e
22459
22460 </pre><pre>
22461
22462 f</pre>
22463 !! end
22464
22465 !! test
22466 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
22467 !! options
22468 parsoid=html2wt
22469 !! wikitext
22470 [[Special:BookSources/1234567890|ISBN 1234567895]]
22471 !! html
22472 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
22473 !! end
22474
22475 !! test
22476 Edited RFC links not serializable as RFC links should serialize as extlinks
22477 !! options
22478 parsoid=html2wt
22479 !! wikitext
22480 [//tools.ietf.org/html/rfc123 New RFC]
22481 !! html
22482 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
22483 !! end
22484
22485 !! test
22486 Edited PMID links not serializable as PMID links should serialize as extlinks
22487 !! options
22488 parsoid=html2wt
22489 !! wikitext
22490 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
22491 !! html
22492 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
22493 !! end
22494
22495 !! test
22496 Edited Redirect link should emit a non-piped wikitext link
22497 !! options
22498 parsoid=html2wt
22499 !! wikitext
22500 #REDIRECT [[Bar]]
22501 !! html
22502 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
22503 !! end
22504
22505 !! test
22506 T75121: Infer extension name from typeOf if data-mw is not present
22507 !! options
22508 parsoid=html2wt
22509 !! wikitext
22510 <foo />
22511 !! html
22512 <div typeOf="mw:Extension/foo"></div>
22513 !! end
22514
22515 # -----------------------------------------------------------------
22516 # End of section for Parsoid-only html2wt tests for serialization
22517 # of new content
22518 # -----------------------------------------------------------------
22519
22520 TODO:
22521 more images
22522 more tables
22523 character entities
22524 and much more
22525 Try for 100% code coverage