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 formdness
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
542 !! test
543 Italics and bold: 2-quote opening sequence: (2,3)
544 !! options
545 parsoid=wt2html
546 !! wikitext
547 ''foo'''
548 !! html/*
549 <p><i>foo'</i>
550 </p>
551 !!end
552
553
554 # same html as previous, but wikitext adjusted to match parsoid html2wt
555 !! test
556 Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki
557 !! wikitext
558 ''<nowiki>foo'</nowiki>''
559 !! html
560 <p><i>foo'</i>
561 </p>
562 !! end
563
564
565 !! test
566 Italics and bold: 2-quote opening sequence: (2,4)
567 !! options
568 parsoid=wt2html
569 !! wikitext
570 ''foo''''
571 !! html/*
572 <p><i>foo''</i>
573 </p>
574 !!end
575
576
577 # same html as previous, but wikitext adjusted to match parsoid html2wt
578 !! test
579 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
580 !! wikitext
581 ''<nowiki>foo''</nowiki>''
582 !! html
583 <p><i>foo''</i>
584 </p>
585 !! end
586
587
588 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
589 !! test
590 Italics and bold: 2-quote opening sequence: (2,5)
591 !! options
592 parsoid=wt2html
593 !! wikitext
594 ''foo'''''
595 !! html/php
596 <p><i>foo</i>
597 </p>
598 !! html/parsoid
599 <p><i>foo</i><b></b>
600 </p>
601 !!end
602
603 # same html as previous, but wikitext adjusted to match parsoid html2wt
604 !! test
605 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
606 !! wikitext
607 ''foo'''''<nowiki/>'''
608 !! html/php
609 <p><i>foo</i>
610 </p>
611 !! html/parsoid
612 <p><i>foo</i><b></b>
613 </p>
614 !! end
615
616
617 ###
618 ### 3-quote opening sequence tests
619 ###
620
621 !! test
622 Italics and bold: 3-quote opening sequence: (3,2)
623 !! wikitext
624 '''foo''
625 !! html
626 <p>'<i>foo</i>
627 </p>
628 !!end
629
630
631 !! test
632 Italics and bold: 3-quote opening sequence: (3,3)
633 !! wikitext
634 '''foo'''
635 !! html
636 <p><b>foo</b>
637 </p>
638 !!end
639
640
641 !! test
642 Italics and bold: 3-quote opening sequence: (3,4)
643 !! options
644 parsoid=wt2html
645 !! wikitext
646 '''foo''''
647 !! html/*
648 <p><b>foo'</b>
649 </p>
650 !!end
651
652
653 # same html as previous, but wikitext adjusted to match parsoid html2wt
654 !! test
655 Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki
656 !! wikitext
657 '''<nowiki>foo'</nowiki>'''
658 !! html
659 <p><b>foo'</b>
660 </p>
661 !! end
662
663
664 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
665 !! test
666 Italics and bold: 3-quote opening sequence: (3,5)
667 !! options
668 parsoid=wt2html
669 !! wikitext
670 '''foo'''''
671 !! html/php
672 <p><b>foo</b>
673 </p>
674 !! html/parsoid
675 <p><b>foo</b><i></i>
676 </p>
677 !!end
678
679 # same html as previous, but wikitext adjusted to match parsoid html2wt
680 !! test
681 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
682 !! wikitext
683 '''foo'''''<nowiki/>''
684 !! html/php
685 <p><b>foo</b>
686 </p>
687 !! html/parsoid
688 <p><b>foo</b><i></i>
689 </p>
690 !! end
691
692
693 ###
694 ### 4-quote opening sequence tests
695 ###
696
697 !! test
698 Italics and bold: 4-quote opening sequence: (4,2)
699 !! options
700 parsoid=wt2html
701 !! wikitext
702 ''''foo''
703 !! html/*
704 <p>''<i>foo</i>
705 </p>
706 !!end
707
708
709 # same html as previous, but wikitext adjusted to match parsoid html2wt
710 !! test
711 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
712 !! wikitext
713 <nowiki>''</nowiki>''foo''
714 !! html
715 <p>''<i>foo</i>
716 </p>
717 !! end
718
719
720 !! test
721 Italics and bold: 4-quote opening sequence: (4,3)
722 !! wikitext
723 ''''foo'''
724 !! html
725 <p>'<b>foo</b>
726 </p>
727 !!end
728
729
730 !! test
731 Italics and bold: 4-quote opening sequence: (4,4)
732 !! options
733 parsoid=wt2html
734 !! wikitext
735 ''''foo''''
736 !! html/*
737 <p>'<b>foo'</b>
738 </p>
739 !!end
740
741
742 # same html as previous, but wikitext adjusted to match parsoid html2wt
743 !! test
744 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
745 !! wikitext
746 ''''<nowiki>foo'</nowiki>'''
747 !! html
748 <p>'<b>foo'</b>
749 </p>
750 !! end
751
752
753 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
754 !! test
755 Italics and bold: 4-quote opening sequence: (4,5)
756 !! options
757 parsoid=wt2html
758 !! wikitext
759 ''''foo'''''
760 !! html/php
761 <p>'<b>foo</b>
762 </p>
763 !! html/parsoid
764 <p>'<b>foo</b><i></i>
765 </p>
766 !!end
767
768 # same html as previous, but wikitext adjusted to match parsoid html2wt
769 !! test
770 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
771 !! wikitext
772 ''''foo'''''<nowiki/>''
773 !! html/php
774 <p>'<b>foo</b>
775 </p>
776 !! html/parsoid
777 <p>'<b>foo</b><i></i>
778 </p>
779 !! end
780
781
782 ###
783 ### 5-quote opening sequence tests
784 ###
785
786 !! test
787 Italics and bold: 5-quote opening sequence: (5,2)
788 !! options
789 parsoid=wt2html
790 !! wikitext
791 '''''foo''
792 !! html/*
793 <p><b><i>foo</i></b>
794 </p>
795 !!end
796
797
798 # same html as previous, but wikitext adjusted to match parsoid html2wt
799 # skipping wt2html and html2html because it wants to put <i> before <b>
800 !! test
801 Italics and bold: 5-quote opening sequence: (5,2+3)
802 !! options
803 parsoid=wt2wt,html2wt
804 !! wikitext
805 '''''foo'''''
806 !! html
807 <p><b><i>foo</i></b>
808 </p>
809 !! end
810
811 !! test
812 Italics and bold: 5-quote opening sequence: (5,3)
813 !! options
814 parsoid=wt2html
815 !! wikitext
816 '''''foo'''
817 !! html/*
818 <p><i><b>foo</b></i>
819 </p>
820 !!end
821
822
823 # same html as previous, but wikitext adjusted to match parsoid html2wt
824 !! test
825 Italics and bold: 5-quote opening sequence: (5,3+2)
826 !! wikitext
827 '''''foo'''''
828 !! html
829 <p><i><b>foo</b></i>
830 </p>
831 !! end
832
833
834 !! test
835 Italics and bold: 5-quote opening sequence: (5,4)
836 !! options
837 parsoid=wt2html
838 !! wikitext
839 '''''foo''''
840 !! html/*
841 <p><i><b>foo'</b></i>
842 </p>
843 !!end
844
845
846 # same html as previous, but wikitext adjusted to match parsoid html2wt
847 !! test
848 Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki
849 !! wikitext
850 '''''<nowiki>foo'</nowiki>'''''
851 !! html
852 <p><i><b>foo'</b></i>
853 </p>
854 !! end
855
856
857 !! test
858 Italics and bold: 5-quote opening sequence: (5,5)
859 !! wikitext
860 '''''foo'''''
861 !! html
862 <p><i><b>foo</b></i>
863 </p>
864 !!end
865
866 ###
867 ### multiple quote sequences in a line
868 ###
869 !! test
870 Italics and bold: multiple quote sequences: (2,4,2)
871 !! options
872 parsoid=wt2html
873 !! wikitext
874 ''foo''''bar''
875 !! html/*
876 <p><i>foo'<b>bar</b></i>
877 </p>
878 !!end
879
880
881 # same html as previous, but wikitext adjusted to match parsoid html2wt
882 !! test
883 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
884 !! wikitext
885 ''<nowiki>foo'</nowiki>'''bar'''''
886 !! html
887 <p><i>foo'<b>bar</b></i>
888 </p>
889 !! end
890
891
892 !! test
893 Italics and bold: multiple quote sequences: (2,4,3)
894 !! options
895 parsoid=wt2html
896 !! wikitext
897 ''foo''''bar'''
898 !! html/*
899 <p><i>foo'<b>bar</b></i>
900 </p>
901 !!end
902
903
904 # same html as previous, but wikitext adjusted to match parsoid html2wt
905 !! test
906 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
907 !! wikitext
908 ''<nowiki>foo'</nowiki>'''bar'''''
909 !! html
910 <p><i>foo'<b>bar</b></i>
911 </p>
912 !! end
913
914
915 !! test
916 Italics and bold: multiple quote sequences: (2,4,4)
917 !! options
918 parsoid=wt2html
919 !! wikitext
920 ''foo''''bar''''
921 !! html/*
922 <p><i>foo'<b>bar'</b></i>
923 </p>
924 !!end
925
926
927 # same html as previous, but wikitext adjusted to match parsoid html2wt
928 !! test
929 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
930 !! wikitext
931 ''<nowiki>foo'</nowiki>'''<nowiki>bar'</nowiki>'''''
932 !! html
933 <p><i>foo'<b>bar'</b></i>
934 </p>
935 !! end
936
937
938 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
939 !! test
940 Italics and bold: multiple quote sequences: (3,4,2)
941 !! options
942 parsoid=wt2html
943 !! wikitext
944 '''foo''''bar''
945 !! html/php
946 <p><b>foo'</b>bar
947 </p>
948 !! html/parsoid
949 <p><b>foo'</b>bar<i></i>
950 </p>
951 !!end
952
953 # same html as previous, but wikitext adjusted to match parsoid html2wt
954 !! test
955 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
956 !! options
957 parsoid
958 !! wikitext
959 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
960 !! html/php
961 <p><b>foo'</b>bar
962 </p>
963 !! html/parsoid
964 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
965 </p>
966 !! end
967
968
969 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
970 !! test
971 Italics and bold: multiple quote sequences: (3,4,3)
972 !! options
973 parsoid=wt2html
974 !! wikitext
975 '''foo''''bar'''
976 !! html/php
977 <p><b>foo'</b>bar
978 </p>
979 !! html/parsoid
980 <p><b>foo'</b>bar<b></b>
981 </p>
982 !!end
983
984 # same html as previous, but wikitext adjusted to match parsoid html2wt
985 !! test
986 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
987 !! wikitext
988 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
989 !! html/php
990 <p><b>foo'</b>bar
991 </p>
992 !! html/parsoid
993 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
994 </p>
995 !! end
996
997 ###
998 ### other quote tests
999 ###
1000 !! test
1001 Italics and bold: other quote tests: (2,3,5)
1002 !! wikitext
1003 ''this is about '''foo's family'''''
1004 !! html
1005 <p><i>this is about <b>foo's family</b></i>
1006 </p>
1007 !!end
1008
1009
1010 !! test
1011 Italics and bold: other quote tests: (2,(3,3),2)
1012 !! wikitext
1013 ''this is about '''foo's''' family''
1014 !! html
1015 <p><i>this is about <b>foo's</b> family</i>
1016 </p>
1017 !!end
1018
1019
1020 !! test
1021 Italics and bold: other quote tests: (3,2,3,2)
1022 !! options
1023 parsoid=wt2html
1024 !! wikitext
1025 '''this is about ''foo'''s family''
1026 !! html/*
1027 <p><b>this is about <i>foo</i></b><i>s family</i>
1028 </p>
1029 !!end
1030
1031
1032 # same html as previous, but wikitext adjusted to match parsoid html2wt
1033 # add 'parsoid' option to use 'parsoid' normalization of the placeholder
1034 !! test
1035 Italics and bold: other quote tests: (3,2,3+2+2,2)
1036 !! options
1037 parsoid
1038 !! wikitext
1039 '''this is about ''foo'''''<nowiki/>''s family''
1040 !! html/*
1041 <p><b>this is about <i>foo</i></b><i>s family</i>
1042 </p>
1043 !! end
1044
1045
1046 !! test
1047 Italics and bold: other quote tests: (3,2,3,3)
1048 !! options
1049 !! wikitext
1050 '''this is about ''foo'''s family'''
1051 !! html
1052 <p>'<i>this is about </i>foo<b>s family</b>
1053 </p>
1054 !!end
1055
1056
1057 !! test
1058 Italics and bold: other quote tests: (3,(2,2),3)
1059 !! wikitext
1060 '''this is about ''foo's'' family'''
1061 !! html
1062 <p><b>this is about <i>foo's</i> family</b>
1063 </p>
1064 !!end
1065
1066
1067 !! test
1068 Italicized possessive
1069 !! wikitext
1070 The ''[[Main Page]]'''s talk page.
1071 !! html
1072 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1073 </p>
1074 !! end
1075
1076 !! test
1077 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1078 (Requires tidy for PHP parser output to be fixed up)
1079 !! options
1080 parsoid=wt2html,wt2wt
1081 !! wikitext
1082 {|
1083 !''a!!''b
1084 |''a||''b
1085 |}
1086 !! html/php+tidy
1087 <table>
1088 <tr>
1089 <th><i>a</i></th>
1090 <th><i>b</i></th>
1091 <td><i>a</i></td>
1092 <td><i>b</i></td>
1093 </tr>
1094 </table>
1095 !! html/parsoid
1096 <table>
1097 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1098 <td><i>a</i></td><td><i>b</i></td></tr>
1099 </tbody></table>
1100 !! end
1101
1102 ###
1103 ### Non-html5 tags
1104 ###
1105
1106 !! test
1107 Non-html5 tags should be accepted
1108 !! wikitext
1109 <center>''foo''</center>
1110 <big>''foo''</big>
1111 <font>''foo''</font>
1112 <strike>''foo''</strike>
1113 <tt>''foo''</tt>
1114 !! html
1115 <center><i>foo</i></center>
1116 <p><big><i>foo</i></big>
1117 <font><i>foo</i></font>
1118 <strike><i>foo</i></strike>
1119 <tt><i>foo</i></tt>
1120 </p>
1121 !! end
1122
1123 !! test
1124 <wbr> is valid wikitext (bug 52468)
1125 !! wikitext
1126 <wbr>
1127 !! html
1128 <p><wbr />
1129 </p>
1130 !! end
1131
1132 # <strike> is HTML4, <s> is HTML4/5.
1133 !! test
1134 <s> or <strike> for strikethrough
1135 !! wikitext
1136 <strike>strike</strike>
1137
1138 <s>s</s>
1139 !! html
1140 <p><strike>strike</strike>
1141 </p><p><s>s</s>
1142 </p>
1143 !! end
1144
1145 ## a not permitted
1146 ## i,b,br omitted
1147 !! test
1148 Text-level semantic html elements in wikitext
1149 !! wikitext
1150 <em>text</em>
1151 <strong>text</strong>
1152 <small>text</small>
1153 <s>text</s>
1154 <cite>text</cite>
1155 <q>text</q>
1156 <dfn>text</dfn>
1157 <abbr>text</abbr>
1158 <data>text</data>
1159 <time>text</time>
1160 <code>text</code>
1161 <var>text</var>
1162 <samp>text</samp>
1163 <kbd>text</kbd>
1164 <sub>text</sub>
1165 <u>text</u>
1166 <mark>text</mark>
1167 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1168 <bdi>text</bdi>
1169 <bdo>text</bdo>
1170 <span>text</span>
1171 <wbr />
1172 !! html
1173 <p><em>text</em>
1174 <strong>text</strong>
1175 <small>text</small>
1176 <s>text</s>
1177 <cite>text</cite>
1178 <q>text</q>
1179 <dfn>text</dfn>
1180 <abbr>text</abbr>
1181 <data>text</data>
1182 <time>text</time>
1183 <code>text</code>
1184 <var>text</var>
1185 <samp>text</samp>
1186 <kbd>text</kbd>
1187 <sub>text</sub>
1188 <u>text</u>
1189 <mark>text</mark>
1190 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1191 <bdi>text</bdi>
1192 <bdo>text</bdo>
1193 <span>text</span>
1194 <wbr />
1195 </p>
1196 !! end
1197
1198 # test cases taken from
1199 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1200 !! test
1201 Ruby markup (W3C-style)
1202 !! wikitext
1203 ; Mono-ruby for individual base characters
1204 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1205 ; Group ruby
1206 : <ruby>今日<rt>きょう</rt></ruby>
1207 ; Jukugo ruby
1208 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1209 ; Inline ruby
1210 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1211 ; Double-sided ruby
1212 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1213 <ruby>
1214 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1215 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1216 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1217 </ruby>
1218 !! html
1219 <dl><dt> Mono-ruby for individual base characters</dt>
1220 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1221 <dt> Group ruby</dt>
1222 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1223 <dt> Jukugo ruby</dt>
1224 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1225 <dt> Inline ruby</dt>
1226 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1227 <dt> Double-sided ruby</dt>
1228 <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>
1229 <p><ruby>
1230 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1231 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1232 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1233 </ruby>
1234 </p>
1235 !! end
1236
1237 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1238 !! test
1239 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1240 !! wikitext
1241 <b→> doesn't work! </b→>
1242
1243 <bä> doesn't work! </bä>
1244
1245 <boo> works fine </boo>
1246
1247 <s.foo>s.foo</s.foo>
1248
1249 <sub-ID#1>
1250 !! html
1251 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1252 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1253 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1254 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1255 </p><p>&lt;sub-ID#1&gt;
1256 </p>
1257 !! end
1258
1259 !! test
1260 Isolated close tags should be treated as literal text (bug 52760)
1261 !! wikitext
1262 </b>
1263
1264 <s.foo>s</s>
1265 !! html
1266 <p>&lt;/b&gt;
1267 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1268 </p>
1269 !! end
1270
1271 ###
1272 ### Special characters
1273 ###
1274
1275 !! test
1276 Bare pipe character (bug 52363)
1277 !! wikitext
1278 |
1279 !! html
1280 <p>|
1281 </p>
1282 !! end
1283
1284 !! test
1285 Bare pipe character from a template (bug 52363)
1286 !! wikitext
1287 {{pipe}}
1288 !! html
1289 <p>|
1290 </p>
1291 !! end
1292
1293 ###
1294 ### <nowiki> test cases
1295 ###
1296
1297 !! test
1298 <nowiki> unordered list
1299 !! wikitext
1300 <nowiki>* This is not an unordered list item.</nowiki>
1301 !! html
1302 <p>* This is not an unordered list item.
1303 </p>
1304 !! end
1305
1306 !! test
1307 <nowiki> spacing
1308 !! wikitext
1309 <nowiki>Lorem ipsum dolor
1310
1311 sed abit.
1312 sed nullum.
1313
1314 :and a colon
1315 </nowiki>
1316 !! html
1317 <p>Lorem ipsum dolor
1318
1319 sed abit.
1320 sed nullum.
1321
1322 :and a colon
1323
1324 </p>
1325 !! end
1326
1327 !! test
1328 nowiki 3
1329 !! wikitext
1330 :There is not nowiki.
1331 :There is <nowiki>nowiki</nowiki>.
1332
1333 #There is not nowiki.
1334 #There is <nowiki>nowiki</nowiki>.
1335
1336 *There is not nowiki.
1337 *There is <nowiki>nowiki</nowiki>.
1338 !! html
1339 <dl><dd>There is not nowiki.</dd>
1340 <dd>There is nowiki.</dd></dl>
1341 <ol><li>There is not nowiki.</li>
1342 <li>There is nowiki.</li></ol>
1343 <ul><li>There is not nowiki.</li>
1344 <li>There is nowiki.</li></ul>
1345
1346 !! end
1347
1348 !! test
1349 Entities inside <nowiki>
1350 !! wikitext
1351 <nowiki>&lt;</nowiki>
1352 !! html
1353 <p>&lt;
1354 </p>
1355 !! end
1356
1357 !! test
1358 Entities inside template parameters
1359 !! options
1360 parsoid
1361 !! wikitext
1362 {{echo|&ndash;}}
1363 !! html
1364 <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>
1365 !! end
1366
1367 !! test
1368 Properly escape nowiki when combined with other wiki markup
1369 !! options
1370 parsoid=html2wt
1371 !! wikitext
1372 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1373 !! html
1374 <p>* &lt;/nowiki&gt; tag</p>
1375 !! end
1376
1377 ###
1378 ### Comments
1379 ###
1380 !! test
1381 Comments and Indent-Pre
1382 !! wikitext
1383 <!-- comment 1 --> asdf
1384
1385 <!-- comment 1 --> asdf
1386 <!-- comment 2 -->
1387
1388 <!-- comment 1 --> asdf
1389 <!-- comment 2 -->xyz
1390
1391 <!-- comment 1 --> asdf
1392 <!-- comment 2 --> xyz
1393 !! html
1394 <pre>asdf
1395 </pre>
1396 <pre>asdf
1397 </pre>
1398 <pre>asdf
1399 </pre>
1400 <p>xyz
1401 </p>
1402 <pre>asdf
1403 xyz
1404 </pre>
1405 !! end
1406
1407 !! test
1408 Comment test 2a
1409 !! wikitext
1410 asdf
1411 <!-- comment 1 -->
1412 jkl
1413 !! html
1414 <p>asdf
1415 jkl
1416 </p>
1417 !! end
1418
1419 !! test
1420 Comment test 2b
1421 !! wikitext
1422 asdf
1423 <!-- comment 1 -->
1424
1425 jkl
1426 !! html
1427 <p>asdf
1428 </p><p>jkl
1429 </p>
1430 !! end
1431
1432 !! test
1433 Comment test 3
1434 !! wikitext
1435 asdf
1436 <!-- comment 1 -->
1437 <!-- comment 2 -->
1438 jkl
1439 !! html
1440 <p>asdf
1441 jkl
1442 </p>
1443 !! end
1444
1445 !! test
1446 Comment test 4
1447 !! wikitext
1448 asdf<!-- comment 1 -->jkl
1449 !! html
1450 <p>asdfjkl
1451 </p>
1452 !! end
1453
1454 !! test
1455 Comment spacing
1456 !! wikitext
1457 a
1458 <!-- foo --> b <!-- bar -->
1459 c
1460 !! html
1461 <p>a
1462 </p>
1463 <pre> b
1464 </pre>
1465 <p>c
1466 </p>
1467 !! end
1468
1469 !! test
1470 Comment whitespace
1471 !! wikitext
1472 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1473 !! html
1474
1475 !! end
1476
1477 !! test
1478 Comment semantics and delimiters
1479 !! wikitext
1480 <!-- --><!----><!-----><!------>
1481 !! html
1482
1483 !! end
1484
1485 !! test
1486 Comment semantics and delimiters, redux
1487 !! wikitext
1488 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1489 -- foo -- funky huh? ... -->
1490 !! html
1491
1492 !! end
1493
1494 !! test
1495 Comment semantics and delimiters: directors cut
1496 !! wikitext
1497 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1498 everything starting with < followed by !-- until the first -- and > we see,
1499 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1500 -->-->
1501 !! html
1502 <p>--&gt;
1503 </p>
1504 !! end
1505
1506 !! test
1507 Comment semantics: nesting
1508 !! wikitext
1509 <!--<!-- no, we're not going to do anything fancy here -->-->
1510 !! html
1511 <p>--&gt;
1512 </p>
1513 !! end
1514
1515 !! test
1516 Comment semantics: unclosed comment at end
1517 !! wikitext
1518 <!--This comment will run out to the end of the document
1519 !! html
1520
1521 !! end
1522
1523 # Bug 58184: document parsoid's behaviour
1524 !! test
1525 Suppress comment closing tag in lenient browsers
1526 !! options
1527 parsoid=wt2html,html2html
1528 !! wikitext
1529 <!-- Browsers--!> think this is closed -->
1530 !! html/php
1531
1532 !! html/parsoid
1533 <!-- Browsers--¡> think this is closed -->
1534 !! end
1535
1536 !! test
1537 Comment in template title
1538 !! wikitext
1539 {{f<!---->oo}}
1540 !! html
1541 <p>FOO
1542 </p>
1543 !! end
1544
1545 !! test
1546 Comment on its own line post-expand
1547 !! wikitext
1548 a
1549 {{blank}}<!---->
1550 b
1551 !! html
1552 <p>a
1553 </p><p>b
1554 </p>
1555 !! end
1556
1557 !! test
1558 Comment on its own line post-expand with non-significant whitespace
1559 !! wikitext
1560 a
1561 {{blank}} <!---->
1562 b
1563 !! html
1564 <p>a
1565 </p><p>b
1566 </p>
1567 !! end
1568
1569 !! test
1570 Multiple comments should still parse as SOL-transparent
1571 !! options
1572 parsoid=wt2html,wt2wt
1573 !! wikitext
1574 <!--c1-->*a
1575 <!--c2--><!--c3--><!--c4-->*b
1576 !! html
1577 <ul>
1578 <li>a
1579 </li>
1580 <li>b
1581 </li>
1582 </ul>
1583 !! end
1584
1585 ###
1586 ### paragraph wrapping tests
1587 ###
1588 !! test
1589 No block tags
1590 !! wikitext
1591 a
1592
1593 b
1594 !! html
1595 <p>a
1596 </p><p>b
1597 </p>
1598 !! end
1599
1600 !! test
1601 Block tag on one line (<div>)
1602 !! wikitext
1603 a <div>foo</div>
1604
1605 b
1606 !! html
1607 a <div>foo</div>
1608 <p>b
1609 </p>
1610 !! html+tidy
1611 <p>a</p>
1612 <div>foo</div>
1613 <p>b</p>
1614 !! end
1615
1616 !! test
1617 Block tag on one line (<blockquote>)
1618 !! wikitext
1619 a <blockquote>foo</blockquote>
1620
1621 b
1622 !! html
1623 a <blockquote>foo</blockquote>
1624 <p>b
1625 </p>
1626 !! html+tidy
1627 <p>a</p>
1628 <blockquote>
1629 <p>foo</p>
1630 </blockquote>
1631 <p>b</p>
1632 !! end
1633
1634 !! test
1635 Block tag on both lines (<div>)
1636 !! wikitext
1637 a <div>foo</div>
1638
1639 b <div>foo</div>
1640 !! html
1641 a <div>foo</div>
1642 b <div>foo</div>
1643
1644 !! html+tidy
1645 <p>a</p>
1646 <div>foo</div>
1647 <p>b</p>
1648 <div>foo</div>
1649 !! end
1650
1651 !! test
1652 Block tag on both lines (<blockquote>)
1653 !! wikitext
1654 a <blockquote>foo</blockquote>
1655
1656 b <blockquote>foo</blockquote>
1657 !! html
1658 a <blockquote>foo</blockquote>
1659 b <blockquote>foo</blockquote>
1660
1661 !! html+tidy
1662 <p>a</p>
1663 <blockquote>
1664 <p>foo</p>
1665 </blockquote>
1666 <p>b</p>
1667 <blockquote>
1668 <p>foo</p>
1669 </blockquote>
1670 !! end
1671
1672 !! test
1673 Multiple lines without block tags
1674 !! wikitext
1675 <div>foo</div> a
1676 b
1677 c
1678 d<!--foo--> e
1679 x <div>foo</div> z
1680 !! html
1681 <div>foo</div> a
1682 <p>b
1683 c
1684 d e
1685 </p>
1686 x <div>foo</div> z
1687
1688 !! html+tidy
1689 <div>foo</div>
1690 <p>a</p>
1691 <p>b c d e</p>
1692 <p>x</p>
1693 <div>foo</div>
1694 <p>z</p>
1695 !! end
1696
1697 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1698 # So, we have a separate section for Parsoid. We don't want
1699 # to mimic this stripping behavior in Parsoid. It affects
1700 # editing experience and also requires us to maintain additional
1701 # info for RT-ing.
1702 !! test
1703 Empty lines between lines with block tags
1704 !! wikitext
1705 <div></div>
1706
1707
1708 <div></div>a
1709
1710 b
1711 <div>a</div>b
1712
1713 <div>b</div>d
1714
1715
1716 <div>e</div>
1717 !! html
1718 <div></div>
1719 <p><br />
1720 </p>
1721 <div></div>a
1722 <p>b
1723 </p>
1724 <div>a</div>b
1725 <div>b</div>d
1726 <p><br />
1727 </p>
1728 <div>e</div>
1729
1730 !! html+tidy
1731 <p><br /></p>
1732 <p>a</p>
1733 <p>b</p>
1734 <div>a</div>
1735 <p>b</p>
1736 <div>b</div>
1737 <p>d</p>
1738 <p><br /></p>
1739 <div>e</div>
1740 !! html/parsoid
1741 <div data-parsoid='{"stx":"html"}'></div>
1742
1743 <p><br /></p>
1744 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1745
1746 <p>b</p>
1747 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1748
1749 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1750
1751 <p><br /></p>
1752 <div data-parsoid='{"stx":"html"}'>e</div>
1753 !! end
1754
1755 ## PHP parser emits output which is broken
1756 ## XXX The parsoid output doesn't match the tidy output.
1757 !! test
1758 Unclosed HTML p-tags should be handled properly
1759 !! wikitext
1760 <div><p>foo</div>
1761 a
1762
1763 b
1764 !! html/php+tidy
1765 <div>
1766 <p>foo&lt;/div&gt;</p>
1767 <p>a</p>
1768 b</div>
1769 !! html/parsoid
1770 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1771 <p>a</p>
1772 <p>b</p>
1773 !! end
1774
1775 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
1776 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
1777 ## them for now.
1778 !! test
1779 P-wrapping should leave sol-transparent tags outside p-tags where possible
1780 !! options
1781 parsoid=wt2html
1782 !! wikitext
1783 a [[Category:A1]] [[Category:A2]]
1784 [[Category:A3]]
1785 [[Category:A4]]
1786 !! html/parsoid
1787 <p>a</p>
1788 <link href="Category:A1"/> <link href="Category:A2"/> <link href="Category:A3"/> <link href="Category:A4"/>
1789 !! end
1790
1791 ###
1792 ### Preformatted text
1793 ###
1794 !! test
1795 Preformatted text
1796 !! wikitext
1797 This is some
1798 Preformatted text
1799 With ''italic''
1800 And '''bold'''
1801 And a [[Main Page|link]]
1802 !! html
1803 <pre>This is some
1804 Preformatted text
1805 With <i>italic</i>
1806 And <b>bold</b>
1807 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1808 </pre>
1809 !! end
1810
1811 !! test
1812 Tabs don't trigger preformatted text
1813 !! wikitext
1814 This is not
1815 preformatted text.
1816 This is preformatted text.
1817 So is this.
1818 !! html
1819 <p> This is not
1820 preformatted text.
1821 </p>
1822 <pre>This is preformatted text.
1823 So is this.
1824 </pre>
1825 !! end
1826
1827 !! test
1828 Ident preformatting with inline content
1829 !! wikitext
1830 a
1831 ''b''
1832 !! html
1833 <pre>a
1834 <i>b</i>
1835 </pre>
1836 !! end
1837
1838 !! test
1839 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1840 !! wikitext
1841 <pre><nowiki>
1842 <b>
1843 <cite>
1844 <em>
1845 </nowiki></pre>
1846 !! html
1847 <pre>
1848 &lt;b&gt;
1849 &lt;cite&gt;
1850 &lt;em&gt;
1851 </pre>
1852
1853 !! end
1854
1855 !! test
1856 Regression with preformatted in <center>
1857 !! wikitext
1858 <center>
1859 Blah
1860 </center>
1861 !! html
1862 <center>
1863 <pre>Blah
1864 </pre>
1865 </center>
1866
1867 !! end
1868
1869 !! test
1870 Bug 52763: Preformatted in <blockquote>
1871 !! wikitext
1872 <blockquote>
1873 Blah
1874 {|
1875 |
1876 indented cell (no pre-wrapping!)
1877 |}
1878 </blockquote>
1879 !! html
1880 <blockquote>
1881 <p> Blah
1882 </p>
1883 <table>
1884 <tr>
1885 <td>
1886 <p> indented cell (no pre-wrapping!)
1887 </p>
1888 </td></tr></table>
1889 </blockquote>
1890
1891 !! end
1892
1893 !! test
1894 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1895 !! wikitext
1896 <blockquote>
1897 Foo
1898
1899 Bar
1900 </blockquote>
1901 !! html
1902 <blockquote>
1903 <p>Foo
1904 </p><p>Bar
1905 </p>
1906 </blockquote>
1907
1908 !! end
1909
1910 !! test
1911 Bug 15491: <ins>/<del> in blockquote
1912 !! wikitext
1913 <blockquote>
1914 Foo <del>bar</del> <ins>baz</ins> quux
1915 </blockquote>
1916 !! html
1917 <blockquote>
1918 <p>Foo <del>bar</del> <ins>baz</ins> quux
1919 </p>
1920 </blockquote>
1921
1922 !! end
1923
1924 # Note that the p-wrapping is newline sensitive, which could be
1925 # considered a bug: tidy will wrap only the 'Foo' in the example
1926 # below in a <p> tag. (see comment 23-25 of bug #6200)
1927 !! test
1928 Bug 15491: <ins>/<del> in blockquote (2)
1929 !! wikitext
1930 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1931 </blockquote>
1932 !! html
1933 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1934 </blockquote>
1935
1936 !! html+tidy
1937 <blockquote>
1938 <p>Foo</p>
1939 <del>bar</del> <ins>baz</ins> quux</blockquote>
1940 !! end
1941
1942 !! test
1943 <pre> with attributes (bug 3202)
1944 !! wikitext
1945 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1946 !! html
1947 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1948
1949 !! end
1950
1951 !! test
1952 <pre> with width attribute (bug 3202)
1953 !! wikitext
1954 <pre width="8">Narrow screen goodies</pre>
1955 !! html
1956 <pre width="8">Narrow screen goodies</pre>
1957
1958 !! end
1959
1960 !! test
1961 <pre> with forbidden attribute (bug 3202)
1962 !! wikitext
1963 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1964 !! html
1965 <pre width="8">Narrow screen goodies</pre>
1966
1967 !! end
1968
1969 !! test
1970 Entities inside <pre>
1971 !! wikitext
1972 <pre>&lt;</pre>
1973 !! html
1974 <pre>&lt;</pre>
1975
1976 !! end
1977
1978 !! test
1979 <pre> with forbidden attribute values (bug 3202)
1980 !! wikitext
1981 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1982 !! html
1983 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1984
1985 !! end
1986
1987 !! test
1988 <nowiki> inside <pre> (bug 13238)
1989 !! wikitext
1990 <pre>
1991 <nowiki>
1992 </pre>
1993 <pre>
1994 <nowiki></nowiki>
1995 </pre>
1996 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1997 !! html
1998 <pre>
1999 &lt;nowiki&gt;
2000 </pre>
2001 <pre>
2002
2003 </pre>
2004 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2005
2006 !! end
2007
2008 !! test
2009 <nowiki> and <pre> preference (first one wins)
2010 !! wikitext
2011 <pre>
2012 <nowiki>
2013 </pre>
2014 </nowiki>
2015 </pre>
2016
2017 <nowiki>
2018 <pre>
2019 <nowiki>
2020 </pre>
2021 </nowiki>
2022 </pre>
2023
2024 !! html
2025 <pre>
2026 &lt;nowiki&gt;
2027 </pre>
2028 <p>&lt;/nowiki&gt;
2029 &lt;/pre&gt;
2030 </p><p>
2031 &lt;pre&gt;
2032 &lt;nowiki&gt;
2033 &lt;/pre&gt;
2034
2035 &lt;/pre&gt;
2036 </p>
2037 !! end
2038
2039 !! test
2040 </pre> inside nowiki
2041 !! wikitext
2042 <nowiki></pre></nowiki>
2043 !! html
2044 <p>&lt;/pre&gt;
2045 </p>
2046 !! end
2047
2048 # Parsoid doesn't strip empty tags, like Tidy does.
2049 !! test
2050 Empty pre; pre inside other HTML tags (bug 54946)
2051 !! options
2052 parsoid=wt2html,wt2wt
2053 !! wikitext
2054 a
2055
2056 <div><pre>
2057 foo
2058 </pre></div>
2059 <pre></pre>
2060 !! html/php
2061 <p>a
2062 </p>
2063 <div><pre>
2064 foo
2065 </pre></div>
2066 <pre></pre>
2067
2068 !! html/php+tidy
2069 <p>a</p>
2070 <div>
2071 <pre>
2072 foo
2073 </pre></div>
2074 !! html/parsoid
2075 <p>a</p>
2076
2077 <div><pre>foo
2078 </pre></div>
2079 <pre></pre>
2080 !! end
2081
2082 !! test
2083 HTML pre followed by indent-pre
2084 !! wikitext
2085 <pre>foo</pre>
2086 bar
2087 !! html
2088 <pre>foo</pre>
2089 <pre>bar
2090 </pre>
2091 !! end
2092
2093 !!test
2094 Block tag pre
2095 !!options
2096 parsoid
2097 !! wikitext
2098 <p><pre>foo</pre></p>
2099 !! html
2100 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2101 !!end
2102
2103 !!test
2104 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2105 !! wikitext
2106 {{echo|}}
2107 !! html
2108
2109 !!end
2110
2111 !!test
2112 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2113 !! wikitext
2114 {{echo|
2115 foo}}
2116 !! html
2117 <p>foo
2118 </p>
2119 !!end
2120
2121 !! test
2122 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2123 !! wikitext
2124 {{echo|a
2125 b}}
2126 !! html
2127 <pre>a
2128 </pre>
2129 <p>b
2130 </p>
2131 !!end
2132
2133 !! test
2134 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2135 !! wikitext
2136 {{echo|a
2137 b
2138 c
2139 d
2140 e
2141 }}
2142 !! html
2143 <pre>a
2144 </pre>
2145 <p>b
2146 c
2147 </p>
2148 <pre>d
2149 </pre>
2150 <p>e
2151 </p>
2152 !!end
2153
2154 !!test
2155 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2156 !! wikitext
2157 {{echo| foo}}
2158
2159 {{echo| foo}}{{echo| bar}}
2160
2161 {{echo| foo}}
2162 {{echo| bar}}
2163
2164 {{echo|<!--cmt--> foo}}
2165
2166 <!--cmt-->{{echo| foo}}
2167
2168 {{echo|{{echo| }}bar}}
2169 !! html
2170 <pre>foo
2171 </pre>
2172 <pre>foo bar
2173 </pre>
2174 <pre>foo
2175 bar
2176 </pre>
2177 <pre>foo
2178 </pre>
2179 <pre>foo
2180 </pre>
2181 <pre>bar
2182 </pre>
2183 !!end
2184
2185 !! test
2186 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2187 !! wikitext
2188 {{echo| }}a
2189
2190 {{echo|
2191 }}a
2192
2193 {{echo|
2194 b}}
2195
2196 {{echo|a
2197 }}b
2198
2199 {{echo|a
2200 }} b
2201 !! html
2202 <pre>a
2203 </pre>
2204 <p><br />
2205 </p>
2206 <pre>a
2207 </pre>
2208 <p><br />
2209 </p>
2210 <pre>b
2211 </pre>
2212 <p>a
2213 </p>
2214 <pre>b
2215 </pre>
2216 <p>a
2217 </p>
2218 <pre>b
2219 </pre>
2220 !!end
2221
2222 !! test
2223 Things that look like <pre> tags aren't treated as such
2224 !! wikitext
2225 Barack Obama <President> of the United States
2226 <President></President>
2227 !! html
2228 <p>Barack Obama &lt;President&gt; of the United States
2229 &lt;President&gt;&lt;/President&gt;
2230 </p>
2231 !! end
2232
2233 ## PHP parser discards the "<pre " string
2234 !! test
2235 Handle broken pre-like tags (bug 64025)
2236 !! options
2237 parsoid=wt2html
2238 !! wikitext
2239 {{echo|<pre <pre>x</pre>}}
2240
2241 <table><pre </table>
2242 !! html/php
2243 <pre>x</pre>
2244 <table><pre></pre></table>
2245
2246 !! html/parsoid
2247 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>&lt;pre </p><pre>x</pre>
2248
2249 <p>&lt;pre </p>
2250
2251 <table></table>
2252 !! end
2253
2254 !! test
2255 Parsoid: handle pre with space after attribute
2256 !! options
2257 parsoid=wt2html
2258 !! wikitext
2259 <pre style="width:50%;" >{{echo|foo}}</pre>
2260 !! html
2261 <pre style="width:50%;">{{echo|foo}}</pre>
2262 !! end
2263
2264 # TODO / maybe: fix wt2wt for this
2265 !! test
2266 Parsoid: Don't paragraph-wrap fosterable content
2267 !! options
2268 parsoid=wt2html
2269 !! wikitext
2270 {|
2271 <td></td>
2272 <td></td>
2273
2274
2275
2276 |}
2277 !! html
2278 <table>
2279
2280 <tbody>
2281 <tr>
2282 <td></td>
2283
2284 <td></td></tr>
2285
2286
2287
2288 </tbody></table>
2289 !! end
2290
2291 !! test
2292 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2293 !! options
2294 parsoid=wt2html
2295 !! wikitext
2296 {|
2297 <td>
2298 <td>
2299 </td>
2300
2301
2302
2303 |}
2304 !! html
2305 <table>
2306
2307 <tbody>
2308 <tr>
2309 <td></td>
2310
2311 <td>
2312 </td></tr>
2313
2314
2315
2316 </tbody></table>
2317 !! end
2318
2319
2320 #--------------------------------------------------------------------
2321 # Transclusion parameter whitespace stripping tests
2322 # Behavior is different for positional and named parameters
2323 #--------------------------------------------------------------------
2324 !! test
2325 Templates: Strip leading and trailing whitespace from named-param values
2326 !! wikitext
2327 {{echo|1= a }}
2328
2329 {{echo|1= {{echo|b}} }}
2330
2331 {{echo| 1 =
2332 c }}
2333
2334 {{echo| 1 =
2335 * d
2336 }}
2337 !! html
2338 <p>a
2339 </p><p>b
2340 </p><p>c
2341 </p>
2342 <ul><li> d</li></ul>
2343
2344 !! end
2345
2346 !! test
2347 Templates: Don't strip whitespace from positional-param values
2348 !! wikitext
2349 {{echo|a }}
2350
2351 {{echo|{{echo|b}} }}
2352
2353 {{echo| c
2354 }}
2355
2356 {{echo| {{echo|d}}
2357 }}
2358
2359 {{echo|
2360 e}}
2361
2362 {{echo|
2363 * f}}
2364
2365 {{echo|
2366 }}g
2367 !! html
2368 <p>a
2369 </p><p>b
2370 </p>
2371 <pre>c
2372 </pre>
2373 <p><br />
2374 </p>
2375 <pre>d
2376 </pre>
2377 <p><br />
2378 </p>
2379 <pre>e
2380 </pre>
2381 <p><br />
2382 </p>
2383 <ul><li> f</li></ul>
2384 <p><br />
2385 </p>
2386 <pre>g
2387 </pre>
2388 !! end
2389
2390 !! test
2391 Templates: Handle empty comment-and-ws-only lines correctly
2392 !! wikitext
2393 {{echo|foo
2394 <!--should be ignored-->
2395 <!--should be ignored as well-->
2396 bar}}
2397 !! html
2398 <p>foo
2399 bar
2400 </p>
2401 !! end
2402
2403 !! test
2404 Templates: Handle comments in the target
2405 !! wikitext
2406 {{echo
2407 <!-- should be ignored -->
2408 |foo}}
2409
2410 {{echo<!-- should be ignored -->
2411 |foo}}
2412
2413 {{echo<!-- should be ignored -->|foo}}
2414
2415 {{<!-- should be ignored -->echo|foo}}
2416 !!html/parsoid
2417 <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>
2418
2419 <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>
2420
2421 <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>
2422
2423 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2424 !!end
2425
2426 #--------------------------------------------------------------------
2427 # Transclusion parameter escaping tests
2428 #--------------------------------------------------------------------
2429 !! test
2430 Templates: Parsoid parameter escaping test 1
2431 !! options
2432 parsoid
2433 !! wikitext
2434 {{echo|[foo]|{{echo|[bar]}}}}
2435 !! html
2436 <p about="#mwt1" typeof="mw:Transclusion"
2437 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2438 !! end
2439
2440 !! test
2441 Parsoid: Pipes in external links in template parameter
2442 !! options
2443 parsoid
2444 !! wikitext
2445 {{echo|[{{echo|http://example.com}} link]}}
2446 !! html
2447 <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>
2448 !! end
2449
2450 !! test
2451 Parsoid: pipe in transclusion parameter
2452 !! options
2453 parsoid
2454 !! wikitext
2455 {{echo|http://foo.com/a&#124;b}}
2456 !! html
2457 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2458 typeof="mw:Transclusion"
2459 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>
2460 !! end
2461
2462 !! test
2463 Parsoid: Pipe in external link target and content in template parameter
2464 !! options
2465 parsoid=html2wt,wt2wt
2466 !! wikitext
2467 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2468 !! html
2469 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2470 typeof="mw:Transclusion"
2471 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2472 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2473 !! end
2474
2475 !! test
2476 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2477 !! options
2478 parsoid
2479 !! wikitext
2480 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2481 !! html
2482 <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>
2483 !! end
2484
2485 !! test
2486 Templates: Don't escape already nowiki-escaped text in template parameters
2487 !! options
2488 parsoid=html2wt,wt2wt
2489 !! wikitext
2490 {{echo|foo<nowiki>|</nowiki>bar}}
2491 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2492 {{echo|<nowiki></nowiki>}}
2493 !! html
2494 <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>
2495 <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>
2496 <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>
2497 </p>
2498 !! end
2499
2500 ## Bug 52824
2501 !! test
2502 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2503 !! options
2504 parsoid=html2wt,wt2wt
2505 !! wikitext
2506 {{echo|{{echo|1=bar}}}}
2507 !! html
2508 <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>
2509 !! end
2510
2511 ## Bug 56733
2512 !! test
2513 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2514 !! options
2515 parsoid
2516 !! wikitext
2517 {{echo|a : b}}
2518 !! html
2519 <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>
2520 !! end
2521
2522 ###
2523 ### Parsoid-centric tests for testing RT edge cases for pre
2524 ###
2525
2526 !!test
2527 1a. Indent-Pre and Comments
2528 !! wikitext
2529 a
2530 <!--a-->
2531 c
2532 !! html
2533 <pre>a
2534 </pre>
2535 <p>c
2536 </p>
2537 !!end
2538
2539 !!test
2540 1b. Indent-Pre and Comments
2541 !! wikitext
2542 a
2543 <!--a-->
2544 c
2545 !! html
2546 <pre>a
2547 </pre>
2548 <p>c
2549 </p>
2550 !!end
2551
2552 !!test
2553 1c. Indent-Pre and Comments
2554 !! wikitext
2555 <!--a--> a
2556
2557 <!--a--> a
2558 !! html
2559 <pre> a
2560 </pre>
2561 <pre> a
2562 </pre>
2563 !!end
2564
2565 !!test
2566 1d. Indent-Pre and Comments
2567 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2568 !! wikitext
2569 <!--a--> a
2570
2571 <!--b-->b
2572 !! html
2573 <pre>a
2574 </pre>
2575 <pre>b
2576 </pre>
2577 !!end
2578
2579 !!test
2580 2a. Indent-Pre and tables
2581 !! wikitext
2582 {|
2583 |-
2584 !h1!!h2
2585 |foo||bar
2586 |}
2587 !! html
2588 <table>
2589
2590 <tr>
2591 <th>h1</th>
2592 <th>h2
2593 </th>
2594 <td>foo</td>
2595 <td>bar
2596 </td></tr></table>
2597
2598 !!end
2599
2600 !!test
2601 2b. Indent-Pre and tables
2602 !! wikitext
2603 {|
2604 |-
2605 |foo
2606 |}
2607 !! html
2608 <table>
2609
2610 <tr>
2611 <td>foo
2612 </td></tr></table>
2613
2614 !!end
2615
2616 !!test
2617 2c. Indent-Pre and tables (bug 42252)
2618 !! wikitext
2619 {|
2620 |+ foo
2621 ! | bar
2622 |}
2623 !! html
2624 <table>
2625 <caption> foo
2626 </caption>
2627 <tr>
2628 <th> bar
2629 </th></tr></table>
2630
2631 !!end
2632
2633 !!test
2634 2d. Indent-Pre and tables
2635 !! wikitext
2636 a
2637 {|
2638 | b
2639 |}
2640 !! html/php
2641 <pre>a
2642 </pre>
2643 <table>
2644 <tr>
2645 <td> b
2646 </td></tr></table>
2647
2648 !! html/parsoid
2649 <pre>a</pre>
2650 <table>
2651 <tbody><tr><td> b</td></tr>
2652 </tbody></table>
2653 !!end
2654
2655 !!test
2656 2e. Indent-Pre and table-line syntax
2657 !! wikitext
2658 a
2659 | b
2660 | c
2661 !! html/php
2662 <pre>a
2663 | b
2664 | c
2665 </pre>
2666 !!end
2667
2668 !!test
2669 2f. Indent-pre started by table-line syntax
2670 !! wikitext
2671 a
2672 | b
2673 | c
2674 !! html/php
2675 <p>a
2676 </p>
2677 <pre>| b
2678 | c
2679 </pre>
2680 !! html/parsoid
2681 <p>a</p>
2682 <pre>
2683 | b
2684 | c</pre>
2685 !!end
2686
2687 !!test
2688 3a. Indent-Pre and block tags (single-line html)
2689 !! wikitext
2690 a <p> foo </p>
2691 b <div> foo </div>
2692 c <blockquote> foo </blockquote>
2693 <span> foo </span>
2694 !! html
2695 a <p> foo </p>
2696 b <div> foo </div>
2697 c <blockquote> foo </blockquote>
2698 <pre><span> foo </span>
2699 </pre>
2700 !! html/parsoid
2701 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
2702 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
2703 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
2704 <pre><span> foo </span>
2705 </pre>
2706 !! html+tidy
2707 <p>a</p>
2708 <p>foo</p>
2709 <p>b</p>
2710 <div>foo</div>
2711 <p>c</p>
2712 <blockquote>
2713 <p>foo</p>
2714 </blockquote>
2715 <pre>
2716 <span> foo </span>
2717 </pre>
2718 !! end
2719
2720 !!test
2721 3b. Indent-Pre and block tags (multi-line html)
2722 !! wikitext
2723 a <span>foo</span>
2724 b <div> foo </div>
2725 !! html
2726 <pre>a <span>foo</span>
2727 </pre>
2728 b <div> foo </div>
2729
2730 !! html/parsoid
2731 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
2732 b <div data-parsoid='{"stx":"html"}'> foo </div>
2733 !! html+tidy
2734 <pre>
2735 a <span>foo</span>
2736 </pre>
2737 <p>b</p>
2738 <div>foo</div>
2739 !!end
2740
2741 !!test
2742 3c. Indent-Pre and block tags (pre-content on separate line)
2743 !! wikitext
2744 <p>
2745 foo
2746 </p>
2747
2748 <div>
2749 foo
2750 </div>
2751
2752 <center>
2753 foo
2754 </center>
2755
2756 <blockquote>
2757 foo
2758 </blockquote>
2759
2760 <blockquote>
2761 <pre>
2762 foo
2763 </pre>
2764 </blockquote>
2765
2766 <table><tr><td>
2767 foo
2768 </td></tr></table>
2769
2770 <ul><li>
2771 foo
2772 </li></ul>
2773
2774 !! html
2775 <p>
2776 foo
2777 </p>
2778 <div>
2779 <pre>foo
2780 </pre>
2781 </div>
2782 <center>
2783 <pre>foo
2784 </pre>
2785 </center>
2786 <blockquote>
2787 <p> foo
2788 </p>
2789 </blockquote>
2790 <blockquote>
2791 <pre>
2792 foo
2793 </pre>
2794 </blockquote>
2795 <table><tr><td>
2796 <pre>foo
2797 </pre>
2798 </td></tr></table>
2799 <ul><li>
2800 foo
2801 </li></ul>
2802
2803 !!end
2804
2805 !!test
2806 4. Indent-Pre and extension tags
2807 !! wikitext
2808 a <gallery>
2809 File:foobar.jpg
2810 </gallery>
2811 !! html
2812 a <ul class="gallery mw-gallery-traditional">
2813 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2814 <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>
2815 <div class="gallerytext">
2816 </div>
2817 </div></li>
2818 </ul>
2819
2820 !! html+tidy
2821 <p>a</p>
2822 <ul class="gallery mw-gallery-traditional">
2823 <li class="gallerybox" style="width: 155px">
2824 <div style="width: 155px">
2825 <div class="thumb" style="width: 150px;">
2826 <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>
2827 </div>
2828 <div class="gallerytext"></div>
2829 </div>
2830 </li>
2831 </ul>
2832 !!end
2833
2834 !! test
2835 Table wikitext syntax outside wiki-tables
2836 !! wikitext
2837 a
2838 ! not a table heading
2839 |- not a table row
2840 | not a table cell
2841 | class="foo bar" | baz
2842 b
2843 |}
2844 |-
2845 c
2846 !! html
2847 <p>a
2848 ! not a table heading
2849 |- not a table row
2850 | not a table cell
2851 | class="foo bar" | baz
2852 b
2853 |}
2854 |-
2855 c
2856 </p>
2857 !! end
2858
2859 !!test
2860 Render paragraphs when indent-pre is suppressed in blocklevels
2861 !! wikitext
2862 <blockquote>
2863 foo
2864
2865 bar
2866 </blockquote>
2867 !! html
2868 <blockquote>
2869 <p> foo
2870 </p><p> bar
2871 </p>
2872 </blockquote>
2873
2874 !!end
2875
2876 !!test
2877 4. Multiple spaces at start-of-line
2878 !! wikitext
2879 <p> foo </p>
2880 foo
2881 {|
2882 |foo
2883 |}
2884 !! html
2885 <p> foo </p>
2886 <pre> foo
2887 </pre>
2888 <table>
2889 <tr>
2890 <td>foo
2891 </td></tr></table>
2892
2893 !!end
2894
2895 ## NOTE: the leading white-space chars on empty line are significant
2896 !! test
2897 5a. White-space in indent-pre
2898 !! wikitext
2899 a<br />
2900
2901 b
2902 !! html
2903 <pre>a<br />
2904
2905 b
2906 </pre>
2907 !! end
2908
2909 ## NOTE: the leading white-space chars on empty line are significant
2910 !! test
2911 5b. White-space in indent-pre
2912 !! wikitext
2913 a
2914
2915 b
2916
2917
2918 c
2919 !! html
2920 <pre>a
2921
2922 b
2923
2924
2925 c
2926 </pre>
2927 !! end
2928
2929 !! test
2930 5c. White-space in indent-pre
2931 !! wikitext
2932 ''a''
2933 ''b''
2934 ''c''
2935 !! html
2936 <pre><i>a</i>
2937 <i>b</i>
2938 <i>c</i>
2939 </pre>
2940 !! end
2941
2942 !! test
2943 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2944 !! wikitext
2945 a
2946
2947 <!-- continue -->
2948 b
2949
2950 c
2951
2952 d
2953 !! html
2954 <pre>a
2955
2956 b
2957 </pre>
2958 <pre>c
2959
2960 </pre>
2961 <p>d
2962 </p>
2963 !! end
2964
2965 !! test
2966 7a. Indent-pre and category links
2967 !! options
2968 parsoid=wt2html,wt2wt
2969 !! wikitext
2970 [[Category:foo]] <!-- No pre-wrapping -->
2971 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2972 !! html
2973 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2974 <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 -->
2975 !! end
2976
2977 !! test
2978 7b. Indent-pre and category links
2979 !! options
2980 parsoid=wt2html,wt2wt
2981 !! wikitext
2982 [[Category:foo]] a
2983 [[Category:foo]] {{echo|b}}
2984 !! html
2985 <pre>
2986 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2987 <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>
2988 !! end
2989
2990 ###
2991 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2992 ###
2993
2994 !!test
2995 HTML-pre: 1. embedded newlines
2996 !! wikitext
2997 <pre>foo</pre>
2998
2999 <pre>
3000 foo
3001 </pre>
3002
3003 <pre>
3004
3005 foo
3006 </pre>
3007
3008 <pre>
3009
3010
3011 foo
3012 </pre>
3013 !! html
3014 <pre>foo</pre>
3015 <pre>
3016 foo
3017 </pre>
3018 <pre>
3019
3020 foo
3021 </pre>
3022 <pre>
3023
3024
3025 foo
3026 </pre>
3027
3028 !! html/parsoid
3029 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3030
3031 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3032 foo
3033 </pre>
3034
3035 <pre data-parsoid='{"stx":"html"}'>
3036
3037 foo
3038 </pre>
3039
3040 <pre data-parsoid='{"stx":"html"}'>
3041
3042
3043 foo
3044 </pre>
3045 !!end
3046
3047 !! test
3048 HTML-pre: big spaces
3049 !! wikitext
3050 <pre>
3051
3052
3053
3054
3055 haha
3056
3057
3058
3059
3060 haha
3061
3062
3063
3064
3065 </pre>
3066 !! html
3067 <pre>
3068
3069
3070
3071
3072 haha
3073
3074
3075
3076
3077 haha
3078
3079
3080
3081
3082 </pre>
3083
3084 !! html/parsoid
3085 <pre data-parsoid='{"stx":"html"}'>
3086
3087
3088
3089
3090 haha
3091
3092
3093
3094
3095 haha
3096
3097
3098
3099
3100 </pre>
3101 !! end
3102
3103 !!test
3104 HTML-pre: 2: indented text
3105 !! wikitext
3106 <pre>
3107 foo
3108 </pre>
3109 !! html
3110 <pre>
3111 foo
3112 </pre>
3113
3114 !!end
3115
3116 !!test
3117 HTML-pre: 3: other wikitext
3118 !! wikitext
3119 <pre>
3120 * foo
3121 # bar
3122 = no-h =
3123 '' no-italic ''
3124 [[ NoLink ]]
3125 </pre>
3126 !! html
3127 <pre>
3128 * foo
3129 # bar
3130 = no-h =
3131 '' no-italic ''
3132 [[ NoLink ]]
3133 </pre>
3134
3135 !!end
3136
3137 ###
3138 ### Definition lists
3139 ###
3140 !! test
3141 Simple definition
3142 !! wikitext
3143 ; name : Definition
3144 !! html
3145 <dl><dt> name&#160;</dt>
3146 <dd> Definition</dd></dl>
3147
3148 !! end
3149
3150 !! test
3151 Definition list for indentation only
3152 !! wikitext
3153 : Indented text
3154 !! html
3155 <dl><dd> Indented text</dd></dl>
3156
3157 !! end
3158
3159 !! test
3160 Definition list with no space
3161 !! wikitext
3162 ;name:Definition
3163 !! html
3164 <dl><dt>name</dt>
3165 <dd>Definition</dd></dl>
3166
3167 !!end
3168
3169 !! test
3170 Definition list with URL link
3171 !! wikitext
3172 ; http://example.com/ : definition
3173 !! html
3174 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3175 <dd> definition</dd></dl>
3176
3177 !! end
3178
3179 !! test
3180 Definition list with bracketed URL link
3181 !! wikitext
3182 ;[http://www.example.com/ Example]:Something about it
3183 !! html
3184 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3185 <dd>Something about it</dd></dl>
3186
3187 !! end
3188
3189 !! test
3190 Definition list with wikilink containing colon
3191 !! wikitext
3192 ; [[Help:FAQ]]: The least-read page on Wikipedia
3193 !! html
3194 <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>
3195 <dd> The least-read page on Wikipedia</dd></dl>
3196
3197 !! end
3198
3199 # At Brion's and JeLuF's insistence... :)
3200 !! test
3201 Definition list with news link containing colon
3202 !! wikitext
3203 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3204 !! html
3205 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3206 <dd> This isn't even a real newsgroup!</dd></dl>
3207
3208 !! end
3209
3210 !! test
3211 Malformed definition list with colon
3212 !! wikitext
3213 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3214 !! html
3215 <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>
3216
3217 !! end
3218
3219 !! test
3220 Definition lists: colon in external link text
3221 !! wikitext
3222 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3223 !! html
3224 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3225 <dd> OK, I made that up</dd></dl>
3226
3227 !! end
3228
3229 !! test
3230 Definition lists: colon in HTML attribute
3231 !! wikitext
3232 ;<b style="display: inline">bold</b>
3233 !! html
3234 <dl><dt><b style="display: inline">bold</b></dt></dl>
3235
3236 !! end
3237
3238 !! test
3239 Definition lists: self-closed tag
3240 !! wikitext
3241 ;one<br/>two : two-line fun
3242 !! html
3243 <dl><dt>one<br />two&#160;</dt>
3244 <dd> two-line fun</dd></dl>
3245
3246 !! end
3247
3248 !! test
3249 Bug 11748: Literal closing tags
3250 !! wikitext
3251 <dl>
3252 <dt>test 1</dt>
3253 <dd>test test test test test</dd>
3254 <dt>test 2</dt>
3255 <dd>test test test test test</dd>
3256 </dl>
3257 !! html
3258 <dl>
3259 <dt>test 1</dt>
3260 <dd>test test test test test</dd>
3261 <dt>test 2</dt>
3262 <dd>test test test test test</dd>
3263 </dl>
3264
3265 !! end
3266
3267 !! test
3268 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3269 !! wikitext
3270 <ul><li>
3271 ; term : description
3272 * unordered
3273 </li></ul>
3274 !! html
3275 <ul><li>
3276 <dl><dt> term&#160;</dt>
3277 <dd> description</dd></dl>
3278 <ul><li> unordered</li></ul>
3279 </li></ul>
3280
3281 !! end
3282
3283 !! test
3284
3285 Definition list with empty definition and following paragraph
3286 !! wikitext
3287 ; term:
3288 Paragraph text
3289 !! html
3290 <dl><dt> term</dt>
3291 <dd></dd></dl>
3292 <p>Paragraph text
3293 </p>
3294 !! end
3295
3296 !! test
3297 Nested definition lists using html syntax
3298 !! wikitext
3299 <dl><dt>x</dt>
3300 <dd>a</dd>
3301 <dd>b</dd></dl>
3302
3303 !! end
3304
3305 !! test
3306 Definition Lists: No nesting: Multiple dd's
3307 !! wikitext
3308 ;x
3309 :a
3310 :b
3311 !! html
3312 <dl><dt>x</dt>
3313 <dd>a</dd>
3314 <dd>b</dd></dl>
3315
3316 !! end
3317
3318 !! test
3319 Definition Lists: Indentation: Regular
3320 !! wikitext
3321 :i1
3322 ::i2
3323 :::i3
3324 !! html
3325 <dl><dd>i1
3326 <dl><dd>i2
3327 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3328
3329 !! end
3330
3331 !! test
3332 Definition Lists: Indentation: Missing 1st level
3333 !! wikitext
3334 ::i2
3335 :::i3
3336 !! html
3337 <dl><dd><dl><dd>i2
3338 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3339
3340 !! end
3341
3342 !! test
3343 Definition Lists: Indentation: Multi-level indent
3344 !! wikitext
3345 :::i3
3346 !! html
3347 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3348
3349 !! end
3350
3351 !! test
3352 Definition Lists: Hacky use to indent tables
3353 !! wikitext
3354 ::{|
3355 |foo
3356 |bar
3357 |}
3358 this text
3359 should be left alone
3360 !! html
3361 <dl><dd><dl><dd><table>
3362 <tr>
3363 <td>foo
3364 </td>
3365 <td>bar
3366 </td></tr></table></dd></dl></dd></dl>
3367 <p>this text
3368 should be left alone
3369 </p>
3370 !! end
3371
3372 !! test
3373 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3374 !! wikitext
3375 <!-- foo -->
3376 ::{|
3377 |foo
3378 |bar
3379 |}<!-- bar -->
3380 this text
3381 should be left alone
3382 !! html/parsoid
3383 <!-- foo -->
3384 <dl><dd><dl><dd><table><tr>
3385 <td>foo</td>
3386 <td>bar</td>
3387 </tr></table><!-- bar --></dd></dl></dd></dl>
3388 <p>this text
3389 should be left alone</p>
3390 !! end
3391
3392 !! test
3393 Definition Lists: Hacky use to indent tables, with comment before table
3394 !! wikitext
3395 ::<!-- foo -->{|
3396 |foo
3397 |}
3398 !! html/parsoid
3399 <dl><dd><dl><dd><!-- foo --><table><tr>
3400 <td>foo</td>
3401 </tr></table></dd></dl></dd></dl>
3402 !! end
3403
3404 # Bug 52473
3405 !! test
3406 Definition Lists: Hacky use to indent tables (WS-insensitive)
3407 !! options
3408 parsoid
3409 !! wikitext
3410 : {|
3411 |a
3412 |}
3413 !! html
3414 <dl>
3415 <dd> <table><tr><td>a</td></tr></table> </dd>
3416 </dl>
3417 !! end
3418 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3419 ## as an empty dt item. It also ignores all but the last ";" when followed
3420 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3421 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3422 ## ";"s.
3423 ##
3424 ## Ex: ";;t2 ::d2" is transformed into:
3425 ##
3426 ## <dl>
3427 ## <dt>t2 </dt>
3428 ## <dd>
3429 ## <dl>
3430 ## <dt></dt>
3431 ## <dd>d2</dd>
3432 ## </dl>
3433 ## </dd>
3434 ## </dl>
3435 ##
3436 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3437 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3438 ##
3439 ## <dl>
3440 ## <dt>
3441 ## <dl>
3442 ## <dt>t2 </dt>
3443 ## <dd>:d2</dd>
3444 ## </dl>
3445 ## </dt>
3446 ## </dl>
3447 ##
3448 ## All Parsoid only definition list tests have this difference.
3449 ##
3450 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3451 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3452
3453 !! test
3454 Table / list interaction: indented table with lists in table contents
3455 !! wikitext
3456 :{|
3457 |-
3458 | a
3459 * b
3460 |-
3461 | c
3462 * d
3463 |}
3464 !! html
3465 <dl><dd><table>
3466
3467 <tr>
3468 <td> a
3469 <ul><li> b</li></ul>
3470 </td></tr>
3471 <tr>
3472 <td> c
3473 <ul><li> d</li></ul>
3474 </td></tr></table></dd></dl>
3475
3476 !! end
3477
3478 !!test
3479 Table / list interaction: lists nested in tables nested in indented lists
3480 !! wikitext
3481 :{|
3482 |
3483 :a
3484 :b
3485 |
3486 *c
3487 *d
3488 |}
3489
3490 *e
3491 *f
3492 !! html
3493 <dl><dd><table>
3494 <tr>
3495 <td>
3496 <dl><dd>a</dd>
3497 <dd>b</dd></dl>
3498 </td>
3499 <td>
3500 <ul><li>c</li>
3501 <li>d</li></ul>
3502 </td></tr></table></dd></dl>
3503 <ul><li>e</li>
3504 <li>f</li></ul>
3505
3506 !!end
3507
3508 !! test
3509 Definition Lists: Nesting: Multi-level (Parsoid only)
3510 !! options
3511 parsoid
3512 !! wikitext
3513 ;t1 :d1
3514 ;;t2 ::d2
3515 ;;;t3 :::d3
3516 !! html
3517 <dl>
3518 <dt>t1 </dt>
3519 <dd>d1</dd>
3520 <dt>
3521 <dl>
3522 <dt>t2 </dt>
3523 <dd>:d2</dd>
3524 <dt>
3525 <dl>
3526 <dt>t3 </dt>
3527 <dd>::d3</dd>
3528 </dl>
3529 </dt>
3530 </dl>
3531 </dt>
3532 </dl>
3533
3534
3535 !! end
3536
3537
3538 !! test
3539 Definition Lists: Nesting: Test 2 (Parsoid only)
3540 !! options
3541 parsoid
3542 !! wikitext
3543 ;t1
3544 ::d2
3545 !! html
3546 <dl>
3547 <dt>t1</dt>
3548 <dd>
3549 <dl>
3550 <dd>d2</dd>
3551 </dl>
3552 </dd>
3553 </dl>
3554
3555 !! end
3556
3557
3558 !! test
3559 Definition Lists: Nesting: Test 3 (Parsoid only)
3560 !! options
3561 parsoid
3562 !! wikitext
3563 :;t1
3564 ::::d2
3565 !! html
3566 <dl>
3567 <dd>
3568 <dl>
3569 <dt>t1</dt>
3570 <dd>
3571 <dl>
3572 <dd>
3573 <dl>
3574 <dd>d2</dd>
3575 </dl>
3576 </dd>
3577 </dl>
3578 </dd>
3579 </dl>
3580 </dd>
3581 </dl>
3582
3583 !! end
3584
3585
3586 !! test
3587 Definition Lists: Nesting: Test 4
3588 !! wikitext
3589 ::;t3
3590 :::d3
3591 !! html
3592 <dl><dd><dl><dd><dl><dt>t3</dt>
3593 <dd>d3</dd></dl></dd></dl></dd></dl>
3594
3595 !! end
3596
3597
3598 ## The Parsoid team believes the following three test exposes a
3599 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3600 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3601 ## It also exposes a "misfeature" in tidy, which doesn't like
3602 ## <dl> tags with a single <dt> child; it converts the <dt> into
3603 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3604 !! test
3605 Definition Lists: Mixed Lists: Test 1
3606 !! wikitext
3607 :;* foo
3608 ::* bar
3609 :; baz
3610 !! html/php
3611 <dl><dd><dl><dt><ul><li> foo</li>
3612 <li> bar</li></ul></dt></dl>
3613 <dl><dt> baz</dt></dl></dd></dl>
3614
3615 !! html/php+tidy
3616 <dl>
3617 <dd>
3618 <dl>
3619 <dd>
3620 <ul>
3621 <li>foo</li>
3622 <li>bar</li>
3623 </ul>
3624 </dd>
3625 </dl>
3626 <dl>
3627 <dt>baz</dt>
3628 </dl>
3629 </dd>
3630 </dl>
3631 !! html/parsoid
3632 <dl>
3633 <dd><dl>
3634 <dt><ul>
3635 <li> foo
3636 </li>
3637 </ul></dt>
3638 <dd><ul>
3639 <li> bar
3640 </li>
3641 </ul></dd>
3642 <dt> baz</dt>
3643 </dl></dd>
3644 </dl>
3645 !! end
3646
3647 !! test
3648 Definition Lists: Mixed Lists: Test 2
3649 !! wikitext
3650 *: d1
3651 *: d2
3652 !! html
3653 <ul><li><dl><dd> d1</dd>
3654 <dd> d2</dd></dl></li></ul>
3655
3656 !! end
3657
3658
3659 !! test
3660 Definition Lists: Mixed Lists: Test 3
3661 !! wikitext
3662 *::: d1
3663 *::: d2
3664 !! html
3665 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3666 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3667
3668 !! end
3669
3670
3671 !! test
3672 Definition Lists: Mixed Lists: Test 4
3673 !! wikitext
3674 *;d1 :d2
3675 *;d3 :d4
3676 !! html
3677 <ul><li><dl><dt>d1&#160;</dt>
3678 <dd>d2</dd>
3679 <dt>d3&#160;</dt>
3680 <dd>d4</dd></dl></li></ul>
3681
3682 !! end
3683
3684
3685 !! test
3686 Definition Lists: Mixed Lists: Test 5
3687 !! wikitext
3688 *:d1
3689 *:: d2
3690 !! html
3691 <ul><li><dl><dd>d1
3692 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3693
3694 !! end
3695
3696
3697 !! test
3698 Definition Lists: Mixed Lists: Test 6
3699 !! wikitext
3700 #*:d1
3701 #*::: d3
3702 !! html
3703 <ol><li><ul><li><dl><dd>d1
3704 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3705
3706 !! end
3707
3708
3709 !! test
3710 Definition Lists: Mixed Lists: Test 7
3711 !! wikitext
3712 :* d1
3713 :* d2
3714 !! html
3715 <dl><dd><ul><li> d1</li>
3716 <li> d2</li></ul></dd></dl>
3717
3718 !! end
3719
3720
3721 !! test
3722 Definition Lists: Mixed Lists: Test 8
3723 !! wikitext
3724 :* d1
3725 ::* d2
3726 !! html
3727 <dl><dd><ul><li> d1</li></ul>
3728 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3729
3730 !! end
3731
3732
3733 !! test
3734 Definition Lists: Mixed Lists: Test 9
3735 !! wikitext
3736 *;foo :bar
3737 !! html
3738 <ul><li><dl><dt>foo&#160;</dt>
3739 <dd>bar</dd></dl></li></ul>
3740
3741 !! end
3742
3743
3744 !! test
3745 Definition Lists: Mixed Lists: Test 10
3746 !! wikitext
3747 *#;foo :bar
3748 !! html
3749 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3750 <dd>bar</dd></dl></li></ol></li></ul>
3751
3752 !! end
3753
3754 # The Parsoid team disagrees with the PHP parser's seemingly-random
3755 # rules regarding dd/dt on the next two tests. Parsoid is more
3756 # consistent, and recognizes the shared nesting and keeps the
3757 # still-open tags around until the nesting is complete.
3758 # (And tidy again converts <dt> to <dd> before 'bar'.)
3759
3760 !! test
3761 Definition Lists: Mixed Lists: Test 11
3762 !! wikitext
3763 *#*#;*;;foo :bar
3764 *#*#;boo :baz
3765 !! html/php
3766 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3767 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3768 <dl><dt>boo&#160;</dt>
3769 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3770
3771 !! html/php+tidy
3772 <ul>
3773 <li>
3774 <ol>
3775 <li>
3776 <ul>
3777 <li>
3778 <ol>
3779 <li>
3780 <dl>
3781 <dt>foo&#160;</dt>
3782 <dd>
3783 <ul>
3784 <li>
3785 <dl>
3786 <dd>
3787 <dl>
3788 <dt>bar</dt>
3789 </dl>
3790 </dd>
3791 </dl>
3792 </li>
3793 </ul>
3794 </dd>
3795 </dl>
3796 <dl>
3797 <dt>boo&#160;</dt>
3798 <dd>baz</dd>
3799 </dl>
3800 </li>
3801 </ol>
3802 </li>
3803 </ul>
3804 </li>
3805 </ol>
3806 </li>
3807 </ul>
3808 !! html/parsoid
3809 <ul>
3810 <li>
3811 <ol>
3812 <li>
3813 <ul>
3814 <li>
3815 <ol>
3816 <li>
3817 <dl>
3818 <dt>
3819 <ul>
3820 <li>
3821 <dl>
3822 <dt>
3823 <dl>
3824 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3825 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3826 </dl></dt>
3827 </dl></li>
3828 </ul></dt>
3829 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3830 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3831 </dl></li>
3832 </ol></li>
3833 </ul></li>
3834 </ol></li>
3835 </ul>
3836 !! end
3837
3838
3839 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
3840 !! test
3841 Definition Lists: Weird Ones: Test 1
3842 !! wikitext
3843 *#;*::;; foo : bar (who uses this?)
3844 !! html/php
3845 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3846 <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>
3847
3848 !! html/php+tidy
3849 <ul>
3850 <li>
3851 <ol>
3852 <li>
3853 <dl>
3854 <dt>foo&#160;</dt>
3855 <dd>
3856 <ul>
3857 <li>
3858 <dl>
3859 <dd>
3860 <dl>
3861 <dd>
3862 <dl>
3863 <dd>
3864 <dl>
3865 <dt>bar (who uses this?)</dt>
3866 </dl>
3867 </dd>
3868 </dl>
3869 </dd>
3870 </dl>
3871 </dd>
3872 </dl>
3873 </li>
3874 </ul>
3875 </dd>
3876 </dl>
3877 </li>
3878 </ol>
3879 </li>
3880 </ul>
3881 !! html/parsoid
3882 <ul>
3883 <li>
3884 <ol>
3885 <li>
3886 <dl>
3887 <dt>
3888 <ul>
3889 <li>
3890 <dl>
3891 <dd>
3892 <dl>
3893 <dd>
3894 <dl>
3895 <dt>
3896 <dl>
3897 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3898 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3899 </dl></dt>
3900 </dl></dd>
3901 </dl></dd>
3902 </dl></li>
3903 </ul></dt>
3904 </dl></li>
3905 </ol></li>
3906 </ul>
3907 !! end
3908
3909 ###
3910 ### External links
3911 ###
3912 !! test
3913 External links: non-bracketed
3914 !! wikitext
3915 Non-bracketed: http://example.com
3916 !! html
3917 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3918 </p>
3919 !! end
3920
3921 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3922 !! test
3923 External links: numbered
3924 !! wikitext
3925 Numbered: [http://example.com]
3926 Numbered: [http://example.net]
3927 Numbered: [http://example.com]
3928 !! html/php
3929 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3930 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3931 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3932 </p>
3933 !! html/parsoid
3934 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
3935 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
3936 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
3937 !!end
3938
3939 !! test
3940 External links: specified text
3941 !! wikitext
3942 Specified text: [http://example.com link]
3943 !! html
3944 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3945 </p>
3946 !!end
3947
3948 !! test
3949 External links: trail
3950 !! wikitext
3951 Linktrails should not work for external links: [http://example.com link]s
3952 !! html
3953 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3954 </p>
3955 !! end
3956
3957 !! test
3958 External links: dollar sign in URL
3959 !! wikitext
3960 http://example.com/1$2345
3961 !! html
3962 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3963 </p>
3964 !! end
3965
3966 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3967 !! test
3968 External links: dollar sign in URL (autonumber)
3969 !! wikitext
3970 [http://example.com/1$2345]
3971 !! html/php
3972 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3973 </p>
3974 !! html/parsoid
3975 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
3976 !!end
3977
3978 !! test
3979 External links: open square bracket forbidden in URL (bug 4377)
3980 !! options
3981 parsoid=wt2html,wt2wt,html2html
3982 !! wikitext
3983 http://example.com/1[2345
3984 !! html/php
3985 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3986 </p>
3987 !! html/parsoid
3988 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
3989 !! end
3990
3991 !! test
3992 External links: open square bracket forbidden in URL (named) (bug 4377)
3993 !! options
3994 parsoid=wt2html,html2html
3995 !! wikitext
3996 [http://example.com/1[2345]
3997 !! html/php
3998 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3999 </p>
4000 !! html/parsoid
4001 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4002 !!end
4003
4004 # parsoid adds a space before the link name
4005 !! test
4006 External links: open square bracket forbidden in URL (named) (bug 4377)
4007 Parsoid variant.
4008 !! wikitext
4009 [http://example.com/1 [2345]
4010 !! html
4011 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4012 </p>
4013 !!end
4014
4015 !! test
4016 External links: nowiki in URL link text (bug 6230)
4017 !! wikitext
4018 [http://example.com/ <nowiki>''example site''</nowiki>]
4019 !! html
4020 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4021 </p>
4022 !! end
4023
4024 !! test
4025 External links: newline forbidden in text (bug 6230 regression check)
4026 !! wikitext
4027 [http://example.com/ first
4028 second]
4029 !! html
4030 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4031 second]
4032 </p>
4033 !!end
4034
4035 !! test
4036 External links: Pipe char between url and text
4037 !! wikitext
4038 [http://example.com | link]
4039 !! html
4040 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4041 </p>
4042 !!end
4043
4044 !! test
4045 External links: protocol-relative URL in brackets
4046 !! wikitext
4047 [//example.com/ Test]
4048 !! html
4049 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4050 </p>
4051 !! end
4052
4053 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4054 !! test
4055 External links: protocol-relative URL in brackets without text
4056 !! wikitext
4057 [//example.com]
4058 !! html/php
4059 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4060 </p>
4061 !! html/parsoid
4062 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4063 !! end
4064
4065 !! test
4066 External links: protocol-relative URL in free text is left alone
4067 !! wikitext
4068 //example.com/Foo
4069 !! html
4070 <p>//example.com/Foo
4071 </p>
4072 !!end
4073
4074 !! test
4075 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4076 !! wikitext
4077 foo//example.com/Foo
4078 !! html
4079 <p>foo//example.com/Foo
4080 </p>
4081 !! end
4082
4083 !! test
4084 External links: with no contents
4085 !! wikitext
4086 [http://en.wikipedia.org/wiki/Foo]
4087
4088 [[wikipedia:Foo|Bar]]
4089
4090 [[wikipedia:Foo|<span>Bar</span>]]
4091 !! html/php
4092 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4093 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4094 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4095 </p>
4096 !! html/parsoid
4097 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4098 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4099 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4100 !! end
4101
4102 !! test
4103 External links: Free with trailing punctuation
4104 !! wikitext
4105 http://example.com,
4106 http://example.com;
4107 http://example.com\
4108 http://example.com.
4109 http://example.com:
4110 http://example.com!
4111 http://example.com?
4112 http://example.com)
4113 http://example.com/url_with_(brackets)
4114 !! html
4115 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4116 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4117 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4118 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4119 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4120 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4121 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4122 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4123 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4124 </p>
4125 !! end
4126
4127 !! test
4128 External image
4129 !! wikitext
4130 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4131 !! html
4132 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4133 </p>
4134 !! end
4135
4136 !! test
4137 External image from https
4138 !! wikitext
4139 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4140 !! html
4141 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4142 </p>
4143 !! end
4144
4145 !! test
4146 External image (when not allowed)
4147 !! options
4148 wgAllowExternalImages=0
4149 !! wikitext
4150 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4151 !! html
4152 <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>
4153 </p>
4154 !! end
4155
4156 !! test
4157 Link to non-http image, no img tag
4158 !! wikitext
4159 Link to non-http image, no img tag: ftp://example.com/test.jpg
4160 !! html
4161 <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>
4162 </p>
4163 !! end
4164
4165 !! test
4166 External links: terminating separator
4167 !! wikitext
4168 Terminating separator: http://example.com/thing,
4169 !! html
4170 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4171 </p>
4172 !! end
4173
4174 !! test
4175 External links: intervening separator
4176 !! wikitext
4177 Intervening separator: http://example.com/1,2,3
4178 !! html
4179 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4180 </p>
4181 !! end
4182
4183 !! test
4184 External links: old bug with URL in query
4185 !! wikitext
4186 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4187 !! html
4188 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4189 </p>
4190 !! end
4191
4192 !! test
4193 External links: old URL-in-URL bug, mixed protocols
4194 !! wikitext
4195 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4196 !! html
4197 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4198 </p>
4199 !!end
4200
4201 !! test
4202 External links: URL in text
4203 !! wikitext
4204 URL in text: [http://example.com http://example.com]
4205 !! html
4206 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4207 </p>
4208 !! end
4209
4210 !! test
4211 External links: Clickable images
4212 !! wikitext
4213 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4214 !! html
4215 <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>
4216 </p>
4217 !!end
4218
4219 !! test
4220 External links: raw ampersand
4221 !! wikitext
4222 Old &amp; use: http://x&y
4223 !! html
4224 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4225 </p>
4226 !! end
4227
4228 !! test
4229 External links: encoded ampersand
4230 !! wikitext
4231 Old &amp; use: http://x&amp;y
4232 !! html/php
4233 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4234 </p>
4235 !! html/parsoid
4236 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4237 !! end
4238
4239 !! test
4240 External links: encoded equals (bug 6102)
4241 !! wikitext
4242 http://example.com/?foo&#61;bar
4243 !! html/php
4244 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4245 </p>
4246 !! html/parsoid
4247 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4248 !! end
4249
4250 ##
4251 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4252 ## does it number them. As discussed in bug 53505, we can identify
4253 ## autonumbered links via CSS.
4254 ##
4255
4256 !! test
4257 External links: [raw ampersand]
4258 !! wikitext
4259 Old &amp; use: [http://x&y]
4260 !! html/php
4261 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4262 </p>
4263 !! html/parsoid
4264 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4265 !! end
4266
4267 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4268 # mode will return the [raw ampersand] wikitext
4269 !! test
4270 External links: [encoded ampersand]
4271 !! options
4272 parsoid=wt2html,wt2wt,html2html
4273 !! wikitext
4274 Old &amp; use: [http://x&amp;y]
4275 !! html/php
4276 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4277 </p>
4278 !! html/parsoid
4279 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4280 !! end
4281
4282 !! test
4283 External links: [raw equals]
4284 !! wikitext
4285 [http://example.com/?foo=bar]
4286 !! html/php
4287 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4288 </p>
4289 !! html/parsoid
4290 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4291 !! end
4292
4293 # note that parsoid html is identical to [raw equals] case; so html2wt
4294 # mode will return the [raw equals] wikitext
4295 !! test
4296 External links: [encoded equals] (bug 6102)
4297 !! options
4298 parsoid=wt2html,wt2wt,html2html
4299 !! wikitext
4300 [http://example.com/?foo&#61;bar]
4301 !! html/php
4302 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4303 </p>
4304 !! html/parsoid
4305 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4306 !! end
4307
4308 # xxx parsoid strips the IDN character, so the round-trip tests will
4309 # obviously fail and are disabled. --cscott
4310 !! test
4311 External links: [IDN ignored character reference in hostname; strip it right off]
4312 !! options
4313 parsoid=wt2html,wt2wt,html2html
4314 !! wikitext
4315 [http://e&zwnj;xample.com/]
4316 !! html/php
4317 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4318 </p>
4319 !! html/parsoid
4320 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4321 !! end
4322
4323 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4324 # Where an external link could easily circumvent the sanitization of the text of
4325 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4326 # test demands a higher standard. That's a bit strange.
4327 #
4328 # Example:
4329 #
4330 # http://e‌xample.com -> [http://example.com|http://example.com]
4331 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4332 #
4333 # The first example is sanitized, but the second is not. Any security benefits
4334 # from this production are trivial to circumvent. Either remove this test and
4335 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4336 # the test accordingly.
4337 #
4338 # All our love,
4339 # The Parsoid team.
4340 # xxx parsoid strips the IDN character, so the round-trip tests will
4341 # obviously fail and are disabled. --cscott
4342 !! test
4343 External links: IDN ignored character reference in hostname; strip it right off
4344 !! options
4345 parsoid=wt2html,html2html
4346 !! wikitext
4347 http://e&zwnj;xample.com/
4348 !! html/php
4349 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4350 </p>
4351 !! html/parsoid
4352 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4353 !! end
4354
4355 !! test
4356 External links: www.jpeg.org (bug 554)
4357 !! wikitext
4358 http://www.jpeg.org
4359 !! html
4360 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4361 </p>
4362 !! end
4363
4364 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4365 !! test
4366 External links: URL within URL (original bug 2)
4367 !! wikitext
4368 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4369 !! html/php
4370 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4371 </p>
4372 !! html/parsoid
4373 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4374 !! end
4375
4376 !! test
4377 BUG 361: URL inside bracketed URL
4378 !! wikitext
4379 [http://www.example.com/foo http://www.example.com/bar]
4380 !! html
4381 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4382 </p>
4383 !! end
4384
4385 !! test
4386 BUG 361: URL within URL, not bracketed
4387 !! wikitext
4388 http://www.example.com/foo?=http://www.example.com/bar
4389 !! html
4390 <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>
4391 </p>
4392 !! end
4393
4394 !! test
4395 BUG 289: ">"-token in URL-tail
4396 !! wikitext
4397 http://www.example.com/<hello>
4398 !! html
4399 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4400 </p>
4401 !!end
4402
4403 !! test
4404 BUG 289: literal ">"-token in URL-tail
4405 !! wikitext
4406 http://www.example.com/<b>html</b>
4407 !! html
4408 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4409 </p>
4410 !!end
4411
4412 !! test
4413 BUG 289: ">"-token in bracketed URL
4414 !! wikitext
4415 [http://www.example.com/<hello> stuff]
4416 !! html
4417 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4418 </p>
4419 !!end
4420
4421 !! test
4422 BUG 289: literal ">"-token in bracketed URL
4423 !! wikitext
4424 [http://www.example.com/<b>html</b> stuff]
4425 !! html
4426 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4427 </p>
4428 !!end
4429
4430 !! test
4431 BUG 289: literal double quote at end of URL
4432 !! wikitext
4433 http://www.example.com/"hello"
4434 !! html
4435 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4436 </p>
4437 !!end
4438
4439 !! test
4440 BUG 289: literal double quote in bracketed URL
4441 !! wikitext
4442 [http://www.example.com/"hello" stuff]
4443 !! html
4444 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4445 </p>
4446 !!end
4447
4448 !! test
4449 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4450 !! wikitext
4451 [http://www.example.com test]
4452 !! html
4453 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4454 </p>
4455 !! end
4456
4457 !! test
4458 External links: link text with spaces
4459 !! wikitext
4460 [http://www.example.com a b c]
4461 [http://www.example.com ''a'' ''b'']
4462 !! html
4463 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4464 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4465 </p>
4466 !! end
4467
4468 !! test
4469 External links: wiki links within external link (Bug 3695)
4470 !! wikitext
4471 [http://example.com [[wikilink]] embedded in ext link]
4472 !! html/php
4473 <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>
4474 </p>
4475 !! html/parsoid
4476 <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>
4477 !! end
4478
4479 !! test
4480 BUG 787: Links with one slash after the url protocol are invalid
4481 !! wikitext
4482 http:/example.com
4483
4484 [http:/example.com title]
4485 !! html
4486 <p>http:/example.com
4487 </p><p>[http:/example.com title]
4488 </p>
4489 !! end
4490
4491 !! test
4492 Bracketed external links with template-generated invalid target
4493 !! wikitext
4494 [{{echo|http:/example.com}} title]
4495 !! html
4496 <p>[http:/example.com title]
4497 </p>
4498 !! end
4499
4500 !! test
4501 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4502 !! wikitext
4503 ''[http://example.com text'']
4504 [http://example.com '''text]'''
4505 ''Something [http://example.com in italic'']
4506 ''Something [http://example.com mixed''''', even bold]'''
4507 '''''Now [http://example.com both''''']
4508 !! html
4509 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4510 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4511 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4512 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4513 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4514 </p>
4515 !! end
4516
4517
4518 !! test
4519 Bug 4781: %26 in URL
4520 !! wikitext
4521 http://www.example.com/?title=AT%26T
4522 !! html/php
4523 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4524 </p>
4525 !! html/parsoid
4526 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4527 !! end
4528
4529 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4530 # % is actually legal in HTML5. Any change in output would need testing though.
4531 !! test
4532 Bug 4781, 5267: %25 in URL
4533 !! wikitext
4534 http://www.example.com/?title=100%25_Bran
4535 !! html/php
4536 <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>
4537 </p>
4538 !! html/parsoid
4539 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4540 !! end
4541
4542 !! test
4543 Bug 4781, 5267: %28, %29 in URL
4544 !! wikitext
4545 http://www.example.com/?title=Ben-Hur_%281959_film%29
4546 !! html/php
4547 <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>
4548 </p>
4549 !! html/parsoid
4550 <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>
4551 !! end
4552
4553
4554 !! test
4555 Bug 4781: %26 in autonumber URL
4556 !! wikitext
4557 [http://www.example.com/?title=AT%26T]
4558 !! html/php
4559 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4560 </p>
4561 !! html/parsoid
4562 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4563 !! end
4564
4565 !! test
4566 Bug 4781, 5267: %26 in autonumber URL
4567 !! wikitext
4568 [http://www.example.com/?title=100%25_Bran]
4569 !! html/php
4570 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4571 </p>
4572 !! html/parsoid
4573 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4574 !! end
4575
4576 !! test
4577 Bug 4781, 5267: %28, %29 in autonumber URL
4578 !! wikitext
4579 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4580 !! html/php
4581 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4582 </p>
4583 !! html/parsoid
4584 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4585 !! end
4586
4587
4588 !! test
4589 Bug 4781: %26 in bracketed URL
4590 !! wikitext
4591 [http://www.example.com/?title=AT%26T link]
4592 !! html/php
4593 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4594 </p>
4595 !! html/parsoid
4596 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4597 !! end
4598
4599 !! test
4600 Bug 4781, 5267: %25 in bracketed URL
4601 !! wikitext
4602 [http://www.example.com/?title=100%25_Bran link]
4603 !! html
4604 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4605 </p>
4606 !! end
4607
4608 !! test
4609 Bug 4781, 5267: %28, %29 in bracketed URL
4610 !! wikitext
4611 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4612 !! html/php
4613 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4614 </p>
4615 !! html/parsoid
4616 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4617 !! end
4618
4619 !! test
4620 External link containing a period in the anchor. (bug 63947)
4621 !! wikitext
4622 [//foo.org/bar#baz. bang]
4623
4624 [//foo.org/bar. bang]
4625 !! html/php
4626 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4627 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4628 </p>
4629 !! html/parsoid
4630 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4631 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4632 !! end
4633
4634 !! test
4635 External link containing a single quote. (bug 63947)
4636 !! wikitext
4637 [//foo.org/bar'baz]
4638
4639 [//foo.org/bar'baz bang]
4640 !! html/php
4641 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4642 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4643 </p>
4644 !! html/parsoid
4645 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4646 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4647 !! end
4648
4649
4650 !! test
4651 External link containing a period in the anchor. (bug 63947)
4652 !! wikitext
4653 [//foo.org/bar#baz. bang]
4654
4655 [//foo.org/bar. bang]
4656 !! html/php
4657 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4658 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4659 </p>
4660 !! html/parsoid
4661 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4662 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4663 !! end
4664
4665 !! test
4666 External link containing a single quote. (bug 63947)
4667 !! wikitext
4668 [//foo.org/bar'baz]
4669
4670 [//foo.org/bar'baz bang]
4671 !! html/php
4672 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4673 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4674 </p>
4675 !! html/parsoid
4676 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4677 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4678 !! end
4679
4680
4681 !! test
4682 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4683 !! wikitext
4684 Some [http://example.com/ pretty ''italics'' and stuff]!
4685 !! html
4686 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4687 </p>
4688 !! end
4689
4690 !! test
4691 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4692 !! wikitext
4693 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4694 !! html
4695 <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>
4696 </p>
4697 !! end
4698
4699 !! test
4700 External link containing double-single-quotes with no space separating the url from text in italics
4701 !! wikitext
4702 [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]].]
4703 !! html/php
4704 <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>
4705 </p>
4706 !! html/php+tidy
4707 <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>
4708 !! html/parsoid
4709 <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>
4710 !! end
4711
4712 !! test
4713 External link with comments in link text
4714 !! wikitext
4715 [http://www.google.com Google <!-- comment -->]
4716 !! html
4717 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4718 </p>
4719 !! end
4720
4721 !! test
4722 URL-encoding in URL functions (single parameter)
4723 !! wikitext
4724 {{localurl:Some page|amp=&}}
4725 !! html
4726 <p>/index.php?title=Some_page&amp;amp=&amp;
4727 </p>
4728 !! end
4729
4730 !! test
4731 URL-encoding in URL functions (multiple parameters)
4732 !! wikitext
4733 {{localurl:Some page|q=?&amp=&}}
4734 !! html
4735 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4736 </p>
4737 !! end
4738
4739 !! test
4740 Brackets in urls
4741 !! wikitext
4742 http://example.com/index.php?foozoid%5B%5D=bar
4743
4744 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4745 !! html/php
4746 <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>
4747 </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>
4748 </p>
4749 !! html/parsoid
4750 <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>
4751
4752 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4753 !! end
4754
4755 !! test
4756 IPv6 urls (bug 21261)
4757 !! options
4758 disabled
4759 !! wikitext
4760 http://[2404:130:0:1000::187:2]/index.php
4761 !! html
4762 <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>
4763 </p>
4764 !! end
4765
4766 !! test
4767 Non-extlinks in brackets
4768 !! wikitext
4769 [foo]
4770 [foo bar]
4771 [foo ''bar'']
4772 [fool's] errand
4773 [fool's errand]
4774 [{{echo|foo}}]
4775 [{{echo|foo}} bar]
4776 [{{echo|foo}} ''bar'']
4777 [{{echo|foo}}l's] errand
4778 [{{echo|foo}}l's errand]
4779 [url={{echo|foo}}]
4780 [url=http://example.com]
4781 !! html
4782 <p>[foo]
4783 [foo bar]
4784 [foo <i>bar</i>]
4785 [fool's] errand
4786 [fool's errand]
4787 [foo]
4788 [foo bar]
4789 [foo <i>bar</i>]
4790 [fool's] errand
4791 [fool's errand]
4792 [url=foo]
4793 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4794 </p>
4795 !! end
4796
4797 !! test
4798 Percent encoding in external links
4799 !! wikitext
4800 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4801 !! html/php
4802 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4803 </p>
4804 !! html/parsoid
4805 <p><a rel="mw:ExtLink"
4806 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4807 !! end
4808
4809 !! test
4810 Use url link syntax for links where the content is equal the link target
4811 !! wikitext
4812 http://example.com
4813 !! html/php
4814 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4815 </p>
4816 !! html/parsoid
4817 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4818 !! end
4819
4820 !! test
4821 Parenthesis in external links, especially URL links
4822 !! wikitext
4823 http://example.com)
4824
4825 http://example.com/test)
4826
4827 http://example.com/(test)
4828
4829 http://example.com/((test)
4830
4831 (http://example.com/(test))
4832
4833 (http://example.com/(test)))))
4834
4835 http://example.com/a)b
4836
4837 [http://example.com) foo]
4838 !! html/php
4839 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4840 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4841 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4842 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4843 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4844 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4845 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4846 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4847 </p>
4848 !! html/parsoid
4849 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4850 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4851 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4852 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4853 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4854 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4855 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4856 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4857 !! end
4858
4859 !! test
4860 Parenthesis in external links, w/ transclusion or comment
4861 !! wikitext
4862 (http://example.com/{{echo|hi}})
4863
4864 (http://example.com<!-- hi -->)
4865 !! html/php
4866 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4867 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4868 </p>
4869 !! html/parsoid
4870 <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>
4871
4872 <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>
4873 !! end
4874
4875 !! test
4876 Replace invalid link targets when serializing
4877 !! options
4878 parsoid=html2wt
4879 !! html
4880 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
4881 !! wikitext
4882 [[MediaWiki:Badtitletext|Manual]]
4883 !! end
4884
4885 ###
4886 ### Quotes
4887 ###
4888
4889 !! test
4890 Quotes
4891 !! wikitext
4892 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4893
4894 Normal text. '''''Bold italic text.''''' Normal text.
4895 !! html
4896 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4897 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4898 </p>
4899 !! end
4900
4901
4902 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4903 # parser strips. The wikitext contains just the first half of the bold
4904 # quote pair.
4905 !! test
4906 Unclosed and unmatched quotes
4907 !! wikitext
4908 '''''Bold italic text '''with bold deactivated''' in between.'''''
4909
4910 '''''Bold italic text ''with italic deactivated'' in between.'''''
4911
4912 '''Bold text..
4913
4914 ..spanning two paragraphs (should not work).'''
4915
4916 '''Bold tag left open
4917
4918 ''Italic tag left open
4919
4920 Normal text.
4921
4922 <!-- Unmatching number of opening, closing tags: -->
4923 '''This year''''s election ''should'' beat '''last year''''s.
4924
4925 ''Tom'''s car is bigger than ''Susan'''s.
4926
4927 Plain ''italic'''s plain
4928 !! html/php
4929 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4930 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4931 </p><p><b>Bold text..</b>
4932 </p><p>..spanning two paragraphs (should not work).
4933 </p><p><b>Bold tag left open</b>
4934 </p><p><i>Italic tag left open</i>
4935 </p><p>Normal text.
4936 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4937 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4938 </p><p>Plain <i>italic'</i>s plain
4939 </p>
4940 !! html/parsoid
4941 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4942 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4943 </p><p><b>Bold text..</b>
4944 </p><p>..spanning two paragraphs (should not work).<b></b>
4945 </p><p><b>Bold tag left open</b>
4946 </p><p><i>Italic tag left open</i>
4947 </p><p>Normal text.
4948 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4949 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4950 </p><p>Plain <i>italic'</i>s plain
4951 </p>
4952 !! end
4953
4954 ###
4955 ### Tables
4956 ###
4957 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4958 ###
4959
4960 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4961 # is the bare minimum required by the spec, see:
4962 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4963 # Parsoid team replies: empty table tags are legal in HTML5
4964 !! test
4965 A table with no data.
4966 !! options
4967 parsoid=wt2html
4968 !! wikitext
4969 {||}
4970 !! html/php
4971
4972 !! html/parsoid
4973 <table></table>
4974
4975 !! end
4976
4977 !! test
4978 A table with stray table end tags on start tag line (wt2html)
4979 !! options
4980 parsoid=wt2html
4981 !! wikitext
4982 {|style="color: red;"|}
4983
4984 {|style="color: red;" |}
4985 |foo
4986 |}
4987
4988 {|style="color: red;"|} id="foo"
4989 |foo
4990 |}
4991
4992 {|style="color: red;" |} id="foo"
4993 |foo
4994 |}
4995 !! html
4996 <table style="color: red;"></table>
4997
4998 <table style="color: red;">
4999 <tbody><tr>
5000 <td>foo</td>
5001 </tr></tbody>
5002 </table>
5003
5004 <table style="color: red;" id="foo">
5005 <tbody><tr>
5006 <td>foo</td>
5007 </tr></tbody>
5008 </table>
5009
5010 <table style="color: red;" id="foo">
5011 <tbody><tr>
5012 <td>foo</td>
5013 </tr></tbody>
5014 </table>
5015
5016 !! end
5017
5018 !! test
5019 A table with no data (take 2)
5020 !! wikitext
5021 {|
5022 |}
5023 !! html/parsoid
5024 <table></table>
5025 !! end
5026
5027 # A table with nothing but a caption is invalid XHTML, we might want to render
5028 # this as <p>caption</p>
5029 # Parsoid team replies: table with only a caption is legal in HTML5
5030 !! test
5031 A table with nothing but a caption
5032 !! wikitext
5033 {|
5034 |+ caption
5035 |}
5036 !! html/php
5037 <table>
5038 <caption> caption
5039 </caption><tr><td></td></tr></table>
5040
5041 !! html/parsoid
5042 <table><caption> caption</caption></table>
5043 !! end
5044
5045 !! test
5046 A table with caption with default-spaced attributes and a table row
5047 !! wikitext
5048 {|
5049 |+ style="color: red;" | caption1
5050 |-
5051 | foo
5052 |}
5053 !! html
5054 <table>
5055 <caption style="color: red;"> caption1
5056 </caption>
5057 <tr>
5058 <td> foo
5059 </td></tr></table>
5060
5061 !! end
5062
5063 !! test
5064 A table with captions with non-default spaced attributes and a table row
5065 !! wikitext
5066 {|
5067 |+style="color: red;"|caption2
5068 |+ style="color: red;"| caption3
5069 |-
5070 | foo
5071 |}
5072 !! html
5073 <table>
5074 <caption style="color: red;">caption2
5075 </caption>
5076 <caption style="color: red;"> caption3
5077 </caption>
5078 <tr>
5079 <td> foo
5080 </td></tr></table>
5081
5082 !! end
5083
5084 !! test
5085 Table td-cell syntax variations
5086 !! wikitext
5087 {|
5088 | foo bar foo | baz
5089 | foo bar foo || baz
5090 | style='color:red;' | baz
5091 | style='color:red;' || baz
5092 |}
5093 !! html
5094 <table>
5095 <tr>
5096 <td> baz
5097 </td>
5098 <td> foo bar foo </td>
5099 <td> baz
5100 </td>
5101 <td style="color:red;"> baz
5102 </td>
5103 <td> style='color:red;' </td>
5104 <td> baz
5105 </td></tr></table>
5106
5107 !! end
5108
5109 !! test
5110 Simple table
5111 !! wikitext
5112 {|
5113 | 1 || 2
5114 |-
5115 | 3 || 4
5116 |}
5117 !! html
5118 <table>
5119 <tr>
5120 <td> 1 </td>
5121 <td> 2
5122 </td></tr>
5123 <tr>
5124 <td> 3 </td>
5125 <td> 4
5126 </td></tr></table>
5127
5128 !! end
5129
5130 !! test
5131 Simple table but with multiple dashes for row wikitext
5132 !! wikitext
5133 {|
5134 | foo
5135 |-----
5136 | bar
5137 |}
5138 !! html
5139 <table>
5140 <tr>
5141 <td> foo
5142 </td></tr>
5143 <tr>
5144 <td> bar
5145 </td></tr></table>
5146
5147 !! end
5148 !! test
5149 Multiplication table
5150 !! wikitext
5151 {| border="1" cellpadding="2"
5152 |+Multiplication table
5153 |-
5154 ! &times; !! 1 !! 2 !! 3
5155 |-
5156 ! 1
5157 | 1 || 2 || 3
5158 |-
5159 ! 2
5160 | 2 || 4 || 6
5161 |-
5162 ! 3
5163 | 3 || 6 || 9
5164 |-
5165 ! 4
5166 | 4 || 8 || 12
5167 |-
5168 ! 5
5169 | 5 || 10 || 15
5170 |}
5171 !! html
5172 <table border="1" cellpadding="2">
5173 <caption>Multiplication table
5174 </caption>
5175 <tr>
5176 <th> &#215; </th>
5177 <th> 1 </th>
5178 <th> 2 </th>
5179 <th> 3
5180 </th></tr>
5181 <tr>
5182 <th> 1
5183 </th>
5184 <td> 1 </td>
5185 <td> 2 </td>
5186 <td> 3
5187 </td></tr>
5188 <tr>
5189 <th> 2
5190 </th>
5191 <td> 2 </td>
5192 <td> 4 </td>
5193 <td> 6
5194 </td></tr>
5195 <tr>
5196 <th> 3
5197 </th>
5198 <td> 3 </td>
5199 <td> 6 </td>
5200 <td> 9
5201 </td></tr>
5202 <tr>
5203 <th> 4
5204 </th>
5205 <td> 4 </td>
5206 <td> 8 </td>
5207 <td> 12
5208 </td></tr>
5209 <tr>
5210 <th> 5
5211 </th>
5212 <td> 5 </td>
5213 <td> 10 </td>
5214 <td> 15
5215 </td></tr></table>
5216
5217 !! end
5218
5219 !! test
5220 Accept "||" in table headings
5221 !! wikitext
5222 {|
5223 !h1 || h2
5224 |}
5225 !! html
5226 <table>
5227 <tr>
5228 <th>h1 </th>
5229 <th> h2
5230 </th></tr></table>
5231
5232 !! end
5233
5234 !! test
5235 Accept "!!" in table data
5236 !! wikitext
5237 {|
5238 | Foo!! ||
5239 |}
5240 !! html
5241 <table>
5242 <tr>
5243 <td> Foo!! </td>
5244 <td>
5245 </td></tr></table>
5246
5247 !! html/parsoid
5248 <table>
5249 <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>
5250 </tbody></table>
5251 !! end
5252
5253 !! test
5254 Accept "||" in indented table headings
5255 !! wikitext
5256 :{|
5257 !h1 || h2
5258 |}
5259 !! html
5260 <dl><dd><table>
5261 <tr>
5262 <th>h1 </th>
5263 <th> h2
5264 </th></tr></table></dd></dl>
5265
5266 !! end
5267
5268 !! test
5269 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5270 !! wikitext
5271 {|
5272 !| h1
5273 || a
5274 |}
5275 !! html
5276 <table>
5277 <tr>
5278 <th> h1
5279 </th>
5280 <td> a
5281 </td></tr></table>
5282
5283 !! end
5284
5285 !!test
5286 Accept "| !" at start of line in tables (ignore !-attribute)
5287 !! wikitext
5288 {|
5289 |-
5290 | !style="color:red" | bar
5291 |}
5292 !! html
5293 <table>
5294
5295 <tr>
5296 <td> bar
5297 </td></tr></table>
5298
5299 !!end
5300
5301 !!test
5302 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 +/-
5303 !! wikitext
5304 {|
5305 |-
5306 |style='color:red;'|+1
5307 |style='color:blue;'|-1
5308 |-
5309 | 1 || 2 || 3
5310 | 1 ||+2 ||-3
5311 |-
5312 | +1
5313 | -1
5314 |}
5315 !! html
5316 <table>
5317
5318 <tr>
5319 <td style="color:red;">+1
5320 </td>
5321 <td style="color:blue;">-1
5322 </td></tr>
5323 <tr>
5324 <td> 1 </td>
5325 <td> 2 </td>
5326 <td> 3
5327 </td>
5328 <td> 1 </td>
5329 <td>+2 </td>
5330 <td>-3
5331 </td></tr>
5332 <tr>
5333 <td> +1
5334 </td>
5335 <td> -1
5336 </td></tr></table>
5337
5338 !!end
5339
5340 !! test
5341 Table rowspan
5342 !! wikitext
5343 {| border=1
5344 | Cell 1, row 1
5345 |rowspan=2| Cell 2, row 1 (and 2)
5346 | Cell 3, row 1
5347 |-
5348 | Cell 1, row 2
5349 | Cell 3, row 2
5350 |}
5351 !! html
5352 <table border="1">
5353 <tr>
5354 <td> Cell 1, row 1
5355 </td>
5356 <td rowspan="2"> Cell 2, row 1 (and 2)
5357 </td>
5358 <td> Cell 3, row 1
5359 </td></tr>
5360 <tr>
5361 <td> Cell 1, row 2
5362 </td>
5363 <td> Cell 3, row 2
5364 </td></tr></table>
5365
5366 !! end
5367
5368 !! test
5369 Nested table
5370 !! wikitext
5371 {| border=1
5372 | &alpha;
5373 |
5374 {| bgcolor=#ABCDEF border=2
5375 |nested
5376 |-
5377 |table
5378 |}
5379 |the original table again
5380 |}
5381 !! html
5382 <table border="1">
5383 <tr>
5384 <td> &#945;
5385 </td>
5386 <td>
5387 <table bgcolor="#ABCDEF" border="2">
5388 <tr>
5389 <td>nested
5390 </td></tr>
5391 <tr>
5392 <td>table
5393 </td></tr></table>
5394 </td>
5395 <td>the original table again
5396 </td></tr></table>
5397
5398 !! end
5399
5400 !! test
5401 Invalid attributes in table cell (bug 1830)
5402 !! wikitext
5403 {|
5404 |Cell:|broken
5405 |}
5406 !! html
5407 <table>
5408 <tr>
5409 <td>broken
5410 </td></tr></table>
5411
5412 !! end
5413
5414
5415 # The "|}" to close the table is missing from the input, so parsoid's
5416 # *2wt modes will fail.
5417 !! test
5418 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5419 !! options
5420 parsoid=wt2html,html2html
5421 !! wikitext
5422 {|
5423 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5424 !! html/php
5425 <table>
5426 <tr>
5427 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5428 <td>]" onmouseover="alert(document.cookie)"&gt;test
5429 </td>
5430 </tr>
5431 </table>
5432
5433 !! html/parsoid
5434 <table><tbody>
5435 <tr>
5436 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5437 !! end
5438
5439
5440 !! test
5441 Indented table markup mixed with indented pre content (proposed in bug 6200)
5442 !! wikitext
5443 <table>
5444 <tr>
5445 <td>
5446 Text that should be rendered preformatted
5447 </td>
5448 </tr>
5449 </table>
5450 !! html
5451 <table>
5452 <tr>
5453 <td>
5454 <pre>Text that should be rendered preformatted
5455 </pre>
5456 </td>
5457 </tr>
5458 </table>
5459
5460 !! end
5461
5462 !! test
5463 Template-generated table cell attributes and cell content
5464 !! wikitext
5465 {|
5466 |{{table_attribs}}
5467 | {{table_attribs}}
5468 |}
5469 !! html
5470 <table>
5471 <tr>
5472 <td style="color: red"> Foo
5473 </td>
5474 <td style="color: red"> Foo
5475 </td></tr></table>
5476
5477 !! end
5478
5479 !! test
5480 Template-generated table cell attributes and cell content (2)
5481 !! wikitext
5482 {|
5483 |align=center {{table_attribs}}
5484 |}
5485 !! html
5486 <table>
5487 <tr>
5488 <td align="center" style="color: red"> Foo
5489 </td></tr></table>
5490
5491 !! end
5492
5493 !! test
5494 Template-generated table cell attributes and cell content (3)
5495 !! wikitext
5496 {|
5497 |align=center {{table_cells}}
5498 |}
5499 !! html
5500 <table>
5501 <tr>
5502 <td align="center" style="color: red"> Foo </td>
5503 <td> Bar </td>
5504 <td> Baz
5505 </td></tr></table>
5506
5507 !! end
5508
5509 !! test
5510 Table with row followed by newlines and table heading
5511 !! wikitext
5512 {|
5513 |-
5514
5515 ! foo
5516 |}
5517 !! html
5518 <table>
5519
5520
5521 <tr>
5522 <th> foo
5523 </th></tr></table>
5524
5525 !! end
5526
5527 !! test
5528 Table with empty line following the start tag
5529 !! wikitext
5530 {|
5531
5532 |-
5533 | foo
5534 |}
5535 !! html
5536 <table>
5537
5538
5539 <tr>
5540 <td> foo
5541 </td></tr></table>
5542
5543 !! end
5544
5545 # FIXME: Preserve the attribute properly (with an empty string as value) in
5546 # the PHP parser. Parsoid implements the behavior below.
5547 !! test
5548 Table attributes with empty value
5549 !! wikitext
5550 {|
5551 | style=| hello
5552 |}
5553 !! html/parsoid
5554 <table>
5555 <tbody>
5556 <tr>
5557 <td style=""> hello
5558 </td></tr></tbody></table>
5559
5560 !! end
5561
5562 !! test
5563 Wikitext table with a lot of comments
5564 !! wikitext
5565 {|
5566 <!-- c0 -->
5567 | foo
5568 <!-- c1 -->
5569 |- <!-- c2 -->
5570 <!-- c3 -->
5571 |<!-- c4 -->
5572 <!-- c5 -->
5573 |}
5574 !! html
5575 <table>
5576 <tr>
5577 <td> foo
5578 </td></tr>
5579 <tr>
5580 <td>
5581 </td></tr></table>
5582
5583 !! end
5584
5585 !! test
5586 Wikitext table with double-line table cell
5587 !! wikitext
5588 {|
5589 |a
5590 b
5591 |}
5592 !! html
5593 <table>
5594 <tr>
5595 <td>a
5596 <p>b
5597 </p>
5598 </td></tr></table>
5599
5600 !! end
5601
5602 !! test
5603 Table cell with a single comment
5604 !! wikitext
5605 {|
5606 | <!-- c1 -->
5607 | a
5608 |}
5609 !! html
5610 <table>
5611 <tr>
5612 <td>
5613 </td>
5614 <td> a
5615 </td></tr></table>
5616
5617 !! end
5618
5619 !! test
5620 Table-cell after a comment-only-empty-line
5621 !! wikitext
5622 {|
5623 |a
5624 <!--c1-->
5625 <!--c2-->| b
5626 |}
5627 !! html
5628 <table>
5629 <tr>
5630 <td>a
5631 </td>
5632 <td> b
5633 </td></tr></table>
5634
5635 !! html/parsoid
5636 <table>
5637 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5638 <!--c1-->
5639 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5640 </tbody></table>
5641
5642 !! end
5643
5644 !! test
5645 Build table with {{!}}
5646 !! wikitext
5647 {{{!}} class="wikitable"
5648 ! header
5649 ! second header
5650 {{!}}- style="color:red;"
5651 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
5652 {{!}}}
5653 !! html
5654 <table class="wikitable">
5655 <tr>
5656 <th> header
5657 </th>
5658 <th> second header
5659 </th></tr>
5660 <tr style="color:red;">
5661 <td> data </td>
5662 <td style="color:red;"> second data
5663 </td></tr></table>
5664
5665 !! end
5666
5667 !! test
5668 Build table with pipe as data
5669 !! wikitext
5670 {| class="wikitable"
5671 ! header
5672 ! second header
5673 |- style="color:red;"
5674 | data || style="color:red;" | second data
5675 |-
5676 | style="color:red;" | data with | || style="color:red;" | second data with |
5677 |-
5678 || data with | ||| second data with |
5679 |}
5680 !! html
5681 <table class="wikitable">
5682 <tr>
5683 <th> header
5684 </th>
5685 <th> second header
5686 </th></tr>
5687 <tr style="color:red;">
5688 <td> data </td>
5689 <td style="color:red;"> second data
5690 </td></tr>
5691 <tr>
5692 <td style="color:red;"> data with | </td>
5693 <td style="color:red;"> second data with |
5694 </td></tr>
5695 <tr>
5696 <td> data with | </td>
5697 <td> second data with |
5698 </td></tr></table>
5699
5700 !! end
5701
5702 !! test
5703 Build table with wikilink
5704 !! wikitext
5705 {| class="wikitable"
5706 ! header || second header
5707 |- style="color:red;"
5708 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
5709 |-
5710 | data || second data [[Main Page|link|text with pipe]]
5711 |}
5712 !! html
5713 <table class="wikitable">
5714 <tr>
5715 <th> header </th>
5716 <th> second header
5717 </th></tr>
5718 <tr style="color:red;">
5719 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
5720 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
5721 </td></tr>
5722 <tr>
5723 <td> data </td>
5724 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
5725 </td></tr></table>
5726
5727 !! end
5728
5729 # The expected HTML structure in this test is debatable. The PHP parser does
5730 # not parse this kind of table at all. The main focus for Parsoid is on
5731 # round-tripping, so this output is ok for now. TODO: revisit!
5732 !! test
5733 Wikitext table with html-syntax row
5734 !! wikitext
5735 {|
5736 |-
5737 <td>foo</td>
5738 |}
5739 !! html/parsoid
5740 <table>
5741 <tbody>
5742 <tr>
5743 <td>foo</td></tr></tbody></table>
5744 !! end
5745
5746 ## Note that Parsoid output differs from PHP and PHP+tidy here.
5747 ## The lack of <tr> tags in the PHP output is arguably a bug in the
5748 ## PHP parser, which tidy then compounds by fostering the content
5749 ## entirely out of the table. Parsoid recognizes the table context
5750 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
5751 ## depends on PHP's treatment of broken table markup!
5752 !! test
5753 Implicit <td> after a |-
5754 !! options
5755 parsoid=wt2html,html2html
5756 !! wikitext
5757 {|
5758 |-
5759 a
5760 |}
5761 !! html/php
5762 <table>
5763
5764 a
5765 </table>
5766
5767 !! html/php+tidy
5768 <p>a</p>
5769 !! html/parsoid
5770 <table>
5771 <tr><td>a</td></tr>
5772 </table>
5773 !! end
5774
5775 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
5776 !! test
5777 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
5778 !! options
5779 parsoid=wt2html,html2html
5780 !! wikitext
5781 {|
5782 |-
5783 |
5784 a
5785 |-
5786 b
5787 |}
5788 !! html/php
5789 <table>
5790
5791 <tr>
5792 <td>
5793 <pre>a
5794 </pre>
5795 </td></tr>
5796 b
5797 </table>
5798
5799 !! html/php+tidy
5800 <p>b</p>
5801 <table>
5802 <tr>
5803 <td>
5804 <pre>
5805 a
5806 </pre></td>
5807 </tr>
5808 </table>
5809 !! html/parsoid
5810 <table>
5811 <tbody>
5812 <tr><td><pre>a</pre></td></tr>
5813 <tr><td> b</td></tr>
5814 </tbody>
5815 </table>
5816 !! end
5817
5818 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
5819 # Parsoid generates the missing <td>, so wt2wt won't succeed.
5820 !! test
5821 Lists should be recognized in an implicit <td> context
5822 !! options
5823 parsoid=wt2html,html2html
5824 !! wikitext
5825 {|
5826 |-
5827 *a
5828 |}
5829 !! html/php
5830 <table>
5831
5832 <ul><li>a</li></ul>
5833 </table>
5834
5835 !! html/php+tidy
5836 <ul>
5837 <li>a</li>
5838 </ul>
5839 !! html/parsoid
5840 <table>
5841 <tr>
5842 <td><ul>
5843 <li>a</li>
5844 </ul></td>
5845 </tr>
5846 </table>
5847 !! end
5848
5849 !! test
5850 Parsoid: Round-trip tables directly followed by content (bug 51219)
5851 !! options
5852 parsoid=wt2html,wt2wt
5853 !! wikitext
5854 {|
5855 |foo
5856 |} bar
5857
5858 {|
5859 |baz
5860 |}<b>quux</b>
5861 !! html+tidy
5862 <table>
5863 <tr>
5864 <td>foo</td>
5865 </tr>
5866 </table>
5867 <p>bar</p>
5868 <table>
5869 <tr>
5870 <td>baz</td>
5871 </tr>
5872 </table>
5873 <p><b>quux</b></p>
5874 !! end
5875
5876 !! test
5877 Parsoid: Default to a newline after tables in new content (bug 51219)
5878 !! options
5879 parsoid=html2wt
5880 !! wikitext
5881 {|
5882 |foo
5883 |}
5884 <nowiki> </nowiki>bar
5885 {|
5886 |baz
5887 |}
5888 '''quux'''
5889 !! html
5890 <table><tbody>
5891 <tr><td>foo</td></tr></tbody></table> bar
5892 <table><tbody>
5893 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5894 !! end
5895
5896 !! test
5897 Parsoid: newline inducing block nodes don't suppress <nowiki>
5898 !! options
5899 parsoid=html2wt
5900 !! wikitext
5901 <nowiki> </nowiki>a
5902
5903 = foo =
5904 !! html
5905 a<h1>foo</h1>
5906 !! end
5907
5908 !! test
5909 Parsoid: Row-syntax table headings followed by comment & table cells
5910 !! options
5911 parsoid=wt2html,wt2wt
5912 !! wikitext
5913 {|
5914 ! foo || bar
5915 <!-- foo --> || baz || quux
5916 |}
5917 !! html/php
5918 <table>
5919 <tr>
5920 <th> foo </th>
5921 <th> bar
5922 </th>
5923 <td> baz </td>
5924 <td> quux
5925 </td></tr></table>
5926
5927 !! html/parsoid
5928 <table>
5929 <tbody><tr><th> foo </th><th> bar
5930 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
5931 </tbody></table>
5932 !! end
5933
5934
5935 # PHP throws away the (semi-broken) "foo" class here; Parsoid
5936 # preserves it.
5937 !!test
5938 Parsoid: Recover better from broken table attributes
5939 !!options
5940 parsoid=wt2html
5941 !!wikitext
5942 {| class="foo
5943 | class="bar" |
5944 foo
5945 |}
5946 !!html/php+tidy
5947 <table>
5948 <tr>
5949 <td class="bar">
5950 <p>foo</p>
5951 </td>
5952 </tr>
5953 </table>
5954 !!html/parsoid
5955 <table class="foo">
5956 <tr>
5957 <td class="bar">
5958 <p>foo</p></td></tr>
5959 </tbody></table>
5960 !!end
5961
5962 !! test
5963 Strip unsupported table tags
5964 !! options
5965 parsoid=html2wt
5966 !! html
5967 <table>
5968 <thead>
5969 <tr>
5970 <th>Month</th>
5971 <th>Savings</th>
5972 </tr>
5973 </thead>
5974 <tbody>
5975 <tr>
5976 <td>January</td>
5977 <td>$100</td>
5978 </tr>
5979 <tr>
5980 <td>February</td>
5981 <td>$80</td>
5982 </tr>
5983 </tbody>
5984 <tfoot>
5985 <tr>
5986 <td>Sum</td>
5987 <td>$180</td>
5988 </tr>
5989 </tfoot>
5990 </table>
5991 !! wikitext
5992 {|
5993
5994 !Month
5995 !Savings
5996
5997 |January
5998 |$100
5999
6000 |-
6001 |February
6002 |$80
6003
6004 |Sum
6005 |$180
6006
6007 |}
6008 !! end
6009
6010 ###
6011 ### Internal links
6012 ###
6013 !! test
6014 Plain link, capitalized
6015 !! wikitext
6016 [[Main Page]]
6017 !! html
6018 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6019 </p>
6020 !! end
6021
6022 !! test
6023 Plain link, uncapitalized
6024 !! wikitext
6025 [[main Page]]
6026 !! html
6027 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6028 </p>
6029 !! end
6030
6031 !! test
6032 Piped link
6033 !! wikitext
6034 [[Main Page|The Main Page]]
6035 !! html
6036 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6037 </p>
6038 !! end
6039
6040 !! test
6041 Piped link with comment in link text
6042 !! wikitext
6043 [[Main Page|The Main<!--front--> Page]]
6044 !! html
6045 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6046 </p>
6047 !! end
6048
6049 !! test
6050 Piped link with multiple pipe characters in link text
6051 !! wikitext
6052 [[Main Page||The|Main|Page|]]
6053 !! html/php
6054 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6055 </p>
6056 !! html/parsoid
6057 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6058 !! end
6059
6060 !! test
6061 Broken link
6062 !! wikitext
6063 [[Zigzagzogzagzig]]
6064 !! html
6065 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6066 </p>
6067 !! end
6068
6069 !! test
6070 Broken link with fragment
6071 !! wikitext
6072 [[Zigzagzogzagzig#zug]]
6073 !! html
6074 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6075 </p>
6076 !! end
6077
6078 !! test
6079 Special page link with fragment
6080 !! wikitext
6081 [[Special:Version#anchor]]
6082 !! html
6083 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6084 </p>
6085 !! end
6086
6087 !! test
6088 Nonexistent special page link with fragment
6089 !! wikitext
6090 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6091 !! html
6092 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6093 </p>
6094 !! end
6095
6096 !! test
6097 Link with prefix
6098 !! wikitext
6099 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6100 !! html
6101 <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>
6102 </p>
6103 !! end
6104
6105 !! test
6106 Link with suffix
6107 !! wikitext
6108 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6109 !! html
6110 <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>!!!
6111 </p>
6112 !! end
6113
6114 !! article
6115 prefixed article
6116 !! text
6117 Some text
6118 !! endarticle
6119
6120 !! test
6121 Bug 43661: Piped links with identical prefixes
6122 !! wikitext
6123 [[prefixed article|prefixed articles with spaces]]
6124
6125 [[prefixed article|prefixed articlesaoeu]]
6126
6127 [[Main Page|Main Page test]]
6128 !! html
6129 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6130 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6131 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6132 </p>
6133 !! end
6134
6135
6136 !! test
6137 Link with HTML entity in suffix / tail
6138 !! wikitext
6139 [[Main Page]]&quot;, [[Main Page]]&#97;
6140 !! html
6141 <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;
6142 </p>
6143 !! end
6144
6145 !! test
6146 Link with 3 brackets
6147 !! wikitext
6148 [[[Main Page]]]
6149 !! html
6150 <p>[[[Main Page]]]
6151 </p>
6152 !! end
6153
6154 !! test
6155 Link with 4 brackets
6156 !! wikitext
6157 [[[[Main Page]]]]
6158 !! html
6159 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6160 </p>
6161 !! end
6162
6163 !! test
6164 Piped link with 3 brackets
6165 !! wikitext
6166 [[[main page|the main page]]]
6167 !! html
6168 <p>[[[main page|the main page]]]
6169 </p>
6170 !! end
6171
6172 !! test
6173 Piped link with extlink-like text
6174 !! wikitext
6175 [[Main Page|[bar]]]
6176 [[Main Page|This is a [bar]]]
6177 !! html
6178 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6179 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6180 </p>
6181 !! end
6182
6183 !! test
6184 Link with multiple pipes
6185 !! wikitext
6186 [[Main Page|The|Main|Page]]
6187 !! html
6188 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6189 </p>
6190 !! end
6191
6192 # Note that parsoid does not munge anchor text; all non-space
6193 # characters are valid in HTML5 ids.
6194 !! test
6195 Anchor containing a #. (bug 63430)
6196 !! wikitext
6197 [[Main Page#And#Link]]
6198 !! html/php
6199 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6200 </p>
6201 !! html/parsoid
6202 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6203 !! end
6204
6205 !! test
6206 Link to namespaces
6207 !! wikitext
6208 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6209 !! html
6210 <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>
6211 </p>
6212 !! end
6213
6214 !! test
6215 Link with space in namespace
6216 !! wikitext
6217 [[User talk:Foo bar]]
6218 !! html
6219 <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>
6220 </p>
6221 !! end
6222
6223 !! article
6224 MemoryAlpha:AlphaTest
6225 !! text
6226 This is an article in the MemoryAlpha namespace
6227 (which shadows the memoryalpha interwiki link).
6228 !! endarticle
6229
6230 !! test
6231 Namespace takes precedence over interwiki link (bug 51680)
6232 !! wikitext
6233 [[MemoryAlpha:AlphaTest]]
6234 !! html
6235 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6236 </p>
6237 !! end
6238
6239 # The previous test doesn't work correctly in html2*, due to not recognizing the
6240 # link as an internal one. This one checks for the correct behavior.
6241 !! test
6242 Link to namespace preferred over interwiki with correct rel attribute
6243 !! options
6244 parsoid=html2wt,html2html
6245 !! wikitext
6246 [[MemoryAlpha:AlphaTest]]
6247 !! html
6248 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6249 </p>
6250 !! end
6251
6252 !! test
6253 Piped link to namespace
6254 !! wikitext
6255 [[Meta:Disclaimers|The disclaimers]]
6256 !! html
6257 <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>
6258 </p>
6259 !! end
6260
6261 !! test
6262 Link containing }
6263 !! wikitext
6264 [[Usually caused by a typo (oops}]]
6265 !! html
6266 <p>[[Usually caused by a typo (oops}]]
6267 </p>
6268 !! end
6269
6270 !! article
6271 7% Solution
6272 !! text
6273 Just a test of an article title containing a percent.
6274 !! endarticle
6275
6276 !! test
6277 Link containing % (not as a hex sequence)
6278 !! wikitext
6279 [[7% Solution]]
6280 !! html/php
6281 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6282 </p>
6283 !! html/parsoid
6284 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6285 !! end
6286
6287 # note that the parsoid HTML is identical to the previous test output,
6288 # so the previous test ensures that the html2wt mode will generate the
6289 # "not as a hex sequence" wikitext.
6290 !! test
6291 Link containing % as a single hex sequence interpreted to char
6292 !! options
6293 parsoid=wt2wt,wt2html,html2html
6294 !! wikitext
6295 [[7%25 Solution]]
6296 !! html/php
6297 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6298 </p>
6299 !! html/parsoid
6300 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6301 !!end
6302
6303 !! test
6304 Link containing % as a double hex sequence interpreted to hex sequence
6305 !! wikitext
6306 [[7%2525 Solution]]
6307 !! html
6308 <p>[[7%2525 Solution]]
6309 </p>
6310 !!end
6311
6312 # note that parsoid does not munge anchor text; all non-space
6313 # characters are valid in HTML5 anchors.
6314 !! test
6315 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6316 Example for such a section: == < ==
6317 !! wikitext
6318 [[%23%3c]][[%23%3e]]
6319 !! html/php
6320 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6321 </p>
6322 !! html/parsoid
6323 <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>
6324 !! end
6325
6326 !! test
6327 Link containing "<#" and ">#" as a hex sequences
6328 !! wikitext
6329 [[%3c%23]][[%3e%23]]
6330 !! html
6331 <p>[[%3c%23]][[%3e%23]]
6332 </p>
6333 !! end
6334
6335 !! test
6336 Link containing an equals sign
6337 !! wikitext
6338 [[Special:BookSources/isbn=4-00-026157-6]]
6339 !! html/php
6340 <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>
6341 </p>
6342 !! html/parsoid
6343 <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>
6344 !! end
6345
6346 !! article
6347 Foo~bar
6348 !! text
6349 Just a test of an article title containing a tilde.
6350 !! endarticle
6351
6352 # note that links containing signatures, like [[Foo~~~~]], are
6353 # massaged by the pre-save transform (PST) and so the tildes are never
6354 # seen by the parser.
6355 !! test
6356 Link containing a tilde
6357 !! wikitext
6358 [[Foo~bar]]
6359 !! html/php
6360 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6361 </p>
6362 !! html/parsoid
6363 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6364 !! end
6365
6366 !! test
6367 Link containing double-single-quotes '' (bug 4598)
6368 !! wikitext
6369 [[Lista d''e paise d''o munno]]
6370 !! html/php
6371 <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>
6372 </p>
6373 !! html/parsoid
6374 <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>
6375 !! end
6376
6377 !! test
6378 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6379 !! wikitext
6380 Some [[Link|pretty ''italics'' and stuff]]!
6381 !! html/php
6382 <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>!
6383 </p>
6384 !! html/parsoid
6385 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6386 !! end
6387
6388 !! test
6389 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6390 !! wikitext
6391 ''Some [[Link|pretty ''italics'' and stuff]]!''
6392 !! html
6393 <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>
6394 </p>
6395 !! end
6396
6397 !! test
6398 Link with double quotes in title part (literal) and alternate part (interpreted)
6399 !! wikitext
6400 [[File:Denys Savchenko ''Pentecoste''.jpg]]
6401
6402 [[''Pentecoste'']]
6403
6404 [[''Pentecoste''|Pentecoste]]
6405
6406 [[''Pentecoste''|''Pentecoste'']]
6407 !! html/php
6408 <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>
6409 </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>
6410 </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>
6411 </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>
6412 </p>
6413 !! html/parsoid
6414 <meta typeof="mw:Placeholder"/>
6415 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6416 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6417 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6418 !! end
6419
6420 !! test
6421 Broken image links with HTML captions (bug 39700)
6422 !! wikitext
6423 [[File:Nonexistent|<script></script>]]
6424 [[File:Nonexistent|100px|<script></script>]]
6425 [[File:Nonexistent|&lt;]]
6426 [[File:Nonexistent|a<i>b</i>c]]
6427 !! html
6428 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6429 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6430 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6431 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6432 </p>
6433 !! end
6434
6435 !! test
6436 Plain link to URL
6437 !! wikitext
6438 [[http://www.example.com]]
6439 !! html/php
6440 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6441 </p>
6442 !! html/parsoid
6443 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6444 !! end
6445
6446 !! test
6447 Plain link to URL with link text
6448 !! wikitext
6449 [[http://www.example.com Link text]]
6450 !! html
6451 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6452 </p>
6453 !! end
6454
6455 !! test
6456 Plain link to protocol-relative URL
6457 !! wikitext
6458 [[//www.example.com]]
6459 !! html/php
6460 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6461 </p>
6462 !! html/parsoid
6463 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6464 !! end
6465
6466 !! test
6467 Plain link to protocol-relative URL with link text
6468 !! wikitext
6469 [[//www.example.com Link text]]
6470 !! html
6471 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6472 </p>
6473 !! end
6474
6475 !! test
6476 Plain link to page with question mark in title
6477 !! wikitext
6478 [[A?b]]
6479
6480 [[A?b|Baz]]
6481 !! html
6482 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6483 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6484 </p>
6485 !! end
6486
6487
6488 # I'm fairly sure the expected result here is wrong.
6489 # We want these to be URL links, not pseudo-pages with URLs for titles....
6490 # However the current output is also pretty screwy.
6491 #
6492 # ----
6493 # I'm changing it to match the current output--it arguably makes more
6494 # sense in the light of the test above. Old expected result was:
6495 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6496 #</p>
6497 # But I think this test is bordering on "garbage in, garbage out" anyway.
6498 # -- wtm
6499 !! test
6500 Piped link to URL
6501 !! wikitext
6502 Piped link to URL: [[http://www.example.com|an example URL]]
6503 !! html/php
6504 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6505 </p>
6506 !! html/parsoid
6507 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6508 !! end
6509
6510 !! test
6511 BUG 2: [[page|http://url/]] should link to page, not http://url/
6512 !! wikitext
6513 [[Main Page|http://url/]]
6514 !! html/php
6515 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6516 </p>
6517 !! html/parsoid
6518 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6519 !! end
6520
6521 # Parsoid does not mark self-links, by design.
6522 !! test
6523 BUG 337: Escaped self-links should be bold
6524 !! options
6525 title=[[Bug462]]
6526 !! wikitext
6527 [[Bu&#103;462]] [[Bug462]]
6528 !! html/php
6529 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6530 </p>
6531 !! html/php+tidy
6532 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6533 !! html/parsoid
6534 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6535 !! end
6536
6537 !! test
6538 Self-link to section should not be bold
6539 !! options
6540 title=[[Main Page]]
6541 !! wikitext
6542 [[Main Page#section]]
6543 !! html
6544 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6545 </p>
6546 !! end
6547
6548 !! article
6549 00
6550 !! text
6551 This is 00.
6552 !! endarticle
6553
6554 !!test
6555 Self-link to numeric title
6556 !!options
6557 title=[[0]]
6558 !! wikitext
6559 [[0]]
6560 !! html
6561 <p><strong class="selflink">0</strong>
6562 </p>
6563 !!end
6564
6565 !!test
6566 Link to numeric-equivalent title
6567 !!options
6568 title=[[0]]
6569 !! wikitext
6570 [[00]]
6571 !! html
6572 <p><a href="/wiki/00" title="00">00</a>
6573 </p>
6574 !!end
6575
6576 !! test
6577 <nowiki> inside a link
6578 !! wikitext
6579 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6580 !! html
6581 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6582 </p>
6583 !! end
6584
6585 !! test
6586 Non-breaking spaces in title
6587 !! wikitext
6588 [[&nbsp; Main &nbsp; Page &nbsp;]]
6589 !! html
6590 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6591 </p>
6592 !!end
6593
6594 !! test
6595 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6596 !! options
6597 language=ca
6598 !! wikitext
6599 '''[[Main Page]]'''
6600 !! html
6601 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6602 </p>
6603 !! end
6604
6605 !! test
6606 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6607 !! options
6608 language=ca
6609 !! wikitext
6610 ''[[Main Page]]''
6611 !! html
6612 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6613 </p>
6614 !! end
6615
6616 !! test
6617 Internal link with en linktrail: no apostrophes (bug 27473)
6618 !! options
6619 language=en
6620 !! wikitext
6621 [[Something]]'nice
6622 !! html
6623 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6624 </p>
6625 !! end
6626
6627 !! test
6628 Internal link with ca linktrail with apostrophes (bug 27473)
6629 !! options
6630 language=ca
6631 !! wikitext
6632 [[Something]]'nice
6633 !! html
6634 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6635 </p>
6636 !! end
6637
6638 !! test
6639 Internal link with kaa linktrail with apostrophes (bug 27473)
6640 !! options
6641 language=kaa
6642 !! wikitext
6643 [[Something]]'nice
6644 !! html
6645 <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>
6646 </p>
6647 !! end
6648
6649 !! test
6650 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6651 !! wikitext
6652 [[User:Foo/Test/63636:Bar|Test]]
6653 !! html/php
6654 <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>
6655 </p>
6656 !! html/parsoid
6657 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
6658 !! end
6659
6660 !! test
6661 Purely hash wikilink
6662 !! options
6663 title=[[User:test/123]]
6664 !! wikitext
6665 [[#a|b]]
6666 !! html/php
6667 <p><a href="#a">b</a>
6668 </p>
6669 !! html/parsoid
6670 <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>
6671 !! end
6672
6673 !! test
6674 1. Interaction of linktrail and template encapsulation
6675 !! options
6676 parsoid
6677 !! wikitext
6678 {{echo|[[Foo]]}}l
6679 !! html
6680 <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>
6681 !! end
6682
6683 !! test
6684 2. Interaction of linktrail and template encapsulation
6685 !! options
6686 parsoid
6687 !! wikitext
6688 {{echo|Some [[Fool]]}}s
6689 !! html
6690 <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>
6691 !! end
6692
6693 !! test
6694 3. Interaction of linktrail and template encapsulation
6695 !! options
6696 parsoid
6697 !! wikitext
6698 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6699 !! html
6700 <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>
6701 !! end
6702
6703 !! article
6704 Söfnuður
6705 !! text
6706 Test.
6707 !! endarticle
6708
6709 !! test
6710 Internal link with is link prefix
6711 !! options
6712 language=is
6713 !! wikitext
6714 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6715 !! html
6716 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6717 </p>
6718 !! end
6719
6720 !! article
6721 Mótmælendatrú
6722 !! text
6723 Test.
6724 !! endarticle
6725
6726 !! test
6727 Internal link with is link trail and link prefix
6728 !! options
6729 language=is
6730 !! wikitext
6731 [[mótmælendatrú|xxx]]ar
6732 [[mótmælendatrú]]ar
6733 mótmælenda[[söfnuður]]
6734 mótmælenda[[söfnuður|söfnuðir]]
6735 mótmælenda[[söfnuður|söfnuðir]]xxx
6736 !! html
6737 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6738 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6739 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6740 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6741 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6742 </p>
6743 !! end
6744
6745 !! test
6746 Parsoid link trail escaping
6747 !! options
6748 parsoid=html2wt,html2html
6749 !! wikitext
6750 [[apple]]<nowiki/>s
6751 !! html
6752 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
6753 !! end
6754
6755 !! test
6756 Parsoid link prefix escaping
6757 !! options
6758 language=is
6759 parsoid=html2wt,html2html
6760 !! wikitext
6761 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6762 !! html
6763 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
6764 !! end
6765
6766 !! test
6767 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6768 !! wikitext
6769 [[Foo| bar]]
6770
6771 [[Foo| ''bar'']]
6772
6773 [http://wp.org foo]
6774
6775 [http://wp.org ''foo'']
6776 !! html
6777 <p><a href="/wiki/Foo" title="Foo"> bar</a>
6778 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
6779 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6780 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6781 </p>
6782 !! end
6783
6784 !! test
6785 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6786 !! options
6787 parsoid
6788 !! wikitext
6789 [[Foo|{{echo|a}} b {{echo|c}}]]
6790 !! html
6791 <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>
6792 !! end
6793
6794 !! test
6795 Link with angle bracket after anchor
6796 !! wikitext
6797 [[Foo#<bar>]]
6798 !! html/php
6799 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
6800 </p>
6801 !! html/parsoid
6802 <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>
6803 !! end
6804
6805 ###
6806 ### Interwiki links (see maintenance/interwiki.sql)
6807 ###
6808
6809 !! test
6810 Inline interwiki link
6811 !! options
6812 parsoid=wt2html,wt2wt,html2html
6813 !! wikitext
6814 [[MeatBall:SoftSecurity]]
6815 !! html/php
6816 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6817 </p>
6818 !! html/parsoid
6819 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
6820 !! end
6821
6822 !! test
6823 Inline interwiki link with empty title (bug 2372)
6824 !! options
6825 parsoid=wt2html,wt2wt,html2html
6826 !! wikitext
6827 [[MeatBall:]]
6828 !! html/php
6829 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6830 </p>
6831 !! html/parsoid
6832 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
6833 !! end
6834
6835 !! test
6836 Interwiki link encoding conversion (bug 1636)
6837 !! wikitext
6838 *[[Wikipedia:ro:Olteni&#0355;a]]
6839 *[[Wikipedia:ro:Olteni&#355;a]]
6840 !! html
6841 <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>
6842 <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>
6843
6844 !! html+tidy
6845 <ul>
6846 <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>
6847 <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>
6848 </ul>
6849 !! end
6850
6851 !! test
6852 Interwiki link with fragment (bug 2130)
6853 !! wikitext
6854 [[MeatBall:SoftSecurity#foo]]
6855 !! html
6856 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6857 </p>
6858 !! end
6859
6860 # Ideally the wikipedia: prefix here should be proto-relative too
6861 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
6862 # define the 'en' prefix, and originally the test used 'wikipedia',
6863 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
6864 # article.
6865 !! test
6866 Different interwiki prefixes mapping to the same URL
6867 !! wikitext
6868 [[:en:Foo]]
6869
6870 [[:en:Foo|Foo]]
6871
6872 [[wikipedia:Foo]]
6873
6874 [[:wikipedia:Foo|Foo]]
6875
6876 [[wikipedia:en:Foo]]
6877
6878 [[:wikipedia:en:Foo]]
6879
6880 [[ wikiPEdia :Foo]]
6881 !! html/parsoid
6882 <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>
6883
6884 <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>
6885
6886 <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>
6887
6888 <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>
6889
6890 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
6891
6892 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/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>
6893
6894 <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>
6895 !! end
6896
6897 !! test
6898 Interwiki links that cannot be represented in wiki syntax
6899 !! wikitext
6900 [[meatball:ok]]
6901 [[meatball:ok#foo|ok with fragment]]
6902 [[meatball:ok_as_well?|ok ending with ? mark]]
6903 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6904 [http://de.wikipedia.org/wiki/#foo is just fragment]
6905
6906 !! html/php
6907 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
6908 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
6909 <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>
6910 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6911 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
6912 </p>
6913 !! html/parsoid
6914 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
6915 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
6916 <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>
6917 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6918 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6919 !! end
6920
6921 !! test
6922 Interwiki links: trail
6923 !! wikitext
6924 [[wikipedia:Foo|Ba]]r
6925 !! html/php
6926 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
6927 </p>
6928 !! html/parsoid
6929 <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>
6930 !! end
6931
6932 !! test
6933 Local interwiki link
6934 !! options
6935 parsoid=wt2html,wt2wt,html2html
6936 !! wikitext
6937 [[local:Template:Foo]]
6938 !! html/php
6939 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
6940 </p>
6941 !! html/parsoid
6942 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
6943 !! end
6944
6945 # Parsoid does not mark self-links, by design.
6946 !! test
6947 Local interwiki link: self-link to current page
6948 !! options
6949 title=[[Main Page]]
6950 parsoid=wt2html,wt2wt,html2html
6951 !! wikitext
6952 [[local:Main Page]]
6953 !! html/php
6954 <p><strong class="selflink">local:Main Page</strong>
6955 </p>
6956 !! html/parsoid
6957 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
6958 !! end
6959
6960 !! test
6961 Local interwiki link: prefix only (bug 64167)
6962 !! options
6963 parsoid=wt2html,wt2wt,html2html
6964 !! wikitext
6965 [[local:]]
6966 !! html/php
6967 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
6968 </p>
6969 !! html/parsoid
6970 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
6971 !! end
6972
6973 !! test
6974 Local interwiki link: with additional interwiki prefix (bug 61357)
6975 !! options
6976 parsoid=wt2html,wt2wt,html2html
6977 !! wikitext
6978 [[local:meatball:Hello]]
6979 !! html/php
6980 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
6981 </p>
6982 !! html/parsoid
6983 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
6984 !! end
6985
6986 !! test
6987 Multiple local interwiki link prefixes
6988 !! wikitext
6989 [[local:local:local:local:mi:local:Foo]]
6990 !! options
6991 parsoid=wt2html,wt2wt,html2html
6992 !! html/php
6993 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
6994 </p>
6995 !! html/parsoid
6996 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
6997 !! end
6998
6999 ###
7000 ### Interlanguage links
7001 ### Language links (so that searching for '### language' matches..)
7002 ###
7003
7004 !! test
7005 Interlanguage link
7006 !! wikitext
7007 Blah blah blah
7008 [[zh:Chinese]]
7009 !! html/php
7010 <p>Blah blah blah
7011 </p>
7012 !! html/parsoid
7013 <p>Blah blah blah</p>
7014 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7015 !! end
7016
7017 !! test
7018 Interlanguage link with spacing
7019 !! options
7020 parsoid=wt2html,wt2wt,html2html
7021 !! wikitext
7022 Blah blah blah
7023 [[ zh : Chinese ]]
7024 !! html/php
7025 <p>Blah blah blah
7026 </p>
7027 !! html/parsoid
7028 <p>Blah blah blah</p>
7029 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7030 !! end
7031
7032 !! test
7033 Double interlanguage link
7034 !! wikitext
7035 Blah blah blah
7036 [[es:Spanish]]
7037 [[zh:Chinese]]
7038 !! html/php
7039 <p>Blah blah blah
7040 </p>
7041 !! html/parsoid
7042 <p>Blah blah blah</p>
7043 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7044 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7045 !! end
7046
7047 !! test
7048 Interlanguage link variations
7049 !! wikitext
7050 Blah blah blah
7051 [[ es :Spanish]]
7052 [[ ZH :Chinese]]
7053 !! html/php
7054 <p>Blah blah blah
7055 </p>
7056 !! html/parsoid
7057 <p>Blah blah blah</p>
7058 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" data-parsoid='{"stx":"simple","a":{"href":"http://es.wikipedia.org/wiki/Spanish"},"sa":{"href":" es :Spanish"}}'/>
7059 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" data-parsoid='{"stx":"simple","a":{"href":"http://zh.wikipedia.org/wiki/Chinese"},"sa":{"href":" ZH :Chinese"}}'/>
7060 !! end
7061
7062 !! test
7063 Interlanguage link, with prefix links
7064 !! options
7065 language=ln
7066 !! wikitext
7067 Blah blah blah
7068 [[zh:Chinese]]
7069 !! html/php
7070 <p>Blah blah blah
7071 </p>
7072 !! html/parsoid
7073 <p>Blah blah blah</p>
7074 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7075 !! end
7076
7077 !! test
7078 Double interlanguage link, with prefix links (bug 8897)
7079 !! options
7080 language=ln
7081 !! wikitext
7082 Blah blah blah
7083 [[es:Spanish]]
7084 [[zh:Chinese]]
7085 !! html/php
7086 <p>Blah blah blah
7087 </p>
7088 !! html/parsoid
7089 <p>Blah blah blah</p>
7090 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7091 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7092 !! end
7093
7094 !! test
7095 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7096 !! wikitext
7097 Blah blah blah
7098 [[mul:Article]]
7099 !! html/php
7100 <p>Blah blah blah
7101 </p>
7102 !! html/parsoid
7103 <p>Blah blah blah</p>
7104 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7105 !! end
7106
7107 !! test
7108 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7109 !! options
7110 language=ln
7111 !! wikitext
7112 [[WW&nbsp;II]]
7113 !! html
7114 <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>
7115 </p>
7116 !! end
7117
7118 !! test
7119 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7120 !! options
7121 parsoid=html2wt
7122 !! wikitext
7123 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7124
7125 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7126 !! html
7127 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7128 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7129 !! end
7130
7131 !! test
7132 Parsoid: handle constructor well
7133 !! wikitext
7134 [[constructor]]
7135
7136 [[constructor:foo]]
7137 !! html/php
7138 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7139 </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>
7140 </p>
7141 !! html/parsoid
7142 <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>
7143
7144 <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>
7145 !! end
7146
7147 !! article
7148 ko:
7149 !! text
7150 Test.
7151 !! endarticle
7152
7153 # Note that `ko` isn't a known interlanguage prefix
7154 !! test
7155 Parsoid: recognize interlanguage links without a target page
7156 !! options
7157 ill
7158 !! wikitext
7159 [[es:]]
7160
7161 [[ko:]]
7162 !! html/php
7163 es:
7164 !! html/parsoid
7165 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7166
7167 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7168 !! end
7169
7170 # Note that `ko` isn't a known interwiki prefix
7171 !! test
7172 Parsoid: recognize interwiki links without a target page
7173 !! options
7174 parsoid=wt2html,wt2wt,html2html
7175 !! wikitext
7176 [[:es:]]
7177
7178 [[:ko:]]
7179 !! html/php
7180 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7181 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7182 </p>
7183 !! html/parsoid
7184 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7185 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7186 !! end
7187
7188 !! test
7189 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7190 !! wikitext
7191 [[mi:Foo]]
7192 !! html/php
7193 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7194 </p>
7195 !! html/parsoid
7196 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7197 !! end
7198
7199 !! test
7200 Interlanguage link with preceding local interwiki link (bug 68085)
7201 !! options
7202 parsoid=wt2html,wt2wt,html2html
7203 !! wikitext
7204 Blah blah blah
7205 [[local:es:Spanish]]
7206 !! html/php
7207 <p>Blah blah blah
7208 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7209 </p>
7210 !! html/parsoid
7211 <p>Blah blah blah
7212 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7213 !! end
7214
7215 !! test
7216 Looks like an interlanguage link, but is actually a local interwiki
7217 !! options
7218 parsoid=wt2html,wt2wt,html2html
7219 !! wikitext
7220 Blah blah blah
7221 [[mi:Template:Foo]]
7222 !! html/php
7223 <p>Blah blah blah
7224 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7225 </p>
7226 !! html/parsoid
7227 <p>Blah blah blah
7228 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7229 !! end
7230
7231 ###
7232 ### Redirects, Parsoid-only
7233 ###
7234 !! test
7235 1. Simple redirect to page
7236 !! options
7237 parsoid
7238 !! wikitext
7239 #REDIRECT [[Main Page]]
7240 !! html
7241 <link rel="mw:PageProp/redirect" href="./Main_Page">
7242 !! end
7243
7244 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
7245 !! test
7246 2. Other redirect variants
7247 !! options
7248 parsoid=wt2html,wt2wt
7249 !! wikitext
7250 #REDIRECT [[Main_Page]]
7251 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
7252 !! html/parsoid
7253 <link rel="mw:PageProp/redirect" href="./Main_Page"><link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
7254 !! end
7255
7256 !! test
7257 Empty redirect
7258 !! options
7259 parsoid=wt2html,wt2wt
7260 !! wikitext
7261 #REDIRECT [[]]
7262 !! html
7263 <ol>
7264 <li>REDIRECT [[]]</li></ol>
7265 !! end
7266
7267 !! test
7268 Optional colon in #REDIRECT
7269 !! options
7270 # the colon is archaic syntax. we support it for wt2html, but we
7271 # don't care that it roundtrips back to the modern syntax.
7272 parsoid=wt2html,html2html
7273 !! wikitext
7274 #REDIRECT:[[Main Page]]
7275 !! html
7276 <link rel="mw:PageProp/redirect" href="./Main_Page">
7277 !! end
7278
7279 !! test
7280 Whitespace in #REDIRECT with optional colon
7281 !! options
7282 # the colon and gratuitous whitespace is archaic syntax. we support
7283 # it for wt2html, but we don't care that it roundtrips back to the
7284 # modern syntax (without extra whitespace)
7285 parsoid=wt2html,html2html
7286 !! wikitext
7287
7288 #REDIRECT
7289 :
7290 [[Main Page]]
7291 !! html
7292 <link rel="mw:PageProp/redirect" href="./Main_Page">
7293 !! end
7294
7295 !! test
7296 Piped link in #REDIRECT
7297 !! options
7298 # content after piped link is ignored. we support this syntax,
7299 # but don't care that the piped link is lost when we roundtrip this.
7300 parsoid=wt2html
7301 !! wikitext
7302 #REDIRECT [[Main Page|bar]]
7303 !! html
7304 <link rel="mw:PageProp/redirect" href="./Main_Page">
7305 !! end
7306
7307 !! test
7308 Redirect to category
7309 !! options
7310 parsoid=wt2html
7311 !! wikitext
7312 #REDIRECT [[Category:Foo]]
7313 !! html
7314 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7315 !! end
7316
7317 !! test
7318 Redirect to category with URL encoding
7319 !! options
7320 parsoid=wt2html
7321 !! wikitext
7322 #REDIRECT [[Category%3AFoo]]
7323 !! html
7324 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7325 !! end
7326
7327 !! test
7328 Redirect to category page
7329 !! options
7330 parsoid=wt2html,html2html
7331 !! wikitext
7332 #REDIRECT [[:Category:Foo]]
7333 !! html
7334 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7335 !! end
7336
7337 !! test
7338 Redirect to image page (1)
7339 !! options
7340 parsoid
7341 !! wikitext
7342 #REDIRECT [[File:Wiki.png]]
7343 !! html
7344 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7345 !! end
7346
7347 !! test
7348 Redirect to image page (2)
7349 !! options
7350 parsoid
7351 !! wikitext
7352 #REDIRECT [[Image:Wiki.png]]
7353 !! html
7354 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7355 !! end
7356
7357 !! test
7358 Redirect to language
7359 !! options
7360 parsoid
7361 !! wikitext
7362 #REDIRECT [[en:File:Wiki.png]]
7363 !! html
7364 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7365 !! end
7366
7367 !! test
7368 Redirect to interwiki
7369 !! options
7370 parsoid
7371 !! wikitext
7372 #REDIRECT [[meatball:File:Wiki.png]]
7373 !! html
7374 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7375 !! end
7376
7377 !! test
7378 Non-English #REDIRECT
7379 !! options
7380 parsoid
7381 language=is
7382 !! wikitext
7383 #TILVÍSUN [[Main Page]]
7384 !! html
7385 <link rel="mw:PageProp/redirect" href="./Main_Page">
7386 !! end
7387
7388 !! test
7389 New redirect
7390 !! options
7391 parsoid=html2wt
7392 !! wikitext
7393 Foo
7394 #REDIRECT [[Foo]]
7395 !! html
7396 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7397 !! end
7398
7399 ##
7400 ## XHTML tidiness
7401 ###
7402
7403 !! test
7404 <br> to <br />
7405 !! wikitext
7406 1<br>2<br />3
7407 !! html
7408 <p>1<br />2<br />3
7409 </p>
7410 !! end
7411
7412 !! test
7413 Broken br tag sanitization
7414 !! wikitext
7415 </br>
7416 !! html/php
7417 <p>&lt;/br&gt;
7418 </p>
7419 !! end
7420
7421 # TODO: Fix html2html mode (bug 51055)!
7422 # This </br> handling was added as part of bug 50831; but it
7423 # differs from how PHP+tidy handles this. We should investigate
7424 # this.
7425 !! test
7426 Parsoid: Broken br tag recognition
7427 !! options
7428 parsoid=wt2html
7429 !! wikitext
7430 </br>
7431
7432 <br/ >
7433 !! html/php+tidy
7434 <p>&lt;/br&gt;</p>
7435 <p><br /></p>
7436 !! html/parsoid
7437 <p><br></p>
7438 <p><br/></p>
7439 !! end
7440
7441 !! test
7442 Incorrecly removing closing slashes from correctly formed XHTML
7443 !! wikitext
7444 <br style="clear:both;" />
7445 !! html
7446 <p><br style="clear:both;" />
7447 </p>
7448 !! end
7449
7450 !! test
7451 Failing to transform badly formed HTML into correct XHTML
7452 !! wikitext
7453 <br style="clear: left;">
7454 <br style="clear: right;">
7455 <br style="clear: both;">
7456 !! html
7457 <p><br style="clear: left;" />
7458 <br style="clear: right;" />
7459 <br style="clear: both;" />
7460 </p>
7461 !!end
7462
7463 !! test
7464 Handling html with a div self-closing tag
7465 !! wikitext
7466 <div title />
7467 <div title/>
7468 <div title/ >
7469 <div title=bar />
7470 <div title=bar/>
7471 <div title=bar/ >
7472 !! html
7473 <p>&lt;div title /&gt;
7474 &lt;div title/&gt;
7475 </p>
7476 <div>
7477 <p>&lt;div title=bar /&gt;
7478 &lt;div title=bar/&gt;
7479 </p>
7480 <div title="bar/"></div>
7481 </div>
7482
7483 !! end
7484
7485 !! test
7486 Handling html with a br self-closing tag
7487 !! wikitext
7488 <br title />
7489 <br title/>
7490 <br title/ >
7491 <br title=bar />
7492 <br title=bar/>
7493 <br title=bar/ >
7494 !! html/php
7495 <p><br title="title" />
7496 <br title="title" />
7497 <br />
7498 <br title="bar" />
7499 <br title="bar" />
7500 <br title="bar/" />
7501 </p>
7502 !! html/parsoid
7503 <p><br title="" />
7504 <br title="" />
7505 <br />
7506 <br title="bar" />
7507 <br title="bar" />
7508 <br title="bar/" />
7509 </p>
7510 !! end
7511
7512 !! test
7513 Horizontal ruler (should it add that extra space?)
7514 !! wikitext
7515 <hr>
7516 <hr >
7517 foo <hr
7518 > bar
7519 !! html+tidy
7520 <hr />
7521 <hr />
7522 <p>foo</p>
7523 <hr />
7524 <p>bar</p>
7525 !! end
7526
7527 !! test
7528 Horizontal ruler -- 4+ dashes render hr
7529 !! wikitext
7530 ----
7531 !! html
7532 <hr />
7533
7534 !! end
7535
7536 !! test
7537 Horizontal ruler -- eats additional dashes on the same line
7538 !! wikitext
7539 ---------
7540 !! html
7541 <hr />
7542
7543 !! end
7544
7545 !! test
7546 Horizontal ruler -- does not collapse dashes on consecutive lines
7547 !! wikitext
7548 ----
7549 ----
7550 !! html
7551 <hr />
7552 <hr />
7553
7554 !! end
7555
7556 !! test
7557 Horizontal ruler -- <4 dashes render as plain text
7558 !! wikitext
7559 ---
7560 !! html
7561 <p>---
7562 </p>
7563 !! end
7564
7565 !! test
7566 Horizontal ruler -- Supports content following dashes on same line
7567 !! wikitext
7568 ---- Foo
7569 !! html
7570 <hr /> Foo
7571
7572 !! html+tidy
7573 <hr />
7574 <p>Foo</p>
7575 !! end
7576
7577 ###
7578 ### Block-level elements
7579 ###
7580 !! test
7581 Common list
7582 !! wikitext
7583 *Common list
7584 * item 2
7585 *item 3
7586 !! html
7587 <ul><li>Common list</li>
7588 <li> item 2</li>
7589 <li>item 3</li></ul>
7590
7591 !! end
7592
7593 !! test
7594 Numbered list
7595 !! wikitext
7596 #Numbered list
7597 #item 2
7598 # item 3
7599 !! html
7600 <ol><li>Numbered list</li>
7601 <li>item 2</li>
7602 <li> item 3</li></ol>
7603
7604 !! end
7605
7606 !! test
7607 Mixed list
7608 !! wikitext
7609 *Mixed list
7610 *# with numbers
7611 ** and bullets
7612 *# and numbers
7613 *bullets again
7614 **bullet level 2
7615 ***bullet level 3
7616 ***#Number on level 4
7617 **bullet level 2
7618 **#Number on level 3
7619 **#Number on level 3
7620 *#number level 2
7621 *Level 1
7622 *** Level 3
7623 #** Level 3, but ordered
7624 !! html
7625 <ul><li>Mixed list
7626 <ol><li> with numbers</li></ol>
7627 <ul><li> and bullets</li></ul>
7628 <ol><li> and numbers</li></ol></li>
7629 <li>bullets again
7630 <ul><li>bullet level 2
7631 <ul><li>bullet level 3
7632 <ol><li>Number on level 4</li></ol></li></ul></li>
7633 <li>bullet level 2
7634 <ol><li>Number on level 3</li>
7635 <li>Number on level 3</li></ol></li></ul>
7636 <ol><li>number level 2</li></ol></li>
7637 <li>Level 1
7638 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7639 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7640
7641 !! end
7642
7643 !! test
7644 Nested lists 1
7645 !! wikitext
7646 *foo
7647 **bar
7648 !! html
7649 <ul><li>foo
7650 <ul><li>bar</li></ul></li></ul>
7651
7652 !! end
7653
7654 !! test
7655 Nested lists 2
7656 !! wikitext
7657 **foo
7658 *bar
7659 !! html
7660 <ul><li><ul><li>foo</li></ul></li>
7661 <li>bar</li></ul>
7662
7663 !! end
7664
7665 !! test
7666 Nested lists 3 (first element empty)
7667 !! wikitext
7668 *
7669 **bar
7670 !! html
7671 <ul><li>
7672 <ul><li>bar</li></ul></li></ul>
7673
7674 !! end
7675
7676 !! test
7677 Nested lists 4 (first element empty)
7678 !! wikitext
7679 **
7680 *bar
7681 !! html
7682 <ul><li><ul><li></li></ul></li>
7683 <li>bar</li></ul>
7684
7685 !! end
7686
7687 !! test
7688 Nested lists 5 (both elements empty)
7689 !! wikitext
7690 **
7691 *
7692 !! html
7693 <ul><li><ul><li></li></ul></li>
7694 <li></li></ul>
7695
7696 !! end
7697
7698 !! test
7699 Nested lists 6 (both elements empty)
7700 !! wikitext
7701 *
7702 **
7703 !! html
7704 <ul><li>
7705 <ul><li></li></ul></li></ul>
7706
7707 !! end
7708
7709 !! test
7710 Nested lists 7 (skip initial nesting levels)
7711 !! wikitext
7712 *** foo
7713 !! html
7714 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7715
7716 !! end
7717
7718 !! test
7719 Nested lists 8 (multiple nesting transitions)
7720 !! wikitext
7721 * foo
7722 *** bar
7723 ** baz
7724 * boo
7725 !! html
7726 <ul><li> foo
7727 <ul><li><ul><li> bar</li></ul></li>
7728 <li> baz</li></ul></li>
7729 <li> boo</li></ul>
7730
7731 !! end
7732
7733 !! test
7734 1. Lists with start-of-line-transparent tokens before bullets: Comments
7735 !! wikitext
7736 *foo
7737 *<!--cmt-->bar
7738 <!--cmt-->*baz
7739 !! html
7740 <ul><li>foo</li>
7741 <li>bar</li>
7742 <li>baz</li></ul>
7743
7744 !! end
7745
7746 !! test
7747 2. Lists with start-of-line-transparent tokens before bullets: Template close
7748 !! wikitext
7749 *foo {{echo|bar
7750 }}*baz
7751 !! html
7752 <ul><li>foo bar</li>
7753 <li>baz</li></ul>
7754
7755 !! end
7756
7757 !! test
7758 List items are not parsed correctly following a <pre> block (bug 785)
7759 !! wikitext
7760 * <pre>foo</pre>
7761 * <pre>bar</pre>
7762 * zar
7763 !! html
7764 <ul><li> <pre>foo</pre></li>
7765 <li> <pre>bar</pre></li>
7766 <li> zar</li></ul>
7767
7768 !! end
7769
7770 !! test
7771 List items from template
7772 !! wikitext
7773
7774 {{inner list}}
7775 * item 2
7776
7777 * item 0
7778 {{inner list}}
7779 * item 2
7780
7781 * item 0
7782 * notSOL{{inner list}}
7783 * item 2
7784 !! html
7785 <ul><li> item 1</li>
7786 <li> item 2</li></ul>
7787 <ul><li> item 0</li>
7788 <li> item 1</li>
7789 <li> item 2</li></ul>
7790 <ul><li> item 0</li>
7791 <li> notSOL</li>
7792 <li> item 1</li>
7793 <li> item 2</li></ul>
7794
7795 !! end
7796
7797 !! test
7798 List interrupted by empty line or heading
7799 !! wikitext
7800 * foo
7801
7802 ** bar
7803 == A heading ==
7804 * Another list item
7805 !! html
7806 <ul><li> foo</li></ul>
7807 <ul><li><ul><li> bar</li></ul></li></ul>
7808 <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>
7809 <ul><li> Another list item</li></ul>
7810
7811 !!end
7812
7813 !!test
7814 Multiple list tags generated by templates
7815 !! wikitext
7816 {{echo|<li>}}a
7817 {{echo|<li>}}b
7818 {{echo|<li>}}c
7819 !! html
7820 <li>a
7821 <li>b
7822 <li>c</li>
7823 </li>
7824 </li>
7825
7826 !! html+tidy
7827 <ul>
7828 <li>a</li>
7829 <li>b</li>
7830 <li>c</li>
7831 </ul>
7832 !!end
7833
7834 !!test
7835 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7836 !! wikitext
7837 *a
7838 <!--This line will NOT split the list-->
7839 *b
7840 <!--This line will NOT split the list either-->
7841 *c
7842 <!--foo--> <!----> <!--This line NOT split the list either-->
7843 *d
7844 !! html
7845 <ul><li>a</li>
7846 <li>b</li>
7847 <li>c</li>
7848 <li>d</li></ul>
7849
7850 !!end
7851
7852 !!test
7853 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7854 !! wikitext
7855 *a
7856 <!--This line will NOT split the list-->
7857 *b
7858 <!--This line will NOT split the list either-->
7859 *c
7860 <!--foo--> <!----> <!--This line NOT split the list
7861 either-->
7862 *d
7863 !! html
7864 <ul><li>a</li>
7865 <li>b</li>
7866 <li>c</li>
7867 <li>d</li></ul>
7868
7869 !!end
7870
7871 !!test
7872 Test the li-hack
7873 (The PHP parser relies on Tidy for the hack)
7874 !!options
7875 parsoid=wt2html,wt2wt
7876 !! wikitext
7877 * foo
7878 * <li>li-hack
7879 * {{echo|<li>templated li-hack}}
7880 * <!--foo--> <li> unsupported li-hack with preceding comments
7881
7882 <ul>
7883 <li><li>not a li-hack
7884 </li>
7885 </ul>
7886 !! html+tidy
7887 <ul>
7888 <li>foo</li>
7889 <li>li-hack</li>
7890 <li>templated li-hack</li>
7891 <li>unsupported li-hack with preceding comments</li>
7892 </ul>
7893 <ul>
7894 <li>not a li-hack</li>
7895 </ul>
7896 !!end
7897
7898 !! test
7899 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
7900 !! options
7901 parsoid
7902 !! wikitext
7903 # foo
7904 ## bar
7905 * foo
7906 ** bar
7907 : foo
7908 :: bar
7909 !! html
7910 <ol>
7911 <li> foo<ol>
7912 <li> bar</li>
7913 </ol></li>
7914 </ol><ul>
7915 <li> foo<ul>
7916 <li> bar</li>
7917 </ul></li>
7918 </ul><dl>
7919 <dd> foo<dl>
7920 <dd> bar</dd>
7921 </dl></dd>
7922 </dl>
7923 !! end
7924
7925 !! test
7926 Parsoid: Test of whitespace serialization with Templated bullets
7927 !! options
7928 parsoid
7929 !! wikitext
7930 * {{bullet}}
7931 !! html
7932 <ul>
7933 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
7934 </ul>
7935 !! end
7936
7937 # ------------------------------------------------------------------------
7938 # The next set of tests are about Parsoid's ability to handle badly nested
7939 # tags (parse, minimize scope of fixup, and roundtrip back)
7940 # ------------------------------------------------------------------------
7941
7942 !! test
7943 Unbalanced closing block tags break a list
7944 (php parser relies on Tidy to fix up)
7945 !! wikitext
7946 <div>
7947 *a</div><div>
7948 *b</div>
7949 !! html+tidy
7950 <div>
7951 <ul>
7952 <li>a</li>
7953 </ul>
7954 </div>
7955 <div>
7956 <ul>
7957 <li>b</li>
7958 </ul>
7959 </div>
7960 !! end
7961
7962 # Parsoid fails this test, but it might be tricky to support properly.
7963 # See bug 68395.
7964 !! test
7965 Unbalanced closing non-block tags don't break a list
7966 (php parser relies on Tidy to fix up)
7967 !! wikitext
7968 <span>
7969 *a</span><span>
7970 *b</span>
7971 !! html/php+tidy
7972 <ul>
7973 <li><span>a</span></li>
7974 <li><span>b</span></li>
7975 </ul>
7976 !! html/parsoid
7977 <span>
7978 <ul>
7979 <li>a<span></span>
7980 </li>
7981 <li>b
7982 </li>
7983 </ul>
7984 </span>
7985 !! end
7986
7987 !! test
7988 Unclosed formatting tags that straddle lists are closed and reopened
7989 (php parser relies on Tidy to fix up)
7990 !! options
7991 parsoid=wt2html,wt2wt,html2html
7992 !! wikitext
7993 # <s> a
7994 # b </s>
7995 !! html/php+tidy
7996 <ol>
7997 <li><s>a</s></li>
7998 <li><s>b</s></li>
7999 </ol>
8000 !! html/parsoid
8001 <ol><li> <s> a</s></li>
8002 <li><s> b </s></li></ol>
8003 !! end
8004
8005 # Parsoid fails this test, but it might be tricky to support properly.
8006 # See bug 68395.
8007 !!test
8008 List embedded in a non-block tag
8009 (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
8010 !! wikitext
8011 <small>
8012 * foo
8013 </small>
8014 !! html/php+tidy
8015 <ul>
8016 <li><small>foo</small></li>
8017 </ul>
8018 !! html/parsoid
8019 <small>
8020 <ul>
8021 <li> foo</li>
8022 </ul>
8023 </small>
8024 !!end
8025
8026 # This is a bug in the PHP parser + tidy combination.
8027 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8028 # and then fostered out of the table by tidy.)
8029 # We believe the Parsoid output to be correct.
8030 !! test
8031 Table with missing opening <tr> tag
8032 !! options
8033 parsoid=wt2html,wt2wt
8034 !! wikitext
8035 <table>
8036 <td>foo</td>
8037 </tr>
8038 </table>
8039 !! html/php+tidy
8040 <p>&lt;/tr&gt;</p>
8041 <table>
8042 <tr>
8043 <td>foo</td>
8044 </tr>
8045 </table>
8046 !! html/parsoid
8047 <table>
8048 <tr>
8049 <td>foo</td>
8050 </tr>
8051 </table>
8052 !! end
8053
8054 ###
8055 ### Magic Words
8056 ###
8057
8058 # Note that the current date is hard-coded as
8059 # 1970-01-01T00:02:03Z (a Thursday)
8060 # when running parser tests. The timezone is also fixed to GMT, so
8061 # local date will be identical to current date.
8062
8063 !! test
8064 Magic Word: {{CURRENTDAY}}
8065 !! wikitext
8066 {{CURRENTDAY}}
8067 !! html
8068 <p>1
8069 </p>
8070 !! end
8071
8072 !! test
8073 Magic Word: {{CURRENTDAY2}}
8074 !! wikitext
8075 {{CURRENTDAY2}}
8076 !! html
8077 <p>01
8078 </p>
8079 !! end
8080
8081 !! test
8082 Magic Word: {{CURRENTDAYNAME}}
8083 !! wikitext
8084 {{CURRENTDAYNAME}}
8085 !! html
8086 <p>Thursday
8087 </p>
8088 !! end
8089
8090 !! test
8091 Magic Word: {{CURRENTDOW}}
8092 !! wikitext
8093 {{CURRENTDOW}}
8094 !! html
8095 <p>4
8096 </p>
8097 !! end
8098
8099 !! test
8100 Magic Word: {{CURRENTMONTH}}
8101 !! wikitext
8102 {{CURRENTMONTH}}
8103 !! html
8104 <p>01
8105 </p>
8106 !! end
8107
8108 !! test
8109 Magic Word: {{CURRENTMONTH1}}
8110 !! wikitext
8111 {{CURRENTMONTH1}}
8112 !! html
8113 <p>1
8114 </p>
8115 !! end
8116
8117 !! test
8118 Magic Word: {{CURRENTMONTHABBREV}}
8119 !! wikitext
8120 {{CURRENTMONTHABBREV}}
8121 !! html
8122 <p>Jan
8123 </p>
8124 !! end
8125
8126 !! test
8127 Magic Word: {{CURRENTMONTHNAME}}
8128 !! wikitext
8129 {{CURRENTMONTHNAME}}
8130 !! html
8131 <p>January
8132 </p>
8133 !! end
8134
8135 !! test
8136 Magic Word: {{CURRENTMONTHNAMEGEN}}
8137 !! wikitext
8138 {{CURRENTMONTHNAMEGEN}}
8139 !! html
8140 <p>January
8141 </p>
8142 !! end
8143
8144 !! test
8145 Magic Word: {{CURRENTTIME}}
8146 !! wikitext
8147 {{CURRENTTIME}}
8148 !! html
8149 <p>00:02
8150 </p>
8151 !! end
8152
8153 !! test
8154 Magic Word: {{CURRENTHOUR}}
8155 !! wikitext
8156 {{CURRENTHOUR}}
8157 !! html
8158 <p>00
8159 </p>
8160 !! end
8161
8162 !! test
8163 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8164 !! wikitext
8165 {{CURRENTWEEK}}
8166 !! html
8167 <p>1
8168 </p>
8169 !! end
8170
8171 !! test
8172 Magic Word: {{CURRENTYEAR}}
8173 !! wikitext
8174 {{CURRENTYEAR}}
8175 !! html
8176 <p>1970
8177 </p>
8178 !! end
8179
8180 !! test
8181 Magic Word: {{CURRENTTIMESTAMP}}
8182 !! wikitext
8183 {{CURRENTTIMESTAMP}}
8184 !! html
8185 <p>19700101000203
8186 </p>
8187 !! end
8188
8189 !! test
8190 Magic Words LOCAL (UTC)
8191 !! wikitext
8192 * {{LOCALMONTH}}
8193 * {{LOCALMONTH1}}
8194 * {{LOCALMONTHNAME}}
8195 * {{LOCALMONTHNAMEGEN}}
8196 * {{LOCALMONTHABBREV}}
8197 * {{LOCALDAY}}
8198 * {{LOCALDAY2}}
8199 * {{LOCALDAYNAME}}
8200 * {{LOCALYEAR}}
8201 * {{LOCALTIME}}
8202 * {{LOCALHOUR}}
8203 * {{LOCALWEEK}}
8204 * {{LOCALDOW}}
8205 * {{LOCALTIMESTAMP}}
8206 !! html
8207 <ul><li> 01</li>
8208 <li> 1</li>
8209 <li> January</li>
8210 <li> January</li>
8211 <li> Jan</li>
8212 <li> 1</li>
8213 <li> 01</li>
8214 <li> Thursday</li>
8215 <li> 1970</li>
8216 <li> 00:02</li>
8217 <li> 00</li>
8218 <li> 1</li>
8219 <li> 4</li>
8220 <li> 19700101000203</li></ul>
8221
8222 !! end
8223
8224 !! test
8225 Magic Word: {{FULLPAGENAME}}
8226 !! options
8227 title=[[User:Ævar Arnfjörð Bjarmason]]
8228 !! wikitext
8229 {{FULLPAGENAME}}
8230 !! html
8231 <p>User:Ævar Arnfjörð Bjarmason
8232 </p>
8233 !! end
8234
8235 !! test
8236 Magic Word: {{FULLPAGENAMEE}}
8237 !! options
8238 title=[[User:Ævar Arnfjörð Bjarmason]]
8239 !! wikitext
8240 {{FULLPAGENAMEE}}
8241 !! html
8242 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8243 </p>
8244 !! end
8245
8246 !! test
8247 Magic Word: {{TALKSPACE}}
8248 !! options
8249 title=[[User:Ævar Arnfjörð Bjarmason]]
8250 !! wikitext
8251 {{TALKSPACE}}
8252 !! html
8253 <p>User talk
8254 </p>
8255 !! end
8256
8257 !! test
8258 Magic Word: {{TALKSPACE}}, same namespace
8259 !! options
8260 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8261 !! wikitext
8262 {{TALKSPACE}}
8263 !! html
8264 <p>User talk
8265 </p>
8266 !! end
8267
8268 !! test
8269 Magic Word: {{TALKSPACE}}, main namespace
8270 !! options
8271 title=[[Parser Test]]
8272 !! wikitext
8273 {{TALKSPACE}}
8274 !! html
8275 <p>Talk
8276 </p>
8277 !! end
8278
8279 !! test
8280 Magic Word: {{TALKSPACEE}}
8281 !! options
8282 title=[[User:Ævar Arnfjörð Bjarmason]]
8283 !! wikitext
8284 {{TALKSPACEE}}
8285 !! html
8286 <p>User_talk
8287 </p>
8288 !! end
8289
8290 !! test
8291 Magic Word: {{SUBJECTSPACE}}
8292 !! options
8293 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8294 !! wikitext
8295 {{SUBJECTSPACE}}
8296 !! html
8297 <p>User
8298 </p>
8299 !! end
8300
8301 !! test
8302 Magic Word: {{SUBJECTSPACE}}, same namespace
8303 !! options
8304 title=[[User:Ævar Arnfjörð Bjarmason]]
8305 !! wikitext
8306 {{SUBJECTSPACE}}
8307 !! html
8308 <p>User
8309 </p>
8310 !! end
8311
8312 !! test
8313 Magic Word: {{SUBJECTSPACE}}, main namespace
8314 !! options
8315 title=[[Parser Test]]
8316 !! wikitext
8317 {{SUBJECTSPACE}}
8318 !! html
8319
8320 !! end
8321
8322 !! test
8323 Magic Word: {{SUBJECTSPACEE}}
8324 !! options
8325 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8326 !! wikitext
8327 {{SUBJECTSPACEE}}
8328 !! html
8329 <p>User
8330 </p>
8331 !! end
8332
8333 !! test
8334 Magic Word: {{NAMESPACE}}
8335 !! options
8336 title=[[User:Ævar Arnfjörð Bjarmason]]
8337 !! wikitext
8338 {{NAMESPACE}}
8339 !! html
8340 <p>User
8341 </p>
8342 !! end
8343
8344 !! test
8345 Magic Word: {{NAMESPACEE}}
8346 !! options
8347 title=[[User:Ævar Arnfjörð Bjarmason]]
8348 !! wikitext
8349 {{NAMESPACEE}}
8350 !! html
8351 <p>User
8352 </p>
8353 !! end
8354
8355 !! test
8356 Magic Word: {{NAMESPACENUMBER}}
8357 !! options
8358 title=[[User:Ævar Arnfjörð Bjarmason]]
8359 !! wikitext
8360 {{NAMESPACENUMBER}}
8361 !! html
8362 <p>2
8363 </p>
8364 !! end
8365
8366 !! test
8367 Magic Word: {{SUBPAGENAME}}
8368 !! options
8369 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8370 !! wikitext
8371 {{SUBPAGENAME}}
8372 !! html
8373 <p>sub ö
8374 </p>
8375 !! end
8376
8377 !! test
8378 Magic Word: {{SUBPAGENAMEE}}
8379 !! options
8380 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8381 !! wikitext
8382 {{SUBPAGENAMEE}}
8383 !! html
8384 <p>sub_%C3%B6
8385 </p>
8386 !! end
8387
8388 !! test
8389 Magic Word: {{ROOTPAGENAME}}
8390 !! options
8391 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8392 !! wikitext
8393 {{ROOTPAGENAME}}
8394 !! html
8395 <p>Ævar Arnfjörð Bjarmason
8396 </p>
8397 !! end
8398
8399 !! test
8400 Magic Word: {{ROOTPAGENAMEE}}
8401 !! options
8402 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8403 !! wikitext
8404 {{ROOTPAGENAMEE}}
8405 !! html
8406 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8407 </p>
8408 !! end
8409
8410 !! test
8411 Magic Word: {{BASEPAGENAME}}
8412 !! options
8413 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8414 !! wikitext
8415 {{BASEPAGENAME}}
8416 !! html
8417 <p>Ævar Arnfjörð Bjarmason
8418 </p>
8419 !! end
8420
8421 !! test
8422 Magic Word: {{BASEPAGENAMEE}}
8423 !! options
8424 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8425 !! wikitext
8426 {{BASEPAGENAMEE}}
8427 !! html
8428 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8429 </p>
8430 !! end
8431
8432 !! test
8433 Magic Word: {{TALKPAGENAME}}
8434 !! options
8435 title=[[User:Ævar Arnfjörð Bjarmason]]
8436 !! wikitext
8437 {{TALKPAGENAME}}
8438 !! html
8439 <p>User talk:Ævar Arnfjörð Bjarmason
8440 </p>
8441 !! end
8442
8443 !! test
8444 Magic Word: {{TALKPAGENAMEE}}
8445 !! options
8446 title=[[User:Ævar Arnfjörð Bjarmason]]
8447 !! wikitext
8448 {{TALKPAGENAMEE}}
8449 !! html
8450 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8451 </p>
8452 !! end
8453
8454 !! test
8455 Magic Word: {{SUBJECTPAGENAME}}
8456 !! options
8457 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8458 !! wikitext
8459 {{SUBJECTPAGENAME}}
8460 !! html
8461 <p>User:Ævar Arnfjörð Bjarmason
8462 </p>
8463 !! end
8464
8465 !! test
8466 Magic Word: {{SUBJECTPAGENAMEE}}
8467 !! options
8468 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8469 !! wikitext
8470 {{SUBJECTPAGENAMEE}}
8471 !! html
8472 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8473 </p>
8474 !! end
8475
8476 !! test
8477 Magic Word: {{NUMBEROFFILES}}
8478 !! wikitext
8479 {{NUMBEROFFILES}}
8480 !! html
8481 <p>5
8482 </p>
8483 !! end
8484
8485 !! test
8486 Magic Word: {{PAGENAME}}
8487 !! options
8488 title=[[User:Ævar Arnfjörð Bjarmason]]
8489 !! wikitext
8490 {{PAGENAME}}
8491 !! html
8492 <p>Ævar Arnfjörð Bjarmason
8493 </p>
8494 !! end
8495
8496 !! test
8497 Magic Word: {{PAGENAME}} with metacharacters
8498 !! options
8499 title=[['foo & bar = baz']]
8500 !! wikitext
8501 ''{{PAGENAME}}''
8502 !! html/php
8503 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8504 </p>
8505 !! html+tidy
8506 <p><i>'foo &amp; bar = baz'</i></p>
8507 !! end
8508
8509 !! test
8510 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8511 !! options
8512 title=[[*RFC 1234 http://example.com/]]
8513 !! wikitext
8514 {{PAGENAME}}
8515 !! html/php
8516 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8517 </p>
8518 !! html+tidy
8519 <p>*RFC 1234 http://example.com/</p>
8520 !! end
8521
8522 !! test
8523 Magic Word: {{PAGENAMEE}}
8524 !! options
8525 title=[[User:Ævar Arnfjörð Bjarmason]]
8526 !! wikitext
8527 {{PAGENAMEE}}
8528 !! html
8529 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8530 </p>
8531 !! end
8532
8533 !! test
8534 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8535 !! options
8536 title=[[*RFC 1234 http://example.com/]]
8537 !! wikitext
8538 {{PAGENAMEE}}
8539 !! html/php
8540 <p>&#42;RFC_1234_http&#58;//example.com/
8541 </p>
8542 !! html+tidy
8543 <p>*RFC_1234_http://example.com/</p>
8544 !! end
8545
8546 !! test
8547 Magic Word: {{REVISIONID}}
8548 !! wikitext
8549 {{REVISIONID}}
8550 !! html
8551 <p>1337
8552 </p>
8553 !! end
8554
8555 !! test
8556 Magic Word: {{SCRIPTPATH}}
8557 !! wikitext
8558 {{SCRIPTPATH}}
8559 !! html
8560 <p>/
8561 </p>
8562 !! end
8563
8564 !! test
8565 Magic Word: {{STYLEPATH}}
8566 !! wikitext
8567 {{STYLEPATH}}
8568 !! html
8569 <p>/skins
8570 </p>
8571 !! end
8572
8573 !! test
8574 Magic Word: {{SERVER}}
8575 !! wikitext
8576 {{SERVER}}
8577 !! html
8578 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8579 </p>
8580 !! end
8581
8582 !! test
8583 Magic Word: {{SERVERNAME}}
8584 !! wikitext
8585 {{SERVERNAME}}
8586 !! html
8587 <p>example.org
8588 </p>
8589 !! end
8590
8591 !! test
8592 Magic Word: {{SITENAME}}
8593 !! wikitext
8594 {{SITENAME}}
8595 !! html
8596 <p>MediaWiki
8597 </p>
8598 !! end
8599
8600 !! test
8601 Case-sensitive magic words, when cased differently, should just be template transclusions
8602 !! wikitext
8603 {{CurrentMonth}}
8604 {{currentday}}
8605 {{cURreNTweEK}}
8606 {{currentHour}}
8607 !! html
8608 <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>
8609 <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>
8610 <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>
8611 <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>
8612 </p>
8613 !! end
8614
8615 !! test
8616 Case-insensitive magic words should still work with weird casing.
8617 !! wikitext
8618 {{sErVeRNaMe}}
8619 {{LCFirst:AOEU}}
8620 {{ucFIRST:aoeu}}
8621 {{SERver}}
8622 !! html
8623 <p>example.org
8624 aOEU
8625 Aoeu
8626 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8627 </p>
8628 !! end
8629
8630 !! test
8631 Namespace 1 {{ns:1}}
8632 !! wikitext
8633 {{ns:1}}
8634 !! html
8635 <p>Talk
8636 </p>
8637 !! end
8638
8639 !! test
8640 Namespace 1 {{ns:01}}
8641 !! wikitext
8642 {{ns:01}}
8643 !! html
8644 <p>Talk
8645 </p>
8646 !! end
8647
8648 !! test
8649 Namespace 0 {{ns:0}} (bug 4783)
8650 !! wikitext
8651 {{ns:0}}
8652 !! html
8653
8654 !! end
8655
8656 !! test
8657 Namespace 0 {{ns:00}} (bug 4783)
8658 !! wikitext
8659 {{ns:00}}
8660 !! html
8661
8662 !! end
8663
8664 !! test
8665 Namespace -1 {{ns:-1}}
8666 !! wikitext
8667 {{ns:-1}}
8668 !! html
8669 <p>Special
8670 </p>
8671 !! end
8672
8673 !! test
8674 Namespace User {{ns:User}}
8675 !! wikitext
8676 {{ns:User}}
8677 !! html
8678 <p>User
8679 </p>
8680 !! end
8681
8682 !! test
8683 Namespace User talk {{ns:User_talk}}
8684 !! wikitext
8685 {{ns:User_talk}}
8686 !! html
8687 <p>User talk
8688 </p>
8689 !! end
8690
8691 !! test
8692 Namespace User talk {{ns:uSeR tAlK}}
8693 !! wikitext
8694 {{ns:uSeR tAlK}}
8695 !! html
8696 <p>User talk
8697 </p>
8698 !! end
8699
8700 !! test
8701 Namespace File {{ns:File}}
8702 !! wikitext
8703 {{ns:File}}
8704 !! html
8705 <p>File
8706 </p>
8707 !! end
8708
8709 !! test
8710 Namespace File {{ns:Image}}
8711 !! wikitext
8712 {{ns:Image}}
8713 !! html
8714 <p>File
8715 </p>
8716 !! end
8717
8718 !! test
8719 Namespace (lang=de) Benutzer {{ns:User}}
8720 !! options
8721 language=de
8722 !! wikitext
8723 {{ns:User}}
8724 !! html
8725 <p>Benutzer
8726 </p>
8727 !! end
8728
8729 !! test
8730 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
8731 !! options
8732 language=de
8733 !! wikitext
8734 {{ns:3}}
8735 !! html
8736 <p>Benutzer Diskussion
8737 </p>
8738 !! end
8739
8740
8741 !! test
8742 Urlencode
8743 !! wikitext
8744 {{urlencode:hi world?!}}
8745 {{urlencode:hi world?!|WIKI}}
8746 {{urlencode:hi world?!|PATH}}
8747 {{urlencode:hi world?!|QUERY}}
8748 !! html
8749 <p>hi+world%3F%21
8750 hi_world%3F!
8751 hi%20world%3F%21
8752 hi+world%3F%21
8753 </p>
8754 !! end
8755
8756 !! test
8757 Magic Word: prioritize type info over data-parsoid
8758 !! options
8759 parsoid=html2wt
8760 !! wikitext
8761 __FORCETOC__
8762 !! html
8763 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
8764 !! end
8765
8766 !! test
8767 Magic Word: serialize on separate line (parsoid)
8768 !! options
8769 parsoid=wt2wt,html2wt
8770 !! wikitext
8771 foo
8772 __NOTOC__
8773 bar
8774 !! html
8775 foo<meta property="mw:PageProp/notoc"/>bar
8776 !! end
8777
8778 !! test
8779 Magic Word: rt non-english wikis
8780 !! options
8781 parsoid=wt2wt
8782 language=de
8783 !! wikitext
8784 __NOEDITSECTION__
8785 !! html
8786 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
8787 !! end
8788
8789 ###
8790 ### Magic links
8791 ###
8792 !! test
8793 Magic links: internal link to RFC (bug 479)
8794 !! wikitext
8795 [[RFC 123]]
8796 !! html
8797 <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>
8798 </p>
8799 !! end
8800
8801 !! test
8802 Magic links: RFC (bug 479)
8803 !! wikitext
8804 RFC 822
8805 !! html
8806 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8807 </p>
8808 !! end
8809
8810 !! test
8811 Magic links: ISBN (bug 1937)
8812 !! wikitext
8813 ISBN 0-306-40615-2
8814 !! html
8815 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8816 </p>
8817 !! end
8818
8819 !! test
8820 Magic links: PMID incorrectly converts space to underscore
8821 !! wikitext
8822 PMID 1234
8823 !! html
8824 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8825 </p>
8826 !! end
8827
8828 ###
8829 ### Templates
8830 ####
8831
8832 !! test
8833 Nonexistent template
8834 !! wikitext
8835 {{thistemplatedoesnotexist}}
8836 !! html
8837 <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>
8838 </p>
8839 !! end
8840
8841 !! test
8842 Template with invalid target containing tags
8843 !! wikitext
8844 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8845 !! html
8846 <p>{{a<b>b</b>|foo|a=b|a = b}}
8847 </p>
8848 !! end
8849
8850 !! test
8851 Template with invalid target containing unclosed tag
8852 !! wikitext
8853 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8854 !! html
8855 <p>{{a<b>|foo|a=b|a = b}}</b>
8856 </p>
8857 !! end
8858
8859 !! test
8860 Template with invalid target containing wikilink
8861 !! wikitext
8862 {{[[Main Page]]}}
8863 !! html/php
8864 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
8865 </p>
8866 !! html/parsoid
8867 <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>
8868 !! end
8869
8870 !! test
8871 Template with just whitespace in it, bug #68421
8872 !! wikitext
8873 {{echo|{{ }}}}
8874 !! html/parsoid
8875 <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>
8876 !! end
8877
8878 !! article
8879 Template:test
8880 !! text
8881 This is a test template
8882 !! endarticle
8883
8884 !! test
8885 Simple template
8886 !! wikitext
8887 {{test}}
8888 !! html
8889 <p>This is a test template
8890 </p>
8891 !! end
8892
8893 !! test
8894 Template with explicit namespace
8895 !! wikitext
8896 {{Template:test}}
8897 !! html
8898 <p>This is a test template
8899 </p>
8900 !! end
8901
8902
8903 !! article
8904 Template:paramtest
8905 !! text
8906 This is a test template with parameter {{{param}}}
8907 !! endarticle
8908
8909 !! test
8910 Template parameter
8911 !! wikitext
8912 {{paramtest|param=foo}}
8913 !! html
8914 <p>This is a test template with parameter foo
8915 </p>
8916 !! end
8917
8918 !! article
8919 Template:paramtestnum
8920 !! text
8921 [[{{{1}}}|{{{2}}}]]
8922 !! endarticle
8923
8924 !! test
8925 Template unnamed parameter
8926 !! wikitext
8927 {{paramtestnum|Main Page|the main page}}
8928 !! html
8929 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
8930 </p>
8931 !! end
8932
8933 !! article
8934 Template:templatesimple
8935 !! text
8936 (test)
8937 !! endarticle
8938
8939 !! article
8940 Template:templateredirect
8941 !! text
8942 #redirect [[Template:templatesimple]]
8943 !! endarticle
8944
8945 !! article
8946 Template:templateasargtestnum
8947 !! text
8948 {{{{{1}}}}}
8949 !! endarticle
8950
8951 !! article
8952 Template:templateasargtest
8953 !! text
8954 {{template{{{templ}}}}}
8955 !! endarticle
8956
8957 !! article
8958 Template:templateasargtest2
8959 !! text
8960 {{{{{templ}}}}}
8961 !! endarticle
8962
8963 !! test
8964 Template with template name as unnamed argument
8965 !! wikitext
8966 {{templateasargtestnum|templatesimple}}
8967 !! html
8968 <p>(test)
8969 </p>
8970 !! end
8971
8972 !! test
8973 Template with template name as argument
8974 !! wikitext
8975 {{templateasargtest|templ=simple}}
8976 !! html
8977 <p>(test)
8978 </p>
8979 !! end
8980
8981 !! test
8982 Template with template name as argument (2)
8983 !! wikitext
8984 {{templateasargtest2|templ=templatesimple}}
8985 !! html
8986 <p>(test)
8987 </p>
8988 !! end
8989
8990 !! article
8991 Template:templateasargtestdefault
8992 !! text
8993 {{{{{templ|templatesimple}}}}}
8994 !! endarticle
8995
8996 !! article
8997 Template:templa
8998 !! text
8999 '''templ'''
9000 !! endarticle
9001
9002 !! test
9003 Template with default value
9004 !! wikitext
9005 {{templateasargtestdefault}}
9006 !! html
9007 <p>(test)
9008 </p>
9009 !! end
9010
9011 !! test
9012 Template with default value (value set)
9013 !! wikitext
9014 {{templateasargtestdefault|templ=templa}}
9015 !! html
9016 <p><b>templ</b>
9017 </p>
9018 !! end
9019
9020 !! test
9021 Template redirect
9022 !! wikitext
9023 {{templateredirect}}
9024 !! html
9025 <p>(test)
9026 </p>
9027 !! end
9028
9029 !! test
9030 Template with argument in separate line
9031 !! wikitext
9032 {{ templateasargtest |
9033 templ = simple }}
9034 !! html
9035 <p>(test)
9036 </p>
9037 !! end
9038
9039 !! test
9040 Template with complex template as argument
9041 !! wikitext
9042 {{paramtest|
9043 param ={{ templateasargtest |
9044 templ = simple }}}}
9045 !! html
9046 <p>This is a test template with parameter (test)
9047 </p>
9048 !! end
9049
9050 !! test
9051 Template with thumb image (with link in description)
9052 !! wikitext
9053 {{paramtest|
9054 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9055 !! html/php
9056 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>
9057
9058 !! html+tidy
9059 <p>This is a test template with parameter</p>
9060 <div class="thumb tright">
9061 <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>
9062 <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>
9063 </div>
9064 </div>
9065 !! end
9066
9067 !! article
9068 Template:complextemplate
9069 !! text
9070 {{{1}}} {{paramtest|
9071 param ={{{param}}}}}
9072 !! endarticle
9073
9074 !! test
9075 Template with complex arguments
9076 !! wikitext
9077 {{complextemplate|
9078 param ={{ templateasargtest |
9079 templ = simple }}|[[Template:complextemplate|link]]}}
9080 !! html
9081 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
9082 </p>
9083 !! end
9084
9085 !! test
9086 BUG 553: link with two variables in a piped link
9087 !! wikitext
9088 {|
9089 |[[{{{1}}}|{{{2}}}]]
9090 |}
9091 !! html
9092 <table>
9093 <tr>
9094 <td>[[{{{1}}}|{{{2}}}]]
9095 </td></tr></table>
9096
9097 !! end
9098
9099 !! test
9100 Magic variable as template parameter
9101 !! wikitext
9102 {{paramtest|param={{SITENAME}}}}
9103 !! html
9104 <p>This is a test template with parameter MediaWiki
9105 </p>
9106 !! end
9107
9108 !! article
9109 Template:linktest
9110 !! text
9111 [[{{{param}}}|link]]
9112 !! endarticle
9113
9114 !! test
9115 Template parameter as link source
9116 !! wikitext
9117 {{linktest|param=Main Page}}
9118 !! html
9119 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
9120 </p>
9121 !! end
9122
9123 !!test
9124 Template-generated attribute string (k='v')
9125 !! wikitext
9126 <span {{attr_str|id|v1}}>bar</span>
9127 !! html
9128 <p><span id="v1">bar</span>
9129 </p>
9130 !!end
9131
9132 !!article
9133 Template:paramtest2
9134 !! text
9135 including another template, {{paramtest|param={{{arg}}}}}
9136 !! endarticle
9137
9138 !! test
9139 Template passing argument to another template
9140 !! wikitext
9141 {{paramtest2|arg='hmm'}}
9142 !! html
9143 <p>including another template, This is a test template with parameter 'hmm'
9144 </p>
9145 !! end
9146
9147 !! article
9148 Template:Linktest2
9149 !! text
9150 Main Page
9151 !! endarticle
9152
9153 !! test
9154 Template as link source
9155 !! wikitext
9156 [[{{linktest2}}]]
9157
9158 [[{{linktest2}}|Main Page]]
9159
9160 [[{{linktest2}}]]Page
9161 !! html
9162 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9163 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9164 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
9165 </p>
9166 !! end
9167
9168
9169 !! article
9170 Template:loop1
9171 !! text
9172 {{loop2}}
9173 !! endarticle
9174
9175 !! article
9176 Template:loop2
9177 !! text
9178 {{loop1}}
9179 !! endarticle
9180
9181 !! test
9182 Template infinite loop
9183 !! wikitext
9184 {{loop1}}
9185 !! html
9186 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
9187 </p>
9188 !! end
9189
9190 !! test
9191 Template from main namespace
9192 !! wikitext
9193 {{:Main Page}}
9194 !! html
9195 <p>blah blah
9196 </p>
9197 !! end
9198
9199 !! article
9200 Template:table
9201 !! text
9202 {|
9203 | 1 || 2
9204 |-
9205 | 3 || 4
9206 |}
9207 !! endarticle
9208
9209 !! test
9210 BUG 529: Template with table, not included at beginning of line
9211 !! wikitext
9212 foo {{table}}
9213 !! html
9214 <p>foo
9215 </p>
9216 <table>
9217 <tr>
9218 <td> 1 </td>
9219 <td> 2
9220 </td></tr>
9221 <tr>
9222 <td> 3 </td>
9223 <td> 4
9224 </td></tr></table>
9225
9226 !! end
9227
9228 !! test
9229 BUG 523: Template shouldn't eat newline (or add an extra one before table)
9230 !! wikitext
9231 foo
9232 {{table}}
9233 !! html
9234 <p>foo
9235 </p>
9236 <table>
9237 <tr>
9238 <td> 1 </td>
9239 <td> 2
9240 </td></tr>
9241 <tr>
9242 <td> 3 </td>
9243 <td> 4
9244 </td></tr></table>
9245
9246 !! end
9247
9248 !! test
9249 BUG 41: Template parameters shown as broken links
9250 !! wikitext
9251 {{{parameter}}}
9252 !! html
9253 <p>{{{parameter}}}
9254 </p>
9255 !! end
9256
9257 !! test
9258 Template with targets containing wikilinks
9259 !! wikitext
9260 {{[[foo]]}}
9261
9262 {{[[{{echo|foo}}]]}}
9263
9264 {{{{echo|[[foo}}]]}}
9265 !! html
9266 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9267 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9268 </p><p>{{[[foo}}]]
9269 </p>
9270 !! end
9271
9272 !! article
9273 Template:MSGNW test
9274 !! text
9275 ''None'' of '''this''' should be
9276 * interpreted
9277 but rather passed unmodified
9278 {{test}}
9279 <gallery>
9280 File:Foobar.jpg
9281 </gallery>
9282 !! endarticle
9283
9284 # hmm, fix this or just deprecate msgnw and document its behavior?
9285 !! test
9286 msgnw keyword
9287 !! wikitext
9288 {{msgnw:MSGNW test}}
9289 !! html
9290 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
9291 &#42; interpreted
9292 &#32;but rather passed unmodified
9293 &#123;&#123;test&#125;&#125;
9294 &#60;gallery&#62;
9295 File:Foobar.jpg
9296 &#60;/gallery&#62;
9297 </p>
9298 !! end
9299
9300 !! test
9301 int keyword
9302 !! wikitext
9303 {{int:youhavenewmessages|lots of money|not!}}
9304 !! html
9305 <p>You have lots of money (not!).
9306 </p>
9307 !! end
9308
9309 !! article
9310 Template:Includes
9311 !! text
9312 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9313 !! endarticle
9314
9315 !! test
9316 <includeonly> and <noinclude> being included
9317 !! wikitext
9318 {{Includes}}
9319 !! html
9320 <p>Foobar
9321 </p>
9322 !! end
9323
9324 !! article
9325 Template:Includes2
9326 !! text
9327 <onlyinclude>Foo</onlyinclude>bar
9328 !! endarticle
9329
9330 !! test
9331 <onlyinclude> being included
9332 !! wikitext
9333 {{Includes2}}
9334 !! html
9335 <p>Foo
9336 </p>
9337 !! end
9338
9339
9340 !! article
9341 Template:Includes3
9342 !! text
9343 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9344 !! endarticle
9345
9346 !! test
9347 <onlyinclude> and <includeonly> being included
9348 !! wikitext
9349 {{Includes3}}
9350 !! html
9351 <p>Foo
9352 </p>
9353 !! end
9354
9355 !! test
9356 <includeonly> and <noinclude> on a page
9357 !! wikitext
9358 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9359 !! html
9360 <p>Foozar
9361 </p>
9362 !! end
9363
9364 !! test
9365 Un-closed <noinclude>
9366 !! wikitext
9367 <noinclude>
9368 !! html
9369 !! end
9370
9371 !! test
9372 <onlyinclude> on a page
9373 !! wikitext
9374 <onlyinclude>Foo</onlyinclude>bar
9375 !! html
9376 <p>Foobar
9377 </p>
9378 !! end
9379
9380 !! test
9381 Un-closed <onlyinclude>
9382 !! wikitext
9383 <onlyinclude>
9384 !! html
9385 !! end
9386
9387 !!test
9388 Self-closed noinclude, includeonly, onlyinclude tags
9389 !! wikitext
9390 <noinclude />
9391 <includeonly />
9392 <onlyinclude />
9393 !! html
9394 <p><br />
9395 </p>
9396 !!end
9397
9398 !!test
9399 Unbalanced includeonly and noinclude tags
9400 !! wikitext
9401 {|
9402 |a</noinclude>
9403 |b</noinclude></noinclude>
9404 |c</noinclude></includeonly>
9405 |d</includeonly></includeonly>
9406 |}
9407 !! html
9408 <table>
9409 <tr>
9410 <td>a
9411 </td>
9412 <td>b
9413 </td>
9414 <td>c&lt;/includeonly&gt;
9415 </td>
9416 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9417 </td></tr></table>
9418
9419 !!end
9420
9421 !! article
9422 Template:Includeonly section
9423 !! text
9424 <includeonly>
9425 ==Includeonly section==
9426 </includeonly>
9427 ==Section T-1==
9428 !!endarticle
9429
9430 !! test
9431 Bug 6563: Edit link generation for section shown by <includeonly>
9432 !! wikitext
9433 {{includeonly section}}
9434 !! html
9435 <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>
9436 <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>
9437
9438 !! end
9439
9440 # Uses same input as the contents of [[Template:Includeonly section]]
9441 !! test
9442 Bug 6563: Section extraction for section shown by <includeonly>
9443 !! options
9444 section=T-2
9445 !! wikitext
9446 <includeonly>
9447 ==Includeonly section==
9448 </includeonly>
9449 ==Section T-2==
9450 !! html
9451 ==Section T-2==
9452 !! end
9453
9454 !! test
9455 Bug 6563: Edit link generation for section suppressed by <includeonly>
9456 !! wikitext
9457 <includeonly>
9458 ==Includeonly section==
9459 </includeonly>
9460 ==Section 1==
9461 !! html
9462 <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>
9463
9464 !! end
9465
9466 !! test
9467 Bug 6563: Section extraction for section suppressed by <includeonly>
9468 !! options
9469 section=1
9470 !! wikitext
9471 <includeonly>
9472 ==Includeonly section==
9473 </includeonly>
9474 ==Section 1==
9475 !! html
9476 ==Section 1==
9477 !! end
9478
9479 !! test
9480 Un-closed <includeonly>
9481 !! wikitext
9482 <includeonly>
9483 !! html
9484 !! end
9485
9486 !! test
9487 Includes and comments at SOL
9488 !! wikitext
9489 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
9490
9491 <noinclude>
9492 some
9493 </noinclude>* stuff
9494 * here
9495
9496 <includeonly>can have stuff</includeonly>=== here ===
9497
9498 !! html/php
9499 <h2><span class="mw-headline" id="hu">hu</span></h2>
9500 <p>some
9501 </p>
9502 <ul><li> stuff</li>
9503 <li> here</li></ul>
9504 <h3><span class="mw-headline" id="here">here</span></h3>
9505
9506 !! html/parsoid
9507 <!-- 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>
9508
9509 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
9510 <p>some</p>
9511 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
9512 <li> here</li></ul>
9513
9514 <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>
9515
9516 !! end
9517
9518 # TODO: test with DOM fragment reuse!
9519 !! test
9520 Parsoid: DOM fragment reuse
9521 !! options
9522 parsoid=wt2wt,wt2html
9523 !! wikitext
9524 a{{echo|b<table></table>c}}d
9525
9526 a{{echo|b
9527 <table></table>
9528 c}}d
9529
9530 {{echo|a
9531
9532 <table></table>
9533
9534 b}}
9535 !! html
9536 <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>
9537
9538 <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">
9539 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
9540 </span><p about="#mwt2">cd</p>
9541
9542 <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">
9543
9544 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
9545
9546 </span><p about="#mwt3">b</p>
9547 !! end
9548
9549 !! test
9550 Parsoid: Merge double tds (bug 50603)
9551 !! options
9552 parsoid
9553 !! wikitext
9554 {|
9555 |{{echo|{{!}} foo}}
9556 |}
9557 !! html
9558 <table><tbody>
9559 <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>
9560 </tbody></table>
9561 !! end
9562
9563 !! test
9564 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9565 !! options
9566 parsoid
9567 !! wikitext
9568 {{echo|<div>}}
9569 {|
9570 |{{echo|{{!}} foo}}
9571 |}
9572 {{echo|</div>}}
9573 !! html
9574 <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}}]}'>
9575 <table><tbody>
9576 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9577 </tbody></table>
9578 </div>
9579 !! end
9580
9581 ###
9582 ### <includeonly> and <noinclude> in attributes
9583 ###
9584 !!test
9585 0. includeonly around the entire attribute
9586 !! wikitext
9587 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9588 !! html
9589 <p><span id="v2">bar</span>
9590 </p>
9591 !!end
9592
9593 !!test
9594 1. includeonly in html attr key
9595 !! wikitext
9596 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9597 !! html
9598 <p><span id="foo">bar</span>
9599 </p>
9600 !!end
9601
9602 !!test
9603 2. includeonly in html attr value
9604 !! wikitext
9605 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9606 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9607 !! html
9608 <p><span id="v1">bar</span>
9609 <span id="v1">bar</span>
9610 </p>
9611 !!end
9612
9613 !!test
9614 3. includeonly in part of an attr value
9615 !! wikitext
9616 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9617 !! html
9618 <p><span style="color:red;">bar</span>
9619 </p>
9620 !!end
9621
9622 !!test
9623 4. includeonly in table attributes
9624 !! wikitext
9625 {|
9626 |- <noinclude>
9627 |-
9628 |a
9629 </noinclude>
9630 |- <includeonly>
9631 |-
9632 |b
9633 </includeonly>
9634 |}
9635 !! html
9636 <table>
9637
9638
9639 <tr>
9640 <td>a
9641 </td></tr>
9642 </table>
9643
9644 !!end
9645
9646 ###
9647 ### Token Stream Patcher tests
9648 ###
9649 ### These tests won't always pass wt2wt and other modes because
9650 ### on serialization, the table will be output on a new line.
9651 ### For now, we are blacklisting them, and using this to test selser.
9652 ###
9653
9654 !!test
9655 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
9656 !!options
9657 parsoid=wt2html,wt2wt
9658 !!wikitext
9659 {{echo|}}{| width = '100%'
9660 |foo
9661 |}
9662 !!html/parsoid
9663 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
9664 <tbody><tr><td>foo</td></tr>
9665 </tbody></table>
9666 !!end
9667
9668 !!test
9669 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
9670 !!options
9671 parsoid=wt2html,wt2wt
9672 !!wikitext
9673 <includeonly>a</includeonly>{| {{{b}}}
9674 |c
9675 |}
9676 !!html/parsoid
9677 <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}}}":""}}'>
9678 <tbody><tr><td>c</td></tr>
9679 </tbody></table>
9680
9681 !!end
9682
9683 ###
9684 ### Testing parsing of templates where a template arg
9685 ### has the same name as the template itself.
9686 ###
9687
9688 !! article
9689 Template:quote
9690 !! text
9691 {{{quote|{{{1}}}}}}
9692 !! endarticle
9693
9694 !!test
9695 Templates: Template Name/Arg clash: 1. Use of positional param
9696 !! wikitext
9697 {{quote|foo}}
9698 !! html
9699 <p>foo
9700 </p>
9701 !!end
9702
9703 !!test
9704 Templates: Template Name/Arg clash: 2. Use of named param
9705 !! wikitext
9706 {{quote|quote=foo}}
9707 !! html
9708 <p>foo
9709 </p>
9710 !!end
9711
9712 !!test
9713 Templates: Template Name/Arg clash: 3. Use of named param with empty input
9714 !! wikitext
9715 {{quote|quote}}
9716 !! html
9717 <p>quote
9718 </p>
9719 !!end
9720
9721 ###
9722 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
9723 ###
9724
9725 !!test
9726 Templates: 1. Simple use
9727 !! wikitext
9728 {{echo|Foo}}
9729 !! html
9730 <p>Foo
9731 </p>
9732 !!end
9733
9734 !!test
9735 Templates: 2. Inside a block tag
9736 !! wikitext
9737 <div>{{echo|Foo}}</div>
9738 <blockquote>{{echo|Foo}}</blockquote>
9739 !! html
9740 <div>Foo</div>
9741 <blockquote>Foo</blockquote>
9742
9743 !! html+tidy
9744 <div>Foo</div>
9745 <blockquote>
9746 <p>Foo</p>
9747 </blockquote>
9748 !!end
9749
9750 !!test
9751 Templates: P-wrapping: 1a. Templates on consecutive lines
9752 !! wikitext
9753 {{echo|Foo}}
9754 {{echo|bar}}
9755 !! html
9756 <p>Foo
9757 bar
9758 </p>
9759 !!end
9760
9761 !!test
9762 Templates: P-wrapping: 1b. Templates on consecutive lines
9763 !! wikitext
9764 Foo
9765
9766 {{echo|bar}}
9767 {{echo|baz}}
9768 !! html
9769 <p>Foo
9770 </p><p>bar
9771 baz
9772 </p>
9773 !!end
9774
9775 !!test
9776 Templates: P-wrapping: 1c. Templates on consecutive lines
9777 !! wikitext
9778 {{echo|Foo}}
9779 {{echo|bar}} <div>baz</div>
9780 !! html
9781 <p>Foo
9782 </p>
9783 bar <div>baz</div>
9784
9785 !! html+tidy
9786 <p>Foo</p>
9787 <p>bar</p>
9788 <div>baz</div>
9789 !! end
9790
9791 !!test
9792 Templates: P-wrapping: 1d. Template preceded by comment-only line
9793 !!options
9794 parsoid
9795 !! wikitext
9796 <!-- foo -->
9797 {{echo|Bar}}
9798 !! html
9799 <!-- foo -->
9800
9801 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
9802 !!end
9803
9804 !!test
9805 Templates: Inline Text: 1. Multiple template uses
9806 !! wikitext
9807 {{echo|Foo}}bar{{echo|baz}}
9808 !! html
9809 <p>Foobarbaz
9810 </p>
9811 !!end
9812
9813 !!test
9814 Templates: Inline Text: 2. Back-to-back template uses
9815 !! wikitext
9816 {{echo|Foo}}{{echo|bar}}
9817 !! html
9818 <p>Foobar
9819 </p>
9820 !!end
9821
9822 !!test
9823 Templates: Block Tags: 1. Multiple template uses
9824 !! wikitext
9825 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
9826 !! html
9827 <div>Foo</div><div>bar</div><div>baz</div>
9828
9829 !!end
9830
9831 !!test
9832 Templates: Block Tags: 2. Back-to-back template uses
9833 !! wikitext
9834 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
9835 !! html
9836 <div>Foo</div><div>bar</div>
9837
9838 !!end
9839
9840 # This is an edge case relating to paragraph wrapping.
9841 !!test
9842 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
9843 !! wikitext
9844 {{echo|a
9845 b</p>}}
9846 !! html/parsoid
9847 <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
9848 b</p>
9849 !!end
9850
9851 !!test
9852 Templates: Links: 1. Simple example
9853 !! wikitext
9854 {{echo|[[Foo|bar]]}}
9855 !! html
9856 <p><a href="/wiki/Foo" title="Foo">bar</a>
9857 </p>
9858 !!end
9859
9860 !!test
9861 Templates: Links: 2. Generation of link href
9862 !! wikitext
9863 [[{{echo|Foo}}|bar]]
9864 !! html
9865 <p><a href="/wiki/Foo" title="Foo">bar</a>
9866 </p>
9867 !!end
9868
9869 !!test
9870 Templates: Links: 3. Generation of part of a link href
9871 !! wikitext
9872 [[Fo{{echo|o}}|bar]]
9873
9874 [[Foo{{echo|bar}}]]
9875
9876 [[Foo{{echo|bar}}baz]]
9877
9878 [[Foo{{echo|bar}}|bar]]
9879
9880 [[:Foo{{echo|bar}}]]
9881
9882 [[:Foo{{echo|bar}}|bar]]
9883 !! html
9884 <p><a href="/wiki/Foo" title="Foo">bar</a>
9885 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9886 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
9887 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9888 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9889 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9890 </p>
9891 !!end
9892
9893 !!test
9894 Templates: Links: 4. Multiple templates generating link href
9895 !! wikitext
9896 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
9897 !! html
9898 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9899 </p>
9900 !!end
9901
9902 !!test
9903 Templates: Links: 5. Generation of link text
9904 !! wikitext
9905 [[Foo|{{echo|bar}}]]
9906 !! html
9907 <p><a href="/wiki/Foo" title="Foo">bar</a>
9908 </p>
9909 !!end
9910
9911 !!test
9912 Templates: Links: 5. Nested templates (only outermost template should be marked)
9913 !! wikitext
9914 {{echo|[[{{echo|Foo}}|bar]]}}
9915 !! html
9916 <p><a href="/wiki/Foo" title="Foo">bar</a>
9917 </p>
9918 !!end
9919
9920 !!test
9921 Templates: HTML Tag: 1. Generation of HTML attr. key
9922 !! wikitext
9923 <div {{echo|style}}="color:red;">foo</div>
9924 !! html
9925 <div style="color:red;">foo</div>
9926
9927 !!end
9928
9929 !!test
9930 Templates: HTML Tag: 2. Generation of HTML attr. value
9931 !! wikitext
9932 <div style={{echo|'color:red;'}}>foo</div>
9933 !! html
9934 <div style="color:red;">foo</div>
9935
9936 !!end
9937
9938 !!test
9939 Templates: HTML Tag: 3. Generation of HTML attr key and value
9940 !! wikitext
9941 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
9942 !! html
9943 <div style="color:red;">foo</div>
9944
9945 !!end
9946
9947 !!test
9948 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
9949 !! wikitext
9950 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
9951 !! html
9952 <div title="This is a long title with just one piece templated">foo</div>
9953
9954 !!end
9955
9956 !!test
9957 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
9958 !! wikitext
9959 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
9960 !! html
9961 <div title="This is a long title with just one piece templated">foo</div>
9962
9963 !!end
9964
9965 !!test
9966 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
9967 !! wikitext
9968 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
9969 !! html
9970 <div title="This is a long title with just one piece templated">foo</div>
9971
9972 !!end
9973
9974 !!test
9975 Templates: HTML Tag: 7. Generation of partial attribute key string
9976 !! wikitext
9977 <div st{{echo|yle}}="color:red;">foo</div>
9978 !! html
9979 <div style="color:red;">foo</div>
9980
9981 !!end
9982
9983 !!test
9984 Templates: HTML Tables: 1. Generating start of a HTML table
9985 !! wikitext
9986 {{echo|<table><tr><td>foo</td>}}</tr></table>
9987 !! html
9988 <table><tr><td>foo</td></tr></table>
9989
9990 !!end
9991
9992 !!test
9993 Templates: HTML Tables: 2a. Generating middle of a HTML table
9994 !! wikitext
9995 <table><tr>{{echo|<td>foo</td>}}</tr></table>
9996 !! html
9997 <table><tr><td>foo</td></tr></table>
9998
9999 !!end
10000
10001 !!test
10002 Templates: HTML Tables: 2b. Generating middle of a HTML table
10003 !! wikitext
10004 <table>{{echo|<tr><td>foo</td></tr>}}</table>
10005 !! html
10006 <table><tr><td>foo</td></tr></table>
10007
10008 !!end
10009
10010 !!test
10011 Templates: HTML Tables: 3. Generating end of a HTML table
10012 !! wikitext
10013 <table><tr>{{echo|<td>foo</td></tr></table>}}
10014 !! html
10015 <table><tr><td>foo</td></tr></table>
10016
10017 !!end
10018
10019 !!test
10020 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
10021 !! wikitext
10022 {{echo|<table>}}<tr><td>foo</td></tr></table>
10023 !! html
10024 <table><tr><td>foo</td></tr></table>
10025
10026 !!end
10027
10028 !!test
10029 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
10030 !! wikitext
10031 <table>{{echo|<tr>}}<td>foo</td></tr></table>
10032 !! html
10033 <table><tr><td>foo</td></tr></table>
10034
10035 !!end
10036
10037 !!test
10038 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
10039 !! wikitext
10040 <table><tr>{{echo|<td>}}foo</td></tr></table>
10041 !! html
10042 <table><tr><td>foo</td></tr></table>
10043
10044 !!end
10045
10046 !!test
10047 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
10048 !! wikitext
10049 <table><tr><td>foo{{echo|</td>}}</tr></table>
10050 !! html
10051 <table><tr><td>foo</td></tr></table>
10052
10053 !!end
10054
10055 !!test
10056 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
10057 !! wikitext
10058 <table><tr><td>foo</td>{{echo|</tr>}}</table>
10059 !! html
10060 <table><tr><td>foo</td></tr></table>
10061
10062 !!end
10063
10064 !!test
10065 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
10066 !! wikitext
10067 <table><tr><td>foo</td></tr>{{echo|</table>}}
10068 !! html
10069 <table><tr><td>foo</td></tr></table>
10070
10071 !!end
10072
10073 !!test
10074 Templates: HTML Tables: 5. Proper fostering of categories from inside
10075 !!options
10076 parsoid=wt2html,wt2wt
10077 !! wikitext
10078 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
10079 <!--Two categories (Bug 50330)-->
10080 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
10081 !! html
10082 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
10083 <!--Two categories (Bug 50330)-->
10084 <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>
10085 !!end
10086
10087 !!test
10088 Templates: Wiki Tables: 1a. Fostering of entire template content
10089 !! wikitext
10090 {|
10091 {{echo|a}}
10092 |}
10093 !! html
10094 <table>
10095 a
10096 <tr><td></td></tr></table>
10097
10098 !! html+tidy
10099 <p>a</p>
10100 <table>
10101 <tr>
10102 <td></td>
10103 </tr>
10104 </table>
10105 !! end
10106
10107 !!test
10108 Templates: Wiki Tables: 1b. Fostering of entire template content
10109 !! wikitext
10110 {|
10111 {{echo|<div>}}
10112 foo
10113 {{echo|</div>}}
10114 |}
10115 !! html
10116 <table>
10117 <div>
10118 <p>foo
10119 </p>
10120 </div>
10121 <tr><td></td></tr></table>
10122
10123 !! html+tidy
10124 <div>
10125 <p>foo</p>
10126 </div>
10127 <table>
10128 <tr>
10129 <td></td>
10130 </tr>
10131 </table>
10132 !! end
10133
10134 !!test
10135 Templates: Wiki Tables: 2. Fostering of partial template content
10136 !! wikitext
10137 {|
10138 {{echo|a
10139 <div>b</div>}}
10140 |}
10141 !! html
10142 <table>
10143 a
10144 <div>b</div>
10145 <tr><td></td></tr></table>
10146
10147 !! html+tidy
10148 <p>a</p>
10149 <div>b</div>
10150 <table>
10151 <tr>
10152 <td></td>
10153 </tr>
10154 </table>
10155 !! end
10156
10157 !!test
10158 Templates: Wiki Tables: 3. td-content via multiple templates
10159 !! wikitext
10160 {|
10161 {{echo|{{pipe}}a}}{{echo|b}}
10162 |}
10163 !! html
10164 <table>
10165 <tr>
10166 <td>ab
10167 </td></tr></table>
10168
10169 !!end
10170
10171 !!test
10172 Templates: Wiki Tables: 4. Templated tags, no content
10173 !! wikitext
10174 {{tbl-start}}
10175 {{tbl-end}}
10176 !! html
10177 <table>
10178 <tr><td></td></tr></table>
10179
10180 !!end
10181
10182 !!test
10183 Templates: Wiki Tables: 5. Templated tags, regular td-tags
10184 !! wikitext
10185 {{tbl-start}}
10186 |foo
10187 {{tbl-end}}
10188 !! html
10189 <table>
10190 <tr>
10191 <td>foo
10192 </td></tr></table>
10193
10194 !!end
10195
10196 !!test
10197 Templates: Wiki Tables: 6. Templated tags, templated td-tags
10198 !! wikitext
10199 {{tbl-start}}
10200 {{!}}foo
10201 {{tbl-end}}
10202 !! html
10203 <table>
10204 <tr>
10205 <td>foo
10206 </td></tr></table>
10207
10208 !!end
10209
10210 !!test
10211 Templates: Lists: Multi-line list-items via templates
10212 !! wikitext
10213 *{{echo|a {{nonexistent|
10214 unused}}}}
10215 *{{echo|b {{nonexistent|
10216 unused}}}}
10217 !! html
10218 <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>
10219 <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>
10220
10221 !!end
10222
10223 !!test
10224 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
10225 !! wikitext
10226 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
10227 !! html
10228 <p><i>ab</i>c<i>d</i>e
10229 </p>
10230 !!end
10231
10232 !!test
10233 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
10234 (PHP parser generates misnested html)
10235 !! wikitext
10236 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
10237 !! html/parsoid
10238 <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>
10239 !!end
10240
10241 !!test
10242 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
10243 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
10244 !! options
10245 parsoid=wt2html,wt2wt
10246 !! wikitext
10247 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
10248 !! html
10249 <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>
10250 <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>
10251 <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>
10252 !!end
10253
10254 !!test
10255 Templates: Ugly nesting: 4. Divs opened/closed across templates
10256 !! wikitext
10257 a<div>b{{echo|c</div>d}}e
10258 !! html
10259 a<div>bc</div>de
10260
10261 !! html+tidy
10262 <p>a</p>
10263 <div>bc</div>
10264 <p>de</p>
10265 !! end
10266
10267 !!test
10268 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10269 (Parsoid-centric)
10270 !! options
10271 parsoid
10272 !! wikitext
10273 {|
10274 |{{echo|foo</table>}}
10275 |bar
10276 |}
10277 !! html
10278 <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|}"]}'>
10279
10280 <tbody>
10281 <tr>
10282 <td>foo</td></tr></tbody></table><span about="#mwt1">
10283 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10284 |}</span>
10285 !!end
10286
10287 !!test
10288 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10289 (Parsoid-centric)
10290 !! options
10291 parsoid
10292 !! wikitext
10293 <table>
10294 <tr>
10295 <td>
10296 <table>
10297 <tr>
10298 <td>1. {{echo|foo </table>}}</td>
10299 <td> bar </td>
10300 <td>2. {{echo|baz </table>}}</td>
10301 </tr>
10302 <tr>
10303 <td>abc</td>
10304 </tr>
10305 </table>
10306 </td>
10307 </tr>
10308 <tr>
10309 <td>xyz</td>
10310 </tr>
10311 </table>
10312 !! html
10313 <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>"]}'>
10314 <tbody><tr>
10315 <td>
10316 <table>
10317 <tbody><tr>
10318 <td>1. foo </td></tr></tbody></table></td>
10319 <td> bar </td>
10320 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10321 </span><span about="#mwt2">
10322 </span><span about="#mwt2">
10323 </span><span about="#mwt2">abc</span><span about="#mwt2">
10324 </span><span about="#mwt2">
10325 </span><span about="#mwt2">
10326 </span><span about="#mwt2">
10327 </span><span about="#mwt2">
10328 </span><span about="#mwt2">
10329 </span><span about="#mwt2">xyz</span><span about="#mwt2">
10330 </span><span about="#mwt2">
10331 </span>
10332 !!end
10333
10334 !! test
10335 Templates: Ugly templates: 3. newline-only template parameter
10336 !! wikitext
10337 foo {{echo|
10338 }}
10339 !! html
10340 <p>foo
10341 </p>
10342 !! end
10343
10344 # This looks like a bug: a single newline triggers p/br for some reason.
10345 !! test
10346 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10347 !! wikitext
10348 {{echo|
10349 }}
10350 !! html
10351 <p><br />
10352 </p>
10353 !! end
10354
10355 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10356 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10357 !! test
10358 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10359 !! wikitext
10360 {{echo|<table>}}
10361 {{echo|<div>foo}}
10362 {{echo|</table>}}
10363 !! html/parsoid
10364 <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
10365 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10366 </table>
10367 !! end
10368
10369 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10370 # that are "identical" and generate nesting cycles in the algorithm
10371 !! test
10372 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
10373 !! wikitext
10374 {{echo|<table><tr><td><table>}}
10375 {{echo|<div>}}
10376 {{echo|</div>}}
10377 !! html/parsoid
10378 <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"}'>
10379 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10380 </table></td></tr></tbody></table>
10381 !! end
10382
10383 !!test
10384 Parser Functions: 1. Simple example
10385 !! wikitext
10386 {{uc:foo}}
10387 !! html
10388 <p>FOO
10389 </p>
10390 !!end
10391
10392 !!test
10393 Parser Functions: 2. Nested use (only outermost should be marked up)
10394 !! wikitext
10395 {{uc:{{lc:FOO}}}}
10396 !! html
10397 <p>FOO
10398 </p>
10399 !!end
10400
10401 ###
10402 ### Pre-save transform tests
10403 ###
10404 !! test
10405 pre-save transform: subst:
10406 !! options
10407 PST
10408 !! wikitext
10409 {{subst:test}}
10410 !! html
10411 This is a test template
10412 !! end
10413
10414 !! test
10415 pre-save transform: normal template
10416 !! options
10417 PST
10418 !! wikitext
10419 {{test}}
10420 !! html
10421 {{test}}
10422 !! end
10423
10424 !! test
10425 pre-save transform: nonexistent template
10426 !! options
10427 PST
10428 !! wikitext
10429 {{thistemplatedoesnotexist}}
10430 !! html
10431 {{thistemplatedoesnotexist}}
10432 !! end
10433
10434
10435 !! test
10436 pre-save transform: subst magic variables
10437 !! options
10438 PST
10439 !! wikitext
10440 {{subst:SITENAME}}
10441 !! html
10442 MediaWiki
10443 !! end
10444
10445 # This is bug 89, which I fixed. -- wtm
10446 !! test
10447 pre-save transform: subst: templates with parameters
10448 !! options
10449 pst
10450 !! wikitext
10451 {{subst:paramtest|param="something else"}}
10452 !! html
10453 This is a test template with parameter "something else"
10454 !! end
10455
10456 !! article
10457 Template:nowikitest
10458 !! text
10459 <nowiki>'''not wiki'''</nowiki>
10460 !! endarticle
10461
10462 !! test
10463 pre-save transform: nowiki in subst (bug 1188)
10464 !! options
10465 pst
10466 !! wikitext
10467 {{subst:nowikitest}}
10468 !! html
10469 <nowiki>'''not wiki'''</nowiki>
10470 !! end
10471
10472
10473 !! article
10474 Template:commenttest
10475 !! text
10476 This template has <!-- a comment --> in it.
10477 !! endarticle
10478
10479 !! test
10480 pre-save transform: comment in subst (bug 1936)
10481 !! options
10482 pst
10483 !! wikitext
10484 {{subst:commenttest}}
10485 !! html
10486 This template has <!-- a comment --> in it.
10487 !! end
10488
10489 !! test
10490 pre-save transform: unclosed tag
10491 !! options
10492 pst noxml
10493 !! wikitext
10494 <nowiki>'''not wiki'''
10495 !! html
10496 <nowiki>'''not wiki'''
10497 !! end
10498
10499 !! test
10500 pre-save transform: mixed tag case
10501 !! options
10502 pst noxml
10503 !! wikitext
10504 <NOwiki>'''not wiki'''</noWIKI>
10505 !! html
10506 <NOwiki>'''not wiki'''</noWIKI>
10507 !! end
10508
10509 !! test
10510 pre-save transform: unclosed comment in <nowiki>
10511 !! options
10512 pst noxml
10513 !! wikitext
10514 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10515 !! html
10516 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10517 !!end
10518
10519 # Leading @ in this template definition works around a limitation
10520 # in parsoid's parserTests which otherwise strips the <span> from the
10521 # result (confusing it for a template wrapper)
10522 !! article
10523 Template:dangerous
10524 !!text
10525 @<span onmouseover="alert('crap')">Oh no</span>
10526 !!endarticle
10527
10528 !!test
10529 (confirming safety of fix for subst bug 1936)
10530 !! wikitext
10531 {{Template:dangerous}}
10532 !! html
10533 <p>@<span>Oh no</span>
10534 </p>
10535 !! end
10536
10537 !! test
10538 pre-save transform: comment containing gallery (bug 5024)
10539 !! options
10540 pst
10541 !! wikitext
10542 <!-- <gallery>data</gallery> -->
10543 !! html
10544 <!-- <gallery>data</gallery> -->
10545 !!end
10546
10547 !! test
10548 pre-save transform: comment containing extension
10549 !! options
10550 pst
10551 !! wikitext
10552 <!-- <tag>data</tag> -->
10553 !! html
10554 <!-- <tag>data</tag> -->
10555 !!end
10556
10557 !! test
10558 pre-save transform: comment containing nowiki
10559 !! options
10560 pst
10561 !! wikitext
10562 <!-- <nowiki>data</nowiki> -->
10563 !! html
10564 <!-- <nowiki>data</nowiki> -->
10565 !!end
10566
10567 !! test
10568 pre-save transform: <noinclude> in subst (bug 3298)
10569 !! options
10570 pst
10571 !! wikitext
10572 {{subst:Includes}}
10573 !! html
10574 Foobar
10575 !! end
10576
10577 !! test
10578 pre-save transform: <onlyinclude> in subst (bug 3298)
10579 !! options
10580 pst
10581 !! wikitext
10582 {{subst:Includes2}}
10583 !! html
10584 Foo
10585 !! end
10586
10587 !! article
10588 Template:SubstTest
10589 !!text
10590 {{<includeonly>subst:</includeonly>Includes}}
10591 !! endarticle
10592
10593 !! article
10594 Template:SafeSubstTest
10595 !! text
10596 {{<includeonly>safesubst:</includeonly>Includes}}
10597 !! endarticle
10598
10599 !! test
10600 bug 22297: safesubst: works during PST
10601 !! options
10602 pst
10603 !! wikitext
10604 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
10605 !! html
10606 FoobarFoobar
10607 !! end
10608
10609 !! test
10610 bug 22297: safesubst: works during normal parse
10611 !! wikitext
10612 {{SafeSubstTest}}
10613 !! html
10614 <p>Foobar
10615 </p>
10616 !! end
10617
10618 !! test
10619 subst: does not work during normal parse
10620 !! wikitext
10621 {{SubstTest}}
10622 !! html
10623 <p>{{subst:Includes}}
10624 </p>
10625 !! end
10626
10627 !! test
10628 pre-save transform: context links ("pipe trick")
10629 !! options
10630 pst
10631 !! wikitext
10632 [[Article (context)|]]
10633 [[Bar:Article|]]
10634 [[:Bar:Article|]]
10635 [[Bar:Article (context)|]]
10636 [[:Bar:Article (context)|]]
10637 [[|Article]]
10638 [[|Article (context)]]
10639 [[Bar:X (Y) Z|]]
10640 [[:Bar:X (Y) Z|]]
10641 !! html
10642 [[Article (context)|Article]]
10643 [[Bar:Article|Article]]
10644 [[:Bar:Article|Article]]
10645 [[Bar:Article (context)|Article]]
10646 [[:Bar:Article (context)|Article]]
10647 [[Article]]
10648 [[Article (context)]]
10649 [[Bar:X (Y) Z|X (Y) Z]]
10650 [[:Bar:X (Y) Z|X (Y) Z]]
10651 !! end
10652
10653 !! test
10654 pre-save transform: context links ("pipe trick") with interwiki prefix
10655 !! options
10656 pst
10657 !! wikitext
10658 [[interwiki:Article|]]
10659 [[:interwiki:Article|]]
10660 [[interwiki:Bar:Article|]]
10661 [[:interwiki:Bar:Article|]]
10662 !! html
10663 [[interwiki:Article|Article]]
10664 [[:interwiki:Article|Article]]
10665 [[interwiki:Bar:Article|Bar:Article]]
10666 [[:interwiki:Bar:Article|Bar:Article]]
10667 !! end
10668
10669 !! test
10670 pre-save transform: context links ("pipe trick") with parens in title
10671 !! options
10672 pst title=[[Somearticle (context)]]
10673 !! wikitext
10674 [[|Article]]
10675 !! html
10676 [[Article (context)|Article]]
10677 !! end
10678
10679 !! test
10680 pre-save transform: context links ("pipe trick") with comma in title
10681 !! options
10682 pst title=[[Someplace, Somewhere]]
10683 !! wikitext
10684 [[|Otherplace]]
10685 [[Otherplace, Elsewhere|]]
10686 [[Otherplace, Elsewhere, Anywhere|]]
10687 !! html
10688 [[Otherplace, Somewhere|Otherplace]]
10689 [[Otherplace, Elsewhere|Otherplace]]
10690 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
10691 !! end
10692
10693 !! test
10694 pre-save transform: context links ("pipe trick") with parens and comma
10695 !! options
10696 pst title=[[Someplace (IGNORED), Somewhere]]
10697 !! wikitext
10698 [[|Otherplace]]
10699 [[Otherplace (place), Elsewhere|]]
10700 !! html
10701 [[Otherplace, Somewhere|Otherplace]]
10702 [[Otherplace (place), Elsewhere|Otherplace]]
10703 !! end
10704
10705 !! test
10706 pre-save transform: context links ("pipe trick") with comma and parens
10707 !! options
10708 pst title=[[Who, me? (context)]]
10709 !! wikitext
10710 [[|Yes, you.]]
10711 [[Me, Myself, and I (1937 song)|]]
10712 !! html
10713 [[Yes, you. (context)|Yes, you.]]
10714 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
10715 !! end
10716
10717 !! test
10718 pre-save transform: context links ("pipe trick") with namespace
10719 !! options
10720 pst title=[[Ns:Somearticle]]
10721 !! wikitext
10722 [[|Article]]
10723 !! html
10724 [[Ns:Article|Article]]
10725 !! end
10726
10727 !! test
10728 pre-save transform: context links ("pipe trick") with namespace and parens
10729 !! options
10730 pst title=[[Ns:Somearticle (context)]]
10731 !! wikitext
10732 [[|Article]]
10733 !! html
10734 [[Ns:Article (context)|Article]]
10735 !! end
10736
10737 !! test
10738 pre-save transform: context links ("pipe trick") with namespace and comma
10739 !! options
10740 pst title=[[Ns:Somearticle, Context, Whatever]]
10741 !! wikitext
10742 [[|Article]]
10743 !! html
10744 [[Ns:Article, Context, Whatever|Article]]
10745 !! end
10746
10747 !! test
10748 pre-save transform: context links ("pipe trick") with namespace, comma and parens
10749 !! options
10750 pst title=[[Ns:Somearticle, Context (context)]]
10751 !! wikitext
10752 [[|Article]]
10753 !! html
10754 [[Ns:Article (context)|Article]]
10755 !! end
10756
10757 !! test
10758 pre-save transform: context links ("pipe trick") with namespace, parens and comma
10759 !! options
10760 pst title=[[Ns:Somearticle (IGNORED), Context]]
10761 !! wikitext
10762 [[|Article]]
10763 !! html
10764 [[Ns:Article, Context|Article]]
10765 !! end
10766
10767 !! test
10768 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
10769 !! options
10770 pst
10771 !! wikitext
10772 [[Article(context)|]]
10773 [[Bar:Article(context)|]]
10774 [[:Bar:Article(context)|]]
10775 [[|Article(context)]]
10776 [[Bar:X(Y)Z|]]
10777 [[:Bar:X(Y)Z|]]
10778 !! html
10779 [[Article(context)|Article]]
10780 [[Bar:Article(context)|Article]]
10781 [[:Bar:Article(context)|Article]]
10782 [[Article(context)]]
10783 [[Bar:X(Y)Z|X(Y)Z]]
10784 [[:Bar:X(Y)Z|X(Y)Z]]
10785 !! end
10786
10787 !! test
10788 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
10789 !! options
10790 pst
10791 !! wikitext
10792 [[Article (context)|]]
10793 [[Bar:Article (context)|]]
10794 [[:Bar:Article (context)|]]
10795 [[|Article (context)]]
10796 [[Bar:X (Y) Z|]]
10797 [[:Bar:X (Y) Z|]]
10798 !! html
10799 [[Article (context)|Article]]
10800 [[Bar:Article (context)|Article]]
10801 [[:Bar:Article (context)|Article]]
10802 [[Article (context)]]
10803 [[Bar:X (Y) Z|X (Y) Z]]
10804 [[:Bar:X (Y) Z|X (Y) Z]]
10805 !! end
10806
10807 !! test
10808 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
10809 !! options
10810 pst
10811 !! wikitext
10812 [[Article(context)|]]
10813 [[Bar:Article(context)|]]
10814 [[:Bar:Article(context)|]]
10815 [[|Article(context)]]
10816 [[Bar:X(Y)Z|]]
10817 [[:Bar:X(Y)Z|]]
10818 !! html
10819 [[Article(context)|Article]]
10820 [[Bar:Article(context)|Article]]
10821 [[:Bar:Article(context)|Article]]
10822 [[Article(context)]]
10823 [[Bar:X(Y)Z|X(Y)Z]]
10824 [[:Bar:X(Y)Z|X(Y)Z]]
10825 !! end
10826
10827 !! test
10828 pre-save transform: context links ("pipe trick") with commas (bug 21660)
10829 !! options
10830 pst
10831 !! wikitext
10832 [[Article (context), context|]]
10833 [[Article (context),context|]]
10834 [[Bar:Article (context), context|]]
10835 [[Bar:Article (context),context|]]
10836 [[:Bar:Article (context), context|]]
10837 [[:Bar:Article (context),context|]]
10838 !! html
10839 [[Article (context), context|Article]]
10840 [[Article (context),context|Article]]
10841 [[Bar:Article (context), context|Article]]
10842 [[Bar:Article (context),context|Article]]
10843 [[:Bar:Article (context), context|Article]]
10844 [[:Bar:Article (context),context|Article]]
10845 !! end
10846
10847 !! test
10848 pre-save transform: trim trailing empty lines
10849 !! options
10850 pst
10851 !! wikitext
10852 Empty lines are trimmed
10853
10854
10855
10856
10857 !! html
10858 Empty lines are trimmed
10859 !! end
10860
10861 !! test
10862 pre-save transform: Signature expansion
10863 !! options
10864 pst
10865 !! wikitext
10866 * ~~~
10867 * <noinclude>~~~</noinclude>
10868 * <includeonly>~~~</includeonly>
10869 * <onlyinclude>~~~</onlyinclude>
10870 !! html
10871 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
10872 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
10873 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
10874 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
10875 !! end
10876
10877
10878 !! test
10879 pre-save transform: Signature expansion in nowiki tags (bug 93)
10880 !! options
10881 pst disabled
10882 !! wikitext
10883 Shall not expand:
10884
10885 <nowiki>~~~~</nowiki>
10886
10887 <includeonly><nowiki>~~~~</nowiki></includeonly>
10888
10889 <noinclude><nowiki>~~~~</nowiki></noinclude>
10890
10891 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10892
10893 {{subst:Foo}} shall be converted to FOO
10894
10895 As well as inside noinclude/onlyinclude
10896 <noinclude>{{subst:Foo}}</noinclude>
10897 <onlyinclude>{{subst:Foo}}</onlyinclude>
10898
10899 But not inside includeonly
10900 <includeonly>{{subst:Foo}}</includeonly>
10901 !! html
10902 Shall not expand:
10903
10904 <nowiki>~~~~</nowiki>
10905
10906 <includeonly><nowiki>~~~~</nowiki></includeonly>
10907
10908 <noinclude><nowiki>~~~~</nowiki></noinclude>
10909
10910 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10911
10912 FOO shall be converted to FOO
10913
10914 As well as inside noinclude/onlyinclude
10915 <noinclude>FOO</noinclude>
10916 <onlyinclude>FOO</onlyinclude>
10917
10918 But not inside includeonly
10919 <includeonly>{{subst:Foo}}</includeonly>
10920 !! end
10921
10922 !! test
10923 Parsoid: Recognize nowiki with trailing space in tags
10924 !! options
10925 parsoid=wt2html
10926 !! wikitext
10927 <nowiki ><div>[[foo]]</nowiki >
10928
10929 a<nowiki / >b
10930
10931 c<nowiki />d
10932
10933 e<nowiki/ >f
10934 !! html
10935 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10936 <p>ab</p>
10937 <p>cd</p>
10938 <p>ef</p>
10939 !! end
10940
10941 !! test
10942 Parsoid: Recognize nowiki with odd capitalization
10943 !! options
10944 parsoid=wt2html
10945 !! wikitext
10946 <noWikI ><div>[[foo]]</Nowiki >
10947 !! html
10948 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10949 !! end
10950
10951
10952 !! test
10953 Parsoid: Escape nowiki with trailing space in tags
10954 !! options
10955 parsoid=html2wt
10956 !! wikitext
10957 &lt;nowiki &gt; foo &lt;/nowiki &gt;
10958
10959 a&lt;nowiki /&gt;b
10960
10961 c&lt;nowiki/ &gt;d
10962 !! html
10963 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
10964 <p>a&lt;nowiki /&gt;b</p>
10965 <p>c&lt;nowiki/ &gt;d</p>
10966 !! end
10967
10968 !! test
10969 Parsoid: Escape weird noWikI capitalizations
10970 !! options
10971 parsoid=html2wt
10972 !! wikitext
10973 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
10974 !! html
10975 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
10976 !! end
10977
10978 ###
10979 ### Message transform tests
10980 ###
10981 !! test
10982 message transform: magic variables
10983 !! options
10984 msg
10985 !! wikitext
10986 {{SITENAME}}
10987 !! html
10988 MediaWiki
10989 !! end
10990
10991 !! test
10992 message transform: should not transform wiki markup
10993 !! options
10994 msg
10995 !! wikitext
10996 ''test''
10997 !! html
10998 ''test''
10999 !! end
11000
11001 !! test
11002 message transform: <noinclude> in transcluded template (bug 4926)
11003 !! options
11004 msg
11005 !! wikitext
11006 {{Includes}}
11007 !! html
11008 Foobar
11009 !! end
11010
11011 !! test
11012 message transform: <onlyinclude> in transcluded template (bug 4926)
11013 !! options
11014 msg
11015 !! wikitext
11016 {{Includes2}}
11017 !! html
11018 Foo
11019 !! end
11020
11021 !! test
11022 {{#special:}} page name, known
11023 !! options
11024 msg
11025 !! wikitext
11026 {{#special:Recentchanges}}
11027 !! html
11028 Special:RecentChanges
11029 !! end
11030
11031 !! test
11032 {{#special:}} page name with subpage, known
11033 !! options
11034 msg
11035 !! wikitext
11036 {{#special:Recentchanges/param}}
11037 !! html
11038 Special:RecentChanges/param
11039 !! end
11040
11041 !! test
11042 {{#special:}} page name, unknown
11043 !! options
11044 msg
11045 !! wikitext
11046 {{#special:foobar nonexistent}}
11047 !! html
11048 Special:Foobar nonexistent
11049 !! end
11050
11051 !! test
11052 {{#speciale:}} page name, known
11053 !! options
11054 msg
11055 !! wikitext
11056 {{#speciale:Recentchanges}}
11057 !! html
11058 Special:RecentChanges
11059 !! end
11060
11061 !! test
11062 {{#speciale:}} page name with subpage, known
11063 !! options
11064 msg
11065 !! wikitext
11066 {{#speciale:Recentchanges/param}}
11067 !! html
11068 Special:RecentChanges/param
11069 !! end
11070
11071 !! test
11072 {{#speciale:}} page name, unknown
11073 !! options
11074 msg
11075 !! wikitext
11076 {{#speciale:foobar nonexistent}}
11077 !! html
11078 Special:Foobar_nonexistent
11079 !! end
11080
11081 ###
11082 ### Images
11083 ###
11084 ### For Parsoid-specific tests, see
11085 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11086
11087 !! test
11088 Simple image
11089 !! options
11090 parsoid=wt2html,wt2wt,html2html
11091 !! wikitext
11092 [[Image:foobar.jpg]]
11093 !! html/php
11094 <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>
11095 </p>
11096 !! html/parsoid
11097 <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>
11098 !! end
11099
11100 !! test
11101 Simple image (using File: namespace, now canonical)
11102 !! wikitext
11103 [[File:Foobar.jpg]]
11104 !! html/php
11105 <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>
11106 </p>
11107 !! html/parsoid
11108 <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>
11109 !! end
11110
11111 !! test
11112 Right-aligned image
11113 !! wikitext
11114 [[File:Foobar.jpg|right]]
11115 !! html/php
11116 <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>
11117
11118 !! html/parsoid
11119 <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>
11120 !! end
11121
11122 !! test
11123 Image with caption
11124 !! wikitext
11125 [[File:Foobar.jpg|right|Caption text]]
11126 !! html/php
11127 <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>
11128
11129 !! html/parsoid
11130 <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>
11131 !! end
11132
11133 !! test
11134 Image with caption, bug 53312 #1
11135 !! wikitext
11136 [[File:Foobar.jpg|right|Caption page stuff]]
11137 !! html/php
11138 <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>
11139
11140 !! html/parsoid
11141 <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>
11142 !! end
11143
11144 !! test
11145 Image with caption, bug 53312 #2
11146 !! wikitext
11147 [[File:Foobar.jpg|right|Caption page=]]
11148 !! html/php
11149 <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>
11150
11151 !! html/parsoid
11152 <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>
11153 !! end
11154
11155 !! test
11156 Image with caption, bug 53312 #3
11157 !! wikitext
11158 [[File:Foobar.jpg|right|Caption page=stuff]]
11159 !! html/php
11160 <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>
11161
11162 !! html/parsoid
11163 <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>
11164 !! end
11165
11166 !! test
11167 Allow empty links in image captions (Bug 60753)
11168 !! options
11169 thumbsize=220
11170 !! wikitext
11171 [[File:Foobar.jpg|thumb|Caption [[Link1]]
11172 [[]]
11173 [[Link2]]
11174 ]]
11175 !! html/php
11176 <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>
11177
11178 !! html/parsoid
11179 <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>
11180 [[]]
11181 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
11182 </figcaption></figure>
11183 !! end
11184
11185 !! test
11186 Link with empty target
11187 !! wikitext
11188 [[]]
11189 !! html
11190 <p>[[]]
11191 </p>
11192 !! end
11193
11194 !! test
11195 Image with empty attribute
11196 !! options
11197 parsoid=wt2html,wt2wt,html2html
11198 !! wikitext
11199 [[File:Foobar.jpg|right||Caption text]]
11200 !! html/php
11201 <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>
11202
11203 !! html/parsoid
11204 <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>
11205 !! end
11206
11207 !! test
11208 1. Block image with individual attributes from templates
11209 !! wikitext
11210 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
11211 !! html/php
11212 <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>
11213
11214 !! html/parsoid
11215 <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>
11216 !! end
11217
11218 !! test
11219 2. Block Image with individual attributes from templates
11220 !! wikitext
11221 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
11222 !! html/php
11223 <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>
11224
11225 !! html/parsoid
11226 <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>
11227 !! end
11228
11229 !! test
11230 3. Inline image with individual attributes from templates
11231 !! wikitext
11232 [[File:Foobar.jpg|{{echo|50px}}]]
11233 !! html/php
11234 <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>
11235 </p>
11236 !! html/parsoid
11237 <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>
11238 !! end
11239
11240 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
11241 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
11242 !! test
11243 Image with multiple attributes from the same template
11244 !! wikitext
11245 [[File:Foobar.jpg|{{image_attribs}}]]
11246 !! html/php
11247 <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>
11248
11249 !! html/parsoid
11250 <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>
11251 !! end
11252
11253 !! test
11254 Image with link tails
11255 !! options
11256 thumbsize=220
11257 !! wikitext
11258 123[[File:Foobar.jpg]]456
11259 123[[File:Foobar.jpg|right]]456
11260 123[[File:Foobar.jpg|thumb]]456
11261 !! html/php
11262 <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
11263 </p>
11264 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
11265 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
11266
11267 !! html/php+tidy
11268 <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>
11269 <p>123</p>
11270 <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>
11271 <p>456 123</p>
11272 <div class="thumb tright">
11273 <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>
11274 <div class="thumbcaption">
11275 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11276 </div>
11277 </div>
11278 </div>
11279 <p>456</p>
11280 !! html/parsoid
11281 <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>
11282 <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>
11283 <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>
11284 !! end
11285
11286 !! test
11287 Image with multiple captions -- only last one is accepted
11288 !! wikitext
11289 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11290 !! html/php
11291 <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>
11292
11293 !! html/parsoid
11294 <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>
11295 !! end
11296
11297 !! test
11298 Image with multiple widths -- use last
11299 !! wikitext
11300 [[File:Foobar.jpg|200px|300px|caption]]
11301 !! html/php
11302 <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>
11303 </p>
11304 !! html/parsoid
11305 <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>
11306 !! end
11307
11308 !! test
11309 Image with multiple alignments -- use first (bug 48664)
11310 !! options
11311 thumbsize=220
11312 !! wikitext
11313 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11314
11315 [[File:Foobar.jpg|middle|text-top|caption]]
11316 !! html/php
11317 <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>
11318 <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>
11319 </p>
11320 !! html/parsoid
11321 <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>
11322 <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>
11323 !! end
11324
11325 !! test
11326 Image with width attribute at different positions
11327 !! wikitext
11328 [[File:Foobar.jpg|200px|right|Caption]]
11329 [[File:Foobar.jpg|right|200px|Caption]]
11330 [[File:Foobar.jpg|right|Caption|200px]]
11331 !! html/php
11332 <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>
11333 <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>
11334 <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>
11335
11336 !! html/parsoid
11337 <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>
11338 <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>
11339 <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>
11340 !! end
11341
11342 # a sad bit of backward-compatibility
11343 !! test
11344 Image with size specified with pxpx (bug 13500, 51628)
11345 !! options
11346 parsoid=wt2html,wt2wt,html2html
11347 !! wikitext
11348 [[File:Foobar.jpg|20pxpx]]
11349 [[File:Foobar.jpg|200x20pxpx]]
11350 !! html/php
11351 <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>
11352 <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>
11353 </p>
11354 !! html/parsoid
11355 <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>
11356 !! end
11357
11358 !! test
11359 Image with link parameter, wiki target
11360 !! wikitext
11361 [[File:Foobar.jpg|link=Main Page]]
11362 !! html/php
11363 <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>
11364 </p>
11365 !! html/parsoid
11366 <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>
11367 !! end
11368
11369 # parsoid bug 49293 (part 1)
11370 !! test
11371 Image with link parameter, URL target
11372 !! wikitext
11373 [[File:Foobar.jpg|link=http://example.com/]]
11374 !! html/php
11375 <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>
11376 </p>
11377 !! html/parsoid
11378 <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>
11379 !! end
11380
11381 # parsoid bug 49293 (part 2)
11382 !! test
11383 Image with link parameter, protocol-less URL target
11384 !! wikitext
11385 [[File:Foobar.jpg|link=//example.com/]]
11386 !! html/php
11387 <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>
11388 </p>
11389 !! html/parsoid
11390 <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>
11391 !! end
11392
11393 !! test
11394 Image with link parameter, wgExternalLinkTarget
11395 !! wikitext
11396 [[Image:foobar.jpg|link=http://example.com/]]
11397 !! config
11398 wgExternalLinkTarget='foobar'
11399 !! html
11400 <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>
11401 </p>
11402 !! end
11403
11404 !! test
11405 Image with link parameter, wgNoFollowLinks set to false
11406 !! wikitext
11407 [[Image:foobar.jpg|link=http://example.com/]]
11408 !! config
11409 wgNoFollowLinks=false
11410 !! html
11411 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11412 </p>
11413 !! end
11414
11415 !! test
11416 Image with link parameter, wgNoFollowDomainExceptions
11417 !! wikitext
11418 [[Image:foobar.jpg|link=http://example.com/]]
11419 !! config
11420 wgNoFollowDomainExceptions='example.com'
11421 !! html
11422 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11423 </p>
11424 !! end
11425
11426 !! test
11427 Image with link parameter, wgExternalLinkTarget, unnamed parameter
11428 !! wikitext
11429 [[Image:foobar.jpg|link=http://example.com/|Title]]
11430 !! config
11431 wgExternalLinkTarget='foobar'
11432 !! html
11433 <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>
11434 </p>
11435 !! end
11436
11437 !! test
11438 Image with empty link parameter
11439 !! wikitext
11440 [[File:Foobar.jpg|link=]]
11441 !! html/php
11442 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
11443 </p>
11444 !! html/parsoid
11445 <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>
11446 !! end
11447
11448 !! test
11449 Image with link parameter (wiki target) and unnamed parameter
11450 !! wikitext
11451 [[File:Foobar.jpg|link=Main_Page|Title]]
11452 !! html/php
11453 <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>
11454 </p>
11455 !! html/parsoid
11456 <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>
11457 !! end
11458
11459 !! test
11460 Image with link parameter (URL target) and unnamed parameter
11461 !! wikitext
11462 [[File:Foobar.jpg|link=http://example.com/|Title]]
11463 !! html/php
11464 <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>
11465 </p>
11466 !! html/parsoid
11467 <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>
11468 !! end
11469
11470 !! test
11471 Thumbnail image with link parameter
11472 !! options
11473 thumbsize=220
11474 parsoid=wt2html,wt2wt,html2html
11475 !! wikitext
11476 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
11477 !! html/php
11478 <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>
11479
11480 !! html/parsoid
11481 <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>
11482 !! end
11483
11484 !! test
11485 Manually-specified thumbnail image
11486 !! options
11487 thumbsize=220
11488 !! wikitext
11489 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
11490 !! html/php
11491 <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>
11492
11493 !! html/parsoid
11494 <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>
11495 !! end
11496
11497 !! test
11498 Manually-specified thumbnail image with explicit link to wiki page
11499 !! options
11500 thumbsize=220
11501 parsoid=wt2html,wt2wt,html2html
11502 !! wikitext
11503 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
11504 !! html/php
11505 <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>
11506
11507 !! html/parsoid
11508 <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>
11509 !! end
11510
11511 !! test
11512 Manually-specified thumbnail image with explicit link to url
11513 !! options
11514 thumbsize=220
11515 parsoid=wt2html,wt2wt,html2html
11516 !! wikitext
11517 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
11518 !! html/php
11519 <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>
11520
11521 !! html/parsoid
11522 <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>
11523 !! end
11524
11525 !! test
11526 Manually-specified thumbnail image with explicit no link
11527 !! options
11528 thumbsize=220
11529 parsoid=wt2html,wt2wt,html2html
11530 !! wikitext
11531 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
11532 !! html/php
11533 <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>
11534
11535 !! html/parsoid
11536 <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>
11537 !! end
11538
11539 !! test
11540 Manually-specified thumbnail image with explicit link and alt text
11541 !! options
11542 thumbsize=220
11543 parsoid=wt2html,wt2wt,html2html
11544 !! wikitext
11545 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
11546 !! html/php
11547 <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>
11548
11549 !! html/parsoid
11550 <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>
11551 !! end
11552
11553 !! test
11554 Image with frame and link
11555 !! options
11556 parsoid=wt2html,wt2wt,html2html
11557 !! wikitext
11558 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
11559 !! html/php
11560 <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>
11561
11562 !! html/parsoid
11563 <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>
11564 !! end
11565
11566 !! test
11567 Image with frame and link and explicit alt
11568 !! options
11569 parsoid=wt2html,wt2wt,html2html
11570 !! wikitext
11571 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
11572 !! html/php
11573 <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>
11574
11575 !! html/parsoid
11576 <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>
11577 !! end
11578
11579 !! test
11580 Image with wiki markup in implicit alt
11581 !! options
11582 parsoid=wt2html,wt2wt,html2html
11583 !! wikitext
11584 [[Image:Foobar.jpg|testing '''bold''' in alt]]
11585
11586 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
11587 !! html/php
11588 <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>
11589 </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>
11590 </p>
11591 !! html/parsoid
11592 <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>
11593 <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>
11594 !! end
11595
11596 ###################
11597 # Conflicting image format options.
11598 # First option specified should 'win'.
11599 # All three cases in each test should be identical.
11600
11601 !! test
11602 Image with 'frameless' first.
11603 !! options
11604 parsoid=wt2html,wt2wt,html2html
11605 !! wikitext
11606 [[File:Foobar.jpg|frameless|caption]]
11607
11608 [[File:Foobar.jpg|frameless|frame|caption]]
11609
11610 [[File:Foobar.jpg|frameless|thumb|caption]]
11611 !! html/php
11612 <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>
11613 </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>
11614 </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>
11615 </p>
11616 !! html/parsoid
11617 <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>
11618 <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>
11619 <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>
11620 !! end
11621
11622 !! test
11623 Image with 'frame' first.
11624 !! options
11625 parsoid=wt2html,wt2wt,html2html
11626 !! wikitext
11627 [[File:Foobar.jpg|frame|caption]]
11628 [[File:Foobar.jpg|frame|frameless|caption]]
11629 [[File:Foobar.jpg|frame|thumb|caption]]
11630 !! html/php
11631 <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>
11632 <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>
11633 <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>
11634
11635 !! html/parsoid
11636 <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>
11637 <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>
11638 <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>
11639 !! end
11640
11641 !! test
11642 Image with 'thumb' first.
11643 !! options
11644 parsoid=wt2html,wt2wt,html2html
11645 !! wikitext
11646 [[File:Foobar.jpg|thumb|caption]]
11647 [[File:Foobar.jpg|thumb|frameless|caption]]
11648 [[File:Foobar.jpg|thumb|frame|caption]]
11649 !! html/php
11650 <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>
11651 <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>
11652 <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>
11653
11654 !! html/parsoid
11655 <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>
11656 <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>
11657 <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>
11658 !! end
11659
11660 ###################
11661 # Image sizing.
11662 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
11663 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
11664 # Foobar has actual size of 1941x220
11665 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
11666 # a scalable format.
11667 # 2. Framed images always ignore size options; always render at default size.
11668 # 3. "Unspecified format" and border are the only types which can be
11669 # enlarged.
11670
11671 !! test
11672 Image: "unspecified format" and border enlarge
11673 !! options
11674 parsoid=wt2html,wt2wt,html2html
11675 !! wikitext
11676 [[File:Foobar.jpg|2000px]]
11677
11678 [[File:Foobar.jpg|border|2000px]]
11679 !! html/php
11680 <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>
11681 </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>
11682 </p>
11683 !! html/parsoid
11684 <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>
11685 <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>
11686 !! end
11687
11688 !! test
11689 Image: "unspecified format" and border reduce
11690 !! options
11691 parsoid=wt2html,wt2wt,html2html
11692 !! wikitext
11693 [[File:Foobar.jpg|1000px]]
11694
11695 [[File:Foobar.jpg|border|1000px]]
11696 !! html/php
11697 <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>
11698 </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>
11699 </p>
11700 !! html/parsoid
11701 <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>
11702 <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>
11703 !! end
11704
11705 !! test
11706 Image: thumbs reduce
11707 !! options
11708 parsoid=wt2html,wt2wt,html2html
11709 !! wikitext
11710 [[File:Foobar.jpg|thumb|50px]]
11711 !! html/php
11712 <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>
11713
11714 !! html/parsoid
11715 <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>
11716 !! end
11717
11718 !! test
11719 Image: bitmap thumbs can't be enlarged past original size, but vector can.
11720 !! options
11721 parsoid=wt2html,wt2wt,html2html
11722 !! wikitext
11723 [[File:Foobar.jpg|thumb|2000px]]
11724
11725 [[File:Foobar.svg|thumb|2000px]]
11726 !! html/php
11727 <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>
11728 <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>
11729
11730 !! html/parsoid
11731 <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>
11732 <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>
11733 !! end
11734
11735 !! test
11736 Image: frameless can reduce in size
11737 !! options
11738 parsoid=wt2html,wt2wt,html2html
11739 !! wikitext
11740 [[File:Foobar.jpg|frameless|50px]]
11741 !! html/php
11742 <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>
11743 </p>
11744 !! html/parsoid
11745 <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>
11746 !! end
11747
11748 !! test
11749 Image: bitmap frameless can't be enlarged past original size, but vector can
11750 !! options
11751 parsoid=wt2html,wt2wt,html2html
11752 !! wikitext
11753 [[File:Foobar.jpg|frameless|2000px]]
11754
11755 [[File:Foobar.svg|frameless|2000px]]
11756 !! html/php
11757 <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>
11758 </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>
11759 </p>
11760 !! html/parsoid
11761 <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>
11762 <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>
11763 !! end
11764
11765 !! test
11766 Image: framed images are always unscaled.
11767 !! options
11768 parsoid=wt2html,wt2wt,html2html
11769 !! wikitext
11770 [[File:Foobar.jpg|frame]]
11771
11772 [[File:Foobar.jpg|frame|50px]]
11773
11774 [[File:Foobar.jpg|frame|50x50px]]
11775
11776 [[File:Foobar.jpg|frame|2000px]]
11777 !! html/php
11778 <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>
11779 <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>
11780 <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>
11781 <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>
11782
11783 !! html/parsoid
11784 <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>
11785 <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>
11786 <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>
11787 <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>
11788 !! end
11789
11790 ###################
11791
11792 !! test
11793 Link to image page- image page normally doesn't exists, hence edit link
11794 Add test with existing image page
11795 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
11796 !! wikitext
11797 [[:Image:test]]
11798 !! html
11799 <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>
11800 </p>
11801 !! end
11802
11803 !! test
11804 bug 18784 Link to non-existent image page with caption should use caption as link text
11805 !! wikitext
11806 [[:Image:test|caption]]
11807 !! html
11808 <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>
11809 </p>
11810 !! end
11811
11812 !! test
11813 Frameless image caption with a free URL
11814 !! wikitext
11815 [[File:Foobar.jpg|http://example.com]]
11816 !! html/php
11817 <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>
11818 </p>
11819 !! html/parsoid
11820 <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>
11821 !! end
11822
11823 !! test
11824 Thumbnail image caption with a free URL
11825 !! options
11826 thumbsize=220
11827 !! wikitext
11828 [[File:Foobar.jpg|thumb|http://example.com]]
11829 !! html/php
11830 <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>
11831
11832 !! html/parsoid
11833 <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>
11834 !! end
11835
11836 !! test
11837 Thumbnail image caption with a free URL and explicit alt
11838 !! options
11839 thumbsize=220
11840 parsoid=wt2html,wt2wt,html2html
11841 !! wikitext
11842 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
11843 !! html/php
11844 <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>
11845
11846 !! html/parsoid
11847 <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>
11848 !! end
11849
11850 !! test
11851 SVG thumbnails with no language set
11852 !! options
11853 !! wikitext
11854 [[File:Foobar.svg|thumb|caption]]
11855 !! html/php
11856 <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>
11857
11858 !! html/parsoid
11859 <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>
11860 !! end
11861
11862 !! test
11863 SVG thumbnails with language de
11864 !! options
11865 parsoid=wt2html,wt2wt,html2html
11866 !! wikitext
11867 [[File:Foobar.svg|thumb|caption|lang=de]]
11868 !! html/php
11869 <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>
11870
11871 !! html/parsoid
11872 <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>
11873 !! end
11874
11875 !! test
11876 SVG thumbnails with invalid language code
11877 !! options
11878 parsoid=wt2html,wt2wt,html2html
11879 !! wikitext
11880 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
11881 !! html/php
11882 <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>
11883
11884 !! html/parsoid
11885 <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>
11886 !! end
11887
11888 !! test
11889 BUG 1887: A ISBN with a thumbnail
11890 !! wikitext
11891 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
11892 !! html/php
11893 <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>
11894
11895 !! html/parsoid
11896 <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>
11897 !! end
11898
11899 !! test
11900 BUG 1887: A RFC with a thumbnail
11901 !! wikitext
11902 [[File:Foobar.jpg|thumb|This is RFC 12354]]
11903 !! html/php
11904 <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>
11905
11906 !! html/parsoid
11907 <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>
11908 !! end
11909
11910 !! test
11911 BUG 1887: A mailto link with a thumbnail
11912 !! wikitext
11913 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
11914 !! html/php
11915 <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>
11916
11917 !! html/parsoid
11918 <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>
11919 !! end
11920
11921 # Pending resolution to bug 368
11922 !! test
11923 BUG 648: Frameless image caption with a link
11924 !! wikitext
11925 [[File:Foobar.jpg|text with a [[link]] in it]]
11926 !! html/php
11927 <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>
11928 </p>
11929 !! html/parsoid
11930 <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>
11931 !! end
11932
11933 !! test
11934 BUG 648: Frameless image caption with a link (suffix)
11935 !! wikitext
11936 [[File:Foobar.jpg|text with a [[link]]foo in it]]
11937 !! html/php
11938 <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>
11939 </p>
11940 !! html/parsoid
11941 <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>
11942 !! end
11943
11944 !! test
11945 BUG 648: Frameless image caption with an interwiki link
11946 !! wikitext
11947 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
11948 !! html/php
11949 <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>
11950 </p>
11951 !! html/parsoid
11952 <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>
11953 !! end
11954
11955 !! test
11956 BUG 648: Frameless image caption with a piped interwiki link
11957 !! wikitext
11958 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
11959 !! html/php
11960 <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>
11961 </p>
11962 !! html/parsoid
11963 <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>
11964 !! end
11965
11966 !! test
11967 Escape HTML special chars in image alt text
11968 !! wikitext
11969 [[File:Foobar.jpg|& < > "]]
11970 !! html/php
11971 <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>
11972 </p>
11973 !! html/parsoid
11974 <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>
11975 !! end
11976
11977 !! test
11978 BUG 499: Alt text should have &#1234;, not &amp;1234;
11979 !! wikitext
11980 [[File:Foobar.jpg|&#9792;]]
11981 !! html/php
11982 <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>
11983 </p>
11984 !! html/parsoid
11985 <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>
11986 !! end
11987
11988 !! test
11989 Broken image caption with link
11990 !! options
11991 parsoid=wt2html,wt2wt,html2html
11992 !! wikitext
11993 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
11994 !! html/php
11995 <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.
11996 </p>
11997 !! html/parsoid
11998 <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>
11999 !! end
12000
12001 !! test
12002 Image caption containing another image
12003 !! wikitext
12004 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
12005 !! html/php
12006 <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>
12007
12008 !! html/parsoid
12009 <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>
12010 !! end
12011
12012 !! test
12013 Image: caption containing a newline
12014 !! wikitext
12015 [[File:Foobar.jpg|This
12016 *is some text]]
12017 !! html/php
12018 <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>
12019 </p>
12020 !! html/parsoid
12021 <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>
12022 !!end
12023
12024 !!test
12025 Image: caption containing leading space
12026 (The leading space should not trigger nowiki escaping in wt2wt mode)
12027 !! wikitext
12028 [[File:Foobar.jpg|thumb| bar]]
12029 !! html/php
12030 <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>
12031
12032 !! html/parsoid
12033 <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>
12034 !!end
12035
12036 !! test
12037 Image: caption containing a table
12038 !! options
12039 parsoid=wt2html,wt2wt,html2html
12040 !! wikitext
12041 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
12042 {|
12043 ! Foo !! Bar
12044 |-
12045 | Foo1 || Bar1
12046 |}
12047 and some more text.]]
12048 !! html/php
12049 <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>
12050
12051 !! html/parsoid
12052 <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
12053 <table>
12054 <tbody>
12055 <tr><th>Foo </th><th>Bar</th></tr>
12056 <tr>
12057 <td>Foo1 </td>
12058 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
12059 !! end
12060
12061 !! test
12062 Bug 3090: External links other than http: in image captions
12063 !! wikitext
12064 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
12065 !! html/php
12066 <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>
12067
12068 !! html/parsoid
12069 <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>
12070 !! end
12071
12072 !! test
12073 Custom class
12074 !! options
12075 parsoid=wt2html,wt2wt,html2html
12076 !! wikitext
12077 [[Image:foobar.jpg|a|class=b]]
12078 !! html/php
12079 <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>
12080 </p>
12081 !! html/parsoid
12082 <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>
12083 !! end
12084
12085 !! test
12086 Localized image handling (1).
12087 !! options
12088 parsoid=wt2html,wt2wt,html2html
12089 language=es
12090 !! wikitext
12091 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
12092 !! html/php
12093 <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>
12094
12095 !! html/parsoid
12096 <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>
12097 !! end
12098
12099 !! test
12100 Localized image handling (2).
12101 !! options
12102 thumbsize=220
12103 parsoid=wt2html,wt2wt,html2html
12104 language=es
12105 !! wikitext
12106 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
12107 !! html/php
12108 <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>
12109
12110 !! html/parsoid
12111 <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>
12112 !! end
12113
12114 !! test
12115 "border", "frameless" and "class" attributes on an image.
12116 !! options
12117 thumbsize=220
12118 parsoid=wt2html,wt2wt,html2html
12119 !! wikitext
12120 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
12121 !! html/php
12122 <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>
12123 </p>
12124 !! html/parsoid
12125 <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>
12126 !! end
12127
12128 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
12129 !! test
12130 Invalid image attributes (bug 62500)
12131 !! options
12132 thumbsize=220
12133 parsoid=wt2html,wt2wt,html2html
12134 !! wikitext
12135 [[File:Foobar.jpg|thumb|float|left|caption]]
12136
12137 [[File:Foobar.jpg|thumb|righ|caption]]
12138
12139 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
12140 !! html/php
12141 <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>
12142 <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>
12143 <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>
12144
12145 !! html/parsoid
12146 <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>
12147 <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>
12148 <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>
12149 !! end
12150
12151 !! article
12152 File:Barfoo.jpg
12153 !! text
12154 #REDIRECT [[File:Barfoo.jpg]]
12155 !! endarticle
12156
12157 !! test
12158 Redirected image
12159 !! wikitext
12160 [[Image:Barfoo.jpg]]
12161 !! html
12162 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
12163 </p>
12164 !! end
12165
12166 !! test
12167 Missing image with uploads disabled
12168 !! options
12169 wgEnableUploads=0
12170 !! wikitext
12171 [[Image:Foobaz.jpg]]
12172 !! html
12173 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
12174 </p>
12175 !! end
12176
12177 # Parsoid-specific testing for images
12178 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12179 # Currently imperfect due to a flaw in the Parsoid testrunner
12180 # Work in progress
12181 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
12182 # image tests.
12183
12184 !! test
12185 Parsoid-specific image handling - simple image with size and middle alignment
12186 !! wikitext
12187 [[File:Foobar.jpg|middle|50px]]
12188 !! html/parsoid
12189 <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>
12190 !! end
12191
12192 !! test
12193 Parsoid-specific image handling - simple image with size, middle alignment,
12194 non-standard namespace alias
12195 !! options
12196 parsoid=wt2wt,wt2html,html2html
12197 !! wikitext
12198 [[Image:Foobar.jpg|middle|50px]]
12199 !! html/parsoid
12200 <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>
12201 !! end
12202
12203 !! test
12204 Parsoid-specific image handling - simple image with size and middle alignment
12205 (existing content)
12206 !! wikitext
12207 [[File:Foobar.jpg|50px|middle]]
12208 !! html/parsoid
12209 <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>
12210 !! end
12211
12212 !! test
12213 Parsoid-specific image handling - simple image with size and middle alignment
12214 and non-standard namespace name
12215 !! options
12216 parsoid=wt2html,wt2wt,html2html
12217 !! wikitext
12218 [[Image:Foobar.jpg|50px|middle]]
12219 !! html/parsoid
12220 <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>
12221 !! end
12222
12223 !! test
12224 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
12225 !! wikitext
12226 [[File:Foobar.jpg|500x10px|baseline|caption]]
12227 !! html/parsoid
12228 <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>
12229 !! end
12230
12231 !! test
12232 Parsoid-specific image handling - simple image with border and size spec
12233 !! wikitext
12234 [[File:Foobar.jpg|50px|border|caption]]
12235 !! html/parsoid
12236 <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>
12237 !! end
12238
12239 !! test
12240 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12241 !! wikitext
12242 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
12243 !! html/parsoid
12244 <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>
12245 !! end
12246
12247 !! test
12248 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12249 (existing content)
12250 !! wikitext
12251 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12252 !! html/parsoid
12253 <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>
12254 !! end
12255
12256 !! test
12257 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12258 !! wikitext
12259 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12260 !! html/parsoid
12261 <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>
12262 !! end
12263
12264 !! test
12265 Parsoid-specific image handling - thumbnail with specific size, halign,
12266 valign, and caption (existing content)
12267 !! wikitext
12268 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12269 !! html/parsoid
12270 <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>
12271 !! end
12272
12273 !! test
12274 Parsoid-specific image handling - framed image with specific size and caption
12275 (size is ignored)
12276 !! options
12277 parsoid=wt2html,wt2wt,html2html
12278 !! wikitext
12279 [[File:Foobar.jpg|frame|500x50px|caption]]
12280 !! html/parsoid
12281 <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>
12282 !! end
12283
12284 !! test
12285 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12286 (size is ignored)
12287 !! options
12288 parsoid=wt2html,wt2wt,html2html
12289 !! wikitext
12290 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12291 !! html/parsoid
12292 <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>
12293 !! end
12294
12295 !! test
12296 Parsoid-specific image handling - frameless image with specific size, border, and caption
12297 !! wikitext
12298 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12299 !! html/parsoid
12300 <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>
12301 !! end
12302
12303 !! test
12304 Parsoid-specific image handling - simple image with a formatted caption
12305 !! wikitext
12306 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12307 !! html/parsoid
12308 <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>
12309 !! end
12310
12311 !! test
12312 Parsoid-specific image handling - caption with a template in it
12313 !! wikitext
12314 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12315 !! html/parsoid
12316 <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>
12317 !! end
12318
12319 !! test
12320 Parsoid-specific image handling - caption with unbalanced tags in it
12321 !! options
12322 parsoid=wt2html,wt2wt,html2html
12323 !! wikitext
12324 foo
12325 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12326 bar
12327 !! html/parsoid
12328 <p>foo</p>
12329 <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>
12330 <p>bar</p>
12331 !! end
12332
12333 !! test
12334 Parsoid-specific image handling - empty caption (1)
12335 !! options
12336 parsoid=wt2html,wt2wt
12337 !! wikitext
12338 [[File:Foobar.jpg|thumb|]]
12339 !! html/parsoid
12340 <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>
12341 !! end
12342
12343 # empty captions don't get serialized unless we're in the "round trip" case
12344 !! test
12345 Parsoid-specific image handling - empty caption (2)
12346 !! options
12347 parsoid=html2wt
12348 !! html/parsoid
12349 <figure class="mw-default-size" typeof="mw:Image/Thumb">
12350 <a href="File:Foobar.jpg">
12351 <img resource="./File:Foobar.jpg"
12352 src="//example.com/images/3/3a/Foobar.jpg"
12353 height="25" width="220"/>
12354 </a>
12355 <figcaption></figcaption>
12356 </figure>
12357 !! wikitext
12358 [[File:Foobar.jpg|thumb]]
12359 !! end
12360
12361 !! test
12362 Parsoid-specific image handling - whitespace caption
12363 !! wikitext
12364 [[File:Foobar.jpg|thumb| ]]
12365 !! html/parsoid
12366 <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>
12367 !! end
12368
12369 !! test
12370 Parsoid-specific image handling - lang option
12371 !! wikitext
12372 foo
12373 [[File:Foobar.svg|lang=de|caption]]
12374 bar
12375 !! html/parsoid
12376 <p>foo
12377 <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>
12378 bar</p>
12379 !! end
12380
12381
12382 ###
12383 ### Subpages
12384 ###
12385 !! article
12386 Subpage test/subpage
12387 !! text
12388 foo
12389 !! endarticle
12390
12391 !! test
12392 Subpage link
12393 !! options
12394 subpage title=[[Subpage test]]
12395 !! wikitext
12396 [[/subpage]]
12397 !! html
12398 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
12399 </p>
12400 !! end
12401
12402 !! test
12403 Subpage noslash link
12404 !! options
12405 subpage title=[[Subpage test]]
12406 !! wikitext
12407 [[/subpage/]]
12408 !! html
12409 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
12410 </p>
12411 !! end
12412
12413 # TODO: make this PHP-parser compatible!
12414 !! test
12415 Relative subpage noslash link
12416 !! options
12417 parsoid=wt2wt,wt2html,html2html
12418 subpage title=[[Subpage test/1/2/3/4]]
12419 !! wikitext
12420 [[../../subpage/]]
12421
12422 [[../../subpage]]
12423 !! html
12424 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/" title="Subpage test/1/2/subpage/">subpage</a></p>
12425 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
12426 !! end
12427
12428 !! test
12429 Parsoid: dot-slash prefixed wikilinks
12430 !! wikitext
12431 [[./foo]]
12432
12433 [[././bar]]
12434
12435 [[././baz/]]
12436 !! html/php
12437 <p>[[./foo]]
12438 </p><p>[[././bar]]
12439 </p><p>[[././baz/]]
12440 </p>
12441 !! html/parsoid
12442 <p>[[./foo]]
12443 </p><p>[[././bar]]
12444 </p><p>[[././baz/]]
12445 </p>
12446 !! end
12447
12448 !! test
12449 Render invalid page names as plain text (bug 51090)
12450 !! wikitext
12451 [[./../foo|bar]]
12452 [[foo�|bar]]
12453 [[foo/.|bar]]
12454 [[foo/..|bar]]
12455 [[foo~~~bar]]
12456 [[foo>bar]]
12457 [[foo[bar]]
12458 [[.]]
12459 [[..]]
12460 [[foo././bar]]
12461
12462 [[{{echo|./../foo}}|bar]]
12463 [[{{echo|foo/.}}|bar]]
12464 [[{{echo|foo/..}}|bar]]
12465 [[{{echo|foo~~~~bar}}]]
12466 [[{{echo|foo>bar}}]]
12467 [[{{echo|foo././bar}}]]
12468 [[{{echo|foo{bar}}]]
12469 [[{{echo|foo}bar}}]]
12470 [[{{echo|foo[bar}}]]
12471 [[{{echo|foo]bar}}]]
12472 [[{{echo|foo<bar}}]]
12473 !!html/php
12474 <p>[[./../foo|bar]]
12475 [[foo�|bar]]
12476 [[foo/.|bar]]
12477 [[foo/..|bar]]
12478 [[foo~~~bar]]
12479 [[foo&gt;bar]]
12480 [[foo[bar]]
12481 [[.]]
12482 [[..]]
12483 [[foo././bar]]
12484 </p><p>[[./../foo|bar]]
12485 [[foo/.|bar]]
12486 [[foo/..|bar]]
12487 [[foo~~~~bar]]
12488 [[foo&gt;bar]]
12489 [[foo././bar]]
12490 [[foo{bar]]
12491 [[foo}bar]]
12492 [[foo[bar]]
12493 [[foo]bar]]
12494 [[foo&lt;bar]]
12495 </p>
12496 !!html/parsoid
12497 <p>[[./../foo|bar]]
12498 [[foo�|bar]]
12499 [[foo/.|bar]]
12500 [[foo/..|bar]]
12501 [[foo~~~bar]]
12502 [[foo>bar]]
12503 [[foo[bar]]
12504 [[.]]
12505 [[..]]
12506 [[foo././bar]]</p>
12507
12508 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
12509 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
12510 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
12511 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
12512 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
12513 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
12514 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
12515 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
12516 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
12517 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
12518 [[<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>
12519 !!end
12520
12521 !! test
12522 Disabled subpages
12523 !! wikitext
12524 [[/subpage]]
12525 !! html
12526 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
12527 </p>
12528 !! end
12529
12530 !! test
12531 BUG 561: {{/Subpage}}
12532 !! options
12533 subpage title=[[Page]]
12534 !! wikitext
12535 {{/Subpage}}
12536 !! html
12537 <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>
12538 </p>
12539 !! end
12540
12541 ###
12542 ### Categories
12543 ###
12544 !! article
12545 Category:MediaWiki User's Guide
12546 !! text
12547 blah
12548 !! endarticle
12549
12550 !! test
12551 Link to category
12552 !! wikitext
12553 [[:Category:MediaWiki User's Guide]]
12554 !! html
12555 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
12556 </p>
12557 !! end
12558
12559 !! test
12560 Simple category
12561 !! options
12562 cat
12563 !! wikitext
12564 [[Category:MediaWiki User's Guide]]
12565 !! html
12566 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12567 !! end
12568
12569 !! test
12570 PAGESINCATEGORY invalid title fatal (r33546 fix)
12571 !! wikitext
12572 {{PAGESINCATEGORY:<bogus>}}
12573 !! html
12574 <p>0
12575 </p>
12576 !! end
12577
12578 !! test
12579 Category with different sort key
12580 !! options
12581 cat
12582 !! wikitext
12583 [[Category:MediaWiki User's Guide|Foo]]
12584 !! html
12585 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12586 !! end
12587
12588 !! test
12589 Category with identical sort key
12590 !! options
12591 cat
12592 !! wikitext
12593 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12594 !! html
12595 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12596 !! end
12597
12598 !! test
12599 Category with empty sort key
12600 !! options
12601 cat
12602 pst
12603 !! wikitext
12604 [[Category:MediaWiki User's Guide|]]
12605 !! html
12606 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12607 !! end
12608
12609 !! test
12610 Category with empty sort key and parentheses
12611 !! options
12612 cat
12613 pst
12614 !! wikitext
12615 [[Category:Foo (bar)|]]
12616 !! html
12617 [[Category:Foo (bar)|Foo]]
12618 !! end
12619
12620 !! test
12621 Category with link tail
12622 !! options
12623 cat
12624 pst
12625 !! wikitext
12626 123[[Category:Foo]]456
12627 !! html
12628 123[[Category:Foo]]456
12629 !! end
12630
12631 !! test
12632 Category with template
12633 !! options
12634 cat
12635 pst
12636 !! wikitext
12637 [[Category:{{echo|Foo}}]]
12638 !! html
12639 [[Category:{{echo|Foo}}]]
12640 !! end
12641
12642 !! test
12643 Category with template in sort key
12644 !! options
12645 cat
12646 pst
12647 !! wikitext
12648 [[Category:Foo|{{echo|Bar}}]]
12649 !! html
12650 [[Category:Foo|{{echo|Bar}}]]
12651 !! end
12652
12653 !! test
12654 Category with template in sort key and title
12655 !! options
12656 cat
12657 pst
12658 !! wikitext
12659 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12660 !! html
12661 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12662 !! end
12663
12664 !! test
12665 Category / paragraph interactions
12666 !! wikitext
12667 Foo [[Category:Baz]] Bar
12668
12669 Foo [[Category:Baz]]
12670 Bar
12671
12672 Foo
12673 [[Category:Baz]]
12674 Bar
12675
12676 Foo
12677 [[Category:Baz]] Bar
12678
12679 Foo
12680 [[Category:Baz]]
12681 [[Category:Baz]]
12682 [[Category:Baz]]
12683 Bar
12684
12685 [[Category:Baz]]
12686 [[Category:Baz]]
12687 [[Category:Baz]]
12688
12689 [[Category:Baz]]
12690 {{echo|[[Category:Baz]]}}
12691 [[Category:Baz]]
12692 !! html
12693 <p>Foo Bar
12694 </p><p>Foo
12695 Bar
12696 </p><p>Foo
12697 Bar
12698 </p><p>Foo Bar
12699 </p><p>Foo
12700 Bar
12701 </p>
12702 !! end
12703
12704 !! test
12705 Parsoid: Serialize link to category page with colon escape
12706 !! options
12707 parsoid
12708 !! wikitext
12709
12710 [[:Category:Foo]]
12711 [[:Category:Foo|Bar]]
12712 !! html
12713 <p>
12714 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
12715 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
12716 </p>
12717 !! end
12718
12719 !! test
12720 Parsoid: Link prefix/suffixes aren't applied to category links
12721 !! options
12722 parsoid=wt2html,wt2wt,html2html
12723 language=is
12724 !! wikitext
12725 x[[Category:Foo]]y
12726 !! html
12727 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
12728 !! end
12729
12730 !! test
12731 Parsoid: Serialize link to file page with colon escape
12732 !! options
12733 parsoid
12734 !! wikitext
12735
12736 [[:File:Foo.png]]
12737 [[:File:Foo.png|Bar]]
12738 !! html
12739 <p>
12740 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
12741 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
12742 </p>
12743 !! end
12744
12745 !! test
12746 Parsoid: Serialize a genuine category link without colon escape
12747 !! options
12748 parsoid
12749 !! wikitext
12750 [[Category:Foo]]
12751 [[Category:Foo|Bar]]
12752 !! html
12753 <link rel="mw:PageProp/Category" href="Category:Foo">
12754 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
12755 !! end
12756
12757 !! test
12758 Normalize hrefs properly before testing for invalid link targets (bug 70894)
12759 !! options
12760 parsoid=html2wt
12761 !! html
12762 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
12763 !! wikitext
12764 [[Category:Toxine bactérienne]]
12765 !! end
12766
12767 !! test
12768 Parsoid: Defaultsort
12769 !! options
12770 parsoid
12771 !! wikitext
12772 {{DEFAULTSORT:Foo}}
12773 !! html
12774 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
12775 !! end
12776
12777 ###
12778 ### Inter-language links
12779 ###
12780 !! test
12781 Interlanguage links
12782 !! options
12783 ill
12784 !! wikitext
12785 [[es:Alimento]]
12786 [[fr:Nourriture]]
12787 [[zh:食品]]
12788 !! html/php
12789 es:Alimento fr:Nourriture zh:食品
12790 !! html/parsoid
12791 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
12792 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
12793 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
12794 !! end
12795
12796 !! test
12797 Duplicate interlanguage links (bug 24502)
12798 !! options
12799 ill
12800 !! wikitext
12801 [[es:1]]
12802 [[es:2]]
12803 [[fr:1]]
12804 [[fr:2]]
12805 !! html/php
12806 es:1 fr:1
12807 !! html/parsoid
12808 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
12809 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
12810 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
12811 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
12812 !! end
12813
12814 ###
12815 ### Sections
12816 ###
12817 !! test
12818 Basic section headings
12819 !! wikitext
12820 == Headline 1 ==
12821 Some text
12822
12823 ==Headline 2==
12824 More
12825 ===Smaller headline===
12826 Blah blah
12827 !! html
12828 <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>
12829 <p>Some text
12830 </p>
12831 <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>
12832 <p>More
12833 </p>
12834 <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>
12835 <p>Blah blah
12836 </p>
12837 !! end
12838
12839 !! test
12840 Section headings with TOC
12841 !! wikitext
12842 == Headline 1 ==
12843 === Subheadline 1 ===
12844 ===== Skipping a level =====
12845 ====== Skipping a level ======
12846
12847 == Headline 2 ==
12848 Some text
12849 ===Another headline===
12850 !! html
12851 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12852 <ul>
12853 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
12854 <ul>
12855 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
12856 <ul>
12857 <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>
12858 <ul>
12859 <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>
12860 </ul>
12861 </li>
12862 </ul>
12863 </li>
12864 </ul>
12865 </li>
12866 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
12867 <ul>
12868 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
12869 </ul>
12870 </li>
12871 </ul>
12872 </div>
12873
12874 <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>
12875 <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>
12876 <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>
12877 <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>
12878 <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>
12879 <p>Some text
12880 </p>
12881 <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>
12882
12883 !! end
12884
12885 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
12886 !! test
12887 Handling of sections up to level 6 and beyond
12888 !! wikitext
12889 = Level 1 Heading=
12890 == Level 2 Heading==
12891 === Level 3 Heading===
12892 ==== Level 4 Heading====
12893 ===== Level 5 Heading=====
12894 ====== Level 6 Heading======
12895 ======= Level 7 Heading=======
12896 ======== Level 8 Heading========
12897 ========= Level 9 Heading=========
12898 ========== Level 10 Heading==========
12899 !! html
12900 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12901 <ul>
12902 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
12903 <ul>
12904 <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>
12905 <ul>
12906 <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>
12907 <ul>
12908 <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>
12909 <ul>
12910 <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>
12911 <ul>
12912 <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>
12913 <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>
12914 <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>
12915 <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>
12916 <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>
12917 </ul>
12918 </li>
12919 </ul>
12920 </li>
12921 </ul>
12922 </li>
12923 </ul>
12924 </li>
12925 </ul>
12926 </li>
12927 </ul>
12928 </div>
12929
12930 <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>
12931 <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>
12932 <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>
12933 <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>
12934 <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>
12935 <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>
12936 <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>
12937 <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>
12938 <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>
12939 <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>
12940
12941 !! end
12942
12943 !! test
12944 TOC regression (bug 9764)
12945 !! wikitext
12946 == title 1 ==
12947 === title 1.1 ===
12948 ==== title 1.1.1 ====
12949 === title 1.2 ===
12950 == title 2 ==
12951 === title 2.1 ===
12952 !! html
12953 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12954 <ul>
12955 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12956 <ul>
12957 <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>
12958 <ul>
12959 <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>
12960 </ul>
12961 </li>
12962 <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>
12963 </ul>
12964 </li>
12965 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12966 <ul>
12967 <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>
12968 </ul>
12969 </li>
12970 </ul>
12971 </div>
12972
12973 <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>
12974 <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>
12975 <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>
12976 <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>
12977 <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>
12978 <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>
12979
12980 !! end
12981
12982 !! test
12983 TOC with wgMaxTocLevel=3 (bug 6204)
12984 !! options
12985 wgMaxTocLevel=3
12986 !! wikitext
12987 == title 1 ==
12988 === title 1.1 ===
12989 ==== title 1.1.1 ====
12990 === title 1.2 ===
12991 == title 2 ==
12992 === title 2.1 ===
12993 !! html
12994 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12995 <ul>
12996 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12997 <ul>
12998 <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>
12999 <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>
13000 </ul>
13001 </li>
13002 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13003 <ul>
13004 <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>
13005 </ul>
13006 </li>
13007 </ul>
13008 </div>
13009
13010 <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>
13011 <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>
13012 <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>
13013 <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>
13014 <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>
13015 <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>
13016
13017 !! end
13018
13019 !! test
13020 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
13021 !! options
13022 wgMaxTocLevel=3
13023 !! wikitext
13024 ==Section 1==
13025 ===Section 1.1===
13026 ====Section 1.1.1====
13027 ====Section 1.1.1.1====
13028 ==Section 2==
13029 !! html
13030 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13031 <ul>
13032 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
13033 <ul>
13034 <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>
13035 </ul>
13036 </li>
13037 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
13038 </ul>
13039 </div>
13040
13041 <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>
13042 <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>
13043 <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>
13044 <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>
13045 <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>
13046
13047 !! end
13048
13049
13050 !! test
13051 Resolving duplicate section names
13052 !! wikitext
13053 == Foo bar ==
13054 == Foo bar ==
13055 !! html
13056 <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>
13057 <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>
13058
13059 !! end
13060
13061 !! test
13062 Resolving duplicate section names with differing case (bug 10721)
13063 !! wikitext
13064 == Foo bar ==
13065 == Foo Bar ==
13066 !! html
13067 <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>
13068 <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>
13069
13070 !! end
13071
13072 !! article
13073 Template:sections
13074 !! text
13075 ===Section 1===
13076 ==Section 2==
13077 !! endarticle
13078
13079 !! test
13080 Template with sections, __NOTOC__
13081 !! wikitext
13082 __NOTOC__
13083 ==Section 0==
13084 {{sections}}
13085 ==Section 4==
13086 !! html
13087 <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>
13088 <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>
13089 <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>
13090 <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>
13091
13092 !! end
13093
13094 !! test
13095 __NOEDITSECTION__ keyword
13096 !! wikitext
13097 __NOEDITSECTION__
13098 ==Section 1==
13099 ==Section 2==
13100 !! html
13101 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
13102 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
13103
13104 !! end
13105
13106 !! test
13107 Link inside a section heading
13108 !! wikitext
13109 ==Section with a [[Main Page|link]] in it==
13110 !! html
13111 <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>
13112
13113 !! end
13114
13115 !! test
13116 TOC regression (bug 12077)
13117 !! wikitext
13118 __TOC__
13119 == title 1 ==
13120 === title 1.1 ===
13121 == title 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="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13126 <ul>
13127 <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>
13128 </ul>
13129 </li>
13130 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13131 </ul>
13132 </div>
13133
13134 <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>
13135 <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>
13136 <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>
13137
13138 !! end
13139
13140 !! test
13141 BUG 1219 URL next to image (good)
13142 !! wikitext
13143 http://example.com [[Image:foobar.jpg]]
13144 !! html
13145 <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>
13146 </p>
13147 !!end
13148
13149 !! test
13150 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13151 !! wikitext
13152 ===
13153 The line above must have a trailing space!
13154 === <!--
13155 --> <!-- -->
13156 But just in case it doesn't...
13157 !! html
13158 <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>
13159 <p>The line above must have a trailing space!
13160 </p>
13161 <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>
13162 <p>But just in case it doesn't...
13163 </p>
13164 !! end
13165
13166 !! test
13167 Header with special characters (bug 25462)
13168 !! wikitext
13169 The tooltips shall not show entities to the user (ie. be double escaped)
13170
13171 == text > text ==
13172 section 1
13173
13174 == text < text ==
13175 section 2
13176
13177 == text & text ==
13178 section 3
13179
13180 == text ' text ==
13181 section 4
13182
13183 == text " text ==
13184 section 5
13185 !! html
13186 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13187 </p>
13188 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13189 <ul>
13190 <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>
13191 <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>
13192 <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>
13193 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13194 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13195 </ul>
13196 </div>
13197
13198 <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>
13199 <p>section 1
13200 </p>
13201 <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>
13202 <p>section 2
13203 </p>
13204 <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>
13205 <p>section 3
13206 </p>
13207 <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>
13208 <p>section 4
13209 </p>
13210 <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>
13211 <p>section 5
13212 </p>
13213 !! end
13214
13215 !! test
13216 Header with space, plus and underscore as entity
13217 !! wikitext
13218 Id should not contain + for spaces
13219
13220 == Space between Text ==
13221 section 1
13222
13223 == Space-Entity&#32;between&#32;Text ==
13224 section 2
13225
13226 == Plus+between+Text ==
13227 section 3
13228
13229 == Plus-Entity&#43;between&#43;Text ==
13230 section 4
13231
13232 == Underscore_between_Text ==
13233 section 5
13234
13235 == Underscore-Entity&#95;between&#95;Text ==
13236 section 6
13237
13238 [[#Space between Text]]
13239 [[#Space-Entity&#32;between&#32;Text]]
13240 [[#Plus+between+Text]]
13241 [[#Plus-Entity&#43;between&#43;Text]]
13242 [[#Underscore_between_Text]]
13243 [[#Underscore-Entity&#95;between&#95;Text]]
13244 !! html
13245 <p>Id should not contain + for spaces
13246 </p>
13247 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13248 <ul>
13249 <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>
13250 <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>
13251 <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>
13252 <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>
13253 <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>
13254 <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>
13255 </ul>
13256 </div>
13257
13258 <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>
13259 <p>section 1
13260 </p>
13261 <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>
13262 <p>section 2
13263 </p>
13264 <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>
13265 <p>section 3
13266 </p>
13267 <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>
13268 <p>section 4
13269 </p>
13270 <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>
13271 <p>section 5
13272 </p>
13273 <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>
13274 <p>section 6
13275 </p><p><a href="#Space_between_Text">#Space between Text</a>
13276 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
13277 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
13278 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
13279 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
13280 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
13281 </p>
13282 !! end
13283
13284 !! test
13285 Headers with excess '=' characters
13286 (Are similar tests necessary beyond the 1st level?)
13287 !! wikitext
13288 =foo==
13289 ==foo=
13290 =''italic'' heading==
13291 ==''italic'' heading=
13292 !! html
13293 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13294 <ul>
13295 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
13296 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
13297 <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>
13298 <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>
13299 </ul>
13300 </div>
13301
13302 <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>
13303 <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>
13304 <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>
13305 <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>
13306
13307 !! end
13308
13309 !! test
13310 HTML headers vs TOC (bug 23393)
13311 (__NOEDITSECTION__ for clearer output, doesn't matter here)
13312 !! wikitext
13313 <h1>Header 1</h1>
13314 == Header 1.1 ==
13315 == Header 1.2 ==
13316
13317 <h1>Header 2
13318 </h1>
13319 == Header 2.1 ==
13320 == Header 2.2 ==
13321 __NOEDITSECTION__
13322 !! html
13323 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13324 <ul>
13325 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
13326 <ul>
13327 <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>
13328 <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>
13329 </ul>
13330 </li>
13331 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
13332 <ul>
13333 <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>
13334 <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>
13335 </ul>
13336 </li>
13337 </ul>
13338 </div>
13339
13340 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
13341 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
13342 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
13343 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
13344 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
13345 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
13346
13347 !! end
13348
13349 !! test
13350 Single-line or multiline-comments can follow headings
13351 !! options
13352 parsoid=wt2html,wt2wt
13353 !! wikitext
13354 ==foo==<!---->
13355 ==bar==<!--c1-->
13356 ==baz==<!--
13357 c2
13358 c3-->
13359 !! html
13360 <h2><span class="mw-headline" id="foo">foo</span></h2>
13361 <h2><span class="mw-headline" id="bar">bar</span></h2>
13362 <h2><span class="mw-headline" id="baz">baz</span></h2>
13363
13364 !! end
13365
13366 !! test
13367 BUG 1219 URL next to image (broken)
13368 !! wikitext
13369 http://example.com[[Image:foobar.jpg]]
13370 !! html
13371 <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>
13372 </p>
13373 !!end
13374
13375 !! test
13376 Bug 1186 news: in the middle of text
13377 !! wikitext
13378 http://en.wikinews.org/wiki/Wikinews:Workplace
13379 !! html
13380 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
13381 </p>
13382 !!end
13383
13384
13385 !! test
13386 Namespaced link must have a title
13387 !! wikitext
13388 [[Project:]]
13389 !! html
13390 <p>[[Project:]]
13391 </p>
13392 !!end
13393
13394 !! test
13395 Namespaced link must have a title (bad fragment version)
13396 !! wikitext
13397 [[Project:#fragment]]
13398 !! html
13399 <p>[[Project:#fragment]]
13400 </p>
13401 !!end
13402
13403
13404 ###
13405 ### HTML tags and HTML attributes
13406 ###
13407
13408 !! test
13409 div with no attributes
13410 !! wikitext
13411 <div>HTML rocks</div>
13412 !! html
13413 <div>HTML rocks</div>
13414
13415 !! end
13416
13417 !! test
13418 div with double-quoted attribute
13419 !! wikitext
13420 <div id="rock">HTML rocks</div>
13421 !! html
13422 <div id="rock">HTML rocks</div>
13423
13424 !! end
13425
13426 !! test
13427 div with single-quoted attribute
13428 !! wikitext
13429 <div id='rock'>HTML rocks</div>
13430 !! html
13431 <div id="rock">HTML rocks</div>
13432
13433 !! end
13434
13435 !! test
13436 div with unquoted attribute
13437 !! wikitext
13438 <div id=rock>HTML rocks</div>
13439 !! html
13440 <div id="rock">HTML rocks</div>
13441
13442 !! end
13443
13444 !! test
13445 div with illegal double attributes
13446 !! wikitext
13447 <div id="a" id="b">HTML rocks</div>
13448 !! html
13449 <div id="b">HTML rocks</div>
13450
13451 !!end
13452
13453 # FIXME: produce empty string instead of "class" in the PHP parser, following
13454 # the HTML5 spec.
13455 !! test
13456 div with empty attribute value, space before equals
13457 !! options
13458 parsoid
13459 !! wikitext
13460 <div class =>HTML rocks</div>
13461 !! html
13462 <div class="">HTML rocks</div>
13463
13464 !! end
13465
13466 !! test
13467 div with multiple empty attribute values
13468 !! options
13469 parsoid
13470 !! wikitext
13471 <div id= title=>HTML rocks</div>
13472 !! html
13473 <div id="" title="">HTML rocks</div>
13474
13475 !! end
13476
13477 !! test
13478 table with multiple empty attribute values
13479 !! options
13480 parsoid
13481 !! wikitext
13482 {| title= id=
13483 | hi
13484 |}
13485 !! html
13486 <table title="" id="">
13487 <tbody><tr><td> hi</td></tr>
13488 </tbody></table>
13489 !! end
13490
13491 !! test
13492 div with braces in attribute value
13493 !! wikitext
13494 <div title="{}">Foo</div>
13495 !! html/php
13496 <div title="&#123;}">Foo</div>
13497
13498 !! html/parsoid
13499 <div title="{}">Foo</div>
13500 !! end
13501
13502 # This it very inconsistent in the PHP parser: it returns
13503 # class="class" if there is a space between the name and the equal sign (see
13504 # 'div with empty attribute value, space before equals'), but strips the
13505 # attribute completely if the space is missing. We hope that not much content
13506 # depends on this, so are implementing the behavior below in Parsoid for
13507 # consistencies' sake.
13508 # FIXME: fix this behavior in the PHP parser?
13509 !! test
13510 div with empty attribute value, no space before equals
13511 !! options
13512 parsoid=wt2html,html2html
13513 !! wikitext
13514 <div class=>HTML rocks</div>
13515 !! html/php
13516 <div>HTML rocks</div>
13517
13518 !! html/parsoid
13519 <div class="">HTML rocks</div>
13520 !! end
13521
13522 !! test
13523 HTML multiple attributes correction
13524 !! wikitext
13525 <p class="error" class="awesome">Awesome!</p>
13526 !! html
13527 <p class="awesome">Awesome!</p>
13528
13529 !!end
13530
13531 !! test
13532 Table multiple attributes correction
13533 !! wikitext
13534 {|
13535 !+ class="error" class="awesome"| status
13536 |}
13537 !! html
13538 <table>
13539 <tr>
13540 <th class="awesome"> status
13541 </th></tr></table>
13542
13543 !!end
13544
13545 !! test
13546 DIV IN UPPERCASE
13547 !! wikitext
13548 <DIV ID="x">HTML ROCKS</DIV>
13549 !! html
13550 <div id="x">HTML ROCKS</div>
13551
13552 !!end
13553
13554 !! test
13555 Non-ASCII pseudo-tags are rendered as text
13556 !! wikitext
13557 <khyô>
13558 !! html
13559 <p>&lt;khyô&gt;
13560 </p>
13561 !! end
13562
13563 !! test
13564 Pseudo-tag with URL 'name' renders as url link
13565 !! wikitext
13566 <http://example.com/>
13567 !! html
13568 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
13569 </p>
13570 !! end
13571
13572 !! test
13573 text with amp in the middle of nowhere
13574 !! wikitext
13575 Remember AT&T?
13576 !! html
13577 <p>Remember AT&amp;T?
13578 </p>
13579 !! end
13580
13581 !! test
13582 text with character entity: eacute
13583 !! wikitext
13584 I always thought &eacute; was a cute letter.
13585 !! html
13586 <p>I always thought &#233; was a cute letter.
13587 </p>
13588 !! html+tidy
13589 <p>I always thought é was a cute letter.</p>
13590 !! end
13591
13592 !! test
13593 text with entity-escaped character entity-like string: eacute
13594 !! wikitext
13595 I always thought &amp;eacute; was a cute letter.
13596 !! html
13597 <p>I always thought &amp;eacute; was a cute letter.
13598 </p>
13599 !! end
13600
13601 !! test
13602 text with undefined character entity: xacute
13603 !! wikitext
13604 I always thought &xacute; was a cute letter.
13605 !! html
13606 <p>I always thought &amp;xacute; was a cute letter.
13607 </p>
13608 !! end
13609
13610 # TODO: generalize to PHP parser?
13611 !! test
13612 HTML5 tags
13613 !! options
13614 parsoid
13615 !! wikitext
13616 <data value="5">five</data>
13617 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13618 <mark>This highlighted text</mark>
13619 !! html
13620 <p><data value="5">five</data>
13621 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13622 <mark>This highlighted text</mark></p>
13623 !! end
13624
13625 !! test
13626 HTML tag with leading space is parsed as text
13627 !! wikitext
13628 < div>foo< /div>
13629 !! html
13630 <p>&lt; div&gt;foo&lt; /div&gt;
13631 </p>
13632 !! end
13633
13634 ###
13635 ### Nesting tests (see bug 41545, 50604, 51081)
13636 ###
13637
13638 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
13639 # Note that html2wt is considerably more difficult if we use <b> in
13640 # the test case, instead of <big>
13641 !! test
13642 Ensure that HTML adoption agency algorithm is properly implemented.
13643 !! wikitext
13644 <big>X<big>Y</big>Z</big>
13645 !! html
13646 <p><big>X<big>Y</big>Z</big>
13647 </p>
13648 !! end
13649
13650 # This was bug 41545 in the PHP parser.
13651 # Note that tidy doesn't handle this correctly.
13652 !! test
13653 Nesting of <kbd>
13654 !! wikitext
13655 <kbd>X<kbd>Y</kbd>Z</kbd>
13656 !! html
13657 <p><kbd>X<kbd>Y</kbd>Z</kbd>
13658 </p>
13659 !! end
13660
13661 # The following cases were bug 51081 in the PHP parser.
13662 # Note that there are some other nestable tags (b, i, etc) which are
13663 # not covered; see bug 51081 for discussion.
13664
13665 # Note that tidy doesn't handle this correctly.
13666 !! test
13667 Nesting of <em>
13668 !! wikitext
13669 <em>X<em>Y</em>Z</em>
13670 !! html
13671 <p><em>X<em>Y</em>Z</em>
13672 </p>
13673 !! end
13674
13675 # Note that tidy doesn't handle this correctly.
13676 !! test
13677 Nesting of <strong>
13678 !! wikitext
13679 <strong>X<strong>Y</strong>Z</strong>
13680 !! html
13681 <p><strong>X<strong>Y</strong>Z</strong>
13682 </p>
13683 !! end
13684
13685 !! test
13686 Nesting of <q>
13687 !! wikitext
13688 <q>X<q>Y</q>Z</q>
13689 !! html+tidy
13690 <p><q>X<q>Y</q>Z</q></p>
13691 !! end
13692
13693 # Note that tidy doesn't handle this correctly.
13694 !! test
13695 Nesting of <ruby>
13696 !! wikitext
13697 <ruby>X<ruby>Y</ruby>Z</ruby>
13698 !! html
13699 <p><ruby>X<ruby>Y</ruby>Z</ruby>
13700 </p>
13701 !! end
13702
13703 # Note that tidy doesn't handle this correctly.
13704 !! test
13705 Nesting of <bdo>
13706 !! wikitext
13707 <bdo>X<bdo>Y</bdo>Z</bdo>
13708 !! html
13709 <p><bdo>X<bdo>Y</bdo>Z</bdo>
13710 </p>
13711 !! end
13712
13713
13714 ###
13715 ### Media links
13716 ###
13717
13718 !! test
13719 Media link
13720 !! wikitext
13721 [[Media:Foobar.jpg]]
13722 !! html
13723 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
13724 </p>
13725 !! end
13726
13727 !! test
13728 Media link with text
13729 !! wikitext
13730 [[Media:Foobar.jpg|A neat file to look at]]
13731 !! html
13732 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
13733 </p>
13734 !! end
13735
13736 # FIXME: this is still bad HTML tag nesting
13737 !! test
13738 Media link with nasty text
13739 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
13740 !! wikitext
13741 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
13742 !! html
13743 <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>
13744
13745 !! html+tidy
13746 <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>
13747 !! end
13748
13749 !! test
13750 Media link to nonexistent file (bug 1702)
13751 !! wikitext
13752 [[Media:No such.jpg]]
13753 !! html
13754 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
13755 </p>
13756 !! end
13757
13758 !! test
13759 Image link to nonexistent file (bug 1850 - good)
13760 !! wikitext
13761 [[Image:No such.jpg]]
13762 !! html
13763 <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>
13764 </p>
13765 !! end
13766
13767 !! test
13768 :Image link to nonexistent file (bug 1850 - bad)
13769 !! wikitext
13770 [[:Image:No such.jpg]]
13771 !! html
13772 <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>
13773 </p>
13774 !! end
13775
13776
13777
13778 !! test
13779 Character reference normalization in link text (bug 1938)
13780 !! wikitext
13781 [[Main Page|this&that]]
13782 !! html
13783 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
13784 </p>
13785 !!end
13786
13787 !! article
13788 אַ
13789 !! text
13790 Test for unicode normalization
13791
13792 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
13793 !! endarticle
13794
13795 !! test
13796 (bug 19451) Links should refer to the normalized form.
13797 !! wikitext
13798 [[&#xFB2E;]]
13799 [[&#x5d0;&#x5b7;]]
13800 [[&#x5d0;ַ]]
13801 [[א&#x5b7;]]
13802 [[אַ]]
13803 !! html
13804 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
13805 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
13806 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
13807 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
13808 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
13809 </p>
13810 !! end
13811
13812 !! test
13813 Empty attribute crash test (bug 2067)
13814 !! wikitext
13815 <font color="">foo</font>
13816 !! html
13817 <p><font color="">foo</font>
13818 </p>
13819 !! end
13820
13821 !! test
13822 Empty attribute crash test single-quotes (bug 2067)
13823 !! wikitext
13824 <font color=''>foo</font>
13825 !! html
13826 <p><font color="">foo</font>
13827 </p>
13828 !! end
13829
13830 !! test
13831 Attribute test: equals, then nothing
13832 !! wikitext
13833 <font color=>foo</font>
13834 !! html
13835 <p><font>foo</font>
13836 </p>
13837 !! end
13838
13839 !! test
13840 Attribute test: unquoted value
13841 !! wikitext
13842 <font color=x>foo</font>
13843 !! html
13844 <p><font color="x">foo</font>
13845 </p>
13846 !! end
13847
13848 !! test
13849 Attribute test: unquoted but illegal value (hash)
13850 !! wikitext
13851 <font color=#x>foo</font>
13852 !! html
13853 <p><font color="#x">foo</font>
13854 </p>
13855 !! end
13856
13857 !! test
13858 Attribute test: no value
13859 !! wikitext
13860 <font color>foo</font>
13861 !! html
13862 <p><font color="color">foo</font>
13863 </p>
13864 !! end
13865
13866 !! test
13867 Bug 2095: link with three closing brackets
13868 !! wikitext
13869 [[Main Page]]]
13870 !! html/php
13871 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
13872 </p>
13873 !! html/parsoid
13874 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
13875 !! end
13876
13877 !! test
13878 Bug 2095: link with pipe and three closing brackets
13879 !! wikitext
13880 [[Main Page|link]]]
13881 !! html/php
13882 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
13883 </p>
13884 !! html/parsoid
13885 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
13886 !! end
13887
13888 !! test
13889 Bug 2095: link with pipe and three closing brackets, version 2
13890 !! wikitext
13891 [[Main Page|[http://example.com/]]]
13892 !! html/php
13893 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
13894 </p>
13895 !! html/parsoid
13896 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
13897 !! end
13898
13899
13900 ###
13901 ### Safety
13902 ###
13903
13904 !! article
13905 Template:Dangerous attribute
13906 !! text
13907 " onmouseover="alert(document.cookie)
13908 !! endarticle
13909
13910 !! article
13911 Template:Dangerous style attribute
13912 !! text
13913 border-size: expression(alert(document.cookie))
13914 !! endarticle
13915
13916 !! article
13917 Template:Div style
13918 !! text
13919 <div style="float: right; {{{1}}}">Magic div</div>
13920 !! endarticle
13921
13922 !! test
13923 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
13924 !! wikitext
13925 <div title="{{test}}"></div>
13926 !! html
13927 <div title="This is a test template"></div>
13928
13929 !! end
13930
13931 # Parsoid has enough context to handle this case
13932 !! test
13933 Bug 2304: HTML attribute safety (dangerous template; 2309)
13934 !! wikitext
13935 <div title="{{dangerous attribute}}"></div>
13936 !! html/php
13937 <div title=""></div>
13938
13939 !! html/parsoid
13940 <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>
13941 !! end
13942
13943 !! test
13944 Bug 2304: HTML attribute safety (dangerous style template; 2309)
13945 !! wikitext
13946 <div style="{{dangerous style attribute}}"></div>
13947 !! html
13948 <div style="/* insecure input */"></div>
13949
13950 !! end
13951
13952 !! test
13953 Bug 2304: HTML attribute safety (safe parameter; 2309)
13954 !! wikitext
13955 {{div style|width: 200px}}
13956 !! html
13957 <div style="float: right; width: 200px">Magic div</div>
13958
13959 !! end
13960
13961 !! test
13962 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
13963 !! wikitext
13964 {{div style|width: expression(alert(document.cookie))}}
13965 !! html
13966 <div style="/* insecure input */">Magic div</div>
13967
13968 !! end
13969
13970 !! test
13971 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
13972 !! wikitext
13973 {{div style|"><script>alert(document.cookie)</script>}}
13974 !! html
13975 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13976
13977 !! end
13978
13979 !! test
13980 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
13981 !! wikitext
13982 {{div style|" ><script>alert(document.cookie)</script>}}
13983 !! html
13984 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13985
13986 !! end
13987
13988 !! test
13989 Bug 2304: HTML attribute safety (link)
13990 !! wikitext
13991 <div title="[[Main Page]]"></div>
13992 !! html
13993 <div title="&#91;&#91;Main Page]]"></div>
13994
13995 !! end
13996
13997 !! test
13998 Bug 2304: HTML attribute safety (italics)
13999 !! wikitext
14000 <div title="''foobar''"></div>
14001 !! html
14002 <div title="&#39;&#39;foobar&#39;&#39;"></div>
14003
14004 !! end
14005
14006 !! test
14007 Bug 2304: HTML attribute safety (bold)
14008 !! wikitext
14009 <div title="'''foobar'''"></div>
14010 !! html
14011 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
14012
14013 !! end
14014
14015
14016 !! test
14017 Bug 2304: HTML attribute safety (ISBN)
14018 !! wikitext
14019 <div title="ISBN 1234567890"></div>
14020 !! html
14021 <div title="&#73;SBN 1234567890"></div>
14022
14023 !! end
14024
14025 !! test
14026 Bug 2304: HTML attribute safety (RFC)
14027 !! wikitext
14028 <div title="RFC 1234"></div>
14029 !! html
14030 <div title="&#82;FC 1234"></div>
14031
14032 !! end
14033
14034 !! test
14035 Bug 2304: HTML attribute safety (PMID)
14036 !! wikitext
14037 <div title="PMID 1234567890"></div>
14038 !! html
14039 <div title="&#80;MID 1234567890"></div>
14040
14041 !! end
14042
14043 !! test
14044 Bug 2304: HTML attribute safety (web link)
14045 !! wikitext
14046 <div title="http://example.com/"></div>
14047 !! html
14048 <div title="http&#58;//example.com/"></div>
14049
14050 !! end
14051
14052 !! test
14053 Bug 2304: HTML attribute safety (named web link)
14054 !! wikitext
14055 <div title="[http://example.com/ link]"></div>
14056 !! html
14057 <div title="&#91;http&#58;//example.com/ link]"></div>
14058
14059 !! end
14060
14061 !! test
14062 Bug 3244: HTML attribute safety (extension; safe)
14063 !! wikitext
14064 <div style="<nowiki>background:blue</nowiki>"></div>
14065 !! html
14066 <div style="background:blue"></div>
14067
14068 !! end
14069
14070 !! test
14071 Bug 3244: HTML attribute safety (extension; unsafe)
14072 !! wikitext
14073 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14074 !! html
14075 <div style="/* insecure input */"></div>
14076
14077 !! end
14078
14079 # More MSIE fun discovered by Tom Gilder
14080
14081 !! test
14082 MSIE CSS safety test: spurious slash
14083 !! wikitext
14084 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14085 !! html
14086 <div style="/* insecure input */">evil</div>
14087
14088 !! end
14089
14090 !! test
14091 MSIE CSS safety test: hex code
14092 !! wikitext
14093 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14094 !! html
14095 <div style="/* insecure input */">evil</div>
14096
14097 !! end
14098
14099 !! test
14100 MSIE CSS safety test: comment in url
14101 !! wikitext
14102 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14103 !! html
14104 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14105
14106 !! end
14107
14108 !! test
14109 MSIE CSS safety test: comment in expression
14110 !! wikitext
14111 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14112 !! html
14113 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14114
14115 !! end
14116
14117 !! test
14118 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14119 !! wikitext
14120 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14121 !! html
14122 <p style="/* invalid control char */">A</p>
14123
14124 !! end
14125
14126 !! test
14127 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14128 !! wikitext
14129 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14130 <div style="top:EXPRESSION(alert())">B</div>
14131 !! html
14132 <p style="/* insecure input */">A</p>
14133 <div style="/* insecure input */">B</div>
14134
14135 !! end
14136
14137 !! test
14138 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14139 !! wikitext
14140 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14141 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14142 !! html
14143 <div style="/* insecure input */">A</div>
14144 <p style="/* insecure input */">B</p>
14145
14146 !! end
14147
14148 !! test
14149 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14150 !! wikitext
14151 <div style="background-image:url⁽javascript:alert())">A</div>
14152 <div style="background-image:url₍javascript:alert())">B</div>
14153 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14154 !! html
14155 <div style="/* insecure input */">A</div>
14156 <div style="/* insecure input */">B</div>
14157 <p style="/* insecure input */">C</p>
14158
14159 !! end
14160
14161 !! test
14162 Opera -o-link CSS
14163 !! wikitext
14164 <div
14165 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;"
14166 style="-o-link:attr(title);-o-link-source:current">X</div>
14167 !! html
14168 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14169
14170 !! end
14171
14172 !! test
14173 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14174 !! wikitext
14175 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14176 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14177 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14178 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14179 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14180 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14181 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14182 !! html
14183 <p style="/* insecure input */">A</p>
14184 <p style="/* insecure input */">B</p>
14185 <p style="/* insecure input */">C</p>
14186 <p style="/* insecure input */">D</p>
14187 <p style="/* insecure input */">E</p>
14188 <p style="/* insecure input */">F</p>
14189 <p style="/* insecure input */">G</p>
14190
14191 !! end
14192
14193 !! test
14194 Table attribute legitimate extension
14195 !! wikitext
14196 {|
14197 !+ style="<nowiki>color:blue</nowiki>"| status
14198 |}
14199 !! html
14200 <table>
14201 <tr>
14202 <th style="color:blue"> status
14203 </th></tr></table>
14204
14205 !!end
14206
14207 !! test
14208 Table attribute safety
14209 !! wikitext
14210 {|
14211 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14212 |}
14213 !! html
14214 <table>
14215 <tr>
14216 <th style="/* insecure input */"> status
14217 </th></tr></table>
14218
14219 !! end
14220
14221 !! test
14222 CSS line continuation 1
14223 !! wikitext
14224 <div style="background-image: u\&#10;rl(test.jpg);"></div>
14225 !! html
14226 <div style="/* insecure input */"></div>
14227
14228 !! end
14229
14230 !! test
14231 CSS line continuation 2
14232 !! wikitext
14233 <div style="background-image: u\&#13;rl(test.jpg); "></div>
14234 !! html
14235 <div style="/* insecure input */"></div>
14236
14237 !! end
14238
14239 !! article
14240 Template:Identity
14241 !! text
14242 {{{1}}}
14243 !! endarticle
14244
14245 !! test
14246 Expansion of multi-line templates in attribute values (bug 6255)
14247 !! wikitext
14248 <div style="background: {{identity|#00FF00}}">-</div>
14249 !! html
14250 <div style="background: #00FF00">-</div>
14251
14252 !! end
14253
14254
14255 !! test
14256 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
14257 !! wikitext
14258 <div style="background:
14259 #00FF00">-</div>
14260 !! html/php
14261 <div style="background: #00FF00">-</div>
14262
14263 !! html/parsoid
14264 <div style="background:
14265 #00FF00">-</div>
14266 !! end
14267
14268 !! test
14269 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
14270 !! wikitext
14271 <div style="background: &#10;#00FF00">-</div>
14272 !! html
14273 <div style="background: &#10;#00FF00">-</div>
14274
14275 !! end
14276
14277 !! test
14278 evil <math>-wiki-tags without Extension:Math enabled
14279 !! wikitext
14280 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
14281 !! html+tidy
14282 <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>
14283 !! end
14284
14285 ###
14286 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
14287 ###
14288 !! test
14289 Parser hook: empty input
14290 !! wikitext
14291 <tag></tag>
14292 !! html
14293 <pre>
14294 ''
14295 array (
14296 )
14297 </pre>
14298
14299 !! end
14300
14301 !! test
14302 Parser hook: empty input using terminated empty elements
14303 !! wikitext
14304 <tag/>
14305 !! html
14306 <pre>
14307 NULL
14308 array (
14309 )
14310 </pre>
14311
14312 !! end
14313
14314 !! test
14315 Parser hook: empty input using terminated empty elements (space before)
14316 !! wikitext
14317 <tag />
14318 !! html
14319 <pre>
14320 NULL
14321 array (
14322 )
14323 </pre>
14324
14325 !! end
14326
14327 !! test
14328 Parser hook: basic input
14329 !! wikitext
14330 <tag>input</tag>
14331 !! html
14332 <pre>
14333 'input'
14334 array (
14335 )
14336 </pre>
14337
14338 !! end
14339
14340
14341 !! test
14342 Parser hook: case insensitive
14343 !! wikitext
14344 <TAG>input</TAG>
14345 !! html
14346 <pre>
14347 'input'
14348 array (
14349 )
14350 </pre>
14351
14352 !! end
14353
14354
14355 !! test
14356 Parser hook: case insensitive, redux
14357 !! wikitext
14358 <TaG>input</TAg>
14359 !! html
14360 <pre>
14361 'input'
14362 array (
14363 )
14364 </pre>
14365
14366 !! end
14367
14368 !! test
14369 Parser hook: nested tags
14370 !! options
14371 noxml
14372 !! wikitext
14373 <tag><tag></tag></tag>
14374 !! html
14375 <pre>
14376 '<tag>'
14377 array (
14378 )
14379 </pre>&lt;/tag&gt;
14380
14381 !! end
14382
14383 !! test
14384 Parser hook: basic arguments
14385 !! wikitext
14386 <tag width=200 height = "100" depth = '50' square></tag>
14387 !! html
14388 <pre>
14389 ''
14390 array (
14391 'width' => '200',
14392 'height' => '100',
14393 'depth' => '50',
14394 'square' => 'square',
14395 )
14396 </pre>
14397
14398 !! end
14399
14400 !! test
14401 Parser hook: argument containing a forward slash (bug 5344)
14402 !! wikitext
14403 <tag filename='/tmp/bla'></tag>
14404 !! html
14405 <pre>
14406 ''
14407 array (
14408 'filename' => '/tmp/bla',
14409 )
14410 </pre>
14411
14412 !! end
14413
14414 !! test
14415 Parser hook: empty input using terminated empty elements (bug 2374)
14416 !! wikitext
14417 <tag foo=bar/>text
14418 !! html
14419 <pre>
14420 NULL
14421 array (
14422 'foo' => 'bar',
14423 )
14424 </pre>text
14425
14426 !! end
14427
14428 # </tag> should be output literally since there is no matching tag that begins it
14429 !! test
14430 Parser hook: basic arguments using terminated empty elements (bug 2374)
14431 !! wikitext
14432 <tag width=200 height = "100" depth = '50' square/>
14433 other stuff
14434 </tag>
14435 !! html
14436 <pre>
14437 NULL
14438 array (
14439 'width' => '200',
14440 'height' => '100',
14441 'depth' => '50',
14442 'square' => 'square',
14443 )
14444 </pre>
14445 <p>other stuff
14446 &lt;/tag&gt;
14447 </p>
14448 !! end
14449
14450 ###
14451 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14452 ###
14453
14454 !! test
14455 Parser hook: static parser hook not inside a comment
14456 !! wikitext
14457 <statictag>hello, world</statictag>
14458 <statictag action=flush/>
14459 !! html
14460 <p>hello, world
14461 </p>
14462 !! end
14463
14464
14465 !! test
14466 Parser hook: static parser hook inside a comment
14467 !! wikitext
14468 <!-- <statictag>hello, world</statictag> -->
14469 <statictag action=flush/>
14470 !! html
14471 <p><br />
14472 </p>
14473 !! end
14474
14475 # Nested template calls; this case was broken by Parser.php rev 1.506,
14476 # since reverted.
14477
14478 !! article
14479 Template:One-parameter
14480 !! text
14481 (My parameter is: {{{1}}})
14482 !! endarticle
14483
14484 !! article
14485 Template:Map-one-parameter
14486 !! text
14487 {{{{{1}}}|{{{2}}}}}
14488 !! endarticle
14489
14490 !! test
14491 Nested template calls
14492 !! wikitext
14493 {{Map-one-parameter|One-parameter|param}}
14494 !! html
14495 <p>(My parameter is: param)
14496 </p>
14497 !! end
14498
14499
14500 ###
14501 ### Sanitizer
14502 ###
14503
14504 # HTML+Tidy effectively strips out the empty tags completely
14505 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
14506 # which Tidy would have done for the PHP parser had there been content inside it.
14507 !! test
14508 Sanitizer: Closing of open tags
14509 !! wikitext
14510 <s></s><table></table>
14511 !! html
14512 <s></s><table></table>
14513
14514 !! html/parsoid
14515 <p><s></s></p><table></table>
14516 !! end
14517
14518 !! test
14519 Sanitizer: Closing of open but not closed tags
14520 !! wikitext
14521 <s>foo
14522 !! html
14523 <p><s>foo</s>
14524 </p>
14525 !! end
14526
14527 !! test
14528 Sanitizer: Closing of closed but not open tags
14529 !! wikitext
14530 </s>
14531 !! html
14532 <p>&lt;/s&gt;
14533 </p>
14534 !! end
14535
14536 !! test
14537 Sanitizer: Closing of closed but not open table tags
14538 !! wikitext
14539 Table not started</td></tr></table>
14540 !! html
14541 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
14542 </p>
14543 !! end
14544
14545 !! test
14546 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
14547 !! wikitext
14548 <span id="æ: v">byte</span>[[#æ: v|backlink]]
14549 !! html
14550 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
14551 </p>
14552 !! end
14553
14554 # In HTML5, the restrictions are that id must contain at least one character,
14555 # and must not contain any space characters.
14556 !! test
14557 Sanitizer: Validating the contents of the id attribute (bug 4515)
14558 !! options
14559 disabled
14560 !! wikitext
14561 <br id="" /><br id="a space" />
14562 !! html
14563 Something ...
14564 !! end
14565
14566 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
14567 !! test
14568 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
14569 !! options
14570 disabled
14571 !! wikitext
14572 <br id="foo" /><br id="foo" />
14573 !! html
14574 Something need to be done. foo-2 ?
14575 !! end
14576
14577 !! test
14578 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
14579 !! wikitext
14580 <div itemscope>
14581 <meta itemprop="hello" content="world">
14582 <meta http-equiv="refresh" content="5">
14583 <meta itemprop="hello" http-equiv="refresh" content="5">
14584 <link itemprop="hello" href="{{SERVER}}">
14585 <link rel="stylesheet" href="{{SERVER}}">
14586 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
14587 </div>
14588 !! html
14589 <div itemscope="itemscope">
14590 <p> <meta itemprop="hello" content="world" />
14591 &lt;meta http-equiv="refresh" content="5"&gt;
14592 <meta itemprop="hello" content="5" />
14593 </p>
14594 <link itemprop="hello" href="http&#58;//example.org" />
14595 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
14596 <link itemprop="hello" href="http&#58;//example.org" />
14597 </div>
14598
14599 !! end
14600
14601 !! test
14602 Language converter: output gets cut off unexpectedly (bug 5757)
14603 !! options
14604 language=zh
14605 !! wikitext
14606 this bit is safe: }-
14607
14608 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
14609
14610 then we get cut off here: }-
14611
14612 all additional text is vanished
14613 !! html
14614 <p>this bit is safe: }-
14615 </p><p>but if we add a conversion instance: xxx
14616 </p><p>then we get cut off here: }-
14617 </p><p>all additional text is vanished
14618 </p>
14619 !! end
14620
14621 !! test
14622 Self closed html pairs (bug 5487)
14623 !! options
14624 !! wikitext
14625 <center><font id="bug" />Centered text</center>
14626 <div><font id="bug2" />In div text</div>
14627 !! html
14628 <center>&lt;font id="bug" /&gt;Centered text</center>
14629 <div>&lt;font id="bug2" /&gt;In div text</div>
14630
14631 !! end
14632
14633 #
14634 #
14635 #
14636
14637 !! test
14638 Punctuation: nbsp before exclamation
14639 !! wikitext
14640 C'est grave !
14641 !! html
14642 <p>C'est grave&#160;!
14643 </p>
14644 !! end
14645
14646 !! test
14647 Punctuation: CSS !important (bug 11874)
14648 !! wikitext
14649 <div style="width:50% !important">important</div>
14650 !! html
14651 <div style="width:50% !important">important</div>
14652
14653 !!end
14654
14655 !! test
14656 Punctuation: CSS ! important (bug 11874; with space after)
14657 !! wikitext
14658 <div style="width:50% ! important">important</div>
14659 !! html
14660 <div style="width:50% ! important">important</div>
14661
14662 !!end
14663
14664
14665 !! test
14666 HTML bullet list, closed tags (bug 5497)
14667 !! wikitext
14668 <ul>
14669 <li>One</li>
14670 <li>Two</li>
14671 </ul>
14672 !! html/php
14673 <ul>
14674 <li>One</li>
14675 <li>Two</li>
14676 </ul>
14677
14678 !! html/parsoid
14679 <ul data-parsoid='{"stx":"html"}'>
14680 <li data-parsoid='{"stx":"html"}'>One</li>
14681 <li data-parsoid='{"stx":"html"}'>Two</li>
14682 </ul>
14683
14684 !! end
14685
14686 !! test
14687 HTML bullet list, unclosed tags (bug 5497)
14688 !! wikitext
14689 <ul>
14690 <li>One
14691 <li>Two
14692 </ul>
14693 !! html/php+tidy
14694 <ul>
14695 <li>One</li>
14696 <li>Two</li>
14697 </ul>
14698 !! html/parsoid
14699 <ul data-parsoid='{"stx":"html"}'>
14700 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
14701 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
14702 </ul>
14703
14704 !! end
14705
14706 !! test
14707 HTML ordered list, closed tags (bug 5497)
14708 !! wikitext
14709 <ol>
14710 <li>One</li>
14711 <li>Two</li>
14712 </ol>
14713 !! html/php
14714 <ol>
14715 <li>One</li>
14716 <li>Two</li>
14717 </ol>
14718
14719 !! html/parsoid
14720 <ol data-parsoid='{"stx":"html"}'>
14721 <li data-parsoid='{"stx":"html"}'>One</li>
14722 <li data-parsoid='{"stx":"html"}'>Two</li>
14723 </ol>
14724
14725 !! end
14726
14727 !! test
14728 HTML ordered list, unclosed tags (bug 5497)
14729 !! options
14730 !! wikitext
14731 <ol>
14732 <li>One
14733 <li>Two
14734 </ol>
14735 !! html/php+tidy
14736 <ol>
14737 <li>One</li>
14738 <li>Two</li>
14739 </ol>
14740 !! html/parsoid
14741 <ol data-parsoid='{"stx":"html"}'>
14742 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
14743 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
14744 </ol>
14745
14746 !! end
14747
14748 !! test
14749 HTML nested bullet list, closed tags (bug 5497)
14750 !! wikitext
14751 <ul>
14752 <li>One</li>
14753 <li>Two:
14754 <ul>
14755 <li>Sub-one</li>
14756 <li>Sub-two</li>
14757 </ul>
14758 </li>
14759 </ul>
14760 !! html
14761 <ul>
14762 <li>One</li>
14763 <li>Two:
14764 <ul>
14765 <li>Sub-one</li>
14766 <li>Sub-two</li>
14767 </ul>
14768 </li>
14769 </ul>
14770
14771 !! end
14772
14773 !! test
14774 HTML nested bullet list, open tags (bug 5497)
14775 !! wikitext
14776 <ul>
14777 <li>One
14778 <li>Two:
14779 <ul>
14780 <li>Sub-one
14781 <li>Sub-two
14782 </ul>
14783 </ul>
14784 !! html/php+tidy
14785 <ul>
14786 <li>One</li>
14787 <li>Two:
14788 <ul>
14789 <li>Sub-one</li>
14790 <li>Sub-two</li>
14791 </ul>
14792 </li>
14793 </ul>
14794 !! html/parsoid
14795 <ul>
14796 <li>One
14797 </li>
14798 <li>Two:
14799 <ul>
14800 <li>Sub-one
14801 </li>
14802 <li>Sub-two
14803 </li>
14804 </ul>
14805 </li>
14806 </ul>
14807
14808 !! end
14809
14810 !! test
14811 HTML nested ordered list, closed tags (bug 5497)
14812 !! wikitext
14813 <ol>
14814 <li>One</li>
14815 <li>Two:
14816 <ol>
14817 <li>Sub-one</li>
14818 <li>Sub-two</li>
14819 </ol>
14820 </li>
14821 </ol>
14822 !! html
14823 <ol>
14824 <li>One</li>
14825 <li>Two:
14826 <ol>
14827 <li>Sub-one</li>
14828 <li>Sub-two</li>
14829 </ol>
14830 </li>
14831 </ol>
14832
14833 !! end
14834
14835 !! test
14836 HTML nested ordered list, open tags (bug 5497)
14837 !! wikitext
14838 <ol>
14839 <li>One
14840 <li>Two:
14841 <ol>
14842 <li>Sub-one
14843 <li>Sub-two
14844 </ol>
14845 </ol>
14846 !! html/php
14847 <ol>
14848 <li>One
14849 <li>Two:
14850 <ol>
14851 <li>Sub-one
14852 <li>Sub-two
14853 </ol>
14854 </ol>
14855
14856 !! html/parsoid
14857 <ol>
14858 <li>One
14859 </li>
14860 <li>Two:
14861 <ol>
14862 <li>Sub-one
14863 </li>
14864 <li>Sub-two
14865 </li>
14866 </ol>
14867 </li>
14868 </ol>
14869
14870 !! end
14871
14872 !! test
14873 HTML ordered list item with parameters oddity
14874 !! wikitext
14875 <ol><li id="fragment">One</li>
14876 </ol>
14877 !! html
14878 <ol><li id="fragment">One</li>
14879 </ol>
14880
14881 !! end
14882
14883 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
14884 !!test
14885 bug 5918: autonumbering
14886 !! wikitext
14887 [http://first/] [http://second] [ftp://ftp]
14888
14889 ftp://inlineftp
14890
14891 [mailto:enclosed@mail.tld With target]
14892
14893 [mailto:enclosed@mail.tld]
14894
14895 mailto:inline@mail.tld
14896 !! html/php
14897 <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>
14898 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
14899 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
14900 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
14901 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
14902 </p>
14903 !! html/parsoid
14904 <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>
14905 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
14906 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
14907 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
14908 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
14909 !! end
14910
14911
14912 #
14913 # Security and HTML correctness
14914 # From Nick Jenkins' fuzz testing
14915 #
14916
14917 !! test
14918 Fuzz testing: Parser13
14919 !! wikitext
14920 {|
14921 | http://a|
14922 !! html
14923 <table>
14924 <tr>
14925 <td>
14926 </td>
14927 </tr>
14928 </table>
14929
14930 !! end
14931
14932 !! test
14933 Fuzz testing: Parser14
14934 !! wikitext
14935 == onmouseover= ==
14936 http://__TOC__
14937 !! html
14938 <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>
14939 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14940 <ul>
14941 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
14942 </ul>
14943 </div>
14944
14945
14946 !! html+tidy
14947 <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>
14948 <p>http://</p>
14949 <div id="toc" class="toc">
14950 <div id="toctitle">
14951 <h2>Contents</h2>
14952 </div>
14953 <ul>
14954 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
14955 </ul>
14956 </div>
14957 !! end
14958
14959 !! test
14960 Fuzz testing: Parser14-table
14961 !! wikitext
14962 ==a==
14963 {| STYLE=__TOC__
14964 !! html
14965 <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>
14966 <table style="&#95;_TOC&#95;_">
14967 <tr><td></td></tr>
14968 </table>
14969
14970 !! html+tidy
14971 <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>
14972 <table style="__TOC__">
14973 <tr>
14974 <td></td>
14975 </tr>
14976 </table>
14977 !! end
14978
14979 # Known to produce bogus xml (extra </td>)
14980 !! test
14981 Fuzz testing: Parser16
14982 !! options
14983 noxml
14984 !! wikitext
14985 {|
14986 !https://||||||
14987 !! html
14988 <table>
14989 <tr>
14990 <th>https://</th>
14991 <th></th>
14992 <th></th>
14993 <th>
14994 </td>
14995 </tr>
14996 </table>
14997
14998 !! html+tidy
14999 <table>
15000 <tr>
15001 <th>https://</th>
15002 <th></th>
15003 <th></th>
15004 <th></th>
15005 </tr>
15006 </table>
15007 !! end
15008
15009 !! test
15010 Fuzz testing: Parser21
15011 !! wikitext
15012 {|
15013 ! irc://{{ftp://a" onmouseover="alert('hello world');"
15014 |
15015 !! html
15016 <table>
15017 <tr>
15018 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
15019 </th>
15020 <td>
15021 </td>
15022 </tr>
15023 </table>
15024
15025 !! end
15026
15027 !! test
15028 Fuzz testing: Parser22
15029 !! wikitext
15030 http://===r:::https://b
15031
15032 {|
15033 !! html
15034 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
15035 </p>
15036 <table>
15037 <tr><td></td></tr>
15038 </table>
15039
15040 !! end
15041
15042 # Known to produce bad XML for now
15043 !! test
15044 Fuzz testing: Parser24
15045 !! options
15046 noxml
15047 !! wikitext
15048 {|
15049 {{{|
15050 <u CLASS=
15051 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
15052 <br style="onmouseover='alert(document.cookie);' " />
15053
15054 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15055 |
15056 !! html
15057 <table>
15058 {{{|
15059 <u class="&#124;">}}}} &gt;
15060 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
15061
15062 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15063 <tr>
15064 <td></u>
15065 </td>
15066 </tr>
15067 </table>
15068
15069 !! end
15070
15071 # Note: the current result listed for this is not what the original one was,
15072 # but the original bug was JavaScript injection, which is fixed in any case.
15073 # It's not clear that the original result listed was any more correct than the
15074 # current one. Original result:
15075 # <p>{{{|
15076 # </p>
15077 # <li class="&#124;&#124;">
15078 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15079 !!test
15080 Fuzz testing: Parser25 (bug 6055)
15081 !! wikitext
15082 {{{
15083 |
15084 <LI CLASS=||
15085 >
15086 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15087 !! html
15088 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15089 </p>
15090 !! end
15091
15092 !!test
15093 Fuzz testing: URL adjacent extension (with space, clean)
15094 !! wikitext
15095 http://example.com <nowiki>junk</nowiki>
15096 !! html
15097 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15098 </p>
15099 !!end
15100
15101 !!test
15102 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15103 !! wikitext
15104 http://example.com<nowiki>junk</nowiki>
15105 !! html
15106 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15107 </p>
15108 !!end
15109
15110 !!test
15111 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15112 !! wikitext
15113 http://example.com<pre>junk</pre>
15114 !! html
15115 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15116
15117 !! html+tidy
15118 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15119 <pre>
15120 junk
15121 </pre>
15122 !!end
15123
15124 !!test
15125 Fuzz testing: image with bogus manual thumbnail
15126 !! wikitext
15127 [[Image:foobar.jpg|thumbnail= ]]
15128 !! html/php
15129 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
15130
15131 !! html/parsoid
15132 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}'/>
15133 !!end
15134
15135 !! test
15136 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15137 !! wikitext
15138 <pre dir="&#10;"></pre>
15139 !! html
15140 <pre dir="&#10;"></pre>
15141
15142 !! end
15143
15144 !! test
15145 Parsing optional HTML elements (Bug 6171)
15146 !! options
15147 !! wikitext
15148 <table>
15149 <tr>
15150 <td> Some tabular data</td>
15151 <td> More tabular data ...
15152 <td> And yet som tabular data</td>
15153 </tr>
15154 </table>
15155 !! html
15156 <table>
15157 <tr>
15158 <td> Some tabular data</td>
15159 <td> More tabular data ...
15160 </td><td> And yet som tabular data</td>
15161 </tr>
15162 </table>
15163
15164 !! end
15165
15166 !! test
15167 Correct handling of <td>, <tr> (Bug 6171)
15168 !! options
15169 !! wikitext
15170 <table>
15171 <tr>
15172 <td> Some tabular data</td>
15173 <td> More tabular data ...</td>
15174 <td> And yet som tabular data</td>
15175 </tr>
15176 </table>
15177 !! html
15178 <table>
15179 <tr>
15180 <td> Some tabular data</td>
15181 <td> More tabular data ...</td>
15182 <td> And yet som tabular data</td>
15183 </tr>
15184 </table>
15185
15186 !! end
15187
15188
15189 !! test
15190 Parsing crashing regression (fr:JavaScript)
15191 !! wikitext
15192 </body></x>
15193 !! html
15194 <p>&lt;/body&gt;&lt;/x&gt;
15195 </p>
15196 !! end
15197
15198 !! test
15199 Inline wiki vs wiki block nesting
15200 !! wikitext
15201 '''Bold paragraph
15202
15203 New wiki paragraph
15204 !! html
15205 <p><b>Bold paragraph</b>
15206 </p><p>New wiki paragraph
15207 </p>
15208 !! end
15209
15210 # FIXME: The current php output is documented
15211 # and desired output is the parsoid target.
15212 !! test
15213 Inline HTML vs wiki block nesting
15214 !! wikitext
15215 <b>Bold paragraph
15216
15217 New wiki paragraph
15218 !! html/php
15219 <p><b>Bold paragraph
15220 </p><p>New wiki paragraph</b>
15221 </p>
15222 !! html/parsoid
15223 <p><b>Bold paragraph</b>
15224 </p><p>New wiki paragraph
15225 </p>
15226 !! end
15227
15228 # Original result was this:
15229 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
15230 # </p>
15231 # While that might be marginally more intuitive, maybe, the six-apostrophe
15232 # construct is clearly pathological and the result stated here (which is what
15233 # the parser actually does) is about as reasonable as anything.
15234 !!test
15235 Mixing markup for italics and bold
15236 !! options
15237 !! wikitext
15238 '''bold''''''bold''bolditalics'''''
15239 !! html
15240 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
15241 </p>
15242 !! end
15243
15244
15245 !! article
15246 Xyzzyx
15247 !! text
15248 Article for special page transclusion test
15249 !! endarticle
15250
15251 !! test
15252 Special page transclusion
15253 !! options
15254 !! wikitext
15255 {{Special:Prefixindex/Xyzzyx}}
15256 !! html
15257 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15258
15259 !! end
15260
15261 !! test
15262 Special page transclusion twice (bug 5021)
15263 !! options
15264 !! wikitext
15265 {{Special:Prefixindex/Xyzzyx}}
15266 {{Special:Prefixindex/Xyzzyx}}
15267 !! html
15268 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15269 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15270
15271 !! end
15272
15273 !! test
15274 Transclusion of default MediaWiki message
15275 !! wikitext
15276 {{MediaWiki:Mainpage}}
15277 !! html
15278 <p>Main Page
15279 </p>
15280 !! end
15281
15282 !! test
15283 Transclusion of nonexistent MediaWiki message
15284 !! wikitext
15285 {{MediaWiki:Mainpagexxx}}
15286 !! html
15287 <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>
15288 </p>
15289 !! end
15290
15291 !! test
15292 Transclusion of MediaWiki message with underscore
15293 !! wikitext
15294 {{MediaWiki:history_short}}
15295 !! html
15296 <p>History
15297 </p>
15298 !! end
15299
15300 !! test
15301 Transclusion of MediaWiki message with space
15302 !! wikitext
15303 {{MediaWiki:history short}}
15304 !! html
15305 <p>History
15306 </p>
15307 !! end
15308
15309 !! test
15310 Invalid header with following text
15311 !! wikitext
15312 = x = y
15313 !! html
15314 <p>= x = y
15315 </p>
15316 !! end
15317
15318
15319 !! test
15320 Section extraction test (section 0)
15321 !! options
15322 section=0
15323 !! wikitext
15324 start
15325 ==a==
15326 ===aa===
15327 ====aaa====
15328 ==b==
15329 ===ba===
15330 ===bb===
15331 ====bba====
15332 ===bc===
15333 ==c==
15334 ===ca===
15335 !! html
15336 start
15337 !! end
15338
15339 !! test
15340 Section extraction test (section 1)
15341 !! options
15342 section=1
15343 !! wikitext
15344 start
15345 ==a==
15346 ===aa===
15347 ====aaa====
15348 ==b==
15349 ===ba===
15350 ===bb===
15351 ====bba====
15352 ===bc===
15353 ==c==
15354 ===ca===
15355 !! html
15356 ==a==
15357 ===aa===
15358 ====aaa====
15359 !! end
15360
15361 !! test
15362 Section extraction test (section 2)
15363 !! options
15364 section=2
15365 !! wikitext
15366 start
15367 ==a==
15368 ===aa===
15369 ====aaa====
15370 ==b==
15371 ===ba===
15372 ===bb===
15373 ====bba====
15374 ===bc===
15375 ==c==
15376 ===ca===
15377 !! html
15378 ===aa===
15379 ====aaa====
15380 !! end
15381
15382 !! test
15383 Section extraction test (section 3)
15384 !! options
15385 section=3
15386 !! wikitext
15387 start
15388 ==a==
15389 ===aa===
15390 ====aaa====
15391 ==b==
15392 ===ba===
15393 ===bb===
15394 ====bba====
15395 ===bc===
15396 ==c==
15397 ===ca===
15398 !! html
15399 ====aaa====
15400 !! end
15401
15402 !! test
15403 Section extraction test (section 4)
15404 !! options
15405 section=4
15406 !! wikitext
15407 start
15408 ==a==
15409 ===aa===
15410 ====aaa====
15411 ==b==
15412 ===ba===
15413 ===bb===
15414 ====bba====
15415 ===bc===
15416 ==c==
15417 ===ca===
15418 !! html
15419 ==b==
15420 ===ba===
15421 ===bb===
15422 ====bba====
15423 ===bc===
15424 !! end
15425
15426 !! test
15427 Section extraction test (section 5)
15428 !! options
15429 section=5
15430 !! wikitext
15431 start
15432 ==a==
15433 ===aa===
15434 ====aaa====
15435 ==b==
15436 ===ba===
15437 ===bb===
15438 ====bba====
15439 ===bc===
15440 ==c==
15441 ===ca===
15442 !! html
15443 ===ba===
15444 !! end
15445
15446 !! test
15447 Section extraction test (section 6)
15448 !! options
15449 section=6
15450 !! wikitext
15451 start
15452 ==a==
15453 ===aa===
15454 ====aaa====
15455 ==b==
15456 ===ba===
15457 ===bb===
15458 ====bba====
15459 ===bc===
15460 ==c==
15461 ===ca===
15462 !! html
15463 ===bb===
15464 ====bba====
15465 !! end
15466
15467 !! test
15468 Section extraction test (section 7)
15469 !! options
15470 section=7
15471 !! wikitext
15472 start
15473 ==a==
15474 ===aa===
15475 ====aaa====
15476 ==b==
15477 ===ba===
15478 ===bb===
15479 ====bba====
15480 ===bc===
15481 ==c==
15482 ===ca===
15483 !! html
15484 ====bba====
15485 !! end
15486
15487 !! test
15488 Section extraction test (section 8)
15489 !! options
15490 section=8
15491 !! wikitext
15492 start
15493 ==a==
15494 ===aa===
15495 ====aaa====
15496 ==b==
15497 ===ba===
15498 ===bb===
15499 ====bba====
15500 ===bc===
15501 ==c==
15502 ===ca===
15503 !! html
15504 ===bc===
15505 !! end
15506
15507 !! test
15508 Section extraction test (section 9)
15509 !! options
15510 section=9
15511 !! wikitext
15512 start
15513 ==a==
15514 ===aa===
15515 ====aaa====
15516 ==b==
15517 ===ba===
15518 ===bb===
15519 ====bba====
15520 ===bc===
15521 ==c==
15522 ===ca===
15523 !! html
15524 ==c==
15525 ===ca===
15526 !! end
15527
15528 !! test
15529 Section extraction test (section 10)
15530 !! options
15531 section=10
15532 !! wikitext
15533 start
15534 ==a==
15535 ===aa===
15536 ====aaa====
15537 ==b==
15538 ===ba===
15539 ===bb===
15540 ====bba====
15541 ===bc===
15542 ==c==
15543 ===ca===
15544 !! html
15545 ===ca===
15546 !! end
15547
15548 !! test
15549 Section extraction test (nonexistent section 11)
15550 !! options
15551 section=11
15552 !! wikitext
15553 start
15554 ==a==
15555 ===aa===
15556 ====aaa====
15557 ==b==
15558 ===ba===
15559 ===bb===
15560 ====bba====
15561 ===bc===
15562 ==c==
15563 ===ca===
15564 !! html
15565 !! end
15566
15567 !! test
15568 Section extraction test with bogus heading (section 1)
15569 !! options
15570 section=1
15571 !! wikitext
15572 ==a==
15573 ==bogus== not a legal section
15574 ==b==
15575 !! html
15576 ==a==
15577 ==bogus== not a legal section
15578 !! end
15579
15580 !! test
15581 Section extraction test with bogus heading (section 2)
15582 !! options
15583 section=2
15584 !! wikitext
15585 ==a==
15586 ==bogus== not a legal section
15587 ==b==
15588 !! html
15589 ==b==
15590 !! end
15591
15592 !! test
15593 Section extraction test with comment after heading (section 1)
15594 !! options
15595 section=1
15596 !! wikitext
15597 ==a==
15598 ==b== <!-- -->
15599 ==c==
15600 !! html
15601 ==a==
15602 !! end
15603
15604 !! test
15605 Section extraction test with comment after heading (section 2)
15606 !! options
15607 section=2
15608 !! wikitext
15609 ==a==
15610 ==b== <!-- -->
15611 ==c==
15612 !! html
15613 ==b== <!-- -->
15614 !! end
15615
15616 !! test
15617 Section extraction test with bogus <nowiki> heading (section 1)
15618 !! options
15619 section=1
15620 !! wikitext
15621 ==a==
15622 ==bogus== <nowiki>not a legal section</nowiki>
15623 ==b==
15624 !! html
15625 ==a==
15626 ==bogus== <nowiki>not a legal section</nowiki>
15627 !! end
15628
15629 !! test
15630 Section extraction test with bogus <nowiki> heading (section 2)
15631 !! options
15632 section=2
15633 !! wikitext
15634 ==a==
15635 ==bogus== <nowiki>not a legal section</nowiki>
15636 ==b==
15637 !! html
15638 ==b==
15639 !! end
15640
15641
15642 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
15643 # instead of respecting commented sections
15644 !! test
15645 Section extraction prefixed by comment (section 1)
15646 !! options
15647 section=1
15648 !! wikitext
15649 <!-- -->==sec1==
15650 ==sec2==
15651 !! html
15652 ==sec2==
15653 !!end
15654
15655 !! test
15656 Section extraction prefixed by comment (section 2)
15657 !! options
15658 section=2
15659 !! wikitext
15660 <!-- -->==sec1==
15661 ==sec2==
15662 !! html
15663
15664 !!end
15665
15666
15667 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
15668 # instead of respecting HTML-style headings
15669 !! test
15670 Section extraction, mixed wiki and html (section 1)
15671 !! options
15672 section=1
15673 !! wikitext
15674 <h2>unmarked</h2>
15675 unmarked
15676 ==1==
15677 one
15678 ==2==
15679 two
15680 !! html
15681 ==1==
15682 one
15683 !! end
15684
15685 !! test
15686 Section extraction, mixed wiki and html (section 2)
15687 !! options
15688 section=2
15689 !! wikitext
15690 <h2>unmarked</h2>
15691 unmarked
15692 ==1==
15693 one
15694 ==2==
15695 two
15696 !! html
15697 ==2==
15698 two
15699 !! end
15700
15701
15702 # Formerly testing for bug 3342
15703 !! test
15704 Section extraction, heading surrounded by <noinclude>
15705 !! options
15706 section=1
15707 !! wikitext
15708 <noinclude>==unmarked==</noinclude>
15709 ==marked==
15710 !! html
15711 ==marked==
15712 !!end
15713
15714 # Test behavior of bug 19910
15715 !! test
15716 Sectiion with all-equals
15717 !! options
15718 section=2
15719 !! wikitext
15720 ===
15721 The line above must have a trailing space
15722 === <!--
15723 --> <!-- -->
15724 But just in case it doesn't...
15725 !! html
15726 === <!--
15727 --> <!-- -->
15728 But just in case it doesn't...
15729 !! end
15730
15731 !! test
15732 Section replacement test (section 0)
15733 !! options
15734 replace=0,"xxx"
15735 !! wikitext
15736 start
15737 ==a==
15738 ===aa===
15739 ====aaa====
15740 ==b==
15741 ===ba===
15742 ===bb===
15743 ====bba====
15744 ===bc===
15745 ==c==
15746 ===ca===
15747 !! html
15748 xxx
15749
15750 ==a==
15751 ===aa===
15752 ====aaa====
15753 ==b==
15754 ===ba===
15755 ===bb===
15756 ====bba====
15757 ===bc===
15758 ==c==
15759 ===ca===
15760 !! end
15761
15762 !! test
15763 Section replacement test (section 1)
15764 !! options
15765 replace=1,"xxx"
15766 !! wikitext
15767 start
15768 ==a==
15769 ===aa===
15770 ====aaa====
15771 ==b==
15772 ===ba===
15773 ===bb===
15774 ====bba====
15775 ===bc===
15776 ==c==
15777 ===ca===
15778 !! html
15779 start
15780 xxx
15781
15782 ==b==
15783 ===ba===
15784 ===bb===
15785 ====bba====
15786 ===bc===
15787 ==c==
15788 ===ca===
15789 !! end
15790
15791 !! test
15792 Section replacement test (section 2)
15793 !! options
15794 replace=2,"xxx"
15795 !! wikitext
15796 start
15797 ==a==
15798 ===aa===
15799 ====aaa====
15800 ==b==
15801 ===ba===
15802 ===bb===
15803 ====bba====
15804 ===bc===
15805 ==c==
15806 ===ca===
15807 !! html
15808 start
15809 ==a==
15810 xxx
15811
15812 ==b==
15813 ===ba===
15814 ===bb===
15815 ====bba====
15816 ===bc===
15817 ==c==
15818 ===ca===
15819 !! end
15820
15821 !! test
15822 Section replacement test (section 3)
15823 !! options
15824 replace=3,"xxx"
15825 !! wikitext
15826 start
15827 ==a==
15828 ===aa===
15829 ====aaa====
15830 ==b==
15831 ===ba===
15832 ===bb===
15833 ====bba====
15834 ===bc===
15835 ==c==
15836 ===ca===
15837 !! html
15838 start
15839 ==a==
15840 ===aa===
15841 xxx
15842
15843 ==b==
15844 ===ba===
15845 ===bb===
15846 ====bba====
15847 ===bc===
15848 ==c==
15849 ===ca===
15850 !! end
15851
15852 !! test
15853 Section replacement test (section 4)
15854 !! options
15855 replace=4,"xxx"
15856 !! wikitext
15857 start
15858 ==a==
15859 ===aa===
15860 ====aaa====
15861 ==b==
15862 ===ba===
15863 ===bb===
15864 ====bba====
15865 ===bc===
15866 ==c==
15867 ===ca===
15868 !! html
15869 start
15870 ==a==
15871 ===aa===
15872 ====aaa====
15873 xxx
15874
15875 ==c==
15876 ===ca===
15877 !! end
15878
15879 !! test
15880 Section replacement test (section 5)
15881 !! options
15882 replace=5,"xxx"
15883 !! wikitext
15884 start
15885 ==a==
15886 ===aa===
15887 ====aaa====
15888 ==b==
15889 ===ba===
15890 ===bb===
15891 ====bba====
15892 ===bc===
15893 ==c==
15894 ===ca===
15895 !! html
15896 start
15897 ==a==
15898 ===aa===
15899 ====aaa====
15900 ==b==
15901 xxx
15902
15903 ===bb===
15904 ====bba====
15905 ===bc===
15906 ==c==
15907 ===ca===
15908 !! end
15909
15910 !! test
15911 Section replacement test (section 6)
15912 !! options
15913 replace=6,"xxx"
15914 !! wikitext
15915 start
15916 ==a==
15917 ===aa===
15918 ====aaa====
15919 ==b==
15920 ===ba===
15921 ===bb===
15922 ====bba====
15923 ===bc===
15924 ==c==
15925 ===ca===
15926 !! html
15927 start
15928 ==a==
15929 ===aa===
15930 ====aaa====
15931 ==b==
15932 ===ba===
15933 xxx
15934
15935 ===bc===
15936 ==c==
15937 ===ca===
15938 !! end
15939
15940 !! test
15941 Section replacement test (section 7)
15942 !! options
15943 replace=7,"xxx"
15944 !! wikitext
15945 start
15946 ==a==
15947 ===aa===
15948 ====aaa====
15949 ==b==
15950 ===ba===
15951 ===bb===
15952 ====bba====
15953 ===bc===
15954 ==c==
15955 ===ca===
15956 !! html
15957 start
15958 ==a==
15959 ===aa===
15960 ====aaa====
15961 ==b==
15962 ===ba===
15963 ===bb===
15964 xxx
15965
15966 ===bc===
15967 ==c==
15968 ===ca===
15969 !! end
15970
15971 !! test
15972 Section replacement test (section 8)
15973 !! options
15974 replace=8,"xxx"
15975 !! wikitext
15976 start
15977 ==a==
15978 ===aa===
15979 ====aaa====
15980 ==b==
15981 ===ba===
15982 ===bb===
15983 ====bba====
15984 ===bc===
15985 ==c==
15986 ===ca===
15987 !! html
15988 start
15989 ==a==
15990 ===aa===
15991 ====aaa====
15992 ==b==
15993 ===ba===
15994 ===bb===
15995 ====bba====
15996 xxx
15997
15998 ==c==
15999 ===ca===
16000 !!end
16001
16002 !! test
16003 Section replacement test (section 9)
16004 !! options
16005 replace=9,"xxx"
16006 !! wikitext
16007 start
16008 ==a==
16009 ===aa===
16010 ====aaa====
16011 ==b==
16012 ===ba===
16013 ===bb===
16014 ====bba====
16015 ===bc===
16016 ==c==
16017 ===ca===
16018 !! html
16019 start
16020 ==a==
16021 ===aa===
16022 ====aaa====
16023 ==b==
16024 ===ba===
16025 ===bb===
16026 ====bba====
16027 ===bc===
16028 xxx
16029 !! end
16030
16031 !! test
16032 Section replacement test (section 10)
16033 !! options
16034 replace=10,"xxx"
16035 !! wikitext
16036 start
16037 ==a==
16038 ===aa===
16039 ====aaa====
16040 ==b==
16041 ===ba===
16042 ===bb===
16043 ====bba====
16044 ===bc===
16045 ==c==
16046 ===ca===
16047 !! html
16048 start
16049 ==a==
16050 ===aa===
16051 ====aaa====
16052 ==b==
16053 ===ba===
16054 ===bb===
16055 ====bba====
16056 ===bc===
16057 ==c==
16058 xxx
16059 !! end
16060
16061 !! test
16062 Section replacement test with initial whitespace (bug 13728)
16063 !! options
16064 replace=2,"xxx"
16065 !! wikitext
16066 Preformatted initial line
16067 ==a==
16068 ===a===
16069 !! html
16070 Preformatted initial line
16071 ==a==
16072 xxx
16073 !! end
16074
16075
16076 !! test
16077 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16078 !! options
16079 section=1
16080 !! wikitext
16081 ==a==
16082 a
16083 !! html
16084 ==a==
16085 a
16086 !! end
16087
16088 !! test
16089 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16090 !! options
16091 section=1
16092 !! wikitext
16093 ==a==
16094 a
16095 !! html
16096 ==a==
16097 a
16098 !! end
16099
16100
16101 !! test
16102 Section extraction, <pre> around bogus header (bug 10309)
16103 !! options
16104 noxml section=2
16105 !! wikitext
16106 == Section One ==
16107 <pre>
16108 =======
16109 </pre>
16110
16111 == Section Two ==
16112 stuff
16113 !! html
16114 == Section Two ==
16115 stuff
16116 !! end
16117
16118 !! test
16119 Section replacement, <pre> around bogus header (bug 10309)
16120 !! options
16121 noxml replace=2,"xxx"
16122 !! wikitext
16123 == Section One ==
16124 <pre>
16125 =======
16126 </pre>
16127
16128 == Section Two ==
16129 stuff
16130 !! html
16131 == Section One ==
16132 <pre>
16133 =======
16134 </pre>
16135
16136 xxx
16137 !! end
16138
16139
16140
16141 !! test
16142 Handling of &#x0A; in URLs
16143 !! wikitext
16144 ** irc://&#x0A;a
16145 !! html/php
16146 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16147
16148 !! html/parsoid
16149 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16150 a">irc://
16151 a</a></li></ul></li></ul>
16152 !! end
16153
16154 !! test
16155 Handling of %0A in URLs
16156 !! wikitext
16157 ** irc://%0Aa
16158 !! html/php
16159 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16160
16161 !! html/parsoid
16162 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16163 !! end
16164
16165
16166 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16167 !! test
16168 5 quotes, code coverage +1 line
16169 !! options
16170 parsoid=wt2html
16171 !! wikitext
16172 '''''
16173 !! html/php
16174 !! html/parsoid
16175 <p><b><i></i></b></p>
16176 !! end
16177
16178 # same html as previous, but wikitext adjusted to match parsoid html2wt
16179 # note that wt2html and html2html will put the <i> before the <b>
16180 !! test
16181 5 quotes, code coverage +1 line w/ nowiki (1)
16182 !! options
16183 parsoid=wt2wt,html2wt
16184 !! wikitext
16185 '''''<nowiki/>'''''
16186 !! html/php
16187 <p><i></i>
16188 </p>
16189 !! html/parsoid
16190 <p><b><i></i></b></p>
16191 !! end
16192
16193 # same as previous, just swapping the <i> and <b>
16194 !! test
16195 5 quotes, code coverage +1 line w/ nowiki (2)
16196 !! wikitext
16197 '''''<nowiki/>'''''
16198 !! html/php
16199 <p><i></i>
16200 </p>
16201 !! html/parsoid
16202 <p><i><b></b></i></p>
16203 !! end
16204
16205 !! test
16206 Special:Search page linking.
16207 !! wikitext
16208 {{Special:search}}
16209 !! html
16210 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16211 </p>
16212 !! end
16213
16214 !! test
16215 {{!}} is a magic word
16216 !! wikitext
16217 {{!}} is a magic word there and {{!}} is still a magic word here
16218 !! html/php
16219 <p>| is a magic word there and | is still a magic word here
16220 </p>
16221 !! html/parsoid
16222 <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>
16223 !! end
16224
16225 !! test
16226 Say the magic word
16227 !! options
16228 title=[[Parser test]]
16229 !! wikitext
16230 * {{PAGENAME}}
16231 * {{PAGENAMEE}}
16232 * {{FULLPAGENAME}}
16233 * {{FULLPAGENAMEE}}
16234 * {{BASEPAGENAME}}
16235 * {{BASEPAGENAMEE}}
16236 * {{SUBPAGENAME}}
16237 * {{SUBPAGENAMEE}}
16238 * {{ROOTPAGENAME}}
16239 * {{ROOTPAGENAMEE}}
16240 * {{TALKPAGENAME}}
16241 * {{TALKPAGENAMEE}}
16242 * {{SUBJECTPAGENAME}}
16243 * {{SUBJECTPAGENAMEE}}
16244 * {{NAMESPACEE}}
16245 * {{NAMESPACE}}
16246 * {{NAMESPACENUMBER}}
16247 * {{TALKSPACE}}
16248 * {{TALKSPACEE}}
16249 * {{SUBJECTSPACE}}
16250 * {{SUBJECTSPACEE}}
16251 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
16252 !! html
16253 <ul><li> Parser test</li>
16254 <li> Parser_test</li>
16255 <li> Parser test</li>
16256 <li> Parser_test</li>
16257 <li> Parser test</li>
16258 <li> Parser_test</li>
16259 <li> Parser test</li>
16260 <li> Parser_test</li>
16261 <li> Parser test</li>
16262 <li> Parser_test</li>
16263 <li> Talk:Parser test</li>
16264 <li> Talk:Parser_test</li>
16265 <li> Parser test</li>
16266 <li> Parser_test</li>
16267 <li> </li>
16268 <li> </li>
16269 <li> 0</li>
16270 <li> Talk</li>
16271 <li> Talk</li>
16272 <li> </li>
16273 <li> </li>
16274 <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>
16275
16276 !! end
16277 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
16278
16279 !! test
16280 Gallery
16281 !! wikitext
16282 <gallery>
16283 image1.png |
16284 image2.gif|||||
16285
16286 image3|
16287 image4 |300px| centre
16288 image5.svg| http://///////
16289 [[x|xx]]]]
16290 * image6
16291 </gallery>
16292 !! html
16293 <ul class="gallery mw-gallery-traditional">
16294 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16295 <div class="thumb" style="height: 150px;">Image1.png</div>
16296 <div class="gallerytext">
16297 </div>
16298 </div></li>
16299 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16300 <div class="thumb" style="height: 150px;">Image2.gif</div>
16301 <div class="gallerytext">
16302 <p>||||
16303 </p>
16304 </div>
16305 </div></li>
16306 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16307 <div class="thumb" style="height: 150px;">Image3</div>
16308 <div class="gallerytext">
16309 </div>
16310 </div></li>
16311 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16312 <div class="thumb" style="height: 150px;">Image4</div>
16313 <div class="gallerytext">
16314 <p>300px| centre
16315 </p>
16316 </div>
16317 </div></li>
16318 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16319 <div class="thumb" style="height: 150px;">Image5.svg</div>
16320 <div class="gallerytext">
16321 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
16322 </p>
16323 </div>
16324 </div></li>
16325 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16326 <div class="thumb" style="height: 150px;">* image6</div>
16327 <div class="gallerytext">
16328 </div>
16329 </div></li>
16330 </ul>
16331
16332 !! end
16333
16334 !! test
16335 Gallery (with options)
16336 !! wikitext
16337 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
16338 File:Nonexistant.jpg|caption
16339 File:Nonexistant.jpg
16340 image:foobar.jpg|some '''caption''' [[Main Page]]
16341 image:foobar.jpg
16342 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
16343 </gallery>
16344 !! html
16345 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
16346 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
16347 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16348 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
16349 <div class="gallerytext">
16350 <p>caption
16351 </p>
16352 </div>
16353 </div></li>
16354 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16355 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
16356 <div class="gallerytext">
16357 </div>
16358 </div></li>
16359 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16360 <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>
16361 <div class="gallerytext">
16362 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16363 </p>
16364 </div>
16365 </div></li>
16366 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16367 <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>
16368 <div class="gallerytext">
16369 </div>
16370 </div></li>
16371 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16372 <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>
16373 <div class="gallerytext">
16374 <p>Blabla|blabla.
16375 </p>
16376 </div>
16377 </div></li>
16378 </ul>
16379
16380 !! end
16381
16382 !! test
16383 Gallery with link that has fragment
16384 !! wikitext
16385 <gallery>
16386 image:foobar.jpg|link=Main_Page
16387 image:foobar.jpg|link=Main_Page#section
16388 image:foobar.jpg|link=Main Page#section|caption
16389 </gallery>
16390 !! html
16391 <ul class="gallery mw-gallery-traditional">
16392 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16393 <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>
16394 <div class="gallerytext">
16395 </div>
16396 </div></li>
16397 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16398 <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>
16399 <div class="gallerytext">
16400 </div>
16401 </div></li>
16402 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16403 <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>
16404 <div class="gallerytext">
16405 <p>caption
16406 </p>
16407 </div>
16408 </div></li>
16409 </ul>
16410
16411 !! end
16412
16413 !! test
16414 Gallery with wikitext inside caption
16415 !! wikitext
16416 <gallery>
16417 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
16418 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
16419 </gallery>
16420 !! html
16421 <ul class="gallery mw-gallery-traditional">
16422 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16423 <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>
16424 <div class="gallerytext">
16425 <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>
16426 </p>
16427 </div>
16428 </div></li>
16429 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16430 <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>
16431 <div class="gallerytext">
16432 <p>This is a test template
16433 </p>
16434 </div>
16435 </div></li>
16436 </ul>
16437
16438 !! end
16439
16440 !! test
16441 gallery (with showfilename option)
16442 !! wikitext
16443 <gallery showfilename>
16444 File:Nonexistant.jpg|caption
16445 File:Nonexistant.jpg
16446 image:foobar.jpg|some '''caption''' [[Main Page]]
16447 File:Foobar.jpg
16448 </gallery>
16449 !! html
16450 <ul class="gallery mw-gallery-traditional">
16451 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16452 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16453 <div class="gallerytext">
16454 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
16455 caption
16456 </p>
16457 </div>
16458 </div></li>
16459 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16460 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16461 <div class="gallerytext">
16462 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
16463 </p>
16464 </div>
16465 </div></li>
16466 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16467 <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>
16468 <div class="gallerytext">
16469 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16470 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16471 </p>
16472 </div>
16473 </div></li>
16474 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16475 <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>
16476 <div class="gallerytext">
16477 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16478 </p>
16479 </div>
16480 </div></li>
16481 </ul>
16482
16483 !! end
16484
16485 !! test
16486 Gallery (with namespace-less filenames)
16487 !! wikitext
16488 <gallery>
16489 File:Nonexistant.jpg
16490 Nonexistant.jpg
16491 image:foobar.jpg
16492 foobar.jpg
16493 </gallery>
16494 !! html
16495 <ul class="gallery mw-gallery-traditional">
16496 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16497 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16498 <div class="gallerytext">
16499 </div>
16500 </div></li>
16501 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16502 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16503 <div class="gallerytext">
16504 </div>
16505 </div></li>
16506 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16507 <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>
16508 <div class="gallerytext">
16509 </div>
16510 </div></li>
16511 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16512 <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>
16513 <div class="gallerytext">
16514 </div>
16515 </div></li>
16516 </ul>
16517
16518 !! end
16519
16520 !! test
16521 HTML Hex character encoding (spells the word "JavaScript")
16522 !! options
16523 parsoid=wt2html,wt2wt,html2html
16524 !! wikitext
16525 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
16526 !! html/php
16527 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
16528 </p>
16529 !! html/php+tidy
16530 <p>JavaScript</p>
16531 !! html/parsoid
16532 <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>
16533 !! end
16534
16535 !! test
16536 HTML Hex character encoding bogus encoding (bug 26437 regression check)
16537 !! wikitext
16538 &#xsee;&#XSEE;
16539 !! html/php
16540 <p>&amp;#xsee;&amp;#XSEE;
16541 </p>
16542 !! html/parsoid
16543 <p>&amp;#xsee;&amp;#XSEE;</p>
16544 !! end
16545
16546 !! test
16547 HTML Hex character encoding mixed case
16548 !! options
16549 parsoid=wt2html,wt2wt,html2html
16550 !! wikitext
16551 &#xEE;&#Xee;
16552 !! html/php
16553 <p>&#xee;&#xee;
16554 </p>
16555 !! html/php+tidy
16556 <p>îî</p>
16557 !! html/parsoid
16558 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
16559 !! end
16560
16561 !! test
16562 __FORCETOC__ override
16563 !! wikitext
16564 __NEWSECTIONLINK__
16565 __FORCETOC__
16566 !! html
16567 <p><br />
16568 </p>
16569 !! end
16570
16571 !! test
16572 ISBN code coverage
16573 !! wikitext
16574 ISBN 978-0-1234-56&#x20;789
16575 !! html
16576 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
16577 </p>
16578 !! html+tidy
16579 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
16580 !! end
16581
16582 !! test
16583 ISBN followed by 5 spaces
16584 !! wikitext
16585 ISBN
16586 !! html
16587 <p>ISBN
16588 </p>
16589 !! end
16590
16591 !! test
16592 Double ISBN
16593 !! wikitext
16594 ISBN ISBN 1234567890
16595 !! html
16596 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16597 </p>
16598 !! end
16599
16600 !! test
16601 ISBN with an X
16602 !! wikitext
16603 ISBN 3-462-04561-X
16604 !! html
16605 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
16606 </p>
16607 !! end
16608
16609 !! test
16610 ISBN with empty prefix (parsoid test)
16611 !! wikitext
16612 ISBN 1234567890
16613 !! html/parsoid
16614 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
16615 !! end
16616
16617 !! test
16618 Bug 22905: <abbr> followed by ISBN followed by </a>
16619 !! wikitext
16620 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
16621 !! html
16622 <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>
16623 </p>
16624 !! end
16625
16626 !! test
16627 Double RFC
16628 !! wikitext
16629 RFC RFC 1234
16630 !! html
16631 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
16632 </p>
16633 !! end
16634
16635 !! test
16636 Double RFC with a wiki link
16637 !! wikitext
16638 RFC [[RFC 1234]]
16639 !! html
16640 <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>
16641 </p>
16642 !! end
16643
16644 !! test
16645 RFC code coverage
16646 !! wikitext
16647 RFC 983&#x20;987
16648 !! html
16649 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
16650 </p>
16651 !! html+tidy
16652 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
16653 !! end
16654
16655 !! test
16656 Centre-aligned image
16657 !! wikitext
16658 [[Image:foobar.jpg|centre]]
16659 !! html
16660 <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>
16661
16662 !!end
16663
16664 !! test
16665 None-aligned image
16666 !! wikitext
16667 [[Image:foobar.jpg|none]]
16668 !! html
16669 <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>
16670
16671 !!end
16672
16673 !! test
16674 Width + Height sized image (using px) (height is ignored)
16675 !! wikitext
16676 [[Image:foobar.jpg|640x480px]]
16677 !! html
16678 <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>
16679 </p>
16680 !!end
16681
16682 !! test
16683 Width-sized image (using px, no following whitespace)
16684 !! wikitext
16685 [[Image:foobar.jpg|640px]]
16686 !! html
16687 <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>
16688 </p>
16689 !!end
16690
16691 !! test
16692 Width-sized image (using px, with following whitespace - test regression from r39467)
16693 !! wikitext
16694 [[Image:foobar.jpg|640px ]]
16695 !! html
16696 <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>
16697 </p>
16698 !!end
16699
16700 !! test
16701 Width-sized image (using px, with preceding whitespace - test regression from r39467)
16702 !! wikitext
16703 [[Image:foobar.jpg| 640px]]
16704 !! html
16705 <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>
16706 </p>
16707 !!end
16708
16709 !! test
16710 Image with page parameter
16711 !! options
16712 djvu
16713 !! wikitext
16714 [[File:LoremIpsum.djvu|page=2]]
16715 !! html
16716 <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>
16717 </p>
16718 !! end
16719
16720 !! test
16721 Another italics / bold test
16722 !! wikitext
16723 ''' ''x'
16724 !! html
16725 <pre>'<i> </i>x'
16726 </pre>
16727 !!end
16728
16729 # FIXME: The php output seems broken. It's interleaving some open/close tags.
16730 !! test
16731 dt/dd/dl test
16732 !! wikitext
16733 :;;;::
16734 !! html/php
16735 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
16736
16737 !! html/parsoid
16738 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
16739
16740 !!end
16741
16742
16743 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
16744 !! test
16745 Images with the "|" character in the comment
16746 !! wikitext
16747 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
16748 !! html/php
16749 <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>
16750
16751 !! html/parsoid
16752 <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>
16753 !! end
16754
16755 !! test
16756 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
16757 !! wikitext
16758 <html><script>alert(1);</script></html>
16759 !! html
16760 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
16761 </p>
16762 !! end
16763
16764 !! test
16765 HTML with raw HTML ($wgRawHtml==true)
16766 !! options
16767 wgRawHtml=1
16768 !! wikitext
16769 <html><script>alert(1);</script></html>
16770 !! html
16771 <p><script>alert(1);</script>
16772 </p>
16773 !! end
16774
16775 !! test
16776 Parents of subpages, one level up
16777 !! options
16778 subpage title=[[Subpage test/L1/L2/L3]]
16779 !! wikitext
16780 [[../|L2]]
16781 !! html
16782 <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>
16783 </p>
16784 !! end
16785
16786
16787 !! test
16788 Parents of subpages, one level up, not named
16789 !! options
16790 subpage title=[[Subpage test/L1/L2/L3]]
16791 !! wikitext
16792 [[../]]
16793 !! html
16794 <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>
16795 </p>
16796 !! end
16797
16798
16799
16800 !! test
16801 Parents of subpages, two levels up
16802 !! options
16803 subpage title=[[Subpage test/L1/L2/L3]]
16804 !! wikitext
16805 [[../../|L1]]2
16806
16807 [[../../|L1]]l
16808 !! html
16809 <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
16810 </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>
16811 </p>
16812 !! end
16813
16814 !! test
16815 Parents of subpages, two levels up, without trailing slash or name.
16816 !! options
16817 subpage title=[[Subpage test/L1/L2/L3]]
16818 !! wikitext
16819 [[../..]]
16820 !! html
16821 <p>[[../..]]
16822 </p>
16823 !! end
16824
16825 !! test
16826 Parents of subpages, two levels up, with lots of extra trailing slashes.
16827 !! options
16828 subpage title=[[Subpage test/L1/L2/L3]]
16829 !! wikitext
16830 [[../../////]]
16831 !! html
16832 <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>
16833 </p>
16834 !! end
16835
16836 !! article
16837 Subpage test/L1/L2/L3Sibling
16838 !! text
16839 Sibling article
16840 !! endarticle
16841
16842 !! test
16843 Transclusion of a sibling page (one level up)
16844 !! options
16845 subpage title=[[Subpage test/L1/L2/L3]]
16846 !! wikitext
16847 {{../L3Sibling}}
16848 !! html
16849 <p>Sibling article
16850 </p>
16851 !! end
16852
16853 !! test
16854 Transclusion of a child page
16855 !! options
16856 subpage title=[[Subpage test/L1/L2]]
16857 !! wikitext
16858 {{/L3Sibling}}
16859 !! html
16860 <p>Sibling article
16861 </p>
16862 !! end
16863
16864 !! test
16865 Non-transclusion because of too many up levels
16866 !! options
16867 subpage title=[[Subpage test/L1/L2/L3]]
16868 !! wikitext
16869 {{../../../../More than parent}}
16870 !! html
16871 <p>{{../../../../More than parent}}
16872 </p>
16873 !! end
16874
16875 !! test
16876 Definition list code coverage
16877 !! wikitext
16878 ; title : def
16879 ; title : def
16880 ;title: def
16881 !! html/php
16882 <dl><dt> title &#160;</dt>
16883 <dd> def</dd>
16884 <dt> title&#160;</dt>
16885 <dd> def</dd>
16886 <dt>title</dt>
16887 <dd> def</dd></dl>
16888
16889 !! html/parsoid
16890 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
16891 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
16892 <dt>title</dt><dd> def</dd></dl>
16893 !! end
16894
16895 !! test
16896 Don't fall for the self-closing div
16897 !! wikitext
16898 <div>hello world</div/>
16899 !! html
16900 <div>hello world</div>
16901
16902 !! end
16903
16904 !! test
16905 MSGNW magic word
16906 !! wikitext
16907 {{MSGNW:msg}}
16908 !! html
16909 <p>&#91;&#91;:Template:Msg&#93;&#93;
16910 </p>
16911 !! end
16912
16913 !! test
16914 RAW magic word
16915 !! wikitext
16916 {{RAW:QUERTY}}
16917 !! html
16918 <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>
16919 </p>
16920 !! end
16921
16922 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
16923 !! test
16924 Always escape literal '>' in output, not just after '<'
16925 !! wikitext
16926 ><>
16927 !! html
16928 <p>&gt;&lt;&gt;
16929 </p>
16930 !! end
16931
16932 !! test
16933 Template caching
16934 !! wikitext
16935 {{Test}}
16936 {{Test}}
16937 !! html
16938 <p>This is a test template
16939 This is a test template
16940 </p>
16941 !! end
16942
16943
16944 !! article
16945 MediaWiki:Fake
16946 !! text
16947 ==header==
16948 !! endarticle
16949
16950 !! test
16951 Inclusion of !userCanEdit() content
16952 !! wikitext
16953 {{MediaWiki:Fake}}
16954 !! html
16955 <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>
16956
16957 !! end
16958
16959
16960 !! test
16961 Out-of-order TOC heading levels
16962 !! wikitext
16963 ==2==
16964 ======6======
16965 ===3===
16966 =1=
16967 =====5=====
16968 ==2==
16969 !! html
16970 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16971 <ul>
16972 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
16973 <ul>
16974 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
16975 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
16976 </ul>
16977 </li>
16978 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
16979 <ul>
16980 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
16981 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
16982 </ul>
16983 </li>
16984 </ul>
16985 </div>
16986
16987 <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>
16988 <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>
16989 <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>
16990 <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>
16991 <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>
16992 <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>
16993
16994 !! end
16995
16996
16997 !! test
16998 ISBN with a dummy number
16999 !! wikitext
17000 ISBN ---
17001 !! html
17002 <p>ISBN ---
17003 </p>
17004 !! end
17005
17006
17007 !! test
17008 ISBN with space-delimited number
17009 !! wikitext
17010 ISBN 92 9017 032 8
17011 !! html
17012 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
17013 </p>
17014 !! end
17015
17016
17017 !! test
17018 ISBN with multiple spaces, no number
17019 !! wikitext
17020 ISBN foo
17021 !! html
17022 <p>ISBN foo
17023 </p>
17024 !! end
17025
17026
17027 !! test
17028 ISBN length
17029 !! wikitext
17030 ISBN 123456789
17031
17032 ISBN 1234567890
17033
17034 ISBN 12345678901
17035 !! html
17036 <p>ISBN 123456789
17037 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17038 </p><p>ISBN 12345678901
17039 </p>
17040 !! end
17041
17042
17043 !! test
17044 ISBN with trailing year (bug 8110)
17045 !! wikitext
17046 ISBN 1-234-56789-0 - 2006
17047
17048 ISBN 1 234 56789 0 - 2006
17049 !! html
17050 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
17051 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
17052 </p>
17053 !! end
17054
17055
17056 !! test
17057 anchorencode
17058 !! wikitext
17059 {{anchorencode:foo bar©#%n}}
17060 !! html
17061 <p>foo_bar.C2.A9.23.25n
17062 </p>
17063 !! end
17064
17065 !! test
17066 anchorencode trims spaces
17067 !! wikitext
17068 {{anchorencode: __pretty__please__}}
17069 !! html
17070 <p>pretty_please
17071 </p>
17072 !! end
17073
17074 !! test
17075 anchorencode deals with links
17076 !! wikitext
17077 {{anchorencode: [[hello|world]] [[hi]]}}
17078 !! html
17079 <p>world_hi
17080 </p>
17081 !! end
17082
17083 !! test
17084 anchorencode deals with templates
17085 !! wikitext
17086 {{anchorencode: {{Foo}} }}
17087 !! html
17088 <p>FOO
17089 </p>
17090 !! end
17091
17092 !! test
17093 anchorencode encodes like the TOC generator: (bug 18431)
17094 !! wikitext
17095 === _ +:.3A%3A&&amp;]] ===
17096 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17097 __NOEDITSECTION__
17098 !! html
17099 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17100 <p>.2B:.3A.253A.26.26.5D.5D
17101 </p>
17102 !! end
17103
17104 !! test
17105 Bug 6200: blockquotes and paragraph formatting
17106 !! wikitext
17107 <blockquote>
17108 foo
17109 </blockquote>
17110
17111 bar
17112
17113 baz
17114 !! html
17115 <blockquote>
17116 <p>foo
17117 </p>
17118 </blockquote>
17119 <p>bar
17120 </p>
17121 <pre>baz
17122 </pre>
17123 !! end
17124
17125 !! test
17126 Bug 8293: Use of center tag ruins paragraph formatting
17127 !! wikitext
17128 <center>
17129 foo
17130 </center>
17131
17132 bar
17133
17134 baz
17135 !! html
17136 <center>
17137 <p>foo
17138 </p>
17139 </center>
17140 <p>bar
17141 </p>
17142 <pre>baz
17143 </pre>
17144 !! end
17145
17146 !!test
17147 Parsing of overlapping (improperly nested) inline html tags
17148 !! wikitext
17149 <span><s>x</span></s>
17150 !! html/php
17151 <p><span><s>x&lt;/span&gt;</s></span>
17152 </p>
17153 !! html/parsoid
17154 <p><span><s>x</s></span>
17155 </p>
17156 !!end
17157
17158 ###
17159 ### Language variants related tests
17160 ###
17161 !! test
17162 Self-link in language variants
17163 !! options
17164 title=[[Dunav]] language=sr
17165 !! wikitext
17166 Both [[Dunav]] and [[Дунав]] are names for this river.
17167 !! html
17168 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17169 </p>
17170 !!end
17171
17172 !! article
17173 Дуна
17174 !! text
17175 content
17176 !! endarticle
17177
17178 !! test
17179 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17180 !! options
17181 title=[[Duna]] language=sr
17182 !! wikitext
17183 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17184 !! html
17185 <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.
17186 </p>
17187 !! end
17188
17189 !! test
17190 Link to a section of a variant of this title shouldn't be parsed as self-link
17191 !! options
17192 title=[[Duna]] language=sr
17193 !! wikitext
17194 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
17195 !! html
17196 <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.
17197 </p>
17198 !! end
17199
17200 !! test
17201 Link to pages in language variants
17202 !! options
17203 language=sr
17204 !! wikitext
17205 Main Page can be written as [[Маин Паге]]
17206 !! html
17207 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
17208 </p>
17209 !!end
17210
17211
17212 !! test
17213 Multiple links to pages in language variants
17214 !! options
17215 language=sr
17216 !! wikitext
17217 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
17218 !! html
17219 <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>.
17220 </p>
17221 !!end
17222
17223
17224 !! test
17225 Simple template in language variants
17226 !! options
17227 language=sr
17228 !! wikitext
17229 {{тест}}
17230 !! html
17231 <p>This is a test template
17232 </p>
17233 !! end
17234
17235
17236 !! test
17237 Template with explicit namespace in language variants
17238 !! options
17239 language=sr
17240 !! wikitext
17241 {{Template:тест}}
17242 !! html
17243 <p>This is a test template
17244 </p>
17245 !! end
17246
17247
17248 !! test
17249 Basic test for template parameter in language variants
17250 !! options
17251 language=sr
17252 !! wikitext
17253 {{парамтест|param=foo}}
17254 !! html
17255 <p>This is a test template with parameter foo
17256 </p>
17257 !! end
17258
17259
17260 !! test
17261 Simple category in language variants
17262 !! options
17263 language=sr cat
17264 !! wikitext
17265 [[Category:МедиаWики Усер'с Гуиде]]
17266 !! html
17267 <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>
17268 !! end
17269
17270
17271 !! article
17272 Category:分类
17273 !! text
17274 blah
17275 !! endarticle
17276
17277 !! article
17278 Category:分類
17279 !! text
17280 blah
17281 !! endarticle
17282
17283 !! test
17284 Don't convert blue categorylinks to another variant (bug 33210)
17285 !! options
17286 language=zh cat
17287 !! wikitext
17288 [[A]][[Category:分类]]
17289 !! html
17290 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
17291 !! end
17292
17293
17294 !! test
17295 Stripping -{}- tags (language variants)
17296 !! options
17297 language=sr
17298 !! wikitext
17299 Latin proverb: -{Ne nuntium necare}-
17300 !! html
17301 <p>Latin proverb: Ne nuntium necare
17302 </p>
17303 !! end
17304
17305
17306 !! test
17307 Prevent conversion with -{}- tags (language variants)
17308 !! options
17309 language=sr variant=sr-ec
17310 !! wikitext
17311 Latinski: -{Ne nuntium necare}-
17312 !! html
17313 <p>Латински: Ne nuntium necare
17314 </p>
17315 !! end
17316
17317
17318 !! test
17319 Prevent conversion of text with -{}- tags (language variants)
17320 !! options
17321 language=sr variant=sr-ec
17322 !! wikitext
17323 Latinski: -{Ne nuntium necare}-
17324 !! html
17325 <p>Латински: Ne nuntium necare
17326 </p>
17327 !! end
17328
17329
17330 !! test
17331 Prevent conversion of links with -{}- tags (language variants)
17332 !! options
17333 language=sr variant=sr-ec
17334 !! wikitext
17335 -{[[Main Page]]}-
17336 !! html
17337 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17338 </p>
17339 !! end
17340
17341
17342 !! test
17343 -{}- tags within headlines (within html for parserConvert())
17344 !! options
17345 language=sr variant=sr-ec
17346 !! wikitext
17347 == -{Naslov}- ==
17348 !! html
17349 <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>
17350
17351 !! end
17352
17353
17354 !! test
17355 Explicit definition of language variant alternatives
17356 !! options
17357 language=zh variant=zh-tw
17358 !! wikitext
17359 -{zh:China;zh-tw:Taiwan}-, not China
17360 !! html
17361 <p>Taiwan, not China
17362 </p>
17363 !! end
17364
17365
17366 !! test
17367 Conversion around HTML tags
17368 !! options
17369 language=sr variant=sr-ec
17370 !! wikitext
17371 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
17372 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
17373 !! html
17374 <p>
17375 <span title="ЛаCтин">ски</span>
17376 </p>
17377 !! end
17378
17379
17380 !! test
17381 Explicit session-wise language variant mapping (A flag and - flag)
17382 !! options
17383 language=zh variant=zh-tw
17384 !! wikitext
17385 Taiwan is not China.
17386 But -{A|zh:China;zh-tw:Taiwan}- is China,
17387 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
17388 and -{China}- is China.
17389 !! html
17390 <p>Taiwan is not China.
17391 But Taiwan is Taiwan,
17392 (This should be stripped!)
17393 and China is China.
17394 </p>
17395 !! end
17396
17397 !! test
17398 Explicit session-wise language variant mapping (H flag for hide)
17399 !! options
17400 language=zh variant=zh-tw
17401 !! wikitext
17402 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
17403 Taiwan is China.
17404 !! html
17405 <p>(This should be stripped!)
17406 Taiwan is Taiwan.
17407 </p>
17408 !! end
17409
17410 !! test
17411 Adding explicit conversion rule for title (T flag)
17412 !! options
17413 language=zh variant=zh-tw showtitle
17414 !! wikitext
17415 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17416 !! html
17417 Taiwan
17418 <p>Should be stripped!
17419 </p>
17420 !! end
17421
17422 !! test
17423 Testing that changing the language variant here in the tests actually works
17424 !! options
17425 language=zh variant=zh showtitle
17426 !! wikitext
17427 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17428 !! html
17429 China
17430 <p>Should be stripped!
17431 </p>
17432 !! end
17433
17434 !! test
17435 Recursive conversion of alt and title attrs shouldn't clear converter state
17436 !! options
17437 language=zh variant=zh-cn showtitle
17438 !! wikitext
17439 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
17440 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
17441 !! html
17442 China
17443 <p>
17444 Should be stripped<span title="Exclamation">!</span>
17445 </p>
17446 !! end
17447
17448 !! test
17449 Bug 24072: more test on conversion rule for title
17450 !! options
17451 language=zh variant=zh-tw showtitle
17452 !! wikitext
17453 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17454 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
17455 !! html
17456 Taiwan
17457 <p>This should be stripped!
17458 This won't take interferes with the title rule.
17459 </p>
17460 !! end
17461
17462 !! test
17463 Partly disable title conversion if variant == main language code
17464 !! options
17465 language=zh variant=zh title=[[ZH]] showtitle
17466 !! wikitext
17467 -{T|zh-cn:CN;zh-tw:TW}-
17468 !! html
17469 ZH
17470 <p>
17471 </p>
17472 !! end
17473
17474 !! test
17475 Partly disable title conversion if variant == main language code, more
17476 !! options
17477 language=zh variant=zh title=[[ZH]] showtitle
17478 !! wikitext
17479 -{T|TW}-
17480 !! html
17481 ZH
17482 <p>
17483 </p>
17484 !! end
17485
17486 !! test
17487 Raw output of variant escape tags (R flag)
17488 !! options
17489 language=zh variant=zh-tw
17490 !! wikitext
17491 Raw: -{R|zh:China;zh-tw:Taiwan}-
17492 !! html
17493 <p>Raw: zh:China;zh-tw:Taiwan
17494 </p>
17495 !! end
17496
17497 !! test
17498 Nested using of manual convert syntax
17499 !! options
17500 language=zh variant=zh-hk
17501 !! wikitext
17502 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
17503 !! html
17504 <p>Nested: Hello Hong Kong!
17505 </p>
17506 !! end
17507
17508 !! test
17509 Proper conversion of text in external links
17510 !! options
17511 language=sr variant=sr-ec
17512 !! wikitext
17513 http://www.google.com
17514 gopher://www.google.com
17515 [http://www.google.com http://www.google.com]
17516 [gopher://www.google.com gopher://www.google.com]
17517 [https://www.google.com irc://www.google.com]
17518 [ftp://www.google.com www.google.com/ftp://dir]
17519 [//www.google.com www.google.com]
17520 !! html
17521 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17522 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17523 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17524 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17525 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
17526 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
17527 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
17528 </p>
17529 !! end
17530
17531 !! test
17532 Do not convert roman numbers to language variants
17533 !! options
17534 language=sr variant=sr-ec
17535 !! wikitext
17536 Fridrih IV je car.
17537 !! html
17538 <p>Фридрих IV је цар.
17539 </p>
17540 !! end
17541
17542 !! test
17543 Unclosed language converter markup "-{"
17544 !! options
17545 language=sr
17546 !! wikitext
17547 -{T|hello
17548 !! html
17549 <p>-{T|hello
17550 </p>
17551 !! end
17552
17553 !! test
17554 Don't convert raw rule "-{R|=&gt;}-" to "=>"
17555 !! options
17556 language=sr
17557 !! wikitext
17558 -{R|=&gt;}-
17559 !! html
17560 <p>=&gt;
17561 </p>
17562 !!end
17563
17564 !! test
17565 Don't break link parsing if language converter markup is in the caption.
17566 !! options
17567 language=sr variant=sr-ec
17568 !! wikitext
17569 [[Main Page|-{R|main page}-]]
17570 !! html
17571 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
17572 </p>
17573 !! end
17574
17575 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17576 !! test
17577 Don't break image parsing if language converter markup is in the caption.
17578 !! options
17579 language=sr
17580 !! wikitext
17581 [[File:Foobar.jpg|-{R|caption}-]]
17582 !! html/parsoid
17583 <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>
17584 </p>
17585 !! end
17586
17587 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17588 !! test
17589 Don't break list handling if language converter markup is in the item.
17590 !! options
17591 language=zh variant=zh-cn
17592 !! wikitext
17593 ;-{zh-cn:AAA;zh-tw:BBB}-
17594 !! html/php
17595 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
17596
17597 !! html/parsoid
17598 <dl><dt>AAA
17599 </dt></dl>
17600 !! end
17601
17602 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17603 !! test
17604 Don't break table handling if language converter markup is in the cell.
17605 !! options
17606 language=sr variant=sr-ec
17607 !! wikitext
17608 {|
17609 |-
17610 | -{R|B}-
17611 |}
17612 !! html/php
17613 <table>
17614
17615 <tr>
17616 <td>Б}-
17617 </td></tr></table>
17618
17619 !! html/parsoid
17620 <table>
17621
17622 <tr>
17623 <td> B
17624 </td></tr></table>
17625
17626 !! end
17627
17628 !! test
17629 Bug 529: Uncovered bullet
17630 !! wikitext
17631 * Foo {{bullet}}
17632 !! html
17633 <ul><li> Foo </li>
17634 <li> Bar</li></ul>
17635
17636 !! end
17637
17638 # Plain MediaWiki does not remove empty lists, but tidy actually does.
17639 # Templates in Wikipedia rely on this behavior, as tidy has always been
17640 # enabled there. These tests are normally run *without* tidy, so specify the
17641 # full output here.
17642 # To test realistic parsing behavior, apply a tidy-like transformation to both
17643 # the expected output and your parser's output.
17644 !! test
17645 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
17646 !! wikitext
17647 ******* Foo {{bullet}}
17648 !! html
17649 <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>
17650 <li> Bar</li></ul>
17651
17652 !! end
17653
17654 !! test
17655 Bug 529: Uncovered table already at line-start
17656 !! wikitext
17657 x
17658
17659 {{table}}
17660 y
17661 !! html
17662 <p>x
17663 </p>
17664 <table>
17665 <tr>
17666 <td> 1 </td>
17667 <td> 2
17668 </td></tr>
17669 <tr>
17670 <td> 3 </td>
17671 <td> 4
17672 </td></tr></table>
17673 <p>y
17674 </p>
17675 !! end
17676
17677 !! test
17678 Bug 529: Uncovered bullet in parser function result
17679 !! wikitext
17680 * Foo {{lc:{{bullet}} }}
17681 !! html
17682 <ul><li> Foo </li>
17683 <li> bar</li></ul>
17684
17685 !! end
17686
17687 !! test
17688 Bug 5678: Double-parsed template argument
17689 !! wikitext
17690 {{lc:{{{1}}}|hello}}
17691 !! html
17692 <p>{{{1}}}
17693 </p>
17694 !! end
17695
17696 !! test
17697 Bug 5678: Double-parsed template invocation
17698 !! wikitext
17699 {{lc:{{paramtest {{!}} param = hello }} }}
17700 !! html
17701 <p>{{paramtest | param = hello }}
17702 </p>
17703 !! end
17704
17705 !! test
17706 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
17707 !! options
17708 language=cs
17709 title=[[Main Page]]
17710 !! wikitext
17711 {{PRVNÍVELKÉ:ěščř}}
17712 {{prvnívelké:ěščř}}
17713 {{PRVNÍMALÉ:ěščř}}
17714 {{prvnímalé:ěščř}}
17715 {{MALÁ:ěščř}}
17716 {{malá:ěščř}}
17717 {{VELKÁ:ěščř}}
17718 {{velká:ěščř}}
17719 !! html
17720 <p>Ěščř
17721 Ěščř
17722 ěščř
17723 ěščř
17724 ěščř
17725 ěščř
17726 ĚŠČŘ
17727 ĚŠČŘ
17728 </p>
17729 !! end
17730
17731 !! test
17732 Morwen/13: Unclosed link followed by heading
17733 !! wikitext
17734 [[link
17735 ==heading==
17736 !! html
17737 <p>[[link
17738 </p>
17739 <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>
17740
17741 !! end
17742
17743 !! test
17744 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
17745 !! wikitext
17746 {{foo|
17747 =heading=
17748 !! html
17749 <p>{{foo|
17750 </p>
17751 <h1><span class="mw-headline" id="heading">heading</span></h1>
17752
17753 !! end
17754
17755 !! test
17756 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
17757 !! wikitext
17758 {{foo|
17759 ==heading==
17760 !! html
17761 <p>{{foo|
17762 </p>
17763 <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>
17764
17765 !! end
17766
17767 !! test
17768 Tildes in comments
17769 !! options
17770 pst
17771 !! wikitext
17772 <!-- ~~~~ -->
17773 !! html
17774 <!-- ~~~~ -->
17775 !! end
17776
17777 !! test
17778 Paragraphs inside divs (no extra line breaks)
17779 !! wikitext
17780 <div>Line one
17781
17782 Line two</div>
17783 !! html
17784 <div>Line one
17785 Line two</div>
17786
17787 !! end
17788
17789 !! test
17790 Paragraphs inside divs (extra line break on open)
17791 !! wikitext
17792 <div>
17793 Line one
17794
17795 Line two</div>
17796 !! html
17797 <div>
17798 <p>Line one
17799 </p>
17800 Line two</div>
17801
17802 !! end
17803
17804 !! test
17805 Paragraphs inside divs (extra line break on close)
17806 !! wikitext
17807 <div>Line one
17808
17809 Line two
17810 </div>
17811 !! html
17812 <div>Line one
17813 <p>Line two
17814 </p>
17815 </div>
17816
17817 !! end
17818
17819 !! test
17820 Paragraphs inside divs (extra line break on open and close)
17821 !! wikitext
17822 <div>
17823 Line one
17824
17825 Line two
17826 </div>
17827 !! html
17828 <div>
17829 <p>Line one
17830 </p><p>Line two
17831 </p>
17832 </div>
17833
17834 !! end
17835
17836 !! test
17837 Nesting tags, paragraphs on lines which begin with <div>
17838 !! wikitext
17839 <div></div><strong>A
17840 B</strong>
17841 !! html/php+tidy
17842 <p><strong>A</strong></p>
17843 <p><strong>B</strong></p>
17844 !! html/parsoid
17845 <div></div>
17846 <p><strong>A
17847 B</strong>
17848 </p>
17849 !! end
17850
17851 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
17852 !! test
17853 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
17854 !! wikitext
17855 <blockquote>Line one
17856
17857 Line two</blockquote>
17858 !! html
17859 <blockquote>Line one
17860 Line two</blockquote>
17861
17862 !! html+tidy
17863 <blockquote>
17864 <p>Line one Line two</p>
17865 </blockquote>
17866 !! end
17867
17868 !! test
17869 Bug 6200: paragraphs inside blockquotes (extra line break on open)
17870 !! wikitext
17871 <blockquote>
17872 Line one
17873
17874 Line two</blockquote>
17875 !! html
17876 <blockquote>
17877 <p>Line one
17878 </p>
17879 Line two</blockquote>
17880
17881 !! html+tidy
17882 <blockquote>
17883 <p>Line one</p>
17884 Line two</blockquote>
17885 !! end
17886
17887 !! test
17888 Bug 6200: paragraphs inside blockquotes (extra line break on close)
17889 !! wikitext
17890 <blockquote>Line one
17891
17892 Line two
17893 </blockquote>
17894 !! html
17895 <blockquote>Line one
17896 <p>Line two
17897 </p>
17898 </blockquote>
17899
17900 !! html+tidy
17901 <blockquote>
17902 <p>Line one</p>
17903 <p>Line two</p>
17904 </blockquote>
17905 !! end
17906
17907 !! test
17908 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
17909 !! wikitext
17910 <blockquote>
17911 Line one
17912
17913 Line two
17914 </blockquote>
17915 !! html
17916 <blockquote>
17917 <p>Line one
17918 </p><p>Line two
17919 </p>
17920 </blockquote>
17921
17922 !! html+tidy
17923 <blockquote>
17924 <p>Line one</p>
17925 <p>Line two</p>
17926 </blockquote>
17927 !! end
17928
17929 !! test
17930 Paragraphs inside blockquotes/divs (no extra line breaks)
17931 !! wikitext
17932 <blockquote><div>Line one
17933
17934 Line two</div></blockquote>
17935 !! html
17936 <blockquote><div>Line one
17937 Line two</div></blockquote>
17938
17939 !! end
17940
17941 !! test
17942 Paragraphs inside blockquotes/divs (extra line break on open)
17943 !! wikitext
17944 <blockquote><div>
17945 Line one
17946
17947 Line two</div></blockquote>
17948 !! html
17949 <blockquote><div>
17950 <p>Line one
17951 </p>
17952 Line two</div></blockquote>
17953
17954 !! end
17955
17956 !! test
17957 Paragraphs inside blockquotes/divs (extra line break on close)
17958 !! wikitext
17959 <blockquote><div>Line one
17960
17961 Line two
17962 </div></blockquote>
17963 !! html
17964 <blockquote><div>Line one
17965 <p>Line two
17966 </p>
17967 </div></blockquote>
17968
17969 !! end
17970
17971 !! test
17972 Paragraphs inside blockquotes/divs (extra line break on open and close)
17973 !! wikitext
17974 <blockquote><div>
17975 Line one
17976
17977 Line two
17978 </div></blockquote>
17979 !! html
17980 <blockquote><div>
17981 <p>Line one
17982 </p><p>Line two
17983 </p>
17984 </div></blockquote>
17985
17986 !! end
17987
17988 !! test
17989 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
17990 !! options
17991 wgLinkHolderBatchSize=0
17992 !! wikitext
17993 [[meatball:1]]
17994 [[meatball:2]]
17995 [[meatball:3]]
17996 !! html
17997 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
17998 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
17999 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
18000 </p>
18001 !! end
18002
18003 !! test
18004 Free external link invading image caption
18005 !! wikitext
18006 [[Image:Foobar.jpg|thumb|http://x|hello]]
18007 !! html
18008 <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>
18009
18010 !! end
18011
18012 !! test
18013 Bug 15196: localised external link numbers
18014 !! options
18015 language=fa
18016 !! wikitext
18017 [http://en.wikipedia.org/]
18018 !! html/php
18019 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
18020 </p>
18021 !! html/parsoid
18022 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
18023 !! end
18024
18025 !! test
18026 Multibyte character in padleft
18027 !! wikitext
18028 {{padleft:-Hello|7|Æ}}
18029 !! html
18030 <p>Æ-Hello
18031 </p>
18032 !! end
18033
18034 !! test
18035 Multibyte character in padright
18036 !! wikitext
18037 {{padright:Hello-|7|Æ}}
18038 !! html
18039 <p>Hello-Æ
18040 </p>
18041 !! end
18042
18043 !!test
18044 formatdate parser function
18045 !! wikitext
18046 {{#formatdate:2009-03-24}}
18047 !! html
18048 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
18049 </p>
18050 !! end
18051
18052 !!test
18053 formatdate parser function, with default format
18054 !! wikitext
18055 {{#formatdate:2009-03-24|mdy}}
18056 !! html
18057 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
18058 </p>
18059 !! end
18060
18061 !! test
18062 Spacing of numbers in formatted dates
18063 !! wikitext
18064 {{#formatdate:January 15}}
18065 !! html
18066 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18067 </p>
18068 !! end
18069
18070 !! test
18071 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
18072 !! options
18073 language=nl title=[[MediaWiki:Common.css]]
18074 !! wikitext
18075 {{#formatdate:2009-03-24|dmy}}
18076 !! html
18077 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18078 </p>
18079 !! end
18080
18081 #
18082 #
18083 #
18084
18085 #
18086 # Edit comments
18087 #
18088
18089 !! test
18090 Edit comment with link
18091 !! options
18092 comment
18093 !! wikitext
18094 I like the [[Main Page]] a lot
18095 !! html
18096 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18097 !!end
18098
18099 !! test
18100 Edit comment with link and link text
18101 !! options
18102 comment
18103 !! wikitext
18104 I like the [[Main Page|best pages]] a lot
18105 !! html
18106 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18107 !!end
18108
18109 !! test
18110 Edit comment with link and link text with suffix
18111 !! options
18112 comment
18113 !! wikitext
18114 I like the [[Main Page|best page]]s a lot
18115 !! html
18116 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18117 !!end
18118
18119 !! test
18120 Edit comment with section link (non-local, eg in history list)
18121 !! options
18122 comment title=[[Main Page]]
18123 !! wikitext
18124 /* External links */ removed bogus entries
18125 !! html
18126 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18127 !!end
18128
18129 !! test
18130 Edit comment with section link and text before it (non-local, eg in history list)
18131 !! options
18132 comment title=[[Main Page]]
18133 !! wikitext
18134 pre-comment text /* External links */ removed bogus entries
18135 !! html
18136 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>
18137 !!end
18138
18139 !! test
18140 Edit comment with section link (local, eg in diff view)
18141 !! options
18142 comment local title=[[Main Page]]
18143 !! wikitext
18144 /* External links */ removed bogus entries
18145 !! html
18146 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18147 !!end
18148
18149 !! test
18150 Edit comment with subpage link (bug 14080)
18151 !! options
18152 comment
18153 subpage
18154 title=[[Subpage test]]
18155 !! wikitext
18156 Poked at a [[/subpage]] here...
18157 !! html
18158 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
18159 !!end
18160
18161 !! test
18162 Edit comment with subpage link and link text (bug 14080)
18163 !! options
18164 comment
18165 subpage
18166 title=[[Subpage test]]
18167 !! wikitext
18168 Poked at a [[/subpage|neat little page]] here...
18169 !! html
18170 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
18171 !!end
18172
18173 !! test
18174 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
18175 !! options
18176 comment
18177 title=[[Subpage test]]
18178 !! wikitext
18179 Poked at a [[/subpage]] here...
18180 !! html
18181 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...
18182 !!end
18183
18184 !! test
18185 Edit comment with bare anchor link (local, as on diff)
18186 !! options
18187 comment
18188 local
18189 title=[[Main Page]]
18190 !! wikitext
18191 [[#section]]
18192 !! html
18193 <a href="#section">#section</a>
18194 !! end
18195
18196 !! test
18197 Edit comment with bare anchor link (non-local, as on history)
18198 !! options
18199 comment
18200 title=[[Main Page]]
18201 !! wikitext
18202 [[#section]]
18203 !! html
18204 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
18205 !! end
18206
18207 !! test
18208 Anchor starting with underscore
18209 !! wikitext
18210 [[#_ref|One]]
18211 !! html
18212 <p><a href="#_ref">One</a>
18213 </p>
18214 !! end
18215
18216 !! test
18217 Id starting with underscore
18218 !! wikitext
18219 <div id="_ref"></div>
18220 !! html
18221 <div id="_ref"></div>
18222
18223 !! end
18224
18225 !! test
18226 Space normalisation on autocomment (bug 22784)
18227 !! options
18228 comment
18229 title=[[Main Page]]
18230 !! wikitext
18231 /* __hello__world__ */
18232 !! html
18233 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
18234 !! end
18235
18236 !! test
18237 percent-encoding and + signs in comments (Bug 26410)
18238 !! options
18239 comment
18240 !! wikitext
18241 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
18242 !! html
18243 <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>
18244 !! end
18245
18246 # FIXME: Omitting the php sections here because of differences in the local and
18247 # jenkins output. But, more importantly, the Bad.jpg isn't being stripped,
18248 # which seems to be a problem with the testing infrastructure.
18249 !! test
18250 Bad images - basic functionality
18251 !! wikitext
18252 [[File:Bad.jpg]]
18253 !! html/parsoid
18254 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[File:Bad.jpg]]","optList":[]}'/>
18255 !! end
18256
18257 # FIXME: Same reasoning as above. The expected php is:
18258 # <p>Foo bar
18259 # </p><p>Bar foo
18260 # </p>
18261 !! test
18262 Bad images - bug 16039: text after bad image disappears
18263 !! wikitext
18264 Foo bar
18265 [[File:Bad.jpg]]
18266 Bar foo
18267 !! html/parsoid
18268 <p>Foo bar
18269 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[File:Bad.jpg]]","optList":[]}'/>
18270 Bar foo</p>
18271 !! end
18272
18273 !! test
18274 Verify that displaytitle works (bug #22501) no displaytitle
18275 !! options
18276 showtitle
18277 !! config
18278 wgAllowDisplayTitle=true
18279 wgRestrictDisplayTitle=false
18280 !! wikitext
18281 this is not the the title
18282 !! html
18283 Parser test
18284 <p>this is not the the title
18285 </p>
18286 !! end
18287
18288 !! test
18289 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
18290 !! options
18291 showtitle
18292 title=[[Screen]]
18293 !! config
18294 wgAllowDisplayTitle=true
18295 wgRestrictDisplayTitle=false
18296 !! wikitext
18297 this is not the the title
18298 {{DISPLAYTITLE:whatever}}
18299 !! html
18300 whatever
18301 <p>this is not the the title
18302 </p>
18303 !! end
18304
18305 !! test
18306 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
18307 !! options
18308 showtitle
18309 title=[[Screen]]
18310 !! config
18311 wgAllowDisplayTitle=true
18312 wgRestrictDisplayTitle=true
18313 !! wikitext
18314 this is not the the title
18315 {{DISPLAYTITLE:whatever}}
18316 !! html
18317 Screen
18318 <p>this is not the the title
18319 </p>
18320 !! end
18321
18322 !! test
18323 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
18324 !! options
18325 showtitle
18326 title=[[Screen]]
18327 !! config
18328 wgAllowDisplayTitle=true
18329 wgRestrictDisplayTitle=true
18330 !! wikitext
18331 this is not the the title
18332 {{DISPLAYTITLE:screen}}
18333 !! html
18334 screen
18335 <p>this is not the the title
18336 </p>
18337 !! end
18338
18339 !! test
18340 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
18341 !! options
18342 showtitle
18343 title=[[Screen]]
18344 !! config
18345 wgAllowDisplayTitle=false
18346 !! wikitext
18347 this is not the the title
18348 {{DISPLAYTITLE:screen}}
18349 !! html
18350 Screen
18351 <p>this is not the the title
18352 <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>
18353 </p>
18354 !! end
18355
18356 !! test
18357 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
18358 !! options
18359 showtitle
18360 title=[[Screen]]
18361 !! config
18362 wgAllowDisplayTitle=false
18363 !! wikitext
18364 this is not the the title
18365 !! html
18366 Screen
18367 <p>this is not the the title
18368 </p>
18369 !! end
18370
18371 !! test
18372 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
18373 !! options
18374 showtitle
18375 title=[[Screen]]
18376 !! config
18377 wgAllowDisplayTitle=true
18378 wgRestrictDisplayTitle=true
18379 !! wikitext
18380 this is not the the title
18381 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
18382 !! html
18383 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
18384 <p>this is not the the title
18385 </p>
18386 !! end
18387
18388 !! test
18389 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
18390 !! options
18391 showtitle
18392 title=[[Screen]]
18393 !! config
18394 wgAllowDisplayTitle=true
18395 wgRestrictDisplayTitle=true
18396 !! wikitext
18397 this is not the the title
18398 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
18399 !! html
18400 <span style="color: red;">s</span>creen
18401 <p>this is not the the title
18402 </p>
18403 !! end
18404
18405 !! test
18406 preload: check <noinclude> and <includeonly>
18407 !! options
18408 preload
18409 !! wikitext
18410 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
18411 !! html
18412 Hello kind world.
18413 !! end
18414
18415 !! test
18416 preload: check <onlyinclude>
18417 !! options
18418 preload
18419 !! wikitext
18420 Goodbye <onlyinclude>Hello world</onlyinclude>
18421 !! html
18422 Hello world
18423 !! end
18424
18425 !! test
18426 preload: can pass tags through if we want to
18427 !! options
18428 preload
18429 !! wikitext
18430 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
18431 !! html
18432 <includeonly>Hello world</includeonly>
18433 !! end
18434
18435 !! test
18436 preload: check that it doesn't try to do tricks
18437 !! options
18438 preload
18439 !! wikitext
18440 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18441 !! html
18442 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18443 !! end
18444
18445 !! test
18446 Play a bit with r67090 and bug 3158
18447 !! wikitext
18448 <div style="width:50% !important">&nbsp;</div>
18449 <div style="width:50%&nbsp;!important">&nbsp;</div>
18450 <div style="width:50%&#160;!important">&nbsp;</div>
18451 <div style="border : solid;">&nbsp;</div>
18452 !! html/php
18453 <div style="width:50% !important">&#160;</div>
18454 <div style="width:50% !important">&#160;</div>
18455 <div style="width:50% !important">&#160;</div>
18456 <div style="border&#160;: solid;">&#160;</div>
18457
18458 !! html/parsoid
18459 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18460 <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>
18461 <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>
18462 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18463
18464 !! end
18465
18466 !! test
18467 HTML5 data attributes
18468 !! wikitext
18469 <span data-foo="bar">Baz</span>
18470 <p data-abc-def_hij="">Quuz</p>
18471 !! html
18472 <p><span data-foo="bar">Baz</span>
18473 </p>
18474 <p data-abc-def_hij="">Quuz</p>
18475
18476 !! end
18477
18478 !! test
18479 percent-encoding and + signs in internal links (Bug 26410)
18480 !! wikitext
18481 [[User:+%]] [[Page+title%]]
18482 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
18483 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
18484 [[%33%45]] [[%33%45+]]
18485 !! html
18486 <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>
18487 <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>
18488 <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>
18489 <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>
18490 </p>
18491 !! end
18492
18493 !! test
18494 Special characters in embedded file links (bug 27679)
18495 !! wikitext
18496 [[File:Contains & ampersand.jpg]]
18497 [[File:Does not exist.jpg|Title with & ampersand]]
18498 !! html
18499 <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>
18500 <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>
18501 </p>
18502 !! end
18503
18504
18505 !! test
18506 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
18507 !! wikitext
18508 Text&apos;s been normalized?
18509 !! html
18510 <p>Text&#39;s been normalized?
18511 </p>
18512 !! end
18513
18514 !! test
18515 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
18516 !! wikitext
18517 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
18518 !! html
18519 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
18520 </p>
18521 !! end
18522
18523 !! test
18524 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
18525 !! wikitext
18526 [http://www.example.org/ ideograms]
18527 !! html
18528 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
18529 </p>
18530 !! end
18531
18532 !! test
18533 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
18534 !! wikitext
18535 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
18536 !! html
18537 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
18538 </p>
18539 !! end
18540
18541 !! article
18542 Mediawiki:loop1
18543 !! text
18544 {{Identical|A}}
18545 !! endarticle
18546
18547 !! article
18548 Mediawiki:loop2
18549 !! text
18550 {{Identical|B}}
18551 !! endarticle
18552
18553 !! article
18554 Template:Identical
18555 !! text
18556 {{int:loop1}}
18557 {{int:loop2}}
18558 !! endarticle
18559
18560 !! test
18561 Bug 31098 Template which includes system messages which includes the template
18562 !! wikitext
18563 {{Identical}}
18564 !! html
18565 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18566 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18567 </p>
18568 !! end
18569
18570 !! test
18571 Bug31490 Turkish: ucfirst 'blah'
18572 !! options
18573 language=tr
18574 !! wikitext
18575 {{ucfirst:blah}}
18576 !! html
18577 <p>Blah
18578 </p>
18579 !! end
18580
18581 !! test
18582 Bug31490 Turkish: ucfirst 'ix'
18583 !! options
18584 language=tr
18585 !! wikitext
18586 {{ucfirst:ix}}
18587 !! html
18588 <p>İx
18589 </p>
18590 !! end
18591
18592 !! test
18593 Bug31490 Turkish: lcfirst 'BLAH'
18594 !! options
18595 language=tr
18596 !! wikitext
18597 {{lcfirst:BLAH}}
18598 !! html
18599 <p>bLAH
18600 </p>
18601 !! end
18602
18603 !! test
18604 Bug31490 Turkish: ucfırst (with a dotless i)
18605 !! options
18606 language=tr
18607 !! wikitext
18608 {{ucfırst:blah}}
18609 !! html
18610 <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>
18611 </p>
18612 !! end
18613
18614 !! test
18615 Bug31490 ucfırst (with a dotless i) with English language
18616 !! options
18617 language=en
18618 !! wikitext
18619 {{ucfırst:blah}}
18620 !! html
18621 <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>
18622 </p>
18623 !! end
18624
18625 !! test
18626 Bug 26375: TOC with italics
18627 !! options
18628 title=[[Main Page]]
18629 !! wikitext
18630 __TOC__
18631 == ''Lost'' episodes ==
18632 !! html
18633 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18634 <ul>
18635 <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>
18636 </ul>
18637 </div>
18638
18639 <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>
18640
18641 !! end
18642
18643 !! test
18644 Bug 26375: TOC with bold
18645 !! options
18646 title=[[Main Page]]
18647 !! wikitext
18648 __TOC__
18649 == '''should be bold''' then normal text ==
18650 !! html
18651 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18652 <ul>
18653 <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>
18654 </ul>
18655 </div>
18656
18657 <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>
18658
18659 !! end
18660
18661 !! test
18662 Bug 33845: Headings become cursive in TOC when they contain an image
18663 !! options
18664 title=[[Main Page]]
18665 !! wikitext
18666 __TOC__
18667 == Image [[Image:foobar.jpg]] ==
18668 !! html
18669 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18670 <ul>
18671 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
18672 </ul>
18673 </div>
18674
18675 <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>
18676
18677 !! end
18678
18679 !! test
18680 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
18681 !! options
18682 title=[[Main Page]]
18683 !! wikitext
18684 __TOC__
18685 == <blockquote>Quote</blockquote> ==
18686 !! html
18687 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18688 <ul>
18689 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18690 </ul>
18691 </div>
18692
18693 <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>
18694
18695 !! html+tidy
18696 <div id="toc" class="toc">
18697 <div id="toctitle">
18698 <h2>Contents</h2>
18699 </div>
18700 <ul>
18701 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18702 </ul>
18703 </div>
18704 <h2><span class="mw-headline" id="Quote"></span></h2>
18705 <blockquote>
18706 <p><span class="mw-headline" id="Quote">Quote</span></p>
18707 </blockquote>
18708 <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>
18709 !! end
18710
18711 !! test
18712 Unclosed tags in TOC
18713 !! options
18714 title=[[Main Page]]
18715 !! wikitext
18716 __TOC__
18717 == Proof: 2 < 3 ==
18718 <small>Hanc marginis exiguitas non caperet.</small>
18719 QED
18720 !! html
18721 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18722 <ul>
18723 <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>
18724 </ul>
18725 </div>
18726
18727 <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>
18728 <p><small>Hanc marginis exiguitas non caperet.</small>
18729 QED
18730 </p>
18731 !! end
18732
18733 !! test
18734 Multiple tags in TOC
18735 !! wikitext
18736 __TOC__
18737 == <i>Foo</i> <b>Bar</b> ==
18738
18739 == <i>Foo</i> <blockquote>Bar</blockquote> ==
18740 !! html
18741 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18742 <ul>
18743 <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>
18744 <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>
18745 </ul>
18746 </div>
18747
18748 <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>
18749 <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>
18750
18751 !! html+tidy
18752 <div id="toc" class="toc">
18753 <div id="toctitle">
18754 <h2>Contents</h2>
18755 </div>
18756 <ul>
18757 <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>
18758 <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>
18759 </ul>
18760 </div>
18761 <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>
18762 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
18763 <blockquote>
18764 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
18765 </blockquote>
18766 <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>
18767 !! end
18768
18769 !! test
18770 Tags with parameters in TOC
18771 !! wikitext
18772 __TOC__
18773 == <sup class="in-h2">Hello</sup> ==
18774
18775 == <sup class="a > b">Evilbye</sup> ==
18776 !! html
18777 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18778 <ul>
18779 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
18780 <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>
18781 </ul>
18782 </div>
18783
18784 <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>
18785 <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>
18786
18787 !! end
18788
18789 !! test
18790 span tags with directionality in TOC
18791 !! wikitext
18792 __TOC__
18793 == <span dir="ltr">C++</span> ==
18794
18795 == <span dir="rtl">זבנג!</span> ==
18796
18797 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
18798
18799 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
18800
18801 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
18802 !! html
18803 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18804 <ul>
18805 <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>
18806 <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>
18807 <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>
18808 <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>
18809 <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>
18810 </ul>
18811 </div>
18812
18813 <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>
18814 <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>
18815 <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>
18816 <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>
18817 <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>
18818
18819 !! end
18820
18821 !! article
18822 MediaWiki:Bug32057
18823 !! text
18824 == {{int:headline_sample}} ==
18825 !! endarticle
18826
18827 !! test
18828 Bug 32057: Title needed when expanding <h> nodes.
18829 !! options
18830 title=[[Main Page]]
18831 !! wikitext
18832 {{int:Bug32057}}
18833 !! html
18834 <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>
18835
18836 !! end
18837
18838 !! test
18839 Strip marker in urlencode
18840 !! wikitext
18841 {{urlencode:x<nowiki/>y}}
18842 {{urlencode:x<nowiki/>y|wiki}}
18843 {{urlencode:x<nowiki/>y|path}}
18844 !! html
18845 <p>xy
18846 xy
18847 xy
18848 </p>
18849 !! end
18850
18851 !! test
18852 Strip marker in lc
18853 !! wikitext
18854 {{lc:x<nowiki/>y}}
18855 !! html
18856 <p>xy
18857 </p>
18858 !! end
18859
18860 !! test
18861 Strip marker in uc
18862 !! wikitext
18863 {{uc:x<nowiki/>y}}
18864 !! html
18865 <p>XY
18866 </p>
18867 !! end
18868
18869 !! test
18870 Strip marker in formatNum
18871 !! wikitext
18872 {{formatnum:1<nowiki/>2}}
18873 {{formatnum:1<nowiki/>2|R}}
18874 !! html
18875 <p>12
18876 12
18877 </p>
18878 !! end
18879
18880 !! test
18881 Check noCommafy in formatNum
18882 !! options
18883 language=be-tarask
18884 !! wikitext
18885 {{formatnum:123456.78}}
18886 {{formatnum:123456.78|NOSEP}}
18887 !! html
18888 <p>123 456,78
18889 123456.78
18890 </p>
18891 !! end
18892
18893 !! test
18894 Wrong option for formatNum (bug 56199)
18895 !! wikitext
18896 {{formatnum:1,234.56|Random}}
18897 {{formatnum:1,234.56|EVERYTHING}}
18898 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
18899 !! html
18900 <p>1,234.56
18901 1,234.56
18902 1,234.56
18903 </p>
18904 !! end
18905
18906 !! test
18907 Strip marker in grammar
18908 !! options
18909 language=fi
18910 !! wikitext
18911 {{grammar:elative|foo<nowiki/>bar}}
18912 !! html
18913 <p>foobarista
18914 </p>
18915 !! end
18916
18917 !! test
18918 Strip marker in padleft
18919 !! wikitext
18920 {{padleft:|2|x<nowiki/>y}}
18921 !! html
18922 <p>xy
18923 </p>
18924 !! end
18925
18926 !! test
18927 Strip marker in padright
18928 !! wikitext
18929 {{padright:|2|x<nowiki/>y}}
18930 !! html
18931 <p>xy
18932 </p>
18933 !! end
18934
18935 !! test
18936 Strip marker in anchorencode
18937 !! wikitext
18938 {{anchorencode:x<nowiki/>y}}
18939 !! html
18940 <p>xy
18941 </p>
18942 !! end
18943
18944 !! test
18945 nowiki inside link inside heading (bug 18295)
18946 !! wikitext
18947 ==[[foo|x<nowiki>y</nowiki>z]]==
18948 !! html
18949 <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>
18950
18951 !! end
18952
18953 !! test
18954 new support for bdi element (bug 31817)
18955 !! wikitext
18956 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
18957 !! html
18958 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
18959
18960 !!end
18961
18962 !! test
18963 Ignore pipe between table row attributes
18964 !! wikitext
18965 {|
18966 | quux
18967 |- id=foo | style='color: red'
18968 | bar
18969 |}
18970 !! html
18971 <table>
18972 <tr>
18973 <td> quux
18974 </td></tr>
18975 <tr id="foo" style="color: red">
18976 <td> bar
18977 </td></tr></table>
18978
18979 !! end
18980
18981 !!test
18982 Gallery override link with WikiLink (bug 34852)
18983 !! wikitext
18984 <gallery>
18985 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
18986 </gallery>
18987 !! html
18988 <ul class="gallery mw-gallery-traditional">
18989 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18990 <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>
18991 <div class="gallerytext">
18992 <p>caption
18993 </p>
18994 </div>
18995 </div></li>
18996 </ul>
18997
18998 !! end
18999
19000 !!test
19001 Gallery override link with absolute external link (bug 34852)
19002 !! wikitext
19003 <gallery>
19004 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19005 </gallery>
19006 !! html
19007 <ul class="gallery mw-gallery-traditional">
19008 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19009 <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>
19010 <div class="gallerytext">
19011 <p>caption
19012 </p>
19013 </div>
19014 </div></li>
19015 </ul>
19016
19017 !! end
19018
19019 !!test
19020 Gallery override link with malicious javascript (bug 34852)
19021 !! wikitext
19022 <gallery>
19023 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19024 </gallery>
19025 !! html
19026 <ul class="gallery mw-gallery-traditional">
19027 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19028 <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>
19029 <div class="gallerytext">
19030 <p>caption
19031 </p>
19032 </div>
19033 </div></li>
19034 </ul>
19035
19036 !! end
19037
19038 !!test
19039 Gallery with invalid title as link (bug 43964)
19040 !! wikitext
19041 <gallery>
19042 File:foobar.jpg|link=<
19043 </gallery>
19044 !! html
19045 <ul class="gallery mw-gallery-traditional">
19046 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19047 <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>
19048 <div class="gallerytext">
19049 </div>
19050 </div></li>
19051 </ul>
19052
19053 !! end
19054
19055 !!test
19056 Language parser function
19057 !! wikitext
19058 {{#language:ar}}
19059 !! html
19060 <p>العربية
19061 </p>
19062 !! end
19063
19064 !!test
19065 Padleft and padright as substr
19066 !! wikitext
19067 {{padleft:|3|abcde}}
19068 {{padright:|3|abcde}}
19069 !! html
19070 <p>abc
19071 abc
19072 </p>
19073 !! end
19074
19075 !!test
19076 Special parser function
19077 !! wikitext
19078 {{#special:RandomPage}}
19079 {{#special:BaDtItLe}}
19080 {{#special:Foobar}}
19081 !! html
19082 <p>Special:Random
19083 Special:Badtitle
19084 Special:Foobar
19085 </p>
19086 !! end
19087
19088 !!test
19089 Bug 34939 - Case insensitive link parsing ([HttP://])
19090 !! wikitext
19091 [HttP://MediaWiki.Org/]
19092 !! html/php
19093 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
19094 </p>
19095 !! html/parsoid
19096 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
19097 !! end
19098
19099 !!test
19100 Bug 34939 - Case insensitive link parsing ([HttP:// title])
19101 !! wikitext
19102 [HttP://MediaWiki.Org/ MediaWiki]
19103 !! html
19104 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
19105 </p>
19106 !! end
19107
19108 !!test
19109 Bug 34939 - Case insensitive link parsing (HttP://)
19110 !! wikitext
19111 HttP://MediaWiki.Org/
19112 !! html/php
19113 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
19114 </p>
19115 !! html/parsoid
19116 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
19117 !! end
19118
19119 !!test
19120 Disable TOC
19121 !! options
19122 notoc
19123 !! wikitext
19124 Lead
19125 == Section 1 ==
19126 == Section 2 ==
19127 == Section 3 ==
19128 == Section 4 ==
19129 == Section 5 ==
19130 !! html
19131 <p>Lead
19132 </p>
19133
19134 <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>
19135 <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>
19136 <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>
19137 <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>
19138 <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>
19139
19140 !! end
19141
19142
19143 ###
19144 ### Parsoid-specific tests
19145 ### Parsoid-PHP parser incompatibilities
19146 ###
19147 !!test
19148 1. SOL-sensitive wikitext tokens as template-args
19149 !!options
19150 parsoid=wt2html,wt2wt
19151 !! wikitext
19152 {{echo|*a}}
19153 {{echo|#a}}
19154 {{echo|:a}}
19155 !! html
19156 <span about="#mwt1" typeof="mw:Transclusion">
19157 </span><ul about="#mwt1"><li>a</li>
19158 </ul>
19159 <span about="#mwt2" typeof="mw:Transclusion">
19160 </span><ol about="#mwt2"><li>a</li>
19161 </ol>
19162 <span about="#mwt3" typeof="mw:Transclusion">
19163 </span><dl about="#mwt3"><dd>a</dd>
19164 </dl>
19165 !!end
19166
19167 #### -----------------------------------------------------------------
19168 #### Parsoid-specific functionality tests
19169 #### -----------------------------------------------------------------
19170
19171 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
19172 # We know wt2wt will fail, but we expect selser to pass.
19173 # Due to the nature of our testing, wt2wt and selser tests will enter the
19174 # blacklist and we'll catch selser regressions based on changes to the
19175 # blacklist entries for selser tests.
19176 !! test
19177 1. Bad treebuilder fixup of formatting elt is cleaned up
19178 !! options
19179 parsoid=wt2html,wt2wt
19180 !! wikitext
19181 {|
19182 |
19183 <small>
19184 [[Image:Foobar.jpg|right|Test]]
19185 </small>
19186 |}
19187 !! html/parsoid
19188 <table>
19189 <tbody><tr><td>
19190 <small>
19191 <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>
19192 </small>
19193 </td></tr>
19194 </tbody></table>
19195 !! end
19196
19197 !! test
19198 2. Bad treebuilder fixup of formatting elt is cleaned up
19199 !! options
19200 parsoid=wt2html,wt2wt
19201 !! wikitext
19202 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
19203
19204 <small>[[Image:Foobar.jpg|right|300px]]</small>
19205 !! html/parsoid
19206 <p><b>foo</b></p>
19207 <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>
19208 <p><b>bar</b></p>
19209 <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>
19210 !! end
19211
19212 #### ----------------------------------------------------------------
19213 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
19214 #### tags. Parsoid's output for these tags differs from that of the
19215 #### PHP parser.
19216 #### ----------------------------------------------------------------
19217
19218 !!test
19219 Ref: 1. ref-location should be replaced with an index span
19220 !!options
19221 parsoid
19222 !! wikitext
19223 A <ref>foo</ref>
19224 B <ref name="x">foo</ref>
19225 C <ref name="y" />
19226 !! html
19227 <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>
19228 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>
19229 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>
19230 !!end
19231
19232 !!test
19233 Ref: 2. ref-tags with identical names should all get the same index
19234 !!options
19235 parsoid
19236 !! wikitext
19237 A <ref name="x">foo</ref>
19238 B <ref name="x" />
19239 !! html
19240 <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>
19241 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>
19242 !!end
19243
19244 !!test
19245 Ref: 3. spaces in ref-names should be ignored
19246 !!options
19247 parsoid
19248 !! wikitext
19249 A <ref name="x">foo</ref>
19250 B <ref name=" x " />
19251 C <ref name= x />
19252 !! html
19253 <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>
19254 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>
19255 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>
19256 !!end
19257
19258 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
19259 !!test
19260 Ref: 4. 'constructor' should be accepted as a valid ref-name
19261 !!options
19262 parsoid
19263 !! wikitext
19264 A <ref name="constructor">foo</ref>
19265 !! html
19266 <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>
19267 !!end
19268
19269 !!test
19270 Ref: 5. body should accept generic wikitext
19271 !!options
19272 parsoid
19273 !! wikitext
19274 A <ref>
19275 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
19276 </ref>
19277
19278 <references />
19279 !! html
19280 <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>
19281
19282 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19283 <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>
19284 </li>
19285 </ol>
19286 !!end
19287
19288 !!test
19289 Ref: 6. indent-pres should not be output in ref-body
19290 !!options
19291 parsoid
19292 !! wikitext
19293 A <ref>
19294 foo
19295 bar
19296 baz
19297 </ref>
19298
19299 <references />
19300 !! html
19301 <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>
19302
19303 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19304 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
19305 bar
19306 baz
19307 </li>
19308 </ol>
19309 !!end
19310
19311 !!test
19312 Ref: 7. No p-wrapping in ref-body
19313 !!options
19314 parsoid
19315 !! wikitext
19316 A <ref>
19317 foo
19318
19319 bar
19320
19321
19322 baz
19323
19324
19325
19326 booz
19327 </ref>
19328
19329 <references />
19330 !! html
19331 <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>
19332
19333 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19334 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
19335
19336 bar
19337
19338
19339 baz
19340
19341
19342
19343 booz
19344 </li>
19345 </ol>
19346 !!end
19347
19348 !!test
19349 Ref: 8. transclusion wikitext has lower precedence
19350 !!options
19351 parsoid
19352 !! wikitext
19353 A <ref> foo {{echo|</ref> B C}}
19354
19355 <references />
19356 !! html
19357 <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>
19358 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19359 <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>
19360 </ol>
19361 !!end
19362
19363 !!test
19364 Ref: 9. unclosed comments should not leak out of ref-body
19365 !!options
19366 parsoid
19367 !! wikitext
19368 A <ref> foo <!--</ref> B C
19369 <references />
19370 !! html
19371 <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>
19372 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19373 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li>
19374 </ol>
19375 !!end
19376
19377 !!test
19378 Ref: 10. Unclosed HTML tags should not leak out of ref-body
19379 !!options
19380 parsoid
19381 !! wikitext
19382 A <ref> <b> foo </ref> B C
19383
19384 <references />
19385 !! html
19386 <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>
19387
19388
19389 <ol class="references" typeof="mw:Extension/references" about="#mwt4" 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> <b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></li>
19391 </ol>
19392 !!end
19393
19394 !!test
19395 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
19396 !!options
19397 parsoid
19398 !! wikitext
19399 A <ref>foo</ref> B
19400 C <ref>bar</ref> D
19401 !! html
19402 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B
19403 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>
19404 !!end
19405
19406 !!test
19407 Ref: 12. ref-tags act as trailing newline migration barrier
19408 !!options
19409 parsoid
19410 !! wikitext
19411 <!--the newline at the end of this line moves out of the p-tag-->a
19412
19413 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
19414 <ref />
19415
19416 c
19417 !! html
19418 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
19419
19420
19421 <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>
19422 <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>
19423
19424 <p>c</p>
19425 !!end
19426
19427 !!test
19428 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
19429 !!options
19430 parsoid
19431 !! wikitext
19432 <ref>foo</ref> A
19433 <ref>bar
19434 </ref> B
19435 !! html
19436 <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
19437 <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>
19438 !!end
19439
19440 !!test
19441 Ref: 14. A nested ref-tag should be emitted as plain text
19442 !!options
19443 parsoid
19444 !! wikitext
19445 <ref>foo <ref>bar</ref> baz</ref>
19446
19447 <references />
19448 !! html
19449 <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>
19450
19451 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19452 <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>
19453 </ol>
19454 !!end
19455
19456 !!test
19457 Ref: 15. ref-tags with identical names should get identical indexes
19458 !!options
19459 parsoid
19460 !! wikitext
19461 A1 <ref name="a">foo</ref> A2 <ref name="a" />
19462 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
19463
19464 <references />
19465 !! html
19466 <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>
19467 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>
19468
19469 <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>
19470 </ol>
19471 !!end
19472
19473 ## We don't bother wt2wt-ing non-standard whitespace
19474 !!test
19475 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
19476 !!options
19477 parsoid=wt2html
19478 !! wikitext
19479 A <ref >foo</ref >
19480
19481 <references />
19482 !! html
19483 <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>
19484
19485 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19486 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19487 !!end
19488
19489 !!test
19490 References: 1. references tag without any refs should be handled properly
19491 !!options
19492 parsoid
19493 !! wikitext
19494 <references />
19495 !! html
19496 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
19497 !!end
19498
19499 !!test
19500 References: 2. references tag with group only outputs references from that group
19501 !!options
19502 parsoid
19503 !! wikitext
19504 A <ref group="a">foo</ref>
19505 B <ref group="b">bar</ref>
19506
19507 <references group="a" />
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":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
19510 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>
19511
19512 <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>
19513 </ol>
19514 !!end
19515
19516 !!test
19517 References: 3. ref list should be cleared after processing references
19518 !!options
19519 parsoid
19520 !! wikitext
19521 A <ref>foo</ref>
19522
19523 <references />
19524
19525 B <ref>bar</ref>
19526
19527 <references />
19528 !! html
19529 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19530
19531 <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>
19532 </ol>
19533
19534 <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>
19535
19536 <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>
19537 </ol>
19538 !!end
19539
19540 !!test
19541 References: 4. only referenced group should be cleared after processing references
19542 !!options
19543 parsoid
19544 !! wikitext
19545 A <ref group="a">afoo</ref>
19546 B <ref>bfoo</ref>
19547
19548 <references group="a" />
19549
19550 C <ref>cfoo</ref>
19551
19552 <references />
19553 !! html
19554 <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>
19555 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>
19556
19557 <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>
19558 </ol>
19559
19560 <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>
19561
19562 <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>
19563 </ol>
19564 !!end
19565
19566 !!test
19567 References: 5. ref tags in references should be processed while ignoring all other content
19568 !!options
19569 parsoid
19570 !! wikitext
19571 A <ref name="a" />
19572 B <ref name="b">bar</ref>
19573
19574 <references>
19575 <ref name="a">foo</ref>
19576 This should just get lost.
19577 </references>
19578 !! html
19579 <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>
19580 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>
19581
19582
19583 <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>
19584 </ol>
19585 !!end
19586
19587 !!test
19588 References: 6. <references /> from a transclusion
19589 !!options
19590 parsoid
19591 !! wikitext
19592 <ref>Foo</ref> {{echo|<references />}}
19593 !! html
19594 <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>
19595 !!end
19596
19597 !! test
19598 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
19599 !! options
19600 parsoid
19601 !! wikitext
19602 A <ref>foo bar for a</ref>
19603 B <ref group="X" name="b" />
19604
19605 <references />
19606
19607 <references group="X">
19608 <ref name="b">foo</ref>
19609 </references>
19610 !! html
19611 <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>
19612 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>
19613
19614 <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>
19615
19616 <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>
19617 !! end
19618
19619 !! test
19620 Entities in ref name
19621 !! options
19622 parsoid
19623 !! wikitext
19624 <ref name="test &amp; me">hi</ref>
19625 !! html
19626 <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>
19627 !! end
19628
19629 # This test is wt2html only because we're permitting the serializer to produce
19630 # dirty diffs, normalizing the unclosed references to the self-closed version.
19631 !! test
19632 Generate references for unclosed references tag
19633 !! options
19634 parsoid=wt2html
19635 !! wikitext
19636 a<ref>foo</ref>
19637
19638 <references>
19639 !! html
19640 <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>
19641
19642
19643 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19644 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19645 !! end
19646
19647 !! test
19648 New reference serializes on its own line
19649 !! options
19650 parsoid=wt2wt,html2wt
19651 !! wikitext
19652 foo
19653 <references />
19654 !! html
19655 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
19656 !! end
19657
19658 #--------- Test stripping of empty nodes in template content ----------
19659 !!test
19660 Empty LI and TR nodes should be stripped from template content
19661 !!wikitext
19662 {{EmptyLITest}}
19663 {{EmptyTRTest}}
19664 !!html/parsoid
19665 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
19666 <li>a</li>
19667 <li>b</li>
19668 </ul>
19669 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
19670 <tbody>
19671 <tr>
19672 <td>foo</td>
19673 </tr>
19674 <tr>
19675 <td>bar</td>
19676 </tr>
19677 </tbody>
19678 </table>
19679 !!end
19680
19681 !!test
19682 Empty LI and TR nodes should not be stripped from top-level content
19683 !!wikitext
19684 * a
19685 *
19686 * b
19687 {|
19688 |-
19689 |-
19690 |foo
19691 |}
19692 !!html/parsoid
19693 <ul>
19694 <li> a</li>
19695 <li></li>
19696 <li> b</li>
19697 </ul>
19698 <table>
19699 <tbody>
19700 <tr></tr>
19701 <tr>
19702 <td>foo</td>
19703 </tr>
19704 </tbody>
19705 </table>
19706 !!end
19707
19708 !!test
19709 Empty TR nodes should not be stripped if they have any attributes set
19710 !!wikitext
19711 {{EmptyTRWithHTMLAttrTest}}
19712 !!html/parsoid
19713 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
19714 <tr align="center"></tr>
19715 <tr><td>foo</td></tr>
19716 <tr align="center"></tr>
19717 <tr><td>bar</td></tr>
19718 </table>
19719 !!end
19720
19721 #### ----------------------------------------------------------------
19722 #### The following section of tests are primarily to test
19723 #### wikitext escaping capabilities of Parsoid. Given that
19724 #### escaping can be done any number of ways, the wikitext (input)
19725 #### is always adjusted to reflect how Parsoid adds nowiki
19726 #### escape tags.
19727 ####
19728 #### We are marking several tests as parsoid-only since the
19729 #### HTML in the result section is different from what the
19730 #### PHP parser generates for it.
19731 #### ----------------------------------------------------------------
19732
19733
19734 #### --------------- Headings ---------------
19735 #### 0. Unnested
19736 #### 1. Nested inside html <h1>=foo=</h1>
19737 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
19738 #### 3. Nested inside html with wikitext split by html tags
19739 #### 4. No escape needed
19740 #### 5. Empty headings <h1></h1>
19741 #### 6. Heading chars in SOL context
19742 #### ----------------------------------------
19743 !! test
19744 Headings: 0. Unnested
19745 !! options
19746 parsoid
19747 !! wikitext
19748 <nowiki>=foo=</nowiki>
19749
19750 <nowiki> =foo= </nowiki>
19751 <!--cmt-->
19752 <nowiki>=foo=</nowiki>
19753
19754 =foo''a''<nowiki>=</nowiki>
19755 !! html
19756 <p><span typeof="mw:Nowiki">=foo=</span></p>
19757
19758 <p><span typeof="mw:Nowiki"> =foo= </span>
19759 <!--cmt-->
19760 <span typeof="mw:Nowiki">=foo=</span></p>
19761
19762 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
19763 !!end
19764
19765 # New headings and existing headings are handled differently
19766 !! test
19767 Headings: 1. Nested inside html
19768 !! options
19769 parsoid=html2wt
19770 !! wikitext
19771 = =foo= =
19772
19773 == =foo= ==
19774
19775 === =foo= ===
19776
19777 =<nowiki>=foo=</nowiki>=
19778 ==<nowiki>=foo=</nowiki>==
19779 ===<nowiki>=foo=</nowiki>===
19780 ====<nowiki>=foo=</nowiki>====
19781 =====<nowiki>=foo=</nowiki>=====
19782 ======<nowiki>=foo=</nowiki>======
19783
19784 !! html
19785 <h1>=foo=</h1>
19786 <h2>=foo=</h2>
19787 <h3>=foo=</h3>
19788
19789 <h1 data-parsoid=''>=foo=</h1>
19790 <h2 data-parsoid=''>=foo=</h2>
19791 <h3 data-parsoid=''>=foo=</h3>
19792 <h4 data-parsoid=''>=foo=</h4>
19793 <h5 data-parsoid=''>=foo=</h5>
19794 <h6 data-parsoid=''>=foo=</h6>
19795 !!end
19796
19797 !! test
19798 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
19799 !! options
19800 parsoid=html2wt
19801 !! wikitext
19802 = foo =
19803 <nowiki>*</nowiki>bar
19804
19805 = foo =
19806 =bar
19807
19808 = foo =
19809 <nowiki>=bar=</nowiki>
19810 !! html
19811 <h1>foo</h1>*bar
19812 <h1>foo</h1>=bar
19813 <h1>foo</h1>=bar=
19814 !!end
19815
19816 !! test
19817 Headings: 3. Nested inside html with wikitext split by html tags
19818 !! options
19819 parsoid=html2wt
19820 !! wikitext
19821 = ='''bold'''<nowiki>foo=</nowiki> =
19822 !! html
19823 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
19824 !!end
19825
19826 !! test
19827 Headings: 4a. No escaping needed (testing just h1 and h2)
19828 !! options
19829 parsoid=html2wt
19830 !! wikitext
19831 = =foo =
19832
19833 = foo= =
19834
19835 = =foo= =
19836
19837 = =foo= bar =
19838
19839 == =foo ==
19840
19841 == foo= ==
19842
19843 = ''=''foo= =
19844
19845 = <nowiki>=</nowiki> =
19846 !! html
19847 <h1>=foo</h1>
19848 <h1>foo=</h1>
19849 <h1> =foo= </h1>
19850 <h1>=foo= bar</h1>
19851 <h2>=foo</h2>
19852 <h2>foo=</h2>
19853 <h1><i>=</i>foo=</h1>
19854 <h1><span typeof="mw:Nowiki">=</span></h1>
19855 !!end
19856
19857 !! test
19858 Headings: 4b. No escaping needed (inside p-tags)
19859 !! options
19860 parsoid=html2wt
19861 !! wikitext
19862 ===
19863 =foo= x
19864 =foo= <s></s>
19865 !! html
19866 <p>===
19867 =foo= x
19868 =foo= <s></s>
19869 </p>
19870 !!end
19871
19872 !! test
19873 Headings: 5. Empty headings
19874 !! options
19875 parsoid
19876 !! wikitext
19877 =<nowiki/>=
19878
19879 ==<nowiki/>==
19880
19881 ===<nowiki/>===
19882
19883 ====<nowiki/>====
19884
19885 =====<nowiki/>=====
19886
19887 ======<nowiki/>======
19888 !! html
19889 <h1></h1>
19890 <h2></h2>
19891 <h3></h3>
19892 <h4></h4>
19893 <h5></h5>
19894 <h6></h6>
19895 !!end
19896
19897 !! test
19898 Headings: 6a. Heading chars in SOL context (with trailing spaces)
19899 !! options
19900 parsoid
19901 !! wikitext
19902 <nowiki>=a=</nowiki>
19903
19904 <nowiki>=a=</nowiki>
19905
19906 <nowiki>=a=</nowiki>
19907
19908 <nowiki>=a=</nowiki>
19909 !! html
19910 <p>=a=</p>
19911 <p>=a= </p>
19912 <p>=a= </p>
19913 <p>=a= </p>
19914 !!end
19915
19916 !! test
19917 Headings: 6b. Heading chars in SOL context (with trailing newlines)
19918 !! options
19919 parsoid
19920 !! wikitext
19921 <nowiki>=a=
19922 b</nowiki>
19923
19924 <nowiki>=a=
19925 b</nowiki>
19926
19927 <nowiki>=a=
19928 b</nowiki>
19929
19930 <nowiki>=a=
19931 b</nowiki>
19932 !! html
19933 <p>=a=
19934 b</p>
19935 <p>=a=
19936 b</p>
19937 <p>=a=
19938 b</p>
19939 <p>=a=
19940 b</p>
19941 </p>
19942 !!end
19943
19944 !! test
19945 Headings: 6c. Heading chars in SOL context (leading newline break)
19946 !! options
19947 parsoid
19948 !! wikitext
19949 a
19950 <nowiki>=b=</nowiki>
19951 !! html
19952 <p>a
19953 =b=</p>
19954 !!end
19955
19956 !! test
19957 Headings: 6d. Heading chars in SOL context (with interspersed comments)
19958 !! options
19959 parsoid
19960 !! wikitext
19961 <!--c0--><nowiki>=a=</nowiki>
19962
19963 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
19964 !! html
19965 <p><!--c0-->=a=</p>
19966 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
19967 !!end
19968
19969 !! test
19970 Headings: 6d. Heading chars in SOL context (No escaping needed)
19971 !! options
19972 parsoid=html2wt
19973 !! wikitext
19974 =a=<div>b</div>
19975 !! html
19976 =a=<div>b</div>
19977 !!end
19978
19979 #### --------------- Lists ---------------
19980 #### 0. Outside nests (*foo, etc.)
19981 #### 1. Nested inside html <ul><li>*foo</li></ul>
19982 #### 2. Inside definition lists
19983 #### 3. Only bullets at start should be escaped
19984 #### 4. No escapes needed
19985 #### 5. No unnecessary escapes
19986 #### 6. Escape bullets in SOL position
19987 #### 7. Escape bullets in a multi-line context
19988 #### ----------------------------------------
19989
19990 !! test
19991 Lists: 0. Outside nests
19992 !! wikitext
19993 <nowiki>*</nowiki>foo
19994
19995 <nowiki>#</nowiki>foo
19996
19997 <nowiki>;Foo:</nowiki>bar
19998 !! html
19999 <p>*foo
20000 </p><p>#foo
20001 </p><p>;Foo:bar
20002 </p>
20003 !!end
20004
20005 !! test
20006 Lists: 1. Nested inside html
20007 !! wikitext
20008 *<nowiki>*foo</nowiki>
20009
20010 *<nowiki>#foo</nowiki>
20011
20012 *<nowiki>:foo</nowiki>
20013
20014 *<nowiki>;foo</nowiki>
20015
20016 #<nowiki>*foo</nowiki>
20017
20018 #<nowiki>#foo</nowiki>
20019
20020 #<nowiki>:foo</nowiki>
20021
20022 #<nowiki>;foo</nowiki>
20023 !! html
20024 <ul><li>*foo</li></ul>
20025 <ul><li>#foo</li></ul>
20026 <ul><li>:foo</li></ul>
20027 <ul><li>;foo</li></ul>
20028 <ol><li>*foo</li></ol>
20029 <ol><li>#foo</li></ol>
20030 <ol><li>:foo</li></ol>
20031 <ol><li>;foo</li></ol>
20032
20033 !!end
20034
20035 !! test
20036 Lists: 2. Inside definition lists
20037 !! wikitext
20038 ;<nowiki>;foo</nowiki>
20039
20040 ;<nowiki>:foo</nowiki>
20041
20042 ;<nowiki>:foo</nowiki>
20043 :bar
20044
20045 :<nowiki>:foo</nowiki>
20046 !! html
20047 <dl><dt>;foo</dt></dl>
20048 <dl><dt>:foo</dt></dl>
20049 <dl><dt>:foo</dt>
20050 <dd>bar</dd></dl>
20051 <dl><dd>:foo</dd></dl>
20052
20053 !!end
20054
20055 !! test
20056 Lists: 3. Only bullets at start of text should be escaped
20057 !! wikitext
20058 *<nowiki>*foo*bar</nowiki>
20059
20060 *<nowiki>*foo</nowiki>''it''*bar
20061 !! html
20062 <ul><li>*foo*bar</li></ul>
20063 <ul><li>*foo<i>it</i>*bar</li></ul>
20064
20065 !!end
20066
20067 !! test
20068 Lists: 4. No escapes needed
20069 !! options
20070 parsoid
20071 !! wikitext
20072 *foo*bar
20073
20074 *''foo''*bar
20075
20076 *[[Foo]]: bar
20077
20078 *[[Foo]]*bar
20079 !! html
20080 <ul>
20081 <li>foo*bar
20082 </li>
20083 </ul>
20084 <ul>
20085 <li><i>foo</i>*bar
20086 </li>
20087 </ul>
20088 <ul>
20089 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
20090 </li>
20091 </ul>
20092 <ul>
20093 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
20094 </li>
20095 </ul>
20096 !!end
20097
20098 !! test
20099 Lists: 5. No unnecessary escapes
20100 !! wikitext
20101 * bar <span><nowiki>[[foo]]</nowiki></span>
20102
20103 *=bar <span><nowiki>[[foo]]</nowiki></span>
20104
20105 *[[bar <span><nowiki>[[foo]]</nowiki></span>
20106
20107 *]]bar <span><nowiki>[[foo]]</nowiki></span>
20108
20109 *=bar <span>foo]]</span>=
20110
20111 * <s></s>: a
20112 !! html
20113 <ul><li> bar <span>[[foo]]</span></li></ul>
20114 <ul><li>=bar <span>[[foo]]</span></li></ul>
20115 <ul><li>[[bar <span>[[foo]]</span></li></ul>
20116 <ul><li>]]bar <span>[[foo]]</span></li></ul>
20117 <ul><li>=bar <span>foo]]</span>=</li></ul>
20118 <ul><li> <s></s>: a</li></ul>
20119
20120 !!end
20121
20122 !! test
20123 Lists: 6. Escape bullets in SOL position
20124 !! options
20125 parsoid
20126 !! wikitext
20127 <!--cmt--><nowiki>*foo</nowiki>
20128 !! html
20129 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
20130 !!end
20131
20132 !! test
20133 Lists: 7. Escape bullets in a multi-line context
20134 !! wikitext
20135 a
20136 <nowiki>*</nowiki>b
20137 !! html
20138 <p>a
20139 *b
20140 </p>
20141 !!end
20142
20143 #### --------------- HRs ---------------
20144 #### 1. Single line
20145 #### -----------------------------------
20146
20147 !! test
20148 HRs: 1. Single line
20149 !! options
20150 parsoid
20151 !! wikitext
20152 ----<nowiki>----</nowiki>
20153 ----=foo=
20154 ----*foo
20155 !! html
20156 <hr><p><span typeof="mw:Nowiki">----</span></p>
20157 <hr><p>=foo=</p>
20158 <hr><p>*foo</p>
20159 !! end
20160
20161 #### --------------- Tables ---------------
20162 #### 1a. Simple example
20163 #### 1b. No escaping needed (!foo)
20164 #### 1c. No escaping needed (|foo)
20165 #### 1d. No escaping needed (|}foo)
20166 ####
20167 #### 2a. Nested in td (<td>foo|bar</td>)
20168 #### 2b. Nested in td (<td>foo||bar</td>)
20169 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
20170 ####
20171 #### 3a. Nested in th (<th>foo!bar</th>)
20172 #### 3b. Nested in th (<th>foo!!bar</th>)
20173 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
20174 ####
20175 #### 4a. Escape -
20176 #### 4b. Escape +
20177 #### 4c. No escaping needed
20178 #### --------------------------------------
20179
20180 !! test
20181 Tables: 1a. Simple example
20182 !! wikitext
20183 <nowiki>{|
20184 |}</nowiki>
20185 !! html
20186 <p>{|
20187 |}
20188 </p>
20189 !! end
20190
20191 !! test
20192 Tables: 1b. No escaping needed
20193 !! wikitext
20194 !foo
20195 !! html
20196 <p>!foo
20197 </p>
20198 !! end
20199
20200 !! test
20201 Tables: 1c. No escaping needed
20202 !! wikitext
20203 |foo
20204 !! html
20205 <p>|foo
20206 </p>
20207 !! end
20208
20209 !! test
20210 Tables: 1d. No escaping needed
20211 !! wikitext
20212 |}foo
20213 !! html
20214 <p>|}foo
20215 </p>
20216 !! end
20217
20218 !! test
20219 Tables: 2a. Nested in td
20220 !! options
20221 parsoid=html2wt
20222 !! wikitext
20223 {|
20224 |<nowiki>foo|bar</nowiki>
20225 |-
20226 |x<div><nowiki>a|b</nowiki></div>
20227 |}
20228 !! html
20229 <table><tbody><tr>
20230 <td>foo|bar</td></tr>
20231 <tr><td>x<div>a|b</div></td>
20232 </tbody></table>
20233 !! end
20234
20235 !! test
20236 Tables: 2b. Nested in td
20237 !! options
20238 parsoid
20239 !! wikitext
20240 {|
20241 |<nowiki>foo||bar</nowiki>
20242 |''it''<nowiki>foo||bar</nowiki>
20243 |}
20244 !! html
20245 <table><tbody><tr>
20246 <td><span typeof="mw:Nowiki">foo||bar</span></td>
20247 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
20248 !! end
20249
20250 !! test
20251 Tables: 2c. Nested in td -- no escaping needed
20252 !! options
20253 parsoid
20254 !! wikitext
20255 {|
20256 |foo!!bar
20257 |}
20258 !! html
20259 <table><tbody><tr><td>foo!!bar
20260 </td></tr></tbody></table>
20261
20262 !! end
20263
20264 !! test
20265 Tables: 3a. Nested in th
20266 !! options
20267 parsoid
20268 !! wikitext
20269 {|
20270 !foo!bar
20271 |}
20272 !! html
20273 <table><tbody><tr><th>foo!bar
20274 </th></tr></tbody></table>
20275
20276 !! end
20277
20278 !! test
20279 Tables: 3b. Nested in th
20280 !! options
20281 parsoid
20282 !! wikitext
20283 {|
20284 !<nowiki>foo!!bar</nowiki>
20285 |}
20286 !! html
20287 <table>
20288 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
20289 </tbody></table>
20290 !! end
20291
20292 !! test
20293 Tables: 3c. Nested in th -- no escaping needed
20294 !! options
20295 parsoid
20296 !! wikitext
20297 {|
20298 !<nowiki>foo||bar</nowiki>
20299 |}
20300 !! html
20301 <table><tbody><tr>
20302 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
20303 !! end
20304
20305 !! test
20306 Tables: 4a. Escape -
20307 !! options
20308 parsoid
20309 !! wikitext
20310 {|
20311 !-bar
20312 |-
20313 |<nowiki>-bar</nowiki>
20314 |}
20315 !! html
20316 <table><tbody>
20317 <tr><th>-bar</th></tr>
20318 <tr>
20319 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
20320 !! end
20321
20322 !! test
20323 Tables: 4b. Escape +
20324 !! options
20325 parsoid
20326 !! wikitext
20327 {|
20328 !+bar
20329 |-
20330 |<nowiki>+bar</nowiki>
20331 |}
20332 !! html
20333 <table><tbody>
20334 <tr><th>+bar</th></tr>
20335 <tr>
20336 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
20337 !! end
20338
20339 !! test
20340 Tables: 4c. No escaping needed
20341 !! options
20342 parsoid
20343 !! wikitext
20344 {|
20345 |foo-bar
20346 |foo+bar
20347 |-
20348 |''foo''-bar
20349 |''foo''+bar
20350 |-
20351 |foo
20352 bar|baz
20353 +bar
20354 -bar
20355 |-
20356 |x
20357 <div>a|b</div>
20358 |}
20359 !! html
20360 <table><tbody>
20361 <tr><td>foo-bar</td><td>foo+bar</td></tr>
20362 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
20363 <tr><td>foo
20364 <p>bar|baz
20365 +bar
20366 -bar</p></td></tr>
20367 <tr><td>x
20368 <div>a|b</div></td>
20369 </tbody></table>
20370 !! end
20371
20372 !! test
20373 Tables: 4d. No escaping needed
20374 !! options
20375 parsoid
20376 !! wikitext
20377 {|
20378 |[[Foo]]-bar
20379 ||+1
20380 ||-2
20381 |}
20382 !! html
20383 <table>
20384 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
20385 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
20386 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
20387 </tbody></table>
20388 !! end
20389
20390 !! test
20391 Tables: Digest broken attributes on table and tr tag
20392 !! options
20393 parsoid=wt2html
20394 !! wikitext
20395 {| || |} ++
20396 |- || || ++ --
20397 |- > [
20398 |}
20399 !! html
20400 <table>
20401 <tbody>
20402 <tr></tr>
20403 <tr></tr>
20404 </tbody></table>
20405 !! end
20406
20407 #### --------------- Links ----------------
20408 #### 1. Quote marks in link text
20409 #### 2. Wikilinks: Escapes needed
20410 #### 3. Wikilinks: No escapes needed
20411 #### 4. Extlinks: Escapes needed
20412 #### 5. Extlinks: No escapes needed
20413 #### --------------------------------------
20414 !! test
20415 Links 1. Quote marks in link text
20416 !! options
20417 parsoid
20418 !! wikitext
20419 [[Foo|Foo<nowiki>''boo''</nowiki>]]
20420 !! html
20421 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
20422 !! end
20423
20424 !! test
20425 Links 2. WikiLinks: Escapes needed
20426 !! options
20427 parsoid
20428 !! wikitext
20429 [[Foo|[Foobar]]]
20430 [[Foo|<nowiki>Foobar]</nowiki>]]
20431 [[Foo|x [Foobar] x]]
20432 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
20433 [[Foo|<nowiki>[[Bar]]</nowiki>]]
20434 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
20435 [[Foo|<nowiki>|Bar</nowiki>]]
20436 [[Foo|<nowiki>]]bar</nowiki>]]
20437 [[Foo|<nowiki>[[bar</nowiki>]]
20438 [[Foo|<nowiki>x [[ y</nowiki>]]
20439 [[Foo|<nowiki>x ]] y</nowiki>]]
20440 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
20441 !! html
20442 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
20443 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
20444 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
20445 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
20446 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
20447 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
20448 <a href="Foo" rel="mw:WikiLink">|Bar</a>
20449 <a href="Foo" rel="mw:WikiLink">]]bar</a>
20450 <a href="Foo" rel="mw:WikiLink">[[bar</a>
20451 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
20452 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
20453 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
20454 !! end
20455
20456 !! test
20457 Links 3. WikiLinks: No escapes needed
20458 !! options
20459 parsoid
20460 !! wikitext
20461 [[Foo|[Foobar]]
20462 [[Foo|foo|bar]]
20463 !! html
20464 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
20465 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
20466 !! end
20467
20468 !! test
20469 Links 4. ExtLinks: Escapes needed
20470 !! options
20471 parsoid
20472 !! wikitext
20473 [http://google.com <nowiki>[google]</nowiki>]
20474 [http://google.com <nowiki>google]</nowiki>]
20475
20476 <nowiki>[http://google.com]</nowiki>
20477
20478 <nowiki>[http://google.com google]</nowiki>
20479
20480 !! html
20481 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
20482 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
20483 <p>[http://google.com]</p>
20484 <p>[http://google.com google]</p>
20485 !! end
20486
20487 !! test
20488 Links 5. ExtLinks: No escapes needed
20489 !! options
20490 parsoid
20491 !! wikitext
20492 [http://google.com [google]
20493 !! html
20494 <a href="http://google.com" rel="mw:ExtLink">[google</a>
20495 !! end
20496
20497 !! test
20498 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
20499 !! html/parsoid
20500 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
20501 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
20502 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
20503 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
20504 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
20505 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
20506 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20507 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
20508 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20509 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
20510 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
20511 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
20512 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
20513 </p>
20514 !! wikitext
20515 x<nowiki/>http://example.com<nowiki/>y
20516 http://example.com<nowiki/>?x
20517 http://example.com<nowiki/>&x
20518 http://example.com<nowiki/>'x
20519 http://example.com<nowiki/>,x
20520 http://example.com<nowiki/>.x
20521 http://example.com<nowiki/>;x
20522 http://example.com<nowiki/>:x
20523 http://example.com<nowiki/>;x
20524 http://example.com<nowiki/>!x
20525 http://example.com<nowiki/>=x
20526 http://example.com<nowiki/>(x)
20527 http://example.com(x<nowiki/>)
20528 !! end
20529
20530 !! test
20531 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20532 !! html/parsoid
20533 <p>x
20534 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
20535 y
20536 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
20537 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
20538 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
20539 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
20540 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
20541 </p>
20542 !! wikitext
20543 x
20544 http://example.com
20545 y
20546 "http://example.com"
20547 (http://example.com)
20548 (http://example.com) foo
20549 http://example.com,
20550 http://example.com, foo
20551 !! end
20552
20553 ## Parsoid currently fails wt2html on this one!
20554 !! test
20555 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20556 !! html/parsoid
20557 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
20558 !! wikitext
20559 http://example.com.,;:!?
20560 !! end
20561
20562 !! test
20563 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
20564 !! html/parsoid
20565 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
20566 !! wikitext
20567 RFC 123<nowiki/>4
20568 !! end
20569
20570 !! test
20571 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
20572 !! html/parsoid
20573 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20574 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20575 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
20576 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
20577 </p>
20578 !! wikitext
20579 xRFC 123y
20580 XRFC 123y
20581 RFC 123?foo
20582 RFC 123&foo
20583 !! end
20584
20585 !! test
20586 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
20587 !! html/parsoid
20588 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
20589 !! wikitext
20590 PMID 123<nowiki/>4
20591 !! end
20592
20593 !! test
20594 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
20595 !! html/parsoid
20596 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20597 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20598 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
20599 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
20600 </p>
20601 !! wikitext
20602 xPMID 123y
20603 XPMID 123y
20604 PMID 123?foo
20605 PMID 123&foo
20606 !! end
20607
20608 !! test
20609 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
20610 !! html/parsoid
20611 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
20612 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
20613 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
20614 </p>
20615 !! wikitext
20616 ISBN 1234567890<nowiki/>1
20617 ISBN 1234567890<nowiki/>x
20618 ISBN 1234567890<nowiki/>b
20619 !! end
20620
20621 !! test
20622 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
20623 !! html/parsoid
20624 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
20625 !! wikitext
20626 ISBN 1234567890's
20627 !! end
20628
20629 #### --------------- Quotes ---------------
20630 #### 1. Quotes inside <b> and <i>
20631 #### 2. Link fragments separated by <i> and <b> tags
20632 #### 3. Link fragments inside <i> and <b>
20633 #### 4. No escaping needed
20634 #### --------------------------------------
20635 !! test
20636 1. Quotes inside <b> and <i>
20637 !! options
20638 parsoid=html2wt,wt2wt
20639 !! wikitext
20640 ''<nowiki>'foo'</nowiki>''
20641 ''<nowiki>''foo''</nowiki>''
20642 ''<nowiki>'''foo'''</nowiki>''
20643 ''foo''<nowiki/>'s
20644 '''<nowiki>'foo'</nowiki>'''
20645 '''<nowiki>''foo''</nowiki>'''
20646 '''<nowiki>'''foo'''</nowiki>'''
20647 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
20648 '''foo'''<nowiki/>'s
20649 '''foo''
20650 ''foo''<nowiki/>'
20651 '<nowiki/>''foo''<nowiki/>'
20652 ''''foo'''
20653 '''foo'''<nowiki/>'
20654 '<nowiki/>'''foo'''<nowiki/>'
20655 ''fools'<span> errand</span>''
20656 ''<span>fool</span>'s errand''
20657 !! html
20658 <p><i>'foo'</i>
20659 <i>''foo''</i>
20660 <i>'''foo'''</i>
20661 <i>foo</i>'s
20662 <b>'foo'</b>
20663 <b>''foo''</b>
20664 <b>'''foo'''</b>
20665 <b>foo'<i>bar'</i>baz</b>
20666 <b>foo</b>'s
20667 '<i>foo</i>
20668 <i>foo</i>'
20669 '<i>foo</i>'
20670 '<b>foo</b>
20671 <b>foo</b>'
20672 '<b>foo</b>'</p>
20673 <i>fools'<span> errand</span></i>
20674 <i><span>fool</span>'s errand</i>
20675 !! end
20676
20677 !! test
20678 2. Link fragments separated by <i> and <b> tags
20679 !! wikitext
20680 [[''foo''<nowiki>hello]]</nowiki>
20681
20682 [['''foo'''<nowiki>hello]]</nowiki>
20683 !! html
20684 <p>[[<i>foo</i>hello]]
20685 </p><p>[[<b>foo</b>hello]]
20686 </p>
20687 !! end
20688
20689 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
20690 # this is one of the shortcomings of this format
20691 !! test
20692 3. Link fragments inside <i> and <b>
20693 !! wikitext
20694 ''[[foo''<nowiki>]]</nowiki>
20695
20696 '''[[foo'''<nowiki>]]</nowiki>
20697 !! html
20698 <p><i>[[foo</i>]]
20699 </p><p><b>[[foo</b>]]
20700 </p>
20701 !! end
20702
20703 !! test
20704 4. No escaping needed
20705 !! wikitext
20706 '<span>''bar''</span>'
20707 '<span>'''bar'''</span>'
20708 !! html
20709 <p>'<span><i>bar</i></span>'
20710 '<span><b>bar</b></span>'
20711 </p>
20712 !! end
20713
20714 #### ----------- Paragraphs ---------------
20715 #### 1. No unnecessary escapes
20716 #### --------------------------------------
20717
20718 !! test
20719 1. No unnecessary escapes
20720 !! wikitext
20721 bar <span><nowiki>[[foo]]</nowiki></span>
20722
20723 =bar <span><nowiki>[[foo]]</nowiki></span>
20724
20725 [[bar <span><nowiki>[[foo]]</nowiki></span>
20726
20727 ]]bar <span><nowiki>[[foo]]</nowiki></span>
20728
20729 =bar <span>foo]]</span><nowiki>=</nowiki>
20730 !! html
20731 <p>bar <span>[[foo]]</span>
20732 </p><p>=bar <span>[[foo]]</span>
20733 </p><p>[[bar <span>[[foo]]</span>
20734 </p><p>]]bar <span>[[foo]]</span>
20735 </p><p>=bar <span>foo]]</span>=
20736 </p>
20737 !!end
20738
20739 #### ----------------------- PRE --------------------------
20740 #### 1. Leading whitespace in SOL context should be escaped
20741 #### ------------------------------------------------------
20742 !! test
20743 1. Leading whitespace in SOL context should be escaped
20744 !! options
20745 parsoid
20746 !! wikitext
20747 <nowiki> </nowiki>a
20748
20749 <nowiki> </nowiki> a
20750
20751 <nowiki> </nowiki>a(tab)
20752
20753 <nowiki> </nowiki> a
20754 <!--cmt-->
20755 <nowiki> </nowiki> a
20756
20757 a
20758 <nowiki> </nowiki>b
20759
20760 a
20761 <nowiki> </nowiki>b
20762
20763 a
20764 <nowiki> </nowiki> b
20765 !! html
20766 <p> a</p>
20767 <p> a</p>
20768 <p> a(tab)</p>
20769 <p> a</p>
20770 <p><!--cmt--> a</p>
20771 <p>a
20772 b</p>
20773 <p>a
20774 b</p>
20775 <p>a
20776 b</p>
20777 !! end
20778
20779 !! test
20780 2. Leading whitespace in non-indent-pre contexts should not be escaped
20781 !! options
20782 parsoid
20783 !! wikitext
20784 foo <ref>''a''
20785 b</ref>
20786 !! html
20787 <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>
20788 !! end
20789
20790 !! test
20791 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
20792 !! options
20793 parsoid
20794 !! wikitext
20795 <blockquote>
20796 a
20797 <span>b</span>
20798 c
20799 </blockquote>
20800 !! html
20801 <blockquote>
20802 <p>
20803 a
20804 <span>b</span>
20805 c</p>
20806 </blockquote>
20807 !! end
20808
20809 !! test
20810 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
20811 !! options
20812 parsoid
20813 !! wikitext
20814 [[File:Foobar.jpg|thumb|caption]]
20815 !! html
20816 !! html/parsoid
20817 <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>
20818 !! end
20819
20820 !! test
20821 5. Nowiki escaping should account for indent-pres
20822 !! options
20823 parsoid=html2wt
20824 !! html
20825 <pre>==foo==</pre>
20826 !! wikitext
20827 ==foo==
20828 !! end
20829
20830 #### --------------- Behavior Switches --------------------
20831 !! test
20832 1. Valid behavior switches should be escaped
20833 !! options
20834 parsoid=html2wt
20835 !! wikitext
20836 <nowiki>__TOC__</nowiki>
20837 ''<nowiki>__TOC__</nowiki>''
20838 !! html
20839 __TOC__
20840 <i>__TOC__</i>
20841 !! end
20842
20843 !! test
20844 2. Invalid behavior switches should not be escaped
20845 !! options
20846 parsoid=html2wt
20847 !! wikitext
20848 __TOO__
20849 __|__
20850 !! html
20851 __TOO__
20852 __|__
20853 !! end
20854
20855 #### --------------- HTML tags ---------------
20856 #### 1. a tags
20857 #### 2. other tags
20858 #### 3. multi-line html tag
20859 #### 4. extension tags
20860 #### -----------------------------------------
20861 !! test
20862 1. a tags
20863 !! options
20864 parsoid
20865 !! wikitext
20866 <a href="http://google.com">google</a>
20867 !! html
20868 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
20869 !! end
20870
20871 !! test
20872 2. other tags
20873 !! wikitext
20874 <nowiki><div>foo</div>
20875 <div style="color:red">foo</div></nowiki>
20876 !! html
20877 <p>&lt;div&gt;foo&lt;/div&gt;
20878 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
20879 </p>
20880 !! end
20881
20882 !! test
20883 3. multi-line html tag
20884 !! wikitext
20885 <nowiki><div
20886 >foo</div
20887 ></nowiki>
20888 !! html
20889 <p>&lt;div
20890 &gt;foo&lt;/div
20891 &gt;
20892 </p>
20893 !! end
20894
20895 !! test
20896 4. extension tags
20897 !! wikitext
20898 <nowiki><ref>foo</ref></nowiki>
20899
20900 <nowiki><ref>bar</nowiki>
20901
20902 baz<nowiki></ref></nowiki>
20903 !! html
20904 <p>&lt;ref&gt;foo&lt;/ref&gt;
20905 </p><p>&lt;ref&gt;bar
20906 </p><p>baz&lt;/ref&gt;
20907 </p>
20908 !! end
20909
20910 #### --------------- Others ---------------
20911 !! test
20912 Escaping nowikis
20913 !! wikitext
20914 &lt;nowiki&gt;foo&lt;/nowiki&gt;
20915 !! html
20916 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
20917 </p>
20918 !! end
20919
20920 ## The quote-char in the input is necessary for triggering the bug
20921 !! test
20922 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
20923 !! options
20924 parsoid=wt2wt,html2wt
20925 !! wikitext
20926 foo's bar :
20927 !! html
20928 <p>foo's bar :</p>
20929 !! end
20930
20931 !! test
20932
20933 Tag-like HTML structures are passed through as text
20934 !! wikitext
20935 <x y>
20936
20937 <x.y>
20938
20939 <x-y>
20940
20941 1>2
20942
20943 x<y
20944
20945 a>b
20946
20947 1<d e>f
20948 !! html
20949 <p>&lt;x y&gt;
20950 </p><p>&lt;x.y&gt;
20951 </p><p>&lt;x-y&gt;
20952 </p><p>1&gt;2
20953 </p><p>x&lt;y
20954 </p><p>a&gt;b
20955 </p><p>1&lt;d e&gt;f
20956 </p>
20957 !! end
20958
20959
20960 # This was a bug in the PHP parser (see bug 17663 and its dups,
20961 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
20962 !! test
20963 Tag names followed by punctuation should not be recognized as tags
20964 !! wikitext
20965 <s.ome> text
20966 !! html
20967 <p>&lt;s.ome&gt; text
20968 </p>
20969 !! end
20970
20971 !! test
20972 HTML tag with necessary entities in attributes
20973 !! wikitext
20974 <span title="&amp;amp;">foo</span>
20975 !! html
20976 <p><span title="&amp;amp;">foo</span>
20977 </p>
20978 !! end
20979
20980 !! test
20981 HTML tag with 'unnecessary' entity encoding in attributes
20982 !! wikitext
20983 <span title="&amp;">foo</span>
20984 !! html
20985 <p><span title="&amp;">foo</span>
20986 </p>
20987 !! end
20988
20989 !! test
20990 HTML tag with broken attribute value quoting
20991 !! wikitext
20992 <span title="Hello world>Foo</span>
20993 !! html/php
20994 <p><span>Foo</span>
20995 </p>
20996 !! html/parsoid
20997 <p><span title="Hello world">Foo</span>
20998 </p>
20999 !! end
21000
21001 !! test
21002 Parsoid-only: HTML tag with broken attribute value quoting
21003 !! options
21004 parsoid
21005 !! wikitext
21006 <span title="Hello world>Foo</span>
21007 !! html
21008 <p><span title="Hello world">Foo</span>
21009 </p>
21010 !! end
21011
21012 !! test
21013 Table with broken attribute value quoting
21014 !! wikitext
21015 {|
21016 | title="Hello world|Foo
21017 |}
21018 !! html/php
21019 <table>
21020 <tr>
21021 <td>Foo
21022 </td></tr></table>
21023
21024 !! html/parsoid
21025 <table>
21026 <tr>
21027 <td title="Hello world">Foo
21028 </td></tr></table>
21029
21030 !! end
21031
21032 !! test
21033 Table with broken attribute value quoting on consecutive lines
21034 !! wikitext
21035 {|
21036 | title="Hello world|Foo
21037 | style="color:red|Bar
21038 |}
21039 !! html/php
21040 <table>
21041 <tr>
21042 <td>Foo
21043 </td>
21044 <td>Bar
21045 </td></tr></table>
21046
21047 !! html/parsoid
21048 <table><tbody>
21049 <tr>
21050 <td title="Hello world">Foo
21051 </td><td style="color: red">Bar
21052 </td></tr></tbody></table>
21053
21054 !! end
21055
21056 !! test
21057 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21058 !! options
21059 parsoid
21060 !! wikitext
21061 {{}}
21062 !! html
21063 {{}}
21064 !! end
21065
21066 !! test
21067 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21068 !! options
21069 parsoid
21070 !! wikitext
21071 }}{{
21072 !! html
21073 }}{{
21074 !! end
21075
21076 !!test
21077 Accept empty td cell attribute
21078 !! wikitext
21079 {|
21080 | align="center" | foo || |
21081 |}
21082 !! html
21083 <table>
21084 <tr>
21085 <td align="center"> foo </td>
21086 <td>
21087 </td></tr></table>
21088
21089 !!end
21090
21091 !!test
21092 Non-empty attributes in th-cells
21093 !! wikitext
21094 {|
21095 ! Foo !! style="color: red" | Bar
21096 |}
21097 !! html
21098 <table>
21099 <tr>
21100 <th> Foo </th>
21101 <th style="color: red"> Bar
21102 </th></tr></table>
21103
21104 !!end
21105
21106 !!test
21107 Accept empty attributes in th-cells
21108 !! wikitext
21109 {|
21110 !| foo !!| bar
21111 |}
21112 !! html
21113 <table>
21114 <tr>
21115 <th> foo </th>
21116 <th> bar
21117 </th></tr></table>
21118
21119 !!end
21120
21121 !!test
21122 Empty table rows go away
21123 !! wikitext
21124 {|
21125 | Hello
21126 | there
21127 |- class="foo"
21128 |-
21129 |}
21130 !! html
21131 <table>
21132 <tr>
21133 <td> Hello
21134 </td>
21135 <td> there
21136 </td></tr>
21137
21138 </table>
21139
21140 !! end
21141
21142 ###
21143 ### Parsoid-centric tests for testing RTing of inter-element separators
21144 ### Edge cases not tested by existing parser tests and specific to
21145 ### Parsoid-specific serialization strategies.
21146 ###
21147
21148 !!test
21149 RT-ed inter-element separators should be valid separators
21150 !! wikitext
21151 {|
21152 |- [[foo]]
21153 |}
21154 !! html
21155 <table>
21156
21157 </table>
21158
21159 !!end
21160
21161 # Parsoid-only since PHP parser relies on Tidy for correct output
21162 !!test
21163 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
21164 !!options
21165 parsoid
21166 !! wikitext
21167 {|
21168 |<small>foo
21169 bar
21170 |}
21171
21172 {|
21173 |<small>foo<small>
21174 |}
21175 !! html
21176 <table>
21177 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
21178 <p>bar</p></small></td></tr>
21179 </tbody></table>
21180
21181 <table>
21182 <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>
21183 </tbody></table>
21184 !!end
21185
21186 !!test
21187 Empty TD followed by TD with tpl-generated attribute
21188 !! wikitext
21189 {|
21190 |-
21191 |
21192 |{{echo|style='color:red'}}|foo
21193 |}
21194 !! html
21195 <table>
21196
21197 <tr>
21198 <td>
21199 </td>
21200 <td>foo
21201 </td></tr></table>
21202
21203 !!end
21204
21205 !!test
21206 Indented table with an empty td
21207 !! wikitext
21208 {|
21209 |-
21210 |
21211 |foo
21212 |}
21213 !! html
21214 <table>
21215
21216 <tr>
21217 <td>
21218 </td>
21219 <td>foo
21220 </td></tr></table>
21221
21222 !!end
21223
21224 !!test
21225 Indented block & table
21226 !! wikitext
21227 <div>foo</div>
21228 {|
21229 |foo
21230 |}
21231 !! html/php
21232 <div>foo</div>
21233 <table>
21234 <tr>
21235 <td>foo
21236 </td></tr></table>
21237
21238 !! html/parsoid
21239 <div data-parsoid='{"stx":"html"}'>foo</div>
21240 <table><tbody>
21241 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
21242 </tbody></table>
21243 !!end
21244
21245 !! test
21246 Indent and comment before table row
21247 !! wikitext
21248 {|
21249 <!--hi-->|-
21250 | there
21251 |}
21252 !! html/php
21253 <table>
21254
21255 <tr>
21256 <td> there
21257 </td></tr></table>
21258
21259 !! html/parsoid
21260 <table>
21261 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
21262 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
21263 </tbody></table>
21264 !! end
21265
21266 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
21267 !!test
21268 Empty TR followed by a template-generated TR
21269 !!options
21270 parsoid
21271 !! wikitext
21272 {|
21273 |-
21274 {{echo|<tr><td>foo</td></tr>}}
21275 |}
21276 !! html
21277 <table>
21278 <tbody>
21279 <tr></tr>
21280 <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}}]}'>
21281 <td>foo</td></tr>
21282 </tbody></table>
21283 !!end
21284
21285 ## PHP and parsoid output differ for this, and since this is primarily
21286 ## for testing Parsoid's serializer, marking this Parsoid only
21287 !!test
21288 Empty TR followed by mixed-ws-comment line should RT correctly
21289 !!options
21290 parsoid
21291 !! wikitext
21292 {|
21293 |-
21294 <!--c-->
21295 |-
21296 <!--c--> <!--d-->
21297 |}
21298 !! html
21299 <table>
21300 <tbody>
21301 <tr></tr>
21302 <!--c-->
21303 <tr>
21304 <!--c--> </tr><!--d-->
21305 </tbody></table>
21306
21307 !!end
21308
21309 !!test
21310 Multi-line image caption generated by templates with/without trailing newlines
21311 !!options
21312 parsoid
21313 !! wikitext
21314 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
21315 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
21316 !! html
21317 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC</div></div></div>
21318 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC\n\n</div></div></div>
21319
21320 !!end
21321
21322 !! test
21323 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
21324 !! options
21325 parsoid=html2wt
21326 !! wikitext
21327 <includeonly>foo</includeonly>
21328 new para
21329
21330 [[./Category:Foo]]
21331
21332 = new heading =
21333 !! html
21334 <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>
21335
21336 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
21337 !! end
21338
21339 ## PHP emits broken html for this, and since this is primarily
21340 ## a Parsoid serializer test, marking this Parsoid only
21341 !!test
21342 Improperly nested inline or quotes tags with whitespace in between
21343 !!options
21344 parsoid
21345 !! wikitext
21346 <span> <s>x</span> </s>
21347 ''' ''x''' ''
21348 !! html
21349 <p><span> <s>x</s></span><s> </s>
21350 <b> <i>x</i></b><i> </i>
21351 </p>
21352 !!end
21353
21354 !!test
21355 Encapsulate protected attributes from wt
21356 !!options
21357 parsoid
21358 !! wikitext
21359 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
21360 !! html
21361 <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>
21362 </body>
21363 !!end
21364
21365 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
21366 ## Having nested or stray pre tags results in the attempt to add duplicates,
21367 ## causing an assertion fail. This test tries to prevent that situation.
21368 !!test
21369 Ensure ParagraphWrapper can deal with stray closing pre tags
21370 !!options
21371 parsoid=wt2html
21372 !! wikitext
21373 plain text</pre>
21374 !! html
21375 plain text
21376 !!end
21377
21378 !!test
21379 1. Ensure fostered text content is wrapped in element nodes
21380 !!options
21381 parsoid=wt2html
21382 !! wikitext
21383 <table>hi</table><table>ho</table>
21384 !! html
21385 <p>hi</p>
21386 <table></table>
21387 <p>ho</p>
21388 <table></table>
21389 !!end
21390
21391 !!test
21392 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
21393 !!options
21394 parsoid=wt2html,wt2wt
21395 !! wikitext
21396 <table>
21397 <tr> || ||
21398 <td> a
21399 </table>
21400 !! html
21401 <p> || ||
21402 </p><table>
21403 <tbody><tr><td> a</td></tr>
21404 </tbody></table>
21405 !!end
21406
21407 !!test
21408 Encapsulation properly handles null DSR information from foster box
21409 !!options
21410 parsoid=wt2html,wt2wt
21411 !! wikitext
21412 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
21413 !! html
21414 <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>
21415 !!end
21416
21417 !!test
21418 1. Encapsulate foster-parented transclusion content
21419 !!options
21420 parsoid=wt2wt,wt2html
21421 !! wikitext
21422 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
21423 !! html
21424 <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>
21425 <tbody>
21426 <tr>
21427 <td>bar</td>
21428 </tr>
21429 </tbody>
21430 </table>
21431 !!end
21432
21433 !!test
21434 2. Encapsulate foster-parented transclusion content
21435 !!options
21436 parsoid=wt2wt,wt2html
21437 !! wikitext
21438 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
21439 !! html
21440 <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>
21441 <table>
21442 <tbody>
21443 <tr>
21444 <td>bar</td>
21445 </tr>
21446 </tbody>
21447 </table>
21448 !!end
21449
21450 !!test
21451 3. Encapsulate foster-parented transclusion content
21452 !!options
21453 parsoid=wt2wt,wt2html
21454 !! wikitext
21455 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21456 !! html
21457 <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;]}">
21458 <p>foo</p>
21459 </div>
21460 <table>
21461 <tbody>
21462 <tr>
21463 <td>bar</td>
21464 </tr>
21465 </tbody>
21466 </table>
21467 !!end
21468
21469 !!test
21470 4. Encapsulate foster-parented transclusion content
21471 !!options
21472 parsoid=wt2wt,wt2html
21473 !! wikitext
21474 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21475 !! html
21476 <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;]}">
21477 <p>foo</p>
21478 </div>
21479 <table>
21480 <tbody>
21481 <tr>
21482 <td>bar</td>
21483 </tr>
21484 </tbody>
21485 </table>
21486 !!end
21487
21488 !!test
21489 5. Encapsulate foster-parented transclusion content
21490 !!options
21491 parsoid=wt2wt,wt2html
21492 !! wikitext
21493 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
21494 !! html
21495 <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>
21496 <table>
21497 <tbody>
21498 <tr>
21499 <td>
21500 <div>
21501 <p>foo</p>
21502 </div>
21503 </td>
21504 </tr>
21505 </tbody>
21506 </table>
21507 !!end
21508
21509 !!test
21510 6. Encapsulate foster-parented transclusion content
21511 !!options
21512 parsoid=wt2wt,wt2html
21513 !! wikitext
21514 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
21515 !! html
21516 <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>
21517 <table>
21518 <tbody>
21519 <tr>
21520 <td>
21521 <div>
21522 <p>foo</p>
21523 </div>
21524 </td>
21525 </tr>
21526 </tbody>
21527 </table>
21528 <p>ok</p>
21529 !!end
21530
21531 !!test
21532 7. Encapsulate foster-parented transclusion content
21533 !!options
21534 parsoid=wt2wt,wt2html
21535 !! wikitext
21536 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
21537 !! html
21538 <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>
21539 <table>
21540 <tbody>
21541 <tr>
21542 <td>bar</td>
21543 </tr>
21544 </tbody>
21545 </table>
21546 !!end
21547
21548 !!test
21549 8. Encapsulate foster-parented transclusion content
21550 !!options
21551 parsoid=wt2wt,wt2html
21552 !! wikitext
21553 {{echo|a
21554 }}{|{{echo|style='color:red'}}
21555 |-
21556 |b
21557 |}
21558 !! html
21559 <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>
21560 <tbody>
21561 <tr>
21562 <td>b</td>
21563 </tr>
21564 </tbody>
21565 </table>
21566 !!end
21567
21568 !!test
21569 9. Encapsulate foster-parented transclusion content
21570 !!options
21571 parsoid=wt2wt,wt2html
21572 !! wikitext
21573 <table>{{echo|hi</table>hello}}
21574 !! html
21575 <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>
21576 !!end
21577
21578 !!test
21579 Table in fosterable position
21580 !!options
21581 parsoid=wt2html,wt2wt
21582 !! wikitext
21583 {{OpenTable}}
21584 <div>
21585 {|
21586 |}
21587 </div>
21588 |}
21589 !! html
21590 <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">
21591 </span>
21592 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
21593
21594 <table>
21595 </table>
21596 !!end
21597
21598 # Parsoid only for bug 64747
21599 !! test
21600 Properly encapsulate empty-content transclusions in fosterable positions
21601 !! wikitext
21602 <table>
21603 {{#if:|
21604 <td>foo</td>
21605 }}
21606 </table>
21607 !! html/parsoid
21608 <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>"}'>
21609
21610 </table>
21611 !! end
21612
21613 !!test
21614 Support <object> element with .data attribute
21615 !!options
21616 parsoid=html2wt
21617 !! wikitext
21618 <object data="test.swf"></object>
21619 !! html
21620 <object data="test.swf"></object>
21621 !!end
21622
21623 # -----------------------------------------------------------------
21624 # The following section of tests are primarily to spec requirements
21625 # around serialization of new/edited content.
21626 #
21627 # All these tests are marked Parsoid html2wt and html2html only
21628 # ----------------------------------------------------------------
21629
21630 # 'mi' is a localinterwiki prefix as well as a language
21631 !! test
21632 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
21633 !! options
21634 parsoid=html2wt
21635 !! wikitext
21636 [[Foo]]
21637 !! html
21638 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
21639 !! end
21640
21641 !! test
21642 Image: Modifying size of an image (1)
21643 !! options
21644 parsoid={
21645 "modes": ["wt2wt"],
21646 "changes": [
21647 ["img[height]", "attr", "height", "22"],
21648 ["img[width]", "attr", "width", "200"]
21649 ]
21650 }
21651 !! wikitext
21652 [[Image:Foobar.jpg|230x230px]]
21653 !! wikitext/edited
21654 [[Image:Foobar.jpg|200x200px]]
21655 !!end
21656
21657 !! test
21658 Image: Modifying size of an image (2)
21659 !! options
21660 parsoid={
21661 "modes": ["wt2wt"],
21662 "changes": [
21663 ["img[height]", "attr", "height", "100"],
21664 ["img[width]", "attr", "width", "500"]
21665 ]
21666 }
21667 !! wikitext
21668 [[Image:Foobar.jpg|230x230px]]
21669 !! wikitext/edited
21670 [[Image:Foobar.jpg|500x500px]]
21671 !!end
21672
21673 # Change in size is ignored so long as class='mw-default-size'
21674 !! test
21675 Image: Modifying size of an image (3)
21676 !! options
21677 parsoid={
21678 "modes": ["wt2wt"],
21679 "changes": [
21680 ["figure[class]", "removeClass", "mw-default-size"],
21681 ["figure img", "attr", "height", "19"],
21682 ["figure img", "attr", "width", "170"]
21683 ]
21684 }
21685 !! wikitext
21686 [[Image:Foobar.jpg|thumb]]
21687 !! wikitext/edited
21688 [[Image:Foobar.jpg|thumb|170x170px]]
21689 !!end
21690
21691 !! test
21692 Image: Modifying alignment of an image (bug 48665)
21693 !! options
21694 parsoid={
21695 "modes": ["wt2wt"],
21696 "changes": [
21697 ["figure[class]", "removeClass", "mw-halign-right"],
21698 ["figure[class]", "addClass", "mw-halign-left"]
21699 ]
21700 }
21701 !! wikitext
21702 [[Image:Foobar.jpg|thumb|caption|right]]
21703 !! wikitext/edited
21704 [[Image:Foobar.jpg|thumb|caption|left]]
21705 !! end
21706
21707 !! test
21708 Image: Modifying mw-default-size of an frameless image (bug 62805)
21709 !! options
21710 parsoid={
21711 "modes": ["wt2wt"],
21712 "changes": [
21713 ["figure.mw-default-size", "removeClass", "mw-default-size"]
21714 ]
21715 }
21716 !! wikitext
21717 [[Image:Foobar.jpg|frameless|right]]
21718 !! wikitext/edited
21719 [[Image:Foobar.jpg|frameless|right|220x220px]]
21720 !! end
21721
21722 !! test
21723 Image: Modifying valign of an image (bug 49221)
21724 !! options
21725 parsoid={
21726 "modes": ["wt2wt"],
21727 "changes": [
21728 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
21729 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
21730 ]
21731 }
21732 !! wikitext
21733 [[File:Foobar.jpg|20px|middle]]
21734 !! wikitext/edited
21735 [[File:Foobar.jpg|20px|text-top]]
21736 !! end
21737
21738 !! test
21739 Image: Modifying alt attribute of an image (bug 56400)
21740 !! options
21741 parsoid={
21742 "modes": ["wt2wt"],
21743 "changes": [
21744 ["img[alt]", "attr", "alt", "some alternate edited text"]
21745 ]
21746 }
21747 !! wikitext
21748 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
21749 !! wikitext/edited
21750 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
21751 !!end
21752
21753 !! test
21754 Image: Modifying caption of an image
21755 !! options
21756 parsoid={
21757 "modes": ["wt2wt"],
21758 "changes": [
21759 ["figcaption", "text", "new caption"]
21760 ]
21761 }
21762 !! wikitext
21763 [[Image:Foobar.jpg|thumb|original caption]]
21764 !! wikitext/edited
21765 [[Image:Foobar.jpg|thumb|new caption]]
21766 !!end
21767
21768 !! test
21769 Image: empty alt attribute (bug 48924)
21770 !! options
21771 parsoid
21772 !! wikitext
21773 [[File:Foobar.jpg|thumb|alt=|bar]]
21774 !! html
21775 <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>
21776 !! end
21777
21778 #!! test
21779 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
21780 #!! options
21781 #parsoid=html2wt
21782 #language=ar
21783 #!! input
21784 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
21785 #!! result
21786 #<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>
21787 #!! end
21788
21789 !! test
21790 Image: Block level image should have \n before and after
21791 !! options
21792 parsoid
21793 !! wikitext
21794 123
21795 [[File:Foobar.jpg|right|thumb|150x150px]]
21796 456
21797 !! html
21798 <p>123</p><figure typeof="mw:Image/Thumb" class="mw-halign-right"><a href="./File:Foobar.png"><img src="http://192.168.142.128/mw/images/thumb/b/bc/Foobar.png/131px-Foobar.png" width="131" height="150" resource="./File:Foobar.png" data-parsoid='{"a":{"resource":"./File:Foobar.png","width":"131"},"sa":{"resource":"File:Foobar.png","width":"150"}}'></a></figure><p>456</p>
21799 !!end
21800
21801 !! test
21802 Image: New block level image should have \n before and after (existing content)
21803 !! options
21804 parsoid
21805 !! wikitext
21806 123
21807 [[File:Foobar.jpg|right|thumb|150x150px]]
21808 456
21809 !! html
21810 <p>123</p>
21811 <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>
21812 <p>456</p>
21813 !!end
21814
21815 !! test
21816 Image: upright option (parsoid)
21817 !! options
21818 parsoid
21819 !! wikitext
21820 [[File:Foobar.jpg|thumb|upright|caption]]
21821 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
21822 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
21823 !! html
21824 <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>
21825 <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>
21826 <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>
21827 !!end
21828
21829 !! test
21830 Image: upright option is ignored on inline and frame images (parsoid)
21831 !! options
21832 parsoid
21833 !! wikitext
21834 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
21835 !! html
21836 <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>
21837 !!end
21838
21839 !! test
21840 Image: from basic HTML (1)
21841 !! options
21842 parsoid=html2wt
21843 !! html/parsoid
21844 <span typeof="mw:Image">
21845 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
21846 </span>
21847 !! wikitext
21848 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
21849 !! end
21850
21851 !! test
21852 Image: from basic HTML (2)
21853 !! options
21854 parsoid=html2wt
21855 !! html/parsoid
21856 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
21857 !! wikitext
21858 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
21859 !! end
21860
21861 !! test
21862 Image: from basic HTML (3)
21863 !! options
21864 parsoid=html2wt
21865 !! html/parsoid
21866 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
21867 !! wikitext
21868 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
21869 !! end
21870
21871 !! test
21872 Image: from basic HTML (4)
21873 !! options
21874 parsoid=html2wt
21875 !! html/parsoid
21876 <img src="File:Foobar.jpg">
21877 !! wikitext
21878 [[File:Foobar.jpg|link=]]
21879 !! end
21880
21881 !! test
21882 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
21883 !! options
21884 parsoid=html2wt
21885 !! wikitext
21886 * foo
21887 !! html
21888 <ul>
21889 <li><p>foo</p></li>
21890 </ul>
21891 !! end
21892
21893 !! test
21894 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
21895 !! options
21896 parsoid=html2wt
21897 !! wikitext
21898 * foo
21899 !! html
21900 <ul> <li>foo</li></ul>
21901 !! end
21902
21903 !! test
21904 Don't strip leading whitespace when handling indent-pre suppressing tags
21905 !! options
21906 parsoid=html2wt
21907 !! wikitext
21908 {|
21909 | indented row
21910 |}
21911 <blockquote>
21912 '''This is very bold of you!'''
21913
21914 {|
21915 |
21916 indented cell (no pre-wrapping!)
21917 |}
21918 </blockquote>
21919 foo
21920 <div>bar</div>
21921 !! html
21922 <table>
21923 <tr><td> indented row</td></tr>
21924 </table>
21925 <blockquote><p>
21926 <b>This is very bold of you!</b>
21927 </p>
21928 <table><tr><td>
21929 indented cell (no pre-wrapping!)
21930 </td></tr></table>
21931 </blockquote>
21932 <p>foo</p>
21933 <div>bar</div>
21934 !! end
21935
21936 !! test
21937 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
21938 !! options
21939 parsoid=html2wt
21940 !! wikitext
21941 foo
21942 <nowiki> </nowiki><span>bar</span>
21943
21944 <span>foo2
21945 <nowiki> </nowiki></span>bar2
21946
21947 <div>foo</div>
21948 <nowiki> </nowiki><span>bar</span>
21949
21950 <div>
21951 <nowiki> </nowiki><span>foo</span>
21952 </div>
21953 !! html
21954 <p>foo</p>
21955 <span>bar</span>
21956
21957 <span>foo2
21958 </span>bar2
21959
21960 <div>foo</div>
21961 <span>bar</span>
21962
21963 <div>
21964 <span>foo</span>
21965 </div>
21966 !! end
21967
21968 !! test
21969 Lists: Add space after bullets
21970 !! options
21971 parsoid=html2wt
21972 !! wikitext
21973 * foo
21974 * bar
21975 * <span> baz</span>
21976 !! html
21977 <ul>
21978 <li>foo</li>
21979 <li> bar</li>
21980 <li><span> baz</span></li>
21981 </ul>
21982 !! end
21983
21984 !! test
21985 Lists: Dont insert newlines in a serialized list item.
21986 !! options
21987 parsoid=html2wt
21988 !! wikitext
21989 * a<br>b
21990 * c
21991 !! html
21992 <ul><li>a<br>b</li><li>c</li></ul>
21993 !! end
21994
21995 !! test
21996 Headings: Add space before/after == (Bug 51744)
21997 !! options
21998 parsoid=html2wt
21999 !! wikitext
22000 == foo ==
22001
22002 == bar ==
22003
22004 == baz ==
22005
22006 == <span> baz</span> ==
22007 !! html
22008 <h2>foo</h2>
22009 <h2> bar</h2>
22010 <h2>baz </h2>
22011 <h2><span> baz</span></h2>
22012 !! end
22013
22014 !! test
22015 Parsoid: Serialize positional parameters with = in them as named parameter
22016 !! options
22017 parsoid=html2wt
22018 !! wikitext
22019 {{echo|1 = f=oo}}
22020
22021 {{echo|1 = f=oo|2 = bar}}
22022
22023 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22024 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22025 {{echo|<nowiki>f=oo</nowiki>|bar}}
22026 !! html
22027 <p about="#mwt1" typeof="mw:Transclusion"
22028 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
22029
22030 <p about="#mwt1" typeof="mw:Transclusion"
22031 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
22032
22033 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22034 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22035 <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>
22036 !! end
22037
22038 !! test
22039 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
22040 !! options
22041 parsoid=html2wt
22042 !! wikitext
22043 <div>a
22044 b
22045 </div>
22046 <div>a
22047 b
22048 </div>
22049 <div>
22050 a
22051
22052 b
22053 </div>
22054 !! html
22055 <div>a<p>b</p></div>
22056 <div>a
22057 <p>b</p></div>
22058 <div>
22059 a
22060 <p>b</p></div>
22061 !! end
22062
22063 !! test
22064 Substrings resembling wikitext in hrefs should not get nowiki escapes
22065 !! options
22066 parsoid=html2wt
22067 !! wikitext
22068 [[Foo''bar''baz]]
22069 !! html
22070 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
22071 !! end
22072
22073 #-----------------------------
22074 # I/B quote minimization tests
22075 #-----------------------------
22076
22077 !! test
22078 1. I/B quote minimization: wikitext-only tags should be combined
22079 !! options
22080 parsoid=html2wt
22081 !! wikitext
22082 ''AB''
22083
22084 '''AB'''
22085
22086 ''A'''B'''''
22087
22088 '''A''B'''''
22089
22090 '''A''BC''D'''
22091
22092 '''''AB'''''
22093
22094 '''''AB'''''
22095
22096 '''''AB'''''
22097 !! html
22098 <p><i>A</i><i>B</i></p>
22099 <p><b>A</b><b>B</b></p>
22100 <p><i>A</i><b><i>B</i></b></p>
22101 <p><b>A</b><i><b>B</b></i></p>
22102 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
22103 <p><i><b>A</b></i><i><b>B</b></i></p>
22104 <p><i><b>A</b></i><b><i>B</i></b></p>
22105 <p><b><i>A</i></b><i><b>B</b></i></p>
22106 !! end
22107
22108 !! test
22109 2. I/B quote minimization: wikitext and html tags should not be combined
22110 !! options
22111 parsoid=html2wt
22112 !! wikitext
22113 ''A''<i>B</i>
22114
22115 ''A'''''<i>B</i>'''
22116 !! html
22117 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
22118 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
22119 !! end
22120
22121 !! test
22122 3. I/B quote minimization: templated content stops minimization
22123 !! options
22124 parsoid=html2wt
22125 !! wikitext
22126 ''A''{{echo|''B''}}
22127
22128 ''A''{{echo|'''''B'''''}}
22129 !! html
22130 <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>
22131 <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>
22132 !! end
22133
22134 !! test
22135 4. I/B quote minimization: new content should be mimimized with adjacent old content
22136 !! options
22137 parsoid=html2wt
22138 !! wikitext
22139 ''AB''
22140
22141 '''AB'''
22142
22143 ''A'''B'''''
22144 !! html
22145 <p><i>A</i><i>B</i></p>
22146 <p><b>A</b><b>B</b></p>
22147 <p><i>A</i><b><i>B</i></b></p>
22148 !! end
22149
22150 #------------------------------------
22151 # End of I/B quote minimization tests
22152 #------------------------------------
22153
22154 !!test
22155 Bug 54262: New entities
22156 !! options
22157 parsoid=html2wt
22158 !! wikitext
22159 &nbsp;
22160 !! html
22161 <span typeof="mw:Entity">&nbsp;</span>
22162 !! end
22163
22164 ## Note that there is no wikitext output for 'unknownproperty' ##
22165 ## Unknown magic words are silently dropped ##
22166
22167 !! test
22168 Magic words
22169 !! options
22170 parsoid=html2wt
22171 !! wikitext
22172 __TOC__
22173 __NOTOC__
22174 __FORCETOC__
22175 __INDEX__
22176 __NOINDEX__
22177 __NOGALLERY__
22178 __NOEDITSECTION__
22179 __NOTITLECONVERT__
22180 __NOCONTENTCONVERT__
22181 !! html
22182 <meta property='mw:PageProp/toc' />
22183 <meta property='mw:PageProp/notoc' />
22184 <meta property='mw:PageProp/forcetoc' />
22185 <meta property='mw:PageProp/index' />
22186 <meta property='mw:PageProp/noindex' />
22187 <meta property='mw:PageProp/nogallery' />
22188 <meta property='mw:PageProp/noeditsection' />
22189 <meta property='mw:PageProp/notitleconvert' />
22190 <meta property='mw:PageProp/nocontentconvert' />
22191 <meta property='mw:PageProp/unknownproperty' />
22192 !! end
22193
22194 !! test
22195 Consecutive <pre>s should not get merged
22196 !! options
22197 parsoid=html2wt,html2html
22198 !! wikitext
22199 a
22200
22201 b
22202
22203 c
22204
22205 d
22206
22207 e
22208
22209
22210
22211 f
22212 !! html
22213 <pre>a</pre><pre>b</pre>
22214
22215 <pre>c
22216 </pre><pre>
22217 d</pre>
22218
22219 <pre>e
22220
22221 </pre><pre>
22222
22223 f</pre>
22224 !! end
22225
22226 !! test
22227 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
22228 !! options
22229 parsoid=html2wt
22230 !! wikitext
22231 [[Special:BookSources/1234567890|ISBN 1234567895]]
22232 !! html
22233 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
22234 !! end
22235
22236 !! test
22237 Edited RFC links not serializable as RFC links should serialize as extlinks
22238 !! options
22239 parsoid=html2wt
22240 !! wikitext
22241 [//tools.ietf.org/html/rfc123 New RFC]
22242 !! html
22243 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
22244 !! end
22245
22246 !! test
22247 Edited PMID links not serializable as PMID links should serialize as extlinks
22248 !! options
22249 parsoid=html2wt
22250 !! wikitext
22251 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
22252 !! html
22253 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
22254 !! end
22255
22256 !! test
22257 Edited Redirect link should emit a non-piped wikitext link
22258 !! options
22259 parsoid=html2wt
22260 !! wikitext
22261 #REDIRECT [[Bar]]
22262 !! html
22263 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
22264 !! end
22265
22266 # -----------------------------------------------------------------
22267 # End of section for Parsoid-only html2wt tests for serialization
22268 # of new content
22269 # -----------------------------------------------------------------
22270
22271 TODO:
22272 more images
22273 more tables
22274 character entities
22275 and much more
22276 Try for 100% code coverage