Merge "Add parser tests for tables with pipes and wikilinks"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well-formedness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-specific options (not run by PHP parser unless
25 # the test includes an html/php section)
26 # php php-only test (not run by the parsoid parser unless
27 # the test includes an html/parsoid section)
28 # showtitle make the first line the title
29 # comment run through Linker::formatComment() instead of main parser
30 # local format section links in edit comment text as local links
31 # notoc disable table of contents
32 # thumbsize=NNN set the default thumb size to NNNpx for this test
33 #
34 # You can also set the following parser properties via test options:
35 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
36 # wgLinkHolderBatchSize, wgRawHtml
37 #
38 # For testing purposes, temporary articles can created:
39 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
40 # where '/' denotes a newline.
41
42 # This is the standard article assumed to exist.
43 !! article
44 Main Page
45 !! text
46 blah blah
47 !! endarticle
48
49 !!article
50 Foo
51 !!text
52 FOO
53 !!endarticle
54
55 !!article
56 Template:Foo
57 !!text
58 FOO
59 !!endarticle
60
61 !! article
62 Template:Blank
63 !! text
64 !! endarticle
65
66 !! article
67 Template:pipe
68 !! text
69 |
70 !! endarticle
71
72 !!article
73 MediaWiki:bad image list
74 !!text
75 * [[File:Bad.jpg]] except [[Nasty page]]
76 !!endarticle
77
78 !! article
79 Template:inner list
80 !! text
81 * item 1
82 !! endarticle
83
84 !! article
85 Template:tbl-start
86 !! text
87 {|
88 !! endarticle
89
90 !! article
91 Template:tbl-end
92 !! text
93 |}
94 !! endarticle
95
96 !! article
97 Template:echo
98 !! text
99 {{{1}}}
100 !! endarticle
101
102 !! article
103 Template:echo_with_span
104 !! text
105 <span>{{{1}}}</span>
106 !! endarticle
107
108 !! article
109 Template:echo_with_div
110 !! text
111 <div>{{{1}}}</div>
112 !! endarticle
113
114 !! article
115 Template:attr_str
116 !! text
117 {{{1}}}="{{{2}}}"
118 !! endarticle
119
120 !! article
121 Template:table_attribs
122 !! text
123 <noinclude>
124 |</noinclude>style="color: red"| Foo
125 !! endarticle
126
127 !! article
128 Template:table_cells
129 !! text
130 {{table_attribs}} || Bar || Baz
131 !! endarticle
132
133 !! article
134 Template:image_attribs
135 !! text
136 <noinclude>
137 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
138 !! endarticle
139
140 !! article
141 A?b
142 !! text
143 Weirdo titles!
144 !! endarticle
145
146 !!article
147 Template:Bullet
148 !!text
149 * Bar
150 !!endarticle
151
152 !!article
153 Template:OpenTable
154 !!text
155 {|
156 !!endarticle
157
158 !!article
159 Template:EmptyLITest
160 !!text
161 *a
162 *
163 *
164 *b
165 !!endarticle
166
167 !!article
168 Template:EmptyTRTest
169 !!text
170 {|
171 |-
172 |-
173 |foo
174 |-
175 |-
176 |bar
177 |}
178 !!endarticle
179
180 !!article
181 Template:EmptyTRWithHTMLAttrTest
182 !!text
183 <table>
184 <tr align="center"></tr>
185 <tr><td>foo</td></tr>
186 <tr align="center"></tr>
187 <tr><td>bar</td></tr>
188 </table>
189 !!endarticle
190
191 ###
192 ### Basic tests
193 ###
194 !! test
195 Blank input
196 !! wikitext
197 !! html
198 !! end
199
200
201 !! test
202 Simple paragraph
203 !! wikitext
204 This is a simple paragraph.
205 !! html
206 <p>This is a simple paragraph.
207 </p>
208 !! end
209
210 !! test
211 Paragraphs with extra newline spacing
212 !! wikitext
213 foo
214
215 bar
216
217
218 baz
219
220
221
222 booz
223 !! html
224 <p>foo
225 </p><p>bar
226 </p><p><br />
227 baz
228 </p><p><br />
229 </p><p>booz
230 </p>
231 !! end
232
233 !! test
234 Paragraphs with newline spacing with comment lines in between
235 !! wikitext
236 ----
237 a
238 <!--foo-->
239 b
240 ----
241 a
242 <!--foo--><!--More than 1 comment, still stripped-->
243 b
244 ----
245 a
246 <!--foo--> <!----> <!-- bar -->
247 b
248 ----
249 a
250 <!--foo-->
251
252 b
253 ----
254 a
255
256 <!--foo-->
257 b
258 ----
259 a
260 <!--foo-->
261
262
263 b
264 ----
265 a
266
267
268 <!--foo-->
269 b
270 ----
271 !! html
272 <hr />
273 <p>a
274 b
275 </p>
276 <hr />
277 <p>a
278 b
279 </p>
280 <hr />
281 <p>a
282 b
283 </p>
284 <hr />
285 <p>a
286 </p><p>b
287 </p>
288 <hr />
289 <p>a
290 </p><p>b
291 </p>
292 <hr />
293 <p>a
294 </p><p><br />
295 b
296 </p>
297 <hr />
298 <p>a
299 </p><p><br />
300 b
301 </p>
302 <hr />
303
304 !! end
305
306 !! test
307 Paragraphs with newline spacing with non-empty white-space lines in between
308 !! wikitext
309 ----
310 a
311
312 b
313 ----
314 a
315
316
317 b
318 ----
319 !! html
320 <hr />
321 <p>a
322 </p><p>b
323 </p>
324 <hr />
325 <p>a
326 </p><p><br />
327 b
328 </p>
329 <hr />
330
331 !! end
332
333 !! test
334 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
335 !! wikitext
336 ----
337 a
338 <!--foo-->
339 b
340 ----
341 a
342 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
343 b
344 ----
345 a
346
347 <!--foo-->
348 <!--bar-->
349 b
350 ----
351 a
352
353 <!--foo-->
354 <!--bar-->
355
356 b
357 ----
358 !! html
359 <hr />
360 <p>a
361 b
362 </p>
363 <hr />
364 <p>a
365 b
366 </p>
367 <hr />
368 <p>a
369 </p><p>b
370 </p>
371 <hr />
372 <p>a
373 </p><p><br />
374 b
375 </p>
376 <hr />
377
378 !! end
379
380 !! test
381 Extra newlines: More paragraphs with indented comment
382 !! wikitext
383 a
384
385 <!--boo-->
386
387 b
388 !! html
389 <p>a
390 </p><p><br />
391 b
392 </p>
393 !!end
394
395 !! test
396 Extra newlines followed by heading
397 !! wikitext
398 a
399
400
401
402 =b=
403 [[a]]
404
405
406 =b=
407 !! html
408 <p>a
409 </p><p><br />
410 </p>
411 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
412 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
413 </p><p><br />
414 </p>
415 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
416
417 !! end
418
419 !! test
420 Extra newlines between heading and content are swallowed
421 !! wikitext
422 =b=
423
424
425
426 [[a]]
427 !! html
428 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
429 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
430 </p>
431 !! end
432
433 !! test
434 Parsing an URL
435 !! wikitext
436 http://fr.wikipedia.org/wiki/🍺
437 <!-- EasterEgg we love beer, better be able be able to link to it -->
438 !! html
439 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
440 </p>
441 !! end
442
443 # Note that the html+tidy output removes the spaces after the <li>,
444 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
445 # This is an issue for all tests with lists. We intentionally do
446 # *not* add html+tidy clauses for these, as we don't want to
447 # document/test the broken behavior. (Parsoid matches the non-tidy
448 # output in these cases.)
449
450 !! test
451 Simple list
452 !! wikitext
453 * Item 1
454 * Item 2
455 !! html
456 <ul><li> Item 1</li>
457 <li> Item 2</li></ul>
458
459 !! end
460
461 !! test
462 Italics and bold
463 !! wikitext
464 * plain
465 * plain''italic''plain
466 * plain''italic''plain''italic''plain
467 * plain'''bold'''plain
468 * plain'''bold'''plain'''bold'''plain
469 * plain''italic''plain'''bold'''plain
470 * plain'''bold'''plain''italic''plain
471 * plain''italic'''bold-italic'''italic''plain
472 * plain'''bold''bold-italic''bold'''plain
473 * plain'''''bold-italic'''italic''plain
474 * plain'''''bold-italic''bold'''plain
475 * plain''italic'''bold-italic'''''plain
476 * plain'''bold''bold-italic'''''plain
477 * plain l'''italic''plain
478 * plain l''''bold''' plain
479 !! html
480 <ul><li> plain</li>
481 <li> plain<i>italic</i>plain</li>
482 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
483 <li> plain<b>bold</b>plain</li>
484 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
485 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
486 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
487 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
488 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
489 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
490 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
491 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
492 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
493 <li> plain l'<i>italic</i>plain</li>
494 <li> plain l'<b>bold</b> plain</li></ul>
495
496 !! end
497
498 # this example taken from the [[simple:Moon]] article (bug 47326)
499 !! test
500 Italics and possessives (1)
501 !! wikitext
502 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
503 !! html
504 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
505 </p>
506 !! end
507
508 # this example taken from [[en:Flaming Pie]] (bug 49926)
509 !! test
510 Italics and possessives (2)
511 !! wikitext
512 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
513 !! html
514 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
515 </p>
516 !! end
517
518 # this example taken from [[en:Dictionary]] (bug 49926)
519 !! test
520 Italics and possessives (3)
521 !! wikitext
522 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
523 !! html
524 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
525 </p>
526 !! end
527
528
529 ###
530 ### 2-quote opening sequence tests
531 ###
532 !! test
533 Italics and bold: 2-quote opening sequence: (2,2)
534 !! wikitext
535 ''foo''
536 !! html
537 <p><i>foo</i>
538 </p>
539 !!end
540
541 !! test
542 Italics and bold: 2-quote opening sequence: (2,3)
543 !! options
544 parsoid=wt2html
545 !! wikitext
546 ''foo'''
547 !! html/*
548 <p><i>foo'</i>
549 </p>
550 !!end
551
552 # same html as previous, but wikitext adjusted to match parsoid html2wt
553 !! test
554 Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki
555 !! wikitext
556 ''foo'<nowiki/>''
557 !! html
558 <p><i>foo'</i>
559 </p>
560 !! end
561
562 !! test
563 Italics and bold: 2-quote opening sequence: (2,4)
564 !! options
565 parsoid=wt2html
566 !! wikitext
567 ''foo''''
568 !! html/*
569 <p><i>foo''</i>
570 </p>
571 !!end
572
573 # same html as previous, but wikitext adjusted to match parsoid html2wt
574 !! test
575 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
576 !! wikitext
577 ''foo<nowiki>''</nowiki>''
578 !! html
579 <p><i>foo''</i>
580 </p>
581 !! end
582
583 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
584 !! test
585 Italics and bold: 2-quote opening sequence: (2,5)
586 !! options
587 parsoid=wt2html
588 !! wikitext
589 ''foo'''''
590 !! html/php
591 <p><i>foo</i>
592 </p>
593 !! html/parsoid
594 <p><i>foo</i><b></b>
595 </p>
596 !!end
597
598 # same html as previous, but wikitext adjusted to match parsoid html2wt
599 !! test
600 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
601 !! wikitext
602 ''foo'''''<nowiki/>'''
603 !! html/php
604 <p><i>foo</i>
605 </p>
606 !! html/parsoid
607 <p><i>foo</i><b></b>
608 </p>
609 !! end
610
611
612 ###
613 ### 3-quote opening sequence tests
614 ###
615
616 !! test
617 Italics and bold: 3-quote opening sequence: (3,2)
618 !! options
619 parsoid=wt2html
620 !! wikitext
621 '''foo''
622 !! html/*
623 <p>'<i>foo</i>
624 </p>
625 !!end
626
627 # same html as previous, but wikitext adjusted to match parsoid html2wt
628 !! test
629 Italics and bold: 3-quote opening sequence: (3,2) w/ nowiki
630 !! wikitext
631 '<nowiki/>''foo''
632 !! html
633 <p>'<i>foo</i>
634 </p>
635 !!end
636
637 !! test
638 Italics and bold: 3-quote opening sequence: (3,3)
639 !! wikitext
640 '''foo'''
641 !! html
642 <p><b>foo</b>
643 </p>
644 !!end
645
646 !! test
647 Italics and bold: 3-quote opening sequence: (3,4)
648 !! options
649 parsoid=wt2html
650 !! wikitext
651 '''foo''''
652 !! html/*
653 <p><b>foo'</b>
654 </p>
655 !!end
656
657 # same html as previous, but wikitext adjusted to match parsoid html2wt
658 !! test
659 Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki
660 !! wikitext
661 '''foo'<nowiki/>'''
662 !! html
663 <p><b>foo'</b>
664 </p>
665 !! end
666
667 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
668 !! test
669 Italics and bold: 3-quote opening sequence: (3,5)
670 !! options
671 parsoid=wt2html
672 !! wikitext
673 '''foo'''''
674 !! html/php
675 <p><b>foo</b>
676 </p>
677 !! html/parsoid
678 <p><b>foo</b><i></i>
679 </p>
680 !!end
681
682 # same html as previous, but wikitext adjusted to match parsoid html2wt
683 !! test
684 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
685 !! wikitext
686 '''foo'''''<nowiki/>''
687 !! html/php
688 <p><b>foo</b>
689 </p>
690 !! html/parsoid
691 <p><b>foo</b><i></i>
692 </p>
693 !! end
694
695
696 ###
697 ### 4-quote opening sequence tests
698 ###
699
700 !! test
701 Italics and bold: 4-quote opening sequence: (4,2)
702 !! options
703 parsoid=wt2html
704 !! wikitext
705 ''''foo''
706 !! html/*
707 <p>''<i>foo</i>
708 </p>
709 !!end
710
711 # same html as previous, but wikitext adjusted to match parsoid html2wt
712 !! test
713 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
714 !! wikitext
715 <nowiki>''</nowiki>''foo''
716 !! html
717 <p>''<i>foo</i>
718 </p>
719 !! end
720
721 !! test
722 Italics and bold: 4-quote opening sequence: (4,3)
723 !! options
724 parsoid=wt2html
725 !! wikitext
726 ''''foo'''
727 !! html/*
728 <p>'<b>foo</b>
729 </p>
730 !!end
731
732 # same html as previous, but wikitext adjusted to match parsoid html2wt
733 !! test
734 Italics and bold: 4-quote opening sequence: (4,3) w/ nowiki
735 !! wikitext
736 '<nowiki/>'''foo'''
737 !! html
738 <p>'<b>foo</b>
739 </p>
740 !!end
741
742 !! test
743 Italics and bold: 4-quote opening sequence: (4,4)
744 !! options
745 parsoid=wt2html
746 !! wikitext
747 ''''foo''''
748 !! html/*
749 <p>'<b>foo'</b>
750 </p>
751 !!end
752
753 # same html as previous, but wikitext adjusted to match parsoid html2wt
754 !! test
755 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
756 !! wikitext
757 '<nowiki/>'''foo'<nowiki/>'''
758 !! html
759 <p>'<b>foo'</b>
760 </p>
761 !! end
762
763 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
764 !! test
765 Italics and bold: 4-quote opening sequence: (4,5)
766 !! options
767 parsoid=wt2html
768 !! wikitext
769 ''''foo'''''
770 !! html/php
771 <p>'<b>foo</b>
772 </p>
773 !! html/parsoid
774 <p>'<b>foo</b><i></i>
775 </p>
776 !!end
777
778 # same html as previous, but wikitext adjusted to match parsoid html2wt
779 !! test
780 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
781 !! wikitext
782 '<nowiki/>'''foo'''''<nowiki/>''
783 !! html/php
784 <p>'<b>foo</b>
785 </p>
786 !! html/parsoid
787 <p>'<b>foo</b><i></i>
788 </p>
789 !! end
790
791
792 ###
793 ### 5-quote opening sequence tests
794 ###
795
796 !! test
797 Italics and bold: 5-quote opening sequence: (5,2)
798 !! options
799 parsoid=wt2html
800 !! wikitext
801 '''''foo''
802 !! html/*
803 <p><b><i>foo</i></b>
804 </p>
805 !!end
806
807 # same html as previous, but wikitext adjusted to match parsoid html2wt
808 # skipping wt2html and html2html because it wants to put <i> before <b>
809 !! test
810 Italics and bold: 5-quote opening sequence: (5,2+3)
811 !! options
812 parsoid=wt2wt,html2wt
813 !! wikitext
814 '''''foo'''''
815 !! html
816 <p><b><i>foo</i></b>
817 </p>
818 !! end
819
820 !! test
821 Italics and bold: 5-quote opening sequence: (5,3)
822 !! options
823 parsoid=wt2html
824 !! wikitext
825 '''''foo'''
826 !! html/*
827 <p><i><b>foo</b></i>
828 </p>
829 !!end
830
831 # same html as previous, but wikitext adjusted to match parsoid html2wt
832 !! test
833 Italics and bold: 5-quote opening sequence: (5,3+2)
834 !! wikitext
835 '''''foo'''''
836 !! html
837 <p><i><b>foo</b></i>
838 </p>
839 !! end
840
841 !! test
842 Italics and bold: 5-quote opening sequence: (5,4)
843 !! options
844 parsoid=wt2html
845 !! wikitext
846 '''''foo''''
847 !! html/*
848 <p><i><b>foo'</b></i>
849 </p>
850 !!end
851
852 # same html as previous, but wikitext adjusted to match parsoid html2wt
853 !! test
854 Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki
855 !! wikitext
856 '''''foo'<nowiki/>'''''
857 !! html
858 <p><i><b>foo'</b></i>
859 </p>
860 !! end
861
862 !! test
863 Italics and bold: 5-quote opening sequence: (5,5)
864 !! wikitext
865 '''''foo'''''
866 !! html
867 <p><i><b>foo</b></i>
868 </p>
869 !!end
870
871 ###
872 ### multiple quote sequences in a line
873 ###
874 !! test
875 Italics and bold: multiple quote sequences: (2,4,2)
876 !! options
877 parsoid=wt2html
878 !! wikitext
879 ''foo''''bar''
880 !! html/*
881 <p><i>foo'<b>bar</b></i>
882 </p>
883 !!end
884
885
886 # same html as previous, but wikitext adjusted to match parsoid html2wt
887 !! test
888 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
889 !! wikitext
890 ''foo'<nowiki/>'''bar'''''
891 !! html
892 <p><i>foo'<b>bar</b></i>
893 </p>
894 !! end
895
896
897 !! test
898 Italics and bold: multiple quote sequences: (2,4,3)
899 !! options
900 parsoid=wt2html
901 !! wikitext
902 ''foo''''bar'''
903 !! html/*
904 <p><i>foo'<b>bar</b></i>
905 </p>
906 !!end
907
908
909 # same html as previous, but wikitext adjusted to match parsoid html2wt
910 !! test
911 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
912 !! wikitext
913 ''foo'<nowiki/>'''bar'''''
914 !! html
915 <p><i>foo'<b>bar</b></i>
916 </p>
917 !! end
918
919
920 !! test
921 Italics and bold: multiple quote sequences: (2,4,4)
922 !! options
923 parsoid=wt2html
924 !! wikitext
925 ''foo''''bar''''
926 !! html/*
927 <p><i>foo'<b>bar'</b></i>
928 </p>
929 !!end
930
931
932 # same html as previous, but wikitext adjusted to match parsoid html2wt
933 !! test
934 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
935 !! wikitext
936 ''foo'<nowiki/>'''bar'<nowiki/>'''''
937 !! html
938 <p><i>foo'<b>bar'</b></i>
939 </p>
940 !! end
941
942
943 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
944 !! test
945 Italics and bold: multiple quote sequences: (3,4,2)
946 !! options
947 parsoid=wt2html
948 !! wikitext
949 '''foo''''bar''
950 !! html/php
951 <p><b>foo'</b>bar
952 </p>
953 !! html/parsoid
954 <p><b>foo'</b>bar<i></i>
955 </p>
956 !!end
957
958 # same html as previous, but wikitext adjusted to match parsoid html2wt
959 !! test
960 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
961 !! options
962 parsoid
963 !! wikitext
964 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
965 !! html/php
966 <p><b>foo'</b>bar
967 </p>
968 !! html/parsoid
969 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
970 </p>
971 !! end
972
973
974 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
975 !! test
976 Italics and bold: multiple quote sequences: (3,4,3)
977 !! options
978 parsoid=wt2html
979 !! wikitext
980 '''foo''''bar'''
981 !! html/php
982 <p><b>foo'</b>bar
983 </p>
984 !! html/parsoid
985 <p><b>foo'</b>bar<b></b>
986 </p>
987 !!end
988
989 # same html as previous, but wikitext adjusted to match parsoid html2wt
990 !! test
991 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
992 !! wikitext
993 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
994 !! html/php
995 <p><b>foo'</b>bar
996 </p>
997 !! html/parsoid
998 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
999 </p>
1000 !! end
1001
1002 ###
1003 ### other quote tests
1004 ###
1005 !! test
1006 Italics and bold: other quote tests: (2,3,5)
1007 !! wikitext
1008 ''this is about '''foo's family'''''
1009 !! html
1010 <p><i>this is about <b>foo's family</b></i>
1011 </p>
1012 !!end
1013
1014
1015 !! test
1016 Italics and bold: other quote tests: (2,(3,3),2)
1017 !! wikitext
1018 ''this is about '''foo's''' family''
1019 !! html
1020 <p><i>this is about <b>foo's</b> family</i>
1021 </p>
1022 !!end
1023
1024
1025 !! test
1026 Italics and bold: other quote tests: (3,2,3,2)
1027 !! options
1028 parsoid=wt2html
1029 !! wikitext
1030 '''this is about ''foo'''s family''
1031 !! html/*
1032 <p><b>this is about <i>foo</i></b><i>s family</i>
1033 </p>
1034 !!end
1035
1036
1037 # same html as previous, but wikitext adjusted to match parsoid html2wt
1038 !! test
1039 Italics and bold: other quote tests: (3,2,3+2+2,2)
1040 !! wikitext
1041 '''this is about ''foo'''''<nowiki/>''s family''
1042 !! html
1043 <p><b>this is about <i>foo</i></b><i>s family</i>
1044 </p>
1045 !! end
1046
1047
1048 !! test
1049 Italics and bold: other quote tests: (3,2,3,3)
1050 !! options
1051 parsoid=wt2html
1052 !! wikitext
1053 '''this is about ''foo'''s family'''
1054 !! html/*
1055 <p>'<i>this is about </i>foo<b>s family</b>
1056 </p>
1057 !!end
1058
1059
1060 # same html as previous, but wikitext adjusted to match parsoid html2wt
1061 !! test
1062 Italics and bold: other quote tests: (3,2,3,3) w/ nowiki
1063 !! wikitext
1064 '<nowiki/>''this is about ''foo'''s family'''
1065 !! html
1066 <p>'<i>this is about </i>foo<b>s family</b>
1067 </p>
1068 !!end
1069
1070
1071 !! test
1072 Italics and bold: other quote tests: (3,(2,2),3)
1073 !! wikitext
1074 '''this is about ''foo's'' family'''
1075 !! html
1076 <p><b>this is about <i>foo's</i> family</b>
1077 </p>
1078 !!end
1079
1080
1081 !! test
1082 Italicized possessive
1083 !! wikitext
1084 The ''[[Main Page]]'''s talk page.
1085 !! html
1086 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1087 </p>
1088 !! end
1089
1090 !! test
1091 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1092 (Requires tidy for PHP parser output to be fixed up)
1093 !! options
1094 parsoid=wt2html,wt2wt
1095 !! wikitext
1096 {|
1097 !''a!!''b
1098 |''a||''b
1099 |}
1100 !! html/php+tidy
1101 <table>
1102 <tr>
1103 <th><i>a</i></th>
1104 <th><i>b</i></th>
1105 <td><i>a</i></td>
1106 <td><i>b</i></td>
1107 </tr>
1108 </table>
1109 !! html/parsoid
1110 <table>
1111 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1112 <td><i>a</i></td><td><i>b</i></td></tr>
1113 </tbody></table>
1114 !! end
1115
1116 ###
1117 ### Non-html5 tags
1118 ###
1119
1120 !! test
1121 Non-html5 tags should be accepted
1122 !! wikitext
1123 <center>''foo''</center>
1124 <big>''foo''</big>
1125 <font>''foo''</font>
1126 <strike>''foo''</strike>
1127 <tt>''foo''</tt>
1128 !! html
1129 <center><i>foo</i></center>
1130 <p><big><i>foo</i></big>
1131 <font><i>foo</i></font>
1132 <strike><i>foo</i></strike>
1133 <tt><i>foo</i></tt>
1134 </p>
1135 !! end
1136
1137 !! test
1138 <wbr> is valid wikitext (bug 52468)
1139 !! wikitext
1140 <wbr>
1141 !! html
1142 <p><wbr />
1143 </p>
1144 !! end
1145
1146 # <strike> is HTML4, <s> is HTML4/5.
1147 !! test
1148 <s> or <strike> for strikethrough
1149 !! wikitext
1150 <strike>strike</strike>
1151
1152 <s>s</s>
1153 !! html
1154 <p><strike>strike</strike>
1155 </p><p><s>s</s>
1156 </p>
1157 !! end
1158
1159 ## a not permitted
1160 ## i,b,br omitted
1161 !! test
1162 Text-level semantic html elements in wikitext
1163 !! wikitext
1164 <em>text</em>
1165 <strong>text</strong>
1166 <small>text</small>
1167 <s>text</s>
1168 <cite>text</cite>
1169 <q>text</q>
1170 <dfn>text</dfn>
1171 <abbr>text</abbr>
1172 <data>text</data>
1173 <time>text</time>
1174 <code>text</code>
1175 <var>text</var>
1176 <samp>text</samp>
1177 <kbd>text</kbd>
1178 <sub>text</sub>
1179 <u>text</u>
1180 <mark>text</mark>
1181 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1182 <bdi>text</bdi>
1183 <bdo>text</bdo>
1184 <span>text</span>
1185 <wbr />
1186 !! html
1187 <p><em>text</em>
1188 <strong>text</strong>
1189 <small>text</small>
1190 <s>text</s>
1191 <cite>text</cite>
1192 <q>text</q>
1193 <dfn>text</dfn>
1194 <abbr>text</abbr>
1195 <data>text</data>
1196 <time>text</time>
1197 <code>text</code>
1198 <var>text</var>
1199 <samp>text</samp>
1200 <kbd>text</kbd>
1201 <sub>text</sub>
1202 <u>text</u>
1203 <mark>text</mark>
1204 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1205 <bdi>text</bdi>
1206 <bdo>text</bdo>
1207 <span>text</span>
1208 <wbr />
1209 </p>
1210 !! end
1211
1212 # test cases taken from
1213 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1214 !! test
1215 Ruby markup (W3C-style)
1216 !! wikitext
1217 ; Mono-ruby for individual base characters
1218 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1219 ; Group ruby
1220 : <ruby>今日<rt>きょう</rt></ruby>
1221 ; Jukugo ruby
1222 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1223 ; Inline ruby
1224 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1225 ; Double-sided ruby
1226 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1227 <ruby>
1228 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1229 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1230 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1231 </ruby>
1232 !! html
1233 <dl><dt> Mono-ruby for individual base characters</dt>
1234 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1235 <dt> Group ruby</dt>
1236 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1237 <dt> Jukugo ruby</dt>
1238 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1239 <dt> Inline ruby</dt>
1240 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1241 <dt> Double-sided ruby</dt>
1242 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1243 <p><ruby>
1244 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1245 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1246 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1247 </ruby>
1248 </p>
1249 !! end
1250
1251 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1252 !! test
1253 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1254 !! wikitext
1255 <b→> doesn't work! </b→>
1256
1257 <bä> doesn't work! </bä>
1258
1259 <boo> works fine </boo>
1260
1261 <s.foo>s.foo</s.foo>
1262
1263 <sub-ID#1>
1264 !! html
1265 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1266 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1267 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1268 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1269 </p><p>&lt;sub-ID#1&gt;
1270 </p>
1271 !! end
1272
1273 !! test
1274 Isolated close tags should be treated as literal text (bug 52760)
1275 !! wikitext
1276 </b>
1277
1278 <s.foo>s</s>
1279 !! html
1280 <p>&lt;/b&gt;
1281 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1282 </p>
1283 !! end
1284
1285 ###
1286 ### Special characters
1287 ###
1288
1289 !! test
1290 Bare pipe character (bug 52363)
1291 !! wikitext
1292 |
1293 !! html
1294 <p>|
1295 </p>
1296 !! end
1297
1298 !! test
1299 Bare pipe character from a template (bug 52363)
1300 !! wikitext
1301 {{pipe}}
1302 !! html
1303 <p>|
1304 </p>
1305 !! end
1306
1307 ###
1308 ### <nowiki> test cases
1309 ###
1310
1311 !! test
1312 <nowiki> unordered list
1313 !! wikitext
1314 <nowiki>* This is not an unordered list item.</nowiki>
1315 !! html
1316 <p>* This is not an unordered list item.
1317 </p>
1318 !! end
1319
1320 !! test
1321 <nowiki> spacing
1322 !! wikitext
1323 <nowiki>Lorem ipsum dolor
1324
1325 sed abit.
1326 sed nullum.
1327
1328 :and a colon
1329 </nowiki>
1330 !! html
1331 <p>Lorem ipsum dolor
1332
1333 sed abit.
1334 sed nullum.
1335
1336 :and a colon
1337
1338 </p>
1339 !! end
1340
1341 !! test
1342 nowiki 3
1343 !! wikitext
1344 :There is not nowiki.
1345 :There is <nowiki>nowiki</nowiki>.
1346
1347 #There is not nowiki.
1348 #There is <nowiki>nowiki</nowiki>.
1349
1350 *There is not nowiki.
1351 *There is <nowiki>nowiki</nowiki>.
1352 !! html
1353 <dl><dd>There is not nowiki.</dd>
1354 <dd>There is nowiki.</dd></dl>
1355 <ol><li>There is not nowiki.</li>
1356 <li>There is nowiki.</li></ol>
1357 <ul><li>There is not nowiki.</li>
1358 <li>There is nowiki.</li></ul>
1359
1360 !! end
1361
1362 !! test
1363 Entities inside <nowiki>
1364 !! wikitext
1365 <nowiki>&lt;</nowiki>
1366 !! html
1367 <p>&lt;
1368 </p>
1369 !! end
1370
1371 !! test
1372 Entities inside template parameters
1373 !! options
1374 parsoid
1375 !! wikitext
1376 {{echo|&ndash;}}
1377 !! html
1378 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1379 !! end
1380
1381 !! test
1382 Properly escape nowiki when combined with other wiki markup
1383 !! options
1384 parsoid=html2wt
1385 !! wikitext
1386 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1387 !! html
1388 <p>* &lt;/nowiki&gt; tag</p>
1389 !! end
1390
1391 ###
1392 ### Comments
1393 ###
1394 !! test
1395 Comments and Indent-Pre
1396 !! wikitext
1397 <!-- comment 1 --> asdf
1398
1399 <!-- comment 1 --> asdf
1400 <!-- comment 2 -->
1401
1402 <!-- comment 1 --> asdf
1403 <!-- comment 2 -->xyz
1404
1405 <!-- comment 1 --> asdf
1406 <!-- comment 2 --> xyz
1407 !! html
1408 <pre>asdf
1409 </pre>
1410 <pre>asdf
1411 </pre>
1412 <pre>asdf
1413 </pre>
1414 <p>xyz
1415 </p>
1416 <pre>asdf
1417 xyz
1418 </pre>
1419 !! end
1420
1421 !! test
1422 Comment test 2a
1423 !! wikitext
1424 asdf
1425 <!-- comment 1 -->
1426 jkl
1427 !! html
1428 <p>asdf
1429 jkl
1430 </p>
1431 !! end
1432
1433 !! test
1434 Comment test 2b
1435 !! wikitext
1436 asdf
1437 <!-- comment 1 -->
1438
1439 jkl
1440 !! html
1441 <p>asdf
1442 </p><p>jkl
1443 </p>
1444 !! end
1445
1446 !! test
1447 Comment test 3
1448 !! wikitext
1449 asdf
1450 <!-- comment 1 -->
1451 <!-- comment 2 -->
1452 jkl
1453 !! html
1454 <p>asdf
1455 jkl
1456 </p>
1457 !! end
1458
1459 !! test
1460 Comment test 4
1461 !! wikitext
1462 asdf<!-- comment 1 -->jkl
1463 !! html
1464 <p>asdfjkl
1465 </p>
1466 !! end
1467
1468 !! test
1469 Comment spacing
1470 !! wikitext
1471 a
1472 <!-- foo --> b <!-- bar -->
1473 c
1474 !! html
1475 <p>a
1476 </p>
1477 <pre> b
1478 </pre>
1479 <p>c
1480 </p>
1481 !! end
1482
1483 !! test
1484 Comment whitespace
1485 !! wikitext
1486 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1487 !! html
1488
1489 !! end
1490
1491 !! test
1492 Comment semantics and delimiters
1493 !! wikitext
1494 <!-- --><!----><!-----><!------>
1495 !! html
1496
1497 !! end
1498
1499 !! test
1500 Comment semantics and delimiters, redux
1501 !! wikitext
1502 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1503 -- foo -- funky huh? ... -->
1504 !! html
1505
1506 !! end
1507
1508 !! test
1509 Comment semantics and delimiters: directors cut
1510 !! wikitext
1511 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1512 everything starting with < followed by !-- until the first -- and > we see,
1513 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1514 -->-->
1515 !! html
1516 <p>--&gt;
1517 </p>
1518 !! end
1519
1520 !! test
1521 Comment semantics: nesting
1522 !! wikitext
1523 <!--<!-- no, we're not going to do anything fancy here -->-->
1524 !! html
1525 <p>--&gt;
1526 </p>
1527 !! end
1528
1529 !! test
1530 Comment semantics: unclosed comment at end
1531 !! wikitext
1532 <!--This comment will run out to the end of the document
1533 !! html
1534
1535 !! end
1536
1537 # Bug 58184: document parsoid's behaviour
1538 !! test
1539 Suppress comment closing tag in lenient browsers
1540 !! options
1541 parsoid=wt2html,html2html
1542 !! wikitext
1543 <!-- Browsers--!> think this is closed -->
1544 !! html/php
1545
1546 !! html/parsoid
1547 <!-- Browsers--¡> think this is closed -->
1548 !! end
1549
1550 !! test
1551 Comment in template title
1552 !! wikitext
1553 {{f<!---->oo}}
1554 !! html
1555 <p>FOO
1556 </p>
1557 !! end
1558
1559 !! test
1560 Comment on its own line post-expand
1561 !! wikitext
1562 a
1563 {{blank}}<!---->
1564 b
1565 !! html
1566 <p>a
1567 </p><p>b
1568 </p>
1569 !! end
1570
1571 !! test
1572 Comment on its own line post-expand with non-significant whitespace
1573 !! wikitext
1574 a
1575 {{blank}} <!---->
1576 b
1577 !! html
1578 <p>a
1579 </p><p>b
1580 </p>
1581 !! end
1582
1583 !! test
1584 Multiple comments should still parse as SOL-transparent
1585 !! options
1586 parsoid=wt2html,wt2wt
1587 !! wikitext
1588 <!--c1-->*a
1589 <!--c2--><!--c3--><!--c4-->*b
1590 !! html
1591 <ul>
1592 <li>a
1593 </li>
1594 <li>b
1595 </li>
1596 </ul>
1597 !! end
1598
1599 ###
1600 ### paragraph wrapping tests
1601 ###
1602 !! test
1603 No block tags
1604 !! wikitext
1605 a
1606
1607 b
1608 !! html
1609 <p>a
1610 </p><p>b
1611 </p>
1612 !! end
1613
1614 !! test
1615 Block tag on one line (<div>)
1616 !! wikitext
1617 a <div>foo</div>
1618
1619 b
1620 !! html
1621 a <div>foo</div>
1622 <p>b
1623 </p>
1624 !! html+tidy
1625 <p>a</p>
1626 <div>foo</div>
1627 <p>b</p>
1628 !! end
1629
1630 !! test
1631 Block tag on one line (<blockquote>)
1632 !! wikitext
1633 a <blockquote>foo</blockquote>
1634
1635 b
1636 !! html
1637 a <blockquote>foo</blockquote>
1638 <p>b
1639 </p>
1640 !! html+tidy
1641 <p>a</p>
1642 <blockquote>
1643 <p>foo</p>
1644 </blockquote>
1645 <p>b</p>
1646 !! end
1647
1648 !! test
1649 Block tag on both lines (<div>)
1650 !! wikitext
1651 a <div>foo</div>
1652
1653 b <div>foo</div>
1654 !! html
1655 a <div>foo</div>
1656 b <div>foo</div>
1657
1658 !! html+tidy
1659 <p>a</p>
1660 <div>foo</div>
1661 <p>b</p>
1662 <div>foo</div>
1663 !! end
1664
1665 !! test
1666 Block tag on both lines (<blockquote>)
1667 !! wikitext
1668 a <blockquote>foo</blockquote>
1669
1670 b <blockquote>foo</blockquote>
1671 !! html
1672 a <blockquote>foo</blockquote>
1673 b <blockquote>foo</blockquote>
1674
1675 !! html+tidy
1676 <p>a</p>
1677 <blockquote>
1678 <p>foo</p>
1679 </blockquote>
1680 <p>b</p>
1681 <blockquote>
1682 <p>foo</p>
1683 </blockquote>
1684 !! end
1685
1686 !! test
1687 Multiple lines without block tags
1688 !! wikitext
1689 <div>foo</div> a
1690 b
1691 c
1692 d<!--foo--> e
1693 x <div>foo</div> z
1694 !! html
1695 <div>foo</div> a
1696 <p>b
1697 c
1698 d e
1699 </p>
1700 x <div>foo</div> z
1701
1702 !! html+tidy
1703 <div>foo</div>
1704 <p>a</p>
1705 <p>b c d e</p>
1706 <p>x</p>
1707 <div>foo</div>
1708 <p>z</p>
1709 !! end
1710
1711 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1712 # So, we have a separate section for Parsoid. We don't want
1713 # to mimic this stripping behavior in Parsoid. It affects
1714 # editing experience and also requires us to maintain additional
1715 # info for RT-ing.
1716 !! test
1717 Empty lines between lines with block tags
1718 !! wikitext
1719 <div></div>
1720
1721
1722 <div></div>a
1723
1724 b
1725 <div>a</div>b
1726
1727 <div>b</div>d
1728
1729
1730 <div>e</div>
1731 !! html
1732 <div></div>
1733 <p><br />
1734 </p>
1735 <div></div>a
1736 <p>b
1737 </p>
1738 <div>a</div>b
1739 <div>b</div>d
1740 <p><br />
1741 </p>
1742 <div>e</div>
1743
1744 !! html+tidy
1745 <p><br /></p>
1746 <p>a</p>
1747 <p>b</p>
1748 <div>a</div>
1749 <p>b</p>
1750 <div>b</div>
1751 <p>d</p>
1752 <p><br /></p>
1753 <div>e</div>
1754 !! html/parsoid
1755 <div data-parsoid='{"stx":"html"}'></div>
1756
1757 <p><br /></p>
1758 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1759
1760 <p>b</p>
1761 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1762
1763 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1764
1765 <p><br /></p>
1766 <div data-parsoid='{"stx":"html"}'>e</div>
1767 !! end
1768
1769 ## PHP parser emits output which is broken
1770 ## XXX The parsoid output doesn't match the tidy output.
1771 !! test
1772 Unclosed HTML p-tags should be handled properly
1773 !! wikitext
1774 <div><p>foo</div>
1775 a
1776
1777 b
1778 !! html/php+tidy
1779 <div>
1780 <p>foo&lt;/div&gt;</p>
1781 <p>a</p>
1782 b</div>
1783 !! html/parsoid
1784 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1785 <p>a</p>
1786 <p>b</p>
1787 !! end
1788
1789 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
1790 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
1791 ## them for now.
1792 !! test
1793 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
1794 !! options
1795 parsoid=wt2html
1796 !! wikitext
1797 a [[Category:A1]] [[Category:A2]]
1798 [[Category:A3]]
1799 [[Category:A4]]
1800 !! html/parsoid
1801 <p>a</p>
1802 <link href="Category:A1"/> <link href="Category:A2"/> <link href="Category:A3"/> <link href="Category:A4"/>
1803 !! end
1804
1805 !! test
1806 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
1807 !! options
1808 parsoid=wt2html
1809 !! wikitext
1810 [[Category:A1]]a
1811 !! html/parsoid
1812 <link href="Category:A1"/><p>a</p>
1813 !! end
1814
1815 ###
1816 ### Preformatted text
1817 ###
1818 !! test
1819 Preformatted text
1820 !! wikitext
1821 This is some
1822 Preformatted text
1823 With ''italic''
1824 And '''bold'''
1825 And a [[Main Page|link]]
1826 !! html
1827 <pre>This is some
1828 Preformatted text
1829 With <i>italic</i>
1830 And <b>bold</b>
1831 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1832 </pre>
1833 !! end
1834
1835 !! test
1836 Tabs don't trigger preformatted text
1837 !! wikitext
1838 This is not
1839 preformatted text.
1840 This is preformatted text.
1841 So is this.
1842 !! html
1843 <p> This is not
1844 preformatted text.
1845 </p>
1846 <pre>This is preformatted text.
1847 So is this.
1848 </pre>
1849 !! end
1850
1851 !! test
1852 Ident preformatting with inline content
1853 !! wikitext
1854 a
1855 ''b''
1856 !! html
1857 <pre>a
1858 <i>b</i>
1859 </pre>
1860 !! end
1861
1862 !! test
1863 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1864 !! wikitext
1865 <pre><nowiki>
1866 <b>
1867 <cite>
1868 <em>
1869 </nowiki></pre>
1870 !! html
1871 <pre>
1872 &lt;b&gt;
1873 &lt;cite&gt;
1874 &lt;em&gt;
1875 </pre>
1876
1877 !! end
1878
1879 !! test
1880 Regression with preformatted in <center>
1881 !! wikitext
1882 <center>
1883 Blah
1884 </center>
1885 !! html
1886 <center>
1887 <pre>Blah
1888 </pre>
1889 </center>
1890
1891 !! end
1892
1893 !! test
1894 Bug 52763: Preformatted in <blockquote>
1895 !! wikitext
1896 <blockquote>
1897 Blah
1898 {|
1899 |
1900 indented cell (no pre-wrapping!)
1901 |}
1902 </blockquote>
1903 !! html
1904 <blockquote>
1905 <p> Blah
1906 </p>
1907 <table>
1908 <tr>
1909 <td>
1910 <p> indented cell (no pre-wrapping!)
1911 </p>
1912 </td></tr></table>
1913 </blockquote>
1914
1915 !! end
1916
1917 !! test
1918 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1919 !! wikitext
1920 <blockquote>
1921 Foo
1922
1923 Bar
1924 </blockquote>
1925 !! html
1926 <blockquote>
1927 <p>Foo
1928 </p><p>Bar
1929 </p>
1930 </blockquote>
1931
1932 !! end
1933
1934 !! test
1935 Bug 15491: <ins>/<del> in blockquote
1936 !! wikitext
1937 <blockquote>
1938 Foo <del>bar</del> <ins>baz</ins> quux
1939 </blockquote>
1940 !! html
1941 <blockquote>
1942 <p>Foo <del>bar</del> <ins>baz</ins> quux
1943 </p>
1944 </blockquote>
1945
1946 !! end
1947
1948 # Note that the p-wrapping is newline sensitive, which could be
1949 # considered a bug: tidy will wrap only the 'Foo' in the example
1950 # below in a <p> tag. (see comment 23-25 of bug #6200)
1951 !! test
1952 Bug 15491: <ins>/<del> in blockquote (2)
1953 !! wikitext
1954 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1955 </blockquote>
1956 !! html
1957 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1958 </blockquote>
1959
1960 !! html+tidy
1961 <blockquote>
1962 <p>Foo</p>
1963 <del>bar</del> <ins>baz</ins> quux</blockquote>
1964 !! end
1965
1966 !! test
1967 <pre> with attributes (bug 3202)
1968 !! wikitext
1969 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1970 !! html
1971 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1972
1973 !! end
1974
1975 !! test
1976 <pre> with width attribute (bug 3202)
1977 !! wikitext
1978 <pre width="8">Narrow screen goodies</pre>
1979 !! html
1980 <pre width="8">Narrow screen goodies</pre>
1981
1982 !! end
1983
1984 !! test
1985 <pre> with forbidden attribute (bug 3202)
1986 !! wikitext
1987 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1988 !! html
1989 <pre width="8">Narrow screen goodies</pre>
1990
1991 !! end
1992
1993 !! test
1994 Entities inside <pre>
1995 !! wikitext
1996 <pre>&lt;</pre>
1997 !! html
1998 <pre>&lt;</pre>
1999
2000 !! end
2001
2002 !! test
2003 <pre> with forbidden attribute values (bug 3202)
2004 !! wikitext
2005 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2006 !! html
2007 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2008
2009 !! end
2010
2011 !! test
2012 <nowiki> inside <pre> (bug 13238)
2013 !! wikitext
2014 <pre>
2015 <nowiki>
2016 </pre>
2017 <pre>
2018 <nowiki></nowiki>
2019 </pre>
2020 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2021 !! html
2022 <pre>
2023 &lt;nowiki&gt;
2024 </pre>
2025 <pre>
2026
2027 </pre>
2028 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2029
2030 !! end
2031
2032 !! test
2033 <nowiki> and <pre> preference (first one wins)
2034 !! wikitext
2035 <pre>
2036 <nowiki>
2037 </pre>
2038 </nowiki>
2039 </pre>
2040
2041 <nowiki>
2042 <pre>
2043 <nowiki>
2044 </pre>
2045 </nowiki>
2046 </pre>
2047
2048 !! html
2049 <pre>
2050 &lt;nowiki&gt;
2051 </pre>
2052 <p>&lt;/nowiki&gt;
2053 &lt;/pre&gt;
2054 </p><p>
2055 &lt;pre&gt;
2056 &lt;nowiki&gt;
2057 &lt;/pre&gt;
2058
2059 &lt;/pre&gt;
2060 </p>
2061 !! end
2062
2063 !! test
2064 </pre> inside nowiki
2065 !! wikitext
2066 <nowiki></pre></nowiki>
2067 !! html
2068 <p>&lt;/pre&gt;
2069 </p>
2070 !! end
2071
2072 # Parsoid doesn't strip empty tags, like Tidy does.
2073 !! test
2074 Empty pre; pre inside other HTML tags (bug 54946)
2075 !! options
2076 parsoid=wt2html,wt2wt
2077 !! wikitext
2078 a
2079
2080 <div><pre>
2081 foo
2082 </pre></div>
2083 <pre></pre>
2084 !! html/php
2085 <p>a
2086 </p>
2087 <div><pre>
2088 foo
2089 </pre></div>
2090 <pre></pre>
2091
2092 !! html/php+tidy
2093 <p>a</p>
2094 <div>
2095 <pre>
2096 foo
2097 </pre></div>
2098 !! html/parsoid
2099 <p>a</p>
2100
2101 <div><pre>foo
2102 </pre></div>
2103 <pre></pre>
2104 !! end
2105
2106 !! test
2107 HTML pre followed by indent-pre
2108 !! wikitext
2109 <pre>foo</pre>
2110 bar
2111 !! html
2112 <pre>foo</pre>
2113 <pre>bar
2114 </pre>
2115 !! end
2116
2117 !!test
2118 Block tag pre
2119 !!options
2120 parsoid
2121 !! wikitext
2122 <p><pre>foo</pre></p>
2123 !! html
2124 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2125 !!end
2126
2127 !!test
2128 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2129 !! wikitext
2130 {{echo|}}
2131 !! html
2132
2133 !!end
2134
2135 !!test
2136 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2137 !! wikitext
2138 {{echo|
2139 foo}}
2140 !! html
2141 <p>foo
2142 </p>
2143 !!end
2144
2145 !! test
2146 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2147 !! wikitext
2148 {{echo|a
2149 b}}
2150 !! html
2151 <pre>a
2152 </pre>
2153 <p>b
2154 </p>
2155 !!end
2156
2157 !! test
2158 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2159 !! wikitext
2160 {{echo|a
2161 b
2162 c
2163 d
2164 e
2165 }}
2166 !! html
2167 <pre>a
2168 </pre>
2169 <p>b
2170 c
2171 </p>
2172 <pre>d
2173 </pre>
2174 <p>e
2175 </p>
2176 !!end
2177
2178 !!test
2179 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2180 !! wikitext
2181 {{echo| foo}}
2182
2183 {{echo| foo}}{{echo| bar}}
2184
2185 {{echo| foo}}
2186 {{echo| bar}}
2187
2188 {{echo|<!--cmt--> foo}}
2189
2190 <!--cmt-->{{echo| foo}}
2191
2192 {{echo|{{echo| }}bar}}
2193 !! html
2194 <pre>foo
2195 </pre>
2196 <pre>foo bar
2197 </pre>
2198 <pre>foo
2199 bar
2200 </pre>
2201 <pre>foo
2202 </pre>
2203 <pre>foo
2204 </pre>
2205 <pre>bar
2206 </pre>
2207 !!end
2208
2209 !! test
2210 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2211 !! wikitext
2212 {{echo| }}a
2213
2214 {{echo|
2215 }}a
2216
2217 {{echo|
2218 b}}
2219
2220 {{echo|a
2221 }}b
2222
2223 {{echo|a
2224 }} b
2225 !! html
2226 <pre>a
2227 </pre>
2228 <p><br />
2229 </p>
2230 <pre>a
2231 </pre>
2232 <p><br />
2233 </p>
2234 <pre>b
2235 </pre>
2236 <p>a
2237 </p>
2238 <pre>b
2239 </pre>
2240 <p>a
2241 </p>
2242 <pre>b
2243 </pre>
2244 !!end
2245
2246 !! test
2247 Things that look like <pre> tags aren't treated as such
2248 !! wikitext
2249 Barack Obama <President> of the United States
2250 <President></President>
2251 !! html
2252 <p>Barack Obama &lt;President&gt; of the United States
2253 &lt;President&gt;&lt;/President&gt;
2254 </p>
2255 !! end
2256
2257 ## PHP parser discards the "<pre " string
2258 !! test
2259 Handle broken pre-like tags (bug 64025)
2260 !! options
2261 parsoid=wt2html
2262 !! wikitext
2263 {{echo|<pre <pre>x</pre>}}
2264
2265 <table><pre </table>
2266 !! html/php
2267 <pre>x</pre>
2268 <table><pre></pre></table>
2269
2270 !! html/parsoid
2271 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2272
2273
2274 <p>&lt;pre </p>
2275
2276 <table></table>
2277 !! end
2278
2279 !! test
2280 Parsoid: handle pre with space after attribute
2281 !! options
2282 parsoid=wt2html
2283 !! wikitext
2284 <pre style="width:50%;" >{{echo|foo}}</pre>
2285 !! html
2286 <pre style="width:50%;">{{echo|foo}}</pre>
2287 !! end
2288
2289 # TODO / maybe: fix wt2wt for this
2290 !! test
2291 Parsoid: Don't paragraph-wrap fosterable content
2292 !! options
2293 parsoid=wt2html
2294 !! wikitext
2295 {|
2296 <td></td>
2297 <td></td>
2298
2299
2300
2301 |}
2302 !! html
2303 <table>
2304
2305 <tbody>
2306 <tr>
2307 <td></td>
2308
2309 <td></td></tr>
2310
2311
2312
2313 </tbody></table>
2314 !! end
2315
2316 !! test
2317 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2318 !! options
2319 parsoid=wt2html
2320 !! wikitext
2321 {|
2322 <td>
2323 <td>
2324 </td>
2325
2326
2327
2328 |}
2329 !! html
2330 <table>
2331
2332 <tbody>
2333 <tr>
2334 <td></td>
2335
2336 <td>
2337 </td></tr>
2338
2339
2340
2341 </tbody></table>
2342 !! end
2343
2344
2345 #--------------------------------------------------------------------
2346 # Transclusion parameter whitespace stripping tests
2347 # Behavior is different for positional and named parameters
2348 #--------------------------------------------------------------------
2349 !! test
2350 Templates: Strip leading and trailing whitespace from named-param values
2351 !! wikitext
2352 {{echo|1= a }}
2353
2354 {{echo|1= {{echo|b}} }}
2355
2356 {{echo| 1 =
2357 c }}
2358
2359 {{echo| 1 =
2360 * d
2361 }}
2362 !! html
2363 <p>a
2364 </p><p>b
2365 </p><p>c
2366 </p>
2367 <ul><li> d</li></ul>
2368
2369 !! end
2370
2371 !! test
2372 Templates: Don't strip whitespace from positional-param values
2373 !! wikitext
2374 {{echo|a }}
2375
2376 {{echo|{{echo|b}} }}
2377
2378 {{echo| c
2379 }}
2380
2381 {{echo| {{echo|d}}
2382 }}
2383
2384 {{echo|
2385 e}}
2386
2387 {{echo|
2388 * f}}
2389
2390 {{echo|
2391 }}g
2392 !! html
2393 <p>a
2394 </p><p>b
2395 </p>
2396 <pre>c
2397 </pre>
2398 <p><br />
2399 </p>
2400 <pre>d
2401 </pre>
2402 <p><br />
2403 </p>
2404 <pre>e
2405 </pre>
2406 <p><br />
2407 </p>
2408 <ul><li> f</li></ul>
2409 <p><br />
2410 </p>
2411 <pre>g
2412 </pre>
2413 !! end
2414
2415 !! test
2416 Templates: Handle empty comment-and-ws-only lines correctly
2417 !! wikitext
2418 {{echo|foo
2419 <!--should be ignored-->
2420 <!--should be ignored as well-->
2421 bar}}
2422 !! html
2423 <p>foo
2424 bar
2425 </p>
2426 !! end
2427
2428 !! test
2429 Templates: Handle comments in the target
2430 !! wikitext
2431 {{echo
2432 <!-- should be ignored -->
2433 |foo}}
2434
2435 {{echo<!-- should be ignored -->
2436 |foo}}
2437
2438 {{echo<!-- should be ignored -->|foo}}
2439
2440 {{<!-- should be ignored -->echo|foo}}
2441 !!html/parsoid
2442 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2443
2444 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2445
2446 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2447
2448 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2449 !!end
2450
2451 !! test
2452 Templates: Handle comments in parameter names (bug 67657)
2453 !! wikitext
2454 {{echo|1
2455 <!-- should be ignored -->
2456 =foo}}
2457
2458 {{echo|
2459 <!-- should be ignored -->
2460 1 = foo}}
2461
2462 {{echo|1<!-- should be ignored --> = foo}}
2463
2464 {{echo|<!-- should be ignored -->1 = foo}}
2465 !!html/parsoid
2466 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2467
2468 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2469
2470 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2471
2472 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2473 !!end
2474
2475 !! test
2476 Templates: Other wikitext in parameter names (bug 67657)
2477 !! wikitext
2478 {{echo|''1''=foo}}
2479 !!html/parsoid
2480 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2481 !!html/php
2482 <p>{{{1}}}
2483 </p>
2484 !!end
2485
2486 #--------------------------------------------------------------------
2487 # Transclusion parameter escaping tests
2488 #--------------------------------------------------------------------
2489 !! test
2490 Templates: Parsoid parameter escaping test 1
2491 !! options
2492 parsoid
2493 !! wikitext
2494 {{echo|[foo]|{{echo|[bar]}}}}
2495 !! html
2496 <p about="#mwt1" typeof="mw:Transclusion"
2497 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2498 !! end
2499
2500 !! test
2501 Parsoid: Pipes in external links in template parameter
2502 !! options
2503 parsoid
2504 !! wikitext
2505 {{echo|[{{echo|http://example.com}} link]}}
2506 !! html
2507 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2508 !! end
2509
2510 !! test
2511 Parsoid: pipe in transclusion parameter
2512 !! options
2513 parsoid
2514 !! wikitext
2515 {{echo|http://foo.com/a&#124;b}}
2516 !! html
2517 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2518 typeof="mw:Transclusion"
2519 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2520 !! end
2521
2522 !! test
2523 Parsoid: Pipe in external link target and content in template parameter
2524 !! options
2525 parsoid=html2wt,wt2wt
2526 !! wikitext
2527 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2528 !! html
2529 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2530 typeof="mw:Transclusion"
2531 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2532 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2533 !! end
2534
2535 !! test
2536 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2537 !! options
2538 parsoid
2539 !! wikitext
2540 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2541 !! html
2542 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2543 !! end
2544
2545 !! test
2546 Templates: Don't escape already nowiki-escaped text in template parameters
2547 !! options
2548 parsoid=html2wt,wt2wt
2549 !! wikitext
2550 {{echo|foo<nowiki>|</nowiki>bar}}
2551 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2552 {{echo|<nowiki></nowiki>}}
2553 !! html
2554 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2555 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2556 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2557 </p>
2558 !! end
2559
2560 ## Bug 52824
2561 !! test
2562 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2563 !! options
2564 parsoid=html2wt,wt2wt
2565 !! wikitext
2566 {{echo|{{echo|1=bar}}}}
2567 !! html
2568 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2569 !! end
2570
2571 ## Bug 56733
2572 !! test
2573 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2574 !! options
2575 parsoid
2576 !! wikitext
2577 {{echo|a : b}}
2578 !! html
2579 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2580 !! end
2581
2582 ###
2583 ### Parsoid-centric tests for testing RT edge cases for pre
2584 ###
2585
2586 !!test
2587 1a. Indent-Pre and Comments
2588 !! wikitext
2589 a
2590 <!--a-->
2591 c
2592 !! html
2593 <pre>a
2594 </pre>
2595 <p>c
2596 </p>
2597 !!end
2598
2599 !!test
2600 1b. Indent-Pre and Comments
2601 !! wikitext
2602 a
2603 <!--a-->
2604 c
2605 !! html
2606 <pre>a
2607 </pre>
2608 <p>c
2609 </p>
2610 !!end
2611
2612 !!test
2613 1c. Indent-Pre and Comments
2614 !! wikitext
2615 <!--a--> a
2616
2617 <!--a--> a
2618 !! html
2619 <pre> a
2620 </pre>
2621 <pre> a
2622 </pre>
2623 !!end
2624
2625 !!test
2626 1d. Indent-Pre and Comments
2627 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2628 !! wikitext
2629 <!--a--> a
2630
2631 <!--b-->b
2632 !! html
2633 <pre>a
2634 </pre>
2635 <pre>b
2636 </pre>
2637 !!end
2638
2639 !!test
2640 2a. Indent-Pre and tables
2641 !! wikitext
2642 {|
2643 |-
2644 !h1!!h2
2645 |foo||bar
2646 |}
2647 !! html
2648 <table>
2649
2650 <tr>
2651 <th>h1</th>
2652 <th>h2
2653 </th>
2654 <td>foo</td>
2655 <td>bar
2656 </td></tr></table>
2657
2658 !!end
2659
2660 !!test
2661 2b. Indent-Pre and tables
2662 !! wikitext
2663 {|
2664 |-
2665 |foo
2666 |}
2667 !! html
2668 <table>
2669
2670 <tr>
2671 <td>foo
2672 </td></tr></table>
2673
2674 !!end
2675
2676 !!test
2677 2c. Indent-Pre and tables (bug 42252)
2678 !! wikitext
2679 {|
2680 |+ foo
2681 ! | bar
2682 |}
2683 !! html
2684 <table>
2685 <caption> foo
2686 </caption>
2687 <tr>
2688 <th> bar
2689 </th></tr></table>
2690
2691 !!end
2692
2693 !!test
2694 2d. Indent-Pre and tables
2695 !! wikitext
2696 a
2697 {|
2698 | b
2699 |}
2700 !! html/php
2701 <pre>a
2702 </pre>
2703 <table>
2704 <tr>
2705 <td> b
2706 </td></tr></table>
2707
2708 !! html/parsoid
2709 <pre>a</pre>
2710 <table>
2711 <tbody><tr><td> b</td></tr>
2712 </tbody></table>
2713 !!end
2714
2715 !!test
2716 2e. Indent-Pre and table-line syntax
2717 !! wikitext
2718 a
2719 | b
2720 | c
2721 !! html/php
2722 <pre>a
2723 | b
2724 | c
2725 </pre>
2726 !!end
2727
2728 !!test
2729 2f. Indent-pre started by table-line syntax
2730 !! wikitext
2731 a
2732 | b
2733 | c
2734 !! html/php
2735 <p>a
2736 </p>
2737 <pre>| b
2738 | c
2739 </pre>
2740 !! html/parsoid
2741 <p>a</p>
2742 <pre>
2743 | b
2744 | c</pre>
2745 !!end
2746
2747 !!test
2748 3a. Indent-Pre and block tags (single-line html)
2749 !! wikitext
2750 a <p> foo </p>
2751 b <div> foo </div>
2752 c <blockquote> foo </blockquote>
2753 <span> foo </span>
2754 !! html
2755 a <p> foo </p>
2756 b <div> foo </div>
2757 c <blockquote> foo </blockquote>
2758 <pre><span> foo </span>
2759 </pre>
2760 !! html/parsoid
2761 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
2762 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
2763 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
2764 <pre><span> foo </span>
2765 </pre>
2766 !! html+tidy
2767 <p>a</p>
2768 <p>foo</p>
2769 <p>b</p>
2770 <div>foo</div>
2771 <p>c</p>
2772 <blockquote>
2773 <p>foo</p>
2774 </blockquote>
2775 <pre>
2776 <span> foo </span>
2777 </pre>
2778 !! end
2779
2780 !!test
2781 3b. Indent-Pre and block tags (multi-line html)
2782 !! wikitext
2783 a <span>foo</span>
2784 b <div> foo </div>
2785 !! html
2786 <pre>a <span>foo</span>
2787 </pre>
2788 b <div> foo </div>
2789
2790 !! html/parsoid
2791 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
2792 b <div data-parsoid='{"stx":"html"}'> foo </div>
2793 !! html+tidy
2794 <pre>
2795 a <span>foo</span>
2796 </pre>
2797 <p>b</p>
2798 <div>foo</div>
2799 !!end
2800
2801 !!test
2802 3c. Indent-Pre and block tags (pre-content on separate line)
2803 !! wikitext
2804 <p>
2805 foo
2806 </p>
2807
2808 <div>
2809 foo
2810 </div>
2811
2812 <center>
2813 foo
2814 </center>
2815
2816 <blockquote>
2817 foo
2818 </blockquote>
2819
2820 <blockquote>
2821 <pre>
2822 foo
2823 </pre>
2824 </blockquote>
2825
2826 <table><tr><td>
2827 foo
2828 </td></tr></table>
2829
2830 <ul><li>
2831 foo
2832 </li></ul>
2833
2834 !! html
2835 <p>
2836 foo
2837 </p>
2838 <div>
2839 <pre>foo
2840 </pre>
2841 </div>
2842 <center>
2843 <pre>foo
2844 </pre>
2845 </center>
2846 <blockquote>
2847 <p> foo
2848 </p>
2849 </blockquote>
2850 <blockquote>
2851 <pre>
2852 foo
2853 </pre>
2854 </blockquote>
2855 <table><tr><td>
2856 <pre>foo
2857 </pre>
2858 </td></tr></table>
2859 <ul><li>
2860 foo
2861 </li></ul>
2862
2863 !!end
2864
2865 !!test
2866 4. Indent-Pre and extension tags
2867 !! wikitext
2868 a <gallery>
2869 File:foobar.jpg
2870 </gallery>
2871 !! html
2872 a <ul class="gallery mw-gallery-traditional">
2873 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2874 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
2875 <div class="gallerytext">
2876 </div>
2877 </div></li>
2878 </ul>
2879
2880 !! html+tidy
2881 <p>a</p>
2882 <ul class="gallery mw-gallery-traditional">
2883 <li class="gallerybox" style="width: 155px">
2884 <div style="width: 155px">
2885 <div class="thumb" style="width: 150px;">
2886 <div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div>
2887 </div>
2888 <div class="gallerytext"></div>
2889 </div>
2890 </li>
2891 </ul>
2892 !!end
2893
2894 !! test
2895 Table wikitext syntax outside wiki-tables
2896 !! wikitext
2897 a
2898 ! not a table heading
2899 |- not a table row
2900 | not a table cell
2901 | class="foo bar" | baz
2902 b
2903 |}
2904 |-
2905 c
2906 !! html
2907 <p>a
2908 ! not a table heading
2909 |- not a table row
2910 | not a table cell
2911 | class="foo bar" | baz
2912 b
2913 |}
2914 |-
2915 c
2916 </p>
2917 !! end
2918
2919 !!test
2920 Render paragraphs when indent-pre is suppressed in blocklevels
2921 !! wikitext
2922 <blockquote>
2923 foo
2924
2925 bar
2926 </blockquote>
2927 !! html
2928 <blockquote>
2929 <p> foo
2930 </p><p> bar
2931 </p>
2932 </blockquote>
2933
2934 !!end
2935
2936 !!test
2937 4. Multiple spaces at start-of-line
2938 !! wikitext
2939 <p> foo </p>
2940 foo
2941 {|
2942 |foo
2943 |}
2944 !! html
2945 <p> foo </p>
2946 <pre> foo
2947 </pre>
2948 <table>
2949 <tr>
2950 <td>foo
2951 </td></tr></table>
2952
2953 !!end
2954
2955 ## NOTE: the leading white-space chars on empty line are significant
2956 !! test
2957 5a. White-space in indent-pre
2958 !! wikitext
2959 a<br />
2960
2961 b
2962 !! html
2963 <pre>a<br />
2964
2965 b
2966 </pre>
2967 !! end
2968
2969 ## NOTE: the leading white-space chars on empty line are significant
2970 !! test
2971 5b. White-space in indent-pre
2972 !! wikitext
2973 a
2974
2975 b
2976
2977
2978 c
2979 !! html
2980 <pre>a
2981
2982 b
2983
2984
2985 c
2986 </pre>
2987 !! end
2988
2989 !! test
2990 5c. White-space in indent-pre
2991 !! wikitext
2992 ''a''
2993 ''b''
2994 ''c''
2995 !! html
2996 <pre><i>a</i>
2997 <i>b</i>
2998 <i>c</i>
2999 </pre>
3000 !! end
3001
3002 !! test
3003 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3004 !! wikitext
3005 a
3006
3007 <!-- continue -->
3008 b
3009
3010 c
3011
3012 d
3013 !! html
3014 <pre>a
3015
3016 b
3017 </pre>
3018 <pre>c
3019
3020 </pre>
3021 <p>d
3022 </p>
3023 !! end
3024
3025 !! test
3026 7a. Indent-pre and category links
3027 !! options
3028 parsoid=wt2html,wt2wt
3029 !! wikitext
3030 [[Category:foo]] <!-- No pre-wrapping -->
3031 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3032 !! html
3033 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
3034 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
3035 !! end
3036
3037 !! test
3038 7b. Indent-pre and category links
3039 !! options
3040 parsoid=wt2html,wt2wt
3041 !! wikitext
3042 [[Category:foo]] a
3043 [[Category:foo]] {{echo|b}}
3044 !! html
3045 <pre>
3046 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
3047 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3048 !! end
3049
3050 ###
3051 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3052 ###
3053
3054 !!test
3055 HTML-pre: 1. embedded newlines
3056 !! wikitext
3057 <pre>foo</pre>
3058
3059 <pre>
3060 foo
3061 </pre>
3062
3063 <pre>
3064
3065 foo
3066 </pre>
3067
3068 <pre>
3069
3070
3071 foo
3072 </pre>
3073 !! html
3074 <pre>foo</pre>
3075 <pre>
3076 foo
3077 </pre>
3078 <pre>
3079
3080 foo
3081 </pre>
3082 <pre>
3083
3084
3085 foo
3086 </pre>
3087
3088 !! html/parsoid
3089 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3090
3091 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3092 foo
3093 </pre>
3094
3095 <pre data-parsoid='{"stx":"html"}'>
3096
3097 foo
3098 </pre>
3099
3100 <pre data-parsoid='{"stx":"html"}'>
3101
3102
3103 foo
3104 </pre>
3105 !!end
3106
3107 !! test
3108 HTML-pre: big spaces
3109 !! wikitext
3110 <pre>
3111
3112
3113
3114
3115 haha
3116
3117
3118
3119
3120 haha
3121
3122
3123
3124
3125 </pre>
3126 !! html
3127 <pre>
3128
3129
3130
3131
3132 haha
3133
3134
3135
3136
3137 haha
3138
3139
3140
3141
3142 </pre>
3143
3144 !! html/parsoid
3145 <pre data-parsoid='{"stx":"html"}'>
3146
3147
3148
3149
3150 haha
3151
3152
3153
3154
3155 haha
3156
3157
3158
3159
3160 </pre>
3161 !! end
3162
3163 !!test
3164 HTML-pre: 2: indented text
3165 !! wikitext
3166 <pre>
3167 foo
3168 </pre>
3169 !! html
3170 <pre>
3171 foo
3172 </pre>
3173
3174 !!end
3175
3176 !!test
3177 HTML-pre: 3: other wikitext
3178 !! wikitext
3179 <pre>
3180 * foo
3181 # bar
3182 = no-h =
3183 '' no-italic ''
3184 [[ NoLink ]]
3185 </pre>
3186 !! html
3187 <pre>
3188 * foo
3189 # bar
3190 = no-h =
3191 '' no-italic ''
3192 [[ NoLink ]]
3193 </pre>
3194
3195 !!end
3196
3197 ###
3198 ### Definition lists
3199 ###
3200 !! test
3201 Simple definition
3202 !! wikitext
3203 ; name : Definition
3204 !! html
3205 <dl><dt> name&#160;</dt>
3206 <dd> Definition</dd></dl>
3207
3208 !! end
3209
3210 !! test
3211 Definition list for indentation only
3212 !! wikitext
3213 : Indented text
3214 !! html
3215 <dl><dd> Indented text</dd></dl>
3216
3217 !! end
3218
3219 !! test
3220 Definition list with no space
3221 !! wikitext
3222 ;name:Definition
3223 !! html
3224 <dl><dt>name</dt>
3225 <dd>Definition</dd></dl>
3226
3227 !!end
3228
3229 !! test
3230 Definition list with URL link
3231 !! wikitext
3232 ; http://example.com/ : definition
3233 !! html
3234 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3235 <dd> definition</dd></dl>
3236
3237 !! end
3238
3239 !! test
3240 Definition list with bracketed URL link
3241 !! wikitext
3242 ;[http://www.example.com/ Example]:Something about it
3243 !! html
3244 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3245 <dd>Something about it</dd></dl>
3246
3247 !! end
3248
3249 !! test
3250 Definition list with wikilink containing colon
3251 !! wikitext
3252 ; [[Help:FAQ]]: The least-read page on Wikipedia
3253 !! html
3254 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3255 <dd> The least-read page on Wikipedia</dd></dl>
3256
3257 !! end
3258
3259 # At Brion's and JeLuF's insistence... :)
3260 !! test
3261 Definition list with news link containing colon
3262 !! wikitext
3263 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3264 !! html
3265 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3266 <dd> This isn't even a real newsgroup!</dd></dl>
3267
3268 !! end
3269
3270 !! test
3271 Malformed definition list with colon
3272 !! wikitext
3273 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3274 !! html
3275 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3276
3277 !! end
3278
3279 !! test
3280 Definition lists: colon in external link text
3281 !! wikitext
3282 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3283 !! html
3284 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3285 <dd> OK, I made that up</dd></dl>
3286
3287 !! end
3288
3289 !! test
3290 Definition lists: colon in HTML attribute
3291 !! wikitext
3292 ;<b style="display: inline">bold</b>
3293 !! html
3294 <dl><dt><b style="display: inline">bold</b></dt></dl>
3295
3296 !! end
3297
3298 !! test
3299 Definition lists: self-closed tag
3300 !! wikitext
3301 ;one<br/>two : two-line fun
3302 !! html
3303 <dl><dt>one<br />two&#160;</dt>
3304 <dd> two-line fun</dd></dl>
3305
3306 !! end
3307
3308 !! test
3309 Bug 11748: Literal closing tags
3310 !! wikitext
3311 <dl>
3312 <dt>test 1</dt>
3313 <dd>test test test test test</dd>
3314 <dt>test 2</dt>
3315 <dd>test test test test test</dd>
3316 </dl>
3317 !! html
3318 <dl>
3319 <dt>test 1</dt>
3320 <dd>test test test test test</dd>
3321 <dt>test 2</dt>
3322 <dd>test test test test test</dd>
3323 </dl>
3324
3325 !! end
3326
3327 !! test
3328 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3329 !! wikitext
3330 <ul><li>
3331 ; term : description
3332 * unordered
3333 </li></ul>
3334 !! html
3335 <ul><li>
3336 <dl><dt> term&#160;</dt>
3337 <dd> description</dd></dl>
3338 <ul><li> unordered</li></ul>
3339 </li></ul>
3340
3341 !! end
3342
3343 !! test
3344
3345 Definition list with empty definition and following paragraph
3346 !! wikitext
3347 ; term:
3348 Paragraph text
3349 !! html
3350 <dl><dt> term</dt>
3351 <dd></dd></dl>
3352 <p>Paragraph text
3353 </p>
3354 !! end
3355
3356 !! test
3357 Nested definition lists using html syntax
3358 !! wikitext
3359 <dl><dt>x</dt>
3360 <dd>a</dd>
3361 <dd>b</dd></dl>
3362
3363 !! end
3364
3365 !! test
3366 Definition Lists: No nesting: Multiple dd's
3367 !! wikitext
3368 ;x
3369 :a
3370 :b
3371 !! html
3372 <dl><dt>x</dt>
3373 <dd>a</dd>
3374 <dd>b</dd></dl>
3375
3376 !! end
3377
3378 !! test
3379 Definition Lists: Indentation: Regular
3380 !! wikitext
3381 :i1
3382 ::i2
3383 :::i3
3384 !! html
3385 <dl><dd>i1
3386 <dl><dd>i2
3387 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3388
3389 !! end
3390
3391 !! test
3392 Definition Lists: Indentation: Missing 1st level
3393 !! wikitext
3394 ::i2
3395 :::i3
3396 !! html
3397 <dl><dd><dl><dd>i2
3398 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3399
3400 !! end
3401
3402 !! test
3403 Definition Lists: Indentation: Multi-level indent
3404 !! wikitext
3405 :::i3
3406 !! html
3407 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3408
3409 !! end
3410
3411 !! test
3412 Definition Lists: Hacky use to indent tables
3413 !! wikitext
3414 ::{|
3415 |foo
3416 |bar
3417 |}
3418 this text
3419 should be left alone
3420 !! html
3421 <dl><dd><dl><dd><table>
3422 <tr>
3423 <td>foo
3424 </td>
3425 <td>bar
3426 </td></tr></table></dd></dl></dd></dl>
3427 <p>this text
3428 should be left alone
3429 </p>
3430 !! end
3431
3432 !! test
3433 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3434 !! wikitext
3435 <!-- foo -->
3436 ::{|
3437 |foo
3438 |bar
3439 |}<!-- bar -->
3440 this text
3441 should be left alone
3442 !! html/parsoid
3443 <!-- foo -->
3444 <dl><dd><dl><dd><table><tr>
3445 <td>foo</td>
3446 <td>bar</td>
3447 </tr></table><!-- bar --></dd></dl></dd></dl>
3448 <p>this text
3449 should be left alone</p>
3450 !! end
3451
3452 !! test
3453 Definition Lists: Hacky use to indent tables, with comment before table
3454 !! wikitext
3455 ::<!-- foo -->{|
3456 |foo
3457 |}
3458 !! html/parsoid
3459 <dl><dd><dl><dd><!-- foo --><table><tr>
3460 <td>foo</td>
3461 </tr></table></dd></dl></dd></dl>
3462 !! end
3463
3464 # Bug 52473
3465 !! test
3466 Definition Lists: Hacky use to indent tables (WS-insensitive)
3467 !! options
3468 parsoid
3469 !! wikitext
3470 : {|
3471 |a
3472 |}
3473 !! html
3474 <dl>
3475 <dd> <table><tr><td>a</td></tr></table> </dd>
3476 </dl>
3477 !! end
3478 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3479 ## as an empty dt item. It also ignores all but the last ";" when followed
3480 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3481 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3482 ## ";"s.
3483 ##
3484 ## Ex: ";;t2 ::d2" is transformed into:
3485 ##
3486 ## <dl>
3487 ## <dt>t2 </dt>
3488 ## <dd>
3489 ## <dl>
3490 ## <dt></dt>
3491 ## <dd>d2</dd>
3492 ## </dl>
3493 ## </dd>
3494 ## </dl>
3495 ##
3496 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3497 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3498 ##
3499 ## <dl>
3500 ## <dt>
3501 ## <dl>
3502 ## <dt>t2 </dt>
3503 ## <dd>:d2</dd>
3504 ## </dl>
3505 ## </dt>
3506 ## </dl>
3507 ##
3508 ## All Parsoid only definition list tests have this difference.
3509 ##
3510 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3511 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3512
3513 !! test
3514 Table / list interaction: indented table with lists in table contents
3515 !! wikitext
3516 :{|
3517 |-
3518 | a
3519 * b
3520 |-
3521 | c
3522 * d
3523 |}
3524 !! html
3525 <dl><dd><table>
3526
3527 <tr>
3528 <td> a
3529 <ul><li> b</li></ul>
3530 </td></tr>
3531 <tr>
3532 <td> c
3533 <ul><li> d</li></ul>
3534 </td></tr></table></dd></dl>
3535
3536 !! end
3537
3538 !!test
3539 Table / list interaction: lists nested in tables nested in indented lists
3540 !! wikitext
3541 :{|
3542 |
3543 :a
3544 :b
3545 |
3546 *c
3547 *d
3548 |}
3549
3550 *e
3551 *f
3552 !! html
3553 <dl><dd><table>
3554 <tr>
3555 <td>
3556 <dl><dd>a</dd>
3557 <dd>b</dd></dl>
3558 </td>
3559 <td>
3560 <ul><li>c</li>
3561 <li>d</li></ul>
3562 </td></tr></table></dd></dl>
3563 <ul><li>e</li>
3564 <li>f</li></ul>
3565
3566 !!end
3567
3568 !! test
3569 Definition Lists: Nesting: Multi-level (Parsoid only)
3570 !! options
3571 parsoid
3572 !! wikitext
3573 ;t1 :d1
3574 ;;t2 ::d2
3575 ;;;t3 :::d3
3576 !! html
3577 <dl>
3578 <dt>t1 </dt>
3579 <dd>d1</dd>
3580 <dt>
3581 <dl>
3582 <dt>t2 </dt>
3583 <dd>:d2</dd>
3584 <dt>
3585 <dl>
3586 <dt>t3 </dt>
3587 <dd>::d3</dd>
3588 </dl>
3589 </dt>
3590 </dl>
3591 </dt>
3592 </dl>
3593
3594
3595 !! end
3596
3597
3598 !! test
3599 Definition Lists: Nesting: Test 2 (Parsoid only)
3600 !! options
3601 parsoid
3602 !! wikitext
3603 ;t1
3604 ::d2
3605 !! html
3606 <dl>
3607 <dt>t1</dt>
3608 <dd>
3609 <dl>
3610 <dd>d2</dd>
3611 </dl>
3612 </dd>
3613 </dl>
3614
3615 !! end
3616
3617
3618 !! test
3619 Definition Lists: Nesting: Test 3 (Parsoid only)
3620 !! options
3621 parsoid
3622 !! wikitext
3623 :;t1
3624 ::::d2
3625 !! html
3626 <dl>
3627 <dd>
3628 <dl>
3629 <dt>t1</dt>
3630 <dd>
3631 <dl>
3632 <dd>
3633 <dl>
3634 <dd>d2</dd>
3635 </dl>
3636 </dd>
3637 </dl>
3638 </dd>
3639 </dl>
3640 </dd>
3641 </dl>
3642
3643 !! end
3644
3645
3646 !! test
3647 Definition Lists: Nesting: Test 4
3648 !! wikitext
3649 ::;t3
3650 :::d3
3651 !! html
3652 <dl><dd><dl><dd><dl><dt>t3</dt>
3653 <dd>d3</dd></dl></dd></dl></dd></dl>
3654
3655 !! end
3656
3657
3658 ## The Parsoid team believes the following three test exposes a
3659 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3660 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3661 ## It also exposes a "misfeature" in tidy, which doesn't like
3662 ## <dl> tags with a single <dt> child; it converts the <dt> into
3663 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3664 !! test
3665 Definition Lists: Mixed Lists: Test 1
3666 !! wikitext
3667 :;* foo
3668 ::* bar
3669 :; baz
3670 !! html/php
3671 <dl><dd><dl><dt><ul><li> foo</li>
3672 <li> bar</li></ul></dt></dl>
3673 <dl><dt> baz</dt></dl></dd></dl>
3674
3675 !! html/php+tidy
3676 <dl>
3677 <dd>
3678 <dl>
3679 <dd>
3680 <ul>
3681 <li>foo</li>
3682 <li>bar</li>
3683 </ul>
3684 </dd>
3685 </dl>
3686 <dl>
3687 <dt>baz</dt>
3688 </dl>
3689 </dd>
3690 </dl>
3691 !! html/parsoid
3692 <dl>
3693 <dd><dl>
3694 <dt><ul>
3695 <li> foo
3696 </li>
3697 </ul></dt>
3698 <dd><ul>
3699 <li> bar
3700 </li>
3701 </ul></dd>
3702 <dt> baz</dt>
3703 </dl></dd>
3704 </dl>
3705 !! end
3706
3707 !! test
3708 Definition Lists: Mixed Lists: Test 2
3709 !! wikitext
3710 *: d1
3711 *: d2
3712 !! html
3713 <ul><li><dl><dd> d1</dd>
3714 <dd> d2</dd></dl></li></ul>
3715
3716 !! end
3717
3718
3719 !! test
3720 Definition Lists: Mixed Lists: Test 3
3721 !! wikitext
3722 *::: d1
3723 *::: d2
3724 !! html
3725 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3726 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3727
3728 !! end
3729
3730
3731 !! test
3732 Definition Lists: Mixed Lists: Test 4
3733 !! wikitext
3734 *;d1 :d2
3735 *;d3 :d4
3736 !! html
3737 <ul><li><dl><dt>d1&#160;</dt>
3738 <dd>d2</dd>
3739 <dt>d3&#160;</dt>
3740 <dd>d4</dd></dl></li></ul>
3741
3742 !! end
3743
3744
3745 !! test
3746 Definition Lists: Mixed Lists: Test 5
3747 !! wikitext
3748 *:d1
3749 *:: d2
3750 !! html
3751 <ul><li><dl><dd>d1
3752 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3753
3754 !! end
3755
3756
3757 !! test
3758 Definition Lists: Mixed Lists: Test 6
3759 !! wikitext
3760 #*:d1
3761 #*::: d3
3762 !! html
3763 <ol><li><ul><li><dl><dd>d1
3764 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3765
3766 !! end
3767
3768
3769 !! test
3770 Definition Lists: Mixed Lists: Test 7
3771 !! wikitext
3772 :* d1
3773 :* d2
3774 !! html
3775 <dl><dd><ul><li> d1</li>
3776 <li> d2</li></ul></dd></dl>
3777
3778 !! end
3779
3780
3781 !! test
3782 Definition Lists: Mixed Lists: Test 8
3783 !! wikitext
3784 :* d1
3785 ::* d2
3786 !! html
3787 <dl><dd><ul><li> d1</li></ul>
3788 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3789
3790 !! end
3791
3792
3793 !! test
3794 Definition Lists: Mixed Lists: Test 9
3795 !! wikitext
3796 *;foo :bar
3797 !! html
3798 <ul><li><dl><dt>foo&#160;</dt>
3799 <dd>bar</dd></dl></li></ul>
3800
3801 !! end
3802
3803
3804 !! test
3805 Definition Lists: Mixed Lists: Test 10
3806 !! wikitext
3807 *#;foo :bar
3808 !! html
3809 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3810 <dd>bar</dd></dl></li></ol></li></ul>
3811
3812 !! end
3813
3814 # The Parsoid team disagrees with the PHP parser's seemingly-random
3815 # rules regarding dd/dt on the next two tests. Parsoid is more
3816 # consistent, and recognizes the shared nesting and keeps the
3817 # still-open tags around until the nesting is complete.
3818 # (And tidy again converts <dt> to <dd> before 'bar'.)
3819
3820 !! test
3821 Definition Lists: Mixed Lists: Test 11
3822 !! wikitext
3823 *#*#;*;;foo :bar
3824 *#*#;boo :baz
3825 !! html/php
3826 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3827 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3828 <dl><dt>boo&#160;</dt>
3829 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3830
3831 !! html/php+tidy
3832 <ul>
3833 <li>
3834 <ol>
3835 <li>
3836 <ul>
3837 <li>
3838 <ol>
3839 <li>
3840 <dl>
3841 <dt>foo&#160;</dt>
3842 <dd>
3843 <ul>
3844 <li>
3845 <dl>
3846 <dd>
3847 <dl>
3848 <dt>bar</dt>
3849 </dl>
3850 </dd>
3851 </dl>
3852 </li>
3853 </ul>
3854 </dd>
3855 </dl>
3856 <dl>
3857 <dt>boo&#160;</dt>
3858 <dd>baz</dd>
3859 </dl>
3860 </li>
3861 </ol>
3862 </li>
3863 </ul>
3864 </li>
3865 </ol>
3866 </li>
3867 </ul>
3868 !! html/parsoid
3869 <ul>
3870 <li>
3871 <ol>
3872 <li>
3873 <ul>
3874 <li>
3875 <ol>
3876 <li>
3877 <dl>
3878 <dt>
3879 <ul>
3880 <li>
3881 <dl>
3882 <dt>
3883 <dl>
3884 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3885 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3886 </dl></dt>
3887 </dl></li>
3888 </ul></dt>
3889 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3890 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3891 </dl></li>
3892 </ol></li>
3893 </ul></li>
3894 </ol></li>
3895 </ul>
3896 !! end
3897
3898
3899 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
3900 !! test
3901 Definition Lists: Weird Ones: Test 1
3902 !! wikitext
3903 *#;*::;; foo : bar (who uses this?)
3904 !! html/php
3905 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3906 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
3907
3908 !! html/php+tidy
3909 <ul>
3910 <li>
3911 <ol>
3912 <li>
3913 <dl>
3914 <dt>foo&#160;</dt>
3915 <dd>
3916 <ul>
3917 <li>
3918 <dl>
3919 <dd>
3920 <dl>
3921 <dd>
3922 <dl>
3923 <dd>
3924 <dl>
3925 <dt>bar (who uses this?)</dt>
3926 </dl>
3927 </dd>
3928 </dl>
3929 </dd>
3930 </dl>
3931 </dd>
3932 </dl>
3933 </li>
3934 </ul>
3935 </dd>
3936 </dl>
3937 </li>
3938 </ol>
3939 </li>
3940 </ul>
3941 !! html/parsoid
3942 <ul>
3943 <li>
3944 <ol>
3945 <li>
3946 <dl>
3947 <dt>
3948 <ul>
3949 <li>
3950 <dl>
3951 <dd>
3952 <dl>
3953 <dd>
3954 <dl>
3955 <dt>
3956 <dl>
3957 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3958 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3959 </dl></dt>
3960 </dl></dd>
3961 </dl></dd>
3962 </dl></li>
3963 </ul></dt>
3964 </dl></li>
3965 </ol></li>
3966 </ul>
3967 !! end
3968
3969 ###
3970 ### External links
3971 ###
3972 !! test
3973 External links: non-bracketed
3974 !! wikitext
3975 Non-bracketed: http://example.com
3976 !! html
3977 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3978 </p>
3979 !! end
3980
3981 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3982 !! test
3983 External links: numbered
3984 !! wikitext
3985 Numbered: [http://example.com]
3986 Numbered: [http://example.net]
3987 Numbered: [http://example.com]
3988 !! html/php
3989 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3990 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3991 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3992 </p>
3993 !! html/parsoid
3994 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
3995 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
3996 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
3997 !!end
3998
3999 !! test
4000 External links: specified text
4001 !! wikitext
4002 Specified text: [http://example.com link]
4003 !! html
4004 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4005 </p>
4006 !!end
4007
4008 !! test
4009 External links: trail
4010 !! wikitext
4011 Linktrails should not work for external links: [http://example.com link]s
4012 !! html
4013 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4014 </p>
4015 !! end
4016
4017 !! test
4018 External links: dollar sign in URL
4019 !! wikitext
4020 http://example.com/1$2345
4021 !! html
4022 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4023 </p>
4024 !! end
4025
4026 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4027 !! test
4028 External links: dollar sign in URL (autonumber)
4029 !! wikitext
4030 [http://example.com/1$2345]
4031 !! html/php
4032 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4033 </p>
4034 !! html/parsoid
4035 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4036 !!end
4037
4038 !! test
4039 External links: open square bracket forbidden in URL (bug 4377)
4040 !! options
4041 parsoid=wt2html,wt2wt,html2html
4042 !! wikitext
4043 http://example.com/1[2345
4044 !! html/php
4045 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4046 </p>
4047 !! html/parsoid
4048 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4049 !! end
4050
4051 !! test
4052 External links: open square bracket forbidden in URL (named) (bug 4377)
4053 !! options
4054 parsoid=wt2html,html2html
4055 !! wikitext
4056 [http://example.com/1[2345]
4057 !! html/php
4058 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4059 </p>
4060 !! html/parsoid
4061 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4062 !!end
4063
4064 # parsoid adds a space before the link name
4065 !! test
4066 External links: open square bracket forbidden in URL (named) (bug 4377)
4067 Parsoid variant.
4068 !! wikitext
4069 [http://example.com/1 [2345]
4070 !! html
4071 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4072 </p>
4073 !!end
4074
4075 !! test
4076 External links: nowiki in URL link text (bug 6230)
4077 !! wikitext
4078 [http://example.com/ <nowiki>''example site''</nowiki>]
4079 !! html
4080 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4081 </p>
4082 !! end
4083
4084 !! test
4085 External links: newline forbidden in text (bug 6230 regression check)
4086 !! wikitext
4087 [http://example.com/ first
4088 second]
4089 !! html
4090 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4091 second]
4092 </p>
4093 !!end
4094
4095 !! test
4096 External links: Pipe char between url and text
4097 !! wikitext
4098 [http://example.com | link]
4099 !! html
4100 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4101 </p>
4102 !!end
4103
4104 !! test
4105 External links: protocol-relative URL in brackets
4106 !! wikitext
4107 [//example.com/ Test]
4108 !! html
4109 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4110 </p>
4111 !! end
4112
4113 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4114 !! test
4115 External links: protocol-relative URL in brackets without text
4116 !! wikitext
4117 [//example.com]
4118 !! html/php
4119 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4120 </p>
4121 !! html/parsoid
4122 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4123 !! end
4124
4125 !! test
4126 External links: protocol-relative URL in free text is left alone
4127 !! wikitext
4128 //example.com/Foo
4129 !! html
4130 <p>//example.com/Foo
4131 </p>
4132 !!end
4133
4134 !! test
4135 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4136 !! wikitext
4137 foo//example.com/Foo
4138 !! html
4139 <p>foo//example.com/Foo
4140 </p>
4141 !! end
4142
4143 !! test
4144 External links: with no contents
4145 !! wikitext
4146 [http://en.wikipedia.org/wiki/Foo]
4147
4148 [[wikipedia:Foo|Bar]]
4149
4150 [[wikipedia:Foo|<span>Bar</span>]]
4151 !! html/php
4152 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4153 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4154 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4155 </p>
4156 !! html/parsoid
4157 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4158 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4159 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4160 !! end
4161
4162 !! test
4163 External links: Free with trailing punctuation
4164 !! wikitext
4165 http://example.com,
4166 http://example.com;
4167 http://example.com\
4168 http://example.com.
4169 http://example.com:
4170 http://example.com!
4171 http://example.com?
4172 http://example.com)
4173 http://example.com/url_with_(brackets)
4174 !! html
4175 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4176 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4177 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4178 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4179 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4180 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4181 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4182 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4183 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4184 </p>
4185 !! end
4186
4187 !! test
4188 External image
4189 !! wikitext
4190 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4191 !! html
4192 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4193 </p>
4194 !! end
4195
4196 !! test
4197 External image from https
4198 !! wikitext
4199 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4200 !! html
4201 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4202 </p>
4203 !! end
4204
4205 !! test
4206 External image (when not allowed)
4207 !! options
4208 wgAllowExternalImages=0
4209 !! wikitext
4210 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4211 !! html
4212 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
4213 </p>
4214 !! end
4215
4216 !! test
4217 Link to non-http image, no img tag
4218 !! wikitext
4219 Link to non-http image, no img tag: ftp://example.com/test.jpg
4220 !! html
4221 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
4222 </p>
4223 !! end
4224
4225 !! test
4226 External links: terminating separator
4227 !! wikitext
4228 Terminating separator: http://example.com/thing,
4229 !! html
4230 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4231 </p>
4232 !! end
4233
4234 !! test
4235 External links: intervening separator
4236 !! wikitext
4237 Intervening separator: http://example.com/1,2,3
4238 !! html
4239 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4240 </p>
4241 !! end
4242
4243 !! test
4244 External links: old bug with URL in query
4245 !! wikitext
4246 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4247 !! html
4248 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4249 </p>
4250 !! end
4251
4252 !! test
4253 External links: old URL-in-URL bug, mixed protocols
4254 !! wikitext
4255 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4256 !! html
4257 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4258 </p>
4259 !!end
4260
4261 !! test
4262 External links: URL in text
4263 !! wikitext
4264 URL in text: [http://example.com http://example.com]
4265 !! html
4266 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4267 </p>
4268 !! end
4269
4270 !! test
4271 External links: Clickable images
4272 !! wikitext
4273 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4274 !! html
4275 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
4276 </p>
4277 !!end
4278
4279 !! test
4280 External links: raw ampersand
4281 !! wikitext
4282 Old &amp; use: http://x&y
4283 !! html
4284 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4285 </p>
4286 !! end
4287
4288 !! test
4289 External links: encoded ampersand
4290 !! wikitext
4291 Old &amp; use: http://x&amp;y
4292 !! html/php
4293 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4294 </p>
4295 !! html/parsoid
4296 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4297 !! end
4298
4299 !! test
4300 External links: encoded equals (bug 6102)
4301 !! wikitext
4302 http://example.com/?foo&#61;bar
4303 !! html/php
4304 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4305 </p>
4306 !! html/parsoid
4307 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4308 !! end
4309
4310 ##
4311 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4312 ## does it number them. As discussed in bug 53505, we can identify
4313 ## autonumbered links via CSS.
4314 ##
4315
4316 !! test
4317 External links: [raw ampersand]
4318 !! wikitext
4319 Old &amp; use: [http://x&y]
4320 !! html/php
4321 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4322 </p>
4323 !! html/parsoid
4324 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4325 !! end
4326
4327 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4328 # mode will return the [raw ampersand] wikitext
4329 !! test
4330 External links: [encoded ampersand]
4331 !! options
4332 parsoid=wt2html,wt2wt,html2html
4333 !! wikitext
4334 Old &amp; use: [http://x&amp;y]
4335 !! html/php
4336 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4337 </p>
4338 !! html/parsoid
4339 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4340 !! end
4341
4342 !! test
4343 External links: [raw equals]
4344 !! wikitext
4345 [http://example.com/?foo=bar]
4346 !! html/php
4347 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4348 </p>
4349 !! html/parsoid
4350 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4351 !! end
4352
4353 # note that parsoid html is identical to [raw equals] case; so html2wt
4354 # mode will return the [raw equals] wikitext
4355 !! test
4356 External links: [encoded equals] (bug 6102)
4357 !! options
4358 parsoid=wt2html,wt2wt,html2html
4359 !! wikitext
4360 [http://example.com/?foo&#61;bar]
4361 !! html/php
4362 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4363 </p>
4364 !! html/parsoid
4365 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4366 !! end
4367
4368 # xxx parsoid strips the IDN character, so the round-trip tests will
4369 # obviously fail and are disabled. --cscott
4370 !! test
4371 External links: [IDN ignored character reference in hostname; strip it right off]
4372 !! options
4373 parsoid=wt2html,wt2wt,html2html
4374 !! wikitext
4375 [http://e&zwnj;xample.com/]
4376 !! html/php
4377 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4378 </p>
4379 !! html/parsoid
4380 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4381 !! end
4382
4383 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4384 # Where an external link could easily circumvent the sanitization of the text of
4385 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4386 # test demands a higher standard. That's a bit strange.
4387 #
4388 # Example:
4389 #
4390 # http://e‌xample.com -> [http://example.com|http://example.com]
4391 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4392 #
4393 # The first example is sanitized, but the second is not. Any security benefits
4394 # from this production are trivial to circumvent. Either remove this test and
4395 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4396 # the test accordingly.
4397 #
4398 # All our love,
4399 # The Parsoid team.
4400 # xxx parsoid strips the IDN character, so the round-trip tests will
4401 # obviously fail and are disabled. --cscott
4402 !! test
4403 External links: IDN ignored character reference in hostname; strip it right off
4404 !! options
4405 parsoid=wt2html,html2html
4406 !! wikitext
4407 http://e&zwnj;xample.com/
4408 !! html/php
4409 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4410 </p>
4411 !! html/parsoid
4412 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4413 !! end
4414
4415 !! test
4416 External links: www.jpeg.org (bug 554)
4417 !! wikitext
4418 http://www.jpeg.org
4419 !! html
4420 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4421 </p>
4422 !! end
4423
4424 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4425 !! test
4426 External links: URL within URL (original bug 2)
4427 !! wikitext
4428 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4429 !! html/php
4430 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4431 </p>
4432 !! html/parsoid
4433 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4434 !! end
4435
4436 !! test
4437 BUG 361: URL inside bracketed URL
4438 !! wikitext
4439 [http://www.example.com/foo http://www.example.com/bar]
4440 !! html
4441 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4442 </p>
4443 !! end
4444
4445 !! test
4446 BUG 361: URL within URL, not bracketed
4447 !! wikitext
4448 http://www.example.com/foo?=http://www.example.com/bar
4449 !! html
4450 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
4451 </p>
4452 !! end
4453
4454 !! test
4455 BUG 289: ">"-token in URL-tail
4456 !! wikitext
4457 http://www.example.com/<hello>
4458 !! html
4459 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4460 </p>
4461 !!end
4462
4463 !! test
4464 BUG 289: literal ">"-token in URL-tail
4465 !! wikitext
4466 http://www.example.com/<b>html</b>
4467 !! html
4468 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4469 </p>
4470 !!end
4471
4472 !! test
4473 BUG 289: ">"-token in bracketed URL
4474 !! wikitext
4475 [http://www.example.com/<hello> stuff]
4476 !! html
4477 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4478 </p>
4479 !!end
4480
4481 !! test
4482 BUG 289: literal ">"-token in bracketed URL
4483 !! wikitext
4484 [http://www.example.com/<b>html</b> stuff]
4485 !! html
4486 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4487 </p>
4488 !!end
4489
4490 !! test
4491 BUG 289: literal double quote at end of URL
4492 !! wikitext
4493 http://www.example.com/"hello"
4494 !! html
4495 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4496 </p>
4497 !!end
4498
4499 !! test
4500 BUG 289: literal double quote in bracketed URL
4501 !! wikitext
4502 [http://www.example.com/"hello" stuff]
4503 !! html
4504 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4505 </p>
4506 !!end
4507
4508 !! test
4509 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4510 !! wikitext
4511 [http://www.example.com test]
4512 !! html
4513 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4514 </p>
4515 !! end
4516
4517 !! test
4518 External links: link text with spaces
4519 !! wikitext
4520 [http://www.example.com a b c]
4521 [http://www.example.com ''a'' ''b'']
4522 !! html
4523 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4524 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4525 </p>
4526 !! end
4527
4528 !! test
4529 External links: wiki links within external link (Bug 3695)
4530 !! wikitext
4531 [http://example.com [[wikilink]] embedded in ext link]
4532 !! html/php
4533 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
4534 </p>
4535 !! html/parsoid
4536 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
4537 !! end
4538
4539 !! test
4540 BUG 787: Links with one slash after the url protocol are invalid
4541 !! wikitext
4542 http:/example.com
4543
4544 [http:/example.com title]
4545 !! html
4546 <p>http:/example.com
4547 </p><p>[http:/example.com title]
4548 </p>
4549 !! end
4550
4551 !! test
4552 Bracketed external links with template-generated invalid target
4553 !! wikitext
4554 [{{echo|http:/example.com}} title]
4555 !! html
4556 <p>[http:/example.com title]
4557 </p>
4558 !! end
4559
4560 !! test
4561 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4562 !! wikitext
4563 ''[http://example.com text'']
4564 [http://example.com '''text]'''
4565 ''Something [http://example.com in italic'']
4566 ''Something [http://example.com mixed''''', even bold]'''
4567 '''''Now [http://example.com both''''']
4568 !! html
4569 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4570 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4571 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4572 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4573 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4574 </p>
4575 !! end
4576
4577
4578 !! test
4579 Bug 4781: %26 in URL
4580 !! wikitext
4581 http://www.example.com/?title=AT%26T
4582 !! html/php
4583 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4584 </p>
4585 !! html/parsoid
4586 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4587 !! end
4588
4589 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4590 # % is actually legal in HTML5. Any change in output would need testing though.
4591 !! test
4592 Bug 4781, 5267: %25 in URL
4593 !! wikitext
4594 http://www.example.com/?title=100%25_Bran
4595 !! html/php
4596 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
4597 </p>
4598 !! html/parsoid
4599 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4600 !! end
4601
4602 !! test
4603 Bug 4781, 5267: %28, %29 in URL
4604 !! wikitext
4605 http://www.example.com/?title=Ben-Hur_%281959_film%29
4606 !! html/php
4607 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
4608 </p>
4609 !! html/parsoid
4610 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
4611 !! end
4612
4613
4614 !! test
4615 Bug 4781: %26 in autonumber URL
4616 !! wikitext
4617 [http://www.example.com/?title=AT%26T]
4618 !! html/php
4619 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4620 </p>
4621 !! html/parsoid
4622 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4623 !! end
4624
4625 !! test
4626 Bug 4781, 5267: %26 in autonumber URL
4627 !! wikitext
4628 [http://www.example.com/?title=100%25_Bran]
4629 !! html/php
4630 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4631 </p>
4632 !! html/parsoid
4633 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4634 !! end
4635
4636 !! test
4637 Bug 4781, 5267: %28, %29 in autonumber URL
4638 !! wikitext
4639 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4640 !! html/php
4641 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4642 </p>
4643 !! html/parsoid
4644 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4645 !! end
4646
4647
4648 !! test
4649 Bug 4781: %26 in bracketed URL
4650 !! wikitext
4651 [http://www.example.com/?title=AT%26T link]
4652 !! html/php
4653 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4654 </p>
4655 !! html/parsoid
4656 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4657 !! end
4658
4659 !! test
4660 Bug 4781, 5267: %25 in bracketed URL
4661 !! wikitext
4662 [http://www.example.com/?title=100%25_Bran link]
4663 !! html
4664 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4665 </p>
4666 !! end
4667
4668 !! test
4669 Bug 4781, 5267: %28, %29 in bracketed URL
4670 !! wikitext
4671 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4672 !! html/php
4673 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4674 </p>
4675 !! html/parsoid
4676 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4677 !! end
4678
4679 !! test
4680 External link containing a period in the anchor. (bug 63947)
4681 !! wikitext
4682 [//foo.org/bar#baz. bang]
4683
4684 [//foo.org/bar. bang]
4685 !! html/php
4686 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4687 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4688 </p>
4689 !! html/parsoid
4690 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4691 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4692 !! end
4693
4694 !! test
4695 External link containing a single quote. (bug 63947)
4696 !! wikitext
4697 [//foo.org/bar'baz]
4698
4699 [//foo.org/bar'baz bang]
4700 !! html/php
4701 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4702 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4703 </p>
4704 !! html/parsoid
4705 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4706 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4707 !! end
4708
4709
4710 !! test
4711 External link containing a period in the anchor. (bug 63947)
4712 !! wikitext
4713 [//foo.org/bar#baz. bang]
4714
4715 [//foo.org/bar. bang]
4716 !! html/php
4717 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4718 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4719 </p>
4720 !! html/parsoid
4721 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4722 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4723 !! end
4724
4725 !! test
4726 External link containing a single quote. (bug 63947)
4727 !! wikitext
4728 [//foo.org/bar'baz]
4729
4730 [//foo.org/bar'baz bang]
4731 !! html/php
4732 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4733 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4734 </p>
4735 !! html/parsoid
4736 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4737 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4738 !! end
4739
4740
4741 !! test
4742 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4743 !! wikitext
4744 Some [http://example.com/ pretty ''italics'' and stuff]!
4745 !! html
4746 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4747 </p>
4748 !! end
4749
4750 !! test
4751 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4752 !! wikitext
4753 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4754 !! html
4755 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
4756 </p>
4757 !! end
4758
4759 !! test
4760 External link containing double-single-quotes with no space separating the url from text in italics
4761 !! wikitext
4762 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
4763 !! html/php
4764 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
4765 </p>
4766 !! html/php+tidy
4767 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
4768 !! html/parsoid
4769 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
4770 !! end
4771
4772 !! test
4773 External link with comments in link text
4774 !! wikitext
4775 [http://www.google.com Google <!-- comment -->]
4776 !! html
4777 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4778 </p>
4779 !! end
4780
4781 !! test
4782 URL-encoding in URL functions (single parameter)
4783 !! wikitext
4784 {{localurl:Some page|amp=&}}
4785 !! html
4786 <p>/index.php?title=Some_page&amp;amp=&amp;
4787 </p>
4788 !! end
4789
4790 !! test
4791 URL-encoding in URL functions (multiple parameters)
4792 !! wikitext
4793 {{localurl:Some page|q=?&amp=&}}
4794 !! html
4795 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4796 </p>
4797 !! end
4798
4799 !! test
4800 Brackets in urls
4801 !! wikitext
4802 http://example.com/index.php?foozoid%5B%5D=bar
4803
4804 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4805 !! html/php
4806 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
4807 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
4808 </p>
4809 !! html/parsoid
4810 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
4811
4812 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4813 !! end
4814
4815 !! test
4816 IPv6 urls (bug 21261)
4817 !! options
4818 disabled
4819 !! wikitext
4820 http://[2404:130:0:1000::187:2]/index.php
4821 !! html
4822 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
4823 </p>
4824 !! end
4825
4826 !! test
4827 Non-extlinks in brackets
4828 !! wikitext
4829 [foo]
4830 [foo bar]
4831 [foo ''bar'']
4832 [fool's] errand
4833 [fool's errand]
4834 [{{echo|foo}}]
4835 [{{echo|foo}} bar]
4836 [{{echo|foo}} ''bar'']
4837 [{{echo|foo}}l's] errand
4838 [{{echo|foo}}l's errand]
4839 [url={{echo|foo}}]
4840 [url=http://example.com]
4841 !! html
4842 <p>[foo]
4843 [foo bar]
4844 [foo <i>bar</i>]
4845 [fool's] errand
4846 [fool's errand]
4847 [foo]
4848 [foo bar]
4849 [foo <i>bar</i>]
4850 [fool's] errand
4851 [fool's errand]
4852 [url=foo]
4853 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4854 </p>
4855 !! end
4856
4857 !! test
4858 Percent encoding in external links
4859 !! wikitext
4860 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4861 !! html/php
4862 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4863 </p>
4864 !! html/parsoid
4865 <p><a rel="mw:ExtLink"
4866 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4867 !! end
4868
4869 !! test
4870 Use url link syntax for links where the content is equal the link target
4871 !! wikitext
4872 http://example.com
4873 !! html/php
4874 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4875 </p>
4876 !! html/parsoid
4877 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4878 !! end
4879
4880 !! test
4881 Parenthesis in external links, especially URL links
4882 !! wikitext
4883 http://example.com)
4884
4885 http://example.com/test)
4886
4887 http://example.com/(test)
4888
4889 http://example.com/((test)
4890
4891 (http://example.com/(test))
4892
4893 (http://example.com/(test)))))
4894
4895 http://example.com/a)b
4896
4897 [http://example.com) foo]
4898 !! html/php
4899 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4900 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4901 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4902 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4903 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4904 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4905 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4906 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4907 </p>
4908 !! html/parsoid
4909 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4910 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4911 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4912 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4913 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4914 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4915 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4916 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4917 !! end
4918
4919 !! test
4920 Parenthesis in external links, w/ transclusion or comment
4921 !! wikitext
4922 (http://example.com/{{echo|hi}})
4923
4924 (http://example.com<!-- hi -->)
4925 !! html/php
4926 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4927 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4928 </p>
4929 !! html/parsoid
4930 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
4931
4932 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
4933 !! end
4934
4935 !! test
4936 Replace invalid link targets when serializing
4937 !! options
4938 parsoid=html2wt
4939 !! html
4940 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
4941 !! wikitext
4942 [[MediaWiki:Badtitletext|Manual]]
4943 !! end
4944
4945 ###
4946 ### Quotes
4947 ###
4948
4949 !! test
4950 Quotes
4951 !! wikitext
4952 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4953
4954 Normal text. '''''Bold italic text.''''' Normal text.
4955 !! html
4956 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4957 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4958 </p>
4959 !! end
4960
4961
4962 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4963 # parser strips. The wikitext contains just the first half of the bold
4964 # quote pair.
4965 !! test
4966 Unclosed and unmatched quotes
4967 !! wikitext
4968 '''''Bold italic text '''with bold deactivated''' in between.'''''
4969
4970 '''''Bold italic text ''with italic deactivated'' in between.'''''
4971
4972 '''Bold text..
4973
4974 ..spanning two paragraphs (should not work).'''
4975
4976 '''Bold tag left open
4977
4978 ''Italic tag left open
4979
4980 Normal text.
4981
4982 <!-- Unmatching number of opening, closing tags: -->
4983 '''This year''''s election ''should'' beat '''last year''''s.
4984
4985 ''Tom'''s car is bigger than ''Susan'''s.
4986
4987 Plain ''italic'''s plain
4988 !! html/php
4989 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4990 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4991 </p><p><b>Bold text..</b>
4992 </p><p>..spanning two paragraphs (should not work).
4993 </p><p><b>Bold tag left open</b>
4994 </p><p><i>Italic tag left open</i>
4995 </p><p>Normal text.
4996 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4997 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4998 </p><p>Plain <i>italic'</i>s plain
4999 </p>
5000 !! html/parsoid
5001 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5002 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5003 </p><p><b>Bold text..</b>
5004 </p><p>..spanning two paragraphs (should not work).<b></b>
5005 </p><p><b>Bold tag left open</b>
5006 </p><p><i>Italic tag left open</i>
5007 </p><p>Normal text.
5008 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5009 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5010 </p><p>Plain <i>italic'</i>s plain
5011 </p>
5012 !! end
5013
5014 ###
5015 ### Tables
5016 ###
5017 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5018 ###
5019
5020 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5021 # is the bare minimum required by the spec, see:
5022 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5023 # Parsoid team replies: empty table tags are legal in HTML5
5024 !! test
5025 A table with no data.
5026 !! options
5027 parsoid=wt2html
5028 !! wikitext
5029 {||}
5030 !! html/php
5031
5032 !! html/parsoid
5033 <table></table>
5034
5035 !! end
5036
5037 !! test
5038 A table with stray table end tags on start tag line (wt2html)
5039 !! options
5040 parsoid=wt2html
5041 !! wikitext
5042 {|style="color: red;"|}
5043
5044 {|style="color: red;" |}
5045 |foo
5046 |}
5047
5048 {|style="color: red;"|} id="foo"
5049 |foo
5050 |}
5051
5052 {|style="color: red;" |} id="foo"
5053 |foo
5054 |}
5055 !! html
5056 <table style="color: red;"></table>
5057
5058 <table style="color: red;">
5059 <tbody><tr>
5060 <td>foo</td>
5061 </tr></tbody>
5062 </table>
5063
5064 <table style="color: red;" id="foo">
5065 <tbody><tr>
5066 <td>foo</td>
5067 </tr></tbody>
5068 </table>
5069
5070 <table style="color: red;" id="foo">
5071 <tbody><tr>
5072 <td>foo</td>
5073 </tr></tbody>
5074 </table>
5075
5076 !! end
5077
5078 !! test
5079 A table with no data (take 2)
5080 !! wikitext
5081 {|
5082 |}
5083 !! html/parsoid
5084 <table></table>
5085 !! end
5086
5087 # A table with nothing but a caption is invalid XHTML, we might want to render
5088 # this as <p>caption</p>
5089 # Parsoid team replies: table with only a caption is legal in HTML5
5090 !! test
5091 A table with nothing but a caption
5092 !! wikitext
5093 {|
5094 |+ caption
5095 |}
5096 !! html/php
5097 <table>
5098 <caption> caption
5099 </caption><tr><td></td></tr></table>
5100
5101 !! html/parsoid
5102 <table><caption> caption</caption></table>
5103 !! end
5104
5105 !! test
5106 A table with caption with default-spaced attributes and a table row
5107 !! wikitext
5108 {|
5109 |+ style="color: red;" | caption1
5110 |-
5111 | foo
5112 |}
5113 !! html
5114 <table>
5115 <caption style="color: red;"> caption1
5116 </caption>
5117 <tr>
5118 <td> foo
5119 </td></tr></table>
5120
5121 !! end
5122
5123 !! test
5124 A table with captions with non-default spaced attributes and a table row
5125 !! wikitext
5126 {|
5127 |+style="color: red;"|caption2
5128 |+ style="color: red;"| caption3
5129 |-
5130 | foo
5131 |}
5132 !! html
5133 <table>
5134 <caption style="color: red;">caption2
5135 </caption>
5136 <caption style="color: red;"> caption3
5137 </caption>
5138 <tr>
5139 <td> foo
5140 </td></tr></table>
5141
5142 !! end
5143
5144 !! test
5145 Table td-cell syntax variations
5146 !! wikitext
5147 {|
5148 | foo bar foo | baz
5149 | foo bar foo || baz
5150 | style='color:red;' | baz
5151 | style='color:red;' || baz
5152 |}
5153 !! html
5154 <table>
5155 <tr>
5156 <td> baz
5157 </td>
5158 <td> foo bar foo </td>
5159 <td> baz
5160 </td>
5161 <td style="color:red;"> baz
5162 </td>
5163 <td> style='color:red;' </td>
5164 <td> baz
5165 </td></tr></table>
5166
5167 !! end
5168
5169 !! test
5170 Simple table
5171 !! wikitext
5172 {|
5173 | 1 || 2
5174 |-
5175 | 3 || 4
5176 |}
5177 !! html
5178 <table>
5179 <tr>
5180 <td> 1 </td>
5181 <td> 2
5182 </td></tr>
5183 <tr>
5184 <td> 3 </td>
5185 <td> 4
5186 </td></tr></table>
5187
5188 !! end
5189
5190 !! test
5191 Simple table but with multiple dashes for row wikitext
5192 !! wikitext
5193 {|
5194 | foo
5195 |-----
5196 | bar
5197 |}
5198 !! html
5199 <table>
5200 <tr>
5201 <td> foo
5202 </td></tr>
5203 <tr>
5204 <td> bar
5205 </td></tr></table>
5206
5207 !! end
5208 !! test
5209 Multiplication table
5210 !! wikitext
5211 {| border="1" cellpadding="2"
5212 |+Multiplication table
5213 |-
5214 ! &times; !! 1 !! 2 !! 3
5215 |-
5216 ! 1
5217 | 1 || 2 || 3
5218 |-
5219 ! 2
5220 | 2 || 4 || 6
5221 |-
5222 ! 3
5223 | 3 || 6 || 9
5224 |-
5225 ! 4
5226 | 4 || 8 || 12
5227 |-
5228 ! 5
5229 | 5 || 10 || 15
5230 |}
5231 !! html
5232 <table border="1" cellpadding="2">
5233 <caption>Multiplication table
5234 </caption>
5235 <tr>
5236 <th> &#215; </th>
5237 <th> 1 </th>
5238 <th> 2 </th>
5239 <th> 3
5240 </th></tr>
5241 <tr>
5242 <th> 1
5243 </th>
5244 <td> 1 </td>
5245 <td> 2 </td>
5246 <td> 3
5247 </td></tr>
5248 <tr>
5249 <th> 2
5250 </th>
5251 <td> 2 </td>
5252 <td> 4 </td>
5253 <td> 6
5254 </td></tr>
5255 <tr>
5256 <th> 3
5257 </th>
5258 <td> 3 </td>
5259 <td> 6 </td>
5260 <td> 9
5261 </td></tr>
5262 <tr>
5263 <th> 4
5264 </th>
5265 <td> 4 </td>
5266 <td> 8 </td>
5267 <td> 12
5268 </td></tr>
5269 <tr>
5270 <th> 5
5271 </th>
5272 <td> 5 </td>
5273 <td> 10 </td>
5274 <td> 15
5275 </td></tr></table>
5276
5277 !! end
5278
5279 !! test
5280 Accept "||" in table headings
5281 !! wikitext
5282 {|
5283 !h1 || h2
5284 |}
5285 !! html
5286 <table>
5287 <tr>
5288 <th>h1 </th>
5289 <th> h2
5290 </th></tr></table>
5291
5292 !! end
5293
5294 !! test
5295 Accept "!!" in table data
5296 !! wikitext
5297 {|
5298 | Foo!! ||
5299 |}
5300 !! html
5301 <table>
5302 <tr>
5303 <td> Foo!! </td>
5304 <td>
5305 </td></tr></table>
5306
5307 !! html/parsoid
5308 <table>
5309 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
5310 </tbody></table>
5311 !! end
5312
5313 !! test
5314 Accept "||" in indented table headings
5315 !! wikitext
5316 :{|
5317 !h1 || h2
5318 |}
5319 !! html
5320 <dl><dd><table>
5321 <tr>
5322 <th>h1 </th>
5323 <th> h2
5324 </th></tr></table></dd></dl>
5325
5326 !! end
5327
5328 !! test
5329 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5330 !! wikitext
5331 {|
5332 !| h1
5333 || a
5334 |}
5335 !! html
5336 <table>
5337 <tr>
5338 <th> h1
5339 </th>
5340 <td> a
5341 </td></tr></table>
5342
5343 !! end
5344
5345 !!test
5346 Accept "| !" at start of line in tables (ignore !-attribute)
5347 !! wikitext
5348 {|
5349 |-
5350 | !style="color:red" | bar
5351 |}
5352 !! html
5353 <table>
5354
5355 <tr>
5356 <td> bar
5357 </td></tr></table>
5358
5359 !!end
5360
5361 !!test
5362 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
5363 !! wikitext
5364 {|
5365 |-
5366 |style='color:red;'|+1
5367 |style='color:blue;'|-1
5368 |-
5369 | 1 || 2 || 3
5370 | 1 ||+2 ||-3
5371 |-
5372 | +1
5373 | -1
5374 |}
5375 !! html
5376 <table>
5377
5378 <tr>
5379 <td style="color:red;">+1
5380 </td>
5381 <td style="color:blue;">-1
5382 </td></tr>
5383 <tr>
5384 <td> 1 </td>
5385 <td> 2 </td>
5386 <td> 3
5387 </td>
5388 <td> 1 </td>
5389 <td>+2 </td>
5390 <td>-3
5391 </td></tr>
5392 <tr>
5393 <td> +1
5394 </td>
5395 <td> -1
5396 </td></tr></table>
5397
5398 !!end
5399
5400 !! test
5401 Table rowspan
5402 !! wikitext
5403 {| border=1
5404 | Cell 1, row 1
5405 |rowspan=2| Cell 2, row 1 (and 2)
5406 | Cell 3, row 1
5407 |-
5408 | Cell 1, row 2
5409 | Cell 3, row 2
5410 |}
5411 !! html
5412 <table border="1">
5413 <tr>
5414 <td> Cell 1, row 1
5415 </td>
5416 <td rowspan="2"> Cell 2, row 1 (and 2)
5417 </td>
5418 <td> Cell 3, row 1
5419 </td></tr>
5420 <tr>
5421 <td> Cell 1, row 2
5422 </td>
5423 <td> Cell 3, row 2
5424 </td></tr></table>
5425
5426 !! end
5427
5428 !! test
5429 Nested table
5430 !! wikitext
5431 {| border=1
5432 | &alpha;
5433 |
5434 {| bgcolor=#ABCDEF border=2
5435 |nested
5436 |-
5437 |table
5438 |}
5439 |the original table again
5440 |}
5441 !! html
5442 <table border="1">
5443 <tr>
5444 <td> &#945;
5445 </td>
5446 <td>
5447 <table bgcolor="#ABCDEF" border="2">
5448 <tr>
5449 <td>nested
5450 </td></tr>
5451 <tr>
5452 <td>table
5453 </td></tr></table>
5454 </td>
5455 <td>the original table again
5456 </td></tr></table>
5457
5458 !! end
5459
5460 !! test
5461 Invalid attributes in table cell (bug 1830)
5462 !! wikitext
5463 {|
5464 |Cell:|broken
5465 |}
5466 !! html
5467 <table>
5468 <tr>
5469 <td>broken
5470 </td></tr></table>
5471
5472 !! end
5473
5474
5475 # The "|}" to close the table is missing from the input, so parsoid's
5476 # *2wt modes will fail.
5477 !! test
5478 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5479 !! options
5480 parsoid=wt2html,html2html
5481 !! wikitext
5482 {|
5483 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5484 !! html/php
5485 <table>
5486 <tr>
5487 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5488 <td>]" onmouseover="alert(document.cookie)"&gt;test
5489 </td>
5490 </tr>
5491 </table>
5492
5493 !! html/parsoid
5494 <table><tbody>
5495 <tr>
5496 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5497 !! end
5498
5499
5500 !! test
5501 Indented table markup mixed with indented pre content (proposed in bug 6200)
5502 !! wikitext
5503 <table>
5504 <tr>
5505 <td>
5506 Text that should be rendered preformatted
5507 </td>
5508 </tr>
5509 </table>
5510 !! html
5511 <table>
5512 <tr>
5513 <td>
5514 <pre>Text that should be rendered preformatted
5515 </pre>
5516 </td>
5517 </tr>
5518 </table>
5519
5520 !! end
5521
5522 !! test
5523 Template-generated table cell attributes and cell content
5524 !! wikitext
5525 {|
5526 |{{table_attribs}}
5527 | {{table_attribs}}
5528 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
5529 |align=center {{table_attribs}}
5530 | <!--foo--> align=center <!--bar--> {{table_attribs}}
5531 |}
5532 !! html
5533 <table>
5534 <tr>
5535 <td style="color: red"> Foo
5536 </td>
5537 <td style="color: red"> Foo
5538 </td>
5539 <td style="color: red"> Foo
5540 </td>
5541 <td align="center" style="color: red"> Foo
5542 </td>
5543 <td align="center" style="color: red"> Foo
5544 </td></tr></table>
5545
5546 !! end
5547
5548 !! test
5549 Template-generated table cell attributes and cell content (2)
5550 !! wikitext
5551 {|
5552 |align=center {{table_cells}}
5553 |}
5554 !! html
5555 <table>
5556 <tr>
5557 <td align="center" style="color: red"> Foo </td>
5558 <td> Bar </td>
5559 <td> Baz
5560 </td></tr></table>
5561
5562 !! end
5563
5564 !! test
5565 Table with row followed by newlines and table heading
5566 !! wikitext
5567 {|
5568 |-
5569
5570 ! foo
5571 |}
5572 !! html
5573 <table>
5574
5575
5576 <tr>
5577 <th> foo
5578 </th></tr></table>
5579
5580 !! end
5581
5582 !! test
5583 Table with empty line following the start tag
5584 !! wikitext
5585 {|
5586
5587 |-
5588 | foo
5589 |}
5590 !! html
5591 <table>
5592
5593
5594 <tr>
5595 <td> foo
5596 </td></tr></table>
5597
5598 !! end
5599
5600 # FIXME: Preserve the attribute properly (with an empty string as value) in
5601 # the PHP parser. Parsoid implements the behavior below.
5602 !! test
5603 Table attributes with empty value
5604 !! wikitext
5605 {|
5606 | style=| hello
5607 |}
5608 !! html/parsoid
5609 <table>
5610 <tbody>
5611 <tr>
5612 <td style=""> hello
5613 </td></tr></tbody></table>
5614
5615 !! end
5616
5617 !! test
5618 Wikitext table with a lot of comments
5619 !! wikitext
5620 {|
5621 <!-- c0 -->
5622 | foo
5623 <!-- c1 -->
5624 |- <!-- c2 -->
5625 <!-- c3 -->
5626 |<!-- c4 -->
5627 <!-- c5 -->
5628 |}
5629 !! html
5630 <table>
5631 <tr>
5632 <td> foo
5633 </td></tr>
5634 <tr>
5635 <td>
5636 </td></tr></table>
5637
5638 !! end
5639
5640 !! test
5641 Wikitext table with double-line table cell
5642 !! wikitext
5643 {|
5644 |a
5645 b
5646 |}
5647 !! html
5648 <table>
5649 <tr>
5650 <td>a
5651 <p>b
5652 </p>
5653 </td></tr></table>
5654
5655 !! end
5656
5657 !! test
5658 Table cell with a single comment
5659 !! wikitext
5660 {|
5661 | <!-- c1 -->
5662 | a
5663 |}
5664 !! html
5665 <table>
5666 <tr>
5667 <td>
5668 </td>
5669 <td> a
5670 </td></tr></table>
5671
5672 !! end
5673
5674 !! test
5675 Table-cell after a comment-only-empty-line
5676 !! wikitext
5677 {|
5678 |a
5679 <!--c1-->
5680 <!--c2-->| b
5681 |}
5682 !! html
5683 <table>
5684 <tr>
5685 <td>a
5686 </td>
5687 <td> b
5688 </td></tr></table>
5689
5690 !! html/parsoid
5691 <table>
5692 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5693 <!--c1-->
5694 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5695 </tbody></table>
5696
5697 !! end
5698
5699 !! test
5700 Build table with {{!}}
5701 !! wikitext
5702 {{{!}} class="wikitable"
5703 ! header
5704 ! second header
5705 {{!}}- style="color:red;"
5706 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
5707 {{!}}}
5708 !! html
5709 <table class="wikitable">
5710 <tr>
5711 <th> header
5712 </th>
5713 <th> second header
5714 </th></tr>
5715 <tr style="color:red;">
5716 <td> data </td>
5717 <td style="color:red;"> second data
5718 </td></tr></table>
5719
5720 !! end
5721
5722 !! test
5723 Build table with pipe as data
5724 !! wikitext
5725 {| class="wikitable"
5726 ! header
5727 ! second header
5728 |- style="color:red;"
5729 | data || style="color:red;" | second data
5730 |-
5731 | style="color:red;" | data with | || style="color:red;" | second data with |
5732 |-
5733 || data with | ||| second data with |
5734 |}
5735 !! html
5736 <table class="wikitable">
5737 <tr>
5738 <th> header
5739 </th>
5740 <th> second header
5741 </th></tr>
5742 <tr style="color:red;">
5743 <td> data </td>
5744 <td style="color:red;"> second data
5745 </td></tr>
5746 <tr>
5747 <td style="color:red;"> data with | </td>
5748 <td style="color:red;"> second data with |
5749 </td></tr>
5750 <tr>
5751 <td> data with | </td>
5752 <td> second data with |
5753 </td></tr></table>
5754
5755 !! end
5756
5757 !! test
5758 Build table with wikilink
5759 !! wikitext
5760 {| class="wikitable"
5761 ! header || second header
5762 |- style="color:red;"
5763 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
5764 |-
5765 | data || second data [[Main Page|link|text with pipe]]
5766 |}
5767 !! html
5768 <table class="wikitable">
5769 <tr>
5770 <th> header </th>
5771 <th> second header
5772 </th></tr>
5773 <tr style="color:red;">
5774 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
5775 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
5776 </td></tr>
5777 <tr>
5778 <td> data </td>
5779 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
5780 </td></tr></table>
5781
5782 !! end
5783
5784 # The expected HTML structure in this test is debatable. The PHP parser does
5785 # not parse this kind of table at all. The main focus for Parsoid is on
5786 # round-tripping, so this output is ok for now. TODO: revisit!
5787 !! test
5788 Wikitext table with html-syntax row
5789 !! wikitext
5790 {|
5791 |-
5792 <td>foo</td>
5793 |}
5794 !! html/parsoid
5795 <table>
5796 <tbody>
5797 <tr>
5798 <td>foo</td></tr></tbody></table>
5799 !! end
5800
5801 ## Note that Parsoid output differs from PHP and PHP+tidy here.
5802 ## The lack of <tr> tags in the PHP output is arguably a bug in the
5803 ## PHP parser, which tidy then compounds by fostering the content
5804 ## entirely out of the table. Parsoid recognizes the table context
5805 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
5806 ## depends on PHP's treatment of broken table markup!
5807 !! test
5808 Implicit <td> after a |-
5809 !! options
5810 parsoid=wt2html,html2html
5811 !! wikitext
5812 {|
5813 |-
5814 a
5815 |}
5816 !! html/php
5817 <table>
5818
5819 a
5820 </table>
5821
5822 !! html/php+tidy
5823 <p>a</p>
5824 !! html/parsoid
5825 <table>
5826 <tr><td>a</td></tr>
5827 </table>
5828 !! end
5829
5830 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
5831 !! test
5832 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
5833 !! options
5834 parsoid=wt2html,html2html
5835 !! wikitext
5836 {|
5837 |-
5838 |
5839 a
5840 |-
5841 b
5842 |}
5843 !! html/php
5844 <table>
5845
5846 <tr>
5847 <td>
5848 <pre>a
5849 </pre>
5850 </td></tr>
5851 b
5852 </table>
5853
5854 !! html/php+tidy
5855 <p>b</p>
5856 <table>
5857 <tr>
5858 <td>
5859 <pre>
5860 a
5861 </pre></td>
5862 </tr>
5863 </table>
5864 !! html/parsoid
5865 <table>
5866 <tbody>
5867 <tr><td><pre>a</pre></td></tr>
5868 <tr><td> b</td></tr>
5869 </tbody>
5870 </table>
5871 !! end
5872
5873 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
5874 # Parsoid generates the missing <td>, so wt2wt won't succeed.
5875 !! test
5876 Lists should be recognized in an implicit <td> context
5877 !! options
5878 parsoid=wt2html,html2html
5879 !! wikitext
5880 {|
5881 |-
5882 *a
5883 |}
5884 !! html/php
5885 <table>
5886
5887 <ul><li>a</li></ul>
5888 </table>
5889
5890 !! html/php+tidy
5891 <ul>
5892 <li>a</li>
5893 </ul>
5894 !! html/parsoid
5895 <table>
5896 <tr>
5897 <td><ul>
5898 <li>a</li>
5899 </ul></td>
5900 </tr>
5901 </table>
5902 !! end
5903
5904 !! test
5905 Parsoid: Round-trip tables directly followed by content (bug 51219)
5906 !! options
5907 parsoid=wt2html,wt2wt
5908 !! wikitext
5909 {|
5910 |foo
5911 |} bar
5912
5913 {|
5914 |baz
5915 |}<b>quux</b>
5916 !! html+tidy
5917 <table>
5918 <tr>
5919 <td>foo</td>
5920 </tr>
5921 </table>
5922 <p>bar</p>
5923 <table>
5924 <tr>
5925 <td>baz</td>
5926 </tr>
5927 </table>
5928 <p><b>quux</b></p>
5929 !! end
5930
5931 !! test
5932 Parsoid: Default to a newline after tables in new content (bug 51219)
5933 !! options
5934 parsoid=html2wt
5935 !! wikitext
5936 {|
5937 |foo
5938 |}
5939 <nowiki> </nowiki>bar
5940 {|
5941 |baz
5942 |}
5943 '''quux'''
5944 !! html
5945 <table><tbody>
5946 <tr><td>foo</td></tr></tbody></table> bar
5947 <table><tbody>
5948 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5949 !! end
5950
5951 !! test
5952 Parsoid: newline inducing block nodes don't suppress <nowiki>
5953 !! options
5954 parsoid=html2wt
5955 !! wikitext
5956 <nowiki> </nowiki>a
5957
5958 = foo =
5959 !! html
5960 a<h1>foo</h1>
5961 !! end
5962
5963 !! test
5964 Parsoid: Row-syntax table headings followed by comment & table cells
5965 !! options
5966 parsoid=wt2html,wt2wt
5967 !! wikitext
5968 {|
5969 ! foo || bar
5970 <!-- foo --> || baz || quux
5971 |}
5972 !! html/php
5973 <table>
5974 <tr>
5975 <th> foo </th>
5976 <th> bar
5977 </th>
5978 <td> baz </td>
5979 <td> quux
5980 </td></tr></table>
5981
5982 !! html/parsoid
5983 <table>
5984 <tbody><tr><th> foo </th><th> bar
5985 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
5986 </tbody></table>
5987 !! end
5988
5989
5990 # PHP throws away the (semi-broken) "foo" class here; Parsoid
5991 # preserves it.
5992 !!test
5993 Parsoid: Recover better from broken table attributes
5994 !!options
5995 parsoid=wt2html
5996 !!wikitext
5997 {| class="foo
5998 | class="bar" |
5999 foo
6000 |}
6001 !!html/php+tidy
6002 <table>
6003 <tr>
6004 <td class="bar">
6005 <p>foo</p>
6006 </td>
6007 </tr>
6008 </table>
6009 !!html/parsoid
6010 <table class="foo">
6011 <tr>
6012 <td class="bar">
6013 <p>foo</p></td></tr>
6014 </tbody></table>
6015 !!end
6016
6017 !! test
6018 Strip unsupported table tags
6019 !! options
6020 parsoid=html2wt
6021 !! html
6022 <table>
6023 <thead>
6024 <tr>
6025 <th>Month</th>
6026 <th>Savings</th>
6027 </tr>
6028 </thead>
6029 <tbody>
6030 <tr>
6031 <td>January</td>
6032 <td>$100</td>
6033 </tr>
6034 <tr>
6035 <td>February</td>
6036 <td>$80</td>
6037 </tr>
6038 </tbody>
6039 <tfoot>
6040 <tr>
6041 <td>Sum</td>
6042 <td>$180</td>
6043 </tr>
6044 </tfoot>
6045 </table>
6046 !! wikitext
6047 {|
6048
6049 !Month
6050 !Savings
6051
6052 |January
6053 |$100
6054
6055 |-
6056 |February
6057 |$80
6058
6059 |Sum
6060 |$180
6061
6062 |}
6063 !! end
6064
6065 ###
6066 ### Internal links
6067 ###
6068 !! test
6069 Plain link, capitalized
6070 !! wikitext
6071 [[Main Page]]
6072 !! html
6073 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6074 </p>
6075 !! end
6076
6077 !! test
6078 Plain link, uncapitalized
6079 !! wikitext
6080 [[main Page]]
6081 !! html
6082 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6083 </p>
6084 !! end
6085
6086 !! test
6087 Piped link
6088 !! wikitext
6089 [[Main Page|The Main Page]]
6090 !! html
6091 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6092 </p>
6093 !! end
6094
6095 !! test
6096 Piped link with comment in link text
6097 !! wikitext
6098 [[Main Page|The Main<!--front--> Page]]
6099 !! html
6100 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6101 </p>
6102 !! end
6103
6104 !! test
6105 Piped link with multiple pipe characters in link text
6106 !! wikitext
6107 [[Main Page||The|Main|Page|]]
6108 !! html/php
6109 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6110 </p>
6111 !! html/parsoid
6112 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6113 !! end
6114
6115 !! test
6116 Broken link
6117 !! wikitext
6118 [[Zigzagzogzagzig]]
6119 !! html
6120 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6121 </p>
6122 !! end
6123
6124 !! test
6125 Broken link with fragment
6126 !! wikitext
6127 [[Zigzagzogzagzig#zug]]
6128 !! html
6129 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6130 </p>
6131 !! end
6132
6133 !! test
6134 Special page link with fragment
6135 !! wikitext
6136 [[Special:Version#anchor]]
6137 !! html
6138 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6139 </p>
6140 !! end
6141
6142 !! test
6143 Nonexistent special page link with fragment
6144 !! wikitext
6145 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6146 !! html
6147 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6148 </p>
6149 !! end
6150
6151 !! test
6152 Link with prefix
6153 !! wikitext
6154 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6155 !! html
6156 <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>
6157 </p>
6158 !! end
6159
6160 !! test
6161 Link with suffix
6162 !! wikitext
6163 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6164 !! html
6165 <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>!!!
6166 </p>
6167 !! end
6168
6169 !! article
6170 prefixed article
6171 !! text
6172 Some text
6173 !! endarticle
6174
6175 !! test
6176 Bug 43661: Piped links with identical prefixes
6177 !! wikitext
6178 [[prefixed article|prefixed articles with spaces]]
6179
6180 [[prefixed article|prefixed articlesaoeu]]
6181
6182 [[Main Page|Main Page test]]
6183 !! html
6184 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6185 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6186 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6187 </p>
6188 !! end
6189
6190
6191 !! test
6192 Link with HTML entity in suffix / tail
6193 !! wikitext
6194 [[Main Page]]&quot;, [[Main Page]]&#97;
6195 !! html
6196 <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;
6197 </p>
6198 !! end
6199
6200 !! test
6201 Link with 3 brackets
6202 !! wikitext
6203 [[[Main Page]]]
6204 !! html
6205 <p>[[[Main Page]]]
6206 </p>
6207 !! end
6208
6209 !! test
6210 Link with 4 brackets
6211 !! wikitext
6212 [[[[Main Page]]]]
6213 !! html
6214 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6215 </p>
6216 !! end
6217
6218 !! test
6219 Piped link with 3 brackets
6220 !! wikitext
6221 [[[main page|the main page]]]
6222 !! html
6223 <p>[[[main page|the main page]]]
6224 </p>
6225 !! end
6226
6227 !! test
6228 Piped link with extlink-like text
6229 !! wikitext
6230 [[Main Page|[bar]]]
6231 [[Main Page|This is a [bar]]]
6232 !! html
6233 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6234 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6235 </p>
6236 !! end
6237
6238 !! test
6239 Link with multiple pipes
6240 !! wikitext
6241 [[Main Page|The|Main|Page]]
6242 !! html
6243 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6244 </p>
6245 !! end
6246
6247 # Note that parsoid does not munge anchor text; all non-space
6248 # characters are valid in HTML5 ids.
6249 !! test
6250 Anchor containing a #. (bug 63430)
6251 !! wikitext
6252 [[Main Page#And#Link]]
6253 !! html/php
6254 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6255 </p>
6256 !! html/parsoid
6257 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6258 !! end
6259
6260 !! test
6261 Link to namespaces
6262 !! wikitext
6263 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6264 !! html
6265 <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>
6266 </p>
6267 !! end
6268
6269 !! test
6270 Link with space in namespace
6271 !! wikitext
6272 [[User talk:Foo bar]]
6273 !! html
6274 <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>
6275 </p>
6276 !! end
6277
6278 !! article
6279 MemoryAlpha:AlphaTest
6280 !! text
6281 This is an article in the MemoryAlpha namespace
6282 (which shadows the memoryalpha interwiki link).
6283 !! endarticle
6284
6285 !! test
6286 Namespace takes precedence over interwiki link (bug 51680)
6287 !! wikitext
6288 [[MemoryAlpha:AlphaTest]]
6289 !! html
6290 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6291 </p>
6292 !! end
6293
6294 # The previous test doesn't work correctly in html2*, due to not recognizing the
6295 # link as an internal one. This one checks for the correct behavior.
6296 !! test
6297 Link to namespace preferred over interwiki with correct rel attribute
6298 !! options
6299 parsoid=html2wt,html2html
6300 !! wikitext
6301 [[MemoryAlpha:AlphaTest]]
6302 !! html
6303 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6304 </p>
6305 !! end
6306
6307 !! test
6308 Piped link to namespace
6309 !! wikitext
6310 [[Meta:Disclaimers|The disclaimers]]
6311 !! html
6312 <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>
6313 </p>
6314 !! end
6315
6316 !! test
6317 Link containing }
6318 !! wikitext
6319 [[Usually caused by a typo (oops}]]
6320 !! html
6321 <p>[[Usually caused by a typo (oops}]]
6322 </p>
6323 !! end
6324
6325 !! article
6326 7% Solution
6327 !! text
6328 Just a test of an article title containing a percent.
6329 !! endarticle
6330
6331 !! test
6332 Link containing % (not as a hex sequence)
6333 !! wikitext
6334 [[7% Solution]]
6335 !! html/php
6336 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6337 </p>
6338 !! html/parsoid
6339 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6340 !! end
6341
6342 # note that the parsoid HTML is identical to the previous test output,
6343 # so the previous test ensures that the html2wt mode will generate the
6344 # "not as a hex sequence" wikitext.
6345 !! test
6346 Link containing % as a single hex sequence interpreted to char
6347 !! options
6348 parsoid=wt2wt,wt2html,html2html
6349 !! wikitext
6350 [[7%25 Solution]]
6351 !! html/php
6352 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6353 </p>
6354 !! html/parsoid
6355 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6356 !!end
6357
6358 !! test
6359 Link containing % as a double hex sequence interpreted to hex sequence
6360 !! wikitext
6361 [[7%2525 Solution]]
6362 !! html
6363 <p>[[7%2525 Solution]]
6364 </p>
6365 !!end
6366
6367 # note that parsoid does not munge anchor text; all non-space
6368 # characters are valid in HTML5 anchors.
6369 !! test
6370 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6371 Example for such a section: == < ==
6372 !! wikitext
6373 [[%23%3c]][[%23%3e]]
6374 !! html/php
6375 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6376 </p>
6377 !! html/parsoid
6378 <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>
6379 !! end
6380
6381 !! test
6382 Link containing "<#" and ">#" as a hex sequences
6383 !! wikitext
6384 [[%3c%23]][[%3e%23]]
6385 !! html
6386 <p>[[%3c%23]][[%3e%23]]
6387 </p>
6388 !! end
6389
6390 !! test
6391 Link containing an equals sign
6392 !! wikitext
6393 [[Special:BookSources/isbn=4-00-026157-6]]
6394 !! html/php
6395 <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>
6396 </p>
6397 !! html/parsoid
6398 <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>
6399 !! end
6400
6401 !! article
6402 Foo~bar
6403 !! text
6404 Just a test of an article title containing a tilde.
6405 !! endarticle
6406
6407 # note that links containing signatures, like [[Foo~~~~]], are
6408 # massaged by the pre-save transform (PST) and so the tildes are never
6409 # seen by the parser.
6410 !! test
6411 Link containing a tilde
6412 !! wikitext
6413 [[Foo~bar]]
6414 !! html/php
6415 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6416 </p>
6417 !! html/parsoid
6418 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6419 !! end
6420
6421 !! test
6422 Link containing double-single-quotes '' (bug 4598)
6423 !! wikitext
6424 [[Lista d''e paise d''o munno]]
6425 !! html/php
6426 <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>
6427 </p>
6428 !! html/parsoid
6429 <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>
6430 !! end
6431
6432 !! test
6433 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6434 !! wikitext
6435 Some [[Link|pretty ''italics'' and stuff]]!
6436 !! html/php
6437 <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>!
6438 </p>
6439 !! html/parsoid
6440 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6441 !! end
6442
6443 !! test
6444 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6445 !! wikitext
6446 ''Some [[Link|pretty ''italics'' and stuff]]!''
6447 !! html
6448 <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>
6449 </p>
6450 !! end
6451
6452 !! test
6453 Link with double quotes in title part (literal) and alternate part (interpreted)
6454 !! wikitext
6455 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
6456
6457 [[''Pentecoste'']]
6458
6459 [[''Pentecoste''|Pentecoste]]
6460
6461 [[''Pentecoste''|''Pentecoste'']]
6462 !! html/php
6463 <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>
6464 </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>
6465 </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>
6466 </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>
6467 </p>
6468 !! html/parsoid
6469 <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>
6470 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6471 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6472 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6473 !! end
6474
6475 !! test
6476 Broken image links with HTML captions (bug 39700)
6477 !! wikitext
6478 [[File:Nonexistent|<script></script>]]
6479 [[File:Nonexistent|100x100px|<script></script>]]
6480 [[File:Nonexistent|&lt;]]
6481 [[File:Nonexistent|a<i>b</i>c]]
6482 !! html/php
6483 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6484 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6485 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6486 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6487 </p>
6488 !! html/parsoid
6489 <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>
6490 <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>
6491 <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>
6492 <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>
6493 !! end
6494
6495 !! test
6496 Plain link to URL
6497 !! wikitext
6498 [[http://www.example.com]]
6499 !! html/php
6500 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6501 </p>
6502 !! html/parsoid
6503 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6504 !! end
6505
6506 !! test
6507 Plain link to URL with link text
6508 !! wikitext
6509 [[http://www.example.com Link text]]
6510 !! html
6511 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6512 </p>
6513 !! end
6514
6515 !! test
6516 Plain link to protocol-relative URL
6517 !! wikitext
6518 [[//www.example.com]]
6519 !! html/php
6520 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6521 </p>
6522 !! html/parsoid
6523 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6524 !! end
6525
6526 !! test
6527 Plain link to protocol-relative URL with link text
6528 !! wikitext
6529 [[//www.example.com Link text]]
6530 !! html
6531 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6532 </p>
6533 !! end
6534
6535 !! test
6536 Plain link to page with question mark in title
6537 !! wikitext
6538 [[A?b]]
6539
6540 [[A?b|Baz]]
6541 !! html
6542 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6543 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6544 </p>
6545 !! end
6546
6547
6548 # I'm fairly sure the expected result here is wrong.
6549 # We want these to be URL links, not pseudo-pages with URLs for titles....
6550 # However the current output is also pretty screwy.
6551 #
6552 # ----
6553 # I'm changing it to match the current output--it arguably makes more
6554 # sense in the light of the test above. Old expected result was:
6555 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6556 #</p>
6557 # But I think this test is bordering on "garbage in, garbage out" anyway.
6558 # -- wtm
6559 !! test
6560 Piped link to URL
6561 !! wikitext
6562 Piped link to URL: [[http://www.example.com|an example URL]]
6563 !! html/php
6564 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6565 </p>
6566 !! html/parsoid
6567 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6568 !! end
6569
6570 !! test
6571 BUG 2: [[page|http://url/]] should link to page, not http://url/
6572 !! wikitext
6573 [[Main Page|http://url/]]
6574 !! html/php
6575 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6576 </p>
6577 !! html/parsoid
6578 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6579 !! end
6580
6581 # Parsoid does not mark self-links, by design.
6582 !! test
6583 BUG 337: Escaped self-links should be bold
6584 !! options
6585 title=[[Bug462]]
6586 !! wikitext
6587 [[Bu&#103;462]] [[Bug462]]
6588 !! html/php
6589 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6590 </p>
6591 !! html/php+tidy
6592 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6593 !! html/parsoid
6594 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6595 !! end
6596
6597 !! test
6598 Self-link to section should not be bold
6599 !! options
6600 title=[[Main Page]]
6601 !! wikitext
6602 [[Main Page#section]]
6603 !! html
6604 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6605 </p>
6606 !! end
6607
6608 !! article
6609 00
6610 !! text
6611 This is 00.
6612 !! endarticle
6613
6614 !!test
6615 Self-link to numeric title
6616 !!options
6617 title=[[0]]
6618 !! wikitext
6619 [[0]]
6620 !! html
6621 <p><strong class="selflink">0</strong>
6622 </p>
6623 !!end
6624
6625 !!test
6626 Link to numeric-equivalent title
6627 !!options
6628 title=[[0]]
6629 !! wikitext
6630 [[00]]
6631 !! html
6632 <p><a href="/wiki/00" title="00">00</a>
6633 </p>
6634 !!end
6635
6636 !! test
6637 <nowiki> inside a link
6638 !! wikitext
6639 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6640 !! html
6641 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6642 </p>
6643 !! end
6644
6645 !! test
6646 Non-breaking spaces in title
6647 !! wikitext
6648 [[&nbsp; Main &nbsp; Page &nbsp;]]
6649 !! html
6650 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6651 </p>
6652 !!end
6653
6654 !! test
6655 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6656 !! options
6657 language=ca
6658 !! wikitext
6659 '''[[Main Page]]'''
6660 !! html
6661 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6662 </p>
6663 !! end
6664
6665 !! test
6666 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6667 !! options
6668 language=ca
6669 !! wikitext
6670 ''[[Main Page]]''
6671 !! html
6672 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6673 </p>
6674 !! end
6675
6676 !! test
6677 Internal link with en linktrail: no apostrophes (bug 27473)
6678 !! options
6679 language=en
6680 !! wikitext
6681 [[Something]]'nice
6682 !! html
6683 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6684 </p>
6685 !! end
6686
6687 !! test
6688 Internal link with ca linktrail with apostrophes (bug 27473)
6689 !! options
6690 language=ca
6691 !! wikitext
6692 [[Something]]'nice
6693 !! html
6694 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6695 </p>
6696 !! end
6697
6698 !! test
6699 Internal link with kaa linktrail with apostrophes (bug 27473)
6700 !! options
6701 language=kaa
6702 !! wikitext
6703 [[Something]]'nice
6704 !! html
6705 <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>
6706 </p>
6707 !! end
6708
6709 !! test
6710 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6711 !! wikitext
6712 [[User:Foo/Test/63636:Bar|Test]]
6713 !! html/php
6714 <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>
6715 </p>
6716 !! html/parsoid
6717 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
6718 !! end
6719
6720 !! test
6721 Purely hash wikilink
6722 !! options
6723 title=[[User:test/123]]
6724 !! wikitext
6725 [[#a|b]]
6726 !! html/php
6727 <p><a href="#a">b</a>
6728 </p>
6729 !! html/parsoid
6730 <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>
6731 !! end
6732
6733 !! test
6734 1. Interaction of linktrail and template encapsulation
6735 !! options
6736 parsoid
6737 !! wikitext
6738 {{echo|[[Foo]]}}l
6739 !! html
6740 <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>
6741 !! end
6742
6743 !! test
6744 2. Interaction of linktrail and template encapsulation
6745 !! options
6746 parsoid
6747 !! wikitext
6748 {{echo|Some [[Fool]]}}s
6749 !! html
6750 <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>
6751 !! end
6752
6753 !! test
6754 3. Interaction of linktrail and template encapsulation
6755 !! options
6756 parsoid
6757 !! wikitext
6758 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6759 !! html
6760 <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>
6761 !! end
6762
6763 !! article
6764 Söfnuður
6765 !! text
6766 Test.
6767 !! endarticle
6768
6769 !! test
6770 Internal link with is link prefix
6771 !! options
6772 language=is
6773 !! wikitext
6774 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6775 !! html
6776 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6777 </p>
6778 !! end
6779
6780 !! article
6781 Mótmælendatrú
6782 !! text
6783 Test.
6784 !! endarticle
6785
6786 !! test
6787 Internal link with is link trail and link prefix
6788 !! options
6789 language=is
6790 !! wikitext
6791 [[mótmælendatrú|xxx]]ar
6792 [[mótmælendatrú]]ar
6793 mótmælenda[[söfnuður]]
6794 mótmælenda[[söfnuður|söfnuðir]]
6795 mótmælenda[[söfnuður|söfnuðir]]xxx
6796 !! html
6797 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6798 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6799 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6800 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6801 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6802 </p>
6803 !! end
6804
6805 !! test
6806 Parsoid link trail escaping
6807 !! options
6808 parsoid=html2wt,html2html
6809 !! wikitext
6810 [[apple]]<nowiki/>s
6811 !! html
6812 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
6813 !! end
6814
6815 !! test
6816 Parsoid link prefix escaping
6817 !! options
6818 language=is
6819 parsoid=html2wt,html2html
6820 !! wikitext
6821 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6822 !! html
6823 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
6824 !! end
6825
6826 !! test
6827 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6828 !! wikitext
6829 [[Foo| bar]]
6830
6831 [[Foo| ''bar'']]
6832
6833 [http://wp.org foo]
6834
6835 [http://wp.org ''foo'']
6836 !! html
6837 <p><a href="/wiki/Foo" title="Foo"> bar</a>
6838 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
6839 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6840 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6841 </p>
6842 !! end
6843
6844 !! test
6845 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6846 !! options
6847 parsoid
6848 !! wikitext
6849 [[Foo|{{echo|a}} b {{echo|c}}]]
6850 !! html
6851 <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>
6852 !! end
6853
6854 !! test
6855 Link with angle bracket after anchor
6856 !! wikitext
6857 [[Foo#<bar>]]
6858 !! html/php
6859 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
6860 </p>
6861 !! html/parsoid
6862 <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>
6863 !! end
6864
6865 ###
6866 ### Interwiki links (see maintenance/interwiki.sql)
6867 ###
6868
6869 !! test
6870 Inline interwiki link
6871 !! options
6872 parsoid=wt2html,wt2wt,html2html
6873 !! wikitext
6874 [[MeatBall:SoftSecurity]]
6875 !! html/php
6876 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6877 </p>
6878 !! html/parsoid
6879 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
6880 !! end
6881
6882 !! test
6883 Inline interwiki link with empty title (bug 2372)
6884 !! options
6885 parsoid=wt2html,wt2wt,html2html
6886 !! wikitext
6887 [[MeatBall:]]
6888 !! html/php
6889 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6890 </p>
6891 !! html/parsoid
6892 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
6893 !! end
6894
6895 !! test
6896 Interwiki link encoding conversion (bug 1636)
6897 !! wikitext
6898 *[[Wikipedia:ro:Olteni&#0355;a]]
6899 *[[Wikipedia:ro:Olteni&#355;a]]
6900 !! html
6901 <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>
6902 <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>
6903
6904 !! html+tidy
6905 <ul>
6906 <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>
6907 <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>
6908 </ul>
6909 !! end
6910
6911 !! test
6912 Interwiki link with fragment (bug 2130)
6913 !! wikitext
6914 [[MeatBall:SoftSecurity#foo]]
6915 !! html
6916 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6917 </p>
6918 !! end
6919
6920 # Ideally the wikipedia: prefix here should be proto-relative too
6921 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
6922 # define the 'en' prefix, and originally the test used 'wikipedia',
6923 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
6924 # article.
6925 !! test
6926 Different interwiki prefixes mapping to the same URL
6927 !! wikitext
6928 [[:en:Foo]]
6929
6930 [[:en:Foo|Foo]]
6931
6932 [[wikipedia:Foo]]
6933
6934 [[:wikipedia:Foo|Foo]]
6935
6936 [[wikipedia:en:Foo]]
6937
6938 [[:wikipedia:en:Foo]]
6939
6940 [[ wikiPEdia :Foo]]
6941 !! html/parsoid
6942 <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>
6943
6944 <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>
6945
6946 <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>
6947
6948 <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>
6949
6950 <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>
6951
6952 <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>
6953
6954 <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>
6955 !! end
6956
6957 !! test
6958 Interwiki links that cannot be represented in wiki syntax
6959 !! wikitext
6960 [[meatball:ok]]
6961 [[meatball:ok#foo|ok with fragment]]
6962 [[meatball:ok_as_well?|ok ending with ? mark]]
6963 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6964 [http://de.wikipedia.org/wiki/#foo is just fragment]
6965
6966 !! html/php
6967 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
6968 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
6969 <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>
6970 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6971 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
6972 </p>
6973 !! html/parsoid
6974 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
6975 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
6976 <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>
6977 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6978 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6979 !! end
6980
6981 !! test
6982 Interwiki links: trail
6983 !! wikitext
6984 [[wikipedia:Foo|Ba]]r
6985 !! html/php
6986 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
6987 </p>
6988 !! html/parsoid
6989 <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>
6990 !! end
6991
6992 !! test
6993 Local interwiki link
6994 !! options
6995 parsoid=wt2html,wt2wt,html2html
6996 !! wikitext
6997 [[local:Template:Foo]]
6998 !! html/php
6999 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7000 </p>
7001 !! html/parsoid
7002 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7003 !! end
7004
7005 # Parsoid does not mark self-links, by design.
7006 !! test
7007 Local interwiki link: self-link to current page
7008 !! options
7009 title=[[Main Page]]
7010 parsoid=wt2html,wt2wt,html2html
7011 !! wikitext
7012 [[local:Main Page]]
7013 !! html/php
7014 <p><strong class="selflink">local:Main Page</strong>
7015 </p>
7016 !! html/parsoid
7017 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7018 !! end
7019
7020 !! test
7021 Local interwiki link: prefix only (bug 64167)
7022 !! options
7023 parsoid=wt2html,wt2wt,html2html
7024 !! wikitext
7025 [[local:]]
7026 !! html/php
7027 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7028 </p>
7029 !! html/parsoid
7030 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7031 !! end
7032
7033 !! test
7034 Local interwiki link: with additional interwiki prefix (bug 61357)
7035 !! options
7036 parsoid=wt2html,wt2wt,html2html
7037 !! wikitext
7038 [[local:meatball:Hello]]
7039 !! html/php
7040 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7041 </p>
7042 !! html/parsoid
7043 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7044 !! end
7045
7046 !! test
7047 Multiple local interwiki link prefixes
7048 !! wikitext
7049 [[local:local:local:local:mi:local:Foo]]
7050 !! options
7051 parsoid=wt2html,wt2wt,html2html
7052 !! html/php
7053 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7054 </p>
7055 !! html/parsoid
7056 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7057 !! end
7058
7059 ###
7060 ### Interlanguage links
7061 ### Language links (so that searching for '### language' matches..)
7062 ###
7063
7064 !! test
7065 Interlanguage link
7066 !! options
7067 parsoid=wt2html,wt2wt,html2html
7068 !! wikitext
7069 Blah blah blah
7070 [[zh:Chinese]]
7071 !! html/php
7072 <p>Blah blah blah
7073 </p>
7074 !! html/parsoid
7075 <p>Blah blah blah</p>
7076 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7077 !! end
7078
7079 !! test
7080 Interlanguage link with spacing
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 Double interlanguage link
7096 !! options
7097 parsoid=wt2html,wt2wt,html2html
7098 !! wikitext
7099 Blah blah blah
7100 [[es:Spanish]]
7101 [[zh:Chinese]]
7102 !! html/php
7103 <p>Blah blah blah
7104 </p>
7105 !! html/parsoid
7106 <p>Blah blah blah</p>
7107 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7108 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7109 !! end
7110
7111 !! test
7112 Interlanguage link variations
7113 !! options
7114 parsoid=wt2html,wt2wt,html2html
7115 !! wikitext
7116 Blah blah blah
7117 [[ es :Spanish]]
7118 [[ ZH :Chinese]]
7119 [[es:Foo_bar]]
7120 [[es:Foo bar]]
7121 !! html/php
7122 <p>Blah blah blah
7123 </p>
7124 !! html/parsoid
7125 <p>Blah blah blah</p>
7126 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7127 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7128 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7129 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7130 !! end
7131
7132 !! test
7133 Interlanguage link, with prefix links
7134 !! options
7135 language=ln
7136 !! wikitext
7137 Blah blah blah
7138 [[zh:Chinese]]
7139 !! html/php
7140 <p>Blah blah blah
7141 </p>
7142 !! html/parsoid
7143 <p>Blah blah blah</p>
7144 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7145 !! end
7146
7147 !! test
7148 Double interlanguage link, with prefix links (bug 8897)
7149 !! options
7150 language=ln
7151 !! wikitext
7152 Blah blah blah
7153 [[es:Spanish]]
7154 [[zh:Chinese]]
7155 !! html/php
7156 <p>Blah blah blah
7157 </p>
7158 !! html/parsoid
7159 <p>Blah blah blah</p>
7160 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7161 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7162 !! end
7163
7164 !! test
7165 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7166 !! wikitext
7167 Blah blah blah
7168 [[mul:Article]]
7169 !! html/php
7170 <p>Blah blah blah
7171 </p>
7172 !! html/parsoid
7173 <p>Blah blah blah</p>
7174 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7175 !! end
7176
7177 !! test
7178 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7179 !! options
7180 language=ln
7181 !! wikitext
7182 [[WW&nbsp;II]]
7183 !! html
7184 <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>
7185 </p>
7186 !! end
7187
7188 !! test
7189 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7190 !! options
7191 parsoid=html2wt
7192 !! wikitext
7193 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7194
7195 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7196 !! html
7197 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7198 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7199 !! end
7200
7201 !! test
7202 Parsoid: handle constructor well
7203 !! wikitext
7204 [[constructor]]
7205
7206 [[constructor:foo]]
7207 !! html/php
7208 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7209 </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>
7210 </p>
7211 !! html/parsoid
7212 <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>
7213
7214 <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>
7215 !! end
7216
7217 !! article
7218 ko:
7219 !! text
7220 Test.
7221 !! endarticle
7222
7223 # Note that `ko` isn't a known interlanguage prefix
7224 !! test
7225 Parsoid: recognize interlanguage links without a target page
7226 !! options
7227 ill
7228 !! wikitext
7229 [[es:]]
7230
7231 [[ko:]]
7232 !! html/php
7233 es:
7234 !! html/parsoid
7235 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7236
7237 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7238 !! end
7239
7240 # Note that `ko` isn't a known interwiki prefix
7241 !! test
7242 Parsoid: recognize interwiki links without a target page
7243 !! options
7244 parsoid=wt2html,wt2wt,html2html
7245 !! wikitext
7246 [[:es:]]
7247
7248 [[:ko:]]
7249 !! html/php
7250 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7251 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7252 </p>
7253 !! html/parsoid
7254 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7255 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7256 !! end
7257
7258 !! test
7259 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7260 !! wikitext
7261 [[mi:Foo]]
7262 !! html/php
7263 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7264 </p>
7265 !! html/parsoid
7266 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7267 !! end
7268
7269 !! test
7270 Interlanguage link with preceding local interwiki link (bug 68085)
7271 !! options
7272 parsoid=wt2html,wt2wt,html2html
7273 !! wikitext
7274 Blah blah blah
7275 [[local:es:Spanish]]
7276 !! html/php
7277 <p>Blah blah blah
7278 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7279 </p>
7280 !! html/parsoid
7281 <p>Blah blah blah
7282 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7283 !! end
7284
7285 !! test
7286 Looks like an interlanguage link, but is actually a local interwiki
7287 !! options
7288 parsoid=wt2html,wt2wt,html2html
7289 !! wikitext
7290 Blah blah blah
7291 [[mi:Template:Foo]]
7292 !! html/php
7293 <p>Blah blah blah
7294 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7295 </p>
7296 !! html/parsoid
7297 <p>Blah blah blah
7298 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7299 !! end
7300
7301 ###
7302 ### Redirects, Parsoid-only
7303 ###
7304 !! test
7305 1. Simple redirect to page
7306 !! options
7307 parsoid
7308 !! wikitext
7309 #REDIRECT [[Main Page]]
7310 !! html
7311 <link rel="mw:PageProp/redirect" href="./Main_Page">
7312 !! end
7313
7314 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
7315 !! test
7316 2. Other redirect variants
7317 !! options
7318 parsoid=wt2html,wt2wt
7319 !! wikitext
7320 #REDIRECT [[Main_Page]]
7321 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
7322 !! html/parsoid
7323 <link rel="mw:PageProp/redirect" href="./Main_Page"><link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
7324 !! end
7325
7326 !! test
7327 Empty redirect
7328 !! options
7329 parsoid=wt2html,wt2wt
7330 !! wikitext
7331 #REDIRECT [[]]
7332 !! html
7333 <ol>
7334 <li>REDIRECT [[]]</li></ol>
7335 !! end
7336
7337 !! test
7338 Optional colon in #REDIRECT
7339 !! options
7340 # the colon is archaic syntax. we support it for wt2html, but we
7341 # don't care that it roundtrips back to the modern syntax.
7342 parsoid=wt2html,html2html
7343 !! wikitext
7344 #REDIRECT:[[Main Page]]
7345 !! html
7346 <link rel="mw:PageProp/redirect" href="./Main_Page">
7347 !! end
7348
7349 !! test
7350 Whitespace in #REDIRECT with optional colon
7351 !! options
7352 # the colon and gratuitous whitespace is archaic syntax. we support
7353 # it for wt2html, but we don't care that it roundtrips back to the
7354 # modern syntax (without extra whitespace)
7355 parsoid=wt2html,html2html
7356 !! wikitext
7357
7358 #REDIRECT
7359 :
7360 [[Main Page]]
7361 !! html
7362 <link rel="mw:PageProp/redirect" href="./Main_Page">
7363 !! end
7364
7365 !! test
7366 Piped link in #REDIRECT
7367 !! options
7368 # content after piped link is ignored. we support this syntax,
7369 # but don't care that the piped link is lost when we roundtrip this.
7370 parsoid=wt2html
7371 !! wikitext
7372 #REDIRECT [[Main Page|bar]]
7373 !! html
7374 <link rel="mw:PageProp/redirect" href="./Main_Page">
7375 !! end
7376
7377 !! test
7378 Redirect to category
7379 !! options
7380 parsoid=wt2html
7381 !! wikitext
7382 #REDIRECT [[Category:Foo]]
7383 !! html
7384 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7385 !! end
7386
7387 !! test
7388 Redirect to category with URL encoding
7389 !! options
7390 parsoid=wt2html
7391 !! wikitext
7392 #REDIRECT [[Category%3AFoo]]
7393 !! html
7394 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7395 !! end
7396
7397 !! test
7398 Redirect to category page
7399 !! options
7400 parsoid=wt2html,html2html
7401 !! wikitext
7402 #REDIRECT [[:Category:Foo]]
7403 !! html
7404 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7405 !! end
7406
7407 !! test
7408 Redirect to image page (1)
7409 !! options
7410 parsoid
7411 !! wikitext
7412 #REDIRECT [[File:Wiki.png]]
7413 !! html
7414 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7415 !! end
7416
7417 !! test
7418 Redirect to image page (2)
7419 !! options
7420 parsoid
7421 !! wikitext
7422 #REDIRECT [[Image:Wiki.png]]
7423 !! html
7424 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7425 !! end
7426
7427 !! test
7428 Redirect to language
7429 !! options
7430 parsoid
7431 !! wikitext
7432 #REDIRECT [[en:File:Wiki.png]]
7433 !! html
7434 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7435 !! end
7436
7437 !! test
7438 Redirect to interwiki
7439 !! options
7440 parsoid
7441 !! wikitext
7442 #REDIRECT [[meatball:File:Wiki.png]]
7443 !! html
7444 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7445 !! end
7446
7447 !! test
7448 Non-English #REDIRECT
7449 !! options
7450 parsoid
7451 language=is
7452 !! wikitext
7453 #TILVÍSUN [[Main Page]]
7454 !! html
7455 <link rel="mw:PageProp/redirect" href="./Main_Page">
7456 !! end
7457
7458 !! test
7459 New redirect
7460 !! options
7461 parsoid=html2wt
7462 !! wikitext
7463 Foo
7464 #REDIRECT [[Foo]]
7465 !! html
7466 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7467 !! end
7468
7469 ##
7470 ## XHTML tidiness
7471 ###
7472
7473 !! test
7474 <br> to <br />
7475 !! wikitext
7476 1<br>2<br />3
7477 !! html
7478 <p>1<br />2<br />3
7479 </p>
7480 !! end
7481
7482 !! test
7483 Broken br tag sanitization
7484 !! wikitext
7485 </br>
7486 !! html/php
7487 <p>&lt;/br&gt;
7488 </p>
7489 !! end
7490
7491 # TODO: Fix html2html mode (bug 51055)!
7492 # This </br> handling was added as part of bug 50831; but it
7493 # differs from how PHP+tidy handles this. We should investigate
7494 # this.
7495 !! test
7496 Parsoid: Broken br tag recognition
7497 !! options
7498 parsoid=wt2html
7499 !! wikitext
7500 </br>
7501
7502 <br/ >
7503 !! html/php+tidy
7504 <p>&lt;/br&gt;</p>
7505 <p><br /></p>
7506 !! html/parsoid
7507 <p><br></p>
7508 <p><br/></p>
7509 !! end
7510
7511 !! test
7512 Incorrecly removing closing slashes from correctly formed XHTML
7513 !! wikitext
7514 <br style="clear:both;" />
7515 !! html
7516 <p><br style="clear:both;" />
7517 </p>
7518 !! end
7519
7520 !! test
7521 Failing to transform badly formed HTML into correct XHTML
7522 !! wikitext
7523 <br style="clear: left;">
7524 <br style="clear: right;">
7525 <br style="clear: both;">
7526 !! html
7527 <p><br style="clear: left;" />
7528 <br style="clear: right;" />
7529 <br style="clear: both;" />
7530 </p>
7531 !!end
7532
7533 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
7534 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
7535 !! test
7536 Handling html with a div self-closing tag
7537 !! wikitext
7538 <div title />
7539 <div title/>
7540 <div title/ >
7541 <div title=bar />
7542 <div title=bar/>
7543 <div title=bar/ >
7544 !! html/php
7545 <p>&lt;div title /&gt;
7546 &lt;div title/&gt;
7547 </p>
7548 <div>
7549 <p>&lt;div title=bar /&gt;
7550 &lt;div title=bar/&gt;
7551 </p>
7552 <div title="bar/"></div>
7553 </div>
7554
7555 !! html/parsoid
7556 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7557 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7558 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
7559 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7560 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7561 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
7562 !! end
7563
7564 !! test
7565 Handling html with a br self-closing tag
7566 !! wikitext
7567 <br title />
7568 <br title/>
7569 <br title/ >
7570 <br title=bar />
7571 <br title=bar/>
7572 <br title=bar/ >
7573 !! html/php
7574 <p><br title="title" />
7575 <br title="title" />
7576 <br />
7577 <br title="bar" />
7578 <br title="bar" />
7579 <br title="bar/" />
7580 </p>
7581 !! html/parsoid
7582 <p><br title="" />
7583 <br title="" />
7584 <br title="" />
7585 <br title="bar" />
7586 <br title="bar" />
7587 <br title="bar/" />
7588 </p>
7589 !! end
7590
7591 !! test
7592 Horizontal ruler (should it add that extra space?)
7593 !! wikitext
7594 <hr>
7595 <hr >
7596 foo <hr
7597 > bar
7598 !! html+tidy
7599 <hr />
7600 <hr />
7601 <p>foo</p>
7602 <hr />
7603 <p>bar</p>
7604 !! end
7605
7606 !! test
7607 Horizontal ruler -- 4+ dashes render hr
7608 !! wikitext
7609 ----
7610 !! html
7611 <hr />
7612
7613 !! end
7614
7615 !! test
7616 Horizontal ruler -- eats additional dashes on the same line
7617 !! wikitext
7618 ---------
7619 !! html
7620 <hr />
7621
7622 !! end
7623
7624 !! test
7625 Horizontal ruler -- does not collapse dashes on consecutive lines
7626 !! wikitext
7627 ----
7628 ----
7629 !! html
7630 <hr />
7631 <hr />
7632
7633 !! end
7634
7635 !! test
7636 Horizontal ruler -- <4 dashes render as plain text
7637 !! wikitext
7638 ---
7639 !! html
7640 <p>---
7641 </p>
7642 !! end
7643
7644 !! test
7645 Horizontal ruler -- Supports content following dashes on same line
7646 !! wikitext
7647 ---- Foo
7648 !! html
7649 <hr /> Foo
7650
7651 !! html+tidy
7652 <hr />
7653 <p>Foo</p>
7654 !! end
7655
7656 ###
7657 ### Block-level elements
7658 ###
7659 !! test
7660 Common list
7661 !! wikitext
7662 *Common list
7663 * item 2
7664 *item 3
7665 !! html
7666 <ul><li>Common list</li>
7667 <li> item 2</li>
7668 <li>item 3</li></ul>
7669
7670 !! end
7671
7672 !! test
7673 Numbered list
7674 !! wikitext
7675 #Numbered list
7676 #item 2
7677 # item 3
7678 !! html
7679 <ol><li>Numbered list</li>
7680 <li>item 2</li>
7681 <li> item 3</li></ol>
7682
7683 !! end
7684
7685 !! test
7686 Mixed list
7687 !! wikitext
7688 *Mixed list
7689 *# with numbers
7690 ** and bullets
7691 *# and numbers
7692 *bullets again
7693 **bullet level 2
7694 ***bullet level 3
7695 ***#Number on level 4
7696 **bullet level 2
7697 **#Number on level 3
7698 **#Number on level 3
7699 *#number level 2
7700 *Level 1
7701 *** Level 3
7702 #** Level 3, but ordered
7703 !! html
7704 <ul><li>Mixed list
7705 <ol><li> with numbers</li></ol>
7706 <ul><li> and bullets</li></ul>
7707 <ol><li> and numbers</li></ol></li>
7708 <li>bullets again
7709 <ul><li>bullet level 2
7710 <ul><li>bullet level 3
7711 <ol><li>Number on level 4</li></ol></li></ul></li>
7712 <li>bullet level 2
7713 <ol><li>Number on level 3</li>
7714 <li>Number on level 3</li></ol></li></ul>
7715 <ol><li>number level 2</li></ol></li>
7716 <li>Level 1
7717 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7718 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7719
7720 !! end
7721
7722 !! test
7723 Nested lists 1
7724 !! wikitext
7725 *foo
7726 **bar
7727 !! html
7728 <ul><li>foo
7729 <ul><li>bar</li></ul></li></ul>
7730
7731 !! end
7732
7733 !! test
7734 Nested lists 2
7735 !! wikitext
7736 **foo
7737 *bar
7738 !! html
7739 <ul><li><ul><li>foo</li></ul></li>
7740 <li>bar</li></ul>
7741
7742 !! end
7743
7744 !! test
7745 Nested lists 3 (first element empty)
7746 !! wikitext
7747 *
7748 **bar
7749 !! html
7750 <ul><li>
7751 <ul><li>bar</li></ul></li></ul>
7752
7753 !! end
7754
7755 !! test
7756 Nested lists 4 (first element empty)
7757 !! wikitext
7758 **
7759 *bar
7760 !! html
7761 <ul><li><ul><li></li></ul></li>
7762 <li>bar</li></ul>
7763
7764 !! end
7765
7766 !! test
7767 Nested lists 5 (both elements empty)
7768 !! wikitext
7769 **
7770 *
7771 !! html
7772 <ul><li><ul><li></li></ul></li>
7773 <li></li></ul>
7774
7775 !! end
7776
7777 !! test
7778 Nested lists 6 (both elements empty)
7779 !! wikitext
7780 *
7781 **
7782 !! html
7783 <ul><li>
7784 <ul><li></li></ul></li></ul>
7785
7786 !! end
7787
7788 !! test
7789 Nested lists 7 (skip initial nesting levels)
7790 !! wikitext
7791 *** foo
7792 !! html
7793 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7794
7795 !! end
7796
7797 !! test
7798 Nested lists 8 (multiple nesting transitions)
7799 !! wikitext
7800 * foo
7801 *** bar
7802 ** baz
7803 * boo
7804 !! html
7805 <ul><li> foo
7806 <ul><li><ul><li> bar</li></ul></li>
7807 <li> baz</li></ul></li>
7808 <li> boo</li></ul>
7809
7810 !! end
7811
7812 !! test
7813 1. Lists with start-of-line-transparent tokens before bullets: Comments
7814 !! wikitext
7815 *foo
7816 *<!--cmt-->bar
7817 <!--cmt-->*baz
7818 !! html
7819 <ul><li>foo</li>
7820 <li>bar</li>
7821 <li>baz</li></ul>
7822
7823 !! end
7824
7825 !! test
7826 2. Lists with start-of-line-transparent tokens before bullets: Template close
7827 !! wikitext
7828 *foo {{echo|bar
7829 }}*baz
7830 !! html
7831 <ul><li>foo bar</li>
7832 <li>baz</li></ul>
7833
7834 !! end
7835
7836 !! test
7837 List items are not parsed correctly following a <pre> block (bug 785)
7838 !! wikitext
7839 * <pre>foo</pre>
7840 * <pre>bar</pre>
7841 * zar
7842 !! html
7843 <ul><li> <pre>foo</pre></li>
7844 <li> <pre>bar</pre></li>
7845 <li> zar</li></ul>
7846
7847 !! end
7848
7849 !! test
7850 List items from template
7851 !! wikitext
7852
7853 {{inner list}}
7854 * item 2
7855
7856 * item 0
7857 {{inner list}}
7858 * item 2
7859
7860 * item 0
7861 * notSOL{{inner list}}
7862 * item 2
7863 !! html
7864 <ul><li> item 1</li>
7865 <li> item 2</li></ul>
7866 <ul><li> item 0</li>
7867 <li> item 1</li>
7868 <li> item 2</li></ul>
7869 <ul><li> item 0</li>
7870 <li> notSOL</li>
7871 <li> item 1</li>
7872 <li> item 2</li></ul>
7873
7874 !! end
7875
7876 !! test
7877 List interrupted by empty line or heading
7878 !! wikitext
7879 * foo
7880
7881 ** bar
7882 == A heading ==
7883 * Another list item
7884 !! html
7885 <ul><li> foo</li></ul>
7886 <ul><li><ul><li> bar</li></ul></li></ul>
7887 <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>
7888 <ul><li> Another list item</li></ul>
7889
7890 !!end
7891
7892 !!test
7893 Multiple list tags generated by templates
7894 !! wikitext
7895 {{echo|<li>}}a
7896 {{echo|<li>}}b
7897 {{echo|<li>}}c
7898 !! html
7899 <li>a
7900 <li>b
7901 <li>c</li>
7902 </li>
7903 </li>
7904
7905 !! html+tidy
7906 <ul>
7907 <li>a</li>
7908 <li>b</li>
7909 <li>c</li>
7910 </ul>
7911 !!end
7912
7913 !!test
7914 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7915 !! wikitext
7916 *a
7917 <!--This line will NOT split the list-->
7918 *b
7919 <!--This line will NOT split the list either-->
7920 *c
7921 <!--foo--> <!----> <!--This line NOT split the list either-->
7922 *d
7923 !! html
7924 <ul><li>a</li>
7925 <li>b</li>
7926 <li>c</li>
7927 <li>d</li></ul>
7928
7929 !!end
7930
7931 !!test
7932 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7933 !! wikitext
7934 *a
7935 <!--This line will NOT split the list-->
7936 *b
7937 <!--This line will NOT split the list either-->
7938 *c
7939 <!--foo--> <!----> <!--This line NOT split the list
7940 either-->
7941 *d
7942 !! html
7943 <ul><li>a</li>
7944 <li>b</li>
7945 <li>c</li>
7946 <li>d</li></ul>
7947
7948 !!end
7949
7950 !!test
7951 Test the li-hack
7952 (The PHP parser relies on Tidy for the hack)
7953 !!options
7954 parsoid=wt2html,wt2wt
7955 !! wikitext
7956 * foo
7957 * <li>li-hack
7958 * {{echo|<li>templated li-hack}}
7959 * <!--foo--> <li> unsupported li-hack with preceding comments
7960
7961 <ul>
7962 <li><li>not a li-hack
7963 </li>
7964 </ul>
7965 !! html+tidy
7966 <ul>
7967 <li>foo</li>
7968 <li>li-hack</li>
7969 <li>templated li-hack</li>
7970 <li>unsupported li-hack with preceding comments</li>
7971 </ul>
7972 <ul>
7973 <li>not a li-hack</li>
7974 </ul>
7975 !!end
7976
7977 !! test
7978 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
7979 !! options
7980 parsoid
7981 !! wikitext
7982 # foo
7983 ## bar
7984 * foo
7985 ** bar
7986 : foo
7987 :: bar
7988 !! html
7989 <ol>
7990 <li> foo<ol>
7991 <li> bar</li>
7992 </ol></li>
7993 </ol><ul>
7994 <li> foo<ul>
7995 <li> bar</li>
7996 </ul></li>
7997 </ul><dl>
7998 <dd> foo<dl>
7999 <dd> bar</dd>
8000 </dl></dd>
8001 </dl>
8002 !! end
8003
8004 !! test
8005 Parsoid: Test of whitespace serialization with Templated bullets
8006 !! options
8007 parsoid
8008 !! wikitext
8009 * {{bullet}}
8010 !! html
8011 <ul>
8012 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8013 </ul>
8014 !! end
8015
8016 # ------------------------------------------------------------------------
8017 # The next set of tests are about Parsoid's ability to handle badly nested
8018 # tags (parse, minimize scope of fixup, and roundtrip back)
8019 # ------------------------------------------------------------------------
8020
8021 !! test
8022 Unbalanced closing block tags break a list
8023 (php parser relies on Tidy to fix up)
8024 !! wikitext
8025 <div>
8026 *a</div><div>
8027 *b</div>
8028 !! html+tidy
8029 <div>
8030 <ul>
8031 <li>a</li>
8032 </ul>
8033 </div>
8034 <div>
8035 <ul>
8036 <li>b</li>
8037 </ul>
8038 </div>
8039 !! end
8040
8041 # Parsoid fails this test, but it might be tricky to support properly.
8042 # See bug 68395.
8043 !! test
8044 Unbalanced closing non-block tags don't break a list
8045 (php parser relies on Tidy to fix up)
8046 !! wikitext
8047 <span>
8048 *a</span><span>
8049 *b</span>
8050 !! html/php+tidy
8051 <ul>
8052 <li><span>a</span></li>
8053 <li><span>b</span></li>
8054 </ul>
8055 !! html/parsoid
8056 <span>
8057 <ul>
8058 <li>a<span></span>
8059 </li>
8060 <li>b
8061 </li>
8062 </ul>
8063 </span>
8064 !! end
8065
8066 !! test
8067 Unclosed formatting tags that straddle lists are closed and reopened
8068 (php parser relies on Tidy to fix up)
8069 !! options
8070 parsoid=wt2html,wt2wt,html2html
8071 !! wikitext
8072 # <s> a
8073 # b </s>
8074 !! html/php+tidy
8075 <ol>
8076 <li><s>a</s></li>
8077 <li><s>b</s></li>
8078 </ol>
8079 !! html/parsoid
8080 <ol><li> <s> a</s></li>
8081 <li><s> b </s></li></ol>
8082 !! end
8083
8084 # Parsoid fails this test, but it might be tricky to support properly.
8085 # See bug 68395.
8086 !!test
8087 List embedded in a non-block tag
8088 (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
8089 !! wikitext
8090 <small>
8091 * foo
8092 </small>
8093 !! html/php+tidy
8094 <ul>
8095 <li><small>foo</small></li>
8096 </ul>
8097 !! html/parsoid
8098 <small>
8099 <ul>
8100 <li> foo</li>
8101 </ul>
8102 </small>
8103 !!end
8104
8105 # This is a bug in the PHP parser + tidy combination.
8106 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8107 # and then fostered out of the table by tidy.)
8108 # We believe the Parsoid output to be correct.
8109 !! test
8110 Table with missing opening <tr> tag
8111 !! options
8112 parsoid=wt2html,wt2wt
8113 !! wikitext
8114 <table>
8115 <td>foo</td>
8116 </tr>
8117 </table>
8118 !! html/php+tidy
8119 <p>&lt;/tr&gt;</p>
8120 <table>
8121 <tr>
8122 <td>foo</td>
8123 </tr>
8124 </table>
8125 !! html/parsoid
8126 <table>
8127 <tr>
8128 <td>foo</td>
8129 </tr>
8130 </table>
8131 !! end
8132
8133 ###
8134 ### Magic Words
8135 ###
8136
8137 # Note that the current date is hard-coded as
8138 # 1970-01-01T00:02:03Z (a Thursday)
8139 # when running parser tests. The timezone is also fixed to GMT, so
8140 # local date will be identical to current date.
8141
8142 !! test
8143 Magic Word: {{CURRENTDAY}}
8144 !! wikitext
8145 {{CURRENTDAY}}
8146 !! html
8147 <p>1
8148 </p>
8149 !! end
8150
8151 !! test
8152 Magic Word: {{CURRENTDAY2}}
8153 !! wikitext
8154 {{CURRENTDAY2}}
8155 !! html
8156 <p>01
8157 </p>
8158 !! end
8159
8160 !! test
8161 Magic Word: {{CURRENTDAYNAME}}
8162 !! wikitext
8163 {{CURRENTDAYNAME}}
8164 !! html
8165 <p>Thursday
8166 </p>
8167 !! end
8168
8169 !! test
8170 Magic Word: {{CURRENTDOW}}
8171 !! wikitext
8172 {{CURRENTDOW}}
8173 !! html
8174 <p>4
8175 </p>
8176 !! end
8177
8178 !! test
8179 Magic Word: {{CURRENTMONTH}}
8180 !! wikitext
8181 {{CURRENTMONTH}}
8182 !! html
8183 <p>01
8184 </p>
8185 !! end
8186
8187 !! test
8188 Magic Word: {{CURRENTMONTH1}}
8189 !! wikitext
8190 {{CURRENTMONTH1}}
8191 !! html
8192 <p>1
8193 </p>
8194 !! end
8195
8196 !! test
8197 Magic Word: {{CURRENTMONTHABBREV}}
8198 !! wikitext
8199 {{CURRENTMONTHABBREV}}
8200 !! html
8201 <p>Jan
8202 </p>
8203 !! end
8204
8205 !! test
8206 Magic Word: {{CURRENTMONTHNAME}}
8207 !! wikitext
8208 {{CURRENTMONTHNAME}}
8209 !! html
8210 <p>January
8211 </p>
8212 !! end
8213
8214 !! test
8215 Magic Word: {{CURRENTMONTHNAMEGEN}}
8216 !! wikitext
8217 {{CURRENTMONTHNAMEGEN}}
8218 !! html
8219 <p>January
8220 </p>
8221 !! end
8222
8223 !! test
8224 Magic Word: {{CURRENTTIME}}
8225 !! wikitext
8226 {{CURRENTTIME}}
8227 !! html
8228 <p>00:02
8229 </p>
8230 !! end
8231
8232 !! test
8233 Magic Word: {{CURRENTHOUR}}
8234 !! wikitext
8235 {{CURRENTHOUR}}
8236 !! html
8237 <p>00
8238 </p>
8239 !! end
8240
8241 !! test
8242 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8243 !! wikitext
8244 {{CURRENTWEEK}}
8245 !! html
8246 <p>1
8247 </p>
8248 !! end
8249
8250 !! test
8251 Magic Word: {{CURRENTYEAR}}
8252 !! wikitext
8253 {{CURRENTYEAR}}
8254 !! html
8255 <p>1970
8256 </p>
8257 !! end
8258
8259 !! test
8260 Magic Word: {{CURRENTTIMESTAMP}}
8261 !! wikitext
8262 {{CURRENTTIMESTAMP}}
8263 !! html
8264 <p>19700101000203
8265 </p>
8266 !! end
8267
8268 !! test
8269 Magic Words LOCAL (UTC)
8270 !! wikitext
8271 * {{LOCALMONTH}}
8272 * {{LOCALMONTH1}}
8273 * {{LOCALMONTHNAME}}
8274 * {{LOCALMONTHNAMEGEN}}
8275 * {{LOCALMONTHABBREV}}
8276 * {{LOCALDAY}}
8277 * {{LOCALDAY2}}
8278 * {{LOCALDAYNAME}}
8279 * {{LOCALYEAR}}
8280 * {{LOCALTIME}}
8281 * {{LOCALHOUR}}
8282 * {{LOCALWEEK}}
8283 * {{LOCALDOW}}
8284 * {{LOCALTIMESTAMP}}
8285 !! html
8286 <ul><li> 01</li>
8287 <li> 1</li>
8288 <li> January</li>
8289 <li> January</li>
8290 <li> Jan</li>
8291 <li> 1</li>
8292 <li> 01</li>
8293 <li> Thursday</li>
8294 <li> 1970</li>
8295 <li> 00:02</li>
8296 <li> 00</li>
8297 <li> 1</li>
8298 <li> 4</li>
8299 <li> 19700101000203</li></ul>
8300
8301 !! end
8302
8303 !! test
8304 Magic Word: {{FULLPAGENAME}}
8305 !! options
8306 title=[[User:Ævar Arnfjörð Bjarmason]]
8307 !! wikitext
8308 {{FULLPAGENAME}}
8309 !! html
8310 <p>User:Ævar Arnfjörð Bjarmason
8311 </p>
8312 !! end
8313
8314 !! test
8315 Magic Word: {{FULLPAGENAMEE}}
8316 !! options
8317 title=[[User:Ævar Arnfjörð Bjarmason]]
8318 !! wikitext
8319 {{FULLPAGENAMEE}}
8320 !! html
8321 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8322 </p>
8323 !! end
8324
8325 !! test
8326 Magic Word: {{TALKSPACE}}
8327 !! options
8328 title=[[User:Ævar Arnfjörð Bjarmason]]
8329 !! wikitext
8330 {{TALKSPACE}}
8331 !! html
8332 <p>User talk
8333 </p>
8334 !! end
8335
8336 !! test
8337 Magic Word: {{TALKSPACE}}, same namespace
8338 !! options
8339 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8340 !! wikitext
8341 {{TALKSPACE}}
8342 !! html
8343 <p>User talk
8344 </p>
8345 !! end
8346
8347 !! test
8348 Magic Word: {{TALKSPACE}}, main namespace
8349 !! options
8350 title=[[Parser Test]]
8351 !! wikitext
8352 {{TALKSPACE}}
8353 !! html
8354 <p>Talk
8355 </p>
8356 !! end
8357
8358 !! test
8359 Magic Word: {{TALKSPACEE}}
8360 !! options
8361 title=[[User:Ævar Arnfjörð Bjarmason]]
8362 !! wikitext
8363 {{TALKSPACEE}}
8364 !! html
8365 <p>User_talk
8366 </p>
8367 !! end
8368
8369 !! test
8370 Magic Word: {{SUBJECTSPACE}}
8371 !! options
8372 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8373 !! wikitext
8374 {{SUBJECTSPACE}}
8375 !! html
8376 <p>User
8377 </p>
8378 !! end
8379
8380 !! test
8381 Magic Word: {{SUBJECTSPACE}}, same namespace
8382 !! options
8383 title=[[User:Ævar Arnfjörð Bjarmason]]
8384 !! wikitext
8385 {{SUBJECTSPACE}}
8386 !! html
8387 <p>User
8388 </p>
8389 !! end
8390
8391 !! test
8392 Magic Word: {{SUBJECTSPACE}}, main namespace
8393 !! options
8394 title=[[Parser Test]]
8395 !! wikitext
8396 {{SUBJECTSPACE}}
8397 !! html
8398
8399 !! end
8400
8401 !! test
8402 Magic Word: {{SUBJECTSPACEE}}
8403 !! options
8404 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8405 !! wikitext
8406 {{SUBJECTSPACEE}}
8407 !! html
8408 <p>User
8409 </p>
8410 !! end
8411
8412 !! test
8413 Magic Word: {{NAMESPACE}}
8414 !! options
8415 title=[[User:Ævar Arnfjörð Bjarmason]]
8416 !! wikitext
8417 {{NAMESPACE}}
8418 !! html
8419 <p>User
8420 </p>
8421 !! end
8422
8423 !! test
8424 Magic Word: {{NAMESPACEE}}
8425 !! options
8426 title=[[User:Ævar Arnfjörð Bjarmason]]
8427 !! wikitext
8428 {{NAMESPACEE}}
8429 !! html
8430 <p>User
8431 </p>
8432 !! end
8433
8434 !! test
8435 Magic Word: {{NAMESPACENUMBER}}
8436 !! options
8437 title=[[User:Ævar Arnfjörð Bjarmason]]
8438 !! wikitext
8439 {{NAMESPACENUMBER}}
8440 !! html
8441 <p>2
8442 </p>
8443 !! end
8444
8445 !! test
8446 Magic Word: {{SUBPAGENAME}}
8447 !! options
8448 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8449 !! wikitext
8450 {{SUBPAGENAME}}
8451 !! html
8452 <p>sub ö
8453 </p>
8454 !! end
8455
8456 !! test
8457 Magic Word: {{SUBPAGENAMEE}}
8458 !! options
8459 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8460 !! wikitext
8461 {{SUBPAGENAMEE}}
8462 !! html
8463 <p>sub_%C3%B6
8464 </p>
8465 !! end
8466
8467 !! test
8468 Magic Word: {{ROOTPAGENAME}}
8469 !! options
8470 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8471 !! wikitext
8472 {{ROOTPAGENAME}}
8473 !! html
8474 <p>Ævar Arnfjörð Bjarmason
8475 </p>
8476 !! end
8477
8478 !! test
8479 Magic Word: {{ROOTPAGENAMEE}}
8480 !! options
8481 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8482 !! wikitext
8483 {{ROOTPAGENAMEE}}
8484 !! html
8485 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8486 </p>
8487 !! end
8488
8489 !! test
8490 Magic Word: {{BASEPAGENAME}}
8491 !! options
8492 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8493 !! wikitext
8494 {{BASEPAGENAME}}
8495 !! html
8496 <p>Ævar Arnfjörð Bjarmason
8497 </p>
8498 !! end
8499
8500 !! test
8501 Magic Word: {{BASEPAGENAMEE}}
8502 !! options
8503 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8504 !! wikitext
8505 {{BASEPAGENAMEE}}
8506 !! html
8507 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8508 </p>
8509 !! end
8510
8511 !! test
8512 Magic Word: {{TALKPAGENAME}}
8513 !! options
8514 title=[[User:Ævar Arnfjörð Bjarmason]]
8515 !! wikitext
8516 {{TALKPAGENAME}}
8517 !! html
8518 <p>User talk:Ævar Arnfjörð Bjarmason
8519 </p>
8520 !! end
8521
8522 !! test
8523 Magic Word: {{TALKPAGENAMEE}}
8524 !! options
8525 title=[[User:Ævar Arnfjörð Bjarmason]]
8526 !! wikitext
8527 {{TALKPAGENAMEE}}
8528 !! html
8529 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8530 </p>
8531 !! end
8532
8533 !! test
8534 Magic Word: {{SUBJECTPAGENAME}}
8535 !! options
8536 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8537 !! wikitext
8538 {{SUBJECTPAGENAME}}
8539 !! html
8540 <p>User:Ævar Arnfjörð Bjarmason
8541 </p>
8542 !! end
8543
8544 !! test
8545 Magic Word: {{SUBJECTPAGENAMEE}}
8546 !! options
8547 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8548 !! wikitext
8549 {{SUBJECTPAGENAMEE}}
8550 !! html
8551 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8552 </p>
8553 !! end
8554
8555 !! test
8556 Magic Word: {{NUMBEROFFILES}}
8557 !! wikitext
8558 {{NUMBEROFFILES}}
8559 !! html
8560 <p>5
8561 </p>
8562 !! end
8563
8564 !! test
8565 Magic Word: {{PAGENAME}}
8566 !! options
8567 title=[[User:Ævar Arnfjörð Bjarmason]]
8568 !! wikitext
8569 {{PAGENAME}}
8570 !! html
8571 <p>Ævar Arnfjörð Bjarmason
8572 </p>
8573 !! end
8574
8575 !! test
8576 Magic Word: {{PAGENAME}} with metacharacters
8577 !! options
8578 title=[['foo & bar = baz']]
8579 !! wikitext
8580 ''{{PAGENAME}}''
8581 !! html/php
8582 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8583 </p>
8584 !! html+tidy
8585 <p><i>'foo &amp; bar = baz'</i></p>
8586 !! end
8587
8588 !! test
8589 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8590 !! options
8591 title=[[*RFC 1234 http://example.com/]]
8592 !! wikitext
8593 {{PAGENAME}}
8594 !! html/php
8595 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8596 </p>
8597 !! html+tidy
8598 <p>*RFC 1234 http://example.com/</p>
8599 !! end
8600
8601 !! test
8602 Magic Word: {{PAGENAMEE}}
8603 !! options
8604 title=[[User:Ævar Arnfjörð Bjarmason]]
8605 !! wikitext
8606 {{PAGENAMEE}}
8607 !! html
8608 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8609 </p>
8610 !! end
8611
8612 !! test
8613 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8614 !! options
8615 title=[[*RFC 1234 http://example.com/]]
8616 !! wikitext
8617 {{PAGENAMEE}}
8618 !! html/php
8619 <p>&#42;RFC_1234_http&#58;//example.com/
8620 </p>
8621 !! html+tidy
8622 <p>*RFC_1234_http://example.com/</p>
8623 !! end
8624
8625 !! test
8626 Magic Word: {{REVISIONID}}
8627 !! wikitext
8628 {{REVISIONID}}
8629 !! html
8630 <p>1337
8631 </p>
8632 !! end
8633
8634 !! test
8635 Magic Word: {{SCRIPTPATH}}
8636 !! wikitext
8637 {{SCRIPTPATH}}
8638 !! html
8639 <p>/
8640 </p>
8641 !! end
8642
8643 !! test
8644 Magic Word: {{STYLEPATH}}
8645 !! wikitext
8646 {{STYLEPATH}}
8647 !! html
8648 <p>/skins
8649 </p>
8650 !! end
8651
8652 !! test
8653 Magic Word: {{SERVER}}
8654 !! wikitext
8655 {{SERVER}}
8656 !! html
8657 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8658 </p>
8659 !! end
8660
8661 !! test
8662 Magic Word: {{SERVERNAME}}
8663 !! wikitext
8664 {{SERVERNAME}}
8665 !! html
8666 <p>example.org
8667 </p>
8668 !! end
8669
8670 !! test
8671 Magic Word: {{SITENAME}}
8672 !! wikitext
8673 {{SITENAME}}
8674 !! html
8675 <p>MediaWiki
8676 </p>
8677 !! end
8678
8679 !! test
8680 Case-sensitive magic words, when cased differently, should just be template transclusions
8681 !! wikitext
8682 {{CurrentMonth}}
8683 {{currentday}}
8684 {{cURreNTweEK}}
8685 {{currentHour}}
8686 !! html
8687 <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>
8688 <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>
8689 <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>
8690 <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>
8691 </p>
8692 !! end
8693
8694 !! test
8695 Case-insensitive magic words should still work with weird casing.
8696 !! wikitext
8697 {{sErVeRNaMe}}
8698 {{LCFirst:AOEU}}
8699 {{ucFIRST:aoeu}}
8700 {{SERver}}
8701 !! html
8702 <p>example.org
8703 aOEU
8704 Aoeu
8705 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8706 </p>
8707 !! end
8708
8709 !! test
8710 Namespace 1 {{ns:1}}
8711 !! wikitext
8712 {{ns:1}}
8713 !! html
8714 <p>Talk
8715 </p>
8716 !! end
8717
8718 !! test
8719 Namespace 1 {{ns:01}}
8720 !! wikitext
8721 {{ns:01}}
8722 !! html
8723 <p>Talk
8724 </p>
8725 !! end
8726
8727 !! test
8728 Namespace 0 {{ns:0}} (bug 4783)
8729 !! wikitext
8730 {{ns:0}}
8731 !! html
8732
8733 !! end
8734
8735 !! test
8736 Namespace 0 {{ns:00}} (bug 4783)
8737 !! wikitext
8738 {{ns:00}}
8739 !! html
8740
8741 !! end
8742
8743 !! test
8744 Namespace -1 {{ns:-1}}
8745 !! wikitext
8746 {{ns:-1}}
8747 !! html
8748 <p>Special
8749 </p>
8750 !! end
8751
8752 !! test
8753 Namespace User {{ns:User}}
8754 !! wikitext
8755 {{ns:User}}
8756 !! html
8757 <p>User
8758 </p>
8759 !! end
8760
8761 !! test
8762 Namespace User talk {{ns:User_talk}}
8763 !! wikitext
8764 {{ns:User_talk}}
8765 !! html
8766 <p>User talk
8767 </p>
8768 !! end
8769
8770 !! test
8771 Namespace User talk {{ns:uSeR tAlK}}
8772 !! wikitext
8773 {{ns:uSeR tAlK}}
8774 !! html
8775 <p>User talk
8776 </p>
8777 !! end
8778
8779 !! test
8780 Namespace File {{ns:File}}
8781 !! wikitext
8782 {{ns:File}}
8783 !! html
8784 <p>File
8785 </p>
8786 !! end
8787
8788 !! test
8789 Namespace File {{ns:Image}}
8790 !! wikitext
8791 {{ns:Image}}
8792 !! html
8793 <p>File
8794 </p>
8795 !! end
8796
8797 !! test
8798 Namespace (lang=de) Benutzer {{ns:User}}
8799 !! options
8800 language=de
8801 !! wikitext
8802 {{ns:User}}
8803 !! html
8804 <p>Benutzer
8805 </p>
8806 !! end
8807
8808 !! test
8809 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
8810 !! options
8811 language=de
8812 !! wikitext
8813 {{ns:3}}
8814 !! html
8815 <p>Benutzer Diskussion
8816 </p>
8817 !! end
8818
8819
8820 !! test
8821 Urlencode
8822 !! wikitext
8823 {{urlencode:hi world?!}}
8824 {{urlencode:hi world?!|WIKI}}
8825 {{urlencode:hi world?!|PATH}}
8826 {{urlencode:hi world?!|QUERY}}
8827 !! html
8828 <p>hi+world%3F%21
8829 hi_world%3F!
8830 hi%20world%3F%21
8831 hi+world%3F%21
8832 </p>
8833 !! end
8834
8835 !! test
8836 Magic Word: prioritize type info over data-parsoid
8837 !! options
8838 parsoid=html2wt
8839 !! wikitext
8840 __FORCETOC__
8841 !! html
8842 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
8843 !! end
8844
8845 !! test
8846 Magic Word: serialize on separate line (parsoid)
8847 !! options
8848 parsoid=wt2wt,html2wt
8849 !! wikitext
8850 foo
8851 __NOTOC__
8852 bar
8853 !! html
8854 foo<meta property="mw:PageProp/notoc"/>bar
8855 !! end
8856
8857 !! test
8858 Magic Word: rt non-english wikis
8859 !! options
8860 parsoid=wt2wt
8861 language=de
8862 !! wikitext
8863 __NOEDITSECTION__
8864 !! html
8865 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
8866 !! end
8867
8868 ###
8869 ### Magic links
8870 ###
8871 !! test
8872 Magic links: internal link to RFC (bug 479)
8873 !! wikitext
8874 [[RFC 123]]
8875 !! html
8876 <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>
8877 </p>
8878 !! end
8879
8880 !! test
8881 Magic links: RFC (bug 479)
8882 !! wikitext
8883 RFC 822
8884 !! html
8885 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8886 </p>
8887 !! end
8888
8889 !! test
8890 Magic links: ISBN (bug 1937)
8891 !! wikitext
8892 ISBN 0-306-40615-2
8893 !! html
8894 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8895 </p>
8896 !! end
8897
8898 !! test
8899 Magic links: PMID incorrectly converts space to underscore
8900 !! wikitext
8901 PMID 1234
8902 !! html
8903 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8904 </p>
8905 !! end
8906
8907 ###
8908 ### Templates
8909 ####
8910
8911 !! test
8912 Nonexistent template
8913 !! wikitext
8914 {{thistemplatedoesnotexist}}
8915 !! html
8916 <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>
8917 </p>
8918 !! end
8919
8920 !! test
8921 Template with invalid target containing tags
8922 !! wikitext
8923 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8924 !! html
8925 <p>{{a<b>b</b>|foo|a=b|a = b}}
8926 </p>
8927 !! end
8928
8929 !! test
8930 Template with invalid target containing unclosed tag
8931 !! wikitext
8932 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8933 !! html
8934 <p>{{a<b>|foo|a=b|a = b}}</b>
8935 </p>
8936 !! end
8937
8938 !! test
8939 Template with invalid target containing wikilink
8940 !! wikitext
8941 {{[[Main Page]]}}
8942 !! html/php
8943 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
8944 </p>
8945 !! html/parsoid
8946 <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>
8947 !! end
8948
8949 !! test
8950 Template with just whitespace in it, bug #68421
8951 !! wikitext
8952 {{echo|{{ }}}}
8953 !! html/parsoid
8954 <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>
8955 !! end
8956
8957 !! article
8958 Template:test
8959 !! text
8960 This is a test template
8961 !! endarticle
8962
8963 !! test
8964 Simple template
8965 !! wikitext
8966 {{test}}
8967 !! html
8968 <p>This is a test template
8969 </p>
8970 !! end
8971
8972 !! test
8973 Template with explicit namespace
8974 !! wikitext
8975 {{Template:test}}
8976 !! html
8977 <p>This is a test template
8978 </p>
8979 !! end
8980
8981
8982 !! article
8983 Template:paramtest
8984 !! text
8985 This is a test template with parameter {{{param}}}
8986 !! endarticle
8987
8988 !! test
8989 Template parameter
8990 !! wikitext
8991 {{paramtest|param=foo}}
8992 !! html
8993 <p>This is a test template with parameter foo
8994 </p>
8995 !! end
8996
8997 !! article
8998 Template:paramtestnum
8999 !! text
9000 [[{{{1}}}|{{{2}}}]]
9001 !! endarticle
9002
9003 !! test
9004 Template unnamed parameter
9005 !! wikitext
9006 {{paramtestnum|Main Page|the main page}}
9007 !! html
9008 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9009 </p>
9010 !! end
9011
9012 !! article
9013 Template:templatesimple
9014 !! text
9015 (test)
9016 !! endarticle
9017
9018 !! article
9019 Template:templateredirect
9020 !! text
9021 #redirect [[Template:templatesimple]]
9022 !! endarticle
9023
9024 !! article
9025 Template:templateasargtestnum
9026 !! text
9027 {{{{{1}}}}}
9028 !! endarticle
9029
9030 !! article
9031 Template:templateasargtest
9032 !! text
9033 {{template{{{templ}}}}}
9034 !! endarticle
9035
9036 !! article
9037 Template:templateasargtest2
9038 !! text
9039 {{{{{templ}}}}}
9040 !! endarticle
9041
9042 !! test
9043 Template with template name as unnamed argument
9044 !! wikitext
9045 {{templateasargtestnum|templatesimple}}
9046 !! html
9047 <p>(test)
9048 </p>
9049 !! end
9050
9051 !! test
9052 Template with template name as argument
9053 !! wikitext
9054 {{templateasargtest|templ=simple}}
9055 !! html
9056 <p>(test)
9057 </p>
9058 !! end
9059
9060 !! test
9061 Template with template name as argument (2)
9062 !! wikitext
9063 {{templateasargtest2|templ=templatesimple}}
9064 !! html
9065 <p>(test)
9066 </p>
9067 !! end
9068
9069 !! article
9070 Template:templateasargtestdefault
9071 !! text
9072 {{{{{templ|templatesimple}}}}}
9073 !! endarticle
9074
9075 !! article
9076 Template:templa
9077 !! text
9078 '''templ'''
9079 !! endarticle
9080
9081 !! test
9082 Template with default value
9083 !! wikitext
9084 {{templateasargtestdefault}}
9085 !! html
9086 <p>(test)
9087 </p>
9088 !! end
9089
9090 !! test
9091 Template with default value (value set)
9092 !! wikitext
9093 {{templateasargtestdefault|templ=templa}}
9094 !! html
9095 <p><b>templ</b>
9096 </p>
9097 !! end
9098
9099 !! test
9100 Template redirect
9101 !! wikitext
9102 {{templateredirect}}
9103 !! html
9104 <p>(test)
9105 </p>
9106 !! end
9107
9108 !! test
9109 Template with argument in separate line
9110 !! wikitext
9111 {{ templateasargtest |
9112 templ = simple }}
9113 !! html
9114 <p>(test)
9115 </p>
9116 !! end
9117
9118 !! test
9119 Template with complex template as argument
9120 !! wikitext
9121 {{paramtest|
9122 param ={{ templateasargtest |
9123 templ = simple }}}}
9124 !! html
9125 <p>This is a test template with parameter (test)
9126 </p>
9127 !! end
9128
9129 !! test
9130 Template with thumb image (with link in description)
9131 !! wikitext
9132 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9133 !! html/php
9134 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>
9135
9136 !! html+tidy
9137 <p>This is a test template with parameter</p>
9138 <div class="thumb tright">
9139 <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>
9140 <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>
9141 </div>
9142 </div>
9143 !! html/parsoid
9144 <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>
9145 !! end
9146
9147 !! article
9148 Template:complextemplate
9149 !! text
9150 {{{1}}} {{paramtest|
9151 param ={{{param}}}}}
9152 !! endarticle
9153
9154 !! test
9155 Template with complex arguments
9156 !! wikitext
9157 {{complextemplate|
9158 param ={{ templateasargtest |
9159 templ = simple }}|[[Template:complextemplate|link]]}}
9160 !! html
9161 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
9162 </p>
9163 !! end
9164
9165 !! test
9166 BUG 553: link with two variables in a piped link
9167 !! wikitext
9168 {|
9169 |[[{{{1}}}|{{{2}}}]]
9170 |}
9171 !! html
9172 <table>
9173 <tr>
9174 <td>[[{{{1}}}|{{{2}}}]]
9175 </td></tr></table>
9176
9177 !! end
9178
9179 !! test
9180 Magic variable as template parameter
9181 !! wikitext
9182 {{paramtest|param={{SITENAME}}}}
9183 !! html
9184 <p>This is a test template with parameter MediaWiki
9185 </p>
9186 !! end
9187
9188 !! article
9189 Template:linktest
9190 !! text
9191 [[{{{param}}}|link]]
9192 !! endarticle
9193
9194 !! test
9195 Template parameter as link source
9196 !! wikitext
9197 {{linktest|param=Main Page}}
9198 !! html
9199 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
9200 </p>
9201 !! end
9202
9203 !!test
9204 Template-generated attribute string (k='v')
9205 !! wikitext
9206 <span {{attr_str|id|v1}}>bar</span>
9207 !! html
9208 <p><span id="v1">bar</span>
9209 </p>
9210 !!end
9211
9212 !!article
9213 Template:paramtest2
9214 !! text
9215 including another template, {{paramtest|param={{{arg}}}}}
9216 !! endarticle
9217
9218 !! test
9219 Template passing argument to another template
9220 !! wikitext
9221 {{paramtest2|arg='hmm'}}
9222 !! html
9223 <p>including another template, This is a test template with parameter 'hmm'
9224 </p>
9225 !! end
9226
9227 !! article
9228 Template:Linktest2
9229 !! text
9230 Main Page
9231 !! endarticle
9232
9233 !! test
9234 Template as link source
9235 !! wikitext
9236 [[{{linktest2}}]]
9237
9238 [[{{linktest2}}|Main Page]]
9239
9240 [[{{linktest2}}]]Page
9241 !! html
9242 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9243 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9244 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
9245 </p>
9246 !! end
9247
9248
9249 !! article
9250 Template:loop1
9251 !! text
9252 {{loop2}}
9253 !! endarticle
9254
9255 !! article
9256 Template:loop2
9257 !! text
9258 {{loop1}}
9259 !! endarticle
9260
9261 !! test
9262 Template infinite loop
9263 !! wikitext
9264 {{loop1}}
9265 !! html
9266 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
9267 </p>
9268 !! end
9269
9270 !! test
9271 Template from main namespace
9272 !! wikitext
9273 {{:Main Page}}
9274 !! html
9275 <p>blah blah
9276 </p>
9277 !! end
9278
9279 !! article
9280 Template:table
9281 !! text
9282 {|
9283 | 1 || 2
9284 |-
9285 | 3 || 4
9286 |}
9287 !! endarticle
9288
9289 !! test
9290 BUG 529: Template with table, not included at beginning of line
9291 !! wikitext
9292 foo {{table}}
9293 !! html
9294 <p>foo
9295 </p>
9296 <table>
9297 <tr>
9298 <td> 1 </td>
9299 <td> 2
9300 </td></tr>
9301 <tr>
9302 <td> 3 </td>
9303 <td> 4
9304 </td></tr></table>
9305
9306 !! end
9307
9308 !! test
9309 BUG 523: Template shouldn't eat newline (or add an extra one before table)
9310 !! wikitext
9311 foo
9312 {{table}}
9313 !! html
9314 <p>foo
9315 </p>
9316 <table>
9317 <tr>
9318 <td> 1 </td>
9319 <td> 2
9320 </td></tr>
9321 <tr>
9322 <td> 3 </td>
9323 <td> 4
9324 </td></tr></table>
9325
9326 !! end
9327
9328 !! test
9329 BUG 41: Template parameters shown as broken links
9330 !! wikitext
9331 {{{parameter}}}
9332 !! html
9333 <p>{{{parameter}}}
9334 </p>
9335 !! end
9336
9337 !! test
9338 Template with targets containing wikilinks
9339 !! wikitext
9340 {{[[foo]]}}
9341
9342 {{[[{{echo|foo}}]]}}
9343
9344 {{{{echo|[[foo}}]]}}
9345 !! html
9346 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9347 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9348 </p><p>{{[[foo}}]]
9349 </p>
9350 !! end
9351
9352 !! article
9353 Template:MSGNW test
9354 !! text
9355 ''None'' of '''this''' should be
9356 * interpreted
9357 but rather passed unmodified
9358 {{test}}
9359 <gallery>
9360 File:Foobar.jpg
9361 </gallery>
9362 !! endarticle
9363
9364 # hmm, fix this or just deprecate msgnw and document its behavior?
9365 !! test
9366 msgnw keyword
9367 !! wikitext
9368 {{msgnw:MSGNW test}}
9369 !! html
9370 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
9371 &#42; interpreted
9372 &#32;but rather passed unmodified
9373 &#123;&#123;test&#125;&#125;
9374 &#60;gallery&#62;
9375 File:Foobar.jpg
9376 &#60;/gallery&#62;
9377 </p>
9378 !! end
9379
9380 !! test
9381 int keyword
9382 !! wikitext
9383 {{int:youhavenewmessages|lots of money|not!}}
9384 !! html
9385 <p>You have lots of money (not!).
9386 </p>
9387 !! end
9388
9389 !! article
9390 Template:Includes
9391 !! text
9392 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9393 !! endarticle
9394
9395 !! test
9396 <includeonly> and <noinclude> being included
9397 !! wikitext
9398 {{Includes}}
9399 !! html
9400 <p>Foobar
9401 </p>
9402 !! end
9403
9404 !! article
9405 Template:Includes2
9406 !! text
9407 <onlyinclude>Foo</onlyinclude>bar
9408 !! endarticle
9409
9410 !! test
9411 <onlyinclude> being included
9412 !! wikitext
9413 {{Includes2}}
9414 !! html
9415 <p>Foo
9416 </p>
9417 !! end
9418
9419
9420 !! article
9421 Template:Includes3
9422 !! text
9423 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9424 !! endarticle
9425
9426 !! test
9427 <onlyinclude> and <includeonly> being included
9428 !! wikitext
9429 {{Includes3}}
9430 !! html
9431 <p>Foo
9432 </p>
9433 !! end
9434
9435 !! test
9436 <includeonly> and <noinclude> on a page
9437 !! wikitext
9438 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9439 !! html
9440 <p>Foozar
9441 </p>
9442 !! end
9443
9444 !! test
9445 Un-closed <noinclude>
9446 !! wikitext
9447 <noinclude>
9448 !! html
9449 !! end
9450
9451 !! test
9452 <onlyinclude> on a page
9453 !! wikitext
9454 <onlyinclude>Foo</onlyinclude>bar
9455 !! html
9456 <p>Foobar
9457 </p>
9458 !! end
9459
9460 !! test
9461 Un-closed <onlyinclude>
9462 !! wikitext
9463 <onlyinclude>
9464 !! html
9465 !! end
9466
9467 !!test
9468 Self-closed noinclude, includeonly, onlyinclude tags
9469 !! wikitext
9470 <noinclude />
9471 <includeonly />
9472 <onlyinclude />
9473 !! html
9474 <p><br />
9475 </p>
9476 !!end
9477
9478 !!test
9479 Unbalanced includeonly and noinclude tags
9480 !! wikitext
9481 {|
9482 |a</noinclude>
9483 |b</noinclude></noinclude>
9484 |c</noinclude></includeonly>
9485 |d</includeonly></includeonly>
9486 |}
9487 !! html
9488 <table>
9489 <tr>
9490 <td>a
9491 </td>
9492 <td>b
9493 </td>
9494 <td>c&lt;/includeonly&gt;
9495 </td>
9496 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9497 </td></tr></table>
9498
9499 !!end
9500
9501 !! article
9502 Template:Includeonly section
9503 !! text
9504 <includeonly>
9505 ==Includeonly section==
9506 </includeonly>
9507 ==Section T-1==
9508 !!endarticle
9509
9510 !! test
9511 Bug 6563: Edit link generation for section shown by <includeonly>
9512 !! wikitext
9513 {{includeonly section}}
9514 !! html
9515 <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>
9516 <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>
9517
9518 !! end
9519
9520 # Uses same input as the contents of [[Template:Includeonly section]]
9521 !! test
9522 Bug 6563: Section extraction for section shown by <includeonly>
9523 !! options
9524 section=T-2
9525 !! wikitext
9526 <includeonly>
9527 ==Includeonly section==
9528 </includeonly>
9529 ==Section T-2==
9530 !! html
9531 ==Section T-2==
9532 !! end
9533
9534 !! test
9535 Bug 6563: Edit link generation for section suppressed by <includeonly>
9536 !! wikitext
9537 <includeonly>
9538 ==Includeonly section==
9539 </includeonly>
9540 ==Section 1==
9541 !! html
9542 <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>
9543
9544 !! end
9545
9546 !! test
9547 Bug 6563: Section extraction for section suppressed by <includeonly>
9548 !! options
9549 section=1
9550 !! wikitext
9551 <includeonly>
9552 ==Includeonly section==
9553 </includeonly>
9554 ==Section 1==
9555 !! html
9556 ==Section 1==
9557 !! end
9558
9559 !! test
9560 Un-closed <includeonly>
9561 !! wikitext
9562 <includeonly>
9563 !! html
9564 !! end
9565
9566 !! test
9567 Includes and comments at SOL
9568 !! wikitext
9569 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
9570
9571 <noinclude>
9572 some
9573 </noinclude>* stuff
9574 * here
9575
9576 <includeonly>can have stuff</includeonly>=== here ===
9577
9578 !! html/php
9579 <h2><span class="mw-headline" id="hu">hu</span></h2>
9580 <p>some
9581 </p>
9582 <ul><li> stuff</li>
9583 <li> here</li></ul>
9584 <h3><span class="mw-headline" id="here">here</span></h3>
9585
9586 !! html/parsoid
9587 <!-- 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>
9588
9589 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
9590 <p>some</p>
9591 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
9592 <li> here</li></ul>
9593
9594 <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>
9595
9596 !! end
9597
9598 # TODO: test with DOM fragment reuse!
9599 !! test
9600 Parsoid: DOM fragment reuse
9601 !! options
9602 parsoid=wt2wt,wt2html
9603 !! wikitext
9604 a{{echo|b<table></table>c}}d
9605
9606 a{{echo|b
9607 <table></table>
9608 c}}d
9609
9610 {{echo|a
9611
9612 <table></table>
9613
9614 b}}
9615 !! html
9616 <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>
9617
9618 <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">
9619 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
9620 </span><p about="#mwt2">cd</p>
9621
9622 <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">
9623
9624 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
9625
9626 </span><p about="#mwt3">b</p>
9627 !! end
9628
9629 !! test
9630 Parsoid: Merge double tds (bug 50603)
9631 !! options
9632 parsoid
9633 !! wikitext
9634 {|
9635 |{{echo|{{!}} foo}}
9636 |}
9637 !! html
9638 <table><tbody>
9639 <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>
9640 </tbody></table>
9641 !! end
9642
9643 !! test
9644 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9645 !! options
9646 parsoid
9647 !! wikitext
9648 {{echo|<div>}}
9649 {|
9650 |{{echo|{{!}} foo}}
9651 |}
9652 {{echo|</div>}}
9653 !! html
9654 <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}}]}'>
9655 <table><tbody>
9656 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9657 </tbody></table>
9658 </div>
9659 !! end
9660
9661 ###
9662 ### <includeonly> and <noinclude> in attributes
9663 ###
9664 !!test
9665 0. includeonly around the entire attribute
9666 !! wikitext
9667 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9668 !! html
9669 <p><span id="v2">bar</span>
9670 </p>
9671 !!end
9672
9673 !!test
9674 1. includeonly in html attr key
9675 !! wikitext
9676 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9677 !! html
9678 <p><span id="foo">bar</span>
9679 </p>
9680 !!end
9681
9682 !!test
9683 2. includeonly in html attr value
9684 !! wikitext
9685 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9686 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9687 !! html
9688 <p><span id="v1">bar</span>
9689 <span id="v1">bar</span>
9690 </p>
9691 !!end
9692
9693 !!test
9694 3. includeonly in part of an attr value
9695 !! wikitext
9696 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9697 !! html
9698 <p><span style="color:red;">bar</span>
9699 </p>
9700 !!end
9701
9702 !!test
9703 4. includeonly in table attributes
9704 !! wikitext
9705 {|
9706 |- <noinclude>
9707 |-
9708 |a
9709 </noinclude>
9710 |- <includeonly>
9711 |-
9712 |b
9713 </includeonly>
9714 |}
9715 !! html
9716 <table>
9717
9718
9719 <tr>
9720 <td>a
9721 </td></tr>
9722 </table>
9723
9724 !!end
9725
9726 ###
9727 ### Token Stream Patcher tests
9728 ###
9729 ### These tests won't always pass wt2wt and other modes because
9730 ### on serialization, the table will be output on a new line.
9731 ### For now, we are blacklisting them, and using this to test selser.
9732 ###
9733
9734 !!test
9735 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
9736 !!options
9737 parsoid=wt2html,wt2wt
9738 !!wikitext
9739 {{echo|}}{| width = '100%'
9740 |foo
9741 |}
9742 !!html/parsoid
9743 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
9744 <tbody><tr><td>foo</td></tr>
9745 </tbody></table>
9746 !!end
9747
9748 !!test
9749 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
9750 !!options
9751 parsoid=wt2html,wt2wt
9752 !!wikitext
9753 <includeonly>a</includeonly>{| {{{b}}}
9754 |c
9755 |}
9756 !!html/parsoid
9757 <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}}}":""}}'>
9758 <tbody><tr><td>c</td></tr>
9759 </tbody></table>
9760
9761 !!end
9762
9763 ###
9764 ### Testing parsing of templates where a template arg
9765 ### has the same name as the template itself.
9766 ###
9767
9768 !! article
9769 Template:quote
9770 !! text
9771 {{{quote|{{{1}}}}}}
9772 !! endarticle
9773
9774 !!test
9775 Templates: Template Name/Arg clash: 1. Use of positional param
9776 !! wikitext
9777 {{quote|foo}}
9778 !! html
9779 <p>foo
9780 </p>
9781 !!end
9782
9783 !!test
9784 Templates: Template Name/Arg clash: 2. Use of named param
9785 !! wikitext
9786 {{quote|quote=foo}}
9787 !! html
9788 <p>foo
9789 </p>
9790 !!end
9791
9792 !!test
9793 Templates: Template Name/Arg clash: 3. Use of named param with empty input
9794 !! wikitext
9795 {{quote|quote}}
9796 !! html
9797 <p>quote
9798 </p>
9799 !!end
9800
9801 ###
9802 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
9803 ###
9804
9805 !!test
9806 Templates: 1. Simple use
9807 !! wikitext
9808 {{echo|Foo}}
9809 !! html
9810 <p>Foo
9811 </p>
9812 !!end
9813
9814 !!test
9815 Templates: 2. Inside a block tag
9816 !! wikitext
9817 <div>{{echo|Foo}}</div>
9818 <blockquote>{{echo|Foo}}</blockquote>
9819 !! html
9820 <div>Foo</div>
9821 <blockquote>Foo</blockquote>
9822
9823 !! html+tidy
9824 <div>Foo</div>
9825 <blockquote>
9826 <p>Foo</p>
9827 </blockquote>
9828 !!end
9829
9830 !!test
9831 Templates: P-wrapping: 1a. Templates on consecutive lines
9832 !! wikitext
9833 {{echo|Foo}}
9834 {{echo|bar}}
9835 !! html
9836 <p>Foo
9837 bar
9838 </p>
9839 !!end
9840
9841 !!test
9842 Templates: P-wrapping: 1b. Templates on consecutive lines
9843 !! wikitext
9844 Foo
9845
9846 {{echo|bar}}
9847 {{echo|baz}}
9848 !! html
9849 <p>Foo
9850 </p><p>bar
9851 baz
9852 </p>
9853 !!end
9854
9855 !!test
9856 Templates: P-wrapping: 1c. Templates on consecutive lines
9857 !! wikitext
9858 {{echo|Foo}}
9859 {{echo|bar}} <div>baz</div>
9860 !! html
9861 <p>Foo
9862 </p>
9863 bar <div>baz</div>
9864
9865 !! html+tidy
9866 <p>Foo</p>
9867 <p>bar</p>
9868 <div>baz</div>
9869 !! end
9870
9871 !!test
9872 Templates: P-wrapping: 1d. Template preceded by comment-only line
9873 !!options
9874 parsoid
9875 !! wikitext
9876 <!-- foo -->
9877 {{echo|Bar}}
9878 !! html
9879 <!-- foo -->
9880
9881 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
9882 !!end
9883
9884 !!test
9885 Templates: Inline Text: 1. Multiple template uses
9886 !! wikitext
9887 {{echo|Foo}}bar{{echo|baz}}
9888 !! html
9889 <p>Foobarbaz
9890 </p>
9891 !!end
9892
9893 !!test
9894 Templates: Inline Text: 2. Back-to-back template uses
9895 !! wikitext
9896 {{echo|Foo}}{{echo|bar}}
9897 !! html
9898 <p>Foobar
9899 </p>
9900 !!end
9901
9902 !!test
9903 Templates: Block Tags: 1. Multiple template uses
9904 !! wikitext
9905 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
9906 !! html
9907 <div>Foo</div><div>bar</div><div>baz</div>
9908
9909 !!end
9910
9911 !!test
9912 Templates: Block Tags: 2. Back-to-back template uses
9913 !! wikitext
9914 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
9915 !! html
9916 <div>Foo</div><div>bar</div>
9917
9918 !!end
9919
9920 # This is an edge case relating to paragraph wrapping.
9921 !!test
9922 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
9923 !! wikitext
9924 {{echo|a
9925 b</p>}}
9926 !! html/parsoid
9927 <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
9928 b</p>
9929 !!end
9930
9931 !!test
9932 Templates: Links: 1. Simple example
9933 !! wikitext
9934 {{echo|[[Foo|bar]]}}
9935 !! html
9936 <p><a href="/wiki/Foo" title="Foo">bar</a>
9937 </p>
9938 !!end
9939
9940 !!test
9941 Templates: Links: 2. Generation of link href
9942 !! wikitext
9943 [[{{echo|Foo}}|bar]]
9944 !! html
9945 <p><a href="/wiki/Foo" title="Foo">bar</a>
9946 </p>
9947 !!end
9948
9949 !!test
9950 Templates: Links: 3. Generation of part of a link href
9951 !! wikitext
9952 [[Fo{{echo|o}}|bar]]
9953
9954 [[Foo{{echo|bar}}]]
9955
9956 [[Foo{{echo|bar}}baz]]
9957
9958 [[Foo{{echo|bar}}|bar]]
9959
9960 [[:Foo{{echo|bar}}]]
9961
9962 [[:Foo{{echo|bar}}|bar]]
9963 !! html
9964 <p><a href="/wiki/Foo" title="Foo">bar</a>
9965 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9966 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
9967 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9968 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9969 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9970 </p>
9971 !!end
9972
9973 !!test
9974 Templates: Links: 4. Multiple templates generating link href
9975 !! wikitext
9976 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
9977 !! html
9978 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9979 </p>
9980 !!end
9981
9982 !!test
9983 Templates: Links: 5. Generation of link text
9984 !! wikitext
9985 [[Foo|{{echo|bar}}]]
9986 !! html
9987 <p><a href="/wiki/Foo" title="Foo">bar</a>
9988 </p>
9989 !!end
9990
9991 !!test
9992 Templates: Links: 5. Nested templates (only outermost template should be marked)
9993 !! wikitext
9994 {{echo|[[{{echo|Foo}}|bar]]}}
9995 !! html
9996 <p><a href="/wiki/Foo" title="Foo">bar</a>
9997 </p>
9998 !!end
9999
10000 !!test
10001 Templates: HTML Tag: 1. Generation of HTML attr. key
10002 !! wikitext
10003 <div {{echo|style}}="color:red;">foo</div>
10004 !! html
10005 <div style="color:red;">foo</div>
10006
10007 !!end
10008
10009 !!test
10010 Templates: HTML Tag: 2. Generation of HTML attr. value
10011 !! wikitext
10012 <div style={{echo|'color:red;'}}>foo</div>
10013 !! html
10014 <div style="color:red;">foo</div>
10015
10016 !!end
10017
10018 !!test
10019 Templates: HTML Tag: 3. Generation of HTML attr key and value
10020 !! wikitext
10021 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10022 !! html
10023 <div style="color:red;">foo</div>
10024
10025 !!end
10026
10027 !!test
10028 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10029 !! wikitext
10030 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10031 !! html
10032 <div title="This is a long title with just one piece templated">foo</div>
10033
10034 !!end
10035
10036 !!test
10037 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10038 !! wikitext
10039 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10040 !! html
10041 <div title="This is a long title with just one piece templated">foo</div>
10042
10043 !!end
10044
10045 !!test
10046 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10047 !! wikitext
10048 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10049 !! html
10050 <div title="This is a long title with just one piece templated">foo</div>
10051
10052 !!end
10053
10054 !!test
10055 Templates: HTML Tag: 7. Generation of partial attribute key string
10056 !! wikitext
10057 <div st{{echo|yle}}="color:red;">foo</div>
10058 !! html
10059 <div style="color:red;">foo</div>
10060
10061 !!end
10062
10063 !!test
10064 Templates: HTML Tables: 1. Generating start of a HTML table
10065 !! wikitext
10066 {{echo|<table><tr><td>foo</td>}}</tr></table>
10067 !! html
10068 <table><tr><td>foo</td></tr></table>
10069
10070 !!end
10071
10072 !!test
10073 Templates: HTML Tables: 2a. Generating middle of a HTML table
10074 !! wikitext
10075 <table><tr>{{echo|<td>foo</td>}}</tr></table>
10076 !! html
10077 <table><tr><td>foo</td></tr></table>
10078
10079 !!end
10080
10081 !!test
10082 Templates: HTML Tables: 2b. Generating middle of a HTML table
10083 !! wikitext
10084 <table>{{echo|<tr><td>foo</td></tr>}}</table>
10085 !! html
10086 <table><tr><td>foo</td></tr></table>
10087
10088 !!end
10089
10090 !!test
10091 Templates: HTML Tables: 3. Generating end of a HTML table
10092 !! wikitext
10093 <table><tr>{{echo|<td>foo</td></tr></table>}}
10094 !! html
10095 <table><tr><td>foo</td></tr></table>
10096
10097 !!end
10098
10099 !!test
10100 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
10101 !! wikitext
10102 {{echo|<table>}}<tr><td>foo</td></tr></table>
10103 !! html
10104 <table><tr><td>foo</td></tr></table>
10105
10106 !!end
10107
10108 !!test
10109 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
10110 !! wikitext
10111 <table>{{echo|<tr>}}<td>foo</td></tr></table>
10112 !! html
10113 <table><tr><td>foo</td></tr></table>
10114
10115 !!end
10116
10117 !!test
10118 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
10119 !! wikitext
10120 <table><tr>{{echo|<td>}}foo</td></tr></table>
10121 !! html
10122 <table><tr><td>foo</td></tr></table>
10123
10124 !!end
10125
10126 !!test
10127 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
10128 !! wikitext
10129 <table><tr><td>foo{{echo|</td>}}</tr></table>
10130 !! html
10131 <table><tr><td>foo</td></tr></table>
10132
10133 !!end
10134
10135 !!test
10136 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
10137 !! wikitext
10138 <table><tr><td>foo</td>{{echo|</tr>}}</table>
10139 !! html
10140 <table><tr><td>foo</td></tr></table>
10141
10142 !!end
10143
10144 !!test
10145 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
10146 !! wikitext
10147 <table><tr><td>foo</td></tr>{{echo|</table>}}
10148 !! html
10149 <table><tr><td>foo</td></tr></table>
10150
10151 !!end
10152
10153 !!test
10154 Templates: HTML Tables: 5. Proper fostering of categories from inside
10155 !!options
10156 parsoid=wt2html,wt2wt
10157 !! wikitext
10158 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
10159 <!--Two categories (Bug 50330)-->
10160 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
10161 !! html
10162 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
10163 <!--Two categories (Bug 50330)-->
10164 <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>
10165 !!end
10166
10167 !!test
10168 Templates: Wiki Tables: 1a. Fostering of entire template content
10169 !! wikitext
10170 {|
10171 {{echo|a}}
10172 |}
10173 !! html
10174 <table>
10175 a
10176 <tr><td></td></tr></table>
10177
10178 !! html+tidy
10179 <p>a</p>
10180 <table>
10181 <tr>
10182 <td></td>
10183 </tr>
10184 </table>
10185 !! end
10186
10187 !!test
10188 Templates: Wiki Tables: 1b. Fostering of entire template content
10189 !! wikitext
10190 {|
10191 {{echo|<div>}}
10192 foo
10193 {{echo|</div>}}
10194 |}
10195 !! html
10196 <table>
10197 <div>
10198 <p>foo
10199 </p>
10200 </div>
10201 <tr><td></td></tr></table>
10202
10203 !! html+tidy
10204 <div>
10205 <p>foo</p>
10206 </div>
10207 <table>
10208 <tr>
10209 <td></td>
10210 </tr>
10211 </table>
10212 !! end
10213
10214 !!test
10215 Templates: Wiki Tables: 2. Fostering of partial template content
10216 !! wikitext
10217 {|
10218 {{echo|a
10219 <div>b</div>}}
10220 |}
10221 !! html
10222 <table>
10223 a
10224 <div>b</div>
10225 <tr><td></td></tr></table>
10226
10227 !! html+tidy
10228 <p>a</p>
10229 <div>b</div>
10230 <table>
10231 <tr>
10232 <td></td>
10233 </tr>
10234 </table>
10235 !! end
10236
10237 !!test
10238 Templates: Wiki Tables: 3. td-content via multiple templates
10239 !! wikitext
10240 {|
10241 {{echo|{{pipe}}a}}{{echo|b}}
10242 |}
10243 !! html
10244 <table>
10245 <tr>
10246 <td>ab
10247 </td></tr></table>
10248
10249 !!end
10250
10251 !!test
10252 Templates: Wiki Tables: 4. Templated tags, no content
10253 !! wikitext
10254 {{tbl-start}}
10255 {{tbl-end}}
10256 !! html
10257 <table>
10258 <tr><td></td></tr></table>
10259
10260 !!end
10261
10262 !!test
10263 Templates: Wiki Tables: 5. Templated tags, regular td-tags
10264 !! wikitext
10265 {{tbl-start}}
10266 |foo
10267 {{tbl-end}}
10268 !! html
10269 <table>
10270 <tr>
10271 <td>foo
10272 </td></tr></table>
10273
10274 !!end
10275
10276 !!test
10277 Templates: Wiki Tables: 6. Templated tags, templated td-tags
10278 !! wikitext
10279 {{tbl-start}}
10280 {{!}}foo
10281 {{tbl-end}}
10282 !! html
10283 <table>
10284 <tr>
10285 <td>foo
10286 </td></tr></table>
10287
10288 !!end
10289
10290 !!test
10291 Templates: Lists: Multi-line list-items via templates
10292 !! wikitext
10293 *{{echo|a {{nonexistent|
10294 unused}}}}
10295 *{{echo|b {{nonexistent|
10296 unused}}}}
10297 !! html
10298 <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>
10299 <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>
10300
10301 !!end
10302
10303 !!test
10304 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
10305 !! wikitext
10306 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
10307 !! html
10308 <p><i>ab</i>c<i>d</i>e
10309 </p>
10310 !!end
10311
10312 !!test
10313 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
10314 (PHP parser generates misnested html)
10315 !! wikitext
10316 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
10317 !! html/parsoid
10318 <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>
10319 !!end
10320
10321 !!test
10322 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
10323 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
10324 !! options
10325 parsoid=wt2html,wt2wt
10326 !! wikitext
10327 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
10328 !! html
10329 <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>
10330 <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>
10331 <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>
10332 !!end
10333
10334 !!test
10335 Templates: Ugly nesting: 4. Divs opened/closed across templates
10336 !! wikitext
10337 a<div>b{{echo|c</div>d}}e
10338 !! html
10339 a<div>bc</div>de
10340
10341 !! html+tidy
10342 <p>a</p>
10343 <div>bc</div>
10344 <p>de</p>
10345 !! end
10346
10347 !!test
10348 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10349 (Parsoid-centric)
10350 !! options
10351 parsoid
10352 !! wikitext
10353 {|
10354 |{{echo|foo</table>}}
10355 |bar
10356 |}
10357 !! html
10358 <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|}"]}'>
10359
10360 <tbody>
10361 <tr>
10362 <td>foo</td></tr></tbody></table><span about="#mwt1">
10363 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10364 |}</span>
10365 !!end
10366
10367 !!test
10368 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10369 (Parsoid-centric)
10370 !! options
10371 parsoid
10372 !! wikitext
10373 <table>
10374 <tr>
10375 <td>
10376 <table>
10377 <tr>
10378 <td>1. {{echo|foo </table>}}</td>
10379 <td> bar </td>
10380 <td>2. {{echo|baz </table>}}</td>
10381 </tr>
10382 <tr>
10383 <td>abc</td>
10384 </tr>
10385 </table>
10386 </td>
10387 </tr>
10388 <tr>
10389 <td>xyz</td>
10390 </tr>
10391 </table>
10392 !! html
10393 <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>"]}'>
10394 <tbody><tr>
10395 <td>
10396 <table>
10397 <tbody><tr>
10398 <td>1. foo </td></tr></tbody></table></td>
10399 <td> bar </td>
10400 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10401 </span><span about="#mwt2">
10402 </span><span about="#mwt2">
10403 </span><span about="#mwt2">abc</span><span about="#mwt2">
10404 </span><span about="#mwt2">
10405 </span><span about="#mwt2">
10406 </span><span about="#mwt2">
10407 </span><span about="#mwt2">
10408 </span><span about="#mwt2">
10409 </span><span about="#mwt2">xyz</span><span about="#mwt2">
10410 </span><span about="#mwt2">
10411 </span>
10412 !!end
10413
10414 !! test
10415 Templates: Ugly templates: 3. newline-only template parameter
10416 !! wikitext
10417 foo {{echo|
10418 }}
10419 !! html
10420 <p>foo
10421 </p>
10422 !! end
10423
10424 # This looks like a bug: a single newline triggers p/br for some reason.
10425 !! test
10426 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10427 !! wikitext
10428 {{echo|
10429 }}
10430 !! html
10431 <p><br />
10432 </p>
10433 !! end
10434
10435 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10436 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10437 !! test
10438 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10439 !! wikitext
10440 {{echo|<table>}}
10441 {{echo|<div>foo}}
10442 {{echo|</table>}}
10443 !! html/parsoid
10444 <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
10445 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10446 </table>
10447 !! end
10448
10449 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10450 # that are "identical" and generate nesting cycles in the algorithm
10451 !! test
10452 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
10453 !! wikitext
10454 {{echo|<table><tr><td><table>}}
10455 {{echo|<div>}}
10456 {{echo|</div>}}
10457 !! html/parsoid
10458 <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"}'>
10459 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10460 </table></td></tr></tbody></table>
10461 !! end
10462
10463 !!test
10464 Parser Functions: 1. Simple example
10465 !! wikitext
10466 {{uc:foo}}
10467 !! html
10468 <p>FOO
10469 </p>
10470 !!end
10471
10472 !!test
10473 Parser Functions: 2. Nested use (only outermost should be marked up)
10474 !! wikitext
10475 {{uc:{{lc:FOO}}}}
10476 !! html
10477 <p>FOO
10478 </p>
10479 !!end
10480
10481 ###
10482 ### Pre-save transform tests
10483 ###
10484 !! test
10485 pre-save transform: subst:
10486 !! options
10487 PST
10488 !! wikitext
10489 {{subst:test}}
10490 !! html
10491 This is a test template
10492 !! end
10493
10494 !! test
10495 pre-save transform: normal template
10496 !! options
10497 PST
10498 !! wikitext
10499 {{test}}
10500 !! html
10501 {{test}}
10502 !! end
10503
10504 !! test
10505 pre-save transform: nonexistent template
10506 !! options
10507 PST
10508 !! wikitext
10509 {{thistemplatedoesnotexist}}
10510 !! html
10511 {{thistemplatedoesnotexist}}
10512 !! end
10513
10514
10515 !! test
10516 pre-save transform: subst magic variables
10517 !! options
10518 PST
10519 !! wikitext
10520 {{subst:SITENAME}}
10521 !! html
10522 MediaWiki
10523 !! end
10524
10525 # This is bug 89, which I fixed. -- wtm
10526 !! test
10527 pre-save transform: subst: templates with parameters
10528 !! options
10529 pst
10530 !! wikitext
10531 {{subst:paramtest|param="something else"}}
10532 !! html
10533 This is a test template with parameter "something else"
10534 !! end
10535
10536 !! article
10537 Template:nowikitest
10538 !! text
10539 <nowiki>'''not wiki'''</nowiki>
10540 !! endarticle
10541
10542 !! test
10543 pre-save transform: nowiki in subst (bug 1188)
10544 !! options
10545 pst
10546 !! wikitext
10547 {{subst:nowikitest}}
10548 !! html
10549 <nowiki>'''not wiki'''</nowiki>
10550 !! end
10551
10552
10553 !! article
10554 Template:commenttest
10555 !! text
10556 This template has <!-- a comment --> in it.
10557 !! endarticle
10558
10559 !! test
10560 pre-save transform: comment in subst (bug 1936)
10561 !! options
10562 pst
10563 !! wikitext
10564 {{subst:commenttest}}
10565 !! html
10566 This template has <!-- a comment --> in it.
10567 !! end
10568
10569 !! test
10570 pre-save transform: unclosed tag
10571 !! options
10572 pst noxml
10573 !! wikitext
10574 <nowiki>'''not wiki'''
10575 !! html
10576 <nowiki>'''not wiki'''
10577 !! end
10578
10579 !! test
10580 pre-save transform: mixed tag case
10581 !! options
10582 pst noxml
10583 !! wikitext
10584 <NOwiki>'''not wiki'''</noWIKI>
10585 !! html
10586 <NOwiki>'''not wiki'''</noWIKI>
10587 !! end
10588
10589 !! test
10590 pre-save transform: unclosed comment in <nowiki>
10591 !! options
10592 pst noxml
10593 !! wikitext
10594 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10595 !! html
10596 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10597 !!end
10598
10599 # Leading @ in this template definition works around a limitation
10600 # in parsoid's parserTests which otherwise strips the <span> from the
10601 # result (confusing it for a template wrapper)
10602 !! article
10603 Template:dangerous
10604 !!text
10605 @<span onmouseover="alert('crap')">Oh no</span>
10606 !!endarticle
10607
10608 !!test
10609 (confirming safety of fix for subst bug 1936)
10610 !! wikitext
10611 {{Template:dangerous}}
10612 !! html
10613 <p>@<span>Oh no</span>
10614 </p>
10615 !! end
10616
10617 !! test
10618 pre-save transform: comment containing gallery (bug 5024)
10619 !! options
10620 pst
10621 !! wikitext
10622 <!-- <gallery>data</gallery> -->
10623 !! html
10624 <!-- <gallery>data</gallery> -->
10625 !!end
10626
10627 !! test
10628 pre-save transform: comment containing extension
10629 !! options
10630 pst
10631 !! wikitext
10632 <!-- <tag>data</tag> -->
10633 !! html
10634 <!-- <tag>data</tag> -->
10635 !!end
10636
10637 !! test
10638 pre-save transform: comment containing nowiki
10639 !! options
10640 pst
10641 !! wikitext
10642 <!-- <nowiki>data</nowiki> -->
10643 !! html
10644 <!-- <nowiki>data</nowiki> -->
10645 !!end
10646
10647 !! test
10648 pre-save transform: <noinclude> in subst (bug 3298)
10649 !! options
10650 pst
10651 !! wikitext
10652 {{subst:Includes}}
10653 !! html
10654 Foobar
10655 !! end
10656
10657 !! test
10658 pre-save transform: <onlyinclude> in subst (bug 3298)
10659 !! options
10660 pst
10661 !! wikitext
10662 {{subst:Includes2}}
10663 !! html
10664 Foo
10665 !! end
10666
10667 !! article
10668 Template:SubstTest
10669 !!text
10670 {{<includeonly>subst:</includeonly>Includes}}
10671 !! endarticle
10672
10673 !! article
10674 Template:SafeSubstTest
10675 !! text
10676 {{<includeonly>safesubst:</includeonly>Includes}}
10677 !! endarticle
10678
10679 !! test
10680 bug 22297: safesubst: works during PST
10681 !! options
10682 pst
10683 !! wikitext
10684 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
10685 !! html
10686 FoobarFoobar
10687 !! end
10688
10689 !! test
10690 bug 22297: safesubst: works during normal parse
10691 !! wikitext
10692 {{SafeSubstTest}}
10693 !! html
10694 <p>Foobar
10695 </p>
10696 !! end
10697
10698 !! test
10699 subst: does not work during normal parse
10700 !! wikitext
10701 {{SubstTest}}
10702 !! html
10703 <p>{{subst:Includes}}
10704 </p>
10705 !! end
10706
10707 !! test
10708 pre-save transform: context links ("pipe trick")
10709 !! options
10710 pst
10711 !! wikitext
10712 [[Article (context)|]]
10713 [[Bar:Article|]]
10714 [[:Bar:Article|]]
10715 [[Bar:Article (context)|]]
10716 [[:Bar:Article (context)|]]
10717 [[|Article]]
10718 [[|Article (context)]]
10719 [[Bar:X (Y) Z|]]
10720 [[:Bar:X (Y) Z|]]
10721 !! html
10722 [[Article (context)|Article]]
10723 [[Bar:Article|Article]]
10724 [[:Bar:Article|Article]]
10725 [[Bar:Article (context)|Article]]
10726 [[:Bar:Article (context)|Article]]
10727 [[Article]]
10728 [[Article (context)]]
10729 [[Bar:X (Y) Z|X (Y) Z]]
10730 [[:Bar:X (Y) Z|X (Y) Z]]
10731 !! end
10732
10733 !! test
10734 pre-save transform: context links ("pipe trick") with interwiki prefix
10735 !! options
10736 pst
10737 !! wikitext
10738 [[interwiki:Article|]]
10739 [[:interwiki:Article|]]
10740 [[interwiki:Bar:Article|]]
10741 [[:interwiki:Bar:Article|]]
10742 !! html
10743 [[interwiki:Article|Article]]
10744 [[:interwiki:Article|Article]]
10745 [[interwiki:Bar:Article|Bar:Article]]
10746 [[:interwiki:Bar:Article|Bar:Article]]
10747 !! end
10748
10749 !! test
10750 pre-save transform: context links ("pipe trick") with parens in title
10751 !! options
10752 pst title=[[Somearticle (context)]]
10753 !! wikitext
10754 [[|Article]]
10755 !! html
10756 [[Article (context)|Article]]
10757 !! end
10758
10759 !! test
10760 pre-save transform: context links ("pipe trick") with comma in title
10761 !! options
10762 pst title=[[Someplace, Somewhere]]
10763 !! wikitext
10764 [[|Otherplace]]
10765 [[Otherplace, Elsewhere|]]
10766 [[Otherplace, Elsewhere, Anywhere|]]
10767 !! html
10768 [[Otherplace, Somewhere|Otherplace]]
10769 [[Otherplace, Elsewhere|Otherplace]]
10770 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
10771 !! end
10772
10773 !! test
10774 pre-save transform: context links ("pipe trick") with parens and comma
10775 !! options
10776 pst title=[[Someplace (IGNORED), Somewhere]]
10777 !! wikitext
10778 [[|Otherplace]]
10779 [[Otherplace (place), Elsewhere|]]
10780 !! html
10781 [[Otherplace, Somewhere|Otherplace]]
10782 [[Otherplace (place), Elsewhere|Otherplace]]
10783 !! end
10784
10785 !! test
10786 pre-save transform: context links ("pipe trick") with comma and parens
10787 !! options
10788 pst title=[[Who, me? (context)]]
10789 !! wikitext
10790 [[|Yes, you.]]
10791 [[Me, Myself, and I (1937 song)|]]
10792 !! html
10793 [[Yes, you. (context)|Yes, you.]]
10794 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
10795 !! end
10796
10797 !! test
10798 pre-save transform: context links ("pipe trick") with namespace
10799 !! options
10800 pst title=[[Ns:Somearticle]]
10801 !! wikitext
10802 [[|Article]]
10803 !! html
10804 [[Ns:Article|Article]]
10805 !! end
10806
10807 !! test
10808 pre-save transform: context links ("pipe trick") with namespace and parens
10809 !! options
10810 pst title=[[Ns:Somearticle (context)]]
10811 !! wikitext
10812 [[|Article]]
10813 !! html
10814 [[Ns:Article (context)|Article]]
10815 !! end
10816
10817 !! test
10818 pre-save transform: context links ("pipe trick") with namespace and comma
10819 !! options
10820 pst title=[[Ns:Somearticle, Context, Whatever]]
10821 !! wikitext
10822 [[|Article]]
10823 !! html
10824 [[Ns:Article, Context, Whatever|Article]]
10825 !! end
10826
10827 !! test
10828 pre-save transform: context links ("pipe trick") with namespace, comma and parens
10829 !! options
10830 pst title=[[Ns:Somearticle, Context (context)]]
10831 !! wikitext
10832 [[|Article]]
10833 !! html
10834 [[Ns:Article (context)|Article]]
10835 !! end
10836
10837 !! test
10838 pre-save transform: context links ("pipe trick") with namespace, parens and comma
10839 !! options
10840 pst title=[[Ns:Somearticle (IGNORED), Context]]
10841 !! wikitext
10842 [[|Article]]
10843 !! html
10844 [[Ns:Article, Context|Article]]
10845 !! end
10846
10847 !! test
10848 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
10849 !! options
10850 pst
10851 !! wikitext
10852 [[Article(context)|]]
10853 [[Bar:Article(context)|]]
10854 [[:Bar:Article(context)|]]
10855 [[|Article(context)]]
10856 [[Bar:X(Y)Z|]]
10857 [[:Bar:X(Y)Z|]]
10858 !! html
10859 [[Article(context)|Article]]
10860 [[Bar:Article(context)|Article]]
10861 [[:Bar:Article(context)|Article]]
10862 [[Article(context)]]
10863 [[Bar:X(Y)Z|X(Y)Z]]
10864 [[:Bar:X(Y)Z|X(Y)Z]]
10865 !! end
10866
10867 !! test
10868 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
10869 !! options
10870 pst
10871 !! wikitext
10872 [[Article (context)|]]
10873 [[Bar:Article (context)|]]
10874 [[:Bar:Article (context)|]]
10875 [[|Article (context)]]
10876 [[Bar:X (Y) Z|]]
10877 [[:Bar:X (Y) Z|]]
10878 !! html
10879 [[Article (context)|Article]]
10880 [[Bar:Article (context)|Article]]
10881 [[:Bar:Article (context)|Article]]
10882 [[Article (context)]]
10883 [[Bar:X (Y) Z|X (Y) Z]]
10884 [[:Bar:X (Y) Z|X (Y) Z]]
10885 !! end
10886
10887 !! test
10888 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
10889 !! options
10890 pst
10891 !! wikitext
10892 [[Article(context)|]]
10893 [[Bar:Article(context)|]]
10894 [[:Bar:Article(context)|]]
10895 [[|Article(context)]]
10896 [[Bar:X(Y)Z|]]
10897 [[:Bar:X(Y)Z|]]
10898 !! html
10899 [[Article(context)|Article]]
10900 [[Bar:Article(context)|Article]]
10901 [[:Bar:Article(context)|Article]]
10902 [[Article(context)]]
10903 [[Bar:X(Y)Z|X(Y)Z]]
10904 [[:Bar:X(Y)Z|X(Y)Z]]
10905 !! end
10906
10907 !! test
10908 pre-save transform: context links ("pipe trick") with commas (bug 21660)
10909 !! options
10910 pst
10911 !! wikitext
10912 [[Article (context), context|]]
10913 [[Article (context),context|]]
10914 [[Bar:Article (context), context|]]
10915 [[Bar:Article (context),context|]]
10916 [[:Bar:Article (context), context|]]
10917 [[:Bar:Article (context),context|]]
10918 !! html
10919 [[Article (context), context|Article]]
10920 [[Article (context),context|Article]]
10921 [[Bar:Article (context), context|Article]]
10922 [[Bar:Article (context),context|Article]]
10923 [[:Bar:Article (context), context|Article]]
10924 [[:Bar:Article (context),context|Article]]
10925 !! end
10926
10927 !! test
10928 pre-save transform: trim trailing empty lines
10929 !! options
10930 pst
10931 !! wikitext
10932 Empty lines are trimmed
10933
10934
10935
10936
10937 !! html
10938 Empty lines are trimmed
10939 !! end
10940
10941 !! test
10942 pre-save transform: Signature expansion
10943 !! options
10944 pst
10945 !! wikitext
10946 * ~~~
10947 * <noinclude>~~~</noinclude>
10948 * <includeonly>~~~</includeonly>
10949 * <onlyinclude>~~~</onlyinclude>
10950 !! html
10951 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
10952 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
10953 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
10954 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
10955 !! end
10956
10957
10958 !! test
10959 pre-save transform: Signature expansion in nowiki tags (bug 93)
10960 !! options
10961 pst disabled
10962 !! wikitext
10963 Shall not expand:
10964
10965 <nowiki>~~~~</nowiki>
10966
10967 <includeonly><nowiki>~~~~</nowiki></includeonly>
10968
10969 <noinclude><nowiki>~~~~</nowiki></noinclude>
10970
10971 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10972
10973 {{subst:Foo}} shall be converted to FOO
10974
10975 As well as inside noinclude/onlyinclude
10976 <noinclude>{{subst:Foo}}</noinclude>
10977 <onlyinclude>{{subst:Foo}}</onlyinclude>
10978
10979 But not inside includeonly
10980 <includeonly>{{subst:Foo}}</includeonly>
10981 !! html
10982 Shall not expand:
10983
10984 <nowiki>~~~~</nowiki>
10985
10986 <includeonly><nowiki>~~~~</nowiki></includeonly>
10987
10988 <noinclude><nowiki>~~~~</nowiki></noinclude>
10989
10990 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10991
10992 FOO shall be converted to FOO
10993
10994 As well as inside noinclude/onlyinclude
10995 <noinclude>FOO</noinclude>
10996 <onlyinclude>FOO</onlyinclude>
10997
10998 But not inside includeonly
10999 <includeonly>{{subst:Foo}}</includeonly>
11000 !! end
11001
11002 !! test
11003 Parsoid: Recognize nowiki with trailing space in tags
11004 !! options
11005 parsoid=wt2html
11006 !! wikitext
11007 <nowiki ><div>[[foo]]</nowiki >
11008
11009 a<nowiki / >b
11010
11011 c<nowiki />d
11012
11013 e<nowiki/ >f
11014 !! html
11015 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11016 <p>ab</p>
11017 <p>cd</p>
11018 <p>ef</p>
11019 !! end
11020
11021 !! test
11022 Parsoid: Recognize nowiki with odd capitalization
11023 !! options
11024 parsoid=wt2html
11025 !! wikitext
11026 <noWikI ><div>[[foo]]</Nowiki >
11027 !! html
11028 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11029 !! end
11030
11031
11032 !! test
11033 Parsoid: Escape nowiki with trailing space in tags
11034 !! options
11035 parsoid=html2wt
11036 !! wikitext
11037 &lt;nowiki &gt; foo &lt;/nowiki &gt;
11038
11039 a&lt;nowiki /&gt;b
11040
11041 c&lt;nowiki/ &gt;d
11042 !! html
11043 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
11044 <p>a&lt;nowiki /&gt;b</p>
11045 <p>c&lt;nowiki/ &gt;d</p>
11046 !! end
11047
11048 !! test
11049 Parsoid: Escape weird noWikI capitalizations
11050 !! options
11051 parsoid=html2wt
11052 !! wikitext
11053 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
11054 !! html
11055 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
11056 !! end
11057
11058 ###
11059 ### Message transform tests
11060 ###
11061 !! test
11062 message transform: magic variables
11063 !! options
11064 msg
11065 !! wikitext
11066 {{SITENAME}}
11067 !! html
11068 MediaWiki
11069 !! end
11070
11071 !! test
11072 message transform: should not transform wiki markup
11073 !! options
11074 msg
11075 !! wikitext
11076 ''test''
11077 !! html
11078 ''test''
11079 !! end
11080
11081 !! test
11082 message transform: <noinclude> in transcluded template (bug 4926)
11083 !! options
11084 msg
11085 !! wikitext
11086 {{Includes}}
11087 !! html
11088 Foobar
11089 !! end
11090
11091 !! test
11092 message transform: <onlyinclude> in transcluded template (bug 4926)
11093 !! options
11094 msg
11095 !! wikitext
11096 {{Includes2}}
11097 !! html
11098 Foo
11099 !! end
11100
11101 !! test
11102 {{#special:}} page name, known
11103 !! options
11104 msg
11105 !! wikitext
11106 {{#special:Recentchanges}}
11107 !! html
11108 Special:RecentChanges
11109 !! end
11110
11111 !! test
11112 {{#special:}} page name with subpage, known
11113 !! options
11114 msg
11115 !! wikitext
11116 {{#special:Recentchanges/param}}
11117 !! html
11118 Special:RecentChanges/param
11119 !! end
11120
11121 !! test
11122 {{#special:}} page name, unknown
11123 !! options
11124 msg
11125 !! wikitext
11126 {{#special:foobar nonexistent}}
11127 !! html
11128 Special:Foobar nonexistent
11129 !! end
11130
11131 !! test
11132 {{#speciale:}} page name, known
11133 !! options
11134 msg
11135 !! wikitext
11136 {{#speciale:Recentchanges}}
11137 !! html
11138 Special:RecentChanges
11139 !! end
11140
11141 !! test
11142 {{#speciale:}} page name with subpage, known
11143 !! options
11144 msg
11145 !! wikitext
11146 {{#speciale:Recentchanges/param}}
11147 !! html
11148 Special:RecentChanges/param
11149 !! end
11150
11151 !! test
11152 {{#speciale:}} page name, unknown
11153 !! options
11154 msg
11155 !! wikitext
11156 {{#speciale:foobar nonexistent}}
11157 !! html
11158 Special:Foobar_nonexistent
11159 !! end
11160
11161 ###
11162 ### Images
11163 ###
11164 ### For Parsoid-specific tests, see
11165 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11166
11167 !! test
11168 Simple image
11169 !! options
11170 parsoid=wt2html,wt2wt,html2html
11171 !! wikitext
11172 [[Image:foobar.jpg]]
11173 !! html/php
11174 <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>
11175 </p>
11176 !! html/parsoid
11177 <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>
11178 !! end
11179
11180 !! test
11181 Simple image (using File: namespace, now canonical)
11182 !! wikitext
11183 [[File:Foobar.jpg]]
11184 !! html/php
11185 <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>
11186 </p>
11187 !! html/parsoid
11188 <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>
11189 !! end
11190
11191 !! test
11192 Right-aligned image
11193 !! wikitext
11194 [[File:Foobar.jpg|right]]
11195 !! html/php
11196 <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>
11197
11198 !! html/parsoid
11199 <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>
11200 !! end
11201
11202 !! test
11203 Image with caption
11204 !! wikitext
11205 [[File:Foobar.jpg|right|Caption text]]
11206 !! html/php
11207 <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>
11208
11209 !! html/parsoid
11210 <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>
11211 !! end
11212
11213 !! test
11214 Image with caption, bug 53312 #1
11215 !! wikitext
11216 [[File:Foobar.jpg|right|Caption page stuff]]
11217 !! html/php
11218 <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>
11219
11220 !! html/parsoid
11221 <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>
11222 !! end
11223
11224 !! test
11225 Image with caption, bug 53312 #2
11226 !! wikitext
11227 [[File:Foobar.jpg|right|Caption page=]]
11228 !! html/php
11229 <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>
11230
11231 !! html/parsoid
11232 <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>
11233 !! end
11234
11235 !! test
11236 Image with caption, bug 53312 #3
11237 !! wikitext
11238 [[File:Foobar.jpg|right|Caption page=stuff]]
11239 !! html/php
11240 <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>
11241
11242 !! html/parsoid
11243 <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>
11244 !! end
11245
11246 !! test
11247 Allow empty links in image captions (Bug 60753)
11248 !! options
11249 thumbsize=220
11250 !! wikitext
11251 [[File:Foobar.jpg|thumb|Caption [[Link1]]
11252 [[]]
11253 [[Link2]]
11254 ]]
11255 !! html/php
11256 <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>
11257
11258 !! html/parsoid
11259 <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>
11260 [[]]
11261 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
11262 </figcaption></figure>
11263 !! end
11264
11265 !! test
11266 Link with empty target
11267 !! wikitext
11268 [[]]
11269 !! html
11270 <p>[[]]
11271 </p>
11272 !! end
11273
11274 !! test
11275 Image with empty attribute
11276 !! options
11277 parsoid=wt2html,wt2wt,html2html
11278 !! wikitext
11279 [[File:Foobar.jpg|right||Caption text]]
11280 !! html/php
11281 <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>
11282
11283 !! html/parsoid
11284 <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>
11285 !! end
11286
11287 !! test
11288 1. Block image with individual attributes from templates
11289 !! wikitext
11290 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
11291 !! html/php
11292 <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>
11293
11294 !! html/parsoid
11295 <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>
11296 !! end
11297
11298 !! test
11299 2. Block Image with individual attributes from templates
11300 !! wikitext
11301 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
11302 !! html/php
11303 <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>
11304
11305 !! html/parsoid
11306 <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>
11307 !! end
11308
11309 !! test
11310 3. Inline image with individual attributes from templates
11311 !! wikitext
11312 [[File:Foobar.jpg|{{echo|50px}}]]
11313 !! html/php
11314 <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>
11315 </p>
11316 !! html/parsoid
11317 <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>
11318 !! end
11319
11320 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
11321 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
11322 !! test
11323 Image with multiple attributes from the same template
11324 !! wikitext
11325 [[File:Foobar.jpg|{{image_attribs}}]]
11326 !! html/php
11327 <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>
11328
11329 !! html/parsoid
11330 <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>
11331 !! end
11332
11333 !! test
11334 Image with link tails
11335 !! options
11336 thumbsize=220
11337 !! wikitext
11338 123[[File:Foobar.jpg]]456
11339 123[[File:Foobar.jpg|right]]456
11340 123[[File:Foobar.jpg|thumb]]456
11341 !! html/php
11342 <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
11343 </p>
11344 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
11345 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
11346
11347 !! html/php+tidy
11348 <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>
11349 <p>123</p>
11350 <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>
11351 <p>456 123</p>
11352 <div class="thumb tright">
11353 <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>
11354 <div class="thumbcaption">
11355 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11356 </div>
11357 </div>
11358 </div>
11359 <p>456</p>
11360 !! html/parsoid
11361 <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>
11362 <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>
11363 <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>
11364 !! end
11365
11366 !! test
11367 Image with multiple captions -- only last one is accepted
11368 !! wikitext
11369 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11370 !! html/php
11371 <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>
11372
11373 !! html/parsoid
11374 <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>
11375 !! end
11376
11377 !! test
11378 Image with multiple widths -- use last
11379 !! wikitext
11380 [[File:Foobar.jpg|200px|300px|caption]]
11381 !! html/php
11382 <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>
11383 </p>
11384 !! html/parsoid
11385 <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>
11386 !! end
11387
11388 !! test
11389 Image with multiple alignments -- use first (bug 48664)
11390 !! options
11391 thumbsize=220
11392 !! wikitext
11393 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11394
11395 [[File:Foobar.jpg|middle|text-top|caption]]
11396 !! html/php
11397 <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>
11398 <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>
11399 </p>
11400 !! html/parsoid
11401 <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>
11402 <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>
11403 !! end
11404
11405 !! test
11406 Image with width attribute at different positions
11407 !! wikitext
11408 [[File:Foobar.jpg|200px|right|Caption]]
11409 [[File:Foobar.jpg|right|200px|Caption]]
11410 [[File:Foobar.jpg|right|Caption|200px]]
11411 !! html/php
11412 <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>
11413 <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>
11414 <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>
11415
11416 !! html/parsoid
11417 <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>
11418 <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>
11419 <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>
11420 !! end
11421
11422 # a sad bit of backward-compatibility
11423 !! test
11424 Image with size specified with pxpx (bug 13500, 51628)
11425 !! options
11426 parsoid=wt2html,wt2wt,html2html
11427 !! wikitext
11428 [[File:Foobar.jpg|20pxpx]]
11429 [[File:Foobar.jpg|200x20pxpx]]
11430 !! html/php
11431 <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>
11432 <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>
11433 </p>
11434 !! html/parsoid
11435 <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>
11436 !! end
11437
11438 !! test
11439 Image with link parameter, wiki target
11440 !! wikitext
11441 [[File:Foobar.jpg|link=Main Page]]
11442 !! html/php
11443 <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>
11444 </p>
11445 !! html/parsoid
11446 <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>
11447 !! end
11448
11449 # parsoid bug 49293 (part 1)
11450 !! test
11451 Image with link parameter, URL target
11452 !! wikitext
11453 [[File:Foobar.jpg|link=http://example.com/]]
11454 !! html/php
11455 <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>
11456 </p>
11457 !! html/parsoid
11458 <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>
11459 !! end
11460
11461 # parsoid bug 49293 (part 2)
11462 !! test
11463 Image with link parameter, protocol-less URL target
11464 !! wikitext
11465 [[File:Foobar.jpg|link=//example.com/]]
11466 !! html/php
11467 <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>
11468 </p>
11469 !! html/parsoid
11470 <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>
11471 !! end
11472
11473 !! test
11474 Image with link parameter, wgExternalLinkTarget
11475 !! wikitext
11476 [[Image:foobar.jpg|link=http://example.com/]]
11477 !! config
11478 wgExternalLinkTarget='foobar'
11479 !! html
11480 <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>
11481 </p>
11482 !! end
11483
11484 !! test
11485 Image with link parameter, wgNoFollowLinks set to false
11486 !! wikitext
11487 [[Image:foobar.jpg|link=http://example.com/]]
11488 !! config
11489 wgNoFollowLinks=false
11490 !! html
11491 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11492 </p>
11493 !! end
11494
11495 !! test
11496 Image with link parameter, wgNoFollowDomainExceptions
11497 !! wikitext
11498 [[Image:foobar.jpg|link=http://example.com/]]
11499 !! config
11500 wgNoFollowDomainExceptions='example.com'
11501 !! html
11502 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11503 </p>
11504 !! end
11505
11506 !! test
11507 Image with link parameter, wgExternalLinkTarget, unnamed parameter
11508 !! wikitext
11509 [[Image:foobar.jpg|link=http://example.com/|Title]]
11510 !! config
11511 wgExternalLinkTarget='foobar'
11512 !! html
11513 <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>
11514 </p>
11515 !! end
11516
11517 !! test
11518 Image with empty link parameter
11519 !! wikitext
11520 [[File:Foobar.jpg|link=]]
11521 !! html/php
11522 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
11523 </p>
11524 !! html/parsoid
11525 <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>
11526 !! end
11527
11528 !! test
11529 Image with link parameter (wiki target) and unnamed parameter
11530 !! wikitext
11531 [[File:Foobar.jpg|link=Main_Page|Title]]
11532 !! html/php
11533 <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>
11534 </p>
11535 !! html/parsoid
11536 <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>
11537 !! end
11538
11539 !! test
11540 Image with link parameter (URL target) and unnamed parameter
11541 !! wikitext
11542 [[File:Foobar.jpg|link=http://example.com/|Title]]
11543 !! html/php
11544 <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>
11545 </p>
11546 !! html/parsoid
11547 <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>
11548 !! end
11549
11550 !! test
11551 Thumbnail image with link parameter
11552 !! options
11553 thumbsize=220
11554 parsoid=wt2html,wt2wt,html2html
11555 !! wikitext
11556 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
11557 !! html/php
11558 <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>
11559
11560 !! html/parsoid
11561 <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>
11562 !! end
11563
11564 !! test
11565 Manually-specified thumbnail image
11566 !! options
11567 thumbsize=220
11568 !! wikitext
11569 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
11570 !! html/php
11571 <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>
11572
11573 !! html/parsoid
11574 <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>
11575 !! end
11576
11577 !! test
11578 Manually-specified thumbnail image with explicit link to wiki page
11579 !! options
11580 thumbsize=220
11581 parsoid=wt2html,wt2wt,html2html
11582 !! wikitext
11583 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
11584 !! html/php
11585 <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>
11586
11587 !! html/parsoid
11588 <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>
11589 !! end
11590
11591 !! test
11592 Manually-specified thumbnail image with explicit link to url
11593 !! options
11594 thumbsize=220
11595 parsoid=wt2html,wt2wt,html2html
11596 !! wikitext
11597 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
11598 !! html/php
11599 <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>
11600
11601 !! html/parsoid
11602 <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>
11603 !! end
11604
11605 !! test
11606 Manually-specified thumbnail image with explicit no link
11607 !! options
11608 thumbsize=220
11609 parsoid=wt2html,wt2wt,html2html
11610 !! wikitext
11611 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
11612 !! html/php
11613 <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>
11614
11615 !! html/parsoid
11616 <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>
11617 !! end
11618
11619 !! test
11620 Manually-specified thumbnail image with explicit link and alt text
11621 !! options
11622 thumbsize=220
11623 parsoid=wt2html,wt2wt,html2html
11624 !! wikitext
11625 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|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="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>
11628
11629 !! html/parsoid
11630 <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>
11631 !! end
11632
11633 !! test
11634 Image with frame and link
11635 !! options
11636 parsoid=wt2html,wt2wt,html2html
11637 !! wikitext
11638 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
11639 !! html/php
11640 <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>
11641
11642 !! html/parsoid
11643 <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>
11644 !! end
11645
11646 !! test
11647 Image with frame and link and explicit alt
11648 !! options
11649 parsoid=wt2html,wt2wt,html2html
11650 !! wikitext
11651 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
11652 !! html/php
11653 <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>
11654
11655 !! html/parsoid
11656 <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>
11657 !! end
11658
11659 !! test
11660 Image with wiki markup in implicit alt
11661 !! options
11662 parsoid=wt2html,wt2wt,html2html
11663 !! wikitext
11664 [[Image:Foobar.jpg|testing '''bold''' in alt]]
11665
11666 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
11667 !! html/php
11668 <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>
11669 </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>
11670 </p>
11671 !! html/parsoid
11672 <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>
11673 <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>
11674 !! end
11675
11676 ###################
11677 # Conflicting image format options.
11678 # First option specified should 'win'.
11679 # All three cases in each test should be identical.
11680
11681 !! test
11682 Image with 'frameless' first.
11683 !! options
11684 parsoid=wt2html,wt2wt,html2html
11685 !! wikitext
11686 [[File:Foobar.jpg|frameless|caption]]
11687
11688 [[File:Foobar.jpg|frameless|frame|caption]]
11689
11690 [[File:Foobar.jpg|frameless|thumb|caption]]
11691 !! html/php
11692 <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>
11693 </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>
11694 </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>
11695 </p>
11696 !! html/parsoid
11697 <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>
11698 <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>
11699 <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>
11700 !! end
11701
11702 !! test
11703 Image with 'frame' first.
11704 !! options
11705 parsoid=wt2html,wt2wt,html2html
11706 !! wikitext
11707 [[File:Foobar.jpg|frame|caption]]
11708 [[File:Foobar.jpg|frame|frameless|caption]]
11709 [[File:Foobar.jpg|frame|thumb|caption]]
11710 !! html/php
11711 <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>
11712 <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>
11713 <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>
11714
11715 !! html/parsoid
11716 <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>
11717 <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>
11718 <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>
11719 !! end
11720
11721 !! test
11722 Image with 'thumb' first.
11723 !! options
11724 parsoid=wt2html,wt2wt,html2html
11725 !! wikitext
11726 [[File:Foobar.jpg|thumb|caption]]
11727 [[File:Foobar.jpg|thumb|frameless|caption]]
11728 [[File:Foobar.jpg|thumb|frame|caption]]
11729 !! html/php
11730 <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>
11731 <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>
11732 <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>
11733
11734 !! html/parsoid
11735 <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>
11736 <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>
11737 <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>
11738 !! end
11739
11740 ###################
11741 # Image sizing.
11742 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
11743 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
11744 # Foobar has actual size of 1941x220
11745 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
11746 # a scalable format.
11747 # 2. Framed images always ignore size options; always render at default size.
11748 # 3. "Unspecified format" and border are the only types which can be
11749 # enlarged.
11750
11751 !! test
11752 Image: "unspecified format" and border enlarge
11753 !! options
11754 parsoid=wt2html,wt2wt,html2html
11755 !! wikitext
11756 [[File:Foobar.jpg|2000px]]
11757
11758 [[File:Foobar.jpg|border|2000px]]
11759 !! html/php
11760 <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>
11761 </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>
11762 </p>
11763 !! html/parsoid
11764 <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>
11765 <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>
11766 !! end
11767
11768 !! test
11769 Image: "unspecified format" and border reduce
11770 !! options
11771 parsoid=wt2html,wt2wt,html2html
11772 !! wikitext
11773 [[File:Foobar.jpg|1000px]]
11774
11775 [[File:Foobar.jpg|border|1000px]]
11776 !! html/php
11777 <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>
11778 </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>
11779 </p>
11780 !! html/parsoid
11781 <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>
11782 <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>
11783 !! end
11784
11785 !! test
11786 Image: thumbs reduce
11787 !! options
11788 parsoid=wt2html,wt2wt,html2html
11789 !! wikitext
11790 [[File:Foobar.jpg|thumb|50px]]
11791 !! html/php
11792 <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>
11793
11794 !! html/parsoid
11795 <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>
11796 !! end
11797
11798 !! test
11799 Image: bitmap thumbs can't be enlarged past original size, but vector can.
11800 !! options
11801 parsoid=wt2html,wt2wt,html2html
11802 !! wikitext
11803 [[File:Foobar.jpg|thumb|2000px]]
11804
11805 [[File:Foobar.svg|thumb|2000px]]
11806 !! html/php
11807 <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>
11808 <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>
11809
11810 !! html/parsoid
11811 <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>
11812 <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>
11813 !! end
11814
11815 !! test
11816 Image: frameless can reduce in size
11817 !! options
11818 parsoid=wt2html,wt2wt,html2html
11819 !! wikitext
11820 [[File:Foobar.jpg|frameless|50px]]
11821 !! html/php
11822 <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>
11823 </p>
11824 !! html/parsoid
11825 <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>
11826 !! end
11827
11828 !! test
11829 Image: bitmap frameless can't be enlarged past original size, but vector can
11830 !! options
11831 parsoid=wt2html,wt2wt,html2html
11832 !! wikitext
11833 [[File:Foobar.jpg|frameless|2000px]]
11834
11835 [[File:Foobar.svg|frameless|2000px]]
11836 !! html/php
11837 <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>
11838 </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>
11839 </p>
11840 !! html/parsoid
11841 <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>
11842 <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>
11843 !! end
11844
11845 !! test
11846 Image: framed images are always unscaled.
11847 !! options
11848 parsoid=wt2html,wt2wt,html2html
11849 !! wikitext
11850 [[File:Foobar.jpg|frame]]
11851
11852 [[File:Foobar.jpg|frame|50px]]
11853
11854 [[File:Foobar.jpg|frame|50x50px]]
11855
11856 [[File:Foobar.jpg|frame|2000px]]
11857 !! html/php
11858 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
11859 <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>
11860 <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>
11861 <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>
11862
11863 !! html/parsoid
11864 <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>
11865 <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>
11866 <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>
11867 <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>
11868 !! end
11869
11870 ###################
11871
11872 !! test
11873 Link to image page- image page normally doesn't exists, hence edit link
11874 Add test with existing image page
11875 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
11876 !! wikitext
11877 [[:Image:test]]
11878 !! html
11879 <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>
11880 </p>
11881 !! end
11882
11883 !! test
11884 bug 18784 Link to non-existent image page with caption should use caption as link text
11885 !! wikitext
11886 [[:Image:test|caption]]
11887 !! html
11888 <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>
11889 </p>
11890 !! end
11891
11892 !! test
11893 Frameless image caption with a free URL
11894 !! wikitext
11895 [[File:Foobar.jpg|http://example.com]]
11896 !! html/php
11897 <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>
11898 </p>
11899 !! html/parsoid
11900 <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>
11901 !! end
11902
11903 !! test
11904 Thumbnail image caption with a free URL
11905 !! options
11906 thumbsize=220
11907 !! wikitext
11908 [[File:Foobar.jpg|thumb|http://example.com]]
11909 !! html/php
11910 <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>
11911
11912 !! html/parsoid
11913 <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>
11914 !! end
11915
11916 !! test
11917 Thumbnail image caption with a free URL and explicit alt
11918 !! options
11919 thumbsize=220
11920 parsoid=wt2html,wt2wt,html2html
11921 !! wikitext
11922 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
11923 !! html/php
11924 <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>
11925
11926 !! html/parsoid
11927 <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>
11928 !! end
11929
11930 !! test
11931 SVG thumbnails with no language set
11932 !! options
11933 !! wikitext
11934 [[File:Foobar.svg|thumb|caption]]
11935 !! html/php
11936 <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>
11937
11938 !! html/parsoid
11939 <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>
11940 !! end
11941
11942 !! test
11943 SVG thumbnails with language de
11944 !! options
11945 parsoid=wt2html,wt2wt,html2html
11946 !! wikitext
11947 [[File:Foobar.svg|thumb|caption|lang=de]]
11948 !! html/php
11949 <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>
11950
11951 !! html/parsoid
11952 <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>
11953 !! end
11954
11955 !! test
11956 SVG thumbnails with invalid language code
11957 !! options
11958 parsoid=wt2html,wt2wt,html2html
11959 !! wikitext
11960 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
11961 !! html/php
11962 <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>
11963
11964 !! html/parsoid
11965 <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>
11966 !! end
11967
11968 !! test
11969 BUG 1887: A ISBN with a thumbnail
11970 !! wikitext
11971 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
11972 !! html/php
11973 <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>
11974
11975 !! html/parsoid
11976 <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>
11977 !! end
11978
11979 !! test
11980 BUG 1887: A RFC with a thumbnail
11981 !! wikitext
11982 [[File:Foobar.jpg|thumb|This is RFC 12354]]
11983 !! html/php
11984 <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>
11985
11986 !! html/parsoid
11987 <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>
11988 !! end
11989
11990 !! test
11991 BUG 1887: A mailto link with a thumbnail
11992 !! wikitext
11993 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
11994 !! html/php
11995 <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>
11996
11997 !! html/parsoid
11998 <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>
11999 !! end
12000
12001 # Pending resolution to bug 368
12002 !! test
12003 BUG 648: Frameless image caption with a link
12004 !! wikitext
12005 [[File:Foobar.jpg|text with a [[link]] in it]]
12006 !! html/php
12007 <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>
12008 </p>
12009 !! html/parsoid
12010 <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>
12011 !! end
12012
12013 !! test
12014 BUG 648: Frameless image caption with a link (suffix)
12015 !! wikitext
12016 [[File:Foobar.jpg|text with a [[link]]foo in it]]
12017 !! html/php
12018 <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>
12019 </p>
12020 !! html/parsoid
12021 <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>
12022 !! end
12023
12024 !! test
12025 BUG 648: Frameless image caption with an interwiki link
12026 !! wikitext
12027 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
12028 !! html/php
12029 <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>
12030 </p>
12031 !! html/parsoid
12032 <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>
12033 !! end
12034
12035 !! test
12036 BUG 648: Frameless image caption with a piped interwiki link
12037 !! wikitext
12038 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
12039 !! html/php
12040 <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>
12041 </p>
12042 !! html/parsoid
12043 <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>
12044 !! end
12045
12046 !! test
12047 Escape HTML special chars in image alt text
12048 !! wikitext
12049 [[File:Foobar.jpg|& < > "]]
12050 !! html/php
12051 <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>
12052 </p>
12053 !! html/parsoid
12054 <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>
12055 !! end
12056
12057 !! test
12058 BUG 499: Alt text should have &#1234;, not &amp;1234;
12059 !! wikitext
12060 [[File:Foobar.jpg|&#9792;]]
12061 !! html/php
12062 <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>
12063 </p>
12064 !! html/parsoid
12065 <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>
12066 !! end
12067
12068 !! test
12069 Broken image caption with link
12070 !! options
12071 parsoid=wt2html,wt2wt,html2html
12072 !! wikitext
12073 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
12074 !! html/php
12075 <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.
12076 </p>
12077 !! html/parsoid
12078 <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>
12079 !! end
12080
12081 !! test
12082 Image caption containing another image
12083 !! wikitext
12084 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
12085 !! html/php
12086 <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>
12087
12088 !! html/parsoid
12089 <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>
12090 !! end
12091
12092 !! test
12093 Image: caption containing a newline
12094 !! wikitext
12095 [[File:Foobar.jpg|This
12096 *is some text]]
12097 !! html/php
12098 <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>
12099 </p>
12100 !! html/parsoid
12101 <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>
12102 !!end
12103
12104 !!test
12105 Image: caption containing leading space
12106 (The leading space should not trigger nowiki escaping in wt2wt mode)
12107 !! wikitext
12108 [[File:Foobar.jpg|thumb| bar]]
12109 !! html/php
12110 <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>
12111
12112 !! html/parsoid
12113 <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>
12114 !!end
12115
12116 !! test
12117 Image: caption containing a table
12118 !! options
12119 parsoid=wt2html,wt2wt,html2html
12120 !! wikitext
12121 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
12122 {|
12123 ! Foo !! Bar
12124 |-
12125 | Foo1 || Bar1
12126 |}
12127 and some more text.]]
12128 !! html/php
12129 <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>
12130
12131 !! html/parsoid
12132 <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
12133 <table>
12134 <tbody>
12135 <tr><th>Foo </th><th>Bar</th></tr>
12136 <tr>
12137 <td>Foo1 </td>
12138 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
12139 !! end
12140
12141 !! test
12142 Bug 3090: External links other than http: in image captions
12143 !! wikitext
12144 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
12145 !! html/php
12146 <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>
12147
12148 !! html/parsoid
12149 <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>
12150 !! end
12151
12152 !! test
12153 Custom class
12154 !! options
12155 parsoid=wt2html,wt2wt,html2html
12156 !! wikitext
12157 [[Image:foobar.jpg|a|class=b]]
12158 !! html/php
12159 <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>
12160 </p>
12161 !! html/parsoid
12162 <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>
12163 !! end
12164
12165 !! test
12166 Localized image handling (1).
12167 !! options
12168 parsoid=wt2html,wt2wt,html2html
12169 language=es
12170 !! wikitext
12171 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
12172 !! html/php
12173 <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>
12174
12175 !! html/parsoid
12176 <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>
12177 !! end
12178
12179 !! test
12180 Localized image handling (2).
12181 !! options
12182 thumbsize=220
12183 parsoid=wt2html,wt2wt,html2html
12184 language=es
12185 !! wikitext
12186 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
12187 !! html/php
12188 <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>
12189
12190 !! html/parsoid
12191 <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>
12192 !! end
12193
12194 !! test
12195 "border", "frameless" and "class" attributes on an image.
12196 !! options
12197 thumbsize=220
12198 parsoid=wt2html,wt2wt,html2html
12199 !! wikitext
12200 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
12201 !! html/php
12202 <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>
12203 </p>
12204 !! html/parsoid
12205 <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>
12206 !! end
12207
12208 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
12209 !! test
12210 Invalid image attributes (bug 62500)
12211 !! options
12212 thumbsize=220
12213 parsoid=wt2html,wt2wt,html2html
12214 !! wikitext
12215 [[File:Foobar.jpg|thumb|float|left|caption]]
12216
12217 [[File:Foobar.jpg|thumb|righ|caption]]
12218
12219 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
12220 !! html/php
12221 <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>
12222 <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>
12223 <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>
12224
12225 !! html/parsoid
12226 <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>
12227 <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>
12228 <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>
12229 !! end
12230
12231 !! article
12232 File:Barfoo.jpg
12233 !! text
12234 #REDIRECT [[File:Barfoo.jpg]]
12235 !! endarticle
12236
12237 # FIXME: Parsoid should run this test -- but we'd need to teach the
12238 # mockAPI about the redirected Barfoo.jpg image.
12239 !! test
12240 Redirected image
12241 !! wikitext
12242 [[Image:Barfoo.jpg]]
12243 !! html/php
12244 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
12245 </p>
12246 !! end
12247
12248 !! test
12249 Missing image with uploads disabled
12250 !! options
12251 wgEnableUploads=0
12252 !! wikitext
12253 [[File:Foobaz.jpg]]
12254 !! html/php
12255 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
12256 </p>
12257 !! html/parsoid
12258 <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>
12259 !! end
12260
12261 # Parsoid-specific testing for images
12262 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12263 # Currently imperfect due to a flaw in the Parsoid testrunner
12264 # Work in progress
12265 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
12266 # image tests.
12267
12268 !! test
12269 Parsoid-specific image handling - simple image with size and middle alignment
12270 !! wikitext
12271 [[File:Foobar.jpg|middle|50px]]
12272 !! html/parsoid
12273 <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>
12274 !! end
12275
12276 !! test
12277 Parsoid-specific image handling - simple image with size, middle alignment,
12278 non-standard namespace alias
12279 !! options
12280 parsoid=wt2wt,wt2html,html2html
12281 !! wikitext
12282 [[Image:Foobar.jpg|middle|50px]]
12283 !! html/parsoid
12284 <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>
12285 !! end
12286
12287 !! test
12288 Parsoid-specific image handling - simple image with size and middle alignment
12289 (existing content)
12290 !! wikitext
12291 [[File:Foobar.jpg|50px|middle]]
12292 !! html/parsoid
12293 <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>
12294 !! end
12295
12296 !! test
12297 Parsoid-specific image handling - simple image with size and middle alignment
12298 and non-standard namespace name
12299 !! options
12300 parsoid=wt2html,wt2wt,html2html
12301 !! wikitext
12302 [[Image:Foobar.jpg|50px|middle]]
12303 !! html/parsoid
12304 <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>
12305 !! end
12306
12307 !! test
12308 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
12309 !! wikitext
12310 [[File:Foobar.jpg|500x10px|baseline|caption]]
12311 !! html/parsoid
12312 <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>
12313 !! end
12314
12315 !! test
12316 Parsoid-specific image handling - simple image with border and size spec
12317 !! wikitext
12318 [[File:Foobar.jpg|50px|border|caption]]
12319 !! html/parsoid
12320 <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>
12321 !! end
12322
12323 !! test
12324 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12325 !! wikitext
12326 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
12327 !! html/parsoid
12328 <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>
12329 !! end
12330
12331 !! test
12332 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12333 (existing content)
12334 !! wikitext
12335 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12336 !! html/parsoid
12337 <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>
12338 !! end
12339
12340 !! test
12341 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12342 !! wikitext
12343 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12344 !! html/parsoid
12345 <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>
12346 !! end
12347
12348 !! test
12349 Parsoid-specific image handling - thumbnail with specific size, halign,
12350 valign, and caption (existing content)
12351 !! wikitext
12352 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12353 !! html/parsoid
12354 <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>
12355 !! end
12356
12357 !! test
12358 Parsoid-specific image handling - framed image with specific size and caption
12359 (size is ignored)
12360 !! options
12361 parsoid=wt2html,wt2wt,html2html
12362 !! wikitext
12363 [[File:Foobar.jpg|frame|500x50px|caption]]
12364 !! html/parsoid
12365 <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>
12366 !! end
12367
12368 !! test
12369 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12370 (size is ignored)
12371 !! options
12372 parsoid=wt2html,wt2wt,html2html
12373 !! wikitext
12374 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12375 !! html/parsoid
12376 <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>
12377 !! end
12378
12379 !! test
12380 Parsoid-specific image handling - frameless image with specific size, border, and caption
12381 !! wikitext
12382 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12383 !! html/parsoid
12384 <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>
12385 !! end
12386
12387 !! test
12388 Parsoid-specific image handling - simple image with a formatted caption
12389 !! wikitext
12390 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12391 !! html/parsoid
12392 <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>
12393 !! end
12394
12395 !! test
12396 Parsoid-specific image handling - caption with a template in it
12397 !! wikitext
12398 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12399 !! html/parsoid
12400 <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>
12401 !! end
12402
12403 !! test
12404 Parsoid-specific image handling - caption with unbalanced tags in it
12405 !! options
12406 parsoid=wt2html,wt2wt,html2html
12407 !! wikitext
12408 foo
12409 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12410 bar
12411 !! html/parsoid
12412 <p>foo</p>
12413 <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>
12414 <p>bar</p>
12415 !! end
12416
12417 !! test
12418 Parsoid-specific image handling - empty caption (1)
12419 !! options
12420 parsoid=wt2html,wt2wt
12421 !! wikitext
12422 [[File:Foobar.jpg|thumb|]]
12423 !! html/parsoid
12424 <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>
12425 !! end
12426
12427 # empty captions don't get serialized unless we're in the "round trip" case
12428 !! test
12429 Parsoid-specific image handling - empty caption (2)
12430 !! options
12431 parsoid=html2wt
12432 !! html/parsoid
12433 <figure class="mw-default-size" typeof="mw:Image/Thumb">
12434 <a href="File:Foobar.jpg">
12435 <img resource="./File:Foobar.jpg"
12436 src="//example.com/images/3/3a/Foobar.jpg"
12437 height="25" width="220"/>
12438 </a>
12439 <figcaption></figcaption>
12440 </figure>
12441 !! wikitext
12442 [[File:Foobar.jpg|thumb]]
12443 !! end
12444
12445 !! test
12446 Parsoid-specific image handling - whitespace caption
12447 !! wikitext
12448 [[File:Foobar.jpg|thumb| ]]
12449 !! html/parsoid
12450 <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>
12451 !! end
12452
12453 !! test
12454 Parsoid-specific image handling - lang option
12455 !! wikitext
12456 foo
12457 [[File:Foobar.svg|lang=de|caption]]
12458 bar
12459 !! html/parsoid
12460 <p>foo
12461 <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>
12462 bar</p>
12463 !! end
12464
12465
12466 ###
12467 ### Subpages
12468 ###
12469 !! article
12470 Subpage test/subpage
12471 !! text
12472 foo
12473 !! endarticle
12474
12475 !! test
12476 Subpage link
12477 !! options
12478 subpage title=[[Subpage test]]
12479 !! wikitext
12480 [[/subpage]]
12481 !! html
12482 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
12483 </p>
12484 !! end
12485
12486 !! test
12487 Subpage noslash link
12488 !! options
12489 subpage title=[[Subpage test]]
12490 !! wikitext
12491 [[/subpage/]]
12492 !! html
12493 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
12494 </p>
12495 !! end
12496
12497 !! article
12498 Subpage test/1/2/subpage
12499 !! text
12500 blah
12501 !! endarticle
12502
12503 !! test
12504 Relative subpage noslash link
12505 !! options
12506 parsoid=wt2wt,wt2html,html2html
12507 subpage title=[[Subpage test/1/2/3/4]]
12508 !! wikitext
12509 [[../../subpage/]]
12510
12511 [[../../subpage]]
12512 !! html/php
12513 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
12514 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
12515 </p>
12516 !! html/parsoid
12517 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
12518 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
12519 !! end
12520
12521 !! test
12522 Parsoid: dot-slash prefixed wikilinks
12523 !! wikitext
12524 [[./foo]]
12525
12526 [[././bar]]
12527
12528 [[././baz/]]
12529 !! html/php
12530 <p>[[./foo]]
12531 </p><p>[[././bar]]
12532 </p><p>[[././baz/]]
12533 </p>
12534 !! html/parsoid
12535 <p>[[./foo]]
12536 </p><p>[[././bar]]
12537 </p><p>[[././baz/]]
12538 </p>
12539 !! end
12540
12541 !! test
12542 Render invalid page names as plain text (bug 51090)
12543 !! wikitext
12544 [[./../foo|bar]]
12545 [[foo�|bar]]
12546 [[foo/.|bar]]
12547 [[foo/..|bar]]
12548 [[foo~~~bar]]
12549 [[foo>bar]]
12550 [[foo[bar]]
12551 [[.]]
12552 [[..]]
12553 [[foo././bar]]
12554
12555 [[{{echo|./../foo}}|bar]]
12556 [[{{echo|foo/.}}|bar]]
12557 [[{{echo|foo/..}}|bar]]
12558 [[{{echo|foo~~~~bar}}]]
12559 [[{{echo|foo>bar}}]]
12560 [[{{echo|foo././bar}}]]
12561 [[{{echo|foo{bar}}]]
12562 [[{{echo|foo}bar}}]]
12563 [[{{echo|foo[bar}}]]
12564 [[{{echo|foo]bar}}]]
12565 [[{{echo|foo<bar}}]]
12566 !!html/php
12567 <p>[[./../foo|bar]]
12568 [[foo�|bar]]
12569 [[foo/.|bar]]
12570 [[foo/..|bar]]
12571 [[foo~~~bar]]
12572 [[foo&gt;bar]]
12573 [[foo[bar]]
12574 [[.]]
12575 [[..]]
12576 [[foo././bar]]
12577 </p><p>[[./../foo|bar]]
12578 [[foo/.|bar]]
12579 [[foo/..|bar]]
12580 [[foo~~~~bar]]
12581 [[foo&gt;bar]]
12582 [[foo././bar]]
12583 [[foo{bar]]
12584 [[foo}bar]]
12585 [[foo[bar]]
12586 [[foo]bar]]
12587 [[foo&lt;bar]]
12588 </p>
12589 !!html/parsoid
12590 <p>[[./../foo|bar]]
12591 [[foo�|bar]]
12592 [[foo/.|bar]]
12593 [[foo/..|bar]]
12594 [[foo~~~bar]]
12595 [[foo>bar]]
12596 [[foo[bar]]
12597 [[.]]
12598 [[..]]
12599 [[foo././bar]]</p>
12600
12601 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
12602 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
12603 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
12604 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
12605 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
12606 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
12607 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
12608 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
12609 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
12610 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
12611 [[<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>
12612 !!end
12613
12614 !! test
12615 Disabled subpages
12616 !! wikitext
12617 [[/subpage]]
12618 !! html
12619 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
12620 </p>
12621 !! end
12622
12623 !! test
12624 BUG 561: {{/Subpage}}
12625 !! options
12626 subpage title=[[Page]]
12627 !! wikitext
12628 {{/Subpage}}
12629 !! html
12630 <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>
12631 </p>
12632 !! end
12633
12634 ###
12635 ### Categories
12636 ###
12637 !! article
12638 Category:MediaWiki User's Guide
12639 !! text
12640 blah
12641 !! endarticle
12642
12643 !! test
12644 Link to category
12645 !! wikitext
12646 [[:Category:MediaWiki User's Guide]]
12647 !! html
12648 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
12649 </p>
12650 !! end
12651
12652 !! test
12653 Simple category
12654 !! options
12655 cat
12656 !! wikitext
12657 [[Category:MediaWiki User's Guide]]
12658 !! html
12659 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12660 !! end
12661
12662 !! test
12663 PAGESINCATEGORY invalid title fatal (r33546 fix)
12664 !! wikitext
12665 {{PAGESINCATEGORY:<bogus>}}
12666 !! html
12667 <p>0
12668 </p>
12669 !! end
12670
12671 !! test
12672 Category with different sort key
12673 !! options
12674 cat
12675 !! wikitext
12676 [[Category:MediaWiki User's Guide|Foo]]
12677 !! html
12678 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12679 !! end
12680
12681 !! test
12682 Category with identical sort key
12683 !! options
12684 cat
12685 !! wikitext
12686 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12687 !! html
12688 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12689 !! end
12690
12691 !! test
12692 Category with empty sort key
12693 !! options
12694 cat
12695 pst
12696 !! wikitext
12697 [[Category:MediaWiki User's Guide|]]
12698 !! html
12699 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12700 !! end
12701
12702 !! test
12703 Category with empty sort key and parentheses
12704 !! options
12705 cat
12706 pst
12707 !! wikitext
12708 [[Category:Foo (bar)|]]
12709 !! html
12710 [[Category:Foo (bar)|Foo]]
12711 !! end
12712
12713 !! test
12714 Category with link tail
12715 !! options
12716 cat
12717 pst
12718 !! wikitext
12719 123[[Category:Foo]]456
12720 !! html
12721 123[[Category:Foo]]456
12722 !! end
12723
12724 !! test
12725 Category with template
12726 !! options
12727 cat
12728 pst
12729 !! wikitext
12730 [[Category:{{echo|Foo}}]]
12731 !! html
12732 [[Category:{{echo|Foo}}]]
12733 !! end
12734
12735 !! test
12736 Category with template in sort key
12737 !! options
12738 cat
12739 pst
12740 !! wikitext
12741 [[Category:Foo|{{echo|Bar}}]]
12742 !! html
12743 [[Category:Foo|{{echo|Bar}}]]
12744 !! end
12745
12746 !! test
12747 Category with template in sort key and title
12748 !! options
12749 cat
12750 pst
12751 !! wikitext
12752 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12753 !! html
12754 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12755 !! end
12756
12757 !! test
12758 Category / paragraph interactions
12759 !! wikitext
12760 Foo [[Category:Baz]] Bar
12761
12762 Foo [[Category:Baz]]
12763 Bar
12764
12765 Foo
12766 [[Category:Baz]]
12767 Bar
12768
12769 Foo
12770 [[Category:Baz]] Bar
12771
12772 Foo
12773 [[Category:Baz]]
12774 [[Category:Baz]]
12775 [[Category:Baz]]
12776 Bar
12777
12778 [[Category:Baz]]
12779 [[Category:Baz]]
12780 [[Category:Baz]]
12781
12782 [[Category:Baz]]
12783 {{echo|[[Category:Baz]]}}
12784 [[Category:Baz]]
12785 !! html
12786 <p>Foo Bar
12787 </p><p>Foo
12788 Bar
12789 </p><p>Foo
12790 Bar
12791 </p><p>Foo Bar
12792 </p><p>Foo
12793 Bar
12794 </p>
12795 !! end
12796
12797 !! test
12798 Parsoid: Serialize link to category page with colon escape
12799 !! options
12800 parsoid
12801 !! wikitext
12802
12803 [[:Category:Foo]]
12804 [[:Category:Foo|Bar]]
12805 !! html
12806 <p>
12807 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
12808 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
12809 </p>
12810 !! end
12811
12812 !! test
12813 Parsoid: Link prefix/suffixes aren't applied to category links
12814 !! options
12815 parsoid=wt2html,wt2wt,html2html
12816 language=is
12817 !! wikitext
12818 x[[Category:Foo]]y
12819 !! html
12820 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
12821 !! end
12822
12823 !! test
12824 Parsoid: Serialize link to file page with colon escape
12825 !! options
12826 parsoid
12827 !! wikitext
12828
12829 [[:File:Foo.png]]
12830 [[:File:Foo.png|Bar]]
12831 !! html
12832 <p>
12833 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
12834 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
12835 </p>
12836 !! end
12837
12838 !! test
12839 Parsoid: Serialize a genuine category link without colon escape
12840 !! options
12841 parsoid
12842 !! wikitext
12843 [[Category:Foo]]
12844 [[Category:Foo|Bar]]
12845 !! html
12846 <link rel="mw:PageProp/Category" href="Category:Foo">
12847 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
12848 !! end
12849
12850 !! test
12851 Normalize hrefs properly before testing for invalid link targets (bug 70894)
12852 !! options
12853 parsoid=html2wt
12854 !! html
12855 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
12856 !! wikitext
12857 [[Category:Toxine bactérienne]]
12858 !! end
12859
12860 !! test
12861 Parsoid: Defaultsort
12862 !! options
12863 parsoid
12864 !! wikitext
12865 {{DEFAULTSORT:Foo}}
12866 !! html
12867 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
12868 !! end
12869
12870 ###
12871 ### Inter-language links
12872 ###
12873 !! test
12874 Interlanguage links
12875 !! options
12876 ill
12877 !! wikitext
12878 [[es:Alimento]]
12879 [[fr:Nourriture]]
12880 [[zh:食品]]
12881 !! html/php
12882 es:Alimento fr:Nourriture zh:食品
12883 !! html/parsoid
12884 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
12885 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
12886 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
12887 !! end
12888
12889 !! test
12890 Duplicate interlanguage links (bug 24502)
12891 !! options
12892 ill
12893 !! wikitext
12894 [[es:1]]
12895 [[es:2]]
12896 [[fr:1]]
12897 [[fr:2]]
12898 !! html/php
12899 es:1 fr:1
12900 !! html/parsoid
12901 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
12902 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
12903 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
12904 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
12905 !! end
12906
12907 ###
12908 ### Sections
12909 ###
12910 !! test
12911 Basic section headings
12912 !! wikitext
12913 == Headline 1 ==
12914 Some text
12915
12916 ==Headline 2==
12917 More
12918 ===Smaller headline===
12919 Blah blah
12920 !! html
12921 <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>
12922 <p>Some text
12923 </p>
12924 <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>
12925 <p>More
12926 </p>
12927 <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>
12928 <p>Blah blah
12929 </p>
12930 !! end
12931
12932 !! test
12933 Section headings with TOC
12934 !! wikitext
12935 == Headline 1 ==
12936 === Subheadline 1 ===
12937 ===== Skipping a level =====
12938 ====== Skipping a level ======
12939
12940 == Headline 2 ==
12941 Some text
12942 ===Another headline===
12943 !! html
12944 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12945 <ul>
12946 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
12947 <ul>
12948 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
12949 <ul>
12950 <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>
12951 <ul>
12952 <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>
12953 </ul>
12954 </li>
12955 </ul>
12956 </li>
12957 </ul>
12958 </li>
12959 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
12960 <ul>
12961 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
12962 </ul>
12963 </li>
12964 </ul>
12965 </div>
12966
12967 <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>
12968 <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>
12969 <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>
12970 <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>
12971 <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>
12972 <p>Some text
12973 </p>
12974 <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>
12975
12976 !! end
12977
12978 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
12979 !! test
12980 Handling of sections up to level 6 and beyond
12981 !! wikitext
12982 = Level 1 Heading=
12983 == Level 2 Heading==
12984 === Level 3 Heading===
12985 ==== Level 4 Heading====
12986 ===== Level 5 Heading=====
12987 ====== Level 6 Heading======
12988 ======= Level 7 Heading=======
12989 ======== Level 8 Heading========
12990 ========= Level 9 Heading=========
12991 ========== Level 10 Heading==========
12992 !! html
12993 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12994 <ul>
12995 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
12996 <ul>
12997 <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>
12998 <ul>
12999 <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>
13000 <ul>
13001 <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>
13002 <ul>
13003 <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>
13004 <ul>
13005 <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>
13006 <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>
13007 <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>
13008 <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>
13009 <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>
13010 </ul>
13011 </li>
13012 </ul>
13013 </li>
13014 </ul>
13015 </li>
13016 </ul>
13017 </li>
13018 </ul>
13019 </li>
13020 </ul>
13021 </div>
13022
13023 <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>
13024 <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>
13025 <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>
13026 <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>
13027 <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>
13028 <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>
13029 <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>
13030 <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>
13031 <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>
13032 <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>
13033
13034 !! end
13035
13036 !! test
13037 TOC regression (bug 9764)
13038 !! wikitext
13039 == title 1 ==
13040 === title 1.1 ===
13041 ==== title 1.1.1 ====
13042 === title 1.2 ===
13043 == title 2 ==
13044 === title 2.1 ===
13045 !! html
13046 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13047 <ul>
13048 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13049 <ul>
13050 <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>
13051 <ul>
13052 <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>
13053 </ul>
13054 </li>
13055 <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>
13056 </ul>
13057 </li>
13058 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13059 <ul>
13060 <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>
13061 </ul>
13062 </li>
13063 </ul>
13064 </div>
13065
13066 <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>
13067 <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>
13068 <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>
13069 <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>
13070 <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>
13071 <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>
13072
13073 !! end
13074
13075 !! test
13076 TOC with wgMaxTocLevel=3 (bug 6204)
13077 !! options
13078 wgMaxTocLevel=3
13079 !! wikitext
13080 == title 1 ==
13081 === title 1.1 ===
13082 ==== title 1.1.1 ====
13083 === title 1.2 ===
13084 == title 2 ==
13085 === title 2.1 ===
13086 !! html
13087 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13088 <ul>
13089 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13090 <ul>
13091 <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>
13092 <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>
13093 </ul>
13094 </li>
13095 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13096 <ul>
13097 <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>
13098 </ul>
13099 </li>
13100 </ul>
13101 </div>
13102
13103 <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>
13104 <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>
13105 <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>
13106 <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>
13107 <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>
13108 <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>
13109
13110 !! end
13111
13112 !! test
13113 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
13114 !! options
13115 wgMaxTocLevel=3
13116 !! wikitext
13117 ==Section 1==
13118 ===Section 1.1===
13119 ====Section 1.1.1====
13120 ====Section 1.1.1.1====
13121 ==Section 2==
13122 !! html
13123 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13124 <ul>
13125 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
13126 <ul>
13127 <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>
13128 </ul>
13129 </li>
13130 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
13131 </ul>
13132 </div>
13133
13134 <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>
13135 <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>
13136 <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>
13137 <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>
13138 <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>
13139
13140 !! end
13141
13142
13143 !! test
13144 Resolving duplicate section names
13145 !! wikitext
13146 == Foo bar ==
13147 == Foo bar ==
13148 !! html
13149 <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>
13150 <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>
13151
13152 !! end
13153
13154 !! test
13155 Resolving duplicate section names with differing case (bug 10721)
13156 !! wikitext
13157 == Foo bar ==
13158 == Foo Bar ==
13159 !! html
13160 <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>
13161 <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>
13162
13163 !! end
13164
13165 !! article
13166 Template:sections
13167 !! text
13168 ===Section 1===
13169 ==Section 2==
13170 !! endarticle
13171
13172 !! test
13173 Template with sections, __NOTOC__
13174 !! wikitext
13175 __NOTOC__
13176 ==Section 0==
13177 {{sections}}
13178 ==Section 4==
13179 !! html
13180 <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>
13181 <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>
13182 <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>
13183 <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>
13184
13185 !! end
13186
13187 !! test
13188 __NOEDITSECTION__ keyword
13189 !! wikitext
13190 __NOEDITSECTION__
13191 ==Section 1==
13192 ==Section 2==
13193 !! html
13194 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
13195 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
13196
13197 !! end
13198
13199 !! test
13200 Link inside a section heading
13201 !! wikitext
13202 ==Section with a [[Main Page|link]] in it==
13203 !! html
13204 <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>
13205
13206 !! end
13207
13208 !! test
13209 TOC regression (bug 12077)
13210 !! wikitext
13211 __TOC__
13212 == title 1 ==
13213 === title 1.1 ===
13214 == title 2 ==
13215 !! html
13216 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13217 <ul>
13218 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13219 <ul>
13220 <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>
13221 </ul>
13222 </li>
13223 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13224 </ul>
13225 </div>
13226
13227 <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>
13228 <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>
13229 <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>
13230
13231 !! end
13232
13233 !! test
13234 BUG 1219 URL next to image (good)
13235 !! wikitext
13236 http://example.com [[Image:foobar.jpg]]
13237 !! html
13238 <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>
13239 </p>
13240 !!end
13241
13242 !! test
13243 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13244 !! wikitext
13245 ===
13246 The line above must have a trailing space!
13247 === <!--
13248 --> <!-- -->
13249 But just in case it doesn't...
13250 !! html
13251 <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>
13252 <p>The line above must have a trailing space!
13253 </p>
13254 <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>
13255 <p>But just in case it doesn't...
13256 </p>
13257 !! end
13258
13259 !! test
13260 Header with special characters (bug 25462)
13261 !! wikitext
13262 The tooltips shall not show entities to the user (ie. be double escaped)
13263
13264 == text > text ==
13265 section 1
13266
13267 == text < text ==
13268 section 2
13269
13270 == text & text ==
13271 section 3
13272
13273 == text ' text ==
13274 section 4
13275
13276 == text " text ==
13277 section 5
13278 !! html
13279 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13280 </p>
13281 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13282 <ul>
13283 <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>
13284 <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>
13285 <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>
13286 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13287 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13288 </ul>
13289 </div>
13290
13291 <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>
13292 <p>section 1
13293 </p>
13294 <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>
13295 <p>section 2
13296 </p>
13297 <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>
13298 <p>section 3
13299 </p>
13300 <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>
13301 <p>section 4
13302 </p>
13303 <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>
13304 <p>section 5
13305 </p>
13306 !! end
13307
13308 !! test
13309 Header with space, plus and underscore as entity
13310 !! wikitext
13311 Id should not contain + for spaces
13312
13313 == Space between Text ==
13314 section 1
13315
13316 == Space-Entity&#32;between&#32;Text ==
13317 section 2
13318
13319 == Plus+between+Text ==
13320 section 3
13321
13322 == Plus-Entity&#43;between&#43;Text ==
13323 section 4
13324
13325 == Underscore_between_Text ==
13326 section 5
13327
13328 == Underscore-Entity&#95;between&#95;Text ==
13329 section 6
13330
13331 [[#Space between Text]]
13332 [[#Space-Entity&#32;between&#32;Text]]
13333 [[#Plus+between+Text]]
13334 [[#Plus-Entity&#43;between&#43;Text]]
13335 [[#Underscore_between_Text]]
13336 [[#Underscore-Entity&#95;between&#95;Text]]
13337 !! html
13338 <p>Id should not contain + for spaces
13339 </p>
13340 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13341 <ul>
13342 <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>
13343 <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>
13344 <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>
13345 <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>
13346 <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>
13347 <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>
13348 </ul>
13349 </div>
13350
13351 <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>
13352 <p>section 1
13353 </p>
13354 <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>
13355 <p>section 2
13356 </p>
13357 <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>
13358 <p>section 3
13359 </p>
13360 <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>
13361 <p>section 4
13362 </p>
13363 <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>
13364 <p>section 5
13365 </p>
13366 <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>
13367 <p>section 6
13368 </p><p><a href="#Space_between_Text">#Space between Text</a>
13369 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
13370 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
13371 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
13372 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
13373 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
13374 </p>
13375 !! end
13376
13377 !! test
13378 Headers with excess '=' characters
13379 (Are similar tests necessary beyond the 1st level?)
13380 !! wikitext
13381 =foo==
13382 ==foo=
13383 =''italic'' heading==
13384 ==''italic'' heading=
13385 !! html
13386 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13387 <ul>
13388 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
13389 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
13390 <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>
13391 <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>
13392 </ul>
13393 </div>
13394
13395 <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>
13396 <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>
13397 <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>
13398 <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>
13399
13400 !! end
13401
13402 !! test
13403 HTML headers vs TOC (bug 23393)
13404 (__NOEDITSECTION__ for clearer output, doesn't matter here)
13405 !! wikitext
13406 <h1>Header 1</h1>
13407 == Header 1.1 ==
13408 == Header 1.2 ==
13409
13410 <h1>Header 2
13411 </h1>
13412 == Header 2.1 ==
13413 == Header 2.2 ==
13414 __NOEDITSECTION__
13415 !! html
13416 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13417 <ul>
13418 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
13419 <ul>
13420 <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>
13421 <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>
13422 </ul>
13423 </li>
13424 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
13425 <ul>
13426 <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>
13427 <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>
13428 </ul>
13429 </li>
13430 </ul>
13431 </div>
13432
13433 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
13434 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
13435 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
13436 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
13437 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
13438 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
13439
13440 !! end
13441
13442 !! test
13443 Single-line or multiline-comments can follow headings
13444 !! options
13445 parsoid=wt2html,wt2wt
13446 !! wikitext
13447 ==foo==<!---->
13448 ==bar==<!--c1-->
13449 ==baz==<!--
13450 c2
13451 c3-->
13452 !! html
13453 <h2><span class="mw-headline" id="foo">foo</span></h2>
13454 <h2><span class="mw-headline" id="bar">bar</span></h2>
13455 <h2><span class="mw-headline" id="baz">baz</span></h2>
13456
13457 !! end
13458
13459 !! test
13460 BUG 1219 URL next to image (broken)
13461 !! wikitext
13462 http://example.com[[Image:foobar.jpg]]
13463 !! html
13464 <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>
13465 </p>
13466 !!end
13467
13468 !! test
13469 Bug 1186 news: in the middle of text
13470 !! wikitext
13471 http://en.wikinews.org/wiki/Wikinews:Workplace
13472 !! html
13473 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
13474 </p>
13475 !!end
13476
13477
13478 !! test
13479 Namespaced link must have a title
13480 !! wikitext
13481 [[Project:]]
13482 !! html
13483 <p>[[Project:]]
13484 </p>
13485 !!end
13486
13487 !! test
13488 Namespaced link must have a title (bad fragment version)
13489 !! wikitext
13490 [[Project:#fragment]]
13491 !! html
13492 <p>[[Project:#fragment]]
13493 </p>
13494 !!end
13495
13496
13497 ###
13498 ### HTML tags and HTML attributes
13499 ###
13500
13501 !! test
13502 div with no attributes
13503 !! wikitext
13504 <div>HTML rocks</div>
13505 !! html
13506 <div>HTML rocks</div>
13507
13508 !! end
13509
13510 !! test
13511 div with double-quoted attribute
13512 !! wikitext
13513 <div id="rock">HTML rocks</div>
13514 !! html
13515 <div id="rock">HTML rocks</div>
13516
13517 !! end
13518
13519 !! test
13520 div with single-quoted attribute
13521 !! wikitext
13522 <div id='rock'>HTML rocks</div>
13523 !! html
13524 <div id="rock">HTML rocks</div>
13525
13526 !! end
13527
13528 !! test
13529 div with unquoted attribute
13530 !! wikitext
13531 <div id=rock>HTML rocks</div>
13532 !! html
13533 <div id="rock">HTML rocks</div>
13534
13535 !! end
13536
13537 !! test
13538 div with illegal double attributes
13539 !! wikitext
13540 <div id="a" id="b">HTML rocks</div>
13541 !! html
13542 <div id="b">HTML rocks</div>
13543
13544 !!end
13545
13546 # FIXME: produce empty string instead of "class" in the PHP parser, following
13547 # the HTML5 spec.
13548 !! test
13549 div with empty attribute value, space before equals
13550 !! options
13551 parsoid
13552 !! wikitext
13553 <div class =>HTML rocks</div>
13554 !! html
13555 <div class="">HTML rocks</div>
13556
13557 !! end
13558
13559 !! test
13560 div with multiple empty attribute values
13561 !! options
13562 parsoid
13563 !! wikitext
13564 <div id= title=>HTML rocks</div>
13565 !! html
13566 <div id="" title="">HTML rocks</div>
13567
13568 !! end
13569
13570 !! test
13571 table with multiple empty attribute values
13572 !! options
13573 parsoid
13574 !! wikitext
13575 {| title= id=
13576 | hi
13577 |}
13578 !! html
13579 <table title="" id="">
13580 <tbody><tr><td> hi</td></tr>
13581 </tbody></table>
13582 !! end
13583
13584 !! test
13585 div with braces in attribute value
13586 !! wikitext
13587 <div title="{}">Foo</div>
13588 !! html/php
13589 <div title="&#123;}">Foo</div>
13590
13591 !! html/parsoid
13592 <div title="{}">Foo</div>
13593 !! end
13594
13595 # This it very inconsistent in the PHP parser: it returns
13596 # class="class" if there is a space between the name and the equal sign (see
13597 # 'div with empty attribute value, space before equals'), but strips the
13598 # attribute completely if the space is missing. We hope that not much content
13599 # depends on this, so are implementing the behavior below in Parsoid for
13600 # consistencies' sake.
13601 # FIXME: fix this behavior in the PHP parser?
13602 !! test
13603 div with empty attribute value, no space before equals
13604 !! options
13605 parsoid=wt2html,html2html
13606 !! wikitext
13607 <div class=>HTML rocks</div>
13608 !! html/php
13609 <div>HTML rocks</div>
13610
13611 !! html/parsoid
13612 <div class="">HTML rocks</div>
13613 !! end
13614
13615 !! test
13616 HTML multiple attributes correction
13617 !! wikitext
13618 <p class="error" class="awesome">Awesome!</p>
13619 !! html
13620 <p class="awesome">Awesome!</p>
13621
13622 !!end
13623
13624 !! test
13625 Table multiple attributes correction
13626 !! wikitext
13627 {|
13628 !+ class="error" class="awesome"| status
13629 |}
13630 !! html
13631 <table>
13632 <tr>
13633 <th class="awesome"> status
13634 </th></tr></table>
13635
13636 !!end
13637
13638 !! test
13639 DIV IN UPPERCASE
13640 !! wikitext
13641 <DIV ID="x">HTML ROCKS</DIV>
13642 !! html
13643 <div id="x">HTML ROCKS</div>
13644
13645 !!end
13646
13647 !! test
13648 Non-ASCII pseudo-tags are rendered as text
13649 !! wikitext
13650 <khyô>
13651 !! html
13652 <p>&lt;khyô&gt;
13653 </p>
13654 !! end
13655
13656 !! test
13657 Pseudo-tag with URL 'name' renders as url link
13658 !! wikitext
13659 <http://example.com/>
13660 !! html
13661 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
13662 </p>
13663 !! end
13664
13665 !! test
13666 text with amp in the middle of nowhere
13667 !! wikitext
13668 Remember AT&T?
13669 !! html
13670 <p>Remember AT&amp;T?
13671 </p>
13672 !! end
13673
13674 !! test
13675 text with character entity: eacute
13676 !! wikitext
13677 I always thought &eacute; was a cute letter.
13678 !! html
13679 <p>I always thought &#233; was a cute letter.
13680 </p>
13681 !! html+tidy
13682 <p>I always thought é was a cute letter.</p>
13683 !! end
13684
13685 !! test
13686 text with entity-escaped character entity-like string: eacute
13687 !! wikitext
13688 I always thought &amp;eacute; was a cute letter.
13689 !! html
13690 <p>I always thought &amp;eacute; was a cute letter.
13691 </p>
13692 !! end
13693
13694 !! test
13695 text with undefined character entity: xacute
13696 !! wikitext
13697 I always thought &xacute; was a cute letter.
13698 !! html
13699 <p>I always thought &amp;xacute; was a cute letter.
13700 </p>
13701 !! end
13702
13703 # TODO: generalize to PHP parser?
13704 !! test
13705 HTML5 tags
13706 !! options
13707 parsoid
13708 !! wikitext
13709 <data value="5">five</data>
13710 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13711 <mark>This highlighted text</mark>
13712 !! html
13713 <p><data value="5">five</data>
13714 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13715 <mark>This highlighted text</mark></p>
13716 !! end
13717
13718 !! test
13719 HTML tag with leading space is parsed as text
13720 !! wikitext
13721 < div>foo< /div>
13722 !! html
13723 <p>&lt; div&gt;foo&lt; /div&gt;
13724 </p>
13725 !! end
13726
13727 ###
13728 ### Nesting tests (see bug 41545, 50604, 51081)
13729 ###
13730
13731 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
13732 # Note that html2wt is considerably more difficult if we use <b> in
13733 # the test case, instead of <big>
13734 !! test
13735 Ensure that HTML adoption agency algorithm is properly implemented.
13736 !! wikitext
13737 <big>X<big>Y</big>Z</big>
13738 !! html
13739 <p><big>X<big>Y</big>Z</big>
13740 </p>
13741 !! end
13742
13743 # This was bug 41545 in the PHP parser.
13744 # Note that tidy doesn't handle this correctly.
13745 !! test
13746 Nesting of <kbd>
13747 !! wikitext
13748 <kbd>X<kbd>Y</kbd>Z</kbd>
13749 !! html
13750 <p><kbd>X<kbd>Y</kbd>Z</kbd>
13751 </p>
13752 !! end
13753
13754 # The following cases were bug 51081 in the PHP parser.
13755 # Note that there are some other nestable tags (b, i, etc) which are
13756 # not covered; see bug 51081 for discussion.
13757
13758 # Note that tidy doesn't handle this correctly.
13759 !! test
13760 Nesting of <em>
13761 !! wikitext
13762 <em>X<em>Y</em>Z</em>
13763 !! html
13764 <p><em>X<em>Y</em>Z</em>
13765 </p>
13766 !! end
13767
13768 # Note that tidy doesn't handle this correctly.
13769 !! test
13770 Nesting of <strong>
13771 !! wikitext
13772 <strong>X<strong>Y</strong>Z</strong>
13773 !! html
13774 <p><strong>X<strong>Y</strong>Z</strong>
13775 </p>
13776 !! end
13777
13778 !! test
13779 Nesting of <q>
13780 !! wikitext
13781 <q>X<q>Y</q>Z</q>
13782 !! html+tidy
13783 <p><q>X<q>Y</q>Z</q></p>
13784 !! end
13785
13786 # Note that tidy doesn't handle this correctly.
13787 !! test
13788 Nesting of <ruby>
13789 !! wikitext
13790 <ruby>X<ruby>Y</ruby>Z</ruby>
13791 !! html
13792 <p><ruby>X<ruby>Y</ruby>Z</ruby>
13793 </p>
13794 !! end
13795
13796 # Note that tidy doesn't handle this correctly.
13797 !! test
13798 Nesting of <bdo>
13799 !! wikitext
13800 <bdo>X<bdo>Y</bdo>Z</bdo>
13801 !! html
13802 <p><bdo>X<bdo>Y</bdo>Z</bdo>
13803 </p>
13804 !! end
13805
13806
13807 ###
13808 ### Media links
13809 ###
13810
13811 !! test
13812 Media link
13813 !! wikitext
13814 [[Media:Foobar.jpg]]
13815 !! html
13816 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
13817 </p>
13818 !! end
13819
13820 !! test
13821 Media link with text
13822 !! wikitext
13823 [[Media:Foobar.jpg|A neat file to look at]]
13824 !! html
13825 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
13826 </p>
13827 !! end
13828
13829 # FIXME: this is still bad HTML tag nesting
13830 !! test
13831 Media link with nasty text
13832 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
13833 !! wikitext
13834 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
13835 !! html
13836 <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>
13837
13838 !! html+tidy
13839 <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>
13840 !! end
13841
13842 !! test
13843 Media link to nonexistent file (bug 1702)
13844 !! wikitext
13845 [[Media:No such.jpg]]
13846 !! html
13847 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
13848 </p>
13849 !! end
13850
13851 !! test
13852 Image link to nonexistent file (bug 1850 - good)
13853 !! wikitext
13854 [[File:No_such.jpg]]
13855 !! html/php
13856 <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>
13857 </p>
13858 !! html/parsoid
13859 <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>
13860 !! end
13861
13862 !! test
13863 :Image link to nonexistent file (bug 1850 - bad)
13864 !! wikitext
13865 [[:Image:No such.jpg]]
13866 !! html/php
13867 <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>
13868 </p>
13869 !! html/parsoid
13870 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
13871 !! end
13872
13873
13874
13875 !! test
13876 Character reference normalization in link text (bug 1938)
13877 !! wikitext
13878 [[Main Page|this&that]]
13879 !! html
13880 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
13881 </p>
13882 !!end
13883
13884 !! article
13885 אַ
13886 !! text
13887 Test for unicode normalization
13888
13889 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
13890 !! endarticle
13891
13892 !! test
13893 (bug 19451) Links should refer to the normalized form.
13894 !! wikitext
13895 [[&#xFB2E;]]
13896 [[&#x5d0;&#x5b7;]]
13897 [[&#x5d0;ַ]]
13898 [[א&#x5b7;]]
13899 [[אַ]]
13900 !! html
13901 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
13902 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
13903 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
13904 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
13905 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
13906 </p>
13907 !! end
13908
13909 !! test
13910 Empty attribute crash test (bug 2067)
13911 !! wikitext
13912 <font color="">foo</font>
13913 !! html
13914 <p><font color="">foo</font>
13915 </p>
13916 !! end
13917
13918 !! test
13919 Empty attribute crash test single-quotes (bug 2067)
13920 !! wikitext
13921 <font color=''>foo</font>
13922 !! html
13923 <p><font color="">foo</font>
13924 </p>
13925 !! end
13926
13927 !! test
13928 Attribute test: equals, then nothing
13929 !! wikitext
13930 <font color=>foo</font>
13931 !! html
13932 <p><font>foo</font>
13933 </p>
13934 !! end
13935
13936 !! test
13937 Attribute test: unquoted value
13938 !! wikitext
13939 <font color=x>foo</font>
13940 !! html
13941 <p><font color="x">foo</font>
13942 </p>
13943 !! end
13944
13945 !! test
13946 Attribute test: unquoted but illegal value (hash)
13947 !! wikitext
13948 <font color=#x>foo</font>
13949 !! html
13950 <p><font color="#x">foo</font>
13951 </p>
13952 !! end
13953
13954 !! test
13955 Attribute test: no value
13956 !! wikitext
13957 <font color>foo</font>
13958 !! html
13959 <p><font color="color">foo</font>
13960 </p>
13961 !! end
13962
13963 !! test
13964 Bug 2095: link with three closing brackets
13965 !! wikitext
13966 [[Main Page]]]
13967 !! html/php
13968 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
13969 </p>
13970 !! html/parsoid
13971 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
13972 !! end
13973
13974 !! test
13975 Bug 2095: link with pipe and three closing brackets
13976 !! wikitext
13977 [[Main Page|link]]]
13978 !! html/php
13979 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
13980 </p>
13981 !! html/parsoid
13982 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
13983 !! end
13984
13985 !! test
13986 Bug 2095: link with pipe and three closing brackets, version 2
13987 !! wikitext
13988 [[Main Page|[http://example.com/]]]
13989 !! html/php
13990 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
13991 </p>
13992 !! html/parsoid
13993 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
13994 !! end
13995
13996
13997 ###
13998 ### Safety
13999 ###
14000
14001 !! article
14002 Template:Dangerous attribute
14003 !! text
14004 " onmouseover="alert(document.cookie)
14005 !! endarticle
14006
14007 !! article
14008 Template:Dangerous style attribute
14009 !! text
14010 border-size: expression(alert(document.cookie))
14011 !! endarticle
14012
14013 !! article
14014 Template:Div style
14015 !! text
14016 <div style="float: right; {{{1}}}">Magic div</div>
14017 !! endarticle
14018
14019 !! test
14020 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
14021 !! wikitext
14022 <div title="{{test}}"></div>
14023 !! html
14024 <div title="This is a test template"></div>
14025
14026 !! end
14027
14028 # Parsoid has enough context to handle this case
14029 !! test
14030 Bug 2304: HTML attribute safety (dangerous template; 2309)
14031 !! wikitext
14032 <div title="{{dangerous attribute}}"></div>
14033 !! html/php
14034 <div title=""></div>
14035
14036 !! html/parsoid
14037 <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>
14038 !! end
14039
14040 !! test
14041 Bug 2304: HTML attribute safety (dangerous style template; 2309)
14042 !! wikitext
14043 <div style="{{dangerous style attribute}}"></div>
14044 !! html
14045 <div style="/* insecure input */"></div>
14046
14047 !! end
14048
14049 !! test
14050 Bug 2304: HTML attribute safety (safe parameter; 2309)
14051 !! wikitext
14052 {{div style|width: 200px}}
14053 !! html
14054 <div style="float: right; width: 200px">Magic div</div>
14055
14056 !! end
14057
14058 !! test
14059 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
14060 !! wikitext
14061 {{div style|width: expression(alert(document.cookie))}}
14062 !! html
14063 <div style="/* insecure input */">Magic div</div>
14064
14065 !! end
14066
14067 !! test
14068 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
14069 !! wikitext
14070 {{div style|"><script>alert(document.cookie)</script>}}
14071 !! html
14072 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14073
14074 !! end
14075
14076 !! test
14077 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
14078 !! wikitext
14079 {{div style|" ><script>alert(document.cookie)</script>}}
14080 !! html
14081 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14082
14083 !! end
14084
14085 !! test
14086 Bug 2304: HTML attribute safety (link)
14087 !! wikitext
14088 <div title="[[Main Page]]"></div>
14089 !! html
14090 <div title="&#91;&#91;Main Page]]"></div>
14091
14092 !! end
14093
14094 !! test
14095 Bug 2304: HTML attribute safety (italics)
14096 !! wikitext
14097 <div title="''foobar''"></div>
14098 !! html
14099 <div title="&#39;&#39;foobar&#39;&#39;"></div>
14100
14101 !! end
14102
14103 !! test
14104 Bug 2304: HTML attribute safety (bold)
14105 !! wikitext
14106 <div title="'''foobar'''"></div>
14107 !! html
14108 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
14109
14110 !! end
14111
14112
14113 !! test
14114 Bug 2304: HTML attribute safety (ISBN)
14115 !! wikitext
14116 <div title="ISBN 1234567890"></div>
14117 !! html
14118 <div title="&#73;SBN 1234567890"></div>
14119
14120 !! end
14121
14122 !! test
14123 Bug 2304: HTML attribute safety (RFC)
14124 !! wikitext
14125 <div title="RFC 1234"></div>
14126 !! html
14127 <div title="&#82;FC 1234"></div>
14128
14129 !! end
14130
14131 !! test
14132 Bug 2304: HTML attribute safety (PMID)
14133 !! wikitext
14134 <div title="PMID 1234567890"></div>
14135 !! html
14136 <div title="&#80;MID 1234567890"></div>
14137
14138 !! end
14139
14140 !! test
14141 Bug 2304: HTML attribute safety (web link)
14142 !! wikitext
14143 <div title="http://example.com/"></div>
14144 !! html
14145 <div title="http&#58;//example.com/"></div>
14146
14147 !! end
14148
14149 !! test
14150 Bug 2304: HTML attribute safety (named web link)
14151 !! wikitext
14152 <div title="[http://example.com/ link]"></div>
14153 !! html
14154 <div title="&#91;http&#58;//example.com/ link]"></div>
14155
14156 !! end
14157
14158 !! test
14159 Bug 3244: HTML attribute safety (extension; safe)
14160 !! wikitext
14161 <div style="<nowiki>background:blue</nowiki>"></div>
14162 !! html
14163 <div style="background:blue"></div>
14164
14165 !! end
14166
14167 !! test
14168 Bug 3244: HTML attribute safety (extension; unsafe)
14169 !! wikitext
14170 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14171 !! html
14172 <div style="/* insecure input */"></div>
14173
14174 !! end
14175
14176 # More MSIE fun discovered by Tom Gilder
14177
14178 !! test
14179 MSIE CSS safety test: spurious slash
14180 !! wikitext
14181 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14182 !! html
14183 <div style="/* insecure input */">evil</div>
14184
14185 !! end
14186
14187 !! test
14188 MSIE CSS safety test: hex code
14189 !! wikitext
14190 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14191 !! html
14192 <div style="/* insecure input */">evil</div>
14193
14194 !! end
14195
14196 !! test
14197 MSIE CSS safety test: comment in url
14198 !! wikitext
14199 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14200 !! html
14201 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14202
14203 !! end
14204
14205 !! test
14206 MSIE CSS safety test: comment in expression
14207 !! wikitext
14208 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14209 !! html
14210 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14211
14212 !! end
14213
14214 !! test
14215 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14216 !! wikitext
14217 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14218 !! html
14219 <p style="/* invalid control char */">A</p>
14220
14221 !! end
14222
14223 !! test
14224 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14225 !! wikitext
14226 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14227 <div style="top:EXPRESSION(alert())">B</div>
14228 !! html
14229 <p style="/* insecure input */">A</p>
14230 <div style="/* insecure input */">B</div>
14231
14232 !! end
14233
14234 !! test
14235 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14236 !! wikitext
14237 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14238 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14239 !! html
14240 <div style="/* insecure input */">A</div>
14241 <p style="/* insecure input */">B</p>
14242
14243 !! end
14244
14245 !! test
14246 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14247 !! wikitext
14248 <div style="background-image:url⁽javascript:alert())">A</div>
14249 <div style="background-image:url₍javascript:alert())">B</div>
14250 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14251 !! html
14252 <div style="/* insecure input */">A</div>
14253 <div style="/* insecure input */">B</div>
14254 <p style="/* insecure input */">C</p>
14255
14256 !! end
14257
14258 !! test
14259 Opera -o-link CSS
14260 !! wikitext
14261 <div
14262 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;"
14263 style="-o-link:attr(title);-o-link-source:current">X</div>
14264 !! html
14265 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14266
14267 !! end
14268
14269 !! test
14270 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14271 !! wikitext
14272 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14273 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14274 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14275 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14276 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14277 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14278 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14279 !! html
14280 <p style="/* insecure input */">A</p>
14281 <p style="/* insecure input */">B</p>
14282 <p style="/* insecure input */">C</p>
14283 <p style="/* insecure input */">D</p>
14284 <p style="/* insecure input */">E</p>
14285 <p style="/* insecure input */">F</p>
14286 <p style="/* insecure input */">G</p>
14287
14288 !! end
14289
14290 !! test
14291 Table attribute legitimate extension
14292 !! wikitext
14293 {|
14294 !+ style="<nowiki>color:blue</nowiki>"| status
14295 |}
14296 !! html
14297 <table>
14298 <tr>
14299 <th style="color:blue"> status
14300 </th></tr></table>
14301
14302 !!end
14303
14304 !! test
14305 Table attribute safety
14306 !! wikitext
14307 {|
14308 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14309 |}
14310 !! html
14311 <table>
14312 <tr>
14313 <th style="/* insecure input */"> status
14314 </th></tr></table>
14315
14316 !! end
14317
14318 !! test
14319 CSS line continuation 1
14320 !! wikitext
14321 <div style="background-image: u\&#10;rl(test.jpg);"></div>
14322 !! html
14323 <div style="/* insecure input */"></div>
14324
14325 !! end
14326
14327 !! test
14328 CSS line continuation 2
14329 !! wikitext
14330 <div style="background-image: u\&#13;rl(test.jpg); "></div>
14331 !! html
14332 <div style="/* insecure input */"></div>
14333
14334 !! end
14335
14336 !! article
14337 Template:Identity
14338 !! text
14339 {{{1}}}
14340 !! endarticle
14341
14342 !! test
14343 Expansion of multi-line templates in attribute values (bug 6255)
14344 !! wikitext
14345 <div style="background: {{identity|#00FF00}}">-</div>
14346 !! html
14347 <div style="background: #00FF00">-</div>
14348
14349 !! end
14350
14351
14352 !! test
14353 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
14354 !! wikitext
14355 <div style="background:
14356 #00FF00">-</div>
14357 !! html/php
14358 <div style="background: #00FF00">-</div>
14359
14360 !! html/parsoid
14361 <div style="background:
14362 #00FF00">-</div>
14363 !! end
14364
14365 !! test
14366 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
14367 !! wikitext
14368 <div style="background: &#10;#00FF00">-</div>
14369 !! html
14370 <div style="background: &#10;#00FF00">-</div>
14371
14372 !! end
14373
14374 !! test
14375 evil <math>-wiki-tags without Extension:Math enabled
14376 !! wikitext
14377 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
14378 !! html+tidy
14379 <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>
14380 !! end
14381
14382 ###
14383 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
14384 ###
14385 !! test
14386 Parser hook: empty input
14387 !! wikitext
14388 <tag></tag>
14389 !! html
14390 <pre>
14391 ''
14392 array (
14393 )
14394 </pre>
14395
14396 !! end
14397
14398 !! test
14399 Parser hook: empty input using terminated empty elements
14400 !! wikitext
14401 <tag/>
14402 !! html
14403 <pre>
14404 NULL
14405 array (
14406 )
14407 </pre>
14408
14409 !! end
14410
14411 !! test
14412 Parser hook: empty input using terminated empty elements (space before)
14413 !! wikitext
14414 <tag />
14415 !! html
14416 <pre>
14417 NULL
14418 array (
14419 )
14420 </pre>
14421
14422 !! end
14423
14424 !! test
14425 Parser hook: basic input
14426 !! wikitext
14427 <tag>input</tag>
14428 !! html
14429 <pre>
14430 'input'
14431 array (
14432 )
14433 </pre>
14434
14435 !! end
14436
14437
14438 !! test
14439 Parser hook: case insensitive
14440 !! wikitext
14441 <TAG>input</TAG>
14442 !! html
14443 <pre>
14444 'input'
14445 array (
14446 )
14447 </pre>
14448
14449 !! end
14450
14451
14452 !! test
14453 Parser hook: case insensitive, redux
14454 !! wikitext
14455 <TaG>input</TAg>
14456 !! html
14457 <pre>
14458 'input'
14459 array (
14460 )
14461 </pre>
14462
14463 !! end
14464
14465 !! test
14466 Parser hook: nested tags
14467 !! options
14468 noxml
14469 !! wikitext
14470 <tag><tag></tag></tag>
14471 !! html
14472 <pre>
14473 '<tag>'
14474 array (
14475 )
14476 </pre>&lt;/tag&gt;
14477
14478 !! end
14479
14480 !! test
14481 Parser hook: basic arguments
14482 !! wikitext
14483 <tag width=200 height = "100" depth = '50' square></tag>
14484 !! html
14485 <pre>
14486 ''
14487 array (
14488 'width' => '200',
14489 'height' => '100',
14490 'depth' => '50',
14491 'square' => 'square',
14492 )
14493 </pre>
14494
14495 !! end
14496
14497 !! test
14498 Parser hook: argument containing a forward slash (bug 5344)
14499 !! wikitext
14500 <tag filename='/tmp/bla'></tag>
14501 !! html
14502 <pre>
14503 ''
14504 array (
14505 'filename' => '/tmp/bla',
14506 )
14507 </pre>
14508
14509 !! end
14510
14511 !! test
14512 Parser hook: empty input using terminated empty elements (bug 2374)
14513 !! wikitext
14514 <tag foo=bar/>text
14515 !! html
14516 <pre>
14517 NULL
14518 array (
14519 'foo' => 'bar',
14520 )
14521 </pre>text
14522
14523 !! end
14524
14525 # </tag> should be output literally since there is no matching tag that begins it
14526 !! test
14527 Parser hook: basic arguments using terminated empty elements (bug 2374)
14528 !! wikitext
14529 <tag width=200 height = "100" depth = '50' square/>
14530 other stuff
14531 </tag>
14532 !! html
14533 <pre>
14534 NULL
14535 array (
14536 'width' => '200',
14537 'height' => '100',
14538 'depth' => '50',
14539 'square' => 'square',
14540 )
14541 </pre>
14542 <p>other stuff
14543 &lt;/tag&gt;
14544 </p>
14545 !! end
14546
14547 ###
14548 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14549 ###
14550
14551 !! test
14552 Parser hook: static parser hook not inside a comment
14553 !! wikitext
14554 <statictag>hello, world</statictag>
14555 <statictag action=flush/>
14556 !! html
14557 <p>hello, world
14558 </p>
14559 !! end
14560
14561
14562 !! test
14563 Parser hook: static parser hook inside a comment
14564 !! wikitext
14565 <!-- <statictag>hello, world</statictag> -->
14566 <statictag action=flush/>
14567 !! html
14568 <p><br />
14569 </p>
14570 !! end
14571
14572 # Nested template calls; this case was broken by Parser.php rev 1.506,
14573 # since reverted.
14574
14575 !! article
14576 Template:One-parameter
14577 !! text
14578 (My parameter is: {{{1}}})
14579 !! endarticle
14580
14581 !! article
14582 Template:Map-one-parameter
14583 !! text
14584 {{{{{1}}}|{{{2}}}}}
14585 !! endarticle
14586
14587 !! test
14588 Nested template calls
14589 !! wikitext
14590 {{Map-one-parameter|One-parameter|param}}
14591 !! html
14592 <p>(My parameter is: param)
14593 </p>
14594 !! end
14595
14596
14597 ###
14598 ### Sanitizer
14599 ###
14600
14601 # HTML+Tidy effectively strips out the empty tags completely
14602 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
14603 # which Tidy would have done for the PHP parser had there been content inside it.
14604 !! test
14605 Sanitizer: Closing of open tags
14606 !! wikitext
14607 <s></s><table></table>
14608 !! html
14609 <s></s><table></table>
14610
14611 !! html/parsoid
14612 <p><s></s></p><table></table>
14613 !! end
14614
14615 !! test
14616 Sanitizer: Closing of open but not closed tags
14617 !! wikitext
14618 <s>foo
14619 !! html
14620 <p><s>foo</s>
14621 </p>
14622 !! end
14623
14624 !! test
14625 Sanitizer: Closing of closed but not open tags
14626 !! wikitext
14627 </s>
14628 !! html
14629 <p>&lt;/s&gt;
14630 </p>
14631 !! end
14632
14633 !! test
14634 Sanitizer: Closing of closed but not open table tags
14635 !! wikitext
14636 Table not started</td></tr></table>
14637 !! html
14638 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
14639 </p>
14640 !! end
14641
14642 !! test
14643 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
14644 !! wikitext
14645 <span id="æ: v">byte</span>[[#æ: v|backlink]]
14646 !! html
14647 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
14648 </p>
14649 !! end
14650
14651 # In HTML5, the restrictions are that id must contain at least one character,
14652 # and must not contain any space characters.
14653 !! test
14654 Sanitizer: Validating the contents of the id attribute (bug 4515)
14655 !! options
14656 disabled
14657 !! wikitext
14658 <br id="" /><br id="a space" />
14659 !! html
14660 Something ...
14661 !! end
14662
14663 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
14664 !! test
14665 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
14666 !! options
14667 disabled
14668 !! wikitext
14669 <br id="foo" /><br id="foo" />
14670 !! html
14671 Something need to be done. foo-2 ?
14672 !! end
14673
14674 !! test
14675 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
14676 !! wikitext
14677 <div itemscope>
14678 <meta itemprop="hello" content="world">
14679 <meta http-equiv="refresh" content="5">
14680 <meta itemprop="hello" http-equiv="refresh" content="5">
14681 <link itemprop="hello" href="{{SERVER}}">
14682 <link rel="stylesheet" href="{{SERVER}}">
14683 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
14684 </div>
14685 !! html
14686 <div itemscope="itemscope">
14687 <p> <meta itemprop="hello" content="world" />
14688 &lt;meta http-equiv="refresh" content="5"&gt;
14689 <meta itemprop="hello" content="5" />
14690 </p>
14691 <link itemprop="hello" href="http&#58;//example.org" />
14692 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
14693 <link itemprop="hello" href="http&#58;//example.org" />
14694 </div>
14695
14696 !! end
14697
14698 !! test
14699 Language converter: output gets cut off unexpectedly (bug 5757)
14700 !! options
14701 language=zh
14702 !! wikitext
14703 this bit is safe: }-
14704
14705 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
14706
14707 then we get cut off here: }-
14708
14709 all additional text is vanished
14710 !! html
14711 <p>this bit is safe: }-
14712 </p><p>but if we add a conversion instance: xxx
14713 </p><p>then we get cut off here: }-
14714 </p><p>all additional text is vanished
14715 </p>
14716 !! end
14717
14718 !! test
14719 Self closed html pairs (bug 5487)
14720 !! options
14721 !! wikitext
14722 <center><font id="bug" />Centered text</center>
14723 <div><font id="bug2" />In div text</div>
14724 !! html
14725 <center>&lt;font id="bug" /&gt;Centered text</center>
14726 <div>&lt;font id="bug2" /&gt;In div text</div>
14727
14728 !! end
14729
14730 #
14731 #
14732 #
14733
14734 !! test
14735 Punctuation: nbsp before exclamation
14736 !! wikitext
14737 C'est grave !
14738 !! html
14739 <p>C'est grave&#160;!
14740 </p>
14741 !! end
14742
14743 !! test
14744 Punctuation: CSS !important (bug 11874)
14745 !! wikitext
14746 <div style="width:50% !important">important</div>
14747 !! html
14748 <div style="width:50% !important">important</div>
14749
14750 !!end
14751
14752 !! test
14753 Punctuation: CSS ! important (bug 11874; with space after)
14754 !! wikitext
14755 <div style="width:50% ! important">important</div>
14756 !! html
14757 <div style="width:50% ! important">important</div>
14758
14759 !!end
14760
14761
14762 !! test
14763 HTML bullet list, closed tags (bug 5497)
14764 !! wikitext
14765 <ul>
14766 <li>One</li>
14767 <li>Two</li>
14768 </ul>
14769 !! html/php
14770 <ul>
14771 <li>One</li>
14772 <li>Two</li>
14773 </ul>
14774
14775 !! html/parsoid
14776 <ul data-parsoid='{"stx":"html"}'>
14777 <li data-parsoid='{"stx":"html"}'>One</li>
14778 <li data-parsoid='{"stx":"html"}'>Two</li>
14779 </ul>
14780
14781 !! end
14782
14783 !! test
14784 HTML bullet list, unclosed tags (bug 5497)
14785 !! wikitext
14786 <ul>
14787 <li>One
14788 <li>Two
14789 </ul>
14790 !! html/php+tidy
14791 <ul>
14792 <li>One</li>
14793 <li>Two</li>
14794 </ul>
14795 !! html/parsoid
14796 <ul data-parsoid='{"stx":"html"}'>
14797 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
14798 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
14799 </ul>
14800
14801 !! end
14802
14803 !! test
14804 HTML ordered list, closed tags (bug 5497)
14805 !! wikitext
14806 <ol>
14807 <li>One</li>
14808 <li>Two</li>
14809 </ol>
14810 !! html/php
14811 <ol>
14812 <li>One</li>
14813 <li>Two</li>
14814 </ol>
14815
14816 !! html/parsoid
14817 <ol data-parsoid='{"stx":"html"}'>
14818 <li data-parsoid='{"stx":"html"}'>One</li>
14819 <li data-parsoid='{"stx":"html"}'>Two</li>
14820 </ol>
14821
14822 !! end
14823
14824 !! test
14825 HTML ordered list, unclosed tags (bug 5497)
14826 !! options
14827 !! wikitext
14828 <ol>
14829 <li>One
14830 <li>Two
14831 </ol>
14832 !! html/php+tidy
14833 <ol>
14834 <li>One</li>
14835 <li>Two</li>
14836 </ol>
14837 !! html/parsoid
14838 <ol 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 </ol>
14842
14843 !! end
14844
14845 !! test
14846 HTML nested bullet list, closed tags (bug 5497)
14847 !! wikitext
14848 <ul>
14849 <li>One</li>
14850 <li>Two:
14851 <ul>
14852 <li>Sub-one</li>
14853 <li>Sub-two</li>
14854 </ul>
14855 </li>
14856 </ul>
14857 !! html
14858 <ul>
14859 <li>One</li>
14860 <li>Two:
14861 <ul>
14862 <li>Sub-one</li>
14863 <li>Sub-two</li>
14864 </ul>
14865 </li>
14866 </ul>
14867
14868 !! end
14869
14870 !! test
14871 HTML nested bullet list, open tags (bug 5497)
14872 !! wikitext
14873 <ul>
14874 <li>One
14875 <li>Two:
14876 <ul>
14877 <li>Sub-one
14878 <li>Sub-two
14879 </ul>
14880 </ul>
14881 !! html/php+tidy
14882 <ul>
14883 <li>One</li>
14884 <li>Two:
14885 <ul>
14886 <li>Sub-one</li>
14887 <li>Sub-two</li>
14888 </ul>
14889 </li>
14890 </ul>
14891 !! html/parsoid
14892 <ul>
14893 <li>One
14894 </li>
14895 <li>Two:
14896 <ul>
14897 <li>Sub-one
14898 </li>
14899 <li>Sub-two
14900 </li>
14901 </ul>
14902 </li>
14903 </ul>
14904
14905 !! end
14906
14907 !! test
14908 HTML nested ordered list, closed tags (bug 5497)
14909 !! wikitext
14910 <ol>
14911 <li>One</li>
14912 <li>Two:
14913 <ol>
14914 <li>Sub-one</li>
14915 <li>Sub-two</li>
14916 </ol>
14917 </li>
14918 </ol>
14919 !! html
14920 <ol>
14921 <li>One</li>
14922 <li>Two:
14923 <ol>
14924 <li>Sub-one</li>
14925 <li>Sub-two</li>
14926 </ol>
14927 </li>
14928 </ol>
14929
14930 !! end
14931
14932 !! test
14933 HTML nested ordered list, open tags (bug 5497)
14934 !! wikitext
14935 <ol>
14936 <li>One
14937 <li>Two:
14938 <ol>
14939 <li>Sub-one
14940 <li>Sub-two
14941 </ol>
14942 </ol>
14943 !! html/php
14944 <ol>
14945 <li>One
14946 <li>Two:
14947 <ol>
14948 <li>Sub-one
14949 <li>Sub-two
14950 </ol>
14951 </ol>
14952
14953 !! html/parsoid
14954 <ol>
14955 <li>One
14956 </li>
14957 <li>Two:
14958 <ol>
14959 <li>Sub-one
14960 </li>
14961 <li>Sub-two
14962 </li>
14963 </ol>
14964 </li>
14965 </ol>
14966
14967 !! end
14968
14969 !! test
14970 HTML ordered list item with parameters oddity
14971 !! wikitext
14972 <ol><li id="fragment">One</li>
14973 </ol>
14974 !! html
14975 <ol><li id="fragment">One</li>
14976 </ol>
14977
14978 !! end
14979
14980 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
14981 !!test
14982 bug 5918: autonumbering
14983 !! wikitext
14984 [http://first/] [http://second] [ftp://ftp]
14985
14986 ftp://inlineftp
14987
14988 [mailto:enclosed@mail.tld With target]
14989
14990 [mailto:enclosed@mail.tld]
14991
14992 mailto:inline@mail.tld
14993 !! html/php
14994 <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>
14995 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
14996 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
14997 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
14998 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
14999 </p>
15000 !! html/parsoid
15001 <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>
15002 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
15003 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
15004 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
15005 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
15006 !! end
15007
15008
15009 #
15010 # Security and HTML correctness
15011 # From Nick Jenkins' fuzz testing
15012 #
15013
15014 !! test
15015 Fuzz testing: Parser13
15016 !! wikitext
15017 {|
15018 | http://a|
15019 !! html
15020 <table>
15021 <tr>
15022 <td>
15023 </td>
15024 </tr>
15025 </table>
15026
15027 !! end
15028
15029 !! test
15030 Fuzz testing: Parser14
15031 !! wikitext
15032 == onmouseover= ==
15033 http://__TOC__
15034 !! html
15035 <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>
15036 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15037 <ul>
15038 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15039 </ul>
15040 </div>
15041
15042
15043 !! html+tidy
15044 <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>
15045 <p>http://</p>
15046 <div id="toc" class="toc">
15047 <div id="toctitle">
15048 <h2>Contents</h2>
15049 </div>
15050 <ul>
15051 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15052 </ul>
15053 </div>
15054 !! end
15055
15056 !! test
15057 Fuzz testing: Parser14-table
15058 !! wikitext
15059 ==a==
15060 {| STYLE=__TOC__
15061 !! html
15062 <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>
15063 <table style="&#95;_TOC&#95;_">
15064 <tr><td></td></tr>
15065 </table>
15066
15067 !! html+tidy
15068 <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>
15069 <table style="__TOC__">
15070 <tr>
15071 <td></td>
15072 </tr>
15073 </table>
15074 !! end
15075
15076 # Known to produce bogus xml (extra </td>)
15077 !! test
15078 Fuzz testing: Parser16
15079 !! options
15080 noxml
15081 !! wikitext
15082 {|
15083 !https://||||||
15084 !! html
15085 <table>
15086 <tr>
15087 <th>https://</th>
15088 <th></th>
15089 <th></th>
15090 <th>
15091 </td>
15092 </tr>
15093 </table>
15094
15095 !! html+tidy
15096 <table>
15097 <tr>
15098 <th>https://</th>
15099 <th></th>
15100 <th></th>
15101 <th></th>
15102 </tr>
15103 </table>
15104 !! end
15105
15106 !! test
15107 Fuzz testing: Parser21
15108 !! wikitext
15109 {|
15110 ! irc://{{ftp://a" onmouseover="alert('hello world');"
15111 |
15112 !! html
15113 <table>
15114 <tr>
15115 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
15116 </th>
15117 <td>
15118 </td>
15119 </tr>
15120 </table>
15121
15122 !! end
15123
15124 !! test
15125 Fuzz testing: Parser22
15126 !! wikitext
15127 http://===r:::https://b
15128
15129 {|
15130 !! html
15131 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
15132 </p>
15133 <table>
15134 <tr><td></td></tr>
15135 </table>
15136
15137 !! end
15138
15139 # Known to produce bad XML for now
15140 !! test
15141 Fuzz testing: Parser24
15142 !! options
15143 noxml
15144 !! wikitext
15145 {|
15146 {{{|
15147 <u CLASS=
15148 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
15149 <br style="onmouseover='alert(document.cookie);' " />
15150
15151 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15152 |
15153 !! html
15154 <table>
15155 {{{|
15156 <u class="&#124;">}}}} &gt;
15157 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
15158
15159 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15160 <tr>
15161 <td></u>
15162 </td>
15163 </tr>
15164 </table>
15165
15166 !! end
15167
15168 # Note: the current result listed for this is not what the original one was,
15169 # but the original bug was JavaScript injection, which is fixed in any case.
15170 # It's not clear that the original result listed was any more correct than the
15171 # current one. Original result:
15172 # <p>{{{|
15173 # </p>
15174 # <li class="&#124;&#124;">
15175 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15176 !!test
15177 Fuzz testing: Parser25 (bug 6055)
15178 !! wikitext
15179 {{{
15180 |
15181 <LI CLASS=||
15182 >
15183 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15184 !! html
15185 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15186 </p>
15187 !! end
15188
15189 !!test
15190 Fuzz testing: URL adjacent extension (with space, clean)
15191 !! wikitext
15192 http://example.com <nowiki>junk</nowiki>
15193 !! html
15194 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15195 </p>
15196 !!end
15197
15198 !!test
15199 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15200 !! wikitext
15201 http://example.com<nowiki>junk</nowiki>
15202 !! html
15203 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15204 </p>
15205 !!end
15206
15207 !!test
15208 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15209 !! wikitext
15210 http://example.com<pre>junk</pre>
15211 !! html
15212 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15213
15214 !! html+tidy
15215 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15216 <pre>
15217 junk
15218 </pre>
15219 !!end
15220
15221 !!test
15222 Fuzz testing: image with bogus manual thumbnail
15223 !! wikitext
15224 [[Image:foobar.jpg|thumbnail= ]]
15225 !! html/php
15226 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
15227
15228 !! html/parsoid
15229 <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>
15230 !!end
15231
15232 !! test
15233 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15234 !! wikitext
15235 <pre dir="&#10;"></pre>
15236 !! html
15237 <pre dir="&#10;"></pre>
15238
15239 !! end
15240
15241 !! test
15242 Parsing optional HTML elements (Bug 6171)
15243 !! options
15244 !! wikitext
15245 <table>
15246 <tr>
15247 <td> Some tabular data</td>
15248 <td> More tabular data ...
15249 <td> And yet som tabular data</td>
15250 </tr>
15251 </table>
15252 !! html
15253 <table>
15254 <tr>
15255 <td> Some tabular data</td>
15256 <td> More tabular data ...
15257 </td><td> And yet som tabular data</td>
15258 </tr>
15259 </table>
15260
15261 !! end
15262
15263 !! test
15264 Correct handling of <td>, <tr> (Bug 6171)
15265 !! options
15266 !! wikitext
15267 <table>
15268 <tr>
15269 <td> Some tabular data</td>
15270 <td> More tabular data ...</td>
15271 <td> And yet som tabular data</td>
15272 </tr>
15273 </table>
15274 !! html
15275 <table>
15276 <tr>
15277 <td> Some tabular data</td>
15278 <td> More tabular data ...</td>
15279 <td> And yet som tabular data</td>
15280 </tr>
15281 </table>
15282
15283 !! end
15284
15285
15286 !! test
15287 Parsing crashing regression (fr:JavaScript)
15288 !! wikitext
15289 </body></x>
15290 !! html
15291 <p>&lt;/body&gt;&lt;/x&gt;
15292 </p>
15293 !! end
15294
15295 !! test
15296 Inline wiki vs wiki block nesting
15297 !! wikitext
15298 '''Bold paragraph
15299
15300 New wiki paragraph
15301 !! html
15302 <p><b>Bold paragraph</b>
15303 </p><p>New wiki paragraph
15304 </p>
15305 !! end
15306
15307 # FIXME: The current php output is documented
15308 # and desired output is the parsoid target.
15309 !! test
15310 Inline HTML vs wiki block nesting
15311 !! wikitext
15312 <b>Bold paragraph
15313
15314 New wiki paragraph
15315 !! html/php
15316 <p><b>Bold paragraph
15317 </p><p>New wiki paragraph</b>
15318 </p>
15319 !! html/parsoid
15320 <p><b>Bold paragraph</b>
15321 </p><p>New wiki paragraph
15322 </p>
15323 !! end
15324
15325 # Original result was this:
15326 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
15327 # </p>
15328 # While that might be marginally more intuitive, maybe, the six-apostrophe
15329 # construct is clearly pathological and the result stated here (which is what
15330 # the parser actually does) is about as reasonable as anything.
15331 !!test
15332 Mixing markup for italics and bold
15333 !! options
15334 !! wikitext
15335 '''bold''''''bold''bolditalics'''''
15336 !! html
15337 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
15338 </p>
15339 !! end
15340
15341
15342 !! article
15343 Xyzzyx
15344 !! text
15345 Article for special page transclusion test
15346 !! endarticle
15347
15348 !! test
15349 Special page transclusion
15350 !! options
15351 !! wikitext
15352 {{Special:Prefixindex/Xyzzyx}}
15353 !! html
15354 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15355
15356 !! end
15357
15358 !! test
15359 Special page transclusion twice (bug 5021)
15360 !! options
15361 !! wikitext
15362 {{Special:Prefixindex/Xyzzyx}}
15363 {{Special:Prefixindex/Xyzzyx}}
15364 !! html
15365 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15366 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15367
15368 !! end
15369
15370 !! test
15371 Transclusion of default MediaWiki message
15372 !! wikitext
15373 {{MediaWiki:Mainpage}}
15374 !! html
15375 <p>Main Page
15376 </p>
15377 !! end
15378
15379 !! test
15380 Transclusion of nonexistent MediaWiki message
15381 !! wikitext
15382 {{MediaWiki:Mainpagexxx}}
15383 !! html
15384 <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>
15385 </p>
15386 !! end
15387
15388 !! test
15389 Transclusion of MediaWiki message with underscore
15390 !! wikitext
15391 {{MediaWiki:history_short}}
15392 !! html
15393 <p>History
15394 </p>
15395 !! end
15396
15397 !! test
15398 Transclusion of MediaWiki message with space
15399 !! wikitext
15400 {{MediaWiki:history short}}
15401 !! html
15402 <p>History
15403 </p>
15404 !! end
15405
15406 !! test
15407 Invalid header with following text
15408 !! wikitext
15409 = x = y
15410 !! html
15411 <p>= x = y
15412 </p>
15413 !! end
15414
15415
15416 !! test
15417 Section extraction test (section 0)
15418 !! options
15419 section=0
15420 !! wikitext
15421 start
15422 ==a==
15423 ===aa===
15424 ====aaa====
15425 ==b==
15426 ===ba===
15427 ===bb===
15428 ====bba====
15429 ===bc===
15430 ==c==
15431 ===ca===
15432 !! html
15433 start
15434 !! end
15435
15436 !! test
15437 Section extraction test (section 1)
15438 !! options
15439 section=1
15440 !! wikitext
15441 start
15442 ==a==
15443 ===aa===
15444 ====aaa====
15445 ==b==
15446 ===ba===
15447 ===bb===
15448 ====bba====
15449 ===bc===
15450 ==c==
15451 ===ca===
15452 !! html
15453 ==a==
15454 ===aa===
15455 ====aaa====
15456 !! end
15457
15458 !! test
15459 Section extraction test (section 2)
15460 !! options
15461 section=2
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 ===aa===
15476 ====aaa====
15477 !! end
15478
15479 !! test
15480 Section extraction test (section 3)
15481 !! options
15482 section=3
15483 !! wikitext
15484 start
15485 ==a==
15486 ===aa===
15487 ====aaa====
15488 ==b==
15489 ===ba===
15490 ===bb===
15491 ====bba====
15492 ===bc===
15493 ==c==
15494 ===ca===
15495 !! html
15496 ====aaa====
15497 !! end
15498
15499 !! test
15500 Section extraction test (section 4)
15501 !! options
15502 section=4
15503 !! wikitext
15504 start
15505 ==a==
15506 ===aa===
15507 ====aaa====
15508 ==b==
15509 ===ba===
15510 ===bb===
15511 ====bba====
15512 ===bc===
15513 ==c==
15514 ===ca===
15515 !! html
15516 ==b==
15517 ===ba===
15518 ===bb===
15519 ====bba====
15520 ===bc===
15521 !! end
15522
15523 !! test
15524 Section extraction test (section 5)
15525 !! options
15526 section=5
15527 !! wikitext
15528 start
15529 ==a==
15530 ===aa===
15531 ====aaa====
15532 ==b==
15533 ===ba===
15534 ===bb===
15535 ====bba====
15536 ===bc===
15537 ==c==
15538 ===ca===
15539 !! html
15540 ===ba===
15541 !! end
15542
15543 !! test
15544 Section extraction test (section 6)
15545 !! options
15546 section=6
15547 !! wikitext
15548 start
15549 ==a==
15550 ===aa===
15551 ====aaa====
15552 ==b==
15553 ===ba===
15554 ===bb===
15555 ====bba====
15556 ===bc===
15557 ==c==
15558 ===ca===
15559 !! html
15560 ===bb===
15561 ====bba====
15562 !! end
15563
15564 !! test
15565 Section extraction test (section 7)
15566 !! options
15567 section=7
15568 !! wikitext
15569 start
15570 ==a==
15571 ===aa===
15572 ====aaa====
15573 ==b==
15574 ===ba===
15575 ===bb===
15576 ====bba====
15577 ===bc===
15578 ==c==
15579 ===ca===
15580 !! html
15581 ====bba====
15582 !! end
15583
15584 !! test
15585 Section extraction test (section 8)
15586 !! options
15587 section=8
15588 !! wikitext
15589 start
15590 ==a==
15591 ===aa===
15592 ====aaa====
15593 ==b==
15594 ===ba===
15595 ===bb===
15596 ====bba====
15597 ===bc===
15598 ==c==
15599 ===ca===
15600 !! html
15601 ===bc===
15602 !! end
15603
15604 !! test
15605 Section extraction test (section 9)
15606 !! options
15607 section=9
15608 !! wikitext
15609 start
15610 ==a==
15611 ===aa===
15612 ====aaa====
15613 ==b==
15614 ===ba===
15615 ===bb===
15616 ====bba====
15617 ===bc===
15618 ==c==
15619 ===ca===
15620 !! html
15621 ==c==
15622 ===ca===
15623 !! end
15624
15625 !! test
15626 Section extraction test (section 10)
15627 !! options
15628 section=10
15629 !! wikitext
15630 start
15631 ==a==
15632 ===aa===
15633 ====aaa====
15634 ==b==
15635 ===ba===
15636 ===bb===
15637 ====bba====
15638 ===bc===
15639 ==c==
15640 ===ca===
15641 !! html
15642 ===ca===
15643 !! end
15644
15645 !! test
15646 Section extraction test (nonexistent section 11)
15647 !! options
15648 section=11
15649 !! wikitext
15650 start
15651 ==a==
15652 ===aa===
15653 ====aaa====
15654 ==b==
15655 ===ba===
15656 ===bb===
15657 ====bba====
15658 ===bc===
15659 ==c==
15660 ===ca===
15661 !! html
15662 !! end
15663
15664 !! test
15665 Section extraction test with bogus heading (section 1)
15666 !! options
15667 section=1
15668 !! wikitext
15669 ==a==
15670 ==bogus== not a legal section
15671 ==b==
15672 !! html
15673 ==a==
15674 ==bogus== not a legal section
15675 !! end
15676
15677 !! test
15678 Section extraction test with bogus heading (section 2)
15679 !! options
15680 section=2
15681 !! wikitext
15682 ==a==
15683 ==bogus== not a legal section
15684 ==b==
15685 !! html
15686 ==b==
15687 !! end
15688
15689 !! test
15690 Section extraction test with comment after heading (section 1)
15691 !! options
15692 section=1
15693 !! wikitext
15694 ==a==
15695 ==b== <!-- -->
15696 ==c==
15697 !! html
15698 ==a==
15699 !! end
15700
15701 !! test
15702 Section extraction test with comment after heading (section 2)
15703 !! options
15704 section=2
15705 !! wikitext
15706 ==a==
15707 ==b== <!-- -->
15708 ==c==
15709 !! html
15710 ==b== <!-- -->
15711 !! end
15712
15713 !! test
15714 Section extraction test with bogus <nowiki> heading (section 1)
15715 !! options
15716 section=1
15717 !! wikitext
15718 ==a==
15719 ==bogus== <nowiki>not a legal section</nowiki>
15720 ==b==
15721 !! html
15722 ==a==
15723 ==bogus== <nowiki>not a legal section</nowiki>
15724 !! end
15725
15726 !! test
15727 Section extraction test with bogus <nowiki> heading (section 2)
15728 !! options
15729 section=2
15730 !! wikitext
15731 ==a==
15732 ==bogus== <nowiki>not a legal section</nowiki>
15733 ==b==
15734 !! html
15735 ==b==
15736 !! end
15737
15738
15739 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
15740 # instead of respecting commented sections
15741 !! test
15742 Section extraction prefixed by comment (section 1)
15743 !! options
15744 section=1
15745 !! wikitext
15746 <!-- -->==sec1==
15747 ==sec2==
15748 !! html
15749 ==sec2==
15750 !!end
15751
15752 !! test
15753 Section extraction prefixed by comment (section 2)
15754 !! options
15755 section=2
15756 !! wikitext
15757 <!-- -->==sec1==
15758 ==sec2==
15759 !! html
15760
15761 !!end
15762
15763
15764 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
15765 # instead of respecting HTML-style headings
15766 !! test
15767 Section extraction, mixed wiki and html (section 1)
15768 !! options
15769 section=1
15770 !! wikitext
15771 <h2>unmarked</h2>
15772 unmarked
15773 ==1==
15774 one
15775 ==2==
15776 two
15777 !! html
15778 ==1==
15779 one
15780 !! end
15781
15782 !! test
15783 Section extraction, mixed wiki and html (section 2)
15784 !! options
15785 section=2
15786 !! wikitext
15787 <h2>unmarked</h2>
15788 unmarked
15789 ==1==
15790 one
15791 ==2==
15792 two
15793 !! html
15794 ==2==
15795 two
15796 !! end
15797
15798
15799 # Formerly testing for bug 3342
15800 !! test
15801 Section extraction, heading surrounded by <noinclude>
15802 !! options
15803 section=1
15804 !! wikitext
15805 <noinclude>==unmarked==</noinclude>
15806 ==marked==
15807 !! html
15808 ==marked==
15809 !!end
15810
15811 # Test behavior of bug 19910
15812 !! test
15813 Sectiion with all-equals
15814 !! options
15815 section=2
15816 !! wikitext
15817 ===
15818 The line above must have a trailing space
15819 === <!--
15820 --> <!-- -->
15821 But just in case it doesn't...
15822 !! html
15823 === <!--
15824 --> <!-- -->
15825 But just in case it doesn't...
15826 !! end
15827
15828 !! test
15829 Section replacement test (section 0)
15830 !! options
15831 replace=0,"xxx"
15832 !! wikitext
15833 start
15834 ==a==
15835 ===aa===
15836 ====aaa====
15837 ==b==
15838 ===ba===
15839 ===bb===
15840 ====bba====
15841 ===bc===
15842 ==c==
15843 ===ca===
15844 !! html
15845 xxx
15846
15847 ==a==
15848 ===aa===
15849 ====aaa====
15850 ==b==
15851 ===ba===
15852 ===bb===
15853 ====bba====
15854 ===bc===
15855 ==c==
15856 ===ca===
15857 !! end
15858
15859 !! test
15860 Section replacement test (section 1)
15861 !! options
15862 replace=1,"xxx"
15863 !! wikitext
15864 start
15865 ==a==
15866 ===aa===
15867 ====aaa====
15868 ==b==
15869 ===ba===
15870 ===bb===
15871 ====bba====
15872 ===bc===
15873 ==c==
15874 ===ca===
15875 !! html
15876 start
15877 xxx
15878
15879 ==b==
15880 ===ba===
15881 ===bb===
15882 ====bba====
15883 ===bc===
15884 ==c==
15885 ===ca===
15886 !! end
15887
15888 !! test
15889 Section replacement test (section 2)
15890 !! options
15891 replace=2,"xxx"
15892 !! wikitext
15893 start
15894 ==a==
15895 ===aa===
15896 ====aaa====
15897 ==b==
15898 ===ba===
15899 ===bb===
15900 ====bba====
15901 ===bc===
15902 ==c==
15903 ===ca===
15904 !! html
15905 start
15906 ==a==
15907 xxx
15908
15909 ==b==
15910 ===ba===
15911 ===bb===
15912 ====bba====
15913 ===bc===
15914 ==c==
15915 ===ca===
15916 !! end
15917
15918 !! test
15919 Section replacement test (section 3)
15920 !! options
15921 replace=3,"xxx"
15922 !! wikitext
15923 start
15924 ==a==
15925 ===aa===
15926 ====aaa====
15927 ==b==
15928 ===ba===
15929 ===bb===
15930 ====bba====
15931 ===bc===
15932 ==c==
15933 ===ca===
15934 !! html
15935 start
15936 ==a==
15937 ===aa===
15938 xxx
15939
15940 ==b==
15941 ===ba===
15942 ===bb===
15943 ====bba====
15944 ===bc===
15945 ==c==
15946 ===ca===
15947 !! end
15948
15949 !! test
15950 Section replacement test (section 4)
15951 !! options
15952 replace=4,"xxx"
15953 !! wikitext
15954 start
15955 ==a==
15956 ===aa===
15957 ====aaa====
15958 ==b==
15959 ===ba===
15960 ===bb===
15961 ====bba====
15962 ===bc===
15963 ==c==
15964 ===ca===
15965 !! html
15966 start
15967 ==a==
15968 ===aa===
15969 ====aaa====
15970 xxx
15971
15972 ==c==
15973 ===ca===
15974 !! end
15975
15976 !! test
15977 Section replacement test (section 5)
15978 !! options
15979 replace=5,"xxx"
15980 !! wikitext
15981 start
15982 ==a==
15983 ===aa===
15984 ====aaa====
15985 ==b==
15986 ===ba===
15987 ===bb===
15988 ====bba====
15989 ===bc===
15990 ==c==
15991 ===ca===
15992 !! html
15993 start
15994 ==a==
15995 ===aa===
15996 ====aaa====
15997 ==b==
15998 xxx
15999
16000 ===bb===
16001 ====bba====
16002 ===bc===
16003 ==c==
16004 ===ca===
16005 !! end
16006
16007 !! test
16008 Section replacement test (section 6)
16009 !! options
16010 replace=6,"xxx"
16011 !! wikitext
16012 start
16013 ==a==
16014 ===aa===
16015 ====aaa====
16016 ==b==
16017 ===ba===
16018 ===bb===
16019 ====bba====
16020 ===bc===
16021 ==c==
16022 ===ca===
16023 !! html
16024 start
16025 ==a==
16026 ===aa===
16027 ====aaa====
16028 ==b==
16029 ===ba===
16030 xxx
16031
16032 ===bc===
16033 ==c==
16034 ===ca===
16035 !! end
16036
16037 !! test
16038 Section replacement test (section 7)
16039 !! options
16040 replace=7,"xxx"
16041 !! wikitext
16042 start
16043 ==a==
16044 ===aa===
16045 ====aaa====
16046 ==b==
16047 ===ba===
16048 ===bb===
16049 ====bba====
16050 ===bc===
16051 ==c==
16052 ===ca===
16053 !! html
16054 start
16055 ==a==
16056 ===aa===
16057 ====aaa====
16058 ==b==
16059 ===ba===
16060 ===bb===
16061 xxx
16062
16063 ===bc===
16064 ==c==
16065 ===ca===
16066 !! end
16067
16068 !! test
16069 Section replacement test (section 8)
16070 !! options
16071 replace=8,"xxx"
16072 !! wikitext
16073 start
16074 ==a==
16075 ===aa===
16076 ====aaa====
16077 ==b==
16078 ===ba===
16079 ===bb===
16080 ====bba====
16081 ===bc===
16082 ==c==
16083 ===ca===
16084 !! html
16085 start
16086 ==a==
16087 ===aa===
16088 ====aaa====
16089 ==b==
16090 ===ba===
16091 ===bb===
16092 ====bba====
16093 xxx
16094
16095 ==c==
16096 ===ca===
16097 !!end
16098
16099 !! test
16100 Section replacement test (section 9)
16101 !! options
16102 replace=9,"xxx"
16103 !! wikitext
16104 start
16105 ==a==
16106 ===aa===
16107 ====aaa====
16108 ==b==
16109 ===ba===
16110 ===bb===
16111 ====bba====
16112 ===bc===
16113 ==c==
16114 ===ca===
16115 !! html
16116 start
16117 ==a==
16118 ===aa===
16119 ====aaa====
16120 ==b==
16121 ===ba===
16122 ===bb===
16123 ====bba====
16124 ===bc===
16125 xxx
16126 !! end
16127
16128 !! test
16129 Section replacement test (section 10)
16130 !! options
16131 replace=10,"xxx"
16132 !! wikitext
16133 start
16134 ==a==
16135 ===aa===
16136 ====aaa====
16137 ==b==
16138 ===ba===
16139 ===bb===
16140 ====bba====
16141 ===bc===
16142 ==c==
16143 ===ca===
16144 !! html
16145 start
16146 ==a==
16147 ===aa===
16148 ====aaa====
16149 ==b==
16150 ===ba===
16151 ===bb===
16152 ====bba====
16153 ===bc===
16154 ==c==
16155 xxx
16156 !! end
16157
16158 !! test
16159 Section replacement test with initial whitespace (bug 13728)
16160 !! options
16161 replace=2,"xxx"
16162 !! wikitext
16163 Preformatted initial line
16164 ==a==
16165 ===a===
16166 !! html
16167 Preformatted initial line
16168 ==a==
16169 xxx
16170 !! end
16171
16172
16173 !! test
16174 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16175 !! options
16176 section=1
16177 !! wikitext
16178 ==a==
16179 a
16180 !! html
16181 ==a==
16182 a
16183 !! end
16184
16185 !! test
16186 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16187 !! options
16188 section=1
16189 !! wikitext
16190 ==a==
16191 a
16192 !! html
16193 ==a==
16194 a
16195 !! end
16196
16197
16198 !! test
16199 Section extraction, <pre> around bogus header (bug 10309)
16200 !! options
16201 noxml section=2
16202 !! wikitext
16203 == Section One ==
16204 <pre>
16205 =======
16206 </pre>
16207
16208 == Section Two ==
16209 stuff
16210 !! html
16211 == Section Two ==
16212 stuff
16213 !! end
16214
16215 !! test
16216 Section replacement, <pre> around bogus header (bug 10309)
16217 !! options
16218 noxml replace=2,"xxx"
16219 !! wikitext
16220 == Section One ==
16221 <pre>
16222 =======
16223 </pre>
16224
16225 == Section Two ==
16226 stuff
16227 !! html
16228 == Section One ==
16229 <pre>
16230 =======
16231 </pre>
16232
16233 xxx
16234 !! end
16235
16236
16237
16238 !! test
16239 Handling of &#x0A; in URLs
16240 !! wikitext
16241 ** irc://&#x0A;a
16242 !! html/php
16243 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16244
16245 !! html/parsoid
16246 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16247 a">irc://
16248 a</a></li></ul></li></ul>
16249 !! end
16250
16251 !! test
16252 Handling of %0A in URLs
16253 !! wikitext
16254 ** irc://%0Aa
16255 !! html/php
16256 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16257
16258 !! html/parsoid
16259 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16260 !! end
16261
16262
16263 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16264 !! test
16265 5 quotes, code coverage +1 line
16266 !! options
16267 parsoid=wt2html
16268 !! wikitext
16269 '''''
16270 !! html/php
16271 !! html/parsoid
16272 <p><b><i></i></b></p>
16273 !! end
16274
16275 # same html as previous, but wikitext adjusted to match parsoid html2wt
16276 # note that wt2html and html2html will put the <i> before the <b>
16277 !! test
16278 5 quotes, code coverage +1 line w/ nowiki (1)
16279 !! options
16280 parsoid=wt2wt,html2wt
16281 !! wikitext
16282 '''''<nowiki/>'''''
16283 !! html/php
16284 <p><i></i>
16285 </p>
16286 !! html/parsoid
16287 <p><b><i></i></b></p>
16288 !! end
16289
16290 # same as previous, just swapping the <i> and <b>
16291 !! test
16292 5 quotes, code coverage +1 line w/ nowiki (2)
16293 !! wikitext
16294 '''''<nowiki/>'''''
16295 !! html/php
16296 <p><i></i>
16297 </p>
16298 !! html/parsoid
16299 <p><i><b></b></i></p>
16300 !! end
16301
16302 !! test
16303 Special:Search page linking.
16304 !! wikitext
16305 {{Special:search}}
16306 !! html
16307 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16308 </p>
16309 !! end
16310
16311 !! test
16312 {{!}} is a magic word
16313 !! wikitext
16314 {{!}} is a magic word there and {{!}} is still a magic word here
16315 !! html/php
16316 <p>| is a magic word there and | is still a magic word here
16317 </p>
16318 !! html/parsoid
16319 <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>
16320 !! end
16321
16322 !! test
16323 Say the magic word
16324 !! options
16325 title=[[Parser test]]
16326 !! wikitext
16327 * {{PAGENAME}}
16328 * {{PAGENAMEE}}
16329 * {{FULLPAGENAME}}
16330 * {{FULLPAGENAMEE}}
16331 * {{BASEPAGENAME}}
16332 * {{BASEPAGENAMEE}}
16333 * {{SUBPAGENAME}}
16334 * {{SUBPAGENAMEE}}
16335 * {{ROOTPAGENAME}}
16336 * {{ROOTPAGENAMEE}}
16337 * {{TALKPAGENAME}}
16338 * {{TALKPAGENAMEE}}
16339 * {{SUBJECTPAGENAME}}
16340 * {{SUBJECTPAGENAMEE}}
16341 * {{NAMESPACEE}}
16342 * {{NAMESPACE}}
16343 * {{NAMESPACENUMBER}}
16344 * {{TALKSPACE}}
16345 * {{TALKSPACEE}}
16346 * {{SUBJECTSPACE}}
16347 * {{SUBJECTSPACEE}}
16348 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
16349 !! html
16350 <ul><li> Parser test</li>
16351 <li> Parser_test</li>
16352 <li> Parser test</li>
16353 <li> Parser_test</li>
16354 <li> Parser test</li>
16355 <li> Parser_test</li>
16356 <li> Parser test</li>
16357 <li> Parser_test</li>
16358 <li> Parser test</li>
16359 <li> Parser_test</li>
16360 <li> Talk:Parser test</li>
16361 <li> Talk:Parser_test</li>
16362 <li> Parser test</li>
16363 <li> Parser_test</li>
16364 <li> </li>
16365 <li> </li>
16366 <li> 0</li>
16367 <li> Talk</li>
16368 <li> Talk</li>
16369 <li> </li>
16370 <li> </li>
16371 <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>
16372
16373 !! end
16374 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
16375
16376 !! test
16377 Gallery
16378 !! wikitext
16379 <gallery>
16380 image1.png |
16381 image2.gif|||||
16382
16383 image3|
16384 image4 |300px| centre
16385 image5.svg| http://///////
16386 [[x|xx]]]]
16387 * image6
16388 </gallery>
16389 !! html
16390 <ul class="gallery mw-gallery-traditional">
16391 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16392 <div class="thumb" style="height: 150px;">Image1.png</div>
16393 <div class="gallerytext">
16394 </div>
16395 </div></li>
16396 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16397 <div class="thumb" style="height: 150px;">Image2.gif</div>
16398 <div class="gallerytext">
16399 <p>||||
16400 </p>
16401 </div>
16402 </div></li>
16403 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16404 <div class="thumb" style="height: 150px;">Image3</div>
16405 <div class="gallerytext">
16406 </div>
16407 </div></li>
16408 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16409 <div class="thumb" style="height: 150px;">Image4</div>
16410 <div class="gallerytext">
16411 <p>300px| centre
16412 </p>
16413 </div>
16414 </div></li>
16415 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16416 <div class="thumb" style="height: 150px;">Image5.svg</div>
16417 <div class="gallerytext">
16418 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
16419 </p>
16420 </div>
16421 </div></li>
16422 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16423 <div class="thumb" style="height: 150px;">* image6</div>
16424 <div class="gallerytext">
16425 </div>
16426 </div></li>
16427 </ul>
16428
16429 !! end
16430
16431 !! test
16432 Gallery (with options)
16433 !! wikitext
16434 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
16435 File:Nonexistant.jpg|caption
16436 File:Nonexistant.jpg
16437 image:foobar.jpg|some '''caption''' [[Main Page]]
16438 image:foobar.jpg
16439 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
16440 </gallery>
16441 !! html
16442 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
16443 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
16444 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16445 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
16446 <div class="gallerytext">
16447 <p>caption
16448 </p>
16449 </div>
16450 </div></li>
16451 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16452 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
16453 <div class="gallerytext">
16454 </div>
16455 </div></li>
16456 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16457 <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>
16458 <div class="gallerytext">
16459 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16460 </p>
16461 </div>
16462 </div></li>
16463 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16464 <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>
16465 <div class="gallerytext">
16466 </div>
16467 </div></li>
16468 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16469 <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>
16470 <div class="gallerytext">
16471 <p>Blabla|blabla.
16472 </p>
16473 </div>
16474 </div></li>
16475 </ul>
16476
16477 !! end
16478
16479 !! test
16480 Gallery with link that has fragment
16481 !! wikitext
16482 <gallery>
16483 image:foobar.jpg|link=Main_Page
16484 image:foobar.jpg|link=Main_Page#section
16485 image:foobar.jpg|link=Main Page#section|caption
16486 </gallery>
16487 !! html
16488 <ul class="gallery mw-gallery-traditional">
16489 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16490 <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>
16491 <div class="gallerytext">
16492 </div>
16493 </div></li>
16494 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16495 <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>
16496 <div class="gallerytext">
16497 </div>
16498 </div></li>
16499 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16500 <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>
16501 <div class="gallerytext">
16502 <p>caption
16503 </p>
16504 </div>
16505 </div></li>
16506 </ul>
16507
16508 !! end
16509
16510 !! test
16511 Gallery with wikitext inside caption
16512 !! wikitext
16513 <gallery>
16514 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
16515 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
16516 </gallery>
16517 !! html
16518 <ul class="gallery mw-gallery-traditional">
16519 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16520 <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>
16521 <div class="gallerytext">
16522 <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>
16523 </p>
16524 </div>
16525 </div></li>
16526 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16527 <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>
16528 <div class="gallerytext">
16529 <p>This is a test template
16530 </p>
16531 </div>
16532 </div></li>
16533 </ul>
16534
16535 !! end
16536
16537 !! test
16538 gallery (with showfilename option)
16539 !! wikitext
16540 <gallery showfilename>
16541 File:Nonexistant.jpg|caption
16542 File:Nonexistant.jpg
16543 image:foobar.jpg|some '''caption''' [[Main Page]]
16544 File:Foobar.jpg
16545 </gallery>
16546 !! html
16547 <ul class="gallery mw-gallery-traditional">
16548 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16549 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16550 <div class="gallerytext">
16551 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
16552 caption
16553 </p>
16554 </div>
16555 </div></li>
16556 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16557 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16558 <div class="gallerytext">
16559 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
16560 </p>
16561 </div>
16562 </div></li>
16563 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16564 <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>
16565 <div class="gallerytext">
16566 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16567 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16568 </p>
16569 </div>
16570 </div></li>
16571 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16572 <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>
16573 <div class="gallerytext">
16574 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16575 </p>
16576 </div>
16577 </div></li>
16578 </ul>
16579
16580 !! end
16581
16582 !! test
16583 Gallery (with namespace-less filenames)
16584 !! wikitext
16585 <gallery>
16586 File:Nonexistant.jpg
16587 Nonexistant.jpg
16588 image:foobar.jpg
16589 foobar.jpg
16590 </gallery>
16591 !! html
16592 <ul class="gallery mw-gallery-traditional">
16593 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16594 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16595 <div class="gallerytext">
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 </div>
16602 </div></li>
16603 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16604 <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>
16605 <div class="gallerytext">
16606 </div>
16607 </div></li>
16608 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16609 <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>
16610 <div class="gallerytext">
16611 </div>
16612 </div></li>
16613 </ul>
16614
16615 !! end
16616
16617 !! test
16618 HTML Hex character encoding (spells the word "JavaScript")
16619 !! options
16620 parsoid=wt2html,wt2wt,html2html
16621 !! wikitext
16622 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
16623 !! html/php
16624 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
16625 </p>
16626 !! html/php+tidy
16627 <p>JavaScript</p>
16628 !! html/parsoid
16629 <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>
16630 !! end
16631
16632 !! test
16633 HTML Hex character encoding bogus encoding (bug 26437 regression check)
16634 !! wikitext
16635 &#xsee;&#XSEE;
16636 !! html/php
16637 <p>&amp;#xsee;&amp;#XSEE;
16638 </p>
16639 !! html/parsoid
16640 <p>&amp;#xsee;&amp;#XSEE;</p>
16641 !! end
16642
16643 !! test
16644 HTML Hex character encoding mixed case
16645 !! options
16646 parsoid=wt2html,wt2wt,html2html
16647 !! wikitext
16648 &#xEE;&#Xee;
16649 !! html/php
16650 <p>&#xee;&#xee;
16651 </p>
16652 !! html/php+tidy
16653 <p>îî</p>
16654 !! html/parsoid
16655 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
16656 !! end
16657
16658 !! test
16659 __FORCETOC__ override
16660 !! wikitext
16661 __NEWSECTIONLINK__
16662 __FORCETOC__
16663 !! html
16664 <p><br />
16665 </p>
16666 !! end
16667
16668 !! test
16669 ISBN code coverage
16670 !! wikitext
16671 ISBN 978-0-1234-56&#x20;789
16672 !! html
16673 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
16674 </p>
16675 !! html+tidy
16676 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
16677 !! end
16678
16679 !! test
16680 ISBN followed by 5 spaces
16681 !! wikitext
16682 ISBN
16683 !! html
16684 <p>ISBN
16685 </p>
16686 !! end
16687
16688 !! test
16689 Double ISBN
16690 !! wikitext
16691 ISBN ISBN 1234567890
16692 !! html
16693 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16694 </p>
16695 !! end
16696
16697 !! test
16698 ISBN with an X
16699 !! wikitext
16700 ISBN 3-462-04561-X
16701 !! html
16702 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
16703 </p>
16704 !! end
16705
16706 !! test
16707 ISBN with empty prefix (parsoid test)
16708 !! wikitext
16709 ISBN 1234567890
16710 !! html/parsoid
16711 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
16712 !! end
16713
16714 !! test
16715 Bug 22905: <abbr> followed by ISBN followed by </a>
16716 !! wikitext
16717 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
16718 !! html
16719 <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>
16720 </p>
16721 !! end
16722
16723 !! test
16724 Double RFC
16725 !! wikitext
16726 RFC RFC 1234
16727 !! html
16728 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
16729 </p>
16730 !! end
16731
16732 !! test
16733 Double RFC with a wiki link
16734 !! wikitext
16735 RFC [[RFC 1234]]
16736 !! html
16737 <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>
16738 </p>
16739 !! end
16740
16741 !! test
16742 RFC code coverage
16743 !! wikitext
16744 RFC 983&#x20;987
16745 !! html
16746 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
16747 </p>
16748 !! html+tidy
16749 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
16750 !! end
16751
16752 !! test
16753 Centre-aligned image
16754 !! wikitext
16755 [[Image:foobar.jpg|centre]]
16756 !! html
16757 <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>
16758
16759 !!end
16760
16761 !! test
16762 None-aligned image
16763 !! wikitext
16764 [[Image:foobar.jpg|none]]
16765 !! html
16766 <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>
16767
16768 !!end
16769
16770 !! test
16771 Width + Height sized image (using px) (height is ignored)
16772 !! wikitext
16773 [[Image:foobar.jpg|640x480px]]
16774 !! html
16775 <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>
16776 </p>
16777 !!end
16778
16779 !! test
16780 Width-sized image (using px, no following whitespace)
16781 !! wikitext
16782 [[Image:foobar.jpg|640px]]
16783 !! html
16784 <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>
16785 </p>
16786 !!end
16787
16788 !! test
16789 Width-sized image (using px, with following whitespace - test regression from r39467)
16790 !! wikitext
16791 [[Image:foobar.jpg|640px ]]
16792 !! html
16793 <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>
16794 </p>
16795 !!end
16796
16797 !! test
16798 Width-sized image (using px, with preceding whitespace - test regression from r39467)
16799 !! wikitext
16800 [[Image:foobar.jpg| 640px]]
16801 !! html
16802 <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>
16803 </p>
16804 !!end
16805
16806 !! test
16807 Image with page parameter
16808 !! options
16809 djvu
16810 !! wikitext
16811 [[File:LoremIpsum.djvu|page=2]]
16812 !! html/php
16813 <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>
16814 </p>
16815 !! html/parsoid
16816 <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>
16817 !! end
16818
16819 !! test
16820 Another italics / bold test
16821 !! wikitext
16822 ''' ''x'
16823 !! html
16824 <pre>'<i> </i>x'
16825 </pre>
16826 !!end
16827
16828 # FIXME: The php output seems broken. It's interleaving some open/close tags.
16829 !! test
16830 dt/dd/dl test
16831 !! wikitext
16832 :;;;::
16833 !! html/php
16834 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
16835
16836 !! html/parsoid
16837 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
16838
16839 !!end
16840
16841
16842 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
16843 !! test
16844 Images with the "|" character in the comment
16845 !! wikitext
16846 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
16847 !! html/php
16848 <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>
16849
16850 !! html/parsoid
16851 <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>
16852 !! end
16853
16854 !! test
16855 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
16856 !! wikitext
16857 <html><script>alert(1);</script></html>
16858 !! html
16859 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
16860 </p>
16861 !! end
16862
16863 !! test
16864 HTML with raw HTML ($wgRawHtml==true)
16865 !! options
16866 wgRawHtml=1
16867 !! wikitext
16868 <html><script>alert(1);</script></html>
16869 !! html
16870 <p><script>alert(1);</script>
16871 </p>
16872 !! end
16873
16874 !! test
16875 Parents of subpages, one level up
16876 !! options
16877 subpage title=[[Subpage test/L1/L2/L3]]
16878 !! wikitext
16879 [[../|L2]]
16880 !! html
16881 <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>
16882 </p>
16883 !! end
16884
16885
16886 !! test
16887 Parents of subpages, one level up, not named
16888 !! options
16889 subpage title=[[Subpage test/L1/L2/L3]]
16890 !! wikitext
16891 [[../]]
16892 !! html
16893 <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>
16894 </p>
16895 !! end
16896
16897
16898
16899 !! test
16900 Parents of subpages, two levels up
16901 !! options
16902 subpage title=[[Subpage test/L1/L2/L3]]
16903 !! wikitext
16904 [[../../|L1]]2
16905
16906 [[../../|L1]]l
16907 !! html
16908 <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
16909 </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>
16910 </p>
16911 !! end
16912
16913 !! test
16914 Parents of subpages, two levels up, without trailing slash or name.
16915 !! options
16916 subpage title=[[Subpage test/L1/L2/L3]]
16917 !! wikitext
16918 [[../..]]
16919 !! html
16920 <p>[[../..]]
16921 </p>
16922 !! end
16923
16924 !! test
16925 Parents of subpages, two levels up, with lots of extra trailing slashes.
16926 !! options
16927 subpage title=[[Subpage test/L1/L2/L3]]
16928 !! wikitext
16929 [[../../////]]
16930 !! html
16931 <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>
16932 </p>
16933 !! end
16934
16935 !! article
16936 Subpage test/L1/L2/L3Sibling
16937 !! text
16938 Sibling article
16939 !! endarticle
16940
16941 !! test
16942 Transclusion of a sibling page (one level up)
16943 !! options
16944 subpage title=[[Subpage test/L1/L2/L3]]
16945 !! wikitext
16946 {{../L3Sibling}}
16947 !! html
16948 <p>Sibling article
16949 </p>
16950 !! end
16951
16952 !! test
16953 Transclusion of a child page
16954 !! options
16955 subpage title=[[Subpage test/L1/L2]]
16956 !! wikitext
16957 {{/L3Sibling}}
16958 !! html
16959 <p>Sibling article
16960 </p>
16961 !! end
16962
16963 !! test
16964 Non-transclusion because of too many up levels
16965 !! options
16966 subpage title=[[Subpage test/L1/L2/L3]]
16967 !! wikitext
16968 {{../../../../More than parent}}
16969 !! html
16970 <p>{{../../../../More than parent}}
16971 </p>
16972 !! end
16973
16974 !! test
16975 Definition list code coverage
16976 !! wikitext
16977 ; title : def
16978 ; title : def
16979 ;title: def
16980 !! html/php
16981 <dl><dt> title &#160;</dt>
16982 <dd> def</dd>
16983 <dt> title&#160;</dt>
16984 <dd> def</dd>
16985 <dt>title</dt>
16986 <dd> def</dd></dl>
16987
16988 !! html/parsoid
16989 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
16990 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
16991 <dt>title</dt><dd> def</dd></dl>
16992 !! end
16993
16994 !! test
16995 Don't fall for the self-closing div
16996 !! wikitext
16997 <div>hello world</div/>
16998 !! html
16999 <div>hello world</div>
17000
17001 !! end
17002
17003 !! test
17004 MSGNW magic word
17005 !! wikitext
17006 {{MSGNW:msg}}
17007 !! html
17008 <p>&#91;&#91;:Template:Msg&#93;&#93;
17009 </p>
17010 !! end
17011
17012 !! test
17013 RAW magic word
17014 !! wikitext
17015 {{RAW:QUERTY}}
17016 !! html
17017 <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>
17018 </p>
17019 !! end
17020
17021 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
17022 !! test
17023 Always escape literal '>' in output, not just after '<'
17024 !! wikitext
17025 ><>
17026 !! html
17027 <p>&gt;&lt;&gt;
17028 </p>
17029 !! end
17030
17031 !! test
17032 Template caching
17033 !! wikitext
17034 {{Test}}
17035 {{Test}}
17036 !! html
17037 <p>This is a test template
17038 This is a test template
17039 </p>
17040 !! end
17041
17042
17043 !! article
17044 MediaWiki:Fake
17045 !! text
17046 ==header==
17047 !! endarticle
17048
17049 !! test
17050 Inclusion of !userCanEdit() content
17051 !! wikitext
17052 {{MediaWiki:Fake}}
17053 !! html
17054 <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>
17055
17056 !! end
17057
17058
17059 !! test
17060 Out-of-order TOC heading levels
17061 !! wikitext
17062 ==2==
17063 ======6======
17064 ===3===
17065 =1=
17066 =====5=====
17067 ==2==
17068 !! html
17069 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17070 <ul>
17071 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
17072 <ul>
17073 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
17074 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
17075 </ul>
17076 </li>
17077 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
17078 <ul>
17079 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
17080 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
17081 </ul>
17082 </li>
17083 </ul>
17084 </div>
17085
17086 <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>
17087 <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>
17088 <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>
17089 <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>
17090 <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>
17091 <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>
17092
17093 !! end
17094
17095
17096 !! test
17097 ISBN with a dummy number
17098 !! wikitext
17099 ISBN ---
17100 !! html
17101 <p>ISBN ---
17102 </p>
17103 !! end
17104
17105
17106 !! test
17107 ISBN with space-delimited number
17108 !! wikitext
17109 ISBN 92 9017 032 8
17110 !! html
17111 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
17112 </p>
17113 !! end
17114
17115
17116 !! test
17117 ISBN with multiple spaces, no number
17118 !! wikitext
17119 ISBN foo
17120 !! html
17121 <p>ISBN foo
17122 </p>
17123 !! end
17124
17125
17126 !! test
17127 ISBN length
17128 !! wikitext
17129 ISBN 123456789
17130
17131 ISBN 1234567890
17132
17133 ISBN 12345678901
17134 !! html
17135 <p>ISBN 123456789
17136 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17137 </p><p>ISBN 12345678901
17138 </p>
17139 !! end
17140
17141
17142 !! test
17143 ISBN with trailing year (bug 8110)
17144 !! wikitext
17145 ISBN 1-234-56789-0 - 2006
17146
17147 ISBN 1 234 56789 0 - 2006
17148 !! html
17149 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
17150 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
17151 </p>
17152 !! end
17153
17154
17155 !! test
17156 anchorencode
17157 !! wikitext
17158 {{anchorencode:foo bar©#%n}}
17159 !! html
17160 <p>foo_bar.C2.A9.23.25n
17161 </p>
17162 !! end
17163
17164 !! test
17165 anchorencode trims spaces
17166 !! wikitext
17167 {{anchorencode: __pretty__please__}}
17168 !! html
17169 <p>pretty_please
17170 </p>
17171 !! end
17172
17173 !! test
17174 anchorencode deals with links
17175 !! wikitext
17176 {{anchorencode: [[hello|world]] [[hi]]}}
17177 !! html
17178 <p>world_hi
17179 </p>
17180 !! end
17181
17182 !! test
17183 anchorencode deals with templates
17184 !! wikitext
17185 {{anchorencode: {{Foo}} }}
17186 !! html
17187 <p>FOO
17188 </p>
17189 !! end
17190
17191 !! test
17192 anchorencode encodes like the TOC generator: (bug 18431)
17193 !! wikitext
17194 === _ +:.3A%3A&&amp;]] ===
17195 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17196 __NOEDITSECTION__
17197 !! html
17198 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17199 <p>.2B:.3A.253A.26.26.5D.5D
17200 </p>
17201 !! end
17202
17203 !! test
17204 Bug 6200: blockquotes and paragraph formatting
17205 !! wikitext
17206 <blockquote>
17207 foo
17208 </blockquote>
17209
17210 bar
17211
17212 baz
17213 !! html
17214 <blockquote>
17215 <p>foo
17216 </p>
17217 </blockquote>
17218 <p>bar
17219 </p>
17220 <pre>baz
17221 </pre>
17222 !! end
17223
17224 !! test
17225 Bug 8293: Use of center tag ruins paragraph formatting
17226 !! wikitext
17227 <center>
17228 foo
17229 </center>
17230
17231 bar
17232
17233 baz
17234 !! html
17235 <center>
17236 <p>foo
17237 </p>
17238 </center>
17239 <p>bar
17240 </p>
17241 <pre>baz
17242 </pre>
17243 !! end
17244
17245 !!test
17246 Parsing of overlapping (improperly nested) inline html tags
17247 !! wikitext
17248 <span><s>x</span></s>
17249 !! html/php
17250 <p><span><s>x&lt;/span&gt;</s></span>
17251 </p>
17252 !! html/parsoid
17253 <p><span><s>x</s></span>
17254 </p>
17255 !!end
17256
17257 ###
17258 ### Language variants related tests
17259 ###
17260 !! test
17261 Self-link in language variants
17262 !! options
17263 title=[[Dunav]] language=sr
17264 !! wikitext
17265 Both [[Dunav]] and [[Дунав]] are names for this river.
17266 !! html
17267 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17268 </p>
17269 !!end
17270
17271 !! article
17272 Дуна
17273 !! text
17274 content
17275 !! endarticle
17276
17277 !! test
17278 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17279 !! options
17280 title=[[Duna]] language=sr
17281 !! wikitext
17282 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17283 !! html
17284 <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.
17285 </p>
17286 !! end
17287
17288 !! test
17289 Link to a section of a variant of this title shouldn't be parsed as self-link
17290 !! options
17291 title=[[Duna]] language=sr
17292 !! wikitext
17293 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
17294 !! html
17295 <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.
17296 </p>
17297 !! end
17298
17299 !! test
17300 Link to pages in language variants
17301 !! options
17302 language=sr
17303 !! wikitext
17304 Main Page can be written as [[Маин Паге]]
17305 !! html
17306 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
17307 </p>
17308 !!end
17309
17310
17311 !! test
17312 Multiple links to pages in language variants
17313 !! options
17314 language=sr
17315 !! wikitext
17316 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
17317 !! html
17318 <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>.
17319 </p>
17320 !!end
17321
17322
17323 !! test
17324 Simple template in language variants
17325 !! options
17326 language=sr
17327 !! wikitext
17328 {{тест}}
17329 !! html
17330 <p>This is a test template
17331 </p>
17332 !! end
17333
17334
17335 !! test
17336 Template with explicit namespace in language variants
17337 !! options
17338 language=sr
17339 !! wikitext
17340 {{Template:тест}}
17341 !! html
17342 <p>This is a test template
17343 </p>
17344 !! end
17345
17346
17347 !! test
17348 Basic test for template parameter in language variants
17349 !! options
17350 language=sr
17351 !! wikitext
17352 {{парамтест|param=foo}}
17353 !! html
17354 <p>This is a test template with parameter foo
17355 </p>
17356 !! end
17357
17358
17359 !! test
17360 Simple category in language variants
17361 !! options
17362 language=sr cat
17363 !! wikitext
17364 [[Category:МедиаWики Усер'с Гуиде]]
17365 !! html
17366 <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>
17367 !! end
17368
17369
17370 !! article
17371 Category:分类
17372 !! text
17373 blah
17374 !! endarticle
17375
17376 !! article
17377 Category:分類
17378 !! text
17379 blah
17380 !! endarticle
17381
17382 !! test
17383 Don't convert blue categorylinks to another variant (bug 33210)
17384 !! options
17385 language=zh cat
17386 !! wikitext
17387 [[A]][[Category:分类]]
17388 !! html
17389 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
17390 !! end
17391
17392
17393 !! test
17394 Stripping -{}- tags (language variants)
17395 !! options
17396 language=sr
17397 !! wikitext
17398 Latin proverb: -{Ne nuntium necare}-
17399 !! html
17400 <p>Latin proverb: Ne nuntium necare
17401 </p>
17402 !! end
17403
17404
17405 !! test
17406 Prevent conversion with -{}- tags (language variants)
17407 !! options
17408 language=sr variant=sr-ec
17409 !! wikitext
17410 Latinski: -{Ne nuntium necare}-
17411 !! html
17412 <p>Латински: Ne nuntium necare
17413 </p>
17414 !! end
17415
17416
17417 !! test
17418 Prevent conversion of text with -{}- tags (language variants)
17419 !! options
17420 language=sr variant=sr-ec
17421 !! wikitext
17422 Latinski: -{Ne nuntium necare}-
17423 !! html
17424 <p>Латински: Ne nuntium necare
17425 </p>
17426 !! end
17427
17428
17429 !! test
17430 Prevent conversion of links with -{}- tags (language variants)
17431 !! options
17432 language=sr variant=sr-ec
17433 !! wikitext
17434 -{[[Main Page]]}-
17435 !! html
17436 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17437 </p>
17438 !! end
17439
17440
17441 !! test
17442 -{}- tags within headlines (within html for parserConvert())
17443 !! options
17444 language=sr variant=sr-ec
17445 !! wikitext
17446 == -{Naslov}- ==
17447 !! html
17448 <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>
17449
17450 !! end
17451
17452
17453 !! test
17454 Explicit definition of language variant alternatives
17455 !! options
17456 language=zh variant=zh-tw
17457 !! wikitext
17458 -{zh:China;zh-tw:Taiwan}-, not China
17459 !! html
17460 <p>Taiwan, not China
17461 </p>
17462 !! end
17463
17464
17465 !! test
17466 Conversion around HTML tags
17467 !! options
17468 language=sr variant=sr-ec
17469 !! wikitext
17470 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
17471 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
17472 !! html
17473 <p>
17474 <span title="ЛаCтин">ски</span>
17475 </p>
17476 !! end
17477
17478
17479 !! test
17480 Explicit session-wise language variant mapping (A flag and - flag)
17481 !! options
17482 language=zh variant=zh-tw
17483 !! wikitext
17484 Taiwan is not China.
17485 But -{A|zh:China;zh-tw:Taiwan}- is China,
17486 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
17487 and -{China}- is China.
17488 !! html
17489 <p>Taiwan is not China.
17490 But Taiwan is Taiwan,
17491 (This should be stripped!)
17492 and China is China.
17493 </p>
17494 !! end
17495
17496 !! test
17497 Explicit session-wise language variant mapping (H flag for hide)
17498 !! options
17499 language=zh variant=zh-tw
17500 !! wikitext
17501 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
17502 Taiwan is China.
17503 !! html
17504 <p>(This should be stripped!)
17505 Taiwan is Taiwan.
17506 </p>
17507 !! end
17508
17509 !! test
17510 Adding explicit conversion rule for title (T flag)
17511 !! options
17512 language=zh variant=zh-tw showtitle
17513 !! wikitext
17514 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17515 !! html
17516 Taiwan
17517 <p>Should be stripped!
17518 </p>
17519 !! end
17520
17521 !! test
17522 Testing that changing the language variant here in the tests actually works
17523 !! options
17524 language=zh variant=zh showtitle
17525 !! wikitext
17526 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17527 !! html
17528 China
17529 <p>Should be stripped!
17530 </p>
17531 !! end
17532
17533 !! test
17534 Recursive conversion of alt and title attrs shouldn't clear converter state
17535 !! options
17536 language=zh variant=zh-cn showtitle
17537 !! wikitext
17538 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
17539 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
17540 !! html
17541 China
17542 <p>
17543 Should be stripped<span title="Exclamation">!</span>
17544 </p>
17545 !! end
17546
17547 !! test
17548 Bug 24072: more test on conversion rule for title
17549 !! options
17550 language=zh variant=zh-tw showtitle
17551 !! wikitext
17552 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17553 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
17554 !! html
17555 Taiwan
17556 <p>This should be stripped!
17557 This won't take interferes with the title rule.
17558 </p>
17559 !! end
17560
17561 !! test
17562 Partly disable title conversion if variant == main language code
17563 !! options
17564 language=zh variant=zh title=[[ZH]] showtitle
17565 !! wikitext
17566 -{T|zh-cn:CN;zh-tw:TW}-
17567 !! html
17568 ZH
17569 <p>
17570 </p>
17571 !! end
17572
17573 !! test
17574 Partly disable title conversion if variant == main language code, more
17575 !! options
17576 language=zh variant=zh title=[[ZH]] showtitle
17577 !! wikitext
17578 -{T|TW}-
17579 !! html
17580 ZH
17581 <p>
17582 </p>
17583 !! end
17584
17585 !! test
17586 Raw output of variant escape tags (R flag)
17587 !! options
17588 language=zh variant=zh-tw
17589 !! wikitext
17590 Raw: -{R|zh:China;zh-tw:Taiwan}-
17591 !! html
17592 <p>Raw: zh:China;zh-tw:Taiwan
17593 </p>
17594 !! end
17595
17596 !! test
17597 Nested using of manual convert syntax
17598 !! options
17599 language=zh variant=zh-hk
17600 !! wikitext
17601 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
17602 !! html
17603 <p>Nested: Hello Hong Kong!
17604 </p>
17605 !! end
17606
17607 !! test
17608 Proper conversion of text in external links
17609 !! options
17610 language=sr variant=sr-ec
17611 !! wikitext
17612 http://www.google.com
17613 gopher://www.google.com
17614 [http://www.google.com http://www.google.com]
17615 [gopher://www.google.com gopher://www.google.com]
17616 [https://www.google.com irc://www.google.com]
17617 [ftp://www.google.com www.google.com/ftp://dir]
17618 [//www.google.com www.google.com]
17619 !! html
17620 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17621 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17622 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17623 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17624 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
17625 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
17626 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
17627 </p>
17628 !! end
17629
17630 !! test
17631 Do not convert roman numbers to language variants
17632 !! options
17633 language=sr variant=sr-ec
17634 !! wikitext
17635 Fridrih IV je car.
17636 !! html
17637 <p>Фридрих IV је цар.
17638 </p>
17639 !! end
17640
17641 !! test
17642 Unclosed language converter markup "-{"
17643 !! options
17644 language=sr
17645 !! wikitext
17646 -{T|hello
17647 !! html
17648 <p>-{T|hello
17649 </p>
17650 !! end
17651
17652 !! test
17653 Don't convert raw rule "-{R|=&gt;}-" to "=>"
17654 !! options
17655 language=sr
17656 !! wikitext
17657 -{R|=&gt;}-
17658 !! html
17659 <p>=&gt;
17660 </p>
17661 !!end
17662
17663 !! test
17664 Don't break link parsing if language converter markup is in the caption.
17665 !! options
17666 language=sr variant=sr-ec
17667 !! wikitext
17668 [[Main Page|-{R|main page}-]]
17669 !! html
17670 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
17671 </p>
17672 !! end
17673
17674 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17675 !! test
17676 Don't break image parsing if language converter markup is in the caption.
17677 !! options
17678 language=sr
17679 !! wikitext
17680 [[File:Foobar.jpg|-{R|caption}-]]
17681 !! html/parsoid
17682 <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>
17683 </p>
17684 !! end
17685
17686 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17687 !! test
17688 Don't break list handling if language converter markup is in the item.
17689 !! options
17690 language=zh variant=zh-cn
17691 !! wikitext
17692 ;-{zh-cn:AAA;zh-tw:BBB}-
17693 !! html/php
17694 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
17695
17696 !! html/parsoid
17697 <dl><dt>AAA
17698 </dt></dl>
17699 !! end
17700
17701 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17702 !! test
17703 Don't break table handling if language converter markup is in the cell.
17704 !! options
17705 language=sr variant=sr-ec
17706 !! wikitext
17707 {|
17708 |-
17709 | -{R|B}-
17710 |}
17711 !! html/php
17712 <table>
17713
17714 <tr>
17715 <td>Б}-
17716 </td></tr></table>
17717
17718 !! html/parsoid
17719 <table>
17720
17721 <tr>
17722 <td> B
17723 </td></tr></table>
17724
17725 !! end
17726
17727 !! test
17728 Bug 529: Uncovered bullet
17729 !! wikitext
17730 * Foo {{bullet}}
17731 !! html
17732 <ul><li> Foo </li>
17733 <li> Bar</li></ul>
17734
17735 !! end
17736
17737 # Plain MediaWiki does not remove empty lists, but tidy actually does.
17738 # Templates in Wikipedia rely on this behavior, as tidy has always been
17739 # enabled there. These tests are normally run *without* tidy, so specify the
17740 # full output here.
17741 # To test realistic parsing behavior, apply a tidy-like transformation to both
17742 # the expected output and your parser's output.
17743 !! test
17744 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
17745 !! wikitext
17746 ******* Foo {{bullet}}
17747 !! html
17748 <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>
17749 <li> Bar</li></ul>
17750
17751 !! end
17752
17753 !! test
17754 Bug 529: Uncovered table already at line-start
17755 !! wikitext
17756 x
17757
17758 {{table}}
17759 y
17760 !! html
17761 <p>x
17762 </p>
17763 <table>
17764 <tr>
17765 <td> 1 </td>
17766 <td> 2
17767 </td></tr>
17768 <tr>
17769 <td> 3 </td>
17770 <td> 4
17771 </td></tr></table>
17772 <p>y
17773 </p>
17774 !! end
17775
17776 !! test
17777 Bug 529: Uncovered bullet in parser function result
17778 !! wikitext
17779 * Foo {{lc:{{bullet}} }}
17780 !! html
17781 <ul><li> Foo </li>
17782 <li> bar</li></ul>
17783
17784 !! end
17785
17786 !! test
17787 Bug 5678: Double-parsed template argument
17788 !! wikitext
17789 {{lc:{{{1}}}|hello}}
17790 !! html
17791 <p>{{{1}}}
17792 </p>
17793 !! end
17794
17795 !! test
17796 Bug 5678: Double-parsed template invocation
17797 !! wikitext
17798 {{lc:{{paramtest {{!}} param = hello }} }}
17799 !! html
17800 <p>{{paramtest | param = hello }}
17801 </p>
17802 !! end
17803
17804 !! test
17805 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
17806 !! options
17807 language=cs
17808 title=[[Main Page]]
17809 !! wikitext
17810 {{PRVNÍVELKÉ:ěščř}}
17811 {{prvnívelké:ěščř}}
17812 {{PRVNÍMALÉ:ěščř}}
17813 {{prvnímalé:ěščř}}
17814 {{MALÁ:ěščř}}
17815 {{malá:ěščř}}
17816 {{VELKÁ:ěščř}}
17817 {{velká:ěščř}}
17818 !! html
17819 <p>Ěščř
17820 Ěščř
17821 ěščř
17822 ěščř
17823 ěščř
17824 ěščř
17825 ĚŠČŘ
17826 ĚŠČŘ
17827 </p>
17828 !! end
17829
17830 !! test
17831 Morwen/13: Unclosed link followed by heading
17832 !! wikitext
17833 [[link
17834 ==heading==
17835 !! html
17836 <p>[[link
17837 </p>
17838 <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>
17839
17840 !! end
17841
17842 !! test
17843 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
17844 !! wikitext
17845 {{foo|
17846 =heading=
17847 !! html
17848 <p>{{foo|
17849 </p>
17850 <h1><span class="mw-headline" id="heading">heading</span></h1>
17851
17852 !! end
17853
17854 !! test
17855 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
17856 !! wikitext
17857 {{foo|
17858 ==heading==
17859 !! html
17860 <p>{{foo|
17861 </p>
17862 <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>
17863
17864 !! end
17865
17866 !! test
17867 Tildes in comments
17868 !! options
17869 pst
17870 !! wikitext
17871 <!-- ~~~~ -->
17872 !! html
17873 <!-- ~~~~ -->
17874 !! end
17875
17876 !! test
17877 Paragraphs inside divs (no extra line breaks)
17878 !! wikitext
17879 <div>Line one
17880
17881 Line two</div>
17882 !! html
17883 <div>Line one
17884 Line two</div>
17885
17886 !! end
17887
17888 !! test
17889 Paragraphs inside divs (extra line break on open)
17890 !! wikitext
17891 <div>
17892 Line one
17893
17894 Line two</div>
17895 !! html
17896 <div>
17897 <p>Line one
17898 </p>
17899 Line two</div>
17900
17901 !! end
17902
17903 !! test
17904 Paragraphs inside divs (extra line break on close)
17905 !! wikitext
17906 <div>Line one
17907
17908 Line two
17909 </div>
17910 !! html
17911 <div>Line one
17912 <p>Line two
17913 </p>
17914 </div>
17915
17916 !! end
17917
17918 !! test
17919 Paragraphs inside divs (extra line break on open and close)
17920 !! wikitext
17921 <div>
17922 Line one
17923
17924 Line two
17925 </div>
17926 !! html
17927 <div>
17928 <p>Line one
17929 </p><p>Line two
17930 </p>
17931 </div>
17932
17933 !! end
17934
17935 !! test
17936 Nesting tags, paragraphs on lines which begin with <div>
17937 !! wikitext
17938 <div></div><strong>A
17939 B</strong>
17940 !! html/php+tidy
17941 <p><strong>A</strong></p>
17942 <p><strong>B</strong></p>
17943 !! html/parsoid
17944 <div></div>
17945 <p><strong>A
17946 B</strong>
17947 </p>
17948 !! end
17949
17950 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
17951 !! test
17952 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
17953 !! wikitext
17954 <blockquote>Line one
17955
17956 Line two</blockquote>
17957 !! html
17958 <blockquote>Line one
17959 Line two</blockquote>
17960
17961 !! html+tidy
17962 <blockquote>
17963 <p>Line one Line two</p>
17964 </blockquote>
17965 !! end
17966
17967 !! test
17968 Bug 6200: paragraphs inside blockquotes (extra line break on open)
17969 !! wikitext
17970 <blockquote>
17971 Line one
17972
17973 Line two</blockquote>
17974 !! html
17975 <blockquote>
17976 <p>Line one
17977 </p>
17978 Line two</blockquote>
17979
17980 !! html+tidy
17981 <blockquote>
17982 <p>Line one</p>
17983 Line two</blockquote>
17984 !! end
17985
17986 !! test
17987 Bug 6200: paragraphs inside blockquotes (extra line break on close)
17988 !! wikitext
17989 <blockquote>Line one
17990
17991 Line two
17992 </blockquote>
17993 !! html
17994 <blockquote>Line one
17995 <p>Line two
17996 </p>
17997 </blockquote>
17998
17999 !! html+tidy
18000 <blockquote>
18001 <p>Line one</p>
18002 <p>Line two</p>
18003 </blockquote>
18004 !! end
18005
18006 !! test
18007 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
18008 !! wikitext
18009 <blockquote>
18010 Line one
18011
18012 Line two
18013 </blockquote>
18014 !! html
18015 <blockquote>
18016 <p>Line one
18017 </p><p>Line two
18018 </p>
18019 </blockquote>
18020
18021 !! html+tidy
18022 <blockquote>
18023 <p>Line one</p>
18024 <p>Line two</p>
18025 </blockquote>
18026 !! end
18027
18028 !! test
18029 Paragraphs inside blockquotes/divs (no extra line breaks)
18030 !! wikitext
18031 <blockquote><div>Line one
18032
18033 Line two</div></blockquote>
18034 !! html
18035 <blockquote><div>Line one
18036 Line two</div></blockquote>
18037
18038 !! end
18039
18040 !! test
18041 Paragraphs inside blockquotes/divs (extra line break on open)
18042 !! wikitext
18043 <blockquote><div>
18044 Line one
18045
18046 Line two</div></blockquote>
18047 !! html
18048 <blockquote><div>
18049 <p>Line one
18050 </p>
18051 Line two</div></blockquote>
18052
18053 !! end
18054
18055 !! test
18056 Paragraphs inside blockquotes/divs (extra line break on close)
18057 !! wikitext
18058 <blockquote><div>Line one
18059
18060 Line two
18061 </div></blockquote>
18062 !! html
18063 <blockquote><div>Line one
18064 <p>Line two
18065 </p>
18066 </div></blockquote>
18067
18068 !! end
18069
18070 !! test
18071 Paragraphs inside blockquotes/divs (extra line break on open and close)
18072 !! wikitext
18073 <blockquote><div>
18074 Line one
18075
18076 Line two
18077 </div></blockquote>
18078 !! html
18079 <blockquote><div>
18080 <p>Line one
18081 </p><p>Line two
18082 </p>
18083 </div></blockquote>
18084
18085 !! end
18086
18087 !! test
18088 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
18089 !! options
18090 wgLinkHolderBatchSize=0
18091 !! wikitext
18092 [[meatball:1]]
18093 [[meatball:2]]
18094 [[meatball:3]]
18095 !! html
18096 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
18097 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
18098 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
18099 </p>
18100 !! end
18101
18102 !! test
18103 Free external link invading image caption
18104 !! wikitext
18105 [[Image:Foobar.jpg|thumb|http://x|hello]]
18106 !! html
18107 <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>
18108
18109 !! end
18110
18111 !! test
18112 Bug 15196: localised external link numbers
18113 !! options
18114 language=fa
18115 !! wikitext
18116 [http://en.wikipedia.org/]
18117 !! html/php
18118 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
18119 </p>
18120 !! html/parsoid
18121 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
18122 !! end
18123
18124 !! test
18125 Multibyte character in padleft
18126 !! wikitext
18127 {{padleft:-Hello|7|Æ}}
18128 !! html
18129 <p>Æ-Hello
18130 </p>
18131 !! end
18132
18133 !! test
18134 Multibyte character in padright
18135 !! wikitext
18136 {{padright:Hello-|7|Æ}}
18137 !! html
18138 <p>Hello-Æ
18139 </p>
18140 !! end
18141
18142 !!test
18143 formatdate parser function
18144 !! wikitext
18145 {{#formatdate:2009-03-24}}
18146 !! html
18147 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
18148 </p>
18149 !! end
18150
18151 !!test
18152 formatdate parser function, with default format
18153 !! wikitext
18154 {{#formatdate:2009-03-24|mdy}}
18155 !! html
18156 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
18157 </p>
18158 !! end
18159
18160 !! test
18161 Spacing of numbers in formatted dates
18162 !! wikitext
18163 {{#formatdate:January 15}}
18164 !! html
18165 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18166 </p>
18167 !! end
18168
18169 !! test
18170 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
18171 !! options
18172 language=nl title=[[MediaWiki:Common.css]]
18173 !! wikitext
18174 {{#formatdate:2009-03-24|dmy}}
18175 !! html
18176 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18177 </p>
18178 !! end
18179
18180 #
18181 #
18182 #
18183
18184 #
18185 # Edit comments
18186 #
18187
18188 !! test
18189 Edit comment with link
18190 !! options
18191 comment
18192 !! wikitext
18193 I like the [[Main Page]] a lot
18194 !! html
18195 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18196 !!end
18197
18198 !! test
18199 Edit comment with link and link text
18200 !! options
18201 comment
18202 !! wikitext
18203 I like the [[Main Page|best pages]] a lot
18204 !! html
18205 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18206 !!end
18207
18208 !! test
18209 Edit comment with link and link text with suffix
18210 !! options
18211 comment
18212 !! wikitext
18213 I like the [[Main Page|best page]]s a lot
18214 !! html
18215 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18216 !!end
18217
18218 !! test
18219 Edit comment with section link (non-local, eg in history list)
18220 !! options
18221 comment title=[[Main Page]]
18222 !! wikitext
18223 /* External links */ removed bogus entries
18224 !! html
18225 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18226 !!end
18227
18228 !! test
18229 Edit comment with section link and text before it (non-local, eg in history list)
18230 !! options
18231 comment title=[[Main Page]]
18232 !! wikitext
18233 pre-comment text /* External links */ removed bogus entries
18234 !! html
18235 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>
18236 !!end
18237
18238 !! test
18239 Edit comment with section link (local, eg in diff view)
18240 !! options
18241 comment local title=[[Main Page]]
18242 !! wikitext
18243 /* External links */ removed bogus entries
18244 !! html
18245 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18246 !!end
18247
18248 !! test
18249 Edit comment with subpage link (bug 14080)
18250 !! options
18251 comment
18252 subpage
18253 title=[[Subpage test]]
18254 !! wikitext
18255 Poked at a [[/subpage]] here...
18256 !! html
18257 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
18258 !!end
18259
18260 !! test
18261 Edit comment with subpage link and link text (bug 14080)
18262 !! options
18263 comment
18264 subpage
18265 title=[[Subpage test]]
18266 !! wikitext
18267 Poked at a [[/subpage|neat little page]] here...
18268 !! html
18269 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
18270 !!end
18271
18272 !! test
18273 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
18274 !! options
18275 comment
18276 title=[[Subpage test]]
18277 !! wikitext
18278 Poked at a [[/subpage]] here...
18279 !! html
18280 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...
18281 !!end
18282
18283 !! test
18284 Edit comment with bare anchor link (local, as on diff)
18285 !! options
18286 comment
18287 local
18288 title=[[Main Page]]
18289 !! wikitext
18290 [[#section]]
18291 !! html
18292 <a href="#section">#section</a>
18293 !! end
18294
18295 !! test
18296 Edit comment with bare anchor link (non-local, as on history)
18297 !! options
18298 comment
18299 title=[[Main Page]]
18300 !! wikitext
18301 [[#section]]
18302 !! html
18303 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
18304 !! end
18305
18306 !! test
18307 Anchor starting with underscore
18308 !! wikitext
18309 [[#_ref|One]]
18310 !! html
18311 <p><a href="#_ref">One</a>
18312 </p>
18313 !! end
18314
18315 !! test
18316 Id starting with underscore
18317 !! wikitext
18318 <div id="_ref"></div>
18319 !! html
18320 <div id="_ref"></div>
18321
18322 !! end
18323
18324 !! test
18325 Space normalisation on autocomment (bug 22784)
18326 !! options
18327 comment
18328 title=[[Main Page]]
18329 !! wikitext
18330 /* __hello__world__ */
18331 !! html
18332 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
18333 !! end
18334
18335 !! test
18336 percent-encoding and + signs in comments (Bug 26410)
18337 !! options
18338 comment
18339 !! wikitext
18340 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
18341 !! html
18342 <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>
18343 !! end
18344
18345 # Parsoid doesn't support this yet: see bug 73581
18346 # but it *should* omit the 'src' attribute if the image is bad.
18347 # PHP side of tests was disabled in
18348 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
18349 # because of issues in the PHP parserTests infrastructure
18350 # (but the output below is indeed what the PHP side emits)
18351 !! test
18352 Bad images - basic functionality
18353 !! wikitext
18354 [[File:Bad.jpg]]
18355 !! DISABLED/html/php
18356 !! html/parsoid
18357 <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>
18358 !! end
18359
18360 !! test
18361 Bad images - bug 16039: text after bad image disappears
18362 !! wikitext
18363 Foo bar
18364 [[File:Bad.jpg]]
18365 Bar foo
18366 !! DISABLED/html/php
18367 <p>Foo bar
18368 </p><p>Bar foo
18369 </p>
18370 !! html/parsoid
18371 <p>Foo bar
18372 <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>
18373 Bar foo</p>
18374 !! end
18375
18376 !! test
18377 Verify that displaytitle works (bug #22501) no displaytitle
18378 !! options
18379 showtitle
18380 !! config
18381 wgAllowDisplayTitle=true
18382 wgRestrictDisplayTitle=false
18383 !! wikitext
18384 this is not the the title
18385 !! html
18386 Parser test
18387 <p>this is not the the title
18388 </p>
18389 !! end
18390
18391 !! test
18392 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
18393 !! options
18394 showtitle
18395 title=[[Screen]]
18396 !! config
18397 wgAllowDisplayTitle=true
18398 wgRestrictDisplayTitle=false
18399 !! wikitext
18400 this is not the the title
18401 {{DISPLAYTITLE:whatever}}
18402 !! html
18403 whatever
18404 <p>this is not the the title
18405 </p>
18406 !! end
18407
18408 !! test
18409 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
18410 !! options
18411 showtitle
18412 title=[[Screen]]
18413 !! config
18414 wgAllowDisplayTitle=true
18415 wgRestrictDisplayTitle=true
18416 !! wikitext
18417 this is not the the title
18418 {{DISPLAYTITLE:whatever}}
18419 !! html
18420 Screen
18421 <p>this is not the the title
18422 </p>
18423 !! end
18424
18425 !! test
18426 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
18427 !! options
18428 showtitle
18429 title=[[Screen]]
18430 !! config
18431 wgAllowDisplayTitle=true
18432 wgRestrictDisplayTitle=true
18433 !! wikitext
18434 this is not the the title
18435 {{DISPLAYTITLE:screen}}
18436 !! html
18437 screen
18438 <p>this is not the the title
18439 </p>
18440 !! end
18441
18442 !! test
18443 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
18444 !! options
18445 showtitle
18446 title=[[Screen]]
18447 !! config
18448 wgAllowDisplayTitle=false
18449 !! wikitext
18450 this is not the the title
18451 {{DISPLAYTITLE:screen}}
18452 !! html
18453 Screen
18454 <p>this is not the the title
18455 <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>
18456 </p>
18457 !! end
18458
18459 !! test
18460 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
18461 !! options
18462 showtitle
18463 title=[[Screen]]
18464 !! config
18465 wgAllowDisplayTitle=false
18466 !! wikitext
18467 this is not the the title
18468 !! html
18469 Screen
18470 <p>this is not the the title
18471 </p>
18472 !! end
18473
18474 !! test
18475 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
18476 !! options
18477 showtitle
18478 title=[[Screen]]
18479 !! config
18480 wgAllowDisplayTitle=true
18481 wgRestrictDisplayTitle=true
18482 !! wikitext
18483 this is not the the title
18484 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
18485 !! html
18486 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
18487 <p>this is not the the title
18488 </p>
18489 !! end
18490
18491 !! test
18492 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
18493 !! options
18494 showtitle
18495 title=[[Screen]]
18496 !! config
18497 wgAllowDisplayTitle=true
18498 wgRestrictDisplayTitle=true
18499 !! wikitext
18500 this is not the the title
18501 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
18502 !! html
18503 <span style="color: red;">s</span>creen
18504 <p>this is not the the title
18505 </p>
18506 !! end
18507
18508 !! test
18509 preload: check <noinclude> and <includeonly>
18510 !! options
18511 preload
18512 !! wikitext
18513 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
18514 !! html
18515 Hello kind world.
18516 !! end
18517
18518 !! test
18519 preload: check <onlyinclude>
18520 !! options
18521 preload
18522 !! wikitext
18523 Goodbye <onlyinclude>Hello world</onlyinclude>
18524 !! html
18525 Hello world
18526 !! end
18527
18528 !! test
18529 preload: can pass tags through if we want to
18530 !! options
18531 preload
18532 !! wikitext
18533 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
18534 !! html
18535 <includeonly>Hello world</includeonly>
18536 !! end
18537
18538 !! test
18539 preload: check that it doesn't try to do tricks
18540 !! options
18541 preload
18542 !! wikitext
18543 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18544 !! html
18545 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18546 !! end
18547
18548 !! test
18549 Play a bit with r67090 and bug 3158
18550 !! wikitext
18551 <div style="width:50% !important">&nbsp;</div>
18552 <div style="width:50%&nbsp;!important">&nbsp;</div>
18553 <div style="width:50%&#160;!important">&nbsp;</div>
18554 <div style="border : solid;">&nbsp;</div>
18555 !! html/php
18556 <div style="width:50% !important">&#160;</div>
18557 <div style="width:50% !important">&#160;</div>
18558 <div style="width:50% !important">&#160;</div>
18559 <div style="border&#160;: solid;">&#160;</div>
18560
18561 !! html/parsoid
18562 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18563 <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>
18564 <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>
18565 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18566
18567 !! end
18568
18569 !! test
18570 HTML5 data attributes
18571 !! wikitext
18572 <span data-foo="bar">Baz</span>
18573 <p data-abc-def_hij="">Quuz</p>
18574 !! html
18575 <p><span data-foo="bar">Baz</span>
18576 </p>
18577 <p data-abc-def_hij="">Quuz</p>
18578
18579 !! end
18580
18581 !! test
18582 percent-encoding and + signs in internal links (Bug 26410)
18583 !! wikitext
18584 [[User:+%]] [[Page+title%]]
18585 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
18586 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
18587 [[%33%45]] [[%33%45+]]
18588 !! html/php
18589 <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>
18590 <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>
18591 <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>
18592 <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>
18593 </p>
18594 !! html/parsoid
18595 <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>
18596 !! end
18597
18598 !! test
18599 Special characters in embedded file links (bug 27679)
18600 !! wikitext
18601 [[File:Contains & ampersand.jpg]]
18602 [[File:Does not exist.jpg|Title with & ampersand]]
18603 !! html/php
18604 <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>
18605 <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>
18606 </p>
18607 !! html/parsoid
18608 <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>
18609 <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>
18610 !! end
18611
18612 !! test
18613 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
18614 !! wikitext
18615 Text&apos;s been normalized?
18616 !! html
18617 <p>Text&#39;s been normalized?
18618 </p>
18619 !! end
18620
18621 !! test
18622 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
18623 !! wikitext
18624 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
18625 !! html
18626 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
18627 </p>
18628 !! end
18629
18630 !! test
18631 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
18632 !! wikitext
18633 [http://www.example.org/ ideograms]
18634 !! html
18635 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
18636 </p>
18637 !! end
18638
18639 !! test
18640 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
18641 !! wikitext
18642 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
18643 !! html
18644 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
18645 </p>
18646 !! end
18647
18648 !! article
18649 Mediawiki:loop1
18650 !! text
18651 {{Identical|A}}
18652 !! endarticle
18653
18654 !! article
18655 Mediawiki:loop2
18656 !! text
18657 {{Identical|B}}
18658 !! endarticle
18659
18660 !! article
18661 Template:Identical
18662 !! text
18663 {{int:loop1}}
18664 {{int:loop2}}
18665 !! endarticle
18666
18667 !! test
18668 Bug 31098 Template which includes system messages which includes the template
18669 !! wikitext
18670 {{Identical}}
18671 !! html
18672 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18673 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18674 </p>
18675 !! end
18676
18677 !! test
18678 Bug31490 Turkish: ucfirst 'blah'
18679 !! options
18680 language=tr
18681 !! wikitext
18682 {{ucfirst:blah}}
18683 !! html
18684 <p>Blah
18685 </p>
18686 !! end
18687
18688 !! test
18689 Bug31490 Turkish: ucfirst 'ix'
18690 !! options
18691 language=tr
18692 !! wikitext
18693 {{ucfirst:ix}}
18694 !! html
18695 <p>İx
18696 </p>
18697 !! end
18698
18699 !! test
18700 Bug31490 Turkish: lcfirst 'BLAH'
18701 !! options
18702 language=tr
18703 !! wikitext
18704 {{lcfirst:BLAH}}
18705 !! html
18706 <p>bLAH
18707 </p>
18708 !! end
18709
18710 !! test
18711 Bug31490 Turkish: ucfırst (with a dotless i)
18712 !! options
18713 language=tr
18714 !! wikitext
18715 {{ucfırst:blah}}
18716 !! html
18717 <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>
18718 </p>
18719 !! end
18720
18721 !! test
18722 Bug31490 ucfırst (with a dotless i) with English language
18723 !! options
18724 language=en
18725 !! wikitext
18726 {{ucfırst:blah}}
18727 !! html
18728 <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>
18729 </p>
18730 !! end
18731
18732 !! test
18733 Bug 26375: TOC with italics
18734 !! options
18735 title=[[Main Page]]
18736 !! wikitext
18737 __TOC__
18738 == ''Lost'' episodes ==
18739 !! html
18740 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18741 <ul>
18742 <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>
18743 </ul>
18744 </div>
18745
18746 <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>
18747
18748 !! end
18749
18750 !! test
18751 Bug 26375: TOC with bold
18752 !! options
18753 title=[[Main Page]]
18754 !! wikitext
18755 __TOC__
18756 == '''should be bold''' then normal text ==
18757 !! html
18758 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18759 <ul>
18760 <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>
18761 </ul>
18762 </div>
18763
18764 <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>
18765
18766 !! end
18767
18768 !! test
18769 Bug 33845: Headings become cursive in TOC when they contain an image
18770 !! options
18771 title=[[Main Page]]
18772 !! wikitext
18773 __TOC__
18774 == Image [[Image:foobar.jpg]] ==
18775 !! html
18776 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18777 <ul>
18778 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
18779 </ul>
18780 </div>
18781
18782 <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>
18783
18784 !! end
18785
18786 !! test
18787 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
18788 !! options
18789 title=[[Main Page]]
18790 !! wikitext
18791 __TOC__
18792 == <blockquote>Quote</blockquote> ==
18793 !! html
18794 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18795 <ul>
18796 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18797 </ul>
18798 </div>
18799
18800 <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>
18801
18802 !! html+tidy
18803 <div id="toc" class="toc">
18804 <div id="toctitle">
18805 <h2>Contents</h2>
18806 </div>
18807 <ul>
18808 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18809 </ul>
18810 </div>
18811 <h2><span class="mw-headline" id="Quote"></span></h2>
18812 <blockquote>
18813 <p><span class="mw-headline" id="Quote">Quote</span></p>
18814 </blockquote>
18815 <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>
18816 !! end
18817
18818 !! test
18819 Unclosed tags in TOC
18820 !! options
18821 title=[[Main Page]]
18822 !! wikitext
18823 __TOC__
18824 == Proof: 2 < 3 ==
18825 <small>Hanc marginis exiguitas non caperet.</small>
18826 QED
18827 !! html
18828 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18829 <ul>
18830 <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>
18831 </ul>
18832 </div>
18833
18834 <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>
18835 <p><small>Hanc marginis exiguitas non caperet.</small>
18836 QED
18837 </p>
18838 !! end
18839
18840 !! test
18841 Multiple tags in TOC
18842 !! wikitext
18843 __TOC__
18844 == <i>Foo</i> <b>Bar</b> ==
18845
18846 == <i>Foo</i> <blockquote>Bar</blockquote> ==
18847 !! html
18848 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18849 <ul>
18850 <li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
18851 <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>
18852 </ul>
18853 </div>
18854
18855 <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>
18856 <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>
18857
18858 !! html+tidy
18859 <div id="toc" class="toc">
18860 <div id="toctitle">
18861 <h2>Contents</h2>
18862 </div>
18863 <ul>
18864 <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>
18865 <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>
18866 </ul>
18867 </div>
18868 <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>
18869 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
18870 <blockquote>
18871 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
18872 </blockquote>
18873 <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>
18874 !! end
18875
18876 !! test
18877 Tags with parameters in TOC
18878 !! wikitext
18879 __TOC__
18880 == <sup class="in-h2">Hello</sup> ==
18881
18882 == <sup class="a > b">Evilbye</sup> ==
18883 !! html
18884 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18885 <ul>
18886 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
18887 <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>
18888 </ul>
18889 </div>
18890
18891 <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>
18892 <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>
18893
18894 !! end
18895
18896 !! test
18897 span tags with directionality in TOC
18898 !! wikitext
18899 __TOC__
18900 == <span dir="ltr">C++</span> ==
18901
18902 == <span dir="rtl">זבנג!</span> ==
18903
18904 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
18905
18906 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
18907
18908 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
18909 !! html
18910 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18911 <ul>
18912 <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>
18913 <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>
18914 <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>
18915 <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>
18916 <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>
18917 </ul>
18918 </div>
18919
18920 <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>
18921 <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>
18922 <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>
18923 <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>
18924 <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>
18925
18926 !! end
18927
18928 !! article
18929 MediaWiki:Bug32057
18930 !! text
18931 == {{int:headline_sample}} ==
18932 !! endarticle
18933
18934 !! test
18935 Bug 32057: Title needed when expanding <h> nodes.
18936 !! options
18937 title=[[Main Page]]
18938 !! wikitext
18939 {{int:Bug32057}}
18940 !! html
18941 <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>
18942
18943 !! end
18944
18945 !! test
18946 Strip marker in urlencode
18947 !! wikitext
18948 {{urlencode:x<nowiki/>y}}
18949 {{urlencode:x<nowiki/>y|wiki}}
18950 {{urlencode:x<nowiki/>y|path}}
18951 !! html
18952 <p>xy
18953 xy
18954 xy
18955 </p>
18956 !! end
18957
18958 !! test
18959 Strip marker in lc
18960 !! wikitext
18961 {{lc:x<nowiki/>y}}
18962 !! html
18963 <p>xy
18964 </p>
18965 !! end
18966
18967 !! test
18968 Strip marker in uc
18969 !! wikitext
18970 {{uc:x<nowiki/>y}}
18971 !! html
18972 <p>XY
18973 </p>
18974 !! end
18975
18976 !! test
18977 Strip marker in formatNum
18978 !! wikitext
18979 {{formatnum:1<nowiki/>2}}
18980 {{formatnum:1<nowiki/>2|R}}
18981 !! html
18982 <p>12
18983 12
18984 </p>
18985 !! end
18986
18987 !! test
18988 Check noCommafy in formatNum
18989 !! options
18990 language=be-tarask
18991 !! wikitext
18992 {{formatnum:123456.78}}
18993 {{formatnum:123456.78|NOSEP}}
18994 !! html
18995 <p>123 456,78
18996 123456.78
18997 </p>
18998 !! end
18999
19000 !! test
19001 Wrong option for formatNum (bug 56199)
19002 !! wikitext
19003 {{formatnum:1,234.56|Random}}
19004 {{formatnum:1,234.56|EVERYTHING}}
19005 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
19006 !! html
19007 <p>1,234.56
19008 1,234.56
19009 1,234.56
19010 </p>
19011 !! end
19012
19013 !! test
19014 Strip marker in grammar
19015 !! options
19016 language=fi
19017 !! wikitext
19018 {{grammar:elative|foo<nowiki/>bar}}
19019 !! html
19020 <p>foobarista
19021 </p>
19022 !! end
19023
19024 !! test
19025 Strip marker in padleft
19026 !! wikitext
19027 {{padleft:|2|x<nowiki/>y}}
19028 !! html
19029 <p>xy
19030 </p>
19031 !! end
19032
19033 !! test
19034 Strip marker in padright
19035 !! wikitext
19036 {{padright:|2|x<nowiki/>y}}
19037 !! html
19038 <p>xy
19039 </p>
19040 !! end
19041
19042 !! test
19043 Strip marker in anchorencode
19044 !! wikitext
19045 {{anchorencode:x<nowiki/>y}}
19046 !! html
19047 <p>xy
19048 </p>
19049 !! end
19050
19051 !! test
19052 nowiki inside link inside heading (bug 18295)
19053 !! wikitext
19054 ==[[foo|x<nowiki>y</nowiki>z]]==
19055 !! html
19056 <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>
19057
19058 !! end
19059
19060 !! test
19061 new support for bdi element (bug 31817)
19062 !! wikitext
19063 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19064 !! html
19065 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19066
19067 !!end
19068
19069 !! test
19070 Ignore pipe between table row attributes
19071 !! wikitext
19072 {|
19073 | quux
19074 |- id=foo | style='color: red'
19075 | bar
19076 |}
19077 !! html
19078 <table>
19079 <tr>
19080 <td> quux
19081 </td></tr>
19082 <tr id="foo" style="color: red">
19083 <td> bar
19084 </td></tr></table>
19085
19086 !! end
19087
19088 !!test
19089 Gallery override link with WikiLink (bug 34852)
19090 !! wikitext
19091 <gallery>
19092 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
19093 </gallery>
19094 !! html
19095 <ul class="gallery mw-gallery-traditional">
19096 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19097 <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>
19098 <div class="gallerytext">
19099 <p>caption
19100 </p>
19101 </div>
19102 </div></li>
19103 </ul>
19104
19105 !! end
19106
19107 !!test
19108 Gallery override link with absolute external link (bug 34852)
19109 !! wikitext
19110 <gallery>
19111 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19112 </gallery>
19113 !! html
19114 <ul class="gallery mw-gallery-traditional">
19115 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19116 <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>
19117 <div class="gallerytext">
19118 <p>caption
19119 </p>
19120 </div>
19121 </div></li>
19122 </ul>
19123
19124 !! end
19125
19126 !!test
19127 Gallery override link with malicious javascript (bug 34852)
19128 !! wikitext
19129 <gallery>
19130 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19131 </gallery>
19132 !! html
19133 <ul class="gallery mw-gallery-traditional">
19134 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19135 <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>
19136 <div class="gallerytext">
19137 <p>caption
19138 </p>
19139 </div>
19140 </div></li>
19141 </ul>
19142
19143 !! end
19144
19145 !!test
19146 Gallery with invalid title as link (bug 43964)
19147 !! wikitext
19148 <gallery>
19149 File:foobar.jpg|link=<
19150 </gallery>
19151 !! html
19152 <ul class="gallery mw-gallery-traditional">
19153 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19154 <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>
19155 <div class="gallerytext">
19156 </div>
19157 </div></li>
19158 </ul>
19159
19160 !! end
19161
19162 !!test
19163 Language parser function
19164 !! wikitext
19165 {{#language:ar}}
19166 !! html
19167 <p>العربية
19168 </p>
19169 !! end
19170
19171 !!test
19172 Padleft and padright as substr
19173 !! wikitext
19174 {{padleft:|3|abcde}}
19175 {{padright:|3|abcde}}
19176 !! html
19177 <p>abc
19178 abc
19179 </p>
19180 !! end
19181
19182 !!test
19183 Special parser function
19184 !! wikitext
19185 {{#special:RandomPage}}
19186 {{#special:BaDtItLe}}
19187 {{#special:Foobar}}
19188 !! html
19189 <p>Special:Random
19190 Special:Badtitle
19191 Special:Foobar
19192 </p>
19193 !! end
19194
19195 !!test
19196 Bug 34939 - Case insensitive link parsing ([HttP://])
19197 !! wikitext
19198 [HttP://MediaWiki.Org/]
19199 !! html/php
19200 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
19201 </p>
19202 !! html/parsoid
19203 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
19204 !! end
19205
19206 !!test
19207 Bug 34939 - Case insensitive link parsing ([HttP:// title])
19208 !! wikitext
19209 [HttP://MediaWiki.Org/ MediaWiki]
19210 !! html
19211 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
19212 </p>
19213 !! end
19214
19215 !!test
19216 Bug 34939 - Case insensitive link parsing (HttP://)
19217 !! wikitext
19218 HttP://MediaWiki.Org/
19219 !! html/php
19220 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
19221 </p>
19222 !! html/parsoid
19223 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
19224 !! end
19225
19226 !!test
19227 Disable TOC
19228 !! options
19229 notoc
19230 !! wikitext
19231 Lead
19232 == Section 1 ==
19233 == Section 2 ==
19234 == Section 3 ==
19235 == Section 4 ==
19236 == Section 5 ==
19237 !! html
19238 <p>Lead
19239 </p>
19240
19241 <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>
19242 <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>
19243 <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>
19244 <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>
19245 <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>
19246
19247 !! end
19248
19249
19250 ###
19251 ### Parsoid-specific tests
19252 ### Parsoid-PHP parser incompatibilities
19253 ###
19254 !!test
19255 1. SOL-sensitive wikitext tokens as template-args
19256 !!options
19257 parsoid=wt2html,wt2wt
19258 !! wikitext
19259 {{echo|*a}}
19260 {{echo|#a}}
19261 {{echo|:a}}
19262 !! html
19263 <span about="#mwt1" typeof="mw:Transclusion">
19264 </span><ul about="#mwt1"><li>a</li>
19265 </ul>
19266 <span about="#mwt2" typeof="mw:Transclusion">
19267 </span><ol about="#mwt2"><li>a</li>
19268 </ol>
19269 <span about="#mwt3" typeof="mw:Transclusion">
19270 </span><dl about="#mwt3"><dd>a</dd>
19271 </dl>
19272 !!end
19273
19274 #### -----------------------------------------------------------------
19275 #### Parsoid-specific functionality tests
19276 #### -----------------------------------------------------------------
19277
19278 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
19279 # We know wt2wt will fail, but we expect selser to pass.
19280 # Due to the nature of our testing, wt2wt and selser tests will enter the
19281 # blacklist and we'll catch selser regressions based on changes to the
19282 # blacklist entries for selser tests.
19283 !! test
19284 1. Bad treebuilder fixup of formatting elt is cleaned up
19285 !! options
19286 parsoid=wt2html,wt2wt
19287 !! wikitext
19288 {|
19289 |
19290 <small>
19291 [[Image:Foobar.jpg|right|Test]]
19292 </small>
19293 |}
19294 !! html/parsoid
19295 <table>
19296 <tbody><tr><td>
19297 <small>
19298 <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>
19299 </small>
19300 </td></tr>
19301 </tbody></table>
19302 !! end
19303
19304 !! test
19305 2. Bad treebuilder fixup of formatting elt is cleaned up
19306 !! options
19307 parsoid=wt2html,wt2wt
19308 !! wikitext
19309 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
19310
19311 <small>[[Image:Foobar.jpg|right|300px]]</small>
19312 !! html/parsoid
19313 <p><b>foo</b></p>
19314 <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>
19315 <p><b>bar</b></p>
19316 <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>
19317 !! end
19318
19319 #### ----------------------------------------------------------------
19320 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
19321 #### tags. Parsoid's output for these tags differs from that of the
19322 #### PHP parser.
19323 #### ----------------------------------------------------------------
19324
19325 !!test
19326 Ref: 1. ref-location should be replaced with an index span
19327 !!options
19328 parsoid
19329 !! wikitext
19330 A <ref>foo</ref>
19331 B <ref name="x">foo</ref>
19332 C <ref name="y" />
19333 !! html
19334 <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>
19335 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>
19336 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>
19337 !!end
19338
19339 !!test
19340 Ref: 2. ref-tags with identical names should all get the same index
19341 !!options
19342 parsoid
19343 !! wikitext
19344 A <ref name="x">foo</ref>
19345 B <ref name="x" />
19346 !! html
19347 <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>
19348 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>
19349 !!end
19350
19351 !!test
19352 Ref: 3. spaces in ref-names should be ignored
19353 !!options
19354 parsoid
19355 !! wikitext
19356 A <ref name="x">foo</ref>
19357 B <ref name=" x " />
19358 C <ref name= x />
19359 !! html
19360 <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>
19361 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>
19362 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>
19363 !!end
19364
19365 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
19366 !!test
19367 Ref: 4. 'constructor' should be accepted as a valid ref-name
19368 !!options
19369 parsoid
19370 !! wikitext
19371 A <ref name="constructor">foo</ref>
19372 !! html
19373 <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>
19374 !!end
19375
19376 !!test
19377 Ref: 5. body should accept generic wikitext
19378 !!options
19379 parsoid
19380 !! wikitext
19381 A <ref>
19382 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
19383 </ref>
19384
19385 <references />
19386 !! html
19387 <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>
19388
19389 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19390 <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>
19391 </li>
19392 </ol>
19393 !!end
19394
19395 !!test
19396 Ref: 6. indent-pres should not be output in ref-body
19397 !!options
19398 parsoid
19399 !! wikitext
19400 A <ref>
19401 foo
19402 bar
19403 baz
19404 </ref>
19405
19406 <references />
19407 !! html
19408 <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>
19409
19410 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19411 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
19412 bar
19413 baz
19414 </li>
19415 </ol>
19416 !!end
19417
19418 !!test
19419 Ref: 7. No p-wrapping in ref-body
19420 !!options
19421 parsoid
19422 !! wikitext
19423 A <ref>
19424 foo
19425
19426 bar
19427
19428
19429 baz
19430
19431
19432
19433 booz
19434 </ref>
19435
19436 <references />
19437 !! html
19438 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo\n\nbar\n\n\nbaz\n\n\n\nbooz\n"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19439
19440 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19441 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
19442
19443 bar
19444
19445
19446 baz
19447
19448
19449
19450 booz
19451 </li>
19452 </ol>
19453 !!end
19454
19455 !!test
19456 Ref: 8. transclusion wikitext has lower precedence
19457 !!options
19458 parsoid
19459 !! wikitext
19460 A <ref> foo {{echo|</ref> B C}}
19461
19462 <references />
19463 !! html
19464 <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>
19465 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19466 <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>
19467 </ol>
19468 !!end
19469
19470 !!test
19471 Ref: 9. unclosed comments should not leak out of ref-body
19472 !!options
19473 parsoid
19474 !! wikitext
19475 A <ref> foo <!--</ref> B C
19476 <references />
19477 !! html
19478 <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>
19479 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19480 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li>
19481 </ol>
19482 !!end
19483
19484 !!test
19485 Ref: 10. Unclosed HTML tags should not leak out of ref-body
19486 !!options
19487 parsoid
19488 !! wikitext
19489 A <ref> <b> foo </ref> B C
19490
19491 <references />
19492 !! html
19493 <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>
19494
19495
19496 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19497 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> <b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></li>
19498 </ol>
19499 !!end
19500
19501 !!test
19502 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
19503 !!options
19504 parsoid
19505 !! wikitext
19506 A <ref>foo</ref> B
19507 C <ref>bar</ref> D
19508 !! html
19509 <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
19510 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>
19511 !!end
19512
19513 !!test
19514 Ref: 12. ref-tags act as trailing newline migration barrier
19515 !!options
19516 parsoid
19517 !! wikitext
19518 <!--the newline at the end of this line moves out of the p-tag-->a
19519
19520 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
19521 <ref />
19522
19523 c
19524 !! html
19525 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
19526
19527
19528 <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>
19529 <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>
19530
19531 <p>c</p>
19532 !!end
19533
19534 !!test
19535 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
19536 !!options
19537 parsoid
19538 !! wikitext
19539 <ref>foo</ref> A
19540 <ref>bar
19541 </ref> B
19542 !! html
19543 <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
19544 <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>
19545 !!end
19546
19547 !!test
19548 Ref: 14. A nested ref-tag should be emitted as plain text
19549 !!options
19550 parsoid
19551 !! wikitext
19552 <ref>foo <ref>bar</ref> baz</ref>
19553
19554 <references />
19555 !! html
19556 <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>
19557
19558 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19559 <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>
19560 </ol>
19561 !!end
19562
19563 !!test
19564 Ref: 15. ref-tags with identical names should get identical indexes
19565 !!options
19566 parsoid
19567 !! wikitext
19568 A1 <ref name="a">foo</ref> A2 <ref name="a" />
19569 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
19570
19571 <references />
19572 !! html
19573 <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>
19574 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>
19575
19576 <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>
19577 </ol>
19578 !!end
19579
19580 ## We don't bother wt2wt-ing non-standard whitespace
19581 !!test
19582 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
19583 !!options
19584 parsoid=wt2html
19585 !! wikitext
19586 A <ref >foo</ref >
19587
19588 <references />
19589 !! html
19590 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19591
19592 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19593 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19594 !!end
19595
19596 !!test
19597 Ref: 17. Generate valid HTML5 id/about attributes
19598 !!options
19599 parsoid
19600 !!wikitext
19601 <ref name="a b">foo</ref>
19602
19603 <references />
19604 !!html
19605 <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>
19606 </p>
19607
19608 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19609 <li id="cite_note-a_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_b-1-0">↑</a></span> foo</li>
19610 !!end
19611
19612 !!test
19613 References: 1. references tag without any refs should be handled properly
19614 !!options
19615 parsoid
19616 !! wikitext
19617 <references />
19618 !! html
19619 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
19620 !!end
19621
19622 !!test
19623 References: 2. references tag with group only outputs references from that group
19624 !!options
19625 parsoid
19626 !! wikitext
19627 A <ref group="a">foo</ref>
19628 B <ref group="b">bar</ref>
19629
19630 <references group="a" />
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":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
19633 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>
19634
19635 <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>
19636 </ol>
19637 !!end
19638
19639 !!test
19640 References: 3. ref list should be cleared after processing references
19641 !!options
19642 parsoid
19643 !! wikitext
19644 A <ref>foo</ref>
19645
19646 <references />
19647
19648 B <ref>bar</ref>
19649
19650 <references />
19651 !! html
19652 <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>
19653
19654 <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>
19655 </ol>
19656
19657 <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>
19658
19659 <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>
19660 </ol>
19661 !!end
19662
19663 !!test
19664 References: 4. only referenced group should be cleared after processing references
19665 !!options
19666 parsoid
19667 !! wikitext
19668 A <ref group="a">afoo</ref>
19669 B <ref>bfoo</ref>
19670
19671 <references group="a" />
19672
19673 C <ref>cfoo</ref>
19674
19675 <references />
19676 !! html
19677 <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>
19678 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>
19679
19680 <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>
19681 </ol>
19682
19683 <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>
19684
19685 <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>
19686 </ol>
19687 !!end
19688
19689 !!test
19690 References: 5. ref tags in references should be processed while ignoring all other content
19691 !!options
19692 parsoid
19693 !! wikitext
19694 A <ref name="a" />
19695 B <ref name="b">bar</ref>
19696
19697 <references>
19698 <ref name="a">foo</ref>
19699 This should just get lost.
19700 </references>
19701 !! html
19702 <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>
19703 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>
19704
19705
19706 <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>
19707 </ol>
19708 !!end
19709
19710 !!test
19711 References: 6. <references /> from a transclusion
19712 !!options
19713 parsoid
19714 !! wikitext
19715 <ref>Foo</ref> {{echo|<references />}}
19716 !! html
19717 <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>
19718 !!end
19719
19720 !! test
19721 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
19722 !! options
19723 parsoid
19724 !! wikitext
19725 A <ref>foo bar for a</ref>
19726 B <ref group="X" name="b" />
19727
19728 <references />
19729
19730 <references group="X">
19731 <ref name="b">foo</ref>
19732 </references>
19733 !! html
19734 <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>
19735 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>
19736
19737 <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>
19738
19739 <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>
19740 !! end
19741
19742 !! test
19743 Entities in ref name
19744 !! options
19745 parsoid
19746 !! wikitext
19747 <ref name="test &amp; me">hi</ref>
19748 !! html
19749 <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>
19750 !! end
19751
19752 # This test is wt2html only because we're permitting the serializer to produce
19753 # dirty diffs, normalizing the unclosed references to the self-closed version.
19754 !! test
19755 Generate references for unclosed references tag
19756 !! options
19757 parsoid=wt2html
19758 !! wikitext
19759 a<ref>foo</ref>
19760
19761 <references>
19762 !! html
19763 <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>
19764
19765
19766 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19767 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19768 !! end
19769
19770 !! test
19771 New reference serializes on its own line
19772 !! options
19773 parsoid=wt2wt,html2wt
19774 !! wikitext
19775 foo
19776 <references />
19777 !! html
19778 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
19779 !! end
19780
19781 #--------- Test stripping of empty nodes in template content ----------
19782 !!test
19783 Empty LI and TR nodes should be stripped from template content
19784 !!wikitext
19785 {{EmptyLITest}}
19786 {{EmptyTRTest}}
19787 !!html/parsoid
19788 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
19789 <li>a</li>
19790 <li>b</li>
19791 </ul>
19792 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
19793 <tbody>
19794 <tr>
19795 <td>foo</td>
19796 </tr>
19797 <tr>
19798 <td>bar</td>
19799 </tr>
19800 </tbody>
19801 </table>
19802 !!end
19803
19804 !!test
19805 Empty LI and TR nodes should not be stripped from top-level content
19806 !!wikitext
19807 * a
19808 *
19809 * b
19810 {|
19811 |-
19812 |-
19813 |foo
19814 |}
19815 !!html/parsoid
19816 <ul>
19817 <li> a</li>
19818 <li></li>
19819 <li> b</li>
19820 </ul>
19821 <table>
19822 <tbody>
19823 <tr></tr>
19824 <tr>
19825 <td>foo</td>
19826 </tr>
19827 </tbody>
19828 </table>
19829 !!end
19830
19831 !!test
19832 Empty TR nodes should not be stripped if they have any attributes set
19833 !!wikitext
19834 {{EmptyTRWithHTMLAttrTest}}
19835 !!html/parsoid
19836 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
19837 <tr align="center"></tr>
19838 <tr><td>foo</td></tr>
19839 <tr align="center"></tr>
19840 <tr><td>bar</td></tr>
19841 </table>
19842 !!end
19843
19844 #### ----------------------------------------------------------------
19845 #### The following section of tests are primarily to test
19846 #### wikitext escaping capabilities of Parsoid. Given that
19847 #### escaping can be done any number of ways, the wikitext (input)
19848 #### is always adjusted to reflect how Parsoid adds nowiki
19849 #### escape tags.
19850 ####
19851 #### We are marking several tests as parsoid-only since the
19852 #### HTML in the result section is different from what the
19853 #### PHP parser generates for it.
19854 #### ----------------------------------------------------------------
19855
19856
19857 #### --------------- Headings ---------------
19858 #### 0. Unnested
19859 #### 1. Nested inside html <h1>=foo=</h1>
19860 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
19861 #### 3. Nested inside html with wikitext split by html tags
19862 #### 4. No escape needed
19863 #### 5. Empty headings <h1></h1>
19864 #### 6. Heading chars in SOL context
19865 #### ----------------------------------------
19866 !! test
19867 Headings: 0. Unnested
19868 !! options
19869 parsoid
19870 !! wikitext
19871 <nowiki>=foo=</nowiki>
19872
19873 <nowiki> =foo= </nowiki>
19874 <!--cmt-->
19875 <nowiki>=foo=</nowiki>
19876
19877 =foo''a''<nowiki>=</nowiki>
19878 !! html
19879 <p><span typeof="mw:Nowiki">=foo=</span></p>
19880
19881 <p><span typeof="mw:Nowiki"> =foo= </span>
19882 <!--cmt-->
19883 <span typeof="mw:Nowiki">=foo=</span></p>
19884
19885 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
19886 !!end
19887
19888 # New headings and existing headings are handled differently
19889 !! test
19890 Headings: 1. Nested inside html
19891 !! options
19892 parsoid=html2wt
19893 !! wikitext
19894 = =foo= =
19895
19896 == =foo= ==
19897
19898 === =foo= ===
19899
19900 =<nowiki>=foo=</nowiki>=
19901 ==<nowiki>=foo=</nowiki>==
19902 ===<nowiki>=foo=</nowiki>===
19903 ====<nowiki>=foo=</nowiki>====
19904 =====<nowiki>=foo=</nowiki>=====
19905 ======<nowiki>=foo=</nowiki>======
19906
19907 !! html
19908 <h1>=foo=</h1>
19909 <h2>=foo=</h2>
19910 <h3>=foo=</h3>
19911
19912 <h1 data-parsoid=''>=foo=</h1>
19913 <h2 data-parsoid=''>=foo=</h2>
19914 <h3 data-parsoid=''>=foo=</h3>
19915 <h4 data-parsoid=''>=foo=</h4>
19916 <h5 data-parsoid=''>=foo=</h5>
19917 <h6 data-parsoid=''>=foo=</h6>
19918 !!end
19919
19920 !! test
19921 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
19922 !! options
19923 parsoid=html2wt
19924 !! wikitext
19925 = foo =
19926 <nowiki>*</nowiki>bar
19927
19928 = foo =
19929 =bar
19930
19931 = foo =
19932 <nowiki>=bar=</nowiki>
19933 !! html
19934 <h1>foo</h1>*bar
19935 <h1>foo</h1>=bar
19936 <h1>foo</h1>=bar=
19937 !!end
19938
19939 !! test
19940 Headings: 3. Nested inside html with wikitext split by html tags
19941 !! options
19942 parsoid=html2wt
19943 !! wikitext
19944 = ='''bold'''<nowiki>foo=</nowiki> =
19945 !! html
19946 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
19947 !!end
19948
19949 !! test
19950 Headings: 4a. No escaping needed (testing just h1 and h2)
19951 !! options
19952 parsoid=html2wt
19953 !! wikitext
19954 = =foo =
19955
19956 = foo= =
19957
19958 = =foo= =
19959
19960 = =foo= bar =
19961
19962 == =foo ==
19963
19964 == foo= ==
19965
19966 = ''=''foo= =
19967
19968 = <nowiki>=</nowiki> =
19969 !! html
19970 <h1>=foo</h1>
19971 <h1>foo=</h1>
19972 <h1> =foo= </h1>
19973 <h1>=foo= bar</h1>
19974 <h2>=foo</h2>
19975 <h2>foo=</h2>
19976 <h1><i>=</i>foo=</h1>
19977 <h1><span typeof="mw:Nowiki">=</span></h1>
19978 !!end
19979
19980 !! test
19981 Headings: 4b. No escaping needed (inside p-tags)
19982 !! options
19983 parsoid=html2wt
19984 !! wikitext
19985 ===
19986 =foo= x
19987 =foo= <s></s>
19988 !! html
19989 <p>===
19990 =foo= x
19991 =foo= <s></s>
19992 </p>
19993 !!end
19994
19995 !! test
19996 Headings: 5. Empty headings
19997 !! options
19998 parsoid
19999 !! wikitext
20000 =<nowiki/>=
20001
20002 ==<nowiki/>==
20003
20004 ===<nowiki/>===
20005
20006 ====<nowiki/>====
20007
20008 =====<nowiki/>=====
20009
20010 ======<nowiki/>======
20011 !! html
20012 <h1></h1>
20013 <h2></h2>
20014 <h3></h3>
20015 <h4></h4>
20016 <h5></h5>
20017 <h6></h6>
20018 !!end
20019
20020 !! test
20021 Headings: 6a. Heading chars in SOL context (with trailing spaces)
20022 !! options
20023 parsoid
20024 !! wikitext
20025 <nowiki>=a=</nowiki>
20026
20027 <nowiki>=a=</nowiki>
20028
20029 <nowiki>=a=</nowiki>
20030
20031 <nowiki>=a=</nowiki>
20032 !! html
20033 <p>=a=</p>
20034 <p>=a= </p>
20035 <p>=a= </p>
20036 <p>=a= </p>
20037 !!end
20038
20039 !! test
20040 Headings: 6b. Heading chars in SOL context (with trailing newlines)
20041 !! options
20042 parsoid
20043 !! wikitext
20044 <nowiki>=a=
20045 b</nowiki>
20046
20047 <nowiki>=a=
20048 b</nowiki>
20049
20050 <nowiki>=a=
20051 b</nowiki>
20052
20053 <nowiki>=a=
20054 b</nowiki>
20055 !! html
20056 <p>=a=
20057 b</p>
20058 <p>=a=
20059 b</p>
20060 <p>=a=
20061 b</p>
20062 <p>=a=
20063 b</p>
20064 </p>
20065 !!end
20066
20067 !! test
20068 Headings: 6c. Heading chars in SOL context (leading newline break)
20069 !! options
20070 parsoid
20071 !! wikitext
20072 a
20073 <nowiki>=b=</nowiki>
20074 !! html
20075 <p>a
20076 =b=</p>
20077 !!end
20078
20079 !! test
20080 Headings: 6d. Heading chars in SOL context (with interspersed comments)
20081 !! options
20082 parsoid
20083 !! wikitext
20084 <!--c0--><nowiki>=a=</nowiki>
20085
20086 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
20087 !! html
20088 <p><!--c0-->=a=</p>
20089 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
20090 !!end
20091
20092 !! test
20093 Headings: 6d. Heading chars in SOL context (No escaping needed)
20094 !! options
20095 parsoid=html2wt
20096 !! wikitext
20097 =a=<div>b</div>
20098 !! html
20099 =a=<div>b</div>
20100 !!end
20101
20102 #### --------------- Lists ---------------
20103 #### 0. Outside nests (*foo, etc.)
20104 #### 1. Nested inside html <ul><li>*foo</li></ul>
20105 #### 2. Inside definition lists
20106 #### 3. Only bullets at start should be escaped
20107 #### 4. No escapes needed
20108 #### 5. No unnecessary escapes
20109 #### 6. Escape bullets in SOL position
20110 #### 7. Escape bullets in a multi-line context
20111 #### ----------------------------------------
20112
20113 !! test
20114 Lists: 0. Outside nests
20115 !! wikitext
20116 <nowiki>*</nowiki>foo
20117
20118 <nowiki>#</nowiki>foo
20119
20120 <nowiki>;Foo:</nowiki>bar
20121 !! html
20122 <p>*foo
20123 </p><p>#foo
20124 </p><p>;Foo:bar
20125 </p>
20126 !!end
20127
20128 !! test
20129 Lists: 1. Nested inside html
20130 !! wikitext
20131 *<nowiki>*foo</nowiki>
20132
20133 *<nowiki>#foo</nowiki>
20134
20135 *<nowiki>:foo</nowiki>
20136
20137 *<nowiki>;foo</nowiki>
20138
20139 #<nowiki>*foo</nowiki>
20140
20141 #<nowiki>#foo</nowiki>
20142
20143 #<nowiki>:foo</nowiki>
20144
20145 #<nowiki>;foo</nowiki>
20146 !! html
20147 <ul><li>*foo</li></ul>
20148 <ul><li>#foo</li></ul>
20149 <ul><li>:foo</li></ul>
20150 <ul><li>;foo</li></ul>
20151 <ol><li>*foo</li></ol>
20152 <ol><li>#foo</li></ol>
20153 <ol><li>:foo</li></ol>
20154 <ol><li>;foo</li></ol>
20155
20156 !!end
20157
20158 !! test
20159 Lists: 2. Inside definition lists
20160 !! wikitext
20161 ;<nowiki>;foo</nowiki>
20162
20163 ;<nowiki>:foo</nowiki>
20164
20165 ;<nowiki>:foo</nowiki>
20166 :bar
20167
20168 :<nowiki>:foo</nowiki>
20169 !! html
20170 <dl><dt>;foo</dt></dl>
20171 <dl><dt>:foo</dt></dl>
20172 <dl><dt>:foo</dt>
20173 <dd>bar</dd></dl>
20174 <dl><dd>:foo</dd></dl>
20175
20176 !!end
20177
20178 !! test
20179 Lists: 3. Only bullets at start of text should be escaped
20180 !! wikitext
20181 *<nowiki>*foo*bar</nowiki>
20182
20183 *<nowiki>*foo</nowiki>''it''*bar
20184 !! html
20185 <ul><li>*foo*bar</li></ul>
20186 <ul><li>*foo<i>it</i>*bar</li></ul>
20187
20188 !!end
20189
20190 !! test
20191 Lists: 4. No escapes needed
20192 !! options
20193 parsoid
20194 !! wikitext
20195 *foo*bar
20196
20197 *''foo''*bar
20198
20199 *[[Foo]]: bar
20200
20201 *[[Foo]]*bar
20202 !! html
20203 <ul>
20204 <li>foo*bar
20205 </li>
20206 </ul>
20207 <ul>
20208 <li><i>foo</i>*bar
20209 </li>
20210 </ul>
20211 <ul>
20212 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
20213 </li>
20214 </ul>
20215 <ul>
20216 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
20217 </li>
20218 </ul>
20219 !!end
20220
20221 !! test
20222 Lists: 5. No unnecessary escapes
20223 !! wikitext
20224 * bar <span><nowiki>[[foo]]</nowiki></span>
20225
20226 *=bar <span><nowiki>[[foo]]</nowiki></span>
20227
20228 *[[bar <span><nowiki>[[foo]]</nowiki></span>
20229
20230 *]]bar <span><nowiki>[[foo]]</nowiki></span>
20231
20232 *=bar <span>foo]]</span>=
20233
20234 * <s></s>: a
20235 !! html
20236 <ul><li> bar <span>[[foo]]</span></li></ul>
20237 <ul><li>=bar <span>[[foo]]</span></li></ul>
20238 <ul><li>[[bar <span>[[foo]]</span></li></ul>
20239 <ul><li>]]bar <span>[[foo]]</span></li></ul>
20240 <ul><li>=bar <span>foo]]</span>=</li></ul>
20241 <ul><li> <s></s>: a</li></ul>
20242
20243 !!end
20244
20245 !! test
20246 Lists: 6. Escape bullets in SOL position
20247 !! options
20248 parsoid
20249 !! wikitext
20250 <!--cmt--><nowiki>*foo</nowiki>
20251 !! html
20252 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
20253 !!end
20254
20255 !! test
20256 Lists: 7. Escape bullets in a multi-line context
20257 !! wikitext
20258 a
20259 <nowiki>*</nowiki>b
20260 !! html
20261 <p>a
20262 *b
20263 </p>
20264 !!end
20265
20266 #### --------------- HRs ---------------
20267 #### 1. Single line
20268 #### -----------------------------------
20269
20270 !! test
20271 HRs: 1. Single line
20272 !! options
20273 parsoid
20274 !! wikitext
20275 ----<nowiki>----</nowiki>
20276 ----=foo=
20277 ----*foo
20278 !! html
20279 <hr><p><span typeof="mw:Nowiki">----</span></p>
20280 <hr><p>=foo=</p>
20281 <hr><p>*foo</p>
20282 !! end
20283
20284 #### --------------- Tables ---------------
20285 #### 1a. Simple example
20286 #### 1b. No escaping needed (!foo)
20287 #### 1c. No escaping needed (|foo)
20288 #### 1d. No escaping needed (|}foo)
20289 ####
20290 #### 2a. Nested in td (<td>foo|bar</td>)
20291 #### 2b. Nested in td (<td>foo||bar</td>)
20292 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
20293 ####
20294 #### 3a. Nested in th (<th>foo!bar</th>)
20295 #### 3b. Nested in th (<th>foo!!bar</th>)
20296 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
20297 ####
20298 #### 4a. Escape -
20299 #### 4b. Escape +
20300 #### 4c. No escaping needed
20301 #### --------------------------------------
20302
20303 !! test
20304 Tables: 1a. Simple example
20305 !! wikitext
20306 <nowiki>{|
20307 |}</nowiki>
20308 !! html
20309 <p>{|
20310 |}
20311 </p>
20312 !! end
20313
20314 !! test
20315 Tables: 1b. No escaping needed
20316 !! wikitext
20317 !foo
20318 !! html
20319 <p>!foo
20320 </p>
20321 !! end
20322
20323 !! test
20324 Tables: 1c. No escaping needed
20325 !! wikitext
20326 |foo
20327 !! html
20328 <p>|foo
20329 </p>
20330 !! end
20331
20332 !! test
20333 Tables: 1d. No escaping needed
20334 !! wikitext
20335 |}foo
20336 !! html
20337 <p>|}foo
20338 </p>
20339 !! end
20340
20341 !! test
20342 Tables: 2a. Nested in td
20343 !! options
20344 parsoid=html2wt
20345 !! wikitext
20346 {|
20347 |<nowiki>foo|bar</nowiki>
20348 |-
20349 |x<div><nowiki>a|b</nowiki></div>
20350 |}
20351 !! html
20352 <table><tbody><tr>
20353 <td>foo|bar</td></tr>
20354 <tr><td>x<div>a|b</div></td>
20355 </tbody></table>
20356 !! end
20357
20358 !! test
20359 Tables: 2b. Nested in td
20360 !! options
20361 parsoid
20362 !! wikitext
20363 {|
20364 |<nowiki>foo||bar</nowiki>
20365 |''it''<nowiki>foo||bar</nowiki>
20366 |}
20367 !! html
20368 <table><tbody><tr>
20369 <td><span typeof="mw:Nowiki">foo||bar</span></td>
20370 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
20371 !! end
20372
20373 !! test
20374 Tables: 2c. Nested in td -- no escaping needed
20375 !! options
20376 parsoid
20377 !! wikitext
20378 {|
20379 |foo!!bar
20380 |}
20381 !! html
20382 <table><tbody><tr><td>foo!!bar
20383 </td></tr></tbody></table>
20384
20385 !! end
20386
20387 !! test
20388 Tables: 3a. Nested in th
20389 !! options
20390 parsoid
20391 !! wikitext
20392 {|
20393 !foo!bar
20394 |}
20395 !! html
20396 <table><tbody><tr><th>foo!bar
20397 </th></tr></tbody></table>
20398
20399 !! end
20400
20401 !! test
20402 Tables: 3b. Nested in th
20403 !! options
20404 parsoid
20405 !! wikitext
20406 {|
20407 !<nowiki>foo!!bar</nowiki>
20408 |}
20409 !! html
20410 <table>
20411 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
20412 </tbody></table>
20413 !! end
20414
20415 !! test
20416 Tables: 3c. Nested in th -- no escaping needed
20417 !! options
20418 parsoid
20419 !! wikitext
20420 {|
20421 !<nowiki>foo||bar</nowiki>
20422 |}
20423 !! html
20424 <table><tbody><tr>
20425 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
20426 !! end
20427
20428 !! test
20429 Tables: 4a. Escape -
20430 !! options
20431 parsoid
20432 !! wikitext
20433 {|
20434 !-bar
20435 |-
20436 |<nowiki>-bar</nowiki>
20437 |}
20438 !! html
20439 <table><tbody>
20440 <tr><th>-bar</th></tr>
20441 <tr>
20442 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
20443 !! end
20444
20445 !! test
20446 Tables: 4b. Escape +
20447 !! options
20448 parsoid
20449 !! wikitext
20450 {|
20451 !+bar
20452 |-
20453 |<nowiki>+bar</nowiki>
20454 |}
20455 !! html
20456 <table><tbody>
20457 <tr><th>+bar</th></tr>
20458 <tr>
20459 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
20460 !! end
20461
20462 !! test
20463 Tables: 4c. No escaping needed
20464 !! options
20465 parsoid
20466 !! wikitext
20467 {|
20468 |foo-bar
20469 |foo+bar
20470 |-
20471 |''foo''-bar
20472 |''foo''+bar
20473 |-
20474 |foo
20475 bar|baz
20476 +bar
20477 -bar
20478 |-
20479 |x
20480 <div>a|b</div>
20481 |}
20482 !! html
20483 <table><tbody>
20484 <tr><td>foo-bar</td><td>foo+bar</td></tr>
20485 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
20486 <tr><td>foo
20487 <p>bar|baz
20488 +bar
20489 -bar</p></td></tr>
20490 <tr><td>x
20491 <div>a|b</div></td>
20492 </tbody></table>
20493 !! end
20494
20495 !! test
20496 Tables: 4d. No escaping needed
20497 !! options
20498 parsoid
20499 !! wikitext
20500 {|
20501 |[[Foo]]-bar
20502 ||+1
20503 ||-2
20504 |}
20505 !! html
20506 <table>
20507 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
20508 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
20509 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
20510 </tbody></table>
20511 !! end
20512
20513 !! test
20514 Tables: Digest broken attributes on table and tr tag
20515 !! options
20516 parsoid=wt2html
20517 !! wikitext
20518 {| || |} ++
20519 |- || || ++ --
20520 |- > [
20521 |}
20522 !! html
20523 <table>
20524 <tbody>
20525 <tr></tr>
20526 <tr></tr>
20527 </tbody></table>
20528 !! end
20529
20530 #### --------------- Links ----------------
20531 #### 1. Quote marks in link text
20532 #### 2. Wikilinks: Escapes needed
20533 #### 3. Wikilinks: No escapes needed
20534 #### 4. Extlinks: Escapes needed
20535 #### 5. Extlinks: No escapes needed
20536 #### --------------------------------------
20537 !! test
20538 Links 1. Quote marks in link text
20539 !! options
20540 parsoid
20541 !! wikitext
20542 [[Foo|Foo<nowiki>''boo''</nowiki>]]
20543 !! html
20544 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
20545 !! end
20546
20547 !! test
20548 Links 2. WikiLinks: Escapes needed
20549 !! options
20550 parsoid
20551 !! wikitext
20552 [[Foo|[Foobar]]]
20553 [[Foo|<nowiki>Foobar]</nowiki>]]
20554 [[Foo|x [Foobar] x]]
20555 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
20556 [[Foo|<nowiki>[[Bar]]</nowiki>]]
20557 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
20558 [[Foo|<nowiki>|Bar</nowiki>]]
20559 [[Foo|<nowiki>]]bar</nowiki>]]
20560 [[Foo|<nowiki>[[bar</nowiki>]]
20561 [[Foo|<nowiki>x [[ y</nowiki>]]
20562 [[Foo|<nowiki>x ]] y</nowiki>]]
20563 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
20564 !! html
20565 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
20566 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
20567 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
20568 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
20569 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
20570 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
20571 <a href="Foo" rel="mw:WikiLink">|Bar</a>
20572 <a href="Foo" rel="mw:WikiLink">]]bar</a>
20573 <a href="Foo" rel="mw:WikiLink">[[bar</a>
20574 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
20575 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
20576 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
20577 !! end
20578
20579 !! test
20580 Links 3. WikiLinks: No escapes needed
20581 !! options
20582 parsoid
20583 !! wikitext
20584 [[Foo|[Foobar]]
20585 [[Foo|foo|bar]]
20586 !! html
20587 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
20588 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
20589 !! end
20590
20591 !! test
20592 Links 4. ExtLinks: Escapes needed
20593 !! options
20594 parsoid
20595 !! wikitext
20596 [http://google.com <nowiki>[google]</nowiki>]
20597 [http://google.com <nowiki>google]</nowiki>]
20598
20599 <nowiki>[http://google.com]</nowiki>
20600
20601 <nowiki>[http://google.com google]</nowiki>
20602
20603 !! html
20604 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
20605 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
20606 <p>[http://google.com]</p>
20607 <p>[http://google.com google]</p>
20608 !! end
20609
20610 !! test
20611 Links 5. ExtLinks: No escapes needed
20612 !! options
20613 parsoid
20614 !! wikitext
20615 [http://google.com [google]
20616 !! html
20617 <a href="http://google.com" rel="mw:ExtLink">[google</a>
20618 !! end
20619
20620 !! test
20621 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
20622 !! html/parsoid
20623 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
20624 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
20625 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
20626 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
20627 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
20628 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
20629 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20630 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
20631 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20632 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
20633 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
20634 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
20635 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
20636 </p>
20637 !! wikitext
20638 x<nowiki/>http://example.com<nowiki/>y
20639 http://example.com<nowiki/>?x
20640 http://example.com<nowiki/>&x
20641 http://example.com<nowiki/>'x
20642 http://example.com<nowiki/>,x
20643 http://example.com<nowiki/>.x
20644 http://example.com<nowiki/>;x
20645 http://example.com<nowiki/>:x
20646 http://example.com<nowiki/>;x
20647 http://example.com<nowiki/>!x
20648 http://example.com<nowiki/>=x
20649 http://example.com<nowiki/>(x)
20650 http://example.com(x<nowiki/>)
20651 !! end
20652
20653 !! test
20654 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20655 !! html/parsoid
20656 <p>x
20657 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
20658 y
20659 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
20660 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
20661 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
20662 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
20663 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
20664 </p>
20665 !! wikitext
20666 x
20667 http://example.com
20668 y
20669 "http://example.com"
20670 (http://example.com)
20671 (http://example.com) foo
20672 http://example.com,
20673 http://example.com, foo
20674 !! end
20675
20676 ## Parsoid currently fails wt2html on this one!
20677 !! test
20678 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20679 !! html/parsoid
20680 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
20681 !! wikitext
20682 http://example.com.,;:!?
20683 !! end
20684
20685 !! test
20686 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
20687 !! html/parsoid
20688 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
20689 !! wikitext
20690 RFC 123<nowiki/>4
20691 !! end
20692
20693 !! test
20694 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
20695 !! html/parsoid
20696 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20697 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20698 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
20699 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
20700 </p>
20701 !! wikitext
20702 xRFC 123y
20703 XRFC 123y
20704 RFC 123?foo
20705 RFC 123&foo
20706 !! end
20707
20708 !! test
20709 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
20710 !! html/parsoid
20711 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
20712 !! wikitext
20713 PMID 123<nowiki/>4
20714 !! end
20715
20716 !! test
20717 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
20718 !! html/parsoid
20719 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20720 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20721 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
20722 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
20723 </p>
20724 !! wikitext
20725 xPMID 123y
20726 XPMID 123y
20727 PMID 123?foo
20728 PMID 123&foo
20729 !! end
20730
20731 !! test
20732 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
20733 !! html/parsoid
20734 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
20735 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
20736 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
20737 </p>
20738 !! wikitext
20739 ISBN 1234567890<nowiki/>1
20740 ISBN 1234567890<nowiki/>x
20741 ISBN 1234567890<nowiki/>b
20742 !! end
20743
20744 !! test
20745 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
20746 !! html/parsoid
20747 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
20748 !! wikitext
20749 ISBN 1234567890's
20750 !! end
20751
20752 #### --------------- Quotes ---------------
20753 #### 1. Quotes inside <b> and <i>
20754 #### 2. Link fragments separated by <i> and <b> tags
20755 #### 3. Link fragments inside <i> and <b>
20756 #### 4. No escaping needed
20757 #### --------------------------------------
20758 !! test
20759 1. Quotes inside <b> and <i>
20760 !! options
20761 parsoid=html2wt,wt2wt
20762 !! wikitext
20763 ''<nowiki/>'foo'<nowiki/>''
20764 ''<nowiki>''foo''</nowiki>''
20765 ''<nowiki>'''foo'''</nowiki>''
20766 ''foo''<nowiki/>'s
20767 '''<nowiki/>'foo'<nowiki/>'''
20768 '''<nowiki>''foo''</nowiki>'''
20769 '''<nowiki>'''foo'''</nowiki>'''
20770 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
20771 '''foo'''<nowiki/>'s
20772 '<nowiki/>''foo''
20773 ''foo''<nowiki/>'
20774 '<nowiki/>''foo''<nowiki/>'
20775 '<nowiki/>'''foo'''
20776 '''foo'''<nowiki/>'
20777 '<nowiki/>'''foo'''<nowiki/>'
20778 ''fools'<span> errand</span>''
20779 ''<span>fool</span>'s errand''
20780 !! html/*
20781 <p><i>'foo'</i>
20782 <i>''foo''</i>
20783 <i>'''foo'''</i>
20784 <i>foo</i>'s
20785 <b>'foo'</b>
20786 <b>''foo''</b>
20787 <b>'''foo'''</b>
20788 <b>foo'<i>bar'</i>baz</b>
20789 <b>foo</b>'s
20790 '<i>foo</i>
20791 <i>foo</i>'
20792 '<i>foo</i>'
20793 '<b>foo</b>
20794 <b>foo</b>'
20795 '<b>foo</b>'
20796 <i>fools'<span> errand</span></i>
20797 <i><span>fool</span>'s errand</i>
20798 </p>
20799 !! end
20800
20801 !! test
20802 2. Link fragments separated by <i> and <b> tags
20803 !! wikitext
20804 [[''foo''<nowiki>hello]]</nowiki>
20805
20806 [['''foo'''<nowiki>hello]]</nowiki>
20807 !! html
20808 <p>[[<i>foo</i>hello]]
20809 </p><p>[[<b>foo</b>hello]]
20810 </p>
20811 !! end
20812
20813 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
20814 # this is one of the shortcomings of this format
20815 !! test
20816 3. Link fragments inside <i> and <b>
20817 !! wikitext
20818 ''[[foo''<nowiki>]]</nowiki>
20819
20820 '''[[foo'''<nowiki>]]</nowiki>
20821 !! html
20822 <p><i>[[foo</i>]]
20823 </p><p><b>[[foo</b>]]
20824 </p>
20825 !! end
20826
20827 !! test
20828 4. No escaping needed
20829 !! wikitext
20830 '<span>''bar''</span>'
20831 '<span>'''bar'''</span>'
20832 !! html
20833 <p>'<span><i>bar</i></span>'
20834 '<span><b>bar</b></span>'
20835 </p>
20836 !! end
20837
20838 #### ----------- Paragraphs ---------------
20839 #### 1. No unnecessary escapes
20840 #### --------------------------------------
20841
20842 !! test
20843 1. No unnecessary escapes
20844 !! wikitext
20845 bar <span><nowiki>[[foo]]</nowiki></span>
20846
20847 =bar <span><nowiki>[[foo]]</nowiki></span>
20848
20849 [[bar <span><nowiki>[[foo]]</nowiki></span>
20850
20851 ]]bar <span><nowiki>[[foo]]</nowiki></span>
20852
20853 =bar <span>foo]]</span><nowiki>=</nowiki>
20854 !! html
20855 <p>bar <span>[[foo]]</span>
20856 </p><p>=bar <span>[[foo]]</span>
20857 </p><p>[[bar <span>[[foo]]</span>
20858 </p><p>]]bar <span>[[foo]]</span>
20859 </p><p>=bar <span>foo]]</span>=
20860 </p>
20861 !!end
20862
20863 #### ----------------------- PRE --------------------------
20864 #### 1. Leading whitespace in SOL context should be escaped
20865 #### ------------------------------------------------------
20866 !! test
20867 1. Leading whitespace in SOL context should be escaped
20868 !! options
20869 parsoid
20870 !! wikitext
20871 <nowiki> </nowiki>a
20872
20873 <nowiki> </nowiki> a
20874
20875 <nowiki> </nowiki>a(tab)
20876
20877 <nowiki> </nowiki> a
20878 <!--cmt-->
20879 <nowiki> </nowiki> a
20880
20881 a
20882 <nowiki> </nowiki>b
20883
20884 a
20885 <nowiki> </nowiki>b
20886
20887 a
20888 <nowiki> </nowiki> b
20889 !! html
20890 <p> a</p>
20891 <p> a</p>
20892 <p> a(tab)</p>
20893 <p> a</p>
20894 <p><!--cmt--> a</p>
20895 <p>a
20896 b</p>
20897 <p>a
20898 b</p>
20899 <p>a
20900 b</p>
20901 !! end
20902
20903 !! test
20904 2. Leading whitespace in non-indent-pre contexts should not be escaped
20905 !! options
20906 parsoid
20907 !! wikitext
20908 foo <ref>''a''
20909 b</ref>
20910 !! html
20911 <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>
20912 !! end
20913
20914 !! test
20915 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
20916 !! options
20917 parsoid
20918 !! wikitext
20919 <blockquote>
20920 a
20921 <span>b</span>
20922 c
20923 </blockquote>
20924 !! html
20925 <blockquote>
20926 <p>
20927 a
20928 <span>b</span>
20929 c</p>
20930 </blockquote>
20931 !! end
20932
20933 !! test
20934 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
20935 !! options
20936 parsoid
20937 !! wikitext
20938 [[File:Foobar.jpg|thumb|caption]]
20939 !! html
20940 !! html/parsoid
20941 <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>
20942 !! end
20943
20944 !! test
20945 5. Nowiki escaping should account for indent-pres
20946 !! options
20947 parsoid=html2wt
20948 !! html
20949 <pre>==foo==</pre>
20950 !! wikitext
20951 ==foo==
20952 !! end
20953
20954 #### --------------- Behavior Switches --------------------
20955 !! test
20956 1. Valid behavior switches should be escaped
20957 !! options
20958 parsoid=html2wt
20959 !! wikitext
20960 <nowiki>__TOC__</nowiki>
20961 ''<nowiki>__TOC__</nowiki>''
20962 !! html
20963 __TOC__
20964 <i>__TOC__</i>
20965 !! end
20966
20967 !! test
20968 2. Invalid behavior switches should not be escaped
20969 !! options
20970 parsoid=html2wt
20971 !! wikitext
20972 __TOO__
20973 __|__
20974 !! html
20975 __TOO__
20976 __|__
20977 !! end
20978
20979 #### --------------- HTML tags ---------------
20980 #### 1. a tags
20981 #### 2. other tags
20982 #### 3. multi-line html tag
20983 #### 4. extension tags
20984 #### -----------------------------------------
20985 !! test
20986 1. a tags
20987 !! options
20988 parsoid
20989 !! wikitext
20990 <a href="http://google.com">google</a>
20991 !! html
20992 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
20993 !! end
20994
20995 !! test
20996 2. other tags
20997 !! wikitext
20998 <nowiki><div>foo</div>
20999 <div style="color:red">foo</div></nowiki>
21000 !! html
21001 <p>&lt;div&gt;foo&lt;/div&gt;
21002 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
21003 </p>
21004 !! end
21005
21006 !! test
21007 3. multi-line html tag
21008 !! wikitext
21009 <nowiki><div
21010 >foo</div
21011 ></nowiki>
21012 !! html
21013 <p>&lt;div
21014 &gt;foo&lt;/div
21015 &gt;
21016 </p>
21017 !! end
21018
21019 !! test
21020 4. extension tags
21021 !! wikitext
21022 <nowiki><ref>foo</ref></nowiki>
21023
21024 <nowiki><ref>bar</nowiki>
21025
21026 baz<nowiki></ref></nowiki>
21027 !! html
21028 <p>&lt;ref&gt;foo&lt;/ref&gt;
21029 </p><p>&lt;ref&gt;bar
21030 </p><p>baz&lt;/ref&gt;
21031 </p>
21032 !! end
21033
21034 #### --------------- Others ---------------
21035 !! test
21036 Escaping nowikis
21037 !! wikitext
21038 &lt;nowiki&gt;foo&lt;/nowiki&gt;
21039 !! html
21040 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
21041 </p>
21042 !! end
21043
21044 ## The quote-char in the input is necessary for triggering the bug
21045 !! test
21046 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
21047 !! options
21048 parsoid=wt2wt,html2wt
21049 !! wikitext
21050 foo's bar :
21051 !! html
21052 <p>foo's bar :</p>
21053 !! end
21054
21055 !! test
21056
21057 Tag-like HTML structures are passed through as text
21058 !! wikitext
21059 <x y>
21060
21061 <x.y>
21062
21063 <x-y>
21064
21065 1>2
21066
21067 x<y
21068
21069 a>b
21070
21071 1<d e>f
21072 !! html
21073 <p>&lt;x y&gt;
21074 </p><p>&lt;x.y&gt;
21075 </p><p>&lt;x-y&gt;
21076 </p><p>1&gt;2
21077 </p><p>x&lt;y
21078 </p><p>a&gt;b
21079 </p><p>1&lt;d e&gt;f
21080 </p>
21081 !! end
21082
21083
21084 # This was a bug in the PHP parser (see bug 17663 and its dups,
21085 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
21086 !! test
21087 Tag names followed by punctuation should not be recognized as tags
21088 !! wikitext
21089 <s.ome> text
21090 !! html
21091 <p>&lt;s.ome&gt; text
21092 </p>
21093 !! end
21094
21095 !! test
21096 HTML tag with necessary entities in attributes
21097 !! wikitext
21098 <span title="&amp;amp;">foo</span>
21099 !! html
21100 <p><span title="&amp;amp;">foo</span>
21101 </p>
21102 !! end
21103
21104 !! test
21105 HTML tag with 'unnecessary' entity encoding in attributes
21106 !! wikitext
21107 <span title="&amp;">foo</span>
21108 !! html
21109 <p><span title="&amp;">foo</span>
21110 </p>
21111 !! end
21112
21113 !! test
21114 HTML tag with broken attribute value quoting
21115 !! wikitext
21116 <span title="Hello world>Foo</span>
21117 !! html/php
21118 <p><span>Foo</span>
21119 </p>
21120 !! html/parsoid
21121 <p><span title="Hello world">Foo</span>
21122 </p>
21123 !! end
21124
21125 !! test
21126 Parsoid-only: HTML tag with broken attribute value quoting
21127 !! options
21128 parsoid
21129 !! wikitext
21130 <span title="Hello world>Foo</span>
21131 !! html
21132 <p><span title="Hello world">Foo</span>
21133 </p>
21134 !! end
21135
21136 !! test
21137 Table with broken attribute value quoting
21138 !! wikitext
21139 {|
21140 | title="Hello world|Foo
21141 |}
21142 !! html/php
21143 <table>
21144 <tr>
21145 <td>Foo
21146 </td></tr></table>
21147
21148 !! html/parsoid
21149 <table>
21150 <tr>
21151 <td title="Hello world">Foo
21152 </td></tr></table>
21153
21154 !! end
21155
21156 !! test
21157 Table with broken attribute value quoting on consecutive lines
21158 !! wikitext
21159 {|
21160 | title="Hello world|Foo
21161 | style="color:red|Bar
21162 |}
21163 !! html/php
21164 <table>
21165 <tr>
21166 <td>Foo
21167 </td>
21168 <td>Bar
21169 </td></tr></table>
21170
21171 !! html/parsoid
21172 <table><tbody>
21173 <tr>
21174 <td title="Hello world">Foo
21175 </td><td style="color: red">Bar
21176 </td></tr></tbody></table>
21177
21178 !! end
21179
21180 !! test
21181 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21182 !! options
21183 parsoid
21184 !! wikitext
21185 {{}}
21186 !! html
21187 {{}}
21188 !! end
21189
21190 !! test
21191 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21192 !! options
21193 parsoid
21194 !! wikitext
21195 }}{{
21196 !! html
21197 }}{{
21198 !! end
21199
21200 !!test
21201 Accept empty td cell attribute
21202 !! wikitext
21203 {|
21204 | align="center" | foo || |
21205 |}
21206 !! html
21207 <table>
21208 <tr>
21209 <td align="center"> foo </td>
21210 <td>
21211 </td></tr></table>
21212
21213 !!end
21214
21215 !!test
21216 Non-empty attributes in th-cells
21217 !! wikitext
21218 {|
21219 ! Foo !! style="color: red" | Bar
21220 |}
21221 !! html
21222 <table>
21223 <tr>
21224 <th> Foo </th>
21225 <th style="color: red"> Bar
21226 </th></tr></table>
21227
21228 !!end
21229
21230 !!test
21231 Accept empty attributes in th-cells
21232 !! wikitext
21233 {|
21234 !| foo !!| bar
21235 |}
21236 !! html
21237 <table>
21238 <tr>
21239 <th> foo </th>
21240 <th> bar
21241 </th></tr></table>
21242
21243 !!end
21244
21245 !!test
21246 Empty table rows go away
21247 !! wikitext
21248 {|
21249 | Hello
21250 | there
21251 |- class="foo"
21252 |-
21253 |}
21254 !! html
21255 <table>
21256 <tr>
21257 <td> Hello
21258 </td>
21259 <td> there
21260 </td></tr>
21261
21262 </table>
21263
21264 !! end
21265
21266 ###
21267 ### Parsoid-centric tests for testing RTing of inter-element separators
21268 ### Edge cases not tested by existing parser tests and specific to
21269 ### Parsoid-specific serialization strategies.
21270 ###
21271
21272 !!test
21273 RT-ed inter-element separators should be valid separators
21274 !! wikitext
21275 {|
21276 |- [[foo]]
21277 |}
21278 !! html
21279 <table>
21280
21281 </table>
21282
21283 !!end
21284
21285 # Parsoid-only since PHP parser relies on Tidy for correct output
21286 !!test
21287 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
21288 !!options
21289 parsoid
21290 !! wikitext
21291 {|
21292 |<small>foo
21293 bar
21294 |}
21295
21296 {|
21297 |<small>foo<small>
21298 |}
21299 !! html
21300 <table>
21301 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
21302 <p>bar</p></small></td></tr>
21303 </tbody></table>
21304
21305 <table>
21306 <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>
21307 </tbody></table>
21308 !!end
21309
21310 !!test
21311 Empty TD followed by TD with tpl-generated attribute
21312 !! wikitext
21313 {|
21314 |-
21315 |
21316 |{{echo|style='color:red'}}|foo
21317 |}
21318 !! html
21319 <table>
21320
21321 <tr>
21322 <td>
21323 </td>
21324 <td>foo
21325 </td></tr></table>
21326
21327 !!end
21328
21329 !!test
21330 Indented table with an empty td
21331 !! wikitext
21332 {|
21333 |-
21334 |
21335 |foo
21336 |}
21337 !! html
21338 <table>
21339
21340 <tr>
21341 <td>
21342 </td>
21343 <td>foo
21344 </td></tr></table>
21345
21346 !!end
21347
21348 !!test
21349 Indented block & table
21350 !! wikitext
21351 <div>foo</div>
21352 {|
21353 |foo
21354 |}
21355 !! html/php
21356 <div>foo</div>
21357 <table>
21358 <tr>
21359 <td>foo
21360 </td></tr></table>
21361
21362 !! html/parsoid
21363 <div data-parsoid='{"stx":"html"}'>foo</div>
21364 <table><tbody>
21365 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
21366 </tbody></table>
21367 !!end
21368
21369 !! test
21370 Indent and comment before table row
21371 !! wikitext
21372 {|
21373 <!--hi-->|-
21374 | there
21375 |}
21376 !! html/php
21377 <table>
21378
21379 <tr>
21380 <td> there
21381 </td></tr></table>
21382
21383 !! html/parsoid
21384 <table>
21385 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
21386 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
21387 </tbody></table>
21388 !! end
21389
21390 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
21391 !!test
21392 Empty TR followed by a template-generated TR
21393 !!options
21394 parsoid
21395 !! wikitext
21396 {|
21397 |-
21398 {{echo|<tr><td>foo</td></tr>}}
21399 |}
21400 !! html
21401 <table>
21402 <tbody>
21403 <tr></tr>
21404 <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}}]}'>
21405 <td>foo</td></tr>
21406 </tbody></table>
21407 !!end
21408
21409 ## PHP and parsoid output differ for this, and since this is primarily
21410 ## for testing Parsoid's serializer, marking this Parsoid only
21411 !!test
21412 Empty TR followed by mixed-ws-comment line should RT correctly
21413 !!options
21414 parsoid
21415 !! wikitext
21416 {|
21417 |-
21418 <!--c-->
21419 |-
21420 <!--c--> <!--d-->
21421 |}
21422 !! html
21423 <table>
21424 <tbody>
21425 <tr></tr>
21426 <!--c-->
21427 <tr>
21428 <!--c--> </tr><!--d-->
21429 </tbody></table>
21430
21431 !!end
21432
21433 !!test
21434 Multi-line image caption generated by templates with/without trailing newlines
21435 !! wikitext
21436 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
21437 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
21438 !! html/parsoid
21439 <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>
21440 <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>
21441 !!end
21442
21443 !! test
21444 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
21445 !! options
21446 parsoid=html2wt
21447 !! wikitext
21448 <includeonly>foo</includeonly>
21449 new para
21450
21451 [[./Category:Foo]]
21452
21453 = new heading =
21454 !! html
21455 <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>
21456
21457 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
21458 !! end
21459
21460 ## PHP emits broken html for this, and since this is primarily
21461 ## a Parsoid serializer test, marking this Parsoid only
21462 !!test
21463 Improperly nested inline or quotes tags with whitespace in between
21464 !!options
21465 parsoid
21466 !! wikitext
21467 <span> <s>x</span> </s>
21468 ''' ''x''' ''
21469 !! html
21470 <p><span> <s>x</s></span><s> </s>
21471 <b> <i>x</i></b><i> </i>
21472 </p>
21473 !!end
21474
21475 !!test
21476 Encapsulate protected attributes from wt
21477 !!options
21478 parsoid
21479 !! wikitext
21480 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
21481 !! html
21482 <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>
21483 </body>
21484 !!end
21485
21486 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
21487 ## Having nested or stray pre tags results in the attempt to add duplicates,
21488 ## causing an assertion fail. This test tries to prevent that situation.
21489 !!test
21490 Ensure ParagraphWrapper can deal with stray closing pre tags
21491 !!options
21492 parsoid=wt2html
21493 !! wikitext
21494 plain text</pre>
21495 !! html
21496 plain text
21497 !!end
21498
21499 !!test
21500 1. Ensure fostered text content is wrapped in element nodes
21501 !!options
21502 parsoid=wt2html
21503 !! wikitext
21504 <table>hi</table><table>ho</table>
21505 !! html
21506 <p>hi</p>
21507 <table></table>
21508 <p>ho</p>
21509 <table></table>
21510 !!end
21511
21512 !!test
21513 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
21514 !!options
21515 parsoid=wt2html,wt2wt
21516 !! wikitext
21517 <table>
21518 <tr> || ||
21519 <td> a
21520 </table>
21521 !! html
21522 <p> || ||
21523 </p><table>
21524 <tbody><tr><td> a</td></tr>
21525 </tbody></table>
21526 !!end
21527
21528 !!test
21529 Encapsulation properly handles null DSR information from foster box
21530 !!options
21531 parsoid=wt2html,wt2wt
21532 !! wikitext
21533 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
21534 !! html
21535 <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>
21536 !!end
21537
21538 !!test
21539 1. Encapsulate foster-parented transclusion content
21540 !!options
21541 parsoid=wt2wt,wt2html
21542 !! wikitext
21543 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
21544 !! html
21545 <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>
21546 <tbody>
21547 <tr>
21548 <td>bar</td>
21549 </tr>
21550 </tbody>
21551 </table>
21552 !!end
21553
21554 !!test
21555 2. Encapsulate foster-parented transclusion content
21556 !!options
21557 parsoid=wt2wt,wt2html
21558 !! wikitext
21559 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
21560 !! html
21561 <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>
21562 <table>
21563 <tbody>
21564 <tr>
21565 <td>bar</td>
21566 </tr>
21567 </tbody>
21568 </table>
21569 !!end
21570
21571 !!test
21572 3. Encapsulate foster-parented transclusion content
21573 !!options
21574 parsoid=wt2wt,wt2html
21575 !! wikitext
21576 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21577 !! html
21578 <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;]}">
21579 <p>foo</p>
21580 </div>
21581 <table>
21582 <tbody>
21583 <tr>
21584 <td>bar</td>
21585 </tr>
21586 </tbody>
21587 </table>
21588 !!end
21589
21590 !!test
21591 4. Encapsulate foster-parented transclusion content
21592 !!options
21593 parsoid=wt2wt,wt2html
21594 !! wikitext
21595 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21596 !! html
21597 <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;]}">
21598 <p>foo</p>
21599 </div>
21600 <table>
21601 <tbody>
21602 <tr>
21603 <td>bar</td>
21604 </tr>
21605 </tbody>
21606 </table>
21607 !!end
21608
21609 !!test
21610 5. Encapsulate foster-parented transclusion content
21611 !!options
21612 parsoid=wt2wt,wt2html
21613 !! wikitext
21614 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
21615 !! html
21616 <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>
21617 <table>
21618 <tbody>
21619 <tr>
21620 <td>
21621 <div>
21622 <p>foo</p>
21623 </div>
21624 </td>
21625 </tr>
21626 </tbody>
21627 </table>
21628 !!end
21629
21630 !!test
21631 6. Encapsulate foster-parented transclusion content
21632 !!options
21633 parsoid=wt2wt,wt2html
21634 !! wikitext
21635 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
21636 !! html
21637 <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>
21638 <table>
21639 <tbody>
21640 <tr>
21641 <td>
21642 <div>
21643 <p>foo</p>
21644 </div>
21645 </td>
21646 </tr>
21647 </tbody>
21648 </table>
21649 <p>ok</p>
21650 !!end
21651
21652 !!test
21653 7. Encapsulate foster-parented transclusion content
21654 !!options
21655 parsoid=wt2wt,wt2html
21656 !! wikitext
21657 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
21658 !! html
21659 <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>
21660 <table>
21661 <tbody>
21662 <tr>
21663 <td>bar</td>
21664 </tr>
21665 </tbody>
21666 </table>
21667 !!end
21668
21669 !!test
21670 8. Encapsulate foster-parented transclusion content
21671 !!options
21672 parsoid=wt2wt,wt2html
21673 !! wikitext
21674 {{echo|a
21675 }}{|{{echo|style='color:red'}}
21676 |-
21677 |b
21678 |}
21679 !! html
21680 <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>
21681 <tbody>
21682 <tr>
21683 <td>b</td>
21684 </tr>
21685 </tbody>
21686 </table>
21687 !!end
21688
21689 !!test
21690 9. Encapsulate foster-parented transclusion content
21691 !!options
21692 parsoid=wt2wt,wt2html
21693 !! wikitext
21694 <table>{{echo|hi</table>hello}}
21695 !! html
21696 <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>
21697 !!end
21698
21699 !!test
21700 Table in fosterable position
21701 !!options
21702 parsoid=wt2html,wt2wt
21703 !! wikitext
21704 {{OpenTable}}
21705 <div>
21706 {|
21707 |}
21708 </div>
21709 |}
21710 !! html
21711 <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">
21712 </span>
21713 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
21714
21715 <table>
21716 </table>
21717 !!end
21718
21719 # Parsoid only for bug 64747
21720 !! test
21721 Properly encapsulate empty-content transclusions in fosterable positions
21722 !! wikitext
21723 <table>
21724 {{#if:|
21725 <td>foo</td>
21726 }}
21727 </table>
21728 !! html/parsoid
21729 <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>"}'>
21730
21731 </table>
21732 !! end
21733
21734 !!test
21735 Support <object> element with .data attribute
21736 !!options
21737 parsoid=html2wt
21738 !! wikitext
21739 <object data="test.swf"></object>
21740 !! html
21741 <object data="test.swf"></object>
21742 !!end
21743
21744 !! test
21745 Don't block XML namespace declaration
21746 !! wikitext
21747 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
21748 !! html/php
21749 <p><span>MediaWiki</span>
21750 </p>
21751 !! html/parsoid
21752 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
21753 !! end
21754
21755 # -----------------------------------------------------------------
21756 # The following section of tests are primarily to spec requirements
21757 # around serialization of new/edited content.
21758 #
21759 # All these tests are marked Parsoid html2wt and html2html only
21760 # ----------------------------------------------------------------
21761
21762 # 'mi' is a localinterwiki prefix as well as a language
21763 !! test
21764 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
21765 !! options
21766 parsoid=html2wt
21767 !! wikitext
21768 [[Foo]]
21769 !! html
21770 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
21771 !! end
21772
21773 !! test
21774 New wiki links (href variations)
21775 !! options
21776 parsoid=html2wt
21777 !! html
21778 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
21779 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
21780 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
21781 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
21782 !! wikitext
21783 [[Foo_bar]]
21784 [[Foo_bar]]
21785 [[Foo_bar]]
21786 [[Toxine bactérienne]]
21787 !! end
21788
21789 !! test
21790 New wiki links (content string variations)
21791 !! options
21792 parsoid=html2wt
21793 !! html
21794 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
21795 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
21796 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
21797 !! wikitext
21798 [[Foo_bar]]
21799 [[Foo bar]]
21800 [[Foo_bar|./Foo_bar]]
21801 !! end
21802
21803 !! test
21804 New category links (href variations)
21805 !! options
21806 parsoid=html2wt
21807 !! html
21808 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
21809 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
21810 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
21811 !! wikitext
21812 [[Category:Toxine bactérienne]]
21813 [[Category:Toxine bactérienne]]
21814 [[Category:Toxine bactérienne]]
21815 !! end
21816
21817 !! test
21818 New interlanguage links (href variations)
21819 !! options
21820 parsoid=html2wt
21821 !! html
21822 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
21823 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
21824 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
21825 !! wikitext
21826 [[es:Toxine bactérienne]]
21827 [[es:Toxine_bactérienne]]
21828 [[es:Toxine_bactérienne]]
21829 !! end
21830
21831 !! test
21832 Image: Modifying size of an image (1)
21833 !! options
21834 parsoid={
21835 "modes": ["wt2wt"],
21836 "changes": [
21837 ["img[height]", "attr", "height", "22"],
21838 ["img[width]", "attr", "width", "200"]
21839 ]
21840 }
21841 !! wikitext
21842 [[Image:Foobar.jpg|230x230px]]
21843 !! wikitext/edited
21844 [[Image:Foobar.jpg|200x200px]]
21845 !!end
21846
21847 !! test
21848 Image: Modifying size of an image (2)
21849 !! options
21850 parsoid={
21851 "modes": ["wt2wt"],
21852 "changes": [
21853 ["img[height]", "attr", "height", "100"],
21854 ["img[width]", "attr", "width", "500"]
21855 ]
21856 }
21857 !! wikitext
21858 [[Image:Foobar.jpg|230x230px]]
21859 !! wikitext/edited
21860 [[Image:Foobar.jpg|500x500px]]
21861 !!end
21862
21863 # Change in size is ignored so long as class='mw-default-size'
21864 !! test
21865 Image: Modifying size of an image (3)
21866 !! options
21867 parsoid={
21868 "modes": ["wt2wt"],
21869 "changes": [
21870 ["figure[class]", "removeClass", "mw-default-size"],
21871 ["figure img", "attr", "height", "19"],
21872 ["figure img", "attr", "width", "170"]
21873 ]
21874 }
21875 !! wikitext
21876 [[Image:Foobar.jpg|thumb]]
21877 !! wikitext/edited
21878 [[Image:Foobar.jpg|thumb|170x170px]]
21879 !!end
21880
21881 !! test
21882 Image: Modifying alignment of an image (bug 48665)
21883 !! options
21884 parsoid={
21885 "modes": ["wt2wt"],
21886 "changes": [
21887 ["figure[class]", "removeClass", "mw-halign-right"],
21888 ["figure[class]", "addClass", "mw-halign-left"]
21889 ]
21890 }
21891 !! wikitext
21892 [[Image:Foobar.jpg|thumb|caption|right]]
21893 !! wikitext/edited
21894 [[Image:Foobar.jpg|thumb|caption|left]]
21895 !! end
21896
21897 !! test
21898 Image: Modifying mw-default-size of an frameless image (bug 62805)
21899 !! options
21900 parsoid={
21901 "modes": ["wt2wt"],
21902 "changes": [
21903 ["figure.mw-default-size", "removeClass", "mw-default-size"]
21904 ]
21905 }
21906 !! wikitext
21907 [[Image:Foobar.jpg|frameless|right]]
21908 !! wikitext/edited
21909 [[Image:Foobar.jpg|frameless|right|220x220px]]
21910 !! end
21911
21912 !! test
21913 Image: Modifying valign of an image (bug 49221)
21914 !! options
21915 parsoid={
21916 "modes": ["wt2wt"],
21917 "changes": [
21918 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
21919 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
21920 ]
21921 }
21922 !! wikitext
21923 [[File:Foobar.jpg|20px|middle]]
21924 !! wikitext/edited
21925 [[File:Foobar.jpg|20px|text-top]]
21926 !! end
21927
21928 !! test
21929 Image: Modifying alt attribute of an image (bug 56400)
21930 !! options
21931 parsoid={
21932 "modes": ["wt2wt"],
21933 "changes": [
21934 ["img[alt]", "attr", "alt", "some alternate edited text"]
21935 ]
21936 }
21937 !! wikitext
21938 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
21939 !! wikitext/edited
21940 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
21941 !!end
21942
21943 !! test
21944 Image: Modifying caption of an image
21945 !! options
21946 parsoid={
21947 "modes": ["wt2wt"],
21948 "changes": [
21949 ["figcaption", "text", "new caption"]
21950 ]
21951 }
21952 !! wikitext
21953 [[Image:Foobar.jpg|thumb|original caption]]
21954 !! wikitext/edited
21955 [[Image:Foobar.jpg|thumb|new caption]]
21956 !!end
21957
21958 !! test
21959 Image: empty alt attribute (bug 48924)
21960 !! options
21961 parsoid
21962 !! wikitext
21963 [[File:Foobar.jpg|thumb|alt=|bar]]
21964 !! html
21965 <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>
21966 !! end
21967
21968 #!! test
21969 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
21970 #!! options
21971 #parsoid=html2wt
21972 #language=ar
21973 #!! wikitext
21974 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
21975 #!! html
21976 #<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>
21977 #!! end
21978
21979 !! test
21980 Image: Block level image should have \n before and after
21981 !! wikitext
21982 123
21983 [[File:Foobar.jpg|right|thumb|150x150px]]
21984 456
21985 !! html/parsoid
21986 <p>123</p>
21987 <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>
21988 <p>456</p>
21989 !!end
21990
21991 !! test
21992 Image: New block level image should have \n before and after (existing content)
21993 !! wikitext
21994 123
21995 [[File:Foobar.jpg|right|thumb|150x150px]]
21996 456
21997 !! html/parsoid
21998 <p>123</p>
21999 <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>
22000 <p>456</p>
22001 !!end
22002
22003 !! test
22004 Image: upright option (parsoid)
22005 !! options
22006 parsoid
22007 !! wikitext
22008 [[File:Foobar.jpg|thumb|upright|caption]]
22009 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
22010 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
22011 !! html
22012 <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>
22013 <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>
22014 <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>
22015 !!end
22016
22017 !! test
22018 Image: upright option is ignored on inline and frame images (parsoid)
22019 !! options
22020 parsoid
22021 !! wikitext
22022 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
22023 !! html
22024 <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>
22025 !!end
22026
22027 !! test
22028 Image: from basic HTML (1)
22029 !! options
22030 parsoid=html2wt
22031 !! html/parsoid
22032 <span typeof="mw:Image">
22033 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22034 </span>
22035 !! wikitext
22036 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22037 !! end
22038
22039 !! test
22040 Image: from basic HTML (2)
22041 !! options
22042 parsoid=html2wt
22043 !! html/parsoid
22044 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22045 !! wikitext
22046 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22047 !! end
22048
22049 !! test
22050 Image: from basic HTML (3)
22051 !! options
22052 parsoid=html2wt
22053 !! html/parsoid
22054 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
22055 !! wikitext
22056 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
22057 !! end
22058
22059 !! test
22060 Image: from basic HTML (4)
22061 !! options
22062 parsoid=html2wt
22063 !! html/parsoid
22064 <img src="File:Foobar.jpg">
22065 !! wikitext
22066 [[File:Foobar.jpg|link=]]
22067 !! end
22068
22069 !! test
22070 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
22071 !! options
22072 parsoid=html2wt
22073 !! wikitext
22074 * foo
22075 !! html
22076 <ul>
22077 <li><p>foo</p></li>
22078 </ul>
22079 !! end
22080
22081 !! test
22082 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
22083 !! options
22084 parsoid=html2wt
22085 !! wikitext
22086 * foo
22087 !! html
22088 <ul> <li>foo</li></ul>
22089 !! end
22090
22091 !! test
22092 Don't strip leading whitespace when handling indent-pre suppressing tags
22093 !! options
22094 parsoid=html2wt
22095 !! wikitext
22096 {|
22097 | indented row
22098 |}
22099 <blockquote>
22100 '''This is very bold of you!'''
22101
22102 {|
22103 |
22104 indented cell (no pre-wrapping!)
22105 |}
22106 </blockquote>
22107 foo
22108 <div>bar</div>
22109 !! html
22110 <table>
22111 <tr><td> indented row</td></tr>
22112 </table>
22113 <blockquote><p>
22114 <b>This is very bold of you!</b>
22115 </p>
22116 <table><tr><td>
22117 indented cell (no pre-wrapping!)
22118 </td></tr></table>
22119 </blockquote>
22120 <p>foo</p>
22121 <div>bar</div>
22122 !! end
22123
22124 !! test
22125 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
22126 !! options
22127 parsoid=html2wt
22128 !! wikitext
22129 foo
22130 <nowiki> </nowiki><span>bar</span>
22131
22132 <span>foo2
22133 <nowiki> </nowiki></span>bar2
22134
22135 <div>foo</div>
22136 <nowiki> </nowiki><span>bar</span>
22137
22138 <div>
22139 <nowiki> </nowiki><span>foo</span>
22140 </div>
22141 !! html
22142 <p>foo</p>
22143 <span>bar</span>
22144
22145 <span>foo2
22146 </span>bar2
22147
22148 <div>foo</div>
22149 <span>bar</span>
22150
22151 <div>
22152 <span>foo</span>
22153 </div>
22154 !! end
22155
22156 !! test
22157 Lists: Add space after bullets
22158 !! options
22159 parsoid=html2wt
22160 !! wikitext
22161 * foo
22162 * bar
22163 * <span> baz</span>
22164 !! html
22165 <ul>
22166 <li>foo</li>
22167 <li> bar</li>
22168 <li><span> baz</span></li>
22169 </ul>
22170 !! end
22171
22172 !! test
22173 Lists: Dont insert newlines in a serialized list item.
22174 !! options
22175 parsoid=html2wt
22176 !! wikitext
22177 * a<br>b
22178 * c
22179 !! html
22180 <ul><li>a<br>b</li><li>c</li></ul>
22181 !! end
22182
22183 !! test
22184 Headings: Add space before/after == (Bug 51744)
22185 !! options
22186 parsoid=html2wt
22187 !! wikitext
22188 == foo ==
22189
22190 == bar ==
22191
22192 == baz ==
22193
22194 == <span> baz</span> ==
22195 !! html
22196 <h2>foo</h2>
22197 <h2> bar</h2>
22198 <h2>baz </h2>
22199 <h2><span> baz</span></h2>
22200 !! end
22201
22202 !! test
22203 Parsoid: Serialize positional parameters with = in them as named parameter
22204 !! options
22205 parsoid=html2wt
22206 !! wikitext
22207 {{echo|1 = f=oo}}
22208
22209 {{echo|1 = f=oo|2 = bar}}
22210
22211 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22212 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22213 {{echo|<nowiki>f=oo</nowiki>|bar}}
22214 !! html
22215 <p about="#mwt1" typeof="mw:Transclusion"
22216 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
22217
22218 <p about="#mwt1" typeof="mw:Transclusion"
22219 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
22220
22221 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22222 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22223 <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>
22224 !! end
22225
22226 !! test
22227 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
22228 !! options
22229 parsoid=html2wt
22230 !! wikitext
22231 <div>a
22232 b
22233 </div>
22234 <div>a
22235 b
22236 </div>
22237 <div>
22238 a
22239
22240 b
22241 </div>
22242 !! html
22243 <div>a<p>b</p></div>
22244 <div>a
22245 <p>b</p></div>
22246 <div>
22247 a
22248 <p>b</p></div>
22249 !! end
22250
22251 !! test
22252 Substrings resembling wikitext in hrefs should not get nowiki escapes
22253 !! options
22254 parsoid=html2wt
22255 !! wikitext
22256 [[Foo''bar''baz]]
22257 !! html
22258 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
22259 !! end
22260
22261 #-----------------------------
22262 # I/B quote minimization tests
22263 #-----------------------------
22264
22265 !! test
22266 1. I/B quote minimization: wikitext-only tags should be combined
22267 !! options
22268 parsoid=html2wt
22269 !! wikitext
22270 ''AB''
22271
22272 '''AB'''
22273
22274 ''A'''B'''''
22275
22276 '''A''B'''''
22277
22278 '''A''BC''D'''
22279
22280 '''''AB'''''
22281
22282 '''''AB'''''
22283
22284 '''''AB'''''
22285 !! html
22286 <p><i>A</i><i>B</i></p>
22287 <p><b>A</b><b>B</b></p>
22288 <p><i>A</i><b><i>B</i></b></p>
22289 <p><b>A</b><i><b>B</b></i></p>
22290 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
22291 <p><i><b>A</b></i><i><b>B</b></i></p>
22292 <p><i><b>A</b></i><b><i>B</i></b></p>
22293 <p><b><i>A</i></b><i><b>B</b></i></p>
22294 !! end
22295
22296 !! test
22297 2. I/B quote minimization: wikitext and html tags should not be combined
22298 !! options
22299 parsoid=html2wt
22300 !! wikitext
22301 ''A''<i>B</i>
22302
22303 ''A''<nowiki/>'''<i>B</i>'''
22304 !! html
22305 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
22306 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
22307 !! end
22308
22309 !! test
22310 3. I/B quote minimization: templated content stops minimization
22311 !! options
22312 parsoid=html2wt
22313 !! wikitext
22314 ''A''{{echo|''B''}}
22315
22316 ''A''{{echo|'''''B'''''}}
22317 !! html
22318 <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>
22319 <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>
22320 !! end
22321
22322 !! test
22323 4. I/B quote minimization: new content should be mimimized with adjacent old content
22324 !! options
22325 parsoid=html2wt
22326 !! wikitext
22327 ''AB''
22328
22329 '''AB'''
22330
22331 ''A'''B'''''
22332 !! html
22333 <p><i>A</i><i>B</i></p>
22334 <p><b>A</b><b>B</b></p>
22335 <p><i>A</i><b><i>B</i></b></p>
22336 !! end
22337
22338 #------------------------------------
22339 # End of I/B quote minimization tests
22340 #------------------------------------
22341
22342 !!test
22343 Bug 54262: New entities
22344 !! options
22345 parsoid=html2wt
22346 !! wikitext
22347 &nbsp;
22348 !! html
22349 <span typeof="mw:Entity">&nbsp;</span>
22350 !! end
22351
22352 ## Note that there is no wikitext output for 'unknownproperty' ##
22353 ## Unknown magic words are silently dropped ##
22354
22355 !! test
22356 Magic words
22357 !! options
22358 parsoid=html2wt
22359 !! wikitext
22360 __TOC__
22361 __NOTOC__
22362 __FORCETOC__
22363 __INDEX__
22364 __NOINDEX__
22365 __NOGALLERY__
22366 __NOEDITSECTION__
22367 __NOTITLECONVERT__
22368 __NOCONTENTCONVERT__
22369 !! html
22370 <meta property='mw:PageProp/toc' />
22371 <meta property='mw:PageProp/notoc' />
22372 <meta property='mw:PageProp/forcetoc' />
22373 <meta property='mw:PageProp/index' />
22374 <meta property='mw:PageProp/noindex' />
22375 <meta property='mw:PageProp/nogallery' />
22376 <meta property='mw:PageProp/noeditsection' />
22377 <meta property='mw:PageProp/notitleconvert' />
22378 <meta property='mw:PageProp/nocontentconvert' />
22379 <meta property='mw:PageProp/unknownproperty' />
22380 !! end
22381
22382 !! test
22383 Consecutive <pre>s should not get merged
22384 !! options
22385 parsoid=html2wt,html2html
22386 !! wikitext
22387 a
22388
22389 b
22390
22391 c
22392
22393 d
22394
22395 e
22396
22397
22398
22399 f
22400 !! html
22401 <pre>a</pre><pre>b</pre>
22402
22403 <pre>c
22404 </pre><pre>
22405 d</pre>
22406
22407 <pre>e
22408
22409 </pre><pre>
22410
22411 f</pre>
22412 !! end
22413
22414 !! test
22415 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
22416 !! options
22417 parsoid=html2wt
22418 !! wikitext
22419 [[Special:BookSources/1234567890|ISBN 1234567895]]
22420 !! html
22421 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
22422 !! end
22423
22424 !! test
22425 Edited RFC links not serializable as RFC links should serialize as extlinks
22426 !! options
22427 parsoid=html2wt
22428 !! wikitext
22429 [//tools.ietf.org/html/rfc123 New RFC]
22430 !! html
22431 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
22432 !! end
22433
22434 !! test
22435 Edited PMID links not serializable as PMID links should serialize as extlinks
22436 !! options
22437 parsoid=html2wt
22438 !! wikitext
22439 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
22440 !! html
22441 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
22442 !! end
22443
22444 !! test
22445 Edited Redirect link should emit a non-piped wikitext link
22446 !! options
22447 parsoid=html2wt
22448 !! wikitext
22449 #REDIRECT [[Bar]]
22450 !! html
22451 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
22452 !! end
22453
22454 !! test
22455 T75121: Infer extension name from typeOf if data-mw is not present
22456 !! options
22457 parsoid=html2wt
22458 !! wikitext
22459 <foo />
22460 !! html
22461 <div typeOf="mw:Extension/foo"></div>
22462 !! end
22463
22464 # -----------------------------------------------------------------
22465 # End of section for Parsoid-only html2wt tests for serialization
22466 # of new content
22467 # -----------------------------------------------------------------
22468
22469 TODO:
22470 more images
22471 more tables
22472 character entities
22473 and much more
22474 Try for 100% code coverage