5f19e8b4ff442b43d28e9dfed5b982f963013c26
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well-formedness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-specific options (not run by PHP parser unless
25 # the test includes an html/php section)
26 # php php-only test (not run by the parsoid parser unless
27 # the test includes an html/parsoid section)
28 # showtitle make the first line the title
29 # comment run through Linker::formatComment() instead of main parser
30 # local format section links in edit comment text as local links
31 # notoc disable table of contents
32 # thumbsize=NNN set the default thumb size to NNNpx for this test
33 #
34 # You can also set the following parser properties via test options:
35 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
36 # wgLinkHolderBatchSize, wgRawHtml
37 #
38 # For testing purposes, temporary articles can created:
39 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
40 # where '/' denotes a newline.
41
42 # This is the standard article assumed to exist.
43 !! article
44 Main Page
45 !! text
46 blah blah
47 !! endarticle
48
49 !!article
50 Foo
51 !!text
52 FOO
53 !!endarticle
54
55 !!article
56 Template:Foo
57 !!text
58 FOO
59 !!endarticle
60
61 !! article
62 Template:Blank
63 !! text
64 !! endarticle
65
66 !! article
67 Template:pipe
68 !! text
69 |
70 !! endarticle
71
72 !!article
73 MediaWiki:bad image list
74 !!text
75 * [[File:Bad.jpg]] except [[Nasty page]]
76 !!endarticle
77
78 !! article
79 Template:inner list
80 !! text
81 * item 1
82 !! endarticle
83
84 !! article
85 Template:tbl-start
86 !! text
87 {|
88 !! endarticle
89
90 !! article
91 Template:tbl-end
92 !! text
93 |}
94 !! endarticle
95
96 !! article
97 Template:echo
98 !! text
99 {{{1}}}
100 !! endarticle
101
102 !! article
103 Template:echo_with_span
104 !! text
105 <span>{{{1}}}</span>
106 !! endarticle
107
108 !! article
109 Template:echo_with_div
110 !! text
111 <div>{{{1}}}</div>
112 !! endarticle
113
114 !! article
115 Template:attr_str
116 !! text
117 {{{1}}}="{{{2}}}"
118 !! endarticle
119
120 !! article
121 Template:table_attribs
122 !! text
123 <noinclude>
124 |</noinclude>style="color: red"| Foo
125 !! endarticle
126
127 !! article
128 Template:table_cells
129 !! text
130 {{table_attribs}} || Bar || Baz
131 !! endarticle
132
133 !! article
134 Template:image_attribs
135 !! text
136 <noinclude>
137 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
138 !! endarticle
139
140 !! article
141 A?b
142 !! text
143 Weirdo titles!
144 !! endarticle
145
146 !!article
147 Template:Bullet
148 !!text
149 * Bar
150 !!endarticle
151
152 !!article
153 Template:OpenTable
154 !!text
155 {|
156 !!endarticle
157
158 !!article
159 Template:EmptyLITest
160 !!text
161 *a
162 *
163 *
164 *b
165 !!endarticle
166
167 !!article
168 Template:EmptyTRTest
169 !!text
170 {|
171 |-
172 |-
173 |foo
174 |-
175 |-
176 |bar
177 |}
178 !!endarticle
179
180 !!article
181 Template:EmptyTRWithHTMLAttrTest
182 !!text
183 <table>
184 <tr align="center"></tr>
185 <tr><td>foo</td></tr>
186 <tr align="center"></tr>
187 <tr><td>bar</td></tr>
188 </table>
189 !!endarticle
190
191 ###
192 ### Basic tests
193 ###
194 !! test
195 Blank input
196 !! wikitext
197 !! html
198 !! end
199
200
201 !! test
202 Simple paragraph
203 !! wikitext
204 This is a simple paragraph.
205 !! html
206 <p>This is a simple paragraph.
207 </p>
208 !! end
209
210 !! test
211 Paragraphs with extra newline spacing
212 !! wikitext
213 foo
214
215 bar
216
217
218 baz
219
220
221
222 booz
223 !! html
224 <p>foo
225 </p><p>bar
226 </p><p><br />
227 baz
228 </p><p><br />
229 </p><p>booz
230 </p>
231 !! end
232
233 !! test
234 Paragraphs with newline spacing with comment lines in between
235 !! wikitext
236 ----
237 a
238 <!--foo-->
239 b
240 ----
241 a
242 <!--foo--><!--More than 1 comment, still stripped-->
243 b
244 ----
245 a
246 <!--foo--> <!----> <!-- bar -->
247 b
248 ----
249 a
250 <!--foo-->
251
252 b
253 ----
254 a
255
256 <!--foo-->
257 b
258 ----
259 a
260 <!--foo-->
261
262
263 b
264 ----
265 a
266
267
268 <!--foo-->
269 b
270 ----
271 !! html
272 <hr />
273 <p>a
274 b
275 </p>
276 <hr />
277 <p>a
278 b
279 </p>
280 <hr />
281 <p>a
282 b
283 </p>
284 <hr />
285 <p>a
286 </p><p>b
287 </p>
288 <hr />
289 <p>a
290 </p><p>b
291 </p>
292 <hr />
293 <p>a
294 </p><p><br />
295 b
296 </p>
297 <hr />
298 <p>a
299 </p><p><br />
300 b
301 </p>
302 <hr />
303
304 !! end
305
306 !! test
307 Paragraphs with newline spacing with non-empty white-space lines in between
308 !! wikitext
309 ----
310 a
311
312 b
313 ----
314 a
315
316
317 b
318 ----
319 !! html
320 <hr />
321 <p>a
322 </p><p>b
323 </p>
324 <hr />
325 <p>a
326 </p><p><br />
327 b
328 </p>
329 <hr />
330
331 !! end
332
333 !! test
334 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
335 !! wikitext
336 ----
337 a
338 <!--foo-->
339 b
340 ----
341 a
342 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
343 b
344 ----
345 a
346
347 <!--foo-->
348 <!--bar-->
349 b
350 ----
351 a
352
353 <!--foo-->
354 <!--bar-->
355
356 b
357 ----
358 !! html
359 <hr />
360 <p>a
361 b
362 </p>
363 <hr />
364 <p>a
365 b
366 </p>
367 <hr />
368 <p>a
369 </p><p>b
370 </p>
371 <hr />
372 <p>a
373 </p><p><br />
374 b
375 </p>
376 <hr />
377
378 !! end
379
380 !! test
381 Extra newlines: More paragraphs with indented comment
382 !! wikitext
383 a
384
385 <!--boo-->
386
387 b
388 !! html
389 <p>a
390 </p><p><br />
391 b
392 </p>
393 !!end
394
395 !! test
396 Extra newlines followed by heading
397 !! wikitext
398 a
399
400
401
402 =b=
403 [[a]]
404
405
406 =b=
407 !! html
408 <p>a
409 </p><p><br />
410 </p>
411 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
412 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
413 </p><p><br />
414 </p>
415 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
416
417 !! end
418
419 !! test
420 Extra newlines between heading and content are swallowed
421 !! wikitext
422 =b=
423
424
425
426 [[a]]
427 !! html
428 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
429 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
430 </p>
431 !! end
432
433 !! test
434 Parsing an URL
435 !! wikitext
436 http://fr.wikipedia.org/wiki/🍺
437 <!-- EasterEgg we love beer, better be able be able to link to it -->
438 !! html
439 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
440 </p>
441 !! end
442
443 # Note that the html+tidy output removes the spaces after the <li>,
444 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
445 # This is an issue for all tests with lists. We intentionally do
446 # *not* add html+tidy clauses for these, as we don't want to
447 # document/test the broken behavior. (Parsoid matches the non-tidy
448 # output in these cases.)
449
450 !! test
451 Simple list
452 !! wikitext
453 * Item 1
454 * Item 2
455 !! html
456 <ul><li> Item 1</li>
457 <li> Item 2</li></ul>
458
459 !! end
460
461 !! test
462 Italics and bold
463 !! wikitext
464 * plain
465 * plain''italic''plain
466 * plain''italic''plain''italic''plain
467 * plain'''bold'''plain
468 * plain'''bold'''plain'''bold'''plain
469 * plain''italic''plain'''bold'''plain
470 * plain'''bold'''plain''italic''plain
471 * plain''italic'''bold-italic'''italic''plain
472 * plain'''bold''bold-italic''bold'''plain
473 * plain'''''bold-italic'''italic''plain
474 * plain'''''bold-italic''bold'''plain
475 * plain''italic'''bold-italic'''''plain
476 * plain'''bold''bold-italic'''''plain
477 * plain l'''italic''plain
478 * plain l''''bold''' plain
479 !! html
480 <ul><li> plain</li>
481 <li> plain<i>italic</i>plain</li>
482 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
483 <li> plain<b>bold</b>plain</li>
484 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
485 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
486 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
487 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
488 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
489 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
490 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
491 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
492 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
493 <li> plain l'<i>italic</i>plain</li>
494 <li> plain l'<b>bold</b> plain</li></ul>
495
496 !! end
497
498 # this example taken from the [[simple:Moon]] article (bug 47326)
499 !! test
500 Italics and possessives (1)
501 !! wikitext
502 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
503 !! html
504 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
505 </p>
506 !! end
507
508 # this example taken from [[en:Flaming Pie]] (bug 49926)
509 !! test
510 Italics and possessives (2)
511 !! wikitext
512 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
513 !! html
514 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
515 </p>
516 !! end
517
518 # this example taken from [[en:Dictionary]] (bug 49926)
519 !! test
520 Italics and possessives (3)
521 !! wikitext
522 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
523 !! html
524 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
525 </p>
526 !! end
527
528
529 ###
530 ### 2-quote opening sequence tests
531 ###
532 !! test
533 Italics and bold: 2-quote opening sequence: (2,2)
534 !! wikitext
535 ''foo''
536 !! html
537 <p><i>foo</i>
538 </p>
539 !!end
540
541 !! test
542 Italics and bold: 2-quote opening sequence: (2,3)
543 !! options
544 parsoid=wt2html
545 !! wikitext
546 ''foo'''
547 !! html/*
548 <p><i>foo'</i>
549 </p>
550 !!end
551
552 # same html as previous, but wikitext adjusted to match parsoid html2wt
553 !! test
554 Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki
555 !! wikitext
556 ''foo'<nowiki/>''
557 !! html
558 <p><i>foo'</i>
559 </p>
560 !! end
561
562 !! test
563 Italics and bold: 2-quote opening sequence: (2,4)
564 !! options
565 parsoid=wt2html
566 !! wikitext
567 ''foo''''
568 !! html/*
569 <p><i>foo''</i>
570 </p>
571 !!end
572
573 # same html as previous, but wikitext adjusted to match parsoid html2wt
574 !! test
575 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
576 !! wikitext
577 ''foo<nowiki>''</nowiki>''
578 !! html
579 <p><i>foo''</i>
580 </p>
581 !! end
582
583 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
584 !! test
585 Italics and bold: 2-quote opening sequence: (2,5)
586 !! options
587 parsoid=wt2html
588 !! wikitext
589 ''foo'''''
590 !! html/php
591 <p><i>foo</i>
592 </p>
593 !! html/parsoid
594 <p><i>foo</i><b></b>
595 </p>
596 !!end
597
598 # same html as previous, but wikitext adjusted to match parsoid html2wt
599 !! test
600 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
601 !! wikitext
602 ''foo'''''<nowiki/>'''
603 !! html/php
604 <p><i>foo</i>
605 </p>
606 !! html/parsoid
607 <p><i>foo</i><b></b>
608 </p>
609 !! end
610
611
612 ###
613 ### 3-quote opening sequence tests
614 ###
615
616 !! test
617 Italics and bold: 3-quote opening sequence: (3,2)
618 !! options
619 parsoid=wt2html
620 !! wikitext
621 '''foo''
622 !! html/*
623 <p>'<i>foo</i>
624 </p>
625 !!end
626
627 # same html as previous, but wikitext adjusted to match parsoid html2wt
628 !! test
629 Italics and bold: 3-quote opening sequence: (3,2) w/ nowiki
630 !! wikitext
631 '<nowiki/>''foo''
632 !! html
633 <p>'<i>foo</i>
634 </p>
635 !!end
636
637 !! test
638 Italics and bold: 3-quote opening sequence: (3,3)
639 !! wikitext
640 '''foo'''
641 !! html
642 <p><b>foo</b>
643 </p>
644 !!end
645
646 !! test
647 Italics and bold: 3-quote opening sequence: (3,4)
648 !! options
649 parsoid=wt2html
650 !! wikitext
651 '''foo''''
652 !! html/*
653 <p><b>foo'</b>
654 </p>
655 !!end
656
657 # same html as previous, but wikitext adjusted to match parsoid html2wt
658 !! test
659 Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki
660 !! wikitext
661 '''foo'<nowiki/>'''
662 !! html
663 <p><b>foo'</b>
664 </p>
665 !! end
666
667 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
668 !! test
669 Italics and bold: 3-quote opening sequence: (3,5)
670 !! options
671 parsoid=wt2html
672 !! wikitext
673 '''foo'''''
674 !! html/php
675 <p><b>foo</b>
676 </p>
677 !! html/parsoid
678 <p><b>foo</b><i></i>
679 </p>
680 !!end
681
682 # same html as previous, but wikitext adjusted to match parsoid html2wt
683 !! test
684 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
685 !! wikitext
686 '''foo'''''<nowiki/>''
687 !! html/php
688 <p><b>foo</b>
689 </p>
690 !! html/parsoid
691 <p><b>foo</b><i></i>
692 </p>
693 !! end
694
695
696 ###
697 ### 4-quote opening sequence tests
698 ###
699
700 !! test
701 Italics and bold: 4-quote opening sequence: (4,2)
702 !! options
703 parsoid=wt2html
704 !! wikitext
705 ''''foo''
706 !! html/*
707 <p>''<i>foo</i>
708 </p>
709 !!end
710
711 # same html as previous, but wikitext adjusted to match parsoid html2wt
712 !! test
713 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
714 !! wikitext
715 <nowiki>''</nowiki>''foo''
716 !! html
717 <p>''<i>foo</i>
718 </p>
719 !! end
720
721 !! test
722 Italics and bold: 4-quote opening sequence: (4,3)
723 !! options
724 parsoid=wt2html
725 !! wikitext
726 ''''foo'''
727 !! html/*
728 <p>'<b>foo</b>
729 </p>
730 !!end
731
732 # same html as previous, but wikitext adjusted to match parsoid html2wt
733 !! test
734 Italics and bold: 4-quote opening sequence: (4,3) w/ nowiki
735 !! wikitext
736 '<nowiki/>'''foo'''
737 !! html
738 <p>'<b>foo</b>
739 </p>
740 !!end
741
742 !! test
743 Italics and bold: 4-quote opening sequence: (4,4)
744 !! options
745 parsoid=wt2html
746 !! wikitext
747 ''''foo''''
748 !! html/*
749 <p>'<b>foo'</b>
750 </p>
751 !!end
752
753 # same html as previous, but wikitext adjusted to match parsoid html2wt
754 !! test
755 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
756 !! wikitext
757 '<nowiki/>'''foo'<nowiki/>'''
758 !! html
759 <p>'<b>foo'</b>
760 </p>
761 !! end
762
763 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
764 !! test
765 Italics and bold: 4-quote opening sequence: (4,5)
766 !! options
767 parsoid=wt2html
768 !! wikitext
769 ''''foo'''''
770 !! html/php
771 <p>'<b>foo</b>
772 </p>
773 !! html/parsoid
774 <p>'<b>foo</b><i></i>
775 </p>
776 !!end
777
778 # same html as previous, but wikitext adjusted to match parsoid html2wt
779 !! test
780 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
781 !! wikitext
782 '<nowiki/>'''foo'''''<nowiki/>''
783 !! html/php
784 <p>'<b>foo</b>
785 </p>
786 !! html/parsoid
787 <p>'<b>foo</b><i></i>
788 </p>
789 !! end
790
791
792 ###
793 ### 5-quote opening sequence tests
794 ###
795
796 !! test
797 Italics and bold: 5-quote opening sequence: (5,2)
798 !! options
799 parsoid=wt2html
800 !! wikitext
801 '''''foo''
802 !! html/*
803 <p><b><i>foo</i></b>
804 </p>
805 !!end
806
807 # same html as previous, but wikitext adjusted to match parsoid html2wt
808 # skipping wt2html and html2html because it wants to put <i> before <b>
809 !! test
810 Italics and bold: 5-quote opening sequence: (5,2+3)
811 !! options
812 parsoid=wt2wt,html2wt
813 !! wikitext
814 '''''foo'''''
815 !! html
816 <p><b><i>foo</i></b>
817 </p>
818 !! end
819
820 !! test
821 Italics and bold: 5-quote opening sequence: (5,3)
822 !! options
823 parsoid=wt2html
824 !! wikitext
825 '''''foo'''
826 !! html/*
827 <p><i><b>foo</b></i>
828 </p>
829 !!end
830
831 # same html as previous, but wikitext adjusted to match parsoid html2wt
832 !! test
833 Italics and bold: 5-quote opening sequence: (5,3+2)
834 !! wikitext
835 '''''foo'''''
836 !! html
837 <p><i><b>foo</b></i>
838 </p>
839 !! end
840
841 !! test
842 Italics and bold: 5-quote opening sequence: (5,4)
843 !! options
844 parsoid=wt2html
845 !! wikitext
846 '''''foo''''
847 !! html/*
848 <p><i><b>foo'</b></i>
849 </p>
850 !!end
851
852 # same html as previous, but wikitext adjusted to match parsoid html2wt
853 !! test
854 Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki
855 !! wikitext
856 '''''foo'<nowiki/>'''''
857 !! html
858 <p><i><b>foo'</b></i>
859 </p>
860 !! end
861
862 !! test
863 Italics and bold: 5-quote opening sequence: (5,5)
864 !! wikitext
865 '''''foo'''''
866 !! html
867 <p><i><b>foo</b></i>
868 </p>
869 !!end
870
871 ###
872 ### multiple quote sequences in a line
873 ###
874 !! test
875 Italics and bold: multiple quote sequences: (2,4,2)
876 !! options
877 parsoid=wt2html
878 !! wikitext
879 ''foo''''bar''
880 !! html/*
881 <p><i>foo'<b>bar</b></i>
882 </p>
883 !!end
884
885
886 # same html as previous, but wikitext adjusted to match parsoid html2wt
887 !! test
888 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
889 !! wikitext
890 ''foo'<nowiki/>'''bar'''''
891 !! html
892 <p><i>foo'<b>bar</b></i>
893 </p>
894 !! end
895
896
897 !! test
898 Italics and bold: multiple quote sequences: (2,4,3)
899 !! options
900 parsoid=wt2html
901 !! wikitext
902 ''foo''''bar'''
903 !! html/*
904 <p><i>foo'<b>bar</b></i>
905 </p>
906 !!end
907
908
909 # same html as previous, but wikitext adjusted to match parsoid html2wt
910 !! test
911 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
912 !! wikitext
913 ''foo'<nowiki/>'''bar'''''
914 !! html
915 <p><i>foo'<b>bar</b></i>
916 </p>
917 !! end
918
919
920 !! test
921 Italics and bold: multiple quote sequences: (2,4,4)
922 !! options
923 parsoid=wt2html
924 !! wikitext
925 ''foo''''bar''''
926 !! html/*
927 <p><i>foo'<b>bar'</b></i>
928 </p>
929 !!end
930
931
932 # same html as previous, but wikitext adjusted to match parsoid html2wt
933 !! test
934 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
935 !! wikitext
936 ''foo'<nowiki/>'''bar'<nowiki/>'''''
937 !! html
938 <p><i>foo'<b>bar'</b></i>
939 </p>
940 !! end
941
942
943 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
944 !! test
945 Italics and bold: multiple quote sequences: (3,4,2)
946 !! options
947 parsoid=wt2html
948 !! wikitext
949 '''foo''''bar''
950 !! html/php
951 <p><b>foo'</b>bar
952 </p>
953 !! html/parsoid
954 <p><b>foo'</b>bar<i></i>
955 </p>
956 !!end
957
958 # same html as previous, but wikitext adjusted to match parsoid html2wt
959 !! test
960 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
961 !! options
962 parsoid
963 !! wikitext
964 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
965 !! html/php
966 <p><b>foo'</b>bar
967 </p>
968 !! html/parsoid
969 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
970 </p>
971 !! end
972
973
974 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
975 !! test
976 Italics and bold: multiple quote sequences: (3,4,3)
977 !! options
978 parsoid=wt2html
979 !! wikitext
980 '''foo''''bar'''
981 !! html/php
982 <p><b>foo'</b>bar
983 </p>
984 !! html/parsoid
985 <p><b>foo'</b>bar<b></b>
986 </p>
987 !!end
988
989 # same html as previous, but wikitext adjusted to match parsoid html2wt
990 !! test
991 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
992 !! wikitext
993 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
994 !! html/php
995 <p><b>foo'</b>bar
996 </p>
997 !! html/parsoid
998 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
999 </p>
1000 !! end
1001
1002 ###
1003 ### other quote tests
1004 ###
1005 !! test
1006 Italics and bold: other quote tests: (2,3,5)
1007 !! wikitext
1008 ''this is about '''foo's family'''''
1009 !! html
1010 <p><i>this is about <b>foo's family</b></i>
1011 </p>
1012 !!end
1013
1014
1015 !! test
1016 Italics and bold: other quote tests: (2,(3,3),2)
1017 !! wikitext
1018 ''this is about '''foo's''' family''
1019 !! html
1020 <p><i>this is about <b>foo's</b> family</i>
1021 </p>
1022 !!end
1023
1024
1025 !! test
1026 Italics and bold: other quote tests: (3,2,3,2)
1027 !! options
1028 parsoid=wt2html
1029 !! wikitext
1030 '''this is about ''foo'''s family''
1031 !! html/*
1032 <p><b>this is about <i>foo</i></b><i>s family</i>
1033 </p>
1034 !!end
1035
1036
1037 # same html as previous, but wikitext adjusted to match parsoid html2wt
1038 !! test
1039 Italics and bold: other quote tests: (3,2,3+2+2,2)
1040 !! wikitext
1041 '''this is about ''foo'''''<nowiki/>''s family''
1042 !! html
1043 <p><b>this is about <i>foo</i></b><i>s family</i>
1044 </p>
1045 !! end
1046
1047
1048 !! test
1049 Italics and bold: other quote tests: (3,2,3,3)
1050 !! options
1051 parsoid=wt2html
1052 !! wikitext
1053 '''this is about ''foo'''s family'''
1054 !! html/*
1055 <p>'<i>this is about </i>foo<b>s family</b>
1056 </p>
1057 !!end
1058
1059
1060 # same html as previous, but wikitext adjusted to match parsoid html2wt
1061 !! test
1062 Italics and bold: other quote tests: (3,2,3,3) w/ nowiki
1063 !! wikitext
1064 '<nowiki/>''this is about ''foo'''s family'''
1065 !! html
1066 <p>'<i>this is about </i>foo<b>s family</b>
1067 </p>
1068 !!end
1069
1070
1071 !! test
1072 Italics and bold: other quote tests: (3,(2,2),3)
1073 !! wikitext
1074 '''this is about ''foo's'' family'''
1075 !! html
1076 <p><b>this is about <i>foo's</i> family</b>
1077 </p>
1078 !!end
1079
1080
1081 !! test
1082 Italicized possessive
1083 !! wikitext
1084 The ''[[Main Page]]'''s talk page.
1085 !! html
1086 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1087 </p>
1088 !! end
1089
1090 !! test
1091 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1092 (Requires tidy for PHP parser output to be fixed up)
1093 !! options
1094 parsoid=wt2html,wt2wt
1095 !! wikitext
1096 {|
1097 !''a!!''b
1098 |''a||''b
1099 |}
1100 !! html/php+tidy
1101 <table>
1102 <tr>
1103 <th><i>a</i></th>
1104 <th><i>b</i></th>
1105 <td><i>a</i></td>
1106 <td><i>b</i></td>
1107 </tr>
1108 </table>
1109 !! html/parsoid
1110 <table>
1111 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1112 <td><i>a</i></td><td><i>b</i></td></tr>
1113 </tbody></table>
1114 !! end
1115
1116 ###
1117 ### Non-html5 tags
1118 ###
1119
1120 !! test
1121 Non-html5 tags should be accepted
1122 !! wikitext
1123 <center>''foo''</center>
1124 <big>''foo''</big>
1125 <font>''foo''</font>
1126 <strike>''foo''</strike>
1127 <tt>''foo''</tt>
1128 !! html
1129 <center><i>foo</i></center>
1130 <p><big><i>foo</i></big>
1131 <font><i>foo</i></font>
1132 <strike><i>foo</i></strike>
1133 <tt><i>foo</i></tt>
1134 </p>
1135 !! end
1136
1137 !! test
1138 <wbr> is valid wikitext (bug 52468)
1139 !! wikitext
1140 <wbr>
1141 !! html
1142 <p><wbr />
1143 </p>
1144 !! end
1145
1146 # <strike> is HTML4, <s> is HTML4/5.
1147 !! test
1148 <s> or <strike> for strikethrough
1149 !! wikitext
1150 <strike>strike</strike>
1151
1152 <s>s</s>
1153 !! html
1154 <p><strike>strike</strike>
1155 </p><p><s>s</s>
1156 </p>
1157 !! end
1158
1159 ## a not permitted
1160 ## i,b,br omitted
1161 !! test
1162 Text-level semantic html elements in wikitext
1163 !! wikitext
1164 <em>text</em>
1165 <strong>text</strong>
1166 <small>text</small>
1167 <s>text</s>
1168 <cite>text</cite>
1169 <q>text</q>
1170 <dfn>text</dfn>
1171 <abbr>text</abbr>
1172 <data>text</data>
1173 <time>text</time>
1174 <code>text</code>
1175 <var>text</var>
1176 <samp>text</samp>
1177 <kbd>text</kbd>
1178 <sub>text</sub>
1179 <u>text</u>
1180 <mark>text</mark>
1181 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1182 <bdi>text</bdi>
1183 <bdo>text</bdo>
1184 <span>text</span>
1185 <wbr />
1186 !! html
1187 <p><em>text</em>
1188 <strong>text</strong>
1189 <small>text</small>
1190 <s>text</s>
1191 <cite>text</cite>
1192 <q>text</q>
1193 <dfn>text</dfn>
1194 <abbr>text</abbr>
1195 <data>text</data>
1196 <time>text</time>
1197 <code>text</code>
1198 <var>text</var>
1199 <samp>text</samp>
1200 <kbd>text</kbd>
1201 <sub>text</sub>
1202 <u>text</u>
1203 <mark>text</mark>
1204 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1205 <bdi>text</bdi>
1206 <bdo>text</bdo>
1207 <span>text</span>
1208 <wbr />
1209 </p>
1210 !! end
1211
1212 # test cases taken from
1213 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1214 !! test
1215 Ruby markup (W3C-style)
1216 !! wikitext
1217 ; Mono-ruby for individual base characters
1218 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1219 ; Group ruby
1220 : <ruby>今日<rt>きょう</rt></ruby>
1221 ; Jukugo ruby
1222 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1223 ; Inline ruby
1224 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1225 ; Double-sided ruby
1226 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1227 <ruby>
1228 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1229 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1230 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1231 </ruby>
1232 !! html
1233 <dl><dt> Mono-ruby for individual base characters</dt>
1234 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1235 <dt> Group ruby</dt>
1236 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1237 <dt> Jukugo ruby</dt>
1238 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1239 <dt> Inline ruby</dt>
1240 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1241 <dt> Double-sided ruby</dt>
1242 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1243 <p><ruby>
1244 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1245 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1246 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1247 </ruby>
1248 </p>
1249 !! end
1250
1251 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1252 !! test
1253 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1254 !! wikitext
1255 <b→> doesn't work! </b→>
1256
1257 <bä> doesn't work! </bä>
1258
1259 <boo> works fine </boo>
1260
1261 <s.foo>s.foo</s.foo>
1262
1263 <sub-ID#1>
1264 !! html
1265 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1266 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1267 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1268 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1269 </p><p>&lt;sub-ID#1&gt;
1270 </p>
1271 !! end
1272
1273 !! test
1274 Isolated close tags should be treated as literal text (bug 52760)
1275 !! wikitext
1276 </b>
1277
1278 <s.foo>s</s>
1279 !! html
1280 <p>&lt;/b&gt;
1281 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1282 </p>
1283 !! end
1284
1285 ###
1286 ### Special characters
1287 ###
1288
1289 !! test
1290 Bare pipe character (bug 52363)
1291 !! wikitext
1292 |
1293 !! html
1294 <p>|
1295 </p>
1296 !! end
1297
1298 !! test
1299 Bare pipe character from a template (bug 52363)
1300 !! wikitext
1301 {{pipe}}
1302 !! html
1303 <p>|
1304 </p>
1305 !! end
1306
1307 ###
1308 ### <nowiki> test cases
1309 ###
1310
1311 !! test
1312 <nowiki> unordered list
1313 !! wikitext
1314 <nowiki>* This is not an unordered list item.</nowiki>
1315 !! html
1316 <p>* This is not an unordered list item.
1317 </p>
1318 !! end
1319
1320 !! test
1321 <nowiki> spacing
1322 !! wikitext
1323 <nowiki>Lorem ipsum dolor
1324
1325 sed abit.
1326 sed nullum.
1327
1328 :and a colon
1329 </nowiki>
1330 !! html
1331 <p>Lorem ipsum dolor
1332
1333 sed abit.
1334 sed nullum.
1335
1336 :and a colon
1337
1338 </p>
1339 !! end
1340
1341 !! test
1342 nowiki 3
1343 !! wikitext
1344 :There is not nowiki.
1345 :There is <nowiki>nowiki</nowiki>.
1346
1347 #There is not nowiki.
1348 #There is <nowiki>nowiki</nowiki>.
1349
1350 *There is not nowiki.
1351 *There is <nowiki>nowiki</nowiki>.
1352 !! html
1353 <dl><dd>There is not nowiki.</dd>
1354 <dd>There is nowiki.</dd></dl>
1355 <ol><li>There is not nowiki.</li>
1356 <li>There is nowiki.</li></ol>
1357 <ul><li>There is not nowiki.</li>
1358 <li>There is nowiki.</li></ul>
1359
1360 !! end
1361
1362 !! test
1363 Entities inside <nowiki>
1364 !! wikitext
1365 <nowiki>&lt;</nowiki>
1366 !! html
1367 <p>&lt;
1368 </p>
1369 !! end
1370
1371 !! test
1372 Entities inside template parameters
1373 !! options
1374 parsoid
1375 !! wikitext
1376 {{echo|&ndash;}}
1377 !! html
1378 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1379 !! end
1380
1381 !! test
1382 Properly escape nowiki when combined with other wiki markup
1383 !! options
1384 parsoid=html2wt
1385 !! wikitext
1386 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1387 !! html
1388 <p>* &lt;/nowiki&gt; tag</p>
1389 !! end
1390
1391 ###
1392 ### Comments
1393 ###
1394 !! test
1395 Comments and Indent-Pre
1396 !! wikitext
1397 <!-- comment 1 --> asdf
1398
1399 <!-- comment 1 --> asdf
1400 <!-- comment 2 -->
1401
1402 <!-- comment 1 --> asdf
1403 <!-- comment 2 -->xyz
1404
1405 <!-- comment 1 --> asdf
1406 <!-- comment 2 --> xyz
1407 !! html
1408 <pre>asdf
1409 </pre>
1410 <pre>asdf
1411 </pre>
1412 <pre>asdf
1413 </pre>
1414 <p>xyz
1415 </p>
1416 <pre>asdf
1417 xyz
1418 </pre>
1419 !! end
1420
1421 !! test
1422 Comment test 2a
1423 !! wikitext
1424 asdf
1425 <!-- comment 1 -->
1426 jkl
1427 !! html
1428 <p>asdf
1429 jkl
1430 </p>
1431 !! end
1432
1433 !! test
1434 Comment test 2b
1435 !! wikitext
1436 asdf
1437 <!-- comment 1 -->
1438
1439 jkl
1440 !! html
1441 <p>asdf
1442 </p><p>jkl
1443 </p>
1444 !! end
1445
1446 !! test
1447 Comment test 3
1448 !! wikitext
1449 asdf
1450 <!-- comment 1 -->
1451 <!-- comment 2 -->
1452 jkl
1453 !! html
1454 <p>asdf
1455 jkl
1456 </p>
1457 !! end
1458
1459 !! test
1460 Comment test 4
1461 !! wikitext
1462 asdf<!-- comment 1 -->jkl
1463 !! html
1464 <p>asdfjkl
1465 </p>
1466 !! end
1467
1468 !! test
1469 Comment spacing
1470 !! wikitext
1471 a
1472 <!-- foo --> b <!-- bar -->
1473 c
1474 !! html
1475 <p>a
1476 </p>
1477 <pre> b
1478 </pre>
1479 <p>c
1480 </p>
1481 !! end
1482
1483 !! test
1484 Comment whitespace
1485 !! wikitext
1486 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1487 !! html
1488
1489 !! end
1490
1491 !! test
1492 Comment semantics and delimiters
1493 !! wikitext
1494 <!-- --><!----><!-----><!------>
1495 !! html
1496
1497 !! end
1498
1499 !! test
1500 Comment semantics and delimiters, redux
1501 !! wikitext
1502 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1503 -- foo -- funky huh? ... -->
1504 !! html
1505
1506 !! end
1507
1508 !! test
1509 Comment semantics and delimiters: directors cut
1510 !! wikitext
1511 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1512 everything starting with < followed by !-- until the first -- and > we see,
1513 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1514 -->-->
1515 !! html
1516 <p>--&gt;
1517 </p>
1518 !! end
1519
1520 !! test
1521 Comment semantics: nesting
1522 !! wikitext
1523 <!--<!-- no, we're not going to do anything fancy here -->-->
1524 !! html
1525 <p>--&gt;
1526 </p>
1527 !! end
1528
1529 !! test
1530 Comment semantics: unclosed comment at end
1531 !! wikitext
1532 <!--This comment will run out to the end of the document
1533 !! html
1534
1535 !! end
1536
1537 # Bug 58184: document parsoid's behaviour
1538 !! test
1539 Suppress comment closing tag in lenient browsers
1540 !! options
1541 parsoid=wt2html,html2html
1542 !! wikitext
1543 <!-- Browsers--!> think this is closed -->
1544 !! html/php
1545
1546 !! html/parsoid
1547 <!-- Browsers--¡> think this is closed -->
1548 !! end
1549
1550 !! test
1551 Comment in template title
1552 !! wikitext
1553 {{f<!---->oo}}
1554 !! html
1555 <p>FOO
1556 </p>
1557 !! end
1558
1559 !! test
1560 Comment on its own line post-expand
1561 !! wikitext
1562 a
1563 {{blank}}<!---->
1564 b
1565 !! html
1566 <p>a
1567 </p><p>b
1568 </p>
1569 !! end
1570
1571 !! test
1572 Comment on its own line post-expand with non-significant whitespace
1573 !! wikitext
1574 a
1575 {{blank}} <!---->
1576 b
1577 !! html
1578 <p>a
1579 </p><p>b
1580 </p>
1581 !! end
1582
1583 !! test
1584 Multiple comments should still parse as SOL-transparent
1585 !! options
1586 parsoid=wt2html,wt2wt
1587 !! wikitext
1588 <!--c1-->*a
1589 <!--c2--><!--c3--><!--c4-->*b
1590 !! html
1591 <ul>
1592 <li>a
1593 </li>
1594 <li>b
1595 </li>
1596 </ul>
1597 !! end
1598
1599 ###
1600 ### paragraph wrapping tests
1601 ###
1602 !! test
1603 No block tags
1604 !! wikitext
1605 a
1606
1607 b
1608 !! html
1609 <p>a
1610 </p><p>b
1611 </p>
1612 !! end
1613
1614 !! test
1615 Block tag on one line (<div>)
1616 !! wikitext
1617 a <div>foo</div>
1618
1619 b
1620 !! html
1621 a <div>foo</div>
1622 <p>b
1623 </p>
1624 !! html+tidy
1625 <p>a</p>
1626 <div>foo</div>
1627 <p>b</p>
1628 !! end
1629
1630 !! test
1631 Block tag on one line (<blockquote>)
1632 !! wikitext
1633 a <blockquote>foo</blockquote>
1634
1635 b
1636 !! html
1637 a <blockquote>foo</blockquote>
1638 <p>b
1639 </p>
1640 !! html+tidy
1641 <p>a</p>
1642 <blockquote>
1643 <p>foo</p>
1644 </blockquote>
1645 <p>b</p>
1646 !! end
1647
1648 !! test
1649 Block tag on both lines (<div>)
1650 !! wikitext
1651 a <div>foo</div>
1652
1653 b <div>foo</div>
1654 !! html
1655 a <div>foo</div>
1656 b <div>foo</div>
1657
1658 !! html+tidy
1659 <p>a</p>
1660 <div>foo</div>
1661 <p>b</p>
1662 <div>foo</div>
1663 !! end
1664
1665 !! test
1666 Block tag on both lines (<blockquote>)
1667 !! wikitext
1668 a <blockquote>foo</blockquote>
1669
1670 b <blockquote>foo</blockquote>
1671 !! html
1672 a <blockquote>foo</blockquote>
1673 b <blockquote>foo</blockquote>
1674
1675 !! html+tidy
1676 <p>a</p>
1677 <blockquote>
1678 <p>foo</p>
1679 </blockquote>
1680 <p>b</p>
1681 <blockquote>
1682 <p>foo</p>
1683 </blockquote>
1684 !! end
1685
1686 !! test
1687 Multiple lines without block tags
1688 !! wikitext
1689 <div>foo</div> a
1690 b
1691 c
1692 d<!--foo--> e
1693 x <div>foo</div> z
1694 !! html
1695 <div>foo</div> a
1696 <p>b
1697 c
1698 d e
1699 </p>
1700 x <div>foo</div> z
1701
1702 !! html+tidy
1703 <div>foo</div>
1704 <p>a</p>
1705 <p>b c d e</p>
1706 <p>x</p>
1707 <div>foo</div>
1708 <p>z</p>
1709 !! end
1710
1711 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1712 # So, we have a separate section for Parsoid. We don't want
1713 # to mimic this stripping behavior in Parsoid. It affects
1714 # editing experience and also requires us to maintain additional
1715 # info for RT-ing.
1716 !! test
1717 Empty lines between lines with block tags
1718 !! wikitext
1719 <div></div>
1720
1721
1722 <div></div>a
1723
1724 b
1725 <div>a</div>b
1726
1727 <div>b</div>d
1728
1729
1730 <div>e</div>
1731 !! html
1732 <div></div>
1733 <p><br />
1734 </p>
1735 <div></div>a
1736 <p>b
1737 </p>
1738 <div>a</div>b
1739 <div>b</div>d
1740 <p><br />
1741 </p>
1742 <div>e</div>
1743
1744 !! html+tidy
1745 <p><br /></p>
1746 <p>a</p>
1747 <p>b</p>
1748 <div>a</div>
1749 <p>b</p>
1750 <div>b</div>
1751 <p>d</p>
1752 <p><br /></p>
1753 <div>e</div>
1754 !! html/parsoid
1755 <div data-parsoid='{"stx":"html"}'></div>
1756
1757 <p><br /></p>
1758 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1759
1760 <p>b</p>
1761 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1762
1763 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1764
1765 <p><br /></p>
1766 <div data-parsoid='{"stx":"html"}'>e</div>
1767 !! end
1768
1769 ## PHP parser emits output which is broken
1770 ## XXX The parsoid output doesn't match the tidy output.
1771 !! test
1772 Unclosed HTML p-tags should be handled properly
1773 !! wikitext
1774 <div><p>foo</div>
1775 a
1776
1777 b
1778 !! html/php+tidy
1779 <div>
1780 <p>foo&lt;/div&gt;</p>
1781 <p>a</p>
1782 b</div>
1783 !! html/parsoid
1784 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1785 <p>a</p>
1786 <p>b</p>
1787 !! end
1788
1789 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
1790 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
1791 ## them for now.
1792 !! test
1793 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
1794 !! options
1795 parsoid=wt2html
1796 !! wikitext
1797 a [[Category:A1]] [[Category:A2]]
1798 [[Category:A3]]
1799 [[Category:A4]]
1800 !! html/parsoid
1801 <p>a</p>
1802 <link href="Category:A1"/> <link href="Category:A2"/> <link href="Category:A3"/> <link href="Category:A4"/>
1803 !! end
1804
1805 !! test
1806 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
1807 !! options
1808 parsoid=wt2html
1809 !! wikitext
1810 [[Category:A1]]a
1811 !! html/parsoid
1812 <link href="Category:A1"/><p>a</p>
1813 !! end
1814
1815 ###
1816 ### Preformatted text
1817 ###
1818 !! test
1819 Preformatted text
1820 !! wikitext
1821 This is some
1822 Preformatted text
1823 With ''italic''
1824 And '''bold'''
1825 And a [[Main Page|link]]
1826 !! html
1827 <pre>This is some
1828 Preformatted text
1829 With <i>italic</i>
1830 And <b>bold</b>
1831 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1832 </pre>
1833 !! end
1834
1835 !! test
1836 Tabs don't trigger preformatted text
1837 !! wikitext
1838 This is not
1839 preformatted text.
1840 This is preformatted text.
1841 So is this.
1842 !! html
1843 <p> This is not
1844 preformatted text.
1845 </p>
1846 <pre>This is preformatted text.
1847 So is this.
1848 </pre>
1849 !! end
1850
1851 !! test
1852 Ident preformatting with inline content
1853 !! wikitext
1854 a
1855 ''b''
1856 !! html
1857 <pre>a
1858 <i>b</i>
1859 </pre>
1860 !! end
1861
1862 !! test
1863 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1864 !! wikitext
1865 <pre><nowiki>
1866 <b>
1867 <cite>
1868 <em>
1869 </nowiki></pre>
1870 !! html
1871 <pre>
1872 &lt;b&gt;
1873 &lt;cite&gt;
1874 &lt;em&gt;
1875 </pre>
1876
1877 !! end
1878
1879 !! test
1880 Regression with preformatted in <center>
1881 !! wikitext
1882 <center>
1883 Blah
1884 </center>
1885 !! html
1886 <center>
1887 <pre>Blah
1888 </pre>
1889 </center>
1890
1891 !! end
1892
1893 !! test
1894 Bug 52763: Preformatted in <blockquote>
1895 !! wikitext
1896 <blockquote>
1897 Blah
1898 {|
1899 |
1900 indented cell (no pre-wrapping!)
1901 |}
1902 </blockquote>
1903 !! html
1904 <blockquote>
1905 <p> Blah
1906 </p>
1907 <table>
1908 <tr>
1909 <td>
1910 <p> indented cell (no pre-wrapping!)
1911 </p>
1912 </td></tr></table>
1913 </blockquote>
1914
1915 !! end
1916
1917 !! test
1918 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1919 !! wikitext
1920 <blockquote>
1921 Foo
1922
1923 Bar
1924 </blockquote>
1925 !! html
1926 <blockquote>
1927 <p>Foo
1928 </p><p>Bar
1929 </p>
1930 </blockquote>
1931
1932 !! end
1933
1934 !! test
1935 Bug 15491: <ins>/<del> in blockquote
1936 !! wikitext
1937 <blockquote>
1938 Foo <del>bar</del> <ins>baz</ins> quux
1939 </blockquote>
1940 !! html
1941 <blockquote>
1942 <p>Foo <del>bar</del> <ins>baz</ins> quux
1943 </p>
1944 </blockquote>
1945
1946 !! end
1947
1948 # Note that the p-wrapping is newline sensitive, which could be
1949 # considered a bug: tidy will wrap only the 'Foo' in the example
1950 # below in a <p> tag. (see comment 23-25 of bug #6200)
1951 !! test
1952 Bug 15491: <ins>/<del> in blockquote (2)
1953 !! wikitext
1954 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1955 </blockquote>
1956 !! html
1957 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1958 </blockquote>
1959
1960 !! html+tidy
1961 <blockquote>
1962 <p>Foo</p>
1963 <del>bar</del> <ins>baz</ins> quux</blockquote>
1964 !! end
1965
1966 !! test
1967 <pre> with attributes (bug 3202)
1968 !! wikitext
1969 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1970 !! html
1971 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1972
1973 !! end
1974
1975 !! test
1976 <pre> with width attribute (bug 3202)
1977 !! wikitext
1978 <pre width="8">Narrow screen goodies</pre>
1979 !! html
1980 <pre width="8">Narrow screen goodies</pre>
1981
1982 !! end
1983
1984 !! test
1985 <pre> with forbidden attribute (bug 3202)
1986 !! wikitext
1987 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1988 !! html
1989 <pre width="8">Narrow screen goodies</pre>
1990
1991 !! end
1992
1993 !! test
1994 Entities inside <pre>
1995 !! wikitext
1996 <pre>&lt;</pre>
1997 !! html
1998 <pre>&lt;</pre>
1999
2000 !! end
2001
2002 !! test
2003 <pre> with forbidden attribute values (bug 3202)
2004 !! wikitext
2005 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2006 !! html
2007 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2008
2009 !! end
2010
2011 !! test
2012 <nowiki> inside <pre> (bug 13238)
2013 !! wikitext
2014 <pre>
2015 <nowiki>
2016 </pre>
2017 <pre>
2018 <nowiki></nowiki>
2019 </pre>
2020 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2021 !! html
2022 <pre>
2023 &lt;nowiki&gt;
2024 </pre>
2025 <pre>
2026
2027 </pre>
2028 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2029
2030 !! end
2031
2032 !! test
2033 <nowiki> and <pre> preference (first one wins)
2034 !! wikitext
2035 <pre>
2036 <nowiki>
2037 </pre>
2038 </nowiki>
2039 </pre>
2040
2041 <nowiki>
2042 <pre>
2043 <nowiki>
2044 </pre>
2045 </nowiki>
2046 </pre>
2047
2048 !! html
2049 <pre>
2050 &lt;nowiki&gt;
2051 </pre>
2052 <p>&lt;/nowiki&gt;
2053 &lt;/pre&gt;
2054 </p><p>
2055 &lt;pre&gt;
2056 &lt;nowiki&gt;
2057 &lt;/pre&gt;
2058
2059 &lt;/pre&gt;
2060 </p>
2061 !! end
2062
2063 !! test
2064 </pre> inside nowiki
2065 !! wikitext
2066 <nowiki></pre></nowiki>
2067 !! html
2068 <p>&lt;/pre&gt;
2069 </p>
2070 !! end
2071
2072 # Parsoid doesn't strip empty tags, like Tidy does.
2073 !! test
2074 Empty pre; pre inside other HTML tags (bug 54946)
2075 !! options
2076 parsoid=wt2html,wt2wt
2077 !! wikitext
2078 a
2079
2080 <div><pre>
2081 foo
2082 </pre></div>
2083 <pre></pre>
2084 !! html/php
2085 <p>a
2086 </p>
2087 <div><pre>
2088 foo
2089 </pre></div>
2090 <pre></pre>
2091
2092 !! html/php+tidy
2093 <p>a</p>
2094 <div>
2095 <pre>
2096 foo
2097 </pre></div>
2098 !! html/parsoid
2099 <p>a</p>
2100
2101 <div><pre>foo
2102 </pre></div>
2103 <pre></pre>
2104 !! end
2105
2106 !! test
2107 HTML pre followed by indent-pre
2108 !! wikitext
2109 <pre>foo</pre>
2110 bar
2111 !! html
2112 <pre>foo</pre>
2113 <pre>bar
2114 </pre>
2115 !! end
2116
2117 !!test
2118 Block tag pre
2119 !!options
2120 parsoid
2121 !! wikitext
2122 <p><pre>foo</pre></p>
2123 !! html
2124 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2125 !!end
2126
2127 !!test
2128 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2129 !! wikitext
2130 {{echo|}}
2131 !! html
2132
2133 !!end
2134
2135 !!test
2136 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2137 !! wikitext
2138 {{echo|
2139 foo}}
2140 !! html
2141 <p>foo
2142 </p>
2143 !!end
2144
2145 !! test
2146 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2147 !! wikitext
2148 {{echo|a
2149 b}}
2150 !! html
2151 <pre>a
2152 </pre>
2153 <p>b
2154 </p>
2155 !!end
2156
2157 !! test
2158 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2159 !! wikitext
2160 {{echo|a
2161 b
2162 c
2163 d
2164 e
2165 }}
2166 !! html
2167 <pre>a
2168 </pre>
2169 <p>b
2170 c
2171 </p>
2172 <pre>d
2173 </pre>
2174 <p>e
2175 </p>
2176 !!end
2177
2178 !!test
2179 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2180 !! wikitext
2181 {{echo| foo}}
2182
2183 {{echo| foo}}{{echo| bar}}
2184
2185 {{echo| foo}}
2186 {{echo| bar}}
2187
2188 {{echo|<!--cmt--> foo}}
2189
2190 <!--cmt-->{{echo| foo}}
2191
2192 {{echo|{{echo| }}bar}}
2193 !! html
2194 <pre>foo
2195 </pre>
2196 <pre>foo bar
2197 </pre>
2198 <pre>foo
2199 bar
2200 </pre>
2201 <pre>foo
2202 </pre>
2203 <pre>foo
2204 </pre>
2205 <pre>bar
2206 </pre>
2207 !!end
2208
2209 !! test
2210 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2211 !! wikitext
2212 {{echo| }}a
2213
2214 {{echo|
2215 }}a
2216
2217 {{echo|
2218 b}}
2219
2220 {{echo|a
2221 }}b
2222
2223 {{echo|a
2224 }} b
2225 !! html
2226 <pre>a
2227 </pre>
2228 <p><br />
2229 </p>
2230 <pre>a
2231 </pre>
2232 <p><br />
2233 </p>
2234 <pre>b
2235 </pre>
2236 <p>a
2237 </p>
2238 <pre>b
2239 </pre>
2240 <p>a
2241 </p>
2242 <pre>b
2243 </pre>
2244 !!end
2245
2246 !! test
2247 Things that look like <pre> tags aren't treated as such
2248 !! wikitext
2249 Barack Obama <President> of the United States
2250 <President></President>
2251 !! html
2252 <p>Barack Obama &lt;President&gt; of the United States
2253 &lt;President&gt;&lt;/President&gt;
2254 </p>
2255 !! end
2256
2257 ## PHP parser discards the "<pre " string
2258 !! test
2259 Handle broken pre-like tags (bug 64025)
2260 !! options
2261 parsoid=wt2html
2262 !! wikitext
2263 {{echo|<pre <pre>x</pre>}}
2264
2265 <table><pre </table>
2266 !! html/php
2267 <pre>x</pre>
2268 <table><pre></pre></table>
2269
2270 !! html/parsoid
2271 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2272
2273
2274 <p>&lt;pre </p>
2275
2276 <table></table>
2277 !! end
2278
2279 !! test
2280 Parsoid: handle pre with space after attribute
2281 !! options
2282 parsoid=wt2html
2283 !! wikitext
2284 <pre style="width:50%;" >{{echo|foo}}</pre>
2285 !! html
2286 <pre style="width:50%;">{{echo|foo}}</pre>
2287 !! end
2288
2289 # TODO / maybe: fix wt2wt for this
2290 !! test
2291 Parsoid: Don't paragraph-wrap fosterable content
2292 !! options
2293 parsoid=wt2html
2294 !! wikitext
2295 {|
2296 <td></td>
2297 <td></td>
2298
2299
2300
2301 |}
2302 !! html
2303 <table>
2304
2305 <tbody>
2306 <tr>
2307 <td></td>
2308
2309 <td></td></tr>
2310
2311
2312
2313 </tbody></table>
2314 !! end
2315
2316 !! test
2317 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2318 !! options
2319 parsoid=wt2html
2320 !! wikitext
2321 {|
2322 <td>
2323 <td>
2324 </td>
2325
2326
2327
2328 |}
2329 !! html
2330 <table>
2331
2332 <tbody>
2333 <tr>
2334 <td></td>
2335
2336 <td>
2337 </td></tr>
2338
2339
2340
2341 </tbody></table>
2342 !! end
2343
2344
2345 #--------------------------------------------------------------------
2346 # Transclusion parameter whitespace stripping tests
2347 # Behavior is different for positional and named parameters
2348 #--------------------------------------------------------------------
2349 !! test
2350 Templates: Strip leading and trailing whitespace from named-param values
2351 !! wikitext
2352 {{echo|1= a }}
2353
2354 {{echo|1= {{echo|b}} }}
2355
2356 {{echo| 1 =
2357 c }}
2358
2359 {{echo| 1 =
2360 * d
2361 }}
2362 !! html
2363 <p>a
2364 </p><p>b
2365 </p><p>c
2366 </p>
2367 <ul><li> d</li></ul>
2368
2369 !! end
2370
2371 !! test
2372 Templates: Don't strip whitespace from positional-param values
2373 !! wikitext
2374 {{echo|a }}
2375
2376 {{echo|{{echo|b}} }}
2377
2378 {{echo| c
2379 }}
2380
2381 {{echo| {{echo|d}}
2382 }}
2383
2384 {{echo|
2385 e}}
2386
2387 {{echo|
2388 * f}}
2389
2390 {{echo|
2391 }}g
2392 !! html
2393 <p>a
2394 </p><p>b
2395 </p>
2396 <pre>c
2397 </pre>
2398 <p><br />
2399 </p>
2400 <pre>d
2401 </pre>
2402 <p><br />
2403 </p>
2404 <pre>e
2405 </pre>
2406 <p><br />
2407 </p>
2408 <ul><li> f</li></ul>
2409 <p><br />
2410 </p>
2411 <pre>g
2412 </pre>
2413 !! end
2414
2415 !! test
2416 Templates: Handle empty comment-and-ws-only lines correctly
2417 !! wikitext
2418 {{echo|foo
2419 <!--should be ignored-->
2420 <!--should be ignored as well-->
2421 bar}}
2422 !! html
2423 <p>foo
2424 bar
2425 </p>
2426 !! end
2427
2428 !! test
2429 Templates: Handle comments in the target
2430 !! wikitext
2431 {{echo
2432 <!-- should be ignored -->
2433 |foo}}
2434
2435 {{echo<!-- should be ignored -->
2436 |foo}}
2437
2438 {{echo<!-- should be ignored -->|foo}}
2439
2440 {{<!-- should be ignored -->echo|foo}}
2441 !!html/parsoid
2442 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2443
2444 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2445
2446 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2447
2448 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2449 !!end
2450
2451 !! test
2452 Templates: Handle comments in parameter names (bug 67657)
2453 !! wikitext
2454 {{echo|1
2455 <!-- should be ignored -->
2456 =foo}}
2457
2458 {{echo|
2459 <!-- should be ignored -->
2460 1 = foo}}
2461
2462 {{echo|1<!-- should be ignored --> = foo}}
2463
2464 {{echo|<!-- should be ignored -->1 = foo}}
2465 !!html/parsoid
2466 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2467
2468 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2469
2470 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2471
2472 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2473 !!end
2474
2475 !! test
2476 Templates: Other wikitext in parameter names (bug 67657)
2477 !! wikitext
2478 {{echo|''1''=foo}}
2479 !!html/parsoid
2480 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2481 !!html/php
2482 <p>{{{1}}}
2483 </p>
2484 !!end
2485
2486 #--------------------------------------------------------------------
2487 # Transclusion parameter escaping tests
2488 #--------------------------------------------------------------------
2489 !! test
2490 Templates: Parsoid parameter escaping test 1
2491 !! options
2492 parsoid
2493 !! wikitext
2494 {{echo|[foo]|{{echo|[bar]}}}}
2495 !! html
2496 <p about="#mwt1" typeof="mw:Transclusion"
2497 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2498 !! end
2499
2500 !! test
2501 Parsoid: Pipes in external links in template parameter
2502 !! options
2503 parsoid
2504 !! wikitext
2505 {{echo|[{{echo|http://example.com}} link]}}
2506 !! html
2507 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2508 !! end
2509
2510 !! test
2511 Parsoid: pipe in transclusion parameter
2512 !! options
2513 parsoid
2514 !! wikitext
2515 {{echo|http://foo.com/a&#124;b}}
2516 !! html
2517 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2518 typeof="mw:Transclusion"
2519 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2520 !! end
2521
2522 !! test
2523 Parsoid: Pipe in external link target and content in template parameter
2524 !! options
2525 parsoid=html2wt,wt2wt
2526 !! wikitext
2527 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2528 !! html
2529 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2530 typeof="mw:Transclusion"
2531 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2532 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2533 !! end
2534
2535 !! test
2536 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2537 !! options
2538 parsoid
2539 !! wikitext
2540 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2541 !! html
2542 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2543 !! end
2544
2545 !! test
2546 Templates: Don't escape already nowiki-escaped text in template parameters
2547 !! options
2548 parsoid=html2wt,wt2wt
2549 !! wikitext
2550 {{echo|foo<nowiki>|</nowiki>bar}}
2551 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2552 {{echo|<nowiki></nowiki>}}
2553 !! html
2554 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2555 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2556 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2557 </p>
2558 !! end
2559
2560 ## Bug 52824
2561 !! test
2562 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2563 !! options
2564 parsoid=html2wt,wt2wt
2565 !! wikitext
2566 {{echo|{{echo|1=bar}}}}
2567 !! html
2568 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2569 !! end
2570
2571 ## Bug 56733
2572 !! test
2573 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2574 !! options
2575 parsoid
2576 !! wikitext
2577 {{echo|a : b}}
2578 !! html
2579 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2580 !! end
2581
2582 ###
2583 ### Parsoid-centric tests for testing RT edge cases for pre
2584 ###
2585
2586 !!test
2587 1a. Indent-Pre and Comments
2588 !! wikitext
2589 a
2590 <!--a-->
2591 c
2592 !! html
2593 <pre>a
2594 </pre>
2595 <p>c
2596 </p>
2597 !!end
2598
2599 !!test
2600 1b. Indent-Pre and Comments
2601 !! wikitext
2602 a
2603 <!--a-->
2604 c
2605 !! html
2606 <pre>a
2607 </pre>
2608 <p>c
2609 </p>
2610 !!end
2611
2612 !!test
2613 1c. Indent-Pre and Comments
2614 !! wikitext
2615 <!--a--> a
2616
2617 <!--a--> a
2618 !! html
2619 <pre> a
2620 </pre>
2621 <pre> a
2622 </pre>
2623 !!end
2624
2625 !!test
2626 1d. Indent-Pre and Comments
2627 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2628 !! wikitext
2629 <!--a--> a
2630
2631 <!--b-->b
2632 !! html
2633 <pre>a
2634 </pre>
2635 <pre>b
2636 </pre>
2637 !!end
2638
2639 !!test
2640 2a. Indent-Pre and tables
2641 !! wikitext
2642 {|
2643 |-
2644 !h1!!h2
2645 |foo||bar
2646 |}
2647 !! html
2648 <table>
2649
2650 <tr>
2651 <th>h1</th>
2652 <th>h2
2653 </th>
2654 <td>foo</td>
2655 <td>bar
2656 </td></tr></table>
2657
2658 !!end
2659
2660 !!test
2661 2b. Indent-Pre and tables
2662 !! wikitext
2663 {|
2664 |-
2665 |foo
2666 |}
2667 !! html
2668 <table>
2669
2670 <tr>
2671 <td>foo
2672 </td></tr></table>
2673
2674 !!end
2675
2676 !!test
2677 2c. Indent-Pre and tables (bug 42252)
2678 !! wikitext
2679 {|
2680 |+ foo
2681 ! | bar
2682 |}
2683 !! html
2684 <table>
2685 <caption> foo
2686 </caption>
2687 <tr>
2688 <th> bar
2689 </th></tr></table>
2690
2691 !!end
2692
2693 !!test
2694 2d. Indent-Pre and tables
2695 !! wikitext
2696 a
2697 {|
2698 | b
2699 |}
2700 !! html/php
2701 <pre>a
2702 </pre>
2703 <table>
2704 <tr>
2705 <td> b
2706 </td></tr></table>
2707
2708 !! html/parsoid
2709 <pre>a</pre>
2710 <table>
2711 <tbody><tr><td> b</td></tr>
2712 </tbody></table>
2713 !!end
2714
2715 !!test
2716 2e. Indent-Pre and table-line syntax
2717 !! wikitext
2718 a
2719 | b
2720 | c
2721 !! html/php
2722 <pre>a
2723 | b
2724 | c
2725 </pre>
2726 !!end
2727
2728 !!test
2729 2f. Indent-pre started by table-line syntax
2730 !! wikitext
2731 a
2732 | b
2733 | c
2734 !! html/php
2735 <p>a
2736 </p>
2737 <pre>| b
2738 | c
2739 </pre>
2740 !! html/parsoid
2741 <p>a</p>
2742 <pre>
2743 | b
2744 | c</pre>
2745 !!end
2746
2747 !!test
2748 3a. Indent-Pre and block tags (single-line html)
2749 !! wikitext
2750 a <p> foo </p>
2751 b <div> foo </div>
2752 c <blockquote> foo </blockquote>
2753 <span> foo </span>
2754 !! html
2755 a <p> foo </p>
2756 b <div> foo </div>
2757 c <blockquote> foo </blockquote>
2758 <pre><span> foo </span>
2759 </pre>
2760 !! html/parsoid
2761 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
2762 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
2763 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
2764 <pre><span> foo </span>
2765 </pre>
2766 !! html+tidy
2767 <p>a</p>
2768 <p>foo</p>
2769 <p>b</p>
2770 <div>foo</div>
2771 <p>c</p>
2772 <blockquote>
2773 <p>foo</p>
2774 </blockquote>
2775 <pre>
2776 <span> foo </span>
2777 </pre>
2778 !! end
2779
2780 !!test
2781 3b. Indent-Pre and block tags (multi-line html)
2782 !! wikitext
2783 a <span>foo</span>
2784 b <div> foo </div>
2785 !! html
2786 <pre>a <span>foo</span>
2787 </pre>
2788 b <div> foo </div>
2789
2790 !! html/parsoid
2791 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
2792 b <div data-parsoid='{"stx":"html"}'> foo </div>
2793 !! html+tidy
2794 <pre>
2795 a <span>foo</span>
2796 </pre>
2797 <p>b</p>
2798 <div>foo</div>
2799 !!end
2800
2801 !!test
2802 3c. Indent-Pre and block tags (pre-content on separate line)
2803 !! wikitext
2804 <p>
2805 foo
2806 </p>
2807
2808 <div>
2809 foo
2810 </div>
2811
2812 <center>
2813 foo
2814 </center>
2815
2816 <blockquote>
2817 foo
2818 </blockquote>
2819
2820 <blockquote>
2821 <pre>
2822 foo
2823 </pre>
2824 </blockquote>
2825
2826 <table><tr><td>
2827 foo
2828 </td></tr></table>
2829
2830 <ul><li>
2831 foo
2832 </li></ul>
2833
2834 !! html
2835 <p>
2836 foo
2837 </p>
2838 <div>
2839 <pre>foo
2840 </pre>
2841 </div>
2842 <center>
2843 <pre>foo
2844 </pre>
2845 </center>
2846 <blockquote>
2847 <p> foo
2848 </p>
2849 </blockquote>
2850 <blockquote>
2851 <pre>
2852 foo
2853 </pre>
2854 </blockquote>
2855 <table><tr><td>
2856 <pre>foo
2857 </pre>
2858 </td></tr></table>
2859 <ul><li>
2860 foo
2861 </li></ul>
2862
2863 !!end
2864
2865 !!test
2866 4. Indent-Pre and extension tags
2867 !! wikitext
2868 a <gallery>
2869 File:foobar.jpg
2870 </gallery>
2871 !! html
2872 a <ul class="gallery mw-gallery-traditional">
2873 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2874 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
2875 <div class="gallerytext">
2876 </div>
2877 </div></li>
2878 </ul>
2879
2880 !! html+tidy
2881 <p>a</p>
2882 <ul class="gallery mw-gallery-traditional">
2883 <li class="gallerybox" style="width: 155px">
2884 <div style="width: 155px">
2885 <div class="thumb" style="width: 150px;">
2886 <div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div>
2887 </div>
2888 <div class="gallerytext"></div>
2889 </div>
2890 </li>
2891 </ul>
2892 !!end
2893
2894 !! test
2895 Table wikitext syntax outside wiki-tables
2896 !! wikitext
2897 a
2898 ! not a table heading
2899 |- not a table row
2900 | not a table cell
2901 | class="foo bar" | baz
2902 b
2903 |}
2904 |-
2905 c
2906 !! html
2907 <p>a
2908 ! not a table heading
2909 |- not a table row
2910 | not a table cell
2911 | class="foo bar" | baz
2912 b
2913 |}
2914 |-
2915 c
2916 </p>
2917 !! end
2918
2919 !!test
2920 Render paragraphs when indent-pre is suppressed in blocklevels
2921 !! wikitext
2922 <blockquote>
2923 foo
2924
2925 bar
2926 </blockquote>
2927 !! html
2928 <blockquote>
2929 <p> foo
2930 </p><p> bar
2931 </p>
2932 </blockquote>
2933
2934 !!end
2935
2936 !!test
2937 4. Multiple spaces at start-of-line
2938 !! wikitext
2939 <p> foo </p>
2940 foo
2941 {|
2942 |foo
2943 |}
2944 !! html
2945 <p> foo </p>
2946 <pre> foo
2947 </pre>
2948 <table>
2949 <tr>
2950 <td>foo
2951 </td></tr></table>
2952
2953 !!end
2954
2955 ## NOTE: the leading white-space chars on empty line are significant
2956 !! test
2957 5a. White-space in indent-pre
2958 !! wikitext
2959 a<br />
2960
2961 b
2962 !! html
2963 <pre>a<br />
2964
2965 b
2966 </pre>
2967 !! end
2968
2969 ## NOTE: the leading white-space chars on empty line are significant
2970 !! test
2971 5b. White-space in indent-pre
2972 !! wikitext
2973 a
2974
2975 b
2976
2977
2978 c
2979 !! html
2980 <pre>a
2981
2982 b
2983
2984
2985 c
2986 </pre>
2987 !! end
2988
2989 !! test
2990 5c. White-space in indent-pre
2991 !! wikitext
2992 ''a''
2993 ''b''
2994 ''c''
2995 !! html
2996 <pre><i>a</i>
2997 <i>b</i>
2998 <i>c</i>
2999 </pre>
3000 !! end
3001
3002 !! test
3003 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3004 !! wikitext
3005 a
3006
3007 <!-- continue -->
3008 b
3009
3010 c
3011
3012 d
3013 !! html
3014 <pre>a
3015
3016 b
3017 </pre>
3018 <pre>c
3019
3020 </pre>
3021 <p>d
3022 </p>
3023 !! end
3024
3025 !! test
3026 7a. Indent-pre and category links
3027 !! options
3028 parsoid=wt2html,wt2wt
3029 !! wikitext
3030 [[Category:foo]] <!-- No pre-wrapping -->
3031 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3032 !! html
3033 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
3034 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
3035 !! end
3036
3037 !! test
3038 7b. Indent-pre and category links
3039 !! options
3040 parsoid=wt2html,wt2wt
3041 !! wikitext
3042 [[Category:foo]] a
3043 [[Category:foo]] {{echo|b}}
3044 !! html
3045 <pre>
3046 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
3047 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3048 !! end
3049
3050 ###
3051 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3052 ###
3053
3054 !!test
3055 HTML-pre: 1. embedded newlines
3056 !! wikitext
3057 <pre>foo</pre>
3058
3059 <pre>
3060 foo
3061 </pre>
3062
3063 <pre>
3064
3065 foo
3066 </pre>
3067
3068 <pre>
3069
3070
3071 foo
3072 </pre>
3073 !! html
3074 <pre>foo</pre>
3075 <pre>
3076 foo
3077 </pre>
3078 <pre>
3079
3080 foo
3081 </pre>
3082 <pre>
3083
3084
3085 foo
3086 </pre>
3087
3088 !! html/parsoid
3089 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3090
3091 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3092 foo
3093 </pre>
3094
3095 <pre data-parsoid='{"stx":"html"}'>
3096
3097 foo
3098 </pre>
3099
3100 <pre data-parsoid='{"stx":"html"}'>
3101
3102
3103 foo
3104 </pre>
3105 !!end
3106
3107 !! test
3108 HTML-pre: big spaces
3109 !! wikitext
3110 <pre>
3111
3112
3113
3114
3115 haha
3116
3117
3118
3119
3120 haha
3121
3122
3123
3124
3125 </pre>
3126 !! html
3127 <pre>
3128
3129
3130
3131
3132 haha
3133
3134
3135
3136
3137 haha
3138
3139
3140
3141
3142 </pre>
3143
3144 !! html/parsoid
3145 <pre data-parsoid='{"stx":"html"}'>
3146
3147
3148
3149
3150 haha
3151
3152
3153
3154
3155 haha
3156
3157
3158
3159
3160 </pre>
3161 !! end
3162
3163 !!test
3164 HTML-pre: 2: indented text
3165 !! wikitext
3166 <pre>
3167 foo
3168 </pre>
3169 !! html
3170 <pre>
3171 foo
3172 </pre>
3173
3174 !!end
3175
3176 !!test
3177 HTML-pre: 3: other wikitext
3178 !! wikitext
3179 <pre>
3180 * foo
3181 # bar
3182 = no-h =
3183 '' no-italic ''
3184 [[ NoLink ]]
3185 </pre>
3186 !! html
3187 <pre>
3188 * foo
3189 # bar
3190 = no-h =
3191 '' no-italic ''
3192 [[ NoLink ]]
3193 </pre>
3194
3195 !!end
3196
3197 ###
3198 ### Definition lists
3199 ###
3200 !! test
3201 Simple definition
3202 !! wikitext
3203 ; name : Definition
3204 !! html
3205 <dl><dt> name&#160;</dt>
3206 <dd> Definition</dd></dl>
3207
3208 !! end
3209
3210 !! test
3211 Definition list for indentation only
3212 !! wikitext
3213 : Indented text
3214 !! html
3215 <dl><dd> Indented text</dd></dl>
3216
3217 !! end
3218
3219 !! test
3220 Definition list with no space
3221 !! wikitext
3222 ;name:Definition
3223 !! html
3224 <dl><dt>name</dt>
3225 <dd>Definition</dd></dl>
3226
3227 !!end
3228
3229 !! test
3230 Definition list with URL link
3231 !! wikitext
3232 ; http://example.com/ : definition
3233 !! html
3234 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3235 <dd> definition</dd></dl>
3236
3237 !! end
3238
3239 !! test
3240 Definition list with bracketed URL link
3241 !! wikitext
3242 ;[http://www.example.com/ Example]:Something about it
3243 !! html
3244 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3245 <dd>Something about it</dd></dl>
3246
3247 !! end
3248
3249 !! test
3250 Definition list with wikilink containing colon
3251 !! wikitext
3252 ; [[Help:FAQ]]: The least-read page on Wikipedia
3253 !! html
3254 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3255 <dd> The least-read page on Wikipedia</dd></dl>
3256
3257 !! end
3258
3259 # At Brion's and JeLuF's insistence... :)
3260 !! test
3261 Definition list with news link containing colon
3262 !! wikitext
3263 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3264 !! html
3265 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3266 <dd> This isn't even a real newsgroup!</dd></dl>
3267
3268 !! end
3269
3270 !! test
3271 Malformed definition list with colon
3272 !! wikitext
3273 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3274 !! html
3275 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3276
3277 !! end
3278
3279 !! test
3280 Definition lists: colon in external link text
3281 !! wikitext
3282 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3283 !! html
3284 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3285 <dd> OK, I made that up</dd></dl>
3286
3287 !! end
3288
3289 !! test
3290 Definition lists: colon in HTML attribute
3291 !! wikitext
3292 ;<b style="display: inline">bold</b>
3293 !! html
3294 <dl><dt><b style="display: inline">bold</b></dt></dl>
3295
3296 !! end
3297
3298 !! test
3299 Definition lists: self-closed tag
3300 !! wikitext
3301 ;one<br/>two : two-line fun
3302 !! html
3303 <dl><dt>one<br />two&#160;</dt>
3304 <dd> two-line fun</dd></dl>
3305
3306 !! end
3307
3308 !! test
3309 Bug 11748: Literal closing tags
3310 !! wikitext
3311 <dl>
3312 <dt>test 1</dt>
3313 <dd>test test test test test</dd>
3314 <dt>test 2</dt>
3315 <dd>test test test test test</dd>
3316 </dl>
3317 !! html
3318 <dl>
3319 <dt>test 1</dt>
3320 <dd>test test test test test</dd>
3321 <dt>test 2</dt>
3322 <dd>test test test test test</dd>
3323 </dl>
3324
3325 !! end
3326
3327 !! test
3328 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3329 !! wikitext
3330 <ul><li>
3331 ; term : description
3332 * unordered
3333 </li></ul>
3334 !! html
3335 <ul><li>
3336 <dl><dt> term&#160;</dt>
3337 <dd> description</dd></dl>
3338 <ul><li> unordered</li></ul>
3339 </li></ul>
3340
3341 !! end
3342
3343 !! test
3344
3345 Definition list with empty definition and following paragraph
3346 !! wikitext
3347 ; term:
3348 Paragraph text
3349 !! html
3350 <dl><dt> term</dt>
3351 <dd></dd></dl>
3352 <p>Paragraph text
3353 </p>
3354 !! end
3355
3356 !! test
3357 Nested definition lists using html syntax
3358 !! wikitext
3359 <dl><dt>x</dt>
3360 <dd>a</dd>
3361 <dd>b</dd></dl>
3362
3363 !! end
3364
3365 !! test
3366 Definition Lists: No nesting: Multiple dd's
3367 !! wikitext
3368 ;x
3369 :a
3370 :b
3371 !! html
3372 <dl><dt>x</dt>
3373 <dd>a</dd>
3374 <dd>b</dd></dl>
3375
3376 !! end
3377
3378 !! test
3379 Definition Lists: Indentation: Regular
3380 !! wikitext
3381 :i1
3382 ::i2
3383 :::i3
3384 !! html
3385 <dl><dd>i1
3386 <dl><dd>i2
3387 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3388
3389 !! end
3390
3391 !! test
3392 Definition Lists: Indentation: Missing 1st level
3393 !! wikitext
3394 ::i2
3395 :::i3
3396 !! html
3397 <dl><dd><dl><dd>i2
3398 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3399
3400 !! end
3401
3402 !! test
3403 Definition Lists: Indentation: Multi-level indent
3404 !! wikitext
3405 :::i3
3406 !! html
3407 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3408
3409 !! end
3410
3411 !! test
3412 Definition Lists: Hacky use to indent tables
3413 !! wikitext
3414 ::{|
3415 |foo
3416 |bar
3417 |}
3418 this text
3419 should be left alone
3420 !! html
3421 <dl><dd><dl><dd><table>
3422 <tr>
3423 <td>foo
3424 </td>
3425 <td>bar
3426 </td></tr></table></dd></dl></dd></dl>
3427 <p>this text
3428 should be left alone
3429 </p>
3430 !! end
3431
3432 !! test
3433 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3434 !! wikitext
3435 <!-- foo -->
3436 ::{|
3437 |foo
3438 |bar
3439 |}<!-- bar -->
3440 this text
3441 should be left alone
3442 !! html/parsoid
3443 <!-- foo -->
3444 <dl><dd><dl><dd><table><tr>
3445 <td>foo</td>
3446 <td>bar</td>
3447 </tr></table><!-- bar --></dd></dl></dd></dl>
3448 <p>this text
3449 should be left alone</p>
3450 !! end
3451
3452 !! test
3453 Definition Lists: Hacky use to indent tables, with comment before table
3454 !! wikitext
3455 ::<!-- foo -->{|
3456 |foo
3457 |}
3458 !! html/parsoid
3459 <dl><dd><dl><dd><!-- foo --><table><tr>
3460 <td>foo</td>
3461 </tr></table></dd></dl></dd></dl>
3462 !! end
3463
3464 # Bug 52473
3465 !! test
3466 Definition Lists: Hacky use to indent tables (WS-insensitive)
3467 !! options
3468 parsoid
3469 !! wikitext
3470 : {|
3471 |a
3472 |}
3473 !! html
3474 <dl>
3475 <dd> <table><tr><td>a</td></tr></table> </dd>
3476 </dl>
3477 !! end
3478 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3479 ## as an empty dt item. It also ignores all but the last ";" when followed
3480 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3481 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3482 ## ";"s.
3483 ##
3484 ## Ex: ";;t2 ::d2" is transformed into:
3485 ##
3486 ## <dl>
3487 ## <dt>t2 </dt>
3488 ## <dd>
3489 ## <dl>
3490 ## <dt></dt>
3491 ## <dd>d2</dd>
3492 ## </dl>
3493 ## </dd>
3494 ## </dl>
3495 ##
3496 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3497 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3498 ##
3499 ## <dl>
3500 ## <dt>
3501 ## <dl>
3502 ## <dt>t2 </dt>
3503 ## <dd>:d2</dd>
3504 ## </dl>
3505 ## </dt>
3506 ## </dl>
3507 ##
3508 ## All Parsoid only definition list tests have this difference.
3509 ##
3510 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3511 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3512
3513 !! test
3514 Table / list interaction: indented table with lists in table contents
3515 !! wikitext
3516 :{|
3517 |-
3518 | a
3519 * b
3520 |-
3521 | c
3522 * d
3523 |}
3524 !! html
3525 <dl><dd><table>
3526
3527 <tr>
3528 <td> a
3529 <ul><li> b</li></ul>
3530 </td></tr>
3531 <tr>
3532 <td> c
3533 <ul><li> d</li></ul>
3534 </td></tr></table></dd></dl>
3535
3536 !! end
3537
3538 !!test
3539 Table / list interaction: lists nested in tables nested in indented lists
3540 !! wikitext
3541 :{|
3542 |
3543 :a
3544 :b
3545 |
3546 *c
3547 *d
3548 |}
3549
3550 *e
3551 *f
3552 !! html
3553 <dl><dd><table>
3554 <tr>
3555 <td>
3556 <dl><dd>a</dd>
3557 <dd>b</dd></dl>
3558 </td>
3559 <td>
3560 <ul><li>c</li>
3561 <li>d</li></ul>
3562 </td></tr></table></dd></dl>
3563 <ul><li>e</li>
3564 <li>f</li></ul>
3565
3566 !!end
3567
3568 !! test
3569 Definition Lists: Nesting: Multi-level (Parsoid only)
3570 !! options
3571 parsoid
3572 !! wikitext
3573 ;t1 :d1
3574 ;;t2 ::d2
3575 ;;;t3 :::d3
3576 !! html
3577 <dl>
3578 <dt>t1 </dt>
3579 <dd>d1</dd>
3580 <dt>
3581 <dl>
3582 <dt>t2 </dt>
3583 <dd>:d2</dd>
3584 <dt>
3585 <dl>
3586 <dt>t3 </dt>
3587 <dd>::d3</dd>
3588 </dl>
3589 </dt>
3590 </dl>
3591 </dt>
3592 </dl>
3593
3594
3595 !! end
3596
3597
3598 !! test
3599 Definition Lists: Nesting: Test 2 (Parsoid only)
3600 !! options
3601 parsoid
3602 !! wikitext
3603 ;t1
3604 ::d2
3605 !! html
3606 <dl>
3607 <dt>t1</dt>
3608 <dd>
3609 <dl>
3610 <dd>d2</dd>
3611 </dl>
3612 </dd>
3613 </dl>
3614
3615 !! end
3616
3617
3618 !! test
3619 Definition Lists: Nesting: Test 3 (Parsoid only)
3620 !! options
3621 parsoid
3622 !! wikitext
3623 :;t1
3624 ::::d2
3625 !! html
3626 <dl>
3627 <dd>
3628 <dl>
3629 <dt>t1</dt>
3630 <dd>
3631 <dl>
3632 <dd>
3633 <dl>
3634 <dd>d2</dd>
3635 </dl>
3636 </dd>
3637 </dl>
3638 </dd>
3639 </dl>
3640 </dd>
3641 </dl>
3642
3643 !! end
3644
3645
3646 !! test
3647 Definition Lists: Nesting: Test 4
3648 !! wikitext
3649 ::;t3
3650 :::d3
3651 !! html
3652 <dl><dd><dl><dd><dl><dt>t3</dt>
3653 <dd>d3</dd></dl></dd></dl></dd></dl>
3654
3655 !! end
3656
3657
3658 ## The Parsoid team believes the following three test exposes a
3659 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3660 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3661 ## It also exposes a "misfeature" in tidy, which doesn't like
3662 ## <dl> tags with a single <dt> child; it converts the <dt> into
3663 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3664 !! test
3665 Definition Lists: Mixed Lists: Test 1
3666 !! wikitext
3667 :;* foo
3668 ::* bar
3669 :; baz
3670 !! html/php
3671 <dl><dd><dl><dt><ul><li> foo</li>
3672 <li> bar</li></ul></dt></dl>
3673 <dl><dt> baz</dt></dl></dd></dl>
3674
3675 !! html/php+tidy
3676 <dl>
3677 <dd>
3678 <dl>
3679 <dd>
3680 <ul>
3681 <li>foo</li>
3682 <li>bar</li>
3683 </ul>
3684 </dd>
3685 </dl>
3686 <dl>
3687 <dt>baz</dt>
3688 </dl>
3689 </dd>
3690 </dl>
3691 !! html/parsoid
3692 <dl>
3693 <dd><dl>
3694 <dt><ul>
3695 <li> foo
3696 </li>
3697 </ul></dt>
3698 <dd><ul>
3699 <li> bar
3700 </li>
3701 </ul></dd>
3702 <dt> baz</dt>
3703 </dl></dd>
3704 </dl>
3705 !! end
3706
3707 !! test
3708 Definition Lists: Mixed Lists: Test 2
3709 !! wikitext
3710 *: d1
3711 *: d2
3712 !! html
3713 <ul><li><dl><dd> d1</dd>
3714 <dd> d2</dd></dl></li></ul>
3715
3716 !! end
3717
3718
3719 !! test
3720 Definition Lists: Mixed Lists: Test 3
3721 !! wikitext
3722 *::: d1
3723 *::: d2
3724 !! html
3725 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3726 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3727
3728 !! end
3729
3730
3731 !! test
3732 Definition Lists: Mixed Lists: Test 4
3733 !! wikitext
3734 *;d1 :d2
3735 *;d3 :d4
3736 !! html
3737 <ul><li><dl><dt>d1&#160;</dt>
3738 <dd>d2</dd>
3739 <dt>d3&#160;</dt>
3740 <dd>d4</dd></dl></li></ul>
3741
3742 !! end
3743
3744
3745 !! test
3746 Definition Lists: Mixed Lists: Test 5
3747 !! wikitext
3748 *:d1
3749 *:: d2
3750 !! html
3751 <ul><li><dl><dd>d1
3752 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3753
3754 !! end
3755
3756
3757 !! test
3758 Definition Lists: Mixed Lists: Test 6
3759 !! wikitext
3760 #*:d1
3761 #*::: d3
3762 !! html
3763 <ol><li><ul><li><dl><dd>d1
3764 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3765
3766 !! end
3767
3768
3769 !! test
3770 Definition Lists: Mixed Lists: Test 7
3771 !! wikitext
3772 :* d1
3773 :* d2
3774 !! html
3775 <dl><dd><ul><li> d1</li>
3776 <li> d2</li></ul></dd></dl>
3777
3778 !! end
3779
3780
3781 !! test
3782 Definition Lists: Mixed Lists: Test 8
3783 !! wikitext
3784 :* d1
3785 ::* d2
3786 !! html
3787 <dl><dd><ul><li> d1</li></ul>
3788 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3789
3790 !! end
3791
3792
3793 !! test
3794 Definition Lists: Mixed Lists: Test 9
3795 !! wikitext
3796 *;foo :bar
3797 !! html
3798 <ul><li><dl><dt>foo&#160;</dt>
3799 <dd>bar</dd></dl></li></ul>
3800
3801 !! end
3802
3803
3804 !! test
3805 Definition Lists: Mixed Lists: Test 10
3806 !! wikitext
3807 *#;foo :bar
3808 !! html
3809 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3810 <dd>bar</dd></dl></li></ol></li></ul>
3811
3812 !! end
3813
3814 # The Parsoid team disagrees with the PHP parser's seemingly-random
3815 # rules regarding dd/dt on the next two tests. Parsoid is more
3816 # consistent, and recognizes the shared nesting and keeps the
3817 # still-open tags around until the nesting is complete.
3818 # (And tidy again converts <dt> to <dd> before 'bar'.)
3819
3820 !! test
3821 Definition Lists: Mixed Lists: Test 11
3822 !! wikitext
3823 *#*#;*;;foo :bar
3824 *#*#;boo :baz
3825 !! html/php
3826 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3827 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3828 <dl><dt>boo&#160;</dt>
3829 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3830
3831 !! html/php+tidy
3832 <ul>
3833 <li>
3834 <ol>
3835 <li>
3836 <ul>
3837 <li>
3838 <ol>
3839 <li>
3840 <dl>
3841 <dt>foo&#160;</dt>
3842 <dd>
3843 <ul>
3844 <li>
3845 <dl>
3846 <dd>
3847 <dl>
3848 <dt>bar</dt>
3849 </dl>
3850 </dd>
3851 </dl>
3852 </li>
3853 </ul>
3854 </dd>
3855 </dl>
3856 <dl>
3857 <dt>boo&#160;</dt>
3858 <dd>baz</dd>
3859 </dl>
3860 </li>
3861 </ol>
3862 </li>
3863 </ul>
3864 </li>
3865 </ol>
3866 </li>
3867 </ul>
3868 !! html/parsoid
3869 <ul>
3870 <li>
3871 <ol>
3872 <li>
3873 <ul>
3874 <li>
3875 <ol>
3876 <li>
3877 <dl>
3878 <dt>
3879 <ul>
3880 <li>
3881 <dl>
3882 <dt>
3883 <dl>
3884 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3885 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3886 </dl></dt>
3887 </dl></li>
3888 </ul></dt>
3889 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3890 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3891 </dl></li>
3892 </ol></li>
3893 </ul></li>
3894 </ol></li>
3895 </ul>
3896 !! end
3897
3898
3899 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
3900 !! test
3901 Definition Lists: Weird Ones: Test 1
3902 !! wikitext
3903 *#;*::;; foo : bar (who uses this?)
3904 !! html/php
3905 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3906 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
3907
3908 !! html/php+tidy
3909 <ul>
3910 <li>
3911 <ol>
3912 <li>
3913 <dl>
3914 <dt>foo&#160;</dt>
3915 <dd>
3916 <ul>
3917 <li>
3918 <dl>
3919 <dd>
3920 <dl>
3921 <dd>
3922 <dl>
3923 <dd>
3924 <dl>
3925 <dt>bar (who uses this?)</dt>
3926 </dl>
3927 </dd>
3928 </dl>
3929 </dd>
3930 </dl>
3931 </dd>
3932 </dl>
3933 </li>
3934 </ul>
3935 </dd>
3936 </dl>
3937 </li>
3938 </ol>
3939 </li>
3940 </ul>
3941 !! html/parsoid
3942 <ul>
3943 <li>
3944 <ol>
3945 <li>
3946 <dl>
3947 <dt>
3948 <ul>
3949 <li>
3950 <dl>
3951 <dd>
3952 <dl>
3953 <dd>
3954 <dl>
3955 <dt>
3956 <dl>
3957 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3958 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3959 </dl></dt>
3960 </dl></dd>
3961 </dl></dd>
3962 </dl></li>
3963 </ul></dt>
3964 </dl></li>
3965 </ol></li>
3966 </ul>
3967 !! end
3968
3969 ###
3970 ### External links
3971 ###
3972 !! test
3973 External links: non-bracketed
3974 !! wikitext
3975 Non-bracketed: http://example.com
3976 !! html
3977 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3978 </p>
3979 !! end
3980
3981 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3982 !! test
3983 External links: numbered
3984 !! wikitext
3985 Numbered: [http://example.com]
3986 Numbered: [http://example.net]
3987 Numbered: [http://example.com]
3988 !! html/php
3989 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3990 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3991 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3992 </p>
3993 !! html/parsoid
3994 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
3995 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
3996 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
3997 !!end
3998
3999 !! test
4000 External links: specified text
4001 !! wikitext
4002 Specified text: [http://example.com link]
4003 !! html
4004 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4005 </p>
4006 !!end
4007
4008 !! test
4009 External links: trail
4010 !! wikitext
4011 Linktrails should not work for external links: [http://example.com link]s
4012 !! html
4013 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4014 </p>
4015 !! end
4016
4017 !! test
4018 External links: dollar sign in URL
4019 !! wikitext
4020 http://example.com/1$2345
4021 !! html
4022 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4023 </p>
4024 !! end
4025
4026 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4027 !! test
4028 External links: dollar sign in URL (autonumber)
4029 !! wikitext
4030 [http://example.com/1$2345]
4031 !! html/php
4032 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4033 </p>
4034 !! html/parsoid
4035 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4036 !!end
4037
4038 !! test
4039 External links: open square bracket forbidden in URL (bug 4377)
4040 !! options
4041 parsoid=wt2html,wt2wt,html2html
4042 !! wikitext
4043 http://example.com/1[2345
4044 !! html/php
4045 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4046 </p>
4047 !! html/parsoid
4048 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4049 !! end
4050
4051 !! test
4052 External links: open square bracket forbidden in URL (named) (bug 4377)
4053 !! options
4054 parsoid=wt2html,html2html
4055 !! wikitext
4056 [http://example.com/1[2345]
4057 !! html/php
4058 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4059 </p>
4060 !! html/parsoid
4061 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4062 !!end
4063
4064 # parsoid adds a space before the link name
4065 !! test
4066 External links: open square bracket forbidden in URL (named) (bug 4377)
4067 Parsoid variant.
4068 !! wikitext
4069 [http://example.com/1 [2345]
4070 !! html
4071 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4072 </p>
4073 !!end
4074
4075 !! test
4076 External links: nowiki in URL link text (bug 6230)
4077 !! wikitext
4078 [http://example.com/ <nowiki>''example site''</nowiki>]
4079 !! html
4080 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4081 </p>
4082 !! end
4083
4084 !! test
4085 External links: newline forbidden in text (bug 6230 regression check)
4086 !! wikitext
4087 [http://example.com/ first
4088 second]
4089 !! html
4090 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4091 second]
4092 </p>
4093 !!end
4094
4095 !! test
4096 External links: Pipe char between url and text
4097 !! wikitext
4098 [http://example.com | link]
4099 !! html
4100 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4101 </p>
4102 !!end
4103
4104 !! test
4105 External links: protocol-relative URL in brackets
4106 !! wikitext
4107 [//example.com/ Test]
4108 !! html
4109 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4110 </p>
4111 !! end
4112
4113 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4114 !! test
4115 External links: protocol-relative URL in brackets without text
4116 !! wikitext
4117 [//example.com]
4118 !! html/php
4119 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4120 </p>
4121 !! html/parsoid
4122 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4123 !! end
4124
4125 !! test
4126 External links: protocol-relative URL in free text is left alone
4127 !! wikitext
4128 //example.com/Foo
4129 !! html
4130 <p>//example.com/Foo
4131 </p>
4132 !!end
4133
4134 !! test
4135 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4136 !! wikitext
4137 foo//example.com/Foo
4138 !! html
4139 <p>foo//example.com/Foo
4140 </p>
4141 !! end
4142
4143 !! test
4144 External links: with no contents
4145 !! wikitext
4146 [http://en.wikipedia.org/wiki/Foo]
4147
4148 [[wikipedia:Foo|Bar]]
4149
4150 [[wikipedia:Foo|<span>Bar</span>]]
4151 !! html/php
4152 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4153 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4154 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4155 </p>
4156 !! html/parsoid
4157 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4158 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4159 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4160 !! end
4161
4162 !! test
4163 External links: Free with trailing punctuation
4164 !! wikitext
4165 http://example.com,
4166 http://example.com;
4167 http://example.com\
4168 http://example.com.
4169 http://example.com:
4170 http://example.com!
4171 http://example.com?
4172 http://example.com)
4173 http://example.com/url_with_(brackets)
4174 !! html
4175 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4176 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4177 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4178 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4179 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4180 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4181 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4182 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4183 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4184 </p>
4185 !! end
4186
4187 !! test
4188 External links: No preceding word characters allowed (bug 65278)
4189 !! wikitext
4190 NOPEhttp://example.com
4191 N0http://example.com
4192 ok:http://example.com
4193 ok-http://example.com
4194 !! html
4195 <p>NOPEhttp://example.com
4196 N0http://example.com
4197 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4198 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4199 </p>
4200 !! end
4201
4202 !! test
4203 External image
4204 !! wikitext
4205 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4206 !! html
4207 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4208 </p>
4209 !! end
4210
4211 !! test
4212 External image from https
4213 !! wikitext
4214 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4215 !! html
4216 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4217 </p>
4218 !! end
4219
4220 !! test
4221 External image (when not allowed)
4222 !! options
4223 wgAllowExternalImages=0
4224 !! wikitext
4225 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4226 !! html
4227 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
4228 </p>
4229 !! end
4230
4231 !! test
4232 Link to non-http image, no img tag
4233 !! wikitext
4234 Link to non-http image, no img tag: ftp://example.com/test.jpg
4235 !! html
4236 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
4237 </p>
4238 !! end
4239
4240 !! test
4241 External links: terminating separator
4242 !! wikitext
4243 Terminating separator: http://example.com/thing,
4244 !! html
4245 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4246 </p>
4247 !! end
4248
4249 !! test
4250 External links: intervening separator
4251 !! wikitext
4252 Intervening separator: http://example.com/1,2,3
4253 !! html
4254 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4255 </p>
4256 !! end
4257
4258 !! test
4259 External links: old bug with URL in query
4260 !! wikitext
4261 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4262 !! html
4263 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4264 </p>
4265 !! end
4266
4267 !! test
4268 External links: old URL-in-URL bug, mixed protocols
4269 !! wikitext
4270 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4271 !! html
4272 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4273 </p>
4274 !!end
4275
4276 !! test
4277 External links: URL in text
4278 !! wikitext
4279 URL in text: [http://example.com http://example.com]
4280 !! html
4281 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4282 </p>
4283 !! end
4284
4285 !! test
4286 External links: Clickable images
4287 !! wikitext
4288 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4289 !! html
4290 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
4291 </p>
4292 !!end
4293
4294 !! test
4295 External links: raw ampersand
4296 !! wikitext
4297 Old &amp; use: http://x&y
4298 !! html
4299 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4300 </p>
4301 !! end
4302
4303 !! test
4304 External links: encoded ampersand
4305 !! wikitext
4306 Old &amp; use: http://x&amp;y
4307 !! html/php
4308 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4309 </p>
4310 !! html/parsoid
4311 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4312 !! end
4313
4314 !! test
4315 External links: encoded equals (bug 6102)
4316 !! wikitext
4317 http://example.com/?foo&#61;bar
4318 !! html/php
4319 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4320 </p>
4321 !! html/parsoid
4322 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4323 !! end
4324
4325 ##
4326 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4327 ## does it number them. As discussed in bug 53505, we can identify
4328 ## autonumbered links via CSS.
4329 ##
4330
4331 !! test
4332 External links: [raw ampersand]
4333 !! wikitext
4334 Old &amp; use: [http://x&y]
4335 !! html/php
4336 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4337 </p>
4338 !! html/parsoid
4339 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4340 !! end
4341
4342 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4343 # mode will return the [raw ampersand] wikitext
4344 !! test
4345 External links: [encoded ampersand]
4346 !! options
4347 parsoid=wt2html,wt2wt,html2html
4348 !! wikitext
4349 Old &amp; use: [http://x&amp;y]
4350 !! html/php
4351 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4352 </p>
4353 !! html/parsoid
4354 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4355 !! end
4356
4357 !! test
4358 External links: [raw equals]
4359 !! wikitext
4360 [http://example.com/?foo=bar]
4361 !! html/php
4362 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4363 </p>
4364 !! html/parsoid
4365 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4366 !! end
4367
4368 # note that parsoid html is identical to [raw equals] case; so html2wt
4369 # mode will return the [raw equals] wikitext
4370 !! test
4371 External links: [encoded equals] (bug 6102)
4372 !! options
4373 parsoid=wt2html,wt2wt,html2html
4374 !! wikitext
4375 [http://example.com/?foo&#61;bar]
4376 !! html/php
4377 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4378 </p>
4379 !! html/parsoid
4380 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4381 !! end
4382
4383 # xxx parsoid strips the IDN character, so the round-trip tests will
4384 # obviously fail and are disabled. --cscott
4385 !! test
4386 External links: [IDN ignored character reference in hostname; strip it right off]
4387 !! options
4388 parsoid=wt2html,wt2wt,html2html
4389 !! wikitext
4390 [http://e&zwnj;xample.com/]
4391 !! html/php
4392 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4393 </p>
4394 !! html/parsoid
4395 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4396 !! end
4397
4398 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4399 # Where an external link could easily circumvent the sanitization of the text of
4400 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4401 # test demands a higher standard. That's a bit strange.
4402 #
4403 # Example:
4404 #
4405 # http://e‌xample.com -> [http://example.com|http://example.com]
4406 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4407 #
4408 # The first example is sanitized, but the second is not. Any security benefits
4409 # from this production are trivial to circumvent. Either remove this test and
4410 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4411 # the test accordingly.
4412 #
4413 # All our love,
4414 # The Parsoid team.
4415 # xxx parsoid strips the IDN character, so the round-trip tests will
4416 # obviously fail and are disabled. --cscott
4417 !! test
4418 External links: IDN ignored character reference in hostname; strip it right off
4419 !! options
4420 parsoid=wt2html,html2html
4421 !! wikitext
4422 http://e&zwnj;xample.com/
4423 !! html/php
4424 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4425 </p>
4426 !! html/parsoid
4427 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4428 !! end
4429
4430 !! test
4431 External links: www.jpeg.org (bug 554)
4432 !! wikitext
4433 http://www.jpeg.org
4434 !! html
4435 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4436 </p>
4437 !! end
4438
4439 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4440 !! test
4441 External links: URL within URL (original bug 2)
4442 !! wikitext
4443 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4444 !! html/php
4445 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4446 </p>
4447 !! html/parsoid
4448 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4449 !! end
4450
4451 !! test
4452 BUG 361: URL inside bracketed URL
4453 !! wikitext
4454 [http://www.example.com/foo http://www.example.com/bar]
4455 !! html
4456 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4457 </p>
4458 !! end
4459
4460 !! test
4461 BUG 361: URL within URL, not bracketed
4462 !! wikitext
4463 http://www.example.com/foo?=http://www.example.com/bar
4464 !! html
4465 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
4466 </p>
4467 !! end
4468
4469 !! test
4470 BUG 289: ">"-token in URL-tail
4471 !! wikitext
4472 http://www.example.com/<hello>
4473 !! html
4474 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4475 </p>
4476 !!end
4477
4478 !! test
4479 BUG 289: literal ">"-token in URL-tail
4480 !! wikitext
4481 http://www.example.com/<b>html</b>
4482 !! html
4483 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4484 </p>
4485 !!end
4486
4487 !! test
4488 BUG 289: ">"-token in bracketed URL
4489 !! wikitext
4490 [http://www.example.com/<hello> stuff]
4491 !! html
4492 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4493 </p>
4494 !!end
4495
4496 !! test
4497 BUG 289: literal ">"-token in bracketed URL
4498 !! wikitext
4499 [http://www.example.com/<b>html</b> stuff]
4500 !! html
4501 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4502 </p>
4503 !!end
4504
4505 !! test
4506 BUG 289: literal double quote at end of URL
4507 !! wikitext
4508 http://www.example.com/"hello"
4509 !! html
4510 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4511 </p>
4512 !!end
4513
4514 !! test
4515 BUG 289: literal double quote in bracketed URL
4516 !! wikitext
4517 [http://www.example.com/"hello" stuff]
4518 !! html
4519 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4520 </p>
4521 !!end
4522
4523 !! test
4524 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4525 !! wikitext
4526 [http://www.example.com test]
4527 !! html
4528 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4529 </p>
4530 !! end
4531
4532 !! test
4533 External links: link text with spaces
4534 !! wikitext
4535 [http://www.example.com a b c]
4536 [http://www.example.com ''a'' ''b'']
4537 !! html
4538 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4539 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4540 </p>
4541 !! end
4542
4543 !! test
4544 External links: wiki links within external link (Bug 3695)
4545 !! wikitext
4546 [http://example.com [[wikilink]] embedded in ext link]
4547 !! html/php
4548 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
4549 </p>
4550 !! html/parsoid
4551 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
4552 !! end
4553
4554 !! test
4555 BUG 787: Links with one slash after the url protocol are invalid
4556 !! wikitext
4557 http:/example.com
4558
4559 [http:/example.com title]
4560 !! html
4561 <p>http:/example.com
4562 </p><p>[http:/example.com title]
4563 </p>
4564 !! end
4565
4566 !! test
4567 Bracketed external links with template-generated invalid target
4568 !! wikitext
4569 [{{echo|http:/example.com}} title]
4570 !! html
4571 <p>[http:/example.com title]
4572 </p>
4573 !! end
4574
4575 !! test
4576 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4577 !! wikitext
4578 ''[http://example.com text'']
4579 [http://example.com '''text]'''
4580 ''Something [http://example.com in italic'']
4581 ''Something [http://example.com mixed''''', even bold]'''
4582 '''''Now [http://example.com both''''']
4583 !! html
4584 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4585 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4586 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4587 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4588 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4589 </p>
4590 !! end
4591
4592
4593 !! test
4594 Bug 4781: %26 in URL
4595 !! wikitext
4596 http://www.example.com/?title=AT%26T
4597 !! html/php
4598 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4599 </p>
4600 !! html/parsoid
4601 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4602 !! end
4603
4604 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4605 # % is actually legal in HTML5. Any change in output would need testing though.
4606 !! test
4607 Bug 4781, 5267: %25 in URL
4608 !! wikitext
4609 http://www.example.com/?title=100%25_Bran
4610 !! html/php
4611 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
4612 </p>
4613 !! html/parsoid
4614 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4615 !! end
4616
4617 !! test
4618 Bug 4781, 5267: %28, %29 in URL
4619 !! wikitext
4620 http://www.example.com/?title=Ben-Hur_%281959_film%29
4621 !! html/php
4622 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
4623 </p>
4624 !! html/parsoid
4625 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
4626 !! end
4627
4628
4629 !! test
4630 Bug 4781: %26 in autonumber URL
4631 !! wikitext
4632 [http://www.example.com/?title=AT%26T]
4633 !! html/php
4634 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4635 </p>
4636 !! html/parsoid
4637 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4638 !! end
4639
4640 !! test
4641 Bug 4781, 5267: %26 in autonumber URL
4642 !! wikitext
4643 [http://www.example.com/?title=100%25_Bran]
4644 !! html/php
4645 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4646 </p>
4647 !! html/parsoid
4648 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4649 !! end
4650
4651 !! test
4652 Bug 4781, 5267: %28, %29 in autonumber URL
4653 !! wikitext
4654 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4655 !! html/php
4656 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4657 </p>
4658 !! html/parsoid
4659 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4660 !! end
4661
4662
4663 !! test
4664 Bug 4781: %26 in bracketed URL
4665 !! wikitext
4666 [http://www.example.com/?title=AT%26T link]
4667 !! html/php
4668 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4669 </p>
4670 !! html/parsoid
4671 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4672 !! end
4673
4674 !! test
4675 Bug 4781, 5267: %25 in bracketed URL
4676 !! wikitext
4677 [http://www.example.com/?title=100%25_Bran link]
4678 !! html
4679 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4680 </p>
4681 !! end
4682
4683 !! test
4684 Bug 4781, 5267: %28, %29 in bracketed URL
4685 !! wikitext
4686 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4687 !! html/php
4688 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4689 </p>
4690 !! html/parsoid
4691 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4692 !! end
4693
4694 !! test
4695 External link containing a period in the anchor. (bug 63947)
4696 !! wikitext
4697 [//foo.org/bar#baz. bang]
4698
4699 [//foo.org/bar. bang]
4700 !! html/php
4701 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4702 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4703 </p>
4704 !! html/parsoid
4705 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4706 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4707 !! end
4708
4709 !! test
4710 External link containing a single quote. (bug 63947)
4711 !! wikitext
4712 [//foo.org/bar'baz]
4713
4714 [//foo.org/bar'baz bang]
4715 !! html/php
4716 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4717 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4718 </p>
4719 !! html/parsoid
4720 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4721 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4722 !! end
4723
4724
4725 !! test
4726 External link containing a period in the anchor. (bug 63947)
4727 !! wikitext
4728 [//foo.org/bar#baz. bang]
4729
4730 [//foo.org/bar. bang]
4731 !! html/php
4732 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4733 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4734 </p>
4735 !! html/parsoid
4736 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4737 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4738 !! end
4739
4740 !! test
4741 External link containing a single quote. (bug 63947)
4742 !! wikitext
4743 [//foo.org/bar'baz]
4744
4745 [//foo.org/bar'baz bang]
4746 !! html/php
4747 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4748 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4749 </p>
4750 !! html/parsoid
4751 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4752 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4753 !! end
4754
4755
4756 !! test
4757 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4758 !! wikitext
4759 Some [http://example.com/ pretty ''italics'' and stuff]!
4760 !! html
4761 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4762 </p>
4763 !! end
4764
4765 !! test
4766 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4767 !! wikitext
4768 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4769 !! html
4770 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
4771 </p>
4772 !! end
4773
4774 !! test
4775 External link containing double-single-quotes with no space separating the url from text in italics
4776 !! wikitext
4777 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
4778 !! html/php
4779 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
4780 </p>
4781 !! html/php+tidy
4782 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
4783 !! html/parsoid
4784 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
4785 !! end
4786
4787 !! test
4788 External link with comments in link text
4789 !! wikitext
4790 [http://www.google.com Google <!-- comment -->]
4791 !! html
4792 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4793 </p>
4794 !! end
4795
4796 !! test
4797 URL-encoding in URL functions (single parameter)
4798 !! wikitext
4799 {{localurl:Some page|amp=&}}
4800 !! html
4801 <p>/index.php?title=Some_page&amp;amp=&amp;
4802 </p>
4803 !! end
4804
4805 !! test
4806 URL-encoding in URL functions (multiple parameters)
4807 !! wikitext
4808 {{localurl:Some page|q=?&amp=&}}
4809 !! html
4810 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4811 </p>
4812 !! end
4813
4814 !! test
4815 Brackets in urls
4816 !! wikitext
4817 http://example.com/index.php?foozoid%5B%5D=bar
4818
4819 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4820 !! html/php
4821 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
4822 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
4823 </p>
4824 !! html/parsoid
4825 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
4826
4827 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4828 !! end
4829
4830 !! test
4831 IPv6 urls (bug 21261)
4832 !! options
4833 disabled
4834 !! wikitext
4835 http://[2404:130:0:1000::187:2]/index.php
4836 !! html
4837 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
4838 </p>
4839 !! end
4840
4841 !! test
4842 Non-extlinks in brackets
4843 !! wikitext
4844 [foo]
4845 [foo bar]
4846 [foo ''bar'']
4847 [fool's] errand
4848 [fool's errand]
4849 [{{echo|foo}}]
4850 [{{echo|foo}} bar]
4851 [{{echo|foo}} ''bar'']
4852 [{{echo|foo}}l's] errand
4853 [{{echo|foo}}l's errand]
4854 [url={{echo|foo}}]
4855 [url=http://example.com]
4856 !! html
4857 <p>[foo]
4858 [foo bar]
4859 [foo <i>bar</i>]
4860 [fool's] errand
4861 [fool's errand]
4862 [foo]
4863 [foo bar]
4864 [foo <i>bar</i>]
4865 [fool's] errand
4866 [fool's errand]
4867 [url=foo]
4868 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4869 </p>
4870 !! end
4871
4872 !! test
4873 Percent encoding in external links
4874 !! wikitext
4875 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4876 !! html/php
4877 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4878 </p>
4879 !! html/parsoid
4880 <p><a rel="mw:ExtLink"
4881 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4882 !! end
4883
4884 !! test
4885 Use url link syntax for links where the content is equal the link target
4886 !! wikitext
4887 http://example.com
4888 !! html/php
4889 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4890 </p>
4891 !! html/parsoid
4892 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4893 !! end
4894
4895 !! test
4896 Parenthesis in external links, especially URL links
4897 !! wikitext
4898 http://example.com)
4899
4900 http://example.com/test)
4901
4902 http://example.com/(test)
4903
4904 http://example.com/((test)
4905
4906 (http://example.com/(test))
4907
4908 (http://example.com/(test)))))
4909
4910 http://example.com/a)b
4911
4912 [http://example.com) foo]
4913 !! html/php
4914 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4915 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4916 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4917 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4918 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4919 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4920 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4921 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4922 </p>
4923 !! html/parsoid
4924 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4925 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4926 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4927 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4928 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4929 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4930 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4931 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4932 !! end
4933
4934 !! test
4935 Parenthesis in external links, w/ transclusion or comment
4936 !! wikitext
4937 (http://example.com/{{echo|hi}})
4938
4939 (http://example.com<!-- hi -->)
4940 !! html/php
4941 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4942 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4943 </p>
4944 !! html/parsoid
4945 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
4946
4947 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
4948 !! end
4949
4950 !! test
4951 Replace invalid link targets when serializing
4952 !! options
4953 parsoid=html2wt
4954 !! html
4955 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
4956 !! wikitext
4957 [[MediaWiki:Badtitletext|Manual]]
4958 !! end
4959
4960 ###
4961 ### Quotes
4962 ###
4963
4964 !! test
4965 Quotes
4966 !! wikitext
4967 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4968
4969 Normal text. '''''Bold italic text.''''' Normal text.
4970 !! html
4971 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4972 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4973 </p>
4974 !! end
4975
4976
4977 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4978 # parser strips. The wikitext contains just the first half of the bold
4979 # quote pair.
4980 !! test
4981 Unclosed and unmatched quotes
4982 !! wikitext
4983 '''''Bold italic text '''with bold deactivated''' in between.'''''
4984
4985 '''''Bold italic text ''with italic deactivated'' in between.'''''
4986
4987 '''Bold text..
4988
4989 ..spanning two paragraphs (should not work).'''
4990
4991 '''Bold tag left open
4992
4993 ''Italic tag left open
4994
4995 Normal text.
4996
4997 <!-- Unmatching number of opening, closing tags: -->
4998 '''This year''''s election ''should'' beat '''last year''''s.
4999
5000 ''Tom'''s car is bigger than ''Susan'''s.
5001
5002 Plain ''italic'''s plain
5003 !! html/php
5004 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5005 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5006 </p><p><b>Bold text..</b>
5007 </p><p>..spanning two paragraphs (should not work).
5008 </p><p><b>Bold tag left open</b>
5009 </p><p><i>Italic tag left open</i>
5010 </p><p>Normal text.
5011 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5012 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5013 </p><p>Plain <i>italic'</i>s plain
5014 </p>
5015 !! html/parsoid
5016 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5017 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5018 </p><p><b>Bold text..</b>
5019 </p><p>..spanning two paragraphs (should not work).<b></b>
5020 </p><p><b>Bold tag left open</b>
5021 </p><p><i>Italic tag left open</i>
5022 </p><p>Normal text.
5023 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5024 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5025 </p><p>Plain <i>italic'</i>s plain
5026 </p>
5027 !! end
5028
5029 ###
5030 ### Tables
5031 ###
5032 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5033 ###
5034
5035 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5036 # is the bare minimum required by the spec, see:
5037 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5038 # Parsoid team replies: empty table tags are legal in HTML5
5039 !! test
5040 A table with no data.
5041 !! options
5042 parsoid=wt2html
5043 !! wikitext
5044 {||}
5045 !! html/php
5046
5047 !! html/parsoid
5048 <table></table>
5049
5050 !! end
5051
5052 !! test
5053 A table with stray table end tags on start tag line (wt2html)
5054 !! options
5055 parsoid=wt2html
5056 !! wikitext
5057 {|style="color: red;"|}
5058
5059 {|style="color: red;" |}
5060 |foo
5061 |}
5062
5063 {|style="color: red;"|} id="foo"
5064 |foo
5065 |}
5066
5067 {|style="color: red;" |} id="foo"
5068 |foo
5069 |}
5070 !! html
5071 <table style="color: red;"></table>
5072
5073 <table style="color: red;">
5074 <tbody><tr>
5075 <td>foo</td>
5076 </tr></tbody>
5077 </table>
5078
5079 <table style="color: red;" id="foo">
5080 <tbody><tr>
5081 <td>foo</td>
5082 </tr></tbody>
5083 </table>
5084
5085 <table style="color: red;" id="foo">
5086 <tbody><tr>
5087 <td>foo</td>
5088 </tr></tbody>
5089 </table>
5090
5091 !! end
5092
5093 !! test
5094 A table with no data (take 2)
5095 !! wikitext
5096 {|
5097 |}
5098 !! html/parsoid
5099 <table></table>
5100 !! end
5101
5102 # A table with nothing but a caption is invalid XHTML, we might want to render
5103 # this as <p>caption</p>
5104 # Parsoid team replies: table with only a caption is legal in HTML5
5105 !! test
5106 A table with nothing but a caption
5107 !! wikitext
5108 {|
5109 |+ caption
5110 |}
5111 !! html/php
5112 <table>
5113 <caption> caption
5114 </caption><tr><td></td></tr></table>
5115
5116 !! html/parsoid
5117 <table><caption> caption</caption></table>
5118 !! end
5119
5120 !! test
5121 A table with caption with default-spaced attributes and a table row
5122 !! wikitext
5123 {|
5124 |+ style="color: red;" | caption1
5125 |-
5126 | foo
5127 |}
5128 !! html
5129 <table>
5130 <caption style="color: red;"> caption1
5131 </caption>
5132 <tr>
5133 <td> foo
5134 </td></tr></table>
5135
5136 !! end
5137
5138 !! test
5139 A table with captions with non-default spaced attributes and a table row
5140 !! wikitext
5141 {|
5142 |+style="color: red;"|caption2
5143 |+ style="color: red;"| caption3
5144 |-
5145 | foo
5146 |}
5147 !! html
5148 <table>
5149 <caption style="color: red;">caption2
5150 </caption>
5151 <caption style="color: red;"> caption3
5152 </caption>
5153 <tr>
5154 <td> foo
5155 </td></tr></table>
5156
5157 !! end
5158
5159 !! test
5160 Table td-cell syntax variations
5161 !! wikitext
5162 {|
5163 | foo bar foo | baz
5164 | foo bar foo || baz
5165 | style='color:red;' | baz
5166 | style='color:red;' || baz
5167 |}
5168 !! html
5169 <table>
5170 <tr>
5171 <td> baz
5172 </td>
5173 <td> foo bar foo </td>
5174 <td> baz
5175 </td>
5176 <td style="color:red;"> baz
5177 </td>
5178 <td> style='color:red;' </td>
5179 <td> baz
5180 </td></tr></table>
5181
5182 !! end
5183
5184 !! test
5185 Simple table
5186 !! wikitext
5187 {|
5188 | 1 || 2
5189 |-
5190 | 3 || 4
5191 |}
5192 !! html
5193 <table>
5194 <tr>
5195 <td> 1 </td>
5196 <td> 2
5197 </td></tr>
5198 <tr>
5199 <td> 3 </td>
5200 <td> 4
5201 </td></tr></table>
5202
5203 !! end
5204
5205 !! test
5206 Simple table but with multiple dashes for row wikitext
5207 !! wikitext
5208 {|
5209 | foo
5210 |-----
5211 | bar
5212 |}
5213 !! html
5214 <table>
5215 <tr>
5216 <td> foo
5217 </td></tr>
5218 <tr>
5219 <td> bar
5220 </td></tr></table>
5221
5222 !! end
5223 !! test
5224 Multiplication table
5225 !! wikitext
5226 {| border="1" cellpadding="2"
5227 |+Multiplication table
5228 |-
5229 ! &times; !! 1 !! 2 !! 3
5230 |-
5231 ! 1
5232 | 1 || 2 || 3
5233 |-
5234 ! 2
5235 | 2 || 4 || 6
5236 |-
5237 ! 3
5238 | 3 || 6 || 9
5239 |-
5240 ! 4
5241 | 4 || 8 || 12
5242 |-
5243 ! 5
5244 | 5 || 10 || 15
5245 |}
5246 !! html
5247 <table border="1" cellpadding="2">
5248 <caption>Multiplication table
5249 </caption>
5250 <tr>
5251 <th> &#215; </th>
5252 <th> 1 </th>
5253 <th> 2 </th>
5254 <th> 3
5255 </th></tr>
5256 <tr>
5257 <th> 1
5258 </th>
5259 <td> 1 </td>
5260 <td> 2 </td>
5261 <td> 3
5262 </td></tr>
5263 <tr>
5264 <th> 2
5265 </th>
5266 <td> 2 </td>
5267 <td> 4 </td>
5268 <td> 6
5269 </td></tr>
5270 <tr>
5271 <th> 3
5272 </th>
5273 <td> 3 </td>
5274 <td> 6 </td>
5275 <td> 9
5276 </td></tr>
5277 <tr>
5278 <th> 4
5279 </th>
5280 <td> 4 </td>
5281 <td> 8 </td>
5282 <td> 12
5283 </td></tr>
5284 <tr>
5285 <th> 5
5286 </th>
5287 <td> 5 </td>
5288 <td> 10 </td>
5289 <td> 15
5290 </td></tr></table>
5291
5292 !! end
5293
5294 !! test
5295 Accept "||" in table headings
5296 !! wikitext
5297 {|
5298 !h1 || h2
5299 |}
5300 !! html
5301 <table>
5302 <tr>
5303 <th>h1 </th>
5304 <th> h2
5305 </th></tr></table>
5306
5307 !! end
5308
5309 !! test
5310 Accept "!!" in table data
5311 !! wikitext
5312 {|
5313 | Foo!! ||
5314 |}
5315 !! html
5316 <table>
5317 <tr>
5318 <td> Foo!! </td>
5319 <td>
5320 </td></tr></table>
5321
5322 !! html/parsoid
5323 <table>
5324 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
5325 </tbody></table>
5326 !! end
5327
5328 !! test
5329 Accept "||" in indented table headings
5330 !! wikitext
5331 :{|
5332 !h1 || h2
5333 |}
5334 !! html
5335 <dl><dd><table>
5336 <tr>
5337 <th>h1 </th>
5338 <th> h2
5339 </th></tr></table></dd></dl>
5340
5341 !! end
5342
5343 !! test
5344 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5345 !! wikitext
5346 {|
5347 !| h1
5348 || a
5349 |}
5350 !! html
5351 <table>
5352 <tr>
5353 <th> h1
5354 </th>
5355 <td> a
5356 </td></tr></table>
5357
5358 !! end
5359
5360 !!test
5361 Accept "| !" at start of line in tables (ignore !-attribute)
5362 !! wikitext
5363 {|
5364 |-
5365 | !style="color:red" | bar
5366 |}
5367 !! html
5368 <table>
5369
5370 <tr>
5371 <td> bar
5372 </td></tr></table>
5373
5374 !!end
5375
5376 !!test
5377 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
5378 !! wikitext
5379 {|
5380 |-
5381 |style='color:red;'|+1
5382 |style='color:blue;'|-1
5383 |-
5384 | 1 || 2 || 3
5385 | 1 ||+2 ||-3
5386 |-
5387 | +1
5388 | -1
5389 |}
5390 !! html
5391 <table>
5392
5393 <tr>
5394 <td style="color:red;">+1
5395 </td>
5396 <td style="color:blue;">-1
5397 </td></tr>
5398 <tr>
5399 <td> 1 </td>
5400 <td> 2 </td>
5401 <td> 3
5402 </td>
5403 <td> 1 </td>
5404 <td>+2 </td>
5405 <td>-3
5406 </td></tr>
5407 <tr>
5408 <td> +1
5409 </td>
5410 <td> -1
5411 </td></tr></table>
5412
5413 !!end
5414
5415 !! test
5416 Table rowspan
5417 !! wikitext
5418 {| border=1
5419 | Cell 1, row 1
5420 |rowspan=2| Cell 2, row 1 (and 2)
5421 | Cell 3, row 1
5422 |-
5423 | Cell 1, row 2
5424 | Cell 3, row 2
5425 |}
5426 !! html
5427 <table border="1">
5428 <tr>
5429 <td> Cell 1, row 1
5430 </td>
5431 <td rowspan="2"> Cell 2, row 1 (and 2)
5432 </td>
5433 <td> Cell 3, row 1
5434 </td></tr>
5435 <tr>
5436 <td> Cell 1, row 2
5437 </td>
5438 <td> Cell 3, row 2
5439 </td></tr></table>
5440
5441 !! end
5442
5443 !! test
5444 Nested table
5445 !! wikitext
5446 {| border=1
5447 | &alpha;
5448 |
5449 {| bgcolor=#ABCDEF border=2
5450 |nested
5451 |-
5452 |table
5453 |}
5454 |the original table again
5455 |}
5456 !! html
5457 <table border="1">
5458 <tr>
5459 <td> &#945;
5460 </td>
5461 <td>
5462 <table bgcolor="#ABCDEF" border="2">
5463 <tr>
5464 <td>nested
5465 </td></tr>
5466 <tr>
5467 <td>table
5468 </td></tr></table>
5469 </td>
5470 <td>the original table again
5471 </td></tr></table>
5472
5473 !! end
5474
5475 !! test
5476 Invalid attributes in table cell (bug 1830)
5477 !! wikitext
5478 {|
5479 |Cell:|broken
5480 |}
5481 !! html
5482 <table>
5483 <tr>
5484 <td>broken
5485 </td></tr></table>
5486
5487 !! end
5488
5489
5490 # The "|}" to close the table is missing from the input, so parsoid's
5491 # *2wt modes will fail.
5492 !! test
5493 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5494 !! options
5495 parsoid=wt2html,html2html
5496 !! wikitext
5497 {|
5498 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5499 !! html/php
5500 <table>
5501 <tr>
5502 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5503 <td>]" onmouseover="alert(document.cookie)"&gt;test
5504 </td>
5505 </tr>
5506 </table>
5507
5508 !! html/parsoid
5509 <table><tbody>
5510 <tr>
5511 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5512 !! end
5513
5514
5515 !! test
5516 Indented table markup mixed with indented pre content (proposed in bug 6200)
5517 !! wikitext
5518 <table>
5519 <tr>
5520 <td>
5521 Text that should be rendered preformatted
5522 </td>
5523 </tr>
5524 </table>
5525 !! html
5526 <table>
5527 <tr>
5528 <td>
5529 <pre>Text that should be rendered preformatted
5530 </pre>
5531 </td>
5532 </tr>
5533 </table>
5534
5535 !! end
5536
5537 !! test
5538 Template-generated table cell attributes and cell content
5539 !! wikitext
5540 {|
5541 |{{table_attribs}}
5542 | {{table_attribs}}
5543 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
5544 |align=center {{table_attribs}}
5545 | <!--foo--> align=center <!--bar--> {{table_attribs}}
5546 |}
5547 !! html
5548 <table>
5549 <tr>
5550 <td style="color: red"> Foo
5551 </td>
5552 <td style="color: red"> Foo
5553 </td>
5554 <td style="color: red"> Foo
5555 </td>
5556 <td align="center" style="color: red"> Foo
5557 </td>
5558 <td align="center" style="color: red"> Foo
5559 </td></tr></table>
5560
5561 !! end
5562
5563 !! test
5564 Template-generated table cell attributes and cell content (2)
5565 !! wikitext
5566 {|
5567 |align=center {{table_cells}}
5568 |}
5569 !! html
5570 <table>
5571 <tr>
5572 <td align="center" style="color: red"> Foo </td>
5573 <td> Bar </td>
5574 <td> Baz
5575 </td></tr></table>
5576
5577 !! end
5578
5579 !! test
5580 Table with row followed by newlines and table heading
5581 !! wikitext
5582 {|
5583 |-
5584
5585 ! foo
5586 |}
5587 !! html
5588 <table>
5589
5590
5591 <tr>
5592 <th> foo
5593 </th></tr></table>
5594
5595 !! end
5596
5597 !! test
5598 Table with empty line following the start tag
5599 !! wikitext
5600 {|
5601
5602 |-
5603 | foo
5604 |}
5605 !! html
5606 <table>
5607
5608
5609 <tr>
5610 <td> foo
5611 </td></tr></table>
5612
5613 !! end
5614
5615 # FIXME: Preserve the attribute properly (with an empty string as value) in
5616 # the PHP parser. Parsoid implements the behavior below.
5617 !! test
5618 Table attributes with empty value
5619 !! wikitext
5620 {|
5621 | style=| hello
5622 |}
5623 !! html/parsoid
5624 <table>
5625 <tbody>
5626 <tr>
5627 <td style=""> hello
5628 </td></tr></tbody></table>
5629
5630 !! end
5631
5632 !! test
5633 Wikitext table with a lot of comments
5634 !! wikitext
5635 {|
5636 <!-- c0 -->
5637 | foo
5638 <!-- c1 -->
5639 |- <!-- c2 -->
5640 <!-- c3 -->
5641 |<!-- c4 -->
5642 <!-- c5 -->
5643 |}
5644 !! html
5645 <table>
5646 <tr>
5647 <td> foo
5648 </td></tr>
5649 <tr>
5650 <td>
5651 </td></tr></table>
5652
5653 !! end
5654
5655 !! test
5656 Wikitext table with double-line table cell
5657 !! wikitext
5658 {|
5659 |a
5660 b
5661 |}
5662 !! html
5663 <table>
5664 <tr>
5665 <td>a
5666 <p>b
5667 </p>
5668 </td></tr></table>
5669
5670 !! end
5671
5672 !! test
5673 Table cell with a single comment
5674 !! wikitext
5675 {|
5676 | <!-- c1 -->
5677 | a
5678 |}
5679 !! html
5680 <table>
5681 <tr>
5682 <td>
5683 </td>
5684 <td> a
5685 </td></tr></table>
5686
5687 !! end
5688
5689 !! test
5690 Table-cell after a comment-only-empty-line
5691 !! wikitext
5692 {|
5693 |a
5694 <!--c1-->
5695 <!--c2-->| b
5696 |}
5697 !! html
5698 <table>
5699 <tr>
5700 <td>a
5701 </td>
5702 <td> b
5703 </td></tr></table>
5704
5705 !! html/parsoid
5706 <table>
5707 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5708 <!--c1-->
5709 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5710 </tbody></table>
5711
5712 !! end
5713
5714 !! test
5715 Build table with {{!}}
5716 !! wikitext
5717 {{{!}} class="wikitable"
5718 ! header
5719 ! second header
5720 {{!}}- style="color:red;"
5721 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
5722 {{!}}}
5723 !! html
5724 <table class="wikitable">
5725 <tr>
5726 <th> header
5727 </th>
5728 <th> second header
5729 </th></tr>
5730 <tr style="color:red;">
5731 <td> data </td>
5732 <td style="color:red;"> second data
5733 </td></tr></table>
5734
5735 !! end
5736
5737 !! test
5738 Build table with pipe as data
5739 !! wikitext
5740 {| class="wikitable"
5741 ! header
5742 ! second header
5743 |- style="color:red;"
5744 | data || style="color:red;" | second data
5745 |-
5746 | style="color:red;" | data with | || style="color:red;" | second data with |
5747 |-
5748 || data with | ||| second data with |
5749 |}
5750 !! html
5751 <table class="wikitable">
5752 <tr>
5753 <th> header
5754 </th>
5755 <th> second header
5756 </th></tr>
5757 <tr style="color:red;">
5758 <td> data </td>
5759 <td style="color:red;"> second data
5760 </td></tr>
5761 <tr>
5762 <td style="color:red;"> data with | </td>
5763 <td style="color:red;"> second data with |
5764 </td></tr>
5765 <tr>
5766 <td> data with | </td>
5767 <td> second data with |
5768 </td></tr></table>
5769
5770 !! end
5771
5772 !! test
5773 Build table with wikilink
5774 !! wikitext
5775 {| class="wikitable"
5776 ! header || second header
5777 |- style="color:red;"
5778 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
5779 |-
5780 | data || second data [[Main Page|link|text with pipe]]
5781 |}
5782 !! html
5783 <table class="wikitable">
5784 <tr>
5785 <th> header </th>
5786 <th> second header
5787 </th></tr>
5788 <tr style="color:red;">
5789 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
5790 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
5791 </td></tr>
5792 <tr>
5793 <td> data </td>
5794 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
5795 </td></tr></table>
5796
5797 !! end
5798
5799 # The expected HTML structure in this test is debatable. The PHP parser does
5800 # not parse this kind of table at all. The main focus for Parsoid is on
5801 # round-tripping, so this output is ok for now. TODO: revisit!
5802 !! test
5803 Wikitext table with html-syntax row
5804 !! wikitext
5805 {|
5806 |-
5807 <td>foo</td>
5808 |}
5809 !! html/parsoid
5810 <table>
5811 <tbody>
5812 <tr>
5813 <td>foo</td></tr></tbody></table>
5814 !! end
5815
5816 ## Note that Parsoid output differs from PHP and PHP+tidy here.
5817 ## The lack of <tr> tags in the PHP output is arguably a bug in the
5818 ## PHP parser, which tidy then compounds by fostering the content
5819 ## entirely out of the table. Parsoid recognizes the table context
5820 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
5821 ## depends on PHP's treatment of broken table markup!
5822 !! test
5823 Implicit <td> after a |-
5824 !! options
5825 parsoid=wt2html,html2html
5826 !! wikitext
5827 {|
5828 |-
5829 a
5830 |}
5831 !! html/php
5832 <table>
5833
5834 a
5835 </table>
5836
5837 !! html/php+tidy
5838 <p>a</p>
5839 !! html/parsoid
5840 <table>
5841 <tr><td>a</td></tr>
5842 </table>
5843 !! end
5844
5845 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
5846 !! test
5847 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
5848 !! options
5849 parsoid=wt2html,html2html
5850 !! wikitext
5851 {|
5852 |-
5853 |
5854 a
5855 |-
5856 b
5857 |}
5858 !! html/php
5859 <table>
5860
5861 <tr>
5862 <td>
5863 <pre>a
5864 </pre>
5865 </td></tr>
5866 b
5867 </table>
5868
5869 !! html/php+tidy
5870 <p>b</p>
5871 <table>
5872 <tr>
5873 <td>
5874 <pre>
5875 a
5876 </pre></td>
5877 </tr>
5878 </table>
5879 !! html/parsoid
5880 <table>
5881 <tbody>
5882 <tr><td><pre>a</pre></td></tr>
5883 <tr><td> b</td></tr>
5884 </tbody>
5885 </table>
5886 !! end
5887
5888 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
5889 # Parsoid generates the missing <td>, so wt2wt won't succeed.
5890 !! test
5891 Lists should be recognized in an implicit <td> context
5892 !! options
5893 parsoid=wt2html,html2html
5894 !! wikitext
5895 {|
5896 |-
5897 *a
5898 |}
5899 !! html/php
5900 <table>
5901
5902 <ul><li>a</li></ul>
5903 </table>
5904
5905 !! html/php+tidy
5906 <ul>
5907 <li>a</li>
5908 </ul>
5909 !! html/parsoid
5910 <table>
5911 <tr>
5912 <td><ul>
5913 <li>a</li>
5914 </ul></td>
5915 </tr>
5916 </table>
5917 !! end
5918
5919 !! test
5920 Parsoid: Round-trip tables directly followed by content (bug 51219)
5921 !! options
5922 parsoid=wt2html,wt2wt
5923 !! wikitext
5924 {|
5925 |foo
5926 |} bar
5927
5928 {|
5929 |baz
5930 |}<b>quux</b>
5931 !! html+tidy
5932 <table>
5933 <tr>
5934 <td>foo</td>
5935 </tr>
5936 </table>
5937 <p>bar</p>
5938 <table>
5939 <tr>
5940 <td>baz</td>
5941 </tr>
5942 </table>
5943 <p><b>quux</b></p>
5944 !! end
5945
5946 !! test
5947 Parsoid: Default to a newline after tables in new content (bug 51219)
5948 !! options
5949 parsoid=html2wt
5950 !! wikitext
5951 {|
5952 |foo
5953 |}
5954 <nowiki> </nowiki>bar
5955 {|
5956 |baz
5957 |}
5958 '''quux'''
5959 !! html
5960 <table><tbody>
5961 <tr><td>foo</td></tr></tbody></table> bar
5962 <table><tbody>
5963 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5964 !! end
5965
5966 !! test
5967 Parsoid: newline inducing block nodes don't suppress <nowiki>
5968 !! options
5969 parsoid=html2wt
5970 !! wikitext
5971 <nowiki> </nowiki>a
5972
5973 = foo =
5974 !! html
5975 a<h1>foo</h1>
5976 !! end
5977
5978 !! test
5979 Parsoid: Row-syntax table headings followed by comment & table cells
5980 !! options
5981 parsoid=wt2html,wt2wt
5982 !! wikitext
5983 {|
5984 ! foo || bar
5985 <!-- foo --> || baz || quux
5986 |}
5987 !! html/php
5988 <table>
5989 <tr>
5990 <th> foo </th>
5991 <th> bar
5992 </th>
5993 <td> baz </td>
5994 <td> quux
5995 </td></tr></table>
5996
5997 !! html/parsoid
5998 <table>
5999 <tbody><tr><th> foo </th><th> bar
6000 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6001 </tbody></table>
6002 !! end
6003
6004
6005 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6006 # preserves it.
6007 !!test
6008 Parsoid: Recover better from broken table attributes
6009 !!options
6010 parsoid=wt2html
6011 !!wikitext
6012 {| class="foo
6013 | class="bar" |
6014 foo
6015 |}
6016 !!html/php+tidy
6017 <table>
6018 <tr>
6019 <td class="bar">
6020 <p>foo</p>
6021 </td>
6022 </tr>
6023 </table>
6024 !!html/parsoid
6025 <table class="foo">
6026 <tr>
6027 <td class="bar">
6028 <p>foo</p></td></tr>
6029 </tbody></table>
6030 !!end
6031
6032 !! test
6033 Strip unsupported table tags
6034 !! options
6035 parsoid=html2wt
6036 !! html
6037 <table>
6038 <thead>
6039 <tr>
6040 <th>Month</th>
6041 <th>Savings</th>
6042 </tr>
6043 </thead>
6044 <tbody>
6045 <tr>
6046 <td>January</td>
6047 <td>$100</td>
6048 </tr>
6049 <tr>
6050 <td>February</td>
6051 <td>$80</td>
6052 </tr>
6053 </tbody>
6054 <tfoot>
6055 <tr>
6056 <td>Sum</td>
6057 <td>$180</td>
6058 </tr>
6059 </tfoot>
6060 </table>
6061 !! wikitext
6062 {|
6063
6064 !Month
6065 !Savings
6066
6067 |January
6068 |$100
6069
6070 |-
6071 |February
6072 |$80
6073
6074 |Sum
6075 |$180
6076
6077 |}
6078 !! end
6079
6080 ###
6081 ### Internal links
6082 ###
6083 !! test
6084 Plain link, capitalized
6085 !! wikitext
6086 [[Main Page]]
6087 !! html
6088 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6089 </p>
6090 !! end
6091
6092 !! test
6093 Plain link, uncapitalized
6094 !! wikitext
6095 [[main Page]]
6096 !! html
6097 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6098 </p>
6099 !! end
6100
6101 !! test
6102 Piped link
6103 !! wikitext
6104 [[Main Page|The Main Page]]
6105 !! html
6106 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6107 </p>
6108 !! end
6109
6110 !! test
6111 Piped link with comment in link text
6112 !! wikitext
6113 [[Main Page|The Main<!--front--> Page]]
6114 !! html
6115 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6116 </p>
6117 !! end
6118
6119 !! test
6120 Piped link with multiple pipe characters in link text
6121 !! wikitext
6122 [[Main Page||The|Main|Page|]]
6123 !! html/php
6124 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6125 </p>
6126 !! html/parsoid
6127 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6128 !! end
6129
6130 !! test
6131 Broken link
6132 !! wikitext
6133 [[Zigzagzogzagzig]]
6134 !! html
6135 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6136 </p>
6137 !! end
6138
6139 !! test
6140 Broken link with fragment
6141 !! wikitext
6142 [[Zigzagzogzagzig#zug]]
6143 !! html
6144 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6145 </p>
6146 !! end
6147
6148 !! test
6149 Special page link with fragment
6150 !! wikitext
6151 [[Special:Version#anchor]]
6152 !! html
6153 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6154 </p>
6155 !! end
6156
6157 !! test
6158 Nonexistent special page link with fragment
6159 !! wikitext
6160 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6161 !! html
6162 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6163 </p>
6164 !! end
6165
6166 !! test
6167 Link with prefix
6168 !! wikitext
6169 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6170 !! html
6171 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6172 </p>
6173 !! end
6174
6175 !! test
6176 Link with suffix
6177 !! wikitext
6178 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6179 !! html
6180 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
6181 </p>
6182 !! end
6183
6184 !! article
6185 prefixed article
6186 !! text
6187 Some text
6188 !! endarticle
6189
6190 !! test
6191 Bug 43661: Piped links with identical prefixes
6192 !! wikitext
6193 [[prefixed article|prefixed articles with spaces]]
6194
6195 [[prefixed article|prefixed articlesaoeu]]
6196
6197 [[Main Page|Main Page test]]
6198 !! html
6199 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6200 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6201 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6202 </p>
6203 !! end
6204
6205
6206 !! test
6207 Link with HTML entity in suffix / tail
6208 !! wikitext
6209 [[Main Page]]&quot;, [[Main Page]]&#97;
6210 !! html
6211 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
6212 </p>
6213 !! end
6214
6215 !! test
6216 Link with 3 brackets
6217 !! wikitext
6218 [[[Main Page]]]
6219 !! html
6220 <p>[[[Main Page]]]
6221 </p>
6222 !! end
6223
6224 !! test
6225 Link with 4 brackets
6226 !! wikitext
6227 [[[[Main Page]]]]
6228 !! html
6229 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6230 </p>
6231 !! end
6232
6233 !! test
6234 Piped link with 3 brackets
6235 !! wikitext
6236 [[[main page|the main page]]]
6237 !! html
6238 <p>[[[main page|the main page]]]
6239 </p>
6240 !! end
6241
6242 !! test
6243 Piped link with extlink-like text
6244 !! wikitext
6245 [[Main Page|[bar]]]
6246 [[Main Page|This is a [bar]]]
6247 !! html
6248 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6249 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6250 </p>
6251 !! end
6252
6253 !! test
6254 Link with multiple pipes
6255 !! wikitext
6256 [[Main Page|The|Main|Page]]
6257 !! html
6258 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6259 </p>
6260 !! end
6261
6262 # Note that parsoid does not munge anchor text; all non-space
6263 # characters are valid in HTML5 ids.
6264 !! test
6265 Anchor containing a #. (bug 63430)
6266 !! wikitext
6267 [[Main Page#And#Link]]
6268 !! html/php
6269 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6270 </p>
6271 !! html/parsoid
6272 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6273 !! end
6274
6275 !! test
6276 Link to namespaces
6277 !! wikitext
6278 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6279 !! html
6280 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
6281 </p>
6282 !! end
6283
6284 !! test
6285 Link with space in namespace
6286 !! wikitext
6287 [[User talk:Foo bar]]
6288 !! html
6289 <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
6290 </p>
6291 !! end
6292
6293 !! article
6294 MemoryAlpha:AlphaTest
6295 !! text
6296 This is an article in the MemoryAlpha namespace
6297 (which shadows the memoryalpha interwiki link).
6298 !! endarticle
6299
6300 !! test
6301 Namespace takes precedence over interwiki link (bug 51680)
6302 !! wikitext
6303 [[MemoryAlpha:AlphaTest]]
6304 !! html
6305 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6306 </p>
6307 !! end
6308
6309 # The previous test doesn't work correctly in html2*, due to not recognizing the
6310 # link as an internal one. This one checks for the correct behavior.
6311 !! test
6312 Link to namespace preferred over interwiki with correct rel attribute
6313 !! options
6314 parsoid=html2wt,html2html
6315 !! wikitext
6316 [[MemoryAlpha:AlphaTest]]
6317 !! html
6318 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6319 </p>
6320 !! end
6321
6322 !! test
6323 Piped link to namespace
6324 !! wikitext
6325 [[Meta:Disclaimers|The disclaimers]]
6326 !! html
6327 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
6328 </p>
6329 !! end
6330
6331 !! test
6332 Link containing }
6333 !! wikitext
6334 [[Usually caused by a typo (oops}]]
6335 !! html
6336 <p>[[Usually caused by a typo (oops}]]
6337 </p>
6338 !! end
6339
6340 !! article
6341 7% Solution
6342 !! text
6343 Just a test of an article title containing a percent.
6344 !! endarticle
6345
6346 !! test
6347 Link containing % (not as a hex sequence)
6348 !! wikitext
6349 [[7% Solution]]
6350 !! html/php
6351 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6352 </p>
6353 !! html/parsoid
6354 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6355 !! end
6356
6357 # note that the parsoid HTML is identical to the previous test output,
6358 # so the previous test ensures that the html2wt mode will generate the
6359 # "not as a hex sequence" wikitext.
6360 !! test
6361 Link containing % as a single hex sequence interpreted to char
6362 !! options
6363 parsoid=wt2wt,wt2html,html2html
6364 !! wikitext
6365 [[7%25 Solution]]
6366 !! html/php
6367 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6368 </p>
6369 !! html/parsoid
6370 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6371 !!end
6372
6373 !! test
6374 Link containing % as a double hex sequence interpreted to hex sequence
6375 !! wikitext
6376 [[7%2525 Solution]]
6377 !! html
6378 <p>[[7%2525 Solution]]
6379 </p>
6380 !!end
6381
6382 # note that parsoid does not munge anchor text; all non-space
6383 # characters are valid in HTML5 anchors.
6384 !! test
6385 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6386 Example for such a section: == < ==
6387 !! wikitext
6388 [[%23%3c]][[%23%3e]]
6389 !! html/php
6390 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6391 </p>
6392 !! html/parsoid
6393 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E" title="Main Page">#></a></p>
6394 !! end
6395
6396 !! test
6397 Link containing "<#" and ">#" as a hex sequences
6398 !! wikitext
6399 [[%3c%23]][[%3e%23]]
6400 !! html
6401 <p>[[%3c%23]][[%3e%23]]
6402 </p>
6403 !! end
6404
6405 !! test
6406 Link containing an equals sign
6407 !! wikitext
6408 [[Special:BookSources/isbn=4-00-026157-6]]
6409 !! html/php
6410 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
6411 </p>
6412 !! html/parsoid
6413 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
6414 !! end
6415
6416 !! article
6417 Foo~bar
6418 !! text
6419 Just a test of an article title containing a tilde.
6420 !! endarticle
6421
6422 # note that links containing signatures, like [[Foo~~~~]], are
6423 # massaged by the pre-save transform (PST) and so the tildes are never
6424 # seen by the parser.
6425 !! test
6426 Link containing a tilde
6427 !! wikitext
6428 [[Foo~bar]]
6429 !! html/php
6430 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6431 </p>
6432 !! html/parsoid
6433 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6434 !! end
6435
6436 !! test
6437 Link containing double-single-quotes '' (bug 4598)
6438 !! wikitext
6439 [[Lista d''e paise d''o munno]]
6440 !! html/php
6441 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
6442 </p>
6443 !! html/parsoid
6444 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
6445 !! end
6446
6447 !! test
6448 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6449 !! wikitext
6450 Some [[Link|pretty ''italics'' and stuff]]!
6451 !! html/php
6452 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
6453 </p>
6454 !! html/parsoid
6455 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6456 !! end
6457
6458 !! test
6459 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6460 !! wikitext
6461 ''Some [[Link|pretty ''italics'' and stuff]]!''
6462 !! html
6463 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
6464 </p>
6465 !! end
6466
6467 !! test
6468 Link with double quotes in title part (literal) and alternate part (interpreted)
6469 !! wikitext
6470 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
6471
6472 [[''Pentecoste'']]
6473
6474 [[''Pentecoste''|Pentecoste]]
6475
6476 [[''Pentecoste''|''Pentecoste'']]
6477 !! html/php
6478 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
6479 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
6480 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
6481 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
6482 </p>
6483 !! html/parsoid
6484 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></span></p>
6485 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6486 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6487 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6488 !! end
6489
6490 !! test
6491 Broken image links with HTML captions (bug 39700)
6492 !! wikitext
6493 [[File:Nonexistent|<script></script>]]
6494 [[File:Nonexistent|100x100px|<script></script>]]
6495 [[File:Nonexistent|&lt;]]
6496 [[File:Nonexistent|a<i>b</i>c]]
6497 !! html/php
6498 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6499 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6500 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6501 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6502 </p>
6503 !! html/parsoid
6504 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&lt;/script>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
6505 <span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100"/></a></span>
6506 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
6507 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i>b&lt;/i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p>
6508 !! end
6509
6510 !! test
6511 Plain link to URL
6512 !! wikitext
6513 [[http://www.example.com]]
6514 !! html/php
6515 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6516 </p>
6517 !! html/parsoid
6518 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6519 !! end
6520
6521 !! test
6522 Plain link to URL with link text
6523 !! wikitext
6524 [[http://www.example.com Link text]]
6525 !! html
6526 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6527 </p>
6528 !! end
6529
6530 !! test
6531 Plain link to protocol-relative URL
6532 !! wikitext
6533 [[//www.example.com]]
6534 !! html/php
6535 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6536 </p>
6537 !! html/parsoid
6538 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6539 !! end
6540
6541 !! test
6542 Plain link to protocol-relative URL with link text
6543 !! wikitext
6544 [[//www.example.com Link text]]
6545 !! html
6546 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6547 </p>
6548 !! end
6549
6550 !! test
6551 Plain link to page with question mark in title
6552 !! wikitext
6553 [[A?b]]
6554
6555 [[A?b|Baz]]
6556 !! html
6557 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6558 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6559 </p>
6560 !! end
6561
6562
6563 # I'm fairly sure the expected result here is wrong.
6564 # We want these to be URL links, not pseudo-pages with URLs for titles....
6565 # However the current output is also pretty screwy.
6566 #
6567 # ----
6568 # I'm changing it to match the current output--it arguably makes more
6569 # sense in the light of the test above. Old expected result was:
6570 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6571 #</p>
6572 # But I think this test is bordering on "garbage in, garbage out" anyway.
6573 # -- wtm
6574 !! test
6575 Piped link to URL
6576 !! wikitext
6577 Piped link to URL: [[http://www.example.com|an example URL]]
6578 !! html/php
6579 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6580 </p>
6581 !! html/parsoid
6582 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6583 !! end
6584
6585 !! test
6586 BUG 2: [[page|http://url/]] should link to page, not http://url/
6587 !! wikitext
6588 [[Main Page|http://url/]]
6589 !! html/php
6590 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6591 </p>
6592 !! html/parsoid
6593 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6594 !! end
6595
6596 # Parsoid does not mark self-links, by design.
6597 !! test
6598 BUG 337: Escaped self-links should be bold
6599 !! options
6600 title=[[Bug462]]
6601 !! wikitext
6602 [[Bu&#103;462]] [[Bug462]]
6603 !! html/php
6604 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6605 </p>
6606 !! html/php+tidy
6607 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6608 !! html/parsoid
6609 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6610 !! end
6611
6612 !! test
6613 Self-link to section should not be bold
6614 !! options
6615 title=[[Main Page]]
6616 !! wikitext
6617 [[Main Page#section]]
6618 !! html
6619 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6620 </p>
6621 !! end
6622
6623 !! article
6624 00
6625 !! text
6626 This is 00.
6627 !! endarticle
6628
6629 !!test
6630 Self-link to numeric title
6631 !!options
6632 title=[[0]]
6633 !! wikitext
6634 [[0]]
6635 !! html
6636 <p><strong class="selflink">0</strong>
6637 </p>
6638 !!end
6639
6640 !!test
6641 Link to numeric-equivalent title
6642 !!options
6643 title=[[0]]
6644 !! wikitext
6645 [[00]]
6646 !! html
6647 <p><a href="/wiki/00" title="00">00</a>
6648 </p>
6649 !!end
6650
6651 !! test
6652 <nowiki> inside a link
6653 !! wikitext
6654 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6655 !! html
6656 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6657 </p>
6658 !! end
6659
6660 !! test
6661 Non-breaking spaces in title
6662 !! wikitext
6663 [[&nbsp; Main &nbsp; Page &nbsp;]]
6664 !! html
6665 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6666 </p>
6667 !!end
6668
6669 !! test
6670 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6671 !! options
6672 language=ca
6673 !! wikitext
6674 '''[[Main Page]]'''
6675 !! html
6676 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6677 </p>
6678 !! end
6679
6680 !! test
6681 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6682 !! options
6683 language=ca
6684 !! wikitext
6685 ''[[Main Page]]''
6686 !! html
6687 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6688 </p>
6689 !! end
6690
6691 !! test
6692 Internal link with en linktrail: no apostrophes (bug 27473)
6693 !! options
6694 language=en
6695 !! wikitext
6696 [[Something]]'nice
6697 !! html
6698 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6699 </p>
6700 !! end
6701
6702 !! test
6703 Internal link with ca linktrail with apostrophes (bug 27473)
6704 !! options
6705 language=ca
6706 !! wikitext
6707 [[Something]]'nice
6708 !! html
6709 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6710 </p>
6711 !! end
6712
6713 !! test
6714 Internal link with kaa linktrail with apostrophes (bug 27473)
6715 !! options
6716 language=kaa
6717 !! wikitext
6718 [[Something]]'nice
6719 !! html
6720 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
6721 </p>
6722 !! end
6723
6724 !! test
6725 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6726 !! wikitext
6727 [[User:Foo/Test/63636:Bar|Test]]
6728 !! html/php
6729 <p><a href="/index.php?title=User:Foo/Test/63636:Bar&amp;action=edit&amp;redlink=1" class="new" title="User:Foo/Test/63636:Bar (page does not exist)">Test</a>
6730 </p>
6731 !! html/parsoid
6732 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
6733 !! end
6734
6735 !! test
6736 Purely hash wikilink
6737 !! options
6738 title=[[User:test/123]]
6739 !! wikitext
6740 [[#a|b]]
6741 !! html/php
6742 <p><a href="#a">b</a>
6743 </p>
6744 !! html/parsoid
6745 <p><a rel="mw:WikiLink" href="../User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"../User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
6746 !! end
6747
6748 !! test
6749 1. Interaction of linktrail and template encapsulation
6750 !! options
6751 parsoid
6752 !! wikitext
6753 {{echo|[[Foo]]}}l
6754 !! html
6755 <p><a rel="mw:WikiLink" href="Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
6756 !! end
6757
6758 !! test
6759 2. Interaction of linktrail and template encapsulation
6760 !! options
6761 parsoid
6762 !! wikitext
6763 {{echo|Some [[Fool]]}}s
6764 !! html
6765 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
6766 !! end
6767
6768 !! test
6769 3. Interaction of linktrail and template encapsulation
6770 !! options
6771 parsoid
6772 !! wikitext
6773 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6774 !! html
6775 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
6776 !! end
6777
6778 !! article
6779 Söfnuður
6780 !! text
6781 Test.
6782 !! endarticle
6783
6784 !! test
6785 Internal link with is link prefix
6786 !! options
6787 language=is
6788 !! wikitext
6789 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6790 !! html
6791 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6792 </p>
6793 !! end
6794
6795 !! article
6796 Mótmælendatrú
6797 !! text
6798 Test.
6799 !! endarticle
6800
6801 !! test
6802 Internal link with is link trail and link prefix
6803 !! options
6804 language=is
6805 !! wikitext
6806 [[mótmælendatrú|xxx]]ar
6807 [[mótmælendatrú]]ar
6808 mótmælenda[[söfnuður]]
6809 mótmælenda[[söfnuður|söfnuðir]]
6810 mótmælenda[[söfnuður|söfnuðir]]xxx
6811 !! html
6812 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6813 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6814 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6815 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6816 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6817 </p>
6818 !! end
6819
6820 !! test
6821 Parsoid link trail escaping
6822 !! options
6823 parsoid=html2wt,html2html
6824 !! wikitext
6825 [[apple]]<nowiki/>s
6826 !! html
6827 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
6828 !! end
6829
6830 !! test
6831 Parsoid link prefix escaping
6832 !! options
6833 language=is
6834 parsoid=html2wt,html2html
6835 !! wikitext
6836 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6837 !! html
6838 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
6839 !! end
6840
6841 !! test
6842 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6843 !! wikitext
6844 [[Foo| bar]]
6845
6846 [[Foo| ''bar'']]
6847
6848 [http://wp.org foo]
6849
6850 [http://wp.org ''foo'']
6851 !! html
6852 <p><a href="/wiki/Foo" title="Foo"> bar</a>
6853 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
6854 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6855 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6856 </p>
6857 !! end
6858
6859 !! test
6860 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6861 !! options
6862 parsoid
6863 !! wikitext
6864 [[Foo|{{echo|a}} b {{echo|c}}]]
6865 !! html
6866 <p><a rel="mw:WikiLink" href="Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
6867 !! end
6868
6869 !! test
6870 Link with angle bracket after anchor
6871 !! wikitext
6872 [[Foo#<bar>]]
6873 !! html/php
6874 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
6875 </p>
6876 !! html/parsoid
6877 <p><a rel="mw:WikiLink" href="./Foo#%3Cbar%3E" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#%3Cbar%3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
6878 !! end
6879
6880 ###
6881 ### Interwiki links (see maintenance/interwiki.sql)
6882 ###
6883
6884 !! test
6885 Inline interwiki link
6886 !! options
6887 parsoid=wt2html,wt2wt,html2html
6888 !! wikitext
6889 [[MeatBall:SoftSecurity]]
6890 !! html/php
6891 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6892 </p>
6893 !! html/parsoid
6894 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
6895 !! end
6896
6897 !! test
6898 Inline interwiki link with empty title (bug 2372)
6899 !! options
6900 parsoid=wt2html,wt2wt,html2html
6901 !! wikitext
6902 [[MeatBall:]]
6903 !! html/php
6904 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6905 </p>
6906 !! html/parsoid
6907 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
6908 !! end
6909
6910 !! test
6911 Interwiki link encoding conversion (bug 1636)
6912 !! wikitext
6913 *[[Wikipedia:ro:Olteni&#0355;a]]
6914 *[[Wikipedia:ro:Olteni&#355;a]]
6915 !! html
6916 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
6917 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
6918
6919 !! html+tidy
6920 <ul>
6921 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
6922 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
6923 </ul>
6924 !! end
6925
6926 !! test
6927 Interwiki link with fragment (bug 2130)
6928 !! wikitext
6929 [[MeatBall:SoftSecurity#foo]]
6930 !! html
6931 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6932 </p>
6933 !! end
6934
6935 # Ideally the wikipedia: prefix here should be proto-relative too
6936 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
6937 # define the 'en' prefix, and originally the test used 'wikipedia',
6938 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
6939 # article.
6940 !! test
6941 Different interwiki prefixes mapping to the same URL
6942 !! wikitext
6943 [[:en:Foo]]
6944
6945 [[:en:Foo|Foo]]
6946
6947 [[wikipedia:Foo]]
6948
6949 [[:wikipedia:Foo|Foo]]
6950
6951 [[wikipedia:en:Foo]]
6952
6953 [[:wikipedia:en:Foo]]
6954
6955 [[ wikiPEdia :Foo]]
6956 !! html/parsoid
6957 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">en:Foo</a></p>
6958
6959 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">Foo</a></p>
6960
6961 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">wikipedia:Foo</a></p>
6962
6963 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">Foo</a></p>
6964
6965 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
6966
6967 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
6968
6969 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":" wikiPEdia :Foo"},"isIW":true}' title="wikipedia:Foo"> wikiPEdia :Foo</a></p>
6970 !! end
6971
6972 !! test
6973 Interwiki links that cannot be represented in wiki syntax
6974 !! wikitext
6975 [[meatball:ok]]
6976 [[meatball:ok#foo|ok with fragment]]
6977 [[meatball:ok_as_well?|ok ending with ? mark]]
6978 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6979 [http://de.wikipedia.org/wiki/#foo is just fragment]
6980
6981 !! html/php
6982 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
6983 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
6984 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with ? mark</a>
6985 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6986 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
6987 </p>
6988 !! html/parsoid
6989 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
6990 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
6991 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
6992 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6993 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6994 !! end
6995
6996 !! test
6997 Interwiki links: trail
6998 !! wikitext
6999 [[wikipedia:Foo|Ba]]r
7000 !! html/php
7001 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7002 </p>
7003 !! html/parsoid
7004 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo">Bar</a></p>
7005 !! end
7006
7007 !! test
7008 Local interwiki link
7009 !! options
7010 parsoid=wt2html,wt2wt,html2html
7011 !! wikitext
7012 [[local:Template:Foo]]
7013 !! html/php
7014 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7015 </p>
7016 !! html/parsoid
7017 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7018 !! end
7019
7020 # Parsoid does not mark self-links, by design.
7021 !! test
7022 Local interwiki link: self-link to current page
7023 !! options
7024 title=[[Main Page]]
7025 parsoid=wt2html,wt2wt,html2html
7026 !! wikitext
7027 [[local:Main Page]]
7028 !! html/php
7029 <p><strong class="selflink">local:Main Page</strong>
7030 </p>
7031 !! html/parsoid
7032 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7033 !! end
7034
7035 !! test
7036 Local interwiki link: prefix only (bug 64167)
7037 !! options
7038 parsoid=wt2html,wt2wt,html2html
7039 !! wikitext
7040 [[local:]]
7041 !! html/php
7042 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7043 </p>
7044 !! html/parsoid
7045 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7046 !! end
7047
7048 !! test
7049 Local interwiki link: with additional interwiki prefix (bug 61357)
7050 !! options
7051 parsoid=wt2html,wt2wt,html2html
7052 !! wikitext
7053 [[local:meatball:Hello]]
7054 !! html/php
7055 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7056 </p>
7057 !! html/parsoid
7058 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7059 !! end
7060
7061 !! test
7062 Multiple local interwiki link prefixes
7063 !! wikitext
7064 [[local:local:local:local:mi:local:Foo]]
7065 !! options
7066 parsoid=wt2html,wt2wt,html2html
7067 !! html/php
7068 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7069 </p>
7070 !! html/parsoid
7071 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7072 !! end
7073
7074 ###
7075 ### Interlanguage links
7076 ### Language links (so that searching for '### language' matches..)
7077 ###
7078
7079 !! test
7080 Interlanguage link
7081 !! options
7082 parsoid=wt2html,wt2wt,html2html
7083 !! wikitext
7084 Blah blah blah
7085 [[zh:Chinese]]
7086 !! html/php
7087 <p>Blah blah blah
7088 </p>
7089 !! html/parsoid
7090 <p>Blah blah blah</p>
7091 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7092 !! end
7093
7094 !! test
7095 Interlanguage link with spacing
7096 !! options
7097 parsoid=wt2html,wt2wt,html2html
7098 !! wikitext
7099 Blah blah blah
7100 [[ zh : Chinese ]]
7101 !! html/php
7102 <p>Blah blah blah
7103 </p>
7104 !! html/parsoid
7105 <p>Blah blah blah</p>
7106 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7107 !! end
7108
7109 !! test
7110 Double interlanguage link
7111 !! options
7112 parsoid=wt2html,wt2wt,html2html
7113 !! wikitext
7114 Blah blah blah
7115 [[es:Spanish]]
7116 [[zh:Chinese]]
7117 !! html/php
7118 <p>Blah blah blah
7119 </p>
7120 !! html/parsoid
7121 <p>Blah blah blah</p>
7122 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7123 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7124 !! end
7125
7126 !! test
7127 Interlanguage link variations
7128 !! options
7129 parsoid=wt2html,wt2wt,html2html
7130 !! wikitext
7131 Blah blah blah
7132 [[ es :Spanish]]
7133 [[ ZH :Chinese]]
7134 [[es:Foo_bar]]
7135 [[es:Foo bar]]
7136 !! html/php
7137 <p>Blah blah blah
7138 </p>
7139 !! html/parsoid
7140 <p>Blah blah blah</p>
7141 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7142 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7143 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7144 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7145 !! end
7146
7147 !! test
7148 Interlanguage link, with prefix links
7149 !! options
7150 language=ln
7151 !! wikitext
7152 Blah blah blah
7153 [[zh:Chinese]]
7154 !! html/php
7155 <p>Blah blah blah
7156 </p>
7157 !! html/parsoid
7158 <p>Blah blah blah</p>
7159 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7160 !! end
7161
7162 !! test
7163 Double interlanguage link, with prefix links (bug 8897)
7164 !! options
7165 language=ln
7166 !! wikitext
7167 Blah blah blah
7168 [[es:Spanish]]
7169 [[zh:Chinese]]
7170 !! html/php
7171 <p>Blah blah blah
7172 </p>
7173 !! html/parsoid
7174 <p>Blah blah blah</p>
7175 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7176 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7177 !! end
7178
7179 !! test
7180 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7181 !! wikitext
7182 Blah blah blah
7183 [[mul:Article]]
7184 !! html/php
7185 <p>Blah blah blah
7186 </p>
7187 !! html/parsoid
7188 <p>Blah blah blah</p>
7189 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7190 !! end
7191
7192 !! test
7193 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7194 !! options
7195 language=ln
7196 !! wikitext
7197 [[WW&nbsp;II]]
7198 !! html
7199 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
7200 </p>
7201 !! end
7202
7203 !! test
7204 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7205 !! options
7206 parsoid=html2wt
7207 !! wikitext
7208 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7209
7210 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7211 !! html
7212 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7213 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7214 !! end
7215
7216 !! test
7217 Parsoid: handle constructor well
7218 !! wikitext
7219 [[constructor]]
7220
7221 [[constructor:foo]]
7222 !! html/php
7223 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7224 </p><p><a href="/index.php?title=Constructor:foo&amp;action=edit&amp;redlink=1" class="new" title="Constructor:foo (page does not exist)">constructor:foo</a>
7225 </p>
7226 !! html/parsoid
7227 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;}}">constructor</a></p>
7228
7229 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;}}">constructor:foo</a></p>
7230 !! end
7231
7232 !! article
7233 ko:
7234 !! text
7235 Test.
7236 !! endarticle
7237
7238 # Note that `ko` isn't a known interlanguage prefix
7239 !! test
7240 Parsoid: recognize interlanguage links without a target page
7241 !! options
7242 ill
7243 !! wikitext
7244 [[es:]]
7245
7246 [[ko:]]
7247 !! html/php
7248 es:
7249 !! html/parsoid
7250 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7251
7252 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7253 !! end
7254
7255 # Note that `ko` isn't a known interwiki prefix
7256 !! test
7257 Parsoid: recognize interwiki links without a target page
7258 !! options
7259 parsoid=wt2html,wt2wt,html2html
7260 !! wikitext
7261 [[:es:]]
7262
7263 [[:ko:]]
7264 !! html/php
7265 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7266 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7267 </p>
7268 !! html/parsoid
7269 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7270 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7271 !! end
7272
7273 !! test
7274 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7275 !! wikitext
7276 [[mi:Foo]]
7277 !! html/php
7278 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7279 </p>
7280 !! html/parsoid
7281 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7282 !! end
7283
7284 !! test
7285 Interlanguage link with preceding local interwiki link (bug 68085)
7286 !! options
7287 parsoid=wt2html,wt2wt,html2html
7288 !! wikitext
7289 Blah blah blah
7290 [[local:es:Spanish]]
7291 !! html/php
7292 <p>Blah blah blah
7293 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7294 </p>
7295 !! html/parsoid
7296 <p>Blah blah blah
7297 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7298 !! end
7299
7300 !! test
7301 Looks like an interlanguage link, but is actually a local interwiki
7302 !! options
7303 parsoid=wt2html,wt2wt,html2html
7304 !! wikitext
7305 Blah blah blah
7306 [[mi:Template:Foo]]
7307 !! html/php
7308 <p>Blah blah blah
7309 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7310 </p>
7311 !! html/parsoid
7312 <p>Blah blah blah
7313 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7314 !! end
7315
7316 ###
7317 ### Redirects, Parsoid-only
7318 ###
7319 !! test
7320 1. Simple redirect to page
7321 !! options
7322 parsoid
7323 !! wikitext
7324 #REDIRECT [[Main Page]]
7325 !! html
7326 <link rel="mw:PageProp/redirect" href="./Main_Page">
7327 !! end
7328
7329 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
7330 !! test
7331 2. Other redirect variants
7332 !! options
7333 parsoid=wt2html,wt2wt
7334 !! wikitext
7335 #REDIRECT [[Main_Page]]
7336 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
7337 !! html/parsoid
7338 <link rel="mw:PageProp/redirect" href="./Main_Page"><link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
7339 !! end
7340
7341 !! test
7342 Empty redirect
7343 !! options
7344 parsoid=wt2html,wt2wt
7345 !! wikitext
7346 #REDIRECT [[]]
7347 !! html
7348 <ol>
7349 <li>REDIRECT [[]]</li></ol>
7350 !! end
7351
7352 !! test
7353 Optional colon in #REDIRECT
7354 !! options
7355 # the colon is archaic syntax. we support it for wt2html, but we
7356 # don't care that it roundtrips back to the modern syntax.
7357 parsoid=wt2html,html2html
7358 !! wikitext
7359 #REDIRECT:[[Main Page]]
7360 !! html
7361 <link rel="mw:PageProp/redirect" href="./Main_Page">
7362 !! end
7363
7364 !! test
7365 Whitespace in #REDIRECT with optional colon
7366 !! options
7367 # the colon and gratuitous whitespace is archaic syntax. we support
7368 # it for wt2html, but we don't care that it roundtrips back to the
7369 # modern syntax (without extra whitespace)
7370 parsoid=wt2html,html2html
7371 !! wikitext
7372
7373 #REDIRECT
7374 :
7375 [[Main Page]]
7376 !! html
7377 <link rel="mw:PageProp/redirect" href="./Main_Page">
7378 !! end
7379
7380 !! test
7381 Piped link in #REDIRECT
7382 !! options
7383 # content after piped link is ignored. we support this syntax,
7384 # but don't care that the piped link is lost when we roundtrip this.
7385 parsoid=wt2html
7386 !! wikitext
7387 #REDIRECT [[Main Page|bar]]
7388 !! html
7389 <link rel="mw:PageProp/redirect" href="./Main_Page">
7390 !! end
7391
7392 !! test
7393 Redirect to category
7394 !! options
7395 parsoid=wt2html
7396 !! wikitext
7397 #REDIRECT [[Category:Foo]]
7398 !! html
7399 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7400 !! end
7401
7402 !! test
7403 Redirect to category with URL encoding
7404 !! options
7405 parsoid=wt2html
7406 !! wikitext
7407 #REDIRECT [[Category%3AFoo]]
7408 !! html
7409 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7410 !! end
7411
7412 !! test
7413 Redirect to category page
7414 !! options
7415 parsoid=wt2html,html2html
7416 !! wikitext
7417 #REDIRECT [[:Category:Foo]]
7418 !! html
7419 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7420 !! end
7421
7422 !! test
7423 Redirect to image page (1)
7424 !! options
7425 parsoid
7426 !! wikitext
7427 #REDIRECT [[File:Wiki.png]]
7428 !! html
7429 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7430 !! end
7431
7432 !! test
7433 Redirect to image page (2)
7434 !! options
7435 parsoid
7436 !! wikitext
7437 #REDIRECT [[Image:Wiki.png]]
7438 !! html
7439 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7440 !! end
7441
7442 !! test
7443 Redirect to language
7444 !! options
7445 parsoid
7446 !! wikitext
7447 #REDIRECT [[en:File:Wiki.png]]
7448 !! html
7449 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7450 !! end
7451
7452 !! test
7453 Redirect to interwiki
7454 !! options
7455 parsoid
7456 !! wikitext
7457 #REDIRECT [[meatball:File:Wiki.png]]
7458 !! html
7459 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7460 !! end
7461
7462 !! test
7463 Non-English #REDIRECT
7464 !! options
7465 parsoid
7466 language=is
7467 !! wikitext
7468 #TILVÍSUN [[Main Page]]
7469 !! html
7470 <link rel="mw:PageProp/redirect" href="./Main_Page">
7471 !! end
7472
7473 !! test
7474 New redirect
7475 !! options
7476 parsoid=html2wt
7477 !! wikitext
7478 Foo
7479 #REDIRECT [[Foo]]
7480 !! html
7481 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7482 !! end
7483
7484 ##
7485 ## XHTML tidiness
7486 ###
7487
7488 !! test
7489 <br> to <br />
7490 !! wikitext
7491 1<br>2<br />3
7492 !! html
7493 <p>1<br />2<br />3
7494 </p>
7495 !! end
7496
7497 !! test
7498 Broken br tag sanitization
7499 !! wikitext
7500 </br>
7501 !! html/php
7502 <p>&lt;/br&gt;
7503 </p>
7504 !! end
7505
7506 # TODO: Fix html2html mode (bug 51055)!
7507 # This </br> handling was added as part of bug 50831; but it
7508 # differs from how PHP+tidy handles this. We should investigate
7509 # this.
7510 !! test
7511 Parsoid: Broken br tag recognition
7512 !! options
7513 parsoid=wt2html
7514 !! wikitext
7515 </br>
7516
7517 <br/ >
7518 !! html/php+tidy
7519 <p>&lt;/br&gt;</p>
7520 <p><br /></p>
7521 !! html/parsoid
7522 <p><br></p>
7523 <p><br/></p>
7524 !! end
7525
7526 !! test
7527 Incorrecly removing closing slashes from correctly formed XHTML
7528 !! wikitext
7529 <br style="clear:both;" />
7530 !! html
7531 <p><br style="clear:both;" />
7532 </p>
7533 !! end
7534
7535 !! test
7536 Failing to transform badly formed HTML into correct XHTML
7537 !! wikitext
7538 <br style="clear: left;">
7539 <br style="clear: right;">
7540 <br style="clear: both;">
7541 !! html
7542 <p><br style="clear: left;" />
7543 <br style="clear: right;" />
7544 <br style="clear: both;" />
7545 </p>
7546 !!end
7547
7548 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
7549 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
7550 !! test
7551 Handling html with a div self-closing tag
7552 !! wikitext
7553 <div title />
7554 <div title/>
7555 <div title/ >
7556 <div title=bar />
7557 <div title=bar/>
7558 <div title=bar/ >
7559 !! html/php
7560 <p>&lt;div title /&gt;
7561 &lt;div title/&gt;
7562 </p>
7563 <div>
7564 <p>&lt;div title=bar /&gt;
7565 &lt;div title=bar/&gt;
7566 </p>
7567 <div title="bar/"></div>
7568 </div>
7569
7570 !! html/parsoid
7571 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7572 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7573 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
7574 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7575 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7576 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
7577 !! end
7578
7579 !! test
7580 Handling html with a br self-closing tag
7581 !! wikitext
7582 <br title />
7583 <br title/>
7584 <br title/ >
7585 <br title=bar />
7586 <br title=bar/>
7587 <br title=bar/ >
7588 !! html/php
7589 <p><br title="title" />
7590 <br title="title" />
7591 <br />
7592 <br title="bar" />
7593 <br title="bar" />
7594 <br title="bar/" />
7595 </p>
7596 !! html/parsoid
7597 <p><br title="" />
7598 <br title="" />
7599 <br title="" />
7600 <br title="bar" />
7601 <br title="bar" />
7602 <br title="bar/" />
7603 </p>
7604 !! end
7605
7606 !! test
7607 Horizontal ruler (should it add that extra space?)
7608 !! wikitext
7609 <hr>
7610 <hr >
7611 foo <hr
7612 > bar
7613 !! html+tidy
7614 <hr />
7615 <hr />
7616 <p>foo</p>
7617 <hr />
7618 <p>bar</p>
7619 !! end
7620
7621 !! test
7622 Horizontal ruler -- 4+ dashes render hr
7623 !! wikitext
7624 ----
7625 !! html
7626 <hr />
7627
7628 !! end
7629
7630 !! test
7631 Horizontal ruler -- eats additional dashes on the same line
7632 !! wikitext
7633 ---------
7634 !! html
7635 <hr />
7636
7637 !! end
7638
7639 !! test
7640 Horizontal ruler -- does not collapse dashes on consecutive lines
7641 !! wikitext
7642 ----
7643 ----
7644 !! html
7645 <hr />
7646 <hr />
7647
7648 !! end
7649
7650 !! test
7651 Horizontal ruler -- <4 dashes render as plain text
7652 !! wikitext
7653 ---
7654 !! html
7655 <p>---
7656 </p>
7657 !! end
7658
7659 !! test
7660 Horizontal ruler -- Supports content following dashes on same line
7661 !! wikitext
7662 ---- Foo
7663 !! html
7664 <hr /> Foo
7665
7666 !! html+tidy
7667 <hr />
7668 <p>Foo</p>
7669 !! end
7670
7671 ###
7672 ### Block-level elements
7673 ###
7674 !! test
7675 Common list
7676 !! wikitext
7677 *Common list
7678 * item 2
7679 *item 3
7680 !! html
7681 <ul><li>Common list</li>
7682 <li> item 2</li>
7683 <li>item 3</li></ul>
7684
7685 !! end
7686
7687 !! test
7688 Numbered list
7689 !! wikitext
7690 #Numbered list
7691 #item 2
7692 # item 3
7693 !! html
7694 <ol><li>Numbered list</li>
7695 <li>item 2</li>
7696 <li> item 3</li></ol>
7697
7698 !! end
7699
7700 !! test
7701 Mixed list
7702 !! wikitext
7703 *Mixed list
7704 *# with numbers
7705 ** and bullets
7706 *# and numbers
7707 *bullets again
7708 **bullet level 2
7709 ***bullet level 3
7710 ***#Number on level 4
7711 **bullet level 2
7712 **#Number on level 3
7713 **#Number on level 3
7714 *#number level 2
7715 *Level 1
7716 *** Level 3
7717 #** Level 3, but ordered
7718 !! html
7719 <ul><li>Mixed list
7720 <ol><li> with numbers</li></ol>
7721 <ul><li> and bullets</li></ul>
7722 <ol><li> and numbers</li></ol></li>
7723 <li>bullets again
7724 <ul><li>bullet level 2
7725 <ul><li>bullet level 3
7726 <ol><li>Number on level 4</li></ol></li></ul></li>
7727 <li>bullet level 2
7728 <ol><li>Number on level 3</li>
7729 <li>Number on level 3</li></ol></li></ul>
7730 <ol><li>number level 2</li></ol></li>
7731 <li>Level 1
7732 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7733 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7734
7735 !! end
7736
7737 !! test
7738 Nested lists 1
7739 !! wikitext
7740 *foo
7741 **bar
7742 !! html
7743 <ul><li>foo
7744 <ul><li>bar</li></ul></li></ul>
7745
7746 !! end
7747
7748 !! test
7749 Nested lists 2
7750 !! wikitext
7751 **foo
7752 *bar
7753 !! html
7754 <ul><li><ul><li>foo</li></ul></li>
7755 <li>bar</li></ul>
7756
7757 !! end
7758
7759 !! test
7760 Nested lists 3 (first element empty)
7761 !! wikitext
7762 *
7763 **bar
7764 !! html
7765 <ul><li>
7766 <ul><li>bar</li></ul></li></ul>
7767
7768 !! end
7769
7770 !! test
7771 Nested lists 4 (first element empty)
7772 !! wikitext
7773 **
7774 *bar
7775 !! html
7776 <ul><li><ul><li></li></ul></li>
7777 <li>bar</li></ul>
7778
7779 !! end
7780
7781 !! test
7782 Nested lists 5 (both elements empty)
7783 !! wikitext
7784 **
7785 *
7786 !! html
7787 <ul><li><ul><li></li></ul></li>
7788 <li></li></ul>
7789
7790 !! end
7791
7792 !! test
7793 Nested lists 6 (both elements empty)
7794 !! wikitext
7795 *
7796 **
7797 !! html
7798 <ul><li>
7799 <ul><li></li></ul></li></ul>
7800
7801 !! end
7802
7803 !! test
7804 Nested lists 7 (skip initial nesting levels)
7805 !! wikitext
7806 *** foo
7807 !! html
7808 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7809
7810 !! end
7811
7812 !! test
7813 Nested lists 8 (multiple nesting transitions)
7814 !! wikitext
7815 * foo
7816 *** bar
7817 ** baz
7818 * boo
7819 !! html
7820 <ul><li> foo
7821 <ul><li><ul><li> bar</li></ul></li>
7822 <li> baz</li></ul></li>
7823 <li> boo</li></ul>
7824
7825 !! end
7826
7827 !! test
7828 1. Lists with start-of-line-transparent tokens before bullets: Comments
7829 !! wikitext
7830 *foo
7831 *<!--cmt-->bar
7832 <!--cmt-->*baz
7833 !! html
7834 <ul><li>foo</li>
7835 <li>bar</li>
7836 <li>baz</li></ul>
7837
7838 !! end
7839
7840 !! test
7841 2. Lists with start-of-line-transparent tokens before bullets: Template close
7842 !! wikitext
7843 *foo {{echo|bar
7844 }}*baz
7845 !! html
7846 <ul><li>foo bar</li>
7847 <li>baz</li></ul>
7848
7849 !! end
7850
7851 !! test
7852 List items are not parsed correctly following a <pre> block (bug 785)
7853 !! wikitext
7854 * <pre>foo</pre>
7855 * <pre>bar</pre>
7856 * zar
7857 !! html
7858 <ul><li> <pre>foo</pre></li>
7859 <li> <pre>bar</pre></li>
7860 <li> zar</li></ul>
7861
7862 !! end
7863
7864 !! test
7865 List items from template
7866 !! wikitext
7867
7868 {{inner list}}
7869 * item 2
7870
7871 * item 0
7872 {{inner list}}
7873 * item 2
7874
7875 * item 0
7876 * notSOL{{inner list}}
7877 * item 2
7878 !! html
7879 <ul><li> item 1</li>
7880 <li> item 2</li></ul>
7881 <ul><li> item 0</li>
7882 <li> item 1</li>
7883 <li> item 2</li></ul>
7884 <ul><li> item 0</li>
7885 <li> notSOL</li>
7886 <li> item 1</li>
7887 <li> item 2</li></ul>
7888
7889 !! end
7890
7891 !! test
7892 List interrupted by empty line or heading
7893 !! wikitext
7894 * foo
7895
7896 ** bar
7897 == A heading ==
7898 * Another list item
7899 !! html
7900 <ul><li> foo</li></ul>
7901 <ul><li><ul><li> bar</li></ul></li></ul>
7902 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
7903 <ul><li> Another list item</li></ul>
7904
7905 !!end
7906
7907 !!test
7908 Multiple list tags generated by templates
7909 !! wikitext
7910 {{echo|<li>}}a
7911 {{echo|<li>}}b
7912 {{echo|<li>}}c
7913 !! html
7914 <li>a
7915 <li>b
7916 <li>c</li>
7917 </li>
7918 </li>
7919
7920 !! html+tidy
7921 <ul>
7922 <li>a</li>
7923 <li>b</li>
7924 <li>c</li>
7925 </ul>
7926 !!end
7927
7928 !!test
7929 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7930 !! wikitext
7931 *a
7932 <!--This line will NOT split the list-->
7933 *b
7934 <!--This line will NOT split the list either-->
7935 *c
7936 <!--foo--> <!----> <!--This line NOT split the list either-->
7937 *d
7938 !! html
7939 <ul><li>a</li>
7940 <li>b</li>
7941 <li>c</li>
7942 <li>d</li></ul>
7943
7944 !!end
7945
7946 !!test
7947 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7948 !! wikitext
7949 *a
7950 <!--This line will NOT split the list-->
7951 *b
7952 <!--This line will NOT split the list either-->
7953 *c
7954 <!--foo--> <!----> <!--This line NOT split the list
7955 either-->
7956 *d
7957 !! html
7958 <ul><li>a</li>
7959 <li>b</li>
7960 <li>c</li>
7961 <li>d</li></ul>
7962
7963 !!end
7964
7965 !!test
7966 Test the li-hack
7967 (The PHP parser relies on Tidy for the hack)
7968 !!options
7969 parsoid=wt2html,wt2wt
7970 !! wikitext
7971 * foo
7972 * <li>li-hack
7973 * {{echo|<li>templated li-hack}}
7974 * <!--foo--> <li> unsupported li-hack with preceding comments
7975
7976 <ul>
7977 <li><li>not a li-hack
7978 </li>
7979 </ul>
7980 !! html+tidy
7981 <ul>
7982 <li>foo</li>
7983 <li>li-hack</li>
7984 <li>templated li-hack</li>
7985 <li>unsupported li-hack with preceding comments</li>
7986 </ul>
7987 <ul>
7988 <li>not a li-hack</li>
7989 </ul>
7990 !!end
7991
7992 !! test
7993 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
7994 !! options
7995 parsoid
7996 !! wikitext
7997 # foo
7998 ## bar
7999 * foo
8000 ** bar
8001 : foo
8002 :: bar
8003 !! html
8004 <ol>
8005 <li> foo<ol>
8006 <li> bar</li>
8007 </ol></li>
8008 </ol><ul>
8009 <li> foo<ul>
8010 <li> bar</li>
8011 </ul></li>
8012 </ul><dl>
8013 <dd> foo<dl>
8014 <dd> bar</dd>
8015 </dl></dd>
8016 </dl>
8017 !! end
8018
8019 !! test
8020 Parsoid: Test of whitespace serialization with Templated bullets
8021 !! options
8022 parsoid
8023 !! wikitext
8024 * {{bullet}}
8025 !! html
8026 <ul>
8027 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8028 </ul>
8029 !! end
8030
8031 # ------------------------------------------------------------------------
8032 # The next set of tests are about Parsoid's ability to handle badly nested
8033 # tags (parse, minimize scope of fixup, and roundtrip back)
8034 # ------------------------------------------------------------------------
8035
8036 !! test
8037 Unbalanced closing block tags break a list
8038 (php parser relies on Tidy to fix up)
8039 !! wikitext
8040 <div>
8041 *a</div><div>
8042 *b</div>
8043 !! html+tidy
8044 <div>
8045 <ul>
8046 <li>a</li>
8047 </ul>
8048 </div>
8049 <div>
8050 <ul>
8051 <li>b</li>
8052 </ul>
8053 </div>
8054 !! end
8055
8056 # Parsoid fails this test, but it might be tricky to support properly.
8057 # See bug 68395.
8058 !! test
8059 Unbalanced closing non-block tags don't break a list
8060 (php parser relies on Tidy to fix up)
8061 !! wikitext
8062 <span>
8063 *a</span><span>
8064 *b</span>
8065 !! html/php+tidy
8066 <ul>
8067 <li><span>a</span></li>
8068 <li><span>b</span></li>
8069 </ul>
8070 !! html/parsoid
8071 <span>
8072 <ul>
8073 <li>a<span></span>
8074 </li>
8075 <li>b
8076 </li>
8077 </ul>
8078 </span>
8079 !! end
8080
8081 !! test
8082 Unclosed formatting tags that straddle lists are closed and reopened
8083 (php parser relies on Tidy to fix up)
8084 !! options
8085 parsoid=wt2html,wt2wt,html2html
8086 !! wikitext
8087 # <s> a
8088 # b </s>
8089 !! html/php+tidy
8090 <ol>
8091 <li><s>a</s></li>
8092 <li><s>b</s></li>
8093 </ol>
8094 !! html/parsoid
8095 <ol><li> <s> a</s></li>
8096 <li><s> b </s></li></ol>
8097 !! end
8098
8099 # Parsoid fails this test, but it might be tricky to support properly.
8100 # See bug 68395.
8101 !!test
8102 List embedded in a non-block tag
8103 (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
8104 !! wikitext
8105 <small>
8106 * foo
8107 </small>
8108 !! html/php+tidy
8109 <ul>
8110 <li><small>foo</small></li>
8111 </ul>
8112 !! html/parsoid
8113 <small>
8114 <ul>
8115 <li> foo</li>
8116 </ul>
8117 </small>
8118 !!end
8119
8120 # This is a bug in the PHP parser + tidy combination.
8121 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8122 # and then fostered out of the table by tidy.)
8123 # We believe the Parsoid output to be correct.
8124 !! test
8125 Table with missing opening <tr> tag
8126 !! options
8127 parsoid=wt2html,wt2wt
8128 !! wikitext
8129 <table>
8130 <td>foo</td>
8131 </tr>
8132 </table>
8133 !! html/php+tidy
8134 <p>&lt;/tr&gt;</p>
8135 <table>
8136 <tr>
8137 <td>foo</td>
8138 </tr>
8139 </table>
8140 !! html/parsoid
8141 <table>
8142 <tr>
8143 <td>foo</td>
8144 </tr>
8145 </table>
8146 !! end
8147
8148 ###
8149 ### Magic Words
8150 ###
8151
8152 # Note that the current date is hard-coded as
8153 # 1970-01-01T00:02:03Z (a Thursday)
8154 # when running parser tests. The timezone is also fixed to GMT, so
8155 # local date will be identical to current date.
8156
8157 !! test
8158 Magic Word: {{CURRENTDAY}}
8159 !! wikitext
8160 {{CURRENTDAY}}
8161 !! html
8162 <p>1
8163 </p>
8164 !! end
8165
8166 !! test
8167 Magic Word: {{CURRENTDAY2}}
8168 !! wikitext
8169 {{CURRENTDAY2}}
8170 !! html
8171 <p>01
8172 </p>
8173 !! end
8174
8175 !! test
8176 Magic Word: {{CURRENTDAYNAME}}
8177 !! wikitext
8178 {{CURRENTDAYNAME}}
8179 !! html
8180 <p>Thursday
8181 </p>
8182 !! end
8183
8184 !! test
8185 Magic Word: {{CURRENTDOW}}
8186 !! wikitext
8187 {{CURRENTDOW}}
8188 !! html
8189 <p>4
8190 </p>
8191 !! end
8192
8193 !! test
8194 Magic Word: {{CURRENTMONTH}}
8195 !! wikitext
8196 {{CURRENTMONTH}}
8197 !! html
8198 <p>01
8199 </p>
8200 !! end
8201
8202 !! test
8203 Magic Word: {{CURRENTMONTH1}}
8204 !! wikitext
8205 {{CURRENTMONTH1}}
8206 !! html
8207 <p>1
8208 </p>
8209 !! end
8210
8211 !! test
8212 Magic Word: {{CURRENTMONTHABBREV}}
8213 !! wikitext
8214 {{CURRENTMONTHABBREV}}
8215 !! html
8216 <p>Jan
8217 </p>
8218 !! end
8219
8220 !! test
8221 Magic Word: {{CURRENTMONTHNAME}}
8222 !! wikitext
8223 {{CURRENTMONTHNAME}}
8224 !! html
8225 <p>January
8226 </p>
8227 !! end
8228
8229 !! test
8230 Magic Word: {{CURRENTMONTHNAMEGEN}}
8231 !! wikitext
8232 {{CURRENTMONTHNAMEGEN}}
8233 !! html
8234 <p>January
8235 </p>
8236 !! end
8237
8238 !! test
8239 Magic Word: {{CURRENTTIME}}
8240 !! wikitext
8241 {{CURRENTTIME}}
8242 !! html
8243 <p>00:02
8244 </p>
8245 !! end
8246
8247 !! test
8248 Magic Word: {{CURRENTHOUR}}
8249 !! wikitext
8250 {{CURRENTHOUR}}
8251 !! html
8252 <p>00
8253 </p>
8254 !! end
8255
8256 !! test
8257 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8258 !! wikitext
8259 {{CURRENTWEEK}}
8260 !! html
8261 <p>1
8262 </p>
8263 !! end
8264
8265 !! test
8266 Magic Word: {{CURRENTYEAR}}
8267 !! wikitext
8268 {{CURRENTYEAR}}
8269 !! html
8270 <p>1970
8271 </p>
8272 !! end
8273
8274 !! test
8275 Magic Word: {{CURRENTTIMESTAMP}}
8276 !! wikitext
8277 {{CURRENTTIMESTAMP}}
8278 !! html
8279 <p>19700101000203
8280 </p>
8281 !! end
8282
8283 !! test
8284 Magic Words LOCAL (UTC)
8285 !! wikitext
8286 * {{LOCALMONTH}}
8287 * {{LOCALMONTH1}}
8288 * {{LOCALMONTHNAME}}
8289 * {{LOCALMONTHNAMEGEN}}
8290 * {{LOCALMONTHABBREV}}
8291 * {{LOCALDAY}}
8292 * {{LOCALDAY2}}
8293 * {{LOCALDAYNAME}}
8294 * {{LOCALYEAR}}
8295 * {{LOCALTIME}}
8296 * {{LOCALHOUR}}
8297 * {{LOCALWEEK}}
8298 * {{LOCALDOW}}
8299 * {{LOCALTIMESTAMP}}
8300 !! html
8301 <ul><li> 01</li>
8302 <li> 1</li>
8303 <li> January</li>
8304 <li> January</li>
8305 <li> Jan</li>
8306 <li> 1</li>
8307 <li> 01</li>
8308 <li> Thursday</li>
8309 <li> 1970</li>
8310 <li> 00:02</li>
8311 <li> 00</li>
8312 <li> 1</li>
8313 <li> 4</li>
8314 <li> 19700101000203</li></ul>
8315
8316 !! end
8317
8318 !! test
8319 Magic Word: {{FULLPAGENAME}}
8320 !! options
8321 title=[[User:Ævar Arnfjörð Bjarmason]]
8322 !! wikitext
8323 {{FULLPAGENAME}}
8324 !! html
8325 <p>User:Ævar Arnfjörð Bjarmason
8326 </p>
8327 !! end
8328
8329 !! test
8330 Magic Word: {{FULLPAGENAMEE}}
8331 !! options
8332 title=[[User:Ævar Arnfjörð Bjarmason]]
8333 !! wikitext
8334 {{FULLPAGENAMEE}}
8335 !! html
8336 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8337 </p>
8338 !! end
8339
8340 !! test
8341 Magic Word: {{TALKSPACE}}
8342 !! options
8343 title=[[User:Ævar Arnfjörð Bjarmason]]
8344 !! wikitext
8345 {{TALKSPACE}}
8346 !! html
8347 <p>User talk
8348 </p>
8349 !! end
8350
8351 !! test
8352 Magic Word: {{TALKSPACE}}, same namespace
8353 !! options
8354 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8355 !! wikitext
8356 {{TALKSPACE}}
8357 !! html
8358 <p>User talk
8359 </p>
8360 !! end
8361
8362 !! test
8363 Magic Word: {{TALKSPACE}}, main namespace
8364 !! options
8365 title=[[Parser Test]]
8366 !! wikitext
8367 {{TALKSPACE}}
8368 !! html
8369 <p>Talk
8370 </p>
8371 !! end
8372
8373 !! test
8374 Magic Word: {{TALKSPACEE}}
8375 !! options
8376 title=[[User:Ævar Arnfjörð Bjarmason]]
8377 !! wikitext
8378 {{TALKSPACEE}}
8379 !! html
8380 <p>User_talk
8381 </p>
8382 !! end
8383
8384 !! test
8385 Magic Word: {{SUBJECTSPACE}}
8386 !! options
8387 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8388 !! wikitext
8389 {{SUBJECTSPACE}}
8390 !! html
8391 <p>User
8392 </p>
8393 !! end
8394
8395 !! test
8396 Magic Word: {{SUBJECTSPACE}}, same namespace
8397 !! options
8398 title=[[User:Ævar Arnfjörð Bjarmason]]
8399 !! wikitext
8400 {{SUBJECTSPACE}}
8401 !! html
8402 <p>User
8403 </p>
8404 !! end
8405
8406 !! test
8407 Magic Word: {{SUBJECTSPACE}}, main namespace
8408 !! options
8409 title=[[Parser Test]]
8410 !! wikitext
8411 {{SUBJECTSPACE}}
8412 !! html
8413
8414 !! end
8415
8416 !! test
8417 Magic Word: {{SUBJECTSPACEE}}
8418 !! options
8419 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8420 !! wikitext
8421 {{SUBJECTSPACEE}}
8422 !! html
8423 <p>User
8424 </p>
8425 !! end
8426
8427 !! test
8428 Magic Word: {{NAMESPACE}}
8429 !! options
8430 title=[[User:Ævar Arnfjörð Bjarmason]]
8431 !! wikitext
8432 {{NAMESPACE}}
8433 !! html
8434 <p>User
8435 </p>
8436 !! end
8437
8438 !! test
8439 Magic Word: {{NAMESPACEE}}
8440 !! options
8441 title=[[User:Ævar Arnfjörð Bjarmason]]
8442 !! wikitext
8443 {{NAMESPACEE}}
8444 !! html
8445 <p>User
8446 </p>
8447 !! end
8448
8449 !! test
8450 Magic Word: {{NAMESPACENUMBER}}
8451 !! options
8452 title=[[User:Ævar Arnfjörð Bjarmason]]
8453 !! wikitext
8454 {{NAMESPACENUMBER}}
8455 !! html
8456 <p>2
8457 </p>
8458 !! end
8459
8460 !! test
8461 Magic Word: {{SUBPAGENAME}}
8462 !! options
8463 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8464 !! wikitext
8465 {{SUBPAGENAME}}
8466 !! html
8467 <p>sub ö
8468 </p>
8469 !! end
8470
8471 !! test
8472 Magic Word: {{SUBPAGENAMEE}}
8473 !! options
8474 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8475 !! wikitext
8476 {{SUBPAGENAMEE}}
8477 !! html
8478 <p>sub_%C3%B6
8479 </p>
8480 !! end
8481
8482 !! test
8483 Magic Word: {{ROOTPAGENAME}}
8484 !! options
8485 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8486 !! wikitext
8487 {{ROOTPAGENAME}}
8488 !! html
8489 <p>Ævar Arnfjörð Bjarmason
8490 </p>
8491 !! end
8492
8493 !! test
8494 Magic Word: {{ROOTPAGENAMEE}}
8495 !! options
8496 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8497 !! wikitext
8498 {{ROOTPAGENAMEE}}
8499 !! html
8500 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8501 </p>
8502 !! end
8503
8504 !! test
8505 Magic Word: {{BASEPAGENAME}}
8506 !! options
8507 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8508 !! wikitext
8509 {{BASEPAGENAME}}
8510 !! html
8511 <p>Ævar Arnfjörð Bjarmason
8512 </p>
8513 !! end
8514
8515 !! test
8516 Magic Word: {{BASEPAGENAMEE}}
8517 !! options
8518 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8519 !! wikitext
8520 {{BASEPAGENAMEE}}
8521 !! html
8522 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8523 </p>
8524 !! end
8525
8526 !! test
8527 Magic Word: {{TALKPAGENAME}}
8528 !! options
8529 title=[[User:Ævar Arnfjörð Bjarmason]]
8530 !! wikitext
8531 {{TALKPAGENAME}}
8532 !! html
8533 <p>User talk:Ævar Arnfjörð Bjarmason
8534 </p>
8535 !! end
8536
8537 !! test
8538 Magic Word: {{TALKPAGENAMEE}}
8539 !! options
8540 title=[[User:Ævar Arnfjörð Bjarmason]]
8541 !! wikitext
8542 {{TALKPAGENAMEE}}
8543 !! html
8544 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8545 </p>
8546 !! end
8547
8548 !! test
8549 Magic Word: {{SUBJECTPAGENAME}}
8550 !! options
8551 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8552 !! wikitext
8553 {{SUBJECTPAGENAME}}
8554 !! html
8555 <p>User:Ævar Arnfjörð Bjarmason
8556 </p>
8557 !! end
8558
8559 !! test
8560 Magic Word: {{SUBJECTPAGENAMEE}}
8561 !! options
8562 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8563 !! wikitext
8564 {{SUBJECTPAGENAMEE}}
8565 !! html
8566 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8567 </p>
8568 !! end
8569
8570 !! test
8571 Magic Word: {{NUMBEROFFILES}}
8572 !! wikitext
8573 {{NUMBEROFFILES}}
8574 !! html
8575 <p>5
8576 </p>
8577 !! end
8578
8579 !! test
8580 Magic Word: {{PAGENAME}}
8581 !! options
8582 title=[[User:Ævar Arnfjörð Bjarmason]]
8583 !! wikitext
8584 {{PAGENAME}}
8585 !! html
8586 <p>Ævar Arnfjörð Bjarmason
8587 </p>
8588 !! end
8589
8590 !! test
8591 Magic Word: {{PAGENAME}} with metacharacters
8592 !! options
8593 title=[['foo & bar = baz']]
8594 !! wikitext
8595 ''{{PAGENAME}}''
8596 !! html/php
8597 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8598 </p>
8599 !! html+tidy
8600 <p><i>'foo &amp; bar = baz'</i></p>
8601 !! end
8602
8603 !! test
8604 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8605 !! options
8606 title=[[*RFC 1234 http://example.com/]]
8607 !! wikitext
8608 {{PAGENAME}}
8609 !! html/php
8610 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8611 </p>
8612 !! html+tidy
8613 <p>*RFC 1234 http://example.com/</p>
8614 !! end
8615
8616 !! test
8617 Magic Word: {{PAGENAMEE}}
8618 !! options
8619 title=[[User:Ævar Arnfjörð Bjarmason]]
8620 !! wikitext
8621 {{PAGENAMEE}}
8622 !! html
8623 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8624 </p>
8625 !! end
8626
8627 !! test
8628 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8629 !! options
8630 title=[[*RFC 1234 http://example.com/]]
8631 !! wikitext
8632 {{PAGENAMEE}}
8633 !! html/php
8634 <p>&#42;RFC_1234_http&#58;//example.com/
8635 </p>
8636 !! html+tidy
8637 <p>*RFC_1234_http://example.com/</p>
8638 !! end
8639
8640 !! test
8641 Magic Word: {{REVISIONID}}
8642 !! wikitext
8643 {{REVISIONID}}
8644 !! html
8645 <p>1337
8646 </p>
8647 !! end
8648
8649 !! test
8650 Magic Word: {{SCRIPTPATH}}
8651 !! wikitext
8652 {{SCRIPTPATH}}
8653 !! html
8654 <p>/
8655 </p>
8656 !! end
8657
8658 !! test
8659 Magic Word: {{STYLEPATH}}
8660 !! wikitext
8661 {{STYLEPATH}}
8662 !! html
8663 <p>/skins
8664 </p>
8665 !! end
8666
8667 !! test
8668 Magic Word: {{SERVER}}
8669 !! wikitext
8670 {{SERVER}}
8671 !! html
8672 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8673 </p>
8674 !! end
8675
8676 !! test
8677 Magic Word: {{SERVERNAME}}
8678 !! wikitext
8679 {{SERVERNAME}}
8680 !! html
8681 <p>example.org
8682 </p>
8683 !! end
8684
8685 !! test
8686 Magic Word: {{SITENAME}}
8687 !! wikitext
8688 {{SITENAME}}
8689 !! html
8690 <p>MediaWiki
8691 </p>
8692 !! end
8693
8694 !! test
8695 Case-sensitive magic words, when cased differently, should just be template transclusions
8696 !! wikitext
8697 {{CurrentMonth}}
8698 {{currentday}}
8699 {{cURreNTweEK}}
8700 {{currentHour}}
8701 !! html
8702 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
8703 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
8704 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
8705 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
8706 </p>
8707 !! end
8708
8709 !! test
8710 Case-insensitive magic words should still work with weird casing.
8711 !! wikitext
8712 {{sErVeRNaMe}}
8713 {{LCFirst:AOEU}}
8714 {{ucFIRST:aoeu}}
8715 {{SERver}}
8716 !! html
8717 <p>example.org
8718 aOEU
8719 Aoeu
8720 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8721 </p>
8722 !! end
8723
8724 !! test
8725 Namespace 1 {{ns:1}}
8726 !! wikitext
8727 {{ns:1}}
8728 !! html
8729 <p>Talk
8730 </p>
8731 !! end
8732
8733 !! test
8734 Namespace 1 {{ns:01}}
8735 !! wikitext
8736 {{ns:01}}
8737 !! html
8738 <p>Talk
8739 </p>
8740 !! end
8741
8742 !! test
8743 Namespace 0 {{ns:0}} (bug 4783)
8744 !! wikitext
8745 {{ns:0}}
8746 !! html
8747
8748 !! end
8749
8750 !! test
8751 Namespace 0 {{ns:00}} (bug 4783)
8752 !! wikitext
8753 {{ns:00}}
8754 !! html
8755
8756 !! end
8757
8758 !! test
8759 Namespace -1 {{ns:-1}}
8760 !! wikitext
8761 {{ns:-1}}
8762 !! html
8763 <p>Special
8764 </p>
8765 !! end
8766
8767 !! test
8768 Namespace User {{ns:User}}
8769 !! wikitext
8770 {{ns:User}}
8771 !! html
8772 <p>User
8773 </p>
8774 !! end
8775
8776 !! test
8777 Namespace User talk {{ns:User_talk}}
8778 !! wikitext
8779 {{ns:User_talk}}
8780 !! html
8781 <p>User talk
8782 </p>
8783 !! end
8784
8785 !! test
8786 Namespace User talk {{ns:uSeR tAlK}}
8787 !! wikitext
8788 {{ns:uSeR tAlK}}
8789 !! html
8790 <p>User talk
8791 </p>
8792 !! end
8793
8794 !! test
8795 Namespace File {{ns:File}}
8796 !! wikitext
8797 {{ns:File}}
8798 !! html
8799 <p>File
8800 </p>
8801 !! end
8802
8803 !! test
8804 Namespace File {{ns:Image}}
8805 !! wikitext
8806 {{ns:Image}}
8807 !! html
8808 <p>File
8809 </p>
8810 !! end
8811
8812 !! test
8813 Namespace (lang=de) Benutzer {{ns:User}}
8814 !! options
8815 language=de
8816 !! wikitext
8817 {{ns:User}}
8818 !! html
8819 <p>Benutzer
8820 </p>
8821 !! end
8822
8823 !! test
8824 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
8825 !! options
8826 language=de
8827 !! wikitext
8828 {{ns:3}}
8829 !! html
8830 <p>Benutzer Diskussion
8831 </p>
8832 !! end
8833
8834
8835 !! test
8836 Urlencode
8837 !! wikitext
8838 {{urlencode:hi world?!}}
8839 {{urlencode:hi world?!|WIKI}}
8840 {{urlencode:hi world?!|PATH}}
8841 {{urlencode:hi world?!|QUERY}}
8842 !! html
8843 <p>hi+world%3F%21
8844 hi_world%3F!
8845 hi%20world%3F%21
8846 hi+world%3F%21
8847 </p>
8848 !! end
8849
8850 !! test
8851 Magic Word: prioritize type info over data-parsoid
8852 !! options
8853 parsoid=html2wt
8854 !! wikitext
8855 __FORCETOC__
8856 !! html
8857 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
8858 !! end
8859
8860 !! test
8861 Magic Word: serialize on separate line (parsoid)
8862 !! options
8863 parsoid=wt2wt,html2wt
8864 !! wikitext
8865 foo
8866 __NOTOC__
8867 bar
8868 !! html
8869 foo<meta property="mw:PageProp/notoc"/>bar
8870 !! end
8871
8872 !! test
8873 Magic Word: rt non-english wikis
8874 !! options
8875 parsoid=wt2wt
8876 language=de
8877 !! wikitext
8878 __NOEDITSECTION__
8879 !! html
8880 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
8881 !! end
8882
8883 ###
8884 ### Magic links
8885 ###
8886 !! test
8887 Magic links: internal link to RFC (bug 479)
8888 !! wikitext
8889 [[RFC 123]]
8890 !! html
8891 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
8892 </p>
8893 !! end
8894
8895 !! test
8896 Magic links: RFC (bug 479)
8897 !! wikitext
8898 RFC 822
8899 !! html
8900 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8901 </p>
8902 !! end
8903
8904 !! test
8905 Magic links: RFC (bug 65278)
8906 !! wikitext
8907 This is RFC 822 but thisRFC 822 is not RFC 822linked.
8908 !! html
8909 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
8910 </p>
8911 !! end
8912
8913 !! test
8914 Magic links: ISBN (bug 1937)
8915 !! wikitext
8916 ISBN 0-306-40615-2
8917 !! html
8918 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8919 </p>
8920 !! end
8921
8922 !! test
8923 Magic links: ISBN (bug 65278)
8924 !! wikitext
8925 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
8926 !! html
8927 <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
8928 </p>
8929 !! end
8930
8931 !! test
8932 Magic links: PMID incorrectly converts space to underscore
8933 !! wikitext
8934 PMID 1234
8935 !! html
8936 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8937 </p>
8938 !! end
8939
8940 !! test
8941 Magic links: PMID (bug 65278)
8942 !! wikitext
8943 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
8944 !! html
8945 <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
8946 </p>
8947 !! end
8948
8949 ###
8950 ### Templates
8951 ####
8952
8953 !! test
8954 Nonexistent template
8955 !! wikitext
8956 {{thistemplatedoesnotexist}}
8957 !! html
8958 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
8959 </p>
8960 !! end
8961
8962 !! test
8963 Template with invalid target containing tags
8964 !! wikitext
8965 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8966 !! html
8967 <p>{{a<b>b</b>|foo|a=b|a = b}}
8968 </p>
8969 !! end
8970
8971 !! test
8972 Template with invalid target containing unclosed tag
8973 !! wikitext
8974 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8975 !! html
8976 <p>{{a<b>|foo|a=b|a = b}}</b>
8977 </p>
8978 !! end
8979
8980 !! test
8981 Template with invalid target containing wikilink
8982 !! wikitext
8983 {{[[Main Page]]}}
8984 !! html/php
8985 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
8986 </p>
8987 !! html/parsoid
8988 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"[[Main Page]]"},"params":{},"i":0}}]}'>{{</span><a rel="mw:WikiLink" href="./Main_Page" about="#mwt1">Main Page</a><span about="#mwt1">}}</span></p>
8989 !! end
8990
8991 !! test
8992 Template with just whitespace in it, bug #68421
8993 !! wikitext
8994 {{echo|{{ }}}}
8995 !! html/parsoid
8996 <p><span typeof="mw:Transclusion mw:Nowiki" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</span></p>
8997 !! end
8998
8999 !! article
9000 Template:test
9001 !! text
9002 This is a test template
9003 !! endarticle
9004
9005 !! test
9006 Simple template
9007 !! wikitext
9008 {{test}}
9009 !! html
9010 <p>This is a test template
9011 </p>
9012 !! end
9013
9014 !! test
9015 Template with explicit namespace
9016 !! wikitext
9017 {{Template:test}}
9018 !! html
9019 <p>This is a test template
9020 </p>
9021 !! end
9022
9023
9024 !! article
9025 Template:paramtest
9026 !! text
9027 This is a test template with parameter {{{param}}}
9028 !! endarticle
9029
9030 !! test
9031 Template parameter
9032 !! wikitext
9033 {{paramtest|param=foo}}
9034 !! html
9035 <p>This is a test template with parameter foo
9036 </p>
9037 !! end
9038
9039 !! article
9040 Template:paramtestnum
9041 !! text
9042 [[{{{1}}}|{{{2}}}]]
9043 !! endarticle
9044
9045 !! test
9046 Template unnamed parameter
9047 !! wikitext
9048 {{paramtestnum|Main Page|the main page}}
9049 !! html
9050 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9051 </p>
9052 !! end
9053
9054 !! article
9055 Template:templatesimple
9056 !! text
9057 (test)
9058 !! endarticle
9059
9060 !! article
9061 Template:templateredirect
9062 !! text
9063 #redirect [[Template:templatesimple]]
9064 !! endarticle
9065
9066 !! article
9067 Template:templateasargtestnum
9068 !! text
9069 {{{{{1}}}}}
9070 !! endarticle
9071
9072 !! article
9073 Template:templateasargtest
9074 !! text
9075 {{template{{{templ}}}}}
9076 !! endarticle
9077
9078 !! article
9079 Template:templateasargtest2
9080 !! text
9081 {{{{{templ}}}}}
9082 !! endarticle
9083
9084 !! test
9085 Template with template name as unnamed argument
9086 !! wikitext
9087 {{templateasargtestnum|templatesimple}}
9088 !! html
9089 <p>(test)
9090 </p>
9091 !! end
9092
9093 !! test
9094 Template with template name as argument
9095 !! wikitext
9096 {{templateasargtest|templ=simple}}
9097 !! html
9098 <p>(test)
9099 </p>
9100 !! end
9101
9102 !! test
9103 Template with template name as argument (2)
9104 !! wikitext
9105 {{templateasargtest2|templ=templatesimple}}
9106 !! html
9107 <p>(test)
9108 </p>
9109 !! end
9110
9111 !! article
9112 Template:templateasargtestdefault
9113 !! text
9114 {{{{{templ|templatesimple}}}}}
9115 !! endarticle
9116
9117 !! article
9118 Template:templa
9119 !! text
9120 '''templ'''
9121 !! endarticle
9122
9123 !! test
9124 Template with default value
9125 !! wikitext
9126 {{templateasargtestdefault}}
9127 !! html
9128 <p>(test)
9129 </p>
9130 !! end
9131
9132 !! test
9133 Template with default value (value set)
9134 !! wikitext
9135 {{templateasargtestdefault|templ=templa}}
9136 !! html
9137 <p><b>templ</b>
9138 </p>
9139 !! end
9140
9141 !! test
9142 Template redirect
9143 !! wikitext
9144 {{templateredirect}}
9145 !! html
9146 <p>(test)
9147 </p>
9148 !! end
9149
9150 !! test
9151 Template with argument in separate line
9152 !! wikitext
9153 {{ templateasargtest |
9154 templ = simple }}
9155 !! html
9156 <p>(test)
9157 </p>
9158 !! end
9159
9160 !! test
9161 Template with complex template as argument
9162 !! wikitext
9163 {{paramtest|
9164 param ={{ templateasargtest |
9165 templ = simple }}}}
9166 !! html
9167 <p>This is a test template with parameter (test)
9168 </p>
9169 !! end
9170
9171 !! test
9172 Template with thumb image (with link in description)
9173 !! wikitext
9174 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9175 !! html/php
9176 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
9177
9178 !! html+tidy
9179 <p>This is a test template with parameter</p>
9180 <div class="thumb tright">
9181 <div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a>
9182 <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div>
9183 </div>
9184 </div>
9185 !! html/parsoid
9186 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
9187 !! end
9188
9189 !! article
9190 Template:complextemplate
9191 !! text
9192 {{{1}}} {{paramtest|
9193 param ={{{param}}}}}
9194 !! endarticle
9195
9196 !! test
9197 Template with complex arguments
9198 !! wikitext
9199 {{complextemplate|
9200 param ={{ templateasargtest |
9201 templ = simple }}|[[Template:complextemplate|link]]}}
9202 !! html
9203 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
9204 </p>
9205 !! end
9206
9207 !! test
9208 BUG 553: link with two variables in a piped link
9209 !! wikitext
9210 {|
9211 |[[{{{1}}}|{{{2}}}]]
9212 |}
9213 !! html
9214 <table>
9215 <tr>
9216 <td>[[{{{1}}}|{{{2}}}]]
9217 </td></tr></table>
9218
9219 !! end
9220
9221 !! test
9222 Magic variable as template parameter
9223 !! wikitext
9224 {{paramtest|param={{SITENAME}}}}
9225 !! html
9226 <p>This is a test template with parameter MediaWiki
9227 </p>
9228 !! end
9229
9230 !! article
9231 Template:linktest
9232 !! text
9233 [[{{{param}}}|link]]
9234 !! endarticle
9235
9236 !! test
9237 Template parameter as link source
9238 !! wikitext
9239 {{linktest|param=Main Page}}
9240 !! html
9241 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
9242 </p>
9243 !! end
9244
9245 !!test
9246 Template-generated attribute string (k='v')
9247 !! wikitext
9248 <span {{attr_str|id|v1}}>bar</span>
9249 !! html
9250 <p><span id="v1">bar</span>
9251 </p>
9252 !!end
9253
9254 !!article
9255 Template:paramtest2
9256 !! text
9257 including another template, {{paramtest|param={{{arg}}}}}
9258 !! endarticle
9259
9260 !! test
9261 Template passing argument to another template
9262 !! wikitext
9263 {{paramtest2|arg='hmm'}}
9264 !! html
9265 <p>including another template, This is a test template with parameter 'hmm'
9266 </p>
9267 !! end
9268
9269 !! article
9270 Template:Linktest2
9271 !! text
9272 Main Page
9273 !! endarticle
9274
9275 !! test
9276 Template as link source
9277 !! wikitext
9278 [[{{linktest2}}]]
9279
9280 [[{{linktest2}}|Main Page]]
9281
9282 [[{{linktest2}}]]Page
9283 !! html
9284 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9285 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9286 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
9287 </p>
9288 !! end
9289
9290
9291 !! article
9292 Template:loop1
9293 !! text
9294 {{loop2}}
9295 !! endarticle
9296
9297 !! article
9298 Template:loop2
9299 !! text
9300 {{loop1}}
9301 !! endarticle
9302
9303 !! test
9304 Template infinite loop
9305 !! wikitext
9306 {{loop1}}
9307 !! html
9308 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
9309 </p>
9310 !! end
9311
9312 !! test
9313 Template from main namespace
9314 !! wikitext
9315 {{:Main Page}}
9316 !! html
9317 <p>blah blah
9318 </p>
9319 !! end
9320
9321 !! article
9322 Template:table
9323 !! text
9324 {|
9325 | 1 || 2
9326 |-
9327 | 3 || 4
9328 |}
9329 !! endarticle
9330
9331 !! test
9332 BUG 529: Template with table, not included at beginning of line
9333 !! wikitext
9334 foo {{table}}
9335 !! html
9336 <p>foo
9337 </p>
9338 <table>
9339 <tr>
9340 <td> 1 </td>
9341 <td> 2
9342 </td></tr>
9343 <tr>
9344 <td> 3 </td>
9345 <td> 4
9346 </td></tr></table>
9347
9348 !! end
9349
9350 !! test
9351 BUG 523: Template shouldn't eat newline (or add an extra one before table)
9352 !! wikitext
9353 foo
9354 {{table}}
9355 !! html
9356 <p>foo
9357 </p>
9358 <table>
9359 <tr>
9360 <td> 1 </td>
9361 <td> 2
9362 </td></tr>
9363 <tr>
9364 <td> 3 </td>
9365 <td> 4
9366 </td></tr></table>
9367
9368 !! end
9369
9370 !! test
9371 BUG 41: Template parameters shown as broken links
9372 !! wikitext
9373 {{{parameter}}}
9374 !! html
9375 <p>{{{parameter}}}
9376 </p>
9377 !! end
9378
9379 !! test
9380 Template with targets containing wikilinks
9381 !! wikitext
9382 {{[[foo]]}}
9383
9384 {{[[{{echo|foo}}]]}}
9385
9386 {{{{echo|[[foo}}]]}}
9387 !! html
9388 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9389 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9390 </p><p>{{[[foo}}]]
9391 </p>
9392 !! end
9393
9394 !! article
9395 Template:MSGNW test
9396 !! text
9397 ''None'' of '''this''' should be
9398 * interpreted
9399 but rather passed unmodified
9400 {{test}}
9401 <gallery>
9402 File:Foobar.jpg
9403 </gallery>
9404 !! endarticle
9405
9406 # hmm, fix this or just deprecate msgnw and document its behavior?
9407 !! test
9408 msgnw keyword
9409 !! wikitext
9410 {{msgnw:MSGNW test}}
9411 !! html
9412 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
9413 &#42; interpreted
9414 &#32;but rather passed unmodified
9415 &#123;&#123;test&#125;&#125;
9416 &#60;gallery&#62;
9417 File:Foobar.jpg
9418 &#60;/gallery&#62;
9419 </p>
9420 !! end
9421
9422 !! test
9423 int keyword
9424 !! wikitext
9425 {{int:youhavenewmessages|lots of money|not!}}
9426 !! html
9427 <p>You have lots of money (not!).
9428 </p>
9429 !! end
9430
9431 !! article
9432 Template:Includes
9433 !! text
9434 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9435 !! endarticle
9436
9437 !! test
9438 <includeonly> and <noinclude> being included
9439 !! wikitext
9440 {{Includes}}
9441 !! html
9442 <p>Foobar
9443 </p>
9444 !! end
9445
9446 !! article
9447 Template:Includes2
9448 !! text
9449 <onlyinclude>Foo</onlyinclude>bar
9450 !! endarticle
9451
9452 !! test
9453 <onlyinclude> being included
9454 !! wikitext
9455 {{Includes2}}
9456 !! html
9457 <p>Foo
9458 </p>
9459 !! end
9460
9461
9462 !! article
9463 Template:Includes3
9464 !! text
9465 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9466 !! endarticle
9467
9468 !! test
9469 <onlyinclude> and <includeonly> being included
9470 !! wikitext
9471 {{Includes3}}
9472 !! html
9473 <p>Foo
9474 </p>
9475 !! end
9476
9477 !! test
9478 <includeonly> and <noinclude> on a page
9479 !! wikitext
9480 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9481 !! html
9482 <p>Foozar
9483 </p>
9484 !! end
9485
9486 !! test
9487 Un-closed <noinclude>
9488 !! wikitext
9489 <noinclude>
9490 !! html
9491 !! end
9492
9493 !! test
9494 <onlyinclude> on a page
9495 !! wikitext
9496 <onlyinclude>Foo</onlyinclude>bar
9497 !! html
9498 <p>Foobar
9499 </p>
9500 !! end
9501
9502 !! test
9503 Un-closed <onlyinclude>
9504 !! wikitext
9505 <onlyinclude>
9506 !! html
9507 !! end
9508
9509 !!test
9510 Self-closed noinclude, includeonly, onlyinclude tags
9511 !! wikitext
9512 <noinclude />
9513 <includeonly />
9514 <onlyinclude />
9515 !! html
9516 <p><br />
9517 </p>
9518 !!end
9519
9520 !!test
9521 Unbalanced includeonly and noinclude tags
9522 !! wikitext
9523 {|
9524 |a</noinclude>
9525 |b</noinclude></noinclude>
9526 |c</noinclude></includeonly>
9527 |d</includeonly></includeonly>
9528 |}
9529 !! html
9530 <table>
9531 <tr>
9532 <td>a
9533 </td>
9534 <td>b
9535 </td>
9536 <td>c&lt;/includeonly&gt;
9537 </td>
9538 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9539 </td></tr></table>
9540
9541 !!end
9542
9543 !! article
9544 Template:Includeonly section
9545 !! text
9546 <includeonly>
9547 ==Includeonly section==
9548 </includeonly>
9549 ==Section T-1==
9550 !!endarticle
9551
9552 !! test
9553 Bug 6563: Edit link generation for section shown by <includeonly>
9554 !! wikitext
9555 {{includeonly section}}
9556 !! html
9557 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9558 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9559
9560 !! end
9561
9562 # Uses same input as the contents of [[Template:Includeonly section]]
9563 !! test
9564 Bug 6563: Section extraction for section shown by <includeonly>
9565 !! options
9566 section=T-2
9567 !! wikitext
9568 <includeonly>
9569 ==Includeonly section==
9570 </includeonly>
9571 ==Section T-2==
9572 !! html
9573 ==Section T-2==
9574 !! end
9575
9576 !! test
9577 Bug 6563: Edit link generation for section suppressed by <includeonly>
9578 !! wikitext
9579 <includeonly>
9580 ==Includeonly section==
9581 </includeonly>
9582 ==Section 1==
9583 !! html
9584 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9585
9586 !! end
9587
9588 !! test
9589 Bug 6563: Section extraction for section suppressed by <includeonly>
9590 !! options
9591 section=1
9592 !! wikitext
9593 <includeonly>
9594 ==Includeonly section==
9595 </includeonly>
9596 ==Section 1==
9597 !! html
9598 ==Section 1==
9599 !! end
9600
9601 !! test
9602 Un-closed <includeonly>
9603 !! wikitext
9604 <includeonly>
9605 !! html
9606 !! end
9607
9608 !! test
9609 Includes and comments at SOL
9610 !! wikitext
9611 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
9612
9613 <noinclude>
9614 some
9615 </noinclude>* stuff
9616 * here
9617
9618 <includeonly>can have stuff</includeonly>=== here ===
9619
9620 !! html/php
9621 <h2><span class="mw-headline" id="hu">hu</span></h2>
9622 <p>some
9623 </p>
9624 <ul><li> stuff</li>
9625 <li> here</li></ul>
9626 <h3><span class="mw-headline" id="here">here</span></h3>
9627
9628 !! html/parsoid
9629 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment --><h2> hu </h2>
9630
9631 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
9632 <p>some</p>
9633 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
9634 <li> here</li></ul>
9635
9636 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3> here </h3>
9637
9638 !! end
9639
9640 # TODO: test with DOM fragment reuse!
9641 !! test
9642 Parsoid: DOM fragment reuse
9643 !! options
9644 parsoid=wt2wt,wt2html
9645 !! wikitext
9646 a{{echo|b<table></table>c}}d
9647
9648 a{{echo|b
9649 <table></table>
9650 c}}d
9651
9652 {{echo|a
9653
9654 <table></table>
9655
9656 b}}
9657 !! html
9658 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
9659
9660 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>ab</p><span about="#mwt2">
9661 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
9662 </span><p about="#mwt2">cd</p>
9663
9664 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>a</p><span about="#mwt3">
9665
9666 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
9667
9668 </span><p about="#mwt3">b</p>
9669 !! end
9670
9671 !! test
9672 Parsoid: Merge double tds (bug 50603)
9673 !! options
9674 parsoid
9675 !! wikitext
9676 {|
9677 |{{echo|{{!}} foo}}
9678 |}
9679 !! html
9680 <table><tbody>
9681 <tr><td about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":0}}]}'> foo</td></tr>
9682 </tbody></table>
9683 !! end
9684
9685 !! test
9686 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9687 !! options
9688 parsoid
9689 !! wikitext
9690 {{echo|<div>}}
9691 {|
9692 |{{echo|{{!}} foo}}
9693 |}
9694 {{echo|</div>}}
9695 !! html
9696 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<div>"}},"i":0}},"\n{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":1}},"\n|}\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</div>"}},"i":2}}]}'>
9697 <table><tbody>
9698 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9699 </tbody></table>
9700 </div>
9701 !! end
9702
9703 ###
9704 ### <includeonly> and <noinclude> in attributes
9705 ###
9706 !!test
9707 0. includeonly around the entire attribute
9708 !! wikitext
9709 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9710 !! html
9711 <p><span id="v2">bar</span>
9712 </p>
9713 !!end
9714
9715 !!test
9716 1. includeonly in html attr key
9717 !! wikitext
9718 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9719 !! html
9720 <p><span id="foo">bar</span>
9721 </p>
9722 !!end
9723
9724 !!test
9725 2. includeonly in html attr value
9726 !! wikitext
9727 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9728 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9729 !! html
9730 <p><span id="v1">bar</span>
9731 <span id="v1">bar</span>
9732 </p>
9733 !!end
9734
9735 !!test
9736 3. includeonly in part of an attr value
9737 !! wikitext
9738 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9739 !! html
9740 <p><span style="color:red;">bar</span>
9741 </p>
9742 !!end
9743
9744 !!test
9745 4. includeonly in table attributes
9746 !! wikitext
9747 {|
9748 |- <noinclude>
9749 |-
9750 |a
9751 </noinclude>
9752 |- <includeonly>
9753 |-
9754 |b
9755 </includeonly>
9756 |}
9757 !! html
9758 <table>
9759
9760
9761 <tr>
9762 <td>a
9763 </td></tr>
9764 </table>
9765
9766 !!end
9767
9768 ###
9769 ### Token Stream Patcher tests
9770 ###
9771 ### These tests won't always pass wt2wt and other modes because
9772 ### on serialization, the table will be output on a new line.
9773 ### For now, we are blacklisting them, and using this to test selser.
9774 ###
9775
9776 !!test
9777 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
9778 !!options
9779 parsoid=wt2html,wt2wt
9780 !!wikitext
9781 {{echo|}}{| width = '100%'
9782 |foo
9783 |}
9784 !!html/parsoid
9785 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
9786 <tbody><tr><td>foo</td></tr>
9787 </tbody></table>
9788 !!end
9789
9790 !!test
9791 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
9792 !!options
9793 parsoid=wt2html,wt2wt
9794 !!wikitext
9795 <includeonly>a</includeonly>{| {{{b}}}
9796 |c
9797 |}
9798 !!html/parsoid
9799 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[31,38,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{b}}}&amp;quot;}\">{{{b}}}&lt;/span>"},{"html":""}]]}' data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}'>
9800 <tbody><tr><td>c</td></tr>
9801 </tbody></table>
9802
9803 !!end
9804
9805 ###
9806 ### Testing parsing of templates where a template arg
9807 ### has the same name as the template itself.
9808 ###
9809
9810 !! article
9811 Template:quote
9812 !! text
9813 {{{quote|{{{1}}}}}}
9814 !! endarticle
9815
9816 !!test
9817 Templates: Template Name/Arg clash: 1. Use of positional param
9818 !! wikitext
9819 {{quote|foo}}
9820 !! html
9821 <p>foo
9822 </p>
9823 !!end
9824
9825 !!test
9826 Templates: Template Name/Arg clash: 2. Use of named param
9827 !! wikitext
9828 {{quote|quote=foo}}
9829 !! html
9830 <p>foo
9831 </p>
9832 !!end
9833
9834 !!test
9835 Templates: Template Name/Arg clash: 3. Use of named param with empty input
9836 !! wikitext
9837 {{quote|quote}}
9838 !! html
9839 <p>quote
9840 </p>
9841 !!end
9842
9843 ###
9844 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
9845 ###
9846
9847 !!test
9848 Templates: 1. Simple use
9849 !! wikitext
9850 {{echo|Foo}}
9851 !! html
9852 <p>Foo
9853 </p>
9854 !!end
9855
9856 !!test
9857 Templates: 2. Inside a block tag
9858 !! wikitext
9859 <div>{{echo|Foo}}</div>
9860 <blockquote>{{echo|Foo}}</blockquote>
9861 !! html
9862 <div>Foo</div>
9863 <blockquote>Foo</blockquote>
9864
9865 !! html+tidy
9866 <div>Foo</div>
9867 <blockquote>
9868 <p>Foo</p>
9869 </blockquote>
9870 !!end
9871
9872 !!test
9873 Templates: P-wrapping: 1a. Templates on consecutive lines
9874 !! wikitext
9875 {{echo|Foo}}
9876 {{echo|bar}}
9877 !! html
9878 <p>Foo
9879 bar
9880 </p>
9881 !!end
9882
9883 !!test
9884 Templates: P-wrapping: 1b. Templates on consecutive lines
9885 !! wikitext
9886 Foo
9887
9888 {{echo|bar}}
9889 {{echo|baz}}
9890 !! html
9891 <p>Foo
9892 </p><p>bar
9893 baz
9894 </p>
9895 !!end
9896
9897 !!test
9898 Templates: P-wrapping: 1c. Templates on consecutive lines
9899 !! wikitext
9900 {{echo|Foo}}
9901 {{echo|bar}} <div>baz</div>
9902 !! html
9903 <p>Foo
9904 </p>
9905 bar <div>baz</div>
9906
9907 !! html+tidy
9908 <p>Foo</p>
9909 <p>bar</p>
9910 <div>baz</div>
9911 !! end
9912
9913 !!test
9914 Templates: P-wrapping: 1d. Template preceded by comment-only line
9915 !!options
9916 parsoid
9917 !! wikitext
9918 <!-- foo -->
9919 {{echo|Bar}}
9920 !! html
9921 <!-- foo -->
9922
9923 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
9924 !!end
9925
9926 !!test
9927 Templates: Inline Text: 1. Multiple template uses
9928 !! wikitext
9929 {{echo|Foo}}bar{{echo|baz}}
9930 !! html
9931 <p>Foobarbaz
9932 </p>
9933 !!end
9934
9935 !!test
9936 Templates: Inline Text: 2. Back-to-back template uses
9937 !! wikitext
9938 {{echo|Foo}}{{echo|bar}}
9939 !! html
9940 <p>Foobar
9941 </p>
9942 !!end
9943
9944 !!test
9945 Templates: Block Tags: 1. Multiple template uses
9946 !! wikitext
9947 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
9948 !! html
9949 <div>Foo</div><div>bar</div><div>baz</div>
9950
9951 !!end
9952
9953 !!test
9954 Templates: Block Tags: 2. Back-to-back template uses
9955 !! wikitext
9956 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
9957 !! html
9958 <div>Foo</div><div>bar</div>
9959
9960 !!end
9961
9962 # This is an edge case relating to paragraph wrapping.
9963 !!test
9964 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
9965 !! wikitext
9966 {{echo|a
9967 b</p>}}
9968 !! html/parsoid
9969 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\nb&lt;/p>"}},"i":0}}]}'>a
9970 b</p>
9971 !!end
9972
9973 !!test
9974 Templates: Links: 1. Simple example
9975 !! wikitext
9976 {{echo|[[Foo|bar]]}}
9977 !! html
9978 <p><a href="/wiki/Foo" title="Foo">bar</a>
9979 </p>
9980 !!end
9981
9982 !!test
9983 Templates: Links: 2. Generation of link href
9984 !! wikitext
9985 [[{{echo|Foo}}|bar]]
9986 !! html
9987 <p><a href="/wiki/Foo" title="Foo">bar</a>
9988 </p>
9989 !!end
9990
9991 !!test
9992 Templates: Links: 3. Generation of part of a link href
9993 !! wikitext
9994 [[Fo{{echo|o}}|bar]]
9995
9996 [[Foo{{echo|bar}}]]
9997
9998 [[Foo{{echo|bar}}baz]]
9999
10000 [[Foo{{echo|bar}}|bar]]
10001
10002 [[:Foo{{echo|bar}}]]
10003
10004 [[:Foo{{echo|bar}}|bar]]
10005 !! html
10006 <p><a href="/wiki/Foo" title="Foo">bar</a>
10007 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10008 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10009 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10010 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10011 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10012 </p>
10013 !!end
10014
10015 !!test
10016 Templates: Links: 4. Multiple templates generating link href
10017 !! wikitext
10018 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10019 !! html
10020 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10021 </p>
10022 !!end
10023
10024 !!test
10025 Templates: Links: 5. Generation of link text
10026 !! wikitext
10027 [[Foo|{{echo|bar}}]]
10028 !! html
10029 <p><a href="/wiki/Foo" title="Foo">bar</a>
10030 </p>
10031 !!end
10032
10033 !!test
10034 Templates: Links: 5. Nested templates (only outermost template should be marked)
10035 !! wikitext
10036 {{echo|[[{{echo|Foo}}|bar]]}}
10037 !! html
10038 <p><a href="/wiki/Foo" title="Foo">bar</a>
10039 </p>
10040 !!end
10041
10042 !!test
10043 Templates: HTML Tag: 1. Generation of HTML attr. key
10044 !! wikitext
10045 <div {{echo|style}}="color:red;">foo</div>
10046 !! html
10047 <div style="color:red;">foo</div>
10048
10049 !!end
10050
10051 !!test
10052 Templates: HTML Tag: 2. Generation of HTML attr. value
10053 !! wikitext
10054 <div style={{echo|'color:red;'}}>foo</div>
10055 !! html
10056 <div style="color:red;">foo</div>
10057
10058 !!end
10059
10060 !!test
10061 Templates: HTML Tag: 3. Generation of HTML attr key and value
10062 !! wikitext
10063 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10064 !! html
10065 <div style="color:red;">foo</div>
10066
10067 !!end
10068
10069 !!test
10070 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10071 !! wikitext
10072 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10073 !! html
10074 <div title="This is a long title with just one piece templated">foo</div>
10075
10076 !!end
10077
10078 !!test
10079 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10080 !! wikitext
10081 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10082 !! html
10083 <div title="This is a long title with just one piece templated">foo</div>
10084
10085 !!end
10086
10087 !!test
10088 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10089 !! wikitext
10090 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10091 !! html
10092 <div title="This is a long title with just one piece templated">foo</div>
10093
10094 !!end
10095
10096 !!test
10097 Templates: HTML Tag: 7. Generation of partial attribute key string
10098 !! wikitext
10099 <div st{{echo|yle}}="color:red;">foo</div>
10100 !! html
10101 <div style="color:red;">foo</div>
10102
10103 !!end
10104
10105 !!test
10106 Templates: HTML Tables: 1. Generating start of a HTML table
10107 !! wikitext
10108 {{echo|<table><tr><td>foo</td>}}</tr></table>
10109 !! html
10110 <table><tr><td>foo</td></tr></table>
10111
10112 !!end
10113
10114 !!test
10115 Templates: HTML Tables: 2a. Generating middle of a HTML table
10116 !! wikitext
10117 <table><tr>{{echo|<td>foo</td>}}</tr></table>
10118 !! html
10119 <table><tr><td>foo</td></tr></table>
10120
10121 !!end
10122
10123 !!test
10124 Templates: HTML Tables: 2b. Generating middle of a HTML table
10125 !! wikitext
10126 <table>{{echo|<tr><td>foo</td></tr>}}</table>
10127 !! html
10128 <table><tr><td>foo</td></tr></table>
10129
10130 !!end
10131
10132 !!test
10133 Templates: HTML Tables: 3. Generating end of a HTML table
10134 !! wikitext
10135 <table><tr>{{echo|<td>foo</td></tr></table>}}
10136 !! html
10137 <table><tr><td>foo</td></tr></table>
10138
10139 !!end
10140
10141 !!test
10142 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
10143 !! wikitext
10144 {{echo|<table>}}<tr><td>foo</td></tr></table>
10145 !! html
10146 <table><tr><td>foo</td></tr></table>
10147
10148 !!end
10149
10150 !!test
10151 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
10152 !! wikitext
10153 <table>{{echo|<tr>}}<td>foo</td></tr></table>
10154 !! html
10155 <table><tr><td>foo</td></tr></table>
10156
10157 !!end
10158
10159 !!test
10160 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
10161 !! wikitext
10162 <table><tr>{{echo|<td>}}foo</td></tr></table>
10163 !! html
10164 <table><tr><td>foo</td></tr></table>
10165
10166 !!end
10167
10168 !!test
10169 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
10170 !! wikitext
10171 <table><tr><td>foo{{echo|</td>}}</tr></table>
10172 !! html
10173 <table><tr><td>foo</td></tr></table>
10174
10175 !!end
10176
10177 !!test
10178 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
10179 !! wikitext
10180 <table><tr><td>foo</td>{{echo|</tr>}}</table>
10181 !! html
10182 <table><tr><td>foo</td></tr></table>
10183
10184 !!end
10185
10186 !!test
10187 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
10188 !! wikitext
10189 <table><tr><td>foo</td></tr>{{echo|</table>}}
10190 !! html
10191 <table><tr><td>foo</td></tr></table>
10192
10193 !!end
10194
10195 !!test
10196 Templates: HTML Tables: 5. Proper fostering of categories from inside
10197 !!options
10198 parsoid=wt2html,wt2wt
10199 !! wikitext
10200 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
10201 <!--Two categories (Bug 50330)-->
10202 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
10203 !! html
10204 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
10205 <!--Two categories (Bug 50330)-->
10206 <link rel="mw:PageProp/Category" href="./Category:Bar1"><link rel="mw:PageProp/Category" href="./Category:Bar2"><table><tbody><tr><td>foo</td></tr></tbody></table>
10207 !!end
10208
10209 !!test
10210 Templates: Wiki Tables: 1a. Fostering of entire template content
10211 !! wikitext
10212 {|
10213 {{echo|a}}
10214 |}
10215 !! html
10216 <table>
10217 a
10218 <tr><td></td></tr></table>
10219
10220 !! html+tidy
10221 <p>a</p>
10222 <table>
10223 <tr>
10224 <td></td>
10225 </tr>
10226 </table>
10227 !! end
10228
10229 !!test
10230 Templates: Wiki Tables: 1b. Fostering of entire template content
10231 !! wikitext
10232 {|
10233 {{echo|<div>}}
10234 foo
10235 {{echo|</div>}}
10236 |}
10237 !! html
10238 <table>
10239 <div>
10240 <p>foo
10241 </p>
10242 </div>
10243 <tr><td></td></tr></table>
10244
10245 !! html+tidy
10246 <div>
10247 <p>foo</p>
10248 </div>
10249 <table>
10250 <tr>
10251 <td></td>
10252 </tr>
10253 </table>
10254 !! end
10255
10256 !!test
10257 Templates: Wiki Tables: 2. Fostering of partial template content
10258 !! wikitext
10259 {|
10260 {{echo|a
10261 <div>b</div>}}
10262 |}
10263 !! html
10264 <table>
10265 a
10266 <div>b</div>
10267 <tr><td></td></tr></table>
10268
10269 !! html+tidy
10270 <p>a</p>
10271 <div>b</div>
10272 <table>
10273 <tr>
10274 <td></td>
10275 </tr>
10276 </table>
10277 !! end
10278
10279 !!test
10280 Templates: Wiki Tables: 3. td-content via multiple templates
10281 !! wikitext
10282 {|
10283 {{echo|{{pipe}}a}}{{echo|b}}
10284 |}
10285 !! html
10286 <table>
10287 <tr>
10288 <td>ab
10289 </td></tr></table>
10290
10291 !!end
10292
10293 !!test
10294 Templates: Wiki Tables: 4. Templated tags, no content
10295 !! wikitext
10296 {{tbl-start}}
10297 {{tbl-end}}
10298 !! html
10299 <table>
10300 <tr><td></td></tr></table>
10301
10302 !!end
10303
10304 !!test
10305 Templates: Wiki Tables: 5. Templated tags, regular td-tags
10306 !! wikitext
10307 {{tbl-start}}
10308 |foo
10309 {{tbl-end}}
10310 !! html
10311 <table>
10312 <tr>
10313 <td>foo
10314 </td></tr></table>
10315
10316 !!end
10317
10318 !!test
10319 Templates: Wiki Tables: 6. Templated tags, templated td-tags
10320 !! wikitext
10321 {{tbl-start}}
10322 {{!}}foo
10323 {{tbl-end}}
10324 !! html
10325 <table>
10326 <tr>
10327 <td>foo
10328 </td></tr></table>
10329
10330 !!end
10331
10332 !!test
10333 Templates: Lists: Multi-line list-items via templates
10334 !! wikitext
10335 *{{echo|a {{nonexistent|
10336 unused}}}}
10337 *{{echo|b {{nonexistent|
10338 unused}}}}
10339 !! html
10340 <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li>
10341 <li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li></ul>
10342
10343 !!end
10344
10345 !!test
10346 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
10347 !! wikitext
10348 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
10349 !! html
10350 <p><i>ab</i>c<i>d</i>e
10351 </p>
10352 !!end
10353
10354 !!test
10355 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
10356 (PHP parser generates misnested html)
10357 !! wikitext
10358 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
10359 !! html/parsoid
10360 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></span><i about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}},{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:1}}]}"><span>b</span></i><span about="#mwt2">c</span><i about="#mwt2">d<span></span></i><span about="#mwt2">e</span></p>
10361 !!end
10362
10363 !!test
10364 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
10365 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
10366 !! options
10367 parsoid=wt2html,wt2wt
10368 !! wikitext
10369 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
10370 !! html
10371 <div about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></div>
10372 <div about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}}]}"><i>b</i>c<i>d</i></div>
10373 <div about="#mwt3" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:0}}]}">e</div>
10374 !!end
10375
10376 !!test
10377 Templates: Ugly nesting: 4. Divs opened/closed across templates
10378 !! wikitext
10379 a<div>b{{echo|c</div>d}}e
10380 !! html
10381 a<div>bc</div>de
10382
10383 !! html+tidy
10384 <p>a</p>
10385 <div>bc</div>
10386 <p>de</p>
10387 !! end
10388
10389 !!test
10390 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10391 (Parsoid-centric)
10392 !! options
10393 parsoid
10394 !! wikitext
10395 {|
10396 |{{echo|foo</table>}}
10397 |bar
10398 |}
10399 !! html
10400 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</table>"}},"i":0}},"\n|bar\n|}"]}'>
10401
10402 <tbody>
10403 <tr>
10404 <td>foo</td></tr></tbody></table><span about="#mwt1">
10405 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10406 |}</span>
10407 !!end
10408
10409 !!test
10410 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10411 (Parsoid-centric)
10412 !! options
10413 parsoid
10414 !! wikitext
10415 <table>
10416 <tr>
10417 <td>
10418 <table>
10419 <tr>
10420 <td>1. {{echo|foo </table>}}</td>
10421 <td> bar </td>
10422 <td>2. {{echo|baz </table>}}</td>
10423 </tr>
10424 <tr>
10425 <td>abc</td>
10426 </tr>
10427 </table>
10428 </td>
10429 </tr>
10430 <tr>
10431 <td>xyz</td>
10432 </tr>
10433 </table>
10434 !! html
10435 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["<table>\n <tr>\n <td>\n <table>\n <tr>\n <td>1. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo </table>"}},"i":0}},"</td>\n <td> bar </td>\n <td>2. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"baz </table>"}},"i":1}},"</td>\n </tr>\n <tr>\n <td>abc</td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td>xyz</td>\n </tr>\n</table>"]}'>
10436 <tbody><tr>
10437 <td>
10438 <table>
10439 <tbody><tr>
10440 <td>1. foo </td></tr></tbody></table></td>
10441 <td> bar </td>
10442 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10443 </span><span about="#mwt2">
10444 </span><span about="#mwt2">
10445 </span><span about="#mwt2">abc</span><span about="#mwt2">
10446 </span><span about="#mwt2">
10447 </span><span about="#mwt2">
10448 </span><span about="#mwt2">
10449 </span><span about="#mwt2">
10450 </span><span about="#mwt2">
10451 </span><span about="#mwt2">xyz</span><span about="#mwt2">
10452 </span><span about="#mwt2">
10453 </span>
10454 !!end
10455
10456 !! test
10457 Templates: Ugly templates: 3. newline-only template parameter
10458 !! wikitext
10459 foo {{echo|
10460 }}
10461 !! html
10462 <p>foo
10463 </p>
10464 !! end
10465
10466 # This looks like a bug: a single newline triggers p/br for some reason.
10467 !! test
10468 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10469 !! wikitext
10470 {{echo|
10471 }}
10472 !! html
10473 <p><br />
10474 </p>
10475 !! end
10476
10477 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10478 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10479 !! test
10480 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10481 !! wikitext
10482 {{echo|<table>}}
10483 {{echo|<div>foo}}
10484 {{echo|</table>}}
10485 !! html/parsoid
10486 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>foo"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/table>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'>foo
10487 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10488 </table>
10489 !! end
10490
10491 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10492 # that are "identical" and generate nesting cycles in the algorithm
10493 !! test
10494 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
10495 !! wikitext
10496 {{echo|<table><tr><td><table>}}
10497 {{echo|<div>}}
10498 {{echo|</div>}}
10499 !! html/parsoid
10500 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>&lt;tr>&lt;td>&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/div>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
10501 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10502 </table></td></tr></tbody></table>
10503 !! end
10504
10505 !!test
10506 Parser Functions: 1. Simple example
10507 !! wikitext
10508 {{uc:foo}}
10509 !! html
10510 <p>FOO
10511 </p>
10512 !!end
10513
10514 !!test
10515 Parser Functions: 2. Nested use (only outermost should be marked up)
10516 !! wikitext
10517 {{uc:{{lc:FOO}}}}
10518 !! html
10519 <p>FOO
10520 </p>
10521 !!end
10522
10523 ###
10524 ### Pre-save transform tests
10525 ###
10526 !! test
10527 pre-save transform: subst:
10528 !! options
10529 PST
10530 !! wikitext
10531 {{subst:test}}
10532 !! html
10533 This is a test template
10534 !! end
10535
10536 !! test
10537 pre-save transform: normal template
10538 !! options
10539 PST
10540 !! wikitext
10541 {{test}}
10542 !! html
10543 {{test}}
10544 !! end
10545
10546 !! test
10547 pre-save transform: nonexistent template
10548 !! options
10549 PST
10550 !! wikitext
10551 {{thistemplatedoesnotexist}}
10552 !! html
10553 {{thistemplatedoesnotexist}}
10554 !! end
10555
10556
10557 !! test
10558 pre-save transform: subst magic variables
10559 !! options
10560 PST
10561 !! wikitext
10562 {{subst:SITENAME}}
10563 !! html
10564 MediaWiki
10565 !! end
10566
10567 # This is bug 89, which I fixed. -- wtm
10568 !! test
10569 pre-save transform: subst: templates with parameters
10570 !! options
10571 pst
10572 !! wikitext
10573 {{subst:paramtest|param="something else"}}
10574 !! html
10575 This is a test template with parameter "something else"
10576 !! end
10577
10578 !! article
10579 Template:nowikitest
10580 !! text
10581 <nowiki>'''not wiki'''</nowiki>
10582 !! endarticle
10583
10584 !! test
10585 pre-save transform: nowiki in subst (bug 1188)
10586 !! options
10587 pst
10588 !! wikitext
10589 {{subst:nowikitest}}
10590 !! html
10591 <nowiki>'''not wiki'''</nowiki>
10592 !! end
10593
10594
10595 !! article
10596 Template:commenttest
10597 !! text
10598 This template has <!-- a comment --> in it.
10599 !! endarticle
10600
10601 !! test
10602 pre-save transform: comment in subst (bug 1936)
10603 !! options
10604 pst
10605 !! wikitext
10606 {{subst:commenttest}}
10607 !! html
10608 This template has <!-- a comment --> in it.
10609 !! end
10610
10611 !! test
10612 pre-save transform: unclosed tag
10613 !! options
10614 pst noxml
10615 !! wikitext
10616 <nowiki>'''not wiki'''
10617 !! html
10618 <nowiki>'''not wiki'''
10619 !! end
10620
10621 !! test
10622 pre-save transform: mixed tag case
10623 !! options
10624 pst noxml
10625 !! wikitext
10626 <NOwiki>'''not wiki'''</noWIKI>
10627 !! html
10628 <NOwiki>'''not wiki'''</noWIKI>
10629 !! end
10630
10631 !! test
10632 pre-save transform: unclosed comment in <nowiki>
10633 !! options
10634 pst noxml
10635 !! wikitext
10636 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10637 !! html
10638 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10639 !!end
10640
10641 # Leading @ in this template definition works around a limitation
10642 # in parsoid's parserTests which otherwise strips the <span> from the
10643 # result (confusing it for a template wrapper)
10644 !! article
10645 Template:dangerous
10646 !!text
10647 @<span onmouseover="alert('crap')">Oh no</span>
10648 !!endarticle
10649
10650 !!test
10651 (confirming safety of fix for subst bug 1936)
10652 !! wikitext
10653 {{Template:dangerous}}
10654 !! html
10655 <p>@<span>Oh no</span>
10656 </p>
10657 !! end
10658
10659 !! test
10660 pre-save transform: comment containing gallery (bug 5024)
10661 !! options
10662 pst
10663 !! wikitext
10664 <!-- <gallery>data</gallery> -->
10665 !! html
10666 <!-- <gallery>data</gallery> -->
10667 !!end
10668
10669 !! test
10670 pre-save transform: comment containing extension
10671 !! options
10672 pst
10673 !! wikitext
10674 <!-- <tag>data</tag> -->
10675 !! html
10676 <!-- <tag>data</tag> -->
10677 !!end
10678
10679 !! test
10680 pre-save transform: comment containing nowiki
10681 !! options
10682 pst
10683 !! wikitext
10684 <!-- <nowiki>data</nowiki> -->
10685 !! html
10686 <!-- <nowiki>data</nowiki> -->
10687 !!end
10688
10689 !! test
10690 pre-save transform: <noinclude> in subst (bug 3298)
10691 !! options
10692 pst
10693 !! wikitext
10694 {{subst:Includes}}
10695 !! html
10696 Foobar
10697 !! end
10698
10699 !! test
10700 pre-save transform: <onlyinclude> in subst (bug 3298)
10701 !! options
10702 pst
10703 !! wikitext
10704 {{subst:Includes2}}
10705 !! html
10706 Foo
10707 !! end
10708
10709 !! article
10710 Template:SubstTest
10711 !!text
10712 {{<includeonly>subst:</includeonly>Includes}}
10713 !! endarticle
10714
10715 !! article
10716 Template:SafeSubstTest
10717 !! text
10718 {{<includeonly>safesubst:</includeonly>Includes}}
10719 !! endarticle
10720
10721 !! test
10722 bug 22297: safesubst: works during PST
10723 !! options
10724 pst
10725 !! wikitext
10726 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
10727 !! html
10728 FoobarFoobar
10729 !! end
10730
10731 !! test
10732 bug 22297: safesubst: works during normal parse
10733 !! wikitext
10734 {{SafeSubstTest}}
10735 !! html
10736 <p>Foobar
10737 </p>
10738 !! end
10739
10740 !! test
10741 subst: does not work during normal parse
10742 !! wikitext
10743 {{SubstTest}}
10744 !! html
10745 <p>{{subst:Includes}}
10746 </p>
10747 !! end
10748
10749 !! test
10750 pre-save transform: context links ("pipe trick")
10751 !! options
10752 pst
10753 !! wikitext
10754 [[Article (context)|]]
10755 [[Bar:Article|]]
10756 [[:Bar:Article|]]
10757 [[Bar:Article (context)|]]
10758 [[:Bar:Article (context)|]]
10759 [[|Article]]
10760 [[|Article (context)]]
10761 [[Bar:X (Y) Z|]]
10762 [[:Bar:X (Y) Z|]]
10763 !! html
10764 [[Article (context)|Article]]
10765 [[Bar:Article|Article]]
10766 [[:Bar:Article|Article]]
10767 [[Bar:Article (context)|Article]]
10768 [[:Bar:Article (context)|Article]]
10769 [[Article]]
10770 [[Article (context)]]
10771 [[Bar:X (Y) Z|X (Y) Z]]
10772 [[:Bar:X (Y) Z|X (Y) Z]]
10773 !! end
10774
10775 !! test
10776 pre-save transform: context links ("pipe trick") with interwiki prefix
10777 !! options
10778 pst
10779 !! wikitext
10780 [[interwiki:Article|]]
10781 [[:interwiki:Article|]]
10782 [[interwiki:Bar:Article|]]
10783 [[:interwiki:Bar:Article|]]
10784 !! html
10785 [[interwiki:Article|Article]]
10786 [[:interwiki:Article|Article]]
10787 [[interwiki:Bar:Article|Bar:Article]]
10788 [[:interwiki:Bar:Article|Bar:Article]]
10789 !! end
10790
10791 !! test
10792 pre-save transform: context links ("pipe trick") with parens in title
10793 !! options
10794 pst title=[[Somearticle (context)]]
10795 !! wikitext
10796 [[|Article]]
10797 !! html
10798 [[Article (context)|Article]]
10799 !! end
10800
10801 !! test
10802 pre-save transform: context links ("pipe trick") with comma in title
10803 !! options
10804 pst title=[[Someplace, Somewhere]]
10805 !! wikitext
10806 [[|Otherplace]]
10807 [[Otherplace, Elsewhere|]]
10808 [[Otherplace, Elsewhere, Anywhere|]]
10809 !! html
10810 [[Otherplace, Somewhere|Otherplace]]
10811 [[Otherplace, Elsewhere|Otherplace]]
10812 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
10813 !! end
10814
10815 !! test
10816 pre-save transform: context links ("pipe trick") with parens and comma
10817 !! options
10818 pst title=[[Someplace (IGNORED), Somewhere]]
10819 !! wikitext
10820 [[|Otherplace]]
10821 [[Otherplace (place), Elsewhere|]]
10822 !! html
10823 [[Otherplace, Somewhere|Otherplace]]
10824 [[Otherplace (place), Elsewhere|Otherplace]]
10825 !! end
10826
10827 !! test
10828 pre-save transform: context links ("pipe trick") with comma and parens
10829 !! options
10830 pst title=[[Who, me? (context)]]
10831 !! wikitext
10832 [[|Yes, you.]]
10833 [[Me, Myself, and I (1937 song)|]]
10834 !! html
10835 [[Yes, you. (context)|Yes, you.]]
10836 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
10837 !! end
10838
10839 !! test
10840 pre-save transform: context links ("pipe trick") with namespace
10841 !! options
10842 pst title=[[Ns:Somearticle]]
10843 !! wikitext
10844 [[|Article]]
10845 !! html
10846 [[Ns:Article|Article]]
10847 !! end
10848
10849 !! test
10850 pre-save transform: context links ("pipe trick") with namespace and parens
10851 !! options
10852 pst title=[[Ns:Somearticle (context)]]
10853 !! wikitext
10854 [[|Article]]
10855 !! html
10856 [[Ns:Article (context)|Article]]
10857 !! end
10858
10859 !! test
10860 pre-save transform: context links ("pipe trick") with namespace and comma
10861 !! options
10862 pst title=[[Ns:Somearticle, Context, Whatever]]
10863 !! wikitext
10864 [[|Article]]
10865 !! html
10866 [[Ns:Article, Context, Whatever|Article]]
10867 !! end
10868
10869 !! test
10870 pre-save transform: context links ("pipe trick") with namespace, comma and parens
10871 !! options
10872 pst title=[[Ns:Somearticle, Context (context)]]
10873 !! wikitext
10874 [[|Article]]
10875 !! html
10876 [[Ns:Article (context)|Article]]
10877 !! end
10878
10879 !! test
10880 pre-save transform: context links ("pipe trick") with namespace, parens and comma
10881 !! options
10882 pst title=[[Ns:Somearticle (IGNORED), Context]]
10883 !! wikitext
10884 [[|Article]]
10885 !! html
10886 [[Ns:Article, Context|Article]]
10887 !! end
10888
10889 !! test
10890 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
10891 !! options
10892 pst
10893 !! wikitext
10894 [[Article(context)|]]
10895 [[Bar:Article(context)|]]
10896 [[:Bar:Article(context)|]]
10897 [[|Article(context)]]
10898 [[Bar:X(Y)Z|]]
10899 [[:Bar:X(Y)Z|]]
10900 !! html
10901 [[Article(context)|Article]]
10902 [[Bar:Article(context)|Article]]
10903 [[:Bar:Article(context)|Article]]
10904 [[Article(context)]]
10905 [[Bar:X(Y)Z|X(Y)Z]]
10906 [[:Bar:X(Y)Z|X(Y)Z]]
10907 !! end
10908
10909 !! test
10910 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
10911 !! options
10912 pst
10913 !! wikitext
10914 [[Article (context)|]]
10915 [[Bar:Article (context)|]]
10916 [[:Bar:Article (context)|]]
10917 [[|Article (context)]]
10918 [[Bar:X (Y) Z|]]
10919 [[:Bar:X (Y) Z|]]
10920 !! html
10921 [[Article (context)|Article]]
10922 [[Bar:Article (context)|Article]]
10923 [[:Bar:Article (context)|Article]]
10924 [[Article (context)]]
10925 [[Bar:X (Y) Z|X (Y) Z]]
10926 [[:Bar:X (Y) Z|X (Y) Z]]
10927 !! end
10928
10929 !! test
10930 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
10931 !! options
10932 pst
10933 !! wikitext
10934 [[Article(context)|]]
10935 [[Bar:Article(context)|]]
10936 [[:Bar:Article(context)|]]
10937 [[|Article(context)]]
10938 [[Bar:X(Y)Z|]]
10939 [[:Bar:X(Y)Z|]]
10940 !! html
10941 [[Article(context)|Article]]
10942 [[Bar:Article(context)|Article]]
10943 [[:Bar:Article(context)|Article]]
10944 [[Article(context)]]
10945 [[Bar:X(Y)Z|X(Y)Z]]
10946 [[:Bar:X(Y)Z|X(Y)Z]]
10947 !! end
10948
10949 !! test
10950 pre-save transform: context links ("pipe trick") with commas (bug 21660)
10951 !! options
10952 pst
10953 !! wikitext
10954 [[Article (context), context|]]
10955 [[Article (context),context|]]
10956 [[Bar:Article (context), context|]]
10957 [[Bar:Article (context),context|]]
10958 [[:Bar:Article (context), context|]]
10959 [[:Bar:Article (context),context|]]
10960 !! html
10961 [[Article (context), context|Article]]
10962 [[Article (context),context|Article]]
10963 [[Bar:Article (context), context|Article]]
10964 [[Bar:Article (context),context|Article]]
10965 [[:Bar:Article (context), context|Article]]
10966 [[:Bar:Article (context),context|Article]]
10967 !! end
10968
10969 !! test
10970 pre-save transform: trim trailing empty lines
10971 !! options
10972 pst
10973 !! wikitext
10974 Empty lines are trimmed
10975
10976
10977
10978
10979 !! html
10980 Empty lines are trimmed
10981 !! end
10982
10983 !! test
10984 pre-save transform: Signature expansion
10985 !! options
10986 pst
10987 !! wikitext
10988 * ~~~
10989 * <noinclude>~~~</noinclude>
10990 * <includeonly>~~~</includeonly>
10991 * <onlyinclude>~~~</onlyinclude>
10992 !! html
10993 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
10994 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
10995 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
10996 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
10997 !! end
10998
10999
11000 !! test
11001 pre-save transform: Signature expansion in nowiki tags (bug 93)
11002 !! options
11003 pst disabled
11004 !! wikitext
11005 Shall not expand:
11006
11007 <nowiki>~~~~</nowiki>
11008
11009 <includeonly><nowiki>~~~~</nowiki></includeonly>
11010
11011 <noinclude><nowiki>~~~~</nowiki></noinclude>
11012
11013 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11014
11015 {{subst:Foo}} shall be converted to FOO
11016
11017 As well as inside noinclude/onlyinclude
11018 <noinclude>{{subst:Foo}}</noinclude>
11019 <onlyinclude>{{subst:Foo}}</onlyinclude>
11020
11021 But not inside includeonly
11022 <includeonly>{{subst:Foo}}</includeonly>
11023 !! html
11024 Shall not expand:
11025
11026 <nowiki>~~~~</nowiki>
11027
11028 <includeonly><nowiki>~~~~</nowiki></includeonly>
11029
11030 <noinclude><nowiki>~~~~</nowiki></noinclude>
11031
11032 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11033
11034 FOO shall be converted to FOO
11035
11036 As well as inside noinclude/onlyinclude
11037 <noinclude>FOO</noinclude>
11038 <onlyinclude>FOO</onlyinclude>
11039
11040 But not inside includeonly
11041 <includeonly>{{subst:Foo}}</includeonly>
11042 !! end
11043
11044 !! test
11045 Parsoid: Recognize nowiki with trailing space in tags
11046 !! options
11047 parsoid=wt2html
11048 !! wikitext
11049 <nowiki ><div>[[foo]]</nowiki >
11050
11051 a<nowiki / >b
11052
11053 c<nowiki />d
11054
11055 e<nowiki/ >f
11056 !! html
11057 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11058 <p>ab</p>
11059 <p>cd</p>
11060 <p>ef</p>
11061 !! end
11062
11063 !! test
11064 Parsoid: Recognize nowiki with odd capitalization
11065 !! options
11066 parsoid=wt2html
11067 !! wikitext
11068 <noWikI ><div>[[foo]]</Nowiki >
11069 !! html
11070 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11071 !! end
11072
11073
11074 !! test
11075 Parsoid: Escape nowiki with trailing space in tags
11076 !! options
11077 parsoid=html2wt
11078 !! wikitext
11079 &lt;nowiki &gt; foo &lt;/nowiki &gt;
11080
11081 a&lt;nowiki /&gt;b
11082
11083 c&lt;nowiki/ &gt;d
11084 !! html
11085 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
11086 <p>a&lt;nowiki /&gt;b</p>
11087 <p>c&lt;nowiki/ &gt;d</p>
11088 !! end
11089
11090 !! test
11091 Parsoid: Escape weird noWikI capitalizations
11092 !! options
11093 parsoid=html2wt
11094 !! wikitext
11095 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
11096 !! html
11097 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
11098 !! end
11099
11100 ###
11101 ### Message transform tests
11102 ###
11103 !! test
11104 message transform: magic variables
11105 !! options
11106 msg
11107 !! wikitext
11108 {{SITENAME}}
11109 !! html
11110 MediaWiki
11111 !! end
11112
11113 !! test
11114 message transform: should not transform wiki markup
11115 !! options
11116 msg
11117 !! wikitext
11118 ''test''
11119 !! html
11120 ''test''
11121 !! end
11122
11123 !! test
11124 message transform: <noinclude> in transcluded template (bug 4926)
11125 !! options
11126 msg
11127 !! wikitext
11128 {{Includes}}
11129 !! html
11130 Foobar
11131 !! end
11132
11133 !! test
11134 message transform: <onlyinclude> in transcluded template (bug 4926)
11135 !! options
11136 msg
11137 !! wikitext
11138 {{Includes2}}
11139 !! html
11140 Foo
11141 !! end
11142
11143 !! test
11144 {{#special:}} page name, known
11145 !! options
11146 msg
11147 !! wikitext
11148 {{#special:Recentchanges}}
11149 !! html
11150 Special:RecentChanges
11151 !! end
11152
11153 !! test
11154 {{#special:}} page name with subpage, known
11155 !! options
11156 msg
11157 !! wikitext
11158 {{#special:Recentchanges/param}}
11159 !! html
11160 Special:RecentChanges/param
11161 !! end
11162
11163 !! test
11164 {{#special:}} page name, unknown
11165 !! options
11166 msg
11167 !! wikitext
11168 {{#special:foobar nonexistent}}
11169 !! html
11170 Special:Foobar nonexistent
11171 !! end
11172
11173 !! test
11174 {{#speciale:}} page name, known
11175 !! options
11176 msg
11177 !! wikitext
11178 {{#speciale:Recentchanges}}
11179 !! html
11180 Special:RecentChanges
11181 !! end
11182
11183 !! test
11184 {{#speciale:}} page name with subpage, known
11185 !! options
11186 msg
11187 !! wikitext
11188 {{#speciale:Recentchanges/param}}
11189 !! html
11190 Special:RecentChanges/param
11191 !! end
11192
11193 !! test
11194 {{#speciale:}} page name, unknown
11195 !! options
11196 msg
11197 !! wikitext
11198 {{#speciale:foobar nonexistent}}
11199 !! html
11200 Special:Foobar_nonexistent
11201 !! end
11202
11203 ###
11204 ### Images
11205 ###
11206 ### For Parsoid-specific tests, see
11207 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11208
11209 !! test
11210 Simple image
11211 !! options
11212 parsoid=wt2html,wt2wt,html2html
11213 !! wikitext
11214 [[Image:foobar.jpg]]
11215 !! html/php
11216 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11217 </p>
11218 !! html/parsoid
11219 <p><span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
11220 !! end
11221
11222 !! test
11223 Simple image (using File: namespace, now canonical)
11224 !! wikitext
11225 [[File:Foobar.jpg]]
11226 !! html/php
11227 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11228 </p>
11229 !! html/parsoid
11230 <p><span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
11231 !! end
11232
11233 !! test
11234 Right-aligned image
11235 !! wikitext
11236 [[File:Foobar.jpg|right]]
11237 !! html/php
11238 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
11239
11240 !! html/parsoid
11241 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></figure>
11242 !! end
11243
11244 !! test
11245 Image with caption
11246 !! wikitext
11247 [[File:Foobar.jpg|right|Caption text]]
11248 !! html/php
11249 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
11250
11251 !! html/parsoid
11252 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
11253 !! end
11254
11255 !! test
11256 Image with caption, bug 53312 #1
11257 !! wikitext
11258 [[File:Foobar.jpg|right|Caption page stuff]]
11259 !! html/php
11260 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page stuff"><img alt="Caption page stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
11261
11262 !! html/parsoid
11263 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption page stuff</figcaption></figure>
11264 !! end
11265
11266 !! test
11267 Image with caption, bug 53312 #2
11268 !! wikitext
11269 [[File:Foobar.jpg|right|Caption page=]]
11270 !! html/php
11271 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page="><img alt="Caption page=" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
11272
11273 !! html/parsoid
11274 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption page=</figcaption></figure>
11275 !! end
11276
11277 !! test
11278 Image with caption, bug 53312 #3
11279 !! wikitext
11280 [[File:Foobar.jpg|right|Caption page=stuff]]
11281 !! html/php
11282 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page=stuff"><img alt="Caption page=stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
11283
11284 !! html/parsoid
11285 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption page=stuff</figcaption></figure>
11286 !! end
11287
11288 !! test
11289 Allow empty links in image captions (Bug 60753)
11290 !! options
11291 thumbsize=220
11292 !! wikitext
11293 [[File:Foobar.jpg|thumb|Caption [[Link1]]
11294 [[]]
11295 [[Link2]]
11296 ]]
11297 !! html/php
11298 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Caption <a href="/index.php?title=Link1&amp;action=edit&amp;redlink=1" class="new" title="Link1 (page does not exist)">Link1</a> [[]] <a href="/index.php?title=Link2&amp;action=edit&amp;redlink=1" class="new" title="Link2 (page does not exist)">Link2</a></div></div></div>
11299
11300 !! html/parsoid
11301 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption [[Link1]]\n[[]]\n[[Link2]]\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption <a rel="mw:WikiLink" href="./Link1" title="Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"}}'>Link1</a>
11302 [[]]
11303 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
11304 </figcaption></figure>
11305 !! end
11306
11307 !! test
11308 Link with empty target
11309 !! wikitext
11310 [[]]
11311 !! html
11312 <p>[[]]
11313 </p>
11314 !! end
11315
11316 !! test
11317 Image with empty attribute
11318 !! options
11319 parsoid=wt2html,wt2wt,html2html
11320 !! wikitext
11321 [[File:Foobar.jpg|right||Caption text]]
11322 !! html/php
11323 <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>
11324
11325 !! html/parsoid
11326 <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>
11327 !! end
11328
11329 !! test
11330 1. Block image with individual attributes from templates
11331 !! wikitext
11332 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
11333 !! html/php
11334 <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>
11335
11336 !! html/parsoid
11337 <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>
11338 !! end
11339
11340 !! test
11341 2. Block Image with individual attributes from templates
11342 !! wikitext
11343 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
11344 !! html/php
11345 <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>
11346
11347 !! html/parsoid
11348 <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>
11349 !! end
11350
11351 !! test
11352 3. Inline image with individual attributes from templates
11353 !! wikitext
11354 [[File:Foobar.jpg|{{echo|50px}}]]
11355 !! html/php
11356 <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>
11357 </p>
11358 !! html/parsoid
11359 <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>
11360 !! end
11361
11362 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
11363 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
11364 !! test
11365 Image with multiple attributes from the same template
11366 !! wikitext
11367 [[File:Foobar.jpg|{{image_attribs}}]]
11368 !! html/php
11369 <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>
11370
11371 !! html/parsoid
11372 <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>
11373 !! end
11374
11375 !! test
11376 Image with link tails
11377 !! options
11378 thumbsize=220
11379 !! wikitext
11380 123[[File:Foobar.jpg]]456
11381 123[[File:Foobar.jpg|right]]456
11382 123[[File:Foobar.jpg|thumb]]456
11383 !! html/php
11384 <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
11385 </p>
11386 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
11387 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
11388
11389 !! html/php+tidy
11390 <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>
11391 <p>123</p>
11392 <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>
11393 <p>456 123</p>
11394 <div class="thumb tright">
11395 <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>
11396 <div class="thumbcaption">
11397 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11398 </div>
11399 </div>
11400 </div>
11401 <p>456</p>
11402 !! html/parsoid
11403 <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>
11404 <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>
11405 <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>
11406 !! end
11407
11408 !! test
11409 Image with multiple captions -- only last one is accepted
11410 !! wikitext
11411 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11412 !! html/php
11413 <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>
11414
11415 !! html/parsoid
11416 <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>
11417 !! end
11418
11419 !! test
11420 Image with multiple widths -- use last
11421 !! wikitext
11422 [[File:Foobar.jpg|200px|300px|caption]]
11423 !! html/php
11424 <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>
11425 </p>
11426 !! html/parsoid
11427 <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>
11428 !! end
11429
11430 !! test
11431 Image with multiple alignments -- use first (bug 48664)
11432 !! options
11433 thumbsize=220
11434 !! wikitext
11435 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11436
11437 [[File:Foobar.jpg|middle|text-top|caption]]
11438 !! html/php
11439 <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>
11440 <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>
11441 </p>
11442 !! html/parsoid
11443 <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>
11444 <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>
11445 !! end
11446
11447 !! test
11448 Image with width attribute at different positions
11449 !! wikitext
11450 [[File:Foobar.jpg|200px|right|Caption]]
11451 [[File:Foobar.jpg|right|200px|Caption]]
11452 [[File:Foobar.jpg|right|Caption|200px]]
11453 !! html/php
11454 <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>
11455 <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>
11456 <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>
11457
11458 !! html/parsoid
11459 <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>
11460 <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>
11461 <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>
11462 !! end
11463
11464 # a sad bit of backward-compatibility
11465 !! test
11466 Image with size specified with pxpx (bug 13500, 51628)
11467 !! options
11468 parsoid=wt2html,wt2wt,html2html
11469 !! wikitext
11470 [[File:Foobar.jpg|20pxpx]]
11471 [[File:Foobar.jpg|200x20pxpx]]
11472 !! html/php
11473 <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>
11474 <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>
11475 </p>
11476 !! html/parsoid
11477 <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>
11478 !! end
11479
11480 !! test
11481 Image with link parameter, wiki target
11482 !! wikitext
11483 [[File:Foobar.jpg|link=Main Page]]
11484 !! html/php
11485 <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>
11486 </p>
11487 !! html/parsoid
11488 <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>
11489 !! end
11490
11491 # parsoid bug 49293 (part 1)
11492 !! test
11493 Image with link parameter, URL target
11494 !! wikitext
11495 [[File:Foobar.jpg|link=http://example.com/]]
11496 !! html/php
11497 <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>
11498 </p>
11499 !! html/parsoid
11500 <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>
11501 !! end
11502
11503 # parsoid bug 49293 (part 2)
11504 !! test
11505 Image with link parameter, protocol-less URL target
11506 !! wikitext
11507 [[File:Foobar.jpg|link=//example.com/]]
11508 !! html/php
11509 <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>
11510 </p>
11511 !! html/parsoid
11512 <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>
11513 !! end
11514
11515 !! test
11516 Image with link parameter, wgExternalLinkTarget
11517 !! wikitext
11518 [[Image:foobar.jpg|link=http://example.com/]]
11519 !! config
11520 wgExternalLinkTarget='foobar'
11521 !! html
11522 <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>
11523 </p>
11524 !! end
11525
11526 !! test
11527 Image with link parameter, wgNoFollowLinks set to false
11528 !! wikitext
11529 [[Image:foobar.jpg|link=http://example.com/]]
11530 !! config
11531 wgNoFollowLinks=false
11532 !! html
11533 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11534 </p>
11535 !! end
11536
11537 !! test
11538 Image with link parameter, wgNoFollowDomainExceptions
11539 !! wikitext
11540 [[Image:foobar.jpg|link=http://example.com/]]
11541 !! config
11542 wgNoFollowDomainExceptions='example.com'
11543 !! html
11544 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11545 </p>
11546 !! end
11547
11548 !! test
11549 Image with link parameter, wgExternalLinkTarget, unnamed parameter
11550 !! wikitext
11551 [[Image:foobar.jpg|link=http://example.com/|Title]]
11552 !! config
11553 wgExternalLinkTarget='foobar'
11554 !! html
11555 <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>
11556 </p>
11557 !! end
11558
11559 !! test
11560 Image with empty link parameter
11561 !! wikitext
11562 [[File:Foobar.jpg|link=]]
11563 !! html/php
11564 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
11565 </p>
11566 !! html/parsoid
11567 <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>
11568 !! end
11569
11570 !! test
11571 Image with link parameter (wiki target) and unnamed parameter
11572 !! wikitext
11573 [[File:Foobar.jpg|link=Main_Page|Title]]
11574 !! html/php
11575 <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>
11576 </p>
11577 !! html/parsoid
11578 <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>
11579 !! end
11580
11581 !! test
11582 Image with link parameter (URL target) and unnamed parameter
11583 !! wikitext
11584 [[File:Foobar.jpg|link=http://example.com/|Title]]
11585 !! html/php
11586 <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>
11587 </p>
11588 !! html/parsoid
11589 <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>
11590 !! end
11591
11592 !! test
11593 Thumbnail image with link parameter
11594 !! options
11595 thumbsize=220
11596 parsoid=wt2html,wt2wt,html2html
11597 !! wikitext
11598 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
11599 !! html/php
11600 <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>
11601
11602 !! html/parsoid
11603 <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>
11604 !! end
11605
11606 !! test
11607 Manually-specified thumbnail image
11608 !! options
11609 thumbsize=220
11610 !! wikitext
11611 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
11612 !! html/php
11613 <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>
11614
11615 !! html/parsoid
11616 <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>
11617 !! end
11618
11619 !! test
11620 Manually-specified thumbnail image with explicit link to wiki page
11621 !! options
11622 thumbsize=220
11623 parsoid=wt2html,wt2wt,html2html
11624 !! wikitext
11625 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
11626 !! html/php
11627 <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>
11628
11629 !! html/parsoid
11630 <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>
11631 !! end
11632
11633 !! test
11634 Manually-specified thumbnail image with explicit link to url
11635 !! options
11636 thumbsize=220
11637 parsoid=wt2html,wt2wt,html2html
11638 !! wikitext
11639 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
11640 !! html/php
11641 <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>
11642
11643 !! html/parsoid
11644 <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>
11645 !! end
11646
11647 !! test
11648 Manually-specified thumbnail image with explicit no link
11649 !! options
11650 thumbsize=220
11651 parsoid=wt2html,wt2wt,html2html
11652 !! wikitext
11653 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
11654 !! html/php
11655 <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>
11656
11657 !! html/parsoid
11658 <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>
11659 !! end
11660
11661 !! test
11662 Manually-specified thumbnail image with explicit link and alt text
11663 !! options
11664 thumbsize=220
11665 parsoid=wt2html,wt2wt,html2html
11666 !! wikitext
11667 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
11668 !! html/php
11669 <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>
11670
11671 !! html/parsoid
11672 <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>
11673 !! end
11674
11675 !! test
11676 Image with frame and link
11677 !! options
11678 parsoid=wt2html,wt2wt,html2html
11679 !! wikitext
11680 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
11681 !! html/php
11682 <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>
11683
11684 !! html/parsoid
11685 <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>
11686 !! end
11687
11688 !! test
11689 Image with frame and link and explicit alt
11690 !! options
11691 parsoid=wt2html,wt2wt,html2html
11692 !! wikitext
11693 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
11694 !! html/php
11695 <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>
11696
11697 !! html/parsoid
11698 <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>
11699 !! end
11700
11701 !! test
11702 Image with wiki markup in implicit alt
11703 !! options
11704 parsoid=wt2html,wt2wt,html2html
11705 !! wikitext
11706 [[Image:Foobar.jpg|testing '''bold''' in alt]]
11707
11708 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
11709 !! html/php
11710 <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>
11711 </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>
11712 </p>
11713 !! html/parsoid
11714 <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>
11715 <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>
11716 !! end
11717
11718 ###################
11719 # Conflicting image format options.
11720 # First option specified should 'win'.
11721 # All three cases in each test should be identical.
11722
11723 !! test
11724 Image with 'frameless' first.
11725 !! options
11726 parsoid=wt2html,wt2wt,html2html
11727 !! wikitext
11728 [[File:Foobar.jpg|frameless|caption]]
11729
11730 [[File:Foobar.jpg|frameless|frame|caption]]
11731
11732 [[File:Foobar.jpg|frameless|thumb|caption]]
11733 !! html/php
11734 <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>
11735 </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>
11736 </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>
11737 </p>
11738 !! html/parsoid
11739 <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>
11740 <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>
11741 <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>
11742 !! end
11743
11744 !! test
11745 Image with 'frame' first.
11746 !! options
11747 parsoid=wt2html,wt2wt,html2html
11748 !! wikitext
11749 [[File:Foobar.jpg|frame|caption]]
11750 [[File:Foobar.jpg|frame|frameless|caption]]
11751 [[File:Foobar.jpg|frame|thumb|caption]]
11752 !! html/php
11753 <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>
11754 <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>
11755 <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>
11756
11757 !! html/parsoid
11758 <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>
11759 <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>
11760 <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>
11761 !! end
11762
11763 !! test
11764 Image with 'thumb' first.
11765 !! options
11766 parsoid=wt2html,wt2wt,html2html
11767 !! wikitext
11768 [[File:Foobar.jpg|thumb|caption]]
11769 [[File:Foobar.jpg|thumb|frameless|caption]]
11770 [[File:Foobar.jpg|thumb|frame|caption]]
11771 !! html/php
11772 <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>
11773 <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>
11774 <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>
11775
11776 !! html/parsoid
11777 <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>
11778 <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>
11779 <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>
11780 !! end
11781
11782 ###################
11783 # Image sizing.
11784 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
11785 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
11786 # Foobar has actual size of 1941x220
11787 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
11788 # a scalable format.
11789 # 2. Framed images always ignore size options; always render at default size.
11790 # 3. "Unspecified format" and border are the only types which can be
11791 # enlarged.
11792
11793 !! test
11794 Image: "unspecified format" and border enlarge
11795 !! options
11796 parsoid=wt2html,wt2wt,html2html
11797 !! wikitext
11798 [[File:Foobar.jpg|2000px]]
11799
11800 [[File:Foobar.jpg|border|2000px]]
11801 !! html/php
11802 <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>
11803 </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>
11804 </p>
11805 !! html/parsoid
11806 <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>
11807 <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>
11808 !! end
11809
11810 !! test
11811 Image: "unspecified format" and border reduce
11812 !! options
11813 parsoid=wt2html,wt2wt,html2html
11814 !! wikitext
11815 [[File:Foobar.jpg|1000px]]
11816
11817 [[File:Foobar.jpg|border|1000px]]
11818 !! html/php
11819 <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>
11820 </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>
11821 </p>
11822 !! html/parsoid
11823 <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>
11824 <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>
11825 !! end
11826
11827 !! test
11828 Image: thumbs reduce
11829 !! options
11830 parsoid=wt2html,wt2wt,html2html
11831 !! wikitext
11832 [[File:Foobar.jpg|thumb|50px]]
11833 !! html/php
11834 <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>
11835
11836 !! html/parsoid
11837 <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>
11838 !! end
11839
11840 !! test
11841 Image: bitmap thumbs can't be enlarged past original size, but vector can.
11842 !! options
11843 parsoid=wt2html,wt2wt,html2html
11844 !! wikitext
11845 [[File:Foobar.jpg|thumb|2000px]]
11846
11847 [[File:Foobar.svg|thumb|2000px]]
11848 !! html/php
11849 <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>
11850 <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>
11851
11852 !! html/parsoid
11853 <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>
11854 <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>
11855 !! end
11856
11857 !! test
11858 Image: frameless can reduce in size
11859 !! options
11860 parsoid=wt2html,wt2wt,html2html
11861 !! wikitext
11862 [[File:Foobar.jpg|frameless|50px]]
11863 !! html/php
11864 <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>
11865 </p>
11866 !! html/parsoid
11867 <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>
11868 !! end
11869
11870 !! test
11871 Image: bitmap frameless can't be enlarged past original size, but vector can
11872 !! options
11873 parsoid=wt2html,wt2wt,html2html
11874 !! wikitext
11875 [[File:Foobar.jpg|frameless|2000px]]
11876
11877 [[File:Foobar.svg|frameless|2000px]]
11878 !! html/php
11879 <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>
11880 </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>
11881 </p>
11882 !! html/parsoid
11883 <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>
11884 <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>
11885 !! end
11886
11887 !! test
11888 Image: framed images are always unscaled.
11889 !! options
11890 parsoid=wt2html,wt2wt,html2html
11891 !! wikitext
11892 [[File:Foobar.jpg|frame]]
11893
11894 [[File:Foobar.jpg|frame|50px]]
11895
11896 [[File:Foobar.jpg|frame|50x50px]]
11897
11898 [[File:Foobar.jpg|frame|2000px]]
11899 !! html/php
11900 <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>
11901 <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>
11902 <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>
11903 <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>
11904
11905 !! html/parsoid
11906 <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>
11907 <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>
11908 <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>
11909 <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>
11910 !! end
11911
11912 ###################
11913
11914 !! test
11915 Link to image page- image page normally doesn't exists, hence edit link
11916 Add test with existing image page
11917 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
11918 !! wikitext
11919 [[:Image:test]]
11920 !! html
11921 <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>
11922 </p>
11923 !! end
11924
11925 !! test
11926 bug 18784 Link to non-existent image page with caption should use caption as link text
11927 !! wikitext
11928 [[:Image:test|caption]]
11929 !! html
11930 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
11931 </p>
11932 !! end
11933
11934 !! test
11935 Frameless image caption with a free URL
11936 !! wikitext
11937 [[File:Foobar.jpg|http://example.com]]
11938 !! html/php
11939 <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>
11940 </p>
11941 !! html/parsoid
11942 <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>
11943 !! end
11944
11945 !! test
11946 Thumbnail image caption with a free URL
11947 !! options
11948 thumbsize=220
11949 !! wikitext
11950 [[File:Foobar.jpg|thumb|http://example.com]]
11951 !! html/php
11952 <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>
11953
11954 !! html/parsoid
11955 <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>
11956 !! end
11957
11958 !! test
11959 Thumbnail image caption with a free URL and explicit alt
11960 !! options
11961 thumbsize=220
11962 parsoid=wt2html,wt2wt,html2html
11963 !! wikitext
11964 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
11965 !! html/php
11966 <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>
11967
11968 !! html/parsoid
11969 <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>
11970 !! end
11971
11972 !! test
11973 SVG thumbnails with no language set
11974 !! options
11975 !! wikitext
11976 [[File:Foobar.svg|thumb|caption]]
11977 !! html/php
11978 <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>
11979
11980 !! html/parsoid
11981 <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>
11982 !! end
11983
11984 !! test
11985 SVG thumbnails with language de
11986 !! options
11987 parsoid=wt2html,wt2wt,html2html
11988 !! wikitext
11989 [[File:Foobar.svg|thumb|caption|lang=de]]
11990 !! html/php
11991 <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>
11992
11993 !! html/parsoid
11994 <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>
11995 !! end
11996
11997 !! test
11998 SVG thumbnails with invalid language code
11999 !! options
12000 parsoid=wt2html,wt2wt,html2html
12001 !! wikitext
12002 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
12003 !! html/php
12004 <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>
12005
12006 !! html/parsoid
12007 <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>
12008 !! end
12009
12010 !! test
12011 BUG 1887: A ISBN with a thumbnail
12012 !! wikitext
12013 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
12014 !! html/php
12015 <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>
12016
12017 !! html/parsoid
12018 <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>
12019 !! end
12020
12021 !! test
12022 BUG 1887: A RFC with a thumbnail
12023 !! wikitext
12024 [[File:Foobar.jpg|thumb|This is RFC 12354]]
12025 !! html/php
12026 <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>
12027
12028 !! html/parsoid
12029 <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>
12030 !! end
12031
12032 !! test
12033 BUG 1887: A mailto link with a thumbnail
12034 !! wikitext
12035 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
12036 !! html/php
12037 <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>
12038
12039 !! html/parsoid
12040 <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>
12041 !! end
12042
12043 # Pending resolution to bug 368
12044 !! test
12045 BUG 648: Frameless image caption with a link
12046 !! wikitext
12047 [[File:Foobar.jpg|text with a [[link]] in it]]
12048 !! html/php
12049 <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>
12050 </p>
12051 !! html/parsoid
12052 <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>
12053 !! end
12054
12055 !! test
12056 BUG 648: Frameless image caption with a link (suffix)
12057 !! wikitext
12058 [[File:Foobar.jpg|text with a [[link]]foo in it]]
12059 !! html/php
12060 <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>
12061 </p>
12062 !! html/parsoid
12063 <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>
12064 !! end
12065
12066 !! test
12067 BUG 648: Frameless image caption with an interwiki link
12068 !! wikitext
12069 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
12070 !! html/php
12071 <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>
12072 </p>
12073 !! html/parsoid
12074 <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>
12075 !! end
12076
12077 !! test
12078 BUG 648: Frameless image caption with a piped interwiki link
12079 !! wikitext
12080 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
12081 !! html/php
12082 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12083 </p>
12084 !! html/parsoid
12085 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[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>
12086 !! end
12087
12088 !! test
12089 Escape HTML special chars in image alt text
12090 !! wikitext
12091 [[File:Foobar.jpg|& < > "]]
12092 !! html/php
12093 <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>
12094 </p>
12095 !! html/parsoid
12096 <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>
12097 !! end
12098
12099 !! test
12100 BUG 499: Alt text should have &#1234;, not &amp;1234;
12101 !! wikitext
12102 [[File:Foobar.jpg|&#9792;]]
12103 !! html/php
12104 <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>
12105 </p>
12106 !! html/parsoid
12107 <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>
12108 !! end
12109
12110 !! test
12111 Broken image caption with link
12112 !! options
12113 parsoid=wt2html,wt2wt,html2html
12114 !! wikitext
12115 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
12116 !! html/php
12117 <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.
12118 </p>
12119 !! html/parsoid
12120 <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>
12121 !! end
12122
12123 !! test
12124 Image caption containing another image
12125 !! wikitext
12126 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
12127 !! html/php
12128 <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>
12129
12130 !! html/parsoid
12131 <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>
12132 !! end
12133
12134 !! test
12135 Image: caption containing a newline
12136 !! wikitext
12137 [[File:Foobar.jpg|This
12138 *is some text]]
12139 !! html/php
12140 <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>
12141 </p>
12142 !! html/parsoid
12143 <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>
12144 !!end
12145
12146 !!test
12147 Image: caption containing leading space
12148 (The leading space should not trigger nowiki escaping in wt2wt mode)
12149 !! wikitext
12150 [[File:Foobar.jpg|thumb| bar]]
12151 !! html/php
12152 <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>
12153
12154 !! html/parsoid
12155 <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>
12156 !!end
12157
12158 !! test
12159 Image: caption containing a table
12160 !! options
12161 parsoid=wt2html,wt2wt,html2html
12162 !! wikitext
12163 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
12164 {|
12165 ! Foo !! Bar
12166 |-
12167 | Foo1 || Bar1
12168 |}
12169 and some more text.]]
12170 !! html/php
12171 <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>
12172
12173 !! html/parsoid
12174 <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
12175 <table>
12176 <tbody>
12177 <tr><th>Foo </th><th>Bar</th></tr>
12178 <tr>
12179 <td>Foo1 </td>
12180 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
12181 !! end
12182
12183 !! test
12184 Bug 3090: External links other than http: in image captions
12185 !! wikitext
12186 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
12187 !! html/php
12188 <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>
12189
12190 !! html/parsoid
12191 <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>
12192 !! end
12193
12194 !! test
12195 Custom class
12196 !! options
12197 parsoid=wt2html,wt2wt,html2html
12198 !! wikitext
12199 [[Image:foobar.jpg|a|class=b]]
12200 !! html/php
12201 <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>
12202 </p>
12203 !! html/parsoid
12204 <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>
12205 !! end
12206
12207 !! test
12208 Localized image handling (1).
12209 !! options
12210 parsoid=wt2html,wt2wt,html2html
12211 language=es
12212 !! wikitext
12213 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
12214 !! html/php
12215 <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>
12216
12217 !! html/parsoid
12218 <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>
12219 !! end
12220
12221 !! test
12222 Localized image handling (2).
12223 !! options
12224 thumbsize=220
12225 parsoid=wt2html,wt2wt,html2html
12226 language=es
12227 !! wikitext
12228 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
12229 !! html/php
12230 <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>
12231
12232 !! html/parsoid
12233 <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>
12234 !! end
12235
12236 !! test
12237 "border", "frameless" and "class" attributes on an image.
12238 !! options
12239 thumbsize=220
12240 parsoid=wt2html,wt2wt,html2html
12241 !! wikitext
12242 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
12243 !! html/php
12244 <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>
12245 </p>
12246 !! html/parsoid
12247 <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>
12248 !! end
12249
12250 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
12251 !! test
12252 Invalid image attributes (bug 62500)
12253 !! options
12254 thumbsize=220
12255 parsoid=wt2html,wt2wt,html2html
12256 !! wikitext
12257 [[File:Foobar.jpg|thumb|float|left|caption]]
12258
12259 [[File:Foobar.jpg|thumb|righ|caption]]
12260
12261 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
12262 !! html/php
12263 <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>
12264 <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>
12265 <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>
12266
12267 !! html/parsoid
12268 <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>
12269 <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>
12270 <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>
12271 !! end
12272
12273 !! article
12274 File:Barfoo.jpg
12275 !! text
12276 #REDIRECT [[File:Barfoo.jpg]]
12277 !! endarticle
12278
12279 # FIXME: Parsoid should run this test -- but we'd need to teach the
12280 # mockAPI about the redirected Barfoo.jpg image.
12281 !! test
12282 Redirected image
12283 !! wikitext
12284 [[Image:Barfoo.jpg]]
12285 !! html/php
12286 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
12287 </p>
12288 !! end
12289
12290 !! test
12291 Missing image with uploads disabled
12292 !! options
12293 wgEnableUploads=0
12294 !! wikitext
12295 [[File:Foobaz.jpg]]
12296 !! html/php
12297 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
12298 </p>
12299 !! html/parsoid
12300 <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>
12301 !! end
12302
12303 # Parsoid-specific testing for images
12304 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12305 # Currently imperfect due to a flaw in the Parsoid testrunner
12306 # Work in progress
12307 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
12308 # image tests.
12309
12310 !! test
12311 Parsoid-specific image handling - simple image with size and middle alignment
12312 !! wikitext
12313 [[File:Foobar.jpg|middle|50px]]
12314 !! html/parsoid
12315 <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>
12316 !! end
12317
12318 !! test
12319 Parsoid-specific image handling - simple image with size, middle alignment,
12320 non-standard namespace alias
12321 !! options
12322 parsoid=wt2wt,wt2html,html2html
12323 !! wikitext
12324 [[Image:Foobar.jpg|middle|50px]]
12325 !! html/parsoid
12326 <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>
12327 !! end
12328
12329 !! test
12330 Parsoid-specific image handling - simple image with size and middle alignment
12331 (existing content)
12332 !! wikitext
12333 [[File:Foobar.jpg|50px|middle]]
12334 !! html/parsoid
12335 <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>
12336 !! end
12337
12338 !! test
12339 Parsoid-specific image handling - simple image with size and middle alignment
12340 and non-standard namespace name
12341 !! options
12342 parsoid=wt2html,wt2wt,html2html
12343 !! wikitext
12344 [[Image:Foobar.jpg|50px|middle]]
12345 !! html/parsoid
12346 <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>
12347 !! end
12348
12349 !! test
12350 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
12351 !! wikitext
12352 [[File:Foobar.jpg|500x10px|baseline|caption]]
12353 !! html/parsoid
12354 <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>
12355 !! end
12356
12357 !! test
12358 Parsoid-specific image handling - simple image with border and size spec
12359 !! wikitext
12360 [[File:Foobar.jpg|50px|border|caption]]
12361 !! html/parsoid
12362 <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>
12363 !! end
12364
12365 !! test
12366 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12367 !! wikitext
12368 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
12369 !! html/parsoid
12370 <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>
12371 !! end
12372
12373 !! test
12374 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12375 (existing content)
12376 !! wikitext
12377 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12378 !! html/parsoid
12379 <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>
12380 !! end
12381
12382 !! test
12383 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12384 !! wikitext
12385 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12386 !! html/parsoid
12387 <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>
12388 !! end
12389
12390 !! test
12391 Parsoid-specific image handling - thumbnail with specific size, halign,
12392 valign, and caption (existing content)
12393 !! wikitext
12394 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12395 !! html/parsoid
12396 <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>
12397 !! end
12398
12399 !! test
12400 Parsoid-specific image handling - framed image with specific size and caption
12401 (size is ignored)
12402 !! options
12403 parsoid=wt2html,wt2wt,html2html
12404 !! wikitext
12405 [[File:Foobar.jpg|frame|500x50px|caption]]
12406 !! html/parsoid
12407 <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>
12408 !! end
12409
12410 !! test
12411 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12412 (size is ignored)
12413 !! options
12414 parsoid=wt2html,wt2wt,html2html
12415 !! wikitext
12416 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12417 !! html/parsoid
12418 <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>
12419 !! end
12420
12421 !! test
12422 Parsoid-specific image handling - frameless image with specific size, border, and caption
12423 !! wikitext
12424 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12425 !! html/parsoid
12426 <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>
12427 !! end
12428
12429 !! test
12430 Parsoid-specific image handling - simple image with a formatted caption
12431 !! wikitext
12432 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12433 !! html/parsoid
12434 <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>
12435 !! end
12436
12437 !! test
12438 Parsoid-specific image handling - caption with a template in it
12439 !! wikitext
12440 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12441 !! html/parsoid
12442 <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>
12443 !! end
12444
12445 !! test
12446 Parsoid-specific image handling - caption with unbalanced tags in it
12447 !! options
12448 parsoid=wt2html,wt2wt,html2html
12449 !! wikitext
12450 foo
12451 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12452 bar
12453 !! html/parsoid
12454 <p>foo</p>
12455 <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>
12456 <p>bar</p>
12457 !! end
12458
12459 !! test
12460 Parsoid-specific image handling - empty caption (1)
12461 !! options
12462 parsoid=wt2html,wt2wt
12463 !! wikitext
12464 [[File:Foobar.jpg|thumb|]]
12465 !! html/parsoid
12466 <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>
12467 !! end
12468
12469 # empty captions don't get serialized unless we're in the "round trip" case
12470 !! test
12471 Parsoid-specific image handling - empty caption (2)
12472 !! options
12473 parsoid=html2wt
12474 !! html/parsoid
12475 <figure class="mw-default-size" typeof="mw:Image/Thumb">
12476 <a href="File:Foobar.jpg">
12477 <img resource="./File:Foobar.jpg"
12478 src="//example.com/images/3/3a/Foobar.jpg"
12479 height="25" width="220"/>
12480 </a>
12481 <figcaption></figcaption>
12482 </figure>
12483 !! wikitext
12484 [[File:Foobar.jpg|thumb]]
12485 !! end
12486
12487 !! test
12488 Parsoid-specific image handling - whitespace caption
12489 !! wikitext
12490 [[File:Foobar.jpg|thumb| ]]
12491 !! html/parsoid
12492 <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>
12493 !! end
12494
12495 !! test
12496 Parsoid-specific image handling - lang option
12497 !! wikitext
12498 foo
12499 [[File:Foobar.svg|lang=de|caption]]
12500 bar
12501 !! html/parsoid
12502 <p>foo
12503 <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>
12504 bar</p>
12505 !! end
12506
12507
12508 ###
12509 ### Subpages
12510 ###
12511 !! article
12512 Subpage test/subpage
12513 !! text
12514 foo
12515 !! endarticle
12516
12517 !! test
12518 Subpage link
12519 !! options
12520 subpage title=[[Subpage test]]
12521 !! wikitext
12522 [[/subpage]]
12523 !! html
12524 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
12525 </p>
12526 !! end
12527
12528 !! test
12529 Subpage noslash link
12530 !! options
12531 subpage title=[[Subpage test]]
12532 !! wikitext
12533 [[/subpage/]]
12534 !! html
12535 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
12536 </p>
12537 !! end
12538
12539 !! article
12540 Subpage test/1/2/subpage
12541 !! text
12542 blah
12543 !! endarticle
12544
12545 !! test
12546 Relative subpage noslash link
12547 !! options
12548 parsoid=wt2wt,wt2html,html2html
12549 subpage title=[[Subpage test/1/2/3/4]]
12550 !! wikitext
12551 [[../../subpage/]]
12552
12553 [[../../subpage]]
12554 !! html/php
12555 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
12556 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
12557 </p>
12558 !! html/parsoid
12559 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
12560 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
12561 !! end
12562
12563 !! test
12564 Parsoid: dot-slash prefixed wikilinks
12565 !! wikitext
12566 [[./foo]]
12567
12568 [[././bar]]
12569
12570 [[././baz/]]
12571 !! html/php
12572 <p>[[./foo]]
12573 </p><p>[[././bar]]
12574 </p><p>[[././baz/]]
12575 </p>
12576 !! html/parsoid
12577 <p>[[./foo]]
12578 </p><p>[[././bar]]
12579 </p><p>[[././baz/]]
12580 </p>
12581 !! end
12582
12583 !! test
12584 Render invalid page names as plain text (bug 51090)
12585 !! wikitext
12586 [[./../foo|bar]]
12587 [[foo�|bar]]
12588 [[foo/.|bar]]
12589 [[foo/..|bar]]
12590 [[foo~~~bar]]
12591 [[foo>bar]]
12592 [[foo[bar]]
12593 [[.]]
12594 [[..]]
12595 [[foo././bar]]
12596
12597 [[{{echo|./../foo}}|bar]]
12598 [[{{echo|foo/.}}|bar]]
12599 [[{{echo|foo/..}}|bar]]
12600 [[{{echo|foo~~~~bar}}]]
12601 [[{{echo|foo>bar}}]]
12602 [[{{echo|foo././bar}}]]
12603 [[{{echo|foo{bar}}]]
12604 [[{{echo|foo}bar}}]]
12605 [[{{echo|foo[bar}}]]
12606 [[{{echo|foo]bar}}]]
12607 [[{{echo|foo<bar}}]]
12608 !!html/php
12609 <p>[[./../foo|bar]]
12610 [[foo�|bar]]
12611 [[foo/.|bar]]
12612 [[foo/..|bar]]
12613 [[foo~~~bar]]
12614 [[foo&gt;bar]]
12615 [[foo[bar]]
12616 [[.]]
12617 [[..]]
12618 [[foo././bar]]
12619 </p><p>[[./../foo|bar]]
12620 [[foo/.|bar]]
12621 [[foo/..|bar]]
12622 [[foo~~~~bar]]
12623 [[foo&gt;bar]]
12624 [[foo././bar]]
12625 [[foo{bar]]
12626 [[foo}bar]]
12627 [[foo[bar]]
12628 [[foo]bar]]
12629 [[foo&lt;bar]]
12630 </p>
12631 !!html/parsoid
12632 <p>[[./../foo|bar]]
12633 [[foo�|bar]]
12634 [[foo/.|bar]]
12635 [[foo/..|bar]]
12636 [[foo~~~bar]]
12637 [[foo>bar]]
12638 [[foo[bar]]
12639 [[.]]
12640 [[..]]
12641 [[foo././bar]]</p>
12642
12643 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
12644 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
12645 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
12646 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
12647 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
12648 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
12649 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
12650 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
12651 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
12652 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
12653 [[<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>
12654 !!end
12655
12656 !! test
12657 Disabled subpages
12658 !! wikitext
12659 [[/subpage]]
12660 !! html
12661 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
12662 </p>
12663 !! end
12664
12665 !! test
12666 BUG 561: {{/Subpage}}
12667 !! options
12668 subpage title=[[Page]]
12669 !! wikitext
12670 {{/Subpage}}
12671 !! html
12672 <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>
12673 </p>
12674 !! end
12675
12676 ###
12677 ### Categories
12678 ###
12679 !! article
12680 Category:MediaWiki User's Guide
12681 !! text
12682 blah
12683 !! endarticle
12684
12685 !! test
12686 Link to category
12687 !! wikitext
12688 [[:Category:MediaWiki User's Guide]]
12689 !! html
12690 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
12691 </p>
12692 !! end
12693
12694 !! test
12695 Simple category
12696 !! options
12697 cat
12698 !! wikitext
12699 [[Category:MediaWiki User's Guide]]
12700 !! html
12701 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12702 !! end
12703
12704 !! test
12705 PAGESINCATEGORY invalid title fatal (r33546 fix)
12706 !! wikitext
12707 {{PAGESINCATEGORY:<bogus>}}
12708 !! html
12709 <p>0
12710 </p>
12711 !! end
12712
12713 !! test
12714 Category with different sort key
12715 !! options
12716 cat
12717 !! wikitext
12718 [[Category:MediaWiki User's Guide|Foo]]
12719 !! html
12720 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12721 !! end
12722
12723 !! test
12724 Category with identical sort key
12725 !! options
12726 cat
12727 !! wikitext
12728 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12729 !! html
12730 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12731 !! end
12732
12733 !! test
12734 Category with empty sort key
12735 !! options
12736 cat
12737 pst
12738 !! wikitext
12739 [[Category:MediaWiki User's Guide|]]
12740 !! html
12741 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12742 !! end
12743
12744 !! test
12745 Category with empty sort key and parentheses
12746 !! options
12747 cat
12748 pst
12749 !! wikitext
12750 [[Category:Foo (bar)|]]
12751 !! html
12752 [[Category:Foo (bar)|Foo]]
12753 !! end
12754
12755 !! test
12756 Category with link tail
12757 !! options
12758 cat
12759 pst
12760 !! wikitext
12761 123[[Category:Foo]]456
12762 !! html
12763 123[[Category:Foo]]456
12764 !! end
12765
12766 !! test
12767 Category with template
12768 !! options
12769 cat
12770 pst
12771 !! wikitext
12772 [[Category:{{echo|Foo}}]]
12773 !! html
12774 [[Category:{{echo|Foo}}]]
12775 !! end
12776
12777 !! test
12778 Category with template in sort key
12779 !! options
12780 cat
12781 pst
12782 !! wikitext
12783 [[Category:Foo|{{echo|Bar}}]]
12784 !! html
12785 [[Category:Foo|{{echo|Bar}}]]
12786 !! end
12787
12788 !! test
12789 Category with template in sort key and title
12790 !! options
12791 cat
12792 pst
12793 !! wikitext
12794 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12795 !! html
12796 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12797 !! end
12798
12799 !! test
12800 Category / paragraph interactions
12801 !! wikitext
12802 Foo [[Category:Baz]] Bar
12803
12804 Foo [[Category:Baz]]
12805 Bar
12806
12807 Foo
12808 [[Category:Baz]]
12809 Bar
12810
12811 Foo
12812 [[Category:Baz]] Bar
12813
12814 Foo
12815 [[Category:Baz]]
12816 [[Category:Baz]]
12817 [[Category:Baz]]
12818 Bar
12819
12820 [[Category:Baz]]
12821 [[Category:Baz]]
12822 [[Category:Baz]]
12823
12824 [[Category:Baz]]
12825 {{echo|[[Category:Baz]]}}
12826 [[Category:Baz]]
12827 !! html
12828 <p>Foo Bar
12829 </p><p>Foo
12830 Bar
12831 </p><p>Foo
12832 Bar
12833 </p><p>Foo Bar
12834 </p><p>Foo
12835 Bar
12836 </p>
12837 !! end
12838
12839 !! test
12840 Parsoid: Serialize link to category page with colon escape
12841 !! options
12842 parsoid
12843 !! wikitext
12844
12845 [[:Category:Foo]]
12846 [[:Category:Foo|Bar]]
12847 !! html
12848 <p>
12849 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
12850 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
12851 </p>
12852 !! end
12853
12854 !! test
12855 Parsoid: Link prefix/suffixes aren't applied to category links
12856 !! options
12857 parsoid=wt2html,wt2wt,html2html
12858 language=is
12859 !! wikitext
12860 x[[Category:Foo]]y
12861 !! html
12862 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
12863 !! end
12864
12865 !! test
12866 Parsoid: Serialize link to file page with colon escape
12867 !! options
12868 parsoid
12869 !! wikitext
12870
12871 [[:File:Foo.png]]
12872 [[:File:Foo.png|Bar]]
12873 !! html
12874 <p>
12875 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
12876 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
12877 </p>
12878 !! end
12879
12880 !! test
12881 Parsoid: Serialize a genuine category link without colon escape
12882 !! options
12883 parsoid
12884 !! wikitext
12885 [[Category:Foo]]
12886 [[Category:Foo|Bar]]
12887 !! html
12888 <link rel="mw:PageProp/Category" href="Category:Foo">
12889 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
12890 !! end
12891
12892 !! test
12893 Normalize hrefs properly before testing for invalid link targets (bug 70894)
12894 !! options
12895 parsoid=html2wt
12896 !! html
12897 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
12898 !! wikitext
12899 [[Category:Toxine bactérienne]]
12900 !! end
12901
12902 !! test
12903 Parsoid: Defaultsort
12904 !! options
12905 parsoid
12906 !! wikitext
12907 {{DEFAULTSORT:Foo}}
12908 !! html
12909 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
12910 !! end
12911
12912 ###
12913 ### Inter-language links
12914 ###
12915 !! test
12916 Interlanguage links
12917 !! options
12918 ill
12919 !! wikitext
12920 [[es:Alimento]]
12921 [[fr:Nourriture]]
12922 [[zh:食品]]
12923 !! html/php
12924 es:Alimento fr:Nourriture zh:食品
12925 !! html/parsoid
12926 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
12927 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
12928 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
12929 !! end
12930
12931 !! test
12932 Duplicate interlanguage links (bug 24502)
12933 !! options
12934 ill
12935 !! wikitext
12936 [[es:1]]
12937 [[es:2]]
12938 [[fr:1]]
12939 [[fr:2]]
12940 !! html/php
12941 es:1 fr:1
12942 !! html/parsoid
12943 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
12944 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
12945 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
12946 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
12947 !! end
12948
12949 ###
12950 ### Sections
12951 ###
12952 !! test
12953 Basic section headings
12954 !! wikitext
12955 == Headline 1 ==
12956 Some text
12957
12958 ==Headline 2==
12959 More
12960 ===Smaller headline===
12961 Blah blah
12962 !! html
12963 <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>
12964 <p>Some text
12965 </p>
12966 <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>
12967 <p>More
12968 </p>
12969 <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>
12970 <p>Blah blah
12971 </p>
12972 !! end
12973
12974 !! test
12975 Section headings with TOC
12976 !! wikitext
12977 == Headline 1 ==
12978 === Subheadline 1 ===
12979 ===== Skipping a level =====
12980 ====== Skipping a level ======
12981
12982 == Headline 2 ==
12983 Some text
12984 ===Another headline===
12985 !! html
12986 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12987 <ul>
12988 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
12989 <ul>
12990 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
12991 <ul>
12992 <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>
12993 <ul>
12994 <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>
12995 </ul>
12996 </li>
12997 </ul>
12998 </li>
12999 </ul>
13000 </li>
13001 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
13002 <ul>
13003 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
13004 </ul>
13005 </li>
13006 </ul>
13007 </div>
13008
13009 <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>
13010 <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>
13011 <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>
13012 <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>
13013 <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>
13014 <p>Some text
13015 </p>
13016 <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>
13017
13018 !! end
13019
13020 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
13021 !! test
13022 Handling of sections up to level 6 and beyond
13023 !! wikitext
13024 = Level 1 Heading=
13025 == Level 2 Heading==
13026 === Level 3 Heading===
13027 ==== Level 4 Heading====
13028 ===== Level 5 Heading=====
13029 ====== Level 6 Heading======
13030 ======= Level 7 Heading=======
13031 ======== Level 8 Heading========
13032 ========= Level 9 Heading=========
13033 ========== Level 10 Heading==========
13034 !! html
13035 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13036 <ul>
13037 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
13038 <ul>
13039 <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>
13040 <ul>
13041 <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>
13042 <ul>
13043 <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>
13044 <ul>
13045 <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>
13046 <ul>
13047 <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>
13048 <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>
13049 <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>
13050 <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>
13051 <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>
13052 </ul>
13053 </li>
13054 </ul>
13055 </li>
13056 </ul>
13057 </li>
13058 </ul>
13059 </li>
13060 </ul>
13061 </li>
13062 </ul>
13063 </div>
13064
13065 <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>
13066 <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>
13067 <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>
13068 <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>
13069 <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>
13070 <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>
13071 <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>
13072 <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>
13073 <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>
13074 <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>
13075
13076 !! end
13077
13078 !! test
13079 TOC regression (bug 9764)
13080 !! wikitext
13081 == title 1 ==
13082 === title 1.1 ===
13083 ==== title 1.1.1 ====
13084 === title 1.2 ===
13085 == title 2 ==
13086 === title 2.1 ===
13087 !! html
13088 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13089 <ul>
13090 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13091 <ul>
13092 <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>
13093 <ul>
13094 <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>
13095 </ul>
13096 </li>
13097 <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>
13098 </ul>
13099 </li>
13100 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13101 <ul>
13102 <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>
13103 </ul>
13104 </li>
13105 </ul>
13106 </div>
13107
13108 <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>
13109 <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>
13110 <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>
13111 <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>
13112 <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>
13113 <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>
13114
13115 !! end
13116
13117 !! test
13118 TOC with wgMaxTocLevel=3 (bug 6204)
13119 !! options
13120 wgMaxTocLevel=3
13121 !! wikitext
13122 == title 1 ==
13123 === title 1.1 ===
13124 ==== title 1.1.1 ====
13125 === title 1.2 ===
13126 == title 2 ==
13127 === title 2.1 ===
13128 !! html
13129 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13130 <ul>
13131 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13132 <ul>
13133 <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>
13134 <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>
13135 </ul>
13136 </li>
13137 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13138 <ul>
13139 <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>
13140 </ul>
13141 </li>
13142 </ul>
13143 </div>
13144
13145 <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>
13146 <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>
13147 <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>
13148 <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>
13149 <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>
13150 <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>
13151
13152 !! end
13153
13154 !! test
13155 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
13156 !! options
13157 wgMaxTocLevel=3
13158 !! wikitext
13159 ==Section 1==
13160 ===Section 1.1===
13161 ====Section 1.1.1====
13162 ====Section 1.1.1.1====
13163 ==Section 2==
13164 !! html
13165 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13166 <ul>
13167 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
13168 <ul>
13169 <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>
13170 </ul>
13171 </li>
13172 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
13173 </ul>
13174 </div>
13175
13176 <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>
13177 <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>
13178 <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>
13179 <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>
13180 <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>
13181
13182 !! end
13183
13184
13185 !! test
13186 Resolving duplicate section names
13187 !! wikitext
13188 == Foo bar ==
13189 == Foo bar ==
13190 !! html
13191 <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>
13192 <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>
13193
13194 !! end
13195
13196 !! test
13197 Resolving duplicate section names with differing case (bug 10721)
13198 !! wikitext
13199 == Foo bar ==
13200 == Foo Bar ==
13201 !! html
13202 <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>
13203 <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>
13204
13205 !! end
13206
13207 !! article
13208 Template:sections
13209 !! text
13210 ===Section 1===
13211 ==Section 2==
13212 !! endarticle
13213
13214 !! test
13215 Template with sections, __NOTOC__
13216 !! wikitext
13217 __NOTOC__
13218 ==Section 0==
13219 {{sections}}
13220 ==Section 4==
13221 !! html
13222 <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>
13223 <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>
13224 <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>
13225 <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>
13226
13227 !! end
13228
13229 !! test
13230 __NOEDITSECTION__ keyword
13231 !! wikitext
13232 __NOEDITSECTION__
13233 ==Section 1==
13234 ==Section 2==
13235 !! html
13236 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
13237 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
13238
13239 !! end
13240
13241 !! test
13242 Link inside a section heading
13243 !! wikitext
13244 ==Section with a [[Main Page|link]] in it==
13245 !! html
13246 <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>
13247
13248 !! end
13249
13250 !! test
13251 TOC regression (bug 12077)
13252 !! wikitext
13253 __TOC__
13254 == title 1 ==
13255 === title 1.1 ===
13256 == title 2 ==
13257 !! html
13258 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13259 <ul>
13260 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13261 <ul>
13262 <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>
13263 </ul>
13264 </li>
13265 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13266 </ul>
13267 </div>
13268
13269 <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>
13270 <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>
13271 <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>
13272
13273 !! end
13274
13275 !! test
13276 BUG 1219 URL next to image (good)
13277 !! wikitext
13278 http://example.com [[Image:foobar.jpg]]
13279 !! html
13280 <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>
13281 </p>
13282 !!end
13283
13284 !! test
13285 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13286 !! wikitext
13287 ===
13288 The line above must have a trailing space!
13289 === <!--
13290 --> <!-- -->
13291 But just in case it doesn't...
13292 !! html
13293 <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>
13294 <p>The line above must have a trailing space!
13295 </p>
13296 <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>
13297 <p>But just in case it doesn't...
13298 </p>
13299 !! end
13300
13301 !! test
13302 Header with special characters (bug 25462)
13303 !! wikitext
13304 The tooltips shall not show entities to the user (ie. be double escaped)
13305
13306 == text > text ==
13307 section 1
13308
13309 == text < text ==
13310 section 2
13311
13312 == text & text ==
13313 section 3
13314
13315 == text ' text ==
13316 section 4
13317
13318 == text " text ==
13319 section 5
13320 !! html
13321 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13322 </p>
13323 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13324 <ul>
13325 <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>
13326 <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>
13327 <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>
13328 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13329 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13330 </ul>
13331 </div>
13332
13333 <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>
13334 <p>section 1
13335 </p>
13336 <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>
13337 <p>section 2
13338 </p>
13339 <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>
13340 <p>section 3
13341 </p>
13342 <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>
13343 <p>section 4
13344 </p>
13345 <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>
13346 <p>section 5
13347 </p>
13348 !! end
13349
13350 !! test
13351 Header with space, plus and underscore as entity
13352 !! wikitext
13353 Id should not contain + for spaces
13354
13355 == Space between Text ==
13356 section 1
13357
13358 == Space-Entity&#32;between&#32;Text ==
13359 section 2
13360
13361 == Plus+between+Text ==
13362 section 3
13363
13364 == Plus-Entity&#43;between&#43;Text ==
13365 section 4
13366
13367 == Underscore_between_Text ==
13368 section 5
13369
13370 == Underscore-Entity&#95;between&#95;Text ==
13371 section 6
13372
13373 [[#Space between Text]]
13374 [[#Space-Entity&#32;between&#32;Text]]
13375 [[#Plus+between+Text]]
13376 [[#Plus-Entity&#43;between&#43;Text]]
13377 [[#Underscore_between_Text]]
13378 [[#Underscore-Entity&#95;between&#95;Text]]
13379 !! html
13380 <p>Id should not contain + for spaces
13381 </p>
13382 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13383 <ul>
13384 <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>
13385 <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>
13386 <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>
13387 <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>
13388 <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>
13389 <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>
13390 </ul>
13391 </div>
13392
13393 <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>
13394 <p>section 1
13395 </p>
13396 <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>
13397 <p>section 2
13398 </p>
13399 <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>
13400 <p>section 3
13401 </p>
13402 <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>
13403 <p>section 4
13404 </p>
13405 <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>
13406 <p>section 5
13407 </p>
13408 <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>
13409 <p>section 6
13410 </p><p><a href="#Space_between_Text">#Space between Text</a>
13411 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
13412 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
13413 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
13414 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
13415 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
13416 </p>
13417 !! end
13418
13419 !! test
13420 Headers with excess '=' characters
13421 (Are similar tests necessary beyond the 1st level?)
13422 !! wikitext
13423 =foo==
13424 ==foo=
13425 =''italic'' heading==
13426 ==''italic'' heading=
13427 !! html
13428 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13429 <ul>
13430 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
13431 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
13432 <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>
13433 <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>
13434 </ul>
13435 </div>
13436
13437 <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>
13438 <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>
13439 <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>
13440 <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>
13441
13442 !! end
13443
13444 !! test
13445 HTML headers vs TOC (bug 23393)
13446 (__NOEDITSECTION__ for clearer output, doesn't matter here)
13447 !! wikitext
13448 <h1>Header 1</h1>
13449 == Header 1.1 ==
13450 == Header 1.2 ==
13451
13452 <h1>Header 2
13453 </h1>
13454 == Header 2.1 ==
13455 == Header 2.2 ==
13456 __NOEDITSECTION__
13457 !! html
13458 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13459 <ul>
13460 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
13461 <ul>
13462 <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>
13463 <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>
13464 </ul>
13465 </li>
13466 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
13467 <ul>
13468 <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>
13469 <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>
13470 </ul>
13471 </li>
13472 </ul>
13473 </div>
13474
13475 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
13476 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
13477 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
13478 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
13479 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
13480 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
13481
13482 !! end
13483
13484 !! test
13485 Single-line or multiline-comments can follow headings
13486 !! options
13487 parsoid=wt2html,wt2wt
13488 !! wikitext
13489 ==foo==<!---->
13490 ==bar==<!--c1-->
13491 ==baz==<!--
13492 c2
13493 c3-->
13494 !! html
13495 <h2><span class="mw-headline" id="foo">foo</span></h2>
13496 <h2><span class="mw-headline" id="bar">bar</span></h2>
13497 <h2><span class="mw-headline" id="baz">baz</span></h2>
13498
13499 !! end
13500
13501 !! test
13502 BUG 1219 URL next to image (broken)
13503 !! wikitext
13504 http://example.com[[Image:foobar.jpg]]
13505 !! html
13506 <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>
13507 </p>
13508 !!end
13509
13510 !! test
13511 Bug 1186 news: in the middle of text
13512 !! wikitext
13513 http://en.wikinews.org/wiki/Wikinews:Workplace
13514 !! html
13515 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
13516 </p>
13517 !!end
13518
13519
13520 !! test
13521 Namespaced link must have a title
13522 !! wikitext
13523 [[Project:]]
13524 !! html
13525 <p>[[Project:]]
13526 </p>
13527 !!end
13528
13529 !! test
13530 Namespaced link must have a title (bad fragment version)
13531 !! wikitext
13532 [[Project:#fragment]]
13533 !! html
13534 <p>[[Project:#fragment]]
13535 </p>
13536 !!end
13537
13538
13539 ###
13540 ### HTML tags and HTML attributes
13541 ###
13542
13543 !! test
13544 div with no attributes
13545 !! wikitext
13546 <div>HTML rocks</div>
13547 !! html
13548 <div>HTML rocks</div>
13549
13550 !! end
13551
13552 !! test
13553 div with double-quoted attribute
13554 !! wikitext
13555 <div id="rock">HTML rocks</div>
13556 !! html
13557 <div id="rock">HTML rocks</div>
13558
13559 !! end
13560
13561 !! test
13562 div with single-quoted attribute
13563 !! wikitext
13564 <div id='rock'>HTML rocks</div>
13565 !! html
13566 <div id="rock">HTML rocks</div>
13567
13568 !! end
13569
13570 !! test
13571 div with unquoted attribute
13572 !! wikitext
13573 <div id=rock>HTML rocks</div>
13574 !! html
13575 <div id="rock">HTML rocks</div>
13576
13577 !! end
13578
13579 !! test
13580 div with illegal double attributes
13581 !! wikitext
13582 <div id="a" id="b">HTML rocks</div>
13583 !! html
13584 <div id="b">HTML rocks</div>
13585
13586 !!end
13587
13588 # FIXME: produce empty string instead of "class" in the PHP parser, following
13589 # the HTML5 spec.
13590 !! test
13591 div with empty attribute value, space before equals
13592 !! options
13593 parsoid
13594 !! wikitext
13595 <div class =>HTML rocks</div>
13596 !! html
13597 <div class="">HTML rocks</div>
13598
13599 !! end
13600
13601 !! test
13602 div with multiple empty attribute values
13603 !! options
13604 parsoid
13605 !! wikitext
13606 <div id= title=>HTML rocks</div>
13607 !! html
13608 <div id="" title="">HTML rocks</div>
13609
13610 !! end
13611
13612 !! test
13613 table with multiple empty attribute values
13614 !! options
13615 parsoid
13616 !! wikitext
13617 {| title= id=
13618 | hi
13619 |}
13620 !! html
13621 <table title="" id="">
13622 <tbody><tr><td> hi</td></tr>
13623 </tbody></table>
13624 !! end
13625
13626 !! test
13627 div with braces in attribute value
13628 !! wikitext
13629 <div title="{}">Foo</div>
13630 !! html/php
13631 <div title="&#123;}">Foo</div>
13632
13633 !! html/parsoid
13634 <div title="{}">Foo</div>
13635 !! end
13636
13637 # This it very inconsistent in the PHP parser: it returns
13638 # class="class" if there is a space between the name and the equal sign (see
13639 # 'div with empty attribute value, space before equals'), but strips the
13640 # attribute completely if the space is missing. We hope that not much content
13641 # depends on this, so are implementing the behavior below in Parsoid for
13642 # consistencies' sake.
13643 # FIXME: fix this behavior in the PHP parser?
13644 !! test
13645 div with empty attribute value, no space before equals
13646 !! options
13647 parsoid=wt2html,html2html
13648 !! wikitext
13649 <div class=>HTML rocks</div>
13650 !! html/php
13651 <div>HTML rocks</div>
13652
13653 !! html/parsoid
13654 <div class="">HTML rocks</div>
13655 !! end
13656
13657 !! test
13658 HTML multiple attributes correction
13659 !! wikitext
13660 <p class="error" class="awesome">Awesome!</p>
13661 !! html
13662 <p class="awesome">Awesome!</p>
13663
13664 !!end
13665
13666 !! test
13667 Table multiple attributes correction
13668 !! wikitext
13669 {|
13670 !+ class="error" class="awesome"| status
13671 |}
13672 !! html
13673 <table>
13674 <tr>
13675 <th class="awesome"> status
13676 </th></tr></table>
13677
13678 !!end
13679
13680 !! test
13681 DIV IN UPPERCASE
13682 !! wikitext
13683 <DIV ID="x">HTML ROCKS</DIV>
13684 !! html
13685 <div id="x">HTML ROCKS</div>
13686
13687 !!end
13688
13689 !! test
13690 Non-ASCII pseudo-tags are rendered as text
13691 !! wikitext
13692 <khyô>
13693 !! html
13694 <p>&lt;khyô&gt;
13695 </p>
13696 !! end
13697
13698 !! test
13699 Pseudo-tag with URL 'name' renders as url link
13700 !! wikitext
13701 <http://example.com/>
13702 !! html
13703 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
13704 </p>
13705 !! end
13706
13707 !! test
13708 text with amp in the middle of nowhere
13709 !! wikitext
13710 Remember AT&T?
13711 !! html
13712 <p>Remember AT&amp;T?
13713 </p>
13714 !! end
13715
13716 !! test
13717 text with character entity: eacute
13718 !! wikitext
13719 I always thought &eacute; was a cute letter.
13720 !! html
13721 <p>I always thought &#233; was a cute letter.
13722 </p>
13723 !! html+tidy
13724 <p>I always thought é was a cute letter.</p>
13725 !! end
13726
13727 !! test
13728 text with entity-escaped character entity-like string: eacute
13729 !! wikitext
13730 I always thought &amp;eacute; was a cute letter.
13731 !! html
13732 <p>I always thought &amp;eacute; was a cute letter.
13733 </p>
13734 !! end
13735
13736 !! test
13737 text with undefined character entity: xacute
13738 !! wikitext
13739 I always thought &xacute; was a cute letter.
13740 !! html
13741 <p>I always thought &amp;xacute; was a cute letter.
13742 </p>
13743 !! end
13744
13745 # TODO: generalize to PHP parser?
13746 !! test
13747 HTML5 tags
13748 !! options
13749 parsoid
13750 !! wikitext
13751 <data value="5">five</data>
13752 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13753 <mark>This highlighted text</mark>
13754 !! html
13755 <p><data value="5">five</data>
13756 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13757 <mark>This highlighted text</mark></p>
13758 !! end
13759
13760 !! test
13761 HTML tag with leading space is parsed as text
13762 !! wikitext
13763 < div>foo< /div>
13764 !! html
13765 <p>&lt; div&gt;foo&lt; /div&gt;
13766 </p>
13767 !! end
13768
13769 ###
13770 ### Nesting tests (see bug 41545, 50604, 51081)
13771 ###
13772
13773 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
13774 # Note that html2wt is considerably more difficult if we use <b> in
13775 # the test case, instead of <big>
13776 !! test
13777 Ensure that HTML adoption agency algorithm is properly implemented.
13778 !! wikitext
13779 <big>X<big>Y</big>Z</big>
13780 !! html
13781 <p><big>X<big>Y</big>Z</big>
13782 </p>
13783 !! end
13784
13785 # This was bug 41545 in the PHP parser.
13786 # Note that tidy doesn't handle this correctly.
13787 !! test
13788 Nesting of <kbd>
13789 !! wikitext
13790 <kbd>X<kbd>Y</kbd>Z</kbd>
13791 !! html
13792 <p><kbd>X<kbd>Y</kbd>Z</kbd>
13793 </p>
13794 !! end
13795
13796 # The following cases were bug 51081 in the PHP parser.
13797 # Note that there are some other nestable tags (b, i, etc) which are
13798 # not covered; see bug 51081 for discussion.
13799
13800 # Note that tidy doesn't handle this correctly.
13801 !! test
13802 Nesting of <em>
13803 !! wikitext
13804 <em>X<em>Y</em>Z</em>
13805 !! html
13806 <p><em>X<em>Y</em>Z</em>
13807 </p>
13808 !! end
13809
13810 # Note that tidy doesn't handle this correctly.
13811 !! test
13812 Nesting of <strong>
13813 !! wikitext
13814 <strong>X<strong>Y</strong>Z</strong>
13815 !! html
13816 <p><strong>X<strong>Y</strong>Z</strong>
13817 </p>
13818 !! end
13819
13820 !! test
13821 Nesting of <q>
13822 !! wikitext
13823 <q>X<q>Y</q>Z</q>
13824 !! html+tidy
13825 <p><q>X<q>Y</q>Z</q></p>
13826 !! end
13827
13828 # Note that tidy doesn't handle this correctly.
13829 !! test
13830 Nesting of <ruby>
13831 !! wikitext
13832 <ruby>X<ruby>Y</ruby>Z</ruby>
13833 !! html
13834 <p><ruby>X<ruby>Y</ruby>Z</ruby>
13835 </p>
13836 !! end
13837
13838 # Note that tidy doesn't handle this correctly.
13839 !! test
13840 Nesting of <bdo>
13841 !! wikitext
13842 <bdo>X<bdo>Y</bdo>Z</bdo>
13843 !! html
13844 <p><bdo>X<bdo>Y</bdo>Z</bdo>
13845 </p>
13846 !! end
13847
13848
13849 ###
13850 ### Media links
13851 ###
13852
13853 !! test
13854 Media link
13855 !! wikitext
13856 [[Media:Foobar.jpg]]
13857 !! html
13858 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
13859 </p>
13860 !! end
13861
13862 !! test
13863 Media link with text
13864 !! wikitext
13865 [[Media:Foobar.jpg|A neat file to look at]]
13866 !! html
13867 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
13868 </p>
13869 !! end
13870
13871 # FIXME: this is still bad HTML tag nesting
13872 !! test
13873 Media link with nasty text
13874 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
13875 !! wikitext
13876 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
13877 !! html
13878 <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>
13879
13880 !! html+tidy
13881 <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>
13882 !! end
13883
13884 !! test
13885 Media link to nonexistent file (bug 1702)
13886 !! wikitext
13887 [[Media:No such.jpg]]
13888 !! html
13889 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
13890 </p>
13891 !! end
13892
13893 !! test
13894 Image link to nonexistent file (bug 1850 - good)
13895 !! wikitext
13896 [[File:No_such.jpg]]
13897 !! html/php
13898 <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>
13899 </p>
13900 !! html/parsoid
13901 <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>
13902 !! end
13903
13904 !! test
13905 :Image link to nonexistent file (bug 1850 - bad)
13906 !! wikitext
13907 [[:Image:No such.jpg]]
13908 !! html/php
13909 <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>
13910 </p>
13911 !! html/parsoid
13912 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
13913 !! end
13914
13915
13916
13917 !! test
13918 Character reference normalization in link text (bug 1938)
13919 !! wikitext
13920 [[Main Page|this&that]]
13921 !! html
13922 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
13923 </p>
13924 !!end
13925
13926 !! article
13927 אַ
13928 !! text
13929 Test for unicode normalization
13930
13931 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
13932 !! endarticle
13933
13934 !! test
13935 (bug 19451) Links should refer to the normalized form.
13936 !! wikitext
13937 [[&#xFB2E;]]
13938 [[&#x5d0;&#x5b7;]]
13939 [[&#x5d0;ַ]]
13940 [[א&#x5b7;]]
13941 [[אַ]]
13942 !! html
13943 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
13944 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
13945 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
13946 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
13947 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
13948 </p>
13949 !! end
13950
13951 !! test
13952 Empty attribute crash test (bug 2067)
13953 !! wikitext
13954 <font color="">foo</font>
13955 !! html
13956 <p><font color="">foo</font>
13957 </p>
13958 !! end
13959
13960 !! test
13961 Empty attribute crash test single-quotes (bug 2067)
13962 !! wikitext
13963 <font color=''>foo</font>
13964 !! html
13965 <p><font color="">foo</font>
13966 </p>
13967 !! end
13968
13969 !! test
13970 Attribute test: equals, then nothing
13971 !! wikitext
13972 <font color=>foo</font>
13973 !! html
13974 <p><font>foo</font>
13975 </p>
13976 !! end
13977
13978 !! test
13979 Attribute test: unquoted value
13980 !! wikitext
13981 <font color=x>foo</font>
13982 !! html
13983 <p><font color="x">foo</font>
13984 </p>
13985 !! end
13986
13987 !! test
13988 Attribute test: unquoted but illegal value (hash)
13989 !! wikitext
13990 <font color=#x>foo</font>
13991 !! html
13992 <p><font color="#x">foo</font>
13993 </p>
13994 !! end
13995
13996 !! test
13997 Attribute test: no value
13998 !! wikitext
13999 <font color>foo</font>
14000 !! html
14001 <p><font color="color">foo</font>
14002 </p>
14003 !! end
14004
14005 !! test
14006 Bug 2095: link with three closing brackets
14007 !! wikitext
14008 [[Main Page]]]
14009 !! html/php
14010 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
14011 </p>
14012 !! html/parsoid
14013 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
14014 !! end
14015
14016 !! test
14017 Bug 2095: link with pipe and three closing brackets
14018 !! wikitext
14019 [[Main Page|link]]]
14020 !! html/php
14021 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
14022 </p>
14023 !! html/parsoid
14024 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
14025 !! end
14026
14027 !! test
14028 Bug 2095: link with pipe and three closing brackets, version 2
14029 !! wikitext
14030 [[Main Page|[http://example.com/]]]
14031 !! html/php
14032 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
14033 </p>
14034 !! html/parsoid
14035 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
14036 !! end
14037
14038
14039 ###
14040 ### Safety
14041 ###
14042
14043 !! article
14044 Template:Dangerous attribute
14045 !! text
14046 " onmouseover="alert(document.cookie)
14047 !! endarticle
14048
14049 !! article
14050 Template:Dangerous style attribute
14051 !! text
14052 border-size: expression(alert(document.cookie))
14053 !! endarticle
14054
14055 !! article
14056 Template:Div style
14057 !! text
14058 <div style="float: right; {{{1}}}">Magic div</div>
14059 !! endarticle
14060
14061 !! test
14062 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
14063 !! wikitext
14064 <div title="{{test}}"></div>
14065 !! html
14066 <div title="This is a test template"></div>
14067
14068 !! end
14069
14070 # Parsoid has enough context to handle this case
14071 !! test
14072 Bug 2304: HTML attribute safety (dangerous template; 2309)
14073 !! wikitext
14074 <div title="{{dangerous attribute}}"></div>
14075 !! html/php
14076 <div title=""></div>
14077
14078 !! html/parsoid
14079 <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>
14080 !! end
14081
14082 !! test
14083 Bug 2304: HTML attribute safety (dangerous style template; 2309)
14084 !! wikitext
14085 <div style="{{dangerous style attribute}}"></div>
14086 !! html
14087 <div style="/* insecure input */"></div>
14088
14089 !! end
14090
14091 !! test
14092 Bug 2304: HTML attribute safety (safe parameter; 2309)
14093 !! wikitext
14094 {{div style|width: 200px}}
14095 !! html
14096 <div style="float: right; width: 200px">Magic div</div>
14097
14098 !! end
14099
14100 !! test
14101 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
14102 !! wikitext
14103 {{div style|width: expression(alert(document.cookie))}}
14104 !! html
14105 <div style="/* insecure input */">Magic div</div>
14106
14107 !! end
14108
14109 !! test
14110 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
14111 !! wikitext
14112 {{div style|"><script>alert(document.cookie)</script>}}
14113 !! html
14114 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14115
14116 !! end
14117
14118 !! test
14119 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
14120 !! wikitext
14121 {{div style|" ><script>alert(document.cookie)</script>}}
14122 !! html
14123 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14124
14125 !! end
14126
14127 !! test
14128 Bug 2304: HTML attribute safety (link)
14129 !! wikitext
14130 <div title="[[Main Page]]"></div>
14131 !! html
14132 <div title="&#91;&#91;Main Page]]"></div>
14133
14134 !! end
14135
14136 !! test
14137 Bug 2304: HTML attribute safety (italics)
14138 !! wikitext
14139 <div title="''foobar''"></div>
14140 !! html
14141 <div title="&#39;&#39;foobar&#39;&#39;"></div>
14142
14143 !! end
14144
14145 !! test
14146 Bug 2304: HTML attribute safety (bold)
14147 !! wikitext
14148 <div title="'''foobar'''"></div>
14149 !! html
14150 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
14151
14152 !! end
14153
14154
14155 !! test
14156 Bug 2304: HTML attribute safety (ISBN)
14157 !! wikitext
14158 <div title="ISBN 1234567890"></div>
14159 !! html
14160 <div title="&#73;SBN 1234567890"></div>
14161
14162 !! end
14163
14164 !! test
14165 Bug 2304: HTML attribute safety (RFC)
14166 !! wikitext
14167 <div title="RFC 1234"></div>
14168 !! html
14169 <div title="&#82;FC 1234"></div>
14170
14171 !! end
14172
14173 !! test
14174 Bug 2304: HTML attribute safety (PMID)
14175 !! wikitext
14176 <div title="PMID 1234567890"></div>
14177 !! html
14178 <div title="&#80;MID 1234567890"></div>
14179
14180 !! end
14181
14182 !! test
14183 Bug 2304: HTML attribute safety (web link)
14184 !! wikitext
14185 <div title="http://example.com/"></div>
14186 !! html
14187 <div title="http&#58;//example.com/"></div>
14188
14189 !! end
14190
14191 !! test
14192 Bug 2304: HTML attribute safety (named web link)
14193 !! wikitext
14194 <div title="[http://example.com/ link]"></div>
14195 !! html
14196 <div title="&#91;http&#58;//example.com/ link]"></div>
14197
14198 !! end
14199
14200 !! test
14201 Bug 3244: HTML attribute safety (extension; safe)
14202 !! wikitext
14203 <div style="<nowiki>background:blue</nowiki>"></div>
14204 !! html
14205 <div style="background:blue"></div>
14206
14207 !! end
14208
14209 !! test
14210 Bug 3244: HTML attribute safety (extension; unsafe)
14211 !! wikitext
14212 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14213 !! html
14214 <div style="/* insecure input */"></div>
14215
14216 !! end
14217
14218 # More MSIE fun discovered by Tom Gilder
14219
14220 !! test
14221 MSIE CSS safety test: spurious slash
14222 !! wikitext
14223 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14224 !! html
14225 <div style="/* insecure input */">evil</div>
14226
14227 !! end
14228
14229 !! test
14230 MSIE CSS safety test: hex code
14231 !! wikitext
14232 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14233 !! html
14234 <div style="/* insecure input */">evil</div>
14235
14236 !! end
14237
14238 !! test
14239 MSIE CSS safety test: comment in url
14240 !! wikitext
14241 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14242 !! html
14243 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14244
14245 !! end
14246
14247 !! test
14248 MSIE CSS safety test: comment in expression
14249 !! wikitext
14250 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14251 !! html
14252 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14253
14254 !! end
14255
14256 !! test
14257 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14258 !! wikitext
14259 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14260 !! html
14261 <p style="/* invalid control char */">A</p>
14262
14263 !! end
14264
14265 !! test
14266 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14267 !! wikitext
14268 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14269 <div style="top:EXPRESSION(alert())">B</div>
14270 !! html
14271 <p style="/* insecure input */">A</p>
14272 <div style="/* insecure input */">B</div>
14273
14274 !! end
14275
14276 !! test
14277 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14278 !! wikitext
14279 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14280 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14281 !! html
14282 <div style="/* insecure input */">A</div>
14283 <p style="/* insecure input */">B</p>
14284
14285 !! end
14286
14287 !! test
14288 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14289 !! wikitext
14290 <div style="background-image:url⁽javascript:alert())">A</div>
14291 <div style="background-image:url₍javascript:alert())">B</div>
14292 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14293 !! html
14294 <div style="/* insecure input */">A</div>
14295 <div style="/* insecure input */">B</div>
14296 <p style="/* insecure input */">C</p>
14297
14298 !! end
14299
14300 !! test
14301 Opera -o-link CSS
14302 !! wikitext
14303 <div
14304 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;"
14305 style="-o-link:attr(title);-o-link-source:current">X</div>
14306 !! html
14307 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14308
14309 !! end
14310
14311 !! test
14312 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14313 !! wikitext
14314 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14315 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14316 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14317 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14318 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14319 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14320 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14321 !! html
14322 <p style="/* insecure input */">A</p>
14323 <p style="/* insecure input */">B</p>
14324 <p style="/* insecure input */">C</p>
14325 <p style="/* insecure input */">D</p>
14326 <p style="/* insecure input */">E</p>
14327 <p style="/* insecure input */">F</p>
14328 <p style="/* insecure input */">G</p>
14329
14330 !! end
14331
14332 !! test
14333 Table attribute legitimate extension
14334 !! wikitext
14335 {|
14336 !+ style="<nowiki>color:blue</nowiki>"| status
14337 |}
14338 !! html
14339 <table>
14340 <tr>
14341 <th style="color:blue"> status
14342 </th></tr></table>
14343
14344 !!end
14345
14346 !! test
14347 Table attribute safety
14348 !! wikitext
14349 {|
14350 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14351 |}
14352 !! html
14353 <table>
14354 <tr>
14355 <th style="/* insecure input */"> status
14356 </th></tr></table>
14357
14358 !! end
14359
14360 !! test
14361 CSS line continuation 1
14362 !! wikitext
14363 <div style="background-image: u\&#10;rl(test.jpg);"></div>
14364 !! html
14365 <div style="/* insecure input */"></div>
14366
14367 !! end
14368
14369 !! test
14370 CSS line continuation 2
14371 !! wikitext
14372 <div style="background-image: u\&#13;rl(test.jpg); "></div>
14373 !! html
14374 <div style="/* insecure input */"></div>
14375
14376 !! end
14377
14378 !! article
14379 Template:Identity
14380 !! text
14381 {{{1}}}
14382 !! endarticle
14383
14384 !! test
14385 Expansion of multi-line templates in attribute values (bug 6255)
14386 !! wikitext
14387 <div style="background: {{identity|#00FF00}}">-</div>
14388 !! html
14389 <div style="background: #00FF00">-</div>
14390
14391 !! end
14392
14393
14394 !! test
14395 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
14396 !! wikitext
14397 <div style="background:
14398 #00FF00">-</div>
14399 !! html/php
14400 <div style="background: #00FF00">-</div>
14401
14402 !! html/parsoid
14403 <div style="background:
14404 #00FF00">-</div>
14405 !! end
14406
14407 !! test
14408 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
14409 !! wikitext
14410 <div style="background: &#10;#00FF00">-</div>
14411 !! html
14412 <div style="background: &#10;#00FF00">-</div>
14413
14414 !! end
14415
14416 !! test
14417 evil <math>-wiki-tags without Extension:Math enabled
14418 !! wikitext
14419 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
14420 !! html+tidy
14421 <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>
14422 !! end
14423
14424 ###
14425 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
14426 ###
14427 !! test
14428 Parser hook: empty input
14429 !! wikitext
14430 <tag></tag>
14431 !! html
14432 <pre>
14433 ''
14434 array (
14435 )
14436 </pre>
14437
14438 !! end
14439
14440 !! test
14441 Parser hook: empty input using terminated empty elements
14442 !! wikitext
14443 <tag/>
14444 !! html
14445 <pre>
14446 NULL
14447 array (
14448 )
14449 </pre>
14450
14451 !! end
14452
14453 !! test
14454 Parser hook: empty input using terminated empty elements (space before)
14455 !! wikitext
14456 <tag />
14457 !! html
14458 <pre>
14459 NULL
14460 array (
14461 )
14462 </pre>
14463
14464 !! end
14465
14466 !! test
14467 Parser hook: basic input
14468 !! wikitext
14469 <tag>input</tag>
14470 !! html
14471 <pre>
14472 'input'
14473 array (
14474 )
14475 </pre>
14476
14477 !! end
14478
14479
14480 !! test
14481 Parser hook: case insensitive
14482 !! wikitext
14483 <TAG>input</TAG>
14484 !! html
14485 <pre>
14486 'input'
14487 array (
14488 )
14489 </pre>
14490
14491 !! end
14492
14493
14494 !! test
14495 Parser hook: case insensitive, redux
14496 !! wikitext
14497 <TaG>input</TAg>
14498 !! html
14499 <pre>
14500 'input'
14501 array (
14502 )
14503 </pre>
14504
14505 !! end
14506
14507 !! test
14508 Parser hook: nested tags
14509 !! options
14510 noxml
14511 !! wikitext
14512 <tag><tag></tag></tag>
14513 !! html
14514 <pre>
14515 '<tag>'
14516 array (
14517 )
14518 </pre>&lt;/tag&gt;
14519
14520 !! end
14521
14522 !! test
14523 Parser hook: basic arguments
14524 !! wikitext
14525 <tag width=200 height = "100" depth = '50' square></tag>
14526 !! html
14527 <pre>
14528 ''
14529 array (
14530 'width' => '200',
14531 'height' => '100',
14532 'depth' => '50',
14533 'square' => 'square',
14534 )
14535 </pre>
14536
14537 !! end
14538
14539 !! test
14540 Parser hook: argument containing a forward slash (bug 5344)
14541 !! wikitext
14542 <tag filename='/tmp/bla'></tag>
14543 !! html
14544 <pre>
14545 ''
14546 array (
14547 'filename' => '/tmp/bla',
14548 )
14549 </pre>
14550
14551 !! end
14552
14553 !! test
14554 Parser hook: empty input using terminated empty elements (bug 2374)
14555 !! wikitext
14556 <tag foo=bar/>text
14557 !! html
14558 <pre>
14559 NULL
14560 array (
14561 'foo' => 'bar',
14562 )
14563 </pre>text
14564
14565 !! end
14566
14567 # </tag> should be output literally since there is no matching tag that begins it
14568 !! test
14569 Parser hook: basic arguments using terminated empty elements (bug 2374)
14570 !! wikitext
14571 <tag width=200 height = "100" depth = '50' square/>
14572 other stuff
14573 </tag>
14574 !! html
14575 <pre>
14576 NULL
14577 array (
14578 'width' => '200',
14579 'height' => '100',
14580 'depth' => '50',
14581 'square' => 'square',
14582 )
14583 </pre>
14584 <p>other stuff
14585 &lt;/tag&gt;
14586 </p>
14587 !! end
14588
14589 ###
14590 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14591 ###
14592
14593 !! test
14594 Parser hook: static parser hook not inside a comment
14595 !! wikitext
14596 <statictag>hello, world</statictag>
14597 <statictag action=flush/>
14598 !! html
14599 <p>hello, world
14600 </p>
14601 !! end
14602
14603
14604 !! test
14605 Parser hook: static parser hook inside a comment
14606 !! wikitext
14607 <!-- <statictag>hello, world</statictag> -->
14608 <statictag action=flush/>
14609 !! html
14610 <p><br />
14611 </p>
14612 !! end
14613
14614 # Nested template calls; this case was broken by Parser.php rev 1.506,
14615 # since reverted.
14616
14617 !! article
14618 Template:One-parameter
14619 !! text
14620 (My parameter is: {{{1}}})
14621 !! endarticle
14622
14623 !! article
14624 Template:Map-one-parameter
14625 !! text
14626 {{{{{1}}}|{{{2}}}}}
14627 !! endarticle
14628
14629 !! test
14630 Nested template calls
14631 !! wikitext
14632 {{Map-one-parameter|One-parameter|param}}
14633 !! html
14634 <p>(My parameter is: param)
14635 </p>
14636 !! end
14637
14638
14639 ###
14640 ### Sanitizer
14641 ###
14642
14643 # HTML+Tidy effectively strips out the empty tags completely
14644 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
14645 # which Tidy would have done for the PHP parser had there been content inside it.
14646 !! test
14647 Sanitizer: Closing of open tags
14648 !! wikitext
14649 <s></s><table></table>
14650 !! html
14651 <s></s><table></table>
14652
14653 !! html/parsoid
14654 <p><s></s></p><table></table>
14655 !! end
14656
14657 !! test
14658 Sanitizer: Closing of open but not closed tags
14659 !! wikitext
14660 <s>foo
14661 !! html
14662 <p><s>foo</s>
14663 </p>
14664 !! end
14665
14666 !! test
14667 Sanitizer: Closing of closed but not open tags
14668 !! wikitext
14669 </s>
14670 !! html
14671 <p>&lt;/s&gt;
14672 </p>
14673 !! end
14674
14675 !! test
14676 Sanitizer: Closing of closed but not open table tags
14677 !! wikitext
14678 Table not started</td></tr></table>
14679 !! html
14680 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
14681 </p>
14682 !! end
14683
14684 !! test
14685 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
14686 !! wikitext
14687 <span id="æ: v">byte</span>[[#æ: v|backlink]]
14688 !! html
14689 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
14690 </p>
14691 !! end
14692
14693 # In HTML5, the restrictions are that id must contain at least one character,
14694 # and must not contain any space characters.
14695 !! test
14696 Sanitizer: Validating the contents of the id attribute (bug 4515)
14697 !! options
14698 disabled
14699 !! wikitext
14700 <br id="" /><br id="a space" />
14701 !! html
14702 Something ...
14703 !! end
14704
14705 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
14706 !! test
14707 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
14708 !! options
14709 disabled
14710 !! wikitext
14711 <br id="foo" /><br id="foo" />
14712 !! html
14713 Something need to be done. foo-2 ?
14714 !! end
14715
14716 !! test
14717 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
14718 !! wikitext
14719 <div itemscope>
14720 <meta itemprop="hello" content="world">
14721 <meta http-equiv="refresh" content="5">
14722 <meta itemprop="hello" http-equiv="refresh" content="5">
14723 <link itemprop="hello" href="{{SERVER}}">
14724 <link rel="stylesheet" href="{{SERVER}}">
14725 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
14726 </div>
14727 !! html
14728 <div itemscope="itemscope">
14729 <p> <meta itemprop="hello" content="world" />
14730 &lt;meta http-equiv="refresh" content="5"&gt;
14731 <meta itemprop="hello" content="5" />
14732 </p>
14733 <link itemprop="hello" href="http&#58;//example.org" />
14734 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
14735 <link itemprop="hello" href="http&#58;//example.org" />
14736 </div>
14737
14738 !! end
14739
14740 !! test
14741 Language converter: output gets cut off unexpectedly (bug 5757)
14742 !! options
14743 language=zh
14744 !! wikitext
14745 this bit is safe: }-
14746
14747 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
14748
14749 then we get cut off here: }-
14750
14751 all additional text is vanished
14752 !! html
14753 <p>this bit is safe: }-
14754 </p><p>but if we add a conversion instance: xxx
14755 </p><p>then we get cut off here: }-
14756 </p><p>all additional text is vanished
14757 </p>
14758 !! end
14759
14760 !! test
14761 Self closed html pairs (bug 5487)
14762 !! options
14763 !! wikitext
14764 <center><font id="bug" />Centered text</center>
14765 <div><font id="bug2" />In div text</div>
14766 !! html
14767 <center>&lt;font id="bug" /&gt;Centered text</center>
14768 <div>&lt;font id="bug2" /&gt;In div text</div>
14769
14770 !! end
14771
14772 #
14773 #
14774 #
14775
14776 !! test
14777 Punctuation: nbsp before exclamation
14778 !! wikitext
14779 C'est grave !
14780 !! html
14781 <p>C'est grave&#160;!
14782 </p>
14783 !! end
14784
14785 !! test
14786 Punctuation: CSS !important (bug 11874)
14787 !! wikitext
14788 <div style="width:50% !important">important</div>
14789 !! html
14790 <div style="width:50% !important">important</div>
14791
14792 !!end
14793
14794 !! test
14795 Punctuation: CSS ! important (bug 11874; with space after)
14796 !! wikitext
14797 <div style="width:50% ! important">important</div>
14798 !! html
14799 <div style="width:50% ! important">important</div>
14800
14801 !!end
14802
14803
14804 !! test
14805 HTML bullet list, closed tags (bug 5497)
14806 !! wikitext
14807 <ul>
14808 <li>One</li>
14809 <li>Two</li>
14810 </ul>
14811 !! html/php
14812 <ul>
14813 <li>One</li>
14814 <li>Two</li>
14815 </ul>
14816
14817 !! html/parsoid
14818 <ul data-parsoid='{"stx":"html"}'>
14819 <li data-parsoid='{"stx":"html"}'>One</li>
14820 <li data-parsoid='{"stx":"html"}'>Two</li>
14821 </ul>
14822
14823 !! end
14824
14825 !! test
14826 HTML bullet list, unclosed tags (bug 5497)
14827 !! wikitext
14828 <ul>
14829 <li>One
14830 <li>Two
14831 </ul>
14832 !! html/php+tidy
14833 <ul>
14834 <li>One</li>
14835 <li>Two</li>
14836 </ul>
14837 !! html/parsoid
14838 <ul data-parsoid='{"stx":"html"}'>
14839 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
14840 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
14841 </ul>
14842
14843 !! end
14844
14845 !! test
14846 HTML ordered list, closed tags (bug 5497)
14847 !! wikitext
14848 <ol>
14849 <li>One</li>
14850 <li>Two</li>
14851 </ol>
14852 !! html/php
14853 <ol>
14854 <li>One</li>
14855 <li>Two</li>
14856 </ol>
14857
14858 !! html/parsoid
14859 <ol data-parsoid='{"stx":"html"}'>
14860 <li data-parsoid='{"stx":"html"}'>One</li>
14861 <li data-parsoid='{"stx":"html"}'>Two</li>
14862 </ol>
14863
14864 !! end
14865
14866 !! test
14867 HTML ordered list, unclosed tags (bug 5497)
14868 !! options
14869 !! wikitext
14870 <ol>
14871 <li>One
14872 <li>Two
14873 </ol>
14874 !! html/php+tidy
14875 <ol>
14876 <li>One</li>
14877 <li>Two</li>
14878 </ol>
14879 !! html/parsoid
14880 <ol data-parsoid='{"stx":"html"}'>
14881 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
14882 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
14883 </ol>
14884
14885 !! end
14886
14887 !! test
14888 HTML nested bullet list, closed tags (bug 5497)
14889 !! wikitext
14890 <ul>
14891 <li>One</li>
14892 <li>Two:
14893 <ul>
14894 <li>Sub-one</li>
14895 <li>Sub-two</li>
14896 </ul>
14897 </li>
14898 </ul>
14899 !! html
14900 <ul>
14901 <li>One</li>
14902 <li>Two:
14903 <ul>
14904 <li>Sub-one</li>
14905 <li>Sub-two</li>
14906 </ul>
14907 </li>
14908 </ul>
14909
14910 !! end
14911
14912 !! test
14913 HTML nested bullet list, open tags (bug 5497)
14914 !! wikitext
14915 <ul>
14916 <li>One
14917 <li>Two:
14918 <ul>
14919 <li>Sub-one
14920 <li>Sub-two
14921 </ul>
14922 </ul>
14923 !! html/php+tidy
14924 <ul>
14925 <li>One</li>
14926 <li>Two:
14927 <ul>
14928 <li>Sub-one</li>
14929 <li>Sub-two</li>
14930 </ul>
14931 </li>
14932 </ul>
14933 !! html/parsoid
14934 <ul>
14935 <li>One
14936 </li>
14937 <li>Two:
14938 <ul>
14939 <li>Sub-one
14940 </li>
14941 <li>Sub-two
14942 </li>
14943 </ul>
14944 </li>
14945 </ul>
14946
14947 !! end
14948
14949 !! test
14950 HTML nested ordered list, closed tags (bug 5497)
14951 !! wikitext
14952 <ol>
14953 <li>One</li>
14954 <li>Two:
14955 <ol>
14956 <li>Sub-one</li>
14957 <li>Sub-two</li>
14958 </ol>
14959 </li>
14960 </ol>
14961 !! html
14962 <ol>
14963 <li>One</li>
14964 <li>Two:
14965 <ol>
14966 <li>Sub-one</li>
14967 <li>Sub-two</li>
14968 </ol>
14969 </li>
14970 </ol>
14971
14972 !! end
14973
14974 !! test
14975 HTML nested ordered list, open tags (bug 5497)
14976 !! wikitext
14977 <ol>
14978 <li>One
14979 <li>Two:
14980 <ol>
14981 <li>Sub-one
14982 <li>Sub-two
14983 </ol>
14984 </ol>
14985 !! html/php
14986 <ol>
14987 <li>One
14988 <li>Two:
14989 <ol>
14990 <li>Sub-one
14991 <li>Sub-two
14992 </ol>
14993 </ol>
14994
14995 !! html/parsoid
14996 <ol>
14997 <li>One
14998 </li>
14999 <li>Two:
15000 <ol>
15001 <li>Sub-one
15002 </li>
15003 <li>Sub-two
15004 </li>
15005 </ol>
15006 </li>
15007 </ol>
15008
15009 !! end
15010
15011 !! test
15012 HTML ordered list item with parameters oddity
15013 !! wikitext
15014 <ol><li id="fragment">One</li>
15015 </ol>
15016 !! html
15017 <ol><li id="fragment">One</li>
15018 </ol>
15019
15020 !! end
15021
15022 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
15023 !!test
15024 bug 5918: autonumbering
15025 !! wikitext
15026 [http://first/] [http://second] [ftp://ftp]
15027
15028 ftp://inlineftp
15029
15030 [mailto:enclosed@mail.tld With target]
15031
15032 [mailto:enclosed@mail.tld]
15033
15034 mailto:inline@mail.tld
15035 !! html/php
15036 <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>
15037 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
15038 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
15039 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
15040 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
15041 </p>
15042 !! html/parsoid
15043 <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>
15044 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
15045 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
15046 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
15047 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
15048 !! end
15049
15050
15051 #
15052 # Security and HTML correctness
15053 # From Nick Jenkins' fuzz testing
15054 #
15055
15056 !! test
15057 Fuzz testing: Parser13
15058 !! wikitext
15059 {|
15060 | http://a|
15061 !! html
15062 <table>
15063 <tr>
15064 <td>
15065 </td>
15066 </tr>
15067 </table>
15068
15069 !! end
15070
15071 !! test
15072 Fuzz testing: Parser14
15073 !! wikitext
15074 == onmouseover= ==
15075 http://__TOC__
15076 !! html
15077 <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>
15078 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15079 <ul>
15080 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15081 </ul>
15082 </div>
15083
15084
15085 !! html+tidy
15086 <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15087 <p>http://</p>
15088 <div id="toc" class="toc">
15089 <div id="toctitle">
15090 <h2>Contents</h2>
15091 </div>
15092 <ul>
15093 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15094 </ul>
15095 </div>
15096 !! end
15097
15098 !! test
15099 Fuzz testing: Parser14-table
15100 !! wikitext
15101 ==a==
15102 {| STYLE=__TOC__
15103 !! html
15104 <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>
15105 <table style="&#95;_TOC&#95;_">
15106 <tr><td></td></tr>
15107 </table>
15108
15109 !! html+tidy
15110 <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>
15111 <table style="__TOC__">
15112 <tr>
15113 <td></td>
15114 </tr>
15115 </table>
15116 !! end
15117
15118 # Known to produce bogus xml (extra </td>)
15119 !! test
15120 Fuzz testing: Parser16
15121 !! options
15122 noxml
15123 !! wikitext
15124 {|
15125 !https://||||||
15126 !! html
15127 <table>
15128 <tr>
15129 <th>https://</th>
15130 <th></th>
15131 <th></th>
15132 <th>
15133 </td>
15134 </tr>
15135 </table>
15136
15137 !! html+tidy
15138 <table>
15139 <tr>
15140 <th>https://</th>
15141 <th></th>
15142 <th></th>
15143 <th></th>
15144 </tr>
15145 </table>
15146 !! end
15147
15148 !! test
15149 Fuzz testing: Parser21
15150 !! wikitext
15151 {|
15152 ! irc://{{ftp://a" onmouseover="alert('hello world');"
15153 |
15154 !! html
15155 <table>
15156 <tr>
15157 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
15158 </th>
15159 <td>
15160 </td>
15161 </tr>
15162 </table>
15163
15164 !! end
15165
15166 !! test
15167 Fuzz testing: Parser22
15168 !! wikitext
15169 http://===r:::https://b
15170
15171 {|
15172 !! html
15173 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
15174 </p>
15175 <table>
15176 <tr><td></td></tr>
15177 </table>
15178
15179 !! end
15180
15181 # Known to produce bad XML for now
15182 !! test
15183 Fuzz testing: Parser24
15184 !! options
15185 noxml
15186 !! wikitext
15187 {|
15188 {{{|
15189 <u CLASS=
15190 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
15191 <br style="onmouseover='alert(document.cookie);' " />
15192
15193 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15194 |
15195 !! html
15196 <table>
15197 {{{|
15198 <u class="&#124;">}}}} &gt;
15199 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
15200
15201 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15202 <tr>
15203 <td></u>
15204 </td>
15205 </tr>
15206 </table>
15207
15208 !! end
15209
15210 # Note: the current result listed for this is not what the original one was,
15211 # but the original bug was JavaScript injection, which is fixed in any case.
15212 # It's not clear that the original result listed was any more correct than the
15213 # current one. Original result:
15214 # <p>{{{|
15215 # </p>
15216 # <li class="&#124;&#124;">
15217 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15218 !!test
15219 Fuzz testing: Parser25 (bug 6055)
15220 !! wikitext
15221 {{{
15222 |
15223 <LI CLASS=||
15224 >
15225 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15226 !! html
15227 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15228 </p>
15229 !! end
15230
15231 !!test
15232 Fuzz testing: URL adjacent extension (with space, clean)
15233 !! wikitext
15234 http://example.com <nowiki>junk</nowiki>
15235 !! html
15236 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15237 </p>
15238 !!end
15239
15240 !!test
15241 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15242 !! wikitext
15243 http://example.com<nowiki>junk</nowiki>
15244 !! html
15245 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15246 </p>
15247 !!end
15248
15249 !!test
15250 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15251 !! wikitext
15252 http://example.com<pre>junk</pre>
15253 !! html
15254 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15255
15256 !! html+tidy
15257 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15258 <pre>
15259 junk
15260 </pre>
15261 !!end
15262
15263 !!test
15264 Fuzz testing: image with bogus manual thumbnail
15265 !! wikitext
15266 [[Image:foobar.jpg|thumbnail= ]]
15267 !! html/php
15268 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
15269
15270 !! html/parsoid
15271 <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>
15272 !!end
15273
15274 !! test
15275 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15276 !! wikitext
15277 <pre dir="&#10;"></pre>
15278 !! html
15279 <pre dir="&#10;"></pre>
15280
15281 !! end
15282
15283 !! test
15284 Parsing optional HTML elements (Bug 6171)
15285 !! options
15286 !! wikitext
15287 <table>
15288 <tr>
15289 <td> Some tabular data</td>
15290 <td> More tabular data ...
15291 <td> And yet som tabular data</td>
15292 </tr>
15293 </table>
15294 !! html
15295 <table>
15296 <tr>
15297 <td> Some tabular data</td>
15298 <td> More tabular data ...
15299 </td><td> And yet som tabular data</td>
15300 </tr>
15301 </table>
15302
15303 !! end
15304
15305 !! test
15306 Correct handling of <td>, <tr> (Bug 6171)
15307 !! options
15308 !! wikitext
15309 <table>
15310 <tr>
15311 <td> Some tabular data</td>
15312 <td> More tabular data ...</td>
15313 <td> And yet som tabular data</td>
15314 </tr>
15315 </table>
15316 !! html
15317 <table>
15318 <tr>
15319 <td> Some tabular data</td>
15320 <td> More tabular data ...</td>
15321 <td> And yet som tabular data</td>
15322 </tr>
15323 </table>
15324
15325 !! end
15326
15327
15328 !! test
15329 Parsing crashing regression (fr:JavaScript)
15330 !! wikitext
15331 </body></x>
15332 !! html
15333 <p>&lt;/body&gt;&lt;/x&gt;
15334 </p>
15335 !! end
15336
15337 !! test
15338 Inline wiki vs wiki block nesting
15339 !! wikitext
15340 '''Bold paragraph
15341
15342 New wiki paragraph
15343 !! html
15344 <p><b>Bold paragraph</b>
15345 </p><p>New wiki paragraph
15346 </p>
15347 !! end
15348
15349 # FIXME: The current php output is documented
15350 # and desired output is the parsoid target.
15351 !! test
15352 Inline HTML vs wiki block nesting
15353 !! wikitext
15354 <b>Bold paragraph
15355
15356 New wiki paragraph
15357 !! html/php
15358 <p><b>Bold paragraph
15359 </p><p>New wiki paragraph</b>
15360 </p>
15361 !! html/parsoid
15362 <p><b>Bold paragraph</b>
15363 </p><p>New wiki paragraph
15364 </p>
15365 !! end
15366
15367 # Original result was this:
15368 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
15369 # </p>
15370 # While that might be marginally more intuitive, maybe, the six-apostrophe
15371 # construct is clearly pathological and the result stated here (which is what
15372 # the parser actually does) is about as reasonable as anything.
15373 !!test
15374 Mixing markup for italics and bold
15375 !! options
15376 !! wikitext
15377 '''bold''''''bold''bolditalics'''''
15378 !! html
15379 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
15380 </p>
15381 !! end
15382
15383
15384 !! article
15385 Xyzzyx
15386 !! text
15387 Article for special page transclusion test
15388 !! endarticle
15389
15390 !! test
15391 Special page transclusion
15392 !! options
15393 !! wikitext
15394 {{Special:Prefixindex/Xyzzyx}}
15395 !! html
15396 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15397
15398 !! end
15399
15400 !! test
15401 Special page transclusion twice (bug 5021)
15402 !! options
15403 !! wikitext
15404 {{Special:Prefixindex/Xyzzyx}}
15405 {{Special:Prefixindex/Xyzzyx}}
15406 !! html
15407 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15408 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15409
15410 !! end
15411
15412 !! test
15413 Transclusion of default MediaWiki message
15414 !! wikitext
15415 {{MediaWiki:Mainpage}}
15416 !! html
15417 <p>Main Page
15418 </p>
15419 !! end
15420
15421 !! test
15422 Transclusion of nonexistent MediaWiki message
15423 !! wikitext
15424 {{MediaWiki:Mainpagexxx}}
15425 !! html
15426 <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>
15427 </p>
15428 !! end
15429
15430 !! test
15431 Transclusion of MediaWiki message with underscore
15432 !! wikitext
15433 {{MediaWiki:history_short}}
15434 !! html
15435 <p>History
15436 </p>
15437 !! end
15438
15439 !! test
15440 Transclusion of MediaWiki message with space
15441 !! wikitext
15442 {{MediaWiki:history short}}
15443 !! html
15444 <p>History
15445 </p>
15446 !! end
15447
15448 !! test
15449 Invalid header with following text
15450 !! wikitext
15451 = x = y
15452 !! html
15453 <p>= x = y
15454 </p>
15455 !! end
15456
15457
15458 !! test
15459 Section extraction test (section 0)
15460 !! options
15461 section=0
15462 !! wikitext
15463 start
15464 ==a==
15465 ===aa===
15466 ====aaa====
15467 ==b==
15468 ===ba===
15469 ===bb===
15470 ====bba====
15471 ===bc===
15472 ==c==
15473 ===ca===
15474 !! html
15475 start
15476 !! end
15477
15478 !! test
15479 Section extraction test (section 1)
15480 !! options
15481 section=1
15482 !! wikitext
15483 start
15484 ==a==
15485 ===aa===
15486 ====aaa====
15487 ==b==
15488 ===ba===
15489 ===bb===
15490 ====bba====
15491 ===bc===
15492 ==c==
15493 ===ca===
15494 !! html
15495 ==a==
15496 ===aa===
15497 ====aaa====
15498 !! end
15499
15500 !! test
15501 Section extraction test (section 2)
15502 !! options
15503 section=2
15504 !! wikitext
15505 start
15506 ==a==
15507 ===aa===
15508 ====aaa====
15509 ==b==
15510 ===ba===
15511 ===bb===
15512 ====bba====
15513 ===bc===
15514 ==c==
15515 ===ca===
15516 !! html
15517 ===aa===
15518 ====aaa====
15519 !! end
15520
15521 !! test
15522 Section extraction test (section 3)
15523 !! options
15524 section=3
15525 !! wikitext
15526 start
15527 ==a==
15528 ===aa===
15529 ====aaa====
15530 ==b==
15531 ===ba===
15532 ===bb===
15533 ====bba====
15534 ===bc===
15535 ==c==
15536 ===ca===
15537 !! html
15538 ====aaa====
15539 !! end
15540
15541 !! test
15542 Section extraction test (section 4)
15543 !! options
15544 section=4
15545 !! wikitext
15546 start
15547 ==a==
15548 ===aa===
15549 ====aaa====
15550 ==b==
15551 ===ba===
15552 ===bb===
15553 ====bba====
15554 ===bc===
15555 ==c==
15556 ===ca===
15557 !! html
15558 ==b==
15559 ===ba===
15560 ===bb===
15561 ====bba====
15562 ===bc===
15563 !! end
15564
15565 !! test
15566 Section extraction test (section 5)
15567 !! options
15568 section=5
15569 !! wikitext
15570 start
15571 ==a==
15572 ===aa===
15573 ====aaa====
15574 ==b==
15575 ===ba===
15576 ===bb===
15577 ====bba====
15578 ===bc===
15579 ==c==
15580 ===ca===
15581 !! html
15582 ===ba===
15583 !! end
15584
15585 !! test
15586 Section extraction test (section 6)
15587 !! options
15588 section=6
15589 !! wikitext
15590 start
15591 ==a==
15592 ===aa===
15593 ====aaa====
15594 ==b==
15595 ===ba===
15596 ===bb===
15597 ====bba====
15598 ===bc===
15599 ==c==
15600 ===ca===
15601 !! html
15602 ===bb===
15603 ====bba====
15604 !! end
15605
15606 !! test
15607 Section extraction test (section 7)
15608 !! options
15609 section=7
15610 !! wikitext
15611 start
15612 ==a==
15613 ===aa===
15614 ====aaa====
15615 ==b==
15616 ===ba===
15617 ===bb===
15618 ====bba====
15619 ===bc===
15620 ==c==
15621 ===ca===
15622 !! html
15623 ====bba====
15624 !! end
15625
15626 !! test
15627 Section extraction test (section 8)
15628 !! options
15629 section=8
15630 !! wikitext
15631 start
15632 ==a==
15633 ===aa===
15634 ====aaa====
15635 ==b==
15636 ===ba===
15637 ===bb===
15638 ====bba====
15639 ===bc===
15640 ==c==
15641 ===ca===
15642 !! html
15643 ===bc===
15644 !! end
15645
15646 !! test
15647 Section extraction test (section 9)
15648 !! options
15649 section=9
15650 !! wikitext
15651 start
15652 ==a==
15653 ===aa===
15654 ====aaa====
15655 ==b==
15656 ===ba===
15657 ===bb===
15658 ====bba====
15659 ===bc===
15660 ==c==
15661 ===ca===
15662 !! html
15663 ==c==
15664 ===ca===
15665 !! end
15666
15667 !! test
15668 Section extraction test (section 10)
15669 !! options
15670 section=10
15671 !! wikitext
15672 start
15673 ==a==
15674 ===aa===
15675 ====aaa====
15676 ==b==
15677 ===ba===
15678 ===bb===
15679 ====bba====
15680 ===bc===
15681 ==c==
15682 ===ca===
15683 !! html
15684 ===ca===
15685 !! end
15686
15687 !! test
15688 Section extraction test (nonexistent section 11)
15689 !! options
15690 section=11
15691 !! wikitext
15692 start
15693 ==a==
15694 ===aa===
15695 ====aaa====
15696 ==b==
15697 ===ba===
15698 ===bb===
15699 ====bba====
15700 ===bc===
15701 ==c==
15702 ===ca===
15703 !! html
15704 !! end
15705
15706 !! test
15707 Section extraction test with bogus heading (section 1)
15708 !! options
15709 section=1
15710 !! wikitext
15711 ==a==
15712 ==bogus== not a legal section
15713 ==b==
15714 !! html
15715 ==a==
15716 ==bogus== not a legal section
15717 !! end
15718
15719 !! test
15720 Section extraction test with bogus heading (section 2)
15721 !! options
15722 section=2
15723 !! wikitext
15724 ==a==
15725 ==bogus== not a legal section
15726 ==b==
15727 !! html
15728 ==b==
15729 !! end
15730
15731 !! test
15732 Section extraction test with comment after heading (section 1)
15733 !! options
15734 section=1
15735 !! wikitext
15736 ==a==
15737 ==b== <!-- -->
15738 ==c==
15739 !! html
15740 ==a==
15741 !! end
15742
15743 !! test
15744 Section extraction test with comment after heading (section 2)
15745 !! options
15746 section=2
15747 !! wikitext
15748 ==a==
15749 ==b== <!-- -->
15750 ==c==
15751 !! html
15752 ==b== <!-- -->
15753 !! end
15754
15755 !! test
15756 Section extraction test with bogus <nowiki> heading (section 1)
15757 !! options
15758 section=1
15759 !! wikitext
15760 ==a==
15761 ==bogus== <nowiki>not a legal section</nowiki>
15762 ==b==
15763 !! html
15764 ==a==
15765 ==bogus== <nowiki>not a legal section</nowiki>
15766 !! end
15767
15768 !! test
15769 Section extraction test with bogus <nowiki> heading (section 2)
15770 !! options
15771 section=2
15772 !! wikitext
15773 ==a==
15774 ==bogus== <nowiki>not a legal section</nowiki>
15775 ==b==
15776 !! html
15777 ==b==
15778 !! end
15779
15780
15781 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
15782 # instead of respecting commented sections
15783 !! test
15784 Section extraction prefixed by comment (section 1)
15785 !! options
15786 section=1
15787 !! wikitext
15788 <!-- -->==sec1==
15789 ==sec2==
15790 !! html
15791 ==sec2==
15792 !!end
15793
15794 !! test
15795 Section extraction prefixed by comment (section 2)
15796 !! options
15797 section=2
15798 !! wikitext
15799 <!-- -->==sec1==
15800 ==sec2==
15801 !! html
15802
15803 !!end
15804
15805
15806 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
15807 # instead of respecting HTML-style headings
15808 !! test
15809 Section extraction, mixed wiki and html (section 1)
15810 !! options
15811 section=1
15812 !! wikitext
15813 <h2>unmarked</h2>
15814 unmarked
15815 ==1==
15816 one
15817 ==2==
15818 two
15819 !! html
15820 ==1==
15821 one
15822 !! end
15823
15824 !! test
15825 Section extraction, mixed wiki and html (section 2)
15826 !! options
15827 section=2
15828 !! wikitext
15829 <h2>unmarked</h2>
15830 unmarked
15831 ==1==
15832 one
15833 ==2==
15834 two
15835 !! html
15836 ==2==
15837 two
15838 !! end
15839
15840
15841 # Formerly testing for bug 3342
15842 !! test
15843 Section extraction, heading surrounded by <noinclude>
15844 !! options
15845 section=1
15846 !! wikitext
15847 <noinclude>==unmarked==</noinclude>
15848 ==marked==
15849 !! html
15850 ==marked==
15851 !!end
15852
15853 # Test behavior of bug 19910
15854 !! test
15855 Sectiion with all-equals
15856 !! options
15857 section=2
15858 !! wikitext
15859 ===
15860 The line above must have a trailing space
15861 === <!--
15862 --> <!-- -->
15863 But just in case it doesn't...
15864 !! html
15865 === <!--
15866 --> <!-- -->
15867 But just in case it doesn't...
15868 !! end
15869
15870 !! test
15871 Section replacement test (section 0)
15872 !! options
15873 replace=0,"xxx"
15874 !! wikitext
15875 start
15876 ==a==
15877 ===aa===
15878 ====aaa====
15879 ==b==
15880 ===ba===
15881 ===bb===
15882 ====bba====
15883 ===bc===
15884 ==c==
15885 ===ca===
15886 !! html
15887 xxx
15888
15889 ==a==
15890 ===aa===
15891 ====aaa====
15892 ==b==
15893 ===ba===
15894 ===bb===
15895 ====bba====
15896 ===bc===
15897 ==c==
15898 ===ca===
15899 !! end
15900
15901 !! test
15902 Section replacement test (section 1)
15903 !! options
15904 replace=1,"xxx"
15905 !! wikitext
15906 start
15907 ==a==
15908 ===aa===
15909 ====aaa====
15910 ==b==
15911 ===ba===
15912 ===bb===
15913 ====bba====
15914 ===bc===
15915 ==c==
15916 ===ca===
15917 !! html
15918 start
15919 xxx
15920
15921 ==b==
15922 ===ba===
15923 ===bb===
15924 ====bba====
15925 ===bc===
15926 ==c==
15927 ===ca===
15928 !! end
15929
15930 !! test
15931 Section replacement test (section 2)
15932 !! options
15933 replace=2,"xxx"
15934 !! wikitext
15935 start
15936 ==a==
15937 ===aa===
15938 ====aaa====
15939 ==b==
15940 ===ba===
15941 ===bb===
15942 ====bba====
15943 ===bc===
15944 ==c==
15945 ===ca===
15946 !! html
15947 start
15948 ==a==
15949 xxx
15950
15951 ==b==
15952 ===ba===
15953 ===bb===
15954 ====bba====
15955 ===bc===
15956 ==c==
15957 ===ca===
15958 !! end
15959
15960 !! test
15961 Section replacement test (section 3)
15962 !! options
15963 replace=3,"xxx"
15964 !! wikitext
15965 start
15966 ==a==
15967 ===aa===
15968 ====aaa====
15969 ==b==
15970 ===ba===
15971 ===bb===
15972 ====bba====
15973 ===bc===
15974 ==c==
15975 ===ca===
15976 !! html
15977 start
15978 ==a==
15979 ===aa===
15980 xxx
15981
15982 ==b==
15983 ===ba===
15984 ===bb===
15985 ====bba====
15986 ===bc===
15987 ==c==
15988 ===ca===
15989 !! end
15990
15991 !! test
15992 Section replacement test (section 4)
15993 !! options
15994 replace=4,"xxx"
15995 !! wikitext
15996 start
15997 ==a==
15998 ===aa===
15999 ====aaa====
16000 ==b==
16001 ===ba===
16002 ===bb===
16003 ====bba====
16004 ===bc===
16005 ==c==
16006 ===ca===
16007 !! html
16008 start
16009 ==a==
16010 ===aa===
16011 ====aaa====
16012 xxx
16013
16014 ==c==
16015 ===ca===
16016 !! end
16017
16018 !! test
16019 Section replacement test (section 5)
16020 !! options
16021 replace=5,"xxx"
16022 !! wikitext
16023 start
16024 ==a==
16025 ===aa===
16026 ====aaa====
16027 ==b==
16028 ===ba===
16029 ===bb===
16030 ====bba====
16031 ===bc===
16032 ==c==
16033 ===ca===
16034 !! html
16035 start
16036 ==a==
16037 ===aa===
16038 ====aaa====
16039 ==b==
16040 xxx
16041
16042 ===bb===
16043 ====bba====
16044 ===bc===
16045 ==c==
16046 ===ca===
16047 !! end
16048
16049 !! test
16050 Section replacement test (section 6)
16051 !! options
16052 replace=6,"xxx"
16053 !! wikitext
16054 start
16055 ==a==
16056 ===aa===
16057 ====aaa====
16058 ==b==
16059 ===ba===
16060 ===bb===
16061 ====bba====
16062 ===bc===
16063 ==c==
16064 ===ca===
16065 !! html
16066 start
16067 ==a==
16068 ===aa===
16069 ====aaa====
16070 ==b==
16071 ===ba===
16072 xxx
16073
16074 ===bc===
16075 ==c==
16076 ===ca===
16077 !! end
16078
16079 !! test
16080 Section replacement test (section 7)
16081 !! options
16082 replace=7,"xxx"
16083 !! wikitext
16084 start
16085 ==a==
16086 ===aa===
16087 ====aaa====
16088 ==b==
16089 ===ba===
16090 ===bb===
16091 ====bba====
16092 ===bc===
16093 ==c==
16094 ===ca===
16095 !! html
16096 start
16097 ==a==
16098 ===aa===
16099 ====aaa====
16100 ==b==
16101 ===ba===
16102 ===bb===
16103 xxx
16104
16105 ===bc===
16106 ==c==
16107 ===ca===
16108 !! end
16109
16110 !! test
16111 Section replacement test (section 8)
16112 !! options
16113 replace=8,"xxx"
16114 !! wikitext
16115 start
16116 ==a==
16117 ===aa===
16118 ====aaa====
16119 ==b==
16120 ===ba===
16121 ===bb===
16122 ====bba====
16123 ===bc===
16124 ==c==
16125 ===ca===
16126 !! html
16127 start
16128 ==a==
16129 ===aa===
16130 ====aaa====
16131 ==b==
16132 ===ba===
16133 ===bb===
16134 ====bba====
16135 xxx
16136
16137 ==c==
16138 ===ca===
16139 !!end
16140
16141 !! test
16142 Section replacement test (section 9)
16143 !! options
16144 replace=9,"xxx"
16145 !! wikitext
16146 start
16147 ==a==
16148 ===aa===
16149 ====aaa====
16150 ==b==
16151 ===ba===
16152 ===bb===
16153 ====bba====
16154 ===bc===
16155 ==c==
16156 ===ca===
16157 !! html
16158 start
16159 ==a==
16160 ===aa===
16161 ====aaa====
16162 ==b==
16163 ===ba===
16164 ===bb===
16165 ====bba====
16166 ===bc===
16167 xxx
16168 !! end
16169
16170 !! test
16171 Section replacement test (section 10)
16172 !! options
16173 replace=10,"xxx"
16174 !! wikitext
16175 start
16176 ==a==
16177 ===aa===
16178 ====aaa====
16179 ==b==
16180 ===ba===
16181 ===bb===
16182 ====bba====
16183 ===bc===
16184 ==c==
16185 ===ca===
16186 !! html
16187 start
16188 ==a==
16189 ===aa===
16190 ====aaa====
16191 ==b==
16192 ===ba===
16193 ===bb===
16194 ====bba====
16195 ===bc===
16196 ==c==
16197 xxx
16198 !! end
16199
16200 !! test
16201 Section replacement test with initial whitespace (bug 13728)
16202 !! options
16203 replace=2,"xxx"
16204 !! wikitext
16205 Preformatted initial line
16206 ==a==
16207 ===a===
16208 !! html
16209 Preformatted initial line
16210 ==a==
16211 xxx
16212 !! end
16213
16214
16215 !! test
16216 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16217 !! options
16218 section=1
16219 !! wikitext
16220 ==a==
16221 a
16222 !! html
16223 ==a==
16224 a
16225 !! end
16226
16227 !! test
16228 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16229 !! options
16230 section=1
16231 !! wikitext
16232 ==a==
16233 a
16234 !! html
16235 ==a==
16236 a
16237 !! end
16238
16239
16240 !! test
16241 Section extraction, <pre> around bogus header (bug 10309)
16242 !! options
16243 noxml section=2
16244 !! wikitext
16245 == Section One ==
16246 <pre>
16247 =======
16248 </pre>
16249
16250 == Section Two ==
16251 stuff
16252 !! html
16253 == Section Two ==
16254 stuff
16255 !! end
16256
16257 !! test
16258 Section replacement, <pre> around bogus header (bug 10309)
16259 !! options
16260 noxml replace=2,"xxx"
16261 !! wikitext
16262 == Section One ==
16263 <pre>
16264 =======
16265 </pre>
16266
16267 == Section Two ==
16268 stuff
16269 !! html
16270 == Section One ==
16271 <pre>
16272 =======
16273 </pre>
16274
16275 xxx
16276 !! end
16277
16278
16279
16280 !! test
16281 Handling of &#x0A; in URLs
16282 !! wikitext
16283 ** irc://&#x0A;a
16284 !! html/php
16285 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16286
16287 !! html/parsoid
16288 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16289 a">irc://
16290 a</a></li></ul></li></ul>
16291 !! end
16292
16293 !! test
16294 Handling of %0A in URLs
16295 !! wikitext
16296 ** irc://%0Aa
16297 !! html/php
16298 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16299
16300 !! html/parsoid
16301 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16302 !! end
16303
16304
16305 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16306 !! test
16307 5 quotes, code coverage +1 line
16308 !! options
16309 parsoid=wt2html
16310 !! wikitext
16311 '''''
16312 !! html/php
16313 !! html/parsoid
16314 <p><b><i></i></b></p>
16315 !! end
16316
16317 # same html as previous, but wikitext adjusted to match parsoid html2wt
16318 # note that wt2html and html2html will put the <i> before the <b>
16319 !! test
16320 5 quotes, code coverage +1 line w/ nowiki (1)
16321 !! options
16322 parsoid=wt2wt,html2wt
16323 !! wikitext
16324 '''''<nowiki/>'''''
16325 !! html/php
16326 <p><i></i>
16327 </p>
16328 !! html/parsoid
16329 <p><b><i></i></b></p>
16330 !! end
16331
16332 # same as previous, just swapping the <i> and <b>
16333 !! test
16334 5 quotes, code coverage +1 line w/ nowiki (2)
16335 !! wikitext
16336 '''''<nowiki/>'''''
16337 !! html/php
16338 <p><i></i>
16339 </p>
16340 !! html/parsoid
16341 <p><i><b></b></i></p>
16342 !! end
16343
16344 !! test
16345 Special:Search page linking.
16346 !! wikitext
16347 {{Special:search}}
16348 !! html
16349 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16350 </p>
16351 !! end
16352
16353 !! test
16354 {{!}} is a magic word
16355 !! wikitext
16356 {{!}} is a magic word there and {{!}} is still a magic word here
16357 !! html/php
16358 <p>| is a magic word there and | is still a magic word here
16359 </p>
16360 !! html/parsoid
16361 <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>
16362 !! end
16363
16364 !! test
16365 Say the magic word
16366 !! options
16367 title=[[Parser test]]
16368 !! wikitext
16369 * {{PAGENAME}}
16370 * {{PAGENAMEE}}
16371 * {{FULLPAGENAME}}
16372 * {{FULLPAGENAMEE}}
16373 * {{BASEPAGENAME}}
16374 * {{BASEPAGENAMEE}}
16375 * {{SUBPAGENAME}}
16376 * {{SUBPAGENAMEE}}
16377 * {{ROOTPAGENAME}}
16378 * {{ROOTPAGENAMEE}}
16379 * {{TALKPAGENAME}}
16380 * {{TALKPAGENAMEE}}
16381 * {{SUBJECTPAGENAME}}
16382 * {{SUBJECTPAGENAMEE}}
16383 * {{NAMESPACEE}}
16384 * {{NAMESPACE}}
16385 * {{NAMESPACENUMBER}}
16386 * {{TALKSPACE}}
16387 * {{TALKSPACEE}}
16388 * {{SUBJECTSPACE}}
16389 * {{SUBJECTSPACEE}}
16390 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
16391 !! html
16392 <ul><li> Parser test</li>
16393 <li> Parser_test</li>
16394 <li> Parser test</li>
16395 <li> Parser_test</li>
16396 <li> Parser test</li>
16397 <li> Parser_test</li>
16398 <li> Parser test</li>
16399 <li> Parser_test</li>
16400 <li> Parser test</li>
16401 <li> Parser_test</li>
16402 <li> Talk:Parser test</li>
16403 <li> Talk:Parser_test</li>
16404 <li> Parser test</li>
16405 <li> Parser_test</li>
16406 <li> </li>
16407 <li> </li>
16408 <li> 0</li>
16409 <li> Talk</li>
16410 <li> Talk</li>
16411 <li> </li>
16412 <li> </li>
16413 <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>
16414
16415 !! end
16416 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
16417
16418 !! test
16419 Gallery
16420 !! wikitext
16421 <gallery>
16422 image1.png |
16423 image2.gif|||||
16424
16425 image3|
16426 image4 |300px| centre
16427 image5.svg| http://///////
16428 [[x|xx]]]]
16429 * image6
16430 </gallery>
16431 !! html
16432 <ul class="gallery mw-gallery-traditional">
16433 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16434 <div class="thumb" style="height: 150px;">Image1.png</div>
16435 <div class="gallerytext">
16436 </div>
16437 </div></li>
16438 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16439 <div class="thumb" style="height: 150px;">Image2.gif</div>
16440 <div class="gallerytext">
16441 <p>||||
16442 </p>
16443 </div>
16444 </div></li>
16445 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16446 <div class="thumb" style="height: 150px;">Image3</div>
16447 <div class="gallerytext">
16448 </div>
16449 </div></li>
16450 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16451 <div class="thumb" style="height: 150px;">Image4</div>
16452 <div class="gallerytext">
16453 <p>300px| centre
16454 </p>
16455 </div>
16456 </div></li>
16457 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16458 <div class="thumb" style="height: 150px;">Image5.svg</div>
16459 <div class="gallerytext">
16460 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
16461 </p>
16462 </div>
16463 </div></li>
16464 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16465 <div class="thumb" style="height: 150px;">* image6</div>
16466 <div class="gallerytext">
16467 </div>
16468 </div></li>
16469 </ul>
16470
16471 !! end
16472
16473 !! test
16474 Gallery (with options)
16475 !! wikitext
16476 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
16477 File:Nonexistant.jpg|caption
16478 File:Nonexistant.jpg
16479 image:foobar.jpg|some '''caption''' [[Main Page]]
16480 image:foobar.jpg
16481 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
16482 </gallery>
16483 !! html
16484 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
16485 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
16486 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16487 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
16488 <div class="gallerytext">
16489 <p>caption
16490 </p>
16491 </div>
16492 </div></li>
16493 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16494 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
16495 <div class="gallerytext">
16496 </div>
16497 </div></li>
16498 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16499 <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>
16500 <div class="gallerytext">
16501 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16502 </p>
16503 </div>
16504 </div></li>
16505 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16506 <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>
16507 <div class="gallerytext">
16508 </div>
16509 </div></li>
16510 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16511 <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>
16512 <div class="gallerytext">
16513 <p>Blabla|blabla.
16514 </p>
16515 </div>
16516 </div></li>
16517 </ul>
16518
16519 !! end
16520
16521 !! test
16522 Gallery with link that has fragment
16523 !! wikitext
16524 <gallery>
16525 image:foobar.jpg|link=Main_Page
16526 image:foobar.jpg|link=Main_Page#section
16527 image:foobar.jpg|link=Main Page#section|caption
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="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>
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="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>
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/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>
16543 <div class="gallerytext">
16544 <p>caption
16545 </p>
16546 </div>
16547 </div></li>
16548 </ul>
16549
16550 !! end
16551
16552 !! test
16553 Gallery with wikitext inside caption
16554 !! wikitext
16555 <gallery>
16556 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
16557 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
16558 </gallery>
16559 !! html
16560 <ul class="gallery mw-gallery-traditional">
16561 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16562 <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>
16563 <div class="gallerytext">
16564 <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>
16565 </p>
16566 </div>
16567 </div></li>
16568 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16569 <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>
16570 <div class="gallerytext">
16571 <p>This is a test template
16572 </p>
16573 </div>
16574 </div></li>
16575 </ul>
16576
16577 !! end
16578
16579 !! test
16580 gallery (with showfilename option)
16581 !! wikitext
16582 <gallery showfilename>
16583 File:Nonexistant.jpg|caption
16584 File:Nonexistant.jpg
16585 image:foobar.jpg|some '''caption''' [[Main Page]]
16586 File:Foobar.jpg
16587 </gallery>
16588 !! html
16589 <ul class="gallery mw-gallery-traditional">
16590 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16591 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16592 <div class="gallerytext">
16593 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
16594 caption
16595 </p>
16596 </div>
16597 </div></li>
16598 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16599 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16600 <div class="gallerytext">
16601 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
16602 </p>
16603 </div>
16604 </div></li>
16605 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16606 <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>
16607 <div class="gallerytext">
16608 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16609 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16610 </p>
16611 </div>
16612 </div></li>
16613 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16614 <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>
16615 <div class="gallerytext">
16616 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16617 </p>
16618 </div>
16619 </div></li>
16620 </ul>
16621
16622 !! end
16623
16624 !! test
16625 Gallery (with namespace-less filenames)
16626 !! wikitext
16627 <gallery>
16628 File:Nonexistant.jpg
16629 Nonexistant.jpg
16630 image:foobar.jpg
16631 foobar.jpg
16632 </gallery>
16633 !! html
16634 <ul class="gallery mw-gallery-traditional">
16635 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16636 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16637 <div class="gallerytext">
16638 </div>
16639 </div></li>
16640 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16641 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16642 <div class="gallerytext">
16643 </div>
16644 </div></li>
16645 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16646 <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>
16647 <div class="gallerytext">
16648 </div>
16649 </div></li>
16650 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16651 <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>
16652 <div class="gallerytext">
16653 </div>
16654 </div></li>
16655 </ul>
16656
16657 !! end
16658
16659 !! test
16660 HTML Hex character encoding (spells the word "JavaScript")
16661 !! options
16662 parsoid=wt2html,wt2wt,html2html
16663 !! wikitext
16664 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
16665 !! html/php
16666 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
16667 </p>
16668 !! html/php+tidy
16669 <p>JavaScript</p>
16670 !! html/parsoid
16671 <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>
16672 !! end
16673
16674 !! test
16675 HTML Hex character encoding bogus encoding (bug 26437 regression check)
16676 !! wikitext
16677 &#xsee;&#XSEE;
16678 !! html/php
16679 <p>&amp;#xsee;&amp;#XSEE;
16680 </p>
16681 !! html/parsoid
16682 <p>&amp;#xsee;&amp;#XSEE;</p>
16683 !! end
16684
16685 !! test
16686 HTML Hex character encoding mixed case
16687 !! options
16688 parsoid=wt2html,wt2wt,html2html
16689 !! wikitext
16690 &#xEE;&#Xee;
16691 !! html/php
16692 <p>&#xee;&#xee;
16693 </p>
16694 !! html/php+tidy
16695 <p>îî</p>
16696 !! html/parsoid
16697 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
16698 !! end
16699
16700 !! test
16701 __FORCETOC__ override
16702 !! wikitext
16703 __NEWSECTIONLINK__
16704 __FORCETOC__
16705 !! html
16706 <p><br />
16707 </p>
16708 !! end
16709
16710 !! test
16711 ISBN code coverage
16712 !! wikitext
16713 ISBN 978-0-1234-56&#x20;789
16714 !! html
16715 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
16716 </p>
16717 !! html+tidy
16718 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
16719 !! end
16720
16721 !! test
16722 ISBN followed by 5 spaces
16723 !! wikitext
16724 ISBN
16725 !! html
16726 <p>ISBN
16727 </p>
16728 !! end
16729
16730 !! test
16731 Double ISBN
16732 !! wikitext
16733 ISBN ISBN 1234567890
16734 !! html
16735 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16736 </p>
16737 !! end
16738
16739 !! test
16740 ISBN with an X
16741 !! wikitext
16742 ISBN 3-462-04561-X
16743 !! html
16744 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
16745 </p>
16746 !! end
16747
16748 !! test
16749 ISBN with empty prefix (parsoid test)
16750 !! wikitext
16751 ISBN 1234567890
16752 !! html/parsoid
16753 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
16754 !! end
16755
16756 !! test
16757 Bug 22905: <abbr> followed by ISBN followed by </a>
16758 !! wikitext
16759 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
16760 !! html
16761 <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>
16762 </p>
16763 !! end
16764
16765 !! test
16766 Double RFC
16767 !! wikitext
16768 RFC RFC 1234
16769 !! html
16770 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
16771 </p>
16772 !! end
16773
16774 !! test
16775 Double RFC with a wiki link
16776 !! wikitext
16777 RFC [[RFC 1234]]
16778 !! html
16779 <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>
16780 </p>
16781 !! end
16782
16783 !! test
16784 RFC code coverage
16785 !! wikitext
16786 RFC 983&#x20;987
16787 !! html
16788 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
16789 </p>
16790 !! html+tidy
16791 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
16792 !! end
16793
16794 !! test
16795 Centre-aligned image
16796 !! wikitext
16797 [[Image:foobar.jpg|centre]]
16798 !! html
16799 <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>
16800
16801 !!end
16802
16803 !! test
16804 None-aligned image
16805 !! wikitext
16806 [[Image:foobar.jpg|none]]
16807 !! html
16808 <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>
16809
16810 !!end
16811
16812 !! test
16813 Width + Height sized image (using px) (height is ignored)
16814 !! wikitext
16815 [[Image:foobar.jpg|640x480px]]
16816 !! html
16817 <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>
16818 </p>
16819 !!end
16820
16821 !! test
16822 Width-sized image (using px, no following whitespace)
16823 !! wikitext
16824 [[Image:foobar.jpg|640px]]
16825 !! html
16826 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
16827 </p>
16828 !!end
16829
16830 !! test
16831 Width-sized image (using px, with following whitespace - test regression from r39467)
16832 !! wikitext
16833 [[Image:foobar.jpg|640px ]]
16834 !! html
16835 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
16836 </p>
16837 !!end
16838
16839 !! test
16840 Width-sized image (using px, with preceding whitespace - test regression from r39467)
16841 !! wikitext
16842 [[Image:foobar.jpg| 640px]]
16843 !! html
16844 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
16845 </p>
16846 !!end
16847
16848 !! test
16849 Image with page parameter
16850 !! options
16851 djvu
16852 !! wikitext
16853 [[File:LoremIpsum.djvu|page=2]]
16854 !! html/php
16855 <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>
16856 </p>
16857 !! html/parsoid
16858 <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>
16859 !! end
16860
16861 !! test
16862 Another italics / bold test
16863 !! wikitext
16864 ''' ''x'
16865 !! html
16866 <pre>'<i> </i>x'
16867 </pre>
16868 !!end
16869
16870 # FIXME: The php output seems broken. It's interleaving some open/close tags.
16871 !! test
16872 dt/dd/dl test
16873 !! wikitext
16874 :;;;::
16875 !! html/php
16876 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
16877
16878 !! html/parsoid
16879 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
16880
16881 !!end
16882
16883
16884 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
16885 !! test
16886 Images with the "|" character in the comment
16887 !! wikitext
16888 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
16889 !! html/php
16890 <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>
16891
16892 !! html/parsoid
16893 <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>
16894 !! end
16895
16896 !! test
16897 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
16898 !! wikitext
16899 <html><script>alert(1);</script></html>
16900 !! html
16901 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
16902 </p>
16903 !! end
16904
16905 !! test
16906 HTML with raw HTML ($wgRawHtml==true)
16907 !! options
16908 wgRawHtml=1
16909 !! wikitext
16910 <html><script>alert(1);</script></html>
16911 !! html
16912 <p><script>alert(1);</script>
16913 </p>
16914 !! end
16915
16916 !! test
16917 Parents of subpages, one level up
16918 !! options
16919 subpage title=[[Subpage test/L1/L2/L3]]
16920 !! wikitext
16921 [[../|L2]]
16922 !! html
16923 <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>
16924 </p>
16925 !! end
16926
16927
16928 !! test
16929 Parents of subpages, one level up, not named
16930 !! options
16931 subpage title=[[Subpage test/L1/L2/L3]]
16932 !! wikitext
16933 [[../]]
16934 !! html
16935 <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>
16936 </p>
16937 !! end
16938
16939
16940
16941 !! test
16942 Parents of subpages, two levels up
16943 !! options
16944 subpage title=[[Subpage test/L1/L2/L3]]
16945 !! wikitext
16946 [[../../|L1]]2
16947
16948 [[../../|L1]]l
16949 !! html
16950 <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
16951 </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>
16952 </p>
16953 !! end
16954
16955 !! test
16956 Parents of subpages, two levels up, without trailing slash or name.
16957 !! options
16958 subpage title=[[Subpage test/L1/L2/L3]]
16959 !! wikitext
16960 [[../..]]
16961 !! html
16962 <p>[[../..]]
16963 </p>
16964 !! end
16965
16966 !! test
16967 Parents of subpages, two levels up, with lots of extra trailing slashes.
16968 !! options
16969 subpage title=[[Subpage test/L1/L2/L3]]
16970 !! wikitext
16971 [[../../////]]
16972 !! html
16973 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">Subpage test/L1</a>
16974 </p>
16975 !! end
16976
16977 !! article
16978 Subpage test/L1/L2/L3Sibling
16979 !! text
16980 Sibling article
16981 !! endarticle
16982
16983 !! test
16984 Transclusion of a sibling page (one level up)
16985 !! options
16986 subpage title=[[Subpage test/L1/L2/L3]]
16987 !! wikitext
16988 {{../L3Sibling}}
16989 !! html
16990 <p>Sibling article
16991 </p>
16992 !! end
16993
16994 !! test
16995 Transclusion of a child page
16996 !! options
16997 subpage title=[[Subpage test/L1/L2]]
16998 !! wikitext
16999 {{/L3Sibling}}
17000 !! html
17001 <p>Sibling article
17002 </p>
17003 !! end
17004
17005 !! test
17006 Non-transclusion because of too many up levels
17007 !! options
17008 subpage title=[[Subpage test/L1/L2/L3]]
17009 !! wikitext
17010 {{../../../../More than parent}}
17011 !! html
17012 <p>{{../../../../More than parent}}
17013 </p>
17014 !! end
17015
17016 !! test
17017 Definition list code coverage
17018 !! wikitext
17019 ; title : def
17020 ; title : def
17021 ;title: def
17022 !! html/php
17023 <dl><dt> title &#160;</dt>
17024 <dd> def</dd>
17025 <dt> title&#160;</dt>
17026 <dd> def</dd>
17027 <dt>title</dt>
17028 <dd> def</dd></dl>
17029
17030 !! html/parsoid
17031 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17032 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17033 <dt>title</dt><dd> def</dd></dl>
17034 !! end
17035
17036 !! test
17037 Don't fall for the self-closing div
17038 !! wikitext
17039 <div>hello world</div/>
17040 !! html
17041 <div>hello world</div>
17042
17043 !! end
17044
17045 !! test
17046 MSGNW magic word
17047 !! wikitext
17048 {{MSGNW:msg}}
17049 !! html
17050 <p>&#91;&#91;:Template:Msg&#93;&#93;
17051 </p>
17052 !! end
17053
17054 !! test
17055 RAW magic word
17056 !! wikitext
17057 {{RAW:QUERTY}}
17058 !! html
17059 <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>
17060 </p>
17061 !! end
17062
17063 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
17064 !! test
17065 Always escape literal '>' in output, not just after '<'
17066 !! wikitext
17067 ><>
17068 !! html
17069 <p>&gt;&lt;&gt;
17070 </p>
17071 !! end
17072
17073 !! test
17074 Template caching
17075 !! wikitext
17076 {{Test}}
17077 {{Test}}
17078 !! html
17079 <p>This is a test template
17080 This is a test template
17081 </p>
17082 !! end
17083
17084
17085 !! article
17086 MediaWiki:Fake
17087 !! text
17088 ==header==
17089 !! endarticle
17090
17091 !! test
17092 Inclusion of !userCanEdit() content
17093 !! wikitext
17094 {{MediaWiki:Fake}}
17095 !! html
17096 <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>
17097
17098 !! end
17099
17100
17101 !! test
17102 Out-of-order TOC heading levels
17103 !! wikitext
17104 ==2==
17105 ======6======
17106 ===3===
17107 =1=
17108 =====5=====
17109 ==2==
17110 !! html
17111 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17112 <ul>
17113 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
17114 <ul>
17115 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
17116 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
17117 </ul>
17118 </li>
17119 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
17120 <ul>
17121 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
17122 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
17123 </ul>
17124 </li>
17125 </ul>
17126 </div>
17127
17128 <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>
17129 <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>
17130 <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>
17131 <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>
17132 <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>
17133 <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>
17134
17135 !! end
17136
17137
17138 !! test
17139 ISBN with a dummy number
17140 !! wikitext
17141 ISBN ---
17142 !! html
17143 <p>ISBN ---
17144 </p>
17145 !! end
17146
17147
17148 !! test
17149 ISBN with space-delimited number
17150 !! wikitext
17151 ISBN 92 9017 032 8
17152 !! html
17153 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
17154 </p>
17155 !! end
17156
17157
17158 !! test
17159 ISBN with multiple spaces, no number
17160 !! wikitext
17161 ISBN foo
17162 !! html
17163 <p>ISBN foo
17164 </p>
17165 !! end
17166
17167
17168 !! test
17169 ISBN length
17170 !! wikitext
17171 ISBN 123456789
17172
17173 ISBN 1234567890
17174
17175 ISBN 12345678901
17176 !! html
17177 <p>ISBN 123456789
17178 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17179 </p><p>ISBN 12345678901
17180 </p>
17181 !! end
17182
17183
17184 !! test
17185 ISBN with trailing year (bug 8110)
17186 !! wikitext
17187 ISBN 1-234-56789-0 - 2006
17188
17189 ISBN 1 234 56789 0 - 2006
17190 !! html
17191 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
17192 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
17193 </p>
17194 !! end
17195
17196
17197 !! test
17198 anchorencode
17199 !! wikitext
17200 {{anchorencode:foo bar©#%n}}
17201 !! html
17202 <p>foo_bar.C2.A9.23.25n
17203 </p>
17204 !! end
17205
17206 !! test
17207 anchorencode trims spaces
17208 !! wikitext
17209 {{anchorencode: __pretty__please__}}
17210 !! html
17211 <p>pretty_please
17212 </p>
17213 !! end
17214
17215 !! test
17216 anchorencode deals with links
17217 !! wikitext
17218 {{anchorencode: [[hello|world]] [[hi]]}}
17219 !! html
17220 <p>world_hi
17221 </p>
17222 !! end
17223
17224 !! test
17225 anchorencode deals with templates
17226 !! wikitext
17227 {{anchorencode: {{Foo}} }}
17228 !! html
17229 <p>FOO
17230 </p>
17231 !! end
17232
17233 !! test
17234 anchorencode encodes like the TOC generator: (bug 18431)
17235 !! wikitext
17236 === _ +:.3A%3A&&amp;]] ===
17237 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17238 __NOEDITSECTION__
17239 !! html
17240 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17241 <p>.2B:.3A.253A.26.26.5D.5D
17242 </p>
17243 !! end
17244
17245 !! test
17246 Bug 6200: blockquotes and paragraph formatting
17247 !! wikitext
17248 <blockquote>
17249 foo
17250 </blockquote>
17251
17252 bar
17253
17254 baz
17255 !! html
17256 <blockquote>
17257 <p>foo
17258 </p>
17259 </blockquote>
17260 <p>bar
17261 </p>
17262 <pre>baz
17263 </pre>
17264 !! end
17265
17266 !! test
17267 Bug 8293: Use of center tag ruins paragraph formatting
17268 !! wikitext
17269 <center>
17270 foo
17271 </center>
17272
17273 bar
17274
17275 baz
17276 !! html
17277 <center>
17278 <p>foo
17279 </p>
17280 </center>
17281 <p>bar
17282 </p>
17283 <pre>baz
17284 </pre>
17285 !! end
17286
17287 !!test
17288 Parsing of overlapping (improperly nested) inline html tags
17289 !! wikitext
17290 <span><s>x</span></s>
17291 !! html/php
17292 <p><span><s>x&lt;/span&gt;</s></span>
17293 </p>
17294 !! html/parsoid
17295 <p><span><s>x</s></span>
17296 </p>
17297 !!end
17298
17299 ###
17300 ### Language variants related tests
17301 ###
17302 !! test
17303 Self-link in language variants
17304 !! options
17305 title=[[Dunav]] language=sr
17306 !! wikitext
17307 Both [[Dunav]] and [[Дунав]] are names for this river.
17308 !! html
17309 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17310 </p>
17311 !!end
17312
17313 !! article
17314 Дуна
17315 !! text
17316 content
17317 !! endarticle
17318
17319 !! test
17320 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17321 !! options
17322 title=[[Duna]] language=sr
17323 !! wikitext
17324 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17325 !! html
17326 <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.
17327 </p>
17328 !! end
17329
17330 !! test
17331 Link to a section of a variant of this title shouldn't be parsed as self-link
17332 !! options
17333 title=[[Duna]] language=sr
17334 !! wikitext
17335 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
17336 !! html
17337 <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.
17338 </p>
17339 !! end
17340
17341 !! test
17342 Link to pages in language variants
17343 !! options
17344 language=sr
17345 !! wikitext
17346 Main Page can be written as [[Маин Паге]]
17347 !! html
17348 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
17349 </p>
17350 !!end
17351
17352
17353 !! test
17354 Multiple links to pages in language variants
17355 !! options
17356 language=sr
17357 !! wikitext
17358 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
17359 !! html
17360 <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>.
17361 </p>
17362 !!end
17363
17364
17365 !! test
17366 Simple template in language variants
17367 !! options
17368 language=sr
17369 !! wikitext
17370 {{тест}}
17371 !! html
17372 <p>This is a test template
17373 </p>
17374 !! end
17375
17376
17377 !! test
17378 Template with explicit namespace in language variants
17379 !! options
17380 language=sr
17381 !! wikitext
17382 {{Template:тест}}
17383 !! html
17384 <p>This is a test template
17385 </p>
17386 !! end
17387
17388
17389 !! test
17390 Basic test for template parameter in language variants
17391 !! options
17392 language=sr
17393 !! wikitext
17394 {{парамтест|param=foo}}
17395 !! html
17396 <p>This is a test template with parameter foo
17397 </p>
17398 !! end
17399
17400
17401 !! test
17402 Simple category in language variants
17403 !! options
17404 language=sr cat
17405 !! wikitext
17406 [[Category:МедиаWики Усер'с Гуиде]]
17407 !! html
17408 <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>
17409 !! end
17410
17411
17412 !! article
17413 Category:分类
17414 !! text
17415 blah
17416 !! endarticle
17417
17418 !! article
17419 Category:分類
17420 !! text
17421 blah
17422 !! endarticle
17423
17424 !! test
17425 Don't convert blue categorylinks to another variant (bug 33210)
17426 !! options
17427 language=zh cat
17428 !! wikitext
17429 [[A]][[Category:分类]]
17430 !! html
17431 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
17432 !! end
17433
17434
17435 !! test
17436 Stripping -{}- tags (language variants)
17437 !! options
17438 language=sr
17439 !! wikitext
17440 Latin proverb: -{Ne nuntium necare}-
17441 !! html
17442 <p>Latin proverb: Ne nuntium necare
17443 </p>
17444 !! end
17445
17446
17447 !! test
17448 Prevent conversion with -{}- tags (language variants)
17449 !! options
17450 language=sr variant=sr-ec
17451 !! wikitext
17452 Latinski: -{Ne nuntium necare}-
17453 !! html
17454 <p>Латински: Ne nuntium necare
17455 </p>
17456 !! end
17457
17458
17459 !! test
17460 Prevent conversion of text with -{}- tags (language variants)
17461 !! options
17462 language=sr variant=sr-ec
17463 !! wikitext
17464 Latinski: -{Ne nuntium necare}-
17465 !! html
17466 <p>Латински: Ne nuntium necare
17467 </p>
17468 !! end
17469
17470
17471 !! test
17472 Prevent conversion of links with -{}- tags (language variants)
17473 !! options
17474 language=sr variant=sr-ec
17475 !! wikitext
17476 -{[[Main Page]]}-
17477 !! html
17478 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17479 </p>
17480 !! end
17481
17482
17483 !! test
17484 -{}- tags within headlines (within html for parserConvert())
17485 !! options
17486 language=sr variant=sr-ec
17487 !! wikitext
17488 == -{Naslov}- ==
17489 !! html
17490 <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>
17491
17492 !! end
17493
17494
17495 !! test
17496 Explicit definition of language variant alternatives
17497 !! options
17498 language=zh variant=zh-tw
17499 !! wikitext
17500 -{zh:China;zh-tw:Taiwan}-, not China
17501 !! html
17502 <p>Taiwan, not China
17503 </p>
17504 !! end
17505
17506
17507 !! test
17508 Conversion around HTML tags
17509 !! options
17510 language=sr variant=sr-ec
17511 !! wikitext
17512 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
17513 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
17514 !! html
17515 <p>
17516 <span title="ЛаCтин">ски</span>
17517 </p>
17518 !! end
17519
17520
17521 !! test
17522 Explicit session-wise language variant mapping (A flag and - flag)
17523 !! options
17524 language=zh variant=zh-tw
17525 !! wikitext
17526 Taiwan is not China.
17527 But -{A|zh:China;zh-tw:Taiwan}- is China,
17528 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
17529 and -{China}- is China.
17530 !! html
17531 <p>Taiwan is not China.
17532 But Taiwan is Taiwan,
17533 (This should be stripped!)
17534 and China is China.
17535 </p>
17536 !! end
17537
17538 !! test
17539 Explicit session-wise language variant mapping (H flag for hide)
17540 !! options
17541 language=zh variant=zh-tw
17542 !! wikitext
17543 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
17544 Taiwan is China.
17545 !! html
17546 <p>(This should be stripped!)
17547 Taiwan is Taiwan.
17548 </p>
17549 !! end
17550
17551 !! test
17552 Adding explicit conversion rule for title (T flag)
17553 !! options
17554 language=zh variant=zh-tw showtitle
17555 !! wikitext
17556 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17557 !! html
17558 Taiwan
17559 <p>Should be stripped!
17560 </p>
17561 !! end
17562
17563 !! test
17564 Testing that changing the language variant here in the tests actually works
17565 !! options
17566 language=zh variant=zh showtitle
17567 !! wikitext
17568 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17569 !! html
17570 China
17571 <p>Should be stripped!
17572 </p>
17573 !! end
17574
17575 !! test
17576 Recursive conversion of alt and title attrs shouldn't clear converter state
17577 !! options
17578 language=zh variant=zh-cn showtitle
17579 !! wikitext
17580 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
17581 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
17582 !! html
17583 China
17584 <p>
17585 Should be stripped<span title="Exclamation">!</span>
17586 </p>
17587 !! end
17588
17589 !! test
17590 Bug 24072: more test on conversion rule for title
17591 !! options
17592 language=zh variant=zh-tw showtitle
17593 !! wikitext
17594 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17595 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
17596 !! html
17597 Taiwan
17598 <p>This should be stripped!
17599 This won't take interferes with the title rule.
17600 </p>
17601 !! end
17602
17603 !! test
17604 Partly disable title conversion if variant == main language code
17605 !! options
17606 language=zh variant=zh title=[[ZH]] showtitle
17607 !! wikitext
17608 -{T|zh-cn:CN;zh-tw:TW}-
17609 !! html
17610 ZH
17611 <p>
17612 </p>
17613 !! end
17614
17615 !! test
17616 Partly disable title conversion if variant == main language code, more
17617 !! options
17618 language=zh variant=zh title=[[ZH]] showtitle
17619 !! wikitext
17620 -{T|TW}-
17621 !! html
17622 ZH
17623 <p>
17624 </p>
17625 !! end
17626
17627 !! test
17628 Raw output of variant escape tags (R flag)
17629 !! options
17630 language=zh variant=zh-tw
17631 !! wikitext
17632 Raw: -{R|zh:China;zh-tw:Taiwan}-
17633 !! html
17634 <p>Raw: zh:China;zh-tw:Taiwan
17635 </p>
17636 !! end
17637
17638 !! test
17639 Nested using of manual convert syntax
17640 !! options
17641 language=zh variant=zh-hk
17642 !! wikitext
17643 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
17644 !! html
17645 <p>Nested: Hello Hong Kong!
17646 </p>
17647 !! end
17648
17649 !! test
17650 Proper conversion of text in external links
17651 !! options
17652 language=sr variant=sr-ec
17653 !! wikitext
17654 http://www.google.com
17655 gopher://www.google.com
17656 [http://www.google.com http://www.google.com]
17657 [gopher://www.google.com gopher://www.google.com]
17658 [https://www.google.com irc://www.google.com]
17659 [ftp://www.google.com www.google.com/ftp://dir]
17660 [//www.google.com www.google.com]
17661 !! html
17662 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17663 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17664 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17665 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17666 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
17667 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
17668 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
17669 </p>
17670 !! end
17671
17672 !! test
17673 Do not convert roman numbers to language variants
17674 !! options
17675 language=sr variant=sr-ec
17676 !! wikitext
17677 Fridrih IV je car.
17678 !! html
17679 <p>Фридрих IV је цар.
17680 </p>
17681 !! end
17682
17683 !! test
17684 Unclosed language converter markup "-{"
17685 !! options
17686 language=sr
17687 !! wikitext
17688 -{T|hello
17689 !! html
17690 <p>-{T|hello
17691 </p>
17692 !! end
17693
17694 !! test
17695 Don't convert raw rule "-{R|=&gt;}-" to "=>"
17696 !! options
17697 language=sr
17698 !! wikitext
17699 -{R|=&gt;}-
17700 !! html
17701 <p>=&gt;
17702 </p>
17703 !!end
17704
17705 !! test
17706 Don't break link parsing if language converter markup is in the caption.
17707 !! options
17708 language=sr variant=sr-ec
17709 !! wikitext
17710 [[Main Page|-{R|main page}-]]
17711 !! html
17712 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
17713 </p>
17714 !! end
17715
17716 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17717 !! test
17718 Don't break image parsing if language converter markup is in the caption.
17719 !! options
17720 language=sr
17721 !! wikitext
17722 [[File:Foobar.jpg|-{R|caption}-]]
17723 !! html/parsoid
17724 <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>
17725 </p>
17726 !! end
17727
17728 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17729 !! test
17730 Don't break list handling if language converter markup is in the item.
17731 !! options
17732 language=zh variant=zh-cn
17733 !! wikitext
17734 ;-{zh-cn:AAA;zh-tw:BBB}-
17735 !! html/php
17736 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
17737
17738 !! html/parsoid
17739 <dl><dt>AAA
17740 </dt></dl>
17741 !! end
17742
17743 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17744 !! test
17745 Don't break table handling if language converter markup is in the cell.
17746 !! options
17747 language=sr variant=sr-ec
17748 !! wikitext
17749 {|
17750 |-
17751 | -{R|B}-
17752 |}
17753 !! html/php
17754 <table>
17755
17756 <tr>
17757 <td>Б}-
17758 </td></tr></table>
17759
17760 !! html/parsoid
17761 <table>
17762
17763 <tr>
17764 <td> B
17765 </td></tr></table>
17766
17767 !! end
17768
17769 !! test
17770 Bug 529: Uncovered bullet
17771 !! wikitext
17772 * Foo {{bullet}}
17773 !! html
17774 <ul><li> Foo </li>
17775 <li> Bar</li></ul>
17776
17777 !! end
17778
17779 # Plain MediaWiki does not remove empty lists, but tidy actually does.
17780 # Templates in Wikipedia rely on this behavior, as tidy has always been
17781 # enabled there. These tests are normally run *without* tidy, so specify the
17782 # full output here.
17783 # To test realistic parsing behavior, apply a tidy-like transformation to both
17784 # the expected output and your parser's output.
17785 !! test
17786 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
17787 !! wikitext
17788 ******* Foo {{bullet}}
17789 !! html
17790 <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>
17791 <li> Bar</li></ul>
17792
17793 !! end
17794
17795 !! test
17796 Bug 529: Uncovered table already at line-start
17797 !! wikitext
17798 x
17799
17800 {{table}}
17801 y
17802 !! html
17803 <p>x
17804 </p>
17805 <table>
17806 <tr>
17807 <td> 1 </td>
17808 <td> 2
17809 </td></tr>
17810 <tr>
17811 <td> 3 </td>
17812 <td> 4
17813 </td></tr></table>
17814 <p>y
17815 </p>
17816 !! end
17817
17818 !! test
17819 Bug 529: Uncovered bullet in parser function result
17820 !! wikitext
17821 * Foo {{lc:{{bullet}} }}
17822 !! html
17823 <ul><li> Foo </li>
17824 <li> bar</li></ul>
17825
17826 !! end
17827
17828 !! test
17829 Bug 5678: Double-parsed template argument
17830 !! wikitext
17831 {{lc:{{{1}}}|hello}}
17832 !! html
17833 <p>{{{1}}}
17834 </p>
17835 !! end
17836
17837 !! test
17838 Bug 5678: Double-parsed template invocation
17839 !! wikitext
17840 {{lc:{{paramtest {{!}} param = hello }} }}
17841 !! html
17842 <p>{{paramtest | param = hello }}
17843 </p>
17844 !! end
17845
17846 !! test
17847 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
17848 !! options
17849 language=cs
17850 title=[[Main Page]]
17851 !! wikitext
17852 {{PRVNÍVELKÉ:ěščř}}
17853 {{prvnívelké:ěščř}}
17854 {{PRVNÍMALÉ:ěščř}}
17855 {{prvnímalé:ěščř}}
17856 {{MALÁ:ěščř}}
17857 {{malá:ěščř}}
17858 {{VELKÁ:ěščř}}
17859 {{velká:ěščř}}
17860 !! html
17861 <p>Ěščř
17862 Ěščř
17863 ěščř
17864 ěščř
17865 ěščř
17866 ěščř
17867 ĚŠČŘ
17868 ĚŠČŘ
17869 </p>
17870 !! end
17871
17872 !! test
17873 Morwen/13: Unclosed link followed by heading
17874 !! wikitext
17875 [[link
17876 ==heading==
17877 !! html
17878 <p>[[link
17879 </p>
17880 <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>
17881
17882 !! end
17883
17884 !! test
17885 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
17886 !! wikitext
17887 {{foo|
17888 =heading=
17889 !! html
17890 <p>{{foo|
17891 </p>
17892 <h1><span class="mw-headline" id="heading">heading</span></h1>
17893
17894 !! end
17895
17896 !! test
17897 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
17898 !! wikitext
17899 {{foo|
17900 ==heading==
17901 !! html
17902 <p>{{foo|
17903 </p>
17904 <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>
17905
17906 !! end
17907
17908 !! test
17909 Tildes in comments
17910 !! options
17911 pst
17912 !! wikitext
17913 <!-- ~~~~ -->
17914 !! html
17915 <!-- ~~~~ -->
17916 !! end
17917
17918 !! test
17919 Paragraphs inside divs (no extra line breaks)
17920 !! wikitext
17921 <div>Line one
17922
17923 Line two</div>
17924 !! html
17925 <div>Line one
17926 Line two</div>
17927
17928 !! end
17929
17930 !! test
17931 Paragraphs inside divs (extra line break on open)
17932 !! wikitext
17933 <div>
17934 Line one
17935
17936 Line two</div>
17937 !! html
17938 <div>
17939 <p>Line one
17940 </p>
17941 Line two</div>
17942
17943 !! end
17944
17945 !! test
17946 Paragraphs inside divs (extra line break on close)
17947 !! wikitext
17948 <div>Line one
17949
17950 Line two
17951 </div>
17952 !! html
17953 <div>Line one
17954 <p>Line two
17955 </p>
17956 </div>
17957
17958 !! end
17959
17960 !! test
17961 Paragraphs inside divs (extra line break on open and close)
17962 !! wikitext
17963 <div>
17964 Line one
17965
17966 Line two
17967 </div>
17968 !! html
17969 <div>
17970 <p>Line one
17971 </p><p>Line two
17972 </p>
17973 </div>
17974
17975 !! end
17976
17977 !! test
17978 Nesting tags, paragraphs on lines which begin with <div>
17979 !! wikitext
17980 <div></div><strong>A
17981 B</strong>
17982 !! html/php+tidy
17983 <p><strong>A</strong></p>
17984 <p><strong>B</strong></p>
17985 !! html/parsoid
17986 <div></div>
17987 <p><strong>A
17988 B</strong>
17989 </p>
17990 !! end
17991
17992 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
17993 !! test
17994 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
17995 !! wikitext
17996 <blockquote>Line one
17997
17998 Line two</blockquote>
17999 !! html
18000 <blockquote>Line one
18001 Line two</blockquote>
18002
18003 !! html+tidy
18004 <blockquote>
18005 <p>Line one Line two</p>
18006 </blockquote>
18007 !! end
18008
18009 !! test
18010 Bug 6200: paragraphs inside blockquotes (extra line break on open)
18011 !! wikitext
18012 <blockquote>
18013 Line one
18014
18015 Line two</blockquote>
18016 !! html
18017 <blockquote>
18018 <p>Line one
18019 </p>
18020 Line two</blockquote>
18021
18022 !! html+tidy
18023 <blockquote>
18024 <p>Line one</p>
18025 Line two</blockquote>
18026 !! end
18027
18028 !! test
18029 Bug 6200: paragraphs inside blockquotes (extra line break on close)
18030 !! wikitext
18031 <blockquote>Line one
18032
18033 Line two
18034 </blockquote>
18035 !! html
18036 <blockquote>Line one
18037 <p>Line two
18038 </p>
18039 </blockquote>
18040
18041 !! html+tidy
18042 <blockquote>
18043 <p>Line one</p>
18044 <p>Line two</p>
18045 </blockquote>
18046 !! end
18047
18048 !! test
18049 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
18050 !! wikitext
18051 <blockquote>
18052 Line one
18053
18054 Line two
18055 </blockquote>
18056 !! html
18057 <blockquote>
18058 <p>Line one
18059 </p><p>Line two
18060 </p>
18061 </blockquote>
18062
18063 !! html+tidy
18064 <blockquote>
18065 <p>Line one</p>
18066 <p>Line two</p>
18067 </blockquote>
18068 !! end
18069
18070 !! test
18071 Paragraphs inside blockquotes/divs (no extra line breaks)
18072 !! wikitext
18073 <blockquote><div>Line one
18074
18075 Line two</div></blockquote>
18076 !! html
18077 <blockquote><div>Line one
18078 Line two</div></blockquote>
18079
18080 !! end
18081
18082 !! test
18083 Paragraphs inside blockquotes/divs (extra line break on open)
18084 !! wikitext
18085 <blockquote><div>
18086 Line one
18087
18088 Line two</div></blockquote>
18089 !! html
18090 <blockquote><div>
18091 <p>Line one
18092 </p>
18093 Line two</div></blockquote>
18094
18095 !! end
18096
18097 !! test
18098 Paragraphs inside blockquotes/divs (extra line break on close)
18099 !! wikitext
18100 <blockquote><div>Line one
18101
18102 Line two
18103 </div></blockquote>
18104 !! html
18105 <blockquote><div>Line one
18106 <p>Line two
18107 </p>
18108 </div></blockquote>
18109
18110 !! end
18111
18112 !! test
18113 Paragraphs inside blockquotes/divs (extra line break on open and close)
18114 !! wikitext
18115 <blockquote><div>
18116 Line one
18117
18118 Line two
18119 </div></blockquote>
18120 !! html
18121 <blockquote><div>
18122 <p>Line one
18123 </p><p>Line two
18124 </p>
18125 </div></blockquote>
18126
18127 !! end
18128
18129 !! test
18130 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
18131 !! options
18132 wgLinkHolderBatchSize=0
18133 !! wikitext
18134 [[meatball:1]]
18135 [[meatball:2]]
18136 [[meatball:3]]
18137 !! html
18138 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
18139 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
18140 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
18141 </p>
18142 !! end
18143
18144 !! test
18145 Free external link invading image caption
18146 !! wikitext
18147 [[Image:Foobar.jpg|thumb|http://x|hello]]
18148 !! html
18149 <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>
18150
18151 !! end
18152
18153 !! test
18154 Bug 15196: localised external link numbers
18155 !! options
18156 language=fa
18157 !! wikitext
18158 [http://en.wikipedia.org/]
18159 !! html/php
18160 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
18161 </p>
18162 !! html/parsoid
18163 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
18164 !! end
18165
18166 !! test
18167 Multibyte character in padleft
18168 !! wikitext
18169 {{padleft:-Hello|7|Æ}}
18170 !! html
18171 <p>Æ-Hello
18172 </p>
18173 !! end
18174
18175 !! test
18176 Multibyte character in padright
18177 !! wikitext
18178 {{padright:Hello-|7|Æ}}
18179 !! html
18180 <p>Hello-Æ
18181 </p>
18182 !! end
18183
18184 !!test
18185 formatdate parser function
18186 !! wikitext
18187 {{#formatdate:2009-03-24}}
18188 !! html
18189 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
18190 </p>
18191 !! end
18192
18193 !!test
18194 formatdate parser function, with default format
18195 !! wikitext
18196 {{#formatdate:2009-03-24|mdy}}
18197 !! html
18198 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
18199 </p>
18200 !! end
18201
18202 !! test
18203 Spacing of numbers in formatted dates
18204 !! wikitext
18205 {{#formatdate:January 15}}
18206 !! html
18207 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18208 </p>
18209 !! end
18210
18211 !! test
18212 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
18213 !! options
18214 language=nl title=[[MediaWiki:Common.css]]
18215 !! wikitext
18216 {{#formatdate:2009-03-24|dmy}}
18217 !! html
18218 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18219 </p>
18220 !! end
18221
18222 #
18223 #
18224 #
18225
18226 #
18227 # Edit comments
18228 #
18229
18230 !! test
18231 Edit comment with link
18232 !! options
18233 comment
18234 !! wikitext
18235 I like the [[Main Page]] a lot
18236 !! html
18237 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18238 !!end
18239
18240 !! test
18241 Edit comment with link and link text
18242 !! options
18243 comment
18244 !! wikitext
18245 I like the [[Main Page|best pages]] a lot
18246 !! html
18247 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18248 !!end
18249
18250 !! test
18251 Edit comment with link and link text with suffix
18252 !! options
18253 comment
18254 !! wikitext
18255 I like the [[Main Page|best page]]s a lot
18256 !! html
18257 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18258 !!end
18259
18260 !! test
18261 Edit comment with section link (non-local, eg in history list)
18262 !! options
18263 comment title=[[Main Page]]
18264 !! wikitext
18265 /* External links */ removed bogus entries
18266 !! html
18267 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18268 !!end
18269
18270 !! test
18271 Edit comment with section link and text before it (non-local, eg in history list)
18272 !! options
18273 comment title=[[Main Page]]
18274 !! wikitext
18275 pre-comment text /* External links */ removed bogus entries
18276 !! html
18277 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>
18278 !!end
18279
18280 !! test
18281 Edit comment with section link (local, eg in diff view)
18282 !! options
18283 comment local title=[[Main Page]]
18284 !! wikitext
18285 /* External links */ removed bogus entries
18286 !! html
18287 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18288 !!end
18289
18290 !! test
18291 Edit comment with subpage link (bug 14080)
18292 !! options
18293 comment
18294 subpage
18295 title=[[Subpage test]]
18296 !! wikitext
18297 Poked at a [[/subpage]] here...
18298 !! html
18299 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
18300 !!end
18301
18302 !! test
18303 Edit comment with subpage link and link text (bug 14080)
18304 !! options
18305 comment
18306 subpage
18307 title=[[Subpage test]]
18308 !! wikitext
18309 Poked at a [[/subpage|neat little page]] here...
18310 !! html
18311 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
18312 !!end
18313
18314 !! test
18315 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
18316 !! options
18317 comment
18318 title=[[Subpage test]]
18319 !! wikitext
18320 Poked at a [[/subpage]] here...
18321 !! html
18322 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...
18323 !!end
18324
18325 !! test
18326 Edit comment with bare anchor link (local, as on diff)
18327 !! options
18328 comment
18329 local
18330 title=[[Main Page]]
18331 !! wikitext
18332 [[#section]]
18333 !! html
18334 <a href="#section">#section</a>
18335 !! end
18336
18337 !! test
18338 Edit comment with bare anchor link (non-local, as on history)
18339 !! options
18340 comment
18341 title=[[Main Page]]
18342 !! wikitext
18343 [[#section]]
18344 !! html
18345 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
18346 !! end
18347
18348 !! test
18349 Anchor starting with underscore
18350 !! wikitext
18351 [[#_ref|One]]
18352 !! html
18353 <p><a href="#_ref">One</a>
18354 </p>
18355 !! end
18356
18357 !! test
18358 Id starting with underscore
18359 !! wikitext
18360 <div id="_ref"></div>
18361 !! html
18362 <div id="_ref"></div>
18363
18364 !! end
18365
18366 !! test
18367 Space normalisation on autocomment (bug 22784)
18368 !! options
18369 comment
18370 title=[[Main Page]]
18371 !! wikitext
18372 /* __hello__world__ */
18373 !! html
18374 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
18375 !! end
18376
18377 !! test
18378 percent-encoding and + signs in comments (Bug 26410)
18379 !! options
18380 comment
18381 !! wikitext
18382 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
18383 !! html
18384 <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>
18385 !! end
18386
18387 # Parsoid doesn't support this yet: see bug 73581
18388 # but it *should* omit the 'src' attribute if the image is bad.
18389 # PHP side of tests was disabled in
18390 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
18391 # because of issues in the PHP parserTests infrastructure
18392 # (but the output below is indeed what the PHP side emits)
18393 !! test
18394 Bad images - basic functionality
18395 !! wikitext
18396 [[File:Bad.jpg]]
18397 !! DISABLED/html/php
18398 !! html/parsoid
18399 <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>
18400 !! end
18401
18402 !! test
18403 Bad images - bug 16039: text after bad image disappears
18404 !! wikitext
18405 Foo bar
18406 [[File:Bad.jpg]]
18407 Bar foo
18408 !! DISABLED/html/php
18409 <p>Foo bar
18410 </p><p>Bar foo
18411 </p>
18412 !! html/parsoid
18413 <p>Foo bar
18414 <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>
18415 Bar foo</p>
18416 !! end
18417
18418 !! test
18419 Verify that displaytitle works (bug #22501) no displaytitle
18420 !! options
18421 showtitle
18422 !! config
18423 wgAllowDisplayTitle=true
18424 wgRestrictDisplayTitle=false
18425 !! wikitext
18426 this is not the the title
18427 !! html
18428 Parser test
18429 <p>this is not the the title
18430 </p>
18431 !! end
18432
18433 !! test
18434 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
18435 !! options
18436 showtitle
18437 title=[[Screen]]
18438 !! config
18439 wgAllowDisplayTitle=true
18440 wgRestrictDisplayTitle=false
18441 !! wikitext
18442 this is not the the title
18443 {{DISPLAYTITLE:whatever}}
18444 !! html
18445 whatever
18446 <p>this is not the the title
18447 </p>
18448 !! end
18449
18450 !! test
18451 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
18452 !! options
18453 showtitle
18454 title=[[Screen]]
18455 !! config
18456 wgAllowDisplayTitle=true
18457 wgRestrictDisplayTitle=true
18458 !! wikitext
18459 this is not the the title
18460 {{DISPLAYTITLE:whatever}}
18461 !! html
18462 Screen
18463 <p>this is not the the title
18464 </p>
18465 !! end
18466
18467 !! test
18468 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
18469 !! options
18470 showtitle
18471 title=[[Screen]]
18472 !! config
18473 wgAllowDisplayTitle=true
18474 wgRestrictDisplayTitle=true
18475 !! wikitext
18476 this is not the the title
18477 {{DISPLAYTITLE:screen}}
18478 !! html
18479 screen
18480 <p>this is not the the title
18481 </p>
18482 !! end
18483
18484 !! test
18485 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
18486 !! options
18487 showtitle
18488 title=[[Screen]]
18489 !! config
18490 wgAllowDisplayTitle=false
18491 !! wikitext
18492 this is not the the title
18493 {{DISPLAYTITLE:screen}}
18494 !! html
18495 Screen
18496 <p>this is not the the title
18497 <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>
18498 </p>
18499 !! end
18500
18501 !! test
18502 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
18503 !! options
18504 showtitle
18505 title=[[Screen]]
18506 !! config
18507 wgAllowDisplayTitle=false
18508 !! wikitext
18509 this is not the the title
18510 !! html
18511 Screen
18512 <p>this is not the the title
18513 </p>
18514 !! end
18515
18516 !! test
18517 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
18518 !! options
18519 showtitle
18520 title=[[Screen]]
18521 !! config
18522 wgAllowDisplayTitle=true
18523 wgRestrictDisplayTitle=true
18524 !! wikitext
18525 this is not the the title
18526 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
18527 !! html
18528 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
18529 <p>this is not the the title
18530 </p>
18531 !! end
18532
18533 !! test
18534 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
18535 !! options
18536 showtitle
18537 title=[[Screen]]
18538 !! config
18539 wgAllowDisplayTitle=true
18540 wgRestrictDisplayTitle=true
18541 !! wikitext
18542 this is not the the title
18543 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
18544 !! html
18545 <span style="color: red;">s</span>creen
18546 <p>this is not the the title
18547 </p>
18548 !! end
18549
18550 !! test
18551 preload: check <noinclude> and <includeonly>
18552 !! options
18553 preload
18554 !! wikitext
18555 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
18556 !! html
18557 Hello kind world.
18558 !! end
18559
18560 !! test
18561 preload: check <onlyinclude>
18562 !! options
18563 preload
18564 !! wikitext
18565 Goodbye <onlyinclude>Hello world</onlyinclude>
18566 !! html
18567 Hello world
18568 !! end
18569
18570 !! test
18571 preload: can pass tags through if we want to
18572 !! options
18573 preload
18574 !! wikitext
18575 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
18576 !! html
18577 <includeonly>Hello world</includeonly>
18578 !! end
18579
18580 !! test
18581 preload: check that it doesn't try to do tricks
18582 !! options
18583 preload
18584 !! wikitext
18585 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18586 !! html
18587 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18588 !! end
18589
18590 !! test
18591 Play a bit with r67090 and bug 3158
18592 !! wikitext
18593 <div style="width:50% !important">&nbsp;</div>
18594 <div style="width:50%&nbsp;!important">&nbsp;</div>
18595 <div style="width:50%&#160;!important">&nbsp;</div>
18596 <div style="border : solid;">&nbsp;</div>
18597 !! html/php
18598 <div style="width:50% !important">&#160;</div>
18599 <div style="width:50% !important">&#160;</div>
18600 <div style="width:50% !important">&#160;</div>
18601 <div style="border&#160;: solid;">&#160;</div>
18602
18603 !! html/parsoid
18604 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18605 <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>
18606 <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>
18607 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18608
18609 !! end
18610
18611 !! test
18612 HTML5 data attributes
18613 !! wikitext
18614 <span data-foo="bar">Baz</span>
18615 <p data-abc-def_hij="">Quuz</p>
18616 !! html
18617 <p><span data-foo="bar">Baz</span>
18618 </p>
18619 <p data-abc-def_hij="">Quuz</p>
18620
18621 !! end
18622
18623 !! test
18624 percent-encoding and + signs in internal links (Bug 26410)
18625 !! wikitext
18626 [[User:+%]] [[Page+title%]]
18627 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
18628 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
18629 [[%33%45]] [[%33%45+]]
18630 !! html/php
18631 <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>
18632 <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>
18633 <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>
18634 <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>
18635 </p>
18636 !! html/parsoid
18637 <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>
18638 !! end
18639
18640 !! test
18641 Special characters in embedded file links (bug 27679)
18642 !! wikitext
18643 [[File:Contains & ampersand.jpg]]
18644 [[File:Does not exist.jpg|Title with & ampersand]]
18645 !! html/php
18646 <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>
18647 <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>
18648 </p>
18649 !! html/parsoid
18650 <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>
18651 <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>
18652 !! end
18653
18654 !! test
18655 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
18656 !! wikitext
18657 Text&apos;s been normalized?
18658 !! html
18659 <p>Text&#39;s been normalized?
18660 </p>
18661 !! end
18662
18663 !! test
18664 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
18665 !! wikitext
18666 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
18667 !! html
18668 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
18669 </p>
18670 !! end
18671
18672 !! test
18673 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
18674 !! wikitext
18675 [http://www.example.org/ ideograms]
18676 !! html
18677 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
18678 </p>
18679 !! end
18680
18681 !! test
18682 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
18683 !! wikitext
18684 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
18685 !! html
18686 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
18687 </p>
18688 !! end
18689
18690 !! article
18691 Mediawiki:loop1
18692 !! text
18693 {{Identical|A}}
18694 !! endarticle
18695
18696 !! article
18697 Mediawiki:loop2
18698 !! text
18699 {{Identical|B}}
18700 !! endarticle
18701
18702 !! article
18703 Template:Identical
18704 !! text
18705 {{int:loop1}}
18706 {{int:loop2}}
18707 !! endarticle
18708
18709 !! test
18710 Bug 31098 Template which includes system messages which includes the template
18711 !! wikitext
18712 {{Identical}}
18713 !! html
18714 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18715 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18716 </p>
18717 !! end
18718
18719 !! test
18720 Bug31490 Turkish: ucfirst 'blah'
18721 !! options
18722 language=tr
18723 !! wikitext
18724 {{ucfirst:blah}}
18725 !! html
18726 <p>Blah
18727 </p>
18728 !! end
18729
18730 !! test
18731 Bug31490 Turkish: ucfirst 'ix'
18732 !! options
18733 language=tr
18734 !! wikitext
18735 {{ucfirst:ix}}
18736 !! html
18737 <p>İx
18738 </p>
18739 !! end
18740
18741 !! test
18742 Bug31490 Turkish: lcfirst 'BLAH'
18743 !! options
18744 language=tr
18745 !! wikitext
18746 {{lcfirst:BLAH}}
18747 !! html
18748 <p>bLAH
18749 </p>
18750 !! end
18751
18752 !! test
18753 Bug31490 Turkish: ucfırst (with a dotless i)
18754 !! options
18755 language=tr
18756 !! wikitext
18757 {{ucfırst:blah}}
18758 !! html
18759 <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>
18760 </p>
18761 !! end
18762
18763 !! test
18764 Bug31490 ucfırst (with a dotless i) with English language
18765 !! options
18766 language=en
18767 !! wikitext
18768 {{ucfırst:blah}}
18769 !! html
18770 <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>
18771 </p>
18772 !! end
18773
18774 !! test
18775 Bug 26375: TOC with italics
18776 !! options
18777 title=[[Main Page]]
18778 !! wikitext
18779 __TOC__
18780 == ''Lost'' episodes ==
18781 !! html
18782 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18783 <ul>
18784 <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>
18785 </ul>
18786 </div>
18787
18788 <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>
18789
18790 !! end
18791
18792 !! test
18793 Bug 26375: TOC with bold
18794 !! options
18795 title=[[Main Page]]
18796 !! wikitext
18797 __TOC__
18798 == '''should be bold''' then normal text ==
18799 !! html
18800 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18801 <ul>
18802 <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>
18803 </ul>
18804 </div>
18805
18806 <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>
18807
18808 !! end
18809
18810 !! test
18811 Bug 33845: Headings become cursive in TOC when they contain an image
18812 !! options
18813 title=[[Main Page]]
18814 !! wikitext
18815 __TOC__
18816 == Image [[Image:foobar.jpg]] ==
18817 !! html
18818 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18819 <ul>
18820 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
18821 </ul>
18822 </div>
18823
18824 <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>
18825
18826 !! end
18827
18828 !! test
18829 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
18830 !! options
18831 title=[[Main Page]]
18832 !! wikitext
18833 __TOC__
18834 == <blockquote>Quote</blockquote> ==
18835 !! html
18836 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18837 <ul>
18838 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18839 </ul>
18840 </div>
18841
18842 <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>
18843
18844 !! html+tidy
18845 <div id="toc" class="toc">
18846 <div id="toctitle">
18847 <h2>Contents</h2>
18848 </div>
18849 <ul>
18850 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18851 </ul>
18852 </div>
18853 <h2><span class="mw-headline" id="Quote"></span></h2>
18854 <blockquote>
18855 <p><span class="mw-headline" id="Quote">Quote</span></p>
18856 </blockquote>
18857 <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>
18858 !! end
18859
18860 !! test
18861 Unclosed tags in TOC
18862 !! options
18863 title=[[Main Page]]
18864 !! wikitext
18865 __TOC__
18866 == Proof: 2 < 3 ==
18867 <small>Hanc marginis exiguitas non caperet.</small>
18868 QED
18869 !! html
18870 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18871 <ul>
18872 <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>
18873 </ul>
18874 </div>
18875
18876 <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>
18877 <p><small>Hanc marginis exiguitas non caperet.</small>
18878 QED
18879 </p>
18880 !! end
18881
18882 !! test
18883 Multiple tags in TOC
18884 !! wikitext
18885 __TOC__
18886 == <i>Foo</i> <b>Bar</b> ==
18887
18888 == <i>Foo</i> <blockquote>Bar</blockquote> ==
18889 !! html
18890 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18891 <ul>
18892 <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>
18893 <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>
18894 </ul>
18895 </div>
18896
18897 <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>
18898 <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>
18899
18900 !! html+tidy
18901 <div id="toc" class="toc">
18902 <div id="toctitle">
18903 <h2>Contents</h2>
18904 </div>
18905 <ul>
18906 <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>
18907 <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>
18908 </ul>
18909 </div>
18910 <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>
18911 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
18912 <blockquote>
18913 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
18914 </blockquote>
18915 <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>
18916 !! end
18917
18918 !! test
18919 Tags with parameters in TOC
18920 !! wikitext
18921 __TOC__
18922 == <sup class="in-h2">Hello</sup> ==
18923
18924 == <sup class="a > b">Evilbye</sup> ==
18925 !! html
18926 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18927 <ul>
18928 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
18929 <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>
18930 </ul>
18931 </div>
18932
18933 <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>
18934 <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>
18935
18936 !! end
18937
18938 !! test
18939 span tags with directionality in TOC
18940 !! wikitext
18941 __TOC__
18942 == <span dir="ltr">C++</span> ==
18943
18944 == <span dir="rtl">זבנג!</span> ==
18945
18946 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
18947
18948 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
18949
18950 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
18951 !! html
18952 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18953 <ul>
18954 <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>
18955 <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>
18956 <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>
18957 <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>
18958 <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>
18959 </ul>
18960 </div>
18961
18962 <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>
18963 <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>
18964 <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>
18965 <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>
18966 <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>
18967
18968 !! end
18969
18970 !! article
18971 MediaWiki:Bug32057
18972 !! text
18973 == {{int:headline_sample}} ==
18974 !! endarticle
18975
18976 !! test
18977 Bug 32057: Title needed when expanding <h> nodes.
18978 !! options
18979 title=[[Main Page]]
18980 !! wikitext
18981 {{int:Bug32057}}
18982 !! html
18983 <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>
18984
18985 !! end
18986
18987 !! test
18988 Strip marker in urlencode
18989 !! wikitext
18990 {{urlencode:x<nowiki/>y}}
18991 {{urlencode:x<nowiki/>y|wiki}}
18992 {{urlencode:x<nowiki/>y|path}}
18993 !! html
18994 <p>xy
18995 xy
18996 xy
18997 </p>
18998 !! end
18999
19000 !! test
19001 Strip marker in lc
19002 !! wikitext
19003 {{lc:x<nowiki/>y}}
19004 !! html
19005 <p>xy
19006 </p>
19007 !! end
19008
19009 !! test
19010 Strip marker in uc
19011 !! wikitext
19012 {{uc:x<nowiki/>y}}
19013 !! html
19014 <p>XY
19015 </p>
19016 !! end
19017
19018 !! test
19019 Strip marker in formatNum
19020 !! wikitext
19021 {{formatnum:1<nowiki/>2}}
19022 {{formatnum:1<nowiki/>2|R}}
19023 !! html
19024 <p>12
19025 12
19026 </p>
19027 !! end
19028
19029 !! test
19030 Check noCommafy in formatNum
19031 !! options
19032 language=be-tarask
19033 !! wikitext
19034 {{formatnum:123456.78}}
19035 {{formatnum:123456.78|NOSEP}}
19036 !! html
19037 <p>123 456,78
19038 123456.78
19039 </p>
19040 !! end
19041
19042 !! test
19043 Wrong option for formatNum (bug 56199)
19044 !! wikitext
19045 {{formatnum:1,234.56|Random}}
19046 {{formatnum:1,234.56|EVERYTHING}}
19047 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
19048 !! html
19049 <p>1,234.56
19050 1,234.56
19051 1,234.56
19052 </p>
19053 !! end
19054
19055 !! test
19056 Strip marker in grammar
19057 !! options
19058 language=fi
19059 !! wikitext
19060 {{grammar:elative|foo<nowiki/>bar}}
19061 !! html
19062 <p>foobarista
19063 </p>
19064 !! end
19065
19066 !! test
19067 Strip marker in padleft
19068 !! wikitext
19069 {{padleft:|2|x<nowiki/>y}}
19070 !! html
19071 <p>xy
19072 </p>
19073 !! end
19074
19075 !! test
19076 Strip marker in padright
19077 !! wikitext
19078 {{padright:|2|x<nowiki/>y}}
19079 !! html
19080 <p>xy
19081 </p>
19082 !! end
19083
19084 !! test
19085 Strip marker in anchorencode
19086 !! wikitext
19087 {{anchorencode:x<nowiki/>y}}
19088 !! html
19089 <p>xy
19090 </p>
19091 !! end
19092
19093 !! test
19094 nowiki inside link inside heading (bug 18295)
19095 !! wikitext
19096 ==[[foo|x<nowiki>y</nowiki>z]]==
19097 !! html
19098 <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>
19099
19100 !! end
19101
19102 !! test
19103 new support for bdi element (bug 31817)
19104 !! wikitext
19105 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19106 !! html
19107 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19108
19109 !!end
19110
19111 !! test
19112 Ignore pipe between table row attributes
19113 !! wikitext
19114 {|
19115 | quux
19116 |- id=foo | style='color: red'
19117 | bar
19118 |}
19119 !! html
19120 <table>
19121 <tr>
19122 <td> quux
19123 </td></tr>
19124 <tr id="foo" style="color: red">
19125 <td> bar
19126 </td></tr></table>
19127
19128 !! end
19129
19130 !!test
19131 Gallery override link with WikiLink (bug 34852)
19132 !! wikitext
19133 <gallery>
19134 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
19135 </gallery>
19136 !! html
19137 <ul class="gallery mw-gallery-traditional">
19138 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19139 <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>
19140 <div class="gallerytext">
19141 <p>caption
19142 </p>
19143 </div>
19144 </div></li>
19145 </ul>
19146
19147 !! end
19148
19149 !!test
19150 Gallery override link with absolute external link (bug 34852)
19151 !! wikitext
19152 <gallery>
19153 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19154 </gallery>
19155 !! html
19156 <ul class="gallery mw-gallery-traditional">
19157 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19158 <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>
19159 <div class="gallerytext">
19160 <p>caption
19161 </p>
19162 </div>
19163 </div></li>
19164 </ul>
19165
19166 !! end
19167
19168 !!test
19169 Gallery override link with malicious javascript (bug 34852)
19170 !! wikitext
19171 <gallery>
19172 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19173 </gallery>
19174 !! html
19175 <ul class="gallery mw-gallery-traditional">
19176 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19177 <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>
19178 <div class="gallerytext">
19179 <p>caption
19180 </p>
19181 </div>
19182 </div></li>
19183 </ul>
19184
19185 !! end
19186
19187 !!test
19188 Gallery with invalid title as link (bug 43964)
19189 !! wikitext
19190 <gallery>
19191 File:foobar.jpg|link=<
19192 </gallery>
19193 !! html
19194 <ul class="gallery mw-gallery-traditional">
19195 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19196 <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>
19197 <div class="gallerytext">
19198 </div>
19199 </div></li>
19200 </ul>
19201
19202 !! end
19203
19204 !!test
19205 Language parser function
19206 !! wikitext
19207 {{#language:ar}}
19208 !! html
19209 <p>العربية
19210 </p>
19211 !! end
19212
19213 !!test
19214 Padleft and padright as substr
19215 !! wikitext
19216 {{padleft:|3|abcde}}
19217 {{padright:|3|abcde}}
19218 !! html
19219 <p>abc
19220 abc
19221 </p>
19222 !! end
19223
19224 !!test
19225 Special parser function
19226 !! wikitext
19227 {{#special:RandomPage}}
19228 {{#special:BaDtItLe}}
19229 {{#special:Foobar}}
19230 !! html
19231 <p>Special:Random
19232 Special:Badtitle
19233 Special:Foobar
19234 </p>
19235 !! end
19236
19237 !!test
19238 Bug 34939 - Case insensitive link parsing ([HttP://])
19239 !! wikitext
19240 [HttP://MediaWiki.Org/]
19241 !! html/php
19242 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
19243 </p>
19244 !! html/parsoid
19245 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
19246 !! end
19247
19248 !!test
19249 Bug 34939 - Case insensitive link parsing ([HttP:// title])
19250 !! wikitext
19251 [HttP://MediaWiki.Org/ MediaWiki]
19252 !! html
19253 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
19254 </p>
19255 !! end
19256
19257 !!test
19258 Bug 34939 - Case insensitive link parsing (HttP://)
19259 !! wikitext
19260 HttP://MediaWiki.Org/
19261 !! html/php
19262 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
19263 </p>
19264 !! html/parsoid
19265 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
19266 !! end
19267
19268 !!test
19269 Disable TOC
19270 !! options
19271 notoc
19272 !! wikitext
19273 Lead
19274 == Section 1 ==
19275 == Section 2 ==
19276 == Section 3 ==
19277 == Section 4 ==
19278 == Section 5 ==
19279 !! html
19280 <p>Lead
19281 </p>
19282
19283 <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>
19284 <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>
19285 <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>
19286 <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>
19287 <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>
19288
19289 !! end
19290
19291
19292 ###
19293 ### Parsoid-specific tests
19294 ### Parsoid-PHP parser incompatibilities
19295 ###
19296 !!test
19297 1. SOL-sensitive wikitext tokens as template-args
19298 !!options
19299 parsoid=wt2html,wt2wt
19300 !! wikitext
19301 {{echo|*a}}
19302 {{echo|#a}}
19303 {{echo|:a}}
19304 !! html
19305 <span about="#mwt1" typeof="mw:Transclusion">
19306 </span><ul about="#mwt1"><li>a</li>
19307 </ul>
19308 <span about="#mwt2" typeof="mw:Transclusion">
19309 </span><ol about="#mwt2"><li>a</li>
19310 </ol>
19311 <span about="#mwt3" typeof="mw:Transclusion">
19312 </span><dl about="#mwt3"><dd>a</dd>
19313 </dl>
19314 !!end
19315
19316 #### -----------------------------------------------------------------
19317 #### Parsoid-specific functionality tests
19318 #### -----------------------------------------------------------------
19319
19320 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
19321 # We know wt2wt will fail, but we expect selser to pass.
19322 # Due to the nature of our testing, wt2wt and selser tests will enter the
19323 # blacklist and we'll catch selser regressions based on changes to the
19324 # blacklist entries for selser tests.
19325 !! test
19326 1. Bad treebuilder fixup of formatting elt is cleaned up
19327 !! options
19328 parsoid=wt2html,wt2wt
19329 !! wikitext
19330 {|
19331 |
19332 <small>
19333 [[Image:Foobar.jpg|right|Test]]
19334 </small>
19335 |}
19336 !! html/parsoid
19337 <table>
19338 <tbody><tr><td>
19339 <small>
19340 <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>
19341 </small>
19342 </td></tr>
19343 </tbody></table>
19344 !! end
19345
19346 !! test
19347 2. Bad treebuilder fixup of formatting elt is cleaned up
19348 !! options
19349 parsoid=wt2html,wt2wt
19350 !! wikitext
19351 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
19352
19353 <small>[[Image:Foobar.jpg|right|300px]]</small>
19354 !! html/parsoid
19355 <p><b>foo</b></p>
19356 <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>
19357 <p><b>bar</b></p>
19358 <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>
19359 !! end
19360
19361 #### ----------------------------------------------------------------
19362 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
19363 #### tags. Parsoid's output for these tags differs from that of the
19364 #### PHP parser.
19365 #### ----------------------------------------------------------------
19366
19367 !!test
19368 Ref: 1. ref-location should be replaced with an index span
19369 !!options
19370 parsoid
19371 !! wikitext
19372 A <ref>foo</ref>
19373 B <ref name="x">foo</ref>
19374 C <ref name="y" />
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"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
19377 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>
19378 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>
19379 !!end
19380
19381 !!test
19382 Ref: 2. ref-tags with identical names should all get the same index
19383 !!options
19384 parsoid
19385 !! wikitext
19386 A <ref name="x">foo</ref>
19387 B <ref name="x" />
19388 !! html
19389 <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>
19390 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>
19391 !!end
19392
19393 !!test
19394 Ref: 3. spaces in ref-names should be ignored
19395 !!options
19396 parsoid
19397 !! wikitext
19398 A <ref name="x">foo</ref>
19399 B <ref name=" x " />
19400 C <ref name= x />
19401 !! html
19402 <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>
19403 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>
19404 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>
19405 !!end
19406
19407 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
19408 !!test
19409 Ref: 4. 'constructor' should be accepted as a valid ref-name
19410 !!options
19411 parsoid
19412 !! wikitext
19413 A <ref name="constructor">foo</ref>
19414 !! html
19415 <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>
19416 !!end
19417
19418 !!test
19419 Ref: 5. body should accept generic wikitext
19420 !!options
19421 parsoid
19422 !! wikitext
19423 A <ref>
19424 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
19425 </ref>
19426
19427 <references />
19428 !! html
19429 <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>
19430
19431 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19432 <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>
19433 </li>
19434 </ol>
19435 !!end
19436
19437 !!test
19438 Ref: 6. indent-pres should not be output in ref-body
19439 !!options
19440 parsoid
19441 !! wikitext
19442 A <ref>
19443 foo
19444 bar
19445 baz
19446 </ref>
19447
19448 <references />
19449 !! html
19450 <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>
19451
19452 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19453 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
19454 bar
19455 baz
19456 </li>
19457 </ol>
19458 !!end
19459
19460 !!test
19461 Ref: 7. No p-wrapping in ref-body
19462 !!options
19463 parsoid
19464 !! wikitext
19465 A <ref>
19466 foo
19467
19468 bar
19469
19470
19471 baz
19472
19473
19474
19475 booz
19476 </ref>
19477
19478 <references />
19479 !! html
19480 <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>
19481
19482 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19483 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
19484
19485 bar
19486
19487
19488 baz
19489
19490
19491
19492 booz
19493 </li>
19494 </ol>
19495 !!end
19496
19497 !!test
19498 Ref: 8. transclusion wikitext has lower precedence
19499 !!options
19500 parsoid
19501 !! wikitext
19502 A <ref> foo {{echo|</ref> B C}}
19503
19504 <references />
19505 !! html
19506 <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>
19507 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19508 <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>
19509 </ol>
19510 !!end
19511
19512 !!test
19513 Ref: 9. unclosed comments should not leak out of ref-body
19514 !!options
19515 parsoid
19516 !! wikitext
19517 A <ref> foo <!--</ref> B C
19518 <references />
19519 !! html
19520 <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>
19521 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19522 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li>
19523 </ol>
19524 !!end
19525
19526 !!test
19527 Ref: 10. Unclosed HTML tags should not leak out of ref-body
19528 !!options
19529 parsoid
19530 !! wikitext
19531 A <ref> <b> foo </ref> B C
19532
19533 <references />
19534 !! html
19535 <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>
19536
19537
19538 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19539 <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>
19540 </ol>
19541 !!end
19542
19543 !!test
19544 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
19545 !!options
19546 parsoid
19547 !! wikitext
19548 A <ref>foo</ref> B
19549 C <ref>bar</ref> D
19550 !! html
19551 <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
19552 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>
19553 !!end
19554
19555 !!test
19556 Ref: 12. ref-tags act as trailing newline migration barrier
19557 !!options
19558 parsoid
19559 !! wikitext
19560 <!--the newline at the end of this line moves out of the p-tag-->a
19561
19562 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
19563 <ref />
19564
19565 c
19566 !! html
19567 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
19568
19569
19570 <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>
19571 <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>
19572
19573 <p>c</p>
19574 !!end
19575
19576 !!test
19577 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
19578 !!options
19579 parsoid
19580 !! wikitext
19581 <ref>foo</ref> A
19582 <ref>bar
19583 </ref> B
19584 !! html
19585 <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
19586 <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>
19587 !!end
19588
19589 !!test
19590 Ref: 14. A nested ref-tag should be emitted as plain text
19591 !!options
19592 parsoid
19593 !! wikitext
19594 <ref>foo <ref>bar</ref> baz</ref>
19595
19596 <references />
19597 !! html
19598 <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>
19599
19600 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19601 <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>
19602 </ol>
19603 !!end
19604
19605 !!test
19606 Ref: 15. ref-tags with identical names should get identical indexes
19607 !!options
19608 parsoid
19609 !! wikitext
19610 A1 <ref name="a">foo</ref> A2 <ref name="a" />
19611 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
19612
19613 <references />
19614 !! html
19615 <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>
19616 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>
19617
19618 <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>
19619 </ol>
19620 !!end
19621
19622 ## We don't bother wt2wt-ing non-standard whitespace
19623 !!test
19624 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
19625 !!options
19626 parsoid=wt2html
19627 !! wikitext
19628 A <ref >foo</ref >
19629
19630 <references />
19631 !! html
19632 <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>
19633
19634 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19635 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19636 !!end
19637
19638 !!test
19639 Ref: 17. Generate valid HTML5 id/about attributes
19640 !!options
19641 parsoid
19642 !!wikitext
19643 <ref name="a b">foo</ref>
19644
19645 <references />
19646 !!html
19647 <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>
19648 </p>
19649
19650 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19651 <li id="cite_note-a_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_b-1-0">↑</a></span> foo</li>
19652 !!end
19653
19654 !!test
19655 References: 1. references tag without any refs should be handled properly
19656 !!options
19657 parsoid
19658 !! wikitext
19659 <references />
19660 !! html
19661 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
19662 !!end
19663
19664 !!test
19665 References: 2. references tag with group only outputs references from that group
19666 !!options
19667 parsoid
19668 !! wikitext
19669 A <ref group="a">foo</ref>
19670 B <ref group="b">bar</ref>
19671
19672 <references group="a" />
19673 !! html
19674 <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>
19675 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>
19676
19677 <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>
19678 </ol>
19679 !!end
19680
19681 !!test
19682 References: 3. ref list should be cleared after processing references
19683 !!options
19684 parsoid
19685 !! wikitext
19686 A <ref>foo</ref>
19687
19688 <references />
19689
19690 B <ref>bar</ref>
19691
19692 <references />
19693 !! html
19694 <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>
19695
19696 <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>
19697 </ol>
19698
19699 <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>
19700
19701 <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>
19702 </ol>
19703 !!end
19704
19705 !!test
19706 References: 4. only referenced group should be cleared after processing references
19707 !!options
19708 parsoid
19709 !! wikitext
19710 A <ref group="a">afoo</ref>
19711 B <ref>bfoo</ref>
19712
19713 <references group="a" />
19714
19715 C <ref>cfoo</ref>
19716
19717 <references />
19718 !! html
19719 <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>
19720 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>
19721
19722 <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>
19723 </ol>
19724
19725 <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>
19726
19727 <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>
19728 </ol>
19729 !!end
19730
19731 !!test
19732 References: 5. ref tags in references should be processed while ignoring all other content
19733 !!options
19734 parsoid
19735 !! wikitext
19736 A <ref name="a" />
19737 B <ref name="b">bar</ref>
19738
19739 <references>
19740 <ref name="a">foo</ref>
19741 This should just get lost.
19742 </references>
19743 !! html
19744 <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>
19745 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>
19746
19747
19748 <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>
19749 </ol>
19750 !!end
19751
19752 !!test
19753 References: 6. <references /> from a transclusion
19754 !!options
19755 parsoid
19756 !! wikitext
19757 <ref>Foo</ref> {{echo|<references />}}
19758 !! html
19759 <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>
19760 !!end
19761
19762 !! test
19763 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
19764 !! options
19765 parsoid
19766 !! wikitext
19767 A <ref>foo bar for a</ref>
19768 B <ref group="X" name="b" />
19769
19770 <references />
19771
19772 <references group="X">
19773 <ref name="b">foo</ref>
19774 </references>
19775 !! html
19776 <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>
19777 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>
19778
19779 <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>
19780
19781 <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>
19782 !! end
19783
19784 !! test
19785 Entities in ref name
19786 !! options
19787 parsoid
19788 !! wikitext
19789 <ref name="test &amp; me">hi</ref>
19790 !! html
19791 <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>
19792 !! end
19793
19794 # This test is wt2html only because we're permitting the serializer to produce
19795 # dirty diffs, normalizing the unclosed references to the self-closed version.
19796 !! test
19797 Generate references for unclosed references tag
19798 !! options
19799 parsoid=wt2html
19800 !! wikitext
19801 a<ref>foo</ref>
19802
19803 <references>
19804 !! html
19805 <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>
19806
19807
19808 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19809 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19810 !! end
19811
19812 !! test
19813 New reference serializes on its own line
19814 !! options
19815 parsoid=wt2wt,html2wt
19816 !! wikitext
19817 foo
19818 <references />
19819 !! html
19820 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
19821 !! end
19822
19823 #--------- Test stripping of empty nodes in template content ----------
19824 !!test
19825 Empty LI and TR nodes should be stripped from template content
19826 !!wikitext
19827 {{EmptyLITest}}
19828 {{EmptyTRTest}}
19829 !!html/parsoid
19830 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
19831 <li>a</li>
19832 <li>b</li>
19833 </ul>
19834 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
19835 <tbody>
19836 <tr>
19837 <td>foo</td>
19838 </tr>
19839 <tr>
19840 <td>bar</td>
19841 </tr>
19842 </tbody>
19843 </table>
19844 !!end
19845
19846 !!test
19847 Empty LI and TR nodes should not be stripped from top-level content
19848 !!wikitext
19849 * a
19850 *
19851 * b
19852 {|
19853 |-
19854 |-
19855 |foo
19856 |}
19857 !!html/parsoid
19858 <ul>
19859 <li> a</li>
19860 <li></li>
19861 <li> b</li>
19862 </ul>
19863 <table>
19864 <tbody>
19865 <tr></tr>
19866 <tr>
19867 <td>foo</td>
19868 </tr>
19869 </tbody>
19870 </table>
19871 !!end
19872
19873 !!test
19874 Empty TR nodes should not be stripped if they have any attributes set
19875 !!wikitext
19876 {{EmptyTRWithHTMLAttrTest}}
19877 !!html/parsoid
19878 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
19879 <tr align="center"></tr>
19880 <tr><td>foo</td></tr>
19881 <tr align="center"></tr>
19882 <tr><td>bar</td></tr>
19883 </table>
19884 !!end
19885
19886 #### ----------------------------------------------------------------
19887 #### The following section of tests are primarily to test
19888 #### wikitext escaping capabilities of Parsoid. Given that
19889 #### escaping can be done any number of ways, the wikitext (input)
19890 #### is always adjusted to reflect how Parsoid adds nowiki
19891 #### escape tags.
19892 ####
19893 #### We are marking several tests as parsoid-only since the
19894 #### HTML in the result section is different from what the
19895 #### PHP parser generates for it.
19896 #### ----------------------------------------------------------------
19897
19898
19899 #### --------------- Headings ---------------
19900 #### 0. Unnested
19901 #### 1. Nested inside html <h1>=foo=</h1>
19902 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
19903 #### 3. Nested inside html with wikitext split by html tags
19904 #### 4. No escape needed
19905 #### 5. Empty headings <h1></h1>
19906 #### 6. Heading chars in SOL context
19907 #### ----------------------------------------
19908 !! test
19909 Headings: 0. Unnested
19910 !! options
19911 parsoid
19912 !! wikitext
19913 <nowiki>=foo=</nowiki>
19914
19915 <nowiki> =foo= </nowiki>
19916 <!--cmt-->
19917 <nowiki>=foo=</nowiki>
19918
19919 =foo''a''<nowiki>=</nowiki>
19920 !! html
19921 <p><span typeof="mw:Nowiki">=foo=</span></p>
19922
19923 <p><span typeof="mw:Nowiki"> =foo= </span>
19924 <!--cmt-->
19925 <span typeof="mw:Nowiki">=foo=</span></p>
19926
19927 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
19928 !!end
19929
19930 # New headings and existing headings are handled differently
19931 !! test
19932 Headings: 1. Nested inside html
19933 !! options
19934 parsoid=html2wt
19935 !! wikitext
19936 = =foo= =
19937
19938 == =foo= ==
19939
19940 === =foo= ===
19941
19942 =<nowiki>=foo=</nowiki>=
19943 ==<nowiki>=foo=</nowiki>==
19944 ===<nowiki>=foo=</nowiki>===
19945 ====<nowiki>=foo=</nowiki>====
19946 =====<nowiki>=foo=</nowiki>=====
19947 ======<nowiki>=foo=</nowiki>======
19948
19949 !! html
19950 <h1>=foo=</h1>
19951 <h2>=foo=</h2>
19952 <h3>=foo=</h3>
19953
19954 <h1 data-parsoid=''>=foo=</h1>
19955 <h2 data-parsoid=''>=foo=</h2>
19956 <h3 data-parsoid=''>=foo=</h3>
19957 <h4 data-parsoid=''>=foo=</h4>
19958 <h5 data-parsoid=''>=foo=</h5>
19959 <h6 data-parsoid=''>=foo=</h6>
19960 !!end
19961
19962 !! test
19963 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
19964 !! options
19965 parsoid=html2wt
19966 !! wikitext
19967 = foo =
19968 <nowiki>*</nowiki>bar
19969
19970 = foo =
19971 =bar
19972
19973 = foo =
19974 <nowiki>=bar=</nowiki>
19975 !! html
19976 <h1>foo</h1>*bar
19977 <h1>foo</h1>=bar
19978 <h1>foo</h1>=bar=
19979 !!end
19980
19981 !! test
19982 Headings: 3. Nested inside html with wikitext split by html tags
19983 !! options
19984 parsoid=html2wt
19985 !! wikitext
19986 = ='''bold'''<nowiki>foo=</nowiki> =
19987 !! html
19988 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
19989 !!end
19990
19991 !! test
19992 Headings: 4a. No escaping needed (testing just h1 and h2)
19993 !! options
19994 parsoid=html2wt
19995 !! wikitext
19996 = =foo =
19997
19998 = foo= =
19999
20000 = =foo= =
20001
20002 = =foo= bar =
20003
20004 == =foo ==
20005
20006 == foo= ==
20007
20008 = ''=''foo= =
20009
20010 = <nowiki>=</nowiki> =
20011 !! html
20012 <h1>=foo</h1>
20013 <h1>foo=</h1>
20014 <h1> =foo= </h1>
20015 <h1>=foo= bar</h1>
20016 <h2>=foo</h2>
20017 <h2>foo=</h2>
20018 <h1><i>=</i>foo=</h1>
20019 <h1><span typeof="mw:Nowiki">=</span></h1>
20020 !!end
20021
20022 !! test
20023 Headings: 4b. No escaping needed (inside p-tags)
20024 !! options
20025 parsoid=html2wt
20026 !! wikitext
20027 ===
20028 =foo= x
20029 =foo= <s></s>
20030 !! html
20031 <p>===
20032 =foo= x
20033 =foo= <s></s>
20034 </p>
20035 !!end
20036
20037 !! test
20038 Headings: 5. Empty headings
20039 !! options
20040 parsoid
20041 !! wikitext
20042 =<nowiki/>=
20043
20044 ==<nowiki/>==
20045
20046 ===<nowiki/>===
20047
20048 ====<nowiki/>====
20049
20050 =====<nowiki/>=====
20051
20052 ======<nowiki/>======
20053 !! html
20054 <h1></h1>
20055 <h2></h2>
20056 <h3></h3>
20057 <h4></h4>
20058 <h5></h5>
20059 <h6></h6>
20060 !!end
20061
20062 !! test
20063 Headings: 6a. Heading chars in SOL context (with trailing spaces)
20064 !! options
20065 parsoid
20066 !! wikitext
20067 <nowiki>=a=</nowiki>
20068
20069 <nowiki>=a=</nowiki>
20070
20071 <nowiki>=a=</nowiki>
20072
20073 <nowiki>=a=</nowiki>
20074 !! html
20075 <p>=a=</p>
20076 <p>=a= </p>
20077 <p>=a= </p>
20078 <p>=a= </p>
20079 !!end
20080
20081 !! test
20082 Headings: 6b. Heading chars in SOL context (with trailing newlines)
20083 !! options
20084 parsoid
20085 !! wikitext
20086 <nowiki>=a=
20087 b</nowiki>
20088
20089 <nowiki>=a=
20090 b</nowiki>
20091
20092 <nowiki>=a=
20093 b</nowiki>
20094
20095 <nowiki>=a=
20096 b</nowiki>
20097 !! html
20098 <p>=a=
20099 b</p>
20100 <p>=a=
20101 b</p>
20102 <p>=a=
20103 b</p>
20104 <p>=a=
20105 b</p>
20106 </p>
20107 !!end
20108
20109 !! test
20110 Headings: 6c. Heading chars in SOL context (leading newline break)
20111 !! options
20112 parsoid
20113 !! wikitext
20114 a
20115 <nowiki>=b=</nowiki>
20116 !! html
20117 <p>a
20118 =b=</p>
20119 !!end
20120
20121 !! test
20122 Headings: 6d. Heading chars in SOL context (with interspersed comments)
20123 !! options
20124 parsoid
20125 !! wikitext
20126 <!--c0--><nowiki>=a=</nowiki>
20127
20128 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
20129 !! html
20130 <p><!--c0-->=a=</p>
20131 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
20132 !!end
20133
20134 !! test
20135 Headings: 6d. Heading chars in SOL context (No escaping needed)
20136 !! options
20137 parsoid=html2wt
20138 !! wikitext
20139 =a=<div>b</div>
20140 !! html
20141 =a=<div>b</div>
20142 !!end
20143
20144 #### --------------- Lists ---------------
20145 #### 0. Outside nests (*foo, etc.)
20146 #### 1. Nested inside html <ul><li>*foo</li></ul>
20147 #### 2. Inside definition lists
20148 #### 3. Only bullets at start should be escaped
20149 #### 4. No escapes needed
20150 #### 5. No unnecessary escapes
20151 #### 6. Escape bullets in SOL position
20152 #### 7. Escape bullets in a multi-line context
20153 #### ----------------------------------------
20154
20155 !! test
20156 Lists: 0. Outside nests
20157 !! wikitext
20158 <nowiki>*</nowiki>foo
20159
20160 <nowiki>#</nowiki>foo
20161
20162 <nowiki>;Foo:</nowiki>bar
20163 !! html
20164 <p>*foo
20165 </p><p>#foo
20166 </p><p>;Foo:bar
20167 </p>
20168 !!end
20169
20170 !! test
20171 Lists: 1. Nested inside html
20172 !! wikitext
20173 *<nowiki>*foo</nowiki>
20174
20175 *<nowiki>#foo</nowiki>
20176
20177 *<nowiki>:foo</nowiki>
20178
20179 *<nowiki>;foo</nowiki>
20180
20181 #<nowiki>*foo</nowiki>
20182
20183 #<nowiki>#foo</nowiki>
20184
20185 #<nowiki>:foo</nowiki>
20186
20187 #<nowiki>;foo</nowiki>
20188 !! html
20189 <ul><li>*foo</li></ul>
20190 <ul><li>#foo</li></ul>
20191 <ul><li>:foo</li></ul>
20192 <ul><li>;foo</li></ul>
20193 <ol><li>*foo</li></ol>
20194 <ol><li>#foo</li></ol>
20195 <ol><li>:foo</li></ol>
20196 <ol><li>;foo</li></ol>
20197
20198 !!end
20199
20200 !! test
20201 Lists: 2. Inside definition lists
20202 !! wikitext
20203 ;<nowiki>;foo</nowiki>
20204
20205 ;<nowiki>:foo</nowiki>
20206
20207 ;<nowiki>:foo</nowiki>
20208 :bar
20209
20210 :<nowiki>:foo</nowiki>
20211 !! html
20212 <dl><dt>;foo</dt></dl>
20213 <dl><dt>:foo</dt></dl>
20214 <dl><dt>:foo</dt>
20215 <dd>bar</dd></dl>
20216 <dl><dd>:foo</dd></dl>
20217
20218 !!end
20219
20220 !! test
20221 Lists: 3. Only bullets at start of text should be escaped
20222 !! wikitext
20223 *<nowiki>*foo*bar</nowiki>
20224
20225 *<nowiki>*foo</nowiki>''it''*bar
20226 !! html
20227 <ul><li>*foo*bar</li></ul>
20228 <ul><li>*foo<i>it</i>*bar</li></ul>
20229
20230 !!end
20231
20232 !! test
20233 Lists: 4. No escapes needed
20234 !! options
20235 parsoid
20236 !! wikitext
20237 *foo*bar
20238
20239 *''foo''*bar
20240
20241 *[[Foo]]: bar
20242
20243 *[[Foo]]*bar
20244 !! html
20245 <ul>
20246 <li>foo*bar
20247 </li>
20248 </ul>
20249 <ul>
20250 <li><i>foo</i>*bar
20251 </li>
20252 </ul>
20253 <ul>
20254 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
20255 </li>
20256 </ul>
20257 <ul>
20258 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
20259 </li>
20260 </ul>
20261 !!end
20262
20263 !! test
20264 Lists: 5. No unnecessary escapes
20265 !! wikitext
20266 * bar <span><nowiki>[[foo]]</nowiki></span>
20267
20268 *=bar <span><nowiki>[[foo]]</nowiki></span>
20269
20270 *[[bar <span><nowiki>[[foo]]</nowiki></span>
20271
20272 *]]bar <span><nowiki>[[foo]]</nowiki></span>
20273
20274 *=bar <span>foo]]</span>=
20275
20276 * <s></s>: a
20277 !! html
20278 <ul><li> bar <span>[[foo]]</span></li></ul>
20279 <ul><li>=bar <span>[[foo]]</span></li></ul>
20280 <ul><li>[[bar <span>[[foo]]</span></li></ul>
20281 <ul><li>]]bar <span>[[foo]]</span></li></ul>
20282 <ul><li>=bar <span>foo]]</span>=</li></ul>
20283 <ul><li> <s></s>: a</li></ul>
20284
20285 !!end
20286
20287 !! test
20288 Lists: 6. Escape bullets in SOL position
20289 !! options
20290 parsoid
20291 !! wikitext
20292 <!--cmt--><nowiki>*foo</nowiki>
20293 !! html
20294 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
20295 !!end
20296
20297 !! test
20298 Lists: 7. Escape bullets in a multi-line context
20299 !! wikitext
20300 a
20301 <nowiki>*</nowiki>b
20302 !! html
20303 <p>a
20304 *b
20305 </p>
20306 !!end
20307
20308 #### --------------- HRs ---------------
20309 #### 1. Single line
20310 #### -----------------------------------
20311
20312 !! test
20313 HRs: 1. Single line
20314 !! options
20315 parsoid
20316 !! wikitext
20317 ----<nowiki>----</nowiki>
20318 ----=foo=
20319 ----*foo
20320 !! html
20321 <hr><p><span typeof="mw:Nowiki">----</span></p>
20322 <hr><p>=foo=</p>
20323 <hr><p>*foo</p>
20324 !! end
20325
20326 #### --------------- Tables ---------------
20327 #### 1a. Simple example
20328 #### 1b. No escaping needed (!foo)
20329 #### 1c. No escaping needed (|foo)
20330 #### 1d. No escaping needed (|}foo)
20331 ####
20332 #### 2a. Nested in td (<td>foo|bar</td>)
20333 #### 2b. Nested in td (<td>foo||bar</td>)
20334 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
20335 ####
20336 #### 3a. Nested in th (<th>foo!bar</th>)
20337 #### 3b. Nested in th (<th>foo!!bar</th>)
20338 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
20339 ####
20340 #### 4a. Escape -
20341 #### 4b. Escape +
20342 #### 4c. No escaping needed
20343 #### --------------------------------------
20344
20345 !! test
20346 Tables: 1a. Simple example
20347 !! wikitext
20348 <nowiki>{|
20349 |}</nowiki>
20350 !! html
20351 <p>{|
20352 |}
20353 </p>
20354 !! end
20355
20356 !! test
20357 Tables: 1b. No escaping needed
20358 !! wikitext
20359 !foo
20360 !! html
20361 <p>!foo
20362 </p>
20363 !! end
20364
20365 !! test
20366 Tables: 1c. No escaping needed
20367 !! wikitext
20368 |foo
20369 !! html
20370 <p>|foo
20371 </p>
20372 !! end
20373
20374 !! test
20375 Tables: 1d. No escaping needed
20376 !! wikitext
20377 |}foo
20378 !! html
20379 <p>|}foo
20380 </p>
20381 !! end
20382
20383 !! test
20384 Tables: 2a. Nested in td
20385 !! options
20386 parsoid=html2wt
20387 !! wikitext
20388 {|
20389 |<nowiki>foo|bar</nowiki>
20390 |-
20391 |x<div><nowiki>a|b</nowiki></div>
20392 |}
20393 !! html
20394 <table><tbody><tr>
20395 <td>foo|bar</td></tr>
20396 <tr><td>x<div>a|b</div></td>
20397 </tbody></table>
20398 !! end
20399
20400 !! test
20401 Tables: 2b. Nested in td
20402 !! options
20403 parsoid
20404 !! wikitext
20405 {|
20406 |<nowiki>foo||bar</nowiki>
20407 |''it''<nowiki>foo||bar</nowiki>
20408 |}
20409 !! html
20410 <table><tbody><tr>
20411 <td><span typeof="mw:Nowiki">foo||bar</span></td>
20412 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
20413 !! end
20414
20415 !! test
20416 Tables: 2c. Nested in td -- no escaping needed
20417 !! options
20418 parsoid
20419 !! wikitext
20420 {|
20421 |foo!!bar
20422 |}
20423 !! html
20424 <table><tbody><tr><td>foo!!bar
20425 </td></tr></tbody></table>
20426
20427 !! end
20428
20429 !! test
20430 Tables: 3a. Nested in th
20431 !! options
20432 parsoid
20433 !! wikitext
20434 {|
20435 !foo!bar
20436 |}
20437 !! html
20438 <table><tbody><tr><th>foo!bar
20439 </th></tr></tbody></table>
20440
20441 !! end
20442
20443 !! test
20444 Tables: 3b. Nested in th
20445 !! options
20446 parsoid
20447 !! wikitext
20448 {|
20449 !<nowiki>foo!!bar</nowiki>
20450 |}
20451 !! html
20452 <table>
20453 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
20454 </tbody></table>
20455 !! end
20456
20457 !! test
20458 Tables: 3c. Nested in th -- no escaping needed
20459 !! options
20460 parsoid
20461 !! wikitext
20462 {|
20463 !<nowiki>foo||bar</nowiki>
20464 |}
20465 !! html
20466 <table><tbody><tr>
20467 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
20468 !! end
20469
20470 !! test
20471 Tables: 4a. Escape -
20472 !! options
20473 parsoid
20474 !! wikitext
20475 {|
20476 !-bar
20477 |-
20478 |<nowiki>-bar</nowiki>
20479 |}
20480 !! html
20481 <table><tbody>
20482 <tr><th>-bar</th></tr>
20483 <tr>
20484 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
20485 !! end
20486
20487 !! test
20488 Tables: 4b. Escape +
20489 !! options
20490 parsoid
20491 !! wikitext
20492 {|
20493 !+bar
20494 |-
20495 |<nowiki>+bar</nowiki>
20496 |}
20497 !! html
20498 <table><tbody>
20499 <tr><th>+bar</th></tr>
20500 <tr>
20501 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
20502 !! end
20503
20504 !! test
20505 Tables: 4c. No escaping needed
20506 !! options
20507 parsoid
20508 !! wikitext
20509 {|
20510 |foo-bar
20511 |foo+bar
20512 |-
20513 |''foo''-bar
20514 |''foo''+bar
20515 |-
20516 |foo
20517 bar|baz
20518 +bar
20519 -bar
20520 |-
20521 |x
20522 <div>a|b</div>
20523 |}
20524 !! html
20525 <table><tbody>
20526 <tr><td>foo-bar</td><td>foo+bar</td></tr>
20527 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
20528 <tr><td>foo
20529 <p>bar|baz
20530 +bar
20531 -bar</p></td></tr>
20532 <tr><td>x
20533 <div>a|b</div></td>
20534 </tbody></table>
20535 !! end
20536
20537 !! test
20538 Tables: 4d. No escaping needed
20539 !! options
20540 parsoid
20541 !! wikitext
20542 {|
20543 |[[Foo]]-bar
20544 ||+1
20545 ||-2
20546 |}
20547 !! html
20548 <table>
20549 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
20550 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
20551 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
20552 </tbody></table>
20553 !! end
20554
20555 !! test
20556 Tables: Digest broken attributes on table and tr tag
20557 !! options
20558 parsoid=wt2html
20559 !! wikitext
20560 {| || |} ++
20561 |- || || ++ --
20562 |- > [
20563 |}
20564 !! html
20565 <table>
20566 <tbody>
20567 <tr></tr>
20568 <tr></tr>
20569 </tbody></table>
20570 !! end
20571
20572 #### --------------- Links ----------------
20573 #### 1. Quote marks in link text
20574 #### 2. Wikilinks: Escapes needed
20575 #### 3. Wikilinks: No escapes needed
20576 #### 4. Extlinks: Escapes needed
20577 #### 5. Extlinks: No escapes needed
20578 #### --------------------------------------
20579 !! test
20580 Links 1. Quote marks in link text
20581 !! options
20582 parsoid
20583 !! wikitext
20584 [[Foo|Foo<nowiki>''boo''</nowiki>]]
20585 !! html
20586 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
20587 !! end
20588
20589 !! test
20590 Links 2. WikiLinks: Escapes needed
20591 !! options
20592 parsoid
20593 !! wikitext
20594 [[Foo|[Foobar]]]
20595 [[Foo|<nowiki>Foobar]</nowiki>]]
20596 [[Foo|x [Foobar] x]]
20597 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
20598 [[Foo|<nowiki>[[Bar]]</nowiki>]]
20599 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
20600 [[Foo|<nowiki>|Bar</nowiki>]]
20601 [[Foo|<nowiki>]]bar</nowiki>]]
20602 [[Foo|<nowiki>[[bar</nowiki>]]
20603 [[Foo|<nowiki>x [[ y</nowiki>]]
20604 [[Foo|<nowiki>x ]] y</nowiki>]]
20605 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
20606 !! html
20607 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
20608 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
20609 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
20610 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
20611 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
20612 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
20613 <a href="Foo" rel="mw:WikiLink">|Bar</a>
20614 <a href="Foo" rel="mw:WikiLink">]]bar</a>
20615 <a href="Foo" rel="mw:WikiLink">[[bar</a>
20616 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
20617 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
20618 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
20619 !! end
20620
20621 !! test
20622 Links 3. WikiLinks: No escapes needed
20623 !! options
20624 parsoid
20625 !! wikitext
20626 [[Foo|[Foobar]]
20627 [[Foo|foo|bar]]
20628 !! html
20629 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
20630 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
20631 !! end
20632
20633 !! test
20634 Links 4. ExtLinks: Escapes needed
20635 !! options
20636 parsoid
20637 !! wikitext
20638 [http://google.com <nowiki>[google]</nowiki>]
20639 [http://google.com <nowiki>google]</nowiki>]
20640
20641 <nowiki>[http://google.com]</nowiki>
20642
20643 <nowiki>[http://google.com google]</nowiki>
20644
20645 !! html
20646 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
20647 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
20648 <p>[http://google.com]</p>
20649 <p>[http://google.com google]</p>
20650 !! end
20651
20652 !! test
20653 Links 5. ExtLinks: No escapes needed
20654 !! options
20655 parsoid
20656 !! wikitext
20657 [http://google.com [google]
20658 !! html
20659 <a href="http://google.com" rel="mw:ExtLink">[google</a>
20660 !! end
20661
20662 !! test
20663 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
20664 !! html/parsoid
20665 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
20666 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
20667 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
20668 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
20669 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
20670 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
20671 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20672 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
20673 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20674 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
20675 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
20676 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
20677 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
20678 </p>
20679 !! wikitext
20680 x<nowiki/>http://example.com<nowiki/>y
20681 http://example.com<nowiki/>?x
20682 http://example.com<nowiki/>&x
20683 http://example.com<nowiki/>'x
20684 http://example.com<nowiki/>,x
20685 http://example.com<nowiki/>.x
20686 http://example.com<nowiki/>;x
20687 http://example.com<nowiki/>:x
20688 http://example.com<nowiki/>;x
20689 http://example.com<nowiki/>!x
20690 http://example.com<nowiki/>=x
20691 http://example.com<nowiki/>(x)
20692 http://example.com(x<nowiki/>)
20693 !! end
20694
20695 !! test
20696 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20697 !! html/parsoid
20698 <p>x
20699 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
20700 y
20701 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
20702 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
20703 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
20704 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
20705 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
20706 </p>
20707 !! wikitext
20708 x
20709 http://example.com
20710 y
20711 "http://example.com"
20712 (http://example.com)
20713 (http://example.com) foo
20714 http://example.com,
20715 http://example.com, foo
20716 !! end
20717
20718 ## Parsoid currently fails wt2html on this one!
20719 !! test
20720 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20721 !! html/parsoid
20722 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
20723 !! wikitext
20724 http://example.com.,;:!?
20725 !! end
20726
20727 !! test
20728 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
20729 !! html/parsoid
20730 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
20731 !! wikitext
20732 RFC 123<nowiki/>4
20733 !! end
20734
20735 !! test
20736 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
20737 !! html/parsoid
20738 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20739 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20740 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
20741 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
20742 </p>
20743 !! wikitext
20744 xRFC 123y
20745 XRFC 123y
20746 RFC 123?foo
20747 RFC 123&foo
20748 !! end
20749
20750 !! test
20751 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
20752 !! html/parsoid
20753 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
20754 !! wikitext
20755 PMID 123<nowiki/>4
20756 !! end
20757
20758 !! test
20759 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
20760 !! html/parsoid
20761 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20762 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20763 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
20764 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
20765 </p>
20766 !! wikitext
20767 xPMID 123y
20768 XPMID 123y
20769 PMID 123?foo
20770 PMID 123&foo
20771 !! end
20772
20773 !! test
20774 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
20775 !! html/parsoid
20776 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
20777 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
20778 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
20779 </p>
20780 !! wikitext
20781 ISBN 1234567890<nowiki/>1
20782 ISBN 1234567890<nowiki/>x
20783 ISBN 1234567890<nowiki/>b
20784 !! end
20785
20786 !! test
20787 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
20788 !! html/parsoid
20789 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
20790 !! wikitext
20791 ISBN 1234567890's
20792 !! end
20793
20794 #### --------------- Quotes ---------------
20795 #### 1. Quotes inside <b> and <i>
20796 #### 2. Link fragments separated by <i> and <b> tags
20797 #### 3. Link fragments inside <i> and <b>
20798 #### 4. No escaping needed
20799 #### --------------------------------------
20800 !! test
20801 1. Quotes inside <b> and <i>
20802 !! options
20803 parsoid=html2wt,wt2wt
20804 !! wikitext
20805 ''<nowiki/>'foo'<nowiki/>''
20806 ''<nowiki>''foo''</nowiki>''
20807 ''<nowiki>'''foo'''</nowiki>''
20808 ''foo''<nowiki/>'s
20809 '''<nowiki/>'foo'<nowiki/>'''
20810 '''<nowiki>''foo''</nowiki>'''
20811 '''<nowiki>'''foo'''</nowiki>'''
20812 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
20813 '''foo'''<nowiki/>'s
20814 '<nowiki/>''foo''
20815 ''foo''<nowiki/>'
20816 '<nowiki/>''foo''<nowiki/>'
20817 '<nowiki/>'''foo'''
20818 '''foo'''<nowiki/>'
20819 '<nowiki/>'''foo'''<nowiki/>'
20820 ''fools'<span> errand</span>''
20821 ''<span>fool</span>'s errand''
20822 !! html/*
20823 <p><i>'foo'</i>
20824 <i>''foo''</i>
20825 <i>'''foo'''</i>
20826 <i>foo</i>'s
20827 <b>'foo'</b>
20828 <b>''foo''</b>
20829 <b>'''foo'''</b>
20830 <b>foo'<i>bar'</i>baz</b>
20831 <b>foo</b>'s
20832 '<i>foo</i>
20833 <i>foo</i>'
20834 '<i>foo</i>'
20835 '<b>foo</b>
20836 <b>foo</b>'
20837 '<b>foo</b>'
20838 <i>fools'<span> errand</span></i>
20839 <i><span>fool</span>'s errand</i>
20840 </p>
20841 !! end
20842
20843 !! test
20844 2. Link fragments separated by <i> and <b> tags
20845 !! wikitext
20846 [[''foo''<nowiki>hello]]</nowiki>
20847
20848 [['''foo'''<nowiki>hello]]</nowiki>
20849 !! html
20850 <p>[[<i>foo</i>hello]]
20851 </p><p>[[<b>foo</b>hello]]
20852 </p>
20853 !! end
20854
20855 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
20856 # this is one of the shortcomings of this format
20857 !! test
20858 3. Link fragments inside <i> and <b>
20859 !! wikitext
20860 ''[[foo''<nowiki>]]</nowiki>
20861
20862 '''[[foo'''<nowiki>]]</nowiki>
20863 !! html
20864 <p><i>[[foo</i>]]
20865 </p><p><b>[[foo</b>]]
20866 </p>
20867 !! end
20868
20869 !! test
20870 4. No escaping needed
20871 !! wikitext
20872 '<span>''bar''</span>'
20873 '<span>'''bar'''</span>'
20874 !! html
20875 <p>'<span><i>bar</i></span>'
20876 '<span><b>bar</b></span>'
20877 </p>
20878 !! end
20879
20880 #### ----------- Paragraphs ---------------
20881 #### 1. No unnecessary escapes
20882 #### --------------------------------------
20883
20884 !! test
20885 1. No unnecessary escapes
20886 !! wikitext
20887 bar <span><nowiki>[[foo]]</nowiki></span>
20888
20889 =bar <span><nowiki>[[foo]]</nowiki></span>
20890
20891 [[bar <span><nowiki>[[foo]]</nowiki></span>
20892
20893 ]]bar <span><nowiki>[[foo]]</nowiki></span>
20894
20895 =bar <span>foo]]</span><nowiki>=</nowiki>
20896 !! html
20897 <p>bar <span>[[foo]]</span>
20898 </p><p>=bar <span>[[foo]]</span>
20899 </p><p>[[bar <span>[[foo]]</span>
20900 </p><p>]]bar <span>[[foo]]</span>
20901 </p><p>=bar <span>foo]]</span>=
20902 </p>
20903 !!end
20904
20905 #### ----------------------- PRE --------------------------
20906 #### 1. Leading whitespace in SOL context should be escaped
20907 #### ------------------------------------------------------
20908 !! test
20909 1. Leading whitespace in SOL context should be escaped
20910 !! options
20911 parsoid
20912 !! wikitext
20913 <nowiki> </nowiki>a
20914
20915 <nowiki> </nowiki> a
20916
20917 <nowiki> </nowiki>a(tab)
20918
20919 <nowiki> </nowiki> a
20920 <!--cmt-->
20921 <nowiki> </nowiki> a
20922
20923 a
20924 <nowiki> </nowiki>b
20925
20926 a
20927 <nowiki> </nowiki>b
20928
20929 a
20930 <nowiki> </nowiki> b
20931 !! html
20932 <p> a</p>
20933 <p> a</p>
20934 <p> a(tab)</p>
20935 <p> a</p>
20936 <p><!--cmt--> a</p>
20937 <p>a
20938 b</p>
20939 <p>a
20940 b</p>
20941 <p>a
20942 b</p>
20943 !! end
20944
20945 !! test
20946 2. Leading whitespace in non-indent-pre contexts should not be escaped
20947 !! options
20948 parsoid
20949 !! wikitext
20950 foo <ref>''a''
20951 b</ref>
20952 !! html
20953 <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>
20954 !! end
20955
20956 !! test
20957 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
20958 !! options
20959 parsoid
20960 !! wikitext
20961 <blockquote>
20962 a
20963 <span>b</span>
20964 c
20965 </blockquote>
20966 !! html
20967 <blockquote>
20968 <p>
20969 a
20970 <span>b</span>
20971 c</p>
20972 </blockquote>
20973 !! end
20974
20975 !! test
20976 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
20977 !! options
20978 parsoid
20979 !! wikitext
20980 [[File:Foobar.jpg|thumb|caption]]
20981 !! html
20982 !! html/parsoid
20983 <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>
20984 !! end
20985
20986 !! test
20987 5. Nowiki escaping should account for indent-pres
20988 !! options
20989 parsoid=html2wt
20990 !! html
20991 <pre>==foo==</pre>
20992 !! wikitext
20993 ==foo==
20994 !! end
20995
20996 #### --------------- Behavior Switches --------------------
20997 !! test
20998 1. Valid behavior switches should be escaped
20999 !! options
21000 parsoid=html2wt
21001 !! wikitext
21002 <nowiki>__TOC__</nowiki>
21003 ''<nowiki>__TOC__</nowiki>''
21004 !! html
21005 __TOC__
21006 <i>__TOC__</i>
21007 !! end
21008
21009 !! test
21010 2. Invalid behavior switches should not be escaped
21011 !! options
21012 parsoid=html2wt
21013 !! wikitext
21014 __TOO__
21015 __|__
21016 !! html
21017 __TOO__
21018 __|__
21019 !! end
21020
21021 #### --------------- HTML tags ---------------
21022 #### 1. a tags
21023 #### 2. other tags
21024 #### 3. multi-line html tag
21025 #### 4. extension tags
21026 #### -----------------------------------------
21027 !! test
21028 1. a tags
21029 !! options
21030 parsoid
21031 !! wikitext
21032 <a href="http://google.com">google</a>
21033 !! html
21034 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
21035 !! end
21036
21037 !! test
21038 2. other tags
21039 !! wikitext
21040 <nowiki><div>foo</div>
21041 <div style="color:red">foo</div></nowiki>
21042 !! html
21043 <p>&lt;div&gt;foo&lt;/div&gt;
21044 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
21045 </p>
21046 !! end
21047
21048 !! test
21049 3. multi-line html tag
21050 !! wikitext
21051 <nowiki><div
21052 >foo</div
21053 ></nowiki>
21054 !! html
21055 <p>&lt;div
21056 &gt;foo&lt;/div
21057 &gt;
21058 </p>
21059 !! end
21060
21061 !! test
21062 4. extension tags
21063 !! wikitext
21064 <nowiki><ref>foo</ref></nowiki>
21065
21066 <nowiki><ref>bar</nowiki>
21067
21068 baz<nowiki></ref></nowiki>
21069 !! html
21070 <p>&lt;ref&gt;foo&lt;/ref&gt;
21071 </p><p>&lt;ref&gt;bar
21072 </p><p>baz&lt;/ref&gt;
21073 </p>
21074 !! end
21075
21076 #### --------------- Others ---------------
21077 !! test
21078 Escaping nowikis
21079 !! wikitext
21080 &lt;nowiki&gt;foo&lt;/nowiki&gt;
21081 !! html
21082 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
21083 </p>
21084 !! end
21085
21086 ## The quote-char in the input is necessary for triggering the bug
21087 !! test
21088 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
21089 !! options
21090 parsoid=wt2wt,html2wt
21091 !! wikitext
21092 foo's bar :
21093 !! html
21094 <p>foo's bar :</p>
21095 !! end
21096
21097 !! test
21098
21099 Tag-like HTML structures are passed through as text
21100 !! wikitext
21101 <x y>
21102
21103 <x.y>
21104
21105 <x-y>
21106
21107 1>2
21108
21109 x<y
21110
21111 a>b
21112
21113 1<d e>f
21114 !! html
21115 <p>&lt;x y&gt;
21116 </p><p>&lt;x.y&gt;
21117 </p><p>&lt;x-y&gt;
21118 </p><p>1&gt;2
21119 </p><p>x&lt;y
21120 </p><p>a&gt;b
21121 </p><p>1&lt;d e&gt;f
21122 </p>
21123 !! end
21124
21125
21126 # This was a bug in the PHP parser (see bug 17663 and its dups,
21127 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
21128 !! test
21129 Tag names followed by punctuation should not be recognized as tags
21130 !! wikitext
21131 <s.ome> text
21132 !! html
21133 <p>&lt;s.ome&gt; text
21134 </p>
21135 !! end
21136
21137 !! test
21138 HTML tag with necessary entities in attributes
21139 !! wikitext
21140 <span title="&amp;amp;">foo</span>
21141 !! html
21142 <p><span title="&amp;amp;">foo</span>
21143 </p>
21144 !! end
21145
21146 !! test
21147 HTML tag with 'unnecessary' entity encoding in attributes
21148 !! wikitext
21149 <span title="&amp;">foo</span>
21150 !! html
21151 <p><span title="&amp;">foo</span>
21152 </p>
21153 !! end
21154
21155 !! test
21156 HTML tag with broken attribute value quoting
21157 !! wikitext
21158 <span title="Hello world>Foo</span>
21159 !! html/php
21160 <p><span>Foo</span>
21161 </p>
21162 !! html/parsoid
21163 <p><span title="Hello world">Foo</span>
21164 </p>
21165 !! end
21166
21167 !! test
21168 Parsoid-only: HTML tag with broken attribute value quoting
21169 !! options
21170 parsoid
21171 !! wikitext
21172 <span title="Hello world>Foo</span>
21173 !! html
21174 <p><span title="Hello world">Foo</span>
21175 </p>
21176 !! end
21177
21178 !! test
21179 Table with broken attribute value quoting
21180 !! wikitext
21181 {|
21182 | title="Hello world|Foo
21183 |}
21184 !! html/php
21185 <table>
21186 <tr>
21187 <td>Foo
21188 </td></tr></table>
21189
21190 !! html/parsoid
21191 <table>
21192 <tr>
21193 <td title="Hello world">Foo
21194 </td></tr></table>
21195
21196 !! end
21197
21198 !! test
21199 Table with broken attribute value quoting on consecutive lines
21200 !! wikitext
21201 {|
21202 | title="Hello world|Foo
21203 | style="color:red|Bar
21204 |}
21205 !! html/php
21206 <table>
21207 <tr>
21208 <td>Foo
21209 </td>
21210 <td>Bar
21211 </td></tr></table>
21212
21213 !! html/parsoid
21214 <table><tbody>
21215 <tr>
21216 <td title="Hello world">Foo
21217 </td><td style="color: red">Bar
21218 </td></tr></tbody></table>
21219
21220 !! end
21221
21222 !! test
21223 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21224 !! options
21225 parsoid
21226 !! wikitext
21227 {{}}
21228 !! html
21229 {{}}
21230 !! end
21231
21232 !! test
21233 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21234 !! options
21235 parsoid
21236 !! wikitext
21237 }}{{
21238 !! html
21239 }}{{
21240 !! end
21241
21242 !!test
21243 Accept empty td cell attribute
21244 !! wikitext
21245 {|
21246 | align="center" | foo || |
21247 |}
21248 !! html
21249 <table>
21250 <tr>
21251 <td align="center"> foo </td>
21252 <td>
21253 </td></tr></table>
21254
21255 !!end
21256
21257 !!test
21258 Non-empty attributes in th-cells
21259 !! wikitext
21260 {|
21261 ! Foo !! style="color: red" | Bar
21262 |}
21263 !! html
21264 <table>
21265 <tr>
21266 <th> Foo </th>
21267 <th style="color: red"> Bar
21268 </th></tr></table>
21269
21270 !!end
21271
21272 !!test
21273 Accept empty attributes in th-cells
21274 !! wikitext
21275 {|
21276 !| foo !!| bar
21277 |}
21278 !! html
21279 <table>
21280 <tr>
21281 <th> foo </th>
21282 <th> bar
21283 </th></tr></table>
21284
21285 !!end
21286
21287 !!test
21288 Empty table rows go away
21289 !! wikitext
21290 {|
21291 | Hello
21292 | there
21293 |- class="foo"
21294 |-
21295 |}
21296 !! html
21297 <table>
21298 <tr>
21299 <td> Hello
21300 </td>
21301 <td> there
21302 </td></tr>
21303
21304 </table>
21305
21306 !! end
21307
21308 ###
21309 ### Parsoid-centric tests for testing RTing of inter-element separators
21310 ### Edge cases not tested by existing parser tests and specific to
21311 ### Parsoid-specific serialization strategies.
21312 ###
21313
21314 !!test
21315 RT-ed inter-element separators should be valid separators
21316 !! wikitext
21317 {|
21318 |- [[foo]]
21319 |}
21320 !! html
21321 <table>
21322
21323 </table>
21324
21325 !!end
21326
21327 # Parsoid-only since PHP parser relies on Tidy for correct output
21328 !!test
21329 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
21330 !!options
21331 parsoid
21332 !! wikitext
21333 {|
21334 |<small>foo
21335 bar
21336 |}
21337
21338 {|
21339 |<small>foo<small>
21340 |}
21341 !! html
21342 <table>
21343 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
21344 <p>bar</p></small></td></tr>
21345 </tbody></table>
21346
21347 <table>
21348 <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>
21349 </tbody></table>
21350 !!end
21351
21352 !!test
21353 Empty TD followed by TD with tpl-generated attribute
21354 !! wikitext
21355 {|
21356 |-
21357 |
21358 |{{echo|style='color:red'}}|foo
21359 |}
21360 !! html
21361 <table>
21362
21363 <tr>
21364 <td>
21365 </td>
21366 <td>foo
21367 </td></tr></table>
21368
21369 !!end
21370
21371 !!test
21372 Indented table with an empty td
21373 !! wikitext
21374 {|
21375 |-
21376 |
21377 |foo
21378 |}
21379 !! html
21380 <table>
21381
21382 <tr>
21383 <td>
21384 </td>
21385 <td>foo
21386 </td></tr></table>
21387
21388 !!end
21389
21390 !!test
21391 Indented block & table
21392 !! wikitext
21393 <div>foo</div>
21394 {|
21395 |foo
21396 |}
21397 !! html/php
21398 <div>foo</div>
21399 <table>
21400 <tr>
21401 <td>foo
21402 </td></tr></table>
21403
21404 !! html/parsoid
21405 <div data-parsoid='{"stx":"html"}'>foo</div>
21406 <table><tbody>
21407 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
21408 </tbody></table>
21409 !!end
21410
21411 !! test
21412 Indent and comment before table row
21413 !! wikitext
21414 {|
21415 <!--hi-->|-
21416 | there
21417 |}
21418 !! html/php
21419 <table>
21420
21421 <tr>
21422 <td> there
21423 </td></tr></table>
21424
21425 !! html/parsoid
21426 <table>
21427 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
21428 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
21429 </tbody></table>
21430 !! end
21431
21432 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
21433 !!test
21434 Empty TR followed by a template-generated TR
21435 !!options
21436 parsoid
21437 !! wikitext
21438 {|
21439 |-
21440 {{echo|<tr><td>foo</td></tr>}}
21441 |}
21442 !! html
21443 <table>
21444 <tbody>
21445 <tr></tr>
21446 <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}}]}'>
21447 <td>foo</td></tr>
21448 </tbody></table>
21449 !!end
21450
21451 ## PHP and parsoid output differ for this, and since this is primarily
21452 ## for testing Parsoid's serializer, marking this Parsoid only
21453 !!test
21454 Empty TR followed by mixed-ws-comment line should RT correctly
21455 !!options
21456 parsoid
21457 !! wikitext
21458 {|
21459 |-
21460 <!--c-->
21461 |-
21462 <!--c--> <!--d-->
21463 |}
21464 !! html
21465 <table>
21466 <tbody>
21467 <tr></tr>
21468 <!--c-->
21469 <tr>
21470 <!--c--> </tr><!--d-->
21471 </tbody></table>
21472
21473 !!end
21474
21475 !!test
21476 Multi-line image caption generated by templates with/without trailing newlines
21477 !! wikitext
21478 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
21479 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
21480 !! html/parsoid
21481 <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>
21482 <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>
21483 !!end
21484
21485 !! test
21486 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
21487 !! options
21488 parsoid=html2wt
21489 !! wikitext
21490 <includeonly>foo</includeonly>
21491 new para
21492
21493 [[./Category:Foo]]
21494
21495 = new heading =
21496 !! html
21497 <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>
21498
21499 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
21500 !! end
21501
21502 ## PHP emits broken html for this, and since this is primarily
21503 ## a Parsoid serializer test, marking this Parsoid only
21504 !!test
21505 Improperly nested inline or quotes tags with whitespace in between
21506 !!options
21507 parsoid
21508 !! wikitext
21509 <span> <s>x</span> </s>
21510 ''' ''x''' ''
21511 !! html
21512 <p><span> <s>x</s></span><s> </s>
21513 <b> <i>x</i></b><i> </i>
21514 </p>
21515 !!end
21516
21517 !!test
21518 Encapsulate protected attributes from wt
21519 !!options
21520 parsoid
21521 !! wikitext
21522 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
21523 !! html
21524 <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>
21525 </body>
21526 !!end
21527
21528 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
21529 ## Having nested or stray pre tags results in the attempt to add duplicates,
21530 ## causing an assertion fail. This test tries to prevent that situation.
21531 !!test
21532 Ensure ParagraphWrapper can deal with stray closing pre tags
21533 !!options
21534 parsoid=wt2html
21535 !! wikitext
21536 plain text</pre>
21537 !! html
21538 plain text
21539 !!end
21540
21541 !!test
21542 1. Ensure fostered text content is wrapped in element nodes
21543 !!options
21544 parsoid=wt2html
21545 !! wikitext
21546 <table>hi</table><table>ho</table>
21547 !! html
21548 <p>hi</p>
21549 <table></table>
21550 <p>ho</p>
21551 <table></table>
21552 !!end
21553
21554 !!test
21555 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
21556 !!options
21557 parsoid=wt2html,wt2wt
21558 !! wikitext
21559 <table>
21560 <tr> || ||
21561 <td> a
21562 </table>
21563 !! html
21564 <p> || ||
21565 </p><table>
21566 <tbody><tr><td> a</td></tr>
21567 </tbody></table>
21568 !!end
21569
21570 !!test
21571 Encapsulation properly handles null DSR information from foster box
21572 !!options
21573 parsoid=wt2html,wt2wt
21574 !! wikitext
21575 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
21576 !! html
21577 <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>
21578 !!end
21579
21580 !!test
21581 1. Encapsulate foster-parented transclusion content
21582 !!options
21583 parsoid=wt2wt,wt2html
21584 !! wikitext
21585 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
21586 !! html
21587 <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>
21588 <tbody>
21589 <tr>
21590 <td>bar</td>
21591 </tr>
21592 </tbody>
21593 </table>
21594 !!end
21595
21596 !!test
21597 2. Encapsulate foster-parented transclusion content
21598 !!options
21599 parsoid=wt2wt,wt2html
21600 !! wikitext
21601 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
21602 !! html
21603 <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>
21604 <table>
21605 <tbody>
21606 <tr>
21607 <td>bar</td>
21608 </tr>
21609 </tbody>
21610 </table>
21611 !!end
21612
21613 !!test
21614 3. Encapsulate foster-parented transclusion content
21615 !!options
21616 parsoid=wt2wt,wt2html
21617 !! wikitext
21618 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21619 !! html
21620 <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;]}">
21621 <p>foo</p>
21622 </div>
21623 <table>
21624 <tbody>
21625 <tr>
21626 <td>bar</td>
21627 </tr>
21628 </tbody>
21629 </table>
21630 !!end
21631
21632 !!test
21633 4. Encapsulate foster-parented transclusion content
21634 !!options
21635 parsoid=wt2wt,wt2html
21636 !! wikitext
21637 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21638 !! html
21639 <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;]}">
21640 <p>foo</p>
21641 </div>
21642 <table>
21643 <tbody>
21644 <tr>
21645 <td>bar</td>
21646 </tr>
21647 </tbody>
21648 </table>
21649 !!end
21650
21651 !!test
21652 5. Encapsulate foster-parented transclusion content
21653 !!options
21654 parsoid=wt2wt,wt2html
21655 !! wikitext
21656 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
21657 !! html
21658 <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>
21659 <table>
21660 <tbody>
21661 <tr>
21662 <td>
21663 <div>
21664 <p>foo</p>
21665 </div>
21666 </td>
21667 </tr>
21668 </tbody>
21669 </table>
21670 !!end
21671
21672 !!test
21673 6. Encapsulate foster-parented transclusion content
21674 !!options
21675 parsoid=wt2wt,wt2html
21676 !! wikitext
21677 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
21678 !! html
21679 <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>
21680 <table>
21681 <tbody>
21682 <tr>
21683 <td>
21684 <div>
21685 <p>foo</p>
21686 </div>
21687 </td>
21688 </tr>
21689 </tbody>
21690 </table>
21691 <p>ok</p>
21692 !!end
21693
21694 !!test
21695 7. Encapsulate foster-parented transclusion content
21696 !!options
21697 parsoid=wt2wt,wt2html
21698 !! wikitext
21699 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
21700 !! html
21701 <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>
21702 <table>
21703 <tbody>
21704 <tr>
21705 <td>bar</td>
21706 </tr>
21707 </tbody>
21708 </table>
21709 !!end
21710
21711 !!test
21712 8. Encapsulate foster-parented transclusion content
21713 !!options
21714 parsoid=wt2wt,wt2html
21715 !! wikitext
21716 {{echo|a
21717 }}{|{{echo|style='color:red'}}
21718 |-
21719 |b
21720 |}
21721 !! html
21722 <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>
21723 <tbody>
21724 <tr>
21725 <td>b</td>
21726 </tr>
21727 </tbody>
21728 </table>
21729 !!end
21730
21731 !!test
21732 9. Encapsulate foster-parented transclusion content
21733 !!options
21734 parsoid=wt2wt,wt2html
21735 !! wikitext
21736 <table>{{echo|hi</table>hello}}
21737 !! html
21738 <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>
21739 !!end
21740
21741 !!test
21742 Table in fosterable position
21743 !!options
21744 parsoid=wt2html,wt2wt
21745 !! wikitext
21746 {{OpenTable}}
21747 <div>
21748 {|
21749 |}
21750 </div>
21751 |}
21752 !! html
21753 <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">
21754 </span>
21755 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
21756
21757 <table>
21758 </table>
21759 !!end
21760
21761 # Parsoid only for bug 64747
21762 !! test
21763 Properly encapsulate empty-content transclusions in fosterable positions
21764 !! wikitext
21765 <table>
21766 {{#if:|
21767 <td>foo</td>
21768 }}
21769 </table>
21770 !! html/parsoid
21771 <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>"}'>
21772
21773 </table>
21774 !! end
21775
21776 !!test
21777 Support <object> element with .data attribute
21778 !!options
21779 parsoid=html2wt
21780 !! wikitext
21781 <object data="test.swf"></object>
21782 !! html
21783 <object data="test.swf"></object>
21784 !!end
21785
21786 !! test
21787 Don't block XML namespace declaration
21788 !! wikitext
21789 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
21790 !! html/php
21791 <p><span>MediaWiki</span>
21792 </p>
21793 !! html/parsoid
21794 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
21795 !! end
21796
21797 # -----------------------------------------------------------------
21798 # The following section of tests are primarily to spec requirements
21799 # around serialization of new/edited content.
21800 #
21801 # All these tests are marked Parsoid html2wt and html2html only
21802 # ----------------------------------------------------------------
21803
21804 # 'mi' is a localinterwiki prefix as well as a language
21805 !! test
21806 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
21807 !! options
21808 parsoid=html2wt
21809 !! wikitext
21810 [[Foo]]
21811 !! html
21812 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
21813 !! end
21814
21815 !! test
21816 New wiki links (href variations)
21817 !! options
21818 parsoid=html2wt
21819 !! html
21820 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
21821 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
21822 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
21823 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
21824 !! wikitext
21825 [[Foo_bar]]
21826 [[Foo_bar]]
21827 [[Foo_bar]]
21828 [[Toxine bactérienne]]
21829 !! end
21830
21831 !! test
21832 New wiki links (content string variations)
21833 !! options
21834 parsoid=html2wt
21835 !! html
21836 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
21837 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
21838 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
21839 !! wikitext
21840 [[Foo_bar]]
21841 [[Foo bar]]
21842 [[Foo_bar|./Foo_bar]]
21843 !! end
21844
21845 !! test
21846 New category links (href variations)
21847 !! options
21848 parsoid=html2wt
21849 !! html
21850 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
21851 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
21852 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
21853 !! wikitext
21854 [[Category:Toxine bactérienne]]
21855 [[Category:Toxine bactérienne]]
21856 [[Category:Toxine bactérienne]]
21857 !! end
21858
21859 !! test
21860 New interlanguage links (href variations)
21861 !! options
21862 parsoid=html2wt
21863 !! html
21864 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
21865 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
21866 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
21867 !! wikitext
21868 [[es:Toxine bactérienne]]
21869 [[es:Toxine_bactérienne]]
21870 [[es:Toxine_bactérienne]]
21871 !! end
21872
21873 !! test
21874 Image: Modifying size of an image (1)
21875 !! options
21876 parsoid={
21877 "modes": ["wt2wt"],
21878 "changes": [
21879 ["img[height]", "attr", "height", "22"],
21880 ["img[width]", "attr", "width", "200"]
21881 ]
21882 }
21883 !! wikitext
21884 [[Image:Foobar.jpg|230x230px]]
21885 !! wikitext/edited
21886 [[Image:Foobar.jpg|200x200px]]
21887 !!end
21888
21889 !! test
21890 Image: Modifying size of an image (2)
21891 !! options
21892 parsoid={
21893 "modes": ["wt2wt"],
21894 "changes": [
21895 ["img[height]", "attr", "height", "100"],
21896 ["img[width]", "attr", "width", "500"]
21897 ]
21898 }
21899 !! wikitext
21900 [[Image:Foobar.jpg|230x230px]]
21901 !! wikitext/edited
21902 [[Image:Foobar.jpg|500x500px]]
21903 !!end
21904
21905 # Change in size is ignored so long as class='mw-default-size'
21906 !! test
21907 Image: Modifying size of an image (3)
21908 !! options
21909 parsoid={
21910 "modes": ["wt2wt"],
21911 "changes": [
21912 ["figure[class]", "removeClass", "mw-default-size"],
21913 ["figure img", "attr", "height", "19"],
21914 ["figure img", "attr", "width", "170"]
21915 ]
21916 }
21917 !! wikitext
21918 [[Image:Foobar.jpg|thumb]]
21919 !! wikitext/edited
21920 [[Image:Foobar.jpg|thumb|170x170px]]
21921 !!end
21922
21923 !! test
21924 Image: Modifying alignment of an image (bug 48665)
21925 !! options
21926 parsoid={
21927 "modes": ["wt2wt"],
21928 "changes": [
21929 ["figure[class]", "removeClass", "mw-halign-right"],
21930 ["figure[class]", "addClass", "mw-halign-left"]
21931 ]
21932 }
21933 !! wikitext
21934 [[Image:Foobar.jpg|thumb|caption|right]]
21935 !! wikitext/edited
21936 [[Image:Foobar.jpg|thumb|caption|left]]
21937 !! end
21938
21939 !! test
21940 Image: Modifying mw-default-size of an frameless image (bug 62805)
21941 !! options
21942 parsoid={
21943 "modes": ["wt2wt"],
21944 "changes": [
21945 ["figure.mw-default-size", "removeClass", "mw-default-size"]
21946 ]
21947 }
21948 !! wikitext
21949 [[Image:Foobar.jpg|frameless|right]]
21950 !! wikitext/edited
21951 [[Image:Foobar.jpg|frameless|right|220x220px]]
21952 !! end
21953
21954 !! test
21955 Image: Modifying valign of an image (bug 49221)
21956 !! options
21957 parsoid={
21958 "modes": ["wt2wt"],
21959 "changes": [
21960 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
21961 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
21962 ]
21963 }
21964 !! wikitext
21965 [[File:Foobar.jpg|20px|middle]]
21966 !! wikitext/edited
21967 [[File:Foobar.jpg|20px|text-top]]
21968 !! end
21969
21970 !! test
21971 Image: Modifying alt attribute of an image (bug 56400)
21972 !! options
21973 parsoid={
21974 "modes": ["wt2wt"],
21975 "changes": [
21976 ["img[alt]", "attr", "alt", "some alternate edited text"]
21977 ]
21978 }
21979 !! wikitext
21980 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
21981 !! wikitext/edited
21982 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
21983 !!end
21984
21985 !! test
21986 Image: Modifying caption of an image
21987 !! options
21988 parsoid={
21989 "modes": ["wt2wt"],
21990 "changes": [
21991 ["figcaption", "text", "new caption"]
21992 ]
21993 }
21994 !! wikitext
21995 [[Image:Foobar.jpg|thumb|original caption]]
21996 !! wikitext/edited
21997 [[Image:Foobar.jpg|thumb|new caption]]
21998 !!end
21999
22000 !! test
22001 Image: empty alt attribute (bug 48924)
22002 !! options
22003 parsoid
22004 !! wikitext
22005 [[File:Foobar.jpg|thumb|alt=|bar]]
22006 !! html
22007 <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>
22008 !! end
22009
22010 #!! test
22011 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
22012 #!! options
22013 #parsoid=html2wt
22014 #language=ar
22015 #!! wikitext
22016 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
22017 #!! html
22018 #<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>
22019 #!! end
22020
22021 !! test
22022 Image: Block level image should have \n before and after
22023 !! wikitext
22024 123
22025 [[File:Foobar.jpg|right|thumb|150x150px]]
22026 456
22027 !! html/parsoid
22028 <p>123</p>
22029 <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>
22030 <p>456</p>
22031 !!end
22032
22033 !! test
22034 Image: New block level image should have \n before and after (existing content)
22035 !! wikitext
22036 123
22037 [[File:Foobar.jpg|right|thumb|150x150px]]
22038 456
22039 !! html/parsoid
22040 <p>123</p>
22041 <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>
22042 <p>456</p>
22043 !!end
22044
22045 !! test
22046 Image: upright option (parsoid)
22047 !! options
22048 parsoid
22049 !! wikitext
22050 [[File:Foobar.jpg|thumb|upright|caption]]
22051 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
22052 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
22053 !! html
22054 <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>
22055 <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>
22056 <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>
22057 !!end
22058
22059 !! test
22060 Image: upright option is ignored on inline and frame images (parsoid)
22061 !! options
22062 parsoid
22063 !! wikitext
22064 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
22065 !! html
22066 <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>
22067 !!end
22068
22069 !! test
22070 Image: from basic HTML (1)
22071 !! options
22072 parsoid=html2wt
22073 !! html/parsoid
22074 <span typeof="mw:Image">
22075 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22076 </span>
22077 !! wikitext
22078 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22079 !! end
22080
22081 !! test
22082 Image: from basic HTML (2)
22083 !! options
22084 parsoid=html2wt
22085 !! html/parsoid
22086 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22087 !! wikitext
22088 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22089 !! end
22090
22091 !! test
22092 Image: from basic HTML (3)
22093 !! options
22094 parsoid=html2wt
22095 !! html/parsoid
22096 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
22097 !! wikitext
22098 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
22099 !! end
22100
22101 !! test
22102 Image: from basic HTML (4)
22103 !! options
22104 parsoid=html2wt
22105 !! html/parsoid
22106 <img src="File:Foobar.jpg">
22107 !! wikitext
22108 [[File:Foobar.jpg|link=]]
22109 !! end
22110
22111 !! test
22112 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
22113 !! options
22114 parsoid=html2wt
22115 !! wikitext
22116 * foo
22117 !! html
22118 <ul>
22119 <li><p>foo</p></li>
22120 </ul>
22121 !! end
22122
22123 !! test
22124 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
22125 !! options
22126 parsoid=html2wt
22127 !! wikitext
22128 * foo
22129 !! html
22130 <ul> <li>foo</li></ul>
22131 !! end
22132
22133 !! test
22134 Don't strip leading whitespace when handling indent-pre suppressing tags
22135 !! options
22136 parsoid=html2wt
22137 !! wikitext
22138 {|
22139 | indented row
22140 |}
22141 <blockquote>
22142 '''This is very bold of you!'''
22143
22144 {|
22145 |
22146 indented cell (no pre-wrapping!)
22147 |}
22148 </blockquote>
22149 foo
22150 <div>bar</div>
22151 !! html
22152 <table>
22153 <tr><td> indented row</td></tr>
22154 </table>
22155 <blockquote><p>
22156 <b>This is very bold of you!</b>
22157 </p>
22158 <table><tr><td>
22159 indented cell (no pre-wrapping!)
22160 </td></tr></table>
22161 </blockquote>
22162 <p>foo</p>
22163 <div>bar</div>
22164 !! end
22165
22166 !! test
22167 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
22168 !! options
22169 parsoid=html2wt
22170 !! wikitext
22171 foo
22172 <nowiki> </nowiki><span>bar</span>
22173
22174 <span>foo2
22175 <nowiki> </nowiki></span>bar2
22176
22177 <div>foo</div>
22178 <nowiki> </nowiki><span>bar</span>
22179
22180 <div>
22181 <nowiki> </nowiki><span>foo</span>
22182 </div>
22183 !! html
22184 <p>foo</p>
22185 <span>bar</span>
22186
22187 <span>foo2
22188 </span>bar2
22189
22190 <div>foo</div>
22191 <span>bar</span>
22192
22193 <div>
22194 <span>foo</span>
22195 </div>
22196 !! end
22197
22198 !! test
22199 Lists: Add space after bullets
22200 !! options
22201 parsoid=html2wt
22202 !! wikitext
22203 * foo
22204 * bar
22205 * <span> baz</span>
22206 !! html
22207 <ul>
22208 <li>foo</li>
22209 <li> bar</li>
22210 <li><span> baz</span></li>
22211 </ul>
22212 !! end
22213
22214 !! test
22215 Lists: Dont insert newlines in a serialized list item.
22216 !! options
22217 parsoid=html2wt
22218 !! wikitext
22219 * a<br>b
22220 * c
22221 !! html
22222 <ul><li>a<br>b</li><li>c</li></ul>
22223 !! end
22224
22225 !! test
22226 Headings: Add space before/after == (Bug 51744)
22227 !! options
22228 parsoid=html2wt
22229 !! wikitext
22230 == foo ==
22231
22232 == bar ==
22233
22234 == baz ==
22235
22236 == <span> baz</span> ==
22237 !! html
22238 <h2>foo</h2>
22239 <h2> bar</h2>
22240 <h2>baz </h2>
22241 <h2><span> baz</span></h2>
22242 !! end
22243
22244 !! test
22245 Parsoid: Serialize positional parameters with = in them as named parameter
22246 !! options
22247 parsoid=html2wt
22248 !! wikitext
22249 {{echo|1 = f=oo}}
22250
22251 {{echo|1 = f=oo|2 = bar}}
22252
22253 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22254 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22255 {{echo|<nowiki>f=oo</nowiki>|bar}}
22256 !! html
22257 <p about="#mwt1" typeof="mw:Transclusion"
22258 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
22259
22260 <p about="#mwt1" typeof="mw:Transclusion"
22261 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
22262
22263 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22264 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22265 <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>
22266 !! end
22267
22268 !! test
22269 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
22270 !! options
22271 parsoid=html2wt
22272 !! wikitext
22273 <div>a
22274 b
22275 </div>
22276 <div>a
22277 b
22278 </div>
22279 <div>
22280 a
22281
22282 b
22283 </div>
22284 !! html
22285 <div>a<p>b</p></div>
22286 <div>a
22287 <p>b</p></div>
22288 <div>
22289 a
22290 <p>b</p></div>
22291 !! end
22292
22293 !! test
22294 Substrings resembling wikitext in hrefs should not get nowiki escapes
22295 !! options
22296 parsoid=html2wt
22297 !! wikitext
22298 [[Foo''bar''baz]]
22299 !! html
22300 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
22301 !! end
22302
22303 #-----------------------------
22304 # I/B quote minimization tests
22305 #-----------------------------
22306
22307 !! test
22308 1. I/B quote minimization: wikitext-only tags should be combined
22309 !! options
22310 parsoid=html2wt
22311 !! wikitext
22312 ''AB''
22313
22314 '''AB'''
22315
22316 ''A'''B'''''
22317
22318 '''A''B'''''
22319
22320 '''A''BC''D'''
22321
22322 '''''AB'''''
22323
22324 '''''AB'''''
22325
22326 '''''AB'''''
22327 !! html
22328 <p><i>A</i><i>B</i></p>
22329 <p><b>A</b><b>B</b></p>
22330 <p><i>A</i><b><i>B</i></b></p>
22331 <p><b>A</b><i><b>B</b></i></p>
22332 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
22333 <p><i><b>A</b></i><i><b>B</b></i></p>
22334 <p><i><b>A</b></i><b><i>B</i></b></p>
22335 <p><b><i>A</i></b><i><b>B</b></i></p>
22336 !! end
22337
22338 !! test
22339 2. I/B quote minimization: wikitext and html tags should not be combined
22340 !! options
22341 parsoid=html2wt
22342 !! wikitext
22343 ''A''<i>B</i>
22344
22345 ''A''<nowiki/>'''<i>B</i>'''
22346 !! html
22347 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
22348 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
22349 !! end
22350
22351 !! test
22352 3. I/B quote minimization: templated content stops minimization
22353 !! options
22354 parsoid=html2wt
22355 !! wikitext
22356 ''A''{{echo|''B''}}
22357
22358 ''A''{{echo|'''''B'''''}}
22359 !! html
22360 <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>
22361 <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>
22362 !! end
22363
22364 !! test
22365 4. I/B quote minimization: new content should be mimimized with adjacent old content
22366 !! options
22367 parsoid=html2wt
22368 !! wikitext
22369 ''AB''
22370
22371 '''AB'''
22372
22373 ''A'''B'''''
22374 !! html
22375 <p><i>A</i><i>B</i></p>
22376 <p><b>A</b><b>B</b></p>
22377 <p><i>A</i><b><i>B</i></b></p>
22378 !! end
22379
22380 #------------------------------------
22381 # End of I/B quote minimization tests
22382 #------------------------------------
22383
22384 !!test
22385 Bug 54262: New entities
22386 !! options
22387 parsoid=html2wt
22388 !! wikitext
22389 &nbsp;
22390 !! html
22391 <span typeof="mw:Entity">&nbsp;</span>
22392 !! end
22393
22394 ## Note that there is no wikitext output for 'unknownproperty' ##
22395 ## Unknown magic words are silently dropped ##
22396
22397 !! test
22398 Magic words
22399 !! options
22400 parsoid=html2wt
22401 !! wikitext
22402 __TOC__
22403 __NOTOC__
22404 __FORCETOC__
22405 __INDEX__
22406 __NOINDEX__
22407 __NOGALLERY__
22408 __NOEDITSECTION__
22409 __NOTITLECONVERT__
22410 __NOCONTENTCONVERT__
22411 !! html
22412 <meta property='mw:PageProp/toc' />
22413 <meta property='mw:PageProp/notoc' />
22414 <meta property='mw:PageProp/forcetoc' />
22415 <meta property='mw:PageProp/index' />
22416 <meta property='mw:PageProp/noindex' />
22417 <meta property='mw:PageProp/nogallery' />
22418 <meta property='mw:PageProp/noeditsection' />
22419 <meta property='mw:PageProp/notitleconvert' />
22420 <meta property='mw:PageProp/nocontentconvert' />
22421 <meta property='mw:PageProp/unknownproperty' />
22422 !! end
22423
22424 !! test
22425 Consecutive <pre>s should not get merged
22426 !! options
22427 parsoid=html2wt,html2html
22428 !! wikitext
22429 a
22430
22431 b
22432
22433 c
22434
22435 d
22436
22437 e
22438
22439
22440
22441 f
22442 !! html
22443 <pre>a</pre><pre>b</pre>
22444
22445 <pre>c
22446 </pre><pre>
22447 d</pre>
22448
22449 <pre>e
22450
22451 </pre><pre>
22452
22453 f</pre>
22454 !! end
22455
22456 !! test
22457 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
22458 !! options
22459 parsoid=html2wt
22460 !! wikitext
22461 [[Special:BookSources/1234567890|ISBN 1234567895]]
22462 !! html
22463 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
22464 !! end
22465
22466 !! test
22467 Edited RFC links not serializable as RFC links should serialize as extlinks
22468 !! options
22469 parsoid=html2wt
22470 !! wikitext
22471 [//tools.ietf.org/html/rfc123 New RFC]
22472 !! html
22473 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
22474 !! end
22475
22476 !! test
22477 Edited PMID links not serializable as PMID links should serialize as extlinks
22478 !! options
22479 parsoid=html2wt
22480 !! wikitext
22481 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
22482 !! html
22483 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
22484 !! end
22485
22486 !! test
22487 Edited Redirect link should emit a non-piped wikitext link
22488 !! options
22489 parsoid=html2wt
22490 !! wikitext
22491 #REDIRECT [[Bar]]
22492 !! html
22493 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
22494 !! end
22495
22496 !! test
22497 T75121: Infer extension name from typeOf if data-mw is not present
22498 !! options
22499 parsoid=html2wt
22500 !! wikitext
22501 <foo />
22502 !! html
22503 <div typeOf="mw:Extension/foo"></div>
22504 !! end
22505
22506 # -----------------------------------------------------------------
22507 # End of section for Parsoid-only html2wt tests for serialization
22508 # of new content
22509 # -----------------------------------------------------------------
22510
22511 TODO:
22512 more images
22513 more tables
22514 character entities
22515 and much more
22516 Try for 100% code coverage