Merge "Allow moment on mobile web"
[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 image
4189 !! wikitext
4190 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4191 !! html
4192 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4193 </p>
4194 !! end
4195
4196 !! test
4197 External image from https
4198 !! wikitext
4199 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4200 !! html
4201 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4202 </p>
4203 !! end
4204
4205 !! test
4206 External image (when not allowed)
4207 !! options
4208 wgAllowExternalImages=0
4209 !! wikitext
4210 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4211 !! html
4212 <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>
4213 </p>
4214 !! end
4215
4216 !! test
4217 Link to non-http image, no img tag
4218 !! wikitext
4219 Link to non-http image, no img tag: ftp://example.com/test.jpg
4220 !! html
4221 <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>
4222 </p>
4223 !! end
4224
4225 !! test
4226 External links: terminating separator
4227 !! wikitext
4228 Terminating separator: http://example.com/thing,
4229 !! html
4230 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4231 </p>
4232 !! end
4233
4234 !! test
4235 External links: intervening separator
4236 !! wikitext
4237 Intervening separator: http://example.com/1,2,3
4238 !! html
4239 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4240 </p>
4241 !! end
4242
4243 !! test
4244 External links: old bug with URL in query
4245 !! wikitext
4246 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4247 !! html
4248 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4249 </p>
4250 !! end
4251
4252 !! test
4253 External links: old URL-in-URL bug, mixed protocols
4254 !! wikitext
4255 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4256 !! html
4257 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4258 </p>
4259 !!end
4260
4261 !! test
4262 External links: URL in text
4263 !! wikitext
4264 URL in text: [http://example.com http://example.com]
4265 !! html
4266 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4267 </p>
4268 !! end
4269
4270 !! test
4271 External links: Clickable images
4272 !! wikitext
4273 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4274 !! html
4275 <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>
4276 </p>
4277 !!end
4278
4279 !! test
4280 External links: raw ampersand
4281 !! wikitext
4282 Old &amp; use: http://x&y
4283 !! html
4284 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4285 </p>
4286 !! end
4287
4288 !! test
4289 External links: encoded ampersand
4290 !! wikitext
4291 Old &amp; use: http://x&amp;y
4292 !! html/php
4293 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4294 </p>
4295 !! html/parsoid
4296 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4297 !! end
4298
4299 !! test
4300 External links: encoded equals (bug 6102)
4301 !! wikitext
4302 http://example.com/?foo&#61;bar
4303 !! html/php
4304 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4305 </p>
4306 !! html/parsoid
4307 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4308 !! end
4309
4310 ##
4311 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4312 ## does it number them. As discussed in bug 53505, we can identify
4313 ## autonumbered links via CSS.
4314 ##
4315
4316 !! test
4317 External links: [raw ampersand]
4318 !! wikitext
4319 Old &amp; use: [http://x&y]
4320 !! html/php
4321 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4322 </p>
4323 !! html/parsoid
4324 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4325 !! end
4326
4327 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4328 # mode will return the [raw ampersand] wikitext
4329 !! test
4330 External links: [encoded ampersand]
4331 !! options
4332 parsoid=wt2html,wt2wt,html2html
4333 !! wikitext
4334 Old &amp; use: [http://x&amp;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 !! test
4343 External links: [raw equals]
4344 !! wikitext
4345 [http://example.com/?foo=bar]
4346 !! html/php
4347 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4348 </p>
4349 !! html/parsoid
4350 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4351 !! end
4352
4353 # note that parsoid html is identical to [raw equals] case; so html2wt
4354 # mode will return the [raw equals] wikitext
4355 !! test
4356 External links: [encoded equals] (bug 6102)
4357 !! options
4358 parsoid=wt2html,wt2wt,html2html
4359 !! wikitext
4360 [http://example.com/?foo&#61;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 # xxx parsoid strips the IDN character, so the round-trip tests will
4369 # obviously fail and are disabled. --cscott
4370 !! test
4371 External links: [IDN ignored character reference in hostname; strip it right off]
4372 !! options
4373 parsoid=wt2html,wt2wt,html2html
4374 !! wikitext
4375 [http://e&zwnj;xample.com/]
4376 !! html/php
4377 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4378 </p>
4379 !! html/parsoid
4380 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4381 !! end
4382
4383 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4384 # Where an external link could easily circumvent the sanitization of the text of
4385 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4386 # test demands a higher standard. That's a bit strange.
4387 #
4388 # Example:
4389 #
4390 # http://e‌xample.com -> [http://example.com|http://example.com]
4391 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4392 #
4393 # The first example is sanitized, but the second is not. Any security benefits
4394 # from this production are trivial to circumvent. Either remove this test and
4395 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4396 # the test accordingly.
4397 #
4398 # All our love,
4399 # The Parsoid team.
4400 # xxx parsoid strips the IDN character, so the round-trip tests will
4401 # obviously fail and are disabled. --cscott
4402 !! test
4403 External links: IDN ignored character reference in hostname; strip it right off
4404 !! options
4405 parsoid=wt2html,html2html
4406 !! wikitext
4407 http://e&zwnj;xample.com/
4408 !! html/php
4409 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4410 </p>
4411 !! html/parsoid
4412 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4413 !! end
4414
4415 !! test
4416 External links: www.jpeg.org (bug 554)
4417 !! wikitext
4418 http://www.jpeg.org
4419 !! html
4420 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4421 </p>
4422 !! end
4423
4424 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4425 !! test
4426 External links: URL within URL (original bug 2)
4427 !! wikitext
4428 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4429 !! html/php
4430 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4431 </p>
4432 !! html/parsoid
4433 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4434 !! end
4435
4436 !! test
4437 BUG 361: URL inside bracketed URL
4438 !! wikitext
4439 [http://www.example.com/foo http://www.example.com/bar]
4440 !! html
4441 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4442 </p>
4443 !! end
4444
4445 !! test
4446 BUG 361: URL within URL, not bracketed
4447 !! wikitext
4448 http://www.example.com/foo?=http://www.example.com/bar
4449 !! html
4450 <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>
4451 </p>
4452 !! end
4453
4454 !! test
4455 BUG 289: ">"-token in URL-tail
4456 !! wikitext
4457 http://www.example.com/<hello>
4458 !! html
4459 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4460 </p>
4461 !!end
4462
4463 !! test
4464 BUG 289: literal ">"-token in URL-tail
4465 !! wikitext
4466 http://www.example.com/<b>html</b>
4467 !! html
4468 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4469 </p>
4470 !!end
4471
4472 !! test
4473 BUG 289: ">"-token in bracketed URL
4474 !! wikitext
4475 [http://www.example.com/<hello> stuff]
4476 !! html
4477 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4478 </p>
4479 !!end
4480
4481 !! test
4482 BUG 289: literal ">"-token in bracketed URL
4483 !! wikitext
4484 [http://www.example.com/<b>html</b> stuff]
4485 !! html
4486 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4487 </p>
4488 !!end
4489
4490 !! test
4491 BUG 289: literal double quote at end of URL
4492 !! wikitext
4493 http://www.example.com/"hello"
4494 !! html
4495 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4496 </p>
4497 !!end
4498
4499 !! test
4500 BUG 289: literal double quote in bracketed URL
4501 !! wikitext
4502 [http://www.example.com/"hello" stuff]
4503 !! html
4504 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4505 </p>
4506 !!end
4507
4508 !! test
4509 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4510 !! wikitext
4511 [http://www.example.com test]
4512 !! html
4513 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4514 </p>
4515 !! end
4516
4517 !! test
4518 External links: link text with spaces
4519 !! wikitext
4520 [http://www.example.com a b c]
4521 [http://www.example.com ''a'' ''b'']
4522 !! html
4523 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4524 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4525 </p>
4526 !! end
4527
4528 !! test
4529 External links: wiki links within external link (Bug 3695)
4530 !! wikitext
4531 [http://example.com [[wikilink]] embedded in ext link]
4532 !! html/php
4533 <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>
4534 </p>
4535 !! html/parsoid
4536 <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>
4537 !! end
4538
4539 !! test
4540 BUG 787: Links with one slash after the url protocol are invalid
4541 !! wikitext
4542 http:/example.com
4543
4544 [http:/example.com title]
4545 !! html
4546 <p>http:/example.com
4547 </p><p>[http:/example.com title]
4548 </p>
4549 !! end
4550
4551 !! test
4552 Bracketed external links with template-generated invalid target
4553 !! wikitext
4554 [{{echo|http:/example.com}} title]
4555 !! html
4556 <p>[http:/example.com title]
4557 </p>
4558 !! end
4559
4560 !! test
4561 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4562 !! wikitext
4563 ''[http://example.com text'']
4564 [http://example.com '''text]'''
4565 ''Something [http://example.com in italic'']
4566 ''Something [http://example.com mixed''''', even bold]'''
4567 '''''Now [http://example.com both''''']
4568 !! html
4569 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4570 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4571 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4572 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4573 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4574 </p>
4575 !! end
4576
4577
4578 !! test
4579 Bug 4781: %26 in URL
4580 !! wikitext
4581 http://www.example.com/?title=AT%26T
4582 !! html/php
4583 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4584 </p>
4585 !! html/parsoid
4586 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4587 !! end
4588
4589 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4590 # % is actually legal in HTML5. Any change in output would need testing though.
4591 !! test
4592 Bug 4781, 5267: %25 in URL
4593 !! wikitext
4594 http://www.example.com/?title=100%25_Bran
4595 !! html/php
4596 <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>
4597 </p>
4598 !! html/parsoid
4599 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4600 !! end
4601
4602 !! test
4603 Bug 4781, 5267: %28, %29 in URL
4604 !! wikitext
4605 http://www.example.com/?title=Ben-Hur_%281959_film%29
4606 !! html/php
4607 <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>
4608 </p>
4609 !! html/parsoid
4610 <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>
4611 !! end
4612
4613
4614 !! test
4615 Bug 4781: %26 in autonumber URL
4616 !! wikitext
4617 [http://www.example.com/?title=AT%26T]
4618 !! html/php
4619 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4620 </p>
4621 !! html/parsoid
4622 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4623 !! end
4624
4625 !! test
4626 Bug 4781, 5267: %26 in autonumber URL
4627 !! wikitext
4628 [http://www.example.com/?title=100%25_Bran]
4629 !! html/php
4630 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4631 </p>
4632 !! html/parsoid
4633 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4634 !! end
4635
4636 !! test
4637 Bug 4781, 5267: %28, %29 in autonumber URL
4638 !! wikitext
4639 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4640 !! html/php
4641 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4642 </p>
4643 !! html/parsoid
4644 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4645 !! end
4646
4647
4648 !! test
4649 Bug 4781: %26 in bracketed URL
4650 !! wikitext
4651 [http://www.example.com/?title=AT%26T link]
4652 !! html/php
4653 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4654 </p>
4655 !! html/parsoid
4656 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4657 !! end
4658
4659 !! test
4660 Bug 4781, 5267: %25 in bracketed URL
4661 !! wikitext
4662 [http://www.example.com/?title=100%25_Bran link]
4663 !! html
4664 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4665 </p>
4666 !! end
4667
4668 !! test
4669 Bug 4781, 5267: %28, %29 in bracketed URL
4670 !! wikitext
4671 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4672 !! html/php
4673 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4674 </p>
4675 !! html/parsoid
4676 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4677 !! end
4678
4679 !! test
4680 External link containing a period in the anchor. (bug 63947)
4681 !! wikitext
4682 [//foo.org/bar#baz. bang]
4683
4684 [//foo.org/bar. bang]
4685 !! html/php
4686 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4687 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4688 </p>
4689 !! html/parsoid
4690 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4691 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4692 !! end
4693
4694 !! test
4695 External link containing a single quote. (bug 63947)
4696 !! wikitext
4697 [//foo.org/bar'baz]
4698
4699 [//foo.org/bar'baz bang]
4700 !! html/php
4701 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4702 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4703 </p>
4704 !! html/parsoid
4705 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4706 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4707 !! end
4708
4709
4710 !! test
4711 External link containing a period in the anchor. (bug 63947)
4712 !! wikitext
4713 [//foo.org/bar#baz. bang]
4714
4715 [//foo.org/bar. bang]
4716 !! html/php
4717 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4718 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4719 </p>
4720 !! html/parsoid
4721 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4722 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4723 !! end
4724
4725 !! test
4726 External link containing a single quote. (bug 63947)
4727 !! wikitext
4728 [//foo.org/bar'baz]
4729
4730 [//foo.org/bar'baz bang]
4731 !! html/php
4732 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4733 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4734 </p>
4735 !! html/parsoid
4736 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4737 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4738 !! end
4739
4740
4741 !! test
4742 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4743 !! wikitext
4744 Some [http://example.com/ pretty ''italics'' and stuff]!
4745 !! html
4746 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4747 </p>
4748 !! end
4749
4750 !! test
4751 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4752 !! wikitext
4753 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4754 !! html
4755 <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>
4756 </p>
4757 !! end
4758
4759 !! test
4760 External link containing double-single-quotes with no space separating the url from text in italics
4761 !! wikitext
4762 [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]].]
4763 !! html/php
4764 <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>
4765 </p>
4766 !! html/php+tidy
4767 <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>
4768 !! html/parsoid
4769 <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>
4770 !! end
4771
4772 !! test
4773 External link with comments in link text
4774 !! wikitext
4775 [http://www.google.com Google <!-- comment -->]
4776 !! html
4777 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4778 </p>
4779 !! end
4780
4781 !! test
4782 URL-encoding in URL functions (single parameter)
4783 !! wikitext
4784 {{localurl:Some page|amp=&}}
4785 !! html
4786 <p>/index.php?title=Some_page&amp;amp=&amp;
4787 </p>
4788 !! end
4789
4790 !! test
4791 URL-encoding in URL functions (multiple parameters)
4792 !! wikitext
4793 {{localurl:Some page|q=?&amp=&}}
4794 !! html
4795 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4796 </p>
4797 !! end
4798
4799 !! test
4800 Brackets in urls
4801 !! wikitext
4802 http://example.com/index.php?foozoid%5B%5D=bar
4803
4804 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4805 !! html/php
4806 <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>
4807 </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>
4808 </p>
4809 !! html/parsoid
4810 <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>
4811
4812 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4813 !! end
4814
4815 !! test
4816 IPv6 urls (bug 21261)
4817 !! options
4818 disabled
4819 !! wikitext
4820 http://[2404:130:0:1000::187:2]/index.php
4821 !! html
4822 <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>
4823 </p>
4824 !! end
4825
4826 !! test
4827 Non-extlinks in brackets
4828 !! wikitext
4829 [foo]
4830 [foo bar]
4831 [foo ''bar'']
4832 [fool's] errand
4833 [fool's errand]
4834 [{{echo|foo}}]
4835 [{{echo|foo}} bar]
4836 [{{echo|foo}} ''bar'']
4837 [{{echo|foo}}l's] errand
4838 [{{echo|foo}}l's errand]
4839 [url={{echo|foo}}]
4840 [url=http://example.com]
4841 !! html
4842 <p>[foo]
4843 [foo bar]
4844 [foo <i>bar</i>]
4845 [fool's] errand
4846 [fool's errand]
4847 [foo]
4848 [foo bar]
4849 [foo <i>bar</i>]
4850 [fool's] errand
4851 [fool's errand]
4852 [url=foo]
4853 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4854 </p>
4855 !! end
4856
4857 !! test
4858 Percent encoding in external links
4859 !! wikitext
4860 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4861 !! html/php
4862 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4863 </p>
4864 !! html/parsoid
4865 <p><a rel="mw:ExtLink"
4866 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4867 !! end
4868
4869 !! test
4870 Use url link syntax for links where the content is equal the link target
4871 !! wikitext
4872 http://example.com
4873 !! html/php
4874 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4875 </p>
4876 !! html/parsoid
4877 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4878 !! end
4879
4880 !! test
4881 Parenthesis in external links, especially URL links
4882 !! wikitext
4883 http://example.com)
4884
4885 http://example.com/test)
4886
4887 http://example.com/(test)
4888
4889 http://example.com/((test)
4890
4891 (http://example.com/(test))
4892
4893 (http://example.com/(test)))))
4894
4895 http://example.com/a)b
4896
4897 [http://example.com) foo]
4898 !! html/php
4899 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4900 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4901 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4902 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4903 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4904 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4905 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4906 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4907 </p>
4908 !! html/parsoid
4909 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4910 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4911 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4912 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4913 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4914 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4915 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4916 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4917 !! end
4918
4919 !! test
4920 Parenthesis in external links, w/ transclusion or comment
4921 !! wikitext
4922 (http://example.com/{{echo|hi}})
4923
4924 (http://example.com<!-- hi -->)
4925 !! html/php
4926 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4927 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4928 </p>
4929 !! html/parsoid
4930 <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>
4931
4932 <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>
4933 !! end
4934
4935 !! test
4936 Replace invalid link targets when serializing
4937 !! options
4938 parsoid=html2wt
4939 !! html
4940 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
4941 !! wikitext
4942 [[MediaWiki:Badtitletext|Manual]]
4943 !! end
4944
4945 ###
4946 ### Quotes
4947 ###
4948
4949 !! test
4950 Quotes
4951 !! wikitext
4952 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4953
4954 Normal text. '''''Bold italic text.''''' Normal text.
4955 !! html
4956 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4957 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4958 </p>
4959 !! end
4960
4961
4962 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4963 # parser strips. The wikitext contains just the first half of the bold
4964 # quote pair.
4965 !! test
4966 Unclosed and unmatched quotes
4967 !! wikitext
4968 '''''Bold italic text '''with bold deactivated''' in between.'''''
4969
4970 '''''Bold italic text ''with italic deactivated'' in between.'''''
4971
4972 '''Bold text..
4973
4974 ..spanning two paragraphs (should not work).'''
4975
4976 '''Bold tag left open
4977
4978 ''Italic tag left open
4979
4980 Normal text.
4981
4982 <!-- Unmatching number of opening, closing tags: -->
4983 '''This year''''s election ''should'' beat '''last year''''s.
4984
4985 ''Tom'''s car is bigger than ''Susan'''s.
4986
4987 Plain ''italic'''s plain
4988 !! html/php
4989 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4990 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4991 </p><p><b>Bold text..</b>
4992 </p><p>..spanning two paragraphs (should not work).
4993 </p><p><b>Bold tag left open</b>
4994 </p><p><i>Italic tag left open</i>
4995 </p><p>Normal text.
4996 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4997 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4998 </p><p>Plain <i>italic'</i>s plain
4999 </p>
5000 !! html/parsoid
5001 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5002 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5003 </p><p><b>Bold text..</b>
5004 </p><p>..spanning two paragraphs (should not work).<b></b>
5005 </p><p><b>Bold tag left open</b>
5006 </p><p><i>Italic tag left open</i>
5007 </p><p>Normal text.
5008 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5009 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5010 </p><p>Plain <i>italic'</i>s plain
5011 </p>
5012 !! end
5013
5014 ###
5015 ### Tables
5016 ###
5017 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5018 ###
5019
5020 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5021 # is the bare minimum required by the spec, see:
5022 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5023 # Parsoid team replies: empty table tags are legal in HTML5
5024 !! test
5025 A table with no data.
5026 !! options
5027 parsoid=wt2html
5028 !! wikitext
5029 {||}
5030 !! html/php
5031
5032 !! html/parsoid
5033 <table></table>
5034
5035 !! end
5036
5037 !! test
5038 A table with stray table end tags on start tag line (wt2html)
5039 !! options
5040 parsoid=wt2html
5041 !! wikitext
5042 {|style="color: red;"|}
5043
5044 {|style="color: red;" |}
5045 |foo
5046 |}
5047
5048 {|style="color: red;"|} id="foo"
5049 |foo
5050 |}
5051
5052 {|style="color: red;" |} id="foo"
5053 |foo
5054 |}
5055 !! html
5056 <table style="color: red;"></table>
5057
5058 <table style="color: red;">
5059 <tbody><tr>
5060 <td>foo</td>
5061 </tr></tbody>
5062 </table>
5063
5064 <table style="color: red;" id="foo">
5065 <tbody><tr>
5066 <td>foo</td>
5067 </tr></tbody>
5068 </table>
5069
5070 <table style="color: red;" id="foo">
5071 <tbody><tr>
5072 <td>foo</td>
5073 </tr></tbody>
5074 </table>
5075
5076 !! end
5077
5078 !! test
5079 A table with no data (take 2)
5080 !! wikitext
5081 {|
5082 |}
5083 !! html/parsoid
5084 <table></table>
5085 !! end
5086
5087 # A table with nothing but a caption is invalid XHTML, we might want to render
5088 # this as <p>caption</p>
5089 # Parsoid team replies: table with only a caption is legal in HTML5
5090 !! test
5091 A table with nothing but a caption
5092 !! wikitext
5093 {|
5094 |+ caption
5095 |}
5096 !! html/php
5097 <table>
5098 <caption> caption
5099 </caption><tr><td></td></tr></table>
5100
5101 !! html/parsoid
5102 <table><caption> caption</caption></table>
5103 !! end
5104
5105 !! test
5106 A table with caption with default-spaced attributes and a table row
5107 !! wikitext
5108 {|
5109 |+ style="color: red;" | caption1
5110 |-
5111 | foo
5112 |}
5113 !! html
5114 <table>
5115 <caption style="color: red;"> caption1
5116 </caption>
5117 <tr>
5118 <td> foo
5119 </td></tr></table>
5120
5121 !! end
5122
5123 !! test
5124 A table with captions with non-default spaced attributes and a table row
5125 !! wikitext
5126 {|
5127 |+style="color: red;"|caption2
5128 |+ style="color: red;"| caption3
5129 |-
5130 | foo
5131 |}
5132 !! html
5133 <table>
5134 <caption style="color: red;">caption2
5135 </caption>
5136 <caption style="color: red;"> caption3
5137 </caption>
5138 <tr>
5139 <td> foo
5140 </td></tr></table>
5141
5142 !! end
5143
5144 !! test
5145 Table td-cell syntax variations
5146 !! wikitext
5147 {|
5148 | foo bar foo | baz
5149 | foo bar foo || baz
5150 | style='color:red;' | baz
5151 | style='color:red;' || baz
5152 |}
5153 !! html
5154 <table>
5155 <tr>
5156 <td> baz
5157 </td>
5158 <td> foo bar foo </td>
5159 <td> baz
5160 </td>
5161 <td style="color:red;"> baz
5162 </td>
5163 <td> style='color:red;' </td>
5164 <td> baz
5165 </td></tr></table>
5166
5167 !! end
5168
5169 !! test
5170 Simple table
5171 !! wikitext
5172 {|
5173 | 1 || 2
5174 |-
5175 | 3 || 4
5176 |}
5177 !! html
5178 <table>
5179 <tr>
5180 <td> 1 </td>
5181 <td> 2
5182 </td></tr>
5183 <tr>
5184 <td> 3 </td>
5185 <td> 4
5186 </td></tr></table>
5187
5188 !! end
5189
5190 !! test
5191 Simple table but with multiple dashes for row wikitext
5192 !! wikitext
5193 {|
5194 | foo
5195 |-----
5196 | bar
5197 |}
5198 !! html
5199 <table>
5200 <tr>
5201 <td> foo
5202 </td></tr>
5203 <tr>
5204 <td> bar
5205 </td></tr></table>
5206
5207 !! end
5208 !! test
5209 Multiplication table
5210 !! wikitext
5211 {| border="1" cellpadding="2"
5212 |+Multiplication table
5213 |-
5214 ! &times; !! 1 !! 2 !! 3
5215 |-
5216 ! 1
5217 | 1 || 2 || 3
5218 |-
5219 ! 2
5220 | 2 || 4 || 6
5221 |-
5222 ! 3
5223 | 3 || 6 || 9
5224 |-
5225 ! 4
5226 | 4 || 8 || 12
5227 |-
5228 ! 5
5229 | 5 || 10 || 15
5230 |}
5231 !! html
5232 <table border="1" cellpadding="2">
5233 <caption>Multiplication table
5234 </caption>
5235 <tr>
5236 <th> &#215; </th>
5237 <th> 1 </th>
5238 <th> 2 </th>
5239 <th> 3
5240 </th></tr>
5241 <tr>
5242 <th> 1
5243 </th>
5244 <td> 1 </td>
5245 <td> 2 </td>
5246 <td> 3
5247 </td></tr>
5248 <tr>
5249 <th> 2
5250 </th>
5251 <td> 2 </td>
5252 <td> 4 </td>
5253 <td> 6
5254 </td></tr>
5255 <tr>
5256 <th> 3
5257 </th>
5258 <td> 3 </td>
5259 <td> 6 </td>
5260 <td> 9
5261 </td></tr>
5262 <tr>
5263 <th> 4
5264 </th>
5265 <td> 4 </td>
5266 <td> 8 </td>
5267 <td> 12
5268 </td></tr>
5269 <tr>
5270 <th> 5
5271 </th>
5272 <td> 5 </td>
5273 <td> 10 </td>
5274 <td> 15
5275 </td></tr></table>
5276
5277 !! end
5278
5279 !! test
5280 Accept "||" in table headings
5281 !! wikitext
5282 {|
5283 !h1 || h2
5284 |}
5285 !! html
5286 <table>
5287 <tr>
5288 <th>h1 </th>
5289 <th> h2
5290 </th></tr></table>
5291
5292 !! end
5293
5294 !! test
5295 Accept "!!" in table data
5296 !! wikitext
5297 {|
5298 | Foo!! ||
5299 |}
5300 !! html
5301 <table>
5302 <tr>
5303 <td> Foo!! </td>
5304 <td>
5305 </td></tr></table>
5306
5307 !! html/parsoid
5308 <table>
5309 <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>
5310 </tbody></table>
5311 !! end
5312
5313 !! test
5314 Accept "||" in indented table headings
5315 !! wikitext
5316 :{|
5317 !h1 || h2
5318 |}
5319 !! html
5320 <dl><dd><table>
5321 <tr>
5322 <th>h1 </th>
5323 <th> h2
5324 </th></tr></table></dd></dl>
5325
5326 !! end
5327
5328 !! test
5329 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5330 !! wikitext
5331 {|
5332 !| h1
5333 || a
5334 |}
5335 !! html
5336 <table>
5337 <tr>
5338 <th> h1
5339 </th>
5340 <td> a
5341 </td></tr></table>
5342
5343 !! end
5344
5345 !!test
5346 Accept "| !" at start of line in tables (ignore !-attribute)
5347 !! wikitext
5348 {|
5349 |-
5350 | !style="color:red" | bar
5351 |}
5352 !! html
5353 <table>
5354
5355 <tr>
5356 <td> bar
5357 </td></tr></table>
5358
5359 !!end
5360
5361 !!test
5362 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 +/-
5363 !! wikitext
5364 {|
5365 |-
5366 |style='color:red;'|+1
5367 |style='color:blue;'|-1
5368 |-
5369 | 1 || 2 || 3
5370 | 1 ||+2 ||-3
5371 |-
5372 | +1
5373 | -1
5374 |}
5375 !! html
5376 <table>
5377
5378 <tr>
5379 <td style="color:red;">+1
5380 </td>
5381 <td style="color:blue;">-1
5382 </td></tr>
5383 <tr>
5384 <td> 1 </td>
5385 <td> 2 </td>
5386 <td> 3
5387 </td>
5388 <td> 1 </td>
5389 <td>+2 </td>
5390 <td>-3
5391 </td></tr>
5392 <tr>
5393 <td> +1
5394 </td>
5395 <td> -1
5396 </td></tr></table>
5397
5398 !!end
5399
5400 !! test
5401 Table rowspan
5402 !! wikitext
5403 {| border=1
5404 | Cell 1, row 1
5405 |rowspan=2| Cell 2, row 1 (and 2)
5406 | Cell 3, row 1
5407 |-
5408 | Cell 1, row 2
5409 | Cell 3, row 2
5410 |}
5411 !! html
5412 <table border="1">
5413 <tr>
5414 <td> Cell 1, row 1
5415 </td>
5416 <td rowspan="2"> Cell 2, row 1 (and 2)
5417 </td>
5418 <td> Cell 3, row 1
5419 </td></tr>
5420 <tr>
5421 <td> Cell 1, row 2
5422 </td>
5423 <td> Cell 3, row 2
5424 </td></tr></table>
5425
5426 !! end
5427
5428 !! test
5429 Nested table
5430 !! wikitext
5431 {| border=1
5432 | &alpha;
5433 |
5434 {| bgcolor=#ABCDEF border=2
5435 |nested
5436 |-
5437 |table
5438 |}
5439 |the original table again
5440 |}
5441 !! html
5442 <table border="1">
5443 <tr>
5444 <td> &#945;
5445 </td>
5446 <td>
5447 <table bgcolor="#ABCDEF" border="2">
5448 <tr>
5449 <td>nested
5450 </td></tr>
5451 <tr>
5452 <td>table
5453 </td></tr></table>
5454 </td>
5455 <td>the original table again
5456 </td></tr></table>
5457
5458 !! end
5459
5460 !! test
5461 Invalid attributes in table cell (bug 1830)
5462 !! wikitext
5463 {|
5464 |Cell:|broken
5465 |}
5466 !! html
5467 <table>
5468 <tr>
5469 <td>broken
5470 </td></tr></table>
5471
5472 !! end
5473
5474
5475 # The "|}" to close the table is missing from the input, so parsoid's
5476 # *2wt modes will fail.
5477 !! test
5478 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5479 !! options
5480 parsoid=wt2html,html2html
5481 !! wikitext
5482 {|
5483 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5484 !! html/php
5485 <table>
5486 <tr>
5487 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5488 <td>]" onmouseover="alert(document.cookie)"&gt;test
5489 </td>
5490 </tr>
5491 </table>
5492
5493 !! html/parsoid
5494 <table><tbody>
5495 <tr>
5496 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5497 !! end
5498
5499
5500 !! test
5501 Indented table markup mixed with indented pre content (proposed in bug 6200)
5502 !! wikitext
5503 <table>
5504 <tr>
5505 <td>
5506 Text that should be rendered preformatted
5507 </td>
5508 </tr>
5509 </table>
5510 !! html
5511 <table>
5512 <tr>
5513 <td>
5514 <pre>Text that should be rendered preformatted
5515 </pre>
5516 </td>
5517 </tr>
5518 </table>
5519
5520 !! end
5521
5522 !! test
5523 Template-generated table cell attributes and cell content
5524 !! wikitext
5525 {|
5526 |{{table_attribs}}
5527 | {{table_attribs}}
5528 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
5529 |align=center {{table_attribs}}
5530 | <!--foo--> align=center <!--bar--> {{table_attribs}}
5531 |}
5532 !! html
5533 <table>
5534 <tr>
5535 <td style="color: red"> Foo
5536 </td>
5537 <td style="color: red"> Foo
5538 </td>
5539 <td style="color: red"> Foo
5540 </td>
5541 <td align="center" style="color: red"> Foo
5542 </td>
5543 <td align="center" style="color: red"> Foo
5544 </td></tr></table>
5545
5546 !! end
5547
5548 !! test
5549 Template-generated table cell attributes and cell content (2)
5550 !! wikitext
5551 {|
5552 |align=center {{table_cells}}
5553 |}
5554 !! html
5555 <table>
5556 <tr>
5557 <td align="center" style="color: red"> Foo </td>
5558 <td> Bar </td>
5559 <td> Baz
5560 </td></tr></table>
5561
5562 !! end
5563
5564 !! test
5565 Table with row followed by newlines and table heading
5566 !! wikitext
5567 {|
5568 |-
5569
5570 ! foo
5571 |}
5572 !! html
5573 <table>
5574
5575
5576 <tr>
5577 <th> foo
5578 </th></tr></table>
5579
5580 !! end
5581
5582 !! test
5583 Table with empty line following the start tag
5584 !! wikitext
5585 {|
5586
5587 |-
5588 | foo
5589 |}
5590 !! html
5591 <table>
5592
5593
5594 <tr>
5595 <td> foo
5596 </td></tr></table>
5597
5598 !! end
5599
5600 # FIXME: Preserve the attribute properly (with an empty string as value) in
5601 # the PHP parser. Parsoid implements the behavior below.
5602 !! test
5603 Table attributes with empty value
5604 !! wikitext
5605 {|
5606 | style=| hello
5607 |}
5608 !! html/parsoid
5609 <table>
5610 <tbody>
5611 <tr>
5612 <td style=""> hello
5613 </td></tr></tbody></table>
5614
5615 !! end
5616
5617 !! test
5618 Wikitext table with a lot of comments
5619 !! wikitext
5620 {|
5621 <!-- c0 -->
5622 | foo
5623 <!-- c1 -->
5624 |- <!-- c2 -->
5625 <!-- c3 -->
5626 |<!-- c4 -->
5627 <!-- c5 -->
5628 |}
5629 !! html
5630 <table>
5631 <tr>
5632 <td> foo
5633 </td></tr>
5634 <tr>
5635 <td>
5636 </td></tr></table>
5637
5638 !! end
5639
5640 !! test
5641 Wikitext table with double-line table cell
5642 !! wikitext
5643 {|
5644 |a
5645 b
5646 |}
5647 !! html
5648 <table>
5649 <tr>
5650 <td>a
5651 <p>b
5652 </p>
5653 </td></tr></table>
5654
5655 !! end
5656
5657 !! test
5658 Table cell with a single comment
5659 !! wikitext
5660 {|
5661 | <!-- c1 -->
5662 | a
5663 |}
5664 !! html
5665 <table>
5666 <tr>
5667 <td>
5668 </td>
5669 <td> a
5670 </td></tr></table>
5671
5672 !! end
5673
5674 !! test
5675 Table-cell after a comment-only-empty-line
5676 !! wikitext
5677 {|
5678 |a
5679 <!--c1-->
5680 <!--c2-->| b
5681 |}
5682 !! html
5683 <table>
5684 <tr>
5685 <td>a
5686 </td>
5687 <td> b
5688 </td></tr></table>
5689
5690 !! html/parsoid
5691 <table>
5692 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5693 <!--c1-->
5694 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5695 </tbody></table>
5696
5697 !! end
5698
5699 !! test
5700 Build table with {{!}}
5701 !! wikitext
5702 {{{!}} class="wikitable"
5703 ! header
5704 ! second header
5705 {{!}}- style="color:red;"
5706 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
5707 {{!}}}
5708 !! html
5709 <table class="wikitable">
5710 <tr>
5711 <th> header
5712 </th>
5713 <th> second header
5714 </th></tr>
5715 <tr style="color:red;">
5716 <td> data </td>
5717 <td style="color:red;"> second data
5718 </td></tr></table>
5719
5720 !! end
5721
5722 # The expected HTML structure in this test is debatable. The PHP parser does
5723 # not parse this kind of table at all. The main focus for Parsoid is on
5724 # round-tripping, so this output is ok for now. TODO: revisit!
5725 !! test
5726 Wikitext table with html-syntax row
5727 !! wikitext
5728 {|
5729 |-
5730 <td>foo</td>
5731 |}
5732 !! html/parsoid
5733 <table>
5734 <tbody>
5735 <tr>
5736 <td>foo</td></tr></tbody></table>
5737 !! end
5738
5739 ## Note that Parsoid output differs from PHP and PHP+tidy here.
5740 ## The lack of <tr> tags in the PHP output is arguably a bug in the
5741 ## PHP parser, which tidy then compounds by fostering the content
5742 ## entirely out of the table. Parsoid recognizes the table context
5743 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
5744 ## depends on PHP's treatment of broken table markup!
5745 !! test
5746 Implicit <td> after a |-
5747 !! options
5748 parsoid=wt2html,html2html
5749 !! wikitext
5750 {|
5751 |-
5752 a
5753 |}
5754 !! html/php
5755 <table>
5756
5757 a
5758 </table>
5759
5760 !! html/php+tidy
5761 <p>a</p>
5762 !! html/parsoid
5763 <table>
5764 <tr><td>a</td></tr>
5765 </table>
5766 !! end
5767
5768 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
5769 !! test
5770 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
5771 !! options
5772 parsoid=wt2html,html2html
5773 !! wikitext
5774 {|
5775 |-
5776 |
5777 a
5778 |-
5779 b
5780 |}
5781 !! html/php
5782 <table>
5783
5784 <tr>
5785 <td>
5786 <pre>a
5787 </pre>
5788 </td></tr>
5789 b
5790 </table>
5791
5792 !! html/php+tidy
5793 <p>b</p>
5794 <table>
5795 <tr>
5796 <td>
5797 <pre>
5798 a
5799 </pre></td>
5800 </tr>
5801 </table>
5802 !! html/parsoid
5803 <table>
5804 <tbody>
5805 <tr><td><pre>a</pre></td></tr>
5806 <tr><td> b</td></tr>
5807 </tbody>
5808 </table>
5809 !! end
5810
5811 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
5812 # Parsoid generates the missing <td>, so wt2wt won't succeed.
5813 !! test
5814 Lists should be recognized in an implicit <td> context
5815 !! options
5816 parsoid=wt2html,html2html
5817 !! wikitext
5818 {|
5819 |-
5820 *a
5821 |}
5822 !! html/php
5823 <table>
5824
5825 <ul><li>a</li></ul>
5826 </table>
5827
5828 !! html/php+tidy
5829 <ul>
5830 <li>a</li>
5831 </ul>
5832 !! html/parsoid
5833 <table>
5834 <tr>
5835 <td><ul>
5836 <li>a</li>
5837 </ul></td>
5838 </tr>
5839 </table>
5840 !! end
5841
5842 !! test
5843 Parsoid: Round-trip tables directly followed by content (bug 51219)
5844 !! options
5845 parsoid=wt2html,wt2wt
5846 !! wikitext
5847 {|
5848 |foo
5849 |} bar
5850
5851 {|
5852 |baz
5853 |}<b>quux</b>
5854 !! html+tidy
5855 <table>
5856 <tr>
5857 <td>foo</td>
5858 </tr>
5859 </table>
5860 <p>bar</p>
5861 <table>
5862 <tr>
5863 <td>baz</td>
5864 </tr>
5865 </table>
5866 <p><b>quux</b></p>
5867 !! end
5868
5869 !! test
5870 Parsoid: Default to a newline after tables in new content (bug 51219)
5871 !! options
5872 parsoid=html2wt
5873 !! wikitext
5874 {|
5875 |foo
5876 |}
5877 <nowiki> </nowiki>bar
5878 {|
5879 |baz
5880 |}
5881 '''quux'''
5882 !! html
5883 <table><tbody>
5884 <tr><td>foo</td></tr></tbody></table> bar
5885 <table><tbody>
5886 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5887 !! end
5888
5889 !! test
5890 Parsoid: newline inducing block nodes don't suppress <nowiki>
5891 !! options
5892 parsoid=html2wt
5893 !! wikitext
5894 <nowiki> </nowiki>a
5895
5896 = foo =
5897 !! html
5898 a<h1>foo</h1>
5899 !! end
5900
5901 !! test
5902 Parsoid: Row-syntax table headings followed by comment & table cells
5903 !! options
5904 parsoid=wt2html,wt2wt
5905 !! wikitext
5906 {|
5907 ! foo || bar
5908 <!-- foo --> || baz || quux
5909 |}
5910 !! html/php
5911 <table>
5912 <tr>
5913 <th> foo </th>
5914 <th> bar
5915 </th>
5916 <td> baz </td>
5917 <td> quux
5918 </td></tr></table>
5919
5920 !! html/parsoid
5921 <table>
5922 <tbody><tr><th> foo </th><th> bar
5923 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
5924 </tbody></table>
5925 !! end
5926
5927
5928 # PHP throws away the (semi-broken) "foo" class here; Parsoid
5929 # preserves it.
5930 !!test
5931 Parsoid: Recover better from broken table attributes
5932 !!options
5933 parsoid=wt2html
5934 !!wikitext
5935 {| class="foo
5936 | class="bar" |
5937 foo
5938 |}
5939 !!html/php+tidy
5940 <table>
5941 <tr>
5942 <td class="bar">
5943 <p>foo</p>
5944 </td>
5945 </tr>
5946 </table>
5947 !!html/parsoid
5948 <table class="foo">
5949 <tr>
5950 <td class="bar">
5951 <p>foo</p></td></tr>
5952 </tbody></table>
5953 !!end
5954
5955 !! test
5956 Strip unsupported table tags
5957 !! options
5958 parsoid=html2wt
5959 !! html
5960 <table>
5961 <thead>
5962 <tr>
5963 <th>Month</th>
5964 <th>Savings</th>
5965 </tr>
5966 </thead>
5967 <tbody>
5968 <tr>
5969 <td>January</td>
5970 <td>$100</td>
5971 </tr>
5972 <tr>
5973 <td>February</td>
5974 <td>$80</td>
5975 </tr>
5976 </tbody>
5977 <tfoot>
5978 <tr>
5979 <td>Sum</td>
5980 <td>$180</td>
5981 </tr>
5982 </tfoot>
5983 </table>
5984 !! wikitext
5985 {|
5986
5987 !Month
5988 !Savings
5989
5990 |January
5991 |$100
5992
5993 |-
5994 |February
5995 |$80
5996
5997 |Sum
5998 |$180
5999
6000 |}
6001 !! end
6002
6003 ###
6004 ### Internal links
6005 ###
6006 !! test
6007 Plain link, capitalized
6008 !! wikitext
6009 [[Main Page]]
6010 !! html
6011 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6012 </p>
6013 !! end
6014
6015 !! test
6016 Plain link, uncapitalized
6017 !! wikitext
6018 [[main Page]]
6019 !! html
6020 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6021 </p>
6022 !! end
6023
6024 !! test
6025 Piped link
6026 !! wikitext
6027 [[Main Page|The Main Page]]
6028 !! html
6029 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6030 </p>
6031 !! end
6032
6033 !! test
6034 Piped link with comment in link text
6035 !! wikitext
6036 [[Main Page|The Main<!--front--> Page]]
6037 !! html
6038 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6039 </p>
6040 !! end
6041
6042 !! test
6043 Piped link with multiple pipe characters in link text
6044 !! wikitext
6045 [[Main Page||The|Main|Page|]]
6046 !! html/php
6047 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6048 </p>
6049 !! html/parsoid
6050 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6051 !! end
6052
6053 !! test
6054 Broken link
6055 !! wikitext
6056 [[Zigzagzogzagzig]]
6057 !! html
6058 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6059 </p>
6060 !! end
6061
6062 !! test
6063 Broken link with fragment
6064 !! wikitext
6065 [[Zigzagzogzagzig#zug]]
6066 !! html
6067 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6068 </p>
6069 !! end
6070
6071 !! test
6072 Special page link with fragment
6073 !! wikitext
6074 [[Special:Version#anchor]]
6075 !! html
6076 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6077 </p>
6078 !! end
6079
6080 !! test
6081 Nonexistent special page link with fragment
6082 !! wikitext
6083 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6084 !! html
6085 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6086 </p>
6087 !! end
6088
6089 !! test
6090 Link with prefix
6091 !! wikitext
6092 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6093 !! html
6094 <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>
6095 </p>
6096 !! end
6097
6098 !! test
6099 Link with suffix
6100 !! wikitext
6101 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6102 !! html
6103 <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>!!!
6104 </p>
6105 !! end
6106
6107 !! article
6108 prefixed article
6109 !! text
6110 Some text
6111 !! endarticle
6112
6113 !! test
6114 Bug 43661: Piped links with identical prefixes
6115 !! wikitext
6116 [[prefixed article|prefixed articles with spaces]]
6117
6118 [[prefixed article|prefixed articlesaoeu]]
6119
6120 [[Main Page|Main Page test]]
6121 !! html
6122 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6123 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6124 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6125 </p>
6126 !! end
6127
6128
6129 !! test
6130 Link with HTML entity in suffix / tail
6131 !! wikitext
6132 [[Main Page]]&quot;, [[Main Page]]&#97;
6133 !! html
6134 <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;
6135 </p>
6136 !! end
6137
6138 !! test
6139 Link with 3 brackets
6140 !! wikitext
6141 [[[Main Page]]]
6142 !! html
6143 <p>[[[Main Page]]]
6144 </p>
6145 !! end
6146
6147 !! test
6148 Link with 4 brackets
6149 !! wikitext
6150 [[[[Main Page]]]]
6151 !! html
6152 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6153 </p>
6154 !! end
6155
6156 !! test
6157 Piped link with 3 brackets
6158 !! wikitext
6159 [[[main page|the main page]]]
6160 !! html
6161 <p>[[[main page|the main page]]]
6162 </p>
6163 !! end
6164
6165 !! test
6166 Piped link with extlink-like text
6167 !! wikitext
6168 [[Main Page|[bar]]]
6169 [[Main Page|This is a [bar]]]
6170 !! html
6171 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6172 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6173 </p>
6174 !! end
6175
6176 !! test
6177 Link with multiple pipes
6178 !! wikitext
6179 [[Main Page|The|Main|Page]]
6180 !! html
6181 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6182 </p>
6183 !! end
6184
6185 # Note that parsoid does not munge anchor text; all non-space
6186 # characters are valid in HTML5 ids.
6187 !! test
6188 Anchor containing a #. (bug 63430)
6189 !! wikitext
6190 [[Main Page#And#Link]]
6191 !! html/php
6192 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6193 </p>
6194 !! html/parsoid
6195 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6196 !! end
6197
6198 !! test
6199 Link to namespaces
6200 !! wikitext
6201 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6202 !! html
6203 <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>
6204 </p>
6205 !! end
6206
6207 !! test
6208 Link with space in namespace
6209 !! wikitext
6210 [[User talk:Foo bar]]
6211 !! html
6212 <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>
6213 </p>
6214 !! end
6215
6216 !! article
6217 MemoryAlpha:AlphaTest
6218 !! text
6219 This is an article in the MemoryAlpha namespace
6220 (which shadows the memoryalpha interwiki link).
6221 !! endarticle
6222
6223 !! test
6224 Namespace takes precedence over interwiki link (bug 51680)
6225 !! wikitext
6226 [[MemoryAlpha:AlphaTest]]
6227 !! html
6228 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6229 </p>
6230 !! end
6231
6232 # The previous test doesn't work correctly in html2*, due to not recognizing the
6233 # link as an internal one. This one checks for the correct behavior.
6234 !! test
6235 Link to namespace preferred over interwiki with correct rel attribute
6236 !! options
6237 parsoid=html2wt,html2html
6238 !! wikitext
6239 [[MemoryAlpha:AlphaTest]]
6240 !! html
6241 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6242 </p>
6243 !! end
6244
6245 !! test
6246 Piped link to namespace
6247 !! wikitext
6248 [[Meta:Disclaimers|The disclaimers]]
6249 !! html
6250 <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>
6251 </p>
6252 !! end
6253
6254 !! test
6255 Link containing }
6256 !! wikitext
6257 [[Usually caused by a typo (oops}]]
6258 !! html
6259 <p>[[Usually caused by a typo (oops}]]
6260 </p>
6261 !! end
6262
6263 !! article
6264 7% Solution
6265 !! text
6266 Just a test of an article title containing a percent.
6267 !! endarticle
6268
6269 !! test
6270 Link containing % (not as a hex sequence)
6271 !! wikitext
6272 [[7% Solution]]
6273 !! html/php
6274 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6275 </p>
6276 !! html/parsoid
6277 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6278 !! end
6279
6280 # note that the parsoid HTML is identical to the previous test output,
6281 # so the previous test ensures that the html2wt mode will generate the
6282 # "not as a hex sequence" wikitext.
6283 !! test
6284 Link containing % as a single hex sequence interpreted to char
6285 !! options
6286 parsoid=wt2wt,wt2html,html2html
6287 !! wikitext
6288 [[7%25 Solution]]
6289 !! html/php
6290 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6291 </p>
6292 !! html/parsoid
6293 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6294 !!end
6295
6296 !! test
6297 Link containing % as a double hex sequence interpreted to hex sequence
6298 !! wikitext
6299 [[7%2525 Solution]]
6300 !! html
6301 <p>[[7%2525 Solution]]
6302 </p>
6303 !!end
6304
6305 # note that parsoid does not munge anchor text; all non-space
6306 # characters are valid in HTML5 anchors.
6307 !! test
6308 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6309 Example for such a section: == < ==
6310 !! wikitext
6311 [[%23%3c]][[%23%3e]]
6312 !! html/php
6313 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6314 </p>
6315 !! html/parsoid
6316 <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>
6317 !! end
6318
6319 !! test
6320 Link containing "<#" and ">#" as a hex sequences
6321 !! wikitext
6322 [[%3c%23]][[%3e%23]]
6323 !! html
6324 <p>[[%3c%23]][[%3e%23]]
6325 </p>
6326 !! end
6327
6328 !! test
6329 Link containing an equals sign
6330 !! wikitext
6331 [[Special:BookSources/isbn=4-00-026157-6]]
6332 !! html/php
6333 <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>
6334 </p>
6335 !! html/parsoid
6336 <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>
6337 !! end
6338
6339 !! article
6340 Foo~bar
6341 !! text
6342 Just a test of an article title containing a tilde.
6343 !! endarticle
6344
6345 # note that links containing signatures, like [[Foo~~~~]], are
6346 # massaged by the pre-save transform (PST) and so the tildes are never
6347 # seen by the parser.
6348 !! test
6349 Link containing a tilde
6350 !! wikitext
6351 [[Foo~bar]]
6352 !! html/php
6353 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6354 </p>
6355 !! html/parsoid
6356 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6357 !! end
6358
6359 !! test
6360 Link containing double-single-quotes '' (bug 4598)
6361 !! wikitext
6362 [[Lista d''e paise d''o munno]]
6363 !! html/php
6364 <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>
6365 </p>
6366 !! html/parsoid
6367 <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>
6368 !! end
6369
6370 !! test
6371 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6372 !! wikitext
6373 Some [[Link|pretty ''italics'' and stuff]]!
6374 !! html/php
6375 <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>!
6376 </p>
6377 !! html/parsoid
6378 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6379 !! end
6380
6381 !! test
6382 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6383 !! wikitext
6384 ''Some [[Link|pretty ''italics'' and stuff]]!''
6385 !! html
6386 <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>
6387 </p>
6388 !! end
6389
6390 !! test
6391 Link with double quotes in title part (literal) and alternate part (interpreted)
6392 !! wikitext
6393 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
6394
6395 [[''Pentecoste'']]
6396
6397 [[''Pentecoste''|Pentecoste]]
6398
6399 [[''Pentecoste''|''Pentecoste'']]
6400 !! html/php
6401 <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>
6402 </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>
6403 </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>
6404 </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>
6405 </p>
6406 !! html/parsoid
6407 <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>
6408 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6409 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6410 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6411 !! end
6412
6413 !! test
6414 Broken image links with HTML captions (bug 39700)
6415 !! wikitext
6416 [[File:Nonexistent|<script></script>]]
6417 [[File:Nonexistent|100x100px|<script></script>]]
6418 [[File:Nonexistent|&lt;]]
6419 [[File:Nonexistent|a<i>b</i>c]]
6420 !! html/php
6421 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6422 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6423 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6424 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6425 </p>
6426 !! html/parsoid
6427 <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>
6428 <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>
6429 <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>
6430 <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>
6431 !! end
6432
6433 !! test
6434 Plain link to URL
6435 !! wikitext
6436 [[http://www.example.com]]
6437 !! html/php
6438 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6439 </p>
6440 !! html/parsoid
6441 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6442 !! end
6443
6444 !! test
6445 Plain link to URL with link text
6446 !! wikitext
6447 [[http://www.example.com Link text]]
6448 !! html
6449 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6450 </p>
6451 !! end
6452
6453 !! test
6454 Plain link to protocol-relative URL
6455 !! wikitext
6456 [[//www.example.com]]
6457 !! html/php
6458 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6459 </p>
6460 !! html/parsoid
6461 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6462 !! end
6463
6464 !! test
6465 Plain link to protocol-relative URL with link text
6466 !! wikitext
6467 [[//www.example.com Link text]]
6468 !! html
6469 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6470 </p>
6471 !! end
6472
6473 !! test
6474 Plain link to page with question mark in title
6475 !! wikitext
6476 [[A?b]]
6477
6478 [[A?b|Baz]]
6479 !! html
6480 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6481 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6482 </p>
6483 !! end
6484
6485
6486 # I'm fairly sure the expected result here is wrong.
6487 # We want these to be URL links, not pseudo-pages with URLs for titles....
6488 # However the current output is also pretty screwy.
6489 #
6490 # ----
6491 # I'm changing it to match the current output--it arguably makes more
6492 # sense in the light of the test above. Old expected result was:
6493 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6494 #</p>
6495 # But I think this test is bordering on "garbage in, garbage out" anyway.
6496 # -- wtm
6497 !! test
6498 Piped link to URL
6499 !! wikitext
6500 Piped link to URL: [[http://www.example.com|an example URL]]
6501 !! html/php
6502 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6503 </p>
6504 !! html/parsoid
6505 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6506 !! end
6507
6508 !! test
6509 BUG 2: [[page|http://url/]] should link to page, not http://url/
6510 !! wikitext
6511 [[Main Page|http://url/]]
6512 !! html/php
6513 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6514 </p>
6515 !! html/parsoid
6516 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6517 !! end
6518
6519 # Parsoid does not mark self-links, by design.
6520 !! test
6521 BUG 337: Escaped self-links should be bold
6522 !! options
6523 title=[[Bug462]]
6524 !! wikitext
6525 [[Bu&#103;462]] [[Bug462]]
6526 !! html/php
6527 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6528 </p>
6529 !! html/php+tidy
6530 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6531 !! html/parsoid
6532 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6533 !! end
6534
6535 !! test
6536 Self-link to section should not be bold
6537 !! options
6538 title=[[Main Page]]
6539 !! wikitext
6540 [[Main Page#section]]
6541 !! html
6542 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6543 </p>
6544 !! end
6545
6546 !! article
6547 00
6548 !! text
6549 This is 00.
6550 !! endarticle
6551
6552 !!test
6553 Self-link to numeric title
6554 !!options
6555 title=[[0]]
6556 !! wikitext
6557 [[0]]
6558 !! html
6559 <p><strong class="selflink">0</strong>
6560 </p>
6561 !!end
6562
6563 !!test
6564 Link to numeric-equivalent title
6565 !!options
6566 title=[[0]]
6567 !! wikitext
6568 [[00]]
6569 !! html
6570 <p><a href="/wiki/00" title="00">00</a>
6571 </p>
6572 !!end
6573
6574 !! test
6575 <nowiki> inside a link
6576 !! wikitext
6577 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6578 !! html
6579 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6580 </p>
6581 !! end
6582
6583 !! test
6584 Non-breaking spaces in title
6585 !! wikitext
6586 [[&nbsp; Main &nbsp; Page &nbsp;]]
6587 !! html
6588 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6589 </p>
6590 !!end
6591
6592 !! test
6593 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6594 !! options
6595 language=ca
6596 !! wikitext
6597 '''[[Main Page]]'''
6598 !! html
6599 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6600 </p>
6601 !! end
6602
6603 !! test
6604 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6605 !! options
6606 language=ca
6607 !! wikitext
6608 ''[[Main Page]]''
6609 !! html
6610 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6611 </p>
6612 !! end
6613
6614 !! test
6615 Internal link with en linktrail: no apostrophes (bug 27473)
6616 !! options
6617 language=en
6618 !! wikitext
6619 [[Something]]'nice
6620 !! html
6621 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6622 </p>
6623 !! end
6624
6625 !! test
6626 Internal link with ca linktrail with apostrophes (bug 27473)
6627 !! options
6628 language=ca
6629 !! wikitext
6630 [[Something]]'nice
6631 !! html
6632 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6633 </p>
6634 !! end
6635
6636 !! test
6637 Internal link with kaa linktrail with apostrophes (bug 27473)
6638 !! options
6639 language=kaa
6640 !! wikitext
6641 [[Something]]'nice
6642 !! html
6643 <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>
6644 </p>
6645 !! end
6646
6647 !! test
6648 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6649 !! wikitext
6650 [[User:Foo/Test/63636:Bar|Test]]
6651 !! html/php
6652 <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>
6653 </p>
6654 !! html/parsoid
6655 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
6656 !! end
6657
6658 !! test
6659 Purely hash wikilink
6660 !! options
6661 title=[[User:test/123]]
6662 !! wikitext
6663 [[#a|b]]
6664 !! html/php
6665 <p><a href="#a">b</a>
6666 </p>
6667 !! html/parsoid
6668 <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>
6669 !! end
6670
6671 !! test
6672 1. Interaction of linktrail and template encapsulation
6673 !! options
6674 parsoid
6675 !! wikitext
6676 {{echo|[[Foo]]}}l
6677 !! html
6678 <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>
6679 !! end
6680
6681 !! test
6682 2. Interaction of linktrail and template encapsulation
6683 !! options
6684 parsoid
6685 !! wikitext
6686 {{echo|Some [[Fool]]}}s
6687 !! html
6688 <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>
6689 !! end
6690
6691 !! test
6692 3. Interaction of linktrail and template encapsulation
6693 !! options
6694 parsoid
6695 !! wikitext
6696 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6697 !! html
6698 <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>
6699 !! end
6700
6701 !! article
6702 Söfnuður
6703 !! text
6704 Test.
6705 !! endarticle
6706
6707 !! test
6708 Internal link with is link prefix
6709 !! options
6710 language=is
6711 !! wikitext
6712 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6713 !! html
6714 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6715 </p>
6716 !! end
6717
6718 !! article
6719 Mótmælendatrú
6720 !! text
6721 Test.
6722 !! endarticle
6723
6724 !! test
6725 Internal link with is link trail and link prefix
6726 !! options
6727 language=is
6728 !! wikitext
6729 [[mótmælendatrú|xxx]]ar
6730 [[mótmælendatrú]]ar
6731 mótmælenda[[söfnuður]]
6732 mótmælenda[[söfnuður|söfnuðir]]
6733 mótmælenda[[söfnuður|söfnuðir]]xxx
6734 !! html
6735 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6736 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6737 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6738 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6739 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6740 </p>
6741 !! end
6742
6743 !! test
6744 Parsoid link trail escaping
6745 !! options
6746 parsoid=html2wt,html2html
6747 !! wikitext
6748 [[apple]]<nowiki/>s
6749 !! html
6750 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
6751 !! end
6752
6753 !! test
6754 Parsoid link prefix escaping
6755 !! options
6756 language=is
6757 parsoid=html2wt,html2html
6758 !! wikitext
6759 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6760 !! html
6761 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
6762 !! end
6763
6764 !! test
6765 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6766 !! wikitext
6767 [[Foo| bar]]
6768
6769 [[Foo| ''bar'']]
6770
6771 [http://wp.org foo]
6772
6773 [http://wp.org ''foo'']
6774 !! html
6775 <p><a href="/wiki/Foo" title="Foo"> bar</a>
6776 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
6777 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6778 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6779 </p>
6780 !! end
6781
6782 !! test
6783 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6784 !! options
6785 parsoid
6786 !! wikitext
6787 [[Foo|{{echo|a}} b {{echo|c}}]]
6788 !! html
6789 <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>
6790 !! end
6791
6792 !! test
6793 Link with angle bracket after anchor
6794 !! wikitext
6795 [[Foo#<bar>]]
6796 !! html/php
6797 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
6798 </p>
6799 !! html/parsoid
6800 <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>
6801 !! end
6802
6803 ###
6804 ### Interwiki links (see maintenance/interwiki.sql)
6805 ###
6806
6807 !! test
6808 Inline interwiki link
6809 !! options
6810 parsoid=wt2html,wt2wt,html2html
6811 !! wikitext
6812 [[MeatBall:SoftSecurity]]
6813 !! html/php
6814 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6815 </p>
6816 !! html/parsoid
6817 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
6818 !! end
6819
6820 !! test
6821 Inline interwiki link with empty title (bug 2372)
6822 !! options
6823 parsoid=wt2html,wt2wt,html2html
6824 !! wikitext
6825 [[MeatBall:]]
6826 !! html/php
6827 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6828 </p>
6829 !! html/parsoid
6830 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
6831 !! end
6832
6833 !! test
6834 Interwiki link encoding conversion (bug 1636)
6835 !! wikitext
6836 *[[Wikipedia:ro:Olteni&#0355;a]]
6837 *[[Wikipedia:ro:Olteni&#355;a]]
6838 !! html
6839 <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>
6840 <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>
6841
6842 !! html+tidy
6843 <ul>
6844 <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>
6845 <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>
6846 </ul>
6847 !! end
6848
6849 !! test
6850 Interwiki link with fragment (bug 2130)
6851 !! wikitext
6852 [[MeatBall:SoftSecurity#foo]]
6853 !! html
6854 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6855 </p>
6856 !! end
6857
6858 # Ideally the wikipedia: prefix here should be proto-relative too
6859 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
6860 # define the 'en' prefix, and originally the test used 'wikipedia',
6861 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
6862 # article.
6863 !! test
6864 Different interwiki prefixes mapping to the same URL
6865 !! wikitext
6866 [[:en:Foo]]
6867
6868 [[:en:Foo|Foo]]
6869
6870 [[wikipedia:Foo]]
6871
6872 [[:wikipedia:Foo|Foo]]
6873
6874 [[wikipedia:en:Foo]]
6875
6876 [[:wikipedia:en:Foo]]
6877
6878 [[ wikiPEdia :Foo]]
6879 !! html/parsoid
6880 <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>
6881
6882 <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>
6883
6884 <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>
6885
6886 <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>
6887
6888 <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>
6889
6890 <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>
6891
6892 <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>
6893 !! end
6894
6895 !! test
6896 Interwiki links that cannot be represented in wiki syntax
6897 !! wikitext
6898 [[meatball:ok]]
6899 [[meatball:ok#foo|ok with fragment]]
6900 [[meatball:ok_as_well?|ok ending with ? mark]]
6901 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6902 [http://de.wikipedia.org/wiki/#foo is just fragment]
6903
6904 !! html/php
6905 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
6906 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
6907 <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>
6908 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6909 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
6910 </p>
6911 !! html/parsoid
6912 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
6913 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
6914 <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>
6915 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6916 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6917 !! end
6918
6919 !! test
6920 Interwiki links: trail
6921 !! wikitext
6922 [[wikipedia:Foo|Ba]]r
6923 !! html/php
6924 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
6925 </p>
6926 !! html/parsoid
6927 <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>
6928 !! end
6929
6930 !! test
6931 Local interwiki link
6932 !! options
6933 parsoid=wt2html,wt2wt,html2html
6934 !! wikitext
6935 [[local:Template:Foo]]
6936 !! html/php
6937 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
6938 </p>
6939 !! html/parsoid
6940 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
6941 !! end
6942
6943 # Parsoid does not mark self-links, by design.
6944 !! test
6945 Local interwiki link: self-link to current page
6946 !! options
6947 title=[[Main Page]]
6948 parsoid=wt2html,wt2wt,html2html
6949 !! wikitext
6950 [[local:Main Page]]
6951 !! html/php
6952 <p><strong class="selflink">local:Main Page</strong>
6953 </p>
6954 !! html/parsoid
6955 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
6956 !! end
6957
6958 !! test
6959 Local interwiki link: prefix only (bug 64167)
6960 !! options
6961 parsoid=wt2html,wt2wt,html2html
6962 !! wikitext
6963 [[local:]]
6964 !! html/php
6965 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
6966 </p>
6967 !! html/parsoid
6968 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
6969 !! end
6970
6971 !! test
6972 Local interwiki link: with additional interwiki prefix (bug 61357)
6973 !! options
6974 parsoid=wt2html,wt2wt,html2html
6975 !! wikitext
6976 [[local:meatball:Hello]]
6977 !! html/php
6978 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
6979 </p>
6980 !! html/parsoid
6981 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
6982 !! end
6983
6984 !! test
6985 Multiple local interwiki link prefixes
6986 !! wikitext
6987 [[local:local:local:local:mi:local:Foo]]
6988 !! options
6989 parsoid=wt2html,wt2wt,html2html
6990 !! html/php
6991 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
6992 </p>
6993 !! html/parsoid
6994 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
6995 !! end
6996
6997 ###
6998 ### Interlanguage links
6999 ### Language links (so that searching for '### language' matches..)
7000 ###
7001
7002 !! test
7003 Interlanguage link
7004 !! options
7005 parsoid=wt2html,wt2wt,html2html
7006 !! wikitext
7007 Blah blah blah
7008 [[zh:Chinese]]
7009 !! html/php
7010 <p>Blah blah blah
7011 </p>
7012 !! html/parsoid
7013 <p>Blah blah blah</p>
7014 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7015 !! end
7016
7017 !! test
7018 Interlanguage link with spacing
7019 !! options
7020 parsoid=wt2html,wt2wt,html2html
7021 !! wikitext
7022 Blah blah blah
7023 [[ zh : Chinese ]]
7024 !! html/php
7025 <p>Blah blah blah
7026 </p>
7027 !! html/parsoid
7028 <p>Blah blah blah</p>
7029 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7030 !! end
7031
7032 !! test
7033 Double interlanguage link
7034 !! options
7035 parsoid=wt2html,wt2wt,html2html
7036 !! wikitext
7037 Blah blah blah
7038 [[es:Spanish]]
7039 [[zh:Chinese]]
7040 !! html/php
7041 <p>Blah blah blah
7042 </p>
7043 !! html/parsoid
7044 <p>Blah blah blah</p>
7045 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7046 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7047 !! end
7048
7049 !! test
7050 Interlanguage link variations
7051 !! options
7052 parsoid=wt2html,wt2wt,html2html
7053 !! wikitext
7054 Blah blah blah
7055 [[ es :Spanish]]
7056 [[ ZH :Chinese]]
7057 [[es:Foo_bar]]
7058 [[es:Foo bar]]
7059 !! html/php
7060 <p>Blah blah blah
7061 </p>
7062 !! html/parsoid
7063 <p>Blah blah blah</p>
7064 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7065 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7066 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7067 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7068 !! end
7069
7070 !! test
7071 Interlanguage link, with prefix links
7072 !! options
7073 language=ln
7074 !! wikitext
7075 Blah blah blah
7076 [[zh:Chinese]]
7077 !! html/php
7078 <p>Blah blah blah
7079 </p>
7080 !! html/parsoid
7081 <p>Blah blah blah</p>
7082 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7083 !! end
7084
7085 !! test
7086 Double interlanguage link, with prefix links (bug 8897)
7087 !! options
7088 language=ln
7089 !! wikitext
7090 Blah blah blah
7091 [[es:Spanish]]
7092 [[zh:Chinese]]
7093 !! html/php
7094 <p>Blah blah blah
7095 </p>
7096 !! html/parsoid
7097 <p>Blah blah blah</p>
7098 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7099 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7100 !! end
7101
7102 !! test
7103 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7104 !! wikitext
7105 Blah blah blah
7106 [[mul:Article]]
7107 !! html/php
7108 <p>Blah blah blah
7109 </p>
7110 !! html/parsoid
7111 <p>Blah blah blah</p>
7112 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7113 !! end
7114
7115 !! test
7116 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7117 !! options
7118 language=ln
7119 !! wikitext
7120 [[WW&nbsp;II]]
7121 !! html
7122 <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>
7123 </p>
7124 !! end
7125
7126 !! test
7127 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7128 !! options
7129 parsoid=html2wt
7130 !! wikitext
7131 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7132
7133 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7134 !! html
7135 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7136 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7137 !! end
7138
7139 !! test
7140 Parsoid: handle constructor well
7141 !! wikitext
7142 [[constructor]]
7143
7144 [[constructor:foo]]
7145 !! html/php
7146 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7147 </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>
7148 </p>
7149 !! html/parsoid
7150 <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>
7151
7152 <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>
7153 !! end
7154
7155 !! article
7156 ko:
7157 !! text
7158 Test.
7159 !! endarticle
7160
7161 # Note that `ko` isn't a known interlanguage prefix
7162 !! test
7163 Parsoid: recognize interlanguage links without a target page
7164 !! options
7165 ill
7166 !! wikitext
7167 [[es:]]
7168
7169 [[ko:]]
7170 !! html/php
7171 es:
7172 !! html/parsoid
7173 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7174
7175 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7176 !! end
7177
7178 # Note that `ko` isn't a known interwiki prefix
7179 !! test
7180 Parsoid: recognize interwiki links without a target page
7181 !! options
7182 parsoid=wt2html,wt2wt,html2html
7183 !! wikitext
7184 [[:es:]]
7185
7186 [[:ko:]]
7187 !! html/php
7188 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7189 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7190 </p>
7191 !! html/parsoid
7192 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7193 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7194 !! end
7195
7196 !! test
7197 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7198 !! wikitext
7199 [[mi:Foo]]
7200 !! html/php
7201 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7202 </p>
7203 !! html/parsoid
7204 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7205 !! end
7206
7207 !! test
7208 Interlanguage link with preceding local interwiki link (bug 68085)
7209 !! options
7210 parsoid=wt2html,wt2wt,html2html
7211 !! wikitext
7212 Blah blah blah
7213 [[local:es:Spanish]]
7214 !! html/php
7215 <p>Blah blah blah
7216 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7217 </p>
7218 !! html/parsoid
7219 <p>Blah blah blah
7220 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7221 !! end
7222
7223 !! test
7224 Looks like an interlanguage link, but is actually a local interwiki
7225 !! options
7226 parsoid=wt2html,wt2wt,html2html
7227 !! wikitext
7228 Blah blah blah
7229 [[mi:Template:Foo]]
7230 !! html/php
7231 <p>Blah blah blah
7232 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7233 </p>
7234 !! html/parsoid
7235 <p>Blah blah blah
7236 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7237 !! end
7238
7239 ###
7240 ### Redirects, Parsoid-only
7241 ###
7242 !! test
7243 1. Simple redirect to page
7244 !! options
7245 parsoid
7246 !! wikitext
7247 #REDIRECT [[Main Page]]
7248 !! html
7249 <link rel="mw:PageProp/redirect" href="./Main_Page">
7250 !! end
7251
7252 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
7253 !! test
7254 2. Other redirect variants
7255 !! options
7256 parsoid=wt2html,wt2wt
7257 !! wikitext
7258 #REDIRECT [[Main_Page]]
7259 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
7260 !! html/parsoid
7261 <link rel="mw:PageProp/redirect" href="./Main_Page"><link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
7262 !! end
7263
7264 !! test
7265 Empty redirect
7266 !! options
7267 parsoid=wt2html,wt2wt
7268 !! wikitext
7269 #REDIRECT [[]]
7270 !! html
7271 <ol>
7272 <li>REDIRECT [[]]</li></ol>
7273 !! end
7274
7275 !! test
7276 Optional colon in #REDIRECT
7277 !! options
7278 # the colon is archaic syntax. we support it for wt2html, but we
7279 # don't care that it roundtrips back to the modern syntax.
7280 parsoid=wt2html,html2html
7281 !! wikitext
7282 #REDIRECT:[[Main Page]]
7283 !! html
7284 <link rel="mw:PageProp/redirect" href="./Main_Page">
7285 !! end
7286
7287 !! test
7288 Whitespace in #REDIRECT with optional colon
7289 !! options
7290 # the colon and gratuitous whitespace is archaic syntax. we support
7291 # it for wt2html, but we don't care that it roundtrips back to the
7292 # modern syntax (without extra whitespace)
7293 parsoid=wt2html,html2html
7294 !! wikitext
7295
7296 #REDIRECT
7297 :
7298 [[Main Page]]
7299 !! html
7300 <link rel="mw:PageProp/redirect" href="./Main_Page">
7301 !! end
7302
7303 !! test
7304 Piped link in #REDIRECT
7305 !! options
7306 # content after piped link is ignored. we support this syntax,
7307 # but don't care that the piped link is lost when we roundtrip this.
7308 parsoid=wt2html
7309 !! wikitext
7310 #REDIRECT [[Main Page|bar]]
7311 !! html
7312 <link rel="mw:PageProp/redirect" href="./Main_Page">
7313 !! end
7314
7315 !! test
7316 Redirect to category
7317 !! options
7318 parsoid=wt2html
7319 !! wikitext
7320 #REDIRECT [[Category:Foo]]
7321 !! html
7322 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7323 !! end
7324
7325 !! test
7326 Redirect to category with URL encoding
7327 !! options
7328 parsoid=wt2html
7329 !! wikitext
7330 #REDIRECT [[Category%3AFoo]]
7331 !! html
7332 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7333 !! end
7334
7335 !! test
7336 Redirect to category page
7337 !! options
7338 parsoid=wt2html,html2html
7339 !! wikitext
7340 #REDIRECT [[:Category:Foo]]
7341 !! html
7342 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7343 !! end
7344
7345 !! test
7346 Redirect to image page (1)
7347 !! options
7348 parsoid
7349 !! wikitext
7350 #REDIRECT [[File:Wiki.png]]
7351 !! html
7352 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7353 !! end
7354
7355 !! test
7356 Redirect to image page (2)
7357 !! options
7358 parsoid
7359 !! wikitext
7360 #REDIRECT [[Image:Wiki.png]]
7361 !! html
7362 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7363 !! end
7364
7365 !! test
7366 Redirect to language
7367 !! options
7368 parsoid
7369 !! wikitext
7370 #REDIRECT [[en:File:Wiki.png]]
7371 !! html
7372 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7373 !! end
7374
7375 !! test
7376 Redirect to interwiki
7377 !! options
7378 parsoid
7379 !! wikitext
7380 #REDIRECT [[meatball:File:Wiki.png]]
7381 !! html
7382 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7383 !! end
7384
7385 !! test
7386 Non-English #REDIRECT
7387 !! options
7388 parsoid
7389 language=is
7390 !! wikitext
7391 #TILVÍSUN [[Main Page]]
7392 !! html
7393 <link rel="mw:PageProp/redirect" href="./Main_Page">
7394 !! end
7395
7396 !! test
7397 New redirect
7398 !! options
7399 parsoid=html2wt
7400 !! wikitext
7401 Foo
7402 #REDIRECT [[Foo]]
7403 !! html
7404 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7405 !! end
7406
7407 ##
7408 ## XHTML tidiness
7409 ###
7410
7411 !! test
7412 <br> to <br />
7413 !! wikitext
7414 1<br>2<br />3
7415 !! html
7416 <p>1<br />2<br />3
7417 </p>
7418 !! end
7419
7420 !! test
7421 Broken br tag sanitization
7422 !! wikitext
7423 </br>
7424 !! html/php
7425 <p>&lt;/br&gt;
7426 </p>
7427 !! end
7428
7429 # TODO: Fix html2html mode (bug 51055)!
7430 # This </br> handling was added as part of bug 50831; but it
7431 # differs from how PHP+tidy handles this. We should investigate
7432 # this.
7433 !! test
7434 Parsoid: Broken br tag recognition
7435 !! options
7436 parsoid=wt2html
7437 !! wikitext
7438 </br>
7439
7440 <br/ >
7441 !! html/php+tidy
7442 <p>&lt;/br&gt;</p>
7443 <p><br /></p>
7444 !! html/parsoid
7445 <p><br></p>
7446 <p><br/></p>
7447 !! end
7448
7449 !! test
7450 Incorrecly removing closing slashes from correctly formed XHTML
7451 !! wikitext
7452 <br style="clear:both;" />
7453 !! html
7454 <p><br style="clear:both;" />
7455 </p>
7456 !! end
7457
7458 !! test
7459 Failing to transform badly formed HTML into correct XHTML
7460 !! wikitext
7461 <br style="clear: left;">
7462 <br style="clear: right;">
7463 <br style="clear: both;">
7464 !! html
7465 <p><br style="clear: left;" />
7466 <br style="clear: right;" />
7467 <br style="clear: both;" />
7468 </p>
7469 !!end
7470
7471 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
7472 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
7473 !! test
7474 Handling html with a div self-closing tag
7475 !! wikitext
7476 <div title />
7477 <div title/>
7478 <div title/ >
7479 <div title=bar />
7480 <div title=bar/>
7481 <div title=bar/ >
7482 !! html/php
7483 <p>&lt;div title /&gt;
7484 &lt;div title/&gt;
7485 </p>
7486 <div>
7487 <p>&lt;div title=bar /&gt;
7488 &lt;div title=bar/&gt;
7489 </p>
7490 <div title="bar/"></div>
7491 </div>
7492
7493 !! html/parsoid
7494 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7495 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7496 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
7497 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7498 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7499 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
7500 !! end
7501
7502 !! test
7503 Handling html with a br self-closing tag
7504 !! wikitext
7505 <br title />
7506 <br title/>
7507 <br title/ >
7508 <br title=bar />
7509 <br title=bar/>
7510 <br title=bar/ >
7511 !! html/php
7512 <p><br title="title" />
7513 <br title="title" />
7514 <br />
7515 <br title="bar" />
7516 <br title="bar" />
7517 <br title="bar/" />
7518 </p>
7519 !! html/parsoid
7520 <p><br title="" />
7521 <br title="" />
7522 <br title="" />
7523 <br title="bar" />
7524 <br title="bar" />
7525 <br title="bar/" />
7526 </p>
7527 !! end
7528
7529 !! test
7530 Horizontal ruler (should it add that extra space?)
7531 !! wikitext
7532 <hr>
7533 <hr >
7534 foo <hr
7535 > bar
7536 !! html+tidy
7537 <hr />
7538 <hr />
7539 <p>foo</p>
7540 <hr />
7541 <p>bar</p>
7542 !! end
7543
7544 !! test
7545 Horizontal ruler -- 4+ dashes render hr
7546 !! wikitext
7547 ----
7548 !! html
7549 <hr />
7550
7551 !! end
7552
7553 !! test
7554 Horizontal ruler -- eats additional dashes on the same line
7555 !! wikitext
7556 ---------
7557 !! html
7558 <hr />
7559
7560 !! end
7561
7562 !! test
7563 Horizontal ruler -- does not collapse dashes on consecutive lines
7564 !! wikitext
7565 ----
7566 ----
7567 !! html
7568 <hr />
7569 <hr />
7570
7571 !! end
7572
7573 !! test
7574 Horizontal ruler -- <4 dashes render as plain text
7575 !! wikitext
7576 ---
7577 !! html
7578 <p>---
7579 </p>
7580 !! end
7581
7582 !! test
7583 Horizontal ruler -- Supports content following dashes on same line
7584 !! wikitext
7585 ---- Foo
7586 !! html
7587 <hr /> Foo
7588
7589 !! html+tidy
7590 <hr />
7591 <p>Foo</p>
7592 !! end
7593
7594 ###
7595 ### Block-level elements
7596 ###
7597 !! test
7598 Common list
7599 !! wikitext
7600 *Common list
7601 * item 2
7602 *item 3
7603 !! html
7604 <ul><li>Common list</li>
7605 <li> item 2</li>
7606 <li>item 3</li></ul>
7607
7608 !! end
7609
7610 !! test
7611 Numbered list
7612 !! wikitext
7613 #Numbered list
7614 #item 2
7615 # item 3
7616 !! html
7617 <ol><li>Numbered list</li>
7618 <li>item 2</li>
7619 <li> item 3</li></ol>
7620
7621 !! end
7622
7623 !! test
7624 Mixed list
7625 !! wikitext
7626 *Mixed list
7627 *# with numbers
7628 ** and bullets
7629 *# and numbers
7630 *bullets again
7631 **bullet level 2
7632 ***bullet level 3
7633 ***#Number on level 4
7634 **bullet level 2
7635 **#Number on level 3
7636 **#Number on level 3
7637 *#number level 2
7638 *Level 1
7639 *** Level 3
7640 #** Level 3, but ordered
7641 !! html
7642 <ul><li>Mixed list
7643 <ol><li> with numbers</li></ol>
7644 <ul><li> and bullets</li></ul>
7645 <ol><li> and numbers</li></ol></li>
7646 <li>bullets again
7647 <ul><li>bullet level 2
7648 <ul><li>bullet level 3
7649 <ol><li>Number on level 4</li></ol></li></ul></li>
7650 <li>bullet level 2
7651 <ol><li>Number on level 3</li>
7652 <li>Number on level 3</li></ol></li></ul>
7653 <ol><li>number level 2</li></ol></li>
7654 <li>Level 1
7655 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7656 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7657
7658 !! end
7659
7660 !! test
7661 Nested lists 1
7662 !! wikitext
7663 *foo
7664 **bar
7665 !! html
7666 <ul><li>foo
7667 <ul><li>bar</li></ul></li></ul>
7668
7669 !! end
7670
7671 !! test
7672 Nested lists 2
7673 !! wikitext
7674 **foo
7675 *bar
7676 !! html
7677 <ul><li><ul><li>foo</li></ul></li>
7678 <li>bar</li></ul>
7679
7680 !! end
7681
7682 !! test
7683 Nested lists 3 (first element empty)
7684 !! wikitext
7685 *
7686 **bar
7687 !! html
7688 <ul><li>
7689 <ul><li>bar</li></ul></li></ul>
7690
7691 !! end
7692
7693 !! test
7694 Nested lists 4 (first element empty)
7695 !! wikitext
7696 **
7697 *bar
7698 !! html
7699 <ul><li><ul><li></li></ul></li>
7700 <li>bar</li></ul>
7701
7702 !! end
7703
7704 !! test
7705 Nested lists 5 (both elements empty)
7706 !! wikitext
7707 **
7708 *
7709 !! html
7710 <ul><li><ul><li></li></ul></li>
7711 <li></li></ul>
7712
7713 !! end
7714
7715 !! test
7716 Nested lists 6 (both elements empty)
7717 !! wikitext
7718 *
7719 **
7720 !! html
7721 <ul><li>
7722 <ul><li></li></ul></li></ul>
7723
7724 !! end
7725
7726 !! test
7727 Nested lists 7 (skip initial nesting levels)
7728 !! wikitext
7729 *** foo
7730 !! html
7731 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7732
7733 !! end
7734
7735 !! test
7736 Nested lists 8 (multiple nesting transitions)
7737 !! wikitext
7738 * foo
7739 *** bar
7740 ** baz
7741 * boo
7742 !! html
7743 <ul><li> foo
7744 <ul><li><ul><li> bar</li></ul></li>
7745 <li> baz</li></ul></li>
7746 <li> boo</li></ul>
7747
7748 !! end
7749
7750 !! test
7751 1. Lists with start-of-line-transparent tokens before bullets: Comments
7752 !! wikitext
7753 *foo
7754 *<!--cmt-->bar
7755 <!--cmt-->*baz
7756 !! html
7757 <ul><li>foo</li>
7758 <li>bar</li>
7759 <li>baz</li></ul>
7760
7761 !! end
7762
7763 !! test
7764 2. Lists with start-of-line-transparent tokens before bullets: Template close
7765 !! wikitext
7766 *foo {{echo|bar
7767 }}*baz
7768 !! html
7769 <ul><li>foo bar</li>
7770 <li>baz</li></ul>
7771
7772 !! end
7773
7774 !! test
7775 List items are not parsed correctly following a <pre> block (bug 785)
7776 !! wikitext
7777 * <pre>foo</pre>
7778 * <pre>bar</pre>
7779 * zar
7780 !! html
7781 <ul><li> <pre>foo</pre></li>
7782 <li> <pre>bar</pre></li>
7783 <li> zar</li></ul>
7784
7785 !! end
7786
7787 !! test
7788 List items from template
7789 !! wikitext
7790
7791 {{inner list}}
7792 * item 2
7793
7794 * item 0
7795 {{inner list}}
7796 * item 2
7797
7798 * item 0
7799 * notSOL{{inner list}}
7800 * item 2
7801 !! html
7802 <ul><li> item 1</li>
7803 <li> item 2</li></ul>
7804 <ul><li> item 0</li>
7805 <li> item 1</li>
7806 <li> item 2</li></ul>
7807 <ul><li> item 0</li>
7808 <li> notSOL</li>
7809 <li> item 1</li>
7810 <li> item 2</li></ul>
7811
7812 !! end
7813
7814 !! test
7815 List interrupted by empty line or heading
7816 !! wikitext
7817 * foo
7818
7819 ** bar
7820 == A heading ==
7821 * Another list item
7822 !! html
7823 <ul><li> foo</li></ul>
7824 <ul><li><ul><li> bar</li></ul></li></ul>
7825 <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>
7826 <ul><li> Another list item</li></ul>
7827
7828 !!end
7829
7830 !!test
7831 Multiple list tags generated by templates
7832 !! wikitext
7833 {{echo|<li>}}a
7834 {{echo|<li>}}b
7835 {{echo|<li>}}c
7836 !! html
7837 <li>a
7838 <li>b
7839 <li>c</li>
7840 </li>
7841 </li>
7842
7843 !! html+tidy
7844 <ul>
7845 <li>a</li>
7846 <li>b</li>
7847 <li>c</li>
7848 </ul>
7849 !!end
7850
7851 !!test
7852 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7853 !! wikitext
7854 *a
7855 <!--This line will NOT split the list-->
7856 *b
7857 <!--This line will NOT split the list either-->
7858 *c
7859 <!--foo--> <!----> <!--This line NOT split the list either-->
7860 *d
7861 !! html
7862 <ul><li>a</li>
7863 <li>b</li>
7864 <li>c</li>
7865 <li>d</li></ul>
7866
7867 !!end
7868
7869 !!test
7870 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7871 !! wikitext
7872 *a
7873 <!--This line will NOT split the list-->
7874 *b
7875 <!--This line will NOT split the list either-->
7876 *c
7877 <!--foo--> <!----> <!--This line NOT split the list
7878 either-->
7879 *d
7880 !! html
7881 <ul><li>a</li>
7882 <li>b</li>
7883 <li>c</li>
7884 <li>d</li></ul>
7885
7886 !!end
7887
7888 !!test
7889 Test the li-hack
7890 (The PHP parser relies on Tidy for the hack)
7891 !!options
7892 parsoid=wt2html,wt2wt
7893 !! wikitext
7894 * foo
7895 * <li>li-hack
7896 * {{echo|<li>templated li-hack}}
7897 * <!--foo--> <li> unsupported li-hack with preceding comments
7898
7899 <ul>
7900 <li><li>not a li-hack
7901 </li>
7902 </ul>
7903 !! html+tidy
7904 <ul>
7905 <li>foo</li>
7906 <li>li-hack</li>
7907 <li>templated li-hack</li>
7908 <li>unsupported li-hack with preceding comments</li>
7909 </ul>
7910 <ul>
7911 <li>not a li-hack</li>
7912 </ul>
7913 !!end
7914
7915 !! test
7916 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
7917 !! options
7918 parsoid
7919 !! wikitext
7920 # foo
7921 ## bar
7922 * foo
7923 ** bar
7924 : foo
7925 :: bar
7926 !! html
7927 <ol>
7928 <li> foo<ol>
7929 <li> bar</li>
7930 </ol></li>
7931 </ol><ul>
7932 <li> foo<ul>
7933 <li> bar</li>
7934 </ul></li>
7935 </ul><dl>
7936 <dd> foo<dl>
7937 <dd> bar</dd>
7938 </dl></dd>
7939 </dl>
7940 !! end
7941
7942 !! test
7943 Parsoid: Test of whitespace serialization with Templated bullets
7944 !! options
7945 parsoid
7946 !! wikitext
7947 * {{bullet}}
7948 !! html
7949 <ul>
7950 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
7951 </ul>
7952 !! end
7953
7954 # ------------------------------------------------------------------------
7955 # The next set of tests are about Parsoid's ability to handle badly nested
7956 # tags (parse, minimize scope of fixup, and roundtrip back)
7957 # ------------------------------------------------------------------------
7958
7959 !! test
7960 Unbalanced closing block tags break a list
7961 (php parser relies on Tidy to fix up)
7962 !! wikitext
7963 <div>
7964 *a</div><div>
7965 *b</div>
7966 !! html+tidy
7967 <div>
7968 <ul>
7969 <li>a</li>
7970 </ul>
7971 </div>
7972 <div>
7973 <ul>
7974 <li>b</li>
7975 </ul>
7976 </div>
7977 !! end
7978
7979 # Parsoid fails this test, but it might be tricky to support properly.
7980 # See bug 68395.
7981 !! test
7982 Unbalanced closing non-block tags don't break a list
7983 (php parser relies on Tidy to fix up)
7984 !! wikitext
7985 <span>
7986 *a</span><span>
7987 *b</span>
7988 !! html/php+tidy
7989 <ul>
7990 <li><span>a</span></li>
7991 <li><span>b</span></li>
7992 </ul>
7993 !! html/parsoid
7994 <span>
7995 <ul>
7996 <li>a<span></span>
7997 </li>
7998 <li>b
7999 </li>
8000 </ul>
8001 </span>
8002 !! end
8003
8004 !! test
8005 Unclosed formatting tags that straddle lists are closed and reopened
8006 (php parser relies on Tidy to fix up)
8007 !! options
8008 parsoid=wt2html,wt2wt,html2html
8009 !! wikitext
8010 # <s> a
8011 # b </s>
8012 !! html/php+tidy
8013 <ol>
8014 <li><s>a</s></li>
8015 <li><s>b</s></li>
8016 </ol>
8017 !! html/parsoid
8018 <ol><li> <s> a</s></li>
8019 <li><s> b </s></li></ol>
8020 !! end
8021
8022 # Parsoid fails this test, but it might be tricky to support properly.
8023 # See bug 68395.
8024 !!test
8025 List embedded in a non-block tag
8026 (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
8027 !! wikitext
8028 <small>
8029 * foo
8030 </small>
8031 !! html/php+tidy
8032 <ul>
8033 <li><small>foo</small></li>
8034 </ul>
8035 !! html/parsoid
8036 <small>
8037 <ul>
8038 <li> foo</li>
8039 </ul>
8040 </small>
8041 !!end
8042
8043 # This is a bug in the PHP parser + tidy combination.
8044 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8045 # and then fostered out of the table by tidy.)
8046 # We believe the Parsoid output to be correct.
8047 !! test
8048 Table with missing opening <tr> tag
8049 !! options
8050 parsoid=wt2html,wt2wt
8051 !! wikitext
8052 <table>
8053 <td>foo</td>
8054 </tr>
8055 </table>
8056 !! html/php+tidy
8057 <p>&lt;/tr&gt;</p>
8058 <table>
8059 <tr>
8060 <td>foo</td>
8061 </tr>
8062 </table>
8063 !! html/parsoid
8064 <table>
8065 <tr>
8066 <td>foo</td>
8067 </tr>
8068 </table>
8069 !! end
8070
8071 ###
8072 ### Magic Words
8073 ###
8074
8075 # Note that the current date is hard-coded as
8076 # 1970-01-01T00:02:03Z (a Thursday)
8077 # when running parser tests. The timezone is also fixed to GMT, so
8078 # local date will be identical to current date.
8079
8080 !! test
8081 Magic Word: {{CURRENTDAY}}
8082 !! wikitext
8083 {{CURRENTDAY}}
8084 !! html
8085 <p>1
8086 </p>
8087 !! end
8088
8089 !! test
8090 Magic Word: {{CURRENTDAY2}}
8091 !! wikitext
8092 {{CURRENTDAY2}}
8093 !! html
8094 <p>01
8095 </p>
8096 !! end
8097
8098 !! test
8099 Magic Word: {{CURRENTDAYNAME}}
8100 !! wikitext
8101 {{CURRENTDAYNAME}}
8102 !! html
8103 <p>Thursday
8104 </p>
8105 !! end
8106
8107 !! test
8108 Magic Word: {{CURRENTDOW}}
8109 !! wikitext
8110 {{CURRENTDOW}}
8111 !! html
8112 <p>4
8113 </p>
8114 !! end
8115
8116 !! test
8117 Magic Word: {{CURRENTMONTH}}
8118 !! wikitext
8119 {{CURRENTMONTH}}
8120 !! html
8121 <p>01
8122 </p>
8123 !! end
8124
8125 !! test
8126 Magic Word: {{CURRENTMONTH1}}
8127 !! wikitext
8128 {{CURRENTMONTH1}}
8129 !! html
8130 <p>1
8131 </p>
8132 !! end
8133
8134 !! test
8135 Magic Word: {{CURRENTMONTHABBREV}}
8136 !! wikitext
8137 {{CURRENTMONTHABBREV}}
8138 !! html
8139 <p>Jan
8140 </p>
8141 !! end
8142
8143 !! test
8144 Magic Word: {{CURRENTMONTHNAME}}
8145 !! wikitext
8146 {{CURRENTMONTHNAME}}
8147 !! html
8148 <p>January
8149 </p>
8150 !! end
8151
8152 !! test
8153 Magic Word: {{CURRENTMONTHNAMEGEN}}
8154 !! wikitext
8155 {{CURRENTMONTHNAMEGEN}}
8156 !! html
8157 <p>January
8158 </p>
8159 !! end
8160
8161 !! test
8162 Magic Word: {{CURRENTTIME}}
8163 !! wikitext
8164 {{CURRENTTIME}}
8165 !! html
8166 <p>00:02
8167 </p>
8168 !! end
8169
8170 !! test
8171 Magic Word: {{CURRENTHOUR}}
8172 !! wikitext
8173 {{CURRENTHOUR}}
8174 !! html
8175 <p>00
8176 </p>
8177 !! end
8178
8179 !! test
8180 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8181 !! wikitext
8182 {{CURRENTWEEK}}
8183 !! html
8184 <p>1
8185 </p>
8186 !! end
8187
8188 !! test
8189 Magic Word: {{CURRENTYEAR}}
8190 !! wikitext
8191 {{CURRENTYEAR}}
8192 !! html
8193 <p>1970
8194 </p>
8195 !! end
8196
8197 !! test
8198 Magic Word: {{CURRENTTIMESTAMP}}
8199 !! wikitext
8200 {{CURRENTTIMESTAMP}}
8201 !! html
8202 <p>19700101000203
8203 </p>
8204 !! end
8205
8206 !! test
8207 Magic Words LOCAL (UTC)
8208 !! wikitext
8209 * {{LOCALMONTH}}
8210 * {{LOCALMONTH1}}
8211 * {{LOCALMONTHNAME}}
8212 * {{LOCALMONTHNAMEGEN}}
8213 * {{LOCALMONTHABBREV}}
8214 * {{LOCALDAY}}
8215 * {{LOCALDAY2}}
8216 * {{LOCALDAYNAME}}
8217 * {{LOCALYEAR}}
8218 * {{LOCALTIME}}
8219 * {{LOCALHOUR}}
8220 * {{LOCALWEEK}}
8221 * {{LOCALDOW}}
8222 * {{LOCALTIMESTAMP}}
8223 !! html
8224 <ul><li> 01</li>
8225 <li> 1</li>
8226 <li> January</li>
8227 <li> January</li>
8228 <li> Jan</li>
8229 <li> 1</li>
8230 <li> 01</li>
8231 <li> Thursday</li>
8232 <li> 1970</li>
8233 <li> 00:02</li>
8234 <li> 00</li>
8235 <li> 1</li>
8236 <li> 4</li>
8237 <li> 19700101000203</li></ul>
8238
8239 !! end
8240
8241 !! test
8242 Magic Word: {{FULLPAGENAME}}
8243 !! options
8244 title=[[User:Ævar Arnfjörð Bjarmason]]
8245 !! wikitext
8246 {{FULLPAGENAME}}
8247 !! html
8248 <p>User:Ævar Arnfjörð Bjarmason
8249 </p>
8250 !! end
8251
8252 !! test
8253 Magic Word: {{FULLPAGENAMEE}}
8254 !! options
8255 title=[[User:Ævar Arnfjörð Bjarmason]]
8256 !! wikitext
8257 {{FULLPAGENAMEE}}
8258 !! html
8259 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8260 </p>
8261 !! end
8262
8263 !! test
8264 Magic Word: {{TALKSPACE}}
8265 !! options
8266 title=[[User:Ævar Arnfjörð Bjarmason]]
8267 !! wikitext
8268 {{TALKSPACE}}
8269 !! html
8270 <p>User talk
8271 </p>
8272 !! end
8273
8274 !! test
8275 Magic Word: {{TALKSPACE}}, same namespace
8276 !! options
8277 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8278 !! wikitext
8279 {{TALKSPACE}}
8280 !! html
8281 <p>User talk
8282 </p>
8283 !! end
8284
8285 !! test
8286 Magic Word: {{TALKSPACE}}, main namespace
8287 !! options
8288 title=[[Parser Test]]
8289 !! wikitext
8290 {{TALKSPACE}}
8291 !! html
8292 <p>Talk
8293 </p>
8294 !! end
8295
8296 !! test
8297 Magic Word: {{TALKSPACEE}}
8298 !! options
8299 title=[[User:Ævar Arnfjörð Bjarmason]]
8300 !! wikitext
8301 {{TALKSPACEE}}
8302 !! html
8303 <p>User_talk
8304 </p>
8305 !! end
8306
8307 !! test
8308 Magic Word: {{SUBJECTSPACE}}
8309 !! options
8310 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8311 !! wikitext
8312 {{SUBJECTSPACE}}
8313 !! html
8314 <p>User
8315 </p>
8316 !! end
8317
8318 !! test
8319 Magic Word: {{SUBJECTSPACE}}, same namespace
8320 !! options
8321 title=[[User:Ævar Arnfjörð Bjarmason]]
8322 !! wikitext
8323 {{SUBJECTSPACE}}
8324 !! html
8325 <p>User
8326 </p>
8327 !! end
8328
8329 !! test
8330 Magic Word: {{SUBJECTSPACE}}, main namespace
8331 !! options
8332 title=[[Parser Test]]
8333 !! wikitext
8334 {{SUBJECTSPACE}}
8335 !! html
8336
8337 !! end
8338
8339 !! test
8340 Magic Word: {{SUBJECTSPACEE}}
8341 !! options
8342 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8343 !! wikitext
8344 {{SUBJECTSPACEE}}
8345 !! html
8346 <p>User
8347 </p>
8348 !! end
8349
8350 !! test
8351 Magic Word: {{NAMESPACE}}
8352 !! options
8353 title=[[User:Ævar Arnfjörð Bjarmason]]
8354 !! wikitext
8355 {{NAMESPACE}}
8356 !! html
8357 <p>User
8358 </p>
8359 !! end
8360
8361 !! test
8362 Magic Word: {{NAMESPACEE}}
8363 !! options
8364 title=[[User:Ævar Arnfjörð Bjarmason]]
8365 !! wikitext
8366 {{NAMESPACEE}}
8367 !! html
8368 <p>User
8369 </p>
8370 !! end
8371
8372 !! test
8373 Magic Word: {{NAMESPACENUMBER}}
8374 !! options
8375 title=[[User:Ævar Arnfjörð Bjarmason]]
8376 !! wikitext
8377 {{NAMESPACENUMBER}}
8378 !! html
8379 <p>2
8380 </p>
8381 !! end
8382
8383 !! test
8384 Magic Word: {{SUBPAGENAME}}
8385 !! options
8386 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8387 !! wikitext
8388 {{SUBPAGENAME}}
8389 !! html
8390 <p>sub ö
8391 </p>
8392 !! end
8393
8394 !! test
8395 Magic Word: {{SUBPAGENAMEE}}
8396 !! options
8397 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8398 !! wikitext
8399 {{SUBPAGENAMEE}}
8400 !! html
8401 <p>sub_%C3%B6
8402 </p>
8403 !! end
8404
8405 !! test
8406 Magic Word: {{ROOTPAGENAME}}
8407 !! options
8408 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8409 !! wikitext
8410 {{ROOTPAGENAME}}
8411 !! html
8412 <p>Ævar Arnfjörð Bjarmason
8413 </p>
8414 !! end
8415
8416 !! test
8417 Magic Word: {{ROOTPAGENAMEE}}
8418 !! options
8419 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8420 !! wikitext
8421 {{ROOTPAGENAMEE}}
8422 !! html
8423 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8424 </p>
8425 !! end
8426
8427 !! test
8428 Magic Word: {{BASEPAGENAME}}
8429 !! options
8430 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8431 !! wikitext
8432 {{BASEPAGENAME}}
8433 !! html
8434 <p>Ævar Arnfjörð Bjarmason
8435 </p>
8436 !! end
8437
8438 !! test
8439 Magic Word: {{BASEPAGENAMEE}}
8440 !! options
8441 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8442 !! wikitext
8443 {{BASEPAGENAMEE}}
8444 !! html
8445 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8446 </p>
8447 !! end
8448
8449 !! test
8450 Magic Word: {{TALKPAGENAME}}
8451 !! options
8452 title=[[User:Ævar Arnfjörð Bjarmason]]
8453 !! wikitext
8454 {{TALKPAGENAME}}
8455 !! html
8456 <p>User talk:Ævar Arnfjörð Bjarmason
8457 </p>
8458 !! end
8459
8460 !! test
8461 Magic Word: {{TALKPAGENAMEE}}
8462 !! options
8463 title=[[User:Ævar Arnfjörð Bjarmason]]
8464 !! wikitext
8465 {{TALKPAGENAMEE}}
8466 !! html
8467 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8468 </p>
8469 !! end
8470
8471 !! test
8472 Magic Word: {{SUBJECTPAGENAME}}
8473 !! options
8474 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8475 !! wikitext
8476 {{SUBJECTPAGENAME}}
8477 !! html
8478 <p>User:Ævar Arnfjörð Bjarmason
8479 </p>
8480 !! end
8481
8482 !! test
8483 Magic Word: {{SUBJECTPAGENAMEE}}
8484 !! options
8485 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8486 !! wikitext
8487 {{SUBJECTPAGENAMEE}}
8488 !! html
8489 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8490 </p>
8491 !! end
8492
8493 !! test
8494 Magic Word: {{NUMBEROFFILES}}
8495 !! wikitext
8496 {{NUMBEROFFILES}}
8497 !! html
8498 <p>5
8499 </p>
8500 !! end
8501
8502 !! test
8503 Magic Word: {{PAGENAME}}
8504 !! options
8505 title=[[User:Ævar Arnfjörð Bjarmason]]
8506 !! wikitext
8507 {{PAGENAME}}
8508 !! html
8509 <p>Ævar Arnfjörð Bjarmason
8510 </p>
8511 !! end
8512
8513 !! test
8514 Magic Word: {{PAGENAME}} with metacharacters
8515 !! options
8516 title=[['foo & bar = baz']]
8517 !! wikitext
8518 ''{{PAGENAME}}''
8519 !! html/php
8520 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8521 </p>
8522 !! html+tidy
8523 <p><i>'foo &amp; bar = baz'</i></p>
8524 !! end
8525
8526 !! test
8527 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8528 !! options
8529 title=[[*RFC 1234 http://example.com/]]
8530 !! wikitext
8531 {{PAGENAME}}
8532 !! html/php
8533 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8534 </p>
8535 !! html+tidy
8536 <p>*RFC 1234 http://example.com/</p>
8537 !! end
8538
8539 !! test
8540 Magic Word: {{PAGENAMEE}}
8541 !! options
8542 title=[[User:Ævar Arnfjörð Bjarmason]]
8543 !! wikitext
8544 {{PAGENAMEE}}
8545 !! html
8546 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8547 </p>
8548 !! end
8549
8550 !! test
8551 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8552 !! options
8553 title=[[*RFC 1234 http://example.com/]]
8554 !! wikitext
8555 {{PAGENAMEE}}
8556 !! html/php
8557 <p>&#42;RFC_1234_http&#58;//example.com/
8558 </p>
8559 !! html+tidy
8560 <p>*RFC_1234_http://example.com/</p>
8561 !! end
8562
8563 !! test
8564 Magic Word: {{REVISIONID}}
8565 !! wikitext
8566 {{REVISIONID}}
8567 !! html
8568 <p>1337
8569 </p>
8570 !! end
8571
8572 !! test
8573 Magic Word: {{SCRIPTPATH}}
8574 !! wikitext
8575 {{SCRIPTPATH}}
8576 !! html
8577 <p>/
8578 </p>
8579 !! end
8580
8581 !! test
8582 Magic Word: {{STYLEPATH}}
8583 !! wikitext
8584 {{STYLEPATH}}
8585 !! html
8586 <p>/skins
8587 </p>
8588 !! end
8589
8590 !! test
8591 Magic Word: {{SERVER}}
8592 !! wikitext
8593 {{SERVER}}
8594 !! html
8595 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8596 </p>
8597 !! end
8598
8599 !! test
8600 Magic Word: {{SERVERNAME}}
8601 !! wikitext
8602 {{SERVERNAME}}
8603 !! html
8604 <p>example.org
8605 </p>
8606 !! end
8607
8608 !! test
8609 Magic Word: {{SITENAME}}
8610 !! wikitext
8611 {{SITENAME}}
8612 !! html
8613 <p>MediaWiki
8614 </p>
8615 !! end
8616
8617 !! test
8618 Case-sensitive magic words, when cased differently, should just be template transclusions
8619 !! wikitext
8620 {{CurrentMonth}}
8621 {{currentday}}
8622 {{cURreNTweEK}}
8623 {{currentHour}}
8624 !! html
8625 <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>
8626 <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>
8627 <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>
8628 <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>
8629 </p>
8630 !! end
8631
8632 !! test
8633 Case-insensitive magic words should still work with weird casing.
8634 !! wikitext
8635 {{sErVeRNaMe}}
8636 {{LCFirst:AOEU}}
8637 {{ucFIRST:aoeu}}
8638 {{SERver}}
8639 !! html
8640 <p>example.org
8641 aOEU
8642 Aoeu
8643 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8644 </p>
8645 !! end
8646
8647 !! test
8648 Namespace 1 {{ns:1}}
8649 !! wikitext
8650 {{ns:1}}
8651 !! html
8652 <p>Talk
8653 </p>
8654 !! end
8655
8656 !! test
8657 Namespace 1 {{ns:01}}
8658 !! wikitext
8659 {{ns:01}}
8660 !! html
8661 <p>Talk
8662 </p>
8663 !! end
8664
8665 !! test
8666 Namespace 0 {{ns:0}} (bug 4783)
8667 !! wikitext
8668 {{ns:0}}
8669 !! html
8670
8671 !! end
8672
8673 !! test
8674 Namespace 0 {{ns:00}} (bug 4783)
8675 !! wikitext
8676 {{ns:00}}
8677 !! html
8678
8679 !! end
8680
8681 !! test
8682 Namespace -1 {{ns:-1}}
8683 !! wikitext
8684 {{ns:-1}}
8685 !! html
8686 <p>Special
8687 </p>
8688 !! end
8689
8690 !! test
8691 Namespace User {{ns:User}}
8692 !! wikitext
8693 {{ns:User}}
8694 !! html
8695 <p>User
8696 </p>
8697 !! end
8698
8699 !! test
8700 Namespace User talk {{ns:User_talk}}
8701 !! wikitext
8702 {{ns:User_talk}}
8703 !! html
8704 <p>User talk
8705 </p>
8706 !! end
8707
8708 !! test
8709 Namespace User talk {{ns:uSeR tAlK}}
8710 !! wikitext
8711 {{ns:uSeR tAlK}}
8712 !! html
8713 <p>User talk
8714 </p>
8715 !! end
8716
8717 !! test
8718 Namespace File {{ns:File}}
8719 !! wikitext
8720 {{ns:File}}
8721 !! html
8722 <p>File
8723 </p>
8724 !! end
8725
8726 !! test
8727 Namespace File {{ns:Image}}
8728 !! wikitext
8729 {{ns:Image}}
8730 !! html
8731 <p>File
8732 </p>
8733 !! end
8734
8735 !! test
8736 Namespace (lang=de) Benutzer {{ns:User}}
8737 !! options
8738 language=de
8739 !! wikitext
8740 {{ns:User}}
8741 !! html
8742 <p>Benutzer
8743 </p>
8744 !! end
8745
8746 !! test
8747 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
8748 !! options
8749 language=de
8750 !! wikitext
8751 {{ns:3}}
8752 !! html
8753 <p>Benutzer Diskussion
8754 </p>
8755 !! end
8756
8757
8758 !! test
8759 Urlencode
8760 !! wikitext
8761 {{urlencode:hi world?!}}
8762 {{urlencode:hi world?!|WIKI}}
8763 {{urlencode:hi world?!|PATH}}
8764 {{urlencode:hi world?!|QUERY}}
8765 !! html
8766 <p>hi+world%3F%21
8767 hi_world%3F!
8768 hi%20world%3F%21
8769 hi+world%3F%21
8770 </p>
8771 !! end
8772
8773 !! test
8774 Magic Word: prioritize type info over data-parsoid
8775 !! options
8776 parsoid=html2wt
8777 !! wikitext
8778 __FORCETOC__
8779 !! html
8780 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
8781 !! end
8782
8783 !! test
8784 Magic Word: serialize on separate line (parsoid)
8785 !! options
8786 parsoid=wt2wt,html2wt
8787 !! wikitext
8788 foo
8789 __NOTOC__
8790 bar
8791 !! html
8792 foo<meta property="mw:PageProp/notoc"/>bar
8793 !! end
8794
8795 !! test
8796 Magic Word: rt non-english wikis
8797 !! options
8798 parsoid=wt2wt
8799 language=de
8800 !! wikitext
8801 __NOEDITSECTION__
8802 !! html
8803 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
8804 !! end
8805
8806 ###
8807 ### Magic links
8808 ###
8809 !! test
8810 Magic links: internal link to RFC (bug 479)
8811 !! wikitext
8812 [[RFC 123]]
8813 !! html
8814 <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>
8815 </p>
8816 !! end
8817
8818 !! test
8819 Magic links: RFC (bug 479)
8820 !! wikitext
8821 RFC 822
8822 !! html
8823 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8824 </p>
8825 !! end
8826
8827 !! test
8828 Magic links: ISBN (bug 1937)
8829 !! wikitext
8830 ISBN 0-306-40615-2
8831 !! html
8832 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8833 </p>
8834 !! end
8835
8836 !! test
8837 Magic links: PMID incorrectly converts space to underscore
8838 !! wikitext
8839 PMID 1234
8840 !! html
8841 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8842 </p>
8843 !! end
8844
8845 ###
8846 ### Templates
8847 ####
8848
8849 !! test
8850 Nonexistent template
8851 !! wikitext
8852 {{thistemplatedoesnotexist}}
8853 !! html
8854 <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>
8855 </p>
8856 !! end
8857
8858 !! test
8859 Template with invalid target containing tags
8860 !! wikitext
8861 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8862 !! html
8863 <p>{{a<b>b</b>|foo|a=b|a = b}}
8864 </p>
8865 !! end
8866
8867 !! test
8868 Template with invalid target containing unclosed tag
8869 !! wikitext
8870 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8871 !! html
8872 <p>{{a<b>|foo|a=b|a = b}}</b>
8873 </p>
8874 !! end
8875
8876 !! test
8877 Template with invalid target containing wikilink
8878 !! wikitext
8879 {{[[Main Page]]}}
8880 !! html/php
8881 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
8882 </p>
8883 !! html/parsoid
8884 <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>
8885 !! end
8886
8887 !! test
8888 Template with just whitespace in it, bug #68421
8889 !! wikitext
8890 {{echo|{{ }}}}
8891 !! html/parsoid
8892 <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>
8893 !! end
8894
8895 !! article
8896 Template:test
8897 !! text
8898 This is a test template
8899 !! endarticle
8900
8901 !! test
8902 Simple template
8903 !! wikitext
8904 {{test}}
8905 !! html
8906 <p>This is a test template
8907 </p>
8908 !! end
8909
8910 !! test
8911 Template with explicit namespace
8912 !! wikitext
8913 {{Template:test}}
8914 !! html
8915 <p>This is a test template
8916 </p>
8917 !! end
8918
8919
8920 !! article
8921 Template:paramtest
8922 !! text
8923 This is a test template with parameter {{{param}}}
8924 !! endarticle
8925
8926 !! test
8927 Template parameter
8928 !! wikitext
8929 {{paramtest|param=foo}}
8930 !! html
8931 <p>This is a test template with parameter foo
8932 </p>
8933 !! end
8934
8935 !! article
8936 Template:paramtestnum
8937 !! text
8938 [[{{{1}}}|{{{2}}}]]
8939 !! endarticle
8940
8941 !! test
8942 Template unnamed parameter
8943 !! wikitext
8944 {{paramtestnum|Main Page|the main page}}
8945 !! html
8946 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
8947 </p>
8948 !! end
8949
8950 !! article
8951 Template:templatesimple
8952 !! text
8953 (test)
8954 !! endarticle
8955
8956 !! article
8957 Template:templateredirect
8958 !! text
8959 #redirect [[Template:templatesimple]]
8960 !! endarticle
8961
8962 !! article
8963 Template:templateasargtestnum
8964 !! text
8965 {{{{{1}}}}}
8966 !! endarticle
8967
8968 !! article
8969 Template:templateasargtest
8970 !! text
8971 {{template{{{templ}}}}}
8972 !! endarticle
8973
8974 !! article
8975 Template:templateasargtest2
8976 !! text
8977 {{{{{templ}}}}}
8978 !! endarticle
8979
8980 !! test
8981 Template with template name as unnamed argument
8982 !! wikitext
8983 {{templateasargtestnum|templatesimple}}
8984 !! html
8985 <p>(test)
8986 </p>
8987 !! end
8988
8989 !! test
8990 Template with template name as argument
8991 !! wikitext
8992 {{templateasargtest|templ=simple}}
8993 !! html
8994 <p>(test)
8995 </p>
8996 !! end
8997
8998 !! test
8999 Template with template name as argument (2)
9000 !! wikitext
9001 {{templateasargtest2|templ=templatesimple}}
9002 !! html
9003 <p>(test)
9004 </p>
9005 !! end
9006
9007 !! article
9008 Template:templateasargtestdefault
9009 !! text
9010 {{{{{templ|templatesimple}}}}}
9011 !! endarticle
9012
9013 !! article
9014 Template:templa
9015 !! text
9016 '''templ'''
9017 !! endarticle
9018
9019 !! test
9020 Template with default value
9021 !! wikitext
9022 {{templateasargtestdefault}}
9023 !! html
9024 <p>(test)
9025 </p>
9026 !! end
9027
9028 !! test
9029 Template with default value (value set)
9030 !! wikitext
9031 {{templateasargtestdefault|templ=templa}}
9032 !! html
9033 <p><b>templ</b>
9034 </p>
9035 !! end
9036
9037 !! test
9038 Template redirect
9039 !! wikitext
9040 {{templateredirect}}
9041 !! html
9042 <p>(test)
9043 </p>
9044 !! end
9045
9046 !! test
9047 Template with argument in separate line
9048 !! wikitext
9049 {{ templateasargtest |
9050 templ = simple }}
9051 !! html
9052 <p>(test)
9053 </p>
9054 !! end
9055
9056 !! test
9057 Template with complex template as argument
9058 !! wikitext
9059 {{paramtest|
9060 param ={{ templateasargtest |
9061 templ = simple }}}}
9062 !! html
9063 <p>This is a test template with parameter (test)
9064 </p>
9065 !! end
9066
9067 !! test
9068 Template with thumb image (with link in description)
9069 !! wikitext
9070 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9071 !! html/php
9072 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>
9073
9074 !! html+tidy
9075 <p>This is a test template with parameter</p>
9076 <div class="thumb tright">
9077 <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>
9078 <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>
9079 </div>
9080 </div>
9081 !! html/parsoid
9082 <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>
9083 !! end
9084
9085 !! article
9086 Template:complextemplate
9087 !! text
9088 {{{1}}} {{paramtest|
9089 param ={{{param}}}}}
9090 !! endarticle
9091
9092 !! test
9093 Template with complex arguments
9094 !! wikitext
9095 {{complextemplate|
9096 param ={{ templateasargtest |
9097 templ = simple }}|[[Template:complextemplate|link]]}}
9098 !! html
9099 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
9100 </p>
9101 !! end
9102
9103 !! test
9104 BUG 553: link with two variables in a piped link
9105 !! wikitext
9106 {|
9107 |[[{{{1}}}|{{{2}}}]]
9108 |}
9109 !! html
9110 <table>
9111 <tr>
9112 <td>[[{{{1}}}|{{{2}}}]]
9113 </td></tr></table>
9114
9115 !! end
9116
9117 !! test
9118 Magic variable as template parameter
9119 !! wikitext
9120 {{paramtest|param={{SITENAME}}}}
9121 !! html
9122 <p>This is a test template with parameter MediaWiki
9123 </p>
9124 !! end
9125
9126 !! article
9127 Template:linktest
9128 !! text
9129 [[{{{param}}}|link]]
9130 !! endarticle
9131
9132 !! test
9133 Template parameter as link source
9134 !! wikitext
9135 {{linktest|param=Main Page}}
9136 !! html
9137 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
9138 </p>
9139 !! end
9140
9141 !!test
9142 Template-generated attribute string (k='v')
9143 !! wikitext
9144 <span {{attr_str|id|v1}}>bar</span>
9145 !! html
9146 <p><span id="v1">bar</span>
9147 </p>
9148 !!end
9149
9150 !!article
9151 Template:paramtest2
9152 !! text
9153 including another template, {{paramtest|param={{{arg}}}}}
9154 !! endarticle
9155
9156 !! test
9157 Template passing argument to another template
9158 !! wikitext
9159 {{paramtest2|arg='hmm'}}
9160 !! html
9161 <p>including another template, This is a test template with parameter 'hmm'
9162 </p>
9163 !! end
9164
9165 !! article
9166 Template:Linktest2
9167 !! text
9168 Main Page
9169 !! endarticle
9170
9171 !! test
9172 Template as link source
9173 !! wikitext
9174 [[{{linktest2}}]]
9175
9176 [[{{linktest2}}|Main Page]]
9177
9178 [[{{linktest2}}]]Page
9179 !! html
9180 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9181 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9182 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
9183 </p>
9184 !! end
9185
9186
9187 !! article
9188 Template:loop1
9189 !! text
9190 {{loop2}}
9191 !! endarticle
9192
9193 !! article
9194 Template:loop2
9195 !! text
9196 {{loop1}}
9197 !! endarticle
9198
9199 !! test
9200 Template infinite loop
9201 !! wikitext
9202 {{loop1}}
9203 !! html
9204 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
9205 </p>
9206 !! end
9207
9208 !! test
9209 Template from main namespace
9210 !! wikitext
9211 {{:Main Page}}
9212 !! html
9213 <p>blah blah
9214 </p>
9215 !! end
9216
9217 !! article
9218 Template:table
9219 !! text
9220 {|
9221 | 1 || 2
9222 |-
9223 | 3 || 4
9224 |}
9225 !! endarticle
9226
9227 !! test
9228 BUG 529: Template with table, not included at beginning of line
9229 !! wikitext
9230 foo {{table}}
9231 !! html
9232 <p>foo
9233 </p>
9234 <table>
9235 <tr>
9236 <td> 1 </td>
9237 <td> 2
9238 </td></tr>
9239 <tr>
9240 <td> 3 </td>
9241 <td> 4
9242 </td></tr></table>
9243
9244 !! end
9245
9246 !! test
9247 BUG 523: Template shouldn't eat newline (or add an extra one before table)
9248 !! wikitext
9249 foo
9250 {{table}}
9251 !! html
9252 <p>foo
9253 </p>
9254 <table>
9255 <tr>
9256 <td> 1 </td>
9257 <td> 2
9258 </td></tr>
9259 <tr>
9260 <td> 3 </td>
9261 <td> 4
9262 </td></tr></table>
9263
9264 !! end
9265
9266 !! test
9267 BUG 41: Template parameters shown as broken links
9268 !! wikitext
9269 {{{parameter}}}
9270 !! html
9271 <p>{{{parameter}}}
9272 </p>
9273 !! end
9274
9275 !! test
9276 Template with targets containing wikilinks
9277 !! wikitext
9278 {{[[foo]]}}
9279
9280 {{[[{{echo|foo}}]]}}
9281
9282 {{{{echo|[[foo}}]]}}
9283 !! html
9284 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9285 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9286 </p><p>{{[[foo}}]]
9287 </p>
9288 !! end
9289
9290 !! article
9291 Template:MSGNW test
9292 !! text
9293 ''None'' of '''this''' should be
9294 * interpreted
9295 but rather passed unmodified
9296 {{test}}
9297 <gallery>
9298 File:Foobar.jpg
9299 </gallery>
9300 !! endarticle
9301
9302 # hmm, fix this or just deprecate msgnw and document its behavior?
9303 !! test
9304 msgnw keyword
9305 !! wikitext
9306 {{msgnw:MSGNW test}}
9307 !! html
9308 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
9309 &#42; interpreted
9310 &#32;but rather passed unmodified
9311 &#123;&#123;test&#125;&#125;
9312 &#60;gallery&#62;
9313 File:Foobar.jpg
9314 &#60;/gallery&#62;
9315 </p>
9316 !! end
9317
9318 !! test
9319 int keyword
9320 !! wikitext
9321 {{int:youhavenewmessages|lots of money|not!}}
9322 !! html
9323 <p>You have lots of money (not!).
9324 </p>
9325 !! end
9326
9327 !! article
9328 Template:Includes
9329 !! text
9330 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9331 !! endarticle
9332
9333 !! test
9334 <includeonly> and <noinclude> being included
9335 !! wikitext
9336 {{Includes}}
9337 !! html
9338 <p>Foobar
9339 </p>
9340 !! end
9341
9342 !! article
9343 Template:Includes2
9344 !! text
9345 <onlyinclude>Foo</onlyinclude>bar
9346 !! endarticle
9347
9348 !! test
9349 <onlyinclude> being included
9350 !! wikitext
9351 {{Includes2}}
9352 !! html
9353 <p>Foo
9354 </p>
9355 !! end
9356
9357
9358 !! article
9359 Template:Includes3
9360 !! text
9361 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9362 !! endarticle
9363
9364 !! test
9365 <onlyinclude> and <includeonly> being included
9366 !! wikitext
9367 {{Includes3}}
9368 !! html
9369 <p>Foo
9370 </p>
9371 !! end
9372
9373 !! test
9374 <includeonly> and <noinclude> on a page
9375 !! wikitext
9376 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9377 !! html
9378 <p>Foozar
9379 </p>
9380 !! end
9381
9382 !! test
9383 Un-closed <noinclude>
9384 !! wikitext
9385 <noinclude>
9386 !! html
9387 !! end
9388
9389 !! test
9390 <onlyinclude> on a page
9391 !! wikitext
9392 <onlyinclude>Foo</onlyinclude>bar
9393 !! html
9394 <p>Foobar
9395 </p>
9396 !! end
9397
9398 !! test
9399 Un-closed <onlyinclude>
9400 !! wikitext
9401 <onlyinclude>
9402 !! html
9403 !! end
9404
9405 !!test
9406 Self-closed noinclude, includeonly, onlyinclude tags
9407 !! wikitext
9408 <noinclude />
9409 <includeonly />
9410 <onlyinclude />
9411 !! html
9412 <p><br />
9413 </p>
9414 !!end
9415
9416 !!test
9417 Unbalanced includeonly and noinclude tags
9418 !! wikitext
9419 {|
9420 |a</noinclude>
9421 |b</noinclude></noinclude>
9422 |c</noinclude></includeonly>
9423 |d</includeonly></includeonly>
9424 |}
9425 !! html
9426 <table>
9427 <tr>
9428 <td>a
9429 </td>
9430 <td>b
9431 </td>
9432 <td>c&lt;/includeonly&gt;
9433 </td>
9434 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9435 </td></tr></table>
9436
9437 !!end
9438
9439 !! article
9440 Template:Includeonly section
9441 !! text
9442 <includeonly>
9443 ==Includeonly section==
9444 </includeonly>
9445 ==Section T-1==
9446 !!endarticle
9447
9448 !! test
9449 Bug 6563: Edit link generation for section shown by <includeonly>
9450 !! wikitext
9451 {{includeonly section}}
9452 !! html
9453 <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>
9454 <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>
9455
9456 !! end
9457
9458 # Uses same input as the contents of [[Template:Includeonly section]]
9459 !! test
9460 Bug 6563: Section extraction for section shown by <includeonly>
9461 !! options
9462 section=T-2
9463 !! wikitext
9464 <includeonly>
9465 ==Includeonly section==
9466 </includeonly>
9467 ==Section T-2==
9468 !! html
9469 ==Section T-2==
9470 !! end
9471
9472 !! test
9473 Bug 6563: Edit link generation for section suppressed by <includeonly>
9474 !! wikitext
9475 <includeonly>
9476 ==Includeonly section==
9477 </includeonly>
9478 ==Section 1==
9479 !! html
9480 <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>
9481
9482 !! end
9483
9484 !! test
9485 Bug 6563: Section extraction for section suppressed by <includeonly>
9486 !! options
9487 section=1
9488 !! wikitext
9489 <includeonly>
9490 ==Includeonly section==
9491 </includeonly>
9492 ==Section 1==
9493 !! html
9494 ==Section 1==
9495 !! end
9496
9497 !! test
9498 Un-closed <includeonly>
9499 !! wikitext
9500 <includeonly>
9501 !! html
9502 !! end
9503
9504 !! test
9505 Includes and comments at SOL
9506 !! wikitext
9507 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
9508
9509 <noinclude>
9510 some
9511 </noinclude>* stuff
9512 * here
9513
9514 <includeonly>can have stuff</includeonly>=== here ===
9515
9516 !! html/php
9517 <h2><span class="mw-headline" id="hu">hu</span></h2>
9518 <p>some
9519 </p>
9520 <ul><li> stuff</li>
9521 <li> here</li></ul>
9522 <h3><span class="mw-headline" id="here">here</span></h3>
9523
9524 !! html/parsoid
9525 <!-- 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>
9526
9527 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
9528 <p>some</p>
9529 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
9530 <li> here</li></ul>
9531
9532 <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>
9533
9534 !! end
9535
9536 # TODO: test with DOM fragment reuse!
9537 !! test
9538 Parsoid: DOM fragment reuse
9539 !! options
9540 parsoid=wt2wt,wt2html
9541 !! wikitext
9542 a{{echo|b<table></table>c}}d
9543
9544 a{{echo|b
9545 <table></table>
9546 c}}d
9547
9548 {{echo|a
9549
9550 <table></table>
9551
9552 b}}
9553 !! html
9554 <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>
9555
9556 <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">
9557 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
9558 </span><p about="#mwt2">cd</p>
9559
9560 <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">
9561
9562 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
9563
9564 </span><p about="#mwt3">b</p>
9565 !! end
9566
9567 !! test
9568 Parsoid: Merge double tds (bug 50603)
9569 !! options
9570 parsoid
9571 !! wikitext
9572 {|
9573 |{{echo|{{!}} foo}}
9574 |}
9575 !! html
9576 <table><tbody>
9577 <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>
9578 </tbody></table>
9579 !! end
9580
9581 !! test
9582 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9583 !! options
9584 parsoid
9585 !! wikitext
9586 {{echo|<div>}}
9587 {|
9588 |{{echo|{{!}} foo}}
9589 |}
9590 {{echo|</div>}}
9591 !! html
9592 <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}}]}'>
9593 <table><tbody>
9594 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9595 </tbody></table>
9596 </div>
9597 !! end
9598
9599 ###
9600 ### <includeonly> and <noinclude> in attributes
9601 ###
9602 !!test
9603 0. includeonly around the entire attribute
9604 !! wikitext
9605 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9606 !! html
9607 <p><span id="v2">bar</span>
9608 </p>
9609 !!end
9610
9611 !!test
9612 1. includeonly in html attr key
9613 !! wikitext
9614 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9615 !! html
9616 <p><span id="foo">bar</span>
9617 </p>
9618 !!end
9619
9620 !!test
9621 2. includeonly in html attr value
9622 !! wikitext
9623 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9624 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9625 !! html
9626 <p><span id="v1">bar</span>
9627 <span id="v1">bar</span>
9628 </p>
9629 !!end
9630
9631 !!test
9632 3. includeonly in part of an attr value
9633 !! wikitext
9634 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9635 !! html
9636 <p><span style="color:red;">bar</span>
9637 </p>
9638 !!end
9639
9640 !!test
9641 4. includeonly in table attributes
9642 !! wikitext
9643 {|
9644 |- <noinclude>
9645 |-
9646 |a
9647 </noinclude>
9648 |- <includeonly>
9649 |-
9650 |b
9651 </includeonly>
9652 |}
9653 !! html
9654 <table>
9655
9656
9657 <tr>
9658 <td>a
9659 </td></tr>
9660 </table>
9661
9662 !!end
9663
9664 ###
9665 ### Token Stream Patcher tests
9666 ###
9667 ### These tests won't always pass wt2wt and other modes because
9668 ### on serialization, the table will be output on a new line.
9669 ### For now, we are blacklisting them, and using this to test selser.
9670 ###
9671
9672 !!test
9673 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
9674 !!options
9675 parsoid=wt2html,wt2wt
9676 !!wikitext
9677 {{echo|}}{| width = '100%'
9678 |foo
9679 |}
9680 !!html/parsoid
9681 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
9682 <tbody><tr><td>foo</td></tr>
9683 </tbody></table>
9684 !!end
9685
9686 !!test
9687 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
9688 !!options
9689 parsoid=wt2html,wt2wt
9690 !!wikitext
9691 <includeonly>a</includeonly>{| {{{b}}}
9692 |c
9693 |}
9694 !!html/parsoid
9695 <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}}}":""}}'>
9696 <tbody><tr><td>c</td></tr>
9697 </tbody></table>
9698
9699 !!end
9700
9701 ###
9702 ### Testing parsing of templates where a template arg
9703 ### has the same name as the template itself.
9704 ###
9705
9706 !! article
9707 Template:quote
9708 !! text
9709 {{{quote|{{{1}}}}}}
9710 !! endarticle
9711
9712 !!test
9713 Templates: Template Name/Arg clash: 1. Use of positional param
9714 !! wikitext
9715 {{quote|foo}}
9716 !! html
9717 <p>foo
9718 </p>
9719 !!end
9720
9721 !!test
9722 Templates: Template Name/Arg clash: 2. Use of named param
9723 !! wikitext
9724 {{quote|quote=foo}}
9725 !! html
9726 <p>foo
9727 </p>
9728 !!end
9729
9730 !!test
9731 Templates: Template Name/Arg clash: 3. Use of named param with empty input
9732 !! wikitext
9733 {{quote|quote}}
9734 !! html
9735 <p>quote
9736 </p>
9737 !!end
9738
9739 ###
9740 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
9741 ###
9742
9743 !!test
9744 Templates: 1. Simple use
9745 !! wikitext
9746 {{echo|Foo}}
9747 !! html
9748 <p>Foo
9749 </p>
9750 !!end
9751
9752 !!test
9753 Templates: 2. Inside a block tag
9754 !! wikitext
9755 <div>{{echo|Foo}}</div>
9756 <blockquote>{{echo|Foo}}</blockquote>
9757 !! html
9758 <div>Foo</div>
9759 <blockquote>Foo</blockquote>
9760
9761 !! html+tidy
9762 <div>Foo</div>
9763 <blockquote>
9764 <p>Foo</p>
9765 </blockquote>
9766 !!end
9767
9768 !!test
9769 Templates: P-wrapping: 1a. Templates on consecutive lines
9770 !! wikitext
9771 {{echo|Foo}}
9772 {{echo|bar}}
9773 !! html
9774 <p>Foo
9775 bar
9776 </p>
9777 !!end
9778
9779 !!test
9780 Templates: P-wrapping: 1b. Templates on consecutive lines
9781 !! wikitext
9782 Foo
9783
9784 {{echo|bar}}
9785 {{echo|baz}}
9786 !! html
9787 <p>Foo
9788 </p><p>bar
9789 baz
9790 </p>
9791 !!end
9792
9793 !!test
9794 Templates: P-wrapping: 1c. Templates on consecutive lines
9795 !! wikitext
9796 {{echo|Foo}}
9797 {{echo|bar}} <div>baz</div>
9798 !! html
9799 <p>Foo
9800 </p>
9801 bar <div>baz</div>
9802
9803 !! html+tidy
9804 <p>Foo</p>
9805 <p>bar</p>
9806 <div>baz</div>
9807 !! end
9808
9809 !!test
9810 Templates: P-wrapping: 1d. Template preceded by comment-only line
9811 !!options
9812 parsoid
9813 !! wikitext
9814 <!-- foo -->
9815 {{echo|Bar}}
9816 !! html
9817 <!-- foo -->
9818
9819 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
9820 !!end
9821
9822 !!test
9823 Templates: Inline Text: 1. Multiple template uses
9824 !! wikitext
9825 {{echo|Foo}}bar{{echo|baz}}
9826 !! html
9827 <p>Foobarbaz
9828 </p>
9829 !!end
9830
9831 !!test
9832 Templates: Inline Text: 2. Back-to-back template uses
9833 !! wikitext
9834 {{echo|Foo}}{{echo|bar}}
9835 !! html
9836 <p>Foobar
9837 </p>
9838 !!end
9839
9840 !!test
9841 Templates: Block Tags: 1. Multiple template uses
9842 !! wikitext
9843 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
9844 !! html
9845 <div>Foo</div><div>bar</div><div>baz</div>
9846
9847 !!end
9848
9849 !!test
9850 Templates: Block Tags: 2. Back-to-back template uses
9851 !! wikitext
9852 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
9853 !! html
9854 <div>Foo</div><div>bar</div>
9855
9856 !!end
9857
9858 # This is an edge case relating to paragraph wrapping.
9859 !!test
9860 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
9861 !! wikitext
9862 {{echo|a
9863 b</p>}}
9864 !! html/parsoid
9865 <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
9866 b</p>
9867 !!end
9868
9869 !!test
9870 Templates: Links: 1. Simple example
9871 !! wikitext
9872 {{echo|[[Foo|bar]]}}
9873 !! html
9874 <p><a href="/wiki/Foo" title="Foo">bar</a>
9875 </p>
9876 !!end
9877
9878 !!test
9879 Templates: Links: 2. Generation of link href
9880 !! wikitext
9881 [[{{echo|Foo}}|bar]]
9882 !! html
9883 <p><a href="/wiki/Foo" title="Foo">bar</a>
9884 </p>
9885 !!end
9886
9887 !!test
9888 Templates: Links: 3. Generation of part of a link href
9889 !! wikitext
9890 [[Fo{{echo|o}}|bar]]
9891
9892 [[Foo{{echo|bar}}]]
9893
9894 [[Foo{{echo|bar}}baz]]
9895
9896 [[Foo{{echo|bar}}|bar]]
9897
9898 [[:Foo{{echo|bar}}]]
9899
9900 [[:Foo{{echo|bar}}|bar]]
9901 !! html
9902 <p><a href="/wiki/Foo" title="Foo">bar</a>
9903 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9904 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
9905 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9906 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9907 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9908 </p>
9909 !!end
9910
9911 !!test
9912 Templates: Links: 4. Multiple templates generating link href
9913 !! wikitext
9914 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
9915 !! html
9916 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9917 </p>
9918 !!end
9919
9920 !!test
9921 Templates: Links: 5. Generation of link text
9922 !! wikitext
9923 [[Foo|{{echo|bar}}]]
9924 !! html
9925 <p><a href="/wiki/Foo" title="Foo">bar</a>
9926 </p>
9927 !!end
9928
9929 !!test
9930 Templates: Links: 5. Nested templates (only outermost template should be marked)
9931 !! wikitext
9932 {{echo|[[{{echo|Foo}}|bar]]}}
9933 !! html
9934 <p><a href="/wiki/Foo" title="Foo">bar</a>
9935 </p>
9936 !!end
9937
9938 !!test
9939 Templates: HTML Tag: 1. Generation of HTML attr. key
9940 !! wikitext
9941 <div {{echo|style}}="color:red;">foo</div>
9942 !! html
9943 <div style="color:red;">foo</div>
9944
9945 !!end
9946
9947 !!test
9948 Templates: HTML Tag: 2. Generation of HTML attr. value
9949 !! wikitext
9950 <div style={{echo|'color:red;'}}>foo</div>
9951 !! html
9952 <div style="color:red;">foo</div>
9953
9954 !!end
9955
9956 !!test
9957 Templates: HTML Tag: 3. Generation of HTML attr key and value
9958 !! wikitext
9959 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
9960 !! html
9961 <div style="color:red;">foo</div>
9962
9963 !!end
9964
9965 !!test
9966 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
9967 !! wikitext
9968 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
9969 !! html
9970 <div title="This is a long title with just one piece templated">foo</div>
9971
9972 !!end
9973
9974 !!test
9975 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
9976 !! wikitext
9977 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
9978 !! html
9979 <div title="This is a long title with just one piece templated">foo</div>
9980
9981 !!end
9982
9983 !!test
9984 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
9985 !! wikitext
9986 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
9987 !! html
9988 <div title="This is a long title with just one piece templated">foo</div>
9989
9990 !!end
9991
9992 !!test
9993 Templates: HTML Tag: 7. Generation of partial attribute key string
9994 !! wikitext
9995 <div st{{echo|yle}}="color:red;">foo</div>
9996 !! html
9997 <div style="color:red;">foo</div>
9998
9999 !!end
10000
10001 !!test
10002 Templates: HTML Tables: 1. Generating start of a HTML table
10003 !! wikitext
10004 {{echo|<table><tr><td>foo</td>}}</tr></table>
10005 !! html
10006 <table><tr><td>foo</td></tr></table>
10007
10008 !!end
10009
10010 !!test
10011 Templates: HTML Tables: 2a. Generating middle of a HTML table
10012 !! wikitext
10013 <table><tr>{{echo|<td>foo</td>}}</tr></table>
10014 !! html
10015 <table><tr><td>foo</td></tr></table>
10016
10017 !!end
10018
10019 !!test
10020 Templates: HTML Tables: 2b. Generating middle of a HTML table
10021 !! wikitext
10022 <table>{{echo|<tr><td>foo</td></tr>}}</table>
10023 !! html
10024 <table><tr><td>foo</td></tr></table>
10025
10026 !!end
10027
10028 !!test
10029 Templates: HTML Tables: 3. Generating end of a HTML table
10030 !! wikitext
10031 <table><tr>{{echo|<td>foo</td></tr></table>}}
10032 !! html
10033 <table><tr><td>foo</td></tr></table>
10034
10035 !!end
10036
10037 !!test
10038 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
10039 !! wikitext
10040 {{echo|<table>}}<tr><td>foo</td></tr></table>
10041 !! html
10042 <table><tr><td>foo</td></tr></table>
10043
10044 !!end
10045
10046 !!test
10047 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
10048 !! wikitext
10049 <table>{{echo|<tr>}}<td>foo</td></tr></table>
10050 !! html
10051 <table><tr><td>foo</td></tr></table>
10052
10053 !!end
10054
10055 !!test
10056 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
10057 !! wikitext
10058 <table><tr>{{echo|<td>}}foo</td></tr></table>
10059 !! html
10060 <table><tr><td>foo</td></tr></table>
10061
10062 !!end
10063
10064 !!test
10065 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
10066 !! wikitext
10067 <table><tr><td>foo{{echo|</td>}}</tr></table>
10068 !! html
10069 <table><tr><td>foo</td></tr></table>
10070
10071 !!end
10072
10073 !!test
10074 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
10075 !! wikitext
10076 <table><tr><td>foo</td>{{echo|</tr>}}</table>
10077 !! html
10078 <table><tr><td>foo</td></tr></table>
10079
10080 !!end
10081
10082 !!test
10083 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
10084 !! wikitext
10085 <table><tr><td>foo</td></tr>{{echo|</table>}}
10086 !! html
10087 <table><tr><td>foo</td></tr></table>
10088
10089 !!end
10090
10091 !!test
10092 Templates: HTML Tables: 5. Proper fostering of categories from inside
10093 !!options
10094 parsoid=wt2html,wt2wt
10095 !! wikitext
10096 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
10097 <!--Two categories (Bug 50330)-->
10098 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
10099 !! html
10100 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
10101 <!--Two categories (Bug 50330)-->
10102 <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>
10103 !!end
10104
10105 !!test
10106 Templates: Wiki Tables: 1a. Fostering of entire template content
10107 !! wikitext
10108 {|
10109 {{echo|a}}
10110 |}
10111 !! html
10112 <table>
10113 a
10114 <tr><td></td></tr></table>
10115
10116 !! html+tidy
10117 <p>a</p>
10118 <table>
10119 <tr>
10120 <td></td>
10121 </tr>
10122 </table>
10123 !! end
10124
10125 !!test
10126 Templates: Wiki Tables: 1b. Fostering of entire template content
10127 !! wikitext
10128 {|
10129 {{echo|<div>}}
10130 foo
10131 {{echo|</div>}}
10132 |}
10133 !! html
10134 <table>
10135 <div>
10136 <p>foo
10137 </p>
10138 </div>
10139 <tr><td></td></tr></table>
10140
10141 !! html+tidy
10142 <div>
10143 <p>foo</p>
10144 </div>
10145 <table>
10146 <tr>
10147 <td></td>
10148 </tr>
10149 </table>
10150 !! end
10151
10152 !!test
10153 Templates: Wiki Tables: 2. Fostering of partial template content
10154 !! wikitext
10155 {|
10156 {{echo|a
10157 <div>b</div>}}
10158 |}
10159 !! html
10160 <table>
10161 a
10162 <div>b</div>
10163 <tr><td></td></tr></table>
10164
10165 !! html+tidy
10166 <p>a</p>
10167 <div>b</div>
10168 <table>
10169 <tr>
10170 <td></td>
10171 </tr>
10172 </table>
10173 !! end
10174
10175 !!test
10176 Templates: Wiki Tables: 3. td-content via multiple templates
10177 !! wikitext
10178 {|
10179 {{echo|{{pipe}}a}}{{echo|b}}
10180 |}
10181 !! html
10182 <table>
10183 <tr>
10184 <td>ab
10185 </td></tr></table>
10186
10187 !!end
10188
10189 !!test
10190 Templates: Wiki Tables: 4. Templated tags, no content
10191 !! wikitext
10192 {{tbl-start}}
10193 {{tbl-end}}
10194 !! html
10195 <table>
10196 <tr><td></td></tr></table>
10197
10198 !!end
10199
10200 !!test
10201 Templates: Wiki Tables: 5. Templated tags, regular td-tags
10202 !! wikitext
10203 {{tbl-start}}
10204 |foo
10205 {{tbl-end}}
10206 !! html
10207 <table>
10208 <tr>
10209 <td>foo
10210 </td></tr></table>
10211
10212 !!end
10213
10214 !!test
10215 Templates: Wiki Tables: 6. Templated tags, templated td-tags
10216 !! wikitext
10217 {{tbl-start}}
10218 {{!}}foo
10219 {{tbl-end}}
10220 !! html
10221 <table>
10222 <tr>
10223 <td>foo
10224 </td></tr></table>
10225
10226 !!end
10227
10228 !!test
10229 Templates: Lists: Multi-line list-items via templates
10230 !! wikitext
10231 *{{echo|a {{nonexistent|
10232 unused}}}}
10233 *{{echo|b {{nonexistent|
10234 unused}}}}
10235 !! html
10236 <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>
10237 <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>
10238
10239 !!end
10240
10241 !!test
10242 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
10243 !! wikitext
10244 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
10245 !! html
10246 <p><i>ab</i>c<i>d</i>e
10247 </p>
10248 !!end
10249
10250 !!test
10251 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
10252 (PHP parser generates misnested html)
10253 !! wikitext
10254 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
10255 !! html/parsoid
10256 <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>
10257 !!end
10258
10259 !!test
10260 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
10261 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
10262 !! options
10263 parsoid=wt2html,wt2wt
10264 !! wikitext
10265 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
10266 !! html
10267 <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>
10268 <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>
10269 <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>
10270 !!end
10271
10272 !!test
10273 Templates: Ugly nesting: 4. Divs opened/closed across templates
10274 !! wikitext
10275 a<div>b{{echo|c</div>d}}e
10276 !! html
10277 a<div>bc</div>de
10278
10279 !! html+tidy
10280 <p>a</p>
10281 <div>bc</div>
10282 <p>de</p>
10283 !! end
10284
10285 !!test
10286 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10287 (Parsoid-centric)
10288 !! options
10289 parsoid
10290 !! wikitext
10291 {|
10292 |{{echo|foo</table>}}
10293 |bar
10294 |}
10295 !! html
10296 <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|}"]}'>
10297
10298 <tbody>
10299 <tr>
10300 <td>foo</td></tr></tbody></table><span about="#mwt1">
10301 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10302 |}</span>
10303 !!end
10304
10305 !!test
10306 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10307 (Parsoid-centric)
10308 !! options
10309 parsoid
10310 !! wikitext
10311 <table>
10312 <tr>
10313 <td>
10314 <table>
10315 <tr>
10316 <td>1. {{echo|foo </table>}}</td>
10317 <td> bar </td>
10318 <td>2. {{echo|baz </table>}}</td>
10319 </tr>
10320 <tr>
10321 <td>abc</td>
10322 </tr>
10323 </table>
10324 </td>
10325 </tr>
10326 <tr>
10327 <td>xyz</td>
10328 </tr>
10329 </table>
10330 !! html
10331 <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>"]}'>
10332 <tbody><tr>
10333 <td>
10334 <table>
10335 <tbody><tr>
10336 <td>1. foo </td></tr></tbody></table></td>
10337 <td> bar </td>
10338 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10339 </span><span about="#mwt2">
10340 </span><span about="#mwt2">
10341 </span><span about="#mwt2">abc</span><span about="#mwt2">
10342 </span><span about="#mwt2">
10343 </span><span about="#mwt2">
10344 </span><span about="#mwt2">
10345 </span><span about="#mwt2">
10346 </span><span about="#mwt2">
10347 </span><span about="#mwt2">xyz</span><span about="#mwt2">
10348 </span><span about="#mwt2">
10349 </span>
10350 !!end
10351
10352 !! test
10353 Templates: Ugly templates: 3. newline-only template parameter
10354 !! wikitext
10355 foo {{echo|
10356 }}
10357 !! html
10358 <p>foo
10359 </p>
10360 !! end
10361
10362 # This looks like a bug: a single newline triggers p/br for some reason.
10363 !! test
10364 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10365 !! wikitext
10366 {{echo|
10367 }}
10368 !! html
10369 <p><br />
10370 </p>
10371 !! end
10372
10373 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10374 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10375 !! test
10376 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10377 !! wikitext
10378 {{echo|<table>}}
10379 {{echo|<div>foo}}
10380 {{echo|</table>}}
10381 !! html/parsoid
10382 <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
10383 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10384 </table>
10385 !! end
10386
10387 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10388 # that are "identical" and generate nesting cycles in the algorithm
10389 !! test
10390 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
10391 !! wikitext
10392 {{echo|<table><tr><td><table>}}
10393 {{echo|<div>}}
10394 {{echo|</div>}}
10395 !! html/parsoid
10396 <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"}'>
10397 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10398 </table></td></tr></tbody></table>
10399 !! end
10400
10401 !!test
10402 Parser Functions: 1. Simple example
10403 !! wikitext
10404 {{uc:foo}}
10405 !! html
10406 <p>FOO
10407 </p>
10408 !!end
10409
10410 !!test
10411 Parser Functions: 2. Nested use (only outermost should be marked up)
10412 !! wikitext
10413 {{uc:{{lc:FOO}}}}
10414 !! html
10415 <p>FOO
10416 </p>
10417 !!end
10418
10419 ###
10420 ### Pre-save transform tests
10421 ###
10422 !! test
10423 pre-save transform: subst:
10424 !! options
10425 PST
10426 !! wikitext
10427 {{subst:test}}
10428 !! html
10429 This is a test template
10430 !! end
10431
10432 !! test
10433 pre-save transform: normal template
10434 !! options
10435 PST
10436 !! wikitext
10437 {{test}}
10438 !! html
10439 {{test}}
10440 !! end
10441
10442 !! test
10443 pre-save transform: nonexistent template
10444 !! options
10445 PST
10446 !! wikitext
10447 {{thistemplatedoesnotexist}}
10448 !! html
10449 {{thistemplatedoesnotexist}}
10450 !! end
10451
10452
10453 !! test
10454 pre-save transform: subst magic variables
10455 !! options
10456 PST
10457 !! wikitext
10458 {{subst:SITENAME}}
10459 !! html
10460 MediaWiki
10461 !! end
10462
10463 # This is bug 89, which I fixed. -- wtm
10464 !! test
10465 pre-save transform: subst: templates with parameters
10466 !! options
10467 pst
10468 !! wikitext
10469 {{subst:paramtest|param="something else"}}
10470 !! html
10471 This is a test template with parameter "something else"
10472 !! end
10473
10474 !! article
10475 Template:nowikitest
10476 !! text
10477 <nowiki>'''not wiki'''</nowiki>
10478 !! endarticle
10479
10480 !! test
10481 pre-save transform: nowiki in subst (bug 1188)
10482 !! options
10483 pst
10484 !! wikitext
10485 {{subst:nowikitest}}
10486 !! html
10487 <nowiki>'''not wiki'''</nowiki>
10488 !! end
10489
10490
10491 !! article
10492 Template:commenttest
10493 !! text
10494 This template has <!-- a comment --> in it.
10495 !! endarticle
10496
10497 !! test
10498 pre-save transform: comment in subst (bug 1936)
10499 !! options
10500 pst
10501 !! wikitext
10502 {{subst:commenttest}}
10503 !! html
10504 This template has <!-- a comment --> in it.
10505 !! end
10506
10507 !! test
10508 pre-save transform: unclosed tag
10509 !! options
10510 pst noxml
10511 !! wikitext
10512 <nowiki>'''not wiki'''
10513 !! html
10514 <nowiki>'''not wiki'''
10515 !! end
10516
10517 !! test
10518 pre-save transform: mixed tag case
10519 !! options
10520 pst noxml
10521 !! wikitext
10522 <NOwiki>'''not wiki'''</noWIKI>
10523 !! html
10524 <NOwiki>'''not wiki'''</noWIKI>
10525 !! end
10526
10527 !! test
10528 pre-save transform: unclosed comment in <nowiki>
10529 !! options
10530 pst noxml
10531 !! wikitext
10532 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10533 !! html
10534 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10535 !!end
10536
10537 # Leading @ in this template definition works around a limitation
10538 # in parsoid's parserTests which otherwise strips the <span> from the
10539 # result (confusing it for a template wrapper)
10540 !! article
10541 Template:dangerous
10542 !!text
10543 @<span onmouseover="alert('crap')">Oh no</span>
10544 !!endarticle
10545
10546 !!test
10547 (confirming safety of fix for subst bug 1936)
10548 !! wikitext
10549 {{Template:dangerous}}
10550 !! html
10551 <p>@<span>Oh no</span>
10552 </p>
10553 !! end
10554
10555 !! test
10556 pre-save transform: comment containing gallery (bug 5024)
10557 !! options
10558 pst
10559 !! wikitext
10560 <!-- <gallery>data</gallery> -->
10561 !! html
10562 <!-- <gallery>data</gallery> -->
10563 !!end
10564
10565 !! test
10566 pre-save transform: comment containing extension
10567 !! options
10568 pst
10569 !! wikitext
10570 <!-- <tag>data</tag> -->
10571 !! html
10572 <!-- <tag>data</tag> -->
10573 !!end
10574
10575 !! test
10576 pre-save transform: comment containing nowiki
10577 !! options
10578 pst
10579 !! wikitext
10580 <!-- <nowiki>data</nowiki> -->
10581 !! html
10582 <!-- <nowiki>data</nowiki> -->
10583 !!end
10584
10585 !! test
10586 pre-save transform: <noinclude> in subst (bug 3298)
10587 !! options
10588 pst
10589 !! wikitext
10590 {{subst:Includes}}
10591 !! html
10592 Foobar
10593 !! end
10594
10595 !! test
10596 pre-save transform: <onlyinclude> in subst (bug 3298)
10597 !! options
10598 pst
10599 !! wikitext
10600 {{subst:Includes2}}
10601 !! html
10602 Foo
10603 !! end
10604
10605 !! article
10606 Template:SubstTest
10607 !!text
10608 {{<includeonly>subst:</includeonly>Includes}}
10609 !! endarticle
10610
10611 !! article
10612 Template:SafeSubstTest
10613 !! text
10614 {{<includeonly>safesubst:</includeonly>Includes}}
10615 !! endarticle
10616
10617 !! test
10618 bug 22297: safesubst: works during PST
10619 !! options
10620 pst
10621 !! wikitext
10622 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
10623 !! html
10624 FoobarFoobar
10625 !! end
10626
10627 !! test
10628 bug 22297: safesubst: works during normal parse
10629 !! wikitext
10630 {{SafeSubstTest}}
10631 !! html
10632 <p>Foobar
10633 </p>
10634 !! end
10635
10636 !! test
10637 subst: does not work during normal parse
10638 !! wikitext
10639 {{SubstTest}}
10640 !! html
10641 <p>{{subst:Includes}}
10642 </p>
10643 !! end
10644
10645 !! test
10646 pre-save transform: context links ("pipe trick")
10647 !! options
10648 pst
10649 !! wikitext
10650 [[Article (context)|]]
10651 [[Bar:Article|]]
10652 [[:Bar:Article|]]
10653 [[Bar:Article (context)|]]
10654 [[:Bar:Article (context)|]]
10655 [[|Article]]
10656 [[|Article (context)]]
10657 [[Bar:X (Y) Z|]]
10658 [[:Bar:X (Y) Z|]]
10659 !! html
10660 [[Article (context)|Article]]
10661 [[Bar:Article|Article]]
10662 [[:Bar:Article|Article]]
10663 [[Bar:Article (context)|Article]]
10664 [[:Bar:Article (context)|Article]]
10665 [[Article]]
10666 [[Article (context)]]
10667 [[Bar:X (Y) Z|X (Y) Z]]
10668 [[:Bar:X (Y) Z|X (Y) Z]]
10669 !! end
10670
10671 !! test
10672 pre-save transform: context links ("pipe trick") with interwiki prefix
10673 !! options
10674 pst
10675 !! wikitext
10676 [[interwiki:Article|]]
10677 [[:interwiki:Article|]]
10678 [[interwiki:Bar:Article|]]
10679 [[:interwiki:Bar:Article|]]
10680 !! html
10681 [[interwiki:Article|Article]]
10682 [[:interwiki:Article|Article]]
10683 [[interwiki:Bar:Article|Bar:Article]]
10684 [[:interwiki:Bar:Article|Bar:Article]]
10685 !! end
10686
10687 !! test
10688 pre-save transform: context links ("pipe trick") with parens in title
10689 !! options
10690 pst title=[[Somearticle (context)]]
10691 !! wikitext
10692 [[|Article]]
10693 !! html
10694 [[Article (context)|Article]]
10695 !! end
10696
10697 !! test
10698 pre-save transform: context links ("pipe trick") with comma in title
10699 !! options
10700 pst title=[[Someplace, Somewhere]]
10701 !! wikitext
10702 [[|Otherplace]]
10703 [[Otherplace, Elsewhere|]]
10704 [[Otherplace, Elsewhere, Anywhere|]]
10705 !! html
10706 [[Otherplace, Somewhere|Otherplace]]
10707 [[Otherplace, Elsewhere|Otherplace]]
10708 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
10709 !! end
10710
10711 !! test
10712 pre-save transform: context links ("pipe trick") with parens and comma
10713 !! options
10714 pst title=[[Someplace (IGNORED), Somewhere]]
10715 !! wikitext
10716 [[|Otherplace]]
10717 [[Otherplace (place), Elsewhere|]]
10718 !! html
10719 [[Otherplace, Somewhere|Otherplace]]
10720 [[Otherplace (place), Elsewhere|Otherplace]]
10721 !! end
10722
10723 !! test
10724 pre-save transform: context links ("pipe trick") with comma and parens
10725 !! options
10726 pst title=[[Who, me? (context)]]
10727 !! wikitext
10728 [[|Yes, you.]]
10729 [[Me, Myself, and I (1937 song)|]]
10730 !! html
10731 [[Yes, you. (context)|Yes, you.]]
10732 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
10733 !! end
10734
10735 !! test
10736 pre-save transform: context links ("pipe trick") with namespace
10737 !! options
10738 pst title=[[Ns:Somearticle]]
10739 !! wikitext
10740 [[|Article]]
10741 !! html
10742 [[Ns:Article|Article]]
10743 !! end
10744
10745 !! test
10746 pre-save transform: context links ("pipe trick") with namespace and parens
10747 !! options
10748 pst title=[[Ns:Somearticle (context)]]
10749 !! wikitext
10750 [[|Article]]
10751 !! html
10752 [[Ns:Article (context)|Article]]
10753 !! end
10754
10755 !! test
10756 pre-save transform: context links ("pipe trick") with namespace and comma
10757 !! options
10758 pst title=[[Ns:Somearticle, Context, Whatever]]
10759 !! wikitext
10760 [[|Article]]
10761 !! html
10762 [[Ns:Article, Context, Whatever|Article]]
10763 !! end
10764
10765 !! test
10766 pre-save transform: context links ("pipe trick") with namespace, comma and parens
10767 !! options
10768 pst title=[[Ns:Somearticle, Context (context)]]
10769 !! wikitext
10770 [[|Article]]
10771 !! html
10772 [[Ns:Article (context)|Article]]
10773 !! end
10774
10775 !! test
10776 pre-save transform: context links ("pipe trick") with namespace, parens and comma
10777 !! options
10778 pst title=[[Ns:Somearticle (IGNORED), Context]]
10779 !! wikitext
10780 [[|Article]]
10781 !! html
10782 [[Ns:Article, Context|Article]]
10783 !! end
10784
10785 !! test
10786 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
10787 !! options
10788 pst
10789 !! wikitext
10790 [[Article(context)|]]
10791 [[Bar:Article(context)|]]
10792 [[:Bar:Article(context)|]]
10793 [[|Article(context)]]
10794 [[Bar:X(Y)Z|]]
10795 [[:Bar:X(Y)Z|]]
10796 !! html
10797 [[Article(context)|Article]]
10798 [[Bar:Article(context)|Article]]
10799 [[:Bar:Article(context)|Article]]
10800 [[Article(context)]]
10801 [[Bar:X(Y)Z|X(Y)Z]]
10802 [[:Bar:X(Y)Z|X(Y)Z]]
10803 !! end
10804
10805 !! test
10806 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
10807 !! options
10808 pst
10809 !! wikitext
10810 [[Article (context)|]]
10811 [[Bar:Article (context)|]]
10812 [[:Bar:Article (context)|]]
10813 [[|Article (context)]]
10814 [[Bar:X (Y) Z|]]
10815 [[:Bar:X (Y) Z|]]
10816 !! html
10817 [[Article (context)|Article]]
10818 [[Bar:Article (context)|Article]]
10819 [[:Bar:Article (context)|Article]]
10820 [[Article (context)]]
10821 [[Bar:X (Y) Z|X (Y) Z]]
10822 [[:Bar:X (Y) Z|X (Y) Z]]
10823 !! end
10824
10825 !! test
10826 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
10827 !! options
10828 pst
10829 !! wikitext
10830 [[Article(context)|]]
10831 [[Bar:Article(context)|]]
10832 [[:Bar:Article(context)|]]
10833 [[|Article(context)]]
10834 [[Bar:X(Y)Z|]]
10835 [[:Bar:X(Y)Z|]]
10836 !! html
10837 [[Article(context)|Article]]
10838 [[Bar:Article(context)|Article]]
10839 [[:Bar:Article(context)|Article]]
10840 [[Article(context)]]
10841 [[Bar:X(Y)Z|X(Y)Z]]
10842 [[:Bar:X(Y)Z|X(Y)Z]]
10843 !! end
10844
10845 !! test
10846 pre-save transform: context links ("pipe trick") with commas (bug 21660)
10847 !! options
10848 pst
10849 !! wikitext
10850 [[Article (context), context|]]
10851 [[Article (context),context|]]
10852 [[Bar:Article (context), context|]]
10853 [[Bar:Article (context),context|]]
10854 [[:Bar:Article (context), context|]]
10855 [[:Bar:Article (context),context|]]
10856 !! html
10857 [[Article (context), context|Article]]
10858 [[Article (context),context|Article]]
10859 [[Bar:Article (context), context|Article]]
10860 [[Bar:Article (context),context|Article]]
10861 [[:Bar:Article (context), context|Article]]
10862 [[:Bar:Article (context),context|Article]]
10863 !! end
10864
10865 !! test
10866 pre-save transform: trim trailing empty lines
10867 !! options
10868 pst
10869 !! wikitext
10870 Empty lines are trimmed
10871
10872
10873
10874
10875 !! html
10876 Empty lines are trimmed
10877 !! end
10878
10879 !! test
10880 pre-save transform: Signature expansion
10881 !! options
10882 pst
10883 !! wikitext
10884 * ~~~
10885 * <noinclude>~~~</noinclude>
10886 * <includeonly>~~~</includeonly>
10887 * <onlyinclude>~~~</onlyinclude>
10888 !! html
10889 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
10890 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
10891 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
10892 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
10893 !! end
10894
10895
10896 !! test
10897 pre-save transform: Signature expansion in nowiki tags (bug 93)
10898 !! options
10899 pst disabled
10900 !! wikitext
10901 Shall not expand:
10902
10903 <nowiki>~~~~</nowiki>
10904
10905 <includeonly><nowiki>~~~~</nowiki></includeonly>
10906
10907 <noinclude><nowiki>~~~~</nowiki></noinclude>
10908
10909 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10910
10911 {{subst:Foo}} shall be converted to FOO
10912
10913 As well as inside noinclude/onlyinclude
10914 <noinclude>{{subst:Foo}}</noinclude>
10915 <onlyinclude>{{subst:Foo}}</onlyinclude>
10916
10917 But not inside includeonly
10918 <includeonly>{{subst:Foo}}</includeonly>
10919 !! html
10920 Shall not expand:
10921
10922 <nowiki>~~~~</nowiki>
10923
10924 <includeonly><nowiki>~~~~</nowiki></includeonly>
10925
10926 <noinclude><nowiki>~~~~</nowiki></noinclude>
10927
10928 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10929
10930 FOO shall be converted to FOO
10931
10932 As well as inside noinclude/onlyinclude
10933 <noinclude>FOO</noinclude>
10934 <onlyinclude>FOO</onlyinclude>
10935
10936 But not inside includeonly
10937 <includeonly>{{subst:Foo}}</includeonly>
10938 !! end
10939
10940 !! test
10941 Parsoid: Recognize nowiki with trailing space in tags
10942 !! options
10943 parsoid=wt2html
10944 !! wikitext
10945 <nowiki ><div>[[foo]]</nowiki >
10946
10947 a<nowiki / >b
10948
10949 c<nowiki />d
10950
10951 e<nowiki/ >f
10952 !! html
10953 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10954 <p>ab</p>
10955 <p>cd</p>
10956 <p>ef</p>
10957 !! end
10958
10959 !! test
10960 Parsoid: Recognize nowiki with odd capitalization
10961 !! options
10962 parsoid=wt2html
10963 !! wikitext
10964 <noWikI ><div>[[foo]]</Nowiki >
10965 !! html
10966 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10967 !! end
10968
10969
10970 !! test
10971 Parsoid: Escape nowiki with trailing space in tags
10972 !! options
10973 parsoid=html2wt
10974 !! wikitext
10975 &lt;nowiki &gt; foo &lt;/nowiki &gt;
10976
10977 a&lt;nowiki /&gt;b
10978
10979 c&lt;nowiki/ &gt;d
10980 !! html
10981 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
10982 <p>a&lt;nowiki /&gt;b</p>
10983 <p>c&lt;nowiki/ &gt;d</p>
10984 !! end
10985
10986 !! test
10987 Parsoid: Escape weird noWikI capitalizations
10988 !! options
10989 parsoid=html2wt
10990 !! wikitext
10991 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
10992 !! html
10993 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
10994 !! end
10995
10996 ###
10997 ### Message transform tests
10998 ###
10999 !! test
11000 message transform: magic variables
11001 !! options
11002 msg
11003 !! wikitext
11004 {{SITENAME}}
11005 !! html
11006 MediaWiki
11007 !! end
11008
11009 !! test
11010 message transform: should not transform wiki markup
11011 !! options
11012 msg
11013 !! wikitext
11014 ''test''
11015 !! html
11016 ''test''
11017 !! end
11018
11019 !! test
11020 message transform: <noinclude> in transcluded template (bug 4926)
11021 !! options
11022 msg
11023 !! wikitext
11024 {{Includes}}
11025 !! html
11026 Foobar
11027 !! end
11028
11029 !! test
11030 message transform: <onlyinclude> in transcluded template (bug 4926)
11031 !! options
11032 msg
11033 !! wikitext
11034 {{Includes2}}
11035 !! html
11036 Foo
11037 !! end
11038
11039 !! test
11040 {{#special:}} page name, known
11041 !! options
11042 msg
11043 !! wikitext
11044 {{#special:Recentchanges}}
11045 !! html
11046 Special:RecentChanges
11047 !! end
11048
11049 !! test
11050 {{#special:}} page name with subpage, known
11051 !! options
11052 msg
11053 !! wikitext
11054 {{#special:Recentchanges/param}}
11055 !! html
11056 Special:RecentChanges/param
11057 !! end
11058
11059 !! test
11060 {{#special:}} page name, unknown
11061 !! options
11062 msg
11063 !! wikitext
11064 {{#special:foobar nonexistent}}
11065 !! html
11066 Special:Foobar nonexistent
11067 !! end
11068
11069 !! test
11070 {{#speciale:}} page name, known
11071 !! options
11072 msg
11073 !! wikitext
11074 {{#speciale:Recentchanges}}
11075 !! html
11076 Special:RecentChanges
11077 !! end
11078
11079 !! test
11080 {{#speciale:}} page name with subpage, known
11081 !! options
11082 msg
11083 !! wikitext
11084 {{#speciale:Recentchanges/param}}
11085 !! html
11086 Special:RecentChanges/param
11087 !! end
11088
11089 !! test
11090 {{#speciale:}} page name, unknown
11091 !! options
11092 msg
11093 !! wikitext
11094 {{#speciale:foobar nonexistent}}
11095 !! html
11096 Special:Foobar_nonexistent
11097 !! end
11098
11099 ###
11100 ### Images
11101 ###
11102 ### For Parsoid-specific tests, see
11103 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11104
11105 !! test
11106 Simple image
11107 !! options
11108 parsoid=wt2html,wt2wt,html2html
11109 !! wikitext
11110 [[Image:foobar.jpg]]
11111 !! html/php
11112 <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>
11113 </p>
11114 !! html/parsoid
11115 <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>
11116 !! end
11117
11118 !! test
11119 Simple image (using File: namespace, now canonical)
11120 !! wikitext
11121 [[File:Foobar.jpg]]
11122 !! html/php
11123 <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>
11124 </p>
11125 !! html/parsoid
11126 <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>
11127 !! end
11128
11129 !! test
11130 Right-aligned image
11131 !! wikitext
11132 [[File:Foobar.jpg|right]]
11133 !! html/php
11134 <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>
11135
11136 !! html/parsoid
11137 <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>
11138 !! end
11139
11140 !! test
11141 Image with caption
11142 !! wikitext
11143 [[File:Foobar.jpg|right|Caption text]]
11144 !! html/php
11145 <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>
11146
11147 !! html/parsoid
11148 <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>
11149 !! end
11150
11151 !! test
11152 Image with caption, bug 53312 #1
11153 !! wikitext
11154 [[File:Foobar.jpg|right|Caption page stuff]]
11155 !! html/php
11156 <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>
11157
11158 !! html/parsoid
11159 <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>
11160 !! end
11161
11162 !! test
11163 Image with caption, bug 53312 #2
11164 !! wikitext
11165 [[File:Foobar.jpg|right|Caption page=]]
11166 !! html/php
11167 <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>
11168
11169 !! html/parsoid
11170 <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>
11171 !! end
11172
11173 !! test
11174 Image with caption, bug 53312 #3
11175 !! wikitext
11176 [[File:Foobar.jpg|right|Caption page=stuff]]
11177 !! html/php
11178 <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>
11179
11180 !! html/parsoid
11181 <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>
11182 !! end
11183
11184 !! test
11185 Allow empty links in image captions (Bug 60753)
11186 !! options
11187 thumbsize=220
11188 !! wikitext
11189 [[File:Foobar.jpg|thumb|Caption [[Link1]]
11190 [[]]
11191 [[Link2]]
11192 ]]
11193 !! html/php
11194 <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>
11195
11196 !! html/parsoid
11197 <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>
11198 [[]]
11199 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
11200 </figcaption></figure>
11201 !! end
11202
11203 !! test
11204 Link with empty target
11205 !! wikitext
11206 [[]]
11207 !! html
11208 <p>[[]]
11209 </p>
11210 !! end
11211
11212 !! test
11213 Image with empty attribute
11214 !! options
11215 parsoid=wt2html,wt2wt,html2html
11216 !! wikitext
11217 [[File:Foobar.jpg|right||Caption text]]
11218 !! html/php
11219 <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>
11220
11221 !! html/parsoid
11222 <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>
11223 !! end
11224
11225 !! test
11226 1. Block image with individual attributes from templates
11227 !! wikitext
11228 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
11229 !! html/php
11230 <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>
11231
11232 !! html/parsoid
11233 <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>
11234 !! end
11235
11236 !! test
11237 2. Block Image with individual attributes from templates
11238 !! wikitext
11239 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
11240 !! html/php
11241 <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>
11242
11243 !! html/parsoid
11244 <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>
11245 !! end
11246
11247 !! test
11248 3. Inline image with individual attributes from templates
11249 !! wikitext
11250 [[File:Foobar.jpg|{{echo|50px}}]]
11251 !! html/php
11252 <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>
11253 </p>
11254 !! html/parsoid
11255 <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>
11256 !! end
11257
11258 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
11259 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
11260 !! test
11261 Image with multiple attributes from the same template
11262 !! wikitext
11263 [[File:Foobar.jpg|{{image_attribs}}]]
11264 !! html/php
11265 <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>
11266
11267 !! html/parsoid
11268 <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>
11269 !! end
11270
11271 !! test
11272 Image with link tails
11273 !! options
11274 thumbsize=220
11275 !! wikitext
11276 123[[File:Foobar.jpg]]456
11277 123[[File:Foobar.jpg|right]]456
11278 123[[File:Foobar.jpg|thumb]]456
11279 !! html/php
11280 <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
11281 </p>
11282 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
11283 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
11284
11285 !! html/php+tidy
11286 <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>
11287 <p>123</p>
11288 <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>
11289 <p>456 123</p>
11290 <div class="thumb tright">
11291 <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>
11292 <div class="thumbcaption">
11293 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11294 </div>
11295 </div>
11296 </div>
11297 <p>456</p>
11298 !! html/parsoid
11299 <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>
11300 <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>
11301 <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>
11302 !! end
11303
11304 !! test
11305 Image with multiple captions -- only last one is accepted
11306 !! wikitext
11307 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11308 !! html/php
11309 <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>
11310
11311 !! html/parsoid
11312 <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>
11313 !! end
11314
11315 !! test
11316 Image with multiple widths -- use last
11317 !! wikitext
11318 [[File:Foobar.jpg|200px|300px|caption]]
11319 !! html/php
11320 <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>
11321 </p>
11322 !! html/parsoid
11323 <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>
11324 !! end
11325
11326 !! test
11327 Image with multiple alignments -- use first (bug 48664)
11328 !! options
11329 thumbsize=220
11330 !! wikitext
11331 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11332
11333 [[File:Foobar.jpg|middle|text-top|caption]]
11334 !! html/php
11335 <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>
11336 <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>
11337 </p>
11338 !! html/parsoid
11339 <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>
11340 <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>
11341 !! end
11342
11343 !! test
11344 Image with width attribute at different positions
11345 !! wikitext
11346 [[File:Foobar.jpg|200px|right|Caption]]
11347 [[File:Foobar.jpg|right|200px|Caption]]
11348 [[File:Foobar.jpg|right|Caption|200px]]
11349 !! html/php
11350 <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>
11351 <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>
11352 <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>
11353
11354 !! html/parsoid
11355 <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>
11356 <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>
11357 <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>
11358 !! end
11359
11360 # a sad bit of backward-compatibility
11361 !! test
11362 Image with size specified with pxpx (bug 13500, 51628)
11363 !! options
11364 parsoid=wt2html,wt2wt,html2html
11365 !! wikitext
11366 [[File:Foobar.jpg|20pxpx]]
11367 [[File:Foobar.jpg|200x20pxpx]]
11368 !! html/php
11369 <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>
11370 <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>
11371 </p>
11372 !! html/parsoid
11373 <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>
11374 !! end
11375
11376 !! test
11377 Image with link parameter, wiki target
11378 !! wikitext
11379 [[File:Foobar.jpg|link=Main Page]]
11380 !! html/php
11381 <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>
11382 </p>
11383 !! html/parsoid
11384 <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>
11385 !! end
11386
11387 # parsoid bug 49293 (part 1)
11388 !! test
11389 Image with link parameter, URL target
11390 !! wikitext
11391 [[File:Foobar.jpg|link=http://example.com/]]
11392 !! html/php
11393 <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>
11394 </p>
11395 !! html/parsoid
11396 <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>
11397 !! end
11398
11399 # parsoid bug 49293 (part 2)
11400 !! test
11401 Image with link parameter, protocol-less URL target
11402 !! wikitext
11403 [[File:Foobar.jpg|link=//example.com/]]
11404 !! html/php
11405 <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>
11406 </p>
11407 !! html/parsoid
11408 <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>
11409 !! end
11410
11411 !! test
11412 Image with link parameter, wgExternalLinkTarget
11413 !! wikitext
11414 [[Image:foobar.jpg|link=http://example.com/]]
11415 !! config
11416 wgExternalLinkTarget='foobar'
11417 !! html
11418 <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>
11419 </p>
11420 !! end
11421
11422 !! test
11423 Image with link parameter, wgNoFollowLinks set to false
11424 !! wikitext
11425 [[Image:foobar.jpg|link=http://example.com/]]
11426 !! config
11427 wgNoFollowLinks=false
11428 !! html
11429 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11430 </p>
11431 !! end
11432
11433 !! test
11434 Image with link parameter, wgNoFollowDomainExceptions
11435 !! wikitext
11436 [[Image:foobar.jpg|link=http://example.com/]]
11437 !! config
11438 wgNoFollowDomainExceptions='example.com'
11439 !! html
11440 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11441 </p>
11442 !! end
11443
11444 !! test
11445 Image with link parameter, wgExternalLinkTarget, unnamed parameter
11446 !! wikitext
11447 [[Image:foobar.jpg|link=http://example.com/|Title]]
11448 !! config
11449 wgExternalLinkTarget='foobar'
11450 !! html
11451 <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>
11452 </p>
11453 !! end
11454
11455 !! test
11456 Image with empty link parameter
11457 !! wikitext
11458 [[File:Foobar.jpg|link=]]
11459 !! html/php
11460 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
11461 </p>
11462 !! html/parsoid
11463 <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>
11464 !! end
11465
11466 !! test
11467 Image with link parameter (wiki target) and unnamed parameter
11468 !! wikitext
11469 [[File:Foobar.jpg|link=Main_Page|Title]]
11470 !! html/php
11471 <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>
11472 </p>
11473 !! html/parsoid
11474 <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>
11475 !! end
11476
11477 !! test
11478 Image with link parameter (URL target) and unnamed parameter
11479 !! wikitext
11480 [[File:Foobar.jpg|link=http://example.com/|Title]]
11481 !! html/php
11482 <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>
11483 </p>
11484 !! html/parsoid
11485 <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>
11486 !! end
11487
11488 !! test
11489 Thumbnail image with link parameter
11490 !! options
11491 thumbsize=220
11492 parsoid=wt2html,wt2wt,html2html
11493 !! wikitext
11494 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
11495 !! html/php
11496 <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>
11497
11498 !! html/parsoid
11499 <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>
11500 !! end
11501
11502 !! test
11503 Manually-specified thumbnail image
11504 !! options
11505 thumbsize=220
11506 !! wikitext
11507 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
11508 !! html/php
11509 <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>
11510
11511 !! html/parsoid
11512 <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>
11513 !! end
11514
11515 !! test
11516 Manually-specified thumbnail image with explicit link to wiki page
11517 !! options
11518 thumbsize=220
11519 parsoid=wt2html,wt2wt,html2html
11520 !! wikitext
11521 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
11522 !! html/php
11523 <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>
11524
11525 !! html/parsoid
11526 <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>
11527 !! end
11528
11529 !! test
11530 Manually-specified thumbnail image with explicit link to url
11531 !! options
11532 thumbsize=220
11533 parsoid=wt2html,wt2wt,html2html
11534 !! wikitext
11535 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
11536 !! html/php
11537 <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>
11538
11539 !! html/parsoid
11540 <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>
11541 !! end
11542
11543 !! test
11544 Manually-specified thumbnail image with explicit no link
11545 !! options
11546 thumbsize=220
11547 parsoid=wt2html,wt2wt,html2html
11548 !! wikitext
11549 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
11550 !! html/php
11551 <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>
11552
11553 !! html/parsoid
11554 <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>
11555 !! end
11556
11557 !! test
11558 Manually-specified thumbnail image with explicit link and alt text
11559 !! options
11560 thumbsize=220
11561 parsoid=wt2html,wt2wt,html2html
11562 !! wikitext
11563 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
11564 !! html/php
11565 <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>
11566
11567 !! html/parsoid
11568 <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>
11569 !! end
11570
11571 !! test
11572 Image with frame and link
11573 !! options
11574 parsoid=wt2html,wt2wt,html2html
11575 !! wikitext
11576 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
11577 !! html/php
11578 <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>
11579
11580 !! html/parsoid
11581 <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>
11582 !! end
11583
11584 !! test
11585 Image with frame and link and explicit alt
11586 !! options
11587 parsoid=wt2html,wt2wt,html2html
11588 !! wikitext
11589 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
11590 !! html/php
11591 <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>
11592
11593 !! html/parsoid
11594 <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>
11595 !! end
11596
11597 !! test
11598 Image with wiki markup in implicit alt
11599 !! options
11600 parsoid=wt2html,wt2wt,html2html
11601 !! wikitext
11602 [[Image:Foobar.jpg|testing '''bold''' in alt]]
11603
11604 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
11605 !! html/php
11606 <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>
11607 </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>
11608 </p>
11609 !! html/parsoid
11610 <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>
11611 <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>
11612 !! end
11613
11614 ###################
11615 # Conflicting image format options.
11616 # First option specified should 'win'.
11617 # All three cases in each test should be identical.
11618
11619 !! test
11620 Image with 'frameless' first.
11621 !! options
11622 parsoid=wt2html,wt2wt,html2html
11623 !! wikitext
11624 [[File:Foobar.jpg|frameless|caption]]
11625
11626 [[File:Foobar.jpg|frameless|frame|caption]]
11627
11628 [[File:Foobar.jpg|frameless|thumb|caption]]
11629 !! html/php
11630 <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>
11631 </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>
11632 </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>
11633 </p>
11634 !! html/parsoid
11635 <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>
11636 <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>
11637 <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>
11638 !! end
11639
11640 !! test
11641 Image with 'frame' first.
11642 !! options
11643 parsoid=wt2html,wt2wt,html2html
11644 !! wikitext
11645 [[File:Foobar.jpg|frame|caption]]
11646 [[File:Foobar.jpg|frame|frameless|caption]]
11647 [[File:Foobar.jpg|frame|thumb|caption]]
11648 !! html/php
11649 <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>
11650 <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>
11651 <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>
11652
11653 !! html/parsoid
11654 <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>
11655 <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>
11656 <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>
11657 !! end
11658
11659 !! test
11660 Image with 'thumb' first.
11661 !! options
11662 parsoid=wt2html,wt2wt,html2html
11663 !! wikitext
11664 [[File:Foobar.jpg|thumb|caption]]
11665 [[File:Foobar.jpg|thumb|frameless|caption]]
11666 [[File:Foobar.jpg|thumb|frame|caption]]
11667 !! html/php
11668 <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>
11669 <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>
11670 <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>
11671
11672 !! html/parsoid
11673 <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>
11674 <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>
11675 <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>
11676 !! end
11677
11678 ###################
11679 # Image sizing.
11680 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
11681 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
11682 # Foobar has actual size of 1941x220
11683 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
11684 # a scalable format.
11685 # 2. Framed images always ignore size options; always render at default size.
11686 # 3. "Unspecified format" and border are the only types which can be
11687 # enlarged.
11688
11689 !! test
11690 Image: "unspecified format" and border enlarge
11691 !! options
11692 parsoid=wt2html,wt2wt,html2html
11693 !! wikitext
11694 [[File:Foobar.jpg|2000px]]
11695
11696 [[File:Foobar.jpg|border|2000px]]
11697 !! html/php
11698 <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>
11699 </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>
11700 </p>
11701 !! html/parsoid
11702 <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>
11703 <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>
11704 !! end
11705
11706 !! test
11707 Image: "unspecified format" and border reduce
11708 !! options
11709 parsoid=wt2html,wt2wt,html2html
11710 !! wikitext
11711 [[File:Foobar.jpg|1000px]]
11712
11713 [[File:Foobar.jpg|border|1000px]]
11714 !! html/php
11715 <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>
11716 </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>
11717 </p>
11718 !! html/parsoid
11719 <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>
11720 <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>
11721 !! end
11722
11723 !! test
11724 Image: thumbs reduce
11725 !! options
11726 parsoid=wt2html,wt2wt,html2html
11727 !! wikitext
11728 [[File:Foobar.jpg|thumb|50px]]
11729 !! html/php
11730 <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>
11731
11732 !! html/parsoid
11733 <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>
11734 !! end
11735
11736 !! test
11737 Image: bitmap thumbs can't be enlarged past original size, but vector can.
11738 !! options
11739 parsoid=wt2html,wt2wt,html2html
11740 !! wikitext
11741 [[File:Foobar.jpg|thumb|2000px]]
11742
11743 [[File:Foobar.svg|thumb|2000px]]
11744 !! html/php
11745 <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>
11746 <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>
11747
11748 !! html/parsoid
11749 <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>
11750 <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>
11751 !! end
11752
11753 !! test
11754 Image: frameless can reduce in size
11755 !! options
11756 parsoid=wt2html,wt2wt,html2html
11757 !! wikitext
11758 [[File:Foobar.jpg|frameless|50px]]
11759 !! html/php
11760 <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>
11761 </p>
11762 !! html/parsoid
11763 <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>
11764 !! end
11765
11766 !! test
11767 Image: bitmap frameless can't be enlarged past original size, but vector can
11768 !! options
11769 parsoid=wt2html,wt2wt,html2html
11770 !! wikitext
11771 [[File:Foobar.jpg|frameless|2000px]]
11772
11773 [[File:Foobar.svg|frameless|2000px]]
11774 !! html/php
11775 <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>
11776 </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>
11777 </p>
11778 !! html/parsoid
11779 <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>
11780 <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>
11781 !! end
11782
11783 !! test
11784 Image: framed images are always unscaled.
11785 !! options
11786 parsoid=wt2html,wt2wt,html2html
11787 !! wikitext
11788 [[File:Foobar.jpg|frame]]
11789
11790 [[File:Foobar.jpg|frame|50px]]
11791
11792 [[File:Foobar.jpg|frame|50x50px]]
11793
11794 [[File:Foobar.jpg|frame|2000px]]
11795 !! html/php
11796 <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>
11797 <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>
11798 <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>
11799 <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>
11800
11801 !! html/parsoid
11802 <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>
11803 <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>
11804 <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>
11805 <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>
11806 !! end
11807
11808 ###################
11809
11810 !! test
11811 Link to image page- image page normally doesn't exists, hence edit link
11812 Add test with existing image page
11813 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
11814 !! wikitext
11815 [[:Image:test]]
11816 !! html
11817 <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>
11818 </p>
11819 !! end
11820
11821 !! test
11822 bug 18784 Link to non-existent image page with caption should use caption as link text
11823 !! wikitext
11824 [[:Image:test|caption]]
11825 !! html
11826 <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>
11827 </p>
11828 !! end
11829
11830 !! test
11831 Frameless image caption with a free URL
11832 !! wikitext
11833 [[File:Foobar.jpg|http://example.com]]
11834 !! html/php
11835 <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>
11836 </p>
11837 !! html/parsoid
11838 <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>
11839 !! end
11840
11841 !! test
11842 Thumbnail image caption with a free URL
11843 !! options
11844 thumbsize=220
11845 !! wikitext
11846 [[File:Foobar.jpg|thumb|http://example.com]]
11847 !! html/php
11848 <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>
11849
11850 !! html/parsoid
11851 <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>
11852 !! end
11853
11854 !! test
11855 Thumbnail image caption with a free URL and explicit alt
11856 !! options
11857 thumbsize=220
11858 parsoid=wt2html,wt2wt,html2html
11859 !! wikitext
11860 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
11861 !! html/php
11862 <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>
11863
11864 !! html/parsoid
11865 <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>
11866 !! end
11867
11868 !! test
11869 SVG thumbnails with no language set
11870 !! options
11871 !! wikitext
11872 [[File:Foobar.svg|thumb|caption]]
11873 !! html/php
11874 <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>
11875
11876 !! html/parsoid
11877 <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>
11878 !! end
11879
11880 !! test
11881 SVG thumbnails with language de
11882 !! options
11883 parsoid=wt2html,wt2wt,html2html
11884 !! wikitext
11885 [[File:Foobar.svg|thumb|caption|lang=de]]
11886 !! html/php
11887 <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>
11888
11889 !! html/parsoid
11890 <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>
11891 !! end
11892
11893 !! test
11894 SVG thumbnails with invalid language code
11895 !! options
11896 parsoid=wt2html,wt2wt,html2html
11897 !! wikitext
11898 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
11899 !! html/php
11900 <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>
11901
11902 !! html/parsoid
11903 <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>
11904 !! end
11905
11906 !! test
11907 BUG 1887: A ISBN with a thumbnail
11908 !! wikitext
11909 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
11910 !! html/php
11911 <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>
11912
11913 !! html/parsoid
11914 <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>
11915 !! end
11916
11917 !! test
11918 BUG 1887: A RFC with a thumbnail
11919 !! wikitext
11920 [[File:Foobar.jpg|thumb|This is RFC 12354]]
11921 !! html/php
11922 <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>
11923
11924 !! html/parsoid
11925 <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>
11926 !! end
11927
11928 !! test
11929 BUG 1887: A mailto link with a thumbnail
11930 !! wikitext
11931 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
11932 !! html/php
11933 <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>
11934
11935 !! html/parsoid
11936 <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>
11937 !! end
11938
11939 # Pending resolution to bug 368
11940 !! test
11941 BUG 648: Frameless image caption with a link
11942 !! wikitext
11943 [[File:Foobar.jpg|text with a [[link]] in it]]
11944 !! html/php
11945 <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>
11946 </p>
11947 !! html/parsoid
11948 <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>
11949 !! end
11950
11951 !! test
11952 BUG 648: Frameless image caption with a link (suffix)
11953 !! wikitext
11954 [[File:Foobar.jpg|text with a [[link]]foo in it]]
11955 !! html/php
11956 <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>
11957 </p>
11958 !! html/parsoid
11959 <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>
11960 !! end
11961
11962 !! test
11963 BUG 648: Frameless image caption with an interwiki link
11964 !! wikitext
11965 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
11966 !! html/php
11967 <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>
11968 </p>
11969 !! html/parsoid
11970 <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>
11971 !! end
11972
11973 !! test
11974 BUG 648: Frameless image caption with a piped interwiki link
11975 !! wikitext
11976 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
11977 !! html/php
11978 <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>
11979 </p>
11980 !! html/parsoid
11981 <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>
11982 !! end
11983
11984 !! test
11985 Escape HTML special chars in image alt text
11986 !! wikitext
11987 [[File:Foobar.jpg|& < > "]]
11988 !! html/php
11989 <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>
11990 </p>
11991 !! html/parsoid
11992 <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>
11993 !! end
11994
11995 !! test
11996 BUG 499: Alt text should have &#1234;, not &amp;1234;
11997 !! wikitext
11998 [[File:Foobar.jpg|&#9792;]]
11999 !! html/php
12000 <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>
12001 </p>
12002 !! html/parsoid
12003 <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>
12004 !! end
12005
12006 !! test
12007 Broken image caption with link
12008 !! options
12009 parsoid=wt2html,wt2wt,html2html
12010 !! wikitext
12011 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
12012 !! html/php
12013 <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.
12014 </p>
12015 !! html/parsoid
12016 <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>
12017 !! end
12018
12019 !! test
12020 Image caption containing another image
12021 !! wikitext
12022 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
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>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>
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>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>
12028 !! end
12029
12030 !! test
12031 Image: caption containing a newline
12032 !! wikitext
12033 [[File:Foobar.jpg|This
12034 *is some text]]
12035 !! html/php
12036 <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>
12037 </p>
12038 !! html/parsoid
12039 <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>
12040 !!end
12041
12042 !!test
12043 Image: caption containing leading space
12044 (The leading space should not trigger nowiki escaping in wt2wt mode)
12045 !! wikitext
12046 [[File:Foobar.jpg|thumb| bar]]
12047 !! html/php
12048 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>bar</div></div></div>
12049
12050 !! html/parsoid
12051 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
12052 !!end
12053
12054 !! test
12055 Image: caption containing a table
12056 !! options
12057 parsoid=wt2html,wt2wt,html2html
12058 !! wikitext
12059 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
12060 {|
12061 ! Foo !! Bar
12062 |-
12063 | Foo1 || Bar1
12064 |}
12065 and some more text.]]
12066 !! html/php
12067 <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>
12068
12069 !! html/parsoid
12070 <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
12071 <table>
12072 <tbody>
12073 <tr><th>Foo </th><th>Bar</th></tr>
12074 <tr>
12075 <td>Foo1 </td>
12076 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
12077 !! end
12078
12079 !! test
12080 Bug 3090: External links other than http: in image captions
12081 !! wikitext
12082 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
12083 !! html/php
12084 <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>
12085
12086 !! html/parsoid
12087 <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>
12088 !! end
12089
12090 !! test
12091 Custom class
12092 !! options
12093 parsoid=wt2html,wt2wt,html2html
12094 !! wikitext
12095 [[Image:foobar.jpg|a|class=b]]
12096 !! html/php
12097 <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>
12098 </p>
12099 !! html/parsoid
12100 <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>
12101 !! end
12102
12103 !! test
12104 Localized image handling (1).
12105 !! options
12106 parsoid=wt2html,wt2wt,html2html
12107 language=es
12108 !! wikitext
12109 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
12110 !! html/php
12111 <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>
12112
12113 !! html/parsoid
12114 <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>
12115 !! end
12116
12117 !! test
12118 Localized image handling (2).
12119 !! options
12120 thumbsize=220
12121 parsoid=wt2html,wt2wt,html2html
12122 language=es
12123 !! wikitext
12124 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
12125 !! html/php
12126 <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>
12127
12128 !! html/parsoid
12129 <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>
12130 !! end
12131
12132 !! test
12133 "border", "frameless" and "class" attributes on an image.
12134 !! options
12135 thumbsize=220
12136 parsoid=wt2html,wt2wt,html2html
12137 !! wikitext
12138 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
12139 !! html/php
12140 <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>
12141 </p>
12142 !! html/parsoid
12143 <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>
12144 !! end
12145
12146 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
12147 !! test
12148 Invalid image attributes (bug 62500)
12149 !! options
12150 thumbsize=220
12151 parsoid=wt2html,wt2wt,html2html
12152 !! wikitext
12153 [[File:Foobar.jpg|thumb|float|left|caption]]
12154
12155 [[File:Foobar.jpg|thumb|righ|caption]]
12156
12157 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
12158 !! html/php
12159 <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>
12160 <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>
12161 <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>
12162
12163 !! html/parsoid
12164 <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>
12165 <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>
12166 <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>
12167 !! end
12168
12169 !! article
12170 File:Barfoo.jpg
12171 !! text
12172 #REDIRECT [[File:Barfoo.jpg]]
12173 !! endarticle
12174
12175 # FIXME: Parsoid should run this test -- but we'd need to teach the
12176 # mockAPI about the redirected Barfoo.jpg image.
12177 !! test
12178 Redirected image
12179 !! wikitext
12180 [[Image:Barfoo.jpg]]
12181 !! html/php
12182 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
12183 </p>
12184 !! end
12185
12186 !! test
12187 Missing image with uploads disabled
12188 !! options
12189 wgEnableUploads=0
12190 !! wikitext
12191 [[File:Foobaz.jpg]]
12192 !! html/php
12193 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
12194 </p>
12195 !! html/parsoid
12196 <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>
12197 !! end
12198
12199 # Parsoid-specific testing for images
12200 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12201 # Currently imperfect due to a flaw in the Parsoid testrunner
12202 # Work in progress
12203 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
12204 # image tests.
12205
12206 !! test
12207 Parsoid-specific image handling - simple image with size and middle alignment
12208 !! wikitext
12209 [[File:Foobar.jpg|middle|50px]]
12210 !! html/parsoid
12211 <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>
12212 !! end
12213
12214 !! test
12215 Parsoid-specific image handling - simple image with size, middle alignment,
12216 non-standard namespace alias
12217 !! options
12218 parsoid=wt2wt,wt2html,html2html
12219 !! wikitext
12220 [[Image:Foobar.jpg|middle|50px]]
12221 !! html/parsoid
12222 <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>
12223 !! end
12224
12225 !! test
12226 Parsoid-specific image handling - simple image with size and middle alignment
12227 (existing content)
12228 !! wikitext
12229 [[File:Foobar.jpg|50px|middle]]
12230 !! html/parsoid
12231 <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>
12232 !! end
12233
12234 !! test
12235 Parsoid-specific image handling - simple image with size and middle alignment
12236 and non-standard namespace name
12237 !! options
12238 parsoid=wt2html,wt2wt,html2html
12239 !! wikitext
12240 [[Image:Foobar.jpg|50px|middle]]
12241 !! html/parsoid
12242 <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>
12243 !! end
12244
12245 !! test
12246 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
12247 !! wikitext
12248 [[File:Foobar.jpg|500x10px|baseline|caption]]
12249 !! html/parsoid
12250 <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>
12251 !! end
12252
12253 !! test
12254 Parsoid-specific image handling - simple image with border and size spec
12255 !! wikitext
12256 [[File:Foobar.jpg|50px|border|caption]]
12257 !! html/parsoid
12258 <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>
12259 !! end
12260
12261 !! test
12262 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12263 !! wikitext
12264 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
12265 !! html/parsoid
12266 <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>
12267 !! end
12268
12269 !! test
12270 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12271 (existing content)
12272 !! wikitext
12273 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12274 !! html/parsoid
12275 <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>
12276 !! end
12277
12278 !! test
12279 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12280 !! wikitext
12281 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12282 !! html/parsoid
12283 <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>
12284 !! end
12285
12286 !! test
12287 Parsoid-specific image handling - thumbnail with specific size, halign,
12288 valign, and caption (existing content)
12289 !! wikitext
12290 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12291 !! html/parsoid
12292 <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>
12293 !! end
12294
12295 !! test
12296 Parsoid-specific image handling - framed image with specific size and caption
12297 (size is ignored)
12298 !! options
12299 parsoid=wt2html,wt2wt,html2html
12300 !! wikitext
12301 [[File:Foobar.jpg|frame|500x50px|caption]]
12302 !! html/parsoid
12303 <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>
12304 !! end
12305
12306 !! test
12307 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12308 (size is ignored)
12309 !! options
12310 parsoid=wt2html,wt2wt,html2html
12311 !! wikitext
12312 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12313 !! html/parsoid
12314 <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>
12315 !! end
12316
12317 !! test
12318 Parsoid-specific image handling - frameless image with specific size, border, and caption
12319 !! wikitext
12320 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12321 !! html/parsoid
12322 <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>
12323 !! end
12324
12325 !! test
12326 Parsoid-specific image handling - simple image with a formatted caption
12327 !! wikitext
12328 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12329 !! html/parsoid
12330 <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>
12331 !! end
12332
12333 !! test
12334 Parsoid-specific image handling - caption with a template in it
12335 !! wikitext
12336 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12337 !! html/parsoid
12338 <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>
12339 !! end
12340
12341 !! test
12342 Parsoid-specific image handling - caption with unbalanced tags in it
12343 !! options
12344 parsoid=wt2html,wt2wt,html2html
12345 !! wikitext
12346 foo
12347 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12348 bar
12349 !! html/parsoid
12350 <p>foo</p>
12351 <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>
12352 <p>bar</p>
12353 !! end
12354
12355 !! test
12356 Parsoid-specific image handling - empty caption (1)
12357 !! options
12358 parsoid=wt2html,wt2wt
12359 !! wikitext
12360 [[File:Foobar.jpg|thumb|]]
12361 !! html/parsoid
12362 <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>
12363 !! end
12364
12365 # empty captions don't get serialized unless we're in the "round trip" case
12366 !! test
12367 Parsoid-specific image handling - empty caption (2)
12368 !! options
12369 parsoid=html2wt
12370 !! html/parsoid
12371 <figure class="mw-default-size" typeof="mw:Image/Thumb">
12372 <a href="File:Foobar.jpg">
12373 <img resource="./File:Foobar.jpg"
12374 src="//example.com/images/3/3a/Foobar.jpg"
12375 height="25" width="220"/>
12376 </a>
12377 <figcaption></figcaption>
12378 </figure>
12379 !! wikitext
12380 [[File:Foobar.jpg|thumb]]
12381 !! end
12382
12383 !! test
12384 Parsoid-specific image handling - whitespace caption
12385 !! wikitext
12386 [[File:Foobar.jpg|thumb| ]]
12387 !! html/parsoid
12388 <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>
12389 !! end
12390
12391 !! test
12392 Parsoid-specific image handling - lang option
12393 !! wikitext
12394 foo
12395 [[File:Foobar.svg|lang=de|caption]]
12396 bar
12397 !! html/parsoid
12398 <p>foo
12399 <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>
12400 bar</p>
12401 !! end
12402
12403
12404 ###
12405 ### Subpages
12406 ###
12407 !! article
12408 Subpage test/subpage
12409 !! text
12410 foo
12411 !! endarticle
12412
12413 !! test
12414 Subpage link
12415 !! options
12416 subpage title=[[Subpage test]]
12417 !! wikitext
12418 [[/subpage]]
12419 !! html
12420 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
12421 </p>
12422 !! end
12423
12424 !! test
12425 Subpage noslash link
12426 !! options
12427 subpage title=[[Subpage test]]
12428 !! wikitext
12429 [[/subpage/]]
12430 !! html
12431 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
12432 </p>
12433 !! end
12434
12435 !! article
12436 Subpage test/1/2/subpage
12437 !! text
12438 blah
12439 !! endarticle
12440
12441 !! test
12442 Relative subpage noslash link
12443 !! options
12444 parsoid=wt2wt,wt2html,html2html
12445 subpage title=[[Subpage test/1/2/3/4]]
12446 !! wikitext
12447 [[../../subpage/]]
12448
12449 [[../../subpage]]
12450 !! html/php
12451 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
12452 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
12453 </p>
12454 !! html/parsoid
12455 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
12456 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
12457 !! end
12458
12459 !! test
12460 Parsoid: dot-slash prefixed wikilinks
12461 !! wikitext
12462 [[./foo]]
12463
12464 [[././bar]]
12465
12466 [[././baz/]]
12467 !! html/php
12468 <p>[[./foo]]
12469 </p><p>[[././bar]]
12470 </p><p>[[././baz/]]
12471 </p>
12472 !! html/parsoid
12473 <p>[[./foo]]
12474 </p><p>[[././bar]]
12475 </p><p>[[././baz/]]
12476 </p>
12477 !! end
12478
12479 !! test
12480 Render invalid page names as plain text (bug 51090)
12481 !! wikitext
12482 [[./../foo|bar]]
12483 [[foo�|bar]]
12484 [[foo/.|bar]]
12485 [[foo/..|bar]]
12486 [[foo~~~bar]]
12487 [[foo>bar]]
12488 [[foo[bar]]
12489 [[.]]
12490 [[..]]
12491 [[foo././bar]]
12492
12493 [[{{echo|./../foo}}|bar]]
12494 [[{{echo|foo/.}}|bar]]
12495 [[{{echo|foo/..}}|bar]]
12496 [[{{echo|foo~~~~bar}}]]
12497 [[{{echo|foo>bar}}]]
12498 [[{{echo|foo././bar}}]]
12499 [[{{echo|foo{bar}}]]
12500 [[{{echo|foo}bar}}]]
12501 [[{{echo|foo[bar}}]]
12502 [[{{echo|foo]bar}}]]
12503 [[{{echo|foo<bar}}]]
12504 !!html/php
12505 <p>[[./../foo|bar]]
12506 [[foo�|bar]]
12507 [[foo/.|bar]]
12508 [[foo/..|bar]]
12509 [[foo~~~bar]]
12510 [[foo&gt;bar]]
12511 [[foo[bar]]
12512 [[.]]
12513 [[..]]
12514 [[foo././bar]]
12515 </p><p>[[./../foo|bar]]
12516 [[foo/.|bar]]
12517 [[foo/..|bar]]
12518 [[foo~~~~bar]]
12519 [[foo&gt;bar]]
12520 [[foo././bar]]
12521 [[foo{bar]]
12522 [[foo}bar]]
12523 [[foo[bar]]
12524 [[foo]bar]]
12525 [[foo&lt;bar]]
12526 </p>
12527 !!html/parsoid
12528 <p>[[./../foo|bar]]
12529 [[foo�|bar]]
12530 [[foo/.|bar]]
12531 [[foo/..|bar]]
12532 [[foo~~~bar]]
12533 [[foo>bar]]
12534 [[foo[bar]]
12535 [[.]]
12536 [[..]]
12537 [[foo././bar]]</p>
12538
12539 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
12540 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
12541 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
12542 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
12543 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
12544 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
12545 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
12546 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
12547 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
12548 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
12549 [[<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>
12550 !!end
12551
12552 !! test
12553 Disabled subpages
12554 !! wikitext
12555 [[/subpage]]
12556 !! html
12557 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
12558 </p>
12559 !! end
12560
12561 !! test
12562 BUG 561: {{/Subpage}}
12563 !! options
12564 subpage title=[[Page]]
12565 !! wikitext
12566 {{/Subpage}}
12567 !! html
12568 <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>
12569 </p>
12570 !! end
12571
12572 ###
12573 ### Categories
12574 ###
12575 !! article
12576 Category:MediaWiki User's Guide
12577 !! text
12578 blah
12579 !! endarticle
12580
12581 !! test
12582 Link to category
12583 !! wikitext
12584 [[:Category:MediaWiki User's Guide]]
12585 !! html
12586 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
12587 </p>
12588 !! end
12589
12590 !! test
12591 Simple category
12592 !! options
12593 cat
12594 !! wikitext
12595 [[Category:MediaWiki User's Guide]]
12596 !! html
12597 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12598 !! end
12599
12600 !! test
12601 PAGESINCATEGORY invalid title fatal (r33546 fix)
12602 !! wikitext
12603 {{PAGESINCATEGORY:<bogus>}}
12604 !! html
12605 <p>0
12606 </p>
12607 !! end
12608
12609 !! test
12610 Category with different sort key
12611 !! options
12612 cat
12613 !! wikitext
12614 [[Category:MediaWiki User's Guide|Foo]]
12615 !! html
12616 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12617 !! end
12618
12619 !! test
12620 Category with identical sort key
12621 !! options
12622 cat
12623 !! wikitext
12624 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12625 !! html
12626 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12627 !! end
12628
12629 !! test
12630 Category with empty sort key
12631 !! options
12632 cat
12633 pst
12634 !! wikitext
12635 [[Category:MediaWiki User's Guide|]]
12636 !! html
12637 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12638 !! end
12639
12640 !! test
12641 Category with empty sort key and parentheses
12642 !! options
12643 cat
12644 pst
12645 !! wikitext
12646 [[Category:Foo (bar)|]]
12647 !! html
12648 [[Category:Foo (bar)|Foo]]
12649 !! end
12650
12651 !! test
12652 Category with link tail
12653 !! options
12654 cat
12655 pst
12656 !! wikitext
12657 123[[Category:Foo]]456
12658 !! html
12659 123[[Category:Foo]]456
12660 !! end
12661
12662 !! test
12663 Category with template
12664 !! options
12665 cat
12666 pst
12667 !! wikitext
12668 [[Category:{{echo|Foo}}]]
12669 !! html
12670 [[Category:{{echo|Foo}}]]
12671 !! end
12672
12673 !! test
12674 Category with template in sort key
12675 !! options
12676 cat
12677 pst
12678 !! wikitext
12679 [[Category:Foo|{{echo|Bar}}]]
12680 !! html
12681 [[Category:Foo|{{echo|Bar}}]]
12682 !! end
12683
12684 !! test
12685 Category with template in sort key and title
12686 !! options
12687 cat
12688 pst
12689 !! wikitext
12690 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12691 !! html
12692 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12693 !! end
12694
12695 !! test
12696 Category / paragraph interactions
12697 !! wikitext
12698 Foo [[Category:Baz]] Bar
12699
12700 Foo [[Category:Baz]]
12701 Bar
12702
12703 Foo
12704 [[Category:Baz]]
12705 Bar
12706
12707 Foo
12708 [[Category:Baz]] Bar
12709
12710 Foo
12711 [[Category:Baz]]
12712 [[Category:Baz]]
12713 [[Category:Baz]]
12714 Bar
12715
12716 [[Category:Baz]]
12717 [[Category:Baz]]
12718 [[Category:Baz]]
12719
12720 [[Category:Baz]]
12721 {{echo|[[Category:Baz]]}}
12722 [[Category:Baz]]
12723 !! html
12724 <p>Foo Bar
12725 </p><p>Foo
12726 Bar
12727 </p><p>Foo
12728 Bar
12729 </p><p>Foo Bar
12730 </p><p>Foo
12731 Bar
12732 </p>
12733 !! end
12734
12735 !! test
12736 Parsoid: Serialize link to category page with colon escape
12737 !! options
12738 parsoid
12739 !! wikitext
12740
12741 [[:Category:Foo]]
12742 [[:Category:Foo|Bar]]
12743 !! html
12744 <p>
12745 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
12746 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
12747 </p>
12748 !! end
12749
12750 !! test
12751 Parsoid: Link prefix/suffixes aren't applied to category links
12752 !! options
12753 parsoid=wt2html,wt2wt,html2html
12754 language=is
12755 !! wikitext
12756 x[[Category:Foo]]y
12757 !! html
12758 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
12759 !! end
12760
12761 !! test
12762 Parsoid: Serialize link to file page with colon escape
12763 !! options
12764 parsoid
12765 !! wikitext
12766
12767 [[:File:Foo.png]]
12768 [[:File:Foo.png|Bar]]
12769 !! html
12770 <p>
12771 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
12772 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
12773 </p>
12774 !! end
12775
12776 !! test
12777 Parsoid: Serialize a genuine category link without colon escape
12778 !! options
12779 parsoid
12780 !! wikitext
12781 [[Category:Foo]]
12782 [[Category:Foo|Bar]]
12783 !! html
12784 <link rel="mw:PageProp/Category" href="Category:Foo">
12785 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
12786 !! end
12787
12788 !! test
12789 Normalize hrefs properly before testing for invalid link targets (bug 70894)
12790 !! options
12791 parsoid=html2wt
12792 !! html
12793 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
12794 !! wikitext
12795 [[Category:Toxine bactérienne]]
12796 !! end
12797
12798 !! test
12799 Parsoid: Defaultsort
12800 !! options
12801 parsoid
12802 !! wikitext
12803 {{DEFAULTSORT:Foo}}
12804 !! html
12805 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
12806 !! end
12807
12808 ###
12809 ### Inter-language links
12810 ###
12811 !! test
12812 Interlanguage links
12813 !! options
12814 ill
12815 !! wikitext
12816 [[es:Alimento]]
12817 [[fr:Nourriture]]
12818 [[zh:食品]]
12819 !! html/php
12820 es:Alimento fr:Nourriture zh:食品
12821 !! html/parsoid
12822 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
12823 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
12824 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
12825 !! end
12826
12827 !! test
12828 Duplicate interlanguage links (bug 24502)
12829 !! options
12830 ill
12831 !! wikitext
12832 [[es:1]]
12833 [[es:2]]
12834 [[fr:1]]
12835 [[fr:2]]
12836 !! html/php
12837 es:1 fr:1
12838 !! html/parsoid
12839 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
12840 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
12841 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
12842 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
12843 !! end
12844
12845 ###
12846 ### Sections
12847 ###
12848 !! test
12849 Basic section headings
12850 !! wikitext
12851 == Headline 1 ==
12852 Some text
12853
12854 ==Headline 2==
12855 More
12856 ===Smaller headline===
12857 Blah blah
12858 !! html
12859 <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>
12860 <p>Some text
12861 </p>
12862 <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>
12863 <p>More
12864 </p>
12865 <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>
12866 <p>Blah blah
12867 </p>
12868 !! end
12869
12870 !! test
12871 Section headings with TOC
12872 !! wikitext
12873 == Headline 1 ==
12874 === Subheadline 1 ===
12875 ===== Skipping a level =====
12876 ====== Skipping a level ======
12877
12878 == Headline 2 ==
12879 Some text
12880 ===Another headline===
12881 !! html
12882 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12883 <ul>
12884 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
12885 <ul>
12886 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
12887 <ul>
12888 <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>
12889 <ul>
12890 <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>
12891 </ul>
12892 </li>
12893 </ul>
12894 </li>
12895 </ul>
12896 </li>
12897 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
12898 <ul>
12899 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
12900 </ul>
12901 </li>
12902 </ul>
12903 </div>
12904
12905 <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>
12906 <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>
12907 <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>
12908 <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>
12909 <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>
12910 <p>Some text
12911 </p>
12912 <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>
12913
12914 !! end
12915
12916 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
12917 !! test
12918 Handling of sections up to level 6 and beyond
12919 !! wikitext
12920 = Level 1 Heading=
12921 == Level 2 Heading==
12922 === Level 3 Heading===
12923 ==== Level 4 Heading====
12924 ===== Level 5 Heading=====
12925 ====== Level 6 Heading======
12926 ======= Level 7 Heading=======
12927 ======== Level 8 Heading========
12928 ========= Level 9 Heading=========
12929 ========== Level 10 Heading==========
12930 !! html
12931 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12932 <ul>
12933 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
12934 <ul>
12935 <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>
12936 <ul>
12937 <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>
12938 <ul>
12939 <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>
12940 <ul>
12941 <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>
12942 <ul>
12943 <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>
12944 <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>
12945 <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>
12946 <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>
12947 <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>
12948 </ul>
12949 </li>
12950 </ul>
12951 </li>
12952 </ul>
12953 </li>
12954 </ul>
12955 </li>
12956 </ul>
12957 </li>
12958 </ul>
12959 </div>
12960
12961 <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>
12962 <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>
12963 <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>
12964 <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>
12965 <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>
12966 <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>
12967 <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>
12968 <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>
12969 <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>
12970 <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>
12971
12972 !! end
12973
12974 !! test
12975 TOC regression (bug 9764)
12976 !! wikitext
12977 == title 1 ==
12978 === title 1.1 ===
12979 ==== title 1.1.1 ====
12980 === title 1.2 ===
12981 == title 2 ==
12982 === title 2.1 ===
12983 !! html
12984 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12985 <ul>
12986 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12987 <ul>
12988 <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>
12989 <ul>
12990 <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>
12991 </ul>
12992 </li>
12993 <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>
12994 </ul>
12995 </li>
12996 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12997 <ul>
12998 <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>
12999 </ul>
13000 </li>
13001 </ul>
13002 </div>
13003
13004 <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>
13005 <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>
13006 <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>
13007 <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>
13008 <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>
13009 <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>
13010
13011 !! end
13012
13013 !! test
13014 TOC with wgMaxTocLevel=3 (bug 6204)
13015 !! options
13016 wgMaxTocLevel=3
13017 !! wikitext
13018 == title 1 ==
13019 === title 1.1 ===
13020 ==== title 1.1.1 ====
13021 === title 1.2 ===
13022 == title 2 ==
13023 === title 2.1 ===
13024 !! html
13025 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13026 <ul>
13027 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13028 <ul>
13029 <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>
13030 <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>
13031 </ul>
13032 </li>
13033 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13034 <ul>
13035 <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>
13036 </ul>
13037 </li>
13038 </ul>
13039 </div>
13040
13041 <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>
13042 <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>
13043 <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>
13044 <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>
13045 <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>
13046 <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>
13047
13048 !! end
13049
13050 !! test
13051 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
13052 !! options
13053 wgMaxTocLevel=3
13054 !! wikitext
13055 ==Section 1==
13056 ===Section 1.1===
13057 ====Section 1.1.1====
13058 ====Section 1.1.1.1====
13059 ==Section 2==
13060 !! html
13061 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13062 <ul>
13063 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
13064 <ul>
13065 <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>
13066 </ul>
13067 </li>
13068 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
13069 </ul>
13070 </div>
13071
13072 <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>
13073 <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>
13074 <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>
13075 <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>
13076 <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>
13077
13078 !! end
13079
13080
13081 !! test
13082 Resolving duplicate section names
13083 !! wikitext
13084 == Foo bar ==
13085 == Foo bar ==
13086 !! html
13087 <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>
13088 <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>
13089
13090 !! end
13091
13092 !! test
13093 Resolving duplicate section names with differing case (bug 10721)
13094 !! wikitext
13095 == Foo bar ==
13096 == Foo Bar ==
13097 !! html
13098 <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>
13099 <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>
13100
13101 !! end
13102
13103 !! article
13104 Template:sections
13105 !! text
13106 ===Section 1===
13107 ==Section 2==
13108 !! endarticle
13109
13110 !! test
13111 Template with sections, __NOTOC__
13112 !! wikitext
13113 __NOTOC__
13114 ==Section 0==
13115 {{sections}}
13116 ==Section 4==
13117 !! html
13118 <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>
13119 <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>
13120 <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>
13121 <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>
13122
13123 !! end
13124
13125 !! test
13126 __NOEDITSECTION__ keyword
13127 !! wikitext
13128 __NOEDITSECTION__
13129 ==Section 1==
13130 ==Section 2==
13131 !! html
13132 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
13133 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
13134
13135 !! end
13136
13137 !! test
13138 Link inside a section heading
13139 !! wikitext
13140 ==Section with a [[Main Page|link]] in it==
13141 !! html
13142 <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>
13143
13144 !! end
13145
13146 !! test
13147 TOC regression (bug 12077)
13148 !! wikitext
13149 __TOC__
13150 == title 1 ==
13151 === title 1.1 ===
13152 == title 2 ==
13153 !! html
13154 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13155 <ul>
13156 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13157 <ul>
13158 <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>
13159 </ul>
13160 </li>
13161 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13162 </ul>
13163 </div>
13164
13165 <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>
13166 <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>
13167 <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>
13168
13169 !! end
13170
13171 !! test
13172 BUG 1219 URL next to image (good)
13173 !! wikitext
13174 http://example.com [[Image:foobar.jpg]]
13175 !! html
13176 <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>
13177 </p>
13178 !!end
13179
13180 !! test
13181 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13182 !! wikitext
13183 ===
13184 The line above must have a trailing space!
13185 === <!--
13186 --> <!-- -->
13187 But just in case it doesn't...
13188 !! html
13189 <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>
13190 <p>The line above must have a trailing space!
13191 </p>
13192 <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>
13193 <p>But just in case it doesn't...
13194 </p>
13195 !! end
13196
13197 !! test
13198 Header with special characters (bug 25462)
13199 !! wikitext
13200 The tooltips shall not show entities to the user (ie. be double escaped)
13201
13202 == text > text ==
13203 section 1
13204
13205 == text < text ==
13206 section 2
13207
13208 == text & text ==
13209 section 3
13210
13211 == text ' text ==
13212 section 4
13213
13214 == text " text ==
13215 section 5
13216 !! html
13217 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13218 </p>
13219 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13220 <ul>
13221 <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>
13222 <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>
13223 <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>
13224 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13225 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13226 </ul>
13227 </div>
13228
13229 <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>
13230 <p>section 1
13231 </p>
13232 <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>
13233 <p>section 2
13234 </p>
13235 <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>
13236 <p>section 3
13237 </p>
13238 <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>
13239 <p>section 4
13240 </p>
13241 <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>
13242 <p>section 5
13243 </p>
13244 !! end
13245
13246 !! test
13247 Header with space, plus and underscore as entity
13248 !! wikitext
13249 Id should not contain + for spaces
13250
13251 == Space between Text ==
13252 section 1
13253
13254 == Space-Entity&#32;between&#32;Text ==
13255 section 2
13256
13257 == Plus+between+Text ==
13258 section 3
13259
13260 == Plus-Entity&#43;between&#43;Text ==
13261 section 4
13262
13263 == Underscore_between_Text ==
13264 section 5
13265
13266 == Underscore-Entity&#95;between&#95;Text ==
13267 section 6
13268
13269 [[#Space between Text]]
13270 [[#Space-Entity&#32;between&#32;Text]]
13271 [[#Plus+between+Text]]
13272 [[#Plus-Entity&#43;between&#43;Text]]
13273 [[#Underscore_between_Text]]
13274 [[#Underscore-Entity&#95;between&#95;Text]]
13275 !! html
13276 <p>Id should not contain + for spaces
13277 </p>
13278 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13279 <ul>
13280 <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>
13281 <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>
13282 <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>
13283 <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>
13284 <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>
13285 <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>
13286 </ul>
13287 </div>
13288
13289 <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>
13290 <p>section 1
13291 </p>
13292 <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>
13293 <p>section 2
13294 </p>
13295 <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>
13296 <p>section 3
13297 </p>
13298 <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>
13299 <p>section 4
13300 </p>
13301 <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>
13302 <p>section 5
13303 </p>
13304 <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>
13305 <p>section 6
13306 </p><p><a href="#Space_between_Text">#Space between Text</a>
13307 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
13308 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
13309 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
13310 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
13311 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
13312 </p>
13313 !! end
13314
13315 !! test
13316 Headers with excess '=' characters
13317 (Are similar tests necessary beyond the 1st level?)
13318 !! wikitext
13319 =foo==
13320 ==foo=
13321 =''italic'' heading==
13322 ==''italic'' heading=
13323 !! html
13324 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13325 <ul>
13326 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
13327 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
13328 <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>
13329 <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>
13330 </ul>
13331 </div>
13332
13333 <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>
13334 <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>
13335 <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>
13336 <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>
13337
13338 !! end
13339
13340 !! test
13341 HTML headers vs TOC (bug 23393)
13342 (__NOEDITSECTION__ for clearer output, doesn't matter here)
13343 !! wikitext
13344 <h1>Header 1</h1>
13345 == Header 1.1 ==
13346 == Header 1.2 ==
13347
13348 <h1>Header 2
13349 </h1>
13350 == Header 2.1 ==
13351 == Header 2.2 ==
13352 __NOEDITSECTION__
13353 !! html
13354 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13355 <ul>
13356 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
13357 <ul>
13358 <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>
13359 <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>
13360 </ul>
13361 </li>
13362 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
13363 <ul>
13364 <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>
13365 <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>
13366 </ul>
13367 </li>
13368 </ul>
13369 </div>
13370
13371 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
13372 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
13373 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
13374 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
13375 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
13376 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
13377
13378 !! end
13379
13380 !! test
13381 Single-line or multiline-comments can follow headings
13382 !! options
13383 parsoid=wt2html,wt2wt
13384 !! wikitext
13385 ==foo==<!---->
13386 ==bar==<!--c1-->
13387 ==baz==<!--
13388 c2
13389 c3-->
13390 !! html
13391 <h2><span class="mw-headline" id="foo">foo</span></h2>
13392 <h2><span class="mw-headline" id="bar">bar</span></h2>
13393 <h2><span class="mw-headline" id="baz">baz</span></h2>
13394
13395 !! end
13396
13397 !! test
13398 BUG 1219 URL next to image (broken)
13399 !! wikitext
13400 http://example.com[[Image:foobar.jpg]]
13401 !! html
13402 <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>
13403 </p>
13404 !!end
13405
13406 !! test
13407 Bug 1186 news: in the middle of text
13408 !! wikitext
13409 http://en.wikinews.org/wiki/Wikinews:Workplace
13410 !! html
13411 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
13412 </p>
13413 !!end
13414
13415
13416 !! test
13417 Namespaced link must have a title
13418 !! wikitext
13419 [[Project:]]
13420 !! html
13421 <p>[[Project:]]
13422 </p>
13423 !!end
13424
13425 !! test
13426 Namespaced link must have a title (bad fragment version)
13427 !! wikitext
13428 [[Project:#fragment]]
13429 !! html
13430 <p>[[Project:#fragment]]
13431 </p>
13432 !!end
13433
13434
13435 ###
13436 ### HTML tags and HTML attributes
13437 ###
13438
13439 !! test
13440 div with no attributes
13441 !! wikitext
13442 <div>HTML rocks</div>
13443 !! html
13444 <div>HTML rocks</div>
13445
13446 !! end
13447
13448 !! test
13449 div with double-quoted attribute
13450 !! wikitext
13451 <div id="rock">HTML rocks</div>
13452 !! html
13453 <div id="rock">HTML rocks</div>
13454
13455 !! end
13456
13457 !! test
13458 div with single-quoted attribute
13459 !! wikitext
13460 <div id='rock'>HTML rocks</div>
13461 !! html
13462 <div id="rock">HTML rocks</div>
13463
13464 !! end
13465
13466 !! test
13467 div with unquoted attribute
13468 !! wikitext
13469 <div id=rock>HTML rocks</div>
13470 !! html
13471 <div id="rock">HTML rocks</div>
13472
13473 !! end
13474
13475 !! test
13476 div with illegal double attributes
13477 !! wikitext
13478 <div id="a" id="b">HTML rocks</div>
13479 !! html
13480 <div id="b">HTML rocks</div>
13481
13482 !!end
13483
13484 # FIXME: produce empty string instead of "class" in the PHP parser, following
13485 # the HTML5 spec.
13486 !! test
13487 div with empty attribute value, space before equals
13488 !! options
13489 parsoid
13490 !! wikitext
13491 <div class =>HTML rocks</div>
13492 !! html
13493 <div class="">HTML rocks</div>
13494
13495 !! end
13496
13497 !! test
13498 div with multiple empty attribute values
13499 !! options
13500 parsoid
13501 !! wikitext
13502 <div id= title=>HTML rocks</div>
13503 !! html
13504 <div id="" title="">HTML rocks</div>
13505
13506 !! end
13507
13508 !! test
13509 table with multiple empty attribute values
13510 !! options
13511 parsoid
13512 !! wikitext
13513 {| title= id=
13514 | hi
13515 |}
13516 !! html
13517 <table title="" id="">
13518 <tbody><tr><td> hi</td></tr>
13519 </tbody></table>
13520 !! end
13521
13522 !! test
13523 div with braces in attribute value
13524 !! wikitext
13525 <div title="{}">Foo</div>
13526 !! html/php
13527 <div title="&#123;}">Foo</div>
13528
13529 !! html/parsoid
13530 <div title="{}">Foo</div>
13531 !! end
13532
13533 # This it very inconsistent in the PHP parser: it returns
13534 # class="class" if there is a space between the name and the equal sign (see
13535 # 'div with empty attribute value, space before equals'), but strips the
13536 # attribute completely if the space is missing. We hope that not much content
13537 # depends on this, so are implementing the behavior below in Parsoid for
13538 # consistencies' sake.
13539 # FIXME: fix this behavior in the PHP parser?
13540 !! test
13541 div with empty attribute value, no space before equals
13542 !! options
13543 parsoid=wt2html,html2html
13544 !! wikitext
13545 <div class=>HTML rocks</div>
13546 !! html/php
13547 <div>HTML rocks</div>
13548
13549 !! html/parsoid
13550 <div class="">HTML rocks</div>
13551 !! end
13552
13553 !! test
13554 HTML multiple attributes correction
13555 !! wikitext
13556 <p class="error" class="awesome">Awesome!</p>
13557 !! html
13558 <p class="awesome">Awesome!</p>
13559
13560 !!end
13561
13562 !! test
13563 Table multiple attributes correction
13564 !! wikitext
13565 {|
13566 !+ class="error" class="awesome"| status
13567 |}
13568 !! html
13569 <table>
13570 <tr>
13571 <th class="awesome"> status
13572 </th></tr></table>
13573
13574 !!end
13575
13576 !! test
13577 DIV IN UPPERCASE
13578 !! wikitext
13579 <DIV ID="x">HTML ROCKS</DIV>
13580 !! html
13581 <div id="x">HTML ROCKS</div>
13582
13583 !!end
13584
13585 !! test
13586 Non-ASCII pseudo-tags are rendered as text
13587 !! wikitext
13588 <khyô>
13589 !! html
13590 <p>&lt;khyô&gt;
13591 </p>
13592 !! end
13593
13594 !! test
13595 Pseudo-tag with URL 'name' renders as url link
13596 !! wikitext
13597 <http://example.com/>
13598 !! html
13599 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
13600 </p>
13601 !! end
13602
13603 !! test
13604 text with amp in the middle of nowhere
13605 !! wikitext
13606 Remember AT&T?
13607 !! html
13608 <p>Remember AT&amp;T?
13609 </p>
13610 !! end
13611
13612 !! test
13613 text with character entity: eacute
13614 !! wikitext
13615 I always thought &eacute; was a cute letter.
13616 !! html
13617 <p>I always thought &#233; was a cute letter.
13618 </p>
13619 !! html+tidy
13620 <p>I always thought é was a cute letter.</p>
13621 !! end
13622
13623 !! test
13624 text with entity-escaped character entity-like string: eacute
13625 !! wikitext
13626 I always thought &amp;eacute; was a cute letter.
13627 !! html
13628 <p>I always thought &amp;eacute; was a cute letter.
13629 </p>
13630 !! end
13631
13632 !! test
13633 text with undefined character entity: xacute
13634 !! wikitext
13635 I always thought &xacute; was a cute letter.
13636 !! html
13637 <p>I always thought &amp;xacute; was a cute letter.
13638 </p>
13639 !! end
13640
13641 # TODO: generalize to PHP parser?
13642 !! test
13643 HTML5 tags
13644 !! options
13645 parsoid
13646 !! wikitext
13647 <data value="5">five</data>
13648 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13649 <mark>This highlighted text</mark>
13650 !! html
13651 <p><data value="5">five</data>
13652 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13653 <mark>This highlighted text</mark></p>
13654 !! end
13655
13656 !! test
13657 HTML tag with leading space is parsed as text
13658 !! wikitext
13659 < div>foo< /div>
13660 !! html
13661 <p>&lt; div&gt;foo&lt; /div&gt;
13662 </p>
13663 !! end
13664
13665 ###
13666 ### Nesting tests (see bug 41545, 50604, 51081)
13667 ###
13668
13669 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
13670 # Note that html2wt is considerably more difficult if we use <b> in
13671 # the test case, instead of <big>
13672 !! test
13673 Ensure that HTML adoption agency algorithm is properly implemented.
13674 !! wikitext
13675 <big>X<big>Y</big>Z</big>
13676 !! html
13677 <p><big>X<big>Y</big>Z</big>
13678 </p>
13679 !! end
13680
13681 # This was bug 41545 in the PHP parser.
13682 # Note that tidy doesn't handle this correctly.
13683 !! test
13684 Nesting of <kbd>
13685 !! wikitext
13686 <kbd>X<kbd>Y</kbd>Z</kbd>
13687 !! html
13688 <p><kbd>X<kbd>Y</kbd>Z</kbd>
13689 </p>
13690 !! end
13691
13692 # The following cases were bug 51081 in the PHP parser.
13693 # Note that there are some other nestable tags (b, i, etc) which are
13694 # not covered; see bug 51081 for discussion.
13695
13696 # Note that tidy doesn't handle this correctly.
13697 !! test
13698 Nesting of <em>
13699 !! wikitext
13700 <em>X<em>Y</em>Z</em>
13701 !! html
13702 <p><em>X<em>Y</em>Z</em>
13703 </p>
13704 !! end
13705
13706 # Note that tidy doesn't handle this correctly.
13707 !! test
13708 Nesting of <strong>
13709 !! wikitext
13710 <strong>X<strong>Y</strong>Z</strong>
13711 !! html
13712 <p><strong>X<strong>Y</strong>Z</strong>
13713 </p>
13714 !! end
13715
13716 !! test
13717 Nesting of <q>
13718 !! wikitext
13719 <q>X<q>Y</q>Z</q>
13720 !! html+tidy
13721 <p><q>X<q>Y</q>Z</q></p>
13722 !! end
13723
13724 # Note that tidy doesn't handle this correctly.
13725 !! test
13726 Nesting of <ruby>
13727 !! wikitext
13728 <ruby>X<ruby>Y</ruby>Z</ruby>
13729 !! html
13730 <p><ruby>X<ruby>Y</ruby>Z</ruby>
13731 </p>
13732 !! end
13733
13734 # Note that tidy doesn't handle this correctly.
13735 !! test
13736 Nesting of <bdo>
13737 !! wikitext
13738 <bdo>X<bdo>Y</bdo>Z</bdo>
13739 !! html
13740 <p><bdo>X<bdo>Y</bdo>Z</bdo>
13741 </p>
13742 !! end
13743
13744
13745 ###
13746 ### Media links
13747 ###
13748
13749 !! test
13750 Media link
13751 !! wikitext
13752 [[Media:Foobar.jpg]]
13753 !! html
13754 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
13755 </p>
13756 !! end
13757
13758 !! test
13759 Media link with text
13760 !! wikitext
13761 [[Media:Foobar.jpg|A neat file to look at]]
13762 !! html
13763 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
13764 </p>
13765 !! end
13766
13767 # FIXME: this is still bad HTML tag nesting
13768 !! test
13769 Media link with nasty text
13770 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
13771 !! wikitext
13772 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
13773 !! html
13774 <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>
13775
13776 !! html+tidy
13777 <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>
13778 !! end
13779
13780 !! test
13781 Media link to nonexistent file (bug 1702)
13782 !! wikitext
13783 [[Media:No such.jpg]]
13784 !! html
13785 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
13786 </p>
13787 !! end
13788
13789 !! test
13790 Image link to nonexistent file (bug 1850 - good)
13791 !! wikitext
13792 [[File:No_such.jpg]]
13793 !! html/php
13794 <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>
13795 </p>
13796 !! html/parsoid
13797 <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>
13798 !! end
13799
13800 !! test
13801 :Image link to nonexistent file (bug 1850 - bad)
13802 !! wikitext
13803 [[:Image:No such.jpg]]
13804 !! html/php
13805 <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>
13806 </p>
13807 !! html/parsoid
13808 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
13809 !! end
13810
13811
13812
13813 !! test
13814 Character reference normalization in link text (bug 1938)
13815 !! wikitext
13816 [[Main Page|this&that]]
13817 !! html
13818 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
13819 </p>
13820 !!end
13821
13822 !! article
13823 אַ
13824 !! text
13825 Test for unicode normalization
13826
13827 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
13828 !! endarticle
13829
13830 !! test
13831 (bug 19451) Links should refer to the normalized form.
13832 !! wikitext
13833 [[&#xFB2E;]]
13834 [[&#x5d0;&#x5b7;]]
13835 [[&#x5d0;ַ]]
13836 [[א&#x5b7;]]
13837 [[אַ]]
13838 !! html
13839 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
13840 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
13841 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
13842 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
13843 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
13844 </p>
13845 !! end
13846
13847 !! test
13848 Empty attribute crash test (bug 2067)
13849 !! wikitext
13850 <font color="">foo</font>
13851 !! html
13852 <p><font color="">foo</font>
13853 </p>
13854 !! end
13855
13856 !! test
13857 Empty attribute crash test single-quotes (bug 2067)
13858 !! wikitext
13859 <font color=''>foo</font>
13860 !! html
13861 <p><font color="">foo</font>
13862 </p>
13863 !! end
13864
13865 !! test
13866 Attribute test: equals, then nothing
13867 !! wikitext
13868 <font color=>foo</font>
13869 !! html
13870 <p><font>foo</font>
13871 </p>
13872 !! end
13873
13874 !! test
13875 Attribute test: unquoted value
13876 !! wikitext
13877 <font color=x>foo</font>
13878 !! html
13879 <p><font color="x">foo</font>
13880 </p>
13881 !! end
13882
13883 !! test
13884 Attribute test: unquoted but illegal value (hash)
13885 !! wikitext
13886 <font color=#x>foo</font>
13887 !! html
13888 <p><font color="#x">foo</font>
13889 </p>
13890 !! end
13891
13892 !! test
13893 Attribute test: no value
13894 !! wikitext
13895 <font color>foo</font>
13896 !! html
13897 <p><font color="color">foo</font>
13898 </p>
13899 !! end
13900
13901 !! test
13902 Bug 2095: link with three closing brackets
13903 !! wikitext
13904 [[Main Page]]]
13905 !! html/php
13906 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
13907 </p>
13908 !! html/parsoid
13909 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
13910 !! end
13911
13912 !! test
13913 Bug 2095: link with pipe and three closing brackets
13914 !! wikitext
13915 [[Main Page|link]]]
13916 !! html/php
13917 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
13918 </p>
13919 !! html/parsoid
13920 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
13921 !! end
13922
13923 !! test
13924 Bug 2095: link with pipe and three closing brackets, version 2
13925 !! wikitext
13926 [[Main Page|[http://example.com/]]]
13927 !! html/php
13928 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
13929 </p>
13930 !! html/parsoid
13931 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
13932 !! end
13933
13934
13935 ###
13936 ### Safety
13937 ###
13938
13939 !! article
13940 Template:Dangerous attribute
13941 !! text
13942 " onmouseover="alert(document.cookie)
13943 !! endarticle
13944
13945 !! article
13946 Template:Dangerous style attribute
13947 !! text
13948 border-size: expression(alert(document.cookie))
13949 !! endarticle
13950
13951 !! article
13952 Template:Div style
13953 !! text
13954 <div style="float: right; {{{1}}}">Magic div</div>
13955 !! endarticle
13956
13957 !! test
13958 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
13959 !! wikitext
13960 <div title="{{test}}"></div>
13961 !! html
13962 <div title="This is a test template"></div>
13963
13964 !! end
13965
13966 # Parsoid has enough context to handle this case
13967 !! test
13968 Bug 2304: HTML attribute safety (dangerous template; 2309)
13969 !! wikitext
13970 <div title="{{dangerous attribute}}"></div>
13971 !! html/php
13972 <div title=""></div>
13973
13974 !! html/parsoid
13975 <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>
13976 !! end
13977
13978 !! test
13979 Bug 2304: HTML attribute safety (dangerous style template; 2309)
13980 !! wikitext
13981 <div style="{{dangerous style attribute}}"></div>
13982 !! html
13983 <div style="/* insecure input */"></div>
13984
13985 !! end
13986
13987 !! test
13988 Bug 2304: HTML attribute safety (safe parameter; 2309)
13989 !! wikitext
13990 {{div style|width: 200px}}
13991 !! html
13992 <div style="float: right; width: 200px">Magic div</div>
13993
13994 !! end
13995
13996 !! test
13997 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
13998 !! wikitext
13999 {{div style|width: expression(alert(document.cookie))}}
14000 !! html
14001 <div style="/* insecure input */">Magic div</div>
14002
14003 !! end
14004
14005 !! test
14006 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
14007 !! wikitext
14008 {{div style|"><script>alert(document.cookie)</script>}}
14009 !! html
14010 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14011
14012 !! end
14013
14014 !! test
14015 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
14016 !! wikitext
14017 {{div style|" ><script>alert(document.cookie)</script>}}
14018 !! html
14019 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14020
14021 !! end
14022
14023 !! test
14024 Bug 2304: HTML attribute safety (link)
14025 !! wikitext
14026 <div title="[[Main Page]]"></div>
14027 !! html
14028 <div title="&#91;&#91;Main Page]]"></div>
14029
14030 !! end
14031
14032 !! test
14033 Bug 2304: HTML attribute safety (italics)
14034 !! wikitext
14035 <div title="''foobar''"></div>
14036 !! html
14037 <div title="&#39;&#39;foobar&#39;&#39;"></div>
14038
14039 !! end
14040
14041 !! test
14042 Bug 2304: HTML attribute safety (bold)
14043 !! wikitext
14044 <div title="'''foobar'''"></div>
14045 !! html
14046 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
14047
14048 !! end
14049
14050
14051 !! test
14052 Bug 2304: HTML attribute safety (ISBN)
14053 !! wikitext
14054 <div title="ISBN 1234567890"></div>
14055 !! html
14056 <div title="&#73;SBN 1234567890"></div>
14057
14058 !! end
14059
14060 !! test
14061 Bug 2304: HTML attribute safety (RFC)
14062 !! wikitext
14063 <div title="RFC 1234"></div>
14064 !! html
14065 <div title="&#82;FC 1234"></div>
14066
14067 !! end
14068
14069 !! test
14070 Bug 2304: HTML attribute safety (PMID)
14071 !! wikitext
14072 <div title="PMID 1234567890"></div>
14073 !! html
14074 <div title="&#80;MID 1234567890"></div>
14075
14076 !! end
14077
14078 !! test
14079 Bug 2304: HTML attribute safety (web link)
14080 !! wikitext
14081 <div title="http://example.com/"></div>
14082 !! html
14083 <div title="http&#58;//example.com/"></div>
14084
14085 !! end
14086
14087 !! test
14088 Bug 2304: HTML attribute safety (named web link)
14089 !! wikitext
14090 <div title="[http://example.com/ link]"></div>
14091 !! html
14092 <div title="&#91;http&#58;//example.com/ link]"></div>
14093
14094 !! end
14095
14096 !! test
14097 Bug 3244: HTML attribute safety (extension; safe)
14098 !! wikitext
14099 <div style="<nowiki>background:blue</nowiki>"></div>
14100 !! html
14101 <div style="background:blue"></div>
14102
14103 !! end
14104
14105 !! test
14106 Bug 3244: HTML attribute safety (extension; unsafe)
14107 !! wikitext
14108 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14109 !! html
14110 <div style="/* insecure input */"></div>
14111
14112 !! end
14113
14114 # More MSIE fun discovered by Tom Gilder
14115
14116 !! test
14117 MSIE CSS safety test: spurious slash
14118 !! wikitext
14119 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14120 !! html
14121 <div style="/* insecure input */">evil</div>
14122
14123 !! end
14124
14125 !! test
14126 MSIE CSS safety test: hex code
14127 !! wikitext
14128 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14129 !! html
14130 <div style="/* insecure input */">evil</div>
14131
14132 !! end
14133
14134 !! test
14135 MSIE CSS safety test: comment in url
14136 !! wikitext
14137 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14138 !! html
14139 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14140
14141 !! end
14142
14143 !! test
14144 MSIE CSS safety test: comment in expression
14145 !! wikitext
14146 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14147 !! html
14148 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14149
14150 !! end
14151
14152 !! test
14153 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14154 !! wikitext
14155 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14156 !! html
14157 <p style="/* invalid control char */">A</p>
14158
14159 !! end
14160
14161 !! test
14162 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14163 !! wikitext
14164 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14165 <div style="top:EXPRESSION(alert())">B</div>
14166 !! html
14167 <p style="/* insecure input */">A</p>
14168 <div style="/* insecure input */">B</div>
14169
14170 !! end
14171
14172 !! test
14173 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14174 !! wikitext
14175 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14176 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14177 !! html
14178 <div style="/* insecure input */">A</div>
14179 <p style="/* insecure input */">B</p>
14180
14181 !! end
14182
14183 !! test
14184 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14185 !! wikitext
14186 <div style="background-image:url⁽javascript:alert())">A</div>
14187 <div style="background-image:url₍javascript:alert())">B</div>
14188 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14189 !! html
14190 <div style="/* insecure input */">A</div>
14191 <div style="/* insecure input */">B</div>
14192 <p style="/* insecure input */">C</p>
14193
14194 !! end
14195
14196 !! test
14197 Opera -o-link CSS
14198 !! wikitext
14199 <div
14200 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;"
14201 style="-o-link:attr(title);-o-link-source:current">X</div>
14202 !! html
14203 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14204
14205 !! end
14206
14207 !! test
14208 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14209 !! wikitext
14210 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14211 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14212 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14213 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14214 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14215 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14216 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14217 !! html
14218 <p style="/* insecure input */">A</p>
14219 <p style="/* insecure input */">B</p>
14220 <p style="/* insecure input */">C</p>
14221 <p style="/* insecure input */">D</p>
14222 <p style="/* insecure input */">E</p>
14223 <p style="/* insecure input */">F</p>
14224 <p style="/* insecure input */">G</p>
14225
14226 !! end
14227
14228 !! test
14229 Table attribute legitimate extension
14230 !! wikitext
14231 {|
14232 !+ style="<nowiki>color:blue</nowiki>"| status
14233 |}
14234 !! html
14235 <table>
14236 <tr>
14237 <th style="color:blue"> status
14238 </th></tr></table>
14239
14240 !!end
14241
14242 !! test
14243 Table attribute safety
14244 !! wikitext
14245 {|
14246 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14247 |}
14248 !! html
14249 <table>
14250 <tr>
14251 <th style="/* insecure input */"> status
14252 </th></tr></table>
14253
14254 !! end
14255
14256 !! test
14257 CSS line continuation 1
14258 !! wikitext
14259 <div style="background-image: u\&#10;rl(test.jpg);"></div>
14260 !! html
14261 <div style="/* insecure input */"></div>
14262
14263 !! end
14264
14265 !! test
14266 CSS line continuation 2
14267 !! wikitext
14268 <div style="background-image: u\&#13;rl(test.jpg); "></div>
14269 !! html
14270 <div style="/* insecure input */"></div>
14271
14272 !! end
14273
14274 !! article
14275 Template:Identity
14276 !! text
14277 {{{1}}}
14278 !! endarticle
14279
14280 !! test
14281 Expansion of multi-line templates in attribute values (bug 6255)
14282 !! wikitext
14283 <div style="background: {{identity|#00FF00}}">-</div>
14284 !! html
14285 <div style="background: #00FF00">-</div>
14286
14287 !! end
14288
14289
14290 !! test
14291 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
14292 !! wikitext
14293 <div style="background:
14294 #00FF00">-</div>
14295 !! html/php
14296 <div style="background: #00FF00">-</div>
14297
14298 !! html/parsoid
14299 <div style="background:
14300 #00FF00">-</div>
14301 !! end
14302
14303 !! test
14304 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
14305 !! wikitext
14306 <div style="background: &#10;#00FF00">-</div>
14307 !! html
14308 <div style="background: &#10;#00FF00">-</div>
14309
14310 !! end
14311
14312 !! test
14313 evil <math>-wiki-tags without Extension:Math enabled
14314 !! wikitext
14315 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
14316 !! html+tidy
14317 <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>
14318 !! end
14319
14320 ###
14321 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
14322 ###
14323 !! test
14324 Parser hook: empty input
14325 !! wikitext
14326 <tag></tag>
14327 !! html
14328 <pre>
14329 ''
14330 array (
14331 )
14332 </pre>
14333
14334 !! end
14335
14336 !! test
14337 Parser hook: empty input using terminated empty elements
14338 !! wikitext
14339 <tag/>
14340 !! html
14341 <pre>
14342 NULL
14343 array (
14344 )
14345 </pre>
14346
14347 !! end
14348
14349 !! test
14350 Parser hook: empty input using terminated empty elements (space before)
14351 !! wikitext
14352 <tag />
14353 !! html
14354 <pre>
14355 NULL
14356 array (
14357 )
14358 </pre>
14359
14360 !! end
14361
14362 !! test
14363 Parser hook: basic input
14364 !! wikitext
14365 <tag>input</tag>
14366 !! html
14367 <pre>
14368 'input'
14369 array (
14370 )
14371 </pre>
14372
14373 !! end
14374
14375
14376 !! test
14377 Parser hook: case insensitive
14378 !! wikitext
14379 <TAG>input</TAG>
14380 !! html
14381 <pre>
14382 'input'
14383 array (
14384 )
14385 </pre>
14386
14387 !! end
14388
14389
14390 !! test
14391 Parser hook: case insensitive, redux
14392 !! wikitext
14393 <TaG>input</TAg>
14394 !! html
14395 <pre>
14396 'input'
14397 array (
14398 )
14399 </pre>
14400
14401 !! end
14402
14403 !! test
14404 Parser hook: nested tags
14405 !! options
14406 noxml
14407 !! wikitext
14408 <tag><tag></tag></tag>
14409 !! html
14410 <pre>
14411 '<tag>'
14412 array (
14413 )
14414 </pre>&lt;/tag&gt;
14415
14416 !! end
14417
14418 !! test
14419 Parser hook: basic arguments
14420 !! wikitext
14421 <tag width=200 height = "100" depth = '50' square></tag>
14422 !! html
14423 <pre>
14424 ''
14425 array (
14426 'width' => '200',
14427 'height' => '100',
14428 'depth' => '50',
14429 'square' => 'square',
14430 )
14431 </pre>
14432
14433 !! end
14434
14435 !! test
14436 Parser hook: argument containing a forward slash (bug 5344)
14437 !! wikitext
14438 <tag filename='/tmp/bla'></tag>
14439 !! html
14440 <pre>
14441 ''
14442 array (
14443 'filename' => '/tmp/bla',
14444 )
14445 </pre>
14446
14447 !! end
14448
14449 !! test
14450 Parser hook: empty input using terminated empty elements (bug 2374)
14451 !! wikitext
14452 <tag foo=bar/>text
14453 !! html
14454 <pre>
14455 NULL
14456 array (
14457 'foo' => 'bar',
14458 )
14459 </pre>text
14460
14461 !! end
14462
14463 # </tag> should be output literally since there is no matching tag that begins it
14464 !! test
14465 Parser hook: basic arguments using terminated empty elements (bug 2374)
14466 !! wikitext
14467 <tag width=200 height = "100" depth = '50' square/>
14468 other stuff
14469 </tag>
14470 !! html
14471 <pre>
14472 NULL
14473 array (
14474 'width' => '200',
14475 'height' => '100',
14476 'depth' => '50',
14477 'square' => 'square',
14478 )
14479 </pre>
14480 <p>other stuff
14481 &lt;/tag&gt;
14482 </p>
14483 !! end
14484
14485 ###
14486 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14487 ###
14488
14489 !! test
14490 Parser hook: static parser hook not inside a comment
14491 !! wikitext
14492 <statictag>hello, world</statictag>
14493 <statictag action=flush/>
14494 !! html
14495 <p>hello, world
14496 </p>
14497 !! end
14498
14499
14500 !! test
14501 Parser hook: static parser hook inside a comment
14502 !! wikitext
14503 <!-- <statictag>hello, world</statictag> -->
14504 <statictag action=flush/>
14505 !! html
14506 <p><br />
14507 </p>
14508 !! end
14509
14510 # Nested template calls; this case was broken by Parser.php rev 1.506,
14511 # since reverted.
14512
14513 !! article
14514 Template:One-parameter
14515 !! text
14516 (My parameter is: {{{1}}})
14517 !! endarticle
14518
14519 !! article
14520 Template:Map-one-parameter
14521 !! text
14522 {{{{{1}}}|{{{2}}}}}
14523 !! endarticle
14524
14525 !! test
14526 Nested template calls
14527 !! wikitext
14528 {{Map-one-parameter|One-parameter|param}}
14529 !! html
14530 <p>(My parameter is: param)
14531 </p>
14532 !! end
14533
14534
14535 ###
14536 ### Sanitizer
14537 ###
14538
14539 # HTML+Tidy effectively strips out the empty tags completely
14540 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
14541 # which Tidy would have done for the PHP parser had there been content inside it.
14542 !! test
14543 Sanitizer: Closing of open tags
14544 !! wikitext
14545 <s></s><table></table>
14546 !! html
14547 <s></s><table></table>
14548
14549 !! html/parsoid
14550 <p><s></s></p><table></table>
14551 !! end
14552
14553 !! test
14554 Sanitizer: Closing of open but not closed tags
14555 !! wikitext
14556 <s>foo
14557 !! html
14558 <p><s>foo</s>
14559 </p>
14560 !! end
14561
14562 !! test
14563 Sanitizer: Closing of closed but not open tags
14564 !! wikitext
14565 </s>
14566 !! html
14567 <p>&lt;/s&gt;
14568 </p>
14569 !! end
14570
14571 !! test
14572 Sanitizer: Closing of closed but not open table tags
14573 !! wikitext
14574 Table not started</td></tr></table>
14575 !! html
14576 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
14577 </p>
14578 !! end
14579
14580 !! test
14581 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
14582 !! wikitext
14583 <span id="æ: v">byte</span>[[#æ: v|backlink]]
14584 !! html
14585 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
14586 </p>
14587 !! end
14588
14589 # In HTML5, the restrictions are that id must contain at least one character,
14590 # and must not contain any space characters.
14591 !! test
14592 Sanitizer: Validating the contents of the id attribute (bug 4515)
14593 !! options
14594 disabled
14595 !! wikitext
14596 <br id="" /><br id="a space" />
14597 !! html
14598 Something ...
14599 !! end
14600
14601 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
14602 !! test
14603 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
14604 !! options
14605 disabled
14606 !! wikitext
14607 <br id="foo" /><br id="foo" />
14608 !! html
14609 Something need to be done. foo-2 ?
14610 !! end
14611
14612 !! test
14613 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
14614 !! wikitext
14615 <div itemscope>
14616 <meta itemprop="hello" content="world">
14617 <meta http-equiv="refresh" content="5">
14618 <meta itemprop="hello" http-equiv="refresh" content="5">
14619 <link itemprop="hello" href="{{SERVER}}">
14620 <link rel="stylesheet" href="{{SERVER}}">
14621 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
14622 </div>
14623 !! html
14624 <div itemscope="itemscope">
14625 <p> <meta itemprop="hello" content="world" />
14626 &lt;meta http-equiv="refresh" content="5"&gt;
14627 <meta itemprop="hello" content="5" />
14628 </p>
14629 <link itemprop="hello" href="http&#58;//example.org" />
14630 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
14631 <link itemprop="hello" href="http&#58;//example.org" />
14632 </div>
14633
14634 !! end
14635
14636 !! test
14637 Language converter: output gets cut off unexpectedly (bug 5757)
14638 !! options
14639 language=zh
14640 !! wikitext
14641 this bit is safe: }-
14642
14643 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
14644
14645 then we get cut off here: }-
14646
14647 all additional text is vanished
14648 !! html
14649 <p>this bit is safe: }-
14650 </p><p>but if we add a conversion instance: xxx
14651 </p><p>then we get cut off here: }-
14652 </p><p>all additional text is vanished
14653 </p>
14654 !! end
14655
14656 !! test
14657 Self closed html pairs (bug 5487)
14658 !! options
14659 !! wikitext
14660 <center><font id="bug" />Centered text</center>
14661 <div><font id="bug2" />In div text</div>
14662 !! html
14663 <center>&lt;font id="bug" /&gt;Centered text</center>
14664 <div>&lt;font id="bug2" /&gt;In div text</div>
14665
14666 !! end
14667
14668 #
14669 #
14670 #
14671
14672 !! test
14673 Punctuation: nbsp before exclamation
14674 !! wikitext
14675 C'est grave !
14676 !! html
14677 <p>C'est grave&#160;!
14678 </p>
14679 !! end
14680
14681 !! test
14682 Punctuation: CSS !important (bug 11874)
14683 !! wikitext
14684 <div style="width:50% !important">important</div>
14685 !! html
14686 <div style="width:50% !important">important</div>
14687
14688 !!end
14689
14690 !! test
14691 Punctuation: CSS ! important (bug 11874; with space after)
14692 !! wikitext
14693 <div style="width:50% ! important">important</div>
14694 !! html
14695 <div style="width:50% ! important">important</div>
14696
14697 !!end
14698
14699
14700 !! test
14701 HTML bullet list, closed tags (bug 5497)
14702 !! wikitext
14703 <ul>
14704 <li>One</li>
14705 <li>Two</li>
14706 </ul>
14707 !! html/php
14708 <ul>
14709 <li>One</li>
14710 <li>Two</li>
14711 </ul>
14712
14713 !! html/parsoid
14714 <ul data-parsoid='{"stx":"html"}'>
14715 <li data-parsoid='{"stx":"html"}'>One</li>
14716 <li data-parsoid='{"stx":"html"}'>Two</li>
14717 </ul>
14718
14719 !! end
14720
14721 !! test
14722 HTML bullet list, unclosed tags (bug 5497)
14723 !! wikitext
14724 <ul>
14725 <li>One
14726 <li>Two
14727 </ul>
14728 !! html/php+tidy
14729 <ul>
14730 <li>One</li>
14731 <li>Two</li>
14732 </ul>
14733 !! html/parsoid
14734 <ul data-parsoid='{"stx":"html"}'>
14735 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
14736 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
14737 </ul>
14738
14739 !! end
14740
14741 !! test
14742 HTML ordered list, closed tags (bug 5497)
14743 !! wikitext
14744 <ol>
14745 <li>One</li>
14746 <li>Two</li>
14747 </ol>
14748 !! html/php
14749 <ol>
14750 <li>One</li>
14751 <li>Two</li>
14752 </ol>
14753
14754 !! html/parsoid
14755 <ol data-parsoid='{"stx":"html"}'>
14756 <li data-parsoid='{"stx":"html"}'>One</li>
14757 <li data-parsoid='{"stx":"html"}'>Two</li>
14758 </ol>
14759
14760 !! end
14761
14762 !! test
14763 HTML ordered list, unclosed tags (bug 5497)
14764 !! options
14765 !! wikitext
14766 <ol>
14767 <li>One
14768 <li>Two
14769 </ol>
14770 !! html/php+tidy
14771 <ol>
14772 <li>One</li>
14773 <li>Two</li>
14774 </ol>
14775 !! html/parsoid
14776 <ol data-parsoid='{"stx":"html"}'>
14777 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
14778 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
14779 </ol>
14780
14781 !! end
14782
14783 !! test
14784 HTML nested bullet list, closed tags (bug 5497)
14785 !! wikitext
14786 <ul>
14787 <li>One</li>
14788 <li>Two:
14789 <ul>
14790 <li>Sub-one</li>
14791 <li>Sub-two</li>
14792 </ul>
14793 </li>
14794 </ul>
14795 !! html
14796 <ul>
14797 <li>One</li>
14798 <li>Two:
14799 <ul>
14800 <li>Sub-one</li>
14801 <li>Sub-two</li>
14802 </ul>
14803 </li>
14804 </ul>
14805
14806 !! end
14807
14808 !! test
14809 HTML nested bullet list, open tags (bug 5497)
14810 !! wikitext
14811 <ul>
14812 <li>One
14813 <li>Two:
14814 <ul>
14815 <li>Sub-one
14816 <li>Sub-two
14817 </ul>
14818 </ul>
14819 !! html/php+tidy
14820 <ul>
14821 <li>One</li>
14822 <li>Two:
14823 <ul>
14824 <li>Sub-one</li>
14825 <li>Sub-two</li>
14826 </ul>
14827 </li>
14828 </ul>
14829 !! html/parsoid
14830 <ul>
14831 <li>One
14832 </li>
14833 <li>Two:
14834 <ul>
14835 <li>Sub-one
14836 </li>
14837 <li>Sub-two
14838 </li>
14839 </ul>
14840 </li>
14841 </ul>
14842
14843 !! end
14844
14845 !! test
14846 HTML nested ordered list, closed tags (bug 5497)
14847 !! wikitext
14848 <ol>
14849 <li>One</li>
14850 <li>Two:
14851 <ol>
14852 <li>Sub-one</li>
14853 <li>Sub-two</li>
14854 </ol>
14855 </li>
14856 </ol>
14857 !! html
14858 <ol>
14859 <li>One</li>
14860 <li>Two:
14861 <ol>
14862 <li>Sub-one</li>
14863 <li>Sub-two</li>
14864 </ol>
14865 </li>
14866 </ol>
14867
14868 !! end
14869
14870 !! test
14871 HTML nested ordered list, open tags (bug 5497)
14872 !! wikitext
14873 <ol>
14874 <li>One
14875 <li>Two:
14876 <ol>
14877 <li>Sub-one
14878 <li>Sub-two
14879 </ol>
14880 </ol>
14881 !! html/php
14882 <ol>
14883 <li>One
14884 <li>Two:
14885 <ol>
14886 <li>Sub-one
14887 <li>Sub-two
14888 </ol>
14889 </ol>
14890
14891 !! html/parsoid
14892 <ol>
14893 <li>One
14894 </li>
14895 <li>Two:
14896 <ol>
14897 <li>Sub-one
14898 </li>
14899 <li>Sub-two
14900 </li>
14901 </ol>
14902 </li>
14903 </ol>
14904
14905 !! end
14906
14907 !! test
14908 HTML ordered list item with parameters oddity
14909 !! wikitext
14910 <ol><li id="fragment">One</li>
14911 </ol>
14912 !! html
14913 <ol><li id="fragment">One</li>
14914 </ol>
14915
14916 !! end
14917
14918 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
14919 !!test
14920 bug 5918: autonumbering
14921 !! wikitext
14922 [http://first/] [http://second] [ftp://ftp]
14923
14924 ftp://inlineftp
14925
14926 [mailto:enclosed@mail.tld With target]
14927
14928 [mailto:enclosed@mail.tld]
14929
14930 mailto:inline@mail.tld
14931 !! html/php
14932 <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>
14933 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
14934 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
14935 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
14936 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
14937 </p>
14938 !! html/parsoid
14939 <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>
14940 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
14941 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
14942 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
14943 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
14944 !! end
14945
14946
14947 #
14948 # Security and HTML correctness
14949 # From Nick Jenkins' fuzz testing
14950 #
14951
14952 !! test
14953 Fuzz testing: Parser13
14954 !! wikitext
14955 {|
14956 | http://a|
14957 !! html
14958 <table>
14959 <tr>
14960 <td>
14961 </td>
14962 </tr>
14963 </table>
14964
14965 !! end
14966
14967 !! test
14968 Fuzz testing: Parser14
14969 !! wikitext
14970 == onmouseover= ==
14971 http://__TOC__
14972 !! html
14973 <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>
14974 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14975 <ul>
14976 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
14977 </ul>
14978 </div>
14979
14980
14981 !! html+tidy
14982 <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>
14983 <p>http://</p>
14984 <div id="toc" class="toc">
14985 <div id="toctitle">
14986 <h2>Contents</h2>
14987 </div>
14988 <ul>
14989 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
14990 </ul>
14991 </div>
14992 !! end
14993
14994 !! test
14995 Fuzz testing: Parser14-table
14996 !! wikitext
14997 ==a==
14998 {| STYLE=__TOC__
14999 !! html
15000 <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>
15001 <table style="&#95;_TOC&#95;_">
15002 <tr><td></td></tr>
15003 </table>
15004
15005 !! html+tidy
15006 <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>
15007 <table style="__TOC__">
15008 <tr>
15009 <td></td>
15010 </tr>
15011 </table>
15012 !! end
15013
15014 # Known to produce bogus xml (extra </td>)
15015 !! test
15016 Fuzz testing: Parser16
15017 !! options
15018 noxml
15019 !! wikitext
15020 {|
15021 !https://||||||
15022 !! html
15023 <table>
15024 <tr>
15025 <th>https://</th>
15026 <th></th>
15027 <th></th>
15028 <th>
15029 </td>
15030 </tr>
15031 </table>
15032
15033 !! html+tidy
15034 <table>
15035 <tr>
15036 <th>https://</th>
15037 <th></th>
15038 <th></th>
15039 <th></th>
15040 </tr>
15041 </table>
15042 !! end
15043
15044 !! test
15045 Fuzz testing: Parser21
15046 !! wikitext
15047 {|
15048 ! irc://{{ftp://a" onmouseover="alert('hello world');"
15049 |
15050 !! html
15051 <table>
15052 <tr>
15053 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
15054 </th>
15055 <td>
15056 </td>
15057 </tr>
15058 </table>
15059
15060 !! end
15061
15062 !! test
15063 Fuzz testing: Parser22
15064 !! wikitext
15065 http://===r:::https://b
15066
15067 {|
15068 !! html
15069 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
15070 </p>
15071 <table>
15072 <tr><td></td></tr>
15073 </table>
15074
15075 !! end
15076
15077 # Known to produce bad XML for now
15078 !! test
15079 Fuzz testing: Parser24
15080 !! options
15081 noxml
15082 !! wikitext
15083 {|
15084 {{{|
15085 <u CLASS=
15086 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
15087 <br style="onmouseover='alert(document.cookie);' " />
15088
15089 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15090 |
15091 !! html
15092 <table>
15093 {{{|
15094 <u class="&#124;">}}}} &gt;
15095 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
15096
15097 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15098 <tr>
15099 <td></u>
15100 </td>
15101 </tr>
15102 </table>
15103
15104 !! end
15105
15106 # Note: the current result listed for this is not what the original one was,
15107 # but the original bug was JavaScript injection, which is fixed in any case.
15108 # It's not clear that the original result listed was any more correct than the
15109 # current one. Original result:
15110 # <p>{{{|
15111 # </p>
15112 # <li class="&#124;&#124;">
15113 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15114 !!test
15115 Fuzz testing: Parser25 (bug 6055)
15116 !! wikitext
15117 {{{
15118 |
15119 <LI CLASS=||
15120 >
15121 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15122 !! html
15123 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15124 </p>
15125 !! end
15126
15127 !!test
15128 Fuzz testing: URL adjacent extension (with space, clean)
15129 !! wikitext
15130 http://example.com <nowiki>junk</nowiki>
15131 !! html
15132 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15133 </p>
15134 !!end
15135
15136 !!test
15137 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15138 !! wikitext
15139 http://example.com<nowiki>junk</nowiki>
15140 !! html
15141 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15142 </p>
15143 !!end
15144
15145 !!test
15146 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15147 !! wikitext
15148 http://example.com<pre>junk</pre>
15149 !! html
15150 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15151
15152 !! html+tidy
15153 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15154 <pre>
15155 junk
15156 </pre>
15157 !!end
15158
15159 !!test
15160 Fuzz testing: image with bogus manual thumbnail
15161 !! wikitext
15162 [[Image:foobar.jpg|thumbnail= ]]
15163 !! html/php
15164 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
15165
15166 !! html/parsoid
15167 <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>
15168 !!end
15169
15170 !! test
15171 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15172 !! wikitext
15173 <pre dir="&#10;"></pre>
15174 !! html
15175 <pre dir="&#10;"></pre>
15176
15177 !! end
15178
15179 !! test
15180 Parsing optional HTML elements (Bug 6171)
15181 !! options
15182 !! wikitext
15183 <table>
15184 <tr>
15185 <td> Some tabular data</td>
15186 <td> More tabular data ...
15187 <td> And yet som tabular data</td>
15188 </tr>
15189 </table>
15190 !! html
15191 <table>
15192 <tr>
15193 <td> Some tabular data</td>
15194 <td> More tabular data ...
15195 </td><td> And yet som tabular data</td>
15196 </tr>
15197 </table>
15198
15199 !! end
15200
15201 !! test
15202 Correct handling of <td>, <tr> (Bug 6171)
15203 !! options
15204 !! wikitext
15205 <table>
15206 <tr>
15207 <td> Some tabular data</td>
15208 <td> More tabular data ...</td>
15209 <td> And yet som tabular data</td>
15210 </tr>
15211 </table>
15212 !! html
15213 <table>
15214 <tr>
15215 <td> Some tabular data</td>
15216 <td> More tabular data ...</td>
15217 <td> And yet som tabular data</td>
15218 </tr>
15219 </table>
15220
15221 !! end
15222
15223
15224 !! test
15225 Parsing crashing regression (fr:JavaScript)
15226 !! wikitext
15227 </body></x>
15228 !! html
15229 <p>&lt;/body&gt;&lt;/x&gt;
15230 </p>
15231 !! end
15232
15233 !! test
15234 Inline wiki vs wiki block nesting
15235 !! wikitext
15236 '''Bold paragraph
15237
15238 New wiki paragraph
15239 !! html
15240 <p><b>Bold paragraph</b>
15241 </p><p>New wiki paragraph
15242 </p>
15243 !! end
15244
15245 # FIXME: The current php output is documented
15246 # and desired output is the parsoid target.
15247 !! test
15248 Inline HTML vs wiki block nesting
15249 !! wikitext
15250 <b>Bold paragraph
15251
15252 New wiki paragraph
15253 !! html/php
15254 <p><b>Bold paragraph
15255 </p><p>New wiki paragraph</b>
15256 </p>
15257 !! html/parsoid
15258 <p><b>Bold paragraph</b>
15259 </p><p>New wiki paragraph
15260 </p>
15261 !! end
15262
15263 # Original result was this:
15264 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
15265 # </p>
15266 # While that might be marginally more intuitive, maybe, the six-apostrophe
15267 # construct is clearly pathological and the result stated here (which is what
15268 # the parser actually does) is about as reasonable as anything.
15269 !!test
15270 Mixing markup for italics and bold
15271 !! options
15272 !! wikitext
15273 '''bold''''''bold''bolditalics'''''
15274 !! html
15275 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
15276 </p>
15277 !! end
15278
15279
15280 !! article
15281 Xyzzyx
15282 !! text
15283 Article for special page transclusion test
15284 !! endarticle
15285
15286 !! test
15287 Special page transclusion
15288 !! options
15289 !! wikitext
15290 {{Special:Prefixindex/Xyzzyx}}
15291 !! html
15292 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15293
15294 !! end
15295
15296 !! test
15297 Special page transclusion twice (bug 5021)
15298 !! options
15299 !! wikitext
15300 {{Special:Prefixindex/Xyzzyx}}
15301 {{Special:Prefixindex/Xyzzyx}}
15302 !! html
15303 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15304 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15305
15306 !! end
15307
15308 !! test
15309 Transclusion of default MediaWiki message
15310 !! wikitext
15311 {{MediaWiki:Mainpage}}
15312 !! html
15313 <p>Main Page
15314 </p>
15315 !! end
15316
15317 !! test
15318 Transclusion of nonexistent MediaWiki message
15319 !! wikitext
15320 {{MediaWiki:Mainpagexxx}}
15321 !! html
15322 <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>
15323 </p>
15324 !! end
15325
15326 !! test
15327 Transclusion of MediaWiki message with underscore
15328 !! wikitext
15329 {{MediaWiki:history_short}}
15330 !! html
15331 <p>History
15332 </p>
15333 !! end
15334
15335 !! test
15336 Transclusion of MediaWiki message with space
15337 !! wikitext
15338 {{MediaWiki:history short}}
15339 !! html
15340 <p>History
15341 </p>
15342 !! end
15343
15344 !! test
15345 Invalid header with following text
15346 !! wikitext
15347 = x = y
15348 !! html
15349 <p>= x = y
15350 </p>
15351 !! end
15352
15353
15354 !! test
15355 Section extraction test (section 0)
15356 !! options
15357 section=0
15358 !! wikitext
15359 start
15360 ==a==
15361 ===aa===
15362 ====aaa====
15363 ==b==
15364 ===ba===
15365 ===bb===
15366 ====bba====
15367 ===bc===
15368 ==c==
15369 ===ca===
15370 !! html
15371 start
15372 !! end
15373
15374 !! test
15375 Section extraction test (section 1)
15376 !! options
15377 section=1
15378 !! wikitext
15379 start
15380 ==a==
15381 ===aa===
15382 ====aaa====
15383 ==b==
15384 ===ba===
15385 ===bb===
15386 ====bba====
15387 ===bc===
15388 ==c==
15389 ===ca===
15390 !! html
15391 ==a==
15392 ===aa===
15393 ====aaa====
15394 !! end
15395
15396 !! test
15397 Section extraction test (section 2)
15398 !! options
15399 section=2
15400 !! wikitext
15401 start
15402 ==a==
15403 ===aa===
15404 ====aaa====
15405 ==b==
15406 ===ba===
15407 ===bb===
15408 ====bba====
15409 ===bc===
15410 ==c==
15411 ===ca===
15412 !! html
15413 ===aa===
15414 ====aaa====
15415 !! end
15416
15417 !! test
15418 Section extraction test (section 3)
15419 !! options
15420 section=3
15421 !! wikitext
15422 start
15423 ==a==
15424 ===aa===
15425 ====aaa====
15426 ==b==
15427 ===ba===
15428 ===bb===
15429 ====bba====
15430 ===bc===
15431 ==c==
15432 ===ca===
15433 !! html
15434 ====aaa====
15435 !! end
15436
15437 !! test
15438 Section extraction test (section 4)
15439 !! options
15440 section=4
15441 !! wikitext
15442 start
15443 ==a==
15444 ===aa===
15445 ====aaa====
15446 ==b==
15447 ===ba===
15448 ===bb===
15449 ====bba====
15450 ===bc===
15451 ==c==
15452 ===ca===
15453 !! html
15454 ==b==
15455 ===ba===
15456 ===bb===
15457 ====bba====
15458 ===bc===
15459 !! end
15460
15461 !! test
15462 Section extraction test (section 5)
15463 !! options
15464 section=5
15465 !! wikitext
15466 start
15467 ==a==
15468 ===aa===
15469 ====aaa====
15470 ==b==
15471 ===ba===
15472 ===bb===
15473 ====bba====
15474 ===bc===
15475 ==c==
15476 ===ca===
15477 !! html
15478 ===ba===
15479 !! end
15480
15481 !! test
15482 Section extraction test (section 6)
15483 !! options
15484 section=6
15485 !! wikitext
15486 start
15487 ==a==
15488 ===aa===
15489 ====aaa====
15490 ==b==
15491 ===ba===
15492 ===bb===
15493 ====bba====
15494 ===bc===
15495 ==c==
15496 ===ca===
15497 !! html
15498 ===bb===
15499 ====bba====
15500 !! end
15501
15502 !! test
15503 Section extraction test (section 7)
15504 !! options
15505 section=7
15506 !! wikitext
15507 start
15508 ==a==
15509 ===aa===
15510 ====aaa====
15511 ==b==
15512 ===ba===
15513 ===bb===
15514 ====bba====
15515 ===bc===
15516 ==c==
15517 ===ca===
15518 !! html
15519 ====bba====
15520 !! end
15521
15522 !! test
15523 Section extraction test (section 8)
15524 !! options
15525 section=8
15526 !! wikitext
15527 start
15528 ==a==
15529 ===aa===
15530 ====aaa====
15531 ==b==
15532 ===ba===
15533 ===bb===
15534 ====bba====
15535 ===bc===
15536 ==c==
15537 ===ca===
15538 !! html
15539 ===bc===
15540 !! end
15541
15542 !! test
15543 Section extraction test (section 9)
15544 !! options
15545 section=9
15546 !! wikitext
15547 start
15548 ==a==
15549 ===aa===
15550 ====aaa====
15551 ==b==
15552 ===ba===
15553 ===bb===
15554 ====bba====
15555 ===bc===
15556 ==c==
15557 ===ca===
15558 !! html
15559 ==c==
15560 ===ca===
15561 !! end
15562
15563 !! test
15564 Section extraction test (section 10)
15565 !! options
15566 section=10
15567 !! wikitext
15568 start
15569 ==a==
15570 ===aa===
15571 ====aaa====
15572 ==b==
15573 ===ba===
15574 ===bb===
15575 ====bba====
15576 ===bc===
15577 ==c==
15578 ===ca===
15579 !! html
15580 ===ca===
15581 !! end
15582
15583 !! test
15584 Section extraction test (nonexistent section 11)
15585 !! options
15586 section=11
15587 !! wikitext
15588 start
15589 ==a==
15590 ===aa===
15591 ====aaa====
15592 ==b==
15593 ===ba===
15594 ===bb===
15595 ====bba====
15596 ===bc===
15597 ==c==
15598 ===ca===
15599 !! html
15600 !! end
15601
15602 !! test
15603 Section extraction test with bogus heading (section 1)
15604 !! options
15605 section=1
15606 !! wikitext
15607 ==a==
15608 ==bogus== not a legal section
15609 ==b==
15610 !! html
15611 ==a==
15612 ==bogus== not a legal section
15613 !! end
15614
15615 !! test
15616 Section extraction test with bogus heading (section 2)
15617 !! options
15618 section=2
15619 !! wikitext
15620 ==a==
15621 ==bogus== not a legal section
15622 ==b==
15623 !! html
15624 ==b==
15625 !! end
15626
15627 !! test
15628 Section extraction test with comment after heading (section 1)
15629 !! options
15630 section=1
15631 !! wikitext
15632 ==a==
15633 ==b== <!-- -->
15634 ==c==
15635 !! html
15636 ==a==
15637 !! end
15638
15639 !! test
15640 Section extraction test with comment after heading (section 2)
15641 !! options
15642 section=2
15643 !! wikitext
15644 ==a==
15645 ==b== <!-- -->
15646 ==c==
15647 !! html
15648 ==b== <!-- -->
15649 !! end
15650
15651 !! test
15652 Section extraction test with bogus <nowiki> heading (section 1)
15653 !! options
15654 section=1
15655 !! wikitext
15656 ==a==
15657 ==bogus== <nowiki>not a legal section</nowiki>
15658 ==b==
15659 !! html
15660 ==a==
15661 ==bogus== <nowiki>not a legal section</nowiki>
15662 !! end
15663
15664 !! test
15665 Section extraction test with bogus <nowiki> heading (section 2)
15666 !! options
15667 section=2
15668 !! wikitext
15669 ==a==
15670 ==bogus== <nowiki>not a legal section</nowiki>
15671 ==b==
15672 !! html
15673 ==b==
15674 !! end
15675
15676
15677 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
15678 # instead of respecting commented sections
15679 !! test
15680 Section extraction prefixed by comment (section 1)
15681 !! options
15682 section=1
15683 !! wikitext
15684 <!-- -->==sec1==
15685 ==sec2==
15686 !! html
15687 ==sec2==
15688 !!end
15689
15690 !! test
15691 Section extraction prefixed by comment (section 2)
15692 !! options
15693 section=2
15694 !! wikitext
15695 <!-- -->==sec1==
15696 ==sec2==
15697 !! html
15698
15699 !!end
15700
15701
15702 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
15703 # instead of respecting HTML-style headings
15704 !! test
15705 Section extraction, mixed wiki and html (section 1)
15706 !! options
15707 section=1
15708 !! wikitext
15709 <h2>unmarked</h2>
15710 unmarked
15711 ==1==
15712 one
15713 ==2==
15714 two
15715 !! html
15716 ==1==
15717 one
15718 !! end
15719
15720 !! test
15721 Section extraction, mixed wiki and html (section 2)
15722 !! options
15723 section=2
15724 !! wikitext
15725 <h2>unmarked</h2>
15726 unmarked
15727 ==1==
15728 one
15729 ==2==
15730 two
15731 !! html
15732 ==2==
15733 two
15734 !! end
15735
15736
15737 # Formerly testing for bug 3342
15738 !! test
15739 Section extraction, heading surrounded by <noinclude>
15740 !! options
15741 section=1
15742 !! wikitext
15743 <noinclude>==unmarked==</noinclude>
15744 ==marked==
15745 !! html
15746 ==marked==
15747 !!end
15748
15749 # Test behavior of bug 19910
15750 !! test
15751 Sectiion with all-equals
15752 !! options
15753 section=2
15754 !! wikitext
15755 ===
15756 The line above must have a trailing space
15757 === <!--
15758 --> <!-- -->
15759 But just in case it doesn't...
15760 !! html
15761 === <!--
15762 --> <!-- -->
15763 But just in case it doesn't...
15764 !! end
15765
15766 !! test
15767 Section replacement test (section 0)
15768 !! options
15769 replace=0,"xxx"
15770 !! wikitext
15771 start
15772 ==a==
15773 ===aa===
15774 ====aaa====
15775 ==b==
15776 ===ba===
15777 ===bb===
15778 ====bba====
15779 ===bc===
15780 ==c==
15781 ===ca===
15782 !! html
15783 xxx
15784
15785 ==a==
15786 ===aa===
15787 ====aaa====
15788 ==b==
15789 ===ba===
15790 ===bb===
15791 ====bba====
15792 ===bc===
15793 ==c==
15794 ===ca===
15795 !! end
15796
15797 !! test
15798 Section replacement test (section 1)
15799 !! options
15800 replace=1,"xxx"
15801 !! wikitext
15802 start
15803 ==a==
15804 ===aa===
15805 ====aaa====
15806 ==b==
15807 ===ba===
15808 ===bb===
15809 ====bba====
15810 ===bc===
15811 ==c==
15812 ===ca===
15813 !! html
15814 start
15815 xxx
15816
15817 ==b==
15818 ===ba===
15819 ===bb===
15820 ====bba====
15821 ===bc===
15822 ==c==
15823 ===ca===
15824 !! end
15825
15826 !! test
15827 Section replacement test (section 2)
15828 !! options
15829 replace=2,"xxx"
15830 !! wikitext
15831 start
15832 ==a==
15833 ===aa===
15834 ====aaa====
15835 ==b==
15836 ===ba===
15837 ===bb===
15838 ====bba====
15839 ===bc===
15840 ==c==
15841 ===ca===
15842 !! html
15843 start
15844 ==a==
15845 xxx
15846
15847 ==b==
15848 ===ba===
15849 ===bb===
15850 ====bba====
15851 ===bc===
15852 ==c==
15853 ===ca===
15854 !! end
15855
15856 !! test
15857 Section replacement test (section 3)
15858 !! options
15859 replace=3,"xxx"
15860 !! wikitext
15861 start
15862 ==a==
15863 ===aa===
15864 ====aaa====
15865 ==b==
15866 ===ba===
15867 ===bb===
15868 ====bba====
15869 ===bc===
15870 ==c==
15871 ===ca===
15872 !! html
15873 start
15874 ==a==
15875 ===aa===
15876 xxx
15877
15878 ==b==
15879 ===ba===
15880 ===bb===
15881 ====bba====
15882 ===bc===
15883 ==c==
15884 ===ca===
15885 !! end
15886
15887 !! test
15888 Section replacement test (section 4)
15889 !! options
15890 replace=4,"xxx"
15891 !! wikitext
15892 start
15893 ==a==
15894 ===aa===
15895 ====aaa====
15896 ==b==
15897 ===ba===
15898 ===bb===
15899 ====bba====
15900 ===bc===
15901 ==c==
15902 ===ca===
15903 !! html
15904 start
15905 ==a==
15906 ===aa===
15907 ====aaa====
15908 xxx
15909
15910 ==c==
15911 ===ca===
15912 !! end
15913
15914 !! test
15915 Section replacement test (section 5)
15916 !! options
15917 replace=5,"xxx"
15918 !! wikitext
15919 start
15920 ==a==
15921 ===aa===
15922 ====aaa====
15923 ==b==
15924 ===ba===
15925 ===bb===
15926 ====bba====
15927 ===bc===
15928 ==c==
15929 ===ca===
15930 !! html
15931 start
15932 ==a==
15933 ===aa===
15934 ====aaa====
15935 ==b==
15936 xxx
15937
15938 ===bb===
15939 ====bba====
15940 ===bc===
15941 ==c==
15942 ===ca===
15943 !! end
15944
15945 !! test
15946 Section replacement test (section 6)
15947 !! options
15948 replace=6,"xxx"
15949 !! wikitext
15950 start
15951 ==a==
15952 ===aa===
15953 ====aaa====
15954 ==b==
15955 ===ba===
15956 ===bb===
15957 ====bba====
15958 ===bc===
15959 ==c==
15960 ===ca===
15961 !! html
15962 start
15963 ==a==
15964 ===aa===
15965 ====aaa====
15966 ==b==
15967 ===ba===
15968 xxx
15969
15970 ===bc===
15971 ==c==
15972 ===ca===
15973 !! end
15974
15975 !! test
15976 Section replacement test (section 7)
15977 !! options
15978 replace=7,"xxx"
15979 !! wikitext
15980 start
15981 ==a==
15982 ===aa===
15983 ====aaa====
15984 ==b==
15985 ===ba===
15986 ===bb===
15987 ====bba====
15988 ===bc===
15989 ==c==
15990 ===ca===
15991 !! html
15992 start
15993 ==a==
15994 ===aa===
15995 ====aaa====
15996 ==b==
15997 ===ba===
15998 ===bb===
15999 xxx
16000
16001 ===bc===
16002 ==c==
16003 ===ca===
16004 !! end
16005
16006 !! test
16007 Section replacement test (section 8)
16008 !! options
16009 replace=8,"xxx"
16010 !! wikitext
16011 start
16012 ==a==
16013 ===aa===
16014 ====aaa====
16015 ==b==
16016 ===ba===
16017 ===bb===
16018 ====bba====
16019 ===bc===
16020 ==c==
16021 ===ca===
16022 !! html
16023 start
16024 ==a==
16025 ===aa===
16026 ====aaa====
16027 ==b==
16028 ===ba===
16029 ===bb===
16030 ====bba====
16031 xxx
16032
16033 ==c==
16034 ===ca===
16035 !!end
16036
16037 !! test
16038 Section replacement test (section 9)
16039 !! options
16040 replace=9,"xxx"
16041 !! wikitext
16042 start
16043 ==a==
16044 ===aa===
16045 ====aaa====
16046 ==b==
16047 ===ba===
16048 ===bb===
16049 ====bba====
16050 ===bc===
16051 ==c==
16052 ===ca===
16053 !! html
16054 start
16055 ==a==
16056 ===aa===
16057 ====aaa====
16058 ==b==
16059 ===ba===
16060 ===bb===
16061 ====bba====
16062 ===bc===
16063 xxx
16064 !! end
16065
16066 !! test
16067 Section replacement test (section 10)
16068 !! options
16069 replace=10,"xxx"
16070 !! wikitext
16071 start
16072 ==a==
16073 ===aa===
16074 ====aaa====
16075 ==b==
16076 ===ba===
16077 ===bb===
16078 ====bba====
16079 ===bc===
16080 ==c==
16081 ===ca===
16082 !! html
16083 start
16084 ==a==
16085 ===aa===
16086 ====aaa====
16087 ==b==
16088 ===ba===
16089 ===bb===
16090 ====bba====
16091 ===bc===
16092 ==c==
16093 xxx
16094 !! end
16095
16096 !! test
16097 Section replacement test with initial whitespace (bug 13728)
16098 !! options
16099 replace=2,"xxx"
16100 !! wikitext
16101 Preformatted initial line
16102 ==a==
16103 ===a===
16104 !! html
16105 Preformatted initial line
16106 ==a==
16107 xxx
16108 !! end
16109
16110
16111 !! test
16112 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16113 !! options
16114 section=1
16115 !! wikitext
16116 ==a==
16117 a
16118 !! html
16119 ==a==
16120 a
16121 !! end
16122
16123 !! test
16124 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16125 !! options
16126 section=1
16127 !! wikitext
16128 ==a==
16129 a
16130 !! html
16131 ==a==
16132 a
16133 !! end
16134
16135
16136 !! test
16137 Section extraction, <pre> around bogus header (bug 10309)
16138 !! options
16139 noxml section=2
16140 !! wikitext
16141 == Section One ==
16142 <pre>
16143 =======
16144 </pre>
16145
16146 == Section Two ==
16147 stuff
16148 !! html
16149 == Section Two ==
16150 stuff
16151 !! end
16152
16153 !! test
16154 Section replacement, <pre> around bogus header (bug 10309)
16155 !! options
16156 noxml replace=2,"xxx"
16157 !! wikitext
16158 == Section One ==
16159 <pre>
16160 =======
16161 </pre>
16162
16163 == Section Two ==
16164 stuff
16165 !! html
16166 == Section One ==
16167 <pre>
16168 =======
16169 </pre>
16170
16171 xxx
16172 !! end
16173
16174
16175
16176 !! test
16177 Handling of &#x0A; in URLs
16178 !! wikitext
16179 ** irc://&#x0A;a
16180 !! html/php
16181 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16182
16183 !! html/parsoid
16184 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16185 a">irc://
16186 a</a></li></ul></li></ul>
16187 !! end
16188
16189 !! test
16190 Handling of %0A in URLs
16191 !! wikitext
16192 ** irc://%0Aa
16193 !! html/php
16194 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16195
16196 !! html/parsoid
16197 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16198 !! end
16199
16200
16201 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16202 !! test
16203 5 quotes, code coverage +1 line
16204 !! options
16205 parsoid=wt2html
16206 !! wikitext
16207 '''''
16208 !! html/php
16209 !! html/parsoid
16210 <p><b><i></i></b></p>
16211 !! end
16212
16213 # same html as previous, but wikitext adjusted to match parsoid html2wt
16214 # note that wt2html and html2html will put the <i> before the <b>
16215 !! test
16216 5 quotes, code coverage +1 line w/ nowiki (1)
16217 !! options
16218 parsoid=wt2wt,html2wt
16219 !! wikitext
16220 '''''<nowiki/>'''''
16221 !! html/php
16222 <p><i></i>
16223 </p>
16224 !! html/parsoid
16225 <p><b><i></i></b></p>
16226 !! end
16227
16228 # same as previous, just swapping the <i> and <b>
16229 !! test
16230 5 quotes, code coverage +1 line w/ nowiki (2)
16231 !! wikitext
16232 '''''<nowiki/>'''''
16233 !! html/php
16234 <p><i></i>
16235 </p>
16236 !! html/parsoid
16237 <p><i><b></b></i></p>
16238 !! end
16239
16240 !! test
16241 Special:Search page linking.
16242 !! wikitext
16243 {{Special:search}}
16244 !! html
16245 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16246 </p>
16247 !! end
16248
16249 !! test
16250 {{!}} is a magic word
16251 !! wikitext
16252 {{!}} is a magic word there and {{!}} is still a magic word here
16253 !! html/php
16254 <p>| is a magic word there and | is still a magic word here
16255 </p>
16256 !! html/parsoid
16257 <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>
16258 !! end
16259
16260 !! test
16261 Say the magic word
16262 !! options
16263 title=[[Parser test]]
16264 !! wikitext
16265 * {{PAGENAME}}
16266 * {{PAGENAMEE}}
16267 * {{FULLPAGENAME}}
16268 * {{FULLPAGENAMEE}}
16269 * {{BASEPAGENAME}}
16270 * {{BASEPAGENAMEE}}
16271 * {{SUBPAGENAME}}
16272 * {{SUBPAGENAMEE}}
16273 * {{ROOTPAGENAME}}
16274 * {{ROOTPAGENAMEE}}
16275 * {{TALKPAGENAME}}
16276 * {{TALKPAGENAMEE}}
16277 * {{SUBJECTPAGENAME}}
16278 * {{SUBJECTPAGENAMEE}}
16279 * {{NAMESPACEE}}
16280 * {{NAMESPACE}}
16281 * {{NAMESPACENUMBER}}
16282 * {{TALKSPACE}}
16283 * {{TALKSPACEE}}
16284 * {{SUBJECTSPACE}}
16285 * {{SUBJECTSPACEE}}
16286 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
16287 !! html
16288 <ul><li> Parser test</li>
16289 <li> Parser_test</li>
16290 <li> Parser test</li>
16291 <li> Parser_test</li>
16292 <li> Parser test</li>
16293 <li> Parser_test</li>
16294 <li> Parser test</li>
16295 <li> Parser_test</li>
16296 <li> Parser test</li>
16297 <li> Parser_test</li>
16298 <li> Talk:Parser test</li>
16299 <li> Talk:Parser_test</li>
16300 <li> Parser test</li>
16301 <li> Parser_test</li>
16302 <li> </li>
16303 <li> </li>
16304 <li> 0</li>
16305 <li> Talk</li>
16306 <li> Talk</li>
16307 <li> </li>
16308 <li> </li>
16309 <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>
16310
16311 !! end
16312 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
16313
16314 !! test
16315 Gallery
16316 !! wikitext
16317 <gallery>
16318 image1.png |
16319 image2.gif|||||
16320
16321 image3|
16322 image4 |300px| centre
16323 image5.svg| http://///////
16324 [[x|xx]]]]
16325 * image6
16326 </gallery>
16327 !! html
16328 <ul class="gallery mw-gallery-traditional">
16329 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16330 <div class="thumb" style="height: 150px;">Image1.png</div>
16331 <div class="gallerytext">
16332 </div>
16333 </div></li>
16334 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16335 <div class="thumb" style="height: 150px;">Image2.gif</div>
16336 <div class="gallerytext">
16337 <p>||||
16338 </p>
16339 </div>
16340 </div></li>
16341 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16342 <div class="thumb" style="height: 150px;">Image3</div>
16343 <div class="gallerytext">
16344 </div>
16345 </div></li>
16346 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16347 <div class="thumb" style="height: 150px;">Image4</div>
16348 <div class="gallerytext">
16349 <p>300px| centre
16350 </p>
16351 </div>
16352 </div></li>
16353 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16354 <div class="thumb" style="height: 150px;">Image5.svg</div>
16355 <div class="gallerytext">
16356 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
16357 </p>
16358 </div>
16359 </div></li>
16360 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16361 <div class="thumb" style="height: 150px;">* image6</div>
16362 <div class="gallerytext">
16363 </div>
16364 </div></li>
16365 </ul>
16366
16367 !! end
16368
16369 !! test
16370 Gallery (with options)
16371 !! wikitext
16372 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
16373 File:Nonexistant.jpg|caption
16374 File:Nonexistant.jpg
16375 image:foobar.jpg|some '''caption''' [[Main Page]]
16376 image:foobar.jpg
16377 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
16378 </gallery>
16379 !! html
16380 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
16381 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
16382 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16383 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
16384 <div class="gallerytext">
16385 <p>caption
16386 </p>
16387 </div>
16388 </div></li>
16389 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16390 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
16391 <div class="gallerytext">
16392 </div>
16393 </div></li>
16394 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16395 <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>
16396 <div class="gallerytext">
16397 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16398 </p>
16399 </div>
16400 </div></li>
16401 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16402 <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>
16403 <div class="gallerytext">
16404 </div>
16405 </div></li>
16406 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16407 <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>
16408 <div class="gallerytext">
16409 <p>Blabla|blabla.
16410 </p>
16411 </div>
16412 </div></li>
16413 </ul>
16414
16415 !! end
16416
16417 !! test
16418 Gallery with link that has fragment
16419 !! wikitext
16420 <gallery>
16421 image:foobar.jpg|link=Main_Page
16422 image:foobar.jpg|link=Main_Page#section
16423 image:foobar.jpg|link=Main Page#section|caption
16424 </gallery>
16425 !! html
16426 <ul class="gallery mw-gallery-traditional">
16427 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16428 <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>
16429 <div class="gallerytext">
16430 </div>
16431 </div></li>
16432 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16433 <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>
16434 <div class="gallerytext">
16435 </div>
16436 </div></li>
16437 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16438 <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>
16439 <div class="gallerytext">
16440 <p>caption
16441 </p>
16442 </div>
16443 </div></li>
16444 </ul>
16445
16446 !! end
16447
16448 !! test
16449 Gallery with wikitext inside caption
16450 !! wikitext
16451 <gallery>
16452 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
16453 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
16454 </gallery>
16455 !! html
16456 <ul class="gallery mw-gallery-traditional">
16457 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16458 <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>
16459 <div class="gallerytext">
16460 <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>
16461 </p>
16462 </div>
16463 </div></li>
16464 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16465 <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>
16466 <div class="gallerytext">
16467 <p>This is a test template
16468 </p>
16469 </div>
16470 </div></li>
16471 </ul>
16472
16473 !! end
16474
16475 !! test
16476 gallery (with showfilename option)
16477 !! wikitext
16478 <gallery showfilename>
16479 File:Nonexistant.jpg|caption
16480 File:Nonexistant.jpg
16481 image:foobar.jpg|some '''caption''' [[Main Page]]
16482 File:Foobar.jpg
16483 </gallery>
16484 !! html
16485 <ul class="gallery mw-gallery-traditional">
16486 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16487 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16488 <div class="gallerytext">
16489 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
16490 caption
16491 </p>
16492 </div>
16493 </div></li>
16494 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16495 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16496 <div class="gallerytext">
16497 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
16498 </p>
16499 </div>
16500 </div></li>
16501 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16502 <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>
16503 <div class="gallerytext">
16504 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16505 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16506 </p>
16507 </div>
16508 </div></li>
16509 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16510 <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>
16511 <div class="gallerytext">
16512 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16513 </p>
16514 </div>
16515 </div></li>
16516 </ul>
16517
16518 !! end
16519
16520 !! test
16521 Gallery (with namespace-less filenames)
16522 !! wikitext
16523 <gallery>
16524 File:Nonexistant.jpg
16525 Nonexistant.jpg
16526 image:foobar.jpg
16527 foobar.jpg
16528 </gallery>
16529 !! html
16530 <ul class="gallery mw-gallery-traditional">
16531 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16532 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16533 <div class="gallerytext">
16534 </div>
16535 </div></li>
16536 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16537 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16538 <div class="gallerytext">
16539 </div>
16540 </div></li>
16541 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16542 <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>
16543 <div class="gallerytext">
16544 </div>
16545 </div></li>
16546 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16547 <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>
16548 <div class="gallerytext">
16549 </div>
16550 </div></li>
16551 </ul>
16552
16553 !! end
16554
16555 !! test
16556 HTML Hex character encoding (spells the word "JavaScript")
16557 !! options
16558 parsoid=wt2html,wt2wt,html2html
16559 !! wikitext
16560 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
16561 !! html/php
16562 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
16563 </p>
16564 !! html/php+tidy
16565 <p>JavaScript</p>
16566 !! html/parsoid
16567 <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>
16568 !! end
16569
16570 !! test
16571 HTML Hex character encoding bogus encoding (bug 26437 regression check)
16572 !! wikitext
16573 &#xsee;&#XSEE;
16574 !! html/php
16575 <p>&amp;#xsee;&amp;#XSEE;
16576 </p>
16577 !! html/parsoid
16578 <p>&amp;#xsee;&amp;#XSEE;</p>
16579 !! end
16580
16581 !! test
16582 HTML Hex character encoding mixed case
16583 !! options
16584 parsoid=wt2html,wt2wt,html2html
16585 !! wikitext
16586 &#xEE;&#Xee;
16587 !! html/php
16588 <p>&#xee;&#xee;
16589 </p>
16590 !! html/php+tidy
16591 <p>îî</p>
16592 !! html/parsoid
16593 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
16594 !! end
16595
16596 !! test
16597 __FORCETOC__ override
16598 !! wikitext
16599 __NEWSECTIONLINK__
16600 __FORCETOC__
16601 !! html
16602 <p><br />
16603 </p>
16604 !! end
16605
16606 !! test
16607 ISBN code coverage
16608 !! wikitext
16609 ISBN 978-0-1234-56&#x20;789
16610 !! html
16611 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
16612 </p>
16613 !! html+tidy
16614 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
16615 !! end
16616
16617 !! test
16618 ISBN followed by 5 spaces
16619 !! wikitext
16620 ISBN
16621 !! html
16622 <p>ISBN
16623 </p>
16624 !! end
16625
16626 !! test
16627 Double ISBN
16628 !! wikitext
16629 ISBN ISBN 1234567890
16630 !! html
16631 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16632 </p>
16633 !! end
16634
16635 !! test
16636 ISBN with an X
16637 !! wikitext
16638 ISBN 3-462-04561-X
16639 !! html
16640 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
16641 </p>
16642 !! end
16643
16644 !! test
16645 ISBN with empty prefix (parsoid test)
16646 !! wikitext
16647 ISBN 1234567890
16648 !! html/parsoid
16649 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
16650 !! end
16651
16652 !! test
16653 Bug 22905: <abbr> followed by ISBN followed by </a>
16654 !! wikitext
16655 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
16656 !! html
16657 <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>
16658 </p>
16659 !! end
16660
16661 !! test
16662 Double RFC
16663 !! wikitext
16664 RFC RFC 1234
16665 !! html
16666 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
16667 </p>
16668 !! end
16669
16670 !! test
16671 Double RFC with a wiki link
16672 !! wikitext
16673 RFC [[RFC 1234]]
16674 !! html
16675 <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>
16676 </p>
16677 !! end
16678
16679 !! test
16680 RFC code coverage
16681 !! wikitext
16682 RFC 983&#x20;987
16683 !! html
16684 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
16685 </p>
16686 !! html+tidy
16687 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
16688 !! end
16689
16690 !! test
16691 Centre-aligned image
16692 !! wikitext
16693 [[Image:foobar.jpg|centre]]
16694 !! html
16695 <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>
16696
16697 !!end
16698
16699 !! test
16700 None-aligned image
16701 !! wikitext
16702 [[Image:foobar.jpg|none]]
16703 !! html
16704 <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>
16705
16706 !!end
16707
16708 !! test
16709 Width + Height sized image (using px) (height is ignored)
16710 !! wikitext
16711 [[Image:foobar.jpg|640x480px]]
16712 !! html
16713 <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>
16714 </p>
16715 !!end
16716
16717 !! test
16718 Width-sized image (using px, no following whitespace)
16719 !! wikitext
16720 [[Image:foobar.jpg|640px]]
16721 !! html
16722 <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>
16723 </p>
16724 !!end
16725
16726 !! test
16727 Width-sized image (using px, with following whitespace - test regression from r39467)
16728 !! wikitext
16729 [[Image:foobar.jpg|640px ]]
16730 !! html
16731 <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>
16732 </p>
16733 !!end
16734
16735 !! test
16736 Width-sized image (using px, with preceding whitespace - test regression from r39467)
16737 !! wikitext
16738 [[Image:foobar.jpg| 640px]]
16739 !! html
16740 <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>
16741 </p>
16742 !!end
16743
16744 !! test
16745 Image with page parameter
16746 !! options
16747 djvu
16748 !! wikitext
16749 [[File:LoremIpsum.djvu|page=2]]
16750 !! html/php
16751 <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>
16752 </p>
16753 !! html/parsoid
16754 <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>
16755 !! end
16756
16757 !! test
16758 Another italics / bold test
16759 !! wikitext
16760 ''' ''x'
16761 !! html
16762 <pre>'<i> </i>x'
16763 </pre>
16764 !!end
16765
16766 # FIXME: The php output seems broken. It's interleaving some open/close tags.
16767 !! test
16768 dt/dd/dl test
16769 !! wikitext
16770 :;;;::
16771 !! html/php
16772 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
16773
16774 !! html/parsoid
16775 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
16776
16777 !!end
16778
16779
16780 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
16781 !! test
16782 Images with the "|" character in the comment
16783 !! wikitext
16784 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
16785 !! html/php
16786 <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>
16787
16788 !! html/parsoid
16789 <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>
16790 !! end
16791
16792 !! test
16793 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
16794 !! wikitext
16795 <html><script>alert(1);</script></html>
16796 !! html
16797 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
16798 </p>
16799 !! end
16800
16801 !! test
16802 HTML with raw HTML ($wgRawHtml==true)
16803 !! options
16804 wgRawHtml=1
16805 !! wikitext
16806 <html><script>alert(1);</script></html>
16807 !! html
16808 <p><script>alert(1);</script>
16809 </p>
16810 !! end
16811
16812 !! test
16813 Parents of subpages, one level up
16814 !! options
16815 subpage title=[[Subpage test/L1/L2/L3]]
16816 !! wikitext
16817 [[../|L2]]
16818 !! html
16819 <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>
16820 </p>
16821 !! end
16822
16823
16824 !! test
16825 Parents of subpages, one level up, not named
16826 !! options
16827 subpage title=[[Subpage test/L1/L2/L3]]
16828 !! wikitext
16829 [[../]]
16830 !! html
16831 <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>
16832 </p>
16833 !! end
16834
16835
16836
16837 !! test
16838 Parents of subpages, two levels up
16839 !! options
16840 subpage title=[[Subpage test/L1/L2/L3]]
16841 !! wikitext
16842 [[../../|L1]]2
16843
16844 [[../../|L1]]l
16845 !! html
16846 <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
16847 </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>
16848 </p>
16849 !! end
16850
16851 !! test
16852 Parents of subpages, two levels up, without trailing slash or name.
16853 !! options
16854 subpage title=[[Subpage test/L1/L2/L3]]
16855 !! wikitext
16856 [[../..]]
16857 !! html
16858 <p>[[../..]]
16859 </p>
16860 !! end
16861
16862 !! test
16863 Parents of subpages, two levels up, with lots of extra trailing slashes.
16864 !! options
16865 subpage title=[[Subpage test/L1/L2/L3]]
16866 !! wikitext
16867 [[../../////]]
16868 !! html
16869 <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>
16870 </p>
16871 !! end
16872
16873 !! article
16874 Subpage test/L1/L2/L3Sibling
16875 !! text
16876 Sibling article
16877 !! endarticle
16878
16879 !! test
16880 Transclusion of a sibling page (one level up)
16881 !! options
16882 subpage title=[[Subpage test/L1/L2/L3]]
16883 !! wikitext
16884 {{../L3Sibling}}
16885 !! html
16886 <p>Sibling article
16887 </p>
16888 !! end
16889
16890 !! test
16891 Transclusion of a child page
16892 !! options
16893 subpage title=[[Subpage test/L1/L2]]
16894 !! wikitext
16895 {{/L3Sibling}}
16896 !! html
16897 <p>Sibling article
16898 </p>
16899 !! end
16900
16901 !! test
16902 Non-transclusion because of too many up levels
16903 !! options
16904 subpage title=[[Subpage test/L1/L2/L3]]
16905 !! wikitext
16906 {{../../../../More than parent}}
16907 !! html
16908 <p>{{../../../../More than parent}}
16909 </p>
16910 !! end
16911
16912 !! test
16913 Definition list code coverage
16914 !! wikitext
16915 ; title : def
16916 ; title : def
16917 ;title: def
16918 !! html/php
16919 <dl><dt> title &#160;</dt>
16920 <dd> def</dd>
16921 <dt> title&#160;</dt>
16922 <dd> def</dd>
16923 <dt>title</dt>
16924 <dd> def</dd></dl>
16925
16926 !! html/parsoid
16927 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
16928 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
16929 <dt>title</dt><dd> def</dd></dl>
16930 !! end
16931
16932 !! test
16933 Don't fall for the self-closing div
16934 !! wikitext
16935 <div>hello world</div/>
16936 !! html
16937 <div>hello world</div>
16938
16939 !! end
16940
16941 !! test
16942 MSGNW magic word
16943 !! wikitext
16944 {{MSGNW:msg}}
16945 !! html
16946 <p>&#91;&#91;:Template:Msg&#93;&#93;
16947 </p>
16948 !! end
16949
16950 !! test
16951 RAW magic word
16952 !! wikitext
16953 {{RAW:QUERTY}}
16954 !! html
16955 <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>
16956 </p>
16957 !! end
16958
16959 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
16960 !! test
16961 Always escape literal '>' in output, not just after '<'
16962 !! wikitext
16963 ><>
16964 !! html
16965 <p>&gt;&lt;&gt;
16966 </p>
16967 !! end
16968
16969 !! test
16970 Template caching
16971 !! wikitext
16972 {{Test}}
16973 {{Test}}
16974 !! html
16975 <p>This is a test template
16976 This is a test template
16977 </p>
16978 !! end
16979
16980
16981 !! article
16982 MediaWiki:Fake
16983 !! text
16984 ==header==
16985 !! endarticle
16986
16987 !! test
16988 Inclusion of !userCanEdit() content
16989 !! wikitext
16990 {{MediaWiki:Fake}}
16991 !! html
16992 <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>
16993
16994 !! end
16995
16996
16997 !! test
16998 Out-of-order TOC heading levels
16999 !! wikitext
17000 ==2==
17001 ======6======
17002 ===3===
17003 =1=
17004 =====5=====
17005 ==2==
17006 !! html
17007 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17008 <ul>
17009 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
17010 <ul>
17011 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
17012 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
17013 </ul>
17014 </li>
17015 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
17016 <ul>
17017 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
17018 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
17019 </ul>
17020 </li>
17021 </ul>
17022 </div>
17023
17024 <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>
17025 <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>
17026 <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>
17027 <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>
17028 <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>
17029 <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>
17030
17031 !! end
17032
17033
17034 !! test
17035 ISBN with a dummy number
17036 !! wikitext
17037 ISBN ---
17038 !! html
17039 <p>ISBN ---
17040 </p>
17041 !! end
17042
17043
17044 !! test
17045 ISBN with space-delimited number
17046 !! wikitext
17047 ISBN 92 9017 032 8
17048 !! html
17049 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
17050 </p>
17051 !! end
17052
17053
17054 !! test
17055 ISBN with multiple spaces, no number
17056 !! wikitext
17057 ISBN foo
17058 !! html
17059 <p>ISBN foo
17060 </p>
17061 !! end
17062
17063
17064 !! test
17065 ISBN length
17066 !! wikitext
17067 ISBN 123456789
17068
17069 ISBN 1234567890
17070
17071 ISBN 12345678901
17072 !! html
17073 <p>ISBN 123456789
17074 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17075 </p><p>ISBN 12345678901
17076 </p>
17077 !! end
17078
17079
17080 !! test
17081 ISBN with trailing year (bug 8110)
17082 !! wikitext
17083 ISBN 1-234-56789-0 - 2006
17084
17085 ISBN 1 234 56789 0 - 2006
17086 !! html
17087 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
17088 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
17089 </p>
17090 !! end
17091
17092
17093 !! test
17094 anchorencode
17095 !! wikitext
17096 {{anchorencode:foo bar©#%n}}
17097 !! html
17098 <p>foo_bar.C2.A9.23.25n
17099 </p>
17100 !! end
17101
17102 !! test
17103 anchorencode trims spaces
17104 !! wikitext
17105 {{anchorencode: __pretty__please__}}
17106 !! html
17107 <p>pretty_please
17108 </p>
17109 !! end
17110
17111 !! test
17112 anchorencode deals with links
17113 !! wikitext
17114 {{anchorencode: [[hello|world]] [[hi]]}}
17115 !! html
17116 <p>world_hi
17117 </p>
17118 !! end
17119
17120 !! test
17121 anchorencode deals with templates
17122 !! wikitext
17123 {{anchorencode: {{Foo}} }}
17124 !! html
17125 <p>FOO
17126 </p>
17127 !! end
17128
17129 !! test
17130 anchorencode encodes like the TOC generator: (bug 18431)
17131 !! wikitext
17132 === _ +:.3A%3A&&amp;]] ===
17133 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17134 __NOEDITSECTION__
17135 !! html
17136 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17137 <p>.2B:.3A.253A.26.26.5D.5D
17138 </p>
17139 !! end
17140
17141 !! test
17142 Bug 6200: blockquotes and paragraph formatting
17143 !! wikitext
17144 <blockquote>
17145 foo
17146 </blockquote>
17147
17148 bar
17149
17150 baz
17151 !! html
17152 <blockquote>
17153 <p>foo
17154 </p>
17155 </blockquote>
17156 <p>bar
17157 </p>
17158 <pre>baz
17159 </pre>
17160 !! end
17161
17162 !! test
17163 Bug 8293: Use of center tag ruins paragraph formatting
17164 !! wikitext
17165 <center>
17166 foo
17167 </center>
17168
17169 bar
17170
17171 baz
17172 !! html
17173 <center>
17174 <p>foo
17175 </p>
17176 </center>
17177 <p>bar
17178 </p>
17179 <pre>baz
17180 </pre>
17181 !! end
17182
17183 !!test
17184 Parsing of overlapping (improperly nested) inline html tags
17185 !! wikitext
17186 <span><s>x</span></s>
17187 !! html/php
17188 <p><span><s>x&lt;/span&gt;</s></span>
17189 </p>
17190 !! html/parsoid
17191 <p><span><s>x</s></span>
17192 </p>
17193 !!end
17194
17195 ###
17196 ### Language variants related tests
17197 ###
17198 !! test
17199 Self-link in language variants
17200 !! options
17201 title=[[Dunav]] language=sr
17202 !! wikitext
17203 Both [[Dunav]] and [[Дунав]] are names for this river.
17204 !! html
17205 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17206 </p>
17207 !!end
17208
17209 !! article
17210 Дуна
17211 !! text
17212 content
17213 !! endarticle
17214
17215 !! test
17216 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17217 !! options
17218 title=[[Duna]] language=sr
17219 !! wikitext
17220 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17221 !! html
17222 <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.
17223 </p>
17224 !! end
17225
17226 !! test
17227 Link to a section of a variant of this title shouldn't be parsed as self-link
17228 !! options
17229 title=[[Duna]] language=sr
17230 !! wikitext
17231 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
17232 !! html
17233 <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.
17234 </p>
17235 !! end
17236
17237 !! test
17238 Link to pages in language variants
17239 !! options
17240 language=sr
17241 !! wikitext
17242 Main Page can be written as [[Маин Паге]]
17243 !! html
17244 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
17245 </p>
17246 !!end
17247
17248
17249 !! test
17250 Multiple links to pages in language variants
17251 !! options
17252 language=sr
17253 !! wikitext
17254 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
17255 !! html
17256 <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>.
17257 </p>
17258 !!end
17259
17260
17261 !! test
17262 Simple template in language variants
17263 !! options
17264 language=sr
17265 !! wikitext
17266 {{тест}}
17267 !! html
17268 <p>This is a test template
17269 </p>
17270 !! end
17271
17272
17273 !! test
17274 Template with explicit namespace in language variants
17275 !! options
17276 language=sr
17277 !! wikitext
17278 {{Template:тест}}
17279 !! html
17280 <p>This is a test template
17281 </p>
17282 !! end
17283
17284
17285 !! test
17286 Basic test for template parameter in language variants
17287 !! options
17288 language=sr
17289 !! wikitext
17290 {{парамтест|param=foo}}
17291 !! html
17292 <p>This is a test template with parameter foo
17293 </p>
17294 !! end
17295
17296
17297 !! test
17298 Simple category in language variants
17299 !! options
17300 language=sr cat
17301 !! wikitext
17302 [[Category:МедиаWики Усер'с Гуиде]]
17303 !! html
17304 <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>
17305 !! end
17306
17307
17308 !! article
17309 Category:分类
17310 !! text
17311 blah
17312 !! endarticle
17313
17314 !! article
17315 Category:分類
17316 !! text
17317 blah
17318 !! endarticle
17319
17320 !! test
17321 Don't convert blue categorylinks to another variant (bug 33210)
17322 !! options
17323 language=zh cat
17324 !! wikitext
17325 [[A]][[Category:分类]]
17326 !! html
17327 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
17328 !! end
17329
17330
17331 !! test
17332 Stripping -{}- tags (language variants)
17333 !! options
17334 language=sr
17335 !! wikitext
17336 Latin proverb: -{Ne nuntium necare}-
17337 !! html
17338 <p>Latin proverb: Ne nuntium necare
17339 </p>
17340 !! end
17341
17342
17343 !! test
17344 Prevent conversion with -{}- tags (language variants)
17345 !! options
17346 language=sr variant=sr-ec
17347 !! wikitext
17348 Latinski: -{Ne nuntium necare}-
17349 !! html
17350 <p>Латински: Ne nuntium necare
17351 </p>
17352 !! end
17353
17354
17355 !! test
17356 Prevent conversion of text with -{}- tags (language variants)
17357 !! options
17358 language=sr variant=sr-ec
17359 !! wikitext
17360 Latinski: -{Ne nuntium necare}-
17361 !! html
17362 <p>Латински: Ne nuntium necare
17363 </p>
17364 !! end
17365
17366
17367 !! test
17368 Prevent conversion of links with -{}- tags (language variants)
17369 !! options
17370 language=sr variant=sr-ec
17371 !! wikitext
17372 -{[[Main Page]]}-
17373 !! html
17374 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17375 </p>
17376 !! end
17377
17378
17379 !! test
17380 -{}- tags within headlines (within html for parserConvert())
17381 !! options
17382 language=sr variant=sr-ec
17383 !! wikitext
17384 == -{Naslov}- ==
17385 !! html
17386 <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>
17387
17388 !! end
17389
17390
17391 !! test
17392 Explicit definition of language variant alternatives
17393 !! options
17394 language=zh variant=zh-tw
17395 !! wikitext
17396 -{zh:China;zh-tw:Taiwan}-, not China
17397 !! html
17398 <p>Taiwan, not China
17399 </p>
17400 !! end
17401
17402
17403 !! test
17404 Conversion around HTML tags
17405 !! options
17406 language=sr variant=sr-ec
17407 !! wikitext
17408 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
17409 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
17410 !! html
17411 <p>
17412 <span title="ЛаCтин">ски</span>
17413 </p>
17414 !! end
17415
17416
17417 !! test
17418 Explicit session-wise language variant mapping (A flag and - flag)
17419 !! options
17420 language=zh variant=zh-tw
17421 !! wikitext
17422 Taiwan is not China.
17423 But -{A|zh:China;zh-tw:Taiwan}- is China,
17424 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
17425 and -{China}- is China.
17426 !! html
17427 <p>Taiwan is not China.
17428 But Taiwan is Taiwan,
17429 (This should be stripped!)
17430 and China is China.
17431 </p>
17432 !! end
17433
17434 !! test
17435 Explicit session-wise language variant mapping (H flag for hide)
17436 !! options
17437 language=zh variant=zh-tw
17438 !! wikitext
17439 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
17440 Taiwan is China.
17441 !! html
17442 <p>(This should be stripped!)
17443 Taiwan is Taiwan.
17444 </p>
17445 !! end
17446
17447 !! test
17448 Adding explicit conversion rule for title (T flag)
17449 !! options
17450 language=zh variant=zh-tw showtitle
17451 !! wikitext
17452 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17453 !! html
17454 Taiwan
17455 <p>Should be stripped!
17456 </p>
17457 !! end
17458
17459 !! test
17460 Testing that changing the language variant here in the tests actually works
17461 !! options
17462 language=zh variant=zh showtitle
17463 !! wikitext
17464 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17465 !! html
17466 China
17467 <p>Should be stripped!
17468 </p>
17469 !! end
17470
17471 !! test
17472 Recursive conversion of alt and title attrs shouldn't clear converter state
17473 !! options
17474 language=zh variant=zh-cn showtitle
17475 !! wikitext
17476 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
17477 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
17478 !! html
17479 China
17480 <p>
17481 Should be stripped<span title="Exclamation">!</span>
17482 </p>
17483 !! end
17484
17485 !! test
17486 Bug 24072: more test on conversion rule for title
17487 !! options
17488 language=zh variant=zh-tw showtitle
17489 !! wikitext
17490 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17491 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
17492 !! html
17493 Taiwan
17494 <p>This should be stripped!
17495 This won't take interferes with the title rule.
17496 </p>
17497 !! end
17498
17499 !! test
17500 Partly disable title conversion if variant == main language code
17501 !! options
17502 language=zh variant=zh title=[[ZH]] showtitle
17503 !! wikitext
17504 -{T|zh-cn:CN;zh-tw:TW}-
17505 !! html
17506 ZH
17507 <p>
17508 </p>
17509 !! end
17510
17511 !! test
17512 Partly disable title conversion if variant == main language code, more
17513 !! options
17514 language=zh variant=zh title=[[ZH]] showtitle
17515 !! wikitext
17516 -{T|TW}-
17517 !! html
17518 ZH
17519 <p>
17520 </p>
17521 !! end
17522
17523 !! test
17524 Raw output of variant escape tags (R flag)
17525 !! options
17526 language=zh variant=zh-tw
17527 !! wikitext
17528 Raw: -{R|zh:China;zh-tw:Taiwan}-
17529 !! html
17530 <p>Raw: zh:China;zh-tw:Taiwan
17531 </p>
17532 !! end
17533
17534 !! test
17535 Nested using of manual convert syntax
17536 !! options
17537 language=zh variant=zh-hk
17538 !! wikitext
17539 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
17540 !! html
17541 <p>Nested: Hello Hong Kong!
17542 </p>
17543 !! end
17544
17545 !! test
17546 Proper conversion of text in external links
17547 !! options
17548 language=sr variant=sr-ec
17549 !! wikitext
17550 http://www.google.com
17551 gopher://www.google.com
17552 [http://www.google.com http://www.google.com]
17553 [gopher://www.google.com gopher://www.google.com]
17554 [https://www.google.com irc://www.google.com]
17555 [ftp://www.google.com www.google.com/ftp://dir]
17556 [//www.google.com www.google.com]
17557 !! html
17558 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17559 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17560 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17561 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17562 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
17563 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
17564 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
17565 </p>
17566 !! end
17567
17568 !! test
17569 Do not convert roman numbers to language variants
17570 !! options
17571 language=sr variant=sr-ec
17572 !! wikitext
17573 Fridrih IV je car.
17574 !! html
17575 <p>Фридрих IV је цар.
17576 </p>
17577 !! end
17578
17579 !! test
17580 Unclosed language converter markup "-{"
17581 !! options
17582 language=sr
17583 !! wikitext
17584 -{T|hello
17585 !! html
17586 <p>-{T|hello
17587 </p>
17588 !! end
17589
17590 !! test
17591 Don't convert raw rule "-{R|=&gt;}-" to "=>"
17592 !! options
17593 language=sr
17594 !! wikitext
17595 -{R|=&gt;}-
17596 !! html
17597 <p>=&gt;
17598 </p>
17599 !!end
17600
17601 !! test
17602 Don't break link parsing if language converter markup is in the caption.
17603 !! options
17604 language=sr variant=sr-ec
17605 !! wikitext
17606 [[Main Page|-{R|main page}-]]
17607 !! html
17608 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
17609 </p>
17610 !! end
17611
17612 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17613 !! test
17614 Don't break image parsing if language converter markup is in the caption.
17615 !! options
17616 language=sr
17617 !! wikitext
17618 [[File:Foobar.jpg|-{R|caption}-]]
17619 !! html/parsoid
17620 <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>
17621 </p>
17622 !! end
17623
17624 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17625 !! test
17626 Don't break list handling if language converter markup is in the item.
17627 !! options
17628 language=zh variant=zh-cn
17629 !! wikitext
17630 ;-{zh-cn:AAA;zh-tw:BBB}-
17631 !! html/php
17632 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
17633
17634 !! html/parsoid
17635 <dl><dt>AAA
17636 </dt></dl>
17637 !! end
17638
17639 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17640 !! test
17641 Don't break table handling if language converter markup is in the cell.
17642 !! options
17643 language=sr variant=sr-ec
17644 !! wikitext
17645 {|
17646 |-
17647 | -{R|B}-
17648 |}
17649 !! html/php
17650 <table>
17651
17652 <tr>
17653 <td>Б}-
17654 </td></tr></table>
17655
17656 !! html/parsoid
17657 <table>
17658
17659 <tr>
17660 <td> B
17661 </td></tr></table>
17662
17663 !! end
17664
17665 !! test
17666 Bug 529: Uncovered bullet
17667 !! wikitext
17668 * Foo {{bullet}}
17669 !! html
17670 <ul><li> Foo </li>
17671 <li> Bar</li></ul>
17672
17673 !! end
17674
17675 # Plain MediaWiki does not remove empty lists, but tidy actually does.
17676 # Templates in Wikipedia rely on this behavior, as tidy has always been
17677 # enabled there. These tests are normally run *without* tidy, so specify the
17678 # full output here.
17679 # To test realistic parsing behavior, apply a tidy-like transformation to both
17680 # the expected output and your parser's output.
17681 !! test
17682 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
17683 !! wikitext
17684 ******* Foo {{bullet}}
17685 !! html
17686 <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>
17687 <li> Bar</li></ul>
17688
17689 !! end
17690
17691 !! test
17692 Bug 529: Uncovered table already at line-start
17693 !! wikitext
17694 x
17695
17696 {{table}}
17697 y
17698 !! html
17699 <p>x
17700 </p>
17701 <table>
17702 <tr>
17703 <td> 1 </td>
17704 <td> 2
17705 </td></tr>
17706 <tr>
17707 <td> 3 </td>
17708 <td> 4
17709 </td></tr></table>
17710 <p>y
17711 </p>
17712 !! end
17713
17714 !! test
17715 Bug 529: Uncovered bullet in parser function result
17716 !! wikitext
17717 * Foo {{lc:{{bullet}} }}
17718 !! html
17719 <ul><li> Foo </li>
17720 <li> bar</li></ul>
17721
17722 !! end
17723
17724 !! test
17725 Bug 5678: Double-parsed template argument
17726 !! wikitext
17727 {{lc:{{{1}}}|hello}}
17728 !! html
17729 <p>{{{1}}}
17730 </p>
17731 !! end
17732
17733 !! test
17734 Bug 5678: Double-parsed template invocation
17735 !! wikitext
17736 {{lc:{{paramtest {{!}} param = hello }} }}
17737 !! html
17738 <p>{{paramtest | param = hello }}
17739 </p>
17740 !! end
17741
17742 !! test
17743 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
17744 !! options
17745 language=cs
17746 title=[[Main Page]]
17747 !! wikitext
17748 {{PRVNÍVELKÉ:ěščř}}
17749 {{prvnívelké:ěščř}}
17750 {{PRVNÍMALÉ:ěščř}}
17751 {{prvnímalé:ěščř}}
17752 {{MALÁ:ěščř}}
17753 {{malá:ěščř}}
17754 {{VELKÁ:ěščř}}
17755 {{velká:ěščř}}
17756 !! html
17757 <p>Ěščř
17758 Ěščř
17759 ěščř
17760 ěščř
17761 ěščř
17762 ěščř
17763 ĚŠČŘ
17764 ĚŠČŘ
17765 </p>
17766 !! end
17767
17768 !! test
17769 Morwen/13: Unclosed link followed by heading
17770 !! wikitext
17771 [[link
17772 ==heading==
17773 !! html
17774 <p>[[link
17775 </p>
17776 <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>
17777
17778 !! end
17779
17780 !! test
17781 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
17782 !! wikitext
17783 {{foo|
17784 =heading=
17785 !! html
17786 <p>{{foo|
17787 </p>
17788 <h1><span class="mw-headline" id="heading">heading</span></h1>
17789
17790 !! end
17791
17792 !! test
17793 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
17794 !! wikitext
17795 {{foo|
17796 ==heading==
17797 !! html
17798 <p>{{foo|
17799 </p>
17800 <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>
17801
17802 !! end
17803
17804 !! test
17805 Tildes in comments
17806 !! options
17807 pst
17808 !! wikitext
17809 <!-- ~~~~ -->
17810 !! html
17811 <!-- ~~~~ -->
17812 !! end
17813
17814 !! test
17815 Paragraphs inside divs (no extra line breaks)
17816 !! wikitext
17817 <div>Line one
17818
17819 Line two</div>
17820 !! html
17821 <div>Line one
17822 Line two</div>
17823
17824 !! end
17825
17826 !! test
17827 Paragraphs inside divs (extra line break on open)
17828 !! wikitext
17829 <div>
17830 Line one
17831
17832 Line two</div>
17833 !! html
17834 <div>
17835 <p>Line one
17836 </p>
17837 Line two</div>
17838
17839 !! end
17840
17841 !! test
17842 Paragraphs inside divs (extra line break on close)
17843 !! wikitext
17844 <div>Line one
17845
17846 Line two
17847 </div>
17848 !! html
17849 <div>Line one
17850 <p>Line two
17851 </p>
17852 </div>
17853
17854 !! end
17855
17856 !! test
17857 Paragraphs inside divs (extra line break on open and close)
17858 !! wikitext
17859 <div>
17860 Line one
17861
17862 Line two
17863 </div>
17864 !! html
17865 <div>
17866 <p>Line one
17867 </p><p>Line two
17868 </p>
17869 </div>
17870
17871 !! end
17872
17873 !! test
17874 Nesting tags, paragraphs on lines which begin with <div>
17875 !! wikitext
17876 <div></div><strong>A
17877 B</strong>
17878 !! html/php+tidy
17879 <p><strong>A</strong></p>
17880 <p><strong>B</strong></p>
17881 !! html/parsoid
17882 <div></div>
17883 <p><strong>A
17884 B</strong>
17885 </p>
17886 !! end
17887
17888 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
17889 !! test
17890 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
17891 !! wikitext
17892 <blockquote>Line one
17893
17894 Line two</blockquote>
17895 !! html
17896 <blockquote>Line one
17897 Line two</blockquote>
17898
17899 !! html+tidy
17900 <blockquote>
17901 <p>Line one Line two</p>
17902 </blockquote>
17903 !! end
17904
17905 !! test
17906 Bug 6200: paragraphs inside blockquotes (extra line break on open)
17907 !! wikitext
17908 <blockquote>
17909 Line one
17910
17911 Line two</blockquote>
17912 !! html
17913 <blockquote>
17914 <p>Line one
17915 </p>
17916 Line two</blockquote>
17917
17918 !! html+tidy
17919 <blockquote>
17920 <p>Line one</p>
17921 Line two</blockquote>
17922 !! end
17923
17924 !! test
17925 Bug 6200: paragraphs inside blockquotes (extra line break on close)
17926 !! wikitext
17927 <blockquote>Line one
17928
17929 Line two
17930 </blockquote>
17931 !! html
17932 <blockquote>Line one
17933 <p>Line two
17934 </p>
17935 </blockquote>
17936
17937 !! html+tidy
17938 <blockquote>
17939 <p>Line one</p>
17940 <p>Line two</p>
17941 </blockquote>
17942 !! end
17943
17944 !! test
17945 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
17946 !! wikitext
17947 <blockquote>
17948 Line one
17949
17950 Line two
17951 </blockquote>
17952 !! html
17953 <blockquote>
17954 <p>Line one
17955 </p><p>Line two
17956 </p>
17957 </blockquote>
17958
17959 !! html+tidy
17960 <blockquote>
17961 <p>Line one</p>
17962 <p>Line two</p>
17963 </blockquote>
17964 !! end
17965
17966 !! test
17967 Paragraphs inside blockquotes/divs (no extra line breaks)
17968 !! wikitext
17969 <blockquote><div>Line one
17970
17971 Line two</div></blockquote>
17972 !! html
17973 <blockquote><div>Line one
17974 Line two</div></blockquote>
17975
17976 !! end
17977
17978 !! test
17979 Paragraphs inside blockquotes/divs (extra line break on open)
17980 !! wikitext
17981 <blockquote><div>
17982 Line one
17983
17984 Line two</div></blockquote>
17985 !! html
17986 <blockquote><div>
17987 <p>Line one
17988 </p>
17989 Line two</div></blockquote>
17990
17991 !! end
17992
17993 !! test
17994 Paragraphs inside blockquotes/divs (extra line break on close)
17995 !! wikitext
17996 <blockquote><div>Line one
17997
17998 Line two
17999 </div></blockquote>
18000 !! html
18001 <blockquote><div>Line one
18002 <p>Line two
18003 </p>
18004 </div></blockquote>
18005
18006 !! end
18007
18008 !! test
18009 Paragraphs inside blockquotes/divs (extra line break on open and close)
18010 !! wikitext
18011 <blockquote><div>
18012 Line one
18013
18014 Line two
18015 </div></blockquote>
18016 !! html
18017 <blockquote><div>
18018 <p>Line one
18019 </p><p>Line two
18020 </p>
18021 </div></blockquote>
18022
18023 !! end
18024
18025 !! test
18026 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
18027 !! options
18028 wgLinkHolderBatchSize=0
18029 !! wikitext
18030 [[meatball:1]]
18031 [[meatball:2]]
18032 [[meatball:3]]
18033 !! html
18034 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
18035 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
18036 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
18037 </p>
18038 !! end
18039
18040 !! test
18041 Free external link invading image caption
18042 !! wikitext
18043 [[Image:Foobar.jpg|thumb|http://x|hello]]
18044 !! html
18045 <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>
18046
18047 !! end
18048
18049 !! test
18050 Bug 15196: localised external link numbers
18051 !! options
18052 language=fa
18053 !! wikitext
18054 [http://en.wikipedia.org/]
18055 !! html/php
18056 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
18057 </p>
18058 !! html/parsoid
18059 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
18060 !! end
18061
18062 !! test
18063 Multibyte character in padleft
18064 !! wikitext
18065 {{padleft:-Hello|7|Æ}}
18066 !! html
18067 <p>Æ-Hello
18068 </p>
18069 !! end
18070
18071 !! test
18072 Multibyte character in padright
18073 !! wikitext
18074 {{padright:Hello-|7|Æ}}
18075 !! html
18076 <p>Hello-Æ
18077 </p>
18078 !! end
18079
18080 !!test
18081 formatdate parser function
18082 !! wikitext
18083 {{#formatdate:2009-03-24}}
18084 !! html
18085 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
18086 </p>
18087 !! end
18088
18089 !!test
18090 formatdate parser function, with default format
18091 !! wikitext
18092 {{#formatdate:2009-03-24|mdy}}
18093 !! html
18094 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
18095 </p>
18096 !! end
18097
18098 !! test
18099 Spacing of numbers in formatted dates
18100 !! wikitext
18101 {{#formatdate:January 15}}
18102 !! html
18103 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18104 </p>
18105 !! end
18106
18107 !! test
18108 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
18109 !! options
18110 language=nl title=[[MediaWiki:Common.css]]
18111 !! wikitext
18112 {{#formatdate:2009-03-24|dmy}}
18113 !! html
18114 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18115 </p>
18116 !! end
18117
18118 #
18119 #
18120 #
18121
18122 #
18123 # Edit comments
18124 #
18125
18126 !! test
18127 Edit comment with link
18128 !! options
18129 comment
18130 !! wikitext
18131 I like the [[Main Page]] a lot
18132 !! html
18133 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18134 !!end
18135
18136 !! test
18137 Edit comment with link and link text
18138 !! options
18139 comment
18140 !! wikitext
18141 I like the [[Main Page|best pages]] a lot
18142 !! html
18143 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18144 !!end
18145
18146 !! test
18147 Edit comment with link and link text with suffix
18148 !! options
18149 comment
18150 !! wikitext
18151 I like the [[Main Page|best page]]s a lot
18152 !! html
18153 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18154 !!end
18155
18156 !! test
18157 Edit comment with section link (non-local, eg in history list)
18158 !! options
18159 comment title=[[Main Page]]
18160 !! wikitext
18161 /* External links */ removed bogus entries
18162 !! html
18163 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18164 !!end
18165
18166 !! test
18167 Edit comment with section link and text before it (non-local, eg in history list)
18168 !! options
18169 comment title=[[Main Page]]
18170 !! wikitext
18171 pre-comment text /* External links */ removed bogus entries
18172 !! html
18173 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>
18174 !!end
18175
18176 !! test
18177 Edit comment with section link (local, eg in diff view)
18178 !! options
18179 comment local title=[[Main Page]]
18180 !! wikitext
18181 /* External links */ removed bogus entries
18182 !! html
18183 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18184 !!end
18185
18186 !! test
18187 Edit comment with subpage link (bug 14080)
18188 !! options
18189 comment
18190 subpage
18191 title=[[Subpage test]]
18192 !! wikitext
18193 Poked at a [[/subpage]] here...
18194 !! html
18195 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
18196 !!end
18197
18198 !! test
18199 Edit comment with subpage link and link text (bug 14080)
18200 !! options
18201 comment
18202 subpage
18203 title=[[Subpage test]]
18204 !! wikitext
18205 Poked at a [[/subpage|neat little page]] here...
18206 !! html
18207 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
18208 !!end
18209
18210 !! test
18211 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
18212 !! options
18213 comment
18214 title=[[Subpage test]]
18215 !! wikitext
18216 Poked at a [[/subpage]] here...
18217 !! html
18218 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...
18219 !!end
18220
18221 !! test
18222 Edit comment with bare anchor link (local, as on diff)
18223 !! options
18224 comment
18225 local
18226 title=[[Main Page]]
18227 !! wikitext
18228 [[#section]]
18229 !! html
18230 <a href="#section">#section</a>
18231 !! end
18232
18233 !! test
18234 Edit comment with bare anchor link (non-local, as on history)
18235 !! options
18236 comment
18237 title=[[Main Page]]
18238 !! wikitext
18239 [[#section]]
18240 !! html
18241 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
18242 !! end
18243
18244 !! test
18245 Anchor starting with underscore
18246 !! wikitext
18247 [[#_ref|One]]
18248 !! html
18249 <p><a href="#_ref">One</a>
18250 </p>
18251 !! end
18252
18253 !! test
18254 Id starting with underscore
18255 !! wikitext
18256 <div id="_ref"></div>
18257 !! html
18258 <div id="_ref"></div>
18259
18260 !! end
18261
18262 !! test
18263 Space normalisation on autocomment (bug 22784)
18264 !! options
18265 comment
18266 title=[[Main Page]]
18267 !! wikitext
18268 /* __hello__world__ */
18269 !! html
18270 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
18271 !! end
18272
18273 !! test
18274 percent-encoding and + signs in comments (Bug 26410)
18275 !! options
18276 comment
18277 !! wikitext
18278 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
18279 !! html
18280 <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>
18281 !! end
18282
18283 # Parsoid doesn't support this yet: see bug 73581
18284 # but it *should* omit the 'src' attribute if the image is bad.
18285 # PHP side of tests was disabled in
18286 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
18287 # because of issues in the PHP parserTests infrastructure
18288 # (but the output below is indeed what the PHP side emits)
18289 !! test
18290 Bad images - basic functionality
18291 !! wikitext
18292 [[File:Bad.jpg]]
18293 !! DISABLED/html/php
18294 !! html/parsoid
18295 <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>
18296 !! end
18297
18298 !! test
18299 Bad images - bug 16039: text after bad image disappears
18300 !! wikitext
18301 Foo bar
18302 [[File:Bad.jpg]]
18303 Bar foo
18304 !! DISABLED/html/php
18305 <p>Foo bar
18306 </p><p>Bar foo
18307 </p>
18308 !! html/parsoid
18309 <p>Foo bar
18310 <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>
18311 Bar foo</p>
18312 !! end
18313
18314 !! test
18315 Verify that displaytitle works (bug #22501) no displaytitle
18316 !! options
18317 showtitle
18318 !! config
18319 wgAllowDisplayTitle=true
18320 wgRestrictDisplayTitle=false
18321 !! wikitext
18322 this is not the the title
18323 !! html
18324 Parser test
18325 <p>this is not the the title
18326 </p>
18327 !! end
18328
18329 !! test
18330 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
18331 !! options
18332 showtitle
18333 title=[[Screen]]
18334 !! config
18335 wgAllowDisplayTitle=true
18336 wgRestrictDisplayTitle=false
18337 !! wikitext
18338 this is not the the title
18339 {{DISPLAYTITLE:whatever}}
18340 !! html
18341 whatever
18342 <p>this is not the the title
18343 </p>
18344 !! end
18345
18346 !! test
18347 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
18348 !! options
18349 showtitle
18350 title=[[Screen]]
18351 !! config
18352 wgAllowDisplayTitle=true
18353 wgRestrictDisplayTitle=true
18354 !! wikitext
18355 this is not the the title
18356 {{DISPLAYTITLE:whatever}}
18357 !! html
18358 Screen
18359 <p>this is not the the title
18360 </p>
18361 !! end
18362
18363 !! test
18364 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
18365 !! options
18366 showtitle
18367 title=[[Screen]]
18368 !! config
18369 wgAllowDisplayTitle=true
18370 wgRestrictDisplayTitle=true
18371 !! wikitext
18372 this is not the the title
18373 {{DISPLAYTITLE:screen}}
18374 !! html
18375 screen
18376 <p>this is not the the title
18377 </p>
18378 !! end
18379
18380 !! test
18381 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
18382 !! options
18383 showtitle
18384 title=[[Screen]]
18385 !! config
18386 wgAllowDisplayTitle=false
18387 !! wikitext
18388 this is not the the title
18389 {{DISPLAYTITLE:screen}}
18390 !! html
18391 Screen
18392 <p>this is not the the title
18393 <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>
18394 </p>
18395 !! end
18396
18397 !! test
18398 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
18399 !! options
18400 showtitle
18401 title=[[Screen]]
18402 !! config
18403 wgAllowDisplayTitle=false
18404 !! wikitext
18405 this is not the the title
18406 !! html
18407 Screen
18408 <p>this is not the the title
18409 </p>
18410 !! end
18411
18412 !! test
18413 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
18414 !! options
18415 showtitle
18416 title=[[Screen]]
18417 !! config
18418 wgAllowDisplayTitle=true
18419 wgRestrictDisplayTitle=true
18420 !! wikitext
18421 this is not the the title
18422 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
18423 !! html
18424 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
18425 <p>this is not the the title
18426 </p>
18427 !! end
18428
18429 !! test
18430 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
18431 !! options
18432 showtitle
18433 title=[[Screen]]
18434 !! config
18435 wgAllowDisplayTitle=true
18436 wgRestrictDisplayTitle=true
18437 !! wikitext
18438 this is not the the title
18439 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
18440 !! html
18441 <span style="color: red;">s</span>creen
18442 <p>this is not the the title
18443 </p>
18444 !! end
18445
18446 !! test
18447 preload: check <noinclude> and <includeonly>
18448 !! options
18449 preload
18450 !! wikitext
18451 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
18452 !! html
18453 Hello kind world.
18454 !! end
18455
18456 !! test
18457 preload: check <onlyinclude>
18458 !! options
18459 preload
18460 !! wikitext
18461 Goodbye <onlyinclude>Hello world</onlyinclude>
18462 !! html
18463 Hello world
18464 !! end
18465
18466 !! test
18467 preload: can pass tags through if we want to
18468 !! options
18469 preload
18470 !! wikitext
18471 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
18472 !! html
18473 <includeonly>Hello world</includeonly>
18474 !! end
18475
18476 !! test
18477 preload: check that it doesn't try to do tricks
18478 !! options
18479 preload
18480 !! wikitext
18481 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18482 !! html
18483 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18484 !! end
18485
18486 !! test
18487 Play a bit with r67090 and bug 3158
18488 !! wikitext
18489 <div style="width:50% !important">&nbsp;</div>
18490 <div style="width:50%&nbsp;!important">&nbsp;</div>
18491 <div style="width:50%&#160;!important">&nbsp;</div>
18492 <div style="border : solid;">&nbsp;</div>
18493 !! html/php
18494 <div style="width:50% !important">&#160;</div>
18495 <div style="width:50% !important">&#160;</div>
18496 <div style="width:50% !important">&#160;</div>
18497 <div style="border&#160;: solid;">&#160;</div>
18498
18499 !! html/parsoid
18500 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18501 <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>
18502 <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>
18503 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18504
18505 !! end
18506
18507 !! test
18508 HTML5 data attributes
18509 !! wikitext
18510 <span data-foo="bar">Baz</span>
18511 <p data-abc-def_hij="">Quuz</p>
18512 !! html
18513 <p><span data-foo="bar">Baz</span>
18514 </p>
18515 <p data-abc-def_hij="">Quuz</p>
18516
18517 !! end
18518
18519 !! test
18520 percent-encoding and + signs in internal links (Bug 26410)
18521 !! wikitext
18522 [[User:+%]] [[Page+title%]]
18523 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
18524 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
18525 [[%33%45]] [[%33%45+]]
18526 !! html/php
18527 <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>
18528 <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>
18529 <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>
18530 <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>
18531 </p>
18532 !! html/parsoid
18533 <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>
18534 !! end
18535
18536 !! test
18537 Special characters in embedded file links (bug 27679)
18538 !! wikitext
18539 [[File:Contains & ampersand.jpg]]
18540 [[File:Does not exist.jpg|Title with & ampersand]]
18541 !! html/php
18542 <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>
18543 <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>
18544 </p>
18545 !! html/parsoid
18546 <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>
18547 <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>
18548 !! end
18549
18550 !! test
18551 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
18552 !! wikitext
18553 Text&apos;s been normalized?
18554 !! html
18555 <p>Text&#39;s been normalized?
18556 </p>
18557 !! end
18558
18559 !! test
18560 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
18561 !! wikitext
18562 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
18563 !! html
18564 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
18565 </p>
18566 !! end
18567
18568 !! test
18569 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
18570 !! wikitext
18571 [http://www.example.org/ ideograms]
18572 !! html
18573 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
18574 </p>
18575 !! end
18576
18577 !! test
18578 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
18579 !! wikitext
18580 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
18581 !! html
18582 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
18583 </p>
18584 !! end
18585
18586 !! article
18587 Mediawiki:loop1
18588 !! text
18589 {{Identical|A}}
18590 !! endarticle
18591
18592 !! article
18593 Mediawiki:loop2
18594 !! text
18595 {{Identical|B}}
18596 !! endarticle
18597
18598 !! article
18599 Template:Identical
18600 !! text
18601 {{int:loop1}}
18602 {{int:loop2}}
18603 !! endarticle
18604
18605 !! test
18606 Bug 31098 Template which includes system messages which includes the template
18607 !! wikitext
18608 {{Identical}}
18609 !! html
18610 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18611 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18612 </p>
18613 !! end
18614
18615 !! test
18616 Bug31490 Turkish: ucfirst 'blah'
18617 !! options
18618 language=tr
18619 !! wikitext
18620 {{ucfirst:blah}}
18621 !! html
18622 <p>Blah
18623 </p>
18624 !! end
18625
18626 !! test
18627 Bug31490 Turkish: ucfirst 'ix'
18628 !! options
18629 language=tr
18630 !! wikitext
18631 {{ucfirst:ix}}
18632 !! html
18633 <p>İx
18634 </p>
18635 !! end
18636
18637 !! test
18638 Bug31490 Turkish: lcfirst 'BLAH'
18639 !! options
18640 language=tr
18641 !! wikitext
18642 {{lcfirst:BLAH}}
18643 !! html
18644 <p>bLAH
18645 </p>
18646 !! end
18647
18648 !! test
18649 Bug31490 Turkish: ucfırst (with a dotless i)
18650 !! options
18651 language=tr
18652 !! wikitext
18653 {{ucfırst:blah}}
18654 !! html
18655 <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>
18656 </p>
18657 !! end
18658
18659 !! test
18660 Bug31490 ucfırst (with a dotless i) with English language
18661 !! options
18662 language=en
18663 !! wikitext
18664 {{ucfırst:blah}}
18665 !! html
18666 <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>
18667 </p>
18668 !! end
18669
18670 !! test
18671 Bug 26375: TOC with italics
18672 !! options
18673 title=[[Main Page]]
18674 !! wikitext
18675 __TOC__
18676 == ''Lost'' episodes ==
18677 !! html
18678 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18679 <ul>
18680 <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>
18681 </ul>
18682 </div>
18683
18684 <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>
18685
18686 !! end
18687
18688 !! test
18689 Bug 26375: TOC with bold
18690 !! options
18691 title=[[Main Page]]
18692 !! wikitext
18693 __TOC__
18694 == '''should be bold''' then normal text ==
18695 !! html
18696 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18697 <ul>
18698 <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>
18699 </ul>
18700 </div>
18701
18702 <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>
18703
18704 !! end
18705
18706 !! test
18707 Bug 33845: Headings become cursive in TOC when they contain an image
18708 !! options
18709 title=[[Main Page]]
18710 !! wikitext
18711 __TOC__
18712 == Image [[Image:foobar.jpg]] ==
18713 !! html
18714 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18715 <ul>
18716 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
18717 </ul>
18718 </div>
18719
18720 <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>
18721
18722 !! end
18723
18724 !! test
18725 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
18726 !! options
18727 title=[[Main Page]]
18728 !! wikitext
18729 __TOC__
18730 == <blockquote>Quote</blockquote> ==
18731 !! html
18732 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18733 <ul>
18734 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18735 </ul>
18736 </div>
18737
18738 <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>
18739
18740 !! html+tidy
18741 <div id="toc" class="toc">
18742 <div id="toctitle">
18743 <h2>Contents</h2>
18744 </div>
18745 <ul>
18746 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18747 </ul>
18748 </div>
18749 <h2><span class="mw-headline" id="Quote"></span></h2>
18750 <blockquote>
18751 <p><span class="mw-headline" id="Quote">Quote</span></p>
18752 </blockquote>
18753 <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>
18754 !! end
18755
18756 !! test
18757 Unclosed tags in TOC
18758 !! options
18759 title=[[Main Page]]
18760 !! wikitext
18761 __TOC__
18762 == Proof: 2 < 3 ==
18763 <small>Hanc marginis exiguitas non caperet.</small>
18764 QED
18765 !! html
18766 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18767 <ul>
18768 <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>
18769 </ul>
18770 </div>
18771
18772 <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>
18773 <p><small>Hanc marginis exiguitas non caperet.</small>
18774 QED
18775 </p>
18776 !! end
18777
18778 !! test
18779 Multiple tags in TOC
18780 !! wikitext
18781 __TOC__
18782 == <i>Foo</i> <b>Bar</b> ==
18783
18784 == <i>Foo</i> <blockquote>Bar</blockquote> ==
18785 !! html
18786 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18787 <ul>
18788 <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>
18789 <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>
18790 </ul>
18791 </div>
18792
18793 <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>
18794 <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>
18795
18796 !! html+tidy
18797 <div id="toc" class="toc">
18798 <div id="toctitle">
18799 <h2>Contents</h2>
18800 </div>
18801 <ul>
18802 <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>
18803 <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>
18804 </ul>
18805 </div>
18806 <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>
18807 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
18808 <blockquote>
18809 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
18810 </blockquote>
18811 <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>
18812 !! end
18813
18814 !! test
18815 Tags with parameters in TOC
18816 !! wikitext
18817 __TOC__
18818 == <sup class="in-h2">Hello</sup> ==
18819
18820 == <sup class="a > b">Evilbye</sup> ==
18821 !! html
18822 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18823 <ul>
18824 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
18825 <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>
18826 </ul>
18827 </div>
18828
18829 <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>
18830 <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>
18831
18832 !! end
18833
18834 !! test
18835 span tags with directionality in TOC
18836 !! wikitext
18837 __TOC__
18838 == <span dir="ltr">C++</span> ==
18839
18840 == <span dir="rtl">זבנג!</span> ==
18841
18842 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
18843
18844 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
18845
18846 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
18847 !! html
18848 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18849 <ul>
18850 <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>
18851 <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>
18852 <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>
18853 <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>
18854 <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>
18855 </ul>
18856 </div>
18857
18858 <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>
18859 <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>
18860 <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>
18861 <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>
18862 <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>
18863
18864 !! end
18865
18866 !! article
18867 MediaWiki:Bug32057
18868 !! text
18869 == {{int:headline_sample}} ==
18870 !! endarticle
18871
18872 !! test
18873 Bug 32057: Title needed when expanding <h> nodes.
18874 !! options
18875 title=[[Main Page]]
18876 !! wikitext
18877 {{int:Bug32057}}
18878 !! html
18879 <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>
18880
18881 !! end
18882
18883 !! test
18884 Strip marker in urlencode
18885 !! wikitext
18886 {{urlencode:x<nowiki/>y}}
18887 {{urlencode:x<nowiki/>y|wiki}}
18888 {{urlencode:x<nowiki/>y|path}}
18889 !! html
18890 <p>xy
18891 xy
18892 xy
18893 </p>
18894 !! end
18895
18896 !! test
18897 Strip marker in lc
18898 !! wikitext
18899 {{lc:x<nowiki/>y}}
18900 !! html
18901 <p>xy
18902 </p>
18903 !! end
18904
18905 !! test
18906 Strip marker in uc
18907 !! wikitext
18908 {{uc:x<nowiki/>y}}
18909 !! html
18910 <p>XY
18911 </p>
18912 !! end
18913
18914 !! test
18915 Strip marker in formatNum
18916 !! wikitext
18917 {{formatnum:1<nowiki/>2}}
18918 {{formatnum:1<nowiki/>2|R}}
18919 !! html
18920 <p>12
18921 12
18922 </p>
18923 !! end
18924
18925 !! test
18926 Check noCommafy in formatNum
18927 !! options
18928 language=be-tarask
18929 !! wikitext
18930 {{formatnum:123456.78}}
18931 {{formatnum:123456.78|NOSEP}}
18932 !! html
18933 <p>123 456,78
18934 123456.78
18935 </p>
18936 !! end
18937
18938 !! test
18939 Wrong option for formatNum (bug 56199)
18940 !! wikitext
18941 {{formatnum:1,234.56|Random}}
18942 {{formatnum:1,234.56|EVERYTHING}}
18943 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
18944 !! html
18945 <p>1,234.56
18946 1,234.56
18947 1,234.56
18948 </p>
18949 !! end
18950
18951 !! test
18952 Strip marker in grammar
18953 !! options
18954 language=fi
18955 !! wikitext
18956 {{grammar:elative|foo<nowiki/>bar}}
18957 !! html
18958 <p>foobarista
18959 </p>
18960 !! end
18961
18962 !! test
18963 Strip marker in padleft
18964 !! wikitext
18965 {{padleft:|2|x<nowiki/>y}}
18966 !! html
18967 <p>xy
18968 </p>
18969 !! end
18970
18971 !! test
18972 Strip marker in padright
18973 !! wikitext
18974 {{padright:|2|x<nowiki/>y}}
18975 !! html
18976 <p>xy
18977 </p>
18978 !! end
18979
18980 !! test
18981 Strip marker in anchorencode
18982 !! wikitext
18983 {{anchorencode:x<nowiki/>y}}
18984 !! html
18985 <p>xy
18986 </p>
18987 !! end
18988
18989 !! test
18990 nowiki inside link inside heading (bug 18295)
18991 !! wikitext
18992 ==[[foo|x<nowiki>y</nowiki>z]]==
18993 !! html
18994 <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>
18995
18996 !! end
18997
18998 !! test
18999 new support for bdi element (bug 31817)
19000 !! wikitext
19001 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19002 !! html
19003 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19004
19005 !!end
19006
19007 !! test
19008 Ignore pipe between table row attributes
19009 !! wikitext
19010 {|
19011 | quux
19012 |- id=foo | style='color: red'
19013 | bar
19014 |}
19015 !! html
19016 <table>
19017 <tr>
19018 <td> quux
19019 </td></tr>
19020 <tr id="foo" style="color: red">
19021 <td> bar
19022 </td></tr></table>
19023
19024 !! end
19025
19026 !!test
19027 Gallery override link with WikiLink (bug 34852)
19028 !! wikitext
19029 <gallery>
19030 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
19031 </gallery>
19032 !! html
19033 <ul class="gallery mw-gallery-traditional">
19034 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19035 <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>
19036 <div class="gallerytext">
19037 <p>caption
19038 </p>
19039 </div>
19040 </div></li>
19041 </ul>
19042
19043 !! end
19044
19045 !!test
19046 Gallery override link with absolute external link (bug 34852)
19047 !! wikitext
19048 <gallery>
19049 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19050 </gallery>
19051 !! html
19052 <ul class="gallery mw-gallery-traditional">
19053 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19054 <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>
19055 <div class="gallerytext">
19056 <p>caption
19057 </p>
19058 </div>
19059 </div></li>
19060 </ul>
19061
19062 !! end
19063
19064 !!test
19065 Gallery override link with malicious javascript (bug 34852)
19066 !! wikitext
19067 <gallery>
19068 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19069 </gallery>
19070 !! html
19071 <ul class="gallery mw-gallery-traditional">
19072 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19073 <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>
19074 <div class="gallerytext">
19075 <p>caption
19076 </p>
19077 </div>
19078 </div></li>
19079 </ul>
19080
19081 !! end
19082
19083 !!test
19084 Gallery with invalid title as link (bug 43964)
19085 !! wikitext
19086 <gallery>
19087 File:foobar.jpg|link=<
19088 </gallery>
19089 !! html
19090 <ul class="gallery mw-gallery-traditional">
19091 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19092 <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>
19093 <div class="gallerytext">
19094 </div>
19095 </div></li>
19096 </ul>
19097
19098 !! end
19099
19100 !!test
19101 Language parser function
19102 !! wikitext
19103 {{#language:ar}}
19104 !! html
19105 <p>العربية
19106 </p>
19107 !! end
19108
19109 !!test
19110 Padleft and padright as substr
19111 !! wikitext
19112 {{padleft:|3|abcde}}
19113 {{padright:|3|abcde}}
19114 !! html
19115 <p>abc
19116 abc
19117 </p>
19118 !! end
19119
19120 !!test
19121 Special parser function
19122 !! wikitext
19123 {{#special:RandomPage}}
19124 {{#special:BaDtItLe}}
19125 {{#special:Foobar}}
19126 !! html
19127 <p>Special:Random
19128 Special:Badtitle
19129 Special:Foobar
19130 </p>
19131 !! end
19132
19133 !!test
19134 Bug 34939 - Case insensitive link parsing ([HttP://])
19135 !! wikitext
19136 [HttP://MediaWiki.Org/]
19137 !! html/php
19138 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
19139 </p>
19140 !! html/parsoid
19141 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
19142 !! end
19143
19144 !!test
19145 Bug 34939 - Case insensitive link parsing ([HttP:// title])
19146 !! wikitext
19147 [HttP://MediaWiki.Org/ MediaWiki]
19148 !! html
19149 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
19150 </p>
19151 !! end
19152
19153 !!test
19154 Bug 34939 - Case insensitive link parsing (HttP://)
19155 !! wikitext
19156 HttP://MediaWiki.Org/
19157 !! html/php
19158 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
19159 </p>
19160 !! html/parsoid
19161 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
19162 !! end
19163
19164 !!test
19165 Disable TOC
19166 !! options
19167 notoc
19168 !! wikitext
19169 Lead
19170 == Section 1 ==
19171 == Section 2 ==
19172 == Section 3 ==
19173 == Section 4 ==
19174 == Section 5 ==
19175 !! html
19176 <p>Lead
19177 </p>
19178
19179 <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>
19180 <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>
19181 <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>
19182 <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>
19183 <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>
19184
19185 !! end
19186
19187
19188 ###
19189 ### Parsoid-specific tests
19190 ### Parsoid-PHP parser incompatibilities
19191 ###
19192 !!test
19193 1. SOL-sensitive wikitext tokens as template-args
19194 !!options
19195 parsoid=wt2html,wt2wt
19196 !! wikitext
19197 {{echo|*a}}
19198 {{echo|#a}}
19199 {{echo|:a}}
19200 !! html
19201 <span about="#mwt1" typeof="mw:Transclusion">
19202 </span><ul about="#mwt1"><li>a</li>
19203 </ul>
19204 <span about="#mwt2" typeof="mw:Transclusion">
19205 </span><ol about="#mwt2"><li>a</li>
19206 </ol>
19207 <span about="#mwt3" typeof="mw:Transclusion">
19208 </span><dl about="#mwt3"><dd>a</dd>
19209 </dl>
19210 !!end
19211
19212 #### -----------------------------------------------------------------
19213 #### Parsoid-specific functionality tests
19214 #### -----------------------------------------------------------------
19215
19216 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
19217 # We know wt2wt will fail, but we expect selser to pass.
19218 # Due to the nature of our testing, wt2wt and selser tests will enter the
19219 # blacklist and we'll catch selser regressions based on changes to the
19220 # blacklist entries for selser tests.
19221 !! test
19222 1. Bad treebuilder fixup of formatting elt is cleaned up
19223 !! options
19224 parsoid=wt2html,wt2wt
19225 !! wikitext
19226 {|
19227 |
19228 <small>
19229 [[Image:Foobar.jpg|right|Test]]
19230 </small>
19231 |}
19232 !! html/parsoid
19233 <table>
19234 <tbody><tr><td>
19235 <small>
19236 <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>
19237 </small>
19238 </td></tr>
19239 </tbody></table>
19240 !! end
19241
19242 !! test
19243 2. Bad treebuilder fixup of formatting elt is cleaned up
19244 !! options
19245 parsoid=wt2html,wt2wt
19246 !! wikitext
19247 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
19248
19249 <small>[[Image:Foobar.jpg|right|300px]]</small>
19250 !! html/parsoid
19251 <p><b>foo</b></p>
19252 <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>
19253 <p><b>bar</b></p>
19254 <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>
19255 !! end
19256
19257 #### ----------------------------------------------------------------
19258 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
19259 #### tags. Parsoid's output for these tags differs from that of the
19260 #### PHP parser.
19261 #### ----------------------------------------------------------------
19262
19263 !!test
19264 Ref: 1. ref-location should be replaced with an index span
19265 !!options
19266 parsoid
19267 !! wikitext
19268 A <ref>foo</ref>
19269 B <ref name="x">foo</ref>
19270 C <ref name="y" />
19271 !! html
19272 <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>
19273 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>
19274 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>
19275 !!end
19276
19277 !!test
19278 Ref: 2. ref-tags with identical names should all get the same index
19279 !!options
19280 parsoid
19281 !! wikitext
19282 A <ref name="x">foo</ref>
19283 B <ref name="x" />
19284 !! html
19285 <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>
19286 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>
19287 !!end
19288
19289 !!test
19290 Ref: 3. spaces in ref-names should be ignored
19291 !!options
19292 parsoid
19293 !! wikitext
19294 A <ref name="x">foo</ref>
19295 B <ref name=" x " />
19296 C <ref name= x />
19297 !! html
19298 <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>
19299 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>
19300 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>
19301 !!end
19302
19303 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
19304 !!test
19305 Ref: 4. 'constructor' should be accepted as a valid ref-name
19306 !!options
19307 parsoid
19308 !! wikitext
19309 A <ref name="constructor">foo</ref>
19310 !! html
19311 <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>
19312 !!end
19313
19314 !!test
19315 Ref: 5. body should accept generic wikitext
19316 !!options
19317 parsoid
19318 !! wikitext
19319 A <ref>
19320 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
19321 </ref>
19322
19323 <references />
19324 !! html
19325 <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>
19326
19327 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19328 <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>
19329 </li>
19330 </ol>
19331 !!end
19332
19333 !!test
19334 Ref: 6. indent-pres should not be output in ref-body
19335 !!options
19336 parsoid
19337 !! wikitext
19338 A <ref>
19339 foo
19340 bar
19341 baz
19342 </ref>
19343
19344 <references />
19345 !! html
19346 <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>
19347
19348 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19349 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
19350 bar
19351 baz
19352 </li>
19353 </ol>
19354 !!end
19355
19356 !!test
19357 Ref: 7. No p-wrapping in ref-body
19358 !!options
19359 parsoid
19360 !! wikitext
19361 A <ref>
19362 foo
19363
19364 bar
19365
19366
19367 baz
19368
19369
19370
19371 booz
19372 </ref>
19373
19374 <references />
19375 !! html
19376 <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>
19377
19378 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19379 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
19380
19381 bar
19382
19383
19384 baz
19385
19386
19387
19388 booz
19389 </li>
19390 </ol>
19391 !!end
19392
19393 !!test
19394 Ref: 8. transclusion wikitext has lower precedence
19395 !!options
19396 parsoid
19397 !! wikitext
19398 A <ref> foo {{echo|</ref> B C}}
19399
19400 <references />
19401 !! html
19402 <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>
19403 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19404 <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>
19405 </ol>
19406 !!end
19407
19408 !!test
19409 Ref: 9. unclosed comments should not leak out of ref-body
19410 !!options
19411 parsoid
19412 !! wikitext
19413 A <ref> foo <!--</ref> B C
19414 <references />
19415 !! html
19416 <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>
19417 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19418 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li>
19419 </ol>
19420 !!end
19421
19422 !!test
19423 Ref: 10. Unclosed HTML tags should not leak out of ref-body
19424 !!options
19425 parsoid
19426 !! wikitext
19427 A <ref> <b> foo </ref> B C
19428
19429 <references />
19430 !! html
19431 <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>
19432
19433
19434 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19435 <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>
19436 </ol>
19437 !!end
19438
19439 !!test
19440 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
19441 !!options
19442 parsoid
19443 !! wikitext
19444 A <ref>foo</ref> B
19445 C <ref>bar</ref> D
19446 !! html
19447 <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
19448 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>
19449 !!end
19450
19451 !!test
19452 Ref: 12. ref-tags act as trailing newline migration barrier
19453 !!options
19454 parsoid
19455 !! wikitext
19456 <!--the newline at the end of this line moves out of the p-tag-->a
19457
19458 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
19459 <ref />
19460
19461 c
19462 !! html
19463 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
19464
19465
19466 <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>
19467 <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>
19468
19469 <p>c</p>
19470 !!end
19471
19472 !!test
19473 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
19474 !!options
19475 parsoid
19476 !! wikitext
19477 <ref>foo</ref> A
19478 <ref>bar
19479 </ref> B
19480 !! html
19481 <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
19482 <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>
19483 !!end
19484
19485 !!test
19486 Ref: 14. A nested ref-tag should be emitted as plain text
19487 !!options
19488 parsoid
19489 !! wikitext
19490 <ref>foo <ref>bar</ref> baz</ref>
19491
19492 <references />
19493 !! html
19494 <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>
19495
19496 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19497 <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>
19498 </ol>
19499 !!end
19500
19501 !!test
19502 Ref: 15. ref-tags with identical names should get identical indexes
19503 !!options
19504 parsoid
19505 !! wikitext
19506 A1 <ref name="a">foo</ref> A2 <ref name="a" />
19507 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
19508
19509 <references />
19510 !! html
19511 <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>
19512 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>
19513
19514 <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>
19515 </ol>
19516 !!end
19517
19518 ## We don't bother wt2wt-ing non-standard whitespace
19519 !!test
19520 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
19521 !!options
19522 parsoid=wt2html
19523 !! wikitext
19524 A <ref >foo</ref >
19525
19526 <references />
19527 !! html
19528 <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>
19529
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></ol>
19532 !!end
19533
19534 !!test
19535 Ref: 17. Generate valid HTML5 id/about attributes
19536 !!options
19537 parsoid
19538 !!wikitext
19539 <ref name="a b">foo</ref>
19540
19541 <references />
19542 !!html
19543 <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>
19544 </p>
19545
19546 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19547 <li id="cite_note-a_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_b-1-0">↑</a></span> foo</li>
19548 !!end
19549
19550 !!test
19551 References: 1. references tag without any refs should be handled properly
19552 !!options
19553 parsoid
19554 !! wikitext
19555 <references />
19556 !! html
19557 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
19558 !!end
19559
19560 !!test
19561 References: 2. references tag with group only outputs references from that group
19562 !!options
19563 parsoid
19564 !! wikitext
19565 A <ref group="a">foo</ref>
19566 B <ref group="b">bar</ref>
19567
19568 <references group="a" />
19569 !! html
19570 <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>
19571 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>
19572
19573 <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>
19574 </ol>
19575 !!end
19576
19577 !!test
19578 References: 3. ref list should be cleared after processing references
19579 !!options
19580 parsoid
19581 !! wikitext
19582 A <ref>foo</ref>
19583
19584 <references />
19585
19586 B <ref>bar</ref>
19587
19588 <references />
19589 !! html
19590 <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>
19591
19592 <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>
19593 </ol>
19594
19595 <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>
19596
19597 <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>
19598 </ol>
19599 !!end
19600
19601 !!test
19602 References: 4. only referenced group should be cleared after processing references
19603 !!options
19604 parsoid
19605 !! wikitext
19606 A <ref group="a">afoo</ref>
19607 B <ref>bfoo</ref>
19608
19609 <references group="a" />
19610
19611 C <ref>cfoo</ref>
19612
19613 <references />
19614 !! html
19615 <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>
19616 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>
19617
19618 <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>
19619 </ol>
19620
19621 <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>
19622
19623 <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>
19624 </ol>
19625 !!end
19626
19627 !!test
19628 References: 5. ref tags in references should be processed while ignoring all other content
19629 !!options
19630 parsoid
19631 !! wikitext
19632 A <ref name="a" />
19633 B <ref name="b">bar</ref>
19634
19635 <references>
19636 <ref name="a">foo</ref>
19637 This should just get lost.
19638 </references>
19639 !! html
19640 <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>
19641 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>
19642
19643
19644 <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>
19645 </ol>
19646 !!end
19647
19648 !!test
19649 References: 6. <references /> from a transclusion
19650 !!options
19651 parsoid
19652 !! wikitext
19653 <ref>Foo</ref> {{echo|<references />}}
19654 !! html
19655 <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>
19656 !!end
19657
19658 !! test
19659 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
19660 !! options
19661 parsoid
19662 !! wikitext
19663 A <ref>foo bar for a</ref>
19664 B <ref group="X" name="b" />
19665
19666 <references />
19667
19668 <references group="X">
19669 <ref name="b">foo</ref>
19670 </references>
19671 !! html
19672 <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>
19673 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>
19674
19675 <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>
19676
19677 <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>
19678 !! end
19679
19680 !! test
19681 Entities in ref name
19682 !! options
19683 parsoid
19684 !! wikitext
19685 <ref name="test &amp; me">hi</ref>
19686 !! html
19687 <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>
19688 !! end
19689
19690 # This test is wt2html only because we're permitting the serializer to produce
19691 # dirty diffs, normalizing the unclosed references to the self-closed version.
19692 !! test
19693 Generate references for unclosed references tag
19694 !! options
19695 parsoid=wt2html
19696 !! wikitext
19697 a<ref>foo</ref>
19698
19699 <references>
19700 !! html
19701 <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>
19702
19703
19704 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19705 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19706 !! end
19707
19708 !! test
19709 New reference serializes on its own line
19710 !! options
19711 parsoid=wt2wt,html2wt
19712 !! wikitext
19713 foo
19714 <references />
19715 !! html
19716 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
19717 !! end
19718
19719 #--------- Test stripping of empty nodes in template content ----------
19720 !!test
19721 Empty LI and TR nodes should be stripped from template content
19722 !!wikitext
19723 {{EmptyLITest}}
19724 {{EmptyTRTest}}
19725 !!html/parsoid
19726 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
19727 <li>a</li>
19728 <li>b</li>
19729 </ul>
19730 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
19731 <tbody>
19732 <tr>
19733 <td>foo</td>
19734 </tr>
19735 <tr>
19736 <td>bar</td>
19737 </tr>
19738 </tbody>
19739 </table>
19740 !!end
19741
19742 !!test
19743 Empty LI and TR nodes should not be stripped from top-level content
19744 !!wikitext
19745 * a
19746 *
19747 * b
19748 {|
19749 |-
19750 |-
19751 |foo
19752 |}
19753 !!html/parsoid
19754 <ul>
19755 <li> a</li>
19756 <li></li>
19757 <li> b</li>
19758 </ul>
19759 <table>
19760 <tbody>
19761 <tr></tr>
19762 <tr>
19763 <td>foo</td>
19764 </tr>
19765 </tbody>
19766 </table>
19767 !!end
19768
19769 !!test
19770 Empty TR nodes should not be stripped if they have any attributes set
19771 !!wikitext
19772 {{EmptyTRWithHTMLAttrTest}}
19773 !!html/parsoid
19774 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
19775 <tr align="center"></tr>
19776 <tr><td>foo</td></tr>
19777 <tr align="center"></tr>
19778 <tr><td>bar</td></tr>
19779 </table>
19780 !!end
19781
19782 #### ----------------------------------------------------------------
19783 #### The following section of tests are primarily to test
19784 #### wikitext escaping capabilities of Parsoid. Given that
19785 #### escaping can be done any number of ways, the wikitext (input)
19786 #### is always adjusted to reflect how Parsoid adds nowiki
19787 #### escape tags.
19788 ####
19789 #### We are marking several tests as parsoid-only since the
19790 #### HTML in the result section is different from what the
19791 #### PHP parser generates for it.
19792 #### ----------------------------------------------------------------
19793
19794
19795 #### --------------- Headings ---------------
19796 #### 0. Unnested
19797 #### 1. Nested inside html <h1>=foo=</h1>
19798 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
19799 #### 3. Nested inside html with wikitext split by html tags
19800 #### 4. No escape needed
19801 #### 5. Empty headings <h1></h1>
19802 #### 6. Heading chars in SOL context
19803 #### ----------------------------------------
19804 !! test
19805 Headings: 0. Unnested
19806 !! options
19807 parsoid
19808 !! wikitext
19809 <nowiki>=foo=</nowiki>
19810
19811 <nowiki> =foo= </nowiki>
19812 <!--cmt-->
19813 <nowiki>=foo=</nowiki>
19814
19815 =foo''a''<nowiki>=</nowiki>
19816 !! html
19817 <p><span typeof="mw:Nowiki">=foo=</span></p>
19818
19819 <p><span typeof="mw:Nowiki"> =foo= </span>
19820 <!--cmt-->
19821 <span typeof="mw:Nowiki">=foo=</span></p>
19822
19823 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
19824 !!end
19825
19826 # New headings and existing headings are handled differently
19827 !! test
19828 Headings: 1. Nested inside html
19829 !! options
19830 parsoid=html2wt
19831 !! wikitext
19832 = =foo= =
19833
19834 == =foo= ==
19835
19836 === =foo= ===
19837
19838 =<nowiki>=foo=</nowiki>=
19839 ==<nowiki>=foo=</nowiki>==
19840 ===<nowiki>=foo=</nowiki>===
19841 ====<nowiki>=foo=</nowiki>====
19842 =====<nowiki>=foo=</nowiki>=====
19843 ======<nowiki>=foo=</nowiki>======
19844
19845 !! html
19846 <h1>=foo=</h1>
19847 <h2>=foo=</h2>
19848 <h3>=foo=</h3>
19849
19850 <h1 data-parsoid=''>=foo=</h1>
19851 <h2 data-parsoid=''>=foo=</h2>
19852 <h3 data-parsoid=''>=foo=</h3>
19853 <h4 data-parsoid=''>=foo=</h4>
19854 <h5 data-parsoid=''>=foo=</h5>
19855 <h6 data-parsoid=''>=foo=</h6>
19856 !!end
19857
19858 !! test
19859 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
19860 !! options
19861 parsoid=html2wt
19862 !! wikitext
19863 = foo =
19864 <nowiki>*</nowiki>bar
19865
19866 = foo =
19867 =bar
19868
19869 = foo =
19870 <nowiki>=bar=</nowiki>
19871 !! html
19872 <h1>foo</h1>*bar
19873 <h1>foo</h1>=bar
19874 <h1>foo</h1>=bar=
19875 !!end
19876
19877 !! test
19878 Headings: 3. Nested inside html with wikitext split by html tags
19879 !! options
19880 parsoid=html2wt
19881 !! wikitext
19882 = ='''bold'''<nowiki>foo=</nowiki> =
19883 !! html
19884 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
19885 !!end
19886
19887 !! test
19888 Headings: 4a. No escaping needed (testing just h1 and h2)
19889 !! options
19890 parsoid=html2wt
19891 !! wikitext
19892 = =foo =
19893
19894 = foo= =
19895
19896 = =foo= =
19897
19898 = =foo= bar =
19899
19900 == =foo ==
19901
19902 == foo= ==
19903
19904 = ''=''foo= =
19905
19906 = <nowiki>=</nowiki> =
19907 !! html
19908 <h1>=foo</h1>
19909 <h1>foo=</h1>
19910 <h1> =foo= </h1>
19911 <h1>=foo= bar</h1>
19912 <h2>=foo</h2>
19913 <h2>foo=</h2>
19914 <h1><i>=</i>foo=</h1>
19915 <h1><span typeof="mw:Nowiki">=</span></h1>
19916 !!end
19917
19918 !! test
19919 Headings: 4b. No escaping needed (inside p-tags)
19920 !! options
19921 parsoid=html2wt
19922 !! wikitext
19923 ===
19924 =foo= x
19925 =foo= <s></s>
19926 !! html
19927 <p>===
19928 =foo= x
19929 =foo= <s></s>
19930 </p>
19931 !!end
19932
19933 !! test
19934 Headings: 5. Empty headings
19935 !! options
19936 parsoid
19937 !! wikitext
19938 =<nowiki/>=
19939
19940 ==<nowiki/>==
19941
19942 ===<nowiki/>===
19943
19944 ====<nowiki/>====
19945
19946 =====<nowiki/>=====
19947
19948 ======<nowiki/>======
19949 !! html
19950 <h1></h1>
19951 <h2></h2>
19952 <h3></h3>
19953 <h4></h4>
19954 <h5></h5>
19955 <h6></h6>
19956 !!end
19957
19958 !! test
19959 Headings: 6a. Heading chars in SOL context (with trailing spaces)
19960 !! options
19961 parsoid
19962 !! wikitext
19963 <nowiki>=a=</nowiki>
19964
19965 <nowiki>=a=</nowiki>
19966
19967 <nowiki>=a=</nowiki>
19968
19969 <nowiki>=a=</nowiki>
19970 !! html
19971 <p>=a=</p>
19972 <p>=a= </p>
19973 <p>=a= </p>
19974 <p>=a= </p>
19975 !!end
19976
19977 !! test
19978 Headings: 6b. Heading chars in SOL context (with trailing newlines)
19979 !! options
19980 parsoid
19981 !! wikitext
19982 <nowiki>=a=
19983 b</nowiki>
19984
19985 <nowiki>=a=
19986 b</nowiki>
19987
19988 <nowiki>=a=
19989 b</nowiki>
19990
19991 <nowiki>=a=
19992 b</nowiki>
19993 !! html
19994 <p>=a=
19995 b</p>
19996 <p>=a=
19997 b</p>
19998 <p>=a=
19999 b</p>
20000 <p>=a=
20001 b</p>
20002 </p>
20003 !!end
20004
20005 !! test
20006 Headings: 6c. Heading chars in SOL context (leading newline break)
20007 !! options
20008 parsoid
20009 !! wikitext
20010 a
20011 <nowiki>=b=</nowiki>
20012 !! html
20013 <p>a
20014 =b=</p>
20015 !!end
20016
20017 !! test
20018 Headings: 6d. Heading chars in SOL context (with interspersed comments)
20019 !! options
20020 parsoid
20021 !! wikitext
20022 <!--c0--><nowiki>=a=</nowiki>
20023
20024 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
20025 !! html
20026 <p><!--c0-->=a=</p>
20027 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
20028 !!end
20029
20030 !! test
20031 Headings: 6d. Heading chars in SOL context (No escaping needed)
20032 !! options
20033 parsoid=html2wt
20034 !! wikitext
20035 =a=<div>b</div>
20036 !! html
20037 =a=<div>b</div>
20038 !!end
20039
20040 #### --------------- Lists ---------------
20041 #### 0. Outside nests (*foo, etc.)
20042 #### 1. Nested inside html <ul><li>*foo</li></ul>
20043 #### 2. Inside definition lists
20044 #### 3. Only bullets at start should be escaped
20045 #### 4. No escapes needed
20046 #### 5. No unnecessary escapes
20047 #### 6. Escape bullets in SOL position
20048 #### 7. Escape bullets in a multi-line context
20049 #### ----------------------------------------
20050
20051 !! test
20052 Lists: 0. Outside nests
20053 !! wikitext
20054 <nowiki>*</nowiki>foo
20055
20056 <nowiki>#</nowiki>foo
20057
20058 <nowiki>;Foo:</nowiki>bar
20059 !! html
20060 <p>*foo
20061 </p><p>#foo
20062 </p><p>;Foo:bar
20063 </p>
20064 !!end
20065
20066 !! test
20067 Lists: 1. Nested inside html
20068 !! wikitext
20069 *<nowiki>*foo</nowiki>
20070
20071 *<nowiki>#foo</nowiki>
20072
20073 *<nowiki>:foo</nowiki>
20074
20075 *<nowiki>;foo</nowiki>
20076
20077 #<nowiki>*foo</nowiki>
20078
20079 #<nowiki>#foo</nowiki>
20080
20081 #<nowiki>:foo</nowiki>
20082
20083 #<nowiki>;foo</nowiki>
20084 !! html
20085 <ul><li>*foo</li></ul>
20086 <ul><li>#foo</li></ul>
20087 <ul><li>:foo</li></ul>
20088 <ul><li>;foo</li></ul>
20089 <ol><li>*foo</li></ol>
20090 <ol><li>#foo</li></ol>
20091 <ol><li>:foo</li></ol>
20092 <ol><li>;foo</li></ol>
20093
20094 !!end
20095
20096 !! test
20097 Lists: 2. Inside definition lists
20098 !! wikitext
20099 ;<nowiki>;foo</nowiki>
20100
20101 ;<nowiki>:foo</nowiki>
20102
20103 ;<nowiki>:foo</nowiki>
20104 :bar
20105
20106 :<nowiki>:foo</nowiki>
20107 !! html
20108 <dl><dt>;foo</dt></dl>
20109 <dl><dt>:foo</dt></dl>
20110 <dl><dt>:foo</dt>
20111 <dd>bar</dd></dl>
20112 <dl><dd>:foo</dd></dl>
20113
20114 !!end
20115
20116 !! test
20117 Lists: 3. Only bullets at start of text should be escaped
20118 !! wikitext
20119 *<nowiki>*foo*bar</nowiki>
20120
20121 *<nowiki>*foo</nowiki>''it''*bar
20122 !! html
20123 <ul><li>*foo*bar</li></ul>
20124 <ul><li>*foo<i>it</i>*bar</li></ul>
20125
20126 !!end
20127
20128 !! test
20129 Lists: 4. No escapes needed
20130 !! options
20131 parsoid
20132 !! wikitext
20133 *foo*bar
20134
20135 *''foo''*bar
20136
20137 *[[Foo]]: bar
20138
20139 *[[Foo]]*bar
20140 !! html
20141 <ul>
20142 <li>foo*bar
20143 </li>
20144 </ul>
20145 <ul>
20146 <li><i>foo</i>*bar
20147 </li>
20148 </ul>
20149 <ul>
20150 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
20151 </li>
20152 </ul>
20153 <ul>
20154 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
20155 </li>
20156 </ul>
20157 !!end
20158
20159 !! test
20160 Lists: 5. No unnecessary escapes
20161 !! wikitext
20162 * bar <span><nowiki>[[foo]]</nowiki></span>
20163
20164 *=bar <span><nowiki>[[foo]]</nowiki></span>
20165
20166 *[[bar <span><nowiki>[[foo]]</nowiki></span>
20167
20168 *]]bar <span><nowiki>[[foo]]</nowiki></span>
20169
20170 *=bar <span>foo]]</span>=
20171
20172 * <s></s>: a
20173 !! html
20174 <ul><li> bar <span>[[foo]]</span></li></ul>
20175 <ul><li>=bar <span>[[foo]]</span></li></ul>
20176 <ul><li>[[bar <span>[[foo]]</span></li></ul>
20177 <ul><li>]]bar <span>[[foo]]</span></li></ul>
20178 <ul><li>=bar <span>foo]]</span>=</li></ul>
20179 <ul><li> <s></s>: a</li></ul>
20180
20181 !!end
20182
20183 !! test
20184 Lists: 6. Escape bullets in SOL position
20185 !! options
20186 parsoid
20187 !! wikitext
20188 <!--cmt--><nowiki>*foo</nowiki>
20189 !! html
20190 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
20191 !!end
20192
20193 !! test
20194 Lists: 7. Escape bullets in a multi-line context
20195 !! wikitext
20196 a
20197 <nowiki>*</nowiki>b
20198 !! html
20199 <p>a
20200 *b
20201 </p>
20202 !!end
20203
20204 #### --------------- HRs ---------------
20205 #### 1. Single line
20206 #### -----------------------------------
20207
20208 !! test
20209 HRs: 1. Single line
20210 !! options
20211 parsoid
20212 !! wikitext
20213 ----<nowiki>----</nowiki>
20214 ----=foo=
20215 ----*foo
20216 !! html
20217 <hr><p><span typeof="mw:Nowiki">----</span></p>
20218 <hr><p>=foo=</p>
20219 <hr><p>*foo</p>
20220 !! end
20221
20222 #### --------------- Tables ---------------
20223 #### 1a. Simple example
20224 #### 1b. No escaping needed (!foo)
20225 #### 1c. No escaping needed (|foo)
20226 #### 1d. No escaping needed (|}foo)
20227 ####
20228 #### 2a. Nested in td (<td>foo|bar</td>)
20229 #### 2b. Nested in td (<td>foo||bar</td>)
20230 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
20231 ####
20232 #### 3a. Nested in th (<th>foo!bar</th>)
20233 #### 3b. Nested in th (<th>foo!!bar</th>)
20234 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
20235 ####
20236 #### 4a. Escape -
20237 #### 4b. Escape +
20238 #### 4c. No escaping needed
20239 #### --------------------------------------
20240
20241 !! test
20242 Tables: 1a. Simple example
20243 !! wikitext
20244 <nowiki>{|
20245 |}</nowiki>
20246 !! html
20247 <p>{|
20248 |}
20249 </p>
20250 !! end
20251
20252 !! test
20253 Tables: 1b. No escaping needed
20254 !! wikitext
20255 !foo
20256 !! html
20257 <p>!foo
20258 </p>
20259 !! end
20260
20261 !! test
20262 Tables: 1c. No escaping needed
20263 !! wikitext
20264 |foo
20265 !! html
20266 <p>|foo
20267 </p>
20268 !! end
20269
20270 !! test
20271 Tables: 1d. No escaping needed
20272 !! wikitext
20273 |}foo
20274 !! html
20275 <p>|}foo
20276 </p>
20277 !! end
20278
20279 !! test
20280 Tables: 2a. Nested in td
20281 !! options
20282 parsoid=html2wt
20283 !! wikitext
20284 {|
20285 |<nowiki>foo|bar</nowiki>
20286 |-
20287 |x<div><nowiki>a|b</nowiki></div>
20288 |}
20289 !! html
20290 <table><tbody><tr>
20291 <td>foo|bar</td></tr>
20292 <tr><td>x<div>a|b</div></td>
20293 </tbody></table>
20294 !! end
20295
20296 !! test
20297 Tables: 2b. Nested in td
20298 !! options
20299 parsoid
20300 !! wikitext
20301 {|
20302 |<nowiki>foo||bar</nowiki>
20303 |''it''<nowiki>foo||bar</nowiki>
20304 |}
20305 !! html
20306 <table><tbody><tr>
20307 <td><span typeof="mw:Nowiki">foo||bar</span></td>
20308 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
20309 !! end
20310
20311 !! test
20312 Tables: 2c. Nested in td -- no escaping needed
20313 !! options
20314 parsoid
20315 !! wikitext
20316 {|
20317 |foo!!bar
20318 |}
20319 !! html
20320 <table><tbody><tr><td>foo!!bar
20321 </td></tr></tbody></table>
20322
20323 !! end
20324
20325 !! test
20326 Tables: 3a. Nested in th
20327 !! options
20328 parsoid
20329 !! wikitext
20330 {|
20331 !foo!bar
20332 |}
20333 !! html
20334 <table><tbody><tr><th>foo!bar
20335 </th></tr></tbody></table>
20336
20337 !! end
20338
20339 !! test
20340 Tables: 3b. Nested in th
20341 !! options
20342 parsoid
20343 !! wikitext
20344 {|
20345 !<nowiki>foo!!bar</nowiki>
20346 |}
20347 !! html
20348 <table>
20349 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
20350 </tbody></table>
20351 !! end
20352
20353 !! test
20354 Tables: 3c. Nested in th -- no escaping needed
20355 !! options
20356 parsoid
20357 !! wikitext
20358 {|
20359 !<nowiki>foo||bar</nowiki>
20360 |}
20361 !! html
20362 <table><tbody><tr>
20363 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
20364 !! end
20365
20366 !! test
20367 Tables: 4a. Escape -
20368 !! options
20369 parsoid
20370 !! wikitext
20371 {|
20372 !-bar
20373 |-
20374 |<nowiki>-bar</nowiki>
20375 |}
20376 !! html
20377 <table><tbody>
20378 <tr><th>-bar</th></tr>
20379 <tr>
20380 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
20381 !! end
20382
20383 !! test
20384 Tables: 4b. Escape +
20385 !! options
20386 parsoid
20387 !! wikitext
20388 {|
20389 !+bar
20390 |-
20391 |<nowiki>+bar</nowiki>
20392 |}
20393 !! html
20394 <table><tbody>
20395 <tr><th>+bar</th></tr>
20396 <tr>
20397 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
20398 !! end
20399
20400 !! test
20401 Tables: 4c. No escaping needed
20402 !! options
20403 parsoid
20404 !! wikitext
20405 {|
20406 |foo-bar
20407 |foo+bar
20408 |-
20409 |''foo''-bar
20410 |''foo''+bar
20411 |-
20412 |foo
20413 bar|baz
20414 +bar
20415 -bar
20416 |-
20417 |x
20418 <div>a|b</div>
20419 |}
20420 !! html
20421 <table><tbody>
20422 <tr><td>foo-bar</td><td>foo+bar</td></tr>
20423 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
20424 <tr><td>foo
20425 <p>bar|baz
20426 +bar
20427 -bar</p></td></tr>
20428 <tr><td>x
20429 <div>a|b</div></td>
20430 </tbody></table>
20431 !! end
20432
20433 !! test
20434 Tables: 4d. No escaping needed
20435 !! options
20436 parsoid
20437 !! wikitext
20438 {|
20439 |[[Foo]]-bar
20440 ||+1
20441 ||-2
20442 |}
20443 !! html
20444 <table>
20445 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
20446 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
20447 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
20448 </tbody></table>
20449 !! end
20450
20451 !! test
20452 Tables: Digest broken attributes on table and tr tag
20453 !! options
20454 parsoid=wt2html
20455 !! wikitext
20456 {| || |} ++
20457 |- || || ++ --
20458 |- > [
20459 |}
20460 !! html
20461 <table>
20462 <tbody>
20463 <tr></tr>
20464 <tr></tr>
20465 </tbody></table>
20466 !! end
20467
20468 #### --------------- Links ----------------
20469 #### 1. Quote marks in link text
20470 #### 2. Wikilinks: Escapes needed
20471 #### 3. Wikilinks: No escapes needed
20472 #### 4. Extlinks: Escapes needed
20473 #### 5. Extlinks: No escapes needed
20474 #### --------------------------------------
20475 !! test
20476 Links 1. Quote marks in link text
20477 !! options
20478 parsoid
20479 !! wikitext
20480 [[Foo|Foo<nowiki>''boo''</nowiki>]]
20481 !! html
20482 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
20483 !! end
20484
20485 !! test
20486 Links 2. WikiLinks: Escapes needed
20487 !! options
20488 parsoid
20489 !! wikitext
20490 [[Foo|[Foobar]]]
20491 [[Foo|<nowiki>Foobar]</nowiki>]]
20492 [[Foo|x [Foobar] x]]
20493 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
20494 [[Foo|<nowiki>[[Bar]]</nowiki>]]
20495 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
20496 [[Foo|<nowiki>|Bar</nowiki>]]
20497 [[Foo|<nowiki>]]bar</nowiki>]]
20498 [[Foo|<nowiki>[[bar</nowiki>]]
20499 [[Foo|<nowiki>x [[ y</nowiki>]]
20500 [[Foo|<nowiki>x ]] y</nowiki>]]
20501 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
20502 !! html
20503 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
20504 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
20505 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
20506 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
20507 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
20508 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
20509 <a href="Foo" rel="mw:WikiLink">|Bar</a>
20510 <a href="Foo" rel="mw:WikiLink">]]bar</a>
20511 <a href="Foo" rel="mw:WikiLink">[[bar</a>
20512 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
20513 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
20514 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
20515 !! end
20516
20517 !! test
20518 Links 3. WikiLinks: No escapes needed
20519 !! options
20520 parsoid
20521 !! wikitext
20522 [[Foo|[Foobar]]
20523 [[Foo|foo|bar]]
20524 !! html
20525 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
20526 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
20527 !! end
20528
20529 !! test
20530 Links 4. ExtLinks: Escapes needed
20531 !! options
20532 parsoid
20533 !! wikitext
20534 [http://google.com <nowiki>[google]</nowiki>]
20535 [http://google.com <nowiki>google]</nowiki>]
20536
20537 <nowiki>[http://google.com]</nowiki>
20538
20539 <nowiki>[http://google.com google]</nowiki>
20540
20541 !! html
20542 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
20543 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
20544 <p>[http://google.com]</p>
20545 <p>[http://google.com google]</p>
20546 !! end
20547
20548 !! test
20549 Links 5. ExtLinks: No escapes needed
20550 !! options
20551 parsoid
20552 !! wikitext
20553 [http://google.com [google]
20554 !! html
20555 <a href="http://google.com" rel="mw:ExtLink">[google</a>
20556 !! end
20557
20558 !! test
20559 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
20560 !! html/parsoid
20561 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
20562 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
20563 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
20564 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
20565 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
20566 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
20567 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20568 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
20569 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20570 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
20571 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
20572 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
20573 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
20574 </p>
20575 !! wikitext
20576 x<nowiki/>http://example.com<nowiki/>y
20577 http://example.com<nowiki/>?x
20578 http://example.com<nowiki/>&x
20579 http://example.com<nowiki/>'x
20580 http://example.com<nowiki/>,x
20581 http://example.com<nowiki/>.x
20582 http://example.com<nowiki/>;x
20583 http://example.com<nowiki/>:x
20584 http://example.com<nowiki/>;x
20585 http://example.com<nowiki/>!x
20586 http://example.com<nowiki/>=x
20587 http://example.com<nowiki/>(x)
20588 http://example.com(x<nowiki/>)
20589 !! end
20590
20591 !! test
20592 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20593 !! html/parsoid
20594 <p>x
20595 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
20596 y
20597 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
20598 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
20599 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
20600 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
20601 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
20602 </p>
20603 !! wikitext
20604 x
20605 http://example.com
20606 y
20607 "http://example.com"
20608 (http://example.com)
20609 (http://example.com) foo
20610 http://example.com,
20611 http://example.com, foo
20612 !! end
20613
20614 ## Parsoid currently fails wt2html on this one!
20615 !! test
20616 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20617 !! html/parsoid
20618 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
20619 !! wikitext
20620 http://example.com.,;:!?
20621 !! end
20622
20623 !! test
20624 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
20625 !! html/parsoid
20626 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
20627 !! wikitext
20628 RFC 123<nowiki/>4
20629 !! end
20630
20631 !! test
20632 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
20633 !! html/parsoid
20634 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20635 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20636 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
20637 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
20638 </p>
20639 !! wikitext
20640 xRFC 123y
20641 XRFC 123y
20642 RFC 123?foo
20643 RFC 123&foo
20644 !! end
20645
20646 !! test
20647 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
20648 !! html/parsoid
20649 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
20650 !! wikitext
20651 PMID 123<nowiki/>4
20652 !! end
20653
20654 !! test
20655 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
20656 !! html/parsoid
20657 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20658 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20659 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
20660 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
20661 </p>
20662 !! wikitext
20663 xPMID 123y
20664 XPMID 123y
20665 PMID 123?foo
20666 PMID 123&foo
20667 !! end
20668
20669 !! test
20670 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
20671 !! html/parsoid
20672 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
20673 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
20674 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
20675 </p>
20676 !! wikitext
20677 ISBN 1234567890<nowiki/>1
20678 ISBN 1234567890<nowiki/>x
20679 ISBN 1234567890<nowiki/>b
20680 !! end
20681
20682 !! test
20683 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
20684 !! html/parsoid
20685 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
20686 !! wikitext
20687 ISBN 1234567890's
20688 !! end
20689
20690 #### --------------- Quotes ---------------
20691 #### 1. Quotes inside <b> and <i>
20692 #### 2. Link fragments separated by <i> and <b> tags
20693 #### 3. Link fragments inside <i> and <b>
20694 #### 4. No escaping needed
20695 #### --------------------------------------
20696 !! test
20697 1. Quotes inside <b> and <i>
20698 !! options
20699 parsoid=html2wt,wt2wt
20700 !! wikitext
20701 ''<nowiki/>'foo'<nowiki/>''
20702 ''<nowiki>''foo''</nowiki>''
20703 ''<nowiki>'''foo'''</nowiki>''
20704 ''foo''<nowiki/>'s
20705 '''<nowiki/>'foo'<nowiki/>'''
20706 '''<nowiki>''foo''</nowiki>'''
20707 '''<nowiki>'''foo'''</nowiki>'''
20708 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
20709 '''foo'''<nowiki/>'s
20710 '<nowiki/>''foo''
20711 ''foo''<nowiki/>'
20712 '<nowiki/>''foo''<nowiki/>'
20713 '<nowiki/>'''foo'''
20714 '''foo'''<nowiki/>'
20715 '<nowiki/>'''foo'''<nowiki/>'
20716 ''fools'<span> errand</span>''
20717 ''<span>fool</span>'s errand''
20718 !! html/*
20719 <p><i>'foo'</i>
20720 <i>''foo''</i>
20721 <i>'''foo'''</i>
20722 <i>foo</i>'s
20723 <b>'foo'</b>
20724 <b>''foo''</b>
20725 <b>'''foo'''</b>
20726 <b>foo'<i>bar'</i>baz</b>
20727 <b>foo</b>'s
20728 '<i>foo</i>
20729 <i>foo</i>'
20730 '<i>foo</i>'
20731 '<b>foo</b>
20732 <b>foo</b>'
20733 '<b>foo</b>'
20734 <i>fools'<span> errand</span></i>
20735 <i><span>fool</span>'s errand</i>
20736 </p>
20737 !! end
20738
20739 !! test
20740 2. Link fragments separated by <i> and <b> tags
20741 !! wikitext
20742 [[''foo''<nowiki>hello]]</nowiki>
20743
20744 [['''foo'''<nowiki>hello]]</nowiki>
20745 !! html
20746 <p>[[<i>foo</i>hello]]
20747 </p><p>[[<b>foo</b>hello]]
20748 </p>
20749 !! end
20750
20751 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
20752 # this is one of the shortcomings of this format
20753 !! test
20754 3. Link fragments inside <i> and <b>
20755 !! wikitext
20756 ''[[foo''<nowiki>]]</nowiki>
20757
20758 '''[[foo'''<nowiki>]]</nowiki>
20759 !! html
20760 <p><i>[[foo</i>]]
20761 </p><p><b>[[foo</b>]]
20762 </p>
20763 !! end
20764
20765 !! test
20766 4. No escaping needed
20767 !! wikitext
20768 '<span>''bar''</span>'
20769 '<span>'''bar'''</span>'
20770 !! html
20771 <p>'<span><i>bar</i></span>'
20772 '<span><b>bar</b></span>'
20773 </p>
20774 !! end
20775
20776 #### ----------- Paragraphs ---------------
20777 #### 1. No unnecessary escapes
20778 #### --------------------------------------
20779
20780 !! test
20781 1. No unnecessary escapes
20782 !! wikitext
20783 bar <span><nowiki>[[foo]]</nowiki></span>
20784
20785 =bar <span><nowiki>[[foo]]</nowiki></span>
20786
20787 [[bar <span><nowiki>[[foo]]</nowiki></span>
20788
20789 ]]bar <span><nowiki>[[foo]]</nowiki></span>
20790
20791 =bar <span>foo]]</span><nowiki>=</nowiki>
20792 !! html
20793 <p>bar <span>[[foo]]</span>
20794 </p><p>=bar <span>[[foo]]</span>
20795 </p><p>[[bar <span>[[foo]]</span>
20796 </p><p>]]bar <span>[[foo]]</span>
20797 </p><p>=bar <span>foo]]</span>=
20798 </p>
20799 !!end
20800
20801 #### ----------------------- PRE --------------------------
20802 #### 1. Leading whitespace in SOL context should be escaped
20803 #### ------------------------------------------------------
20804 !! test
20805 1. Leading whitespace in SOL context should be escaped
20806 !! options
20807 parsoid
20808 !! wikitext
20809 <nowiki> </nowiki>a
20810
20811 <nowiki> </nowiki> a
20812
20813 <nowiki> </nowiki>a(tab)
20814
20815 <nowiki> </nowiki> a
20816 <!--cmt-->
20817 <nowiki> </nowiki> a
20818
20819 a
20820 <nowiki> </nowiki>b
20821
20822 a
20823 <nowiki> </nowiki>b
20824
20825 a
20826 <nowiki> </nowiki> b
20827 !! html
20828 <p> a</p>
20829 <p> a</p>
20830 <p> a(tab)</p>
20831 <p> a</p>
20832 <p><!--cmt--> a</p>
20833 <p>a
20834 b</p>
20835 <p>a
20836 b</p>
20837 <p>a
20838 b</p>
20839 !! end
20840
20841 !! test
20842 2. Leading whitespace in non-indent-pre contexts should not be escaped
20843 !! options
20844 parsoid
20845 !! wikitext
20846 foo <ref>''a''
20847 b</ref>
20848 !! html
20849 <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>
20850 !! end
20851
20852 !! test
20853 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
20854 !! options
20855 parsoid
20856 !! wikitext
20857 <blockquote>
20858 a
20859 <span>b</span>
20860 c
20861 </blockquote>
20862 !! html
20863 <blockquote>
20864 <p>
20865 a
20866 <span>b</span>
20867 c</p>
20868 </blockquote>
20869 !! end
20870
20871 !! test
20872 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
20873 !! options
20874 parsoid
20875 !! wikitext
20876 [[File:Foobar.jpg|thumb|caption]]
20877 !! html
20878 !! html/parsoid
20879 <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>
20880 !! end
20881
20882 !! test
20883 5. Nowiki escaping should account for indent-pres
20884 !! options
20885 parsoid=html2wt
20886 !! html
20887 <pre>==foo==</pre>
20888 !! wikitext
20889 ==foo==
20890 !! end
20891
20892 #### --------------- Behavior Switches --------------------
20893 !! test
20894 1. Valid behavior switches should be escaped
20895 !! options
20896 parsoid=html2wt
20897 !! wikitext
20898 <nowiki>__TOC__</nowiki>
20899 ''<nowiki>__TOC__</nowiki>''
20900 !! html
20901 __TOC__
20902 <i>__TOC__</i>
20903 !! end
20904
20905 !! test
20906 2. Invalid behavior switches should not be escaped
20907 !! options
20908 parsoid=html2wt
20909 !! wikitext
20910 __TOO__
20911 __|__
20912 !! html
20913 __TOO__
20914 __|__
20915 !! end
20916
20917 #### --------------- HTML tags ---------------
20918 #### 1. a tags
20919 #### 2. other tags
20920 #### 3. multi-line html tag
20921 #### 4. extension tags
20922 #### -----------------------------------------
20923 !! test
20924 1. a tags
20925 !! options
20926 parsoid
20927 !! wikitext
20928 <a href="http://google.com">google</a>
20929 !! html
20930 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
20931 !! end
20932
20933 !! test
20934 2. other tags
20935 !! wikitext
20936 <nowiki><div>foo</div>
20937 <div style="color:red">foo</div></nowiki>
20938 !! html
20939 <p>&lt;div&gt;foo&lt;/div&gt;
20940 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
20941 </p>
20942 !! end
20943
20944 !! test
20945 3. multi-line html tag
20946 !! wikitext
20947 <nowiki><div
20948 >foo</div
20949 ></nowiki>
20950 !! html
20951 <p>&lt;div
20952 &gt;foo&lt;/div
20953 &gt;
20954 </p>
20955 !! end
20956
20957 !! test
20958 4. extension tags
20959 !! wikitext
20960 <nowiki><ref>foo</ref></nowiki>
20961
20962 <nowiki><ref>bar</nowiki>
20963
20964 baz<nowiki></ref></nowiki>
20965 !! html
20966 <p>&lt;ref&gt;foo&lt;/ref&gt;
20967 </p><p>&lt;ref&gt;bar
20968 </p><p>baz&lt;/ref&gt;
20969 </p>
20970 !! end
20971
20972 #### --------------- Others ---------------
20973 !! test
20974 Escaping nowikis
20975 !! wikitext
20976 &lt;nowiki&gt;foo&lt;/nowiki&gt;
20977 !! html
20978 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
20979 </p>
20980 !! end
20981
20982 ## The quote-char in the input is necessary for triggering the bug
20983 !! test
20984 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
20985 !! options
20986 parsoid=wt2wt,html2wt
20987 !! wikitext
20988 foo's bar :
20989 !! html
20990 <p>foo's bar :</p>
20991 !! end
20992
20993 !! test
20994
20995 Tag-like HTML structures are passed through as text
20996 !! wikitext
20997 <x y>
20998
20999 <x.y>
21000
21001 <x-y>
21002
21003 1>2
21004
21005 x<y
21006
21007 a>b
21008
21009 1<d e>f
21010 !! html
21011 <p>&lt;x y&gt;
21012 </p><p>&lt;x.y&gt;
21013 </p><p>&lt;x-y&gt;
21014 </p><p>1&gt;2
21015 </p><p>x&lt;y
21016 </p><p>a&gt;b
21017 </p><p>1&lt;d e&gt;f
21018 </p>
21019 !! end
21020
21021
21022 # This was a bug in the PHP parser (see bug 17663 and its dups,
21023 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
21024 !! test
21025 Tag names followed by punctuation should not be recognized as tags
21026 !! wikitext
21027 <s.ome> text
21028 !! html
21029 <p>&lt;s.ome&gt; text
21030 </p>
21031 !! end
21032
21033 !! test
21034 HTML tag with necessary entities in attributes
21035 !! wikitext
21036 <span title="&amp;amp;">foo</span>
21037 !! html
21038 <p><span title="&amp;amp;">foo</span>
21039 </p>
21040 !! end
21041
21042 !! test
21043 HTML tag with 'unnecessary' entity encoding in attributes
21044 !! wikitext
21045 <span title="&amp;">foo</span>
21046 !! html
21047 <p><span title="&amp;">foo</span>
21048 </p>
21049 !! end
21050
21051 !! test
21052 HTML tag with broken attribute value quoting
21053 !! wikitext
21054 <span title="Hello world>Foo</span>
21055 !! html/php
21056 <p><span>Foo</span>
21057 </p>
21058 !! html/parsoid
21059 <p><span title="Hello world">Foo</span>
21060 </p>
21061 !! end
21062
21063 !! test
21064 Parsoid-only: HTML tag with broken attribute value quoting
21065 !! options
21066 parsoid
21067 !! wikitext
21068 <span title="Hello world>Foo</span>
21069 !! html
21070 <p><span title="Hello world">Foo</span>
21071 </p>
21072 !! end
21073
21074 !! test
21075 Table with broken attribute value quoting
21076 !! wikitext
21077 {|
21078 | title="Hello world|Foo
21079 |}
21080 !! html/php
21081 <table>
21082 <tr>
21083 <td>Foo
21084 </td></tr></table>
21085
21086 !! html/parsoid
21087 <table>
21088 <tr>
21089 <td title="Hello world">Foo
21090 </td></tr></table>
21091
21092 !! end
21093
21094 !! test
21095 Table with broken attribute value quoting on consecutive lines
21096 !! wikitext
21097 {|
21098 | title="Hello world|Foo
21099 | style="color:red|Bar
21100 |}
21101 !! html/php
21102 <table>
21103 <tr>
21104 <td>Foo
21105 </td>
21106 <td>Bar
21107 </td></tr></table>
21108
21109 !! html/parsoid
21110 <table><tbody>
21111 <tr>
21112 <td title="Hello world">Foo
21113 </td><td style="color: red">Bar
21114 </td></tr></tbody></table>
21115
21116 !! end
21117
21118 !! test
21119 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21120 !! options
21121 parsoid
21122 !! wikitext
21123 {{}}
21124 !! html
21125 {{}}
21126 !! end
21127
21128 !! test
21129 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21130 !! options
21131 parsoid
21132 !! wikitext
21133 }}{{
21134 !! html
21135 }}{{
21136 !! end
21137
21138 !!test
21139 Accept empty td cell attribute
21140 !! wikitext
21141 {|
21142 | align="center" | foo || |
21143 |}
21144 !! html
21145 <table>
21146 <tr>
21147 <td align="center"> foo </td>
21148 <td>
21149 </td></tr></table>
21150
21151 !!end
21152
21153 !!test
21154 Non-empty attributes in th-cells
21155 !! wikitext
21156 {|
21157 ! Foo !! style="color: red" | Bar
21158 |}
21159 !! html
21160 <table>
21161 <tr>
21162 <th> Foo </th>
21163 <th style="color: red"> Bar
21164 </th></tr></table>
21165
21166 !!end
21167
21168 !!test
21169 Accept empty attributes in th-cells
21170 !! wikitext
21171 {|
21172 !| foo !!| bar
21173 |}
21174 !! html
21175 <table>
21176 <tr>
21177 <th> foo </th>
21178 <th> bar
21179 </th></tr></table>
21180
21181 !!end
21182
21183 !!test
21184 Empty table rows go away
21185 !! wikitext
21186 {|
21187 | Hello
21188 | there
21189 |- class="foo"
21190 |-
21191 |}
21192 !! html
21193 <table>
21194 <tr>
21195 <td> Hello
21196 </td>
21197 <td> there
21198 </td></tr>
21199
21200 </table>
21201
21202 !! end
21203
21204 ###
21205 ### Parsoid-centric tests for testing RTing of inter-element separators
21206 ### Edge cases not tested by existing parser tests and specific to
21207 ### Parsoid-specific serialization strategies.
21208 ###
21209
21210 !!test
21211 RT-ed inter-element separators should be valid separators
21212 !! wikitext
21213 {|
21214 |- [[foo]]
21215 |}
21216 !! html
21217 <table>
21218
21219 </table>
21220
21221 !!end
21222
21223 # Parsoid-only since PHP parser relies on Tidy for correct output
21224 !!test
21225 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
21226 !!options
21227 parsoid
21228 !! wikitext
21229 {|
21230 |<small>foo
21231 bar
21232 |}
21233
21234 {|
21235 |<small>foo<small>
21236 |}
21237 !! html
21238 <table>
21239 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
21240 <p>bar</p></small></td></tr>
21241 </tbody></table>
21242
21243 <table>
21244 <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>
21245 </tbody></table>
21246 !!end
21247
21248 !!test
21249 Empty TD followed by TD with tpl-generated attribute
21250 !! wikitext
21251 {|
21252 |-
21253 |
21254 |{{echo|style='color:red'}}|foo
21255 |}
21256 !! html
21257 <table>
21258
21259 <tr>
21260 <td>
21261 </td>
21262 <td>foo
21263 </td></tr></table>
21264
21265 !!end
21266
21267 !!test
21268 Indented table with an empty td
21269 !! wikitext
21270 {|
21271 |-
21272 |
21273 |foo
21274 |}
21275 !! html
21276 <table>
21277
21278 <tr>
21279 <td>
21280 </td>
21281 <td>foo
21282 </td></tr></table>
21283
21284 !!end
21285
21286 !!test
21287 Indented block & table
21288 !! wikitext
21289 <div>foo</div>
21290 {|
21291 |foo
21292 |}
21293 !! html/php
21294 <div>foo</div>
21295 <table>
21296 <tr>
21297 <td>foo
21298 </td></tr></table>
21299
21300 !! html/parsoid
21301 <div data-parsoid='{"stx":"html"}'>foo</div>
21302 <table><tbody>
21303 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
21304 </tbody></table>
21305 !!end
21306
21307 !! test
21308 Indent and comment before table row
21309 !! wikitext
21310 {|
21311 <!--hi-->|-
21312 | there
21313 |}
21314 !! html/php
21315 <table>
21316
21317 <tr>
21318 <td> there
21319 </td></tr></table>
21320
21321 !! html/parsoid
21322 <table>
21323 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
21324 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
21325 </tbody></table>
21326 !! end
21327
21328 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
21329 !!test
21330 Empty TR followed by a template-generated TR
21331 !!options
21332 parsoid
21333 !! wikitext
21334 {|
21335 |-
21336 {{echo|<tr><td>foo</td></tr>}}
21337 |}
21338 !! html
21339 <table>
21340 <tbody>
21341 <tr></tr>
21342 <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}}]}'>
21343 <td>foo</td></tr>
21344 </tbody></table>
21345 !!end
21346
21347 ## PHP and parsoid output differ for this, and since this is primarily
21348 ## for testing Parsoid's serializer, marking this Parsoid only
21349 !!test
21350 Empty TR followed by mixed-ws-comment line should RT correctly
21351 !!options
21352 parsoid
21353 !! wikitext
21354 {|
21355 |-
21356 <!--c-->
21357 |-
21358 <!--c--> <!--d-->
21359 |}
21360 !! html
21361 <table>
21362 <tbody>
21363 <tr></tr>
21364 <!--c-->
21365 <tr>
21366 <!--c--> </tr><!--d-->
21367 </tbody></table>
21368
21369 !!end
21370
21371 !!test
21372 Multi-line image caption generated by templates with/without trailing newlines
21373 !! wikitext
21374 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
21375 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
21376 !! html/parsoid
21377 <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>
21378 <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>
21379 !!end
21380
21381 !! test
21382 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
21383 !! options
21384 parsoid=html2wt
21385 !! wikitext
21386 <includeonly>foo</includeonly>
21387 new para
21388
21389 [[./Category:Foo]]
21390
21391 = new heading =
21392 !! html
21393 <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>
21394
21395 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
21396 !! end
21397
21398 ## PHP emits broken html for this, and since this is primarily
21399 ## a Parsoid serializer test, marking this Parsoid only
21400 !!test
21401 Improperly nested inline or quotes tags with whitespace in between
21402 !!options
21403 parsoid
21404 !! wikitext
21405 <span> <s>x</span> </s>
21406 ''' ''x''' ''
21407 !! html
21408 <p><span> <s>x</s></span><s> </s>
21409 <b> <i>x</i></b><i> </i>
21410 </p>
21411 !!end
21412
21413 !!test
21414 Encapsulate protected attributes from wt
21415 !!options
21416 parsoid
21417 !! wikitext
21418 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
21419 !! html
21420 <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>
21421 </body>
21422 !!end
21423
21424 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
21425 ## Having nested or stray pre tags results in the attempt to add duplicates,
21426 ## causing an assertion fail. This test tries to prevent that situation.
21427 !!test
21428 Ensure ParagraphWrapper can deal with stray closing pre tags
21429 !!options
21430 parsoid=wt2html
21431 !! wikitext
21432 plain text</pre>
21433 !! html
21434 plain text
21435 !!end
21436
21437 !!test
21438 1. Ensure fostered text content is wrapped in element nodes
21439 !!options
21440 parsoid=wt2html
21441 !! wikitext
21442 <table>hi</table><table>ho</table>
21443 !! html
21444 <p>hi</p>
21445 <table></table>
21446 <p>ho</p>
21447 <table></table>
21448 !!end
21449
21450 !!test
21451 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
21452 !!options
21453 parsoid=wt2html,wt2wt
21454 !! wikitext
21455 <table>
21456 <tr> || ||
21457 <td> a
21458 </table>
21459 !! html
21460 <p> || ||
21461 </p><table>
21462 <tbody><tr><td> a</td></tr>
21463 </tbody></table>
21464 !!end
21465
21466 !!test
21467 Encapsulation properly handles null DSR information from foster box
21468 !!options
21469 parsoid=wt2html,wt2wt
21470 !! wikitext
21471 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
21472 !! html
21473 <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>
21474 !!end
21475
21476 !!test
21477 1. Encapsulate foster-parented transclusion content
21478 !!options
21479 parsoid=wt2wt,wt2html
21480 !! wikitext
21481 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
21482 !! html
21483 <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>
21484 <tbody>
21485 <tr>
21486 <td>bar</td>
21487 </tr>
21488 </tbody>
21489 </table>
21490 !!end
21491
21492 !!test
21493 2. Encapsulate foster-parented transclusion content
21494 !!options
21495 parsoid=wt2wt,wt2html
21496 !! wikitext
21497 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
21498 !! html
21499 <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>
21500 <table>
21501 <tbody>
21502 <tr>
21503 <td>bar</td>
21504 </tr>
21505 </tbody>
21506 </table>
21507 !!end
21508
21509 !!test
21510 3. Encapsulate foster-parented transclusion content
21511 !!options
21512 parsoid=wt2wt,wt2html
21513 !! wikitext
21514 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21515 !! html
21516 <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;]}">
21517 <p>foo</p>
21518 </div>
21519 <table>
21520 <tbody>
21521 <tr>
21522 <td>bar</td>
21523 </tr>
21524 </tbody>
21525 </table>
21526 !!end
21527
21528 !!test
21529 4. Encapsulate foster-parented transclusion content
21530 !!options
21531 parsoid=wt2wt,wt2html
21532 !! wikitext
21533 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21534 !! html
21535 <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;]}">
21536 <p>foo</p>
21537 </div>
21538 <table>
21539 <tbody>
21540 <tr>
21541 <td>bar</td>
21542 </tr>
21543 </tbody>
21544 </table>
21545 !!end
21546
21547 !!test
21548 5. Encapsulate foster-parented transclusion content
21549 !!options
21550 parsoid=wt2wt,wt2html
21551 !! wikitext
21552 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
21553 !! html
21554 <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>
21555 <table>
21556 <tbody>
21557 <tr>
21558 <td>
21559 <div>
21560 <p>foo</p>
21561 </div>
21562 </td>
21563 </tr>
21564 </tbody>
21565 </table>
21566 !!end
21567
21568 !!test
21569 6. Encapsulate foster-parented transclusion content
21570 !!options
21571 parsoid=wt2wt,wt2html
21572 !! wikitext
21573 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
21574 !! html
21575 <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>
21576 <table>
21577 <tbody>
21578 <tr>
21579 <td>
21580 <div>
21581 <p>foo</p>
21582 </div>
21583 </td>
21584 </tr>
21585 </tbody>
21586 </table>
21587 <p>ok</p>
21588 !!end
21589
21590 !!test
21591 7. Encapsulate foster-parented transclusion content
21592 !!options
21593 parsoid=wt2wt,wt2html
21594 !! wikitext
21595 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
21596 !! html
21597 <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>
21598 <table>
21599 <tbody>
21600 <tr>
21601 <td>bar</td>
21602 </tr>
21603 </tbody>
21604 </table>
21605 !!end
21606
21607 !!test
21608 8. Encapsulate foster-parented transclusion content
21609 !!options
21610 parsoid=wt2wt,wt2html
21611 !! wikitext
21612 {{echo|a
21613 }}{|{{echo|style='color:red'}}
21614 |-
21615 |b
21616 |}
21617 !! html
21618 <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>
21619 <tbody>
21620 <tr>
21621 <td>b</td>
21622 </tr>
21623 </tbody>
21624 </table>
21625 !!end
21626
21627 !!test
21628 9. Encapsulate foster-parented transclusion content
21629 !!options
21630 parsoid=wt2wt,wt2html
21631 !! wikitext
21632 <table>{{echo|hi</table>hello}}
21633 !! html
21634 <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>
21635 !!end
21636
21637 !!test
21638 Table in fosterable position
21639 !!options
21640 parsoid=wt2html,wt2wt
21641 !! wikitext
21642 {{OpenTable}}
21643 <div>
21644 {|
21645 |}
21646 </div>
21647 |}
21648 !! html
21649 <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">
21650 </span>
21651 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
21652
21653 <table>
21654 </table>
21655 !!end
21656
21657 # Parsoid only for bug 64747
21658 !! test
21659 Properly encapsulate empty-content transclusions in fosterable positions
21660 !! wikitext
21661 <table>
21662 {{#if:|
21663 <td>foo</td>
21664 }}
21665 </table>
21666 !! html/parsoid
21667 <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>"}'>
21668
21669 </table>
21670 !! end
21671
21672 !!test
21673 Support <object> element with .data attribute
21674 !!options
21675 parsoid=html2wt
21676 !! wikitext
21677 <object data="test.swf"></object>
21678 !! html
21679 <object data="test.swf"></object>
21680 !!end
21681
21682 !! test
21683 Don't block XML namespace declaration
21684 !! wikitext
21685 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
21686 !! html/php
21687 <p><span>MediaWiki</span>
21688 </p>
21689 !! html/parsoid
21690 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
21691 !! end
21692
21693 # -----------------------------------------------------------------
21694 # The following section of tests are primarily to spec requirements
21695 # around serialization of new/edited content.
21696 #
21697 # All these tests are marked Parsoid html2wt and html2html only
21698 # ----------------------------------------------------------------
21699
21700 # 'mi' is a localinterwiki prefix as well as a language
21701 !! test
21702 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
21703 !! options
21704 parsoid=html2wt
21705 !! wikitext
21706 [[Foo]]
21707 !! html
21708 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
21709 !! end
21710
21711 !! test
21712 New wiki links (href variations)
21713 !! options
21714 parsoid=html2wt
21715 !! html
21716 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
21717 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
21718 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
21719 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
21720 !! wikitext
21721 [[Foo_bar]]
21722 [[Foo_bar]]
21723 [[Foo_bar]]
21724 [[Toxine bactérienne]]
21725 !! end
21726
21727 !! test
21728 New wiki links (content string variations)
21729 !! options
21730 parsoid=html2wt
21731 !! html
21732 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
21733 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
21734 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
21735 !! wikitext
21736 [[Foo_bar]]
21737 [[Foo bar]]
21738 [[Foo_bar|./Foo_bar]]
21739 !! end
21740
21741 !! test
21742 New category links (href variations)
21743 !! options
21744 parsoid=html2wt
21745 !! html
21746 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
21747 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
21748 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
21749 !! wikitext
21750 [[Category:Toxine bactérienne]]
21751 [[Category:Toxine bactérienne]]
21752 [[Category:Toxine bactérienne]]
21753 !! end
21754
21755 !! test
21756 New interlanguage links (href variations)
21757 !! options
21758 parsoid=html2wt
21759 !! html
21760 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
21761 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
21762 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
21763 !! wikitext
21764 [[es:Toxine bactérienne]]
21765 [[es:Toxine_bactérienne]]
21766 [[es:Toxine_bactérienne]]
21767 !! end
21768
21769 !! test
21770 Image: Modifying size of an image (1)
21771 !! options
21772 parsoid={
21773 "modes": ["wt2wt"],
21774 "changes": [
21775 ["img[height]", "attr", "height", "22"],
21776 ["img[width]", "attr", "width", "200"]
21777 ]
21778 }
21779 !! wikitext
21780 [[Image:Foobar.jpg|230x230px]]
21781 !! wikitext/edited
21782 [[Image:Foobar.jpg|200x200px]]
21783 !!end
21784
21785 !! test
21786 Image: Modifying size of an image (2)
21787 !! options
21788 parsoid={
21789 "modes": ["wt2wt"],
21790 "changes": [
21791 ["img[height]", "attr", "height", "100"],
21792 ["img[width]", "attr", "width", "500"]
21793 ]
21794 }
21795 !! wikitext
21796 [[Image:Foobar.jpg|230x230px]]
21797 !! wikitext/edited
21798 [[Image:Foobar.jpg|500x500px]]
21799 !!end
21800
21801 # Change in size is ignored so long as class='mw-default-size'
21802 !! test
21803 Image: Modifying size of an image (3)
21804 !! options
21805 parsoid={
21806 "modes": ["wt2wt"],
21807 "changes": [
21808 ["figure[class]", "removeClass", "mw-default-size"],
21809 ["figure img", "attr", "height", "19"],
21810 ["figure img", "attr", "width", "170"]
21811 ]
21812 }
21813 !! wikitext
21814 [[Image:Foobar.jpg|thumb]]
21815 !! wikitext/edited
21816 [[Image:Foobar.jpg|thumb|170x170px]]
21817 !!end
21818
21819 !! test
21820 Image: Modifying alignment of an image (bug 48665)
21821 !! options
21822 parsoid={
21823 "modes": ["wt2wt"],
21824 "changes": [
21825 ["figure[class]", "removeClass", "mw-halign-right"],
21826 ["figure[class]", "addClass", "mw-halign-left"]
21827 ]
21828 }
21829 !! wikitext
21830 [[Image:Foobar.jpg|thumb|caption|right]]
21831 !! wikitext/edited
21832 [[Image:Foobar.jpg|thumb|caption|left]]
21833 !! end
21834
21835 !! test
21836 Image: Modifying mw-default-size of an frameless image (bug 62805)
21837 !! options
21838 parsoid={
21839 "modes": ["wt2wt"],
21840 "changes": [
21841 ["figure.mw-default-size", "removeClass", "mw-default-size"]
21842 ]
21843 }
21844 !! wikitext
21845 [[Image:Foobar.jpg|frameless|right]]
21846 !! wikitext/edited
21847 [[Image:Foobar.jpg|frameless|right|220x220px]]
21848 !! end
21849
21850 !! test
21851 Image: Modifying valign of an image (bug 49221)
21852 !! options
21853 parsoid={
21854 "modes": ["wt2wt"],
21855 "changes": [
21856 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
21857 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
21858 ]
21859 }
21860 !! wikitext
21861 [[File:Foobar.jpg|20px|middle]]
21862 !! wikitext/edited
21863 [[File:Foobar.jpg|20px|text-top]]
21864 !! end
21865
21866 !! test
21867 Image: Modifying alt attribute of an image (bug 56400)
21868 !! options
21869 parsoid={
21870 "modes": ["wt2wt"],
21871 "changes": [
21872 ["img[alt]", "attr", "alt", "some alternate edited text"]
21873 ]
21874 }
21875 !! wikitext
21876 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
21877 !! wikitext/edited
21878 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
21879 !!end
21880
21881 !! test
21882 Image: Modifying caption of an image
21883 !! options
21884 parsoid={
21885 "modes": ["wt2wt"],
21886 "changes": [
21887 ["figcaption", "text", "new caption"]
21888 ]
21889 }
21890 !! wikitext
21891 [[Image:Foobar.jpg|thumb|original caption]]
21892 !! wikitext/edited
21893 [[Image:Foobar.jpg|thumb|new caption]]
21894 !!end
21895
21896 !! test
21897 Image: empty alt attribute (bug 48924)
21898 !! options
21899 parsoid
21900 !! wikitext
21901 [[File:Foobar.jpg|thumb|alt=|bar]]
21902 !! html
21903 <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>
21904 !! end
21905
21906 #!! test
21907 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
21908 #!! options
21909 #parsoid=html2wt
21910 #language=ar
21911 #!! wikitext
21912 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
21913 #!! html
21914 #<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>
21915 #!! end
21916
21917 !! test
21918 Image: Block level image should have \n before and after
21919 !! wikitext
21920 123
21921 [[File:Foobar.jpg|right|thumb|150x150px]]
21922 456
21923 !! html/parsoid
21924 <p>123</p>
21925 <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>
21926 <p>456</p>
21927 !!end
21928
21929 !! test
21930 Image: New block level image should have \n before and after (existing content)
21931 !! wikitext
21932 123
21933 [[File:Foobar.jpg|right|thumb|150x150px]]
21934 456
21935 !! html/parsoid
21936 <p>123</p>
21937 <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>
21938 <p>456</p>
21939 !!end
21940
21941 !! test
21942 Image: upright option (parsoid)
21943 !! options
21944 parsoid
21945 !! wikitext
21946 [[File:Foobar.jpg|thumb|upright|caption]]
21947 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
21948 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
21949 !! html
21950 <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>
21951 <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>
21952 <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>
21953 !!end
21954
21955 !! test
21956 Image: upright option is ignored on inline and frame images (parsoid)
21957 !! options
21958 parsoid
21959 !! wikitext
21960 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
21961 !! html
21962 <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>
21963 !!end
21964
21965 !! test
21966 Image: from basic HTML (1)
21967 !! options
21968 parsoid=html2wt
21969 !! html/parsoid
21970 <span typeof="mw:Image">
21971 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
21972 </span>
21973 !! wikitext
21974 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
21975 !! end
21976
21977 !! test
21978 Image: from basic HTML (2)
21979 !! options
21980 parsoid=html2wt
21981 !! html/parsoid
21982 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
21983 !! wikitext
21984 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
21985 !! end
21986
21987 !! test
21988 Image: from basic HTML (3)
21989 !! options
21990 parsoid=html2wt
21991 !! html/parsoid
21992 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
21993 !! wikitext
21994 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
21995 !! end
21996
21997 !! test
21998 Image: from basic HTML (4)
21999 !! options
22000 parsoid=html2wt
22001 !! html/parsoid
22002 <img src="File:Foobar.jpg">
22003 !! wikitext
22004 [[File:Foobar.jpg|link=]]
22005 !! end
22006
22007 !! test
22008 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
22009 !! options
22010 parsoid=html2wt
22011 !! wikitext
22012 * foo
22013 !! html
22014 <ul>
22015 <li><p>foo</p></li>
22016 </ul>
22017 !! end
22018
22019 !! test
22020 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
22021 !! options
22022 parsoid=html2wt
22023 !! wikitext
22024 * foo
22025 !! html
22026 <ul> <li>foo</li></ul>
22027 !! end
22028
22029 !! test
22030 Don't strip leading whitespace when handling indent-pre suppressing tags
22031 !! options
22032 parsoid=html2wt
22033 !! wikitext
22034 {|
22035 | indented row
22036 |}
22037 <blockquote>
22038 '''This is very bold of you!'''
22039
22040 {|
22041 |
22042 indented cell (no pre-wrapping!)
22043 |}
22044 </blockquote>
22045 foo
22046 <div>bar</div>
22047 !! html
22048 <table>
22049 <tr><td> indented row</td></tr>
22050 </table>
22051 <blockquote><p>
22052 <b>This is very bold of you!</b>
22053 </p>
22054 <table><tr><td>
22055 indented cell (no pre-wrapping!)
22056 </td></tr></table>
22057 </blockquote>
22058 <p>foo</p>
22059 <div>bar</div>
22060 !! end
22061
22062 !! test
22063 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
22064 !! options
22065 parsoid=html2wt
22066 !! wikitext
22067 foo
22068 <nowiki> </nowiki><span>bar</span>
22069
22070 <span>foo2
22071 <nowiki> </nowiki></span>bar2
22072
22073 <div>foo</div>
22074 <nowiki> </nowiki><span>bar</span>
22075
22076 <div>
22077 <nowiki> </nowiki><span>foo</span>
22078 </div>
22079 !! html
22080 <p>foo</p>
22081 <span>bar</span>
22082
22083 <span>foo2
22084 </span>bar2
22085
22086 <div>foo</div>
22087 <span>bar</span>
22088
22089 <div>
22090 <span>foo</span>
22091 </div>
22092 !! end
22093
22094 !! test
22095 Lists: Add space after bullets
22096 !! options
22097 parsoid=html2wt
22098 !! wikitext
22099 * foo
22100 * bar
22101 * <span> baz</span>
22102 !! html
22103 <ul>
22104 <li>foo</li>
22105 <li> bar</li>
22106 <li><span> baz</span></li>
22107 </ul>
22108 !! end
22109
22110 !! test
22111 Lists: Dont insert newlines in a serialized list item.
22112 !! options
22113 parsoid=html2wt
22114 !! wikitext
22115 * a<br>b
22116 * c
22117 !! html
22118 <ul><li>a<br>b</li><li>c</li></ul>
22119 !! end
22120
22121 !! test
22122 Headings: Add space before/after == (Bug 51744)
22123 !! options
22124 parsoid=html2wt
22125 !! wikitext
22126 == foo ==
22127
22128 == bar ==
22129
22130 == baz ==
22131
22132 == <span> baz</span> ==
22133 !! html
22134 <h2>foo</h2>
22135 <h2> bar</h2>
22136 <h2>baz </h2>
22137 <h2><span> baz</span></h2>
22138 !! end
22139
22140 !! test
22141 Parsoid: Serialize positional parameters with = in them as named parameter
22142 !! options
22143 parsoid=html2wt
22144 !! wikitext
22145 {{echo|1 = f=oo}}
22146
22147 {{echo|1 = f=oo|2 = bar}}
22148
22149 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22150 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22151 {{echo|<nowiki>f=oo</nowiki>|bar}}
22152 !! html
22153 <p about="#mwt1" typeof="mw:Transclusion"
22154 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
22155
22156 <p about="#mwt1" typeof="mw:Transclusion"
22157 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
22158
22159 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22160 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22161 <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>
22162 !! end
22163
22164 !! test
22165 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
22166 !! options
22167 parsoid=html2wt
22168 !! wikitext
22169 <div>a
22170 b
22171 </div>
22172 <div>a
22173 b
22174 </div>
22175 <div>
22176 a
22177
22178 b
22179 </div>
22180 !! html
22181 <div>a<p>b</p></div>
22182 <div>a
22183 <p>b</p></div>
22184 <div>
22185 a
22186 <p>b</p></div>
22187 !! end
22188
22189 !! test
22190 Substrings resembling wikitext in hrefs should not get nowiki escapes
22191 !! options
22192 parsoid=html2wt
22193 !! wikitext
22194 [[Foo''bar''baz]]
22195 !! html
22196 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
22197 !! end
22198
22199 #-----------------------------
22200 # I/B quote minimization tests
22201 #-----------------------------
22202
22203 !! test
22204 1. I/B quote minimization: wikitext-only tags should be combined
22205 !! options
22206 parsoid=html2wt
22207 !! wikitext
22208 ''AB''
22209
22210 '''AB'''
22211
22212 ''A'''B'''''
22213
22214 '''A''B'''''
22215
22216 '''A''BC''D'''
22217
22218 '''''AB'''''
22219
22220 '''''AB'''''
22221
22222 '''''AB'''''
22223 !! html
22224 <p><i>A</i><i>B</i></p>
22225 <p><b>A</b><b>B</b></p>
22226 <p><i>A</i><b><i>B</i></b></p>
22227 <p><b>A</b><i><b>B</b></i></p>
22228 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
22229 <p><i><b>A</b></i><i><b>B</b></i></p>
22230 <p><i><b>A</b></i><b><i>B</i></b></p>
22231 <p><b><i>A</i></b><i><b>B</b></i></p>
22232 !! end
22233
22234 !! test
22235 2. I/B quote minimization: wikitext and html tags should not be combined
22236 !! options
22237 parsoid=html2wt
22238 !! wikitext
22239 ''A''<i>B</i>
22240
22241 ''A''<nowiki/>'''<i>B</i>'''
22242 !! html
22243 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
22244 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
22245 !! end
22246
22247 !! test
22248 3. I/B quote minimization: templated content stops minimization
22249 !! options
22250 parsoid=html2wt
22251 !! wikitext
22252 ''A''{{echo|''B''}}
22253
22254 ''A''{{echo|'''''B'''''}}
22255 !! html
22256 <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>
22257 <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>
22258 !! end
22259
22260 !! test
22261 4. I/B quote minimization: new content should be mimimized with adjacent old content
22262 !! options
22263 parsoid=html2wt
22264 !! wikitext
22265 ''AB''
22266
22267 '''AB'''
22268
22269 ''A'''B'''''
22270 !! html
22271 <p><i>A</i><i>B</i></p>
22272 <p><b>A</b><b>B</b></p>
22273 <p><i>A</i><b><i>B</i></b></p>
22274 !! end
22275
22276 #------------------------------------
22277 # End of I/B quote minimization tests
22278 #------------------------------------
22279
22280 !!test
22281 Bug 54262: New entities
22282 !! options
22283 parsoid=html2wt
22284 !! wikitext
22285 &nbsp;
22286 !! html
22287 <span typeof="mw:Entity">&nbsp;</span>
22288 !! end
22289
22290 ## Note that there is no wikitext output for 'unknownproperty' ##
22291 ## Unknown magic words are silently dropped ##
22292
22293 !! test
22294 Magic words
22295 !! options
22296 parsoid=html2wt
22297 !! wikitext
22298 __TOC__
22299 __NOTOC__
22300 __FORCETOC__
22301 __INDEX__
22302 __NOINDEX__
22303 __NOGALLERY__
22304 __NOEDITSECTION__
22305 __NOTITLECONVERT__
22306 __NOCONTENTCONVERT__
22307 !! html
22308 <meta property='mw:PageProp/toc' />
22309 <meta property='mw:PageProp/notoc' />
22310 <meta property='mw:PageProp/forcetoc' />
22311 <meta property='mw:PageProp/index' />
22312 <meta property='mw:PageProp/noindex' />
22313 <meta property='mw:PageProp/nogallery' />
22314 <meta property='mw:PageProp/noeditsection' />
22315 <meta property='mw:PageProp/notitleconvert' />
22316 <meta property='mw:PageProp/nocontentconvert' />
22317 <meta property='mw:PageProp/unknownproperty' />
22318 !! end
22319
22320 !! test
22321 Consecutive <pre>s should not get merged
22322 !! options
22323 parsoid=html2wt,html2html
22324 !! wikitext
22325 a
22326
22327 b
22328
22329 c
22330
22331 d
22332
22333 e
22334
22335
22336
22337 f
22338 !! html
22339 <pre>a</pre><pre>b</pre>
22340
22341 <pre>c
22342 </pre><pre>
22343 d</pre>
22344
22345 <pre>e
22346
22347 </pre><pre>
22348
22349 f</pre>
22350 !! end
22351
22352 !! test
22353 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
22354 !! options
22355 parsoid=html2wt
22356 !! wikitext
22357 [[Special:BookSources/1234567890|ISBN 1234567895]]
22358 !! html
22359 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
22360 !! end
22361
22362 !! test
22363 Edited RFC links not serializable as RFC links should serialize as extlinks
22364 !! options
22365 parsoid=html2wt
22366 !! wikitext
22367 [//tools.ietf.org/html/rfc123 New RFC]
22368 !! html
22369 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
22370 !! end
22371
22372 !! test
22373 Edited PMID links not serializable as PMID links should serialize as extlinks
22374 !! options
22375 parsoid=html2wt
22376 !! wikitext
22377 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
22378 !! html
22379 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
22380 !! end
22381
22382 !! test
22383 Edited Redirect link should emit a non-piped wikitext link
22384 !! options
22385 parsoid=html2wt
22386 !! wikitext
22387 #REDIRECT [[Bar]]
22388 !! html
22389 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
22390 !! end
22391
22392 !! test
22393 T75121: Infer extension name from typeOf if data-mw is not present
22394 !! options
22395 parsoid=html2wt
22396 !! wikitext
22397 <foo />
22398 !! html
22399 <div typeOf="mw:Extension/foo"></div>
22400 !! end
22401
22402 # -----------------------------------------------------------------
22403 # End of section for Parsoid-only html2wt tests for serialization
22404 # of new content
22405 # -----------------------------------------------------------------
22406
22407 TODO:
22408 more images
22409 more tables
22410 character entities
22411 and much more
22412 Try for 100% code coverage