Merge "Changed some DatabaseBase type hints to IDatabase"
[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 # The expected HTML structure in this test is debatable. The PHP parser does
5668 # not parse this kind of table at all. The main focus for Parsoid is on
5669 # round-tripping, so this output is ok for now. TODO: revisit!
5670 !! test
5671 Wikitext table with html-syntax row
5672 !! wikitext
5673 {|
5674 |-
5675 <td>foo</td>
5676 |}
5677 !! html/parsoid
5678 <table>
5679 <tbody>
5680 <tr>
5681 <td>foo</td></tr></tbody></table>
5682 !! end
5683
5684 ## Note that Parsoid output differs from PHP and PHP+tidy here.
5685 ## The lack of <tr> tags in the PHP output is arguably a bug in the
5686 ## PHP parser, which tidy then compounds by fostering the content
5687 ## entirely out of the table. Parsoid recognizes the table context
5688 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
5689 ## depends on PHP's treatment of broken table markup!
5690 !! test
5691 Implicit <td> after a |-
5692 !! options
5693 parsoid=wt2html,html2html
5694 !! wikitext
5695 {|
5696 |-
5697 a
5698 |}
5699 !! html/php
5700 <table>
5701
5702 a
5703 </table>
5704
5705 !! html/php+tidy
5706 <p>a</p>
5707 !! html/parsoid
5708 <table>
5709 <tr><td>a</td></tr>
5710 </table>
5711 !! end
5712
5713 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
5714 !! test
5715 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
5716 !! options
5717 parsoid=wt2html,html2html
5718 !! wikitext
5719 {|
5720 |-
5721 |
5722 a
5723 |-
5724 b
5725 |}
5726 !! html/php
5727 <table>
5728
5729 <tr>
5730 <td>
5731 <pre>a
5732 </pre>
5733 </td></tr>
5734 b
5735 </table>
5736
5737 !! html/php+tidy
5738 <p>b</p>
5739 <table>
5740 <tr>
5741 <td>
5742 <pre>
5743 a
5744 </pre></td>
5745 </tr>
5746 </table>
5747 !! html/parsoid
5748 <table>
5749 <tbody>
5750 <tr><td><pre>a</pre></td></tr>
5751 <tr><td> b</td></tr>
5752 </tbody>
5753 </table>
5754 !! end
5755
5756 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
5757 # Parsoid generates the missing <td>, so wt2wt won't succeed.
5758 !! test
5759 Lists should be recognized in an implicit <td> context
5760 !! options
5761 parsoid=wt2html,html2html
5762 !! wikitext
5763 {|
5764 |-
5765 *a
5766 |}
5767 !! html/php
5768 <table>
5769
5770 <ul><li>a</li></ul>
5771 </table>
5772
5773 !! html/php+tidy
5774 <ul>
5775 <li>a</li>
5776 </ul>
5777 !! html/parsoid
5778 <table>
5779 <tr>
5780 <td><ul>
5781 <li>a</li>
5782 </ul></td>
5783 </tr>
5784 </table>
5785 !! end
5786
5787 !! test
5788 Parsoid: Round-trip tables directly followed by content (bug 51219)
5789 !! options
5790 parsoid=wt2html,wt2wt
5791 !! wikitext
5792 {|
5793 |foo
5794 |} bar
5795
5796 {|
5797 |baz
5798 |}<b>quux</b>
5799 !! html+tidy
5800 <table>
5801 <tr>
5802 <td>foo</td>
5803 </tr>
5804 </table>
5805 <p>bar</p>
5806 <table>
5807 <tr>
5808 <td>baz</td>
5809 </tr>
5810 </table>
5811 <p><b>quux</b></p>
5812 !! end
5813
5814 !! test
5815 Parsoid: Default to a newline after tables in new content (bug 51219)
5816 !! options
5817 parsoid=html2wt
5818 !! wikitext
5819 {|
5820 |foo
5821 |}
5822 <nowiki> </nowiki>bar
5823 {|
5824 |baz
5825 |}
5826 '''quux'''
5827 !! html
5828 <table><tbody>
5829 <tr><td>foo</td></tr></tbody></table> bar
5830 <table><tbody>
5831 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5832 !! end
5833
5834 !! test
5835 Parsoid: newline inducing block nodes don't suppress <nowiki>
5836 !! options
5837 parsoid=html2wt
5838 !! wikitext
5839 <nowiki> </nowiki>a
5840
5841 = foo =
5842 !! html
5843 a<h1>foo</h1>
5844 !! end
5845
5846 !! test
5847 Parsoid: Row-syntax table headings followed by comment & table cells
5848 !! options
5849 parsoid=wt2html,wt2wt
5850 !! wikitext
5851 {|
5852 ! foo || bar
5853 <!-- foo --> || baz || quux
5854 |}
5855 !! html/php
5856 <table>
5857 <tr>
5858 <th> foo </th>
5859 <th> bar
5860 </th>
5861 <td> baz </td>
5862 <td> quux
5863 </td></tr></table>
5864
5865 !! html/parsoid
5866 <table>
5867 <tbody><tr><th> foo </th><th> bar
5868 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
5869 </tbody></table>
5870 !! end
5871
5872
5873 # PHP throws away the (semi-broken) "foo" class here; Parsoid
5874 # preserves it.
5875 !!test
5876 Parsoid: Recover better from broken table attributes
5877 !!options
5878 parsoid=wt2html
5879 !!wikitext
5880 {| class="foo
5881 | class="bar" |
5882 foo
5883 |}
5884 !!html/php+tidy
5885 <table>
5886 <tr>
5887 <td class="bar">
5888 <p>foo</p>
5889 </td>
5890 </tr>
5891 </table>
5892 !!html/parsoid
5893 <table class="foo">
5894 <tr>
5895 <td class="bar">
5896 <p>foo</p></td></tr>
5897 </tbody></table>
5898 !!end
5899
5900 !! test
5901 Strip unsupported table tags
5902 !! options
5903 parsoid=html2wt
5904 !! html
5905 <table>
5906 <thead>
5907 <tr>
5908 <th>Month</th>
5909 <th>Savings</th>
5910 </tr>
5911 </thead>
5912 <tbody>
5913 <tr>
5914 <td>January</td>
5915 <td>$100</td>
5916 </tr>
5917 <tr>
5918 <td>February</td>
5919 <td>$80</td>
5920 </tr>
5921 </tbody>
5922 <tfoot>
5923 <tr>
5924 <td>Sum</td>
5925 <td>$180</td>
5926 </tr>
5927 </tfoot>
5928 </table>
5929 !! wikitext
5930 {|
5931
5932 !Month
5933 !Savings
5934
5935 |January
5936 |$100
5937
5938 |-
5939 |February
5940 |$80
5941
5942 |Sum
5943 |$180
5944
5945 |}
5946 !! end
5947
5948 ###
5949 ### Internal links
5950 ###
5951 !! test
5952 Plain link, capitalized
5953 !! wikitext
5954 [[Main Page]]
5955 !! html
5956 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5957 </p>
5958 !! end
5959
5960 !! test
5961 Plain link, uncapitalized
5962 !! wikitext
5963 [[main Page]]
5964 !! html
5965 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
5966 </p>
5967 !! end
5968
5969 !! test
5970 Piped link
5971 !! wikitext
5972 [[Main Page|The Main Page]]
5973 !! html
5974 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5975 </p>
5976 !! end
5977
5978 !! test
5979 Piped link with comment in link text
5980 !! wikitext
5981 [[Main Page|The Main<!--front--> Page]]
5982 !! html
5983 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5984 </p>
5985 !! end
5986
5987 !! test
5988 Piped link with multiple pipe characters in link text
5989 !! wikitext
5990 [[Main Page||The|Main|Page|]]
5991 !! html/php
5992 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
5993 </p>
5994 !! html/parsoid
5995 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
5996 !! end
5997
5998 !! test
5999 Broken link
6000 !! wikitext
6001 [[Zigzagzogzagzig]]
6002 !! html
6003 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6004 </p>
6005 !! end
6006
6007 !! test
6008 Broken link with fragment
6009 !! wikitext
6010 [[Zigzagzogzagzig#zug]]
6011 !! html
6012 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6013 </p>
6014 !! end
6015
6016 !! test
6017 Special page link with fragment
6018 !! wikitext
6019 [[Special:Version#anchor]]
6020 !! html
6021 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6022 </p>
6023 !! end
6024
6025 !! test
6026 Nonexistent special page link with fragment
6027 !! wikitext
6028 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6029 !! html
6030 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6031 </p>
6032 !! end
6033
6034 !! test
6035 Link with prefix
6036 !! wikitext
6037 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6038 !! html
6039 <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>
6040 </p>
6041 !! end
6042
6043 !! test
6044 Link with suffix
6045 !! wikitext
6046 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6047 !! html
6048 <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>!!!
6049 </p>
6050 !! end
6051
6052 !! article
6053 prefixed article
6054 !! text
6055 Some text
6056 !! endarticle
6057
6058 !! test
6059 Bug 43661: Piped links with identical prefixes
6060 !! wikitext
6061 [[prefixed article|prefixed articles with spaces]]
6062
6063 [[prefixed article|prefixed articlesaoeu]]
6064
6065 [[Main Page|Main Page test]]
6066 !! html
6067 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6068 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6069 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6070 </p>
6071 !! end
6072
6073
6074 !! test
6075 Link with HTML entity in suffix / tail
6076 !! wikitext
6077 [[Main Page]]&quot;, [[Main Page]]&#97;
6078 !! html
6079 <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;
6080 </p>
6081 !! end
6082
6083 !! test
6084 Link with 3 brackets
6085 !! wikitext
6086 [[[Main Page]]]
6087 !! html
6088 <p>[[[Main Page]]]
6089 </p>
6090 !! end
6091
6092 !! test
6093 Link with 4 brackets
6094 !! wikitext
6095 [[[[Main Page]]]]
6096 !! html
6097 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6098 </p>
6099 !! end
6100
6101 !! test
6102 Piped link with 3 brackets
6103 !! wikitext
6104 [[[main page|the main page]]]
6105 !! html
6106 <p>[[[main page|the main page]]]
6107 </p>
6108 !! end
6109
6110 !! test
6111 Piped link with extlink-like text
6112 !! wikitext
6113 [[Main Page|[bar]]]
6114 [[Main Page|This is a [bar]]]
6115 !! html
6116 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6117 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6118 </p>
6119 !! end
6120
6121 !! test
6122 Link with multiple pipes
6123 !! wikitext
6124 [[Main Page|The|Main|Page]]
6125 !! html
6126 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6127 </p>
6128 !! end
6129
6130 # Note that parsoid does not munge anchor text; all non-space
6131 # characters are valid in HTML5 ids.
6132 !! test
6133 Anchor containing a #. (bug 63430)
6134 !! wikitext
6135 [[Main Page#And#Link]]
6136 !! html/php
6137 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6138 </p>
6139 !! html/parsoid
6140 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6141 !! end
6142
6143 !! test
6144 Link to namespaces
6145 !! wikitext
6146 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6147 !! html
6148 <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>
6149 </p>
6150 !! end
6151
6152 !! test
6153 Link with space in namespace
6154 !! wikitext
6155 [[User talk:Foo bar]]
6156 !! html
6157 <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>
6158 </p>
6159 !! end
6160
6161 !! article
6162 MemoryAlpha:AlphaTest
6163 !! text
6164 This is an article in the MemoryAlpha namespace
6165 (which shadows the memoryalpha interwiki link).
6166 !! endarticle
6167
6168 !! test
6169 Namespace takes precedence over interwiki link (bug 51680)
6170 !! wikitext
6171 [[MemoryAlpha:AlphaTest]]
6172 !! html
6173 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6174 </p>
6175 !! end
6176
6177 # The previous test doesn't work correctly in html2*, due to not recognizing the
6178 # link as an internal one. This one checks for the correct behavior.
6179 !! test
6180 Link to namespace preferred over interwiki with correct rel attribute
6181 !! options
6182 parsoid=html2wt,html2html
6183 !! wikitext
6184 [[MemoryAlpha:AlphaTest]]
6185 !! html
6186 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6187 </p>
6188 !! end
6189
6190 !! test
6191 Piped link to namespace
6192 !! wikitext
6193 [[Meta:Disclaimers|The disclaimers]]
6194 !! html
6195 <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>
6196 </p>
6197 !! end
6198
6199 !! test
6200 Link containing }
6201 !! wikitext
6202 [[Usually caused by a typo (oops}]]
6203 !! html
6204 <p>[[Usually caused by a typo (oops}]]
6205 </p>
6206 !! end
6207
6208 !! article
6209 7% Solution
6210 !! text
6211 Just a test of an article title containing a percent.
6212 !! endarticle
6213
6214 !! test
6215 Link containing % (not as a hex sequence)
6216 !! wikitext
6217 [[7% Solution]]
6218 !! html/php
6219 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6220 </p>
6221 !! html/parsoid
6222 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6223 !! end
6224
6225 # note that the parsoid HTML is identical to the previous test output,
6226 # so the previous test ensures that the html2wt mode will generate the
6227 # "not as a hex sequence" wikitext.
6228 !! test
6229 Link containing % as a single hex sequence interpreted to char
6230 !! options
6231 parsoid=wt2wt,wt2html,html2html
6232 !! wikitext
6233 [[7%25 Solution]]
6234 !! html/php
6235 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6236 </p>
6237 !! html/parsoid
6238 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6239 !!end
6240
6241 !! test
6242 Link containing % as a double hex sequence interpreted to hex sequence
6243 !! wikitext
6244 [[7%2525 Solution]]
6245 !! html
6246 <p>[[7%2525 Solution]]
6247 </p>
6248 !!end
6249
6250 # note that parsoid does not munge anchor text; all non-space
6251 # characters are valid in HTML5 anchors.
6252 !! test
6253 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6254 Example for such a section: == < ==
6255 !! wikitext
6256 [[%23%3c]][[%23%3e]]
6257 !! html/php
6258 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6259 </p>
6260 !! html/parsoid
6261 <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>
6262 !! end
6263
6264 !! test
6265 Link containing "<#" and ">#" as a hex sequences
6266 !! wikitext
6267 [[%3c%23]][[%3e%23]]
6268 !! html
6269 <p>[[%3c%23]][[%3e%23]]
6270 </p>
6271 !! end
6272
6273 !! test
6274 Link containing an equals sign
6275 !! wikitext
6276 [[Special:BookSources/isbn=4-00-026157-6]]
6277 !! html/php
6278 <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>
6279 </p>
6280 !! html/parsoid
6281 <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>
6282 !! end
6283
6284 !! article
6285 Foo~bar
6286 !! text
6287 Just a test of an article title containing a tilde.
6288 !! endarticle
6289
6290 # note that links containing signatures, like [[Foo~~~~]], are
6291 # massaged by the pre-save transform (PST) and so the tildes are never
6292 # seen by the parser.
6293 !! test
6294 Link containing a tilde
6295 !! wikitext
6296 [[Foo~bar]]
6297 !! html/php
6298 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6299 </p>
6300 !! html/parsoid
6301 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6302 !! end
6303
6304 !! test
6305 Link containing double-single-quotes '' (bug 4598)
6306 !! wikitext
6307 [[Lista d''e paise d''o munno]]
6308 !! html/php
6309 <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>
6310 </p>
6311 !! html/parsoid
6312 <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>
6313 !! end
6314
6315 !! test
6316 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6317 !! wikitext
6318 Some [[Link|pretty ''italics'' and stuff]]!
6319 !! html/php
6320 <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>!
6321 </p>
6322 !! html/parsoid
6323 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6324 !! end
6325
6326 !! test
6327 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6328 !! wikitext
6329 ''Some [[Link|pretty ''italics'' and stuff]]!''
6330 !! html
6331 <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>
6332 </p>
6333 !! end
6334
6335 !! test
6336 Link with double quotes in title part (literal) and alternate part (interpreted)
6337 !! wikitext
6338 [[File:Denys Savchenko ''Pentecoste''.jpg]]
6339
6340 [[''Pentecoste'']]
6341
6342 [[''Pentecoste''|Pentecoste]]
6343
6344 [[''Pentecoste''|''Pentecoste'']]
6345 !! html/php
6346 <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>
6347 </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>
6348 </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>
6349 </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>
6350 </p>
6351 !! html/parsoid
6352 <meta typeof="mw:Placeholder"/>
6353 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6354 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6355 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6356 !! end
6357
6358 !! test
6359 Broken image links with HTML captions (bug 39700)
6360 !! wikitext
6361 [[File:Nonexistent|<script></script>]]
6362 [[File:Nonexistent|100px|<script></script>]]
6363 [[File:Nonexistent|&lt;]]
6364 [[File:Nonexistent|a<i>b</i>c]]
6365 !! html
6366 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6367 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6368 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6369 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6370 </p>
6371 !! end
6372
6373 !! test
6374 Plain link to URL
6375 !! wikitext
6376 [[http://www.example.com]]
6377 !! html/php
6378 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6379 </p>
6380 !! html/parsoid
6381 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6382 !! end
6383
6384 !! test
6385 Plain link to URL with link text
6386 !! wikitext
6387 [[http://www.example.com Link text]]
6388 !! html
6389 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6390 </p>
6391 !! end
6392
6393 !! test
6394 Plain link to protocol-relative URL
6395 !! wikitext
6396 [[//www.example.com]]
6397 !! html/php
6398 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6399 </p>
6400 !! html/parsoid
6401 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6402 !! end
6403
6404 !! test
6405 Plain link to protocol-relative URL with link text
6406 !! wikitext
6407 [[//www.example.com Link text]]
6408 !! html
6409 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6410 </p>
6411 !! end
6412
6413 !! test
6414 Plain link to page with question mark in title
6415 !! wikitext
6416 [[A?b]]
6417
6418 [[A?b|Baz]]
6419 !! html
6420 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6421 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6422 </p>
6423 !! end
6424
6425
6426 # I'm fairly sure the expected result here is wrong.
6427 # We want these to be URL links, not pseudo-pages with URLs for titles....
6428 # However the current output is also pretty screwy.
6429 #
6430 # ----
6431 # I'm changing it to match the current output--it arguably makes more
6432 # sense in the light of the test above. Old expected result was:
6433 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6434 #</p>
6435 # But I think this test is bordering on "garbage in, garbage out" anyway.
6436 # -- wtm
6437 !! test
6438 Piped link to URL
6439 !! wikitext
6440 Piped link to URL: [[http://www.example.com|an example URL]]
6441 !! html/php
6442 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6443 </p>
6444 !! html/parsoid
6445 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6446 !! end
6447
6448 !! test
6449 BUG 2: [[page|http://url/]] should link to page, not http://url/
6450 !! wikitext
6451 [[Main Page|http://url/]]
6452 !! html/php
6453 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6454 </p>
6455 !! html/parsoid
6456 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6457 !! end
6458
6459 # Parsoid does not mark self-links, by design.
6460 !! test
6461 BUG 337: Escaped self-links should be bold
6462 !! options
6463 title=[[Bug462]]
6464 !! wikitext
6465 [[Bu&#103;462]] [[Bug462]]
6466 !! html/php
6467 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6468 </p>
6469 !! html/php+tidy
6470 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6471 !! html/parsoid
6472 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6473 !! end
6474
6475 !! test
6476 Self-link to section should not be bold
6477 !! options
6478 title=[[Main Page]]
6479 !! wikitext
6480 [[Main Page#section]]
6481 !! html
6482 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6483 </p>
6484 !! end
6485
6486 !! article
6487 00
6488 !! text
6489 This is 00.
6490 !! endarticle
6491
6492 !!test
6493 Self-link to numeric title
6494 !!options
6495 title=[[0]]
6496 !! wikitext
6497 [[0]]
6498 !! html
6499 <p><strong class="selflink">0</strong>
6500 </p>
6501 !!end
6502
6503 !!test
6504 Link to numeric-equivalent title
6505 !!options
6506 title=[[0]]
6507 !! wikitext
6508 [[00]]
6509 !! html
6510 <p><a href="/wiki/00" title="00">00</a>
6511 </p>
6512 !!end
6513
6514 !! test
6515 <nowiki> inside a link
6516 !! wikitext
6517 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6518 !! html
6519 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6520 </p>
6521 !! end
6522
6523 !! test
6524 Non-breaking spaces in title
6525 !! wikitext
6526 [[&nbsp; Main &nbsp; Page &nbsp;]]
6527 !! html
6528 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6529 </p>
6530 !!end
6531
6532 !! test
6533 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6534 !! options
6535 language=ca
6536 !! wikitext
6537 '''[[Main Page]]'''
6538 !! html
6539 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6540 </p>
6541 !! end
6542
6543 !! test
6544 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6545 !! options
6546 language=ca
6547 !! wikitext
6548 ''[[Main Page]]''
6549 !! html
6550 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6551 </p>
6552 !! end
6553
6554 !! test
6555 Internal link with en linktrail: no apostrophes (bug 27473)
6556 !! options
6557 language=en
6558 !! wikitext
6559 [[Something]]'nice
6560 !! html
6561 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6562 </p>
6563 !! end
6564
6565 !! test
6566 Internal link with ca linktrail with apostrophes (bug 27473)
6567 !! options
6568 language=ca
6569 !! wikitext
6570 [[Something]]'nice
6571 !! html
6572 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6573 </p>
6574 !! end
6575
6576 !! test
6577 Internal link with kaa linktrail with apostrophes (bug 27473)
6578 !! options
6579 language=kaa
6580 !! wikitext
6581 [[Something]]'nice
6582 !! html
6583 <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>
6584 </p>
6585 !! end
6586
6587 !! test
6588 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6589 !! wikitext
6590 [[User:Foo/Test/63636:Bar|Test]]
6591 !! html/php
6592 <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>
6593 </p>
6594 !! html/parsoid
6595 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
6596 !! end
6597
6598 !! test
6599 Purely hash wikilink
6600 !! options
6601 title=[[User:test/123]]
6602 !! wikitext
6603 [[#a|b]]
6604 !! html/php
6605 <p><a href="#a">b</a>
6606 </p>
6607 !! html/parsoid
6608 <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>
6609 !! end
6610
6611 !! test
6612 1. Interaction of linktrail and template encapsulation
6613 !! options
6614 parsoid
6615 !! wikitext
6616 {{echo|[[Foo]]}}l
6617 !! html
6618 <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>
6619 !! end
6620
6621 !! test
6622 2. Interaction of linktrail and template encapsulation
6623 !! options
6624 parsoid
6625 !! wikitext
6626 {{echo|Some [[Fool]]}}s
6627 !! html
6628 <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>
6629 !! end
6630
6631 !! test
6632 3. Interaction of linktrail and template encapsulation
6633 !! options
6634 parsoid
6635 !! wikitext
6636 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6637 !! html
6638 <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>
6639 !! end
6640
6641 !! article
6642 Söfnuður
6643 !! text
6644 Test.
6645 !! endarticle
6646
6647 !! test
6648 Internal link with is link prefix
6649 !! options
6650 language=is
6651 !! wikitext
6652 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6653 !! html
6654 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6655 </p>
6656 !! end
6657
6658 !! article
6659 Mótmælendatrú
6660 !! text
6661 Test.
6662 !! endarticle
6663
6664 !! test
6665 Internal link with is link trail and link prefix
6666 !! options
6667 language=is
6668 !! wikitext
6669 [[mótmælendatrú|xxx]]ar
6670 [[mótmælendatrú]]ar
6671 mótmælenda[[söfnuður]]
6672 mótmælenda[[söfnuður|söfnuðir]]
6673 mótmælenda[[söfnuður|söfnuðir]]xxx
6674 !! html
6675 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6676 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6677 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6678 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6679 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6680 </p>
6681 !! end
6682
6683 !! test
6684 Parsoid link trail escaping
6685 !! options
6686 parsoid=html2wt,html2html
6687 !! wikitext
6688 [[apple]]<nowiki/>s
6689 !! html
6690 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
6691 !! end
6692
6693 !! test
6694 Parsoid link prefix escaping
6695 !! options
6696 language=is
6697 parsoid=html2wt,html2html
6698 !! wikitext
6699 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6700 !! html
6701 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
6702 !! end
6703
6704 !! test
6705 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6706 !! wikitext
6707 [[Foo| bar]]
6708
6709 [[Foo| ''bar'']]
6710
6711 [http://wp.org foo]
6712
6713 [http://wp.org ''foo'']
6714 !! html
6715 <p><a href="/wiki/Foo" title="Foo"> bar</a>
6716 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
6717 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6718 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6719 </p>
6720 !! end
6721
6722 !! test
6723 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6724 !! options
6725 parsoid
6726 !! wikitext
6727 [[Foo|{{echo|a}} b {{echo|c}}]]
6728 !! html
6729 <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>
6730 !! end
6731
6732 !! test
6733 Link with angle bracket after anchor
6734 !! wikitext
6735 [[Foo#<bar>]]
6736 !! html/php
6737 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
6738 </p>
6739 !! html/parsoid
6740 <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>
6741 !! end
6742
6743 ###
6744 ### Interwiki links (see maintenance/interwiki.sql)
6745 ###
6746
6747 !! test
6748 Inline interwiki link
6749 !! options
6750 parsoid=wt2html,wt2wt,html2html
6751 !! wikitext
6752 [[MeatBall:SoftSecurity]]
6753 !! html/php
6754 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6755 </p>
6756 !! html/parsoid
6757 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
6758 !! end
6759
6760 !! test
6761 Inline interwiki link with empty title (bug 2372)
6762 !! options
6763 parsoid=wt2html,wt2wt,html2html
6764 !! wikitext
6765 [[MeatBall:]]
6766 !! html/php
6767 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6768 </p>
6769 !! html/parsoid
6770 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
6771 !! end
6772
6773 !! test
6774 Interwiki link encoding conversion (bug 1636)
6775 !! wikitext
6776 *[[Wikipedia:ro:Olteni&#0355;a]]
6777 *[[Wikipedia:ro:Olteni&#355;a]]
6778 !! html
6779 <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>
6780 <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>
6781
6782 !! html+tidy
6783 <ul>
6784 <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>
6785 <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>
6786 </ul>
6787 !! end
6788
6789 !! test
6790 Interwiki link with fragment (bug 2130)
6791 !! wikitext
6792 [[MeatBall:SoftSecurity#foo]]
6793 !! html
6794 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6795 </p>
6796 !! end
6797
6798 # Ideally the wikipedia: prefix here should be proto-relative too
6799 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
6800 # define the 'en' prefix, and originally the test used 'wikipedia',
6801 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
6802 # article.
6803 !! test
6804 Different interwiki prefixes mapping to the same URL
6805 !! wikitext
6806 [[:en:Foo]]
6807
6808 [[:en:Foo|Foo]]
6809
6810 [[wikipedia:Foo]]
6811
6812 [[:wikipedia:Foo|Foo]]
6813
6814 [[wikipedia:en:Foo]]
6815
6816 [[:wikipedia:en:Foo]]
6817
6818 [[ wikiPEdia :Foo]]
6819 !! html/parsoid
6820 <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>
6821
6822 <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>
6823
6824 <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>
6825
6826 <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>
6827
6828 <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>
6829
6830 <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>
6831
6832 <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>
6833 !! end
6834
6835 !! test
6836 Interwiki links that cannot be represented in wiki syntax
6837 !! wikitext
6838 [[meatball:ok]]
6839 [[meatball:ok#foo|ok with fragment]]
6840 [[meatball:ok_as_well?|ok ending with ? mark]]
6841 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6842 [http://de.wikipedia.org/wiki/#foo is just fragment]
6843
6844 !! html/php
6845 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
6846 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
6847 <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>
6848 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6849 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
6850 </p>
6851 !! html/parsoid
6852 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
6853 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
6854 <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>
6855 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6856 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6857 !! end
6858
6859 !! test
6860 Interwiki links: trail
6861 !! wikitext
6862 [[wikipedia:Foo|Ba]]r
6863 !! html/php
6864 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
6865 </p>
6866 !! html/parsoid
6867 <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>
6868 !! end
6869
6870 !! test
6871 Local interwiki link
6872 !! options
6873 parsoid=wt2html,wt2wt,html2html
6874 !! wikitext
6875 [[local:Template:Foo]]
6876 !! html/php
6877 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
6878 </p>
6879 !! html/parsoid
6880 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
6881 !! end
6882
6883 # Parsoid does not mark self-links, by design.
6884 !! test
6885 Local interwiki link: self-link to current page
6886 !! options
6887 title=[[Main Page]]
6888 parsoid=wt2html,wt2wt,html2html
6889 !! wikitext
6890 [[local:Main Page]]
6891 !! html/php
6892 <p><strong class="selflink">local:Main Page</strong>
6893 </p>
6894 !! html/parsoid
6895 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
6896 !! end
6897
6898 !! test
6899 Local interwiki link: prefix only (bug 64167)
6900 !! options
6901 parsoid=wt2html,wt2wt,html2html
6902 !! wikitext
6903 [[local:]]
6904 !! html/php
6905 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
6906 </p>
6907 !! html/parsoid
6908 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
6909 !! end
6910
6911 !! test
6912 Local interwiki link: with additional interwiki prefix (bug 61357)
6913 !! options
6914 parsoid=wt2html,wt2wt,html2html
6915 !! wikitext
6916 [[local:meatball:Hello]]
6917 !! html/php
6918 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
6919 </p>
6920 !! html/parsoid
6921 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
6922 !! end
6923
6924 !! test
6925 Multiple local interwiki link prefixes
6926 !! wikitext
6927 [[local:local:local:local:mi:local:Foo]]
6928 !! options
6929 parsoid=wt2html,wt2wt,html2html
6930 !! html/php
6931 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
6932 </p>
6933 !! html/parsoid
6934 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
6935 !! end
6936
6937 ###
6938 ### Interlanguage links
6939 ### Language links (so that searching for '### language' matches..)
6940 ###
6941
6942 !! test
6943 Interlanguage link
6944 !! wikitext
6945 Blah blah blah
6946 [[zh:Chinese]]
6947 !! html/php
6948 <p>Blah blah blah
6949 </p>
6950 !! html/parsoid
6951 <p>Blah blah blah</p>
6952 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
6953 !! end
6954
6955 !! test
6956 Interlanguage link with spacing
6957 !! options
6958 parsoid=wt2html,wt2wt,html2html
6959 !! wikitext
6960 Blah blah blah
6961 [[ zh : Chinese ]]
6962 !! html/php
6963 <p>Blah blah blah
6964 </p>
6965 !! html/parsoid
6966 <p>Blah blah blah</p>
6967 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
6968 !! end
6969
6970 !! test
6971 Double interlanguage link
6972 !! wikitext
6973 Blah blah blah
6974 [[es:Spanish]]
6975 [[zh:Chinese]]
6976 !! html/php
6977 <p>Blah blah blah
6978 </p>
6979 !! html/parsoid
6980 <p>Blah blah blah</p>
6981 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
6982 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
6983 !! end
6984
6985 !! test
6986 Interlanguage link variations
6987 !! wikitext
6988 Blah blah blah
6989 [[ es :Spanish]]
6990 [[ ZH :Chinese]]
6991 !! html/php
6992 <p>Blah blah blah
6993 </p>
6994 !! html/parsoid
6995 <p>Blah blah blah</p>
6996 <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"}}'/>
6997 <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"}}'/>
6998 !! end
6999
7000 !! test
7001 Interlanguage link, with prefix links
7002 !! options
7003 language=ln
7004 !! wikitext
7005 Blah blah blah
7006 [[zh:Chinese]]
7007 !! html/php
7008 <p>Blah blah blah
7009 </p>
7010 !! html/parsoid
7011 <p>Blah blah blah</p>
7012 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7013 !! end
7014
7015 !! test
7016 Double interlanguage link, with prefix links (bug 8897)
7017 !! options
7018 language=ln
7019 !! wikitext
7020 Blah blah blah
7021 [[es:Spanish]]
7022 [[zh:Chinese]]
7023 !! html/php
7024 <p>Blah blah blah
7025 </p>
7026 !! html/parsoid
7027 <p>Blah blah blah</p>
7028 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7029 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7030 !! end
7031
7032 !! test
7033 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7034 !! wikitext
7035 Blah blah blah
7036 [[mul:Article]]
7037 !! html/php
7038 <p>Blah blah blah
7039 </p>
7040 !! html/parsoid
7041 <p>Blah blah blah</p>
7042 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7043 !! end
7044
7045 !! test
7046 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7047 !! options
7048 language=ln
7049 !! wikitext
7050 [[WW&nbsp;II]]
7051 !! html
7052 <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>
7053 </p>
7054 !! end
7055
7056 !! test
7057 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7058 !! options
7059 parsoid=html2wt
7060 !! wikitext
7061 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7062
7063 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7064 !! html
7065 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7066 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7067 !! end
7068
7069 !! test
7070 Parsoid: handle constructor well
7071 !! wikitext
7072 [[constructor]]
7073
7074 [[constructor:foo]]
7075 !! html/php
7076 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7077 </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>
7078 </p>
7079 !! html/parsoid
7080 <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>
7081
7082 <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>
7083 !! end
7084
7085 !! article
7086 ko:
7087 !! text
7088 Test.
7089 !! endarticle
7090
7091 # Note that `ko` isn't a known interlanguage prefix
7092 !! test
7093 Parsoid: recognize interlanguage links without a target page
7094 !! options
7095 ill
7096 !! wikitext
7097 [[es:]]
7098
7099 [[ko:]]
7100 !! html/php
7101 es:
7102 !! html/parsoid
7103 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7104
7105 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7106 !! end
7107
7108 # Note that `ko` isn't a known interwiki prefix
7109 !! test
7110 Parsoid: recognize interwiki links without a target page
7111 !! options
7112 parsoid=wt2html,wt2wt,html2html
7113 !! wikitext
7114 [[:es:]]
7115
7116 [[:ko:]]
7117 !! html/php
7118 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7119 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7120 </p>
7121 !! html/parsoid
7122 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7123 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7124 !! end
7125
7126 !! test
7127 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7128 !! wikitext
7129 [[mi:Foo]]
7130 !! html/php
7131 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7132 </p>
7133 !! html/parsoid
7134 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7135 !! end
7136
7137 !! test
7138 Interlanguage link with preceding local interwiki link (bug 68085)
7139 !! options
7140 parsoid=wt2html,wt2wt,html2html
7141 !! wikitext
7142 Blah blah blah
7143 [[local:es:Spanish]]
7144 !! html/php
7145 <p>Blah blah blah
7146 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7147 </p>
7148 !! html/parsoid
7149 <p>Blah blah blah
7150 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7151 !! end
7152
7153 !! test
7154 Looks like an interlanguage link, but is actually a local interwiki
7155 !! options
7156 parsoid=wt2html,wt2wt,html2html
7157 !! wikitext
7158 Blah blah blah
7159 [[mi:Template:Foo]]
7160 !! html/php
7161 <p>Blah blah blah
7162 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7163 </p>
7164 !! html/parsoid
7165 <p>Blah blah blah
7166 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7167 !! end
7168
7169 ###
7170 ### Redirects, Parsoid-only
7171 ###
7172 !! test
7173 1. Simple redirect to page
7174 !! options
7175 parsoid
7176 !! wikitext
7177 #REDIRECT [[Main Page]]
7178 !! html
7179 <link rel="mw:PageProp/redirect" href="./Main_Page">
7180 !! end
7181
7182 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
7183 !! test
7184 2. Other redirect variants
7185 !! options
7186 parsoid=wt2html,wt2wt
7187 !! wikitext
7188 #REDIRECT [[Main_Page]]
7189 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
7190 !! html/parsoid
7191 <link rel="mw:PageProp/redirect" href="./Main_Page"><link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
7192 !! end
7193
7194 !! test
7195 Empty redirect
7196 !! options
7197 parsoid=wt2html,wt2wt
7198 !! wikitext
7199 #REDIRECT [[]]
7200 !! html
7201 <ol>
7202 <li>REDIRECT [[]]</li></ol>
7203 !! end
7204
7205 !! test
7206 Optional colon in #REDIRECT
7207 !! options
7208 # the colon is archaic syntax. we support it for wt2html, but we
7209 # don't care that it roundtrips back to the modern syntax.
7210 parsoid=wt2html,html2html
7211 !! wikitext
7212 #REDIRECT:[[Main Page]]
7213 !! html
7214 <link rel="mw:PageProp/redirect" href="./Main_Page">
7215 !! end
7216
7217 !! test
7218 Whitespace in #REDIRECT with optional colon
7219 !! options
7220 # the colon and gratuitous whitespace is archaic syntax. we support
7221 # it for wt2html, but we don't care that it roundtrips back to the
7222 # modern syntax (without extra whitespace)
7223 parsoid=wt2html,html2html
7224 !! wikitext
7225
7226 #REDIRECT
7227 :
7228 [[Main Page]]
7229 !! html
7230 <link rel="mw:PageProp/redirect" href="./Main_Page">
7231 !! end
7232
7233 !! test
7234 Piped link in #REDIRECT
7235 !! options
7236 # content after piped link is ignored. we support this syntax,
7237 # but don't care that the piped link is lost when we roundtrip this.
7238 parsoid=wt2html
7239 !! wikitext
7240 #REDIRECT [[Main Page|bar]]
7241 !! html
7242 <link rel="mw:PageProp/redirect" href="./Main_Page">
7243 !! end
7244
7245 !! test
7246 Redirect to category
7247 !! options
7248 parsoid=wt2html
7249 !! wikitext
7250 #REDIRECT [[Category:Foo]]
7251 !! html
7252 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7253 !! end
7254
7255 !! test
7256 Redirect to category with URL encoding
7257 !! options
7258 parsoid=wt2html
7259 !! wikitext
7260 #REDIRECT [[Category%3AFoo]]
7261 !! html
7262 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7263 !! end
7264
7265 !! test
7266 Redirect to category page
7267 !! options
7268 parsoid=wt2html,html2html
7269 !! wikitext
7270 #REDIRECT [[:Category:Foo]]
7271 !! html
7272 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7273 !! end
7274
7275 !! test
7276 Redirect to image page (1)
7277 !! options
7278 parsoid
7279 !! wikitext
7280 #REDIRECT [[File:Wiki.png]]
7281 !! html
7282 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7283 !! end
7284
7285 !! test
7286 Redirect to image page (2)
7287 !! options
7288 parsoid
7289 !! wikitext
7290 #REDIRECT [[Image:Wiki.png]]
7291 !! html
7292 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7293 !! end
7294
7295 !! test
7296 Redirect to language
7297 !! options
7298 parsoid
7299 !! wikitext
7300 #REDIRECT [[en:File:Wiki.png]]
7301 !! html
7302 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7303 !! end
7304
7305 !! test
7306 Redirect to interwiki
7307 !! options
7308 parsoid
7309 !! wikitext
7310 #REDIRECT [[meatball:File:Wiki.png]]
7311 !! html
7312 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7313 !! end
7314
7315 !! test
7316 Non-English #REDIRECT
7317 !! options
7318 parsoid
7319 language=is
7320 !! wikitext
7321 #TILVÍSUN [[Main Page]]
7322 !! html
7323 <link rel="mw:PageProp/redirect" href="./Main_Page">
7324 !! end
7325
7326 !! test
7327 New redirect
7328 !! options
7329 parsoid=html2wt
7330 !! wikitext
7331 Foo
7332 #REDIRECT [[Foo]]
7333 !! html
7334 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7335 !! end
7336
7337 ##
7338 ## XHTML tidiness
7339 ###
7340
7341 !! test
7342 <br> to <br />
7343 !! wikitext
7344 1<br>2<br />3
7345 !! html
7346 <p>1<br />2<br />3
7347 </p>
7348 !! end
7349
7350 !! test
7351 Broken br tag sanitization
7352 !! wikitext
7353 </br>
7354 !! html/php
7355 <p>&lt;/br&gt;
7356 </p>
7357 !! end
7358
7359 # TODO: Fix html2html mode (bug 51055)!
7360 # This </br> handling was added as part of bug 50831; but it
7361 # differs from how PHP+tidy handles this. We should investigate
7362 # this.
7363 !! test
7364 Parsoid: Broken br tag recognition
7365 !! options
7366 parsoid=wt2html
7367 !! wikitext
7368 </br>
7369
7370 <br/ >
7371 !! html/php+tidy
7372 <p>&lt;/br&gt;</p>
7373 <p><br /></p>
7374 !! html/parsoid
7375 <p><br></p>
7376 <p><br/></p>
7377 !! end
7378
7379 !! test
7380 Incorrecly removing closing slashes from correctly formed XHTML
7381 !! wikitext
7382 <br style="clear:both;" />
7383 !! html
7384 <p><br style="clear:both;" />
7385 </p>
7386 !! end
7387
7388 !! test
7389 Failing to transform badly formed HTML into correct XHTML
7390 !! wikitext
7391 <br style="clear: left;">
7392 <br style="clear: right;">
7393 <br style="clear: both;">
7394 !! html
7395 <p><br style="clear: left;" />
7396 <br style="clear: right;" />
7397 <br style="clear: both;" />
7398 </p>
7399 !!end
7400
7401 !! test
7402 Handling html with a div self-closing tag
7403 !! wikitext
7404 <div title />
7405 <div title/>
7406 <div title/ >
7407 <div title=bar />
7408 <div title=bar/>
7409 <div title=bar/ >
7410 !! html
7411 <p>&lt;div title /&gt;
7412 &lt;div title/&gt;
7413 </p>
7414 <div>
7415 <p>&lt;div title=bar /&gt;
7416 &lt;div title=bar/&gt;
7417 </p>
7418 <div title="bar/"></div>
7419 </div>
7420
7421 !! end
7422
7423 !! test
7424 Handling html with a br self-closing tag
7425 !! wikitext
7426 <br title />
7427 <br title/>
7428 <br title/ >
7429 <br title=bar />
7430 <br title=bar/>
7431 <br title=bar/ >
7432 !! html/php
7433 <p><br title="title" />
7434 <br title="title" />
7435 <br />
7436 <br title="bar" />
7437 <br title="bar" />
7438 <br title="bar/" />
7439 </p>
7440 !! html/parsoid
7441 <p><br title="" />
7442 <br title="" />
7443 <br />
7444 <br title="bar" />
7445 <br title="bar" />
7446 <br title="bar/" />
7447 </p>
7448 !! end
7449
7450 !! test
7451 Horizontal ruler (should it add that extra space?)
7452 !! wikitext
7453 <hr>
7454 <hr >
7455 foo <hr
7456 > bar
7457 !! html+tidy
7458 <hr />
7459 <hr />
7460 <p>foo</p>
7461 <hr />
7462 <p>bar</p>
7463 !! end
7464
7465 !! test
7466 Horizontal ruler -- 4+ dashes render hr
7467 !! wikitext
7468 ----
7469 !! html
7470 <hr />
7471
7472 !! end
7473
7474 !! test
7475 Horizontal ruler -- eats additional dashes on the same line
7476 !! wikitext
7477 ---------
7478 !! html
7479 <hr />
7480
7481 !! end
7482
7483 !! test
7484 Horizontal ruler -- does not collapse dashes on consecutive lines
7485 !! wikitext
7486 ----
7487 ----
7488 !! html
7489 <hr />
7490 <hr />
7491
7492 !! end
7493
7494 !! test
7495 Horizontal ruler -- <4 dashes render as plain text
7496 !! wikitext
7497 ---
7498 !! html
7499 <p>---
7500 </p>
7501 !! end
7502
7503 !! test
7504 Horizontal ruler -- Supports content following dashes on same line
7505 !! wikitext
7506 ---- Foo
7507 !! html
7508 <hr /> Foo
7509
7510 !! html+tidy
7511 <hr />
7512 <p>Foo</p>
7513 !! end
7514
7515 ###
7516 ### Block-level elements
7517 ###
7518 !! test
7519 Common list
7520 !! wikitext
7521 *Common list
7522 * item 2
7523 *item 3
7524 !! html
7525 <ul><li>Common list</li>
7526 <li> item 2</li>
7527 <li>item 3</li></ul>
7528
7529 !! end
7530
7531 !! test
7532 Numbered list
7533 !! wikitext
7534 #Numbered list
7535 #item 2
7536 # item 3
7537 !! html
7538 <ol><li>Numbered list</li>
7539 <li>item 2</li>
7540 <li> item 3</li></ol>
7541
7542 !! end
7543
7544 !! test
7545 Mixed list
7546 !! wikitext
7547 *Mixed list
7548 *# with numbers
7549 ** and bullets
7550 *# and numbers
7551 *bullets again
7552 **bullet level 2
7553 ***bullet level 3
7554 ***#Number on level 4
7555 **bullet level 2
7556 **#Number on level 3
7557 **#Number on level 3
7558 *#number level 2
7559 *Level 1
7560 *** Level 3
7561 #** Level 3, but ordered
7562 !! html
7563 <ul><li>Mixed list
7564 <ol><li> with numbers</li></ol>
7565 <ul><li> and bullets</li></ul>
7566 <ol><li> and numbers</li></ol></li>
7567 <li>bullets again
7568 <ul><li>bullet level 2
7569 <ul><li>bullet level 3
7570 <ol><li>Number on level 4</li></ol></li></ul></li>
7571 <li>bullet level 2
7572 <ol><li>Number on level 3</li>
7573 <li>Number on level 3</li></ol></li></ul>
7574 <ol><li>number level 2</li></ol></li>
7575 <li>Level 1
7576 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7577 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7578
7579 !! end
7580
7581 !! test
7582 Nested lists 1
7583 !! wikitext
7584 *foo
7585 **bar
7586 !! html
7587 <ul><li>foo
7588 <ul><li>bar</li></ul></li></ul>
7589
7590 !! end
7591
7592 !! test
7593 Nested lists 2
7594 !! wikitext
7595 **foo
7596 *bar
7597 !! html
7598 <ul><li><ul><li>foo</li></ul></li>
7599 <li>bar</li></ul>
7600
7601 !! end
7602
7603 !! test
7604 Nested lists 3 (first element empty)
7605 !! wikitext
7606 *
7607 **bar
7608 !! html
7609 <ul><li>
7610 <ul><li>bar</li></ul></li></ul>
7611
7612 !! end
7613
7614 !! test
7615 Nested lists 4 (first element empty)
7616 !! wikitext
7617 **
7618 *bar
7619 !! html
7620 <ul><li><ul><li></li></ul></li>
7621 <li>bar</li></ul>
7622
7623 !! end
7624
7625 !! test
7626 Nested lists 5 (both elements empty)
7627 !! wikitext
7628 **
7629 *
7630 !! html
7631 <ul><li><ul><li></li></ul></li>
7632 <li></li></ul>
7633
7634 !! end
7635
7636 !! test
7637 Nested lists 6 (both elements empty)
7638 !! wikitext
7639 *
7640 **
7641 !! html
7642 <ul><li>
7643 <ul><li></li></ul></li></ul>
7644
7645 !! end
7646
7647 !! test
7648 Nested lists 7 (skip initial nesting levels)
7649 !! wikitext
7650 *** foo
7651 !! html
7652 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7653
7654 !! end
7655
7656 !! test
7657 Nested lists 8 (multiple nesting transitions)
7658 !! wikitext
7659 * foo
7660 *** bar
7661 ** baz
7662 * boo
7663 !! html
7664 <ul><li> foo
7665 <ul><li><ul><li> bar</li></ul></li>
7666 <li> baz</li></ul></li>
7667 <li> boo</li></ul>
7668
7669 !! end
7670
7671 !! test
7672 1. Lists with start-of-line-transparent tokens before bullets: Comments
7673 !! wikitext
7674 *foo
7675 *<!--cmt-->bar
7676 <!--cmt-->*baz
7677 !! html
7678 <ul><li>foo</li>
7679 <li>bar</li>
7680 <li>baz</li></ul>
7681
7682 !! end
7683
7684 !! test
7685 2. Lists with start-of-line-transparent tokens before bullets: Template close
7686 !! wikitext
7687 *foo {{echo|bar
7688 }}*baz
7689 !! html
7690 <ul><li>foo bar</li>
7691 <li>baz</li></ul>
7692
7693 !! end
7694
7695 !! test
7696 List items are not parsed correctly following a <pre> block (bug 785)
7697 !! wikitext
7698 * <pre>foo</pre>
7699 * <pre>bar</pre>
7700 * zar
7701 !! html
7702 <ul><li> <pre>foo</pre></li>
7703 <li> <pre>bar</pre></li>
7704 <li> zar</li></ul>
7705
7706 !! end
7707
7708 !! test
7709 List items from template
7710 !! wikitext
7711
7712 {{inner list}}
7713 * item 2
7714
7715 * item 0
7716 {{inner list}}
7717 * item 2
7718
7719 * item 0
7720 * notSOL{{inner list}}
7721 * item 2
7722 !! html
7723 <ul><li> item 1</li>
7724 <li> item 2</li></ul>
7725 <ul><li> item 0</li>
7726 <li> item 1</li>
7727 <li> item 2</li></ul>
7728 <ul><li> item 0</li>
7729 <li> notSOL</li>
7730 <li> item 1</li>
7731 <li> item 2</li></ul>
7732
7733 !! end
7734
7735 !! test
7736 List interrupted by empty line or heading
7737 !! wikitext
7738 * foo
7739
7740 ** bar
7741 == A heading ==
7742 * Another list item
7743 !! html
7744 <ul><li> foo</li></ul>
7745 <ul><li><ul><li> bar</li></ul></li></ul>
7746 <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>
7747 <ul><li> Another list item</li></ul>
7748
7749 !!end
7750
7751 !!test
7752 Multiple list tags generated by templates
7753 !! wikitext
7754 {{echo|<li>}}a
7755 {{echo|<li>}}b
7756 {{echo|<li>}}c
7757 !! html
7758 <li>a
7759 <li>b
7760 <li>c</li>
7761 </li>
7762 </li>
7763
7764 !! html+tidy
7765 <ul>
7766 <li>a</li>
7767 <li>b</li>
7768 <li>c</li>
7769 </ul>
7770 !!end
7771
7772 !!test
7773 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7774 !! wikitext
7775 *a
7776 <!--This line will NOT split the list-->
7777 *b
7778 <!--This line will NOT split the list either-->
7779 *c
7780 <!--foo--> <!----> <!--This line NOT split the list either-->
7781 *d
7782 !! html
7783 <ul><li>a</li>
7784 <li>b</li>
7785 <li>c</li>
7786 <li>d</li></ul>
7787
7788 !!end
7789
7790 !!test
7791 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7792 !! wikitext
7793 *a
7794 <!--This line will NOT split the list-->
7795 *b
7796 <!--This line will NOT split the list either-->
7797 *c
7798 <!--foo--> <!----> <!--This line NOT split the list
7799 either-->
7800 *d
7801 !! html
7802 <ul><li>a</li>
7803 <li>b</li>
7804 <li>c</li>
7805 <li>d</li></ul>
7806
7807 !!end
7808
7809 !!test
7810 Test the li-hack
7811 (The PHP parser relies on Tidy for the hack)
7812 !!options
7813 parsoid=wt2html,wt2wt
7814 !! wikitext
7815 * foo
7816 * <li>li-hack
7817 * {{echo|<li>templated li-hack}}
7818 * <!--foo--> <li> unsupported li-hack with preceding comments
7819
7820 <ul>
7821 <li><li>not a li-hack
7822 </li>
7823 </ul>
7824 !! html+tidy
7825 <ul>
7826 <li>foo</li>
7827 <li>li-hack</li>
7828 <li>templated li-hack</li>
7829 <li>unsupported li-hack with preceding comments</li>
7830 </ul>
7831 <ul>
7832 <li>not a li-hack</li>
7833 </ul>
7834 !!end
7835
7836 !! test
7837 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
7838 !! options
7839 parsoid
7840 !! wikitext
7841 # foo
7842 ## bar
7843 * foo
7844 ** bar
7845 : foo
7846 :: bar
7847 !! html
7848 <ol>
7849 <li> foo<ol>
7850 <li> bar</li>
7851 </ol></li>
7852 </ol><ul>
7853 <li> foo<ul>
7854 <li> bar</li>
7855 </ul></li>
7856 </ul><dl>
7857 <dd> foo<dl>
7858 <dd> bar</dd>
7859 </dl></dd>
7860 </dl>
7861 !! end
7862
7863 !! test
7864 Parsoid: Test of whitespace serialization with Templated bullets
7865 !! options
7866 parsoid
7867 !! wikitext
7868 * {{bullet}}
7869 !! html
7870 <ul>
7871 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
7872 </ul>
7873 !! end
7874
7875 # ------------------------------------------------------------------------
7876 # The next set of tests are about Parsoid's ability to handle badly nested
7877 # tags (parse, minimize scope of fixup, and roundtrip back)
7878 # ------------------------------------------------------------------------
7879
7880 !! test
7881 Unbalanced closing block tags break a list
7882 (php parser relies on Tidy to fix up)
7883 !! wikitext
7884 <div>
7885 *a</div><div>
7886 *b</div>
7887 !! html+tidy
7888 <div>
7889 <ul>
7890 <li>a</li>
7891 </ul>
7892 </div>
7893 <div>
7894 <ul>
7895 <li>b</li>
7896 </ul>
7897 </div>
7898 !! end
7899
7900 # Parsoid fails this test, but it might be tricky to support properly.
7901 # See bug 68395.
7902 !! test
7903 Unbalanced closing non-block tags don't break a list
7904 (php parser relies on Tidy to fix up)
7905 !! wikitext
7906 <span>
7907 *a</span><span>
7908 *b</span>
7909 !! html/php+tidy
7910 <ul>
7911 <li><span>a</span></li>
7912 <li><span>b</span></li>
7913 </ul>
7914 !! html/parsoid
7915 <span>
7916 <ul>
7917 <li>a<span></span>
7918 </li>
7919 <li>b
7920 </li>
7921 </ul>
7922 </span>
7923 !! end
7924
7925 !! test
7926 Unclosed formatting tags that straddle lists are closed and reopened
7927 (php parser relies on Tidy to fix up)
7928 !! options
7929 parsoid=wt2html,wt2wt,html2html
7930 !! wikitext
7931 # <s> a
7932 # b </s>
7933 !! html/php+tidy
7934 <ol>
7935 <li><s>a</s></li>
7936 <li><s>b</s></li>
7937 </ol>
7938 !! html/parsoid
7939 <ol><li> <s> a</s></li>
7940 <li><s> b </s></li></ol>
7941 !! end
7942
7943 # Parsoid fails this test, but it might be tricky to support properly.
7944 # See bug 68395.
7945 !!test
7946 List embedded in a non-block tag
7947 (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
7948 !! wikitext
7949 <small>
7950 * foo
7951 </small>
7952 !! html/php+tidy
7953 <ul>
7954 <li><small>foo</small></li>
7955 </ul>
7956 !! html/parsoid
7957 <small>
7958 <ul>
7959 <li> foo</li>
7960 </ul>
7961 </small>
7962 !!end
7963
7964 # This is a bug in the PHP parser + tidy combination.
7965 # (The </tr> tag gets parsed as text and html-escaped by PHP,
7966 # and then fostered out of the table by tidy.)
7967 # We believe the Parsoid output to be correct.
7968 !! test
7969 Table with missing opening <tr> tag
7970 !! options
7971 parsoid=wt2html,wt2wt
7972 !! wikitext
7973 <table>
7974 <td>foo</td>
7975 </tr>
7976 </table>
7977 !! html/php+tidy
7978 <p>&lt;/tr&gt;</p>
7979 <table>
7980 <tr>
7981 <td>foo</td>
7982 </tr>
7983 </table>
7984 !! html/parsoid
7985 <table>
7986 <tr>
7987 <td>foo</td>
7988 </tr>
7989 </table>
7990 !! end
7991
7992 ###
7993 ### Magic Words
7994 ###
7995
7996 # Note that the current date is hard-coded as
7997 # 1970-01-01T00:02:03Z (a Thursday)
7998 # when running parser tests. The timezone is also fixed to GMT, so
7999 # local date will be identical to current date.
8000
8001 !! test
8002 Magic Word: {{CURRENTDAY}}
8003 !! wikitext
8004 {{CURRENTDAY}}
8005 !! html
8006 <p>1
8007 </p>
8008 !! end
8009
8010 !! test
8011 Magic Word: {{CURRENTDAY2}}
8012 !! wikitext
8013 {{CURRENTDAY2}}
8014 !! html
8015 <p>01
8016 </p>
8017 !! end
8018
8019 !! test
8020 Magic Word: {{CURRENTDAYNAME}}
8021 !! wikitext
8022 {{CURRENTDAYNAME}}
8023 !! html
8024 <p>Thursday
8025 </p>
8026 !! end
8027
8028 !! test
8029 Magic Word: {{CURRENTDOW}}
8030 !! wikitext
8031 {{CURRENTDOW}}
8032 !! html
8033 <p>4
8034 </p>
8035 !! end
8036
8037 !! test
8038 Magic Word: {{CURRENTMONTH}}
8039 !! wikitext
8040 {{CURRENTMONTH}}
8041 !! html
8042 <p>01
8043 </p>
8044 !! end
8045
8046 !! test
8047 Magic Word: {{CURRENTMONTH1}}
8048 !! wikitext
8049 {{CURRENTMONTH1}}
8050 !! html
8051 <p>1
8052 </p>
8053 !! end
8054
8055 !! test
8056 Magic Word: {{CURRENTMONTHABBREV}}
8057 !! wikitext
8058 {{CURRENTMONTHABBREV}}
8059 !! html
8060 <p>Jan
8061 </p>
8062 !! end
8063
8064 !! test
8065 Magic Word: {{CURRENTMONTHNAME}}
8066 !! wikitext
8067 {{CURRENTMONTHNAME}}
8068 !! html
8069 <p>January
8070 </p>
8071 !! end
8072
8073 !! test
8074 Magic Word: {{CURRENTMONTHNAMEGEN}}
8075 !! wikitext
8076 {{CURRENTMONTHNAMEGEN}}
8077 !! html
8078 <p>January
8079 </p>
8080 !! end
8081
8082 !! test
8083 Magic Word: {{CURRENTTIME}}
8084 !! wikitext
8085 {{CURRENTTIME}}
8086 !! html
8087 <p>00:02
8088 </p>
8089 !! end
8090
8091 !! test
8092 Magic Word: {{CURRENTHOUR}}
8093 !! wikitext
8094 {{CURRENTHOUR}}
8095 !! html
8096 <p>00
8097 </p>
8098 !! end
8099
8100 !! test
8101 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8102 !! wikitext
8103 {{CURRENTWEEK}}
8104 !! html
8105 <p>1
8106 </p>
8107 !! end
8108
8109 !! test
8110 Magic Word: {{CURRENTYEAR}}
8111 !! wikitext
8112 {{CURRENTYEAR}}
8113 !! html
8114 <p>1970
8115 </p>
8116 !! end
8117
8118 !! test
8119 Magic Word: {{CURRENTTIMESTAMP}}
8120 !! wikitext
8121 {{CURRENTTIMESTAMP}}
8122 !! html
8123 <p>19700101000203
8124 </p>
8125 !! end
8126
8127 !! test
8128 Magic Words LOCAL (UTC)
8129 !! wikitext
8130 * {{LOCALMONTH}}
8131 * {{LOCALMONTH1}}
8132 * {{LOCALMONTHNAME}}
8133 * {{LOCALMONTHNAMEGEN}}
8134 * {{LOCALMONTHABBREV}}
8135 * {{LOCALDAY}}
8136 * {{LOCALDAY2}}
8137 * {{LOCALDAYNAME}}
8138 * {{LOCALYEAR}}
8139 * {{LOCALTIME}}
8140 * {{LOCALHOUR}}
8141 * {{LOCALWEEK}}
8142 * {{LOCALDOW}}
8143 * {{LOCALTIMESTAMP}}
8144 !! html
8145 <ul><li> 01</li>
8146 <li> 1</li>
8147 <li> January</li>
8148 <li> January</li>
8149 <li> Jan</li>
8150 <li> 1</li>
8151 <li> 01</li>
8152 <li> Thursday</li>
8153 <li> 1970</li>
8154 <li> 00:02</li>
8155 <li> 00</li>
8156 <li> 1</li>
8157 <li> 4</li>
8158 <li> 19700101000203</li></ul>
8159
8160 !! end
8161
8162 !! test
8163 Magic Word: {{FULLPAGENAME}}
8164 !! options
8165 title=[[User:Ævar Arnfjörð Bjarmason]]
8166 !! wikitext
8167 {{FULLPAGENAME}}
8168 !! html
8169 <p>User:Ævar Arnfjörð Bjarmason
8170 </p>
8171 !! end
8172
8173 !! test
8174 Magic Word: {{FULLPAGENAMEE}}
8175 !! options
8176 title=[[User:Ævar Arnfjörð Bjarmason]]
8177 !! wikitext
8178 {{FULLPAGENAMEE}}
8179 !! html
8180 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8181 </p>
8182 !! end
8183
8184 !! test
8185 Magic Word: {{TALKSPACE}}
8186 !! options
8187 title=[[User:Ævar Arnfjörð Bjarmason]]
8188 !! wikitext
8189 {{TALKSPACE}}
8190 !! html
8191 <p>User talk
8192 </p>
8193 !! end
8194
8195 !! test
8196 Magic Word: {{TALKSPACE}}, same namespace
8197 !! options
8198 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8199 !! wikitext
8200 {{TALKSPACE}}
8201 !! html
8202 <p>User talk
8203 </p>
8204 !! end
8205
8206 !! test
8207 Magic Word: {{TALKSPACE}}, main namespace
8208 !! options
8209 title=[[Parser Test]]
8210 !! wikitext
8211 {{TALKSPACE}}
8212 !! html
8213 <p>Talk
8214 </p>
8215 !! end
8216
8217 !! test
8218 Magic Word: {{TALKSPACEE}}
8219 !! options
8220 title=[[User:Ævar Arnfjörð Bjarmason]]
8221 !! wikitext
8222 {{TALKSPACEE}}
8223 !! html
8224 <p>User_talk
8225 </p>
8226 !! end
8227
8228 !! test
8229 Magic Word: {{SUBJECTSPACE}}
8230 !! options
8231 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8232 !! wikitext
8233 {{SUBJECTSPACE}}
8234 !! html
8235 <p>User
8236 </p>
8237 !! end
8238
8239 !! test
8240 Magic Word: {{SUBJECTSPACE}}, same namespace
8241 !! options
8242 title=[[User:Ævar Arnfjörð Bjarmason]]
8243 !! wikitext
8244 {{SUBJECTSPACE}}
8245 !! html
8246 <p>User
8247 </p>
8248 !! end
8249
8250 !! test
8251 Magic Word: {{SUBJECTSPACE}}, main namespace
8252 !! options
8253 title=[[Parser Test]]
8254 !! wikitext
8255 {{SUBJECTSPACE}}
8256 !! html
8257
8258 !! end
8259
8260 !! test
8261 Magic Word: {{SUBJECTSPACEE}}
8262 !! options
8263 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8264 !! wikitext
8265 {{SUBJECTSPACEE}}
8266 !! html
8267 <p>User
8268 </p>
8269 !! end
8270
8271 !! test
8272 Magic Word: {{NAMESPACE}}
8273 !! options
8274 title=[[User:Ævar Arnfjörð Bjarmason]]
8275 !! wikitext
8276 {{NAMESPACE}}
8277 !! html
8278 <p>User
8279 </p>
8280 !! end
8281
8282 !! test
8283 Magic Word: {{NAMESPACEE}}
8284 !! options
8285 title=[[User:Ævar Arnfjörð Bjarmason]]
8286 !! wikitext
8287 {{NAMESPACEE}}
8288 !! html
8289 <p>User
8290 </p>
8291 !! end
8292
8293 !! test
8294 Magic Word: {{NAMESPACENUMBER}}
8295 !! options
8296 title=[[User:Ævar Arnfjörð Bjarmason]]
8297 !! wikitext
8298 {{NAMESPACENUMBER}}
8299 !! html
8300 <p>2
8301 </p>
8302 !! end
8303
8304 !! test
8305 Magic Word: {{SUBPAGENAME}}
8306 !! options
8307 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8308 !! wikitext
8309 {{SUBPAGENAME}}
8310 !! html
8311 <p>sub ö
8312 </p>
8313 !! end
8314
8315 !! test
8316 Magic Word: {{SUBPAGENAMEE}}
8317 !! options
8318 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8319 !! wikitext
8320 {{SUBPAGENAMEE}}
8321 !! html
8322 <p>sub_%C3%B6
8323 </p>
8324 !! end
8325
8326 !! test
8327 Magic Word: {{ROOTPAGENAME}}
8328 !! options
8329 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8330 !! wikitext
8331 {{ROOTPAGENAME}}
8332 !! html
8333 <p>Ævar Arnfjörð Bjarmason
8334 </p>
8335 !! end
8336
8337 !! test
8338 Magic Word: {{ROOTPAGENAMEE}}
8339 !! options
8340 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8341 !! wikitext
8342 {{ROOTPAGENAMEE}}
8343 !! html
8344 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8345 </p>
8346 !! end
8347
8348 !! test
8349 Magic Word: {{BASEPAGENAME}}
8350 !! options
8351 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8352 !! wikitext
8353 {{BASEPAGENAME}}
8354 !! html
8355 <p>Ævar Arnfjörð Bjarmason
8356 </p>
8357 !! end
8358
8359 !! test
8360 Magic Word: {{BASEPAGENAMEE}}
8361 !! options
8362 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8363 !! wikitext
8364 {{BASEPAGENAMEE}}
8365 !! html
8366 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8367 </p>
8368 !! end
8369
8370 !! test
8371 Magic Word: {{TALKPAGENAME}}
8372 !! options
8373 title=[[User:Ævar Arnfjörð Bjarmason]]
8374 !! wikitext
8375 {{TALKPAGENAME}}
8376 !! html
8377 <p>User talk:Ævar Arnfjörð Bjarmason
8378 </p>
8379 !! end
8380
8381 !! test
8382 Magic Word: {{TALKPAGENAMEE}}
8383 !! options
8384 title=[[User:Ævar Arnfjörð Bjarmason]]
8385 !! wikitext
8386 {{TALKPAGENAMEE}}
8387 !! html
8388 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8389 </p>
8390 !! end
8391
8392 !! test
8393 Magic Word: {{SUBJECTPAGENAME}}
8394 !! options
8395 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8396 !! wikitext
8397 {{SUBJECTPAGENAME}}
8398 !! html
8399 <p>User:Ævar Arnfjörð Bjarmason
8400 </p>
8401 !! end
8402
8403 !! test
8404 Magic Word: {{SUBJECTPAGENAMEE}}
8405 !! options
8406 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8407 !! wikitext
8408 {{SUBJECTPAGENAMEE}}
8409 !! html
8410 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8411 </p>
8412 !! end
8413
8414 !! test
8415 Magic Word: {{NUMBEROFFILES}}
8416 !! wikitext
8417 {{NUMBEROFFILES}}
8418 !! html
8419 <p>5
8420 </p>
8421 !! end
8422
8423 !! test
8424 Magic Word: {{PAGENAME}}
8425 !! options
8426 title=[[User:Ævar Arnfjörð Bjarmason]]
8427 !! wikitext
8428 {{PAGENAME}}
8429 !! html
8430 <p>Ævar Arnfjörð Bjarmason
8431 </p>
8432 !! end
8433
8434 !! test
8435 Magic Word: {{PAGENAME}} with metacharacters
8436 !! options
8437 title=[['foo & bar = baz']]
8438 !! wikitext
8439 ''{{PAGENAME}}''
8440 !! html/php
8441 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8442 </p>
8443 !! html+tidy
8444 <p><i>'foo &amp; bar = baz'</i></p>
8445 !! end
8446
8447 !! test
8448 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8449 !! options
8450 title=[[*RFC 1234 http://example.com/]]
8451 !! wikitext
8452 {{PAGENAME}}
8453 !! html/php
8454 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8455 </p>
8456 !! html+tidy
8457 <p>*RFC 1234 http://example.com/</p>
8458 !! end
8459
8460 !! test
8461 Magic Word: {{PAGENAMEE}}
8462 !! options
8463 title=[[User:Ævar Arnfjörð Bjarmason]]
8464 !! wikitext
8465 {{PAGENAMEE}}
8466 !! html
8467 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8468 </p>
8469 !! end
8470
8471 !! test
8472 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8473 !! options
8474 title=[[*RFC 1234 http://example.com/]]
8475 !! wikitext
8476 {{PAGENAMEE}}
8477 !! html/php
8478 <p>&#42;RFC_1234_http&#58;//example.com/
8479 </p>
8480 !! html+tidy
8481 <p>*RFC_1234_http://example.com/</p>
8482 !! end
8483
8484 !! test
8485 Magic Word: {{REVISIONID}}
8486 !! wikitext
8487 {{REVISIONID}}
8488 !! html
8489 <p>1337
8490 </p>
8491 !! end
8492
8493 !! test
8494 Magic Word: {{SCRIPTPATH}}
8495 !! wikitext
8496 {{SCRIPTPATH}}
8497 !! html
8498 <p>/
8499 </p>
8500 !! end
8501
8502 !! test
8503 Magic Word: {{STYLEPATH}}
8504 !! wikitext
8505 {{STYLEPATH}}
8506 !! html
8507 <p>/skins
8508 </p>
8509 !! end
8510
8511 !! test
8512 Magic Word: {{SERVER}}
8513 !! wikitext
8514 {{SERVER}}
8515 !! html
8516 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8517 </p>
8518 !! end
8519
8520 !! test
8521 Magic Word: {{SERVERNAME}}
8522 !! wikitext
8523 {{SERVERNAME}}
8524 !! html
8525 <p>example.org
8526 </p>
8527 !! end
8528
8529 !! test
8530 Magic Word: {{SITENAME}}
8531 !! wikitext
8532 {{SITENAME}}
8533 !! html
8534 <p>MediaWiki
8535 </p>
8536 !! end
8537
8538 !! test
8539 Case-sensitive magic words, when cased differently, should just be template transclusions
8540 !! wikitext
8541 {{CurrentMonth}}
8542 {{currentday}}
8543 {{cURreNTweEK}}
8544 {{currentHour}}
8545 !! html
8546 <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>
8547 <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>
8548 <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>
8549 <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>
8550 </p>
8551 !! end
8552
8553 !! test
8554 Case-insensitive magic words should still work with weird casing.
8555 !! wikitext
8556 {{sErVeRNaMe}}
8557 {{LCFirst:AOEU}}
8558 {{ucFIRST:aoeu}}
8559 {{SERver}}
8560 !! html
8561 <p>example.org
8562 aOEU
8563 Aoeu
8564 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8565 </p>
8566 !! end
8567
8568 !! test
8569 Namespace 1 {{ns:1}}
8570 !! wikitext
8571 {{ns:1}}
8572 !! html
8573 <p>Talk
8574 </p>
8575 !! end
8576
8577 !! test
8578 Namespace 1 {{ns:01}}
8579 !! wikitext
8580 {{ns:01}}
8581 !! html
8582 <p>Talk
8583 </p>
8584 !! end
8585
8586 !! test
8587 Namespace 0 {{ns:0}} (bug 4783)
8588 !! wikitext
8589 {{ns:0}}
8590 !! html
8591
8592 !! end
8593
8594 !! test
8595 Namespace 0 {{ns:00}} (bug 4783)
8596 !! wikitext
8597 {{ns:00}}
8598 !! html
8599
8600 !! end
8601
8602 !! test
8603 Namespace -1 {{ns:-1}}
8604 !! wikitext
8605 {{ns:-1}}
8606 !! html
8607 <p>Special
8608 </p>
8609 !! end
8610
8611 !! test
8612 Namespace User {{ns:User}}
8613 !! wikitext
8614 {{ns:User}}
8615 !! html
8616 <p>User
8617 </p>
8618 !! end
8619
8620 !! test
8621 Namespace User talk {{ns:User_talk}}
8622 !! wikitext
8623 {{ns:User_talk}}
8624 !! html
8625 <p>User talk
8626 </p>
8627 !! end
8628
8629 !! test
8630 Namespace User talk {{ns:uSeR tAlK}}
8631 !! wikitext
8632 {{ns:uSeR tAlK}}
8633 !! html
8634 <p>User talk
8635 </p>
8636 !! end
8637
8638 !! test
8639 Namespace File {{ns:File}}
8640 !! wikitext
8641 {{ns:File}}
8642 !! html
8643 <p>File
8644 </p>
8645 !! end
8646
8647 !! test
8648 Namespace File {{ns:Image}}
8649 !! wikitext
8650 {{ns:Image}}
8651 !! html
8652 <p>File
8653 </p>
8654 !! end
8655
8656 !! test
8657 Namespace (lang=de) Benutzer {{ns:User}}
8658 !! options
8659 language=de
8660 !! wikitext
8661 {{ns:User}}
8662 !! html
8663 <p>Benutzer
8664 </p>
8665 !! end
8666
8667 !! test
8668 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
8669 !! options
8670 language=de
8671 !! wikitext
8672 {{ns:3}}
8673 !! html
8674 <p>Benutzer Diskussion
8675 </p>
8676 !! end
8677
8678
8679 !! test
8680 Urlencode
8681 !! wikitext
8682 {{urlencode:hi world?!}}
8683 {{urlencode:hi world?!|WIKI}}
8684 {{urlencode:hi world?!|PATH}}
8685 {{urlencode:hi world?!|QUERY}}
8686 !! html
8687 <p>hi+world%3F%21
8688 hi_world%3F!
8689 hi%20world%3F%21
8690 hi+world%3F%21
8691 </p>
8692 !! end
8693
8694 !! test
8695 Magic Word: prioritize type info over data-parsoid
8696 !! options
8697 parsoid=html2wt
8698 !! wikitext
8699 __FORCETOC__
8700 !! html
8701 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
8702 !! end
8703
8704 !! test
8705 Magic Word: serialize on separate line (parsoid)
8706 !! options
8707 parsoid=wt2wt,html2wt
8708 !! wikitext
8709 foo
8710 __NOTOC__
8711 bar
8712 !! html
8713 foo<meta property="mw:PageProp/notoc"/>bar
8714 !! end
8715
8716 !! test
8717 Magic Word: rt non-english wikis
8718 !! options
8719 parsoid=wt2wt
8720 language=de
8721 !! wikitext
8722 __NOEDITSECTION__
8723 !! html
8724 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
8725 !! end
8726
8727 ###
8728 ### Magic links
8729 ###
8730 !! test
8731 Magic links: internal link to RFC (bug 479)
8732 !! wikitext
8733 [[RFC 123]]
8734 !! html
8735 <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>
8736 </p>
8737 !! end
8738
8739 !! test
8740 Magic links: RFC (bug 479)
8741 !! wikitext
8742 RFC 822
8743 !! html
8744 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8745 </p>
8746 !! end
8747
8748 !! test
8749 Magic links: ISBN (bug 1937)
8750 !! wikitext
8751 ISBN 0-306-40615-2
8752 !! html
8753 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8754 </p>
8755 !! end
8756
8757 !! test
8758 Magic links: PMID incorrectly converts space to underscore
8759 !! wikitext
8760 PMID 1234
8761 !! html
8762 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8763 </p>
8764 !! end
8765
8766 ###
8767 ### Templates
8768 ####
8769
8770 !! test
8771 Nonexistent template
8772 !! wikitext
8773 {{thistemplatedoesnotexist}}
8774 !! html
8775 <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>
8776 </p>
8777 !! end
8778
8779 !! test
8780 Template with invalid target containing tags
8781 !! wikitext
8782 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8783 !! html
8784 <p>{{a<b>b</b>|foo|a=b|a = b}}
8785 </p>
8786 !! end
8787
8788 !! test
8789 Template with invalid target containing unclosed tag
8790 !! wikitext
8791 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8792 !! html
8793 <p>{{a<b>|foo|a=b|a = b}}</b>
8794 </p>
8795 !! end
8796
8797 !! test
8798 Template with invalid target containing wikilink
8799 !! wikitext
8800 {{[[Main Page]]}}
8801 !! html/php
8802 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
8803 </p>
8804 !! html/parsoid
8805 <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>
8806 !! end
8807
8808 !! test
8809 Template with just whitespace in it, bug #68421
8810 !! wikitext
8811 {{echo|{{ }}}}
8812 !! html/parsoid
8813 <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>
8814 !! end
8815
8816 !! article
8817 Template:test
8818 !! text
8819 This is a test template
8820 !! endarticle
8821
8822 !! test
8823 Simple template
8824 !! wikitext
8825 {{test}}
8826 !! html
8827 <p>This is a test template
8828 </p>
8829 !! end
8830
8831 !! test
8832 Template with explicit namespace
8833 !! wikitext
8834 {{Template:test}}
8835 !! html
8836 <p>This is a test template
8837 </p>
8838 !! end
8839
8840
8841 !! article
8842 Template:paramtest
8843 !! text
8844 This is a test template with parameter {{{param}}}
8845 !! endarticle
8846
8847 !! test
8848 Template parameter
8849 !! wikitext
8850 {{paramtest|param=foo}}
8851 !! html
8852 <p>This is a test template with parameter foo
8853 </p>
8854 !! end
8855
8856 !! article
8857 Template:paramtestnum
8858 !! text
8859 [[{{{1}}}|{{{2}}}]]
8860 !! endarticle
8861
8862 !! test
8863 Template unnamed parameter
8864 !! wikitext
8865 {{paramtestnum|Main Page|the main page}}
8866 !! html
8867 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
8868 </p>
8869 !! end
8870
8871 !! article
8872 Template:templatesimple
8873 !! text
8874 (test)
8875 !! endarticle
8876
8877 !! article
8878 Template:templateredirect
8879 !! text
8880 #redirect [[Template:templatesimple]]
8881 !! endarticle
8882
8883 !! article
8884 Template:templateasargtestnum
8885 !! text
8886 {{{{{1}}}}}
8887 !! endarticle
8888
8889 !! article
8890 Template:templateasargtest
8891 !! text
8892 {{template{{{templ}}}}}
8893 !! endarticle
8894
8895 !! article
8896 Template:templateasargtest2
8897 !! text
8898 {{{{{templ}}}}}
8899 !! endarticle
8900
8901 !! test
8902 Template with template name as unnamed argument
8903 !! wikitext
8904 {{templateasargtestnum|templatesimple}}
8905 !! html
8906 <p>(test)
8907 </p>
8908 !! end
8909
8910 !! test
8911 Template with template name as argument
8912 !! wikitext
8913 {{templateasargtest|templ=simple}}
8914 !! html
8915 <p>(test)
8916 </p>
8917 !! end
8918
8919 !! test
8920 Template with template name as argument (2)
8921 !! wikitext
8922 {{templateasargtest2|templ=templatesimple}}
8923 !! html
8924 <p>(test)
8925 </p>
8926 !! end
8927
8928 !! article
8929 Template:templateasargtestdefault
8930 !! text
8931 {{{{{templ|templatesimple}}}}}
8932 !! endarticle
8933
8934 !! article
8935 Template:templa
8936 !! text
8937 '''templ'''
8938 !! endarticle
8939
8940 !! test
8941 Template with default value
8942 !! wikitext
8943 {{templateasargtestdefault}}
8944 !! html
8945 <p>(test)
8946 </p>
8947 !! end
8948
8949 !! test
8950 Template with default value (value set)
8951 !! wikitext
8952 {{templateasargtestdefault|templ=templa}}
8953 !! html
8954 <p><b>templ</b>
8955 </p>
8956 !! end
8957
8958 !! test
8959 Template redirect
8960 !! wikitext
8961 {{templateredirect}}
8962 !! html
8963 <p>(test)
8964 </p>
8965 !! end
8966
8967 !! test
8968 Template with argument in separate line
8969 !! wikitext
8970 {{ templateasargtest |
8971 templ = simple }}
8972 !! html
8973 <p>(test)
8974 </p>
8975 !! end
8976
8977 !! test
8978 Template with complex template as argument
8979 !! wikitext
8980 {{paramtest|
8981 param ={{ templateasargtest |
8982 templ = simple }}}}
8983 !! html
8984 <p>This is a test template with parameter (test)
8985 </p>
8986 !! end
8987
8988 !! test
8989 Template with thumb image (with link in description)
8990 !! wikitext
8991 {{paramtest|
8992 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
8993 !! html/php
8994 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>
8995
8996 !! html+tidy
8997 <p>This is a test template with parameter</p>
8998 <div class="thumb tright">
8999 <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>
9000 <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>
9001 </div>
9002 </div>
9003 !! end
9004
9005 !! article
9006 Template:complextemplate
9007 !! text
9008 {{{1}}} {{paramtest|
9009 param ={{{param}}}}}
9010 !! endarticle
9011
9012 !! test
9013 Template with complex arguments
9014 !! wikitext
9015 {{complextemplate|
9016 param ={{ templateasargtest |
9017 templ = simple }}|[[Template:complextemplate|link]]}}
9018 !! html
9019 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
9020 </p>
9021 !! end
9022
9023 !! test
9024 BUG 553: link with two variables in a piped link
9025 !! wikitext
9026 {|
9027 |[[{{{1}}}|{{{2}}}]]
9028 |}
9029 !! html
9030 <table>
9031 <tr>
9032 <td>[[{{{1}}}|{{{2}}}]]
9033 </td></tr></table>
9034
9035 !! end
9036
9037 !! test
9038 Magic variable as template parameter
9039 !! wikitext
9040 {{paramtest|param={{SITENAME}}}}
9041 !! html
9042 <p>This is a test template with parameter MediaWiki
9043 </p>
9044 !! end
9045
9046 !! article
9047 Template:linktest
9048 !! text
9049 [[{{{param}}}|link]]
9050 !! endarticle
9051
9052 !! test
9053 Template parameter as link source
9054 !! wikitext
9055 {{linktest|param=Main Page}}
9056 !! html
9057 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
9058 </p>
9059 !! end
9060
9061 !!test
9062 Template-generated attribute string (k='v')
9063 !! wikitext
9064 <span {{attr_str|id|v1}}>bar</span>
9065 !! html
9066 <p><span id="v1">bar</span>
9067 </p>
9068 !!end
9069
9070 !!article
9071 Template:paramtest2
9072 !! text
9073 including another template, {{paramtest|param={{{arg}}}}}
9074 !! endarticle
9075
9076 !! test
9077 Template passing argument to another template
9078 !! wikitext
9079 {{paramtest2|arg='hmm'}}
9080 !! html
9081 <p>including another template, This is a test template with parameter 'hmm'
9082 </p>
9083 !! end
9084
9085 !! article
9086 Template:Linktest2
9087 !! text
9088 Main Page
9089 !! endarticle
9090
9091 !! test
9092 Template as link source
9093 !! wikitext
9094 [[{{linktest2}}]]
9095
9096 [[{{linktest2}}|Main Page]]
9097
9098 [[{{linktest2}}]]Page
9099 !! html
9100 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9101 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9102 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
9103 </p>
9104 !! end
9105
9106
9107 !! article
9108 Template:loop1
9109 !! text
9110 {{loop2}}
9111 !! endarticle
9112
9113 !! article
9114 Template:loop2
9115 !! text
9116 {{loop1}}
9117 !! endarticle
9118
9119 !! test
9120 Template infinite loop
9121 !! wikitext
9122 {{loop1}}
9123 !! html
9124 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
9125 </p>
9126 !! end
9127
9128 !! test
9129 Template from main namespace
9130 !! wikitext
9131 {{:Main Page}}
9132 !! html
9133 <p>blah blah
9134 </p>
9135 !! end
9136
9137 !! article
9138 Template:table
9139 !! text
9140 {|
9141 | 1 || 2
9142 |-
9143 | 3 || 4
9144 |}
9145 !! endarticle
9146
9147 !! test
9148 BUG 529: Template with table, not included at beginning of line
9149 !! wikitext
9150 foo {{table}}
9151 !! html
9152 <p>foo
9153 </p>
9154 <table>
9155 <tr>
9156 <td> 1 </td>
9157 <td> 2
9158 </td></tr>
9159 <tr>
9160 <td> 3 </td>
9161 <td> 4
9162 </td></tr></table>
9163
9164 !! end
9165
9166 !! test
9167 BUG 523: Template shouldn't eat newline (or add an extra one before table)
9168 !! wikitext
9169 foo
9170 {{table}}
9171 !! html
9172 <p>foo
9173 </p>
9174 <table>
9175 <tr>
9176 <td> 1 </td>
9177 <td> 2
9178 </td></tr>
9179 <tr>
9180 <td> 3 </td>
9181 <td> 4
9182 </td></tr></table>
9183
9184 !! end
9185
9186 !! test
9187 BUG 41: Template parameters shown as broken links
9188 !! wikitext
9189 {{{parameter}}}
9190 !! html
9191 <p>{{{parameter}}}
9192 </p>
9193 !! end
9194
9195 !! test
9196 Template with targets containing wikilinks
9197 !! wikitext
9198 {{[[foo]]}}
9199
9200 {{[[{{echo|foo}}]]}}
9201
9202 {{{{echo|[[foo}}]]}}
9203 !! html
9204 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9205 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9206 </p><p>{{[[foo}}]]
9207 </p>
9208 !! end
9209
9210 !! article
9211 Template:MSGNW test
9212 !! text
9213 ''None'' of '''this''' should be
9214 * interpreted
9215 but rather passed unmodified
9216 {{test}}
9217 <gallery>
9218 File:Foobar.jpg
9219 </gallery>
9220 !! endarticle
9221
9222 # hmm, fix this or just deprecate msgnw and document its behavior?
9223 !! test
9224 msgnw keyword
9225 !! wikitext
9226 {{msgnw:MSGNW test}}
9227 !! html
9228 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
9229 &#42; interpreted
9230 &#32;but rather passed unmodified
9231 &#123;&#123;test&#125;&#125;
9232 &#60;gallery&#62;
9233 File:Foobar.jpg
9234 &#60;/gallery&#62;
9235 </p>
9236 !! end
9237
9238 !! test
9239 int keyword
9240 !! wikitext
9241 {{int:youhavenewmessages|lots of money|not!}}
9242 !! html
9243 <p>You have lots of money (not!).
9244 </p>
9245 !! end
9246
9247 !! article
9248 Template:Includes
9249 !! text
9250 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9251 !! endarticle
9252
9253 !! test
9254 <includeonly> and <noinclude> being included
9255 !! wikitext
9256 {{Includes}}
9257 !! html
9258 <p>Foobar
9259 </p>
9260 !! end
9261
9262 !! article
9263 Template:Includes2
9264 !! text
9265 <onlyinclude>Foo</onlyinclude>bar
9266 !! endarticle
9267
9268 !! test
9269 <onlyinclude> being included
9270 !! wikitext
9271 {{Includes2}}
9272 !! html
9273 <p>Foo
9274 </p>
9275 !! end
9276
9277
9278 !! article
9279 Template:Includes3
9280 !! text
9281 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9282 !! endarticle
9283
9284 !! test
9285 <onlyinclude> and <includeonly> being included
9286 !! wikitext
9287 {{Includes3}}
9288 !! html
9289 <p>Foo
9290 </p>
9291 !! end
9292
9293 !! test
9294 <includeonly> and <noinclude> on a page
9295 !! wikitext
9296 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9297 !! html
9298 <p>Foozar
9299 </p>
9300 !! end
9301
9302 !! test
9303 Un-closed <noinclude>
9304 !! wikitext
9305 <noinclude>
9306 !! html
9307 !! end
9308
9309 !! test
9310 <onlyinclude> on a page
9311 !! wikitext
9312 <onlyinclude>Foo</onlyinclude>bar
9313 !! html
9314 <p>Foobar
9315 </p>
9316 !! end
9317
9318 !! test
9319 Un-closed <onlyinclude>
9320 !! wikitext
9321 <onlyinclude>
9322 !! html
9323 !! end
9324
9325 !!test
9326 Self-closed noinclude, includeonly, onlyinclude tags
9327 !! wikitext
9328 <noinclude />
9329 <includeonly />
9330 <onlyinclude />
9331 !! html
9332 <p><br />
9333 </p>
9334 !!end
9335
9336 !!test
9337 Unbalanced includeonly and noinclude tags
9338 !! wikitext
9339 {|
9340 |a</noinclude>
9341 |b</noinclude></noinclude>
9342 |c</noinclude></includeonly>
9343 |d</includeonly></includeonly>
9344 |}
9345 !! html
9346 <table>
9347 <tr>
9348 <td>a
9349 </td>
9350 <td>b
9351 </td>
9352 <td>c&lt;/includeonly&gt;
9353 </td>
9354 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9355 </td></tr></table>
9356
9357 !!end
9358
9359 !! article
9360 Template:Includeonly section
9361 !! text
9362 <includeonly>
9363 ==Includeonly section==
9364 </includeonly>
9365 ==Section T-1==
9366 !!endarticle
9367
9368 !! test
9369 Bug 6563: Edit link generation for section shown by <includeonly>
9370 !! wikitext
9371 {{includeonly section}}
9372 !! html
9373 <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>
9374 <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>
9375
9376 !! end
9377
9378 # Uses same input as the contents of [[Template:Includeonly section]]
9379 !! test
9380 Bug 6563: Section extraction for section shown by <includeonly>
9381 !! options
9382 section=T-2
9383 !! wikitext
9384 <includeonly>
9385 ==Includeonly section==
9386 </includeonly>
9387 ==Section T-2==
9388 !! html
9389 ==Section T-2==
9390 !! end
9391
9392 !! test
9393 Bug 6563: Edit link generation for section suppressed by <includeonly>
9394 !! wikitext
9395 <includeonly>
9396 ==Includeonly section==
9397 </includeonly>
9398 ==Section 1==
9399 !! html
9400 <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>
9401
9402 !! end
9403
9404 !! test
9405 Bug 6563: Section extraction for section suppressed by <includeonly>
9406 !! options
9407 section=1
9408 !! wikitext
9409 <includeonly>
9410 ==Includeonly section==
9411 </includeonly>
9412 ==Section 1==
9413 !! html
9414 ==Section 1==
9415 !! end
9416
9417 !! test
9418 Un-closed <includeonly>
9419 !! wikitext
9420 <includeonly>
9421 !! html
9422 !! end
9423
9424 !! test
9425 Includes and comments at SOL
9426 !! wikitext
9427 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
9428
9429 <noinclude>
9430 some
9431 </noinclude>* stuff
9432 * here
9433
9434 <includeonly>can have stuff</includeonly>=== here ===
9435
9436 !! html/php
9437 <h2><span class="mw-headline" id="hu">hu</span></h2>
9438 <p>some
9439 </p>
9440 <ul><li> stuff</li>
9441 <li> here</li></ul>
9442 <h3><span class="mw-headline" id="here">here</span></h3>
9443
9444 !! html/parsoid
9445 <!-- 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>
9446
9447 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
9448 <p>some</p>
9449 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
9450 <li> here</li></ul>
9451
9452 <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>
9453
9454 !! end
9455
9456 # TODO: test with DOM fragment reuse!
9457 !! test
9458 Parsoid: DOM fragment reuse
9459 !! options
9460 parsoid=wt2wt,wt2html
9461 !! wikitext
9462 a{{echo|b<table></table>c}}d
9463
9464 a{{echo|b
9465 <table></table>
9466 c}}d
9467
9468 {{echo|a
9469
9470 <table></table>
9471
9472 b}}
9473 !! html
9474 <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>
9475
9476 <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">
9477 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
9478 </span><p about="#mwt2">cd</p>
9479
9480 <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">
9481
9482 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
9483
9484 </span><p about="#mwt3">b</p>
9485 !! end
9486
9487 !! test
9488 Parsoid: Merge double tds (bug 50603)
9489 !! options
9490 parsoid
9491 !! wikitext
9492 {|
9493 |{{echo|{{!}} foo}}
9494 |}
9495 !! html
9496 <table><tbody>
9497 <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>
9498 </tbody></table>
9499 !! end
9500
9501 !! test
9502 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9503 !! options
9504 parsoid
9505 !! wikitext
9506 {{echo|<div>}}
9507 {|
9508 |{{echo|{{!}} foo}}
9509 |}
9510 {{echo|</div>}}
9511 !! html
9512 <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}}]}'>
9513 <table><tbody>
9514 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9515 </tbody></table>
9516 </div>
9517 !! end
9518
9519 ###
9520 ### <includeonly> and <noinclude> in attributes
9521 ###
9522 !!test
9523 0. includeonly around the entire attribute
9524 !! wikitext
9525 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9526 !! html
9527 <p><span id="v2">bar</span>
9528 </p>
9529 !!end
9530
9531 !!test
9532 1. includeonly in html attr key
9533 !! wikitext
9534 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9535 !! html
9536 <p><span id="foo">bar</span>
9537 </p>
9538 !!end
9539
9540 !!test
9541 2. includeonly in html attr value
9542 !! wikitext
9543 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9544 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9545 !! html
9546 <p><span id="v1">bar</span>
9547 <span id="v1">bar</span>
9548 </p>
9549 !!end
9550
9551 !!test
9552 3. includeonly in part of an attr value
9553 !! wikitext
9554 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9555 !! html
9556 <p><span style="color:red;">bar</span>
9557 </p>
9558 !!end
9559
9560 !!test
9561 4. includeonly in table attributes
9562 !! wikitext
9563 {|
9564 |- <noinclude>
9565 |-
9566 |a
9567 </noinclude>
9568 |- <includeonly>
9569 |-
9570 |b
9571 </includeonly>
9572 |}
9573 !! html
9574 <table>
9575
9576
9577 <tr>
9578 <td>a
9579 </td></tr>
9580 </table>
9581
9582 !!end
9583
9584 ###
9585 ### Token Stream Patcher tests
9586 ###
9587 ### These tests won't always pass wt2wt and other modes because
9588 ### on serialization, the table will be output on a new line.
9589 ### For now, we are blacklisting them, and using this to test selser.
9590 ###
9591
9592 !!test
9593 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
9594 !!options
9595 parsoid=wt2html,wt2wt
9596 !!wikitext
9597 {{echo|}}{| width = '100%'
9598 |foo
9599 |}
9600 !!html/parsoid
9601 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
9602 <tbody><tr><td>foo</td></tr>
9603 </tbody></table>
9604 !!end
9605
9606 !!test
9607 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
9608 !!options
9609 parsoid=wt2html,wt2wt
9610 !!wikitext
9611 <includeonly>a</includeonly>{| {{{b}}}
9612 |c
9613 |}
9614 !!html/parsoid
9615 <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}}}":""}}'>
9616 <tbody><tr><td>c</td></tr>
9617 </tbody></table>
9618
9619 !!end
9620
9621 ###
9622 ### Testing parsing of templates where a template arg
9623 ### has the same name as the template itself.
9624 ###
9625
9626 !! article
9627 Template:quote
9628 !! text
9629 {{{quote|{{{1}}}}}}
9630 !! endarticle
9631
9632 !!test
9633 Templates: Template Name/Arg clash: 1. Use of positional param
9634 !! wikitext
9635 {{quote|foo}}
9636 !! html
9637 <p>foo
9638 </p>
9639 !!end
9640
9641 !!test
9642 Templates: Template Name/Arg clash: 2. Use of named param
9643 !! wikitext
9644 {{quote|quote=foo}}
9645 !! html
9646 <p>foo
9647 </p>
9648 !!end
9649
9650 !!test
9651 Templates: Template Name/Arg clash: 3. Use of named param with empty input
9652 !! wikitext
9653 {{quote|quote}}
9654 !! html
9655 <p>quote
9656 </p>
9657 !!end
9658
9659 ###
9660 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
9661 ###
9662
9663 !!test
9664 Templates: 1. Simple use
9665 !! wikitext
9666 {{echo|Foo}}
9667 !! html
9668 <p>Foo
9669 </p>
9670 !!end
9671
9672 !!test
9673 Templates: 2. Inside a block tag
9674 !! wikitext
9675 <div>{{echo|Foo}}</div>
9676 <blockquote>{{echo|Foo}}</blockquote>
9677 !! html
9678 <div>Foo</div>
9679 <blockquote>Foo</blockquote>
9680
9681 !! html+tidy
9682 <div>Foo</div>
9683 <blockquote>
9684 <p>Foo</p>
9685 </blockquote>
9686 !!end
9687
9688 !!test
9689 Templates: P-wrapping: 1a. Templates on consecutive lines
9690 !! wikitext
9691 {{echo|Foo}}
9692 {{echo|bar}}
9693 !! html
9694 <p>Foo
9695 bar
9696 </p>
9697 !!end
9698
9699 !!test
9700 Templates: P-wrapping: 1b. Templates on consecutive lines
9701 !! wikitext
9702 Foo
9703
9704 {{echo|bar}}
9705 {{echo|baz}}
9706 !! html
9707 <p>Foo
9708 </p><p>bar
9709 baz
9710 </p>
9711 !!end
9712
9713 !!test
9714 Templates: P-wrapping: 1c. Templates on consecutive lines
9715 !! wikitext
9716 {{echo|Foo}}
9717 {{echo|bar}} <div>baz</div>
9718 !! html
9719 <p>Foo
9720 </p>
9721 bar <div>baz</div>
9722
9723 !! html+tidy
9724 <p>Foo</p>
9725 <p>bar</p>
9726 <div>baz</div>
9727 !! end
9728
9729 !!test
9730 Templates: P-wrapping: 1d. Template preceded by comment-only line
9731 !!options
9732 parsoid
9733 !! wikitext
9734 <!-- foo -->
9735 {{echo|Bar}}
9736 !! html
9737 <!-- foo -->
9738
9739 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
9740 !!end
9741
9742 !!test
9743 Templates: Inline Text: 1. Multiple template uses
9744 !! wikitext
9745 {{echo|Foo}}bar{{echo|baz}}
9746 !! html
9747 <p>Foobarbaz
9748 </p>
9749 !!end
9750
9751 !!test
9752 Templates: Inline Text: 2. Back-to-back template uses
9753 !! wikitext
9754 {{echo|Foo}}{{echo|bar}}
9755 !! html
9756 <p>Foobar
9757 </p>
9758 !!end
9759
9760 !!test
9761 Templates: Block Tags: 1. Multiple template uses
9762 !! wikitext
9763 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
9764 !! html
9765 <div>Foo</div><div>bar</div><div>baz</div>
9766
9767 !!end
9768
9769 !!test
9770 Templates: Block Tags: 2. Back-to-back template uses
9771 !! wikitext
9772 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
9773 !! html
9774 <div>Foo</div><div>bar</div>
9775
9776 !!end
9777
9778 # This is an edge case relating to paragraph wrapping.
9779 !!test
9780 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
9781 !! wikitext
9782 {{echo|a
9783 b</p>}}
9784 !! html/parsoid
9785 <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
9786 b</p>
9787 !!end
9788
9789 !!test
9790 Templates: Links: 1. Simple example
9791 !! wikitext
9792 {{echo|[[Foo|bar]]}}
9793 !! html
9794 <p><a href="/wiki/Foo" title="Foo">bar</a>
9795 </p>
9796 !!end
9797
9798 !!test
9799 Templates: Links: 2. Generation of link href
9800 !! wikitext
9801 [[{{echo|Foo}}|bar]]
9802 !! html
9803 <p><a href="/wiki/Foo" title="Foo">bar</a>
9804 </p>
9805 !!end
9806
9807 !!test
9808 Templates: Links: 3. Generation of part of a link href
9809 !! wikitext
9810 [[Fo{{echo|o}}|bar]]
9811
9812 [[Foo{{echo|bar}}]]
9813
9814 [[Foo{{echo|bar}}baz]]
9815
9816 [[Foo{{echo|bar}}|bar]]
9817
9818 [[:Foo{{echo|bar}}]]
9819
9820 [[:Foo{{echo|bar}}|bar]]
9821 !! html
9822 <p><a href="/wiki/Foo" title="Foo">bar</a>
9823 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9824 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
9825 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9826 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9827 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9828 </p>
9829 !!end
9830
9831 !!test
9832 Templates: Links: 4. Multiple templates generating link href
9833 !! wikitext
9834 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
9835 !! html
9836 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9837 </p>
9838 !!end
9839
9840 !!test
9841 Templates: Links: 5. Generation of link text
9842 !! wikitext
9843 [[Foo|{{echo|bar}}]]
9844 !! html
9845 <p><a href="/wiki/Foo" title="Foo">bar</a>
9846 </p>
9847 !!end
9848
9849 !!test
9850 Templates: Links: 5. Nested templates (only outermost template should be marked)
9851 !! wikitext
9852 {{echo|[[{{echo|Foo}}|bar]]}}
9853 !! html
9854 <p><a href="/wiki/Foo" title="Foo">bar</a>
9855 </p>
9856 !!end
9857
9858 !!test
9859 Templates: HTML Tag: 1. Generation of HTML attr. key
9860 !! wikitext
9861 <div {{echo|style}}="color:red;">foo</div>
9862 !! html
9863 <div style="color:red;">foo</div>
9864
9865 !!end
9866
9867 !!test
9868 Templates: HTML Tag: 2. Generation of HTML attr. value
9869 !! wikitext
9870 <div style={{echo|'color:red;'}}>foo</div>
9871 !! html
9872 <div style="color:red;">foo</div>
9873
9874 !!end
9875
9876 !!test
9877 Templates: HTML Tag: 3. Generation of HTML attr key and value
9878 !! wikitext
9879 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
9880 !! html
9881 <div style="color:red;">foo</div>
9882
9883 !!end
9884
9885 !!test
9886 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
9887 !! wikitext
9888 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
9889 !! html
9890 <div title="This is a long title with just one piece templated">foo</div>
9891
9892 !!end
9893
9894 !!test
9895 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
9896 !! wikitext
9897 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
9898 !! html
9899 <div title="This is a long title with just one piece templated">foo</div>
9900
9901 !!end
9902
9903 !!test
9904 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
9905 !! wikitext
9906 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
9907 !! html
9908 <div title="This is a long title with just one piece templated">foo</div>
9909
9910 !!end
9911
9912 !!test
9913 Templates: HTML Tag: 7. Generation of partial attribute key string
9914 !! wikitext
9915 <div st{{echo|yle}}="color:red;">foo</div>
9916 !! html
9917 <div style="color:red;">foo</div>
9918
9919 !!end
9920
9921 !!test
9922 Templates: HTML Tables: 1. Generating start of a HTML table
9923 !! wikitext
9924 {{echo|<table><tr><td>foo</td>}}</tr></table>
9925 !! html
9926 <table><tr><td>foo</td></tr></table>
9927
9928 !!end
9929
9930 !!test
9931 Templates: HTML Tables: 2a. Generating middle of a HTML table
9932 !! wikitext
9933 <table><tr>{{echo|<td>foo</td>}}</tr></table>
9934 !! html
9935 <table><tr><td>foo</td></tr></table>
9936
9937 !!end
9938
9939 !!test
9940 Templates: HTML Tables: 2b. Generating middle of a HTML table
9941 !! wikitext
9942 <table>{{echo|<tr><td>foo</td></tr>}}</table>
9943 !! html
9944 <table><tr><td>foo</td></tr></table>
9945
9946 !!end
9947
9948 !!test
9949 Templates: HTML Tables: 3. Generating end of a HTML table
9950 !! wikitext
9951 <table><tr>{{echo|<td>foo</td></tr></table>}}
9952 !! html
9953 <table><tr><td>foo</td></tr></table>
9954
9955 !!end
9956
9957 !!test
9958 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
9959 !! wikitext
9960 {{echo|<table>}}<tr><td>foo</td></tr></table>
9961 !! html
9962 <table><tr><td>foo</td></tr></table>
9963
9964 !!end
9965
9966 !!test
9967 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
9968 !! wikitext
9969 <table>{{echo|<tr>}}<td>foo</td></tr></table>
9970 !! html
9971 <table><tr><td>foo</td></tr></table>
9972
9973 !!end
9974
9975 !!test
9976 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
9977 !! wikitext
9978 <table><tr>{{echo|<td>}}foo</td></tr></table>
9979 !! html
9980 <table><tr><td>foo</td></tr></table>
9981
9982 !!end
9983
9984 !!test
9985 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
9986 !! wikitext
9987 <table><tr><td>foo{{echo|</td>}}</tr></table>
9988 !! html
9989 <table><tr><td>foo</td></tr></table>
9990
9991 !!end
9992
9993 !!test
9994 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
9995 !! wikitext
9996 <table><tr><td>foo</td>{{echo|</tr>}}</table>
9997 !! html
9998 <table><tr><td>foo</td></tr></table>
9999
10000 !!end
10001
10002 !!test
10003 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
10004 !! wikitext
10005 <table><tr><td>foo</td></tr>{{echo|</table>}}
10006 !! html
10007 <table><tr><td>foo</td></tr></table>
10008
10009 !!end
10010
10011 !!test
10012 Templates: HTML Tables: 5. Proper fostering of categories from inside
10013 !!options
10014 parsoid=wt2html,wt2wt
10015 !! wikitext
10016 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
10017 <!--Two categories (Bug 50330)-->
10018 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
10019 !! html
10020 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
10021 <!--Two categories (Bug 50330)-->
10022 <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>
10023 !!end
10024
10025 !!test
10026 Templates: Wiki Tables: 1a. Fostering of entire template content
10027 !! wikitext
10028 {|
10029 {{echo|a}}
10030 |}
10031 !! html
10032 <table>
10033 a
10034 <tr><td></td></tr></table>
10035
10036 !! html+tidy
10037 <p>a</p>
10038 <table>
10039 <tr>
10040 <td></td>
10041 </tr>
10042 </table>
10043 !! end
10044
10045 !!test
10046 Templates: Wiki Tables: 1b. Fostering of entire template content
10047 !! wikitext
10048 {|
10049 {{echo|<div>}}
10050 foo
10051 {{echo|</div>}}
10052 |}
10053 !! html
10054 <table>
10055 <div>
10056 <p>foo
10057 </p>
10058 </div>
10059 <tr><td></td></tr></table>
10060
10061 !! html+tidy
10062 <div>
10063 <p>foo</p>
10064 </div>
10065 <table>
10066 <tr>
10067 <td></td>
10068 </tr>
10069 </table>
10070 !! end
10071
10072 !!test
10073 Templates: Wiki Tables: 2. Fostering of partial template content
10074 !! wikitext
10075 {|
10076 {{echo|a
10077 <div>b</div>}}
10078 |}
10079 !! html
10080 <table>
10081 a
10082 <div>b</div>
10083 <tr><td></td></tr></table>
10084
10085 !! html+tidy
10086 <p>a</p>
10087 <div>b</div>
10088 <table>
10089 <tr>
10090 <td></td>
10091 </tr>
10092 </table>
10093 !! end
10094
10095 !!test
10096 Templates: Wiki Tables: 3. td-content via multiple templates
10097 !! wikitext
10098 {|
10099 {{echo|{{pipe}}a}}{{echo|b}}
10100 |}
10101 !! html
10102 <table>
10103 <tr>
10104 <td>ab
10105 </td></tr></table>
10106
10107 !!end
10108
10109 !!test
10110 Templates: Wiki Tables: 4. Templated tags, no content
10111 !! wikitext
10112 {{tbl-start}}
10113 {{tbl-end}}
10114 !! html
10115 <table>
10116 <tr><td></td></tr></table>
10117
10118 !!end
10119
10120 !!test
10121 Templates: Wiki Tables: 5. Templated tags, regular td-tags
10122 !! wikitext
10123 {{tbl-start}}
10124 |foo
10125 {{tbl-end}}
10126 !! html
10127 <table>
10128 <tr>
10129 <td>foo
10130 </td></tr></table>
10131
10132 !!end
10133
10134 !!test
10135 Templates: Wiki Tables: 6. Templated tags, templated td-tags
10136 !! wikitext
10137 {{tbl-start}}
10138 {{!}}foo
10139 {{tbl-end}}
10140 !! html
10141 <table>
10142 <tr>
10143 <td>foo
10144 </td></tr></table>
10145
10146 !!end
10147
10148 !!test
10149 Templates: Lists: Multi-line list-items via templates
10150 !! wikitext
10151 *{{echo|a {{nonexistent|
10152 unused}}}}
10153 *{{echo|b {{nonexistent|
10154 unused}}}}
10155 !! html
10156 <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>
10157 <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>
10158
10159 !!end
10160
10161 !!test
10162 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
10163 !! wikitext
10164 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
10165 !! html
10166 <p><i>ab</i>c<i>d</i>e
10167 </p>
10168 !!end
10169
10170 !!test
10171 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
10172 (PHP parser generates misnested html)
10173 !! wikitext
10174 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
10175 !! html/parsoid
10176 <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>
10177 !!end
10178
10179 !!test
10180 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
10181 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
10182 !! options
10183 parsoid=wt2html,wt2wt
10184 !! wikitext
10185 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
10186 !! html
10187 <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>
10188 <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>
10189 <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>
10190 !!end
10191
10192 !!test
10193 Templates: Ugly nesting: 4. Divs opened/closed across templates
10194 !! wikitext
10195 a<div>b{{echo|c</div>d}}e
10196 !! html
10197 a<div>bc</div>de
10198
10199 !! html+tidy
10200 <p>a</p>
10201 <div>bc</div>
10202 <p>de</p>
10203 !! end
10204
10205 !!test
10206 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10207 (Parsoid-centric)
10208 !! options
10209 parsoid
10210 !! wikitext
10211 {|
10212 |{{echo|foo</table>}}
10213 |bar
10214 |}
10215 !! html
10216 <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|}"]}'>
10217
10218 <tbody>
10219 <tr>
10220 <td>foo</td></tr></tbody></table><span about="#mwt1">
10221 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10222 |}</span>
10223 !!end
10224
10225 !!test
10226 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10227 (Parsoid-centric)
10228 !! options
10229 parsoid
10230 !! wikitext
10231 <table>
10232 <tr>
10233 <td>
10234 <table>
10235 <tr>
10236 <td>1. {{echo|foo </table>}}</td>
10237 <td> bar </td>
10238 <td>2. {{echo|baz </table>}}</td>
10239 </tr>
10240 <tr>
10241 <td>abc</td>
10242 </tr>
10243 </table>
10244 </td>
10245 </tr>
10246 <tr>
10247 <td>xyz</td>
10248 </tr>
10249 </table>
10250 !! html
10251 <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>"]}'>
10252 <tbody><tr>
10253 <td>
10254 <table>
10255 <tbody><tr>
10256 <td>1. foo </td></tr></tbody></table></td>
10257 <td> bar </td>
10258 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10259 </span><span about="#mwt2">
10260 </span><span about="#mwt2">
10261 </span><span about="#mwt2">abc</span><span about="#mwt2">
10262 </span><span about="#mwt2">
10263 </span><span about="#mwt2">
10264 </span><span about="#mwt2">
10265 </span><span about="#mwt2">
10266 </span><span about="#mwt2">
10267 </span><span about="#mwt2">xyz</span><span about="#mwt2">
10268 </span><span about="#mwt2">
10269 </span>
10270 !!end
10271
10272 !! test
10273 Templates: Ugly templates: 3. newline-only template parameter
10274 !! wikitext
10275 foo {{echo|
10276 }}
10277 !! html
10278 <p>foo
10279 </p>
10280 !! end
10281
10282 # This looks like a bug: a single newline triggers p/br for some reason.
10283 !! test
10284 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10285 !! wikitext
10286 {{echo|
10287 }}
10288 !! html
10289 <p><br />
10290 </p>
10291 !! end
10292
10293 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10294 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10295 !! test
10296 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10297 !! wikitext
10298 {{echo|<table>}}
10299 {{echo|<div>foo}}
10300 {{echo|</table>}}
10301 !! html/parsoid
10302 <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
10303 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10304 </table>
10305 !! end
10306
10307 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10308 # that are "identical" and generate nesting cycles in the algorithm
10309 !! test
10310 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
10311 !! wikitext
10312 {{echo|<table><tr><td><table>}}
10313 {{echo|<div>}}
10314 {{echo|</div>}}
10315 !! html/parsoid
10316 <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"}'>
10317 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10318 </table></td></tr></tbody></table>
10319 !! end
10320
10321 !!test
10322 Parser Functions: 1. Simple example
10323 !! wikitext
10324 {{uc:foo}}
10325 !! html
10326 <p>FOO
10327 </p>
10328 !!end
10329
10330 !!test
10331 Parser Functions: 2. Nested use (only outermost should be marked up)
10332 !! wikitext
10333 {{uc:{{lc:FOO}}}}
10334 !! html
10335 <p>FOO
10336 </p>
10337 !!end
10338
10339 ###
10340 ### Pre-save transform tests
10341 ###
10342 !! test
10343 pre-save transform: subst:
10344 !! options
10345 PST
10346 !! wikitext
10347 {{subst:test}}
10348 !! html
10349 This is a test template
10350 !! end
10351
10352 !! test
10353 pre-save transform: normal template
10354 !! options
10355 PST
10356 !! wikitext
10357 {{test}}
10358 !! html
10359 {{test}}
10360 !! end
10361
10362 !! test
10363 pre-save transform: nonexistent template
10364 !! options
10365 PST
10366 !! wikitext
10367 {{thistemplatedoesnotexist}}
10368 !! html
10369 {{thistemplatedoesnotexist}}
10370 !! end
10371
10372
10373 !! test
10374 pre-save transform: subst magic variables
10375 !! options
10376 PST
10377 !! wikitext
10378 {{subst:SITENAME}}
10379 !! html
10380 MediaWiki
10381 !! end
10382
10383 # This is bug 89, which I fixed. -- wtm
10384 !! test
10385 pre-save transform: subst: templates with parameters
10386 !! options
10387 pst
10388 !! wikitext
10389 {{subst:paramtest|param="something else"}}
10390 !! html
10391 This is a test template with parameter "something else"
10392 !! end
10393
10394 !! article
10395 Template:nowikitest
10396 !! text
10397 <nowiki>'''not wiki'''</nowiki>
10398 !! endarticle
10399
10400 !! test
10401 pre-save transform: nowiki in subst (bug 1188)
10402 !! options
10403 pst
10404 !! wikitext
10405 {{subst:nowikitest}}
10406 !! html
10407 <nowiki>'''not wiki'''</nowiki>
10408 !! end
10409
10410
10411 !! article
10412 Template:commenttest
10413 !! text
10414 This template has <!-- a comment --> in it.
10415 !! endarticle
10416
10417 !! test
10418 pre-save transform: comment in subst (bug 1936)
10419 !! options
10420 pst
10421 !! wikitext
10422 {{subst:commenttest}}
10423 !! html
10424 This template has <!-- a comment --> in it.
10425 !! end
10426
10427 !! test
10428 pre-save transform: unclosed tag
10429 !! options
10430 pst noxml
10431 !! wikitext
10432 <nowiki>'''not wiki'''
10433 !! html
10434 <nowiki>'''not wiki'''
10435 !! end
10436
10437 !! test
10438 pre-save transform: mixed tag case
10439 !! options
10440 pst noxml
10441 !! wikitext
10442 <NOwiki>'''not wiki'''</noWIKI>
10443 !! html
10444 <NOwiki>'''not wiki'''</noWIKI>
10445 !! end
10446
10447 !! test
10448 pre-save transform: unclosed comment in <nowiki>
10449 !! options
10450 pst noxml
10451 !! wikitext
10452 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10453 !! html
10454 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10455 !!end
10456
10457 # Leading @ in this template definition works around a limitation
10458 # in parsoid's parserTests which otherwise strips the <span> from the
10459 # result (confusing it for a template wrapper)
10460 !! article
10461 Template:dangerous
10462 !!text
10463 @<span onmouseover="alert('crap')">Oh no</span>
10464 !!endarticle
10465
10466 !!test
10467 (confirming safety of fix for subst bug 1936)
10468 !! wikitext
10469 {{Template:dangerous}}
10470 !! html
10471 <p>@<span>Oh no</span>
10472 </p>
10473 !! end
10474
10475 !! test
10476 pre-save transform: comment containing gallery (bug 5024)
10477 !! options
10478 pst
10479 !! wikitext
10480 <!-- <gallery>data</gallery> -->
10481 !! html
10482 <!-- <gallery>data</gallery> -->
10483 !!end
10484
10485 !! test
10486 pre-save transform: comment containing extension
10487 !! options
10488 pst
10489 !! wikitext
10490 <!-- <tag>data</tag> -->
10491 !! html
10492 <!-- <tag>data</tag> -->
10493 !!end
10494
10495 !! test
10496 pre-save transform: comment containing nowiki
10497 !! options
10498 pst
10499 !! wikitext
10500 <!-- <nowiki>data</nowiki> -->
10501 !! html
10502 <!-- <nowiki>data</nowiki> -->
10503 !!end
10504
10505 !! test
10506 pre-save transform: <noinclude> in subst (bug 3298)
10507 !! options
10508 pst
10509 !! wikitext
10510 {{subst:Includes}}
10511 !! html
10512 Foobar
10513 !! end
10514
10515 !! test
10516 pre-save transform: <onlyinclude> in subst (bug 3298)
10517 !! options
10518 pst
10519 !! wikitext
10520 {{subst:Includes2}}
10521 !! html
10522 Foo
10523 !! end
10524
10525 !! article
10526 Template:SubstTest
10527 !!text
10528 {{<includeonly>subst:</includeonly>Includes}}
10529 !! endarticle
10530
10531 !! article
10532 Template:SafeSubstTest
10533 !! text
10534 {{<includeonly>safesubst:</includeonly>Includes}}
10535 !! endarticle
10536
10537 !! test
10538 bug 22297: safesubst: works during PST
10539 !! options
10540 pst
10541 !! wikitext
10542 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
10543 !! html
10544 FoobarFoobar
10545 !! end
10546
10547 !! test
10548 bug 22297: safesubst: works during normal parse
10549 !! wikitext
10550 {{SafeSubstTest}}
10551 !! html
10552 <p>Foobar
10553 </p>
10554 !! end
10555
10556 !! test
10557 subst: does not work during normal parse
10558 !! wikitext
10559 {{SubstTest}}
10560 !! html
10561 <p>{{subst:Includes}}
10562 </p>
10563 !! end
10564
10565 !! test
10566 pre-save transform: context links ("pipe trick")
10567 !! options
10568 pst
10569 !! wikitext
10570 [[Article (context)|]]
10571 [[Bar:Article|]]
10572 [[:Bar:Article|]]
10573 [[Bar:Article (context)|]]
10574 [[:Bar:Article (context)|]]
10575 [[|Article]]
10576 [[|Article (context)]]
10577 [[Bar:X (Y) Z|]]
10578 [[:Bar:X (Y) Z|]]
10579 !! html
10580 [[Article (context)|Article]]
10581 [[Bar:Article|Article]]
10582 [[:Bar:Article|Article]]
10583 [[Bar:Article (context)|Article]]
10584 [[:Bar:Article (context)|Article]]
10585 [[Article]]
10586 [[Article (context)]]
10587 [[Bar:X (Y) Z|X (Y) Z]]
10588 [[:Bar:X (Y) Z|X (Y) Z]]
10589 !! end
10590
10591 !! test
10592 pre-save transform: context links ("pipe trick") with interwiki prefix
10593 !! options
10594 pst
10595 !! wikitext
10596 [[interwiki:Article|]]
10597 [[:interwiki:Article|]]
10598 [[interwiki:Bar:Article|]]
10599 [[:interwiki:Bar:Article|]]
10600 !! html
10601 [[interwiki:Article|Article]]
10602 [[:interwiki:Article|Article]]
10603 [[interwiki:Bar:Article|Bar:Article]]
10604 [[:interwiki:Bar:Article|Bar:Article]]
10605 !! end
10606
10607 !! test
10608 pre-save transform: context links ("pipe trick") with parens in title
10609 !! options
10610 pst title=[[Somearticle (context)]]
10611 !! wikitext
10612 [[|Article]]
10613 !! html
10614 [[Article (context)|Article]]
10615 !! end
10616
10617 !! test
10618 pre-save transform: context links ("pipe trick") with comma in title
10619 !! options
10620 pst title=[[Someplace, Somewhere]]
10621 !! wikitext
10622 [[|Otherplace]]
10623 [[Otherplace, Elsewhere|]]
10624 [[Otherplace, Elsewhere, Anywhere|]]
10625 !! html
10626 [[Otherplace, Somewhere|Otherplace]]
10627 [[Otherplace, Elsewhere|Otherplace]]
10628 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
10629 !! end
10630
10631 !! test
10632 pre-save transform: context links ("pipe trick") with parens and comma
10633 !! options
10634 pst title=[[Someplace (IGNORED), Somewhere]]
10635 !! wikitext
10636 [[|Otherplace]]
10637 [[Otherplace (place), Elsewhere|]]
10638 !! html
10639 [[Otherplace, Somewhere|Otherplace]]
10640 [[Otherplace (place), Elsewhere|Otherplace]]
10641 !! end
10642
10643 !! test
10644 pre-save transform: context links ("pipe trick") with comma and parens
10645 !! options
10646 pst title=[[Who, me? (context)]]
10647 !! wikitext
10648 [[|Yes, you.]]
10649 [[Me, Myself, and I (1937 song)|]]
10650 !! html
10651 [[Yes, you. (context)|Yes, you.]]
10652 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
10653 !! end
10654
10655 !! test
10656 pre-save transform: context links ("pipe trick") with namespace
10657 !! options
10658 pst title=[[Ns:Somearticle]]
10659 !! wikitext
10660 [[|Article]]
10661 !! html
10662 [[Ns:Article|Article]]
10663 !! end
10664
10665 !! test
10666 pre-save transform: context links ("pipe trick") with namespace and parens
10667 !! options
10668 pst title=[[Ns:Somearticle (context)]]
10669 !! wikitext
10670 [[|Article]]
10671 !! html
10672 [[Ns:Article (context)|Article]]
10673 !! end
10674
10675 !! test
10676 pre-save transform: context links ("pipe trick") with namespace and comma
10677 !! options
10678 pst title=[[Ns:Somearticle, Context, Whatever]]
10679 !! wikitext
10680 [[|Article]]
10681 !! html
10682 [[Ns:Article, Context, Whatever|Article]]
10683 !! end
10684
10685 !! test
10686 pre-save transform: context links ("pipe trick") with namespace, comma and parens
10687 !! options
10688 pst title=[[Ns:Somearticle, Context (context)]]
10689 !! wikitext
10690 [[|Article]]
10691 !! html
10692 [[Ns:Article (context)|Article]]
10693 !! end
10694
10695 !! test
10696 pre-save transform: context links ("pipe trick") with namespace, parens and comma
10697 !! options
10698 pst title=[[Ns:Somearticle (IGNORED), Context]]
10699 !! wikitext
10700 [[|Article]]
10701 !! html
10702 [[Ns:Article, Context|Article]]
10703 !! end
10704
10705 !! test
10706 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
10707 !! options
10708 pst
10709 !! wikitext
10710 [[Article(context)|]]
10711 [[Bar:Article(context)|]]
10712 [[:Bar:Article(context)|]]
10713 [[|Article(context)]]
10714 [[Bar:X(Y)Z|]]
10715 [[:Bar:X(Y)Z|]]
10716 !! html
10717 [[Article(context)|Article]]
10718 [[Bar:Article(context)|Article]]
10719 [[:Bar:Article(context)|Article]]
10720 [[Article(context)]]
10721 [[Bar:X(Y)Z|X(Y)Z]]
10722 [[:Bar:X(Y)Z|X(Y)Z]]
10723 !! end
10724
10725 !! test
10726 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
10727 !! options
10728 pst
10729 !! wikitext
10730 [[Article (context)|]]
10731 [[Bar:Article (context)|]]
10732 [[:Bar:Article (context)|]]
10733 [[|Article (context)]]
10734 [[Bar:X (Y) Z|]]
10735 [[:Bar:X (Y) Z|]]
10736 !! html
10737 [[Article (context)|Article]]
10738 [[Bar:Article (context)|Article]]
10739 [[:Bar:Article (context)|Article]]
10740 [[Article (context)]]
10741 [[Bar:X (Y) Z|X (Y) Z]]
10742 [[:Bar:X (Y) Z|X (Y) Z]]
10743 !! end
10744
10745 !! test
10746 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
10747 !! options
10748 pst
10749 !! wikitext
10750 [[Article(context)|]]
10751 [[Bar:Article(context)|]]
10752 [[:Bar:Article(context)|]]
10753 [[|Article(context)]]
10754 [[Bar:X(Y)Z|]]
10755 [[:Bar:X(Y)Z|]]
10756 !! html
10757 [[Article(context)|Article]]
10758 [[Bar:Article(context)|Article]]
10759 [[:Bar:Article(context)|Article]]
10760 [[Article(context)]]
10761 [[Bar:X(Y)Z|X(Y)Z]]
10762 [[:Bar:X(Y)Z|X(Y)Z]]
10763 !! end
10764
10765 !! test
10766 pre-save transform: context links ("pipe trick") with commas (bug 21660)
10767 !! options
10768 pst
10769 !! wikitext
10770 [[Article (context), context|]]
10771 [[Article (context),context|]]
10772 [[Bar:Article (context), context|]]
10773 [[Bar:Article (context),context|]]
10774 [[:Bar:Article (context), context|]]
10775 [[:Bar:Article (context),context|]]
10776 !! html
10777 [[Article (context), context|Article]]
10778 [[Article (context),context|Article]]
10779 [[Bar:Article (context), context|Article]]
10780 [[Bar:Article (context),context|Article]]
10781 [[:Bar:Article (context), context|Article]]
10782 [[:Bar:Article (context),context|Article]]
10783 !! end
10784
10785 !! test
10786 pre-save transform: trim trailing empty lines
10787 !! options
10788 pst
10789 !! wikitext
10790 Empty lines are trimmed
10791
10792
10793
10794
10795 !! html
10796 Empty lines are trimmed
10797 !! end
10798
10799 !! test
10800 pre-save transform: Signature expansion
10801 !! options
10802 pst
10803 !! wikitext
10804 * ~~~
10805 * <noinclude>~~~</noinclude>
10806 * <includeonly>~~~</includeonly>
10807 * <onlyinclude>~~~</onlyinclude>
10808 !! html
10809 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
10810 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
10811 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
10812 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
10813 !! end
10814
10815
10816 !! test
10817 pre-save transform: Signature expansion in nowiki tags (bug 93)
10818 !! options
10819 pst disabled
10820 !! wikitext
10821 Shall not expand:
10822
10823 <nowiki>~~~~</nowiki>
10824
10825 <includeonly><nowiki>~~~~</nowiki></includeonly>
10826
10827 <noinclude><nowiki>~~~~</nowiki></noinclude>
10828
10829 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10830
10831 {{subst:Foo}} shall be converted to FOO
10832
10833 As well as inside noinclude/onlyinclude
10834 <noinclude>{{subst:Foo}}</noinclude>
10835 <onlyinclude>{{subst:Foo}}</onlyinclude>
10836
10837 But not inside includeonly
10838 <includeonly>{{subst:Foo}}</includeonly>
10839 !! html
10840 Shall not expand:
10841
10842 <nowiki>~~~~</nowiki>
10843
10844 <includeonly><nowiki>~~~~</nowiki></includeonly>
10845
10846 <noinclude><nowiki>~~~~</nowiki></noinclude>
10847
10848 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10849
10850 FOO shall be converted to FOO
10851
10852 As well as inside noinclude/onlyinclude
10853 <noinclude>FOO</noinclude>
10854 <onlyinclude>FOO</onlyinclude>
10855
10856 But not inside includeonly
10857 <includeonly>{{subst:Foo}}</includeonly>
10858 !! end
10859
10860 !! test
10861 Parsoid: Recognize nowiki with trailing space in tags
10862 !! options
10863 parsoid=wt2html
10864 !! wikitext
10865 <nowiki ><div>[[foo]]</nowiki >
10866
10867 a<nowiki / >b
10868
10869 c<nowiki />d
10870
10871 e<nowiki/ >f
10872 !! html
10873 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10874 <p>ab</p>
10875 <p>cd</p>
10876 <p>ef</p>
10877 !! end
10878
10879 !! test
10880 Parsoid: Recognize nowiki with odd capitalization
10881 !! options
10882 parsoid=wt2html
10883 !! wikitext
10884 <noWikI ><div>[[foo]]</Nowiki >
10885 !! html
10886 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10887 !! end
10888
10889
10890 !! test
10891 Parsoid: Escape nowiki with trailing space in tags
10892 !! options
10893 parsoid=html2wt
10894 !! wikitext
10895 &lt;nowiki &gt; foo &lt;/nowiki &gt;
10896
10897 a&lt;nowiki /&gt;b
10898
10899 c&lt;nowiki/ &gt;d
10900 !! html
10901 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
10902 <p>a&lt;nowiki /&gt;b</p>
10903 <p>c&lt;nowiki/ &gt;d</p>
10904 !! end
10905
10906 !! test
10907 Parsoid: Escape weird noWikI capitalizations
10908 !! options
10909 parsoid=html2wt
10910 !! wikitext
10911 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
10912 !! html
10913 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
10914 !! end
10915
10916 ###
10917 ### Message transform tests
10918 ###
10919 !! test
10920 message transform: magic variables
10921 !! options
10922 msg
10923 !! wikitext
10924 {{SITENAME}}
10925 !! html
10926 MediaWiki
10927 !! end
10928
10929 !! test
10930 message transform: should not transform wiki markup
10931 !! options
10932 msg
10933 !! wikitext
10934 ''test''
10935 !! html
10936 ''test''
10937 !! end
10938
10939 !! test
10940 message transform: <noinclude> in transcluded template (bug 4926)
10941 !! options
10942 msg
10943 !! wikitext
10944 {{Includes}}
10945 !! html
10946 Foobar
10947 !! end
10948
10949 !! test
10950 message transform: <onlyinclude> in transcluded template (bug 4926)
10951 !! options
10952 msg
10953 !! wikitext
10954 {{Includes2}}
10955 !! html
10956 Foo
10957 !! end
10958
10959 !! test
10960 {{#special:}} page name, known
10961 !! options
10962 msg
10963 !! wikitext
10964 {{#special:Recentchanges}}
10965 !! html
10966 Special:RecentChanges
10967 !! end
10968
10969 !! test
10970 {{#special:}} page name with subpage, known
10971 !! options
10972 msg
10973 !! wikitext
10974 {{#special:Recentchanges/param}}
10975 !! html
10976 Special:RecentChanges/param
10977 !! end
10978
10979 !! test
10980 {{#special:}} page name, unknown
10981 !! options
10982 msg
10983 !! wikitext
10984 {{#special:foobar nonexistent}}
10985 !! html
10986 Special:Foobar nonexistent
10987 !! end
10988
10989 !! test
10990 {{#speciale:}} page name, known
10991 !! options
10992 msg
10993 !! wikitext
10994 {{#speciale:Recentchanges}}
10995 !! html
10996 Special:RecentChanges
10997 !! end
10998
10999 !! test
11000 {{#speciale:}} page name with subpage, known
11001 !! options
11002 msg
11003 !! wikitext
11004 {{#speciale:Recentchanges/param}}
11005 !! html
11006 Special:RecentChanges/param
11007 !! end
11008
11009 !! test
11010 {{#speciale:}} page name, unknown
11011 !! options
11012 msg
11013 !! wikitext
11014 {{#speciale:foobar nonexistent}}
11015 !! html
11016 Special:Foobar_nonexistent
11017 !! end
11018
11019 ###
11020 ### Images
11021 ###
11022 ### For Parsoid-specific tests, see
11023 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11024
11025 !! test
11026 Simple image
11027 !! options
11028 parsoid=wt2html,wt2wt,html2html
11029 !! wikitext
11030 [[Image:foobar.jpg]]
11031 !! html/php
11032 <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>
11033 </p>
11034 !! html/parsoid
11035 <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>
11036 !! end
11037
11038 !! test
11039 Simple image (using File: namespace, now canonical)
11040 !! wikitext
11041 [[File:Foobar.jpg]]
11042 !! html/php
11043 <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>
11044 </p>
11045 !! html/parsoid
11046 <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>
11047 !! end
11048
11049 !! test
11050 Right-aligned image
11051 !! wikitext
11052 [[File:Foobar.jpg|right]]
11053 !! html/php
11054 <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>
11055
11056 !! html/parsoid
11057 <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>
11058 !! end
11059
11060 !! test
11061 Image with caption
11062 !! wikitext
11063 [[File:Foobar.jpg|right|Caption text]]
11064 !! html/php
11065 <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>
11066
11067 !! html/parsoid
11068 <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>
11069 !! end
11070
11071 !! test
11072 Image with caption, bug 53312 #1
11073 !! wikitext
11074 [[File:Foobar.jpg|right|Caption page stuff]]
11075 !! html/php
11076 <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>
11077
11078 !! html/parsoid
11079 <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>
11080 !! end
11081
11082 !! test
11083 Image with caption, bug 53312 #2
11084 !! wikitext
11085 [[File:Foobar.jpg|right|Caption page=]]
11086 !! html/php
11087 <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>
11088
11089 !! html/parsoid
11090 <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>
11091 !! end
11092
11093 !! test
11094 Image with caption, bug 53312 #3
11095 !! wikitext
11096 [[File:Foobar.jpg|right|Caption page=stuff]]
11097 !! html/php
11098 <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>
11099
11100 !! html/parsoid
11101 <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>
11102 !! end
11103
11104 !! test
11105 Allow empty links in image captions (Bug 60753)
11106 !! options
11107 thumbsize=220
11108 !! wikitext
11109 [[File:Foobar.jpg|thumb|Caption [[Link1]]
11110 [[]]
11111 [[Link2]]
11112 ]]
11113 !! html/php
11114 <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>
11115
11116 !! html/parsoid
11117 <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>
11118 [[]]
11119 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
11120 </figcaption></figure>
11121 !! end
11122
11123 !! test
11124 Link with empty target
11125 !! wikitext
11126 [[]]
11127 !! html
11128 <p>[[]]
11129 </p>
11130 !! end
11131
11132 !! test
11133 Image with empty attribute
11134 !! options
11135 parsoid=wt2html,wt2wt,html2html
11136 !! wikitext
11137 [[File:Foobar.jpg|right||Caption text]]
11138 !! html/php
11139 <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>
11140
11141 !! html/parsoid
11142 <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>
11143 !! end
11144
11145 !! test
11146 1. Block image with individual attributes from templates
11147 !! wikitext
11148 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
11149 !! html/php
11150 <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>
11151
11152 !! html/parsoid
11153 <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>
11154 !! end
11155
11156 !! test
11157 2. Block Image with individual attributes from templates
11158 !! wikitext
11159 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
11160 !! html/php
11161 <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>
11162
11163 !! html/parsoid
11164 <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>
11165 !! end
11166
11167 !! test
11168 3. Inline image with individual attributes from templates
11169 !! wikitext
11170 [[File:Foobar.jpg|{{echo|50px}}]]
11171 !! html/php
11172 <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>
11173 </p>
11174 !! html/parsoid
11175 <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>
11176 !! end
11177
11178 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
11179 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
11180 !! test
11181 Image with multiple attributes from the same template
11182 !! wikitext
11183 [[File:Foobar.jpg|{{image_attribs}}]]
11184 !! html/php
11185 <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>
11186
11187 !! html/parsoid
11188 <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>
11189 !! end
11190
11191 !! test
11192 Image with link tails
11193 !! options
11194 thumbsize=220
11195 !! wikitext
11196 123[[File:Foobar.jpg]]456
11197 123[[File:Foobar.jpg|right]]456
11198 123[[File:Foobar.jpg|thumb]]456
11199 !! html/php
11200 <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
11201 </p>
11202 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
11203 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
11204
11205 !! html/php+tidy
11206 <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>
11207 <p>123</p>
11208 <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>
11209 <p>456 123</p>
11210 <div class="thumb tright">
11211 <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>
11212 <div class="thumbcaption">
11213 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11214 </div>
11215 </div>
11216 </div>
11217 <p>456</p>
11218 !! html/parsoid
11219 <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>
11220 <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>
11221 <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>
11222 !! end
11223
11224 !! test
11225 Image with multiple captions -- only last one is accepted
11226 !! wikitext
11227 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11228 !! html/php
11229 <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>
11230
11231 !! html/parsoid
11232 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption3 - accepted</figcaption></figure>
11233 !! end
11234
11235 !! test
11236 Image with multiple widths -- use last
11237 !! wikitext
11238 [[File:Foobar.jpg|200px|300px|caption]]
11239 !! html/php
11240 <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>
11241 </p>
11242 !! html/parsoid
11243 <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>
11244 !! end
11245
11246 !! test
11247 Image with multiple alignments -- use first (bug 48664)
11248 !! options
11249 thumbsize=220
11250 !! wikitext
11251 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11252
11253 [[File:Foobar.jpg|middle|text-top|caption]]
11254 !! html/php
11255 <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>
11256 <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>
11257 </p>
11258 !! html/parsoid
11259 <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>
11260 <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>
11261 !! end
11262
11263 !! test
11264 Image with width attribute at different positions
11265 !! wikitext
11266 [[File:Foobar.jpg|200px|right|Caption]]
11267 [[File:Foobar.jpg|right|200px|Caption]]
11268 [[File:Foobar.jpg|right|Caption|200px]]
11269 !! html/php
11270 <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>
11271 <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>
11272 <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>
11273
11274 !! html/parsoid
11275 <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>
11276 <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>
11277 <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>
11278 !! end
11279
11280 # a sad bit of backward-compatibility
11281 !! test
11282 Image with size specified with pxpx (bug 13500, 51628)
11283 !! options
11284 parsoid=wt2html,wt2wt,html2html
11285 !! wikitext
11286 [[File:Foobar.jpg|20pxpx]]
11287 [[File:Foobar.jpg|200x20pxpx]]
11288 !! html/php
11289 <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>
11290 <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>
11291 </p>
11292 !! html/parsoid
11293 <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>
11294 !! end
11295
11296 !! test
11297 Image with link parameter, wiki target
11298 !! wikitext
11299 [[File:Foobar.jpg|link=Main Page]]
11300 !! html/php
11301 <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>
11302 </p>
11303 !! html/parsoid
11304 <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>
11305 !! end
11306
11307 # parsoid bug 49293 (part 1)
11308 !! test
11309 Image with link parameter, URL target
11310 !! wikitext
11311 [[File:Foobar.jpg|link=http://example.com/]]
11312 !! html/php
11313 <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>
11314 </p>
11315 !! html/parsoid
11316 <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>
11317 !! end
11318
11319 # parsoid bug 49293 (part 2)
11320 !! test
11321 Image with link parameter, protocol-less URL target
11322 !! wikitext
11323 [[File:Foobar.jpg|link=//example.com/]]
11324 !! html/php
11325 <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>
11326 </p>
11327 !! html/parsoid
11328 <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>
11329 !! end
11330
11331 !! test
11332 Image with link parameter, wgExternalLinkTarget
11333 !! wikitext
11334 [[Image:foobar.jpg|link=http://example.com/]]
11335 !! config
11336 wgExternalLinkTarget='foobar'
11337 !! html
11338 <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>
11339 </p>
11340 !! end
11341
11342 !! test
11343 Image with link parameter, wgNoFollowLinks set to false
11344 !! wikitext
11345 [[Image:foobar.jpg|link=http://example.com/]]
11346 !! config
11347 wgNoFollowLinks=false
11348 !! html
11349 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11350 </p>
11351 !! end
11352
11353 !! test
11354 Image with link parameter, wgNoFollowDomainExceptions
11355 !! wikitext
11356 [[Image:foobar.jpg|link=http://example.com/]]
11357 !! config
11358 wgNoFollowDomainExceptions='example.com'
11359 !! html
11360 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11361 </p>
11362 !! end
11363
11364 !! test
11365 Image with link parameter, wgExternalLinkTarget, unnamed parameter
11366 !! wikitext
11367 [[Image:foobar.jpg|link=http://example.com/|Title]]
11368 !! config
11369 wgExternalLinkTarget='foobar'
11370 !! html
11371 <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>
11372 </p>
11373 !! end
11374
11375 !! test
11376 Image with empty link parameter
11377 !! wikitext
11378 [[File:Foobar.jpg|link=]]
11379 !! html/php
11380 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
11381 </p>
11382 !! html/parsoid
11383 <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>
11384 !! end
11385
11386 !! test
11387 Image with link parameter (wiki target) and unnamed parameter
11388 !! wikitext
11389 [[File:Foobar.jpg|link=Main_Page|Title]]
11390 !! html/php
11391 <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>
11392 </p>
11393 !! html/parsoid
11394 <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>
11395 !! end
11396
11397 !! test
11398 Image with link parameter (URL target) and unnamed parameter
11399 !! wikitext
11400 [[File:Foobar.jpg|link=http://example.com/|Title]]
11401 !! html/php
11402 <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>
11403 </p>
11404 !! html/parsoid
11405 <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>
11406 !! end
11407
11408 !! test
11409 Thumbnail image with link parameter
11410 !! options
11411 thumbsize=220
11412 parsoid=wt2html,wt2wt,html2html
11413 !! wikitext
11414 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
11415 !! html/php
11416 <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>
11417
11418 !! html/parsoid
11419 <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>
11420 !! end
11421
11422 !! test
11423 Manually-specified thumbnail image
11424 !! options
11425 thumbsize=220
11426 !! wikitext
11427 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
11428 !! html/php
11429 <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>
11430
11431 !! html/parsoid
11432 <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>
11433 !! end
11434
11435 !! test
11436 Manually-specified thumbnail image with explicit link to wiki page
11437 !! options
11438 thumbsize=220
11439 parsoid=wt2html,wt2wt,html2html
11440 !! wikitext
11441 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
11442 !! html/php
11443 <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>
11444
11445 !! html/parsoid
11446 <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>
11447 !! end
11448
11449 !! test
11450 Manually-specified thumbnail image with explicit link to url
11451 !! options
11452 thumbsize=220
11453 parsoid=wt2html,wt2wt,html2html
11454 !! wikitext
11455 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
11456 !! html/php
11457 <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>
11458
11459 !! html/parsoid
11460 <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>
11461 !! end
11462
11463 !! test
11464 Manually-specified thumbnail image with explicit no link
11465 !! options
11466 thumbsize=220
11467 parsoid=wt2html,wt2wt,html2html
11468 !! wikitext
11469 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
11470 !! html/php
11471 <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>
11472
11473 !! html/parsoid
11474 <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>
11475 !! end
11476
11477 !! test
11478 Manually-specified thumbnail image with explicit link and alt text
11479 !! options
11480 thumbsize=220
11481 parsoid=wt2html,wt2wt,html2html
11482 !! wikitext
11483 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
11484 !! html/php
11485 <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>
11486
11487 !! html/parsoid
11488 <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>
11489 !! end
11490
11491 !! test
11492 Image with frame and link
11493 !! options
11494 parsoid=wt2html,wt2wt,html2html
11495 !! wikitext
11496 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
11497 !! html/php
11498 <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>
11499
11500 !! html/parsoid
11501 <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>
11502 !! end
11503
11504 !! test
11505 Image with frame and link and explicit alt
11506 !! options
11507 parsoid=wt2html,wt2wt,html2html
11508 !! wikitext
11509 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
11510 !! html/php
11511 <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>
11512
11513 !! html/parsoid
11514 <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>
11515 !! end
11516
11517 !! test
11518 Image with wiki markup in implicit alt
11519 !! options
11520 parsoid=wt2html,wt2wt,html2html
11521 !! wikitext
11522 [[Image:Foobar.jpg|testing '''bold''' in alt]]
11523
11524 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
11525 !! html/php
11526 <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>
11527 </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>
11528 </p>
11529 !! html/parsoid
11530 <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>
11531 <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>
11532 !! end
11533
11534 ###################
11535 # Conflicting image format options.
11536 # First option specified should 'win'.
11537 # All three cases in each test should be identical.
11538
11539 !! test
11540 Image with 'frameless' first.
11541 !! options
11542 parsoid=wt2html,wt2wt,html2html
11543 !! wikitext
11544 [[File:Foobar.jpg|frameless|caption]]
11545
11546 [[File:Foobar.jpg|frameless|frame|caption]]
11547
11548 [[File:Foobar.jpg|frameless|thumb|caption]]
11549 !! html/php
11550 <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>
11551 </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>
11552 </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>
11553 </p>
11554 !! html/parsoid
11555 <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>
11556 <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>
11557 <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>
11558 !! end
11559
11560 !! test
11561 Image with 'frame' first.
11562 !! options
11563 parsoid=wt2html,wt2wt,html2html
11564 !! wikitext
11565 [[File:Foobar.jpg|frame|caption]]
11566 [[File:Foobar.jpg|frame|frameless|caption]]
11567 [[File:Foobar.jpg|frame|thumb|caption]]
11568 !! html/php
11569 <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>
11570 <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>
11571 <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>
11572
11573 !! html/parsoid
11574 <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>
11575 <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>
11576 <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>
11577 !! end
11578
11579 !! test
11580 Image with 'thumb' first.
11581 !! options
11582 parsoid=wt2html,wt2wt,html2html
11583 !! wikitext
11584 [[File:Foobar.jpg|thumb|caption]]
11585 [[File:Foobar.jpg|thumb|frameless|caption]]
11586 [[File:Foobar.jpg|thumb|frame|caption]]
11587 !! html/php
11588 <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>
11589 <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>
11590 <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>
11591
11592 !! html/parsoid
11593 <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>
11594 <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>
11595 <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>
11596 !! end
11597
11598 ###################
11599 # Image sizing.
11600 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
11601 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
11602 # Foobar has actual size of 1941x220
11603 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
11604 # a scalable format.
11605 # 2. Framed images always ignore size options; always render at default size.
11606 # 3. "Unspecified format" and border are the only types which can be
11607 # enlarged.
11608
11609 !! test
11610 Image: "unspecified format" and border enlarge
11611 !! options
11612 parsoid=wt2html,wt2wt,html2html
11613 !! wikitext
11614 [[File:Foobar.jpg|2000px]]
11615
11616 [[File:Foobar.jpg|border|2000px]]
11617 !! html/php
11618 <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>
11619 </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>
11620 </p>
11621 !! html/parsoid
11622 <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>
11623 <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>
11624 !! end
11625
11626 !! test
11627 Image: "unspecified format" and border reduce
11628 !! options
11629 parsoid=wt2html,wt2wt,html2html
11630 !! wikitext
11631 [[File:Foobar.jpg|1000px]]
11632
11633 [[File:Foobar.jpg|border|1000px]]
11634 !! html/php
11635 <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>
11636 </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>
11637 </p>
11638 !! html/parsoid
11639 <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>
11640 <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>
11641 !! end
11642
11643 !! test
11644 Image: thumbs reduce
11645 !! options
11646 parsoid=wt2html,wt2wt,html2html
11647 !! wikitext
11648 [[File:Foobar.jpg|thumb|50px]]
11649 !! html/php
11650 <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>
11651
11652 !! html/parsoid
11653 <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>
11654 !! end
11655
11656 !! test
11657 Image: bitmap thumbs can't be enlarged past original size, but vector can.
11658 !! options
11659 parsoid=wt2html,wt2wt,html2html
11660 !! wikitext
11661 [[File:Foobar.jpg|thumb|2000px]]
11662
11663 [[File:Foobar.svg|thumb|2000px]]
11664 !! html/php
11665 <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>
11666 <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>
11667
11668 !! html/parsoid
11669 <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>
11670 <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>
11671 !! end
11672
11673 !! test
11674 Image: frameless can reduce in size
11675 !! options
11676 parsoid=wt2html,wt2wt,html2html
11677 !! wikitext
11678 [[File:Foobar.jpg|frameless|50px]]
11679 !! html/php
11680 <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>
11681 </p>
11682 !! html/parsoid
11683 <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>
11684 !! end
11685
11686 !! test
11687 Image: bitmap frameless can't be enlarged past original size, but vector can
11688 !! options
11689 parsoid=wt2html,wt2wt,html2html
11690 !! wikitext
11691 [[File:Foobar.jpg|frameless|2000px]]
11692
11693 [[File:Foobar.svg|frameless|2000px]]
11694 !! html/php
11695 <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>
11696 </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>
11697 </p>
11698 !! html/parsoid
11699 <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>
11700 <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>
11701 !! end
11702
11703 !! test
11704 Image: framed images are always unscaled.
11705 !! options
11706 parsoid=wt2html,wt2wt,html2html
11707 !! wikitext
11708 [[File:Foobar.jpg|frame]]
11709
11710 [[File:Foobar.jpg|frame|50px]]
11711
11712 [[File:Foobar.jpg|frame|50x50px]]
11713
11714 [[File:Foobar.jpg|frame|2000px]]
11715 !! html/php
11716 <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>
11717 <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>
11718 <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>
11719 <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>
11720
11721 !! html/parsoid
11722 <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>
11723 <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>
11724 <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>
11725 <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>
11726 !! end
11727
11728 ###################
11729
11730 !! test
11731 Link to image page- image page normally doesn't exists, hence edit link
11732 Add test with existing image page
11733 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
11734 !! wikitext
11735 [[:Image:test]]
11736 !! html
11737 <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>
11738 </p>
11739 !! end
11740
11741 !! test
11742 bug 18784 Link to non-existent image page with caption should use caption as link text
11743 !! wikitext
11744 [[:Image:test|caption]]
11745 !! html
11746 <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>
11747 </p>
11748 !! end
11749
11750 !! test
11751 Frameless image caption with a free URL
11752 !! wikitext
11753 [[File:Foobar.jpg|http://example.com]]
11754 !! html/php
11755 <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>
11756 </p>
11757 !! html/parsoid
11758 <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>
11759 !! end
11760
11761 !! test
11762 Thumbnail image caption with a free URL
11763 !! options
11764 thumbsize=220
11765 !! wikitext
11766 [[File:Foobar.jpg|thumb|http://example.com]]
11767 !! html/php
11768 <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>
11769
11770 !! html/parsoid
11771 <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>
11772 !! end
11773
11774 !! test
11775 Thumbnail image caption with a free URL and explicit alt
11776 !! options
11777 thumbsize=220
11778 parsoid=wt2html,wt2wt,html2html
11779 !! wikitext
11780 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
11781 !! html/php
11782 <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>
11783
11784 !! html/parsoid
11785 <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>
11786 !! end
11787
11788 !! test
11789 SVG thumbnails with no language set
11790 !! options
11791 !! wikitext
11792 [[File:Foobar.svg|thumb|caption]]
11793 !! html/php
11794 <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>
11795
11796 !! html/parsoid
11797 <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>
11798 !! end
11799
11800 !! test
11801 SVG thumbnails with language de
11802 !! options
11803 parsoid=wt2html,wt2wt,html2html
11804 !! wikitext
11805 [[File:Foobar.svg|thumb|caption|lang=de]]
11806 !! html/php
11807 <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>
11808
11809 !! html/parsoid
11810 <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>
11811 !! end
11812
11813 !! test
11814 SVG thumbnails with invalid language code
11815 !! options
11816 parsoid=wt2html,wt2wt,html2html
11817 !! wikitext
11818 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
11819 !! html/php
11820 <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>
11821
11822 !! html/parsoid
11823 <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>
11824 !! end
11825
11826 !! test
11827 BUG 1887: A ISBN with a thumbnail
11828 !! wikitext
11829 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
11830 !! html/php
11831 <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>
11832
11833 !! html/parsoid
11834 <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>
11835 !! end
11836
11837 !! test
11838 BUG 1887: A RFC with a thumbnail
11839 !! wikitext
11840 [[File:Foobar.jpg|thumb|This is RFC 12354]]
11841 !! html/php
11842 <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>
11843
11844 !! html/parsoid
11845 <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>
11846 !! end
11847
11848 !! test
11849 BUG 1887: A mailto link with a thumbnail
11850 !! wikitext
11851 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
11852 !! html/php
11853 <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>
11854
11855 !! html/parsoid
11856 <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>
11857 !! end
11858
11859 # Pending resolution to bug 368
11860 !! test
11861 BUG 648: Frameless image caption with a link
11862 !! wikitext
11863 [[File:Foobar.jpg|text with a [[link]] in it]]
11864 !! html/php
11865 <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>
11866 </p>
11867 !! html/parsoid
11868 <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>
11869 !! end
11870
11871 !! test
11872 BUG 648: Frameless image caption with a link (suffix)
11873 !! wikitext
11874 [[File:Foobar.jpg|text with a [[link]]foo in it]]
11875 !! html/php
11876 <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>
11877 </p>
11878 !! html/parsoid
11879 <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>
11880 !! end
11881
11882 !! test
11883 BUG 648: Frameless image caption with an interwiki link
11884 !! wikitext
11885 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
11886 !! html/php
11887 <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>
11888 </p>
11889 !! html/parsoid
11890 <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>
11891 !! end
11892
11893 !! test
11894 BUG 648: Frameless image caption with a piped interwiki link
11895 !! wikitext
11896 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
11897 !! html/php
11898 <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>
11899 </p>
11900 !! html/parsoid
11901 <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>
11902 !! end
11903
11904 !! test
11905 Escape HTML special chars in image alt text
11906 !! wikitext
11907 [[File:Foobar.jpg|& < > "]]
11908 !! html/php
11909 <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>
11910 </p>
11911 !! html/parsoid
11912 <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>
11913 !! end
11914
11915 !! test
11916 BUG 499: Alt text should have &#1234;, not &amp;1234;
11917 !! wikitext
11918 [[File:Foobar.jpg|&#9792;]]
11919 !! html/php
11920 <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>
11921 </p>
11922 !! html/parsoid
11923 <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>
11924 !! end
11925
11926 !! test
11927 Broken image caption with link
11928 !! options
11929 parsoid=wt2html,wt2wt,html2html
11930 !! wikitext
11931 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
11932 !! html/php
11933 <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.
11934 </p>
11935 !! html/parsoid
11936 <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>
11937 !! end
11938
11939 !! test
11940 Image caption containing another image
11941 !! wikitext
11942 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
11943 !! html/php
11944 <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>
11945
11946 !! html/parsoid
11947 <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>
11948 !! end
11949
11950 !! test
11951 Image: caption containing a newline
11952 !! wikitext
11953 [[File:Foobar.jpg|This
11954 *is some text]]
11955 !! html/php
11956 <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>
11957 </p>
11958 !! html/parsoid
11959 <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>
11960 !!end
11961
11962 !!test
11963 Image: caption containing leading space
11964 (The leading space should not trigger nowiki escaping in wt2wt mode)
11965 !! wikitext
11966 [[File:Foobar.jpg|thumb| bar]]
11967 !! html/php
11968 <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>
11969
11970 !! html/parsoid
11971 <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>
11972 !!end
11973
11974 !! test
11975 Image: caption containing a table
11976 !! options
11977 parsoid=wt2html,wt2wt,html2html
11978 !! wikitext
11979 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
11980 {|
11981 ! Foo !! Bar
11982 |-
11983 | Foo1 || Bar1
11984 |}
11985 and some more text.]]
11986 !! html/php
11987 <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>
11988
11989 !! html/parsoid
11990 <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
11991 <table>
11992 <tbody>
11993 <tr><th>Foo </th><th>Bar</th></tr>
11994 <tr>
11995 <td>Foo1 </td>
11996 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
11997 !! end
11998
11999 !! test
12000 Bug 3090: External links other than http: in image captions
12001 !! wikitext
12002 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
12003 !! html/php
12004 <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>
12005
12006 !! html/parsoid
12007 <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>
12008 !! end
12009
12010 !! test
12011 Custom class
12012 !! options
12013 parsoid=wt2html,wt2wt,html2html
12014 !! wikitext
12015 [[Image:foobar.jpg|a|class=b]]
12016 !! html/php
12017 <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>
12018 </p>
12019 !! html/parsoid
12020 <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>
12021 !! end
12022
12023 !! test
12024 Localized image handling (1).
12025 !! options
12026 parsoid=wt2html,wt2wt,html2html
12027 language=es
12028 !! wikitext
12029 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
12030 !! html/php
12031 <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>
12032
12033 !! html/parsoid
12034 <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>
12035 !! end
12036
12037 !! test
12038 Localized image handling (2).
12039 !! options
12040 thumbsize=220
12041 parsoid=wt2html,wt2wt,html2html
12042 language=es
12043 !! wikitext
12044 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
12045 !! html/php
12046 <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>
12047
12048 !! html/parsoid
12049 <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>
12050 !! end
12051
12052 !! test
12053 "border", "frameless" and "class" attributes on an image.
12054 !! options
12055 thumbsize=220
12056 parsoid=wt2html,wt2wt,html2html
12057 !! wikitext
12058 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
12059 !! html/php
12060 <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>
12061 </p>
12062 !! html/parsoid
12063 <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>
12064 !! end
12065
12066 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
12067 !! test
12068 Invalid image attributes (bug 62500)
12069 !! options
12070 thumbsize=220
12071 parsoid=wt2html,wt2wt,html2html
12072 !! wikitext
12073 [[File:Foobar.jpg|thumb|float|left|caption]]
12074
12075 [[File:Foobar.jpg|thumb|righ|caption]]
12076
12077 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
12078 !! html/php
12079 <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>
12080 <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>
12081 <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>
12082
12083 !! html/parsoid
12084 <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>
12085 <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>
12086 <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>
12087 !! end
12088
12089 !! article
12090 File:Barfoo.jpg
12091 !! text
12092 #REDIRECT [[File:Barfoo.jpg]]
12093 !! endarticle
12094
12095 !! test
12096 Redirected image
12097 !! wikitext
12098 [[Image:Barfoo.jpg]]
12099 !! html
12100 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
12101 </p>
12102 !! end
12103
12104 !! test
12105 Missing image with uploads disabled
12106 !! options
12107 wgEnableUploads=0
12108 !! wikitext
12109 [[Image:Foobaz.jpg]]
12110 !! html
12111 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
12112 </p>
12113 !! end
12114
12115 # Parsoid-specific testing for images
12116 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12117 # Currently imperfect due to a flaw in the Parsoid testrunner
12118 # Work in progress
12119 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
12120 # image tests.
12121
12122 !! test
12123 Parsoid-specific image handling - simple image with size and middle alignment
12124 !! wikitext
12125 [[File:Foobar.jpg|middle|50px]]
12126 !! html/parsoid
12127 <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>
12128 !! end
12129
12130 !! test
12131 Parsoid-specific image handling - simple image with size, middle alignment,
12132 non-standard namespace alias
12133 !! options
12134 parsoid=wt2wt,wt2html,html2html
12135 !! wikitext
12136 [[Image:Foobar.jpg|middle|50px]]
12137 !! html/parsoid
12138 <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>
12139 !! end
12140
12141 !! test
12142 Parsoid-specific image handling - simple image with size and middle alignment
12143 (existing content)
12144 !! wikitext
12145 [[File:Foobar.jpg|50px|middle]]
12146 !! html/parsoid
12147 <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>
12148 !! end
12149
12150 !! test
12151 Parsoid-specific image handling - simple image with size and middle alignment
12152 and non-standard namespace name
12153 !! options
12154 parsoid=wt2html,wt2wt,html2html
12155 !! wikitext
12156 [[Image:Foobar.jpg|50px|middle]]
12157 !! html/parsoid
12158 <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>
12159 !! end
12160
12161 !! test
12162 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
12163 !! wikitext
12164 [[File:Foobar.jpg|500x10px|baseline|caption]]
12165 !! html/parsoid
12166 <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>
12167 !! end
12168
12169 !! test
12170 Parsoid-specific image handling - simple image with border and size spec
12171 !! wikitext
12172 [[File:Foobar.jpg|50px|border|caption]]
12173 !! html/parsoid
12174 <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>
12175 !! end
12176
12177 !! test
12178 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12179 !! wikitext
12180 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
12181 !! html/parsoid
12182 <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>
12183 !! end
12184
12185 !! test
12186 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12187 (existing content)
12188 !! wikitext
12189 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12190 !! html/parsoid
12191 <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>
12192 !! end
12193
12194 !! test
12195 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12196 !! wikitext
12197 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12198 !! html/parsoid
12199 <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>
12200 !! end
12201
12202 !! test
12203 Parsoid-specific image handling - thumbnail with specific size, halign,
12204 valign, and caption (existing content)
12205 !! wikitext
12206 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12207 !! html/parsoid
12208 <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>
12209 !! end
12210
12211 !! test
12212 Parsoid-specific image handling - framed image with specific size and caption
12213 (size is ignored)
12214 !! options
12215 parsoid=wt2html,wt2wt,html2html
12216 !! wikitext
12217 [[File:Foobar.jpg|frame|500x50px|caption]]
12218 !! html/parsoid
12219 <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>
12220 !! end
12221
12222 !! test
12223 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12224 (size is ignored)
12225 !! options
12226 parsoid=wt2html,wt2wt,html2html
12227 !! wikitext
12228 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12229 !! html/parsoid
12230 <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>
12231 !! end
12232
12233 !! test
12234 Parsoid-specific image handling - frameless image with specific size, border, and caption
12235 !! wikitext
12236 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12237 !! html/parsoid
12238 <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>
12239 !! end
12240
12241 !! test
12242 Parsoid-specific image handling - simple image with a formatted caption
12243 !! wikitext
12244 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12245 !! html/parsoid
12246 <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>
12247 !! end
12248
12249 !! test
12250 Parsoid-specific image handling - caption with a template in it
12251 !! wikitext
12252 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12253 !! html/parsoid
12254 <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>
12255 !! end
12256
12257 !! test
12258 Parsoid-specific image handling - caption with unbalanced tags in it
12259 !! options
12260 parsoid=wt2html,wt2wt,html2html
12261 !! wikitext
12262 foo
12263 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12264 bar
12265 !! html/parsoid
12266 <p>foo</p>
12267 <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>
12268 <p>bar</p>
12269 !! end
12270
12271 !! test
12272 Parsoid-specific image handling - empty caption (1)
12273 !! options
12274 parsoid=wt2html,wt2wt
12275 !! wikitext
12276 [[File:Foobar.jpg|thumb|]]
12277 !! html/parsoid
12278 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption></figcaption></figure>
12279 !! end
12280
12281 # empty captions don't get serialized unless we're in the "round trip" case
12282 !! test
12283 Parsoid-specific image handling - empty caption (2)
12284 !! options
12285 parsoid=html2wt
12286 !! html/parsoid
12287 <figure class="mw-default-size" typeof="mw:Image/Thumb">
12288 <a href="File:Foobar.jpg">
12289 <img resource="./File:Foobar.jpg"
12290 src="//example.com/images/3/3a/Foobar.jpg"
12291 height="25" width="220"/>
12292 </a>
12293 <figcaption></figcaption>
12294 </figure>
12295 !! wikitext
12296 [[File:Foobar.jpg|thumb]]
12297 !! end
12298
12299 !! test
12300 Parsoid-specific image handling - whitespace caption
12301 !! wikitext
12302 [[File:Foobar.jpg|thumb| ]]
12303 !! html/parsoid
12304 <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>
12305 !! end
12306
12307 !! test
12308 Parsoid-specific image handling - lang option
12309 !! wikitext
12310 foo
12311 [[File:Foobar.svg|lang=de|caption]]
12312 bar
12313 !! html/parsoid
12314 <p>foo
12315 <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>
12316 bar</p>
12317 !! end
12318
12319
12320 ###
12321 ### Subpages
12322 ###
12323 !! article
12324 Subpage test/subpage
12325 !! text
12326 foo
12327 !! endarticle
12328
12329 !! test
12330 Subpage link
12331 !! options
12332 subpage title=[[Subpage test]]
12333 !! wikitext
12334 [[/subpage]]
12335 !! html
12336 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
12337 </p>
12338 !! end
12339
12340 !! test
12341 Subpage noslash link
12342 !! options
12343 subpage title=[[Subpage test]]
12344 !! wikitext
12345 [[/subpage/]]
12346 !! html
12347 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
12348 </p>
12349 !! end
12350
12351 # TODO: make this PHP-parser compatible!
12352 !! test
12353 Relative subpage noslash link
12354 !! options
12355 parsoid=wt2wt,wt2html,html2html
12356 subpage title=[[Subpage test/1/2/3/4]]
12357 !! wikitext
12358 [[../../subpage/]]
12359
12360 [[../../subpage]]
12361 !! html
12362 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/" title="Subpage test/1/2/subpage/">subpage</a></p>
12363 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
12364 !! end
12365
12366 !! test
12367 Parsoid: dot-slash prefixed wikilinks
12368 !! wikitext
12369 [[./foo]]
12370
12371 [[././bar]]
12372
12373 [[././baz/]]
12374 !! html/php
12375 <p>[[./foo]]
12376 </p><p>[[././bar]]
12377 </p><p>[[././baz/]]
12378 </p>
12379 !! html/parsoid
12380 <p>[[./foo]]
12381 </p><p>[[././bar]]
12382 </p><p>[[././baz/]]
12383 </p>
12384 !! end
12385
12386 !! test
12387 Render invalid page names as plain text (bug 51090)
12388 !! wikitext
12389 [[./../foo|bar]]
12390 [[foo�|bar]]
12391 [[foo/.|bar]]
12392 [[foo/..|bar]]
12393 [[foo~~~bar]]
12394 [[foo>bar]]
12395 [[foo[bar]]
12396 [[.]]
12397 [[..]]
12398 [[foo././bar]]
12399
12400 [[{{echo|./../foo}}|bar]]
12401 [[{{echo|foo/.}}|bar]]
12402 [[{{echo|foo/..}}|bar]]
12403 [[{{echo|foo~~~~bar}}]]
12404 [[{{echo|foo>bar}}]]
12405 [[{{echo|foo././bar}}]]
12406 [[{{echo|foo{bar}}]]
12407 [[{{echo|foo}bar}}]]
12408 [[{{echo|foo[bar}}]]
12409 [[{{echo|foo]bar}}]]
12410 [[{{echo|foo<bar}}]]
12411 !!html/php
12412 <p>[[./../foo|bar]]
12413 [[foo�|bar]]
12414 [[foo/.|bar]]
12415 [[foo/..|bar]]
12416 [[foo~~~bar]]
12417 [[foo&gt;bar]]
12418 [[foo[bar]]
12419 [[.]]
12420 [[..]]
12421 [[foo././bar]]
12422 </p><p>[[./../foo|bar]]
12423 [[foo/.|bar]]
12424 [[foo/..|bar]]
12425 [[foo~~~~bar]]
12426 [[foo&gt;bar]]
12427 [[foo././bar]]
12428 [[foo{bar]]
12429 [[foo}bar]]
12430 [[foo[bar]]
12431 [[foo]bar]]
12432 [[foo&lt;bar]]
12433 </p>
12434 !!html/parsoid
12435 <p>[[./../foo|bar]]
12436 [[foo�|bar]]
12437 [[foo/.|bar]]
12438 [[foo/..|bar]]
12439 [[foo~~~bar]]
12440 [[foo>bar]]
12441 [[foo[bar]]
12442 [[.]]
12443 [[..]]
12444 [[foo././bar]]</p>
12445
12446 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
12447 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
12448 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
12449 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
12450 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
12451 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
12452 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
12453 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
12454 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
12455 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
12456 [[<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>
12457 !!end
12458
12459 !! test
12460 Disabled subpages
12461 !! wikitext
12462 [[/subpage]]
12463 !! html
12464 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
12465 </p>
12466 !! end
12467
12468 !! test
12469 BUG 561: {{/Subpage}}
12470 !! options
12471 subpage title=[[Page]]
12472 !! wikitext
12473 {{/Subpage}}
12474 !! html
12475 <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>
12476 </p>
12477 !! end
12478
12479 ###
12480 ### Categories
12481 ###
12482 !! article
12483 Category:MediaWiki User's Guide
12484 !! text
12485 blah
12486 !! endarticle
12487
12488 !! test
12489 Link to category
12490 !! wikitext
12491 [[:Category:MediaWiki User's Guide]]
12492 !! html
12493 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
12494 </p>
12495 !! end
12496
12497 !! test
12498 Simple category
12499 !! options
12500 cat
12501 !! wikitext
12502 [[Category:MediaWiki User's Guide]]
12503 !! html
12504 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12505 !! end
12506
12507 !! test
12508 PAGESINCATEGORY invalid title fatal (r33546 fix)
12509 !! wikitext
12510 {{PAGESINCATEGORY:<bogus>}}
12511 !! html
12512 <p>0
12513 </p>
12514 !! end
12515
12516 !! test
12517 Category with different sort key
12518 !! options
12519 cat
12520 !! wikitext
12521 [[Category:MediaWiki User's Guide|Foo]]
12522 !! html
12523 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12524 !! end
12525
12526 !! test
12527 Category with identical sort key
12528 !! options
12529 cat
12530 !! wikitext
12531 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12532 !! html
12533 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12534 !! end
12535
12536 !! test
12537 Category with empty sort key
12538 !! options
12539 cat
12540 pst
12541 !! wikitext
12542 [[Category:MediaWiki User's Guide|]]
12543 !! html
12544 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12545 !! end
12546
12547 !! test
12548 Category with empty sort key and parentheses
12549 !! options
12550 cat
12551 pst
12552 !! wikitext
12553 [[Category:Foo (bar)|]]
12554 !! html
12555 [[Category:Foo (bar)|Foo]]
12556 !! end
12557
12558 !! test
12559 Category with link tail
12560 !! options
12561 cat
12562 pst
12563 !! wikitext
12564 123[[Category:Foo]]456
12565 !! html
12566 123[[Category:Foo]]456
12567 !! end
12568
12569 !! test
12570 Category with template
12571 !! options
12572 cat
12573 pst
12574 !! wikitext
12575 [[Category:{{echo|Foo}}]]
12576 !! html
12577 [[Category:{{echo|Foo}}]]
12578 !! end
12579
12580 !! test
12581 Category with template in sort key
12582 !! options
12583 cat
12584 pst
12585 !! wikitext
12586 [[Category:Foo|{{echo|Bar}}]]
12587 !! html
12588 [[Category:Foo|{{echo|Bar}}]]
12589 !! end
12590
12591 !! test
12592 Category with template in sort key and title
12593 !! options
12594 cat
12595 pst
12596 !! wikitext
12597 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12598 !! html
12599 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12600 !! end
12601
12602 !! test
12603 Category / paragraph interactions
12604 !! wikitext
12605 Foo [[Category:Baz]] Bar
12606
12607 Foo [[Category:Baz]]
12608 Bar
12609
12610 Foo
12611 [[Category:Baz]]
12612 Bar
12613
12614 Foo
12615 [[Category:Baz]] Bar
12616
12617 Foo
12618 [[Category:Baz]]
12619 [[Category:Baz]]
12620 [[Category:Baz]]
12621 Bar
12622
12623 [[Category:Baz]]
12624 [[Category:Baz]]
12625 [[Category:Baz]]
12626
12627 [[Category:Baz]]
12628 {{echo|[[Category:Baz]]}}
12629 [[Category:Baz]]
12630 !! html
12631 <p>Foo Bar
12632 </p><p>Foo
12633 Bar
12634 </p><p>Foo
12635 Bar
12636 </p><p>Foo Bar
12637 </p><p>Foo
12638 Bar
12639 </p>
12640 !! end
12641
12642 !! test
12643 Parsoid: Serialize link to category page with colon escape
12644 !! options
12645 parsoid
12646 !! wikitext
12647
12648 [[:Category:Foo]]
12649 [[:Category:Foo|Bar]]
12650 !! html
12651 <p>
12652 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
12653 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
12654 </p>
12655 !! end
12656
12657 !! test
12658 Parsoid: Link prefix/suffixes aren't applied to category links
12659 !! options
12660 parsoid=wt2html,wt2wt,html2html
12661 language=is
12662 !! wikitext
12663 x[[Category:Foo]]y
12664 !! html
12665 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
12666 !! end
12667
12668 !! test
12669 Parsoid: Serialize link to file page with colon escape
12670 !! options
12671 parsoid
12672 !! wikitext
12673
12674 [[:File:Foo.png]]
12675 [[:File:Foo.png|Bar]]
12676 !! html
12677 <p>
12678 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
12679 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
12680 </p>
12681 !! end
12682
12683 !! test
12684 Parsoid: Serialize a genuine category link without colon escape
12685 !! options
12686 parsoid
12687 !! wikitext
12688 [[Category:Foo]]
12689 [[Category:Foo|Bar]]
12690 !! html
12691 <link rel="mw:PageProp/Category" href="Category:Foo">
12692 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
12693 !! end
12694
12695 !! test
12696 Normalize hrefs properly before testing for invalid link targets (bug 70894)
12697 !! options
12698 parsoid=html2wt
12699 !! html
12700 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
12701 !! wikitext
12702 [[Category:Toxine bactérienne]]
12703 !! end
12704
12705 !! test
12706 Parsoid: Defaultsort
12707 !! options
12708 parsoid
12709 !! wikitext
12710 {{DEFAULTSORT:Foo}}
12711 !! html
12712 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
12713 !! end
12714
12715 ###
12716 ### Inter-language links
12717 ###
12718 !! test
12719 Interlanguage links
12720 !! options
12721 ill
12722 !! wikitext
12723 [[es:Alimento]]
12724 [[fr:Nourriture]]
12725 [[zh:食品]]
12726 !! html/php
12727 es:Alimento fr:Nourriture zh:食品
12728 !! html/parsoid
12729 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
12730 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
12731 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
12732 !! end
12733
12734 !! test
12735 Duplicate interlanguage links (bug 24502)
12736 !! options
12737 ill
12738 !! wikitext
12739 [[es:1]]
12740 [[es:2]]
12741 [[fr:1]]
12742 [[fr:2]]
12743 !! html/php
12744 es:1 fr:1
12745 !! html/parsoid
12746 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
12747 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
12748 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
12749 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
12750 !! end
12751
12752 ###
12753 ### Sections
12754 ###
12755 !! test
12756 Basic section headings
12757 !! wikitext
12758 == Headline 1 ==
12759 Some text
12760
12761 ==Headline 2==
12762 More
12763 ===Smaller headline===
12764 Blah blah
12765 !! html
12766 <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>
12767 <p>Some text
12768 </p>
12769 <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>
12770 <p>More
12771 </p>
12772 <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>
12773 <p>Blah blah
12774 </p>
12775 !! end
12776
12777 !! test
12778 Section headings with TOC
12779 !! wikitext
12780 == Headline 1 ==
12781 === Subheadline 1 ===
12782 ===== Skipping a level =====
12783 ====== Skipping a level ======
12784
12785 == Headline 2 ==
12786 Some text
12787 ===Another headline===
12788 !! html
12789 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12790 <ul>
12791 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
12792 <ul>
12793 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
12794 <ul>
12795 <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>
12796 <ul>
12797 <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>
12798 </ul>
12799 </li>
12800 </ul>
12801 </li>
12802 </ul>
12803 </li>
12804 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
12805 <ul>
12806 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
12807 </ul>
12808 </li>
12809 </ul>
12810 </div>
12811
12812 <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>
12813 <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>
12814 <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>
12815 <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>
12816 <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>
12817 <p>Some text
12818 </p>
12819 <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>
12820
12821 !! end
12822
12823 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
12824 !! test
12825 Handling of sections up to level 6 and beyond
12826 !! wikitext
12827 = Level 1 Heading=
12828 == Level 2 Heading==
12829 === Level 3 Heading===
12830 ==== Level 4 Heading====
12831 ===== Level 5 Heading=====
12832 ====== Level 6 Heading======
12833 ======= Level 7 Heading=======
12834 ======== Level 8 Heading========
12835 ========= Level 9 Heading=========
12836 ========== Level 10 Heading==========
12837 !! html
12838 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12839 <ul>
12840 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
12841 <ul>
12842 <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>
12843 <ul>
12844 <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>
12845 <ul>
12846 <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>
12847 <ul>
12848 <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>
12849 <ul>
12850 <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>
12851 <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>
12852 <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>
12853 <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>
12854 <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>
12855 </ul>
12856 </li>
12857 </ul>
12858 </li>
12859 </ul>
12860 </li>
12861 </ul>
12862 </li>
12863 </ul>
12864 </li>
12865 </ul>
12866 </div>
12867
12868 <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>
12869 <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>
12870 <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>
12871 <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>
12872 <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>
12873 <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>
12874 <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>
12875 <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>
12876 <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>
12877 <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>
12878
12879 !! end
12880
12881 !! test
12882 TOC regression (bug 9764)
12883 !! wikitext
12884 == title 1 ==
12885 === title 1.1 ===
12886 ==== title 1.1.1 ====
12887 === title 1.2 ===
12888 == title 2 ==
12889 === title 2.1 ===
12890 !! html
12891 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12892 <ul>
12893 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12894 <ul>
12895 <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>
12896 <ul>
12897 <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>
12898 </ul>
12899 </li>
12900 <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>
12901 </ul>
12902 </li>
12903 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12904 <ul>
12905 <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>
12906 </ul>
12907 </li>
12908 </ul>
12909 </div>
12910
12911 <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>
12912 <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>
12913 <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>
12914 <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>
12915 <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>
12916 <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>
12917
12918 !! end
12919
12920 !! test
12921 TOC with wgMaxTocLevel=3 (bug 6204)
12922 !! options
12923 wgMaxTocLevel=3
12924 !! wikitext
12925 == title 1 ==
12926 === title 1.1 ===
12927 ==== title 1.1.1 ====
12928 === title 1.2 ===
12929 == title 2 ==
12930 === title 2.1 ===
12931 !! html
12932 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12933 <ul>
12934 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12935 <ul>
12936 <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>
12937 <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>
12938 </ul>
12939 </li>
12940 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12941 <ul>
12942 <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>
12943 </ul>
12944 </li>
12945 </ul>
12946 </div>
12947
12948 <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>
12949 <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>
12950 <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>
12951 <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>
12952 <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>
12953 <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>
12954
12955 !! end
12956
12957 !! test
12958 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
12959 !! options
12960 wgMaxTocLevel=3
12961 !! wikitext
12962 ==Section 1==
12963 ===Section 1.1===
12964 ====Section 1.1.1====
12965 ====Section 1.1.1.1====
12966 ==Section 2==
12967 !! html
12968 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12969 <ul>
12970 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
12971 <ul>
12972 <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>
12973 </ul>
12974 </li>
12975 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
12976 </ul>
12977 </div>
12978
12979 <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>
12980 <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>
12981 <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>
12982 <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>
12983 <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>
12984
12985 !! end
12986
12987
12988 !! test
12989 Resolving duplicate section names
12990 !! wikitext
12991 == Foo bar ==
12992 == Foo bar ==
12993 !! html
12994 <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>
12995 <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>
12996
12997 !! end
12998
12999 !! test
13000 Resolving duplicate section names with differing case (bug 10721)
13001 !! wikitext
13002 == Foo bar ==
13003 == Foo Bar ==
13004 !! html
13005 <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>
13006 <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>
13007
13008 !! end
13009
13010 !! article
13011 Template:sections
13012 !! text
13013 ===Section 1===
13014 ==Section 2==
13015 !! endarticle
13016
13017 !! test
13018 Template with sections, __NOTOC__
13019 !! wikitext
13020 __NOTOC__
13021 ==Section 0==
13022 {{sections}}
13023 ==Section 4==
13024 !! html
13025 <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>
13026 <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>
13027 <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>
13028 <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>
13029
13030 !! end
13031
13032 !! test
13033 __NOEDITSECTION__ keyword
13034 !! wikitext
13035 __NOEDITSECTION__
13036 ==Section 1==
13037 ==Section 2==
13038 !! html
13039 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
13040 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
13041
13042 !! end
13043
13044 !! test
13045 Link inside a section heading
13046 !! wikitext
13047 ==Section with a [[Main Page|link]] in it==
13048 !! html
13049 <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>
13050
13051 !! end
13052
13053 !! test
13054 TOC regression (bug 12077)
13055 !! wikitext
13056 __TOC__
13057 == title 1 ==
13058 === title 1.1 ===
13059 == title 2 ==
13060 !! html
13061 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13062 <ul>
13063 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13064 <ul>
13065 <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>
13066 </ul>
13067 </li>
13068 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13069 </ul>
13070 </div>
13071
13072 <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>
13073 <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>
13074 <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>
13075
13076 !! end
13077
13078 !! test
13079 BUG 1219 URL next to image (good)
13080 !! wikitext
13081 http://example.com [[Image:foobar.jpg]]
13082 !! html
13083 <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>
13084 </p>
13085 !!end
13086
13087 !! test
13088 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13089 !! wikitext
13090 ===
13091 The line above must have a trailing space!
13092 === <!--
13093 --> <!-- -->
13094 But just in case it doesn't...
13095 !! html
13096 <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>
13097 <p>The line above must have a trailing space!
13098 </p>
13099 <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>
13100 <p>But just in case it doesn't...
13101 </p>
13102 !! end
13103
13104 !! test
13105 Header with special characters (bug 25462)
13106 !! wikitext
13107 The tooltips shall not show entities to the user (ie. be double escaped)
13108
13109 == text > text ==
13110 section 1
13111
13112 == text < text ==
13113 section 2
13114
13115 == text & text ==
13116 section 3
13117
13118 == text ' text ==
13119 section 4
13120
13121 == text " text ==
13122 section 5
13123 !! html
13124 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13125 </p>
13126 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13127 <ul>
13128 <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>
13129 <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>
13130 <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>
13131 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13132 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13133 </ul>
13134 </div>
13135
13136 <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>
13137 <p>section 1
13138 </p>
13139 <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>
13140 <p>section 2
13141 </p>
13142 <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>
13143 <p>section 3
13144 </p>
13145 <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>
13146 <p>section 4
13147 </p>
13148 <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>
13149 <p>section 5
13150 </p>
13151 !! end
13152
13153 !! test
13154 Header with space, plus and underscore as entity
13155 !! wikitext
13156 Id should not contain + for spaces
13157
13158 == Space between Text ==
13159 section 1
13160
13161 == Space-Entity&#32;between&#32;Text ==
13162 section 2
13163
13164 == Plus+between+Text ==
13165 section 3
13166
13167 == Plus-Entity&#43;between&#43;Text ==
13168 section 4
13169
13170 == Underscore_between_Text ==
13171 section 5
13172
13173 == Underscore-Entity&#95;between&#95;Text ==
13174 section 6
13175
13176 [[#Space between Text]]
13177 [[#Space-Entity&#32;between&#32;Text]]
13178 [[#Plus+between+Text]]
13179 [[#Plus-Entity&#43;between&#43;Text]]
13180 [[#Underscore_between_Text]]
13181 [[#Underscore-Entity&#95;between&#95;Text]]
13182 !! html
13183 <p>Id should not contain + for spaces
13184 </p>
13185 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13186 <ul>
13187 <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>
13188 <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>
13189 <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>
13190 <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>
13191 <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>
13192 <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>
13193 </ul>
13194 </div>
13195
13196 <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>
13197 <p>section 1
13198 </p>
13199 <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>
13200 <p>section 2
13201 </p>
13202 <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>
13203 <p>section 3
13204 </p>
13205 <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>
13206 <p>section 4
13207 </p>
13208 <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>
13209 <p>section 5
13210 </p>
13211 <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>
13212 <p>section 6
13213 </p><p><a href="#Space_between_Text">#Space between Text</a>
13214 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
13215 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
13216 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
13217 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
13218 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
13219 </p>
13220 !! end
13221
13222 !! test
13223 Headers with excess '=' characters
13224 (Are similar tests necessary beyond the 1st level?)
13225 !! wikitext
13226 =foo==
13227 ==foo=
13228 =''italic'' heading==
13229 ==''italic'' heading=
13230 !! html
13231 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13232 <ul>
13233 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
13234 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
13235 <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>
13236 <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>
13237 </ul>
13238 </div>
13239
13240 <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>
13241 <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>
13242 <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>
13243 <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>
13244
13245 !! end
13246
13247 !! test
13248 HTML headers vs TOC (bug 23393)
13249 (__NOEDITSECTION__ for clearer output, doesn't matter here)
13250 !! wikitext
13251 <h1>Header 1</h1>
13252 == Header 1.1 ==
13253 == Header 1.2 ==
13254
13255 <h1>Header 2
13256 </h1>
13257 == Header 2.1 ==
13258 == Header 2.2 ==
13259 __NOEDITSECTION__
13260 !! html
13261 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13262 <ul>
13263 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
13264 <ul>
13265 <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>
13266 <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>
13267 </ul>
13268 </li>
13269 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
13270 <ul>
13271 <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>
13272 <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>
13273 </ul>
13274 </li>
13275 </ul>
13276 </div>
13277
13278 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
13279 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
13280 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
13281 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
13282 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
13283 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
13284
13285 !! end
13286
13287 !! test
13288 Single-line or multiline-comments can follow headings
13289 !! options
13290 parsoid=wt2html,wt2wt
13291 !! wikitext
13292 ==foo==<!---->
13293 ==bar==<!--c1-->
13294 ==baz==<!--
13295 c2
13296 c3-->
13297 !! html
13298 <h2><span class="mw-headline" id="foo">foo</span></h2>
13299 <h2><span class="mw-headline" id="bar">bar</span></h2>
13300 <h2><span class="mw-headline" id="baz">baz</span></h2>
13301
13302 !! end
13303
13304 !! test
13305 BUG 1219 URL next to image (broken)
13306 !! wikitext
13307 http://example.com[[Image:foobar.jpg]]
13308 !! html
13309 <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>
13310 </p>
13311 !!end
13312
13313 !! test
13314 Bug 1186 news: in the middle of text
13315 !! wikitext
13316 http://en.wikinews.org/wiki/Wikinews:Workplace
13317 !! html
13318 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
13319 </p>
13320 !!end
13321
13322
13323 !! test
13324 Namespaced link must have a title
13325 !! wikitext
13326 [[Project:]]
13327 !! html
13328 <p>[[Project:]]
13329 </p>
13330 !!end
13331
13332 !! test
13333 Namespaced link must have a title (bad fragment version)
13334 !! wikitext
13335 [[Project:#fragment]]
13336 !! html
13337 <p>[[Project:#fragment]]
13338 </p>
13339 !!end
13340
13341
13342 ###
13343 ### HTML tags and HTML attributes
13344 ###
13345
13346 !! test
13347 div with no attributes
13348 !! wikitext
13349 <div>HTML rocks</div>
13350 !! html
13351 <div>HTML rocks</div>
13352
13353 !! end
13354
13355 !! test
13356 div with double-quoted attribute
13357 !! wikitext
13358 <div id="rock">HTML rocks</div>
13359 !! html
13360 <div id="rock">HTML rocks</div>
13361
13362 !! end
13363
13364 !! test
13365 div with single-quoted attribute
13366 !! wikitext
13367 <div id='rock'>HTML rocks</div>
13368 !! html
13369 <div id="rock">HTML rocks</div>
13370
13371 !! end
13372
13373 !! test
13374 div with unquoted attribute
13375 !! wikitext
13376 <div id=rock>HTML rocks</div>
13377 !! html
13378 <div id="rock">HTML rocks</div>
13379
13380 !! end
13381
13382 !! test
13383 div with illegal double attributes
13384 !! wikitext
13385 <div id="a" id="b">HTML rocks</div>
13386 !! html
13387 <div id="b">HTML rocks</div>
13388
13389 !!end
13390
13391 # FIXME: produce empty string instead of "class" in the PHP parser, following
13392 # the HTML5 spec.
13393 !! test
13394 div with empty attribute value, space before equals
13395 !! options
13396 parsoid
13397 !! wikitext
13398 <div class =>HTML rocks</div>
13399 !! html
13400 <div class="">HTML rocks</div>
13401
13402 !! end
13403
13404 !! test
13405 div with multiple empty attribute values
13406 !! options
13407 parsoid
13408 !! wikitext
13409 <div id= title=>HTML rocks</div>
13410 !! html
13411 <div id="" title="">HTML rocks</div>
13412
13413 !! end
13414
13415 !! test
13416 table with multiple empty attribute values
13417 !! options
13418 parsoid
13419 !! wikitext
13420 {| title= id=
13421 | hi
13422 |}
13423 !! html
13424 <table title="" id="">
13425 <tbody><tr><td> hi</td></tr>
13426 </tbody></table>
13427 !! end
13428
13429 !! test
13430 div with braces in attribute value
13431 !! wikitext
13432 <div title="{}">Foo</div>
13433 !! html/php
13434 <div title="&#123;}">Foo</div>
13435
13436 !! html/parsoid
13437 <div title="{}">Foo</div>
13438 !! end
13439
13440 # This it very inconsistent in the PHP parser: it returns
13441 # class="class" if there is a space between the name and the equal sign (see
13442 # 'div with empty attribute value, space before equals'), but strips the
13443 # attribute completely if the space is missing. We hope that not much content
13444 # depends on this, so are implementing the behavior below in Parsoid for
13445 # consistencies' sake.
13446 # FIXME: fix this behavior in the PHP parser?
13447 !! test
13448 div with empty attribute value, no space before equals
13449 !! options
13450 parsoid=wt2html,html2html
13451 !! wikitext
13452 <div class=>HTML rocks</div>
13453 !! html/php
13454 <div>HTML rocks</div>
13455
13456 !! html/parsoid
13457 <div class="">HTML rocks</div>
13458 !! end
13459
13460 !! test
13461 HTML multiple attributes correction
13462 !! wikitext
13463 <p class="error" class="awesome">Awesome!</p>
13464 !! html
13465 <p class="awesome">Awesome!</p>
13466
13467 !!end
13468
13469 !! test
13470 Table multiple attributes correction
13471 !! wikitext
13472 {|
13473 !+ class="error" class="awesome"| status
13474 |}
13475 !! html
13476 <table>
13477 <tr>
13478 <th class="awesome"> status
13479 </th></tr></table>
13480
13481 !!end
13482
13483 !! test
13484 DIV IN UPPERCASE
13485 !! wikitext
13486 <DIV ID="x">HTML ROCKS</DIV>
13487 !! html
13488 <div id="x">HTML ROCKS</div>
13489
13490 !!end
13491
13492 !! test
13493 Non-ASCII pseudo-tags are rendered as text
13494 !! wikitext
13495 <khyô>
13496 !! html
13497 <p>&lt;khyô&gt;
13498 </p>
13499 !! end
13500
13501 !! test
13502 Pseudo-tag with URL 'name' renders as url link
13503 !! wikitext
13504 <http://example.com/>
13505 !! html
13506 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
13507 </p>
13508 !! end
13509
13510 !! test
13511 text with amp in the middle of nowhere
13512 !! wikitext
13513 Remember AT&T?
13514 !! html
13515 <p>Remember AT&amp;T?
13516 </p>
13517 !! end
13518
13519 !! test
13520 text with character entity: eacute
13521 !! wikitext
13522 I always thought &eacute; was a cute letter.
13523 !! html
13524 <p>I always thought &#233; was a cute letter.
13525 </p>
13526 !! html+tidy
13527 <p>I always thought é was a cute letter.</p>
13528 !! end
13529
13530 !! test
13531 text with entity-escaped character entity-like string: eacute
13532 !! wikitext
13533 I always thought &amp;eacute; was a cute letter.
13534 !! html
13535 <p>I always thought &amp;eacute; was a cute letter.
13536 </p>
13537 !! end
13538
13539 !! test
13540 text with undefined character entity: xacute
13541 !! wikitext
13542 I always thought &xacute; was a cute letter.
13543 !! html
13544 <p>I always thought &amp;xacute; was a cute letter.
13545 </p>
13546 !! end
13547
13548 # TODO: generalize to PHP parser?
13549 !! test
13550 HTML5 tags
13551 !! options
13552 parsoid
13553 !! wikitext
13554 <data value="5">five</data>
13555 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13556 <mark>This highlighted text</mark>
13557 !! html
13558 <p><data value="5">five</data>
13559 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13560 <mark>This highlighted text</mark></p>
13561 !! end
13562
13563 !! test
13564 HTML tag with leading space is parsed as text
13565 !! wikitext
13566 < div>foo< /div>
13567 !! html
13568 <p>&lt; div&gt;foo&lt; /div&gt;
13569 </p>
13570 !! end
13571
13572 ###
13573 ### Nesting tests (see bug 41545, 50604, 51081)
13574 ###
13575
13576 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
13577 # Note that html2wt is considerably more difficult if we use <b> in
13578 # the test case, instead of <big>
13579 !! test
13580 Ensure that HTML adoption agency algorithm is properly implemented.
13581 !! wikitext
13582 <big>X<big>Y</big>Z</big>
13583 !! html
13584 <p><big>X<big>Y</big>Z</big>
13585 </p>
13586 !! end
13587
13588 # This was bug 41545 in the PHP parser.
13589 # Note that tidy doesn't handle this correctly.
13590 !! test
13591 Nesting of <kbd>
13592 !! wikitext
13593 <kbd>X<kbd>Y</kbd>Z</kbd>
13594 !! html
13595 <p><kbd>X<kbd>Y</kbd>Z</kbd>
13596 </p>
13597 !! end
13598
13599 # The following cases were bug 51081 in the PHP parser.
13600 # Note that there are some other nestable tags (b, i, etc) which are
13601 # not covered; see bug 51081 for discussion.
13602
13603 # Note that tidy doesn't handle this correctly.
13604 !! test
13605 Nesting of <em>
13606 !! wikitext
13607 <em>X<em>Y</em>Z</em>
13608 !! html
13609 <p><em>X<em>Y</em>Z</em>
13610 </p>
13611 !! end
13612
13613 # Note that tidy doesn't handle this correctly.
13614 !! test
13615 Nesting of <strong>
13616 !! wikitext
13617 <strong>X<strong>Y</strong>Z</strong>
13618 !! html
13619 <p><strong>X<strong>Y</strong>Z</strong>
13620 </p>
13621 !! end
13622
13623 !! test
13624 Nesting of <q>
13625 !! wikitext
13626 <q>X<q>Y</q>Z</q>
13627 !! html+tidy
13628 <p><q>X<q>Y</q>Z</q></p>
13629 !! end
13630
13631 # Note that tidy doesn't handle this correctly.
13632 !! test
13633 Nesting of <ruby>
13634 !! wikitext
13635 <ruby>X<ruby>Y</ruby>Z</ruby>
13636 !! html
13637 <p><ruby>X<ruby>Y</ruby>Z</ruby>
13638 </p>
13639 !! end
13640
13641 # Note that tidy doesn't handle this correctly.
13642 !! test
13643 Nesting of <bdo>
13644 !! wikitext
13645 <bdo>X<bdo>Y</bdo>Z</bdo>
13646 !! html
13647 <p><bdo>X<bdo>Y</bdo>Z</bdo>
13648 </p>
13649 !! end
13650
13651
13652 ###
13653 ### Media links
13654 ###
13655
13656 !! test
13657 Media link
13658 !! wikitext
13659 [[Media:Foobar.jpg]]
13660 !! html
13661 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
13662 </p>
13663 !! end
13664
13665 !! test
13666 Media link with text
13667 !! wikitext
13668 [[Media:Foobar.jpg|A neat file to look at]]
13669 !! html
13670 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
13671 </p>
13672 !! end
13673
13674 # FIXME: this is still bad HTML tag nesting
13675 !! test
13676 Media link with nasty text
13677 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
13678 !! wikitext
13679 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
13680 !! html
13681 <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>
13682
13683 !! html+tidy
13684 <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>
13685 !! end
13686
13687 !! test
13688 Media link to nonexistent file (bug 1702)
13689 !! wikitext
13690 [[Media:No such.jpg]]
13691 !! html
13692 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
13693 </p>
13694 !! end
13695
13696 !! test
13697 Image link to nonexistent file (bug 1850 - good)
13698 !! wikitext
13699 [[Image:No such.jpg]]
13700 !! html
13701 <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>
13702 </p>
13703 !! end
13704
13705 !! test
13706 :Image link to nonexistent file (bug 1850 - bad)
13707 !! wikitext
13708 [[:Image:No such.jpg]]
13709 !! html
13710 <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>
13711 </p>
13712 !! end
13713
13714
13715
13716 !! test
13717 Character reference normalization in link text (bug 1938)
13718 !! wikitext
13719 [[Main Page|this&that]]
13720 !! html
13721 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
13722 </p>
13723 !!end
13724
13725 !! article
13726 אַ
13727 !! text
13728 Test for unicode normalization
13729
13730 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
13731 !! endarticle
13732
13733 !! test
13734 (bug 19451) Links should refer to the normalized form.
13735 !! wikitext
13736 [[&#xFB2E;]]
13737 [[&#x5d0;&#x5b7;]]
13738 [[&#x5d0;ַ]]
13739 [[א&#x5b7;]]
13740 [[אַ]]
13741 !! html
13742 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
13743 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
13744 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
13745 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
13746 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
13747 </p>
13748 !! end
13749
13750 !! test
13751 Empty attribute crash test (bug 2067)
13752 !! wikitext
13753 <font color="">foo</font>
13754 !! html
13755 <p><font color="">foo</font>
13756 </p>
13757 !! end
13758
13759 !! test
13760 Empty attribute crash test single-quotes (bug 2067)
13761 !! wikitext
13762 <font color=''>foo</font>
13763 !! html
13764 <p><font color="">foo</font>
13765 </p>
13766 !! end
13767
13768 !! test
13769 Attribute test: equals, then nothing
13770 !! wikitext
13771 <font color=>foo</font>
13772 !! html
13773 <p><font>foo</font>
13774 </p>
13775 !! end
13776
13777 !! test
13778 Attribute test: unquoted value
13779 !! wikitext
13780 <font color=x>foo</font>
13781 !! html
13782 <p><font color="x">foo</font>
13783 </p>
13784 !! end
13785
13786 !! test
13787 Attribute test: unquoted but illegal value (hash)
13788 !! wikitext
13789 <font color=#x>foo</font>
13790 !! html
13791 <p><font color="#x">foo</font>
13792 </p>
13793 !! end
13794
13795 !! test
13796 Attribute test: no value
13797 !! wikitext
13798 <font color>foo</font>
13799 !! html
13800 <p><font color="color">foo</font>
13801 </p>
13802 !! end
13803
13804 !! test
13805 Bug 2095: link with three closing brackets
13806 !! wikitext
13807 [[Main Page]]]
13808 !! html/php
13809 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
13810 </p>
13811 !! html/parsoid
13812 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
13813 !! end
13814
13815 !! test
13816 Bug 2095: link with pipe and three closing brackets
13817 !! wikitext
13818 [[Main Page|link]]]
13819 !! html/php
13820 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
13821 </p>
13822 !! html/parsoid
13823 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
13824 !! end
13825
13826 !! test
13827 Bug 2095: link with pipe and three closing brackets, version 2
13828 !! wikitext
13829 [[Main Page|[http://example.com/]]]
13830 !! html/php
13831 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
13832 </p>
13833 !! html/parsoid
13834 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
13835 !! end
13836
13837
13838 ###
13839 ### Safety
13840 ###
13841
13842 !! article
13843 Template:Dangerous attribute
13844 !! text
13845 " onmouseover="alert(document.cookie)
13846 !! endarticle
13847
13848 !! article
13849 Template:Dangerous style attribute
13850 !! text
13851 border-size: expression(alert(document.cookie))
13852 !! endarticle
13853
13854 !! article
13855 Template:Div style
13856 !! text
13857 <div style="float: right; {{{1}}}">Magic div</div>
13858 !! endarticle
13859
13860 !! test
13861 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
13862 !! wikitext
13863 <div title="{{test}}"></div>
13864 !! html
13865 <div title="This is a test template"></div>
13866
13867 !! end
13868
13869 # Parsoid has enough context to handle this case
13870 !! test
13871 Bug 2304: HTML attribute safety (dangerous template; 2309)
13872 !! wikitext
13873 <div title="{{dangerous attribute}}"></div>
13874 !! html/php
13875 <div title=""></div>
13876
13877 !! html/parsoid
13878 <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>
13879 !! end
13880
13881 !! test
13882 Bug 2304: HTML attribute safety (dangerous style template; 2309)
13883 !! wikitext
13884 <div style="{{dangerous style attribute}}"></div>
13885 !! html
13886 <div style="/* insecure input */"></div>
13887
13888 !! end
13889
13890 !! test
13891 Bug 2304: HTML attribute safety (safe parameter; 2309)
13892 !! wikitext
13893 {{div style|width: 200px}}
13894 !! html
13895 <div style="float: right; width: 200px">Magic div</div>
13896
13897 !! end
13898
13899 !! test
13900 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
13901 !! wikitext
13902 {{div style|width: expression(alert(document.cookie))}}
13903 !! html
13904 <div style="/* insecure input */">Magic div</div>
13905
13906 !! end
13907
13908 !! test
13909 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
13910 !! wikitext
13911 {{div style|"><script>alert(document.cookie)</script>}}
13912 !! html
13913 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13914
13915 !! end
13916
13917 !! test
13918 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
13919 !! wikitext
13920 {{div style|" ><script>alert(document.cookie)</script>}}
13921 !! html
13922 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13923
13924 !! end
13925
13926 !! test
13927 Bug 2304: HTML attribute safety (link)
13928 !! wikitext
13929 <div title="[[Main Page]]"></div>
13930 !! html
13931 <div title="&#91;&#91;Main Page]]"></div>
13932
13933 !! end
13934
13935 !! test
13936 Bug 2304: HTML attribute safety (italics)
13937 !! wikitext
13938 <div title="''foobar''"></div>
13939 !! html
13940 <div title="&#39;&#39;foobar&#39;&#39;"></div>
13941
13942 !! end
13943
13944 !! test
13945 Bug 2304: HTML attribute safety (bold)
13946 !! wikitext
13947 <div title="'''foobar'''"></div>
13948 !! html
13949 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
13950
13951 !! end
13952
13953
13954 !! test
13955 Bug 2304: HTML attribute safety (ISBN)
13956 !! wikitext
13957 <div title="ISBN 1234567890"></div>
13958 !! html
13959 <div title="&#73;SBN 1234567890"></div>
13960
13961 !! end
13962
13963 !! test
13964 Bug 2304: HTML attribute safety (RFC)
13965 !! wikitext
13966 <div title="RFC 1234"></div>
13967 !! html
13968 <div title="&#82;FC 1234"></div>
13969
13970 !! end
13971
13972 !! test
13973 Bug 2304: HTML attribute safety (PMID)
13974 !! wikitext
13975 <div title="PMID 1234567890"></div>
13976 !! html
13977 <div title="&#80;MID 1234567890"></div>
13978
13979 !! end
13980
13981 !! test
13982 Bug 2304: HTML attribute safety (web link)
13983 !! wikitext
13984 <div title="http://example.com/"></div>
13985 !! html
13986 <div title="http&#58;//example.com/"></div>
13987
13988 !! end
13989
13990 !! test
13991 Bug 2304: HTML attribute safety (named web link)
13992 !! wikitext
13993 <div title="[http://example.com/ link]"></div>
13994 !! html
13995 <div title="&#91;http&#58;//example.com/ link]"></div>
13996
13997 !! end
13998
13999 !! test
14000 Bug 3244: HTML attribute safety (extension; safe)
14001 !! wikitext
14002 <div style="<nowiki>background:blue</nowiki>"></div>
14003 !! html
14004 <div style="background:blue"></div>
14005
14006 !! end
14007
14008 !! test
14009 Bug 3244: HTML attribute safety (extension; unsafe)
14010 !! wikitext
14011 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14012 !! html
14013 <div style="/* insecure input */"></div>
14014
14015 !! end
14016
14017 # More MSIE fun discovered by Tom Gilder
14018
14019 !! test
14020 MSIE CSS safety test: spurious slash
14021 !! wikitext
14022 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14023 !! html
14024 <div style="/* insecure input */">evil</div>
14025
14026 !! end
14027
14028 !! test
14029 MSIE CSS safety test: hex code
14030 !! wikitext
14031 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14032 !! html
14033 <div style="/* insecure input */">evil</div>
14034
14035 !! end
14036
14037 !! test
14038 MSIE CSS safety test: comment in url
14039 !! wikitext
14040 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14041 !! html
14042 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14043
14044 !! end
14045
14046 !! test
14047 MSIE CSS safety test: comment in expression
14048 !! wikitext
14049 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14050 !! html
14051 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14052
14053 !! end
14054
14055 !! test
14056 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14057 !! wikitext
14058 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14059 !! html
14060 <p style="/* invalid control char */">A</p>
14061
14062 !! end
14063
14064 !! test
14065 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14066 !! wikitext
14067 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14068 <div style="top:EXPRESSION(alert())">B</div>
14069 !! html
14070 <p style="/* insecure input */">A</p>
14071 <div style="/* insecure input */">B</div>
14072
14073 !! end
14074
14075 !! test
14076 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14077 !! wikitext
14078 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14079 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14080 !! html
14081 <div style="/* insecure input */">A</div>
14082 <p style="/* insecure input */">B</p>
14083
14084 !! end
14085
14086 !! test
14087 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14088 !! wikitext
14089 <div style="background-image:url⁽javascript:alert())">A</div>
14090 <div style="background-image:url₍javascript:alert())">B</div>
14091 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14092 !! html
14093 <div style="/* insecure input */">A</div>
14094 <div style="/* insecure input */">B</div>
14095 <p style="/* insecure input */">C</p>
14096
14097 !! end
14098
14099 !! test
14100 Opera -o-link CSS
14101 !! wikitext
14102 <div
14103 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;"
14104 style="-o-link:attr(title);-o-link-source:current">X</div>
14105 !! html
14106 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14107
14108 !! end
14109
14110 !! test
14111 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14112 !! wikitext
14113 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14114 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14115 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14116 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14117 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14118 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14119 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14120 !! html
14121 <p style="/* insecure input */">A</p>
14122 <p style="/* insecure input */">B</p>
14123 <p style="/* insecure input */">C</p>
14124 <p style="/* insecure input */">D</p>
14125 <p style="/* insecure input */">E</p>
14126 <p style="/* insecure input */">F</p>
14127 <p style="/* insecure input */">G</p>
14128
14129 !! end
14130
14131 !! test
14132 Table attribute legitimate extension
14133 !! wikitext
14134 {|
14135 !+ style="<nowiki>color:blue</nowiki>"| status
14136 |}
14137 !! html
14138 <table>
14139 <tr>
14140 <th style="color:blue"> status
14141 </th></tr></table>
14142
14143 !!end
14144
14145 !! test
14146 Table attribute safety
14147 !! wikitext
14148 {|
14149 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14150 |}
14151 !! html
14152 <table>
14153 <tr>
14154 <th style="/* insecure input */"> status
14155 </th></tr></table>
14156
14157 !! end
14158
14159 !! test
14160 CSS line continuation 1
14161 !! wikitext
14162 <div style="background-image: u\&#10;rl(test.jpg);"></div>
14163 !! html
14164 <div style="/* insecure input */"></div>
14165
14166 !! end
14167
14168 !! test
14169 CSS line continuation 2
14170 !! wikitext
14171 <div style="background-image: u\&#13;rl(test.jpg); "></div>
14172 !! html
14173 <div style="/* insecure input */"></div>
14174
14175 !! end
14176
14177 !! article
14178 Template:Identity
14179 !! text
14180 {{{1}}}
14181 !! endarticle
14182
14183 !! test
14184 Expansion of multi-line templates in attribute values (bug 6255)
14185 !! wikitext
14186 <div style="background: {{identity|#00FF00}}">-</div>
14187 !! html
14188 <div style="background: #00FF00">-</div>
14189
14190 !! end
14191
14192
14193 !! test
14194 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
14195 !! wikitext
14196 <div style="background:
14197 #00FF00">-</div>
14198 !! html/php
14199 <div style="background: #00FF00">-</div>
14200
14201 !! html/parsoid
14202 <div style="background:
14203 #00FF00">-</div>
14204 !! end
14205
14206 !! test
14207 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
14208 !! wikitext
14209 <div style="background: &#10;#00FF00">-</div>
14210 !! html
14211 <div style="background: &#10;#00FF00">-</div>
14212
14213 !! end
14214
14215 !! test
14216 evil <math>-wiki-tags without Extension:Math enabled
14217 !! wikitext
14218 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
14219 !! html+tidy
14220 <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>
14221 !! end
14222
14223 ###
14224 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
14225 ###
14226 !! test
14227 Parser hook: empty input
14228 !! wikitext
14229 <tag></tag>
14230 !! html
14231 <pre>
14232 ''
14233 array (
14234 )
14235 </pre>
14236
14237 !! end
14238
14239 !! test
14240 Parser hook: empty input using terminated empty elements
14241 !! wikitext
14242 <tag/>
14243 !! html
14244 <pre>
14245 NULL
14246 array (
14247 )
14248 </pre>
14249
14250 !! end
14251
14252 !! test
14253 Parser hook: empty input using terminated empty elements (space before)
14254 !! wikitext
14255 <tag />
14256 !! html
14257 <pre>
14258 NULL
14259 array (
14260 )
14261 </pre>
14262
14263 !! end
14264
14265 !! test
14266 Parser hook: basic input
14267 !! wikitext
14268 <tag>input</tag>
14269 !! html
14270 <pre>
14271 'input'
14272 array (
14273 )
14274 </pre>
14275
14276 !! end
14277
14278
14279 !! test
14280 Parser hook: case insensitive
14281 !! wikitext
14282 <TAG>input</TAG>
14283 !! html
14284 <pre>
14285 'input'
14286 array (
14287 )
14288 </pre>
14289
14290 !! end
14291
14292
14293 !! test
14294 Parser hook: case insensitive, redux
14295 !! wikitext
14296 <TaG>input</TAg>
14297 !! html
14298 <pre>
14299 'input'
14300 array (
14301 )
14302 </pre>
14303
14304 !! end
14305
14306 !! test
14307 Parser hook: nested tags
14308 !! options
14309 noxml
14310 !! wikitext
14311 <tag><tag></tag></tag>
14312 !! html
14313 <pre>
14314 '<tag>'
14315 array (
14316 )
14317 </pre>&lt;/tag&gt;
14318
14319 !! end
14320
14321 !! test
14322 Parser hook: basic arguments
14323 !! wikitext
14324 <tag width=200 height = "100" depth = '50' square></tag>
14325 !! html
14326 <pre>
14327 ''
14328 array (
14329 'width' => '200',
14330 'height' => '100',
14331 'depth' => '50',
14332 'square' => 'square',
14333 )
14334 </pre>
14335
14336 !! end
14337
14338 !! test
14339 Parser hook: argument containing a forward slash (bug 5344)
14340 !! wikitext
14341 <tag filename='/tmp/bla'></tag>
14342 !! html
14343 <pre>
14344 ''
14345 array (
14346 'filename' => '/tmp/bla',
14347 )
14348 </pre>
14349
14350 !! end
14351
14352 !! test
14353 Parser hook: empty input using terminated empty elements (bug 2374)
14354 !! wikitext
14355 <tag foo=bar/>text
14356 !! html
14357 <pre>
14358 NULL
14359 array (
14360 'foo' => 'bar',
14361 )
14362 </pre>text
14363
14364 !! end
14365
14366 # </tag> should be output literally since there is no matching tag that begins it
14367 !! test
14368 Parser hook: basic arguments using terminated empty elements (bug 2374)
14369 !! wikitext
14370 <tag width=200 height = "100" depth = '50' square/>
14371 other stuff
14372 </tag>
14373 !! html
14374 <pre>
14375 NULL
14376 array (
14377 'width' => '200',
14378 'height' => '100',
14379 'depth' => '50',
14380 'square' => 'square',
14381 )
14382 </pre>
14383 <p>other stuff
14384 &lt;/tag&gt;
14385 </p>
14386 !! end
14387
14388 ###
14389 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14390 ###
14391
14392 !! test
14393 Parser hook: static parser hook not inside a comment
14394 !! wikitext
14395 <statictag>hello, world</statictag>
14396 <statictag action=flush/>
14397 !! html
14398 <p>hello, world
14399 </p>
14400 !! end
14401
14402
14403 !! test
14404 Parser hook: static parser hook inside a comment
14405 !! wikitext
14406 <!-- <statictag>hello, world</statictag> -->
14407 <statictag action=flush/>
14408 !! html
14409 <p><br />
14410 </p>
14411 !! end
14412
14413 # Nested template calls; this case was broken by Parser.php rev 1.506,
14414 # since reverted.
14415
14416 !! article
14417 Template:One-parameter
14418 !! text
14419 (My parameter is: {{{1}}})
14420 !! endarticle
14421
14422 !! article
14423 Template:Map-one-parameter
14424 !! text
14425 {{{{{1}}}|{{{2}}}}}
14426 !! endarticle
14427
14428 !! test
14429 Nested template calls
14430 !! wikitext
14431 {{Map-one-parameter|One-parameter|param}}
14432 !! html
14433 <p>(My parameter is: param)
14434 </p>
14435 !! end
14436
14437
14438 ###
14439 ### Sanitizer
14440 ###
14441
14442 # HTML+Tidy effectively strips out the empty tags completely
14443 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
14444 # which Tidy would have done for the PHP parser had there been content inside it.
14445 !! test
14446 Sanitizer: Closing of open tags
14447 !! wikitext
14448 <s></s><table></table>
14449 !! html
14450 <s></s><table></table>
14451
14452 !! html/parsoid
14453 <p><s></s></p><table></table>
14454 !! end
14455
14456 !! test
14457 Sanitizer: Closing of open but not closed tags
14458 !! wikitext
14459 <s>foo
14460 !! html
14461 <p><s>foo</s>
14462 </p>
14463 !! end
14464
14465 !! test
14466 Sanitizer: Closing of closed but not open tags
14467 !! wikitext
14468 </s>
14469 !! html
14470 <p>&lt;/s&gt;
14471 </p>
14472 !! end
14473
14474 !! test
14475 Sanitizer: Closing of closed but not open table tags
14476 !! wikitext
14477 Table not started</td></tr></table>
14478 !! html
14479 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
14480 </p>
14481 !! end
14482
14483 !! test
14484 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
14485 !! wikitext
14486 <span id="æ: v">byte</span>[[#æ: v|backlink]]
14487 !! html
14488 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
14489 </p>
14490 !! end
14491
14492 # In HTML5, the restrictions are that id must contain at least one character,
14493 # and must not contain any space characters.
14494 !! test
14495 Sanitizer: Validating the contents of the id attribute (bug 4515)
14496 !! options
14497 disabled
14498 !! wikitext
14499 <br id="" /><br id="a space" />
14500 !! html
14501 Something ...
14502 !! end
14503
14504 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
14505 !! test
14506 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
14507 !! options
14508 disabled
14509 !! wikitext
14510 <br id="foo" /><br id="foo" />
14511 !! html
14512 Something need to be done. foo-2 ?
14513 !! end
14514
14515 !! test
14516 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
14517 !! wikitext
14518 <div itemscope>
14519 <meta itemprop="hello" content="world">
14520 <meta http-equiv="refresh" content="5">
14521 <meta itemprop="hello" http-equiv="refresh" content="5">
14522 <link itemprop="hello" href="{{SERVER}}">
14523 <link rel="stylesheet" href="{{SERVER}}">
14524 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
14525 </div>
14526 !! html
14527 <div itemscope="itemscope">
14528 <p> <meta itemprop="hello" content="world" />
14529 &lt;meta http-equiv="refresh" content="5"&gt;
14530 <meta itemprop="hello" content="5" />
14531 </p>
14532 <link itemprop="hello" href="http&#58;//example.org" />
14533 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
14534 <link itemprop="hello" href="http&#58;//example.org" />
14535 </div>
14536
14537 !! end
14538
14539 !! test
14540 Language converter: output gets cut off unexpectedly (bug 5757)
14541 !! options
14542 language=zh
14543 !! wikitext
14544 this bit is safe: }-
14545
14546 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
14547
14548 then we get cut off here: }-
14549
14550 all additional text is vanished
14551 !! html
14552 <p>this bit is safe: }-
14553 </p><p>but if we add a conversion instance: xxx
14554 </p><p>then we get cut off here: }-
14555 </p><p>all additional text is vanished
14556 </p>
14557 !! end
14558
14559 !! test
14560 Self closed html pairs (bug 5487)
14561 !! options
14562 !! wikitext
14563 <center><font id="bug" />Centered text</center>
14564 <div><font id="bug2" />In div text</div>
14565 !! html
14566 <center>&lt;font id="bug" /&gt;Centered text</center>
14567 <div>&lt;font id="bug2" /&gt;In div text</div>
14568
14569 !! end
14570
14571 #
14572 #
14573 #
14574
14575 !! test
14576 Punctuation: nbsp before exclamation
14577 !! wikitext
14578 C'est grave !
14579 !! html
14580 <p>C'est grave&#160;!
14581 </p>
14582 !! end
14583
14584 !! test
14585 Punctuation: CSS !important (bug 11874)
14586 !! wikitext
14587 <div style="width:50% !important">important</div>
14588 !! html
14589 <div style="width:50% !important">important</div>
14590
14591 !!end
14592
14593 !! test
14594 Punctuation: CSS ! important (bug 11874; with space after)
14595 !! wikitext
14596 <div style="width:50% ! important">important</div>
14597 !! html
14598 <div style="width:50% ! important">important</div>
14599
14600 !!end
14601
14602
14603 !! test
14604 HTML bullet list, closed tags (bug 5497)
14605 !! wikitext
14606 <ul>
14607 <li>One</li>
14608 <li>Two</li>
14609 </ul>
14610 !! html/php
14611 <ul>
14612 <li>One</li>
14613 <li>Two</li>
14614 </ul>
14615
14616 !! html/parsoid
14617 <ul data-parsoid='{"stx":"html"}'>
14618 <li data-parsoid='{"stx":"html"}'>One</li>
14619 <li data-parsoid='{"stx":"html"}'>Two</li>
14620 </ul>
14621
14622 !! end
14623
14624 !! test
14625 HTML bullet list, unclosed tags (bug 5497)
14626 !! wikitext
14627 <ul>
14628 <li>One
14629 <li>Two
14630 </ul>
14631 !! html/php+tidy
14632 <ul>
14633 <li>One</li>
14634 <li>Two</li>
14635 </ul>
14636 !! html/parsoid
14637 <ul data-parsoid='{"stx":"html"}'>
14638 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
14639 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
14640 </ul>
14641
14642 !! end
14643
14644 !! test
14645 HTML ordered list, closed tags (bug 5497)
14646 !! wikitext
14647 <ol>
14648 <li>One</li>
14649 <li>Two</li>
14650 </ol>
14651 !! html/php
14652 <ol>
14653 <li>One</li>
14654 <li>Two</li>
14655 </ol>
14656
14657 !! html/parsoid
14658 <ol data-parsoid='{"stx":"html"}'>
14659 <li data-parsoid='{"stx":"html"}'>One</li>
14660 <li data-parsoid='{"stx":"html"}'>Two</li>
14661 </ol>
14662
14663 !! end
14664
14665 !! test
14666 HTML ordered list, unclosed tags (bug 5497)
14667 !! options
14668 !! wikitext
14669 <ol>
14670 <li>One
14671 <li>Two
14672 </ol>
14673 !! html/php+tidy
14674 <ol>
14675 <li>One</li>
14676 <li>Two</li>
14677 </ol>
14678 !! html/parsoid
14679 <ol data-parsoid='{"stx":"html"}'>
14680 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
14681 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
14682 </ol>
14683
14684 !! end
14685
14686 !! test
14687 HTML nested bullet list, closed tags (bug 5497)
14688 !! wikitext
14689 <ul>
14690 <li>One</li>
14691 <li>Two:
14692 <ul>
14693 <li>Sub-one</li>
14694 <li>Sub-two</li>
14695 </ul>
14696 </li>
14697 </ul>
14698 !! html
14699 <ul>
14700 <li>One</li>
14701 <li>Two:
14702 <ul>
14703 <li>Sub-one</li>
14704 <li>Sub-two</li>
14705 </ul>
14706 </li>
14707 </ul>
14708
14709 !! end
14710
14711 !! test
14712 HTML nested bullet list, open tags (bug 5497)
14713 !! wikitext
14714 <ul>
14715 <li>One
14716 <li>Two:
14717 <ul>
14718 <li>Sub-one
14719 <li>Sub-two
14720 </ul>
14721 </ul>
14722 !! html/php+tidy
14723 <ul>
14724 <li>One</li>
14725 <li>Two:
14726 <ul>
14727 <li>Sub-one</li>
14728 <li>Sub-two</li>
14729 </ul>
14730 </li>
14731 </ul>
14732 !! html/parsoid
14733 <ul>
14734 <li>One
14735 </li>
14736 <li>Two:
14737 <ul>
14738 <li>Sub-one
14739 </li>
14740 <li>Sub-two
14741 </li>
14742 </ul>
14743 </li>
14744 </ul>
14745
14746 !! end
14747
14748 !! test
14749 HTML nested ordered list, closed tags (bug 5497)
14750 !! wikitext
14751 <ol>
14752 <li>One</li>
14753 <li>Two:
14754 <ol>
14755 <li>Sub-one</li>
14756 <li>Sub-two</li>
14757 </ol>
14758 </li>
14759 </ol>
14760 !! html
14761 <ol>
14762 <li>One</li>
14763 <li>Two:
14764 <ol>
14765 <li>Sub-one</li>
14766 <li>Sub-two</li>
14767 </ol>
14768 </li>
14769 </ol>
14770
14771 !! end
14772
14773 !! test
14774 HTML nested ordered list, open tags (bug 5497)
14775 !! wikitext
14776 <ol>
14777 <li>One
14778 <li>Two:
14779 <ol>
14780 <li>Sub-one
14781 <li>Sub-two
14782 </ol>
14783 </ol>
14784 !! html/php
14785 <ol>
14786 <li>One
14787 <li>Two:
14788 <ol>
14789 <li>Sub-one
14790 <li>Sub-two
14791 </ol>
14792 </ol>
14793
14794 !! html/parsoid
14795 <ol>
14796 <li>One
14797 </li>
14798 <li>Two:
14799 <ol>
14800 <li>Sub-one
14801 </li>
14802 <li>Sub-two
14803 </li>
14804 </ol>
14805 </li>
14806 </ol>
14807
14808 !! end
14809
14810 !! test
14811 HTML ordered list item with parameters oddity
14812 !! wikitext
14813 <ol><li id="fragment">One</li>
14814 </ol>
14815 !! html
14816 <ol><li id="fragment">One</li>
14817 </ol>
14818
14819 !! end
14820
14821 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
14822 !!test
14823 bug 5918: autonumbering
14824 !! wikitext
14825 [http://first/] [http://second] [ftp://ftp]
14826
14827 ftp://inlineftp
14828
14829 [mailto:enclosed@mail.tld With target]
14830
14831 [mailto:enclosed@mail.tld]
14832
14833 mailto:inline@mail.tld
14834 !! html/php
14835 <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>
14836 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
14837 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
14838 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
14839 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
14840 </p>
14841 !! html/parsoid
14842 <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>
14843 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
14844 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
14845 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
14846 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
14847 !! end
14848
14849
14850 #
14851 # Security and HTML correctness
14852 # From Nick Jenkins' fuzz testing
14853 #
14854
14855 !! test
14856 Fuzz testing: Parser13
14857 !! wikitext
14858 {|
14859 | http://a|
14860 !! html
14861 <table>
14862 <tr>
14863 <td>
14864 </td>
14865 </tr>
14866 </table>
14867
14868 !! end
14869
14870 !! test
14871 Fuzz testing: Parser14
14872 !! wikitext
14873 == onmouseover= ==
14874 http://__TOC__
14875 !! html
14876 <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>
14877 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14878 <ul>
14879 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
14880 </ul>
14881 </div>
14882
14883
14884 !! html+tidy
14885 <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>
14886 <p>http://</p>
14887 <div id="toc" class="toc">
14888 <div id="toctitle">
14889 <h2>Contents</h2>
14890 </div>
14891 <ul>
14892 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
14893 </ul>
14894 </div>
14895 !! end
14896
14897 !! test
14898 Fuzz testing: Parser14-table
14899 !! wikitext
14900 ==a==
14901 {| STYLE=__TOC__
14902 !! html
14903 <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>
14904 <table style="&#95;_TOC&#95;_">
14905 <tr><td></td></tr>
14906 </table>
14907
14908 !! html+tidy
14909 <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>
14910 <table style="__TOC__">
14911 <tr>
14912 <td></td>
14913 </tr>
14914 </table>
14915 !! end
14916
14917 # Known to produce bogus xml (extra </td>)
14918 !! test
14919 Fuzz testing: Parser16
14920 !! options
14921 noxml
14922 !! wikitext
14923 {|
14924 !https://||||||
14925 !! html
14926 <table>
14927 <tr>
14928 <th>https://</th>
14929 <th></th>
14930 <th></th>
14931 <th>
14932 </td>
14933 </tr>
14934 </table>
14935
14936 !! html+tidy
14937 <table>
14938 <tr>
14939 <th>https://</th>
14940 <th></th>
14941 <th></th>
14942 <th></th>
14943 </tr>
14944 </table>
14945 !! end
14946
14947 !! test
14948 Fuzz testing: Parser21
14949 !! wikitext
14950 {|
14951 ! irc://{{ftp://a" onmouseover="alert('hello world');"
14952 |
14953 !! html
14954 <table>
14955 <tr>
14956 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
14957 </th>
14958 <td>
14959 </td>
14960 </tr>
14961 </table>
14962
14963 !! end
14964
14965 !! test
14966 Fuzz testing: Parser22
14967 !! wikitext
14968 http://===r:::https://b
14969
14970 {|
14971 !! html
14972 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
14973 </p>
14974 <table>
14975 <tr><td></td></tr>
14976 </table>
14977
14978 !! end
14979
14980 # Known to produce bad XML for now
14981 !! test
14982 Fuzz testing: Parser24
14983 !! options
14984 noxml
14985 !! wikitext
14986 {|
14987 {{{|
14988 <u CLASS=
14989 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
14990 <br style="onmouseover='alert(document.cookie);' " />
14991
14992 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14993 |
14994 !! html
14995 <table>
14996 {{{|
14997 <u class="&#124;">}}}} &gt;
14998 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
14999
15000 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15001 <tr>
15002 <td></u>
15003 </td>
15004 </tr>
15005 </table>
15006
15007 !! end
15008
15009 # Note: the current result listed for this is not what the original one was,
15010 # but the original bug was JavaScript injection, which is fixed in any case.
15011 # It's not clear that the original result listed was any more correct than the
15012 # current one. Original result:
15013 # <p>{{{|
15014 # </p>
15015 # <li class="&#124;&#124;">
15016 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15017 !!test
15018 Fuzz testing: Parser25 (bug 6055)
15019 !! wikitext
15020 {{{
15021 |
15022 <LI CLASS=||
15023 >
15024 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15025 !! html
15026 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15027 </p>
15028 !! end
15029
15030 !!test
15031 Fuzz testing: URL adjacent extension (with space, clean)
15032 !! wikitext
15033 http://example.com <nowiki>junk</nowiki>
15034 !! html
15035 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15036 </p>
15037 !!end
15038
15039 !!test
15040 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15041 !! wikitext
15042 http://example.com<nowiki>junk</nowiki>
15043 !! html
15044 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15045 </p>
15046 !!end
15047
15048 !!test
15049 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15050 !! wikitext
15051 http://example.com<pre>junk</pre>
15052 !! html
15053 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15054
15055 !! html+tidy
15056 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15057 <pre>
15058 junk
15059 </pre>
15060 !!end
15061
15062 !!test
15063 Fuzz testing: image with bogus manual thumbnail
15064 !! wikitext
15065 [[Image:foobar.jpg|thumbnail= ]]
15066 !! html/php
15067 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
15068
15069 !! html/parsoid
15070 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}'/>
15071 !!end
15072
15073 !! test
15074 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15075 !! wikitext
15076 <pre dir="&#10;"></pre>
15077 !! html
15078 <pre dir="&#10;"></pre>
15079
15080 !! end
15081
15082 !! test
15083 Parsing optional HTML elements (Bug 6171)
15084 !! options
15085 !! wikitext
15086 <table>
15087 <tr>
15088 <td> Some tabular data</td>
15089 <td> More tabular data ...
15090 <td> And yet som tabular data</td>
15091 </tr>
15092 </table>
15093 !! html
15094 <table>
15095 <tr>
15096 <td> Some tabular data</td>
15097 <td> More tabular data ...
15098 </td><td> And yet som tabular data</td>
15099 </tr>
15100 </table>
15101
15102 !! end
15103
15104 !! test
15105 Correct handling of <td>, <tr> (Bug 6171)
15106 !! options
15107 !! wikitext
15108 <table>
15109 <tr>
15110 <td> Some tabular data</td>
15111 <td> More tabular data ...</td>
15112 <td> And yet som tabular data</td>
15113 </tr>
15114 </table>
15115 !! html
15116 <table>
15117 <tr>
15118 <td> Some tabular data</td>
15119 <td> More tabular data ...</td>
15120 <td> And yet som tabular data</td>
15121 </tr>
15122 </table>
15123
15124 !! end
15125
15126
15127 !! test
15128 Parsing crashing regression (fr:JavaScript)
15129 !! wikitext
15130 </body></x>
15131 !! html
15132 <p>&lt;/body&gt;&lt;/x&gt;
15133 </p>
15134 !! end
15135
15136 !! test
15137 Inline wiki vs wiki block nesting
15138 !! wikitext
15139 '''Bold paragraph
15140
15141 New wiki paragraph
15142 !! html
15143 <p><b>Bold paragraph</b>
15144 </p><p>New wiki paragraph
15145 </p>
15146 !! end
15147
15148 # FIXME: The current php output is documented
15149 # and desired output is the parsoid target.
15150 !! test
15151 Inline HTML vs wiki block nesting
15152 !! wikitext
15153 <b>Bold paragraph
15154
15155 New wiki paragraph
15156 !! html/php
15157 <p><b>Bold paragraph
15158 </p><p>New wiki paragraph</b>
15159 </p>
15160 !! html/parsoid
15161 <p><b>Bold paragraph</b>
15162 </p><p>New wiki paragraph
15163 </p>
15164 !! end
15165
15166 # Original result was this:
15167 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
15168 # </p>
15169 # While that might be marginally more intuitive, maybe, the six-apostrophe
15170 # construct is clearly pathological and the result stated here (which is what
15171 # the parser actually does) is about as reasonable as anything.
15172 !!test
15173 Mixing markup for italics and bold
15174 !! options
15175 !! wikitext
15176 '''bold''''''bold''bolditalics'''''
15177 !! html
15178 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
15179 </p>
15180 !! end
15181
15182
15183 !! article
15184 Xyzzyx
15185 !! text
15186 Article for special page transclusion test
15187 !! endarticle
15188
15189 !! test
15190 Special page transclusion
15191 !! options
15192 !! wikitext
15193 {{Special:Prefixindex/Xyzzyx}}
15194 !! html
15195 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15196
15197 !! end
15198
15199 !! test
15200 Special page transclusion twice (bug 5021)
15201 !! options
15202 !! wikitext
15203 {{Special:Prefixindex/Xyzzyx}}
15204 {{Special:Prefixindex/Xyzzyx}}
15205 !! html
15206 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15207 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15208
15209 !! end
15210
15211 !! test
15212 Transclusion of default MediaWiki message
15213 !! wikitext
15214 {{MediaWiki:Mainpage}}
15215 !! html
15216 <p>Main Page
15217 </p>
15218 !! end
15219
15220 !! test
15221 Transclusion of nonexistent MediaWiki message
15222 !! wikitext
15223 {{MediaWiki:Mainpagexxx}}
15224 !! html
15225 <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>
15226 </p>
15227 !! end
15228
15229 !! test
15230 Transclusion of MediaWiki message with underscore
15231 !! wikitext
15232 {{MediaWiki:history_short}}
15233 !! html
15234 <p>History
15235 </p>
15236 !! end
15237
15238 !! test
15239 Transclusion of MediaWiki message with space
15240 !! wikitext
15241 {{MediaWiki:history short}}
15242 !! html
15243 <p>History
15244 </p>
15245 !! end
15246
15247 !! test
15248 Invalid header with following text
15249 !! wikitext
15250 = x = y
15251 !! html
15252 <p>= x = y
15253 </p>
15254 !! end
15255
15256
15257 !! test
15258 Section extraction test (section 0)
15259 !! options
15260 section=0
15261 !! wikitext
15262 start
15263 ==a==
15264 ===aa===
15265 ====aaa====
15266 ==b==
15267 ===ba===
15268 ===bb===
15269 ====bba====
15270 ===bc===
15271 ==c==
15272 ===ca===
15273 !! html
15274 start
15275 !! end
15276
15277 !! test
15278 Section extraction test (section 1)
15279 !! options
15280 section=1
15281 !! wikitext
15282 start
15283 ==a==
15284 ===aa===
15285 ====aaa====
15286 ==b==
15287 ===ba===
15288 ===bb===
15289 ====bba====
15290 ===bc===
15291 ==c==
15292 ===ca===
15293 !! html
15294 ==a==
15295 ===aa===
15296 ====aaa====
15297 !! end
15298
15299 !! test
15300 Section extraction test (section 2)
15301 !! options
15302 section=2
15303 !! wikitext
15304 start
15305 ==a==
15306 ===aa===
15307 ====aaa====
15308 ==b==
15309 ===ba===
15310 ===bb===
15311 ====bba====
15312 ===bc===
15313 ==c==
15314 ===ca===
15315 !! html
15316 ===aa===
15317 ====aaa====
15318 !! end
15319
15320 !! test
15321 Section extraction test (section 3)
15322 !! options
15323 section=3
15324 !! wikitext
15325 start
15326 ==a==
15327 ===aa===
15328 ====aaa====
15329 ==b==
15330 ===ba===
15331 ===bb===
15332 ====bba====
15333 ===bc===
15334 ==c==
15335 ===ca===
15336 !! html
15337 ====aaa====
15338 !! end
15339
15340 !! test
15341 Section extraction test (section 4)
15342 !! options
15343 section=4
15344 !! wikitext
15345 start
15346 ==a==
15347 ===aa===
15348 ====aaa====
15349 ==b==
15350 ===ba===
15351 ===bb===
15352 ====bba====
15353 ===bc===
15354 ==c==
15355 ===ca===
15356 !! html
15357 ==b==
15358 ===ba===
15359 ===bb===
15360 ====bba====
15361 ===bc===
15362 !! end
15363
15364 !! test
15365 Section extraction test (section 5)
15366 !! options
15367 section=5
15368 !! wikitext
15369 start
15370 ==a==
15371 ===aa===
15372 ====aaa====
15373 ==b==
15374 ===ba===
15375 ===bb===
15376 ====bba====
15377 ===bc===
15378 ==c==
15379 ===ca===
15380 !! html
15381 ===ba===
15382 !! end
15383
15384 !! test
15385 Section extraction test (section 6)
15386 !! options
15387 section=6
15388 !! wikitext
15389 start
15390 ==a==
15391 ===aa===
15392 ====aaa====
15393 ==b==
15394 ===ba===
15395 ===bb===
15396 ====bba====
15397 ===bc===
15398 ==c==
15399 ===ca===
15400 !! html
15401 ===bb===
15402 ====bba====
15403 !! end
15404
15405 !! test
15406 Section extraction test (section 7)
15407 !! options
15408 section=7
15409 !! wikitext
15410 start
15411 ==a==
15412 ===aa===
15413 ====aaa====
15414 ==b==
15415 ===ba===
15416 ===bb===
15417 ====bba====
15418 ===bc===
15419 ==c==
15420 ===ca===
15421 !! html
15422 ====bba====
15423 !! end
15424
15425 !! test
15426 Section extraction test (section 8)
15427 !! options
15428 section=8
15429 !! wikitext
15430 start
15431 ==a==
15432 ===aa===
15433 ====aaa====
15434 ==b==
15435 ===ba===
15436 ===bb===
15437 ====bba====
15438 ===bc===
15439 ==c==
15440 ===ca===
15441 !! html
15442 ===bc===
15443 !! end
15444
15445 !! test
15446 Section extraction test (section 9)
15447 !! options
15448 section=9
15449 !! wikitext
15450 start
15451 ==a==
15452 ===aa===
15453 ====aaa====
15454 ==b==
15455 ===ba===
15456 ===bb===
15457 ====bba====
15458 ===bc===
15459 ==c==
15460 ===ca===
15461 !! html
15462 ==c==
15463 ===ca===
15464 !! end
15465
15466 !! test
15467 Section extraction test (section 10)
15468 !! options
15469 section=10
15470 !! wikitext
15471 start
15472 ==a==
15473 ===aa===
15474 ====aaa====
15475 ==b==
15476 ===ba===
15477 ===bb===
15478 ====bba====
15479 ===bc===
15480 ==c==
15481 ===ca===
15482 !! html
15483 ===ca===
15484 !! end
15485
15486 !! test
15487 Section extraction test (nonexistent section 11)
15488 !! options
15489 section=11
15490 !! wikitext
15491 start
15492 ==a==
15493 ===aa===
15494 ====aaa====
15495 ==b==
15496 ===ba===
15497 ===bb===
15498 ====bba====
15499 ===bc===
15500 ==c==
15501 ===ca===
15502 !! html
15503 !! end
15504
15505 !! test
15506 Section extraction test with bogus heading (section 1)
15507 !! options
15508 section=1
15509 !! wikitext
15510 ==a==
15511 ==bogus== not a legal section
15512 ==b==
15513 !! html
15514 ==a==
15515 ==bogus== not a legal section
15516 !! end
15517
15518 !! test
15519 Section extraction test with bogus heading (section 2)
15520 !! options
15521 section=2
15522 !! wikitext
15523 ==a==
15524 ==bogus== not a legal section
15525 ==b==
15526 !! html
15527 ==b==
15528 !! end
15529
15530 !! test
15531 Section extraction test with comment after heading (section 1)
15532 !! options
15533 section=1
15534 !! wikitext
15535 ==a==
15536 ==b== <!-- -->
15537 ==c==
15538 !! html
15539 ==a==
15540 !! end
15541
15542 !! test
15543 Section extraction test with comment after heading (section 2)
15544 !! options
15545 section=2
15546 !! wikitext
15547 ==a==
15548 ==b== <!-- -->
15549 ==c==
15550 !! html
15551 ==b== <!-- -->
15552 !! end
15553
15554 !! test
15555 Section extraction test with bogus <nowiki> heading (section 1)
15556 !! options
15557 section=1
15558 !! wikitext
15559 ==a==
15560 ==bogus== <nowiki>not a legal section</nowiki>
15561 ==b==
15562 !! html
15563 ==a==
15564 ==bogus== <nowiki>not a legal section</nowiki>
15565 !! end
15566
15567 !! test
15568 Section extraction test with bogus <nowiki> heading (section 2)
15569 !! options
15570 section=2
15571 !! wikitext
15572 ==a==
15573 ==bogus== <nowiki>not a legal section</nowiki>
15574 ==b==
15575 !! html
15576 ==b==
15577 !! end
15578
15579
15580 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
15581 # instead of respecting commented sections
15582 !! test
15583 Section extraction prefixed by comment (section 1)
15584 !! options
15585 section=1
15586 !! wikitext
15587 <!-- -->==sec1==
15588 ==sec2==
15589 !! html
15590 ==sec2==
15591 !!end
15592
15593 !! test
15594 Section extraction prefixed by comment (section 2)
15595 !! options
15596 section=2
15597 !! wikitext
15598 <!-- -->==sec1==
15599 ==sec2==
15600 !! html
15601
15602 !!end
15603
15604
15605 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
15606 # instead of respecting HTML-style headings
15607 !! test
15608 Section extraction, mixed wiki and html (section 1)
15609 !! options
15610 section=1
15611 !! wikitext
15612 <h2>unmarked</h2>
15613 unmarked
15614 ==1==
15615 one
15616 ==2==
15617 two
15618 !! html
15619 ==1==
15620 one
15621 !! end
15622
15623 !! test
15624 Section extraction, mixed wiki and html (section 2)
15625 !! options
15626 section=2
15627 !! wikitext
15628 <h2>unmarked</h2>
15629 unmarked
15630 ==1==
15631 one
15632 ==2==
15633 two
15634 !! html
15635 ==2==
15636 two
15637 !! end
15638
15639
15640 # Formerly testing for bug 3342
15641 !! test
15642 Section extraction, heading surrounded by <noinclude>
15643 !! options
15644 section=1
15645 !! wikitext
15646 <noinclude>==unmarked==</noinclude>
15647 ==marked==
15648 !! html
15649 ==marked==
15650 !!end
15651
15652 # Test behavior of bug 19910
15653 !! test
15654 Sectiion with all-equals
15655 !! options
15656 section=2
15657 !! wikitext
15658 ===
15659 The line above must have a trailing space
15660 === <!--
15661 --> <!-- -->
15662 But just in case it doesn't...
15663 !! html
15664 === <!--
15665 --> <!-- -->
15666 But just in case it doesn't...
15667 !! end
15668
15669 !! test
15670 Section replacement test (section 0)
15671 !! options
15672 replace=0,"xxx"
15673 !! wikitext
15674 start
15675 ==a==
15676 ===aa===
15677 ====aaa====
15678 ==b==
15679 ===ba===
15680 ===bb===
15681 ====bba====
15682 ===bc===
15683 ==c==
15684 ===ca===
15685 !! html
15686 xxx
15687
15688 ==a==
15689 ===aa===
15690 ====aaa====
15691 ==b==
15692 ===ba===
15693 ===bb===
15694 ====bba====
15695 ===bc===
15696 ==c==
15697 ===ca===
15698 !! end
15699
15700 !! test
15701 Section replacement test (section 1)
15702 !! options
15703 replace=1,"xxx"
15704 !! wikitext
15705 start
15706 ==a==
15707 ===aa===
15708 ====aaa====
15709 ==b==
15710 ===ba===
15711 ===bb===
15712 ====bba====
15713 ===bc===
15714 ==c==
15715 ===ca===
15716 !! html
15717 start
15718 xxx
15719
15720 ==b==
15721 ===ba===
15722 ===bb===
15723 ====bba====
15724 ===bc===
15725 ==c==
15726 ===ca===
15727 !! end
15728
15729 !! test
15730 Section replacement test (section 2)
15731 !! options
15732 replace=2,"xxx"
15733 !! wikitext
15734 start
15735 ==a==
15736 ===aa===
15737 ====aaa====
15738 ==b==
15739 ===ba===
15740 ===bb===
15741 ====bba====
15742 ===bc===
15743 ==c==
15744 ===ca===
15745 !! html
15746 start
15747 ==a==
15748 xxx
15749
15750 ==b==
15751 ===ba===
15752 ===bb===
15753 ====bba====
15754 ===bc===
15755 ==c==
15756 ===ca===
15757 !! end
15758
15759 !! test
15760 Section replacement test (section 3)
15761 !! options
15762 replace=3,"xxx"
15763 !! wikitext
15764 start
15765 ==a==
15766 ===aa===
15767 ====aaa====
15768 ==b==
15769 ===ba===
15770 ===bb===
15771 ====bba====
15772 ===bc===
15773 ==c==
15774 ===ca===
15775 !! html
15776 start
15777 ==a==
15778 ===aa===
15779 xxx
15780
15781 ==b==
15782 ===ba===
15783 ===bb===
15784 ====bba====
15785 ===bc===
15786 ==c==
15787 ===ca===
15788 !! end
15789
15790 !! test
15791 Section replacement test (section 4)
15792 !! options
15793 replace=4,"xxx"
15794 !! wikitext
15795 start
15796 ==a==
15797 ===aa===
15798 ====aaa====
15799 ==b==
15800 ===ba===
15801 ===bb===
15802 ====bba====
15803 ===bc===
15804 ==c==
15805 ===ca===
15806 !! html
15807 start
15808 ==a==
15809 ===aa===
15810 ====aaa====
15811 xxx
15812
15813 ==c==
15814 ===ca===
15815 !! end
15816
15817 !! test
15818 Section replacement test (section 5)
15819 !! options
15820 replace=5,"xxx"
15821 !! wikitext
15822 start
15823 ==a==
15824 ===aa===
15825 ====aaa====
15826 ==b==
15827 ===ba===
15828 ===bb===
15829 ====bba====
15830 ===bc===
15831 ==c==
15832 ===ca===
15833 !! html
15834 start
15835 ==a==
15836 ===aa===
15837 ====aaa====
15838 ==b==
15839 xxx
15840
15841 ===bb===
15842 ====bba====
15843 ===bc===
15844 ==c==
15845 ===ca===
15846 !! end
15847
15848 !! test
15849 Section replacement test (section 6)
15850 !! options
15851 replace=6,"xxx"
15852 !! wikitext
15853 start
15854 ==a==
15855 ===aa===
15856 ====aaa====
15857 ==b==
15858 ===ba===
15859 ===bb===
15860 ====bba====
15861 ===bc===
15862 ==c==
15863 ===ca===
15864 !! html
15865 start
15866 ==a==
15867 ===aa===
15868 ====aaa====
15869 ==b==
15870 ===ba===
15871 xxx
15872
15873 ===bc===
15874 ==c==
15875 ===ca===
15876 !! end
15877
15878 !! test
15879 Section replacement test (section 7)
15880 !! options
15881 replace=7,"xxx"
15882 !! wikitext
15883 start
15884 ==a==
15885 ===aa===
15886 ====aaa====
15887 ==b==
15888 ===ba===
15889 ===bb===
15890 ====bba====
15891 ===bc===
15892 ==c==
15893 ===ca===
15894 !! html
15895 start
15896 ==a==
15897 ===aa===
15898 ====aaa====
15899 ==b==
15900 ===ba===
15901 ===bb===
15902 xxx
15903
15904 ===bc===
15905 ==c==
15906 ===ca===
15907 !! end
15908
15909 !! test
15910 Section replacement test (section 8)
15911 !! options
15912 replace=8,"xxx"
15913 !! wikitext
15914 start
15915 ==a==
15916 ===aa===
15917 ====aaa====
15918 ==b==
15919 ===ba===
15920 ===bb===
15921 ====bba====
15922 ===bc===
15923 ==c==
15924 ===ca===
15925 !! html
15926 start
15927 ==a==
15928 ===aa===
15929 ====aaa====
15930 ==b==
15931 ===ba===
15932 ===bb===
15933 ====bba====
15934 xxx
15935
15936 ==c==
15937 ===ca===
15938 !!end
15939
15940 !! test
15941 Section replacement test (section 9)
15942 !! options
15943 replace=9,"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 ====bba====
15965 ===bc===
15966 xxx
15967 !! end
15968
15969 !! test
15970 Section replacement test (section 10)
15971 !! options
15972 replace=10,"xxx"
15973 !! wikitext
15974 start
15975 ==a==
15976 ===aa===
15977 ====aaa====
15978 ==b==
15979 ===ba===
15980 ===bb===
15981 ====bba====
15982 ===bc===
15983 ==c==
15984 ===ca===
15985 !! html
15986 start
15987 ==a==
15988 ===aa===
15989 ====aaa====
15990 ==b==
15991 ===ba===
15992 ===bb===
15993 ====bba====
15994 ===bc===
15995 ==c==
15996 xxx
15997 !! end
15998
15999 !! test
16000 Section replacement test with initial whitespace (bug 13728)
16001 !! options
16002 replace=2,"xxx"
16003 !! wikitext
16004 Preformatted initial line
16005 ==a==
16006 ===a===
16007 !! html
16008 Preformatted initial line
16009 ==a==
16010 xxx
16011 !! end
16012
16013
16014 !! test
16015 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16016 !! options
16017 section=1
16018 !! wikitext
16019 ==a==
16020 a
16021 !! html
16022 ==a==
16023 a
16024 !! end
16025
16026 !! test
16027 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16028 !! options
16029 section=1
16030 !! wikitext
16031 ==a==
16032 a
16033 !! html
16034 ==a==
16035 a
16036 !! end
16037
16038
16039 !! test
16040 Section extraction, <pre> around bogus header (bug 10309)
16041 !! options
16042 noxml section=2
16043 !! wikitext
16044 == Section One ==
16045 <pre>
16046 =======
16047 </pre>
16048
16049 == Section Two ==
16050 stuff
16051 !! html
16052 == Section Two ==
16053 stuff
16054 !! end
16055
16056 !! test
16057 Section replacement, <pre> around bogus header (bug 10309)
16058 !! options
16059 noxml replace=2,"xxx"
16060 !! wikitext
16061 == Section One ==
16062 <pre>
16063 =======
16064 </pre>
16065
16066 == Section Two ==
16067 stuff
16068 !! html
16069 == Section One ==
16070 <pre>
16071 =======
16072 </pre>
16073
16074 xxx
16075 !! end
16076
16077
16078
16079 !! test
16080 Handling of &#x0A; in URLs
16081 !! wikitext
16082 ** irc://&#x0A;a
16083 !! html/php
16084 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16085
16086 !! html/parsoid
16087 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16088 a">irc://
16089 a</a></li></ul></li></ul>
16090 !! end
16091
16092 !! test
16093 Handling of %0A in URLs
16094 !! wikitext
16095 ** irc://%0Aa
16096 !! html/php
16097 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16098
16099 !! html/parsoid
16100 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16101 !! end
16102
16103
16104 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16105 !! test
16106 5 quotes, code coverage +1 line
16107 !! options
16108 parsoid=wt2html
16109 !! wikitext
16110 '''''
16111 !! html/php
16112 !! html/parsoid
16113 <p><b><i></i></b></p>
16114 !! end
16115
16116 # same html as previous, but wikitext adjusted to match parsoid html2wt
16117 # note that wt2html and html2html will put the <i> before the <b>
16118 !! test
16119 5 quotes, code coverage +1 line w/ nowiki (1)
16120 !! options
16121 parsoid=wt2wt,html2wt
16122 !! wikitext
16123 '''''<nowiki/>'''''
16124 !! html/php
16125 <p><i></i>
16126 </p>
16127 !! html/parsoid
16128 <p><b><i></i></b></p>
16129 !! end
16130
16131 # same as previous, just swapping the <i> and <b>
16132 !! test
16133 5 quotes, code coverage +1 line w/ nowiki (2)
16134 !! wikitext
16135 '''''<nowiki/>'''''
16136 !! html/php
16137 <p><i></i>
16138 </p>
16139 !! html/parsoid
16140 <p><i><b></b></i></p>
16141 !! end
16142
16143 !! test
16144 Special:Search page linking.
16145 !! wikitext
16146 {{Special:search}}
16147 !! html
16148 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16149 </p>
16150 !! end
16151
16152 !! test
16153 {{!}} is a magic word
16154 !! wikitext
16155 {{!}} is a magic word there and {{!}} is still a magic word here
16156 !! html/php
16157 <p>| is a magic word there and | is still a magic word here
16158 </p>
16159 !! html/parsoid
16160 <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>
16161 !! end
16162
16163 !! test
16164 Say the magic word
16165 !! options
16166 title=[[Parser test]]
16167 !! wikitext
16168 * {{PAGENAME}}
16169 * {{PAGENAMEE}}
16170 * {{FULLPAGENAME}}
16171 * {{FULLPAGENAMEE}}
16172 * {{BASEPAGENAME}}
16173 * {{BASEPAGENAMEE}}
16174 * {{SUBPAGENAME}}
16175 * {{SUBPAGENAMEE}}
16176 * {{ROOTPAGENAME}}
16177 * {{ROOTPAGENAMEE}}
16178 * {{TALKPAGENAME}}
16179 * {{TALKPAGENAMEE}}
16180 * {{SUBJECTPAGENAME}}
16181 * {{SUBJECTPAGENAMEE}}
16182 * {{NAMESPACEE}}
16183 * {{NAMESPACE}}
16184 * {{NAMESPACENUMBER}}
16185 * {{TALKSPACE}}
16186 * {{TALKSPACEE}}
16187 * {{SUBJECTSPACE}}
16188 * {{SUBJECTSPACEE}}
16189 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
16190 !! html
16191 <ul><li> Parser test</li>
16192 <li> Parser_test</li>
16193 <li> Parser test</li>
16194 <li> Parser_test</li>
16195 <li> Parser test</li>
16196 <li> Parser_test</li>
16197 <li> Parser test</li>
16198 <li> Parser_test</li>
16199 <li> Parser test</li>
16200 <li> Parser_test</li>
16201 <li> Talk:Parser test</li>
16202 <li> Talk:Parser_test</li>
16203 <li> Parser test</li>
16204 <li> Parser_test</li>
16205 <li> </li>
16206 <li> </li>
16207 <li> 0</li>
16208 <li> Talk</li>
16209 <li> Talk</li>
16210 <li> </li>
16211 <li> </li>
16212 <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>
16213
16214 !! end
16215 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
16216
16217 !! test
16218 Gallery
16219 !! wikitext
16220 <gallery>
16221 image1.png |
16222 image2.gif|||||
16223
16224 image3|
16225 image4 |300px| centre
16226 image5.svg| http://///////
16227 [[x|xx]]]]
16228 * image6
16229 </gallery>
16230 !! html
16231 <ul class="gallery mw-gallery-traditional">
16232 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16233 <div class="thumb" style="height: 150px;">Image1.png</div>
16234 <div class="gallerytext">
16235 </div>
16236 </div></li>
16237 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16238 <div class="thumb" style="height: 150px;">Image2.gif</div>
16239 <div class="gallerytext">
16240 <p>||||
16241 </p>
16242 </div>
16243 </div></li>
16244 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16245 <div class="thumb" style="height: 150px;">Image3</div>
16246 <div class="gallerytext">
16247 </div>
16248 </div></li>
16249 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16250 <div class="thumb" style="height: 150px;">Image4</div>
16251 <div class="gallerytext">
16252 <p>300px| centre
16253 </p>
16254 </div>
16255 </div></li>
16256 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16257 <div class="thumb" style="height: 150px;">Image5.svg</div>
16258 <div class="gallerytext">
16259 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
16260 </p>
16261 </div>
16262 </div></li>
16263 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16264 <div class="thumb" style="height: 150px;">* image6</div>
16265 <div class="gallerytext">
16266 </div>
16267 </div></li>
16268 </ul>
16269
16270 !! end
16271
16272 !! test
16273 Gallery (with options)
16274 !! wikitext
16275 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
16276 File:Nonexistant.jpg|caption
16277 File:Nonexistant.jpg
16278 image:foobar.jpg|some '''caption''' [[Main Page]]
16279 image:foobar.jpg
16280 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
16281 </gallery>
16282 !! html
16283 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
16284 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
16285 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16286 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
16287 <div class="gallerytext">
16288 <p>caption
16289 </p>
16290 </div>
16291 </div></li>
16292 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16293 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
16294 <div class="gallerytext">
16295 </div>
16296 </div></li>
16297 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16298 <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>
16299 <div class="gallerytext">
16300 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16301 </p>
16302 </div>
16303 </div></li>
16304 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16305 <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>
16306 <div class="gallerytext">
16307 </div>
16308 </div></li>
16309 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16310 <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>
16311 <div class="gallerytext">
16312 <p>Blabla|blabla.
16313 </p>
16314 </div>
16315 </div></li>
16316 </ul>
16317
16318 !! end
16319
16320 !! test
16321 Gallery with link that has fragment
16322 !! wikitext
16323 <gallery>
16324 image:foobar.jpg|link=Main_Page
16325 image:foobar.jpg|link=Main_Page#section
16326 image:foobar.jpg|link=Main Page#section|caption
16327 </gallery>
16328 !! html
16329 <ul class="gallery mw-gallery-traditional">
16330 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16331 <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>
16332 <div class="gallerytext">
16333 </div>
16334 </div></li>
16335 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16336 <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>
16337 <div class="gallerytext">
16338 </div>
16339 </div></li>
16340 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16341 <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>
16342 <div class="gallerytext">
16343 <p>caption
16344 </p>
16345 </div>
16346 </div></li>
16347 </ul>
16348
16349 !! end
16350
16351 !! test
16352 Gallery with wikitext inside caption
16353 !! wikitext
16354 <gallery>
16355 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
16356 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
16357 </gallery>
16358 !! html
16359 <ul class="gallery mw-gallery-traditional">
16360 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16361 <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>
16362 <div class="gallerytext">
16363 <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>
16364 </p>
16365 </div>
16366 </div></li>
16367 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16368 <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>
16369 <div class="gallerytext">
16370 <p>This is a test template
16371 </p>
16372 </div>
16373 </div></li>
16374 </ul>
16375
16376 !! end
16377
16378 !! test
16379 gallery (with showfilename option)
16380 !! wikitext
16381 <gallery showfilename>
16382 File:Nonexistant.jpg|caption
16383 File:Nonexistant.jpg
16384 image:foobar.jpg|some '''caption''' [[Main Page]]
16385 File:Foobar.jpg
16386 </gallery>
16387 !! html
16388 <ul class="gallery mw-gallery-traditional">
16389 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16390 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16391 <div class="gallerytext">
16392 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
16393 caption
16394 </p>
16395 </div>
16396 </div></li>
16397 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16398 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16399 <div class="gallerytext">
16400 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
16401 </p>
16402 </div>
16403 </div></li>
16404 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16405 <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>
16406 <div class="gallerytext">
16407 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16408 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16409 </p>
16410 </div>
16411 </div></li>
16412 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16413 <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>
16414 <div class="gallerytext">
16415 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16416 </p>
16417 </div>
16418 </div></li>
16419 </ul>
16420
16421 !! end
16422
16423 !! test
16424 Gallery (with namespace-less filenames)
16425 !! wikitext
16426 <gallery>
16427 File:Nonexistant.jpg
16428 Nonexistant.jpg
16429 image:foobar.jpg
16430 foobar.jpg
16431 </gallery>
16432 !! html
16433 <ul class="gallery mw-gallery-traditional">
16434 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16435 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16436 <div class="gallerytext">
16437 </div>
16438 </div></li>
16439 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16440 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16441 <div class="gallerytext">
16442 </div>
16443 </div></li>
16444 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16445 <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>
16446 <div class="gallerytext">
16447 </div>
16448 </div></li>
16449 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16450 <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>
16451 <div class="gallerytext">
16452 </div>
16453 </div></li>
16454 </ul>
16455
16456 !! end
16457
16458 !! test
16459 HTML Hex character encoding (spells the word "JavaScript")
16460 !! options
16461 parsoid=wt2html,wt2wt,html2html
16462 !! wikitext
16463 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
16464 !! html/php
16465 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
16466 </p>
16467 !! html/php+tidy
16468 <p>JavaScript</p>
16469 !! html/parsoid
16470 <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>
16471 !! end
16472
16473 !! test
16474 HTML Hex character encoding bogus encoding (bug 26437 regression check)
16475 !! wikitext
16476 &#xsee;&#XSEE;
16477 !! html/php
16478 <p>&amp;#xsee;&amp;#XSEE;
16479 </p>
16480 !! html/parsoid
16481 <p>&amp;#xsee;&amp;#XSEE;</p>
16482 !! end
16483
16484 !! test
16485 HTML Hex character encoding mixed case
16486 !! options
16487 parsoid=wt2html,wt2wt,html2html
16488 !! wikitext
16489 &#xEE;&#Xee;
16490 !! html/php
16491 <p>&#xee;&#xee;
16492 </p>
16493 !! html/php+tidy
16494 <p>îî</p>
16495 !! html/parsoid
16496 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
16497 !! end
16498
16499 !! test
16500 __FORCETOC__ override
16501 !! wikitext
16502 __NEWSECTIONLINK__
16503 __FORCETOC__
16504 !! html
16505 <p><br />
16506 </p>
16507 !! end
16508
16509 !! test
16510 ISBN code coverage
16511 !! wikitext
16512 ISBN 978-0-1234-56&#x20;789
16513 !! html
16514 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
16515 </p>
16516 !! html+tidy
16517 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
16518 !! end
16519
16520 !! test
16521 ISBN followed by 5 spaces
16522 !! wikitext
16523 ISBN
16524 !! html
16525 <p>ISBN
16526 </p>
16527 !! end
16528
16529 !! test
16530 Double ISBN
16531 !! wikitext
16532 ISBN ISBN 1234567890
16533 !! html
16534 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16535 </p>
16536 !! end
16537
16538 !! test
16539 ISBN with an X
16540 !! wikitext
16541 ISBN 3-462-04561-X
16542 !! html
16543 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
16544 </p>
16545 !! end
16546
16547 !! test
16548 ISBN with empty prefix (parsoid test)
16549 !! wikitext
16550 ISBN 1234567890
16551 !! html/parsoid
16552 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
16553 !! end
16554
16555 !! test
16556 Bug 22905: <abbr> followed by ISBN followed by </a>
16557 !! wikitext
16558 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
16559 !! html
16560 <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>
16561 </p>
16562 !! end
16563
16564 !! test
16565 Double RFC
16566 !! wikitext
16567 RFC RFC 1234
16568 !! html
16569 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
16570 </p>
16571 !! end
16572
16573 !! test
16574 Double RFC with a wiki link
16575 !! wikitext
16576 RFC [[RFC 1234]]
16577 !! html
16578 <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>
16579 </p>
16580 !! end
16581
16582 !! test
16583 RFC code coverage
16584 !! wikitext
16585 RFC 983&#x20;987
16586 !! html
16587 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
16588 </p>
16589 !! html+tidy
16590 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
16591 !! end
16592
16593 !! test
16594 Centre-aligned image
16595 !! wikitext
16596 [[Image:foobar.jpg|centre]]
16597 !! html
16598 <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>
16599
16600 !!end
16601
16602 !! test
16603 None-aligned image
16604 !! wikitext
16605 [[Image:foobar.jpg|none]]
16606 !! html
16607 <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>
16608
16609 !!end
16610
16611 !! test
16612 Width + Height sized image (using px) (height is ignored)
16613 !! wikitext
16614 [[Image:foobar.jpg|640x480px]]
16615 !! html
16616 <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>
16617 </p>
16618 !!end
16619
16620 !! test
16621 Width-sized image (using px, no following whitespace)
16622 !! wikitext
16623 [[Image:foobar.jpg|640px]]
16624 !! html
16625 <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>
16626 </p>
16627 !!end
16628
16629 !! test
16630 Width-sized image (using px, with following whitespace - test regression from r39467)
16631 !! wikitext
16632 [[Image:foobar.jpg|640px ]]
16633 !! html
16634 <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>
16635 </p>
16636 !!end
16637
16638 !! test
16639 Width-sized image (using px, with preceding whitespace - test regression from r39467)
16640 !! wikitext
16641 [[Image:foobar.jpg| 640px]]
16642 !! html
16643 <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>
16644 </p>
16645 !!end
16646
16647 !! test
16648 Image with page parameter
16649 !! options
16650 djvu
16651 !! wikitext
16652 [[File:LoremIpsum.djvu|page=2]]
16653 !! html
16654 <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>
16655 </p>
16656 !! end
16657
16658 !! test
16659 Another italics / bold test
16660 !! wikitext
16661 ''' ''x'
16662 !! html
16663 <pre>'<i> </i>x'
16664 </pre>
16665 !!end
16666
16667 # FIXME: The php output seems broken. It's interleaving some open/close tags.
16668 !! test
16669 dt/dd/dl test
16670 !! wikitext
16671 :;;;::
16672 !! html/php
16673 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
16674
16675 !! html/parsoid
16676 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
16677
16678 !!end
16679
16680
16681 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
16682 !! test
16683 Images with the "|" character in the comment
16684 !! wikitext
16685 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
16686 !! html/php
16687 <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>
16688
16689 !! html/parsoid
16690 <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>
16691 !! end
16692
16693 !! test
16694 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
16695 !! wikitext
16696 <html><script>alert(1);</script></html>
16697 !! html
16698 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
16699 </p>
16700 !! end
16701
16702 !! test
16703 HTML with raw HTML ($wgRawHtml==true)
16704 !! options
16705 wgRawHtml=1
16706 !! wikitext
16707 <html><script>alert(1);</script></html>
16708 !! html
16709 <p><script>alert(1);</script>
16710 </p>
16711 !! end
16712
16713 !! test
16714 Parents of subpages, one level up
16715 !! options
16716 subpage title=[[Subpage test/L1/L2/L3]]
16717 !! wikitext
16718 [[../|L2]]
16719 !! html
16720 <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>
16721 </p>
16722 !! end
16723
16724
16725 !! test
16726 Parents of subpages, one level up, not named
16727 !! options
16728 subpage title=[[Subpage test/L1/L2/L3]]
16729 !! wikitext
16730 [[../]]
16731 !! html
16732 <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>
16733 </p>
16734 !! end
16735
16736
16737
16738 !! test
16739 Parents of subpages, two levels up
16740 !! options
16741 subpage title=[[Subpage test/L1/L2/L3]]
16742 !! wikitext
16743 [[../../|L1]]2
16744
16745 [[../../|L1]]l
16746 !! html
16747 <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
16748 </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>
16749 </p>
16750 !! end
16751
16752 !! test
16753 Parents of subpages, two levels up, without trailing slash or name.
16754 !! options
16755 subpage title=[[Subpage test/L1/L2/L3]]
16756 !! wikitext
16757 [[../..]]
16758 !! html
16759 <p>[[../..]]
16760 </p>
16761 !! end
16762
16763 !! test
16764 Parents of subpages, two levels up, with lots of extra trailing slashes.
16765 !! options
16766 subpage title=[[Subpage test/L1/L2/L3]]
16767 !! wikitext
16768 [[../../////]]
16769 !! html
16770 <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>
16771 </p>
16772 !! end
16773
16774 !! article
16775 Subpage test/L1/L2/L3Sibling
16776 !! text
16777 Sibling article
16778 !! endarticle
16779
16780 !! test
16781 Transclusion of a sibling page (one level up)
16782 !! options
16783 subpage title=[[Subpage test/L1/L2/L3]]
16784 !! wikitext
16785 {{../L3Sibling}}
16786 !! html
16787 <p>Sibling article
16788 </p>
16789 !! end
16790
16791 !! test
16792 Transclusion of a child page
16793 !! options
16794 subpage title=[[Subpage test/L1/L2]]
16795 !! wikitext
16796 {{/L3Sibling}}
16797 !! html
16798 <p>Sibling article
16799 </p>
16800 !! end
16801
16802 !! test
16803 Non-transclusion because of too many up levels
16804 !! options
16805 subpage title=[[Subpage test/L1/L2/L3]]
16806 !! wikitext
16807 {{../../../../More than parent}}
16808 !! html
16809 <p>{{../../../../More than parent}}
16810 </p>
16811 !! end
16812
16813 !! test
16814 Definition list code coverage
16815 !! wikitext
16816 ; title : def
16817 ; title : def
16818 ;title: def
16819 !! html/php
16820 <dl><dt> title &#160;</dt>
16821 <dd> def</dd>
16822 <dt> title&#160;</dt>
16823 <dd> def</dd>
16824 <dt>title</dt>
16825 <dd> def</dd></dl>
16826
16827 !! html/parsoid
16828 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
16829 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
16830 <dt>title</dt><dd> def</dd></dl>
16831 !! end
16832
16833 !! test
16834 Don't fall for the self-closing div
16835 !! wikitext
16836 <div>hello world</div/>
16837 !! html
16838 <div>hello world</div>
16839
16840 !! end
16841
16842 !! test
16843 MSGNW magic word
16844 !! wikitext
16845 {{MSGNW:msg}}
16846 !! html
16847 <p>&#91;&#91;:Template:Msg&#93;&#93;
16848 </p>
16849 !! end
16850
16851 !! test
16852 RAW magic word
16853 !! wikitext
16854 {{RAW:QUERTY}}
16855 !! html
16856 <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>
16857 </p>
16858 !! end
16859
16860 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
16861 !! test
16862 Always escape literal '>' in output, not just after '<'
16863 !! wikitext
16864 ><>
16865 !! html
16866 <p>&gt;&lt;&gt;
16867 </p>
16868 !! end
16869
16870 !! test
16871 Template caching
16872 !! wikitext
16873 {{Test}}
16874 {{Test}}
16875 !! html
16876 <p>This is a test template
16877 This is a test template
16878 </p>
16879 !! end
16880
16881
16882 !! article
16883 MediaWiki:Fake
16884 !! text
16885 ==header==
16886 !! endarticle
16887
16888 !! test
16889 Inclusion of !userCanEdit() content
16890 !! wikitext
16891 {{MediaWiki:Fake}}
16892 !! html
16893 <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>
16894
16895 !! end
16896
16897
16898 !! test
16899 Out-of-order TOC heading levels
16900 !! wikitext
16901 ==2==
16902 ======6======
16903 ===3===
16904 =1=
16905 =====5=====
16906 ==2==
16907 !! html
16908 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16909 <ul>
16910 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
16911 <ul>
16912 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
16913 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
16914 </ul>
16915 </li>
16916 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
16917 <ul>
16918 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
16919 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
16920 </ul>
16921 </li>
16922 </ul>
16923 </div>
16924
16925 <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>
16926 <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>
16927 <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>
16928 <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>
16929 <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>
16930 <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>
16931
16932 !! end
16933
16934
16935 !! test
16936 ISBN with a dummy number
16937 !! wikitext
16938 ISBN ---
16939 !! html
16940 <p>ISBN ---
16941 </p>
16942 !! end
16943
16944
16945 !! test
16946 ISBN with space-delimited number
16947 !! wikitext
16948 ISBN 92 9017 032 8
16949 !! html
16950 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
16951 </p>
16952 !! end
16953
16954
16955 !! test
16956 ISBN with multiple spaces, no number
16957 !! wikitext
16958 ISBN foo
16959 !! html
16960 <p>ISBN foo
16961 </p>
16962 !! end
16963
16964
16965 !! test
16966 ISBN length
16967 !! wikitext
16968 ISBN 123456789
16969
16970 ISBN 1234567890
16971
16972 ISBN 12345678901
16973 !! html
16974 <p>ISBN 123456789
16975 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16976 </p><p>ISBN 12345678901
16977 </p>
16978 !! end
16979
16980
16981 !! test
16982 ISBN with trailing year (bug 8110)
16983 !! wikitext
16984 ISBN 1-234-56789-0 - 2006
16985
16986 ISBN 1 234 56789 0 - 2006
16987 !! html
16988 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
16989 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
16990 </p>
16991 !! end
16992
16993
16994 !! test
16995 anchorencode
16996 !! wikitext
16997 {{anchorencode:foo bar©#%n}}
16998 !! html
16999 <p>foo_bar.C2.A9.23.25n
17000 </p>
17001 !! end
17002
17003 !! test
17004 anchorencode trims spaces
17005 !! wikitext
17006 {{anchorencode: __pretty__please__}}
17007 !! html
17008 <p>pretty_please
17009 </p>
17010 !! end
17011
17012 !! test
17013 anchorencode deals with links
17014 !! wikitext
17015 {{anchorencode: [[hello|world]] [[hi]]}}
17016 !! html
17017 <p>world_hi
17018 </p>
17019 !! end
17020
17021 !! test
17022 anchorencode deals with templates
17023 !! wikitext
17024 {{anchorencode: {{Foo}} }}
17025 !! html
17026 <p>FOO
17027 </p>
17028 !! end
17029
17030 !! test
17031 anchorencode encodes like the TOC generator: (bug 18431)
17032 !! wikitext
17033 === _ +:.3A%3A&&amp;]] ===
17034 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17035 __NOEDITSECTION__
17036 !! html
17037 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17038 <p>.2B:.3A.253A.26.26.5D.5D
17039 </p>
17040 !! end
17041
17042 !! test
17043 Bug 6200: blockquotes and paragraph formatting
17044 !! wikitext
17045 <blockquote>
17046 foo
17047 </blockquote>
17048
17049 bar
17050
17051 baz
17052 !! html
17053 <blockquote>
17054 <p>foo
17055 </p>
17056 </blockquote>
17057 <p>bar
17058 </p>
17059 <pre>baz
17060 </pre>
17061 !! end
17062
17063 !! test
17064 Bug 8293: Use of center tag ruins paragraph formatting
17065 !! wikitext
17066 <center>
17067 foo
17068 </center>
17069
17070 bar
17071
17072 baz
17073 !! html
17074 <center>
17075 <p>foo
17076 </p>
17077 </center>
17078 <p>bar
17079 </p>
17080 <pre>baz
17081 </pre>
17082 !! end
17083
17084 !!test
17085 Parsing of overlapping (improperly nested) inline html tags
17086 !! wikitext
17087 <span><s>x</span></s>
17088 !! html/php
17089 <p><span><s>x&lt;/span&gt;</s></span>
17090 </p>
17091 !! html/parsoid
17092 <p><span><s>x</s></span>
17093 </p>
17094 !!end
17095
17096 ###
17097 ### Language variants related tests
17098 ###
17099 !! test
17100 Self-link in language variants
17101 !! options
17102 title=[[Dunav]] language=sr
17103 !! wikitext
17104 Both [[Dunav]] and [[Дунав]] are names for this river.
17105 !! html
17106 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17107 </p>
17108 !!end
17109
17110 !! article
17111 Дуна
17112 !! text
17113 content
17114 !! endarticle
17115
17116 !! test
17117 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17118 !! options
17119 title=[[Duna]] language=sr
17120 !! wikitext
17121 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17122 !! html
17123 <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.
17124 </p>
17125 !! end
17126
17127 !! test
17128 Link to a section of a variant of this title shouldn't be parsed as self-link
17129 !! options
17130 title=[[Duna]] language=sr
17131 !! wikitext
17132 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
17133 !! html
17134 <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.
17135 </p>
17136 !! end
17137
17138 !! test
17139 Link to pages in language variants
17140 !! options
17141 language=sr
17142 !! wikitext
17143 Main Page can be written as [[Маин Паге]]
17144 !! html
17145 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
17146 </p>
17147 !!end
17148
17149
17150 !! test
17151 Multiple links to pages in language variants
17152 !! options
17153 language=sr
17154 !! wikitext
17155 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
17156 !! html
17157 <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>.
17158 </p>
17159 !!end
17160
17161
17162 !! test
17163 Simple template in language variants
17164 !! options
17165 language=sr
17166 !! wikitext
17167 {{тест}}
17168 !! html
17169 <p>This is a test template
17170 </p>
17171 !! end
17172
17173
17174 !! test
17175 Template with explicit namespace in language variants
17176 !! options
17177 language=sr
17178 !! wikitext
17179 {{Template:тест}}
17180 !! html
17181 <p>This is a test template
17182 </p>
17183 !! end
17184
17185
17186 !! test
17187 Basic test for template parameter in language variants
17188 !! options
17189 language=sr
17190 !! wikitext
17191 {{парамтест|param=foo}}
17192 !! html
17193 <p>This is a test template with parameter foo
17194 </p>
17195 !! end
17196
17197
17198 !! test
17199 Simple category in language variants
17200 !! options
17201 language=sr cat
17202 !! wikitext
17203 [[Category:МедиаWики Усер'с Гуиде]]
17204 !! html
17205 <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>
17206 !! end
17207
17208
17209 !! article
17210 Category:分类
17211 !! text
17212 blah
17213 !! endarticle
17214
17215 !! article
17216 Category:分類
17217 !! text
17218 blah
17219 !! endarticle
17220
17221 !! test
17222 Don't convert blue categorylinks to another variant (bug 33210)
17223 !! options
17224 language=zh cat
17225 !! wikitext
17226 [[A]][[Category:分类]]
17227 !! html
17228 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
17229 !! end
17230
17231
17232 !! test
17233 Stripping -{}- tags (language variants)
17234 !! options
17235 language=sr
17236 !! wikitext
17237 Latin proverb: -{Ne nuntium necare}-
17238 !! html
17239 <p>Latin proverb: Ne nuntium necare
17240 </p>
17241 !! end
17242
17243
17244 !! test
17245 Prevent conversion with -{}- tags (language variants)
17246 !! options
17247 language=sr variant=sr-ec
17248 !! wikitext
17249 Latinski: -{Ne nuntium necare}-
17250 !! html
17251 <p>Латински: Ne nuntium necare
17252 </p>
17253 !! end
17254
17255
17256 !! test
17257 Prevent conversion of text with -{}- tags (language variants)
17258 !! options
17259 language=sr variant=sr-ec
17260 !! wikitext
17261 Latinski: -{Ne nuntium necare}-
17262 !! html
17263 <p>Латински: Ne nuntium necare
17264 </p>
17265 !! end
17266
17267
17268 !! test
17269 Prevent conversion of links with -{}- tags (language variants)
17270 !! options
17271 language=sr variant=sr-ec
17272 !! wikitext
17273 -{[[Main Page]]}-
17274 !! html
17275 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17276 </p>
17277 !! end
17278
17279
17280 !! test
17281 -{}- tags within headlines (within html for parserConvert())
17282 !! options
17283 language=sr variant=sr-ec
17284 !! wikitext
17285 == -{Naslov}- ==
17286 !! html
17287 <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>
17288
17289 !! end
17290
17291
17292 !! test
17293 Explicit definition of language variant alternatives
17294 !! options
17295 language=zh variant=zh-tw
17296 !! wikitext
17297 -{zh:China;zh-tw:Taiwan}-, not China
17298 !! html
17299 <p>Taiwan, not China
17300 </p>
17301 !! end
17302
17303
17304 !! test
17305 Conversion around HTML tags
17306 !! options
17307 language=sr variant=sr-ec
17308 !! wikitext
17309 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
17310 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
17311 !! html
17312 <p>
17313 <span title="ЛаCтин">ски</span>
17314 </p>
17315 !! end
17316
17317
17318 !! test
17319 Explicit session-wise language variant mapping (A flag and - flag)
17320 !! options
17321 language=zh variant=zh-tw
17322 !! wikitext
17323 Taiwan is not China.
17324 But -{A|zh:China;zh-tw:Taiwan}- is China,
17325 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
17326 and -{China}- is China.
17327 !! html
17328 <p>Taiwan is not China.
17329 But Taiwan is Taiwan,
17330 (This should be stripped!)
17331 and China is China.
17332 </p>
17333 !! end
17334
17335 !! test
17336 Explicit session-wise language variant mapping (H flag for hide)
17337 !! options
17338 language=zh variant=zh-tw
17339 !! wikitext
17340 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
17341 Taiwan is China.
17342 !! html
17343 <p>(This should be stripped!)
17344 Taiwan is Taiwan.
17345 </p>
17346 !! end
17347
17348 !! test
17349 Adding explicit conversion rule for title (T flag)
17350 !! options
17351 language=zh variant=zh-tw showtitle
17352 !! wikitext
17353 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17354 !! html
17355 Taiwan
17356 <p>Should be stripped!
17357 </p>
17358 !! end
17359
17360 !! test
17361 Testing that changing the language variant here in the tests actually works
17362 !! options
17363 language=zh variant=zh showtitle
17364 !! wikitext
17365 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17366 !! html
17367 China
17368 <p>Should be stripped!
17369 </p>
17370 !! end
17371
17372 !! test
17373 Recursive conversion of alt and title attrs shouldn't clear converter state
17374 !! options
17375 language=zh variant=zh-cn showtitle
17376 !! wikitext
17377 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
17378 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
17379 !! html
17380 China
17381 <p>
17382 Should be stripped<span title="Exclamation">!</span>
17383 </p>
17384 !! end
17385
17386 !! test
17387 Bug 24072: more test on conversion rule for title
17388 !! options
17389 language=zh variant=zh-tw showtitle
17390 !! wikitext
17391 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17392 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
17393 !! html
17394 Taiwan
17395 <p>This should be stripped!
17396 This won't take interferes with the title rule.
17397 </p>
17398 !! end
17399
17400 !! test
17401 Partly disable title conversion if variant == main language code
17402 !! options
17403 language=zh variant=zh title=[[ZH]] showtitle
17404 !! wikitext
17405 -{T|zh-cn:CN;zh-tw:TW}-
17406 !! html
17407 ZH
17408 <p>
17409 </p>
17410 !! end
17411
17412 !! test
17413 Partly disable title conversion if variant == main language code, more
17414 !! options
17415 language=zh variant=zh title=[[ZH]] showtitle
17416 !! wikitext
17417 -{T|TW}-
17418 !! html
17419 ZH
17420 <p>
17421 </p>
17422 !! end
17423
17424 !! test
17425 Raw output of variant escape tags (R flag)
17426 !! options
17427 language=zh variant=zh-tw
17428 !! wikitext
17429 Raw: -{R|zh:China;zh-tw:Taiwan}-
17430 !! html
17431 <p>Raw: zh:China;zh-tw:Taiwan
17432 </p>
17433 !! end
17434
17435 !! test
17436 Nested using of manual convert syntax
17437 !! options
17438 language=zh variant=zh-hk
17439 !! wikitext
17440 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
17441 !! html
17442 <p>Nested: Hello Hong Kong!
17443 </p>
17444 !! end
17445
17446 !! test
17447 Proper conversion of text in external links
17448 !! options
17449 language=sr variant=sr-ec
17450 !! wikitext
17451 http://www.google.com
17452 gopher://www.google.com
17453 [http://www.google.com http://www.google.com]
17454 [gopher://www.google.com gopher://www.google.com]
17455 [https://www.google.com irc://www.google.com]
17456 [ftp://www.google.com www.google.com/ftp://dir]
17457 [//www.google.com www.google.com]
17458 !! html
17459 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17460 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17461 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17462 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17463 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
17464 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
17465 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
17466 </p>
17467 !! end
17468
17469 !! test
17470 Do not convert roman numbers to language variants
17471 !! options
17472 language=sr variant=sr-ec
17473 !! wikitext
17474 Fridrih IV je car.
17475 !! html
17476 <p>Фридрих IV је цар.
17477 </p>
17478 !! end
17479
17480 !! test
17481 Unclosed language converter markup "-{"
17482 !! options
17483 language=sr
17484 !! wikitext
17485 -{T|hello
17486 !! html
17487 <p>-{T|hello
17488 </p>
17489 !! end
17490
17491 !! test
17492 Don't convert raw rule "-{R|=&gt;}-" to "=>"
17493 !! options
17494 language=sr
17495 !! wikitext
17496 -{R|=&gt;}-
17497 !! html
17498 <p>=&gt;
17499 </p>
17500 !!end
17501
17502 !! test
17503 Don't break link parsing if language converter markup is in the caption.
17504 !! options
17505 language=sr variant=sr-ec
17506 !! wikitext
17507 [[Main Page|-{R|main page}-]]
17508 !! html
17509 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
17510 </p>
17511 !! end
17512
17513 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17514 !! test
17515 Don't break image parsing if language converter markup is in the caption.
17516 !! options
17517 language=sr
17518 !! wikitext
17519 [[File:Foobar.jpg|-{R|caption}-]]
17520 !! html/parsoid
17521 <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>
17522 </p>
17523 !! end
17524
17525 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17526 !! test
17527 Don't break list handling if language converter markup is in the item.
17528 !! options
17529 language=zh variant=zh-cn
17530 !! wikitext
17531 ;-{zh-cn:AAA;zh-tw:BBB}-
17532 !! html/php
17533 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
17534
17535 !! html/parsoid
17536 <dl><dt>AAA
17537 </dt></dl>
17538 !! end
17539
17540 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17541 !! test
17542 Don't break table handling if language converter markup is in the cell.
17543 !! options
17544 language=sr variant=sr-ec
17545 !! wikitext
17546 {|
17547 |-
17548 | -{R|B}-
17549 |}
17550 !! html/php
17551 <table>
17552
17553 <tr>
17554 <td>Б}-
17555 </td></tr></table>
17556
17557 !! html/parsoid
17558 <table>
17559
17560 <tr>
17561 <td> B
17562 </td></tr></table>
17563
17564 !! end
17565
17566 !! test
17567 Bug 529: Uncovered bullet
17568 !! wikitext
17569 * Foo {{bullet}}
17570 !! html
17571 <ul><li> Foo </li>
17572 <li> Bar</li></ul>
17573
17574 !! end
17575
17576 # Plain MediaWiki does not remove empty lists, but tidy actually does.
17577 # Templates in Wikipedia rely on this behavior, as tidy has always been
17578 # enabled there. These tests are normally run *without* tidy, so specify the
17579 # full output here.
17580 # To test realistic parsing behavior, apply a tidy-like transformation to both
17581 # the expected output and your parser's output.
17582 !! test
17583 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
17584 !! wikitext
17585 ******* Foo {{bullet}}
17586 !! html
17587 <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>
17588 <li> Bar</li></ul>
17589
17590 !! end
17591
17592 !! test
17593 Bug 529: Uncovered table already at line-start
17594 !! wikitext
17595 x
17596
17597 {{table}}
17598 y
17599 !! html
17600 <p>x
17601 </p>
17602 <table>
17603 <tr>
17604 <td> 1 </td>
17605 <td> 2
17606 </td></tr>
17607 <tr>
17608 <td> 3 </td>
17609 <td> 4
17610 </td></tr></table>
17611 <p>y
17612 </p>
17613 !! end
17614
17615 !! test
17616 Bug 529: Uncovered bullet in parser function result
17617 !! wikitext
17618 * Foo {{lc:{{bullet}} }}
17619 !! html
17620 <ul><li> Foo </li>
17621 <li> bar</li></ul>
17622
17623 !! end
17624
17625 !! test
17626 Bug 5678: Double-parsed template argument
17627 !! wikitext
17628 {{lc:{{{1}}}|hello}}
17629 !! html
17630 <p>{{{1}}}
17631 </p>
17632 !! end
17633
17634 !! test
17635 Bug 5678: Double-parsed template invocation
17636 !! wikitext
17637 {{lc:{{paramtest {{!}} param = hello }} }}
17638 !! html
17639 <p>{{paramtest | param = hello }}
17640 </p>
17641 !! end
17642
17643 !! test
17644 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
17645 !! options
17646 language=cs
17647 title=[[Main Page]]
17648 !! wikitext
17649 {{PRVNÍVELKÉ:ěščř}}
17650 {{prvnívelké:ěščř}}
17651 {{PRVNÍMALÉ:ěščř}}
17652 {{prvnímalé:ěščř}}
17653 {{MALÁ:ěščř}}
17654 {{malá:ěščř}}
17655 {{VELKÁ:ěščř}}
17656 {{velká:ěščř}}
17657 !! html
17658 <p>Ěščř
17659 Ěščř
17660 ěščř
17661 ěščř
17662 ěščř
17663 ěščř
17664 ĚŠČŘ
17665 ĚŠČŘ
17666 </p>
17667 !! end
17668
17669 !! test
17670 Morwen/13: Unclosed link followed by heading
17671 !! wikitext
17672 [[link
17673 ==heading==
17674 !! html
17675 <p>[[link
17676 </p>
17677 <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>
17678
17679 !! end
17680
17681 !! test
17682 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
17683 !! wikitext
17684 {{foo|
17685 =heading=
17686 !! html
17687 <p>{{foo|
17688 </p>
17689 <h1><span class="mw-headline" id="heading">heading</span></h1>
17690
17691 !! end
17692
17693 !! test
17694 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
17695 !! wikitext
17696 {{foo|
17697 ==heading==
17698 !! html
17699 <p>{{foo|
17700 </p>
17701 <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>
17702
17703 !! end
17704
17705 !! test
17706 Tildes in comments
17707 !! options
17708 pst
17709 !! wikitext
17710 <!-- ~~~~ -->
17711 !! html
17712 <!-- ~~~~ -->
17713 !! end
17714
17715 !! test
17716 Paragraphs inside divs (no extra line breaks)
17717 !! wikitext
17718 <div>Line one
17719
17720 Line two</div>
17721 !! html
17722 <div>Line one
17723 Line two</div>
17724
17725 !! end
17726
17727 !! test
17728 Paragraphs inside divs (extra line break on open)
17729 !! wikitext
17730 <div>
17731 Line one
17732
17733 Line two</div>
17734 !! html
17735 <div>
17736 <p>Line one
17737 </p>
17738 Line two</div>
17739
17740 !! end
17741
17742 !! test
17743 Paragraphs inside divs (extra line break on close)
17744 !! wikitext
17745 <div>Line one
17746
17747 Line two
17748 </div>
17749 !! html
17750 <div>Line one
17751 <p>Line two
17752 </p>
17753 </div>
17754
17755 !! end
17756
17757 !! test
17758 Paragraphs inside divs (extra line break on open and close)
17759 !! wikitext
17760 <div>
17761 Line one
17762
17763 Line two
17764 </div>
17765 !! html
17766 <div>
17767 <p>Line one
17768 </p><p>Line two
17769 </p>
17770 </div>
17771
17772 !! end
17773
17774 !! test
17775 Nesting tags, paragraphs on lines which begin with <div>
17776 !! wikitext
17777 <div></div><strong>A
17778 B</strong>
17779 !! html/php+tidy
17780 <p><strong>A</strong></p>
17781 <p><strong>B</strong></p>
17782 !! html/parsoid
17783 <div></div>
17784 <p><strong>A
17785 B</strong>
17786 </p>
17787 !! end
17788
17789 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
17790 !! test
17791 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
17792 !! wikitext
17793 <blockquote>Line one
17794
17795 Line two</blockquote>
17796 !! html
17797 <blockquote>Line one
17798 Line two</blockquote>
17799
17800 !! html+tidy
17801 <blockquote>
17802 <p>Line one Line two</p>
17803 </blockquote>
17804 !! end
17805
17806 !! test
17807 Bug 6200: paragraphs inside blockquotes (extra line break on open)
17808 !! wikitext
17809 <blockquote>
17810 Line one
17811
17812 Line two</blockquote>
17813 !! html
17814 <blockquote>
17815 <p>Line one
17816 </p>
17817 Line two</blockquote>
17818
17819 !! html+tidy
17820 <blockquote>
17821 <p>Line one</p>
17822 Line two</blockquote>
17823 !! end
17824
17825 !! test
17826 Bug 6200: paragraphs inside blockquotes (extra line break on close)
17827 !! wikitext
17828 <blockquote>Line one
17829
17830 Line two
17831 </blockquote>
17832 !! html
17833 <blockquote>Line one
17834 <p>Line two
17835 </p>
17836 </blockquote>
17837
17838 !! html+tidy
17839 <blockquote>
17840 <p>Line one</p>
17841 <p>Line two</p>
17842 </blockquote>
17843 !! end
17844
17845 !! test
17846 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
17847 !! wikitext
17848 <blockquote>
17849 Line one
17850
17851 Line two
17852 </blockquote>
17853 !! html
17854 <blockquote>
17855 <p>Line one
17856 </p><p>Line two
17857 </p>
17858 </blockquote>
17859
17860 !! html+tidy
17861 <blockquote>
17862 <p>Line one</p>
17863 <p>Line two</p>
17864 </blockquote>
17865 !! end
17866
17867 !! test
17868 Paragraphs inside blockquotes/divs (no extra line breaks)
17869 !! wikitext
17870 <blockquote><div>Line one
17871
17872 Line two</div></blockquote>
17873 !! html
17874 <blockquote><div>Line one
17875 Line two</div></blockquote>
17876
17877 !! end
17878
17879 !! test
17880 Paragraphs inside blockquotes/divs (extra line break on open)
17881 !! wikitext
17882 <blockquote><div>
17883 Line one
17884
17885 Line two</div></blockquote>
17886 !! html
17887 <blockquote><div>
17888 <p>Line one
17889 </p>
17890 Line two</div></blockquote>
17891
17892 !! end
17893
17894 !! test
17895 Paragraphs inside blockquotes/divs (extra line break on close)
17896 !! wikitext
17897 <blockquote><div>Line one
17898
17899 Line two
17900 </div></blockquote>
17901 !! html
17902 <blockquote><div>Line one
17903 <p>Line two
17904 </p>
17905 </div></blockquote>
17906
17907 !! end
17908
17909 !! test
17910 Paragraphs inside blockquotes/divs (extra line break on open and close)
17911 !! wikitext
17912 <blockquote><div>
17913 Line one
17914
17915 Line two
17916 </div></blockquote>
17917 !! html
17918 <blockquote><div>
17919 <p>Line one
17920 </p><p>Line two
17921 </p>
17922 </div></blockquote>
17923
17924 !! end
17925
17926 !! test
17927 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
17928 !! options
17929 wgLinkHolderBatchSize=0
17930 !! wikitext
17931 [[meatball:1]]
17932 [[meatball:2]]
17933 [[meatball:3]]
17934 !! html
17935 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
17936 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
17937 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
17938 </p>
17939 !! end
17940
17941 !! test
17942 Free external link invading image caption
17943 !! wikitext
17944 [[Image:Foobar.jpg|thumb|http://x|hello]]
17945 !! html
17946 <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>
17947
17948 !! end
17949
17950 !! test
17951 Bug 15196: localised external link numbers
17952 !! options
17953 language=fa
17954 !! wikitext
17955 [http://en.wikipedia.org/]
17956 !! html/php
17957 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
17958 </p>
17959 !! html/parsoid
17960 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
17961 !! end
17962
17963 !! test
17964 Multibyte character in padleft
17965 !! wikitext
17966 {{padleft:-Hello|7|Æ}}
17967 !! html
17968 <p>Æ-Hello
17969 </p>
17970 !! end
17971
17972 !! test
17973 Multibyte character in padright
17974 !! wikitext
17975 {{padright:Hello-|7|Æ}}
17976 !! html
17977 <p>Hello-Æ
17978 </p>
17979 !! end
17980
17981 !!test
17982 formatdate parser function
17983 !! wikitext
17984 {{#formatdate:2009-03-24}}
17985 !! html
17986 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
17987 </p>
17988 !! end
17989
17990 !!test
17991 formatdate parser function, with default format
17992 !! wikitext
17993 {{#formatdate:2009-03-24|mdy}}
17994 !! html
17995 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
17996 </p>
17997 !! end
17998
17999 !! test
18000 Spacing of numbers in formatted dates
18001 !! wikitext
18002 {{#formatdate:January 15}}
18003 !! html
18004 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18005 </p>
18006 !! end
18007
18008 !! test
18009 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
18010 !! options
18011 language=nl title=[[MediaWiki:Common.css]]
18012 !! wikitext
18013 {{#formatdate:2009-03-24|dmy}}
18014 !! html
18015 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18016 </p>
18017 !! end
18018
18019 #
18020 #
18021 #
18022
18023 #
18024 # Edit comments
18025 #
18026
18027 !! test
18028 Edit comment with link
18029 !! options
18030 comment
18031 !! wikitext
18032 I like the [[Main Page]] a lot
18033 !! html
18034 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18035 !!end
18036
18037 !! test
18038 Edit comment with link and link text
18039 !! options
18040 comment
18041 !! wikitext
18042 I like the [[Main Page|best pages]] a lot
18043 !! html
18044 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18045 !!end
18046
18047 !! test
18048 Edit comment with link and link text with suffix
18049 !! options
18050 comment
18051 !! wikitext
18052 I like the [[Main Page|best page]]s a lot
18053 !! html
18054 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18055 !!end
18056
18057 !! test
18058 Edit comment with section link (non-local, eg in history list)
18059 !! options
18060 comment title=[[Main Page]]
18061 !! wikitext
18062 /* External links */ removed bogus entries
18063 !! html
18064 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18065 !!end
18066
18067 !! test
18068 Edit comment with section link and text before it (non-local, eg in history list)
18069 !! options
18070 comment title=[[Main Page]]
18071 !! wikitext
18072 pre-comment text /* External links */ removed bogus entries
18073 !! html
18074 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>
18075 !!end
18076
18077 !! test
18078 Edit comment with section link (local, eg in diff view)
18079 !! options
18080 comment local title=[[Main Page]]
18081 !! wikitext
18082 /* External links */ removed bogus entries
18083 !! html
18084 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18085 !!end
18086
18087 !! test
18088 Edit comment with subpage link (bug 14080)
18089 !! options
18090 comment
18091 subpage
18092 title=[[Subpage test]]
18093 !! wikitext
18094 Poked at a [[/subpage]] here...
18095 !! html
18096 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
18097 !!end
18098
18099 !! test
18100 Edit comment with subpage link and link text (bug 14080)
18101 !! options
18102 comment
18103 subpage
18104 title=[[Subpage test]]
18105 !! wikitext
18106 Poked at a [[/subpage|neat little page]] here...
18107 !! html
18108 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
18109 !!end
18110
18111 !! test
18112 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
18113 !! options
18114 comment
18115 title=[[Subpage test]]
18116 !! wikitext
18117 Poked at a [[/subpage]] here...
18118 !! html
18119 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...
18120 !!end
18121
18122 !! test
18123 Edit comment with bare anchor link (local, as on diff)
18124 !! options
18125 comment
18126 local
18127 title=[[Main Page]]
18128 !! wikitext
18129 [[#section]]
18130 !! html
18131 <a href="#section">#section</a>
18132 !! end
18133
18134 !! test
18135 Edit comment with bare anchor link (non-local, as on history)
18136 !! options
18137 comment
18138 title=[[Main Page]]
18139 !! wikitext
18140 [[#section]]
18141 !! html
18142 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
18143 !! end
18144
18145 !! test
18146 Anchor starting with underscore
18147 !! wikitext
18148 [[#_ref|One]]
18149 !! html
18150 <p><a href="#_ref">One</a>
18151 </p>
18152 !! end
18153
18154 !! test
18155 Id starting with underscore
18156 !! wikitext
18157 <div id="_ref"></div>
18158 !! html
18159 <div id="_ref"></div>
18160
18161 !! end
18162
18163 !! test
18164 Space normalisation on autocomment (bug 22784)
18165 !! options
18166 comment
18167 title=[[Main Page]]
18168 !! wikitext
18169 /* __hello__world__ */
18170 !! html
18171 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
18172 !! end
18173
18174 !! test
18175 percent-encoding and + signs in comments (Bug 26410)
18176 !! options
18177 comment
18178 !! wikitext
18179 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
18180 !! html
18181 <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>
18182 !! end
18183
18184 # FIXME: Omitting the php sections here because of differences in the local and
18185 # jenkins output. But, more importantly, the Bad.jpg isn't being stripped,
18186 # which seems to be a problem with the testing infrastructure.
18187 !! test
18188 Bad images - basic functionality
18189 !! wikitext
18190 [[File:Bad.jpg]]
18191 !! html/parsoid
18192 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[File:Bad.jpg]]","optList":[]}'/>
18193 !! end
18194
18195 # FIXME: Same reasoning as above. The expected php is:
18196 # <p>Foo bar
18197 # </p><p>Bar foo
18198 # </p>
18199 !! test
18200 Bad images - bug 16039: text after bad image disappears
18201 !! wikitext
18202 Foo bar
18203 [[File:Bad.jpg]]
18204 Bar foo
18205 !! html/parsoid
18206 <p>Foo bar
18207 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[File:Bad.jpg]]","optList":[]}'/>
18208 Bar foo</p>
18209 !! end
18210
18211 !! test
18212 Verify that displaytitle works (bug #22501) no displaytitle
18213 !! options
18214 showtitle
18215 !! config
18216 wgAllowDisplayTitle=true
18217 wgRestrictDisplayTitle=false
18218 !! wikitext
18219 this is not the the title
18220 !! html
18221 Parser test
18222 <p>this is not the the title
18223 </p>
18224 !! end
18225
18226 !! test
18227 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
18228 !! options
18229 showtitle
18230 title=[[Screen]]
18231 !! config
18232 wgAllowDisplayTitle=true
18233 wgRestrictDisplayTitle=false
18234 !! wikitext
18235 this is not the the title
18236 {{DISPLAYTITLE:whatever}}
18237 !! html
18238 whatever
18239 <p>this is not the the title
18240 </p>
18241 !! end
18242
18243 !! test
18244 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
18245 !! options
18246 showtitle
18247 title=[[Screen]]
18248 !! config
18249 wgAllowDisplayTitle=true
18250 wgRestrictDisplayTitle=true
18251 !! wikitext
18252 this is not the the title
18253 {{DISPLAYTITLE:whatever}}
18254 !! html
18255 Screen
18256 <p>this is not the the title
18257 </p>
18258 !! end
18259
18260 !! test
18261 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
18262 !! options
18263 showtitle
18264 title=[[Screen]]
18265 !! config
18266 wgAllowDisplayTitle=true
18267 wgRestrictDisplayTitle=true
18268 !! wikitext
18269 this is not the the title
18270 {{DISPLAYTITLE:screen}}
18271 !! html
18272 screen
18273 <p>this is not the the title
18274 </p>
18275 !! end
18276
18277 !! test
18278 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
18279 !! options
18280 showtitle
18281 title=[[Screen]]
18282 !! config
18283 wgAllowDisplayTitle=false
18284 !! wikitext
18285 this is not the the title
18286 {{DISPLAYTITLE:screen}}
18287 !! html
18288 Screen
18289 <p>this is not the the title
18290 <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>
18291 </p>
18292 !! end
18293
18294 !! test
18295 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
18296 !! options
18297 showtitle
18298 title=[[Screen]]
18299 !! config
18300 wgAllowDisplayTitle=false
18301 !! wikitext
18302 this is not the the title
18303 !! html
18304 Screen
18305 <p>this is not the the title
18306 </p>
18307 !! end
18308
18309 !! test
18310 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
18311 !! options
18312 showtitle
18313 title=[[Screen]]
18314 !! config
18315 wgAllowDisplayTitle=true
18316 wgRestrictDisplayTitle=true
18317 !! wikitext
18318 this is not the the title
18319 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
18320 !! html
18321 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
18322 <p>this is not the the title
18323 </p>
18324 !! end
18325
18326 !! test
18327 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
18328 !! options
18329 showtitle
18330 title=[[Screen]]
18331 !! config
18332 wgAllowDisplayTitle=true
18333 wgRestrictDisplayTitle=true
18334 !! wikitext
18335 this is not the the title
18336 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
18337 !! html
18338 <span style="color: red;">s</span>creen
18339 <p>this is not the the title
18340 </p>
18341 !! end
18342
18343 !! test
18344 preload: check <noinclude> and <includeonly>
18345 !! options
18346 preload
18347 !! wikitext
18348 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
18349 !! html
18350 Hello kind world.
18351 !! end
18352
18353 !! test
18354 preload: check <onlyinclude>
18355 !! options
18356 preload
18357 !! wikitext
18358 Goodbye <onlyinclude>Hello world</onlyinclude>
18359 !! html
18360 Hello world
18361 !! end
18362
18363 !! test
18364 preload: can pass tags through if we want to
18365 !! options
18366 preload
18367 !! wikitext
18368 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
18369 !! html
18370 <includeonly>Hello world</includeonly>
18371 !! end
18372
18373 !! test
18374 preload: check that it doesn't try to do tricks
18375 !! options
18376 preload
18377 !! wikitext
18378 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18379 !! html
18380 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18381 !! end
18382
18383 !! test
18384 Play a bit with r67090 and bug 3158
18385 !! wikitext
18386 <div style="width:50% !important">&nbsp;</div>
18387 <div style="width:50%&nbsp;!important">&nbsp;</div>
18388 <div style="width:50%&#160;!important">&nbsp;</div>
18389 <div style="border : solid;">&nbsp;</div>
18390 !! html/php
18391 <div style="width:50% !important">&#160;</div>
18392 <div style="width:50% !important">&#160;</div>
18393 <div style="width:50% !important">&#160;</div>
18394 <div style="border&#160;: solid;">&#160;</div>
18395
18396 !! html/parsoid
18397 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18398 <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>
18399 <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>
18400 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18401
18402 !! end
18403
18404 !! test
18405 HTML5 data attributes
18406 !! wikitext
18407 <span data-foo="bar">Baz</span>
18408 <p data-abc-def_hij="">Quuz</p>
18409 !! html
18410 <p><span data-foo="bar">Baz</span>
18411 </p>
18412 <p data-abc-def_hij="">Quuz</p>
18413
18414 !! end
18415
18416 !! test
18417 percent-encoding and + signs in internal links (Bug 26410)
18418 !! wikitext
18419 [[User:+%]] [[Page+title%]]
18420 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
18421 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
18422 [[%33%45]] [[%33%45+]]
18423 !! html
18424 <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>
18425 <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>
18426 <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>
18427 <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>
18428 </p>
18429 !! end
18430
18431 !! test
18432 Special characters in embedded file links (bug 27679)
18433 !! wikitext
18434 [[File:Contains & ampersand.jpg]]
18435 [[File:Does not exist.jpg|Title with & ampersand]]
18436 !! html
18437 <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>
18438 <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>
18439 </p>
18440 !! end
18441
18442
18443 !! test
18444 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
18445 !! wikitext
18446 Text&apos;s been normalized?
18447 !! html
18448 <p>Text&#39;s been normalized?
18449 </p>
18450 !! end
18451
18452 !! test
18453 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
18454 !! wikitext
18455 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
18456 !! html
18457 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
18458 </p>
18459 !! end
18460
18461 !! test
18462 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
18463 !! wikitext
18464 [http://www.example.org/ ideograms]
18465 !! html
18466 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
18467 </p>
18468 !! end
18469
18470 !! test
18471 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
18472 !! wikitext
18473 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
18474 !! html
18475 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
18476 </p>
18477 !! end
18478
18479 !! article
18480 Mediawiki:loop1
18481 !! text
18482 {{Identical|A}}
18483 !! endarticle
18484
18485 !! article
18486 Mediawiki:loop2
18487 !! text
18488 {{Identical|B}}
18489 !! endarticle
18490
18491 !! article
18492 Template:Identical
18493 !! text
18494 {{int:loop1}}
18495 {{int:loop2}}
18496 !! endarticle
18497
18498 !! test
18499 Bug 31098 Template which includes system messages which includes the template
18500 !! wikitext
18501 {{Identical}}
18502 !! html
18503 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18504 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18505 </p>
18506 !! end
18507
18508 !! test
18509 Bug31490 Turkish: ucfirst 'blah'
18510 !! options
18511 language=tr
18512 !! wikitext
18513 {{ucfirst:blah}}
18514 !! html
18515 <p>Blah
18516 </p>
18517 !! end
18518
18519 !! test
18520 Bug31490 Turkish: ucfirst 'ix'
18521 !! options
18522 language=tr
18523 !! wikitext
18524 {{ucfirst:ix}}
18525 !! html
18526 <p>İx
18527 </p>
18528 !! end
18529
18530 !! test
18531 Bug31490 Turkish: lcfirst 'BLAH'
18532 !! options
18533 language=tr
18534 !! wikitext
18535 {{lcfirst:BLAH}}
18536 !! html
18537 <p>bLAH
18538 </p>
18539 !! end
18540
18541 !! test
18542 Bug31490 Turkish: ucfırst (with a dotless i)
18543 !! options
18544 language=tr
18545 !! wikitext
18546 {{ucfırst:blah}}
18547 !! html
18548 <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>
18549 </p>
18550 !! end
18551
18552 !! test
18553 Bug31490 ucfırst (with a dotless i) with English language
18554 !! options
18555 language=en
18556 !! wikitext
18557 {{ucfırst:blah}}
18558 !! html
18559 <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>
18560 </p>
18561 !! end
18562
18563 !! test
18564 Bug 26375: TOC with italics
18565 !! options
18566 title=[[Main Page]]
18567 !! wikitext
18568 __TOC__
18569 == ''Lost'' episodes ==
18570 !! html
18571 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18572 <ul>
18573 <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>
18574 </ul>
18575 </div>
18576
18577 <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>
18578
18579 !! end
18580
18581 !! test
18582 Bug 26375: TOC with bold
18583 !! options
18584 title=[[Main Page]]
18585 !! wikitext
18586 __TOC__
18587 == '''should be bold''' then normal text ==
18588 !! html
18589 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18590 <ul>
18591 <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>
18592 </ul>
18593 </div>
18594
18595 <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>
18596
18597 !! end
18598
18599 !! test
18600 Bug 33845: Headings become cursive in TOC when they contain an image
18601 !! options
18602 title=[[Main Page]]
18603 !! wikitext
18604 __TOC__
18605 == Image [[Image:foobar.jpg]] ==
18606 !! html
18607 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18608 <ul>
18609 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
18610 </ul>
18611 </div>
18612
18613 <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>
18614
18615 !! end
18616
18617 !! test
18618 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
18619 !! options
18620 title=[[Main Page]]
18621 !! wikitext
18622 __TOC__
18623 == <blockquote>Quote</blockquote> ==
18624 !! html
18625 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18626 <ul>
18627 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18628 </ul>
18629 </div>
18630
18631 <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>
18632
18633 !! html+tidy
18634 <div id="toc" class="toc">
18635 <div id="toctitle">
18636 <h2>Contents</h2>
18637 </div>
18638 <ul>
18639 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18640 </ul>
18641 </div>
18642 <h2><span class="mw-headline" id="Quote"></span></h2>
18643 <blockquote>
18644 <p><span class="mw-headline" id="Quote">Quote</span></p>
18645 </blockquote>
18646 <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>
18647 !! end
18648
18649 !! test
18650 Unclosed tags in TOC
18651 !! options
18652 title=[[Main Page]]
18653 !! wikitext
18654 __TOC__
18655 == Proof: 2 < 3 ==
18656 <small>Hanc marginis exiguitas non caperet.</small>
18657 QED
18658 !! html
18659 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18660 <ul>
18661 <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>
18662 </ul>
18663 </div>
18664
18665 <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>
18666 <p><small>Hanc marginis exiguitas non caperet.</small>
18667 QED
18668 </p>
18669 !! end
18670
18671 !! test
18672 Multiple tags in TOC
18673 !! wikitext
18674 __TOC__
18675 == <i>Foo</i> <b>Bar</b> ==
18676
18677 == <i>Foo</i> <blockquote>Bar</blockquote> ==
18678 !! html
18679 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18680 <ul>
18681 <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>
18682 <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>
18683 </ul>
18684 </div>
18685
18686 <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>
18687 <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>
18688
18689 !! html+tidy
18690 <div id="toc" class="toc">
18691 <div id="toctitle">
18692 <h2>Contents</h2>
18693 </div>
18694 <ul>
18695 <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>
18696 <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>
18697 </ul>
18698 </div>
18699 <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>
18700 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
18701 <blockquote>
18702 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
18703 </blockquote>
18704 <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>
18705 !! end
18706
18707 !! test
18708 Tags with parameters in TOC
18709 !! wikitext
18710 __TOC__
18711 == <sup class="in-h2">Hello</sup> ==
18712
18713 == <sup class="a > b">Evilbye</sup> ==
18714 !! html
18715 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18716 <ul>
18717 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
18718 <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>
18719 </ul>
18720 </div>
18721
18722 <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>
18723 <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>
18724
18725 !! end
18726
18727 !! test
18728 span tags with directionality in TOC
18729 !! wikitext
18730 __TOC__
18731 == <span dir="ltr">C++</span> ==
18732
18733 == <span dir="rtl">זבנג!</span> ==
18734
18735 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
18736
18737 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
18738
18739 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
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="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
18744 <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>
18745 <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>
18746 <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>
18747 <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>
18748 </ul>
18749 </div>
18750
18751 <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>
18752 <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>
18753 <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>
18754 <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>
18755 <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>
18756
18757 !! end
18758
18759 !! article
18760 MediaWiki:Bug32057
18761 !! text
18762 == {{int:headline_sample}} ==
18763 !! endarticle
18764
18765 !! test
18766 Bug 32057: Title needed when expanding <h> nodes.
18767 !! options
18768 title=[[Main Page]]
18769 !! wikitext
18770 {{int:Bug32057}}
18771 !! html
18772 <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>
18773
18774 !! end
18775
18776 !! test
18777 Strip marker in urlencode
18778 !! wikitext
18779 {{urlencode:x<nowiki/>y}}
18780 {{urlencode:x<nowiki/>y|wiki}}
18781 {{urlencode:x<nowiki/>y|path}}
18782 !! html
18783 <p>xy
18784 xy
18785 xy
18786 </p>
18787 !! end
18788
18789 !! test
18790 Strip marker in lc
18791 !! wikitext
18792 {{lc:x<nowiki/>y}}
18793 !! html
18794 <p>xy
18795 </p>
18796 !! end
18797
18798 !! test
18799 Strip marker in uc
18800 !! wikitext
18801 {{uc:x<nowiki/>y}}
18802 !! html
18803 <p>XY
18804 </p>
18805 !! end
18806
18807 !! test
18808 Strip marker in formatNum
18809 !! wikitext
18810 {{formatnum:1<nowiki/>2}}
18811 {{formatnum:1<nowiki/>2|R}}
18812 !! html
18813 <p>12
18814 12
18815 </p>
18816 !! end
18817
18818 !! test
18819 Check noCommafy in formatNum
18820 !! options
18821 language=be-tarask
18822 !! wikitext
18823 {{formatnum:123456.78}}
18824 {{formatnum:123456.78|NOSEP}}
18825 !! html
18826 <p>123 456,78
18827 123456.78
18828 </p>
18829 !! end
18830
18831 !! test
18832 Wrong option for formatNum (bug 56199)
18833 !! wikitext
18834 {{formatnum:1,234.56|Random}}
18835 {{formatnum:1,234.56|EVERYTHING}}
18836 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
18837 !! html
18838 <p>1,234.56
18839 1,234.56
18840 1,234.56
18841 </p>
18842 !! end
18843
18844 !! test
18845 Strip marker in grammar
18846 !! options
18847 language=fi
18848 !! wikitext
18849 {{grammar:elative|foo<nowiki/>bar}}
18850 !! html
18851 <p>foobarista
18852 </p>
18853 !! end
18854
18855 !! test
18856 Strip marker in padleft
18857 !! wikitext
18858 {{padleft:|2|x<nowiki/>y}}
18859 !! html
18860 <p>xy
18861 </p>
18862 !! end
18863
18864 !! test
18865 Strip marker in padright
18866 !! wikitext
18867 {{padright:|2|x<nowiki/>y}}
18868 !! html
18869 <p>xy
18870 </p>
18871 !! end
18872
18873 !! test
18874 Strip marker in anchorencode
18875 !! wikitext
18876 {{anchorencode:x<nowiki/>y}}
18877 !! html
18878 <p>xy
18879 </p>
18880 !! end
18881
18882 !! test
18883 nowiki inside link inside heading (bug 18295)
18884 !! wikitext
18885 ==[[foo|x<nowiki>y</nowiki>z]]==
18886 !! html
18887 <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>
18888
18889 !! end
18890
18891 !! test
18892 new support for bdi element (bug 31817)
18893 !! wikitext
18894 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
18895 !! html
18896 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
18897
18898 !!end
18899
18900 !! test
18901 Ignore pipe between table row attributes
18902 !! wikitext
18903 {|
18904 | quux
18905 |- id=foo | style='color: red'
18906 | bar
18907 |}
18908 !! html
18909 <table>
18910 <tr>
18911 <td> quux
18912 </td></tr>
18913 <tr id="foo" style="color: red">
18914 <td> bar
18915 </td></tr></table>
18916
18917 !! end
18918
18919 !!test
18920 Gallery override link with WikiLink (bug 34852)
18921 !! wikitext
18922 <gallery>
18923 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
18924 </gallery>
18925 !! html
18926 <ul class="gallery mw-gallery-traditional">
18927 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18928 <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>
18929 <div class="gallerytext">
18930 <p>caption
18931 </p>
18932 </div>
18933 </div></li>
18934 </ul>
18935
18936 !! end
18937
18938 !!test
18939 Gallery override link with absolute external link (bug 34852)
18940 !! wikitext
18941 <gallery>
18942 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
18943 </gallery>
18944 !! html
18945 <ul class="gallery mw-gallery-traditional">
18946 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18947 <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>
18948 <div class="gallerytext">
18949 <p>caption
18950 </p>
18951 </div>
18952 </div></li>
18953 </ul>
18954
18955 !! end
18956
18957 !!test
18958 Gallery override link with malicious javascript (bug 34852)
18959 !! wikitext
18960 <gallery>
18961 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
18962 </gallery>
18963 !! html
18964 <ul class="gallery mw-gallery-traditional">
18965 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18966 <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>
18967 <div class="gallerytext">
18968 <p>caption
18969 </p>
18970 </div>
18971 </div></li>
18972 </ul>
18973
18974 !! end
18975
18976 !!test
18977 Gallery with invalid title as link (bug 43964)
18978 !! wikitext
18979 <gallery>
18980 File:foobar.jpg|link=<
18981 </gallery>
18982 !! html
18983 <ul class="gallery mw-gallery-traditional">
18984 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18985 <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>
18986 <div class="gallerytext">
18987 </div>
18988 </div></li>
18989 </ul>
18990
18991 !! end
18992
18993 !!test
18994 Language parser function
18995 !! wikitext
18996 {{#language:ar}}
18997 !! html
18998 <p>العربية
18999 </p>
19000 !! end
19001
19002 !!test
19003 Padleft and padright as substr
19004 !! wikitext
19005 {{padleft:|3|abcde}}
19006 {{padright:|3|abcde}}
19007 !! html
19008 <p>abc
19009 abc
19010 </p>
19011 !! end
19012
19013 !!test
19014 Special parser function
19015 !! wikitext
19016 {{#special:RandomPage}}
19017 {{#special:BaDtItLe}}
19018 {{#special:Foobar}}
19019 !! html
19020 <p>Special:Random
19021 Special:Badtitle
19022 Special:Foobar
19023 </p>
19024 !! end
19025
19026 !!test
19027 Bug 34939 - Case insensitive link parsing ([HttP://])
19028 !! wikitext
19029 [HttP://MediaWiki.Org/]
19030 !! html/php
19031 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
19032 </p>
19033 !! html/parsoid
19034 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
19035 !! end
19036
19037 !!test
19038 Bug 34939 - Case insensitive link parsing ([HttP:// title])
19039 !! wikitext
19040 [HttP://MediaWiki.Org/ MediaWiki]
19041 !! html
19042 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
19043 </p>
19044 !! end
19045
19046 !!test
19047 Bug 34939 - Case insensitive link parsing (HttP://)
19048 !! wikitext
19049 HttP://MediaWiki.Org/
19050 !! html/php
19051 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
19052 </p>
19053 !! html/parsoid
19054 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
19055 !! end
19056
19057 !!test
19058 Disable TOC
19059 !! options
19060 notoc
19061 !! wikitext
19062 Lead
19063 == Section 1 ==
19064 == Section 2 ==
19065 == Section 3 ==
19066 == Section 4 ==
19067 == Section 5 ==
19068 !! html
19069 <p>Lead
19070 </p>
19071
19072 <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>
19073 <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>
19074 <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>
19075 <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>
19076 <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>
19077
19078 !! end
19079
19080
19081 ###
19082 ### Parsoid-specific tests
19083 ### Parsoid-PHP parser incompatibilities
19084 ###
19085 !!test
19086 1. SOL-sensitive wikitext tokens as template-args
19087 !!options
19088 parsoid=wt2html,wt2wt
19089 !! wikitext
19090 {{echo|*a}}
19091 {{echo|#a}}
19092 {{echo|:a}}
19093 !! html
19094 <span about="#mwt1" typeof="mw:Transclusion">
19095 </span><ul about="#mwt1"><li>a</li>
19096 </ul>
19097 <span about="#mwt2" typeof="mw:Transclusion">
19098 </span><ol about="#mwt2"><li>a</li>
19099 </ol>
19100 <span about="#mwt3" typeof="mw:Transclusion">
19101 </span><dl about="#mwt3"><dd>a</dd>
19102 </dl>
19103 !!end
19104
19105 #### -----------------------------------------------------------------
19106 #### Parsoid-specific functionality tests
19107 #### -----------------------------------------------------------------
19108
19109 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
19110 # We know wt2wt will fail, but we expect selser to pass.
19111 # Due to the nature of our testing, wt2wt and selser tests will enter the
19112 # blacklist and we'll catch selser regressions based on changes to the
19113 # blacklist entries for selser tests.
19114 !! test
19115 1. Bad treebuilder fixup of formatting elt is cleaned up
19116 !! options
19117 parsoid=wt2html,wt2wt
19118 !! wikitext
19119 {|
19120 |
19121 <small>
19122 [[Image:Foobar.jpg|right|Test]]
19123 </small>
19124 |}
19125 !! html/parsoid
19126 <table>
19127 <tbody><tr><td>
19128 <small>
19129 <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>
19130 </small>
19131 </td></tr>
19132 </tbody></table>
19133 !! end
19134
19135 !! test
19136 2. Bad treebuilder fixup of formatting elt is cleaned up
19137 !! options
19138 parsoid=wt2html,wt2wt
19139 !! wikitext
19140 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
19141
19142 <small>[[Image:Foobar.jpg|right|300px]]</small>
19143 !! html/parsoid
19144 <p><b>foo</b></p>
19145 <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>
19146 <p><b>bar</b></p>
19147 <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>
19148 !! end
19149
19150 #### ----------------------------------------------------------------
19151 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
19152 #### tags. Parsoid's output for these tags differs from that of the
19153 #### PHP parser.
19154 #### ----------------------------------------------------------------
19155
19156 !!test
19157 Ref: 1. ref-location should be replaced with an index span
19158 !!options
19159 parsoid
19160 !! wikitext
19161 A <ref>foo</ref>
19162 B <ref name="x">foo</ref>
19163 C <ref name="y" />
19164 !! html
19165 <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>
19166 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>
19167 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>
19168 !!end
19169
19170 !!test
19171 Ref: 2. ref-tags with identical names should all get the same index
19172 !!options
19173 parsoid
19174 !! wikitext
19175 A <ref name="x">foo</ref>
19176 B <ref name="x" />
19177 !! html
19178 <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>
19179 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>
19180 !!end
19181
19182 !!test
19183 Ref: 3. spaces in ref-names should be ignored
19184 !!options
19185 parsoid
19186 !! wikitext
19187 A <ref name="x">foo</ref>
19188 B <ref name=" x " />
19189 C <ref name= x />
19190 !! html
19191 <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>
19192 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>
19193 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>
19194 !!end
19195
19196 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
19197 !!test
19198 Ref: 4. 'constructor' should be accepted as a valid ref-name
19199 !!options
19200 parsoid
19201 !! wikitext
19202 A <ref name="constructor">foo</ref>
19203 !! html
19204 <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>
19205 !!end
19206
19207 !!test
19208 Ref: 5. body should accept generic wikitext
19209 !!options
19210 parsoid
19211 !! wikitext
19212 A <ref>
19213 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
19214 </ref>
19215
19216 <references />
19217 !! html
19218 <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>
19219
19220 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19221 <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>
19222 </li>
19223 </ol>
19224 !!end
19225
19226 !!test
19227 Ref: 6. indent-pres should not be output in ref-body
19228 !!options
19229 parsoid
19230 !! wikitext
19231 A <ref>
19232 foo
19233 bar
19234 baz
19235 </ref>
19236
19237 <references />
19238 !! html
19239 <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>
19240
19241 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19242 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
19243 bar
19244 baz
19245 </li>
19246 </ol>
19247 !!end
19248
19249 !!test
19250 Ref: 7. No p-wrapping in ref-body
19251 !!options
19252 parsoid
19253 !! wikitext
19254 A <ref>
19255 foo
19256
19257 bar
19258
19259
19260 baz
19261
19262
19263
19264 booz
19265 </ref>
19266
19267 <references />
19268 !! html
19269 <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>
19270
19271 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19272 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
19273
19274 bar
19275
19276
19277 baz
19278
19279
19280
19281 booz
19282 </li>
19283 </ol>
19284 !!end
19285
19286 !!test
19287 Ref: 8. transclusion wikitext has lower precedence
19288 !!options
19289 parsoid
19290 !! wikitext
19291 A <ref> foo {{echo|</ref> B C}}
19292
19293 <references />
19294 !! html
19295 <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>
19296 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19297 <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>
19298 </ol>
19299 !!end
19300
19301 !!test
19302 Ref: 9. unclosed comments should not leak out of ref-body
19303 !!options
19304 parsoid
19305 !! wikitext
19306 A <ref> foo <!--</ref> B C
19307 <references />
19308 !! html
19309 <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>
19310 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19311 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li>
19312 </ol>
19313 !!end
19314
19315 !!test
19316 Ref: 10. Unclosed HTML tags should not leak out of ref-body
19317 !!options
19318 parsoid
19319 !! wikitext
19320 A <ref> <b> foo </ref> B C
19321
19322 <references />
19323 !! html
19324 <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>
19325
19326
19327 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19328 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> <b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></li>
19329 </ol>
19330 !!end
19331
19332 !!test
19333 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
19334 !!options
19335 parsoid
19336 !! wikitext
19337 A <ref>foo</ref> B
19338 C <ref>bar</ref> D
19339 !! html
19340 <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
19341 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>
19342 !!end
19343
19344 !!test
19345 Ref: 12. ref-tags act as trailing newline migration barrier
19346 !!options
19347 parsoid
19348 !! wikitext
19349 <!--the newline at the end of this line moves out of the p-tag-->a
19350
19351 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
19352 <ref />
19353
19354 c
19355 !! html
19356 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
19357
19358
19359 <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>
19360 <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>
19361
19362 <p>c</p>
19363 !!end
19364
19365 !!test
19366 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
19367 !!options
19368 parsoid
19369 !! wikitext
19370 <ref>foo</ref> A
19371 <ref>bar
19372 </ref> B
19373 !! html
19374 <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
19375 <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>
19376 !!end
19377
19378 !!test
19379 Ref: 14. A nested ref-tag should be emitted as plain text
19380 !!options
19381 parsoid
19382 !! wikitext
19383 <ref>foo <ref>bar</ref> baz</ref>
19384
19385 <references />
19386 !! html
19387 <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>
19388
19389 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19390 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo &lt;ref>bar&lt;/ref> baz</li>
19391 </ol>
19392 !!end
19393
19394 !!test
19395 Ref: 15. ref-tags with identical names should get identical indexes
19396 !!options
19397 parsoid
19398 !! wikitext
19399 A1 <ref name="a">foo</ref> A2 <ref name="a" />
19400 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
19401
19402 <references />
19403 !! html
19404 <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>
19405 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>
19406
19407 <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>
19408 </ol>
19409 !!end
19410
19411 ## We don't bother wt2wt-ing non-standard whitespace
19412 !!test
19413 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
19414 !!options
19415 parsoid=wt2html
19416 !! wikitext
19417 A <ref >foo</ref >
19418
19419 <references />
19420 !! html
19421 <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>
19422
19423 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19424 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19425 !!end
19426
19427 !!test
19428 References: 1. references tag without any refs should be handled properly
19429 !!options
19430 parsoid
19431 !! wikitext
19432 <references />
19433 !! html
19434 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
19435 !!end
19436
19437 !!test
19438 References: 2. references tag with group only outputs references from that group
19439 !!options
19440 parsoid
19441 !! wikitext
19442 A <ref group="a">foo</ref>
19443 B <ref group="b">bar</ref>
19444
19445 <references group="a" />
19446 !! html
19447 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
19448 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>
19449
19450 <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>
19451 </ol>
19452 !!end
19453
19454 !!test
19455 References: 3. ref list should be cleared after processing references
19456 !!options
19457 parsoid
19458 !! wikitext
19459 A <ref>foo</ref>
19460
19461 <references />
19462
19463 B <ref>bar</ref>
19464
19465 <references />
19466 !! html
19467 <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>
19468
19469 <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>
19470 </ol>
19471
19472 <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>
19473
19474 <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>
19475 </ol>
19476 !!end
19477
19478 !!test
19479 References: 4. only referenced group should be cleared after processing references
19480 !!options
19481 parsoid
19482 !! wikitext
19483 A <ref group="a">afoo</ref>
19484 B <ref>bfoo</ref>
19485
19486 <references group="a" />
19487
19488 C <ref>cfoo</ref>
19489
19490 <references />
19491 !! html
19492 <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>
19493 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>
19494
19495 <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>
19496 </ol>
19497
19498 <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>
19499
19500 <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>
19501 </ol>
19502 !!end
19503
19504 !!test
19505 References: 5. ref tags in references should be processed while ignoring all other content
19506 !!options
19507 parsoid
19508 !! wikitext
19509 A <ref name="a" />
19510 B <ref name="b">bar</ref>
19511
19512 <references>
19513 <ref name="a">foo</ref>
19514 This should just get lost.
19515 </references>
19516 !! html
19517 <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>
19518 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>
19519
19520
19521 <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>
19522 </ol>
19523 !!end
19524
19525 !!test
19526 References: 6. <references /> from a transclusion
19527 !!options
19528 parsoid
19529 !! wikitext
19530 <ref>Foo</ref> {{echo|<references />}}
19531 !! html
19532 <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>
19533 !!end
19534
19535 !! test
19536 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
19537 !! options
19538 parsoid
19539 !! wikitext
19540 A <ref>foo bar for a</ref>
19541 B <ref group="X" name="b" />
19542
19543 <references />
19544
19545 <references group="X">
19546 <ref name="b">foo</ref>
19547 </references>
19548 !! html
19549 <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>
19550 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>
19551
19552 <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>
19553
19554 <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>
19555 !! end
19556
19557 !! test
19558 Entities in ref name
19559 !! options
19560 parsoid
19561 !! wikitext
19562 <ref name="test &amp; me">hi</ref>
19563 !! html
19564 <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>
19565 !! end
19566
19567 # This test is wt2html only because we're permitting the serializer to produce
19568 # dirty diffs, normalizing the unclosed references to the self-closed version.
19569 !! test
19570 Generate references for unclosed references tag
19571 !! options
19572 parsoid=wt2html
19573 !! wikitext
19574 a<ref>foo</ref>
19575
19576 <references>
19577 !! html
19578 <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>
19579
19580
19581 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19582 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19583 !! end
19584
19585 !! test
19586 New reference serializes on its own line
19587 !! options
19588 parsoid=wt2wt,html2wt
19589 !! wikitext
19590 foo
19591 <references />
19592 !! html
19593 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
19594 !! end
19595
19596 #--------- Test stripping of empty nodes in template content ----------
19597 !!test
19598 Empty LI and TR nodes should be stripped from template content
19599 !!wikitext
19600 {{EmptyLITest}}
19601 {{EmptyTRTest}}
19602 !!html/parsoid
19603 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
19604 <li>a</li>
19605 <li>b</li>
19606 </ul>
19607 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
19608 <tbody>
19609 <tr>
19610 <td>foo</td>
19611 </tr>
19612 <tr>
19613 <td>bar</td>
19614 </tr>
19615 </tbody>
19616 </table>
19617 !!end
19618
19619 !!test
19620 Empty LI and TR nodes should not be stripped from top-level content
19621 !!wikitext
19622 * a
19623 *
19624 * b
19625 {|
19626 |-
19627 |-
19628 |foo
19629 |}
19630 !!html/parsoid
19631 <ul>
19632 <li> a</li>
19633 <li></li>
19634 <li> b</li>
19635 </ul>
19636 <table>
19637 <tbody>
19638 <tr></tr>
19639 <tr>
19640 <td>foo</td>
19641 </tr>
19642 </tbody>
19643 </table>
19644 !!end
19645
19646 !!test
19647 Empty TR nodes should not be stripped if they have any attributes set
19648 !!wikitext
19649 {{EmptyTRWithHTMLAttrTest}}
19650 !!html/parsoid
19651 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
19652 <tr align="center"></tr>
19653 <tr><td>foo</td></tr>
19654 <tr align="center"></tr>
19655 <tr><td>bar</td></tr>
19656 </table>
19657 !!end
19658
19659 #### ----------------------------------------------------------------
19660 #### The following section of tests are primarily to test
19661 #### wikitext escaping capabilities of Parsoid. Given that
19662 #### escaping can be done any number of ways, the wikitext (input)
19663 #### is always adjusted to reflect how Parsoid adds nowiki
19664 #### escape tags.
19665 ####
19666 #### We are marking several tests as parsoid-only since the
19667 #### HTML in the result section is different from what the
19668 #### PHP parser generates for it.
19669 #### ----------------------------------------------------------------
19670
19671
19672 #### --------------- Headings ---------------
19673 #### 0. Unnested
19674 #### 1. Nested inside html <h1>=foo=</h1>
19675 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
19676 #### 3. Nested inside html with wikitext split by html tags
19677 #### 4. No escape needed
19678 #### 5. Empty headings <h1></h1>
19679 #### 6. Heading chars in SOL context
19680 #### ----------------------------------------
19681 !! test
19682 Headings: 0. Unnested
19683 !! options
19684 parsoid
19685 !! wikitext
19686 <nowiki>=foo=</nowiki>
19687
19688 <nowiki> =foo= </nowiki>
19689 <!--cmt-->
19690 <nowiki>=foo=</nowiki>
19691
19692 =foo''a''<nowiki>=</nowiki>
19693 !! html
19694 <p><span typeof="mw:Nowiki">=foo=</span></p>
19695
19696 <p><span typeof="mw:Nowiki"> =foo= </span>
19697 <!--cmt-->
19698 <span typeof="mw:Nowiki">=foo=</span></p>
19699
19700 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
19701 !!end
19702
19703 # New headings and existing headings are handled differently
19704 !! test
19705 Headings: 1. Nested inside html
19706 !! options
19707 parsoid=html2wt
19708 !! wikitext
19709 = =foo= =
19710
19711 == =foo= ==
19712
19713 === =foo= ===
19714
19715 =<nowiki>=foo=</nowiki>=
19716 ==<nowiki>=foo=</nowiki>==
19717 ===<nowiki>=foo=</nowiki>===
19718 ====<nowiki>=foo=</nowiki>====
19719 =====<nowiki>=foo=</nowiki>=====
19720 ======<nowiki>=foo=</nowiki>======
19721
19722 !! html
19723 <h1>=foo=</h1>
19724 <h2>=foo=</h2>
19725 <h3>=foo=</h3>
19726
19727 <h1 data-parsoid=''>=foo=</h1>
19728 <h2 data-parsoid=''>=foo=</h2>
19729 <h3 data-parsoid=''>=foo=</h3>
19730 <h4 data-parsoid=''>=foo=</h4>
19731 <h5 data-parsoid=''>=foo=</h5>
19732 <h6 data-parsoid=''>=foo=</h6>
19733 !!end
19734
19735 !! test
19736 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
19737 !! options
19738 parsoid=html2wt
19739 !! wikitext
19740 = foo =
19741 <nowiki>*</nowiki>bar
19742
19743 = foo =
19744 =bar
19745
19746 = foo =
19747 <nowiki>=bar=</nowiki>
19748 !! html
19749 <h1>foo</h1>*bar
19750 <h1>foo</h1>=bar
19751 <h1>foo</h1>=bar=
19752 !!end
19753
19754 !! test
19755 Headings: 3. Nested inside html with wikitext split by html tags
19756 !! options
19757 parsoid=html2wt
19758 !! wikitext
19759 = ='''bold'''<nowiki>foo=</nowiki> =
19760 !! html
19761 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
19762 !!end
19763
19764 !! test
19765 Headings: 4a. No escaping needed (testing just h1 and h2)
19766 !! options
19767 parsoid=html2wt
19768 !! wikitext
19769 = =foo =
19770
19771 = foo= =
19772
19773 = =foo= =
19774
19775 = =foo= bar =
19776
19777 == =foo ==
19778
19779 == foo= ==
19780
19781 = ''=''foo= =
19782
19783 = <nowiki>=</nowiki> =
19784 !! html
19785 <h1>=foo</h1>
19786 <h1>foo=</h1>
19787 <h1> =foo= </h1>
19788 <h1>=foo= bar</h1>
19789 <h2>=foo</h2>
19790 <h2>foo=</h2>
19791 <h1><i>=</i>foo=</h1>
19792 <h1><span typeof="mw:Nowiki">=</span></h1>
19793 !!end
19794
19795 !! test
19796 Headings: 4b. No escaping needed (inside p-tags)
19797 !! options
19798 parsoid=html2wt
19799 !! wikitext
19800 ===
19801 =foo= x
19802 =foo= <s></s>
19803 !! html
19804 <p>===
19805 =foo= x
19806 =foo= <s></s>
19807 </p>
19808 !!end
19809
19810 !! test
19811 Headings: 5. Empty headings
19812 !! options
19813 parsoid
19814 !! wikitext
19815 =<nowiki/>=
19816
19817 ==<nowiki/>==
19818
19819 ===<nowiki/>===
19820
19821 ====<nowiki/>====
19822
19823 =====<nowiki/>=====
19824
19825 ======<nowiki/>======
19826 !! html
19827 <h1></h1>
19828 <h2></h2>
19829 <h3></h3>
19830 <h4></h4>
19831 <h5></h5>
19832 <h6></h6>
19833 !!end
19834
19835 !! test
19836 Headings: 6a. Heading chars in SOL context (with trailing spaces)
19837 !! options
19838 parsoid
19839 !! wikitext
19840 <nowiki>=a=</nowiki>
19841
19842 <nowiki>=a=</nowiki>
19843
19844 <nowiki>=a=</nowiki>
19845
19846 <nowiki>=a=</nowiki>
19847 !! html
19848 <p>=a=</p>
19849 <p>=a= </p>
19850 <p>=a= </p>
19851 <p>=a= </p>
19852 !!end
19853
19854 !! test
19855 Headings: 6b. Heading chars in SOL context (with trailing newlines)
19856 !! options
19857 parsoid
19858 !! wikitext
19859 <nowiki>=a=
19860 b</nowiki>
19861
19862 <nowiki>=a=
19863 b</nowiki>
19864
19865 <nowiki>=a=
19866 b</nowiki>
19867
19868 <nowiki>=a=
19869 b</nowiki>
19870 !! html
19871 <p>=a=
19872 b</p>
19873 <p>=a=
19874 b</p>
19875 <p>=a=
19876 b</p>
19877 <p>=a=
19878 b</p>
19879 </p>
19880 !!end
19881
19882 !! test
19883 Headings: 6c. Heading chars in SOL context (leading newline break)
19884 !! options
19885 parsoid
19886 !! wikitext
19887 a
19888 <nowiki>=b=</nowiki>
19889 !! html
19890 <p>a
19891 =b=</p>
19892 !!end
19893
19894 !! test
19895 Headings: 6d. Heading chars in SOL context (with interspersed comments)
19896 !! options
19897 parsoid
19898 !! wikitext
19899 <!--c0--><nowiki>=a=</nowiki>
19900
19901 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
19902 !! html
19903 <p><!--c0-->=a=</p>
19904 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
19905 !!end
19906
19907 !! test
19908 Headings: 6d. Heading chars in SOL context (No escaping needed)
19909 !! options
19910 parsoid=html2wt
19911 !! wikitext
19912 =a=<div>b</div>
19913 !! html
19914 =a=<div>b</div>
19915 !!end
19916
19917 #### --------------- Lists ---------------
19918 #### 0. Outside nests (*foo, etc.)
19919 #### 1. Nested inside html <ul><li>*foo</li></ul>
19920 #### 2. Inside definition lists
19921 #### 3. Only bullets at start should be escaped
19922 #### 4. No escapes needed
19923 #### 5. No unnecessary escapes
19924 #### 6. Escape bullets in SOL position
19925 #### 7. Escape bullets in a multi-line context
19926 #### ----------------------------------------
19927
19928 !! test
19929 Lists: 0. Outside nests
19930 !! wikitext
19931 <nowiki>*</nowiki>foo
19932
19933 <nowiki>#</nowiki>foo
19934
19935 <nowiki>;Foo:</nowiki>bar
19936 !! html
19937 <p>*foo
19938 </p><p>#foo
19939 </p><p>;Foo:bar
19940 </p>
19941 !!end
19942
19943 !! test
19944 Lists: 1. Nested inside html
19945 !! wikitext
19946 *<nowiki>*foo</nowiki>
19947
19948 *<nowiki>#foo</nowiki>
19949
19950 *<nowiki>:foo</nowiki>
19951
19952 *<nowiki>;foo</nowiki>
19953
19954 #<nowiki>*foo</nowiki>
19955
19956 #<nowiki>#foo</nowiki>
19957
19958 #<nowiki>:foo</nowiki>
19959
19960 #<nowiki>;foo</nowiki>
19961 !! html
19962 <ul><li>*foo</li></ul>
19963 <ul><li>#foo</li></ul>
19964 <ul><li>:foo</li></ul>
19965 <ul><li>;foo</li></ul>
19966 <ol><li>*foo</li></ol>
19967 <ol><li>#foo</li></ol>
19968 <ol><li>:foo</li></ol>
19969 <ol><li>;foo</li></ol>
19970
19971 !!end
19972
19973 !! test
19974 Lists: 2. Inside definition lists
19975 !! wikitext
19976 ;<nowiki>;foo</nowiki>
19977
19978 ;<nowiki>:foo</nowiki>
19979
19980 ;<nowiki>:foo</nowiki>
19981 :bar
19982
19983 :<nowiki>:foo</nowiki>
19984 !! html
19985 <dl><dt>;foo</dt></dl>
19986 <dl><dt>:foo</dt></dl>
19987 <dl><dt>:foo</dt>
19988 <dd>bar</dd></dl>
19989 <dl><dd>:foo</dd></dl>
19990
19991 !!end
19992
19993 !! test
19994 Lists: 3. Only bullets at start of text should be escaped
19995 !! wikitext
19996 *<nowiki>*foo*bar</nowiki>
19997
19998 *<nowiki>*foo</nowiki>''it''*bar
19999 !! html
20000 <ul><li>*foo*bar</li></ul>
20001 <ul><li>*foo<i>it</i>*bar</li></ul>
20002
20003 !!end
20004
20005 !! test
20006 Lists: 4. No escapes needed
20007 !! options
20008 parsoid
20009 !! wikitext
20010 *foo*bar
20011
20012 *''foo''*bar
20013
20014 *[[Foo]]: bar
20015
20016 *[[Foo]]*bar
20017 !! html
20018 <ul>
20019 <li>foo*bar
20020 </li>
20021 </ul>
20022 <ul>
20023 <li><i>foo</i>*bar
20024 </li>
20025 </ul>
20026 <ul>
20027 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
20028 </li>
20029 </ul>
20030 <ul>
20031 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
20032 </li>
20033 </ul>
20034 !!end
20035
20036 !! test
20037 Lists: 5. No unnecessary escapes
20038 !! wikitext
20039 * bar <span><nowiki>[[foo]]</nowiki></span>
20040
20041 *=bar <span><nowiki>[[foo]]</nowiki></span>
20042
20043 *[[bar <span><nowiki>[[foo]]</nowiki></span>
20044
20045 *]]bar <span><nowiki>[[foo]]</nowiki></span>
20046
20047 *=bar <span>foo]]</span>=
20048
20049 * <s></s>: a
20050 !! html
20051 <ul><li> bar <span>[[foo]]</span></li></ul>
20052 <ul><li>=bar <span>[[foo]]</span></li></ul>
20053 <ul><li>[[bar <span>[[foo]]</span></li></ul>
20054 <ul><li>]]bar <span>[[foo]]</span></li></ul>
20055 <ul><li>=bar <span>foo]]</span>=</li></ul>
20056 <ul><li> <s></s>: a</li></ul>
20057
20058 !!end
20059
20060 !! test
20061 Lists: 6. Escape bullets in SOL position
20062 !! options
20063 parsoid
20064 !! wikitext
20065 <!--cmt--><nowiki>*foo</nowiki>
20066 !! html
20067 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
20068 !!end
20069
20070 !! test
20071 Lists: 7. Escape bullets in a multi-line context
20072 !! wikitext
20073 a
20074 <nowiki>*</nowiki>b
20075 !! html
20076 <p>a
20077 *b
20078 </p>
20079 !!end
20080
20081 #### --------------- HRs ---------------
20082 #### 1. Single line
20083 #### -----------------------------------
20084
20085 !! test
20086 HRs: 1. Single line
20087 !! options
20088 parsoid
20089 !! wikitext
20090 ----<nowiki>----</nowiki>
20091 ----=foo=
20092 ----*foo
20093 !! html
20094 <hr><p><span typeof="mw:Nowiki">----</span></p>
20095 <hr><p>=foo=</p>
20096 <hr><p>*foo</p>
20097 !! end
20098
20099 #### --------------- Tables ---------------
20100 #### 1a. Simple example
20101 #### 1b. No escaping needed (!foo)
20102 #### 1c. No escaping needed (|foo)
20103 #### 1d. No escaping needed (|}foo)
20104 ####
20105 #### 2a. Nested in td (<td>foo|bar</td>)
20106 #### 2b. Nested in td (<td>foo||bar</td>)
20107 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
20108 ####
20109 #### 3a. Nested in th (<th>foo!bar</th>)
20110 #### 3b. Nested in th (<th>foo!!bar</th>)
20111 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
20112 ####
20113 #### 4a. Escape -
20114 #### 4b. Escape +
20115 #### 4c. No escaping needed
20116 #### --------------------------------------
20117
20118 !! test
20119 Tables: 1a. Simple example
20120 !! wikitext
20121 <nowiki>{|
20122 |}</nowiki>
20123 !! html
20124 <p>{|
20125 |}
20126 </p>
20127 !! end
20128
20129 !! test
20130 Tables: 1b. No escaping needed
20131 !! wikitext
20132 !foo
20133 !! html
20134 <p>!foo
20135 </p>
20136 !! end
20137
20138 !! test
20139 Tables: 1c. No escaping needed
20140 !! wikitext
20141 |foo
20142 !! html
20143 <p>|foo
20144 </p>
20145 !! end
20146
20147 !! test
20148 Tables: 1d. No escaping needed
20149 !! wikitext
20150 |}foo
20151 !! html
20152 <p>|}foo
20153 </p>
20154 !! end
20155
20156 !! test
20157 Tables: 2a. Nested in td
20158 !! options
20159 parsoid=html2wt
20160 !! wikitext
20161 {|
20162 |<nowiki>foo|bar</nowiki>
20163 |-
20164 |x<div><nowiki>a|b</nowiki></div>
20165 |}
20166 !! html
20167 <table><tbody><tr>
20168 <td>foo|bar</td></tr>
20169 <tr><td>x<div>a|b</div></td>
20170 </tbody></table>
20171 !! end
20172
20173 !! test
20174 Tables: 2b. Nested in td
20175 !! options
20176 parsoid
20177 !! wikitext
20178 {|
20179 |<nowiki>foo||bar</nowiki>
20180 |''it''<nowiki>foo||bar</nowiki>
20181 |}
20182 !! html
20183 <table><tbody><tr>
20184 <td><span typeof="mw:Nowiki">foo||bar</span></td>
20185 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
20186 !! end
20187
20188 !! test
20189 Tables: 2c. Nested in td -- no escaping needed
20190 !! options
20191 parsoid
20192 !! wikitext
20193 {|
20194 |foo!!bar
20195 |}
20196 !! html
20197 <table><tbody><tr><td>foo!!bar
20198 </td></tr></tbody></table>
20199
20200 !! end
20201
20202 !! test
20203 Tables: 3a. Nested in th
20204 !! options
20205 parsoid
20206 !! wikitext
20207 {|
20208 !foo!bar
20209 |}
20210 !! html
20211 <table><tbody><tr><th>foo!bar
20212 </th></tr></tbody></table>
20213
20214 !! end
20215
20216 !! test
20217 Tables: 3b. Nested in th
20218 !! options
20219 parsoid
20220 !! wikitext
20221 {|
20222 !<nowiki>foo!!bar</nowiki>
20223 |}
20224 !! html
20225 <table>
20226 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
20227 </tbody></table>
20228 !! end
20229
20230 !! test
20231 Tables: 3c. Nested in th -- no escaping needed
20232 !! options
20233 parsoid
20234 !! wikitext
20235 {|
20236 !<nowiki>foo||bar</nowiki>
20237 |}
20238 !! html
20239 <table><tbody><tr>
20240 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
20241 !! end
20242
20243 !! test
20244 Tables: 4a. Escape -
20245 !! options
20246 parsoid
20247 !! wikitext
20248 {|
20249 !-bar
20250 |-
20251 |<nowiki>-bar</nowiki>
20252 |}
20253 !! html
20254 <table><tbody>
20255 <tr><th>-bar</th></tr>
20256 <tr>
20257 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
20258 !! end
20259
20260 !! test
20261 Tables: 4b. Escape +
20262 !! options
20263 parsoid
20264 !! wikitext
20265 {|
20266 !+bar
20267 |-
20268 |<nowiki>+bar</nowiki>
20269 |}
20270 !! html
20271 <table><tbody>
20272 <tr><th>+bar</th></tr>
20273 <tr>
20274 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
20275 !! end
20276
20277 !! test
20278 Tables: 4c. No escaping needed
20279 !! options
20280 parsoid
20281 !! wikitext
20282 {|
20283 |foo-bar
20284 |foo+bar
20285 |-
20286 |''foo''-bar
20287 |''foo''+bar
20288 |-
20289 |foo
20290 bar|baz
20291 +bar
20292 -bar
20293 |-
20294 |x
20295 <div>a|b</div>
20296 |}
20297 !! html
20298 <table><tbody>
20299 <tr><td>foo-bar</td><td>foo+bar</td></tr>
20300 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
20301 <tr><td>foo
20302 <p>bar|baz
20303 +bar
20304 -bar</p></td></tr>
20305 <tr><td>x
20306 <div>a|b</div></td>
20307 </tbody></table>
20308 !! end
20309
20310 !! test
20311 Tables: 4d. No escaping needed
20312 !! options
20313 parsoid
20314 !! wikitext
20315 {|
20316 |[[Foo]]-bar
20317 ||+1
20318 ||-2
20319 |}
20320 !! html
20321 <table>
20322 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
20323 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
20324 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
20325 </tbody></table>
20326 !! end
20327
20328 !! test
20329 Tables: Digest broken attributes on table and tr tag
20330 !! options
20331 parsoid=wt2html
20332 !! wikitext
20333 {| || |} ++
20334 |- || || ++ --
20335 |- > [
20336 |}
20337 !! html
20338 <table>
20339 <tbody>
20340 <tr></tr>
20341 <tr></tr>
20342 </tbody></table>
20343 !! end
20344
20345 #### --------------- Links ----------------
20346 #### 1. Quote marks in link text
20347 #### 2. Wikilinks: Escapes needed
20348 #### 3. Wikilinks: No escapes needed
20349 #### 4. Extlinks: Escapes needed
20350 #### 5. Extlinks: No escapes needed
20351 #### --------------------------------------
20352 !! test
20353 Links 1. Quote marks in link text
20354 !! options
20355 parsoid
20356 !! wikitext
20357 [[Foo|Foo<nowiki>''boo''</nowiki>]]
20358 !! html
20359 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
20360 !! end
20361
20362 !! test
20363 Links 2. WikiLinks: Escapes needed
20364 !! options
20365 parsoid
20366 !! wikitext
20367 [[Foo|[Foobar]]]
20368 [[Foo|<nowiki>Foobar]</nowiki>]]
20369 [[Foo|x [Foobar] x]]
20370 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
20371 [[Foo|<nowiki>[[Bar]]</nowiki>]]
20372 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
20373 [[Foo|<nowiki>|Bar</nowiki>]]
20374 [[Foo|<nowiki>]]bar</nowiki>]]
20375 [[Foo|<nowiki>[[bar</nowiki>]]
20376 [[Foo|<nowiki>x [[ y</nowiki>]]
20377 [[Foo|<nowiki>x ]] y</nowiki>]]
20378 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
20379 !! html
20380 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
20381 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
20382 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
20383 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
20384 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
20385 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
20386 <a href="Foo" rel="mw:WikiLink">|Bar</a>
20387 <a href="Foo" rel="mw:WikiLink">]]bar</a>
20388 <a href="Foo" rel="mw:WikiLink">[[bar</a>
20389 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
20390 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
20391 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
20392 !! end
20393
20394 !! test
20395 Links 3. WikiLinks: No escapes needed
20396 !! options
20397 parsoid
20398 !! wikitext
20399 [[Foo|[Foobar]]
20400 [[Foo|foo|bar]]
20401 !! html
20402 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
20403 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
20404 !! end
20405
20406 !! test
20407 Links 4. ExtLinks: Escapes needed
20408 !! options
20409 parsoid
20410 !! wikitext
20411 [http://google.com <nowiki>[google]</nowiki>]
20412 [http://google.com <nowiki>google]</nowiki>]
20413
20414 <nowiki>[http://google.com]</nowiki>
20415
20416 <nowiki>[http://google.com google]</nowiki>
20417
20418 !! html
20419 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
20420 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
20421 <p>[http://google.com]</p>
20422 <p>[http://google.com google]</p>
20423 !! end
20424
20425 !! test
20426 Links 5. ExtLinks: No escapes needed
20427 !! options
20428 parsoid
20429 !! wikitext
20430 [http://google.com [google]
20431 !! html
20432 <a href="http://google.com" rel="mw:ExtLink">[google</a>
20433 !! end
20434
20435 !! test
20436 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
20437 !! html/parsoid
20438 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
20439 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
20440 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
20441 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
20442 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
20443 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
20444 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20445 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
20446 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20447 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
20448 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
20449 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
20450 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
20451 </p>
20452 !! wikitext
20453 x<nowiki/>http://example.com<nowiki/>y
20454 http://example.com<nowiki/>?x
20455 http://example.com<nowiki/>&x
20456 http://example.com<nowiki/>'x
20457 http://example.com<nowiki/>,x
20458 http://example.com<nowiki/>.x
20459 http://example.com<nowiki/>;x
20460 http://example.com<nowiki/>:x
20461 http://example.com<nowiki/>;x
20462 http://example.com<nowiki/>!x
20463 http://example.com<nowiki/>=x
20464 http://example.com<nowiki/>(x)
20465 http://example.com(x<nowiki/>)
20466 !! end
20467
20468 !! test
20469 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20470 !! html/parsoid
20471 <p>x
20472 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
20473 y
20474 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
20475 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
20476 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
20477 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
20478 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
20479 </p>
20480 !! wikitext
20481 x
20482 http://example.com
20483 y
20484 "http://example.com"
20485 (http://example.com)
20486 (http://example.com) foo
20487 http://example.com,
20488 http://example.com, foo
20489 !! end
20490
20491 ## Parsoid currently fails wt2html on this one!
20492 !! test
20493 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20494 !! html/parsoid
20495 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
20496 !! wikitext
20497 http://example.com.,;:!?
20498 !! end
20499
20500 !! test
20501 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
20502 !! html/parsoid
20503 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
20504 !! wikitext
20505 RFC 123<nowiki/>4
20506 !! end
20507
20508 !! test
20509 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
20510 !! html/parsoid
20511 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20512 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20513 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
20514 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
20515 </p>
20516 !! wikitext
20517 xRFC 123y
20518 XRFC 123y
20519 RFC 123?foo
20520 RFC 123&foo
20521 !! end
20522
20523 !! test
20524 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
20525 !! html/parsoid
20526 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
20527 !! wikitext
20528 PMID 123<nowiki/>4
20529 !! end
20530
20531 !! test
20532 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
20533 !! html/parsoid
20534 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20535 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20536 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
20537 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
20538 </p>
20539 !! wikitext
20540 xPMID 123y
20541 XPMID 123y
20542 PMID 123?foo
20543 PMID 123&foo
20544 !! end
20545
20546 !! test
20547 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
20548 !! html/parsoid
20549 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
20550 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
20551 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
20552 </p>
20553 !! wikitext
20554 ISBN 1234567890<nowiki/>1
20555 ISBN 1234567890<nowiki/>x
20556 ISBN 1234567890<nowiki/>b
20557 !! end
20558
20559 !! test
20560 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
20561 !! html/parsoid
20562 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
20563 !! wikitext
20564 ISBN 1234567890's
20565 !! end
20566
20567 #### --------------- Quotes ---------------
20568 #### 1. Quotes inside <b> and <i>
20569 #### 2. Link fragments separated by <i> and <b> tags
20570 #### 3. Link fragments inside <i> and <b>
20571 #### 4. No escaping needed
20572 #### --------------------------------------
20573 !! test
20574 1. Quotes inside <b> and <i>
20575 !! options
20576 parsoid=html2wt,wt2wt
20577 !! wikitext
20578 ''<nowiki>'foo'</nowiki>''
20579 ''<nowiki>''foo''</nowiki>''
20580 ''<nowiki>'''foo'''</nowiki>''
20581 ''foo''<nowiki/>'s
20582 '''<nowiki>'foo'</nowiki>'''
20583 '''<nowiki>''foo''</nowiki>'''
20584 '''<nowiki>'''foo'''</nowiki>'''
20585 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
20586 '''foo'''<nowiki/>'s
20587 '''foo''
20588 ''foo''<nowiki/>'
20589 '<nowiki/>''foo''<nowiki/>'
20590 ''''foo'''
20591 '''foo'''<nowiki/>'
20592 '<nowiki/>'''foo'''<nowiki/>'
20593 ''fools'<span> errand</span>''
20594 ''<span>fool</span>'s errand''
20595 !! html
20596 <p><i>'foo'</i>
20597 <i>''foo''</i>
20598 <i>'''foo'''</i>
20599 <i>foo</i>'s
20600 <b>'foo'</b>
20601 <b>''foo''</b>
20602 <b>'''foo'''</b>
20603 <b>foo'<i>bar'</i>baz</b>
20604 <b>foo</b>'s
20605 '<i>foo</i>
20606 <i>foo</i>'
20607 '<i>foo</i>'
20608 '<b>foo</b>
20609 <b>foo</b>'
20610 '<b>foo</b>'</p>
20611 <i>fools'<span> errand</span></i>
20612 <i><span>fool</span>'s errand</i>
20613 !! end
20614
20615 !! test
20616 2. Link fragments separated by <i> and <b> tags
20617 !! wikitext
20618 [[''foo''<nowiki>hello]]</nowiki>
20619
20620 [['''foo'''<nowiki>hello]]</nowiki>
20621 !! html
20622 <p>[[<i>foo</i>hello]]
20623 </p><p>[[<b>foo</b>hello]]
20624 </p>
20625 !! end
20626
20627 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
20628 # this is one of the shortcomings of this format
20629 !! test
20630 3. Link fragments inside <i> and <b>
20631 !! wikitext
20632 ''[[foo''<nowiki>]]</nowiki>
20633
20634 '''[[foo'''<nowiki>]]</nowiki>
20635 !! html
20636 <p><i>[[foo</i>]]
20637 </p><p><b>[[foo</b>]]
20638 </p>
20639 !! end
20640
20641 !! test
20642 4. No escaping needed
20643 !! wikitext
20644 '<span>''bar''</span>'
20645 '<span>'''bar'''</span>'
20646 !! html
20647 <p>'<span><i>bar</i></span>'
20648 '<span><b>bar</b></span>'
20649 </p>
20650 !! end
20651
20652 #### ----------- Paragraphs ---------------
20653 #### 1. No unnecessary escapes
20654 #### --------------------------------------
20655
20656 !! test
20657 1. No unnecessary escapes
20658 !! wikitext
20659 bar <span><nowiki>[[foo]]</nowiki></span>
20660
20661 =bar <span><nowiki>[[foo]]</nowiki></span>
20662
20663 [[bar <span><nowiki>[[foo]]</nowiki></span>
20664
20665 ]]bar <span><nowiki>[[foo]]</nowiki></span>
20666
20667 =bar <span>foo]]</span><nowiki>=</nowiki>
20668 !! html
20669 <p>bar <span>[[foo]]</span>
20670 </p><p>=bar <span>[[foo]]</span>
20671 </p><p>[[bar <span>[[foo]]</span>
20672 </p><p>]]bar <span>[[foo]]</span>
20673 </p><p>=bar <span>foo]]</span>=
20674 </p>
20675 !!end
20676
20677 #### ----------------------- PRE --------------------------
20678 #### 1. Leading whitespace in SOL context should be escaped
20679 #### ------------------------------------------------------
20680 !! test
20681 1. Leading whitespace in SOL context should be escaped
20682 !! options
20683 parsoid
20684 !! wikitext
20685 <nowiki> </nowiki>a
20686
20687 <nowiki> </nowiki> a
20688
20689 <nowiki> </nowiki>a(tab)
20690
20691 <nowiki> </nowiki> a
20692 <!--cmt-->
20693 <nowiki> </nowiki> a
20694
20695 a
20696 <nowiki> </nowiki>b
20697
20698 a
20699 <nowiki> </nowiki>b
20700
20701 a
20702 <nowiki> </nowiki> b
20703 !! html
20704 <p> a</p>
20705 <p> a</p>
20706 <p> a(tab)</p>
20707 <p> a</p>
20708 <p><!--cmt--> a</p>
20709 <p>a
20710 b</p>
20711 <p>a
20712 b</p>
20713 <p>a
20714 b</p>
20715 !! end
20716
20717 !! test
20718 2. Leading whitespace in non-indent-pre contexts should not be escaped
20719 !! options
20720 parsoid
20721 !! wikitext
20722 foo <ref>''a''
20723 b</ref>
20724 !! html
20725 <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>
20726 !! end
20727
20728 !! test
20729 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
20730 !! options
20731 parsoid
20732 !! wikitext
20733 <blockquote>
20734 a
20735 <span>b</span>
20736 c
20737 </blockquote>
20738 !! html
20739 <blockquote>
20740 <p>
20741 a
20742 <span>b</span>
20743 c</p>
20744 </blockquote>
20745 !! end
20746
20747 !! test
20748 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
20749 !! options
20750 parsoid
20751 !! wikitext
20752 [[File:Foobar.jpg|thumb|caption]]
20753 !! html
20754 !! html/parsoid
20755 <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>
20756 !! end
20757
20758 !! test
20759 5. Nowiki escaping should account for indent-pres
20760 !! options
20761 parsoid=html2wt
20762 !! html
20763 <pre>==foo==</pre>
20764 !! wikitext
20765 ==foo==
20766 !! end
20767
20768 #### --------------- Behavior Switches --------------------
20769 !! test
20770 1. Valid behavior switches should be escaped
20771 !! options
20772 parsoid=html2wt
20773 !! wikitext
20774 <nowiki>__TOC__</nowiki>
20775 ''<nowiki>__TOC__</nowiki>''
20776 !! html
20777 __TOC__
20778 <i>__TOC__</i>
20779 !! end
20780
20781 !! test
20782 2. Invalid behavior switches should not be escaped
20783 !! options
20784 parsoid=html2wt
20785 !! wikitext
20786 __TOO__
20787 __|__
20788 !! html
20789 __TOO__
20790 __|__
20791 !! end
20792
20793 #### --------------- HTML tags ---------------
20794 #### 1. a tags
20795 #### 2. other tags
20796 #### 3. multi-line html tag
20797 #### 4. extension tags
20798 #### -----------------------------------------
20799 !! test
20800 1. a tags
20801 !! options
20802 parsoid
20803 !! wikitext
20804 <a href="http://google.com">google</a>
20805 !! html
20806 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
20807 !! end
20808
20809 !! test
20810 2. other tags
20811 !! wikitext
20812 <nowiki><div>foo</div>
20813 <div style="color:red">foo</div></nowiki>
20814 !! html
20815 <p>&lt;div&gt;foo&lt;/div&gt;
20816 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
20817 </p>
20818 !! end
20819
20820 !! test
20821 3. multi-line html tag
20822 !! wikitext
20823 <nowiki><div
20824 >foo</div
20825 ></nowiki>
20826 !! html
20827 <p>&lt;div
20828 &gt;foo&lt;/div
20829 &gt;
20830 </p>
20831 !! end
20832
20833 !! test
20834 4. extension tags
20835 !! wikitext
20836 <nowiki><ref>foo</ref></nowiki>
20837
20838 <nowiki><ref>bar</nowiki>
20839
20840 baz<nowiki></ref></nowiki>
20841 !! html
20842 <p>&lt;ref&gt;foo&lt;/ref&gt;
20843 </p><p>&lt;ref&gt;bar
20844 </p><p>baz&lt;/ref&gt;
20845 </p>
20846 !! end
20847
20848 #### --------------- Others ---------------
20849 !! test
20850 Escaping nowikis
20851 !! wikitext
20852 &lt;nowiki&gt;foo&lt;/nowiki&gt;
20853 !! html
20854 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
20855 </p>
20856 !! end
20857
20858 ## The quote-char in the input is necessary for triggering the bug
20859 !! test
20860 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
20861 !! options
20862 parsoid=wt2wt,html2wt
20863 !! wikitext
20864 foo's bar :
20865 !! html
20866 <p>foo's bar :</p>
20867 !! end
20868
20869 !! test
20870
20871 Tag-like HTML structures are passed through as text
20872 !! wikitext
20873 <x y>
20874
20875 <x.y>
20876
20877 <x-y>
20878
20879 1>2
20880
20881 x<y
20882
20883 a>b
20884
20885 1<d e>f
20886 !! html
20887 <p>&lt;x y&gt;
20888 </p><p>&lt;x.y&gt;
20889 </p><p>&lt;x-y&gt;
20890 </p><p>1&gt;2
20891 </p><p>x&lt;y
20892 </p><p>a&gt;b
20893 </p><p>1&lt;d e&gt;f
20894 </p>
20895 !! end
20896
20897
20898 # This was a bug in the PHP parser (see bug 17663 and its dups,
20899 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
20900 !! test
20901 Tag names followed by punctuation should not be recognized as tags
20902 !! wikitext
20903 <s.ome> text
20904 !! html
20905 <p>&lt;s.ome&gt; text
20906 </p>
20907 !! end
20908
20909 !! test
20910 HTML tag with necessary entities in attributes
20911 !! wikitext
20912 <span title="&amp;amp;">foo</span>
20913 !! html
20914 <p><span title="&amp;amp;">foo</span>
20915 </p>
20916 !! end
20917
20918 !! test
20919 HTML tag with 'unnecessary' entity encoding in attributes
20920 !! wikitext
20921 <span title="&amp;">foo</span>
20922 !! html
20923 <p><span title="&amp;">foo</span>
20924 </p>
20925 !! end
20926
20927 !! test
20928 HTML tag with broken attribute value quoting
20929 !! wikitext
20930 <span title="Hello world>Foo</span>
20931 !! html/php
20932 <p><span>Foo</span>
20933 </p>
20934 !! html/parsoid
20935 <p><span title="Hello world">Foo</span>
20936 </p>
20937 !! end
20938
20939 !! test
20940 Parsoid-only: HTML tag with broken attribute value quoting
20941 !! options
20942 parsoid
20943 !! wikitext
20944 <span title="Hello world>Foo</span>
20945 !! html
20946 <p><span title="Hello world">Foo</span>
20947 </p>
20948 !! end
20949
20950 !! test
20951 Table with broken attribute value quoting
20952 !! wikitext
20953 {|
20954 | title="Hello world|Foo
20955 |}
20956 !! html/php
20957 <table>
20958 <tr>
20959 <td>Foo
20960 </td></tr></table>
20961
20962 !! html/parsoid
20963 <table>
20964 <tr>
20965 <td title="Hello world">Foo
20966 </td></tr></table>
20967
20968 !! end
20969
20970 !! test
20971 Table with broken attribute value quoting on consecutive lines
20972 !! wikitext
20973 {|
20974 | title="Hello world|Foo
20975 | style="color:red|Bar
20976 |}
20977 !! html/php
20978 <table>
20979 <tr>
20980 <td>Foo
20981 </td>
20982 <td>Bar
20983 </td></tr></table>
20984
20985 !! html/parsoid
20986 <table><tbody>
20987 <tr>
20988 <td title="Hello world">Foo
20989 </td><td style="color: red">Bar
20990 </td></tr></tbody></table>
20991
20992 !! end
20993
20994 !! test
20995 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
20996 !! options
20997 parsoid
20998 !! wikitext
20999 {{}}
21000 !! html
21001 {{}}
21002 !! end
21003
21004 !! test
21005 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21006 !! options
21007 parsoid
21008 !! wikitext
21009 }}{{
21010 !! html
21011 }}{{
21012 !! end
21013
21014 !!test
21015 Accept empty td cell attribute
21016 !! wikitext
21017 {|
21018 | align="center" | foo || |
21019 |}
21020 !! html
21021 <table>
21022 <tr>
21023 <td align="center"> foo </td>
21024 <td>
21025 </td></tr></table>
21026
21027 !!end
21028
21029 !!test
21030 Non-empty attributes in th-cells
21031 !! wikitext
21032 {|
21033 ! Foo !! style="color: red" | Bar
21034 |}
21035 !! html
21036 <table>
21037 <tr>
21038 <th> Foo </th>
21039 <th style="color: red"> Bar
21040 </th></tr></table>
21041
21042 !!end
21043
21044 !!test
21045 Accept empty attributes in th-cells
21046 !! wikitext
21047 {|
21048 !| foo !!| bar
21049 |}
21050 !! html
21051 <table>
21052 <tr>
21053 <th> foo </th>
21054 <th> bar
21055 </th></tr></table>
21056
21057 !!end
21058
21059 !!test
21060 Empty table rows go away
21061 !! wikitext
21062 {|
21063 | Hello
21064 | there
21065 |- class="foo"
21066 |-
21067 |}
21068 !! html
21069 <table>
21070 <tr>
21071 <td> Hello
21072 </td>
21073 <td> there
21074 </td></tr>
21075
21076 </table>
21077
21078 !! end
21079
21080 ###
21081 ### Parsoid-centric tests for testing RTing of inter-element separators
21082 ### Edge cases not tested by existing parser tests and specific to
21083 ### Parsoid-specific serialization strategies.
21084 ###
21085
21086 !!test
21087 RT-ed inter-element separators should be valid separators
21088 !! wikitext
21089 {|
21090 |- [[foo]]
21091 |}
21092 !! html
21093 <table>
21094
21095 </table>
21096
21097 !!end
21098
21099 # Parsoid-only since PHP parser relies on Tidy for correct output
21100 !!test
21101 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
21102 !!options
21103 parsoid
21104 !! wikitext
21105 {|
21106 |<small>foo
21107 bar
21108 |}
21109
21110 {|
21111 |<small>foo<small>
21112 |}
21113 !! html
21114 <table>
21115 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
21116 <p>bar</p></small></td></tr>
21117 </tbody></table>
21118
21119 <table>
21120 <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>
21121 </tbody></table>
21122 !!end
21123
21124 !!test
21125 Empty TD followed by TD with tpl-generated attribute
21126 !! wikitext
21127 {|
21128 |-
21129 |
21130 |{{echo|style='color:red'}}|foo
21131 |}
21132 !! html
21133 <table>
21134
21135 <tr>
21136 <td>
21137 </td>
21138 <td>foo
21139 </td></tr></table>
21140
21141 !!end
21142
21143 !!test
21144 Indented table with an empty td
21145 !! wikitext
21146 {|
21147 |-
21148 |
21149 |foo
21150 |}
21151 !! html
21152 <table>
21153
21154 <tr>
21155 <td>
21156 </td>
21157 <td>foo
21158 </td></tr></table>
21159
21160 !!end
21161
21162 !!test
21163 Indented block & table
21164 !! wikitext
21165 <div>foo</div>
21166 {|
21167 |foo
21168 |}
21169 !! html/php
21170 <div>foo</div>
21171 <table>
21172 <tr>
21173 <td>foo
21174 </td></tr></table>
21175
21176 !! html/parsoid
21177 <div data-parsoid='{"stx":"html"}'>foo</div>
21178 <table><tbody>
21179 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
21180 </tbody></table>
21181 !!end
21182
21183 !! test
21184 Indent and comment before table row
21185 !! wikitext
21186 {|
21187 <!--hi-->|-
21188 | there
21189 |}
21190 !! html/php
21191 <table>
21192
21193 <tr>
21194 <td> there
21195 </td></tr></table>
21196
21197 !! html/parsoid
21198 <table>
21199 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
21200 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
21201 </tbody></table>
21202 !! end
21203
21204 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
21205 !!test
21206 Empty TR followed by a template-generated TR
21207 !!options
21208 parsoid
21209 !! wikitext
21210 {|
21211 |-
21212 {{echo|<tr><td>foo</td></tr>}}
21213 |}
21214 !! html
21215 <table>
21216 <tbody>
21217 <tr></tr>
21218 <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}}]}'>
21219 <td>foo</td></tr>
21220 </tbody></table>
21221 !!end
21222
21223 ## PHP and parsoid output differ for this, and since this is primarily
21224 ## for testing Parsoid's serializer, marking this Parsoid only
21225 !!test
21226 Empty TR followed by mixed-ws-comment line should RT correctly
21227 !!options
21228 parsoid
21229 !! wikitext
21230 {|
21231 |-
21232 <!--c-->
21233 |-
21234 <!--c--> <!--d-->
21235 |}
21236 !! html
21237 <table>
21238 <tbody>
21239 <tr></tr>
21240 <!--c-->
21241 <tr>
21242 <!--c--> </tr><!--d-->
21243 </tbody></table>
21244
21245 !!end
21246
21247 !!test
21248 Multi-line image caption generated by templates with/without trailing newlines
21249 !!options
21250 parsoid
21251 !! wikitext
21252 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
21253 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
21254 !! html
21255 <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>
21256 <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>
21257
21258 !!end
21259
21260 !! test
21261 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
21262 !! options
21263 parsoid=html2wt
21264 !! wikitext
21265 <includeonly>foo</includeonly>
21266 new para
21267
21268 [[./Category:Foo]]
21269
21270 = new heading =
21271 !! html
21272 <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>
21273
21274 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
21275 !! end
21276
21277 ## PHP emits broken html for this, and since this is primarily
21278 ## a Parsoid serializer test, marking this Parsoid only
21279 !!test
21280 Improperly nested inline or quotes tags with whitespace in between
21281 !!options
21282 parsoid
21283 !! wikitext
21284 <span> <s>x</span> </s>
21285 ''' ''x''' ''
21286 !! html
21287 <p><span> <s>x</s></span><s> </s>
21288 <b> <i>x</i></b><i> </i>
21289 </p>
21290 !!end
21291
21292 !!test
21293 Encapsulate protected attributes from wt
21294 !!options
21295 parsoid
21296 !! wikitext
21297 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
21298 !! html
21299 <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>
21300 </body>
21301 !!end
21302
21303 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
21304 ## Having nested or stray pre tags results in the attempt to add duplicates,
21305 ## causing an assertion fail. This test tries to prevent that situation.
21306 !!test
21307 Ensure ParagraphWrapper can deal with stray closing pre tags
21308 !!options
21309 parsoid=wt2html
21310 !! wikitext
21311 plain text</pre>
21312 !! html
21313 plain text
21314 !!end
21315
21316 !!test
21317 1. Ensure fostered text content is wrapped in element nodes
21318 !!options
21319 parsoid=wt2html
21320 !! wikitext
21321 <table>hi</table><table>ho</table>
21322 !! html
21323 <p>hi</p>
21324 <table></table>
21325 <p>ho</p>
21326 <table></table>
21327 !!end
21328
21329 !!test
21330 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
21331 !!options
21332 parsoid=wt2html,wt2wt
21333 !! wikitext
21334 <table>
21335 <tr> || ||
21336 <td> a
21337 </table>
21338 !! html
21339 <p> || ||
21340 </p><table>
21341 <tbody><tr><td> a</td></tr>
21342 </tbody></table>
21343 !!end
21344
21345 !!test
21346 Encapsulation properly handles null DSR information from foster box
21347 !!options
21348 parsoid=wt2html,wt2wt
21349 !! wikitext
21350 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
21351 !! html
21352 <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>
21353 !!end
21354
21355 !!test
21356 1. Encapsulate foster-parented transclusion content
21357 !!options
21358 parsoid=wt2wt,wt2html
21359 !! wikitext
21360 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
21361 !! html
21362 <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>
21363 <tbody>
21364 <tr>
21365 <td>bar</td>
21366 </tr>
21367 </tbody>
21368 </table>
21369 !!end
21370
21371 !!test
21372 2. Encapsulate foster-parented transclusion content
21373 !!options
21374 parsoid=wt2wt,wt2html
21375 !! wikitext
21376 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
21377 !! html
21378 <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>
21379 <table>
21380 <tbody>
21381 <tr>
21382 <td>bar</td>
21383 </tr>
21384 </tbody>
21385 </table>
21386 !!end
21387
21388 !!test
21389 3. Encapsulate foster-parented transclusion content
21390 !!options
21391 parsoid=wt2wt,wt2html
21392 !! wikitext
21393 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21394 !! html
21395 <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;]}">
21396 <p>foo</p>
21397 </div>
21398 <table>
21399 <tbody>
21400 <tr>
21401 <td>bar</td>
21402 </tr>
21403 </tbody>
21404 </table>
21405 !!end
21406
21407 !!test
21408 4. Encapsulate foster-parented transclusion content
21409 !!options
21410 parsoid=wt2wt,wt2html
21411 !! wikitext
21412 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21413 !! html
21414 <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;]}">
21415 <p>foo</p>
21416 </div>
21417 <table>
21418 <tbody>
21419 <tr>
21420 <td>bar</td>
21421 </tr>
21422 </tbody>
21423 </table>
21424 !!end
21425
21426 !!test
21427 5. Encapsulate foster-parented transclusion content
21428 !!options
21429 parsoid=wt2wt,wt2html
21430 !! wikitext
21431 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
21432 !! html
21433 <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>
21434 <table>
21435 <tbody>
21436 <tr>
21437 <td>
21438 <div>
21439 <p>foo</p>
21440 </div>
21441 </td>
21442 </tr>
21443 </tbody>
21444 </table>
21445 !!end
21446
21447 !!test
21448 6. Encapsulate foster-parented transclusion content
21449 !!options
21450 parsoid=wt2wt,wt2html
21451 !! wikitext
21452 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
21453 !! html
21454 <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>
21455 <table>
21456 <tbody>
21457 <tr>
21458 <td>
21459 <div>
21460 <p>foo</p>
21461 </div>
21462 </td>
21463 </tr>
21464 </tbody>
21465 </table>
21466 <p>ok</p>
21467 !!end
21468
21469 !!test
21470 7. Encapsulate foster-parented transclusion content
21471 !!options
21472 parsoid=wt2wt,wt2html
21473 !! wikitext
21474 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
21475 !! html
21476 <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>
21477 <table>
21478 <tbody>
21479 <tr>
21480 <td>bar</td>
21481 </tr>
21482 </tbody>
21483 </table>
21484 !!end
21485
21486 !!test
21487 8. Encapsulate foster-parented transclusion content
21488 !!options
21489 parsoid=wt2wt,wt2html
21490 !! wikitext
21491 {{echo|a
21492 }}{|{{echo|style='color:red'}}
21493 |-
21494 |b
21495 |}
21496 !! html
21497 <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>
21498 <tbody>
21499 <tr>
21500 <td>b</td>
21501 </tr>
21502 </tbody>
21503 </table>
21504 !!end
21505
21506 !!test
21507 9. Encapsulate foster-parented transclusion content
21508 !!options
21509 parsoid=wt2wt,wt2html
21510 !! wikitext
21511 <table>{{echo|hi</table>hello}}
21512 !! html
21513 <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>
21514 !!end
21515
21516 !!test
21517 Table in fosterable position
21518 !!options
21519 parsoid=wt2html,wt2wt
21520 !! wikitext
21521 {{OpenTable}}
21522 <div>
21523 {|
21524 |}
21525 </div>
21526 |}
21527 !! html
21528 <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">
21529 </span>
21530 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
21531
21532 <table>
21533 </table>
21534 !!end
21535
21536 # Parsoid only for bug 64747
21537 !! test
21538 Properly encapsulate empty-content transclusions in fosterable positions
21539 !! wikitext
21540 <table>
21541 {{#if:|
21542 <td>foo</td>
21543 }}
21544 </table>
21545 !! html/parsoid
21546 <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>"}'>
21547
21548 </table>
21549 !! end
21550
21551 !!test
21552 Support <object> element with .data attribute
21553 !!options
21554 parsoid=html2wt
21555 !! wikitext
21556 <object data="test.swf"></object>
21557 !! html
21558 <object data="test.swf"></object>
21559 !!end
21560
21561 # -----------------------------------------------------------------
21562 # The following section of tests are primarily to spec requirements
21563 # around serialization of new/edited content.
21564 #
21565 # All these tests are marked Parsoid html2wt and html2html only
21566 # ----------------------------------------------------------------
21567
21568 # 'mi' is a localinterwiki prefix as well as a language
21569 !! test
21570 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
21571 !! options
21572 parsoid=html2wt
21573 !! wikitext
21574 [[Foo]]
21575 !! html
21576 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
21577 !! end
21578
21579 !! test
21580 Image: Modifying size of an image (1)
21581 !! options
21582 parsoid={
21583 "modes": ["wt2wt"],
21584 "changes": [
21585 ["img[height]", "attr", "height", "22"],
21586 ["img[width]", "attr", "width", "200"]
21587 ]
21588 }
21589 !! wikitext
21590 [[Image:Foobar.jpg|230x230px]]
21591 !! wikitext/edited
21592 [[Image:Foobar.jpg|200x200px]]
21593 !!end
21594
21595 !! test
21596 Image: Modifying size of an image (2)
21597 !! options
21598 parsoid={
21599 "modes": ["wt2wt"],
21600 "changes": [
21601 ["img[height]", "attr", "height", "100"],
21602 ["img[width]", "attr", "width", "500"]
21603 ]
21604 }
21605 !! wikitext
21606 [[Image:Foobar.jpg|230x230px]]
21607 !! wikitext/edited
21608 [[Image:Foobar.jpg|500x500px]]
21609 !!end
21610
21611 # Change in size is ignored so long as class='mw-default-size'
21612 !! test
21613 Image: Modifying size of an image (3)
21614 !! options
21615 parsoid={
21616 "modes": ["wt2wt"],
21617 "changes": [
21618 ["figure[class]", "removeClass", "mw-default-size"],
21619 ["figure img", "attr", "height", "19"],
21620 ["figure img", "attr", "width", "170"]
21621 ]
21622 }
21623 !! wikitext
21624 [[Image:Foobar.jpg|thumb]]
21625 !! wikitext/edited
21626 [[Image:Foobar.jpg|thumb|170x170px]]
21627 !!end
21628
21629 !! test
21630 Image: Modifying alignment of an image (bug 48665)
21631 !! options
21632 parsoid={
21633 "modes": ["wt2wt"],
21634 "changes": [
21635 ["figure[class]", "removeClass", "mw-halign-right"],
21636 ["figure[class]", "addClass", "mw-halign-left"]
21637 ]
21638 }
21639 !! wikitext
21640 [[Image:Foobar.jpg|thumb|caption|right]]
21641 !! wikitext/edited
21642 [[Image:Foobar.jpg|thumb|caption|left]]
21643 !! end
21644
21645 !! test
21646 Image: Modifying mw-default-size of an frameless image (bug 62805)
21647 !! options
21648 parsoid={
21649 "modes": ["wt2wt"],
21650 "changes": [
21651 ["figure.mw-default-size", "removeClass", "mw-default-size"]
21652 ]
21653 }
21654 !! wikitext
21655 [[Image:Foobar.jpg|frameless|right]]
21656 !! wikitext/edited
21657 [[Image:Foobar.jpg|frameless|right|220x220px]]
21658 !! end
21659
21660 !! test
21661 Image: Modifying valign of an image (bug 49221)
21662 !! options
21663 parsoid={
21664 "modes": ["wt2wt"],
21665 "changes": [
21666 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
21667 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
21668 ]
21669 }
21670 !! wikitext
21671 [[File:Foobar.jpg|20px|middle]]
21672 !! wikitext/edited
21673 [[File:Foobar.jpg|20px|text-top]]
21674 !! end
21675
21676 !! test
21677 Image: Modifying alt attribute of an image (bug 56400)
21678 !! options
21679 parsoid={
21680 "modes": ["wt2wt"],
21681 "changes": [
21682 ["img[alt]", "attr", "alt", "some alternate edited text"]
21683 ]
21684 }
21685 !! wikitext
21686 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
21687 !! wikitext/edited
21688 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
21689 !!end
21690
21691 !! test
21692 Image: Modifying caption of an image
21693 !! options
21694 parsoid={
21695 "modes": ["wt2wt"],
21696 "changes": [
21697 ["figcaption", "text", "new caption"]
21698 ]
21699 }
21700 !! wikitext
21701 [[Image:Foobar.jpg|thumb|original caption]]
21702 !! wikitext/edited
21703 [[Image:Foobar.jpg|thumb|new caption]]
21704 !!end
21705
21706 !! test
21707 Image: empty alt attribute (bug 48924)
21708 !! options
21709 parsoid
21710 !! wikitext
21711 [[File:Foobar.jpg|thumb|alt=|bar]]
21712 !! html
21713 <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>
21714 !! end
21715
21716 #!! test
21717 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
21718 #!! options
21719 #parsoid=html2wt
21720 #language=ar
21721 #!! input
21722 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
21723 #!! result
21724 #<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>
21725 #!! end
21726
21727 !! test
21728 Image: Block level image should have \n before and after
21729 !! options
21730 parsoid
21731 !! wikitext
21732 123
21733 [[File:Foobar.jpg|right|thumb|150x150px]]
21734 456
21735 !! html
21736 <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>
21737 !!end
21738
21739 !! test
21740 Image: New block level image should have \n before and after (existing content)
21741 !! options
21742 parsoid
21743 !! wikitext
21744 123
21745 [[File:Foobar.jpg|right|thumb|150x150px]]
21746 456
21747 !! html
21748 <p>123</p>
21749 <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>
21750 <p>456</p>
21751 !!end
21752
21753 !! test
21754 Image: upright option (parsoid)
21755 !! options
21756 parsoid
21757 !! wikitext
21758 [[File:Foobar.jpg|thumb|upright|caption]]
21759 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
21760 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
21761 !! html
21762 <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>
21763 <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>
21764 <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>
21765 !!end
21766
21767 !! test
21768 Image: upright option is ignored on inline and frame images (parsoid)
21769 !! options
21770 parsoid
21771 !! wikitext
21772 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
21773 !! html
21774 <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>
21775 !!end
21776
21777 !! test
21778 Image: from basic HTML (1)
21779 !! options
21780 parsoid=html2wt
21781 !! html/parsoid
21782 <span typeof="mw:Image">
21783 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
21784 </span>
21785 !! wikitext
21786 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
21787 !! end
21788
21789 !! test
21790 Image: from basic HTML (2)
21791 !! options
21792 parsoid=html2wt
21793 !! html/parsoid
21794 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
21795 !! wikitext
21796 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
21797 !! end
21798
21799 !! test
21800 Image: from basic HTML (3)
21801 !! options
21802 parsoid=html2wt
21803 !! html/parsoid
21804 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
21805 !! wikitext
21806 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
21807 !! end
21808
21809 !! test
21810 Image: from basic HTML (4)
21811 !! options
21812 parsoid=html2wt
21813 !! html/parsoid
21814 <img src="File:Foobar.jpg">
21815 !! wikitext
21816 [[File:Foobar.jpg|link=]]
21817 !! end
21818
21819 !! test
21820 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
21821 !! options
21822 parsoid=html2wt
21823 !! wikitext
21824 * foo
21825 !! html
21826 <ul>
21827 <li><p>foo</p></li>
21828 </ul>
21829 !! end
21830
21831 !! test
21832 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
21833 !! options
21834 parsoid=html2wt
21835 !! wikitext
21836 * foo
21837 !! html
21838 <ul> <li>foo</li></ul>
21839 !! end
21840
21841 !! test
21842 Don't strip leading whitespace when handling indent-pre suppressing tags
21843 !! options
21844 parsoid=html2wt
21845 !! wikitext
21846 {|
21847 | indented row
21848 |}
21849 <blockquote>
21850 '''This is very bold of you!'''
21851
21852 {|
21853 |
21854 indented cell (no pre-wrapping!)
21855 |}
21856 </blockquote>
21857 foo
21858 <div>bar</div>
21859 !! html
21860 <table>
21861 <tr><td> indented row</td></tr>
21862 </table>
21863 <blockquote><p>
21864 <b>This is very bold of you!</b>
21865 </p>
21866 <table><tr><td>
21867 indented cell (no pre-wrapping!)
21868 </td></tr></table>
21869 </blockquote>
21870 <p>foo</p>
21871 <div>bar</div>
21872 !! end
21873
21874 !! test
21875 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
21876 !! options
21877 parsoid=html2wt
21878 !! wikitext
21879 foo
21880 <nowiki> </nowiki><span>bar</span>
21881
21882 <span>foo2
21883 <nowiki> </nowiki></span>bar2
21884
21885 <div>foo</div>
21886 <nowiki> </nowiki><span>bar</span>
21887
21888 <div>
21889 <nowiki> </nowiki><span>foo</span>
21890 </div>
21891 !! html
21892 <p>foo</p>
21893 <span>bar</span>
21894
21895 <span>foo2
21896 </span>bar2
21897
21898 <div>foo</div>
21899 <span>bar</span>
21900
21901 <div>
21902 <span>foo</span>
21903 </div>
21904 !! end
21905
21906 !! test
21907 Lists: Add space after bullets
21908 !! options
21909 parsoid=html2wt
21910 !! wikitext
21911 * foo
21912 * bar
21913 * <span> baz</span>
21914 !! html
21915 <ul>
21916 <li>foo</li>
21917 <li> bar</li>
21918 <li><span> baz</span></li>
21919 </ul>
21920 !! end
21921
21922 !! test
21923 Lists: Dont insert newlines in a serialized list item.
21924 !! options
21925 parsoid=html2wt
21926 !! wikitext
21927 * a<br>b
21928 * c
21929 !! html
21930 <ul><li>a<br>b</li><li>c</li></ul>
21931 !! end
21932
21933 !! test
21934 Headings: Add space before/after == (Bug 51744)
21935 !! options
21936 parsoid=html2wt
21937 !! wikitext
21938 == foo ==
21939
21940 == bar ==
21941
21942 == baz ==
21943
21944 == <span> baz</span> ==
21945 !! html
21946 <h2>foo</h2>
21947 <h2> bar</h2>
21948 <h2>baz </h2>
21949 <h2><span> baz</span></h2>
21950 !! end
21951
21952 !! test
21953 Parsoid: Serialize positional parameters with = in them as named parameter
21954 !! options
21955 parsoid=html2wt
21956 !! wikitext
21957 {{echo|1 = f=oo}}
21958
21959 {{echo|1 = f=oo|2 = bar}}
21960
21961 <!--Orig params with data-parsoid has heuristics for handling = chars-->
21962 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
21963 {{echo|<nowiki>f=oo</nowiki>|bar}}
21964 !! html
21965 <p about="#mwt1" typeof="mw:Transclusion"
21966 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
21967
21968 <p about="#mwt1" typeof="mw:Transclusion"
21969 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
21970
21971 <!--Orig params with data-parsoid has heuristics for handling = chars-->
21972 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
21973 <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>
21974 !! end
21975
21976 !! test
21977 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
21978 !! options
21979 parsoid=html2wt
21980 !! wikitext
21981 <div>a
21982 b
21983 </div>
21984 <div>a
21985 b
21986 </div>
21987 <div>
21988 a
21989
21990 b
21991 </div>
21992 !! html
21993 <div>a<p>b</p></div>
21994 <div>a
21995 <p>b</p></div>
21996 <div>
21997 a
21998 <p>b</p></div>
21999 !! end
22000
22001 !! test
22002 Substrings resembling wikitext in hrefs should not get nowiki escapes
22003 !! options
22004 parsoid=html2wt
22005 !! wikitext
22006 [[Foo''bar''baz]]
22007 !! html
22008 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
22009 !! end
22010
22011 #-----------------------------
22012 # I/B quote minimization tests
22013 #-----------------------------
22014
22015 !! test
22016 1. I/B quote minimization: wikitext-only tags should be combined
22017 !! options
22018 parsoid=html2wt
22019 !! wikitext
22020 ''AB''
22021
22022 '''AB'''
22023
22024 ''A'''B'''''
22025
22026 '''A''B'''''
22027
22028 '''A''BC''D'''
22029
22030 '''''AB'''''
22031
22032 '''''AB'''''
22033
22034 '''''AB'''''
22035 !! html
22036 <p><i>A</i><i>B</i></p>
22037 <p><b>A</b><b>B</b></p>
22038 <p><i>A</i><b><i>B</i></b></p>
22039 <p><b>A</b><i><b>B</b></i></p>
22040 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
22041 <p><i><b>A</b></i><i><b>B</b></i></p>
22042 <p><i><b>A</b></i><b><i>B</i></b></p>
22043 <p><b><i>A</i></b><i><b>B</b></i></p>
22044 !! end
22045
22046 !! test
22047 2. I/B quote minimization: wikitext and html tags should not be combined
22048 !! options
22049 parsoid=html2wt
22050 !! wikitext
22051 ''A''<i>B</i>
22052
22053 ''A'''''<i>B</i>'''
22054 !! html
22055 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
22056 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
22057 !! end
22058
22059 !! test
22060 3. I/B quote minimization: templated content stops minimization
22061 !! options
22062 parsoid=html2wt
22063 !! wikitext
22064 ''A''{{echo|''B''}}
22065
22066 ''A''{{echo|'''''B'''''}}
22067 !! html
22068 <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>
22069 <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>
22070 !! end
22071
22072 !! test
22073 4. I/B quote minimization: new content should be mimimized with adjacent old content
22074 !! options
22075 parsoid=html2wt
22076 !! wikitext
22077 ''AB''
22078
22079 '''AB'''
22080
22081 ''A'''B'''''
22082 !! html
22083 <p><i>A</i><i>B</i></p>
22084 <p><b>A</b><b>B</b></p>
22085 <p><i>A</i><b><i>B</i></b></p>
22086 !! end
22087
22088 #------------------------------------
22089 # End of I/B quote minimization tests
22090 #------------------------------------
22091
22092 !!test
22093 Bug 54262: New entities
22094 !! options
22095 parsoid=html2wt
22096 !! wikitext
22097 &nbsp;
22098 !! html
22099 <span typeof="mw:Entity">&nbsp;</span>
22100 !! end
22101
22102 ## Note that there is no wikitext output for 'unknownproperty' ##
22103 ## Unknown magic words are silently dropped ##
22104
22105 !! test
22106 Magic words
22107 !! options
22108 parsoid=html2wt
22109 !! wikitext
22110 __TOC__
22111 __NOTOC__
22112 __FORCETOC__
22113 __INDEX__
22114 __NOINDEX__
22115 __NOGALLERY__
22116 __NOEDITSECTION__
22117 __NOTITLECONVERT__
22118 __NOCONTENTCONVERT__
22119 !! html
22120 <meta property='mw:PageProp/toc' />
22121 <meta property='mw:PageProp/notoc' />
22122 <meta property='mw:PageProp/forcetoc' />
22123 <meta property='mw:PageProp/index' />
22124 <meta property='mw:PageProp/noindex' />
22125 <meta property='mw:PageProp/nogallery' />
22126 <meta property='mw:PageProp/noeditsection' />
22127 <meta property='mw:PageProp/notitleconvert' />
22128 <meta property='mw:PageProp/nocontentconvert' />
22129 <meta property='mw:PageProp/unknownproperty' />
22130 !! end
22131
22132 !! test
22133 Consecutive <pre>s should not get merged
22134 !! options
22135 parsoid=html2wt,html2html
22136 !! wikitext
22137 a
22138
22139 b
22140
22141 c
22142
22143 d
22144
22145 e
22146
22147
22148
22149 f
22150 !! html
22151 <pre>a</pre><pre>b</pre>
22152
22153 <pre>c
22154 </pre><pre>
22155 d</pre>
22156
22157 <pre>e
22158
22159 </pre><pre>
22160
22161 f</pre>
22162 !! end
22163
22164 !! test
22165 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
22166 !! options
22167 parsoid=html2wt
22168 !! wikitext
22169 [[Special:BookSources/1234567890|ISBN 1234567895]]
22170 !! html
22171 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
22172 !! end
22173
22174 !! test
22175 Edited RFC links not serializable as RFC links should serialize as extlinks
22176 !! options
22177 parsoid=html2wt
22178 !! wikitext
22179 [//tools.ietf.org/html/rfc123 New RFC]
22180 !! html
22181 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
22182 !! end
22183
22184 !! test
22185 Edited PMID links not serializable as PMID links should serialize as extlinks
22186 !! options
22187 parsoid=html2wt
22188 !! wikitext
22189 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
22190 !! html
22191 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
22192 !! end
22193
22194 !! test
22195 Edited Redirect link should emit a non-piped wikitext link
22196 !! options
22197 parsoid=html2wt
22198 !! wikitext
22199 #REDIRECT [[Bar]]
22200 !! html
22201 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
22202 !! end
22203
22204 # -----------------------------------------------------------------
22205 # End of section for Parsoid-only html2wt tests for serialization
22206 # of new content
22207 # -----------------------------------------------------------------
22208
22209 TODO:
22210 more images
22211 more tables
22212 character entities
22213 and much more
22214 Try for 100% code coverage