Support {{!}} as a magic word
[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 Template:Foo
51 !!text
52 FOO
53 !!endarticle
54
55 !! article
56 Template:Blank
57 !! text
58 !! endarticle
59
60 !! article
61 Template:pipe
62 !! text
63 |
64 !! endarticle
65
66 !!article
67 MediaWiki:bad image list
68 !!text
69 * [[File:Bad.jpg]] except [[Nasty page]]
70 !!endarticle
71
72 !! article
73 Template:inner list
74 !! text
75 * item 1
76 !! endarticle
77
78 !! article
79 Template:tbl-start
80 !! text
81 {|
82 !! endarticle
83
84 !! article
85 Template:tbl-end
86 !! text
87 |}
88 !! endarticle
89
90 !! article
91 Template:echo
92 !! text
93 {{{1}}}
94 !! endarticle
95
96 !! article
97 Template:echo_with_span
98 !! text
99 <span>{{{1}}}</span>
100 !! endarticle
101
102 !! article
103 Template:echo_with_div
104 !! text
105 <div>{{{1}}}</div>
106 !! endarticle
107
108 !! article
109 Template:attr_str
110 !! text
111 {{{1}}}="{{{2}}}"
112 !! endarticle
113
114 !! article
115 Template:table_attribs
116 !! text
117 <noinclude>
118 |</noinclude>style="color: red"| Foo
119 !! endarticle
120
121 !! article
122 Template:table_cells
123 !! text
124 {{table_attribs}} || Bar || Baz
125 !! endarticle
126
127 !! article
128 Template:image_attribs
129 !! text
130 <noinclude>
131 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
132 !! endarticle
133
134 !! article
135 A?b
136 !! text
137 Weirdo titles!
138 !! endarticle
139
140 !!article
141 Template:Bullet
142 !!text
143 * Bar
144 !!endarticle
145
146 !!article
147 Template:OpenTable
148 !!text
149 {|
150 !!endarticle
151
152 ###
153 ### Basic tests
154 ###
155 !! test
156 Blank input
157 !! wikitext
158 !! html
159 !! end
160
161
162 !! test
163 Simple paragraph
164 !! wikitext
165 This is a simple paragraph.
166 !! html
167 <p>This is a simple paragraph.
168 </p>
169 !! end
170
171 !! test
172 Paragraphs with extra newline spacing
173 !! wikitext
174 foo
175
176 bar
177
178
179 baz
180
181
182
183 booz
184 !! html
185 <p>foo
186 </p><p>bar
187 </p><p><br />
188 baz
189 </p><p><br />
190 </p><p>booz
191 </p>
192 !! end
193
194 !! test
195 Paragraphs with newline spacing with comment lines in between
196 !! wikitext
197 ----
198 a
199 <!--foo-->
200 b
201 ----
202 a
203 <!--foo--><!--More than 1 comment, still stripped-->
204 b
205 ----
206 a
207 <!--foo--> <!----> <!-- bar -->
208 b
209 ----
210 a
211 <!--foo-->
212
213 b
214 ----
215 a
216
217 <!--foo-->
218 b
219 ----
220 a
221 <!--foo-->
222
223
224 b
225 ----
226 a
227
228
229 <!--foo-->
230 b
231 ----
232 !! html
233 <hr />
234 <p>a
235 b
236 </p>
237 <hr />
238 <p>a
239 b
240 </p>
241 <hr />
242 <p>a
243 b
244 </p>
245 <hr />
246 <p>a
247 </p><p>b
248 </p>
249 <hr />
250 <p>a
251 </p><p>b
252 </p>
253 <hr />
254 <p>a
255 </p><p><br />
256 b
257 </p>
258 <hr />
259 <p>a
260 </p><p><br />
261 b
262 </p>
263 <hr />
264
265 !! end
266
267 !! test
268 Paragraphs with newline spacing with non-empty white-space lines in between
269 !! wikitext
270 ----
271 a
272
273 b
274 ----
275 a
276
277
278 b
279 ----
280 !! html
281 <hr />
282 <p>a
283 </p><p>b
284 </p>
285 <hr />
286 <p>a
287 </p><p><br />
288 b
289 </p>
290 <hr />
291
292 !! end
293
294 !! test
295 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
296 !! wikitext
297 ----
298 a
299 <!--foo-->
300 b
301 ----
302 a
303 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
304 b
305 ----
306 a
307
308 <!--foo-->
309 <!--bar-->
310 b
311 ----
312 a
313
314 <!--foo-->
315 <!--bar-->
316
317 b
318 ----
319 !! html
320 <hr />
321 <p>a
322 b
323 </p>
324 <hr />
325 <p>a
326 b
327 </p>
328 <hr />
329 <p>a
330 </p><p>b
331 </p>
332 <hr />
333 <p>a
334 </p><p><br />
335 b
336 </p>
337 <hr />
338
339 !! end
340
341 !! test
342 Extra newlines: More paragraphs with indented comment
343 !! wikitext
344 a
345
346 <!--boo-->
347
348 b
349 !! html
350 <p>a
351 </p><p><br />
352 b
353 </p>
354 !!end
355
356 !! test
357 Extra newlines followed by heading
358 !! wikitext
359 a
360
361
362
363 =b=
364 [[a]]
365
366
367 =b=
368 !! html
369 <p>a
370 </p><p><br />
371 </p>
372 <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>
373 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
374 </p><p><br />
375 </p>
376 <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>
377
378 !! end
379
380 !! test
381 Extra newlines between heading and content are swallowed
382 !! wikitext
383 =b=
384
385
386
387 [[a]]
388 !! html
389 <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>
390 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
391 </p>
392 !! end
393
394 !! test
395 Parsing an URL
396 !! wikitext
397 http://fr.wikipedia.org/wiki/🍺
398 <!-- EasterEgg we love beer, better be able be able to link to it -->
399 !! html
400 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
401 </p>
402 !! end
403
404 !! test
405 Simple list
406 !! wikitext
407 * Item 1
408 * Item 2
409 !! html
410 <ul><li> Item 1</li>
411 <li> Item 2</li></ul>
412
413 !! end
414
415 !! test
416 Italics and bold
417 !! wikitext
418 * plain
419 * plain''italic''plain
420 * plain''italic''plain''italic''plain
421 * plain'''bold'''plain
422 * plain'''bold'''plain'''bold'''plain
423 * plain''italic''plain'''bold'''plain
424 * plain'''bold'''plain''italic''plain
425 * plain''italic'''bold-italic'''italic''plain
426 * plain'''bold''bold-italic''bold'''plain
427 * plain'''''bold-italic'''italic''plain
428 * plain'''''bold-italic''bold'''plain
429 * plain''italic'''bold-italic'''''plain
430 * plain'''bold''bold-italic'''''plain
431 * plain l'''italic''plain
432 * plain l''''bold''' plain
433 !! html
434 <ul><li> plain</li>
435 <li> plain<i>italic</i>plain</li>
436 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
437 <li> plain<b>bold</b>plain</li>
438 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
439 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
440 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
441 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
442 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
443 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
444 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
445 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
446 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
447 <li> plain l'<i>italic</i>plain</li>
448 <li> plain l'<b>bold</b> plain</li></ul>
449
450 !! end
451
452 # this example taken from the [[simple:Moon]] article (bug 47326)
453 !! test
454 Italics and possessives (1)
455 !! wikitext
456 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
457 !! html
458 <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
459 </p>
460 !! end
461
462 # this example taken from [[en:Flaming Pie]] (bug 49926)
463 !! test
464 Italics and possessives (2)
465 !! wikitext
466 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
467 !! html
468 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
469 </p>
470 !! end
471
472 # this example taken from [[en:Dictionary]] (bug 49926)
473 !! test
474 Italics and possessives (3)
475 !! wikitext
476 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''.
477 !! html
478 <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>.
479 </p>
480 !! end
481
482
483 ###
484 ### 2-quote opening sequence tests
485 ###
486 !! test
487 Italics and bold: 2-quote opening sequence: (2,2)
488 !! wikitext
489 ''foo''
490 !! html
491 <p><i>foo</i>
492 </p>
493 !!end
494
495
496 !! test
497 Italics and bold: 2-quote opening sequence: (2,3)
498 !! options
499 parsoid=wt2html
500 !! wikitext
501 ''foo'''
502 !! html/*
503 <p><i>foo'</i>
504 </p>
505 !!end
506
507
508 # same html as previous, but wikitext adjusted to match parsoid html2wt
509 !! test
510 Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki
511 !! wikitext
512 ''<nowiki>foo'</nowiki>''
513 !! html
514 <p><i>foo'</i>
515 </p>
516 !! end
517
518
519 !! test
520 Italics and bold: 2-quote opening sequence: (2,4)
521 !! options
522 parsoid=wt2html
523 !! wikitext
524 ''foo''''
525 !! html/*
526 <p><i>foo''</i>
527 </p>
528 !!end
529
530
531 # same html as previous, but wikitext adjusted to match parsoid html2wt
532 !! test
533 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
534 !! wikitext
535 ''<nowiki>foo''</nowiki>''
536 !! html
537 <p><i>foo''</i>
538 </p>
539 !! end
540
541
542 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
543 !! test
544 Italics and bold: 2-quote opening sequence: (2,5)
545 !! options
546 parsoid=wt2html
547 !! wikitext
548 ''foo'''''
549 !! html/php
550 <p><i>foo</i>
551 </p>
552 !! html/parsoid
553 <p><i>foo</i><b></b>
554 </p>
555 !!end
556
557 # same html as previous, but wikitext adjusted to match parsoid html2wt
558 !! test
559 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
560 !! wikitext
561 ''foo'''''<nowiki/>'''
562 !! html/php
563 <p><i>foo</i>
564 </p>
565 !! html/parsoid
566 <p><i>foo</i><b></b>
567 </p>
568 !! end
569
570
571 ###
572 ### 3-quote opening sequence tests
573 ###
574
575 !! test
576 Italics and bold: 3-quote opening sequence: (3,2)
577 !! wikitext
578 '''foo''
579 !! html
580 <p>'<i>foo</i>
581 </p>
582 !!end
583
584
585 !! test
586 Italics and bold: 3-quote opening sequence: (3,3)
587 !! wikitext
588 '''foo'''
589 !! html
590 <p><b>foo</b>
591 </p>
592 !!end
593
594
595 !! test
596 Italics and bold: 3-quote opening sequence: (3,4)
597 !! options
598 parsoid=wt2html
599 !! wikitext
600 '''foo''''
601 !! html/*
602 <p><b>foo'</b>
603 </p>
604 !!end
605
606
607 # same html as previous, but wikitext adjusted to match parsoid html2wt
608 !! test
609 Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki
610 !! wikitext
611 '''<nowiki>foo'</nowiki>'''
612 !! html
613 <p><b>foo'</b>
614 </p>
615 !! end
616
617
618 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
619 !! test
620 Italics and bold: 3-quote opening sequence: (3,5)
621 !! options
622 parsoid=wt2html
623 !! wikitext
624 '''foo'''''
625 !! html/php
626 <p><b>foo</b>
627 </p>
628 !! html/parsoid
629 <p><b>foo</b><i></i>
630 </p>
631 !!end
632
633 # same html as previous, but wikitext adjusted to match parsoid html2wt
634 !! test
635 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
636 !! wikitext
637 '''foo'''''<nowiki/>''
638 !! html/php
639 <p><b>foo</b>
640 </p>
641 !! html/parsoid
642 <p><b>foo</b><i></i>
643 </p>
644 !! end
645
646
647 ###
648 ### 4-quote opening sequence tests
649 ###
650
651 !! test
652 Italics and bold: 4-quote opening sequence: (4,2)
653 !! options
654 parsoid=wt2html
655 !! wikitext
656 ''''foo''
657 !! html/*
658 <p>''<i>foo</i>
659 </p>
660 !!end
661
662
663 # same html as previous, but wikitext adjusted to match parsoid html2wt
664 !! test
665 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
666 !! wikitext
667 <nowiki>''</nowiki>''foo''
668 !! html
669 <p>''<i>foo</i>
670 </p>
671 !! end
672
673
674 !! test
675 Italics and bold: 4-quote opening sequence: (4,3)
676 !! wikitext
677 ''''foo'''
678 !! html
679 <p>'<b>foo</b>
680 </p>
681 !!end
682
683
684 !! test
685 Italics and bold: 4-quote opening sequence: (4,4)
686 !! options
687 parsoid=wt2html
688 !! wikitext
689 ''''foo''''
690 !! html/*
691 <p>'<b>foo'</b>
692 </p>
693 !!end
694
695
696 # same html as previous, but wikitext adjusted to match parsoid html2wt
697 !! test
698 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
699 !! wikitext
700 ''''<nowiki>foo'</nowiki>'''
701 !! html
702 <p>'<b>foo'</b>
703 </p>
704 !! end
705
706
707 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
708 !! test
709 Italics and bold: 4-quote opening sequence: (4,5)
710 !! options
711 parsoid=wt2html
712 !! wikitext
713 ''''foo'''''
714 !! html/php
715 <p>'<b>foo</b>
716 </p>
717 !! html/parsoid
718 <p>'<b>foo</b><i></i>
719 </p>
720 !!end
721
722 # same html as previous, but wikitext adjusted to match parsoid html2wt
723 !! test
724 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
725 !! wikitext
726 ''''foo'''''<nowiki/>''
727 !! html/php
728 <p>'<b>foo</b>
729 </p>
730 !! html/parsoid
731 <p>'<b>foo</b><i></i>
732 </p>
733 !! end
734
735
736 ###
737 ### 5-quote opening sequence tests
738 ###
739
740 !! test
741 Italics and bold: 5-quote opening sequence: (5,2)
742 !! options
743 parsoid=wt2html
744 !! wikitext
745 '''''foo''
746 !! html/*
747 <p><b><i>foo</i></b>
748 </p>
749 !!end
750
751
752 # same html as previous, but wikitext adjusted to match parsoid html2wt
753 # skipping wt2html and html2html because it wants to put <i> before <b>
754 !! test
755 Italics and bold: 5-quote opening sequence: (5,2+3)
756 !! options
757 parsoid=wt2wt,html2wt
758 !! wikitext
759 '''''foo'''''
760 !! html/*
761 <p><b><i>foo</i></b>
762 </p>
763 !! end
764
765 !! test
766 Italics and bold: 5-quote opening sequence: (5,3)
767 !! options
768 parsoid=wt2html
769 !! wikitext
770 '''''foo'''
771 !! html/*
772 <p><i><b>foo</b></i>
773 </p>
774 !!end
775
776
777 # same html as previous, but wikitext adjusted to match parsoid html2wt
778 !! test
779 Italics and bold: 5-quote opening sequence: (5,3+2)
780 !! wikitext
781 '''''foo'''''
782 !! html
783 <p><i><b>foo</b></i>
784 </p>
785 !! end
786
787
788 !! test
789 Italics and bold: 5-quote opening sequence: (5,4)
790 !! options
791 parsoid=wt2html
792 !! wikitext
793 '''''foo''''
794 !! html/*
795 <p><i><b>foo'</b></i>
796 </p>
797 !!end
798
799
800 # same html as previous, but wikitext adjusted to match parsoid html2wt
801 !! test
802 Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki
803 !! wikitext
804 '''''<nowiki>foo'</nowiki>'''''
805 !! html
806 <p><i><b>foo'</b></i>
807 </p>
808 !! end
809
810
811 !! test
812 Italics and bold: 5-quote opening sequence: (5,5)
813 !! wikitext
814 '''''foo'''''
815 !! html
816 <p><i><b>foo</b></i>
817 </p>
818 !!end
819
820 ###
821 ### multiple quote sequences in a line
822 ###
823 !! test
824 Italics and bold: multiple quote sequences: (2,4,2)
825 !! options
826 parsoid=wt2html
827 !! wikitext
828 ''foo''''bar''
829 !! html/*
830 <p><i>foo'<b>bar</b></i>
831 </p>
832 !!end
833
834
835 # same html as previous, but wikitext adjusted to match parsoid html2wt
836 !! test
837 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
838 !! wikitext
839 ''<nowiki>foo'</nowiki>'''bar'''''
840 !! html
841 <p><i>foo'<b>bar</b></i>
842 </p>
843 !! end
844
845
846 !! test
847 Italics and bold: multiple quote sequences: (2,4,3)
848 !! options
849 parsoid=wt2html
850 !! wikitext
851 ''foo''''bar'''
852 !! html/*
853 <p><i>foo'<b>bar</b></i>
854 </p>
855 !!end
856
857
858 # same html as previous, but wikitext adjusted to match parsoid html2wt
859 !! test
860 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
861 !! wikitext
862 ''<nowiki>foo'</nowiki>'''bar'''''
863 !! html
864 <p><i>foo'<b>bar</b></i>
865 </p>
866 !! end
867
868
869 !! test
870 Italics and bold: multiple quote sequences: (2,4,4)
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,4+2) w/ nowiki
884 !! wikitext
885 ''<nowiki>foo'</nowiki>'''<nowiki>bar'</nowiki>'''''
886 !! html
887 <p><i>foo'<b>bar'</b></i>
888 </p>
889 !! end
890
891
892 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
893 !! test
894 Italics and bold: multiple quote sequences: (3,4,2)
895 !! options
896 parsoid=wt2html
897 !! wikitext
898 '''foo''''bar''
899 !! html/php
900 <p><b>foo'</b>bar
901 </p>
902 !! html/parsoid
903 <p><b>foo'</b>bar<i></i>
904 </p>
905 !!end
906
907 # same html as previous, but wikitext adjusted to match parsoid html2wt
908 !! test
909 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
910 !! options
911 parsoid
912 !! wikitext
913 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
914 !! html/php
915 <p><b>foo'</b>bar
916 </p>
917 !! html/parsoid
918 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
919 </p>
920 !! end
921
922
923 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
924 !! test
925 Italics and bold: multiple quote sequences: (3,4,3)
926 !! options
927 parsoid=wt2html
928 !! wikitext
929 '''foo''''bar'''
930 !! html/php
931 <p><b>foo'</b>bar
932 </p>
933 !! html/parsoid
934 <p><b>foo'</b>bar<b></b>
935 </p>
936 !!end
937
938 # same html as previous, but wikitext adjusted to match parsoid html2wt
939 !! test
940 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
941 !! wikitext
942 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
943 !! html/php
944 <p><b>foo'</b>bar
945 </p>
946 !! html/parsoid
947 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
948 </p>
949 !! end
950
951 ###
952 ### other quote tests
953 ###
954 !! test
955 Italics and bold: other quote tests: (2,3,5)
956 !! wikitext
957 ''this is about '''foo's family'''''
958 !! html
959 <p><i>this is about <b>foo's family</b></i>
960 </p>
961 !!end
962
963
964 !! test
965 Italics and bold: other quote tests: (2,(3,3),2)
966 !! wikitext
967 ''this is about '''foo's''' family''
968 !! html
969 <p><i>this is about <b>foo's</b> family</i>
970 </p>
971 !!end
972
973
974 !! test
975 Italics and bold: other quote tests: (3,2,3,2)
976 !! options
977 parsoid=wt2html
978 !! wikitext
979 '''this is about ''foo'''s family''
980 !! html/*
981 <p><b>this is about <i>foo</i></b><i>s family</i>
982 </p>
983 !!end
984
985
986 # same html as previous, but wikitext adjusted to match parsoid html2wt
987 # add 'parsoid' option to use 'parsoid' normalization of the placeholder
988 !! test
989 Italics and bold: other quote tests: (3,2,3+2+2,2)
990 !! options
991 parsoid
992 !! wikitext
993 '''this is about ''foo'''''<nowiki/>''s family''
994 !! html/*
995 <p><b>this is about <i>foo</i></b><i>s family</i>
996 </p>
997 !! end
998
999
1000 !! test
1001 Italics and bold: other quote tests: (3,2,3,3)
1002 !! options
1003 !! wikitext
1004 '''this is about ''foo'''s family'''
1005 !! html
1006 <p>'<i>this is about </i>foo<b>s family</b>
1007 </p>
1008 !!end
1009
1010
1011 !! test
1012 Italics and bold: other quote tests: (3,(2,2),3)
1013 !! wikitext
1014 '''this is about ''foo's'' family'''
1015 !! html
1016 <p><b>this is about <i>foo's</i> family</b>
1017 </p>
1018 !!end
1019
1020
1021 !! test
1022 Italicized possessive
1023 !! wikitext
1024 The ''[[Main Page]]'''s talk page.
1025 !! html
1026 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1027 </p>
1028 !! end
1029
1030 !! test
1031 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1032 (Requires tidy for PHP parser output to be fixed up)
1033 !! options
1034 parsoid=wt2html,wt2wt
1035 !! wikitext
1036 {|
1037 !''a!!''b
1038 |''a||''b
1039 |}
1040 !! html
1041 <table>
1042 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1043 <td><i>a</i></td><td><i>b</i></td></tr>
1044 </tbody></table>
1045 !! end
1046
1047 ###
1048 ### Non-html5 tags
1049 ###
1050
1051 !! test
1052 Non-html5 tags should be accepted
1053 !! wikitext
1054 <center>''foo''</center>
1055 <big>''foo''</big>
1056 <font>''foo''</font>
1057 <strike>''foo''</strike>
1058 <tt>''foo''</tt>
1059 !! html
1060 <center><i>foo</i></center>
1061 <p><big><i>foo</i></big>
1062 <font><i>foo</i></font>
1063 <strike><i>foo</i></strike>
1064 <tt><i>foo</i></tt>
1065 </p>
1066 !! end
1067
1068 !! test
1069 <wbr> is valid wikitext (bug 52468)
1070 !! wikitext
1071 <wbr>
1072 !! html
1073 <p><wbr />
1074 </p>
1075 !! end
1076
1077 # <strike> is HTML4, <s> is HTML4/5.
1078 !! test
1079 <s> or <strike> for strikethrough
1080 !! wikitext
1081 <strike>strike</strike>
1082
1083 <s>s</s>
1084 !! html
1085 <p><strike>strike</strike>
1086 </p><p><s>s</s>
1087 </p>
1088 !! end
1089
1090 ## a,rtc not permitted
1091 ## i,b,br omitted
1092 !! test
1093 Text-level semantic html elements in wikitext
1094 !! wikitext
1095 <em>text</em>
1096 <strong>text</strong>
1097 <small>text</small>
1098 <s>text</s>
1099 <cite>text</cite>
1100 <q>text</q>
1101 <dfn>text</dfn>
1102 <abbr>text</abbr>
1103 <data>text</data>
1104 <time>text</time>
1105 <code>text</code>
1106 <var>text</var>
1107 <samp>text</samp>
1108 <kbd>text</kbd>
1109 <sub>text</sub>
1110 <u>text</u>
1111 <mark>text</mark>
1112 <ruby><rb>明日<rp>(</rp><rt>Ashita</rt><rp>)</rp></rb></ruby>
1113 <bdi>text</bdi>
1114 <bdo>text</bdo>
1115 <span>text</span>
1116 <wbr />
1117 !! html
1118 <p><em>text</em>
1119 <strong>text</strong>
1120 <small>text</small>
1121 <s>text</s>
1122 <cite>text</cite>
1123 <q>text</q>
1124 <dfn>text</dfn>
1125 <abbr>text</abbr>
1126 <data>text</data>
1127 <time>text</time>
1128 <code>text</code>
1129 <var>text</var>
1130 <samp>text</samp>
1131 <kbd>text</kbd>
1132 <sub>text</sub>
1133 <u>text</u>
1134 <mark>text</mark>
1135 <ruby><rb>明日<rp>(</rp><rt>Ashita</rt><rp>)</rp></rb></ruby>
1136 <bdi>text</bdi>
1137 <bdo>text</bdo>
1138 <span>text</span>
1139 <wbr />
1140 </p>
1141 !! end
1142
1143 !! test
1144 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1145 !! wikitext
1146 <b→> doesn't work! </b→>
1147
1148 <bä> doesn't work! </bä>
1149
1150 <boo> works fine </boo>
1151
1152 <s.foo>s.foo</s.foo>
1153
1154 <sub-ID#1>
1155 !! html
1156 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1157 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1158 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1159 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1160 </p><p>&lt;sub-ID#1&gt;
1161 </p>
1162 !! end
1163
1164 !! test
1165 Isolated close tags should be treated as literal text (bug 52760)
1166 !! wikitext
1167 </b>
1168
1169 <s.foo>s</s>
1170 !! html
1171 <p>&lt;/b&gt;
1172 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1173 </p>
1174 !! end
1175
1176 ###
1177 ### Special characters
1178 ###
1179
1180 !! test
1181 Bare pipe character (bug 52363)
1182 !! wikitext
1183 |
1184 !! html
1185 <p>|
1186 </p>
1187 !! end
1188
1189 !! test
1190 Bare pipe character from a template (bug 52363)
1191 !! wikitext
1192 {{pipe}}
1193 !! html
1194 <p>|
1195 </p>
1196 !! end
1197
1198 ###
1199 ### <nowiki> test cases
1200 ###
1201
1202 !! test
1203 <nowiki> unordered list
1204 !! wikitext
1205 <nowiki>* This is not an unordered list item.</nowiki>
1206 !! html
1207 <p>* This is not an unordered list item.
1208 </p>
1209 !! end
1210
1211 !! test
1212 <nowiki> spacing
1213 !! wikitext
1214 <nowiki>Lorem ipsum dolor
1215
1216 sed abit.
1217 sed nullum.
1218
1219 :and a colon
1220 </nowiki>
1221 !! html
1222 <p>Lorem ipsum dolor
1223
1224 sed abit.
1225 sed nullum.
1226
1227 :and a colon
1228
1229 </p>
1230 !! end
1231
1232 !! test
1233 nowiki 3
1234 !! wikitext
1235 :There is not nowiki.
1236 :There is <nowiki>nowiki</nowiki>.
1237
1238 #There is not nowiki.
1239 #There is <nowiki>nowiki</nowiki>.
1240
1241 *There is not nowiki.
1242 *There is <nowiki>nowiki</nowiki>.
1243 !! html
1244 <dl><dd>There is not nowiki.</dd>
1245 <dd>There is nowiki.</dd></dl>
1246 <ol><li>There is not nowiki.</li>
1247 <li>There is nowiki.</li></ol>
1248 <ul><li>There is not nowiki.</li>
1249 <li>There is nowiki.</li></ul>
1250
1251 !! end
1252
1253 !! test
1254 Entities inside <nowiki>
1255 !! wikitext
1256 <nowiki>&lt;</nowiki>
1257 !! html
1258 <p>&lt;
1259 </p>
1260 !! end
1261
1262 !! test
1263 Entities inside template parameters
1264 !! options
1265 parsoid
1266 !! wikitext
1267 {{echo|&ndash;}}
1268 !! html
1269 <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>
1270 </p>
1271 !! end
1272
1273 !! test
1274 Properly escape nowiki when combined with other wiki markup
1275 !! options
1276 parsoid=html2wt
1277 !! wikitext
1278 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1279 !! html
1280 <p>* &lt;/nowiki&gt; tag</p>
1281 !! end
1282
1283 ###
1284 ### Comments
1285 ###
1286 !! test
1287 Comments and Indent-Pre
1288 !! wikitext
1289 <!-- comment 1 --> asdf
1290
1291 <!-- comment 1 --> asdf
1292 <!-- comment 2 -->
1293
1294 <!-- comment 1 --> asdf
1295 <!-- comment 2 -->xyz
1296
1297 <!-- comment 1 --> asdf
1298 <!-- comment 2 --> xyz
1299 !! html
1300 <pre>asdf
1301 </pre>
1302 <pre>asdf
1303 </pre>
1304 <pre>asdf
1305 </pre>
1306 <p>xyz
1307 </p>
1308 <pre>asdf
1309 xyz
1310 </pre>
1311 !! end
1312
1313 !! test
1314 Comment test 2a
1315 !! wikitext
1316 asdf
1317 <!-- comment 1 -->
1318 jkl
1319 !! html
1320 <p>asdf
1321 jkl
1322 </p>
1323 !! end
1324
1325 !! test
1326 Comment test 2b
1327 !! wikitext
1328 asdf
1329 <!-- comment 1 -->
1330
1331 jkl
1332 !! html
1333 <p>asdf
1334 </p><p>jkl
1335 </p>
1336 !! end
1337
1338 !! test
1339 Comment test 3
1340 !! wikitext
1341 asdf
1342 <!-- comment 1 -->
1343 <!-- comment 2 -->
1344 jkl
1345 !! html
1346 <p>asdf
1347 jkl
1348 </p>
1349 !! end
1350
1351 !! test
1352 Comment test 4
1353 !! wikitext
1354 asdf<!-- comment 1 -->jkl
1355 !! html
1356 <p>asdfjkl
1357 </p>
1358 !! end
1359
1360 !! test
1361 Comment spacing
1362 !! wikitext
1363 a
1364 <!-- foo --> b <!-- bar -->
1365 c
1366 !! html
1367 <p>a
1368 </p>
1369 <pre> b
1370 </pre>
1371 <p>c
1372 </p>
1373 !! end
1374
1375 !! test
1376 Comment whitespace
1377 !! wikitext
1378 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1379 !! html
1380
1381 !! end
1382
1383 !! test
1384 Comment semantics and delimiters
1385 !! wikitext
1386 <!-- --><!----><!-----><!------>
1387 !! html
1388
1389 !! end
1390
1391 !! test
1392 Comment semantics and delimiters, redux
1393 !! wikitext
1394 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1395 -- foo -- funky huh? ... -->
1396 !! html
1397
1398 !! end
1399
1400 !! test
1401 Comment semantics and delimiters: directors cut
1402 !! wikitext
1403 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1404 everything starting with < followed by !-- until the first -- and > we see,
1405 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1406 -->-->
1407 !! html
1408 <p>--&gt;
1409 </p>
1410 !! end
1411
1412 !! test
1413 Comment semantics: nesting
1414 !! wikitext
1415 <!--<!-- no, we're not going to do anything fancy here -->-->
1416 !! html
1417 <p>--&gt;
1418 </p>
1419 !! end
1420
1421 !! test
1422 Comment semantics: unclosed comment at end
1423 !! wikitext
1424 <!--This comment will run out to the end of the document
1425 !! html
1426
1427 !! end
1428
1429 !! test
1430 Comment in template title
1431 !! wikitext
1432 {{f<!---->oo}}
1433 !! html
1434 <p>FOO
1435 </p>
1436 !! end
1437
1438 !! test
1439 Comment on its own line post-expand
1440 !! wikitext
1441 a
1442 {{blank}}<!---->
1443 b
1444 !! html
1445 <p>a
1446 </p><p>b
1447 </p>
1448 !! end
1449
1450 !! test
1451 Comment on its own line post-expand with non-significant whitespace
1452 !! wikitext
1453 a
1454 {{blank}} <!---->
1455 b
1456 !! html
1457 <p>a
1458 </p><p>b
1459 </p>
1460 !! end
1461
1462 !! test
1463 Multiple comments should still parse as SOL-transparent
1464 !! options
1465 parsoid=wt2html,wt2wt
1466 !! wikitext
1467 <!--c1-->*a
1468 <!--c2--><!--c3--><!--c4-->*b
1469 !! html
1470 <ul>
1471 <li>a
1472 </li>
1473 <li>b
1474 </li>
1475 </ul>
1476 !! end
1477
1478 ###
1479 ### paragraph wrapping tests
1480 ###
1481 !! test
1482 No block tags
1483 !! wikitext
1484 a
1485
1486 b
1487 !! html
1488 <p>a
1489 </p><p>b
1490 </p>
1491 !! end
1492
1493 !! test
1494 Block tag on one line (<div>)
1495 !! wikitext
1496 a <div>foo</div>
1497
1498 b
1499 !! html
1500 a <div>foo</div>
1501 <p>b
1502 </p>
1503 !! end
1504
1505 !! test
1506 Block tag on one line (<blockquote>)
1507 !! wikitext
1508 a <blockquote>foo</blockquote>
1509
1510 b
1511 !! html
1512 a <blockquote>foo</blockquote>
1513 <p>b
1514 </p>
1515 !! end
1516
1517 !! test
1518 Block tag on both lines (<div>)
1519 !! wikitext
1520 a <div>foo</div>
1521
1522 b <div>foo</div>
1523 !! html
1524 a <div>foo</div>
1525 b <div>foo</div>
1526
1527 !! end
1528
1529 !! test
1530 Block tag on both lines (<blockquote>)
1531 !! wikitext
1532 a <blockquote>foo</blockquote>
1533
1534 b <blockquote>foo</blockquote>
1535 !! html
1536 a <blockquote>foo</blockquote>
1537 b <blockquote>foo</blockquote>
1538
1539 !! end
1540
1541 !! test
1542 Multiple lines without block tags
1543 !! wikitext
1544 <div>foo</div> a
1545 b
1546 c
1547 d<!--foo--> e
1548 x <div>foo</div> z
1549 !! html
1550 <div>foo</div> a
1551 <p>b
1552 c
1553 d e
1554 </p>
1555 x <div>foo</div> z
1556
1557 !! end
1558
1559 !! test
1560 Empty lines between lines with block tags
1561 !! wikitext
1562 <div></div>
1563
1564
1565 <div></div>a
1566
1567 b
1568 <div>a</div>b
1569
1570 <div>b</div>d
1571
1572
1573 <div>e</div>
1574 !! html
1575 <div></div>
1576 <p><br />
1577 </p>
1578 <div></div>a
1579 <p>b
1580 </p>
1581 <div>a</div>b
1582 <div>b</div>d
1583 <p><br />
1584 </p>
1585 <div>e</div>
1586
1587 !! end
1588
1589 ## PHP parser emits output which is broken
1590 !! test
1591 Unclosed HTML p-tags should be handled properly
1592 !! wikitext
1593 <div><p>foo</div>
1594 a
1595
1596 b
1597 !! html/parsoid
1598 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1599 <p>a</p>
1600 <p>b</p>
1601 !! end
1602
1603 ###
1604 ### Preformatted text
1605 ###
1606 !! test
1607 Preformatted text
1608 !! wikitext
1609 This is some
1610 Preformatted text
1611 With ''italic''
1612 And '''bold'''
1613 And a [[Main Page|link]]
1614 !! html
1615 <pre>This is some
1616 Preformatted text
1617 With <i>italic</i>
1618 And <b>bold</b>
1619 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1620 </pre>
1621 !! end
1622
1623 !! test
1624 Tabs don't trigger preformatted text
1625 !! wikitext
1626 This is not
1627 preformatted text.
1628 This is preformatted text.
1629 So is this.
1630 !! html
1631 <p> This is not
1632 preformatted text.
1633 </p>
1634 <pre>This is preformatted text.
1635 So is this.
1636 </pre>
1637 !! end
1638
1639 !! test
1640 Ident preformatting with inline content
1641 !! wikitext
1642 a
1643 ''b''
1644 !! html
1645 <pre>a
1646 <i>b</i>
1647 </pre>
1648 !! end
1649
1650 !! test
1651 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1652 !! wikitext
1653 <pre><nowiki>
1654 <b>
1655 <cite>
1656 <em>
1657 </nowiki></pre>
1658 !! html
1659 <pre>
1660 &lt;b&gt;
1661 &lt;cite&gt;
1662 &lt;em&gt;
1663 </pre>
1664
1665 !! end
1666
1667 !! test
1668 Regression with preformatted in <center>
1669 !! wikitext
1670 <center>
1671 Blah
1672 </center>
1673 !! html
1674 <center>
1675 <pre>Blah
1676 </pre>
1677 </center>
1678
1679 !! end
1680
1681 !! test
1682 Bug 52763: Preformatted in <blockquote>
1683 !! wikitext
1684 <blockquote>
1685 Blah
1686 {|
1687 |
1688 indented cell (no pre-wrapping!)
1689 |}
1690 </blockquote>
1691 !! html
1692 <blockquote>
1693 <p> Blah
1694 </p>
1695 <table>
1696 <tr>
1697 <td>
1698 <p> indented cell (no pre-wrapping!)
1699 </p>
1700 </td></tr></table>
1701 </blockquote>
1702
1703 !! end
1704
1705 !! test
1706 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1707 !! wikitext
1708 <blockquote>
1709 Foo
1710
1711 Bar
1712 </blockquote>
1713 !! html
1714 <blockquote>
1715 <p>Foo
1716 </p><p>Bar
1717 </p>
1718 </blockquote>
1719
1720 !! end
1721
1722 !! test
1723 Bug 15491: <ins>/<del> in blockquote
1724 !! wikitext
1725 <blockquote>
1726 Foo <del>bar</del> <ins>baz</ins> quux
1727 </blockquote>
1728 !! html
1729 <blockquote>
1730 <p>Foo <del>bar</del> <ins>baz</ins> quux
1731 </p>
1732 </blockquote>
1733
1734 !! end
1735
1736 # Note that the p-wrapping is newline sensitive, which could be
1737 # considered a bug: tidy will wrap only the 'Foo' in the example
1738 # below in a <p> tag. (see comment 23-25 of bug #6200)
1739 !! test
1740 Bug 15491: <ins>/<del> in blockquote (2)
1741 !! wikitext
1742 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1743 </blockquote>
1744 !! html
1745 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1746 </blockquote>
1747
1748 !! end
1749
1750 !! test
1751 <pre> with attributes (bug 3202)
1752 !! wikitext
1753 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1754 !! html
1755 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1756
1757 !! end
1758
1759 !! test
1760 <pre> with width attribute (bug 3202)
1761 !! wikitext
1762 <pre width="8">Narrow screen goodies</pre>
1763 !! html
1764 <pre width="8">Narrow screen goodies</pre>
1765
1766 !! end
1767
1768 !! test
1769 <pre> with forbidden attribute (bug 3202)
1770 !! wikitext
1771 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1772 !! html
1773 <pre width="8">Narrow screen goodies</pre>
1774
1775 !! end
1776
1777 !! test
1778 Entities inside <pre>
1779 !! wikitext
1780 <pre>&lt;</pre>
1781 !! html
1782 <pre>&lt;</pre>
1783
1784 !! end
1785
1786 !! test
1787 <pre> with forbidden attribute values (bug 3202)
1788 !! wikitext
1789 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1790 !! html
1791 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1792
1793 !! end
1794
1795 !! test
1796 <nowiki> inside <pre> (bug 13238)
1797 !! wikitext
1798 <pre>
1799 <nowiki>
1800 </pre>
1801 <pre>
1802 <nowiki></nowiki>
1803 </pre>
1804 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1805 !! html
1806 <pre>
1807 &lt;nowiki&gt;
1808 </pre>
1809 <pre>
1810
1811 </pre>
1812 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1813
1814 !! end
1815
1816 !! test
1817 <nowiki> and <pre> preference (first one wins)
1818 !! wikitext
1819 <pre>
1820 <nowiki>
1821 </pre>
1822 </nowiki>
1823 </pre>
1824
1825 <nowiki>
1826 <pre>
1827 <nowiki>
1828 </pre>
1829 </nowiki>
1830 </pre>
1831
1832 !! html
1833 <pre>
1834 &lt;nowiki&gt;
1835 </pre>
1836 <p>&lt;/nowiki&gt;
1837 &lt;/pre&gt;
1838 </p><p>
1839 &lt;pre&gt;
1840 &lt;nowiki&gt;
1841 &lt;/pre&gt;
1842
1843 &lt;/pre&gt;
1844 </p>
1845 !! end
1846
1847 !! test
1848 </pre> inside nowiki
1849 !! wikitext
1850 <nowiki></pre></nowiki>
1851 !! html
1852 <p>&lt;/pre&gt;
1853 </p>
1854 !! end
1855
1856 !! test
1857 Empty pre; pre inside other HTML tags (bug 54946)
1858 !! wikitext
1859 a
1860
1861 <div><pre>
1862 foo
1863 </pre></div>
1864 <pre></pre>
1865 !! html
1866 <p>a
1867 </p>
1868 <div><pre>
1869 foo
1870 </pre></div>
1871 <pre></pre>
1872
1873 !! end
1874
1875 !! test
1876 HTML pre followed by indent-pre
1877 !! wikitext
1878 <pre>foo</pre>
1879 bar
1880 !! html
1881 <pre>foo</pre>
1882 <pre>bar
1883 </pre>
1884 !! end
1885
1886 !!test
1887 Block tag pre
1888 !!options
1889 parsoid
1890 !! wikitext
1891 <p><pre>foo</pre></p>
1892 !! html
1893 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
1894 !!end
1895
1896 !!test
1897 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1898 !! wikitext
1899 {{echo|}}
1900 !! html
1901
1902 !!end
1903
1904 !!test
1905 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1906 !! wikitext
1907 {{echo|
1908 foo}}
1909 !! html
1910 <p>foo
1911 </p>
1912 !!end
1913
1914 !! test
1915 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1916 !! wikitext
1917 {{echo|a
1918 b}}
1919 !! html
1920 <pre>a
1921 </pre>
1922 <p>b
1923 </p>
1924 !!end
1925
1926 !! test
1927 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1928 !! wikitext
1929 {{echo|a
1930 b
1931 c
1932 d
1933 e
1934 }}
1935 !! html
1936 <pre>a
1937 </pre>
1938 <p>b
1939 c
1940 </p>
1941 <pre>d
1942 </pre>
1943 <p>e
1944 </p>
1945 !!end
1946
1947 !!test
1948 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1949 !! wikitext
1950 {{echo| foo}}
1951
1952 {{echo| foo}}{{echo| bar}}
1953
1954 {{echo| foo}}
1955 {{echo| bar}}
1956
1957 {{echo|<!--cmt--> foo}}
1958
1959 <!--cmt-->{{echo| foo}}
1960
1961 {{echo|{{echo| }}bar}}
1962 !! html
1963 <pre>foo
1964 </pre>
1965 <pre>foo bar
1966 </pre>
1967 <pre>foo
1968 bar
1969 </pre>
1970 <pre>foo
1971 </pre>
1972 <pre>foo
1973 </pre>
1974 <pre>bar
1975 </pre>
1976 !!end
1977
1978 !! test
1979 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1980 !! wikitext
1981 {{echo| }}a
1982
1983 {{echo|
1984 }}a
1985
1986 {{echo|
1987 b}}
1988
1989 {{echo|a
1990 }}b
1991
1992 {{echo|a
1993 }} b
1994 !! html
1995 <pre>a
1996 </pre>
1997 <p><br />
1998 </p>
1999 <pre>a
2000 </pre>
2001 <p><br />
2002 </p>
2003 <pre>b
2004 </pre>
2005 <p>a
2006 </p>
2007 <pre>b
2008 </pre>
2009 <p>a
2010 </p>
2011 <pre>b
2012 </pre>
2013 !!end
2014
2015 !! test
2016 Things that look like <pre> tags aren't treated as such
2017 !! wikitext
2018 Barack Obama <President> of the United States
2019 <President></President>
2020 !! html
2021 <p>Barack Obama &lt;President&gt; of the United States
2022 &lt;President&gt;&lt;/President&gt;
2023 </p>
2024 !! end
2025
2026 ## PHP parser discards the "<pre " string
2027 !! test
2028 Handle broken pre-like tags (bug 64025)
2029 !! options
2030 parsoid=wt2html
2031 !! wikitext
2032 {{echo|<pre <pre>x</pre>}}
2033
2034 <table><pre </table>
2035 !! html/php
2036 <pre>x</pre>
2037 <table><pre></pre></table>
2038
2039 !! html/parsoid
2040 <span 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 </span>
2041 <pre>x</pre>
2042
2043 <span>&lt;pre </span>
2044 <table></table>
2045 !! end
2046
2047 !! test
2048 Parsoid: handle pre with space after attribute
2049 !! options
2050 parsoid=wt2html
2051 !! wikitext
2052 <pre style="width:50%;" >{{echo|foo}}</pre>
2053 !! html
2054 <pre style="width:50%;">{{echo|foo}}</pre>
2055 !! end
2056
2057 # TODO / maybe: fix wt2wt for this
2058 !! test
2059 Parsoid: Don't paragraph-wrap fosterable content
2060 !! options
2061 parsoid=wt2html
2062 !! wikitext
2063 {|
2064 <td></td>
2065 <td></td>
2066
2067
2068
2069 |}
2070 !! html
2071 <table>
2072
2073 <tbody>
2074 <tr>
2075 <td></td>
2076
2077 <td></td></tr>
2078
2079
2080
2081 </tbody></table>
2082 !! end
2083
2084 !! test
2085 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2086 !! options
2087 parsoid=wt2html
2088 !! wikitext
2089 {|
2090 <td>
2091 <td>
2092 </td>
2093
2094
2095
2096 |}
2097 !! html
2098 <table>
2099
2100 <tbody>
2101 <tr>
2102 <td></td>
2103
2104 <td>
2105 </td></tr>
2106
2107
2108
2109 </tbody></table>
2110 !! end
2111
2112
2113 #--------------------------------------------------------------------
2114 # Transclusion parameter whitespace stripping tests
2115 # Behavior is different for positional and named parameters
2116 #--------------------------------------------------------------------
2117 !! test
2118 Templates: Strip leading and trailing whitespace from named-param values
2119 !! wikitext
2120 {{echo|1= a }}
2121
2122 {{echo|1= {{echo|b}} }}
2123
2124 {{echo| 1 =
2125 c }}
2126
2127 {{echo| 1 =
2128 * d
2129 }}
2130 !! html
2131 <p>a
2132 </p><p>b
2133 </p><p>c
2134 </p>
2135 <ul><li> d</li></ul>
2136
2137 !! end
2138
2139 !! test
2140 Templates: Don't strip whitespace from positional-param values
2141 !! wikitext
2142 {{echo|a }}
2143
2144 {{echo|{{echo|b}} }}
2145
2146 {{echo| c
2147 }}
2148
2149 {{echo| {{echo|d}}
2150 }}
2151
2152 {{echo|
2153 e}}
2154
2155 {{echo|
2156 * f}}
2157
2158 {{echo|
2159 }}g
2160 !! html
2161 <p>a
2162 </p><p>b
2163 </p>
2164 <pre>c
2165 </pre>
2166 <p><br />
2167 </p>
2168 <pre>d
2169 </pre>
2170 <p><br />
2171 </p>
2172 <pre>e
2173 </pre>
2174 <p><br />
2175 </p>
2176 <ul><li> f</li></ul>
2177 <p><br />
2178 </p>
2179 <pre>g
2180 </pre>
2181 !! end
2182
2183 !! test
2184 Templates: Handle empty comment-and-ws-only lines correctly
2185 !! wikitext
2186 {{echo|foo
2187 <!--should be ignored-->
2188 <!--should be ignored as well-->
2189 bar}}
2190 !! html
2191 <p>foo
2192 bar
2193 </p>
2194 !! end
2195
2196 !! test
2197 Templates: Handle comments in the target
2198 !! wikitext
2199 {{echo
2200 <!-- should be ignored -->
2201 |foo}}
2202
2203 {{echo<!-- should be ignored -->
2204 |foo}}
2205
2206 {{echo<!-- should be ignored -->|foo}}
2207
2208 {{<!-- should be ignored -->echo|foo}}
2209 !!html/parsoid
2210 <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>
2211
2212 <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>
2213
2214 <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>
2215
2216 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2217 !!end
2218
2219 #--------------------------------------------------------------------
2220 # Transclusion parameter escaping tests
2221 #--------------------------------------------------------------------
2222 !! test
2223 Templates: Parsoid parameter escaping test 1
2224 !! options
2225 parsoid
2226 !! wikitext
2227 {{echo|[foo]|{{echo|[bar]}}}}
2228 !! html
2229 <p about="#mwt1" typeof="mw:Transclusion"
2230 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2231 !! end
2232
2233 !! test
2234 Parsoid: Pipes in external links in template parameter
2235 !! options
2236 parsoid
2237 !! wikitext
2238 {{echo|[{{echo|http://example.com}} link]}}
2239 !! html
2240 <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>
2241 !! end
2242
2243 !! test
2244 Parsoid: pipe in transclusion parameter
2245 !! options
2246 parsoid
2247 !! wikitext
2248 {{echo|http://foo.com/a&#124;b}}
2249 !! html
2250 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2251 typeof="mw:Transclusion"
2252 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>
2253 !! end
2254
2255 !! test
2256 Parsoid: Pipe in external link target and content in template parameter
2257 !! options
2258 parsoid=html2wt,wt2wt
2259 !! wikitext
2260 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2261 !! html
2262 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2263 typeof="mw:Transclusion"
2264 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2265 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2266 !! end
2267
2268 !! test
2269 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2270 !! options
2271 parsoid
2272 !! wikitext
2273 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2274 !! html
2275 <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>
2276 !! end
2277
2278 !! test
2279 Templates: Don't escape already nowiki-escaped text in template parameters
2280 !! options
2281 parsoid=html2wt,wt2wt
2282 !! wikitext
2283 {{echo|foo<nowiki>|</nowiki>bar}}
2284 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2285 {{echo|<nowiki></nowiki>}}
2286 !! html
2287 <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>
2288 <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>
2289 <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>
2290 </p>
2291 !! end
2292
2293 ## Bug 52824
2294 !! test
2295 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2296 !! options
2297 parsoid=html2wt,wt2wt
2298 !! wikitext
2299 {{echo|{{echo|1=bar}}}}
2300 !! html
2301 <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>
2302 !! end
2303
2304 ## Bug 56733
2305 !! test
2306 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2307 !! options
2308 parsoid
2309 !! wikitext
2310 {{echo|a : b}}
2311 !! html
2312 <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>
2313 !! end
2314
2315 ###
2316 ### Parsoid-centric tests for testing RT edge cases for pre
2317 ###
2318
2319 !!test
2320 1a. Indent-Pre and Comments
2321 !! wikitext
2322 a
2323 <!--a-->
2324 c
2325 !! html
2326 <pre>a
2327 </pre>
2328 <p>c
2329 </p>
2330 !!end
2331
2332 !!test
2333 1b. Indent-Pre and Comments
2334 !! wikitext
2335 a
2336 <!--a-->
2337 c
2338 !! html
2339 <pre>a
2340 </pre>
2341 <p>c
2342 </p>
2343 !!end
2344
2345 !!test
2346 1c. Indent-Pre and Comments
2347 !! wikitext
2348 <!--a--> a
2349
2350 <!--a--> a
2351 !! html
2352 <pre> a
2353 </pre>
2354 <pre> a
2355 </pre>
2356 !!end
2357
2358 !!test
2359 1d. Indent-Pre and Comments
2360 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2361 !! wikitext
2362 <!--a--> a
2363
2364 <!--b-->b
2365 !! html
2366 <pre>a
2367 </pre>
2368 <pre>b
2369 </pre>
2370 !!end
2371
2372 !!test
2373 2a. Indent-Pre and tables
2374 !! wikitext
2375 {|
2376 |-
2377 !h1!!h2
2378 |foo||bar
2379 |}
2380 !! html
2381 <table>
2382
2383 <tr>
2384 <th>h1</th>
2385 <th>h2
2386 </th>
2387 <td>foo</td>
2388 <td>bar
2389 </td></tr></table>
2390
2391 !!end
2392
2393 !!test
2394 2b. Indent-Pre and tables
2395 !! wikitext
2396 {|
2397 |-
2398 |foo
2399 |}
2400 !! html
2401 <table>
2402
2403 <tr>
2404 <td>foo
2405 </td></tr></table>
2406
2407 !!end
2408
2409 !!test
2410 2c. Indent-Pre and tables (bug 42252)
2411 !! wikitext
2412 {|
2413 |+ foo
2414 ! | bar
2415 |}
2416 !! html
2417 <table>
2418 <caption> foo
2419 </caption>
2420 <tr>
2421 <th> bar
2422 </th></tr></table>
2423
2424 !!end
2425
2426 !!test
2427 2d. Indent-Pre and tables
2428 !! wikitext
2429 a
2430 {|
2431 | b
2432 |}
2433 !! html/php
2434 <pre>a
2435 </pre>
2436 <table>
2437 <tr>
2438 <td> b
2439 </td></tr></table>
2440
2441 !! html/parsoid
2442 <pre>a</pre>
2443
2444 <table>
2445
2446 <tbody>
2447 <tr>
2448 <td> b</td></tr>
2449 </tbody></table>
2450 !!end
2451
2452 !!test
2453 2e. Indent-Pre and table-line syntax
2454 !! wikitext
2455 a
2456 | b
2457 | c
2458 !! html/parsoid
2459 <pre>a
2460 | b
2461 | c</pre>
2462 !!end
2463
2464 !!test
2465 2f. Indent-pre started by table-line syntax
2466 !! wikitext
2467 a
2468 | b
2469 | c
2470 !! html/parsoid
2471 <p>a</p>
2472 <pre>
2473 | b
2474 | c</pre>
2475 !!end
2476
2477 !!test
2478 3a. Indent-Pre and block tags (single-line html)
2479 !! wikitext
2480 a <p> foo </p>
2481 b <div> foo </div>
2482 c <blockquote> foo </blockquote>
2483 <span> foo </span>
2484 !! html
2485 a <p> foo </p>
2486 b <div> foo </div>
2487 c <blockquote> foo </blockquote>
2488 <pre><span> foo </span>
2489 </pre>
2490 !!end
2491
2492 !!test
2493 3b. Indent-Pre and block tags (multi-line html)
2494 !! wikitext
2495 a <span>foo</span>
2496 b <div> foo </div>
2497 !! html
2498 <pre>a <span>foo</span>
2499 </pre>
2500 b <div> foo </div>
2501
2502 !!end
2503
2504 !!test
2505 3c. Indent-Pre and block tags (pre-content on separate line)
2506 !! wikitext
2507 <p>
2508 foo
2509 </p>
2510
2511 <div>
2512 foo
2513 </div>
2514
2515 <center>
2516 foo
2517 </center>
2518
2519 <blockquote>
2520 foo
2521 </blockquote>
2522
2523 <blockquote>
2524 <pre>
2525 foo
2526 </pre>
2527 </blockquote>
2528
2529 <table><tr><td>
2530 foo
2531 </td></tr></table>
2532
2533 <ul><li>
2534 foo
2535 </li></ul>
2536
2537 !! html
2538 <p>
2539 foo
2540 </p>
2541 <div>
2542 <pre>foo
2543 </pre>
2544 </div>
2545 <center>
2546 <pre>foo
2547 </pre>
2548 </center>
2549 <blockquote>
2550 <p> foo
2551 </p>
2552 </blockquote>
2553 <blockquote>
2554 <pre>
2555 foo
2556 </pre>
2557 </blockquote>
2558 <table><tr><td>
2559 <pre>foo
2560 </pre>
2561 </td></tr></table>
2562 <ul><li>
2563 foo
2564 </li></ul>
2565
2566 !!end
2567
2568 !!test
2569 4. Indent-Pre and extension tags
2570 !! wikitext
2571 a <gallery>
2572 File:foobar.jpg
2573 </gallery>
2574 !! html
2575 a <ul class="gallery mw-gallery-traditional">
2576 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2577 <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>
2578 <div class="gallerytext">
2579 </div>
2580 </div></li>
2581 </ul>
2582
2583 !!end
2584
2585 !! test
2586 Leading pipes outside of tables
2587 !! options
2588 parsoid
2589 !! wikitext
2590 | foo
2591 !! html
2592 <p>| foo</p>
2593 !! end
2594
2595 !! test
2596 Leading pipes outside of tables 2
2597 !! options
2598 parsoid
2599 !! wikitext
2600 a
2601 | foo
2602 b
2603 !! html
2604 <p>a
2605 | foo
2606 b</p>
2607 !! end
2608
2609 !! test
2610 Leading pipes outside of tables 3
2611 !! options
2612 parsoid
2613 !! wikitext
2614 a
2615 | class="foo bar" | baz
2616 b
2617 !! html
2618 <p>a
2619 | class="foo bar" | baz
2620 b</p>
2621 !! end
2622
2623 !!test
2624 Render paragraphs when indent-pre is suppressed in blocklevels
2625 !! wikitext
2626 <blockquote>
2627 foo
2628
2629 bar
2630 </blockquote>
2631 !! html
2632 <blockquote>
2633 <p> foo
2634 </p><p> bar
2635 </p>
2636 </blockquote>
2637
2638 !!end
2639
2640 !!test
2641 4. Multiple spaces at start-of-line
2642 !! wikitext
2643 <p> foo </p>
2644 foo
2645 {|
2646 |foo
2647 |}
2648 !! html
2649 <p> foo </p>
2650 <pre> foo
2651 </pre>
2652 <table>
2653 <tr>
2654 <td>foo
2655 </td></tr></table>
2656
2657 !!end
2658
2659 ## NOTE: the leading white-space chars on empty line are significant
2660 !! test
2661 5a. White-space in indent-pre
2662 !! wikitext
2663 a<br />
2664
2665 b
2666 !! html
2667 <pre>a<br />
2668
2669 b
2670 </pre>
2671 !! end
2672
2673 ## NOTE: the leading white-space chars on empty line are significant
2674 !! test
2675 5b. White-space in indent-pre
2676 !! wikitext
2677 a
2678
2679 b
2680
2681
2682 c
2683 !! html
2684 <pre>a
2685
2686 b
2687
2688
2689 c
2690 </pre>
2691 !! end
2692
2693 !! test
2694 5c. White-space in indent-pre
2695 !! wikitext
2696 ''a''
2697 ''b''
2698 ''c''
2699 !! html
2700 <pre><i>a</i>
2701 <i>b</i>
2702 <i>c</i>
2703 </pre>
2704 !! end
2705
2706 !! test
2707 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2708 !! wikitext
2709 a
2710
2711 <!-- continue -->
2712 b
2713
2714 c
2715
2716 d
2717 !! html
2718 <pre>a
2719
2720 b
2721 </pre>
2722 <pre>c
2723
2724 </pre>
2725 <p>d
2726 </p>
2727 !! end
2728
2729 !! test
2730 7a. Indent-pre and category links
2731 !! options
2732 parsoid=wt2html,wt2wt
2733 !! wikitext
2734 [[Category:foo]] <!-- No pre-wrapping -->
2735 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2736 !! html
2737 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2738 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2739 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2740 !! end
2741
2742 !! test
2743 7b. Indent-pre and category links
2744 !! options
2745 parsoid=wt2html,wt2wt
2746 !! wikitext
2747 [[Category:foo]] a
2748 [[Category:foo]] {{echo|b}}
2749 !! html
2750 <pre>
2751 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2752
2753 <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>
2754 !! end
2755
2756 ###
2757 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2758 ###
2759
2760 !!test
2761 HTML-pre: 1. embedded newlines
2762 !! wikitext
2763 <pre>foo</pre>
2764
2765 <pre>
2766 foo
2767 </pre>
2768
2769 <pre>
2770
2771 foo
2772 </pre>
2773
2774 <pre>
2775
2776
2777 foo
2778 </pre>
2779 !! html
2780 <pre>foo</pre>
2781 <pre>
2782 foo
2783 </pre>
2784 <pre>
2785
2786 foo
2787 </pre>
2788 <pre>
2789
2790
2791 foo
2792 </pre>
2793
2794 !! html/parsoid
2795 <pre data-parsoid='{"stx":"html"}'>foo</pre>
2796
2797 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
2798 foo
2799 </pre>
2800
2801 <pre data-parsoid='{"stx":"html"}'>
2802
2803 foo
2804 </pre>
2805
2806 <pre data-parsoid='{"stx":"html"}'>
2807
2808
2809 foo
2810 </pre>
2811 !!end
2812
2813 !! test
2814 HTML-pre: big spaces
2815 !! wikitext
2816 <pre>
2817
2818
2819
2820
2821 haha
2822
2823
2824
2825
2826 haha
2827
2828
2829
2830
2831 </pre>
2832 !! html
2833 <pre>
2834
2835
2836
2837
2838 haha
2839
2840
2841
2842
2843 haha
2844
2845
2846
2847
2848 </pre>
2849
2850 !! html/parsoid
2851 <pre data-parsoid='{"stx":"html"}'>
2852
2853
2854
2855
2856 haha
2857
2858
2859
2860
2861 haha
2862
2863
2864
2865
2866 </pre>
2867 !! end
2868
2869 !!test
2870 HTML-pre: 2: indented text
2871 !! wikitext
2872 <pre>
2873 foo
2874 </pre>
2875 !! html
2876 <pre>
2877 foo
2878 </pre>
2879
2880 !!end
2881
2882 !!test
2883 HTML-pre: 3: other wikitext
2884 !! wikitext
2885 <pre>
2886 * foo
2887 # bar
2888 = no-h =
2889 '' no-italic ''
2890 [[ NoLink ]]
2891 </pre>
2892 !! html
2893 <pre>
2894 * foo
2895 # bar
2896 = no-h =
2897 '' no-italic ''
2898 [[ NoLink ]]
2899 </pre>
2900
2901 !!end
2902
2903 ###
2904 ### Definition lists
2905 ###
2906 !! test
2907 Simple definition
2908 !! wikitext
2909 ; name : Definition
2910 !! html
2911 <dl><dt> name&#160;</dt>
2912 <dd> Definition</dd></dl>
2913
2914 !! end
2915
2916 !! test
2917 Definition list for indentation only
2918 !! wikitext
2919 : Indented text
2920 !! html
2921 <dl><dd> Indented text</dd></dl>
2922
2923 !! end
2924
2925 !! test
2926 Definition list with no space
2927 !! wikitext
2928 ;name:Definition
2929 !! html
2930 <dl><dt>name</dt>
2931 <dd>Definition</dd></dl>
2932
2933 !!end
2934
2935 !! test
2936 Definition list with URL link
2937 !! wikitext
2938 ; http://example.com/ : definition
2939 !! html
2940 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2941 <dd> definition</dd></dl>
2942
2943 !! end
2944
2945 !! test
2946 Definition list with bracketed URL link
2947 !! wikitext
2948 ;[http://www.example.com/ Example]:Something about it
2949 !! html
2950 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2951 <dd>Something about it</dd></dl>
2952
2953 !! end
2954
2955 !! test
2956 Definition list with wikilink containing colon
2957 !! wikitext
2958 ; [[Help:FAQ]]: The least-read page on Wikipedia
2959 !! html
2960 <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>
2961 <dd> The least-read page on Wikipedia</dd></dl>
2962
2963 !! end
2964
2965 # At Brion's and JeLuF's insistence... :)
2966 !! test
2967 Definition list with news link containing colon
2968 !! wikitext
2969 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2970 !! html
2971 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2972 <dd> This isn't even a real newsgroup!</dd></dl>
2973
2974 !! end
2975
2976 !! test
2977 Malformed definition list with colon
2978 !! wikitext
2979 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2980 !! html
2981 <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>
2982
2983 !! end
2984
2985 !! test
2986 Definition lists: colon in external link text
2987 !! wikitext
2988 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2989 !! html
2990 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
2991 <dd> OK, I made that up</dd></dl>
2992
2993 !! end
2994
2995 !! test
2996 Definition lists: colon in HTML attribute
2997 !! wikitext
2998 ;<b style="display: inline">bold</b>
2999 !! html
3000 <dl><dt><b style="display: inline">bold</b></dt></dl>
3001
3002 !! end
3003
3004 !! test
3005 Definition lists: self-closed tag
3006 !! wikitext
3007 ;one<br/>two : two-line fun
3008 !! html
3009 <dl><dt>one<br />two&#160;</dt>
3010 <dd> two-line fun</dd></dl>
3011
3012 !! end
3013
3014 !! test
3015 Bug 11748: Literal closing tags
3016 !! wikitext
3017 <dl>
3018 <dt>test 1</dt>
3019 <dd>test test test test test</dd>
3020 <dt>test 2</dt>
3021 <dd>test test test test test</dd>
3022 </dl>
3023 !! html
3024 <dl>
3025 <dt>test 1</dt>
3026 <dd>test test test test test</dd>
3027 <dt>test 2</dt>
3028 <dd>test test test test test</dd>
3029 </dl>
3030
3031 !! end
3032
3033 !! test
3034 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3035 !! wikitext
3036 <ul><li>
3037 ; term : description
3038 * unordered
3039 </li></ul>
3040 !! html
3041 <ul><li>
3042 <dl><dt> term&#160;</dt>
3043 <dd> description</dd></dl>
3044 <ul><li> unordered</li></ul>
3045 </li></ul>
3046
3047 !! end
3048
3049 !! test
3050
3051 Definition list with empty definition and following paragraph
3052 !! wikitext
3053 ; term:
3054 Paragraph text
3055 !! html
3056 <dl><dt> term</dt>
3057 <dd></dd></dl>
3058 <p>Paragraph text
3059 </p>
3060 !! end
3061
3062 !! test
3063 Nested definition lists using html syntax
3064 !! wikitext
3065 <dl><dt>x</dt>
3066 <dd>a</dd>
3067 <dd>b</dd></dl>
3068
3069 !! end
3070
3071 !! test
3072 Definition Lists: No nesting: Multiple dd's
3073 !! wikitext
3074 ;x
3075 :a
3076 :b
3077 !! html
3078 <dl><dt>x</dt>
3079 <dd>a</dd>
3080 <dd>b</dd></dl>
3081
3082 !! end
3083
3084 !! test
3085 Definition Lists: Indentation: Regular
3086 !! wikitext
3087 :i1
3088 ::i2
3089 :::i3
3090 !! html
3091 <dl><dd>i1
3092 <dl><dd>i2
3093 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3094
3095 !! end
3096
3097 !! test
3098 Definition Lists: Indentation: Missing 1st level
3099 !! wikitext
3100 ::i2
3101 :::i3
3102 !! html
3103 <dl><dd><dl><dd>i2
3104 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3105
3106 !! end
3107
3108 !! test
3109 Definition Lists: Indentation: Multi-level indent
3110 !! wikitext
3111 :::i3
3112 !! html
3113 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3114
3115 !! end
3116
3117 !! test
3118 Definition Lists: Hacky use to indent tables
3119 !! wikitext
3120 ::{|
3121 |foo
3122 |bar
3123 |}
3124 this text
3125 should be left alone
3126 !! html
3127 <dl><dd><dl><dd><table>
3128 <tr>
3129 <td>foo
3130 </td>
3131 <td>bar
3132 </td></tr></table></dd></dl></dd></dl>
3133 <p>this text
3134 should be left alone
3135 </p>
3136 !! end
3137
3138 !! test
3139 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3140 !! wikitext
3141 <!-- foo -->
3142 ::{|
3143 |foo
3144 |bar
3145 |}<!-- bar -->
3146 this text
3147 should be left alone
3148 !! html/parsoid
3149 <!-- foo -->
3150 <dl><dd><dl><dd><table><tr>
3151 <td>foo</td>
3152 <td>bar</td>
3153 </tr></table><!-- bar --></dd></dl></dd></dl>
3154 <p>this text
3155 should be left alone</p>
3156 !! end
3157
3158 !! test
3159 Definition Lists: Hacky use to indent tables, with comment before table
3160 !! wikitext
3161 ::<!-- foo -->{|
3162 |foo
3163 |}
3164 !! html/parsoid
3165 <dl><dd><dl><dd><!-- foo --><table><tr>
3166 <td>foo</td>
3167 </tr></table></dd></dl></dd></dl>
3168 !! end
3169
3170 # Bug 52473
3171 !! test
3172 Definition Lists: Hacky use to indent tables (WS-insensitive)
3173 !! options
3174 parsoid
3175 !! wikitext
3176 : {|
3177 |a
3178 |}
3179 !! html
3180 <dl>
3181 <dd> <table><tr><td>a</td></tr></table> </dd>
3182 </dl>
3183 !! end
3184 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3185 ## as an empty dt item. It also ignores all but the last ";" when followed
3186 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3187 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3188 ## ";"s.
3189 ##
3190 ## Ex: ";;t2 ::d2" is transformed into:
3191 ##
3192 ## <dl>
3193 ## <dt>t2 </dt>
3194 ## <dd>
3195 ## <dl>
3196 ## <dt></dt>
3197 ## <dd>d2</dd>
3198 ## </dl>
3199 ## </dd>
3200 ## </dl>
3201 ##
3202 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3203 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3204 ##
3205 ## <dl>
3206 ## <dt>
3207 ## <dl>
3208 ## <dt>t2 </dt>
3209 ## <dd>:d2</dd>
3210 ## </dl>
3211 ## </dt>
3212 ## </dl>
3213 ##
3214 ## All Parsoid only definition list tests have this difference.
3215 ##
3216 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3217 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3218
3219 !! test
3220 Table / list interaction: indented table with lists in table contents
3221 !! wikitext
3222 :{|
3223 |-
3224 | a
3225 * b
3226 |-
3227 | c
3228 * d
3229 |}
3230 !! html
3231 <dl><dd><table>
3232
3233 <tr>
3234 <td> a
3235 <ul><li> b</li></ul>
3236 </td></tr>
3237 <tr>
3238 <td> c
3239 <ul><li> d</li></ul>
3240 </td></tr></table></dd></dl>
3241
3242 !! end
3243
3244 !!test
3245 Table / list interaction: lists nested in tables nested in indented lists
3246 !! wikitext
3247 :{|
3248 |
3249 :a
3250 :b
3251 |
3252 *c
3253 *d
3254 |}
3255
3256 *e
3257 *f
3258 !! html
3259 <dl><dd><table>
3260 <tr>
3261 <td>
3262 <dl><dd>a</dd>
3263 <dd>b</dd></dl>
3264 </td>
3265 <td>
3266 <ul><li>c</li>
3267 <li>d</li></ul>
3268 </td></tr></table></dd></dl>
3269 <ul><li>e</li>
3270 <li>f</li></ul>
3271
3272 !!end
3273
3274 !! test
3275 Definition Lists: Nesting: Multi-level (Parsoid only)
3276 !! options
3277 parsoid
3278 !! wikitext
3279 ;t1 :d1
3280 ;;t2 ::d2
3281 ;;;t3 :::d3
3282 !! html
3283 <dl>
3284 <dt>t1 </dt>
3285 <dd>d1</dd>
3286 <dt>
3287 <dl>
3288 <dt>t2 </dt>
3289 <dd>:d2</dd>
3290 <dt>
3291 <dl>
3292 <dt>t3 </dt>
3293 <dd>::d3</dd>
3294 </dl>
3295 </dt>
3296 </dl>
3297 </dt>
3298 </dl>
3299
3300
3301 !! end
3302
3303
3304 !! test
3305 Definition Lists: Nesting: Test 2 (Parsoid only)
3306 !! options
3307 parsoid
3308 !! wikitext
3309 ;t1
3310 ::d2
3311 !! html
3312 <dl>
3313 <dt>t1</dt>
3314 <dd>
3315 <dl>
3316 <dd>d2</dd>
3317 </dl>
3318 </dd>
3319 </dl>
3320
3321 !! end
3322
3323
3324 !! test
3325 Definition Lists: Nesting: Test 3 (Parsoid only)
3326 !! options
3327 parsoid
3328 !! wikitext
3329 :;t1
3330 ::::d2
3331 !! html
3332 <dl>
3333 <dd>
3334 <dl>
3335 <dt>t1</dt>
3336 <dd>
3337 <dl>
3338 <dd>
3339 <dl>
3340 <dd>d2</dd>
3341 </dl>
3342 </dd>
3343 </dl>
3344 </dd>
3345 </dl>
3346 </dd>
3347 </dl>
3348
3349 !! end
3350
3351
3352 !! test
3353 Definition Lists: Nesting: Test 4
3354 !! wikitext
3355 ::;t3
3356 :::d3
3357 !! html
3358 <dl><dd><dl><dd><dl><dt>t3</dt>
3359 <dd>d3</dd></dl></dd></dl></dd></dl>
3360
3361 !! end
3362
3363
3364 ## The Parsoid team believes the following three test exposes a
3365 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3366 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3367 !! test
3368 Definition Lists: Mixed Lists: Test 1
3369 !! wikitext
3370 :;* foo
3371 ::* bar
3372 :; baz
3373 !! html/php
3374 <dl><dd><dl><dt><ul><li> foo</li>
3375 <li> bar</li></ul></dt></dl>
3376 <dl><dt> baz</dt></dl></dd></dl>
3377
3378 !! html/parsoid
3379 <dl>
3380 <dd><dl>
3381 <dt><ul>
3382 <li> foo
3383 </li>
3384 </ul></dt>
3385 <dd><ul>
3386 <li> bar
3387 </li>
3388 </ul></dd>
3389 <dt> baz</dt>
3390 </dl></dd>
3391 </dl>
3392 !! end
3393
3394 !! test
3395 Definition Lists: Mixed Lists: Test 2
3396 !! wikitext
3397 *: d1
3398 *: d2
3399 !! html
3400 <ul><li><dl><dd> d1</dd>
3401 <dd> d2</dd></dl></li></ul>
3402
3403 !! end
3404
3405
3406 !! test
3407 Definition Lists: Mixed Lists: Test 3
3408 !! wikitext
3409 *::: d1
3410 *::: d2
3411 !! html
3412 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3413 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3414
3415 !! end
3416
3417
3418 !! test
3419 Definition Lists: Mixed Lists: Test 4
3420 !! wikitext
3421 *;d1 :d2
3422 *;d3 :d4
3423 !! html
3424 <ul><li><dl><dt>d1&#160;</dt>
3425 <dd>d2</dd>
3426 <dt>d3&#160;</dt>
3427 <dd>d4</dd></dl></li></ul>
3428
3429 !! end
3430
3431
3432 !! test
3433 Definition Lists: Mixed Lists: Test 5
3434 !! wikitext
3435 *:d1
3436 *:: d2
3437 !! html
3438 <ul><li><dl><dd>d1
3439 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3440
3441 !! end
3442
3443
3444 !! test
3445 Definition Lists: Mixed Lists: Test 6
3446 !! wikitext
3447 #*:d1
3448 #*::: d3
3449 !! html
3450 <ol><li><ul><li><dl><dd>d1
3451 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3452
3453 !! end
3454
3455
3456 !! test
3457 Definition Lists: Mixed Lists: Test 7
3458 !! wikitext
3459 :* d1
3460 :* d2
3461 !! html
3462 <dl><dd><ul><li> d1</li>
3463 <li> d2</li></ul></dd></dl>
3464
3465 !! end
3466
3467
3468 !! test
3469 Definition Lists: Mixed Lists: Test 8
3470 !! wikitext
3471 :* d1
3472 ::* d2
3473 !! html
3474 <dl><dd><ul><li> d1</li></ul>
3475 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3476
3477 !! end
3478
3479
3480 !! test
3481 Definition Lists: Mixed Lists: Test 9
3482 !! wikitext
3483 *;foo :bar
3484 !! html
3485 <ul><li><dl><dt>foo&#160;</dt>
3486 <dd>bar</dd></dl></li></ul>
3487
3488 !! end
3489
3490
3491 !! test
3492 Definition Lists: Mixed Lists: Test 10
3493 !! wikitext
3494 *#;foo :bar
3495 !! html
3496 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3497 <dd>bar</dd></dl></li></ol></li></ul>
3498
3499 !! end
3500
3501 # The Parsoid team disagrees with the PHP parser's seemingly-random
3502 # rules regarding dd/dt on the next two tests. Parsoid is more
3503 # consistent, and recognizes the shared nesting and keeps the
3504 # still-open tags around until the nesting is complete.
3505
3506 !! test
3507 Definition Lists: Mixed Lists: Test 11
3508 !! wikitext
3509 *#*#;*;;foo :bar
3510 *#*#;boo :baz
3511 !! html/php
3512 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3513 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3514 <dl><dt>boo&#160;</dt>
3515 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3516
3517 !! html/parsoid
3518 <ul>
3519 <li>
3520 <ol>
3521 <li>
3522 <ul>
3523 <li>
3524 <ol>
3525 <li>
3526 <dl>
3527 <dt>
3528 <ul>
3529 <li>
3530 <dl>
3531 <dt>
3532 <dl>
3533 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3534 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3535 </dl></dt>
3536 </dl></li>
3537 </ul></dt>
3538 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3539 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3540 </dl></li>
3541 </ol></li>
3542 </ul></li>
3543 </ol></li>
3544 </ul>
3545 !! end
3546
3547
3548 !! test
3549 Definition Lists: Weird Ones: Test 1
3550 !! wikitext
3551 *#;*::;; foo : bar (who uses this?)
3552 !! html/php
3553 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3554 <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>
3555
3556 !! html/parsoid
3557 <ul>
3558 <li>
3559 <ol>
3560 <li>
3561 <dl>
3562 <dt>
3563 <ul>
3564 <li>
3565 <dl>
3566 <dd>
3567 <dl>
3568 <dd>
3569 <dl>
3570 <dt>
3571 <dl>
3572 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3573 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3574 </dl></dt>
3575 </dl></dd>
3576 </dl></dd>
3577 </dl></li>
3578 </ul></dt>
3579 </dl></li>
3580 </ol></li>
3581 </ul>
3582 !! end
3583
3584 ###
3585 ### External links
3586 ###
3587 !! test
3588 External links: non-bracketed
3589 !! wikitext
3590 Non-bracketed: http://example.com
3591 !! html
3592 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3593 </p>
3594 !! end
3595
3596 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3597 !! test
3598 External links: numbered
3599 !! wikitext
3600 Numbered: [http://example.com]
3601 Numbered: [http://example.net]
3602 Numbered: [http://example.com]
3603 !! html/php
3604 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3605 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3606 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3607 </p>
3608 !! html/parsoid
3609 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
3610 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
3611 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
3612 !!end
3613
3614 !! test
3615 External links: specified text
3616 !! wikitext
3617 Specified text: [http://example.com link]
3618 !! html
3619 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3620 </p>
3621 !!end
3622
3623 !! test
3624 External links: trail
3625 !! wikitext
3626 Linktrails should not work for external links: [http://example.com link]s
3627 !! html
3628 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3629 </p>
3630 !! end
3631
3632 !! test
3633 External links: dollar sign in URL
3634 !! wikitext
3635 http://example.com/1$2345
3636 !! html
3637 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3638 </p>
3639 !! end
3640
3641 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3642 !! test
3643 External links: dollar sign in URL (autonumber)
3644 !! wikitext
3645 [http://example.com/1$2345]
3646 !! html/php
3647 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3648 </p>
3649 !! html/parsoid
3650 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
3651 !!end
3652
3653 !! test
3654 External links: open square bracket forbidden in URL (bug 4377)
3655 !! options
3656 parsoid=wt2html,wt2wt,html2html
3657 !! wikitext
3658 http://example.com/1[2345
3659 !! html/php
3660 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3661 </p>
3662 !! html/parsoid
3663 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
3664 !! end
3665
3666 !! test
3667 External links: open square bracket forbidden in URL (named) (bug 4377)
3668 !! options
3669 parsoid=wt2html,html2html
3670 !! wikitext
3671 [http://example.com/1[2345]
3672 !! html/php
3673 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3674 </p>
3675 !! html/parsoid
3676 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
3677 !!end
3678
3679 # parsoid adds a space before the link name
3680 !! test
3681 External links: open square bracket forbidden in URL (named) (bug 4377)
3682 Parsoid variant.
3683 !! wikitext
3684 [http://example.com/1 [2345]
3685 !! html
3686 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3687 </p>
3688 !!end
3689
3690 !! test
3691 External links: nowiki in URL link text (bug 6230)
3692 !! wikitext
3693 [http://example.com/ <nowiki>''example site''</nowiki>]
3694 !! html
3695 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3696 </p>
3697 !! end
3698
3699 !! test
3700 External links: newline forbidden in text (bug 6230 regression check)
3701 !! wikitext
3702 [http://example.com/ first
3703 second]
3704 !! html
3705 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3706 second]
3707 </p>
3708 !!end
3709
3710 !! test
3711 External links: Pipe char between url and text
3712 !! wikitext
3713 [http://example.com | link]
3714 !! html
3715 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3716 </p>
3717 !!end
3718
3719 !! test
3720 External links: protocol-relative URL in brackets
3721 !! wikitext
3722 [//example.com/ Test]
3723 !! html
3724 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3725 </p>
3726 !! end
3727
3728 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3729 !! test
3730 External links: protocol-relative URL in brackets without text
3731 !! wikitext
3732 [//example.com]
3733 !! html/php
3734 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3735 </p>
3736 !! html/parsoid
3737 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
3738 !! end
3739
3740 !! test
3741 External links: protocol-relative URL in free text is left alone
3742 !! wikitext
3743 //example.com/Foo
3744 !! html
3745 <p>//example.com/Foo
3746 </p>
3747 !!end
3748
3749 !! test
3750 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3751 !! wikitext
3752 foo//example.com/Foo
3753 !! html
3754 <p>foo//example.com/Foo
3755 </p>
3756 !! end
3757
3758 !! test
3759 External links: with no contents
3760 !! wikitext
3761 [http://en.wikipedia.org/wiki/Foo]
3762
3763 [[wikipedia:Foo|Bar]]
3764
3765 [[wikipedia:Foo|<span>Bar</span>]]
3766 !! html/parsoid
3767 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
3768 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo">Bar</a></p>
3769 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"><span>Bar</span></a></p>
3770 !! end
3771
3772 !! test
3773 External image
3774 !! wikitext
3775 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3776 !! html
3777 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3778 </p>
3779 !! end
3780
3781 !! test
3782 External image from https
3783 !! wikitext
3784 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3785 !! html
3786 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3787 </p>
3788 !! end
3789
3790 !! test
3791 External image (when not allowed)
3792 !! options
3793 wgAllowExternalImages=0
3794 !! wikitext
3795 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3796 !! html
3797 <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>
3798 </p>
3799 !! end
3800
3801 !! test
3802 Link to non-http image, no img tag
3803 !! wikitext
3804 Link to non-http image, no img tag: ftp://example.com/test.jpg
3805 !! html
3806 <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>
3807 </p>
3808 !! end
3809
3810 !! test
3811 External links: terminating separator
3812 !! wikitext
3813 Terminating separator: http://example.com/thing,
3814 !! html
3815 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3816 </p>
3817 !! end
3818
3819 !! test
3820 External links: intervening separator
3821 !! wikitext
3822 Intervening separator: http://example.com/1,2,3
3823 !! html
3824 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3825 </p>
3826 !! end
3827
3828 !! test
3829 External links: old bug with URL in query
3830 !! wikitext
3831 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3832 !! html
3833 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3834 </p>
3835 !! end
3836
3837 !! test
3838 External links: old URL-in-URL bug, mixed protocols
3839 !! wikitext
3840 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3841 !! html
3842 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3843 </p>
3844 !!end
3845
3846 !! test
3847 External links: URL in text
3848 !! wikitext
3849 URL in text: [http://example.com http://example.com]
3850 !! html
3851 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3852 </p>
3853 !! end
3854
3855 !! test
3856 External links: Clickable images
3857 !! wikitext
3858 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3859 !! html
3860 <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>
3861 </p>
3862 !!end
3863
3864 !! test
3865 External links: raw ampersand
3866 !! wikitext
3867 Old &amp; use: http://x&y
3868 !! html
3869 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3870 </p>
3871 !! end
3872
3873 !! test
3874 External links: encoded ampersand
3875 !! wikitext
3876 Old &amp; use: http://x&amp;y
3877 !! html/php
3878 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3879 </p>
3880 !! html/parsoid
3881 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
3882 !! end
3883
3884 !! test
3885 External links: encoded equals (bug 6102)
3886 !! wikitext
3887 http://example.com/?foo&#61;bar
3888 !! html/php
3889 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3890 </p>
3891 !! html/parsoid
3892 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
3893 !! end
3894
3895 ##
3896 ## Note that parsoid doesn't explicit mark autonumbered links, nor
3897 ## does it number them. As discussed in bug 53505, we can identify
3898 ## autonumbered links via CSS.
3899 ##
3900
3901 !! test
3902 External links: [raw ampersand]
3903 !! wikitext
3904 Old &amp; use: [http://x&y]
3905 !! html/php
3906 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3907 </p>
3908 !! html/parsoid
3909 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3910 !! end
3911
3912 # note that parsoid html is identical to [raw ampersand] case; so html2wt
3913 # mode will return the [raw ampersand] wikitext
3914 !! test
3915 External links: [encoded ampersand]
3916 !! options
3917 parsoid=wt2html,wt2wt,html2html
3918 !! wikitext
3919 Old &amp; use: [http://x&amp;y]
3920 !! html/php
3921 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3922 </p>
3923 !! html/parsoid
3924 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3925 !! end
3926
3927 !! test
3928 External links: [raw equals]
3929 !! wikitext
3930 [http://example.com/?foo=bar]
3931 !! html/php
3932 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3933 </p>
3934 !! html/parsoid
3935 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
3936 !! end
3937
3938 # note that parsoid html is identical to [raw equals] case; so html2wt
3939 # mode will return the [raw equals] wikitext
3940 !! test
3941 External links: [encoded equals] (bug 6102)
3942 !! options
3943 parsoid=wt2html,wt2wt,html2html
3944 !! wikitext
3945 [http://example.com/?foo&#61;bar]
3946 !! html/php
3947 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3948 </p>
3949 !! html/parsoid
3950 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
3951 !! end
3952
3953 # xxx parsoid strips the IDN character, so the round-trip tests will
3954 # obviously fail and are disabled. --cscott
3955 !! test
3956 External links: [IDN ignored character reference in hostname; strip it right off]
3957 !! options
3958 parsoid=wt2html,wt2wt,html2html
3959 !! wikitext
3960 [http://e&zwnj;xample.com/]
3961 !! html/php
3962 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3963 </p>
3964 !! html/parsoid
3965 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
3966 !! end
3967
3968 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3969 # Where an external link could easily circumvent the sanitization of the text of
3970 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3971 # test demands a higher standard. That's a bit strange.
3972 #
3973 # Example:
3974 #
3975 # http://e‌xample.com -> [http://example.com|http://example.com]
3976 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3977 #
3978 # The first example is sanitized, but the second is not. Any security benefits
3979 # from this production are trivial to circumvent. Either remove this test and
3980 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3981 # the test accordingly.
3982 #
3983 # All our love,
3984 # The Parsoid team.
3985 # xxx parsoid strips the IDN character, so the round-trip tests will
3986 # obviously fail and are disabled. --cscott
3987 !! test
3988 External links: IDN ignored character reference in hostname; strip it right off
3989 !! options
3990 parsoid=wt2html,html2html
3991 !! wikitext
3992 http://e&zwnj;xample.com/
3993 !! html/php
3994 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3995 </p>
3996 !! html/parsoid
3997 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
3998 !! end
3999
4000 !! test
4001 External links: www.jpeg.org (bug 554)
4002 !! wikitext
4003 http://www.jpeg.org
4004 !! html
4005 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4006 </p>
4007 !! end
4008
4009 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4010 !! test
4011 External links: URL within URL (original bug 2)
4012 !! wikitext
4013 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4014 !! html/php
4015 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4016 </p>
4017 !! html/parsoid
4018 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4019 !! end
4020
4021 !! test
4022 BUG 361: URL inside bracketed URL
4023 !! wikitext
4024 [http://www.example.com/foo http://www.example.com/bar]
4025 !! html
4026 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4027 </p>
4028 !! end
4029
4030 !! test
4031 BUG 361: URL within URL, not bracketed
4032 !! wikitext
4033 http://www.example.com/foo?=http://www.example.com/bar
4034 !! html
4035 <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>
4036 </p>
4037 !! end
4038
4039 !! test
4040 BUG 289: ">"-token in URL-tail
4041 !! wikitext
4042 http://www.example.com/<hello>
4043 !! html
4044 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4045 </p>
4046 !!end
4047
4048 !! test
4049 BUG 289: literal ">"-token in URL-tail
4050 !! wikitext
4051 http://www.example.com/<b>html</b>
4052 !! html
4053 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4054 </p>
4055 !!end
4056
4057 !! test
4058 BUG 289: ">"-token in bracketed URL
4059 !! wikitext
4060 [http://www.example.com/<hello> stuff]
4061 !! html
4062 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4063 </p>
4064 !!end
4065
4066 !! test
4067 BUG 289: literal ">"-token in bracketed URL
4068 !! wikitext
4069 [http://www.example.com/<b>html</b> stuff]
4070 !! html
4071 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4072 </p>
4073 !!end
4074
4075 !! test
4076 BUG 289: literal double quote at end of URL
4077 !! wikitext
4078 http://www.example.com/"hello"
4079 !! html
4080 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4081 </p>
4082 !!end
4083
4084 !! test
4085 BUG 289: literal double quote in bracketed URL
4086 !! wikitext
4087 [http://www.example.com/"hello" stuff]
4088 !! html
4089 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4090 </p>
4091 !!end
4092
4093 !! test
4094 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4095 !! wikitext
4096 [http://www.example.com test]
4097 !! html
4098 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4099 </p>
4100 !! end
4101
4102 !! test
4103 External links: link text with spaces
4104 !! wikitext
4105 [http://www.example.com a b c]
4106 [http://www.example.com ''a'' ''b'']
4107 !! html
4108 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4109 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4110 </p>
4111 !! end
4112
4113 !! test
4114 External links: wiki links within external link (Bug 3695)
4115 !! wikitext
4116 [http://example.com [[wikilink]] embedded in ext link]
4117 !! html/php
4118 <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>
4119 </p>
4120 !! html/parsoid
4121 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink">wikilink</a><span> embedded in ext link</span></p>
4122 !! end
4123
4124 !! test
4125 BUG 787: Links with one slash after the url protocol are invalid
4126 !! wikitext
4127 http:/example.com
4128
4129 [http:/example.com title]
4130 !! html
4131 <p>http:/example.com
4132 </p><p>[http:/example.com title]
4133 </p>
4134 !! end
4135
4136 !! test
4137 Bracketed external links with template-generated invalid target
4138 !! wikitext
4139 [{{echo|http:/example.com}} title]
4140 !! html
4141 <p>[http:/example.com title]
4142 </p>
4143 !! end
4144
4145 !! test
4146 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4147 !! wikitext
4148 ''[http://example.com text'']
4149 [http://example.com '''text]'''
4150 ''Something [http://example.com in italic'']
4151 ''Something [http://example.com mixed''''', even bold]'''
4152 '''''Now [http://example.com both''''']
4153 !! html
4154 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4155 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4156 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4157 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4158 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4159 </p>
4160 !! end
4161
4162
4163 !! test
4164 Bug 4781: %26 in URL
4165 !! wikitext
4166 http://www.example.com/?title=AT%26T
4167 !! html/php
4168 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4169 </p>
4170 !! html/parsoid
4171 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4172 !! end
4173
4174 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4175 # % is actually legal in HTML5. Any change in output would need testing though.
4176 !! test
4177 Bug 4781, 5267: %25 in URL
4178 !! wikitext
4179 http://www.example.com/?title=100%25_Bran
4180 !! html/php
4181 <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>
4182 </p>
4183 !! html/parsoid
4184 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4185 !! end
4186
4187 !! test
4188 Bug 4781, 5267: %28, %29 in URL
4189 !! wikitext
4190 http://www.example.com/?title=Ben-Hur_%281959_film%29
4191 !! html/php
4192 <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>
4193 </p>
4194 !! html/parsoid
4195 <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>
4196 !! end
4197
4198
4199 !! test
4200 Bug 4781: %26 in autonumber URL
4201 !! wikitext
4202 [http://www.example.com/?title=AT%26T]
4203 !! html/php
4204 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4205 </p>
4206 !! html/parsoid
4207 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4208 !! end
4209
4210 !! test
4211 Bug 4781, 5267: %26 in autonumber URL
4212 !! wikitext
4213 [http://www.example.com/?title=100%25_Bran]
4214 !! html/php
4215 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4216 </p>
4217 !! html/parsoid
4218 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4219 !! end
4220
4221 !! test
4222 Bug 4781, 5267: %28, %29 in autonumber URL
4223 !! wikitext
4224 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4225 !! html/php
4226 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4227 </p>
4228 !! html/parsoid
4229 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4230 !! end
4231
4232
4233 !! test
4234 Bug 4781: %26 in bracketed URL
4235 !! wikitext
4236 [http://www.example.com/?title=AT%26T link]
4237 !! html/php
4238 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4239 </p>
4240 !! html/parsoid
4241 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4242 !! end
4243
4244 !! test
4245 Bug 4781, 5267: %25 in bracketed URL
4246 !! wikitext
4247 [http://www.example.com/?title=100%25_Bran link]
4248 !! html
4249 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4250 </p>
4251 !! end
4252
4253 !! test
4254 Bug 4781, 5267: %28, %29 in bracketed URL
4255 !! wikitext
4256 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4257 !! html/php
4258 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4259 </p>
4260 !! html/parsoid
4261 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4262 !! end
4263
4264 !! test
4265 External link containing a period in the anchor. (bug 63947)
4266 !! wikitext
4267 [//foo.org/bar#baz. bang]
4268
4269 [//foo.org/bar. bang]
4270 !! html/php
4271 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4272 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4273 </p>
4274 !! html/parsoid
4275 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4276 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4277 !! end
4278
4279 !! test
4280 External link containing a single quote. (bug 63947)
4281 !! wikitext
4282 [//foo.org/bar'baz]
4283
4284 [//foo.org/bar'baz bang]
4285 !! html/php
4286 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4287 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4288 </p>
4289 !! html/parsoid
4290 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4291 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4292 !! end
4293
4294
4295 !! test
4296 External link containing a period in the anchor. (bug 63947)
4297 !! wikitext
4298 [//foo.org/bar#baz. bang]
4299
4300 [//foo.org/bar. bang]
4301 !! html/php
4302 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4303 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4304 </p>
4305 !! html/parsoid
4306 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4307 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4308 !! end
4309
4310 !! test
4311 External link containing a single quote. (bug 63947)
4312 !! wikitext
4313 [//foo.org/bar'baz]
4314
4315 [//foo.org/bar'baz bang]
4316 !! html/php
4317 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4318 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4319 </p>
4320 !! html/parsoid
4321 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4322 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4323 !! end
4324
4325
4326 !! test
4327 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4328 !! wikitext
4329 Some [http://example.com/ pretty ''italics'' and stuff]!
4330 !! html
4331 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4332 </p>
4333 !! end
4334
4335 !! test
4336 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4337 !! wikitext
4338 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4339 !! html
4340 <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>
4341 </p>
4342 !! end
4343
4344 !! test
4345 External link containing double-single-quotes with no space separating the url from text in italics
4346 !! wikitext
4347 [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]].]
4348 !! html/php
4349 <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>
4350 </p>
4351 !! html/parsoid
4352 <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)">Museo Picasso</a><span>.</span></p>
4353 !! end
4354
4355 !! test
4356 External link with comments in link text
4357 !! wikitext
4358 [http://www.google.com Google <!-- comment -->]
4359 !! html
4360 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4361 </p>
4362 !! end
4363
4364 !! test
4365 URL-encoding in URL functions (single parameter)
4366 !! wikitext
4367 {{localurl:Some page|amp=&}}
4368 !! html
4369 <p>/index.php?title=Some_page&amp;amp=&amp;
4370 </p>
4371 !! end
4372
4373 !! test
4374 URL-encoding in URL functions (multiple parameters)
4375 !! wikitext
4376 {{localurl:Some page|q=?&amp=&}}
4377 !! html
4378 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4379 </p>
4380 !! end
4381
4382 !! test
4383 Brackets in urls
4384 !! wikitext
4385 http://example.com/index.php?foozoid%5B%5D=bar
4386
4387 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4388 !! html/php
4389 <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>
4390 </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>
4391 </p>
4392 !! html/parsoid
4393 <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>
4394
4395 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4396 !! end
4397
4398 !! test
4399 IPv6 urls (bug 21261)
4400 !! options
4401 disabled
4402 !! wikitext
4403 http://[2404:130:0:1000::187:2]/index.php
4404 !! html
4405 <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>
4406 </p>
4407 !! end
4408
4409 !! test
4410 Non-extlinks in brackets
4411 !! wikitext
4412 [foo]
4413 [foo bar]
4414 [foo ''bar'']
4415 [fool's] errand
4416 [fool's errand]
4417 [{{echo|foo}}]
4418 [{{echo|foo}} bar]
4419 [{{echo|foo}} ''bar'']
4420 [{{echo|foo}}l's] errand
4421 [{{echo|foo}}l's errand]
4422 [url={{echo|foo}}]
4423 [url=http://example.com]
4424 !! html
4425 <p>[foo]
4426 [foo bar]
4427 [foo <i>bar</i>]
4428 [fool's] errand
4429 [fool's errand]
4430 [foo]
4431 [foo bar]
4432 [foo <i>bar</i>]
4433 [fool's] errand
4434 [fool's errand]
4435 [url=foo]
4436 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4437 </p>
4438 !! end
4439
4440 !! test
4441 Percent encoding in external links
4442 !! wikitext
4443 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4444 !! html/php
4445 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4446 </p>
4447 !! html/parsoid
4448 <p><a rel="mw:ExtLink"
4449 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4450 !! end
4451
4452 !! test
4453 Use url link syntax for links where the content is equal the link target
4454 !! wikitext
4455 http://example.com
4456 !! html/php
4457 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4458 </p>
4459 !! html/parsoid
4460 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4461 !! end
4462
4463 !! test
4464 Parenthesis in external links, especially URL links
4465 !! wikitext
4466 http://example.com)
4467
4468 http://example.com/test)
4469
4470 http://example.com/(test)
4471
4472 http://example.com/((test)
4473
4474 (http://example.com/(test))
4475
4476 (http://example.com/(test)))))
4477
4478 http://example.com/a)b
4479
4480 [http://example.com) foo]
4481 !! html/php
4482 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4483 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4484 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4485 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4486 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4487 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4488 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4489 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4490 </p>
4491 !! html/parsoid
4492 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4493 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4494 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4495 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4496 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4497 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4498 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4499 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4500 !! end
4501
4502 !! test
4503 Parenthesis in external links, w/ transclusion or comment
4504 !! wikitext
4505 (http://example.com/{{echo|hi}})
4506
4507 (http://example.com<!-- hi -->)
4508 !! html/php
4509 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4510 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4511 </p>
4512 !! html/parsoid
4513 <p>(<a data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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}}]}\" 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]}\">hi&lt;/span>"}]]}' 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}}"}}'>http://example.com/hi</a>)</p>
4514
4515 <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>
4516 !! end
4517
4518 !! test
4519 Replace invalid link targets when serializing
4520 !! options
4521 parsoid=html2wt
4522 !! html
4523 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
4524 !! wikitext
4525 [[MediaWiki:Badtitletext|Manual]]
4526 !! end
4527
4528 ###
4529 ### Quotes
4530 ###
4531
4532 !! test
4533 Quotes
4534 !! wikitext
4535 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4536
4537 Normal text. '''''Bold italic text.''''' Normal text.
4538 !! html
4539 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4540 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4541 </p>
4542 !! end
4543
4544
4545 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4546 # parser strips. The wikitext contains just the first half of the bold
4547 # quote pair.
4548 !! test
4549 Unclosed and unmatched quotes
4550 !! wikitext
4551 '''''Bold italic text '''with bold deactivated''' in between.'''''
4552
4553 '''''Bold italic text ''with italic deactivated'' in between.'''''
4554
4555 '''Bold text..
4556
4557 ..spanning two paragraphs (should not work).'''
4558
4559 '''Bold tag left open
4560
4561 ''Italic tag left open
4562
4563 Normal text.
4564
4565 <!-- Unmatching number of opening, closing tags: -->
4566 '''This year''''s election ''should'' beat '''last year''''s.
4567
4568 ''Tom'''s car is bigger than ''Susan'''s.
4569
4570 Plain ''italic'''s plain
4571 !! html/php
4572 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4573 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4574 </p><p><b>Bold text..</b>
4575 </p><p>..spanning two paragraphs (should not work).
4576 </p><p><b>Bold tag left open</b>
4577 </p><p><i>Italic tag left open</i>
4578 </p><p>Normal text.
4579 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4580 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4581 </p><p>Plain <i>italic'</i>s plain
4582 </p>
4583 !! html/parsoid
4584 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4585 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4586 </p><p><b>Bold text..</b>
4587 </p><p>..spanning two paragraphs (should not work).<b></b>
4588 </p><p><b>Bold tag left open</b>
4589 </p><p><i>Italic tag left open</i>
4590 </p><p>Normal text.
4591 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4592 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4593 </p><p>Plain <i>italic'</i>s plain
4594 </p>
4595 !! end
4596
4597 ###
4598 ### Tables
4599 ###
4600 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4601 ###
4602
4603 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4604 # is the bare minimum required by the spec, see:
4605 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4606 # Parsoid team replies: empty table tags are legal in HTML5
4607 !! test
4608 A table with no data.
4609 !! options
4610 parsoid=wt2html
4611 !! wikitext
4612 {||}
4613 !! html/php
4614
4615 !! html/parsoid
4616 <table></table>
4617
4618 !! end
4619
4620 !! test
4621 A table with stray table end tags on start tag line (wt2html)
4622 !! options
4623 parsoid=wt2html
4624 !! wikitext
4625 {|style="color: red;"|}
4626
4627 {|style="color: red;" |}
4628 |foo
4629 |}
4630
4631 {|style="color: red;"|} id="foo"
4632 |foo
4633 |}
4634
4635 {|style="color: red;" |} id="foo"
4636 |foo
4637 |}
4638 !! html
4639 <table style="color: red;"></table>
4640
4641 <table style="color: red;">
4642 <tbody><tr>
4643 <td>foo</td>
4644 </tr></tbody>
4645 </table>
4646
4647 <table style="color: red;" id="foo">
4648 <tbody><tr>
4649 <td>foo</td>
4650 </tr></tbody>
4651 </table>
4652
4653 <table style="color: red;" id="foo">
4654 <tbody><tr>
4655 <td>foo</td>
4656 </tr></tbody>
4657 </table>
4658
4659 !! end
4660
4661 !! test
4662 A table with no data (take 2)
4663 !! wikitext
4664 {|
4665 |}
4666 !! html/parsoid
4667 <table></table>
4668 !! end
4669
4670 # A table with nothing but a caption is invalid XHTML, we might want to render
4671 # this as <p>caption</p>
4672 # Parsoid team replies: table with only a caption is legal in HTML5
4673 !! test
4674 A table with nothing but a caption
4675 !! wikitext
4676 {|
4677 |+ caption
4678 |}
4679 !! html/php
4680 <table>
4681 <caption> caption
4682 </caption><tr><td></td></tr></table>
4683
4684 !! html/parsoid
4685 <table><caption> caption</caption></table>
4686 !! end
4687
4688 !! test
4689 A table with caption with default-spaced attributes and a table row
4690 !! wikitext
4691 {|
4692 |+ style="color: red;" | caption1
4693 |-
4694 | foo
4695 |}
4696 !! html
4697 <table>
4698 <caption style="color: red;"> caption1
4699 </caption>
4700 <tr>
4701 <td> foo
4702 </td></tr></table>
4703
4704 !! end
4705
4706 !! test
4707 A table with captions with non-default spaced attributes and a table row
4708 !! wikitext
4709 {|
4710 |+style="color: red;"|caption2
4711 |+ style="color: red;"| caption3
4712 |-
4713 | foo
4714 |}
4715 !! html
4716 <table>
4717 <caption style="color: red;">caption2
4718 </caption>
4719 <caption style="color: red;"> caption3
4720 </caption>
4721 <tr>
4722 <td> foo
4723 </td></tr></table>
4724
4725 !! end
4726
4727 !! test
4728 Table td-cell syntax variations
4729 !! wikitext
4730 {|
4731 | foo bar foo | baz
4732 | foo bar foo || baz
4733 | style='color:red;' | baz
4734 | style='color:red;' || baz
4735 |}
4736 !! html
4737 <table>
4738 <tr>
4739 <td> baz
4740 </td>
4741 <td> foo bar foo </td>
4742 <td> baz
4743 </td>
4744 <td style="color:red;"> baz
4745 </td>
4746 <td> style='color:red;' </td>
4747 <td> baz
4748 </td></tr></table>
4749
4750 !! end
4751
4752 !! test
4753 Simple table
4754 !! wikitext
4755 {|
4756 | 1 || 2
4757 |-
4758 | 3 || 4
4759 |}
4760 !! html
4761 <table>
4762 <tr>
4763 <td> 1 </td>
4764 <td> 2
4765 </td></tr>
4766 <tr>
4767 <td> 3 </td>
4768 <td> 4
4769 </td></tr></table>
4770
4771 !! end
4772
4773 !! test
4774 Simple table but with multiple dashes for row wikitext
4775 !! wikitext
4776 {|
4777 | foo
4778 |-----
4779 | bar
4780 |}
4781 !! html
4782 <table>
4783 <tr>
4784 <td> foo
4785 </td></tr>
4786 <tr>
4787 <td> bar
4788 </td></tr></table>
4789
4790 !! end
4791 !! test
4792 Multiplication table
4793 !! wikitext
4794 {| border="1" cellpadding="2"
4795 |+Multiplication table
4796 |-
4797 ! &times; !! 1 !! 2 !! 3
4798 |-
4799 ! 1
4800 | 1 || 2 || 3
4801 |-
4802 ! 2
4803 | 2 || 4 || 6
4804 |-
4805 ! 3
4806 | 3 || 6 || 9
4807 |-
4808 ! 4
4809 | 4 || 8 || 12
4810 |-
4811 ! 5
4812 | 5 || 10 || 15
4813 |}
4814 !! html
4815 <table border="1" cellpadding="2">
4816 <caption>Multiplication table
4817 </caption>
4818 <tr>
4819 <th> &#215; </th>
4820 <th> 1 </th>
4821 <th> 2 </th>
4822 <th> 3
4823 </th></tr>
4824 <tr>
4825 <th> 1
4826 </th>
4827 <td> 1 </td>
4828 <td> 2 </td>
4829 <td> 3
4830 </td></tr>
4831 <tr>
4832 <th> 2
4833 </th>
4834 <td> 2 </td>
4835 <td> 4 </td>
4836 <td> 6
4837 </td></tr>
4838 <tr>
4839 <th> 3
4840 </th>
4841 <td> 3 </td>
4842 <td> 6 </td>
4843 <td> 9
4844 </td></tr>
4845 <tr>
4846 <th> 4
4847 </th>
4848 <td> 4 </td>
4849 <td> 8 </td>
4850 <td> 12
4851 </td></tr>
4852 <tr>
4853 <th> 5
4854 </th>
4855 <td> 5 </td>
4856 <td> 10 </td>
4857 <td> 15
4858 </td></tr></table>
4859
4860 !! end
4861
4862 !! test
4863 Accept "||" in table headings
4864 !! wikitext
4865 {|
4866 !h1 || h2
4867 |}
4868 !! html
4869 <table>
4870 <tr>
4871 <th>h1 </th>
4872 <th> h2
4873 </th></tr></table>
4874
4875 !! end
4876
4877 !! test
4878 Accept "!!" in table data
4879 !! wikitext
4880 {|
4881 | Foo!! ||
4882 |}
4883 !! html/parsoid
4884 <table data-parsoid='{}'>
4885 <tbody data-parsoid='{}'><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
4886 </tbody></table>
4887 !! end
4888
4889 !! test
4890 Accept "||" in indented table headings
4891 !! wikitext
4892 :{|
4893 !h1 || h2
4894 |}
4895 !! html
4896 <dl><dd><table>
4897 <tr>
4898 <th>h1 </th>
4899 <th> h2
4900 </th></tr></table></dd></dl>
4901
4902 !! end
4903
4904 !! test
4905 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4906 !! wikitext
4907 {|
4908 !| h1
4909 || a
4910 |}
4911 !! html
4912 <table>
4913 <tr>
4914 <th> h1
4915 </th>
4916 <td> a
4917 </td></tr></table>
4918
4919 !! end
4920
4921 !!test
4922 Accept "| !" at start of line in tables (ignore !-attribute)
4923 !! wikitext
4924 {|
4925 |-
4926 | !style="color:red" | bar
4927 |}
4928 !! html
4929 <table>
4930
4931 <tr>
4932 <td> bar
4933 </td></tr></table>
4934
4935 !!end
4936
4937 !!test
4938 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 +/-
4939 !! wikitext
4940 {|
4941 |-
4942 |style='color:red;'|+1
4943 |style='color:blue;'|-1
4944 |-
4945 | 1 || 2 || 3
4946 | 1 ||+2 ||-3
4947 |-
4948 | +1
4949 | -1
4950 |}
4951 !! html
4952 <table>
4953
4954 <tr>
4955 <td style="color:red;">+1
4956 </td>
4957 <td style="color:blue;">-1
4958 </td></tr>
4959 <tr>
4960 <td> 1 </td>
4961 <td> 2 </td>
4962 <td> 3
4963 </td>
4964 <td> 1 </td>
4965 <td>+2 </td>
4966 <td>-3
4967 </td></tr>
4968 <tr>
4969 <td> +1
4970 </td>
4971 <td> -1
4972 </td></tr></table>
4973
4974 !!end
4975
4976 !! test
4977 Table rowspan
4978 !! wikitext
4979 {| border=1
4980 | Cell 1, row 1
4981 |rowspan=2| Cell 2, row 1 (and 2)
4982 | Cell 3, row 1
4983 |-
4984 | Cell 1, row 2
4985 | Cell 3, row 2
4986 |}
4987 !! html
4988 <table border="1">
4989 <tr>
4990 <td> Cell 1, row 1
4991 </td>
4992 <td rowspan="2"> Cell 2, row 1 (and 2)
4993 </td>
4994 <td> Cell 3, row 1
4995 </td></tr>
4996 <tr>
4997 <td> Cell 1, row 2
4998 </td>
4999 <td> Cell 3, row 2
5000 </td></tr></table>
5001
5002 !! end
5003
5004 !! test
5005 Nested table
5006 !! wikitext
5007 {| border=1
5008 | &alpha;
5009 |
5010 {| bgcolor=#ABCDEF border=2
5011 |nested
5012 |-
5013 |table
5014 |}
5015 |the original table again
5016 |}
5017 !! html
5018 <table border="1">
5019 <tr>
5020 <td> &#945;
5021 </td>
5022 <td>
5023 <table bgcolor="#ABCDEF" border="2">
5024 <tr>
5025 <td>nested
5026 </td></tr>
5027 <tr>
5028 <td>table
5029 </td></tr></table>
5030 </td>
5031 <td>the original table again
5032 </td></tr></table>
5033
5034 !! end
5035
5036 !! test
5037 Invalid attributes in table cell (bug 1830)
5038 !! wikitext
5039 {|
5040 |Cell:|broken
5041 |}
5042 !! html
5043 <table>
5044 <tr>
5045 <td>broken
5046 </td></tr></table>
5047
5048 !! end
5049
5050
5051 # The "|}" to close the table is missing from the input, so parsoid's
5052 # *2wt modes will fail.
5053 !! test
5054 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5055 !! options
5056 parsoid=wt2html,html2html
5057 !! wikitext
5058 {|
5059 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5060 !! html/php
5061 <table>
5062 <tr>
5063 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5064 <td>]" onmouseover="alert(document.cookie)"&gt;test
5065 </td>
5066 </tr>
5067 </table>
5068
5069 !! html/parsoid
5070 <table><tbody>
5071 <tr>
5072 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5073 !! end
5074
5075
5076 !! test
5077 Indented table markup mixed with indented pre content (proposed in bug 6200)
5078 !! wikitext
5079 <table>
5080 <tr>
5081 <td>
5082 Text that should be rendered preformatted
5083 </td>
5084 </tr>
5085 </table>
5086 !! html
5087 <table>
5088 <tr>
5089 <td>
5090 <pre>Text that should be rendered preformatted
5091 </pre>
5092 </td>
5093 </tr>
5094 </table>
5095
5096 !! end
5097
5098 !! test
5099 Template-generated table cell attributes and cell content
5100 !! wikitext
5101 {|
5102 |{{table_attribs}}
5103 | {{table_attribs}}
5104 |}
5105 !! html
5106 <table>
5107 <tr>
5108 <td style="color: red"> Foo
5109 </td>
5110 <td style="color: red"> Foo
5111 </td></tr></table>
5112
5113 !! end
5114
5115 !! test
5116 Template-generated table cell attributes and cell content (2)
5117 !! wikitext
5118 {|
5119 |align=center {{table_attribs}}
5120 |}
5121 !! html
5122 <table>
5123 <tr>
5124 <td align="center" style="color: red"> Foo
5125 </td></tr></table>
5126
5127 !! end
5128
5129 !! test
5130 Template-generated table cell attributes and cell content (3)
5131 !! wikitext
5132 {|
5133 |align=center {{table_cells}}
5134 |}
5135 !! html
5136 <table>
5137 <tr>
5138 <td align="center" style="color: red"> Foo </td>
5139 <td> Bar </td>
5140 <td> Baz
5141 </td></tr></table>
5142
5143 !! end
5144
5145 !! test
5146 Table with row followed by newlines and table heading
5147 !! wikitext
5148 {|
5149 |-
5150
5151 ! foo
5152 |}
5153 !! html
5154 <table>
5155
5156
5157 <tr>
5158 <th> foo
5159 </th></tr></table>
5160
5161 !! end
5162
5163 !! test
5164 Table with empty line following the start tag
5165 !! wikitext
5166 {|
5167
5168 |-
5169 | foo
5170 |}
5171 !! html
5172 <table>
5173
5174
5175 <tr>
5176 <td> foo
5177 </td></tr></table>
5178
5179 !! end
5180
5181 # FIXME: Preserve the attribute properly (with an empty string as value) in
5182 # the PHP parser. Parsoid implements the behavior below.
5183 !! test
5184 Table attributes with empty value
5185 !! wikitext
5186 {|
5187 | style=| hello
5188 |}
5189 !! html/parsoid
5190 <table>
5191 <tbody>
5192 <tr>
5193 <td style=""> hello
5194 </td></tr></tbody></table>
5195
5196 !! end
5197
5198 !! test
5199 Wikitext table with a lot of comments
5200 !! wikitext
5201 {|
5202 <!-- c0 -->
5203 | foo
5204 <!-- c1 -->
5205 |- <!-- c2 -->
5206 <!-- c3 -->
5207 |<!-- c4 -->
5208 <!-- c5 -->
5209 |}
5210 !! html
5211 <table>
5212 <tr>
5213 <td> foo
5214 </td></tr>
5215 <tr>
5216 <td>
5217 </td></tr></table>
5218
5219 !! end
5220
5221 !! test
5222 Wikitext table with double-line table cell
5223 !! wikitext
5224 {|
5225 |a
5226 b
5227 |}
5228 !! html
5229 <table>
5230 <tr>
5231 <td>a
5232 <p>b
5233 </p>
5234 </td></tr></table>
5235
5236 !! end
5237
5238 !! test
5239 Table cell with a single comment
5240 !! wikitext
5241 {|
5242 | <!-- c1 -->
5243 | a
5244 |}
5245 !! html
5246 <table>
5247 <tr>
5248 <td>
5249 </td>
5250 <td> a
5251 </td></tr></table>
5252
5253 !! end
5254
5255 !! test
5256 Table-cell after a comment-only-empty-line
5257 !! wikitext
5258 {|
5259 |a
5260 <!--c1-->
5261 <!--c2-->| b
5262 |}
5263 !! html/parsoid
5264 <table>
5265 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5266 <!--c1-->
5267 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5268 </tbody></table>
5269
5270 !! end
5271
5272 # The expected HTML structure in this test is debatable. The PHP parser does
5273 # not parse this kind of table at all. The main focus for Parsoid is on
5274 # round-tripping, so this output is ok for now. TODO: revisit!
5275 !! test
5276 Wikitext table with html-syntax row
5277 !! wikitext
5278 {|
5279 |-
5280 <td>foo</td>
5281 |}
5282 !! html/parsoid
5283 <table>
5284 <tbody>
5285 <tr>
5286 <td>foo</td></tr></tbody></table>
5287 !! end
5288
5289 !! test
5290 Implicit <td> after a |-
5291 (PHP parser relies on Tidy to add the missing <td> tags)
5292 !! options
5293 parsoid=wt2html,wt2wt
5294 !! wikitext
5295 {|
5296 |-
5297 a
5298 |}
5299 !! html
5300 <table>
5301 <tr><td>a</td></tr>
5302 </table>
5303 !! end
5304
5305 !! test
5306 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
5307 (PHP parser relies on Tidy to add the missing <td> tags)
5308 !! options
5309 parsoid=wt2html,wt2wt
5310 !! wikitext
5311 {|
5312 |-
5313 |
5314 a
5315 |-
5316 b
5317 |}
5318 !! html
5319 <table>
5320 <tbody>
5321 <tr><td><pre>a</pre></td></tr>
5322 <tr><td> b</td></tr>
5323 </tbody>
5324 </table>
5325 !! end
5326
5327 !! test
5328 Lists should be recognized in an implicit <td> context
5329 (PHP parser relies on Tidy to add the missing <td> tags)
5330 !! options
5331 parsoid=wt2html,wt2wt
5332 !! wikitext
5333 {|
5334 |-
5335 *a
5336 |}
5337 !! html
5338 <table>
5339 <tr>
5340 <td><ul>
5341 <li>a</li>
5342 </ul></td>
5343 </tr>
5344 </table>
5345 !! end
5346
5347 !! test
5348 Parsoid: Round-trip tables directly followed by content (bug 51219)
5349 !! options
5350 parsoid=wt2html,wt2wt
5351 !! wikitext
5352 {|
5353 |foo
5354 |} bar
5355
5356 {|
5357 |baz
5358 |}<b>quux</b>
5359 !! html
5360 <table><tbody>
5361 <tr>
5362 <td>foo</td></tr></tbody></table> bar
5363 <table>
5364 <tbody>
5365 <tr>
5366 <td>baz</td></tr></tbody></table><b>quux</b>
5367 !! end
5368
5369 !! test
5370 Parsoid: Default to a newline after tables in new content (bug 51219)
5371 !! options
5372 parsoid=html2wt
5373 !! wikitext
5374 {|
5375 |foo
5376 |}
5377 <nowiki> </nowiki>bar
5378 {|
5379 |baz
5380 |}
5381 '''quux'''
5382 !! html
5383 <table><tbody>
5384 <tr><td>foo</td></tr></tbody></table> bar
5385 <table><tbody>
5386 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5387 !! end
5388
5389 !! test
5390 Parsoid: newline inducing block nodes don't suppress <nowiki>
5391 !! options
5392 parsoid=html2wt
5393 !! wikitext
5394 <nowiki> </nowiki>a
5395
5396 = foo =
5397 !! html
5398 a<h1>foo</h1>
5399 !! end
5400
5401 !! test
5402 Parsoid: Row-syntax table headings followed by comment & table cells
5403 !! options
5404 parsoid=wt2html,wt2wt
5405 !! wikitext
5406 {|
5407 ! foo || bar
5408 <!-- foo --> || baz || quux
5409 |}
5410 !! html/parsoid
5411 <table>
5412 <tbody>
5413 <tr><th>foo </th><th>bar </th>
5414 <td>baz </td>
5415 <td>quux</td></tr></tbody></table>
5416 !! end
5417
5418
5419 !!test
5420 Parsoid: Recover better from broken table attributes
5421 !!options
5422 parsoid=wt2html
5423 !!wikitext
5424 {| class="foo
5425 | class="bar" |
5426 foo
5427 |}
5428 !!html/parsoid
5429 <table class="foo">
5430 <tr>
5431 <td class="bar">
5432 <p>foo</p></td></tr>
5433 </tbody></table>
5434 !!end
5435
5436 !! test
5437 Strip unsupported table tags
5438 !! options
5439 parsoid=html2wt
5440 !! html
5441 <table>
5442 <thead>
5443 <tr>
5444 <th>Month</th>
5445 <th>Savings</th>
5446 </tr>
5447 </thead>
5448 <tbody>
5449 <tr>
5450 <td>January</td>
5451 <td>$100</td>
5452 </tr>
5453 <tr>
5454 <td>February</td>
5455 <td>$80</td>
5456 </tr>
5457 </tbody>
5458 <tfoot>
5459 <tr>
5460 <td>Sum</td>
5461 <td>$180</td>
5462 </tr>
5463 </tfoot>
5464 </table>
5465 !! wikitext
5466 {|
5467
5468 !Month
5469 !Savings
5470
5471 |January
5472 |$100
5473
5474 |-
5475 |February
5476 |$80
5477
5478 |Sum
5479 |$180
5480
5481 |}
5482 !! end
5483
5484 ###
5485 ### Internal links
5486 ###
5487 !! test
5488 Plain link, capitalized
5489 !! wikitext
5490 [[Main Page]]
5491 !! html
5492 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5493 </p>
5494 !! end
5495
5496 !! test
5497 Plain link, uncapitalized
5498 !! wikitext
5499 [[main Page]]
5500 !! html
5501 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
5502 </p>
5503 !! end
5504
5505 !! test
5506 Piped link
5507 !! wikitext
5508 [[Main Page|The Main Page]]
5509 !! html
5510 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5511 </p>
5512 !! end
5513
5514 !! test
5515 Piped link with comment in link text
5516 !! wikitext
5517 [[Main Page|The Main<!--front--> Page]]
5518 !! html
5519 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5520 </p>
5521 !! end
5522
5523 !! test
5524 Piped link with multiple pipe characters in link text
5525 !! wikitext
5526 [[Main Page||The|Main|Page|]]
5527 !! html/php
5528 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
5529 </p>
5530 !! html/parsoid
5531 <p><a rel="mw:WikiLink" href="Main_Page">|The|Main|Page|</a></p>
5532 !! end
5533
5534 !! test
5535 Broken link
5536 !! wikitext
5537 [[Zigzagzogzagzig]]
5538 !! html
5539 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
5540 </p>
5541 !! end
5542
5543 !! test
5544 Broken link with fragment
5545 !! wikitext
5546 [[Zigzagzogzagzig#zug]]
5547 !! html
5548 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5549 </p>
5550 !! end
5551
5552 !! test
5553 Special page link with fragment
5554 !! wikitext
5555 [[Special:Version#anchor]]
5556 !! html
5557 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5558 </p>
5559 !! end
5560
5561 !! test
5562 Nonexistent special page link with fragment
5563 !! wikitext
5564 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5565 !! html
5566 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5567 </p>
5568 !! end
5569
5570 !! test
5571 Link with prefix
5572 !! wikitext
5573 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5574 !! html
5575 <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>
5576 </p>
5577 !! end
5578
5579 !! test
5580 Link with suffix
5581 !! wikitext
5582 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5583 !! html
5584 <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>!!!
5585 </p>
5586 !! end
5587
5588 !! article
5589 prefixed article
5590 !! text
5591 Some text
5592 !! endarticle
5593
5594 !! test
5595 Bug 43661: Piped links with identical prefixes
5596 !! wikitext
5597 [[prefixed article|prefixed articles with spaces]]
5598
5599 [[prefixed article|prefixed articlesaoeu]]
5600
5601 [[Main Page|Main Page test]]
5602 !! html
5603 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5604 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5605 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5606 </p>
5607 !! end
5608
5609
5610 !! test
5611 Link with HTML entity in suffix / tail
5612 !! wikitext
5613 [[Main Page]]&quot;, [[Main Page]]&#97;
5614 !! html
5615 <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;
5616 </p>
5617 !! end
5618
5619 !! test
5620 Link with 3 brackets
5621 !! wikitext
5622 [[[Main Page]]]
5623 !! html
5624 <p>[[[Main Page]]]
5625 </p>
5626 !! end
5627
5628 !! test
5629 Link with 4 brackets
5630 !! wikitext
5631 [[[[Main Page]]]]
5632 !! html
5633 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5634 </p>
5635 !! end
5636
5637 !! test
5638 Piped link with 3 brackets
5639 !! wikitext
5640 [[[main page|the main page]]]
5641 !! html
5642 <p>[[[main page|the main page]]]
5643 </p>
5644 !! end
5645
5646 !! test
5647 Piped link with extlink-like text
5648 !! wikitext
5649 [[Main Page|[bar]]]
5650 [[Main Page|This is a [bar]]]
5651 !! html
5652 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5653 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5654 </p>
5655 !! end
5656
5657 !! test
5658 Link with multiple pipes
5659 !! wikitext
5660 [[Main Page|The|Main|Page]]
5661 !! html
5662 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5663 </p>
5664 !! end
5665
5666 # Note that parsoid does not munge anchor text; all non-space
5667 # characters are valid in HTML5 ids.
5668 !! test
5669 Anchor containing a #. (bug 63430)
5670 !! wikitext
5671 [[Main Page#And#Link]]
5672 !! html/php
5673 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
5674 </p>
5675 !! html/parsoid
5676 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link">Main Page#And#Link</a></p>
5677 !! end
5678
5679 !! test
5680 Link to namespaces
5681 !! wikitext
5682 [[Talk:Parser testing]], [[Meta:Disclaimers]]
5683 !! html
5684 <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>
5685 </p>
5686 !! end
5687
5688 !! test
5689 Link with space in namespace
5690 !! wikitext
5691 [[User talk:Foo bar]]
5692 !! html
5693 <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>
5694 </p>
5695 !! end
5696
5697 !! article
5698 MemoryAlpha:AlphaTest
5699 !! text
5700 This is an article in the MemoryAlpha namespace
5701 (which shadows the memoryalpha interwiki link).
5702 !! endarticle
5703
5704 !! test
5705 Namespace takes precedence over interwiki link (bug 51680)
5706 !! wikitext
5707 [[MemoryAlpha:AlphaTest]]
5708 !! html
5709 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5710 </p>
5711 !! end
5712
5713 # The previous test doesn't work correctly in html2*, due to not recognizing the
5714 # link as an internal one. This one checks for the correct behavior.
5715 !! test
5716 Link to namespace preferred over interwiki with correct rel attribute
5717 !! options
5718 parsoid=html2wt,html2html
5719 !! wikitext
5720 [[MemoryAlpha:AlphaTest]]
5721 !! html
5722 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5723 </p>
5724 !! end
5725
5726 !! test
5727 Piped link to namespace
5728 !! wikitext
5729 [[Meta:Disclaimers|The disclaimers]]
5730 !! html
5731 <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>
5732 </p>
5733 !! end
5734
5735 !! test
5736 Link containing }
5737 !! wikitext
5738 [[Usually caused by a typo (oops}]]
5739 !! html
5740 <p>[[Usually caused by a typo (oops}]]
5741 </p>
5742 !! end
5743
5744 !! article
5745 7% Solution
5746 !! text
5747 Just a test of an article title containing a percent.
5748 !! endarticle
5749
5750 !! test
5751 Link containing % (not as a hex sequence)
5752 !! wikitext
5753 [[7% Solution]]
5754 !! html/php
5755 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5756 </p>
5757 !! html/parsoid
5758 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5759 !! end
5760
5761 # note that the parsoid HTML is identical to the previous test output,
5762 # so the previous test ensures that the html2wt mode will generate the
5763 # "not as a hex sequence" wikitext.
5764 !! test
5765 Link containing % as a single hex sequence interpreted to char
5766 !! options
5767 parsoid=wt2wt,wt2html,html2html
5768 !! wikitext
5769 [[7%25 Solution]]
5770 !! html/php
5771 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5772 </p>
5773 !! html/parsoid
5774 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5775 !!end
5776
5777 !! test
5778 Link containing % as a double hex sequence interpreted to hex sequence
5779 !! wikitext
5780 [[7%2525 Solution]]
5781 !! html
5782 <p>[[7%2525 Solution]]
5783 </p>
5784 !!end
5785
5786 # note that parsoid does not munge anchor text; all non-space
5787 # characters are valid in HTML5 anchors.
5788 !! test
5789 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
5790 Example for such a section: == < ==
5791 !! wikitext
5792 [[%23%3c]][[%23%3e]]
5793 !! html/php
5794 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5795 </p>
5796 !! html/parsoid
5797 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E">#></a></p>
5798 !! end
5799
5800 !! test
5801 Link containing "<#" and ">#" as a hex sequences
5802 !! wikitext
5803 [[%3c%23]][[%3e%23]]
5804 !! html
5805 <p>[[%3c%23]][[%3e%23]]
5806 </p>
5807 !! end
5808
5809 !! test
5810 Link containing an equals sign
5811 !! wikitext
5812 [[Special:BookSources/isbn=4-00-026157-6]]
5813 !! html/php
5814 <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>
5815 </p>
5816 !! html/parsoid
5817 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
5818 !! end
5819
5820 !! article
5821 Foo~bar
5822 !! text
5823 Just a test of an article title containing a tilde.
5824 !! endarticle
5825
5826 # note that links containing signatures, like [[Foo~~~~]], are
5827 # massaged by the pre-save transform (PST) and so the tildes are never
5828 # seen by the parser.
5829 !! test
5830 Link containing a tilde
5831 !! wikitext
5832 [[Foo~bar]]
5833 !! html/php
5834 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5835 </p>
5836 !! html/parsoid
5837 <p><a rel="mw:WikiLink" href="./Foo~bar">Foo~bar</a></p>
5838 !! end
5839
5840 !! test
5841 Link containing double-single-quotes '' (bug 4598)
5842 !! wikitext
5843 [[Lista d''e paise d''o munno]]
5844 !! html/php
5845 <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>
5846 </p>
5847 !! html/parsoid
5848 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno">Lista d''e paise d''o munno</a></p>
5849 !! end
5850
5851 !! test
5852 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5853 !! wikitext
5854 Some [[Link|pretty ''italics'' and stuff]]!
5855 !! html/php
5856 <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>!
5857 </p>
5858 !! html/parsoid
5859 <p>Some <a rel="mw:WikiLink" href="Link">pretty <i>italics</i> and stuff</a>!</p>
5860 !! end
5861
5862 !! test
5863 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5864 !! wikitext
5865 ''Some [[Link|pretty ''italics'' and stuff]]!''
5866 !! html
5867 <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>
5868 </p>
5869 !! end
5870
5871 !! test
5872 Link with double quotes in title part (literal) and alternate part (interpreted)
5873 !! wikitext
5874 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5875
5876 [[''Pentecoste'']]
5877
5878 [[''Pentecoste''|Pentecoste]]
5879
5880 [[''Pentecoste''|''Pentecoste'']]
5881 !! html/php
5882 <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>
5883 </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>
5884 </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>
5885 </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>
5886 </p>
5887 !! html/parsoid
5888 <meta typeof="mw:Placeholder"/>
5889 <p><a rel="mw:WikiLink" href="''Pentecoste''">''Pentecoste''</a></p>
5890 <p><a rel="mw:WikiLink" href="''Pentecoste''">Pentecoste</a></p>
5891 <p><a rel="mw:WikiLink" href="''Pentecoste''"><i>Pentecoste</i></a></p>
5892 !! end
5893
5894 !! test
5895 Broken image links with HTML captions (bug 39700)
5896 !! wikitext
5897 [[File:Nonexistent|<script></script>]]
5898 [[File:Nonexistent|100px|<script></script>]]
5899 [[File:Nonexistent|&lt;]]
5900 [[File:Nonexistent|a<i>b</i>c]]
5901 !! html
5902 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5903 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5904 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5905 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5906 </p>
5907 !! end
5908
5909 !! test
5910 Plain link to URL
5911 !! wikitext
5912 [[http://www.example.com]]
5913 !! html/php
5914 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5915 </p>
5916 !! html/parsoid
5917 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
5918 !! end
5919
5920 !! test
5921 Plain link to URL with link text
5922 !! wikitext
5923 [[http://www.example.com Link text]]
5924 !! html
5925 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5926 </p>
5927 !! end
5928
5929 !! test
5930 Plain link to protocol-relative URL
5931 !! wikitext
5932 [[//www.example.com]]
5933 !! html/php
5934 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5935 </p>
5936 !! html/parsoid
5937 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
5938 !! end
5939
5940 !! test
5941 Plain link to protocol-relative URL with link text
5942 !! wikitext
5943 [[//www.example.com Link text]]
5944 !! html
5945 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5946 </p>
5947 !! end
5948
5949 !! test
5950 Plain link to page with question mark in title
5951 !! wikitext
5952 [[A?b]]
5953
5954 [[A?b|Baz]]
5955 !! html
5956 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5957 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5958 </p>
5959 !! end
5960
5961
5962 # I'm fairly sure the expected result here is wrong.
5963 # We want these to be URL links, not pseudo-pages with URLs for titles....
5964 # However the current output is also pretty screwy.
5965 #
5966 # ----
5967 # I'm changing it to match the current output--it arguably makes more
5968 # sense in the light of the test above. Old expected result was:
5969 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5970 #</p>
5971 # But I think this test is bordering on "garbage in, garbage out" anyway.
5972 # -- wtm
5973 !! test
5974 Piped link to URL
5975 !! wikitext
5976 Piped link to URL: [[http://www.example.com|an example URL]]
5977 !! html/php
5978 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
5979 </p>
5980 !! html/parsoid
5981 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
5982 !! end
5983
5984 !! test
5985 BUG 2: [[page|http://url/]] should link to page, not http://url/
5986 !! wikitext
5987 [[Main Page|http://url/]]
5988 !! html/php
5989 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
5990 </p>
5991 !! html/parsoid
5992 <p><a rel="mw:WikiLink" href="./Main_Page">http://url/</a></p>
5993 !! end
5994
5995 # Parsoid does not mark self-links, by design.
5996 !! test
5997 BUG 337: Escaped self-links should be bold
5998 !! options
5999 title=[[Bug462]]
6000 !! wikitext
6001 [[Bu&#103;462]] [[Bug462]]
6002 !! html/php
6003 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6004 </p>
6005 !! html/parsoid
6006 <p><a rel="mw:WikiLink" href="./Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462">Bug462</a></p>
6007 !! end
6008
6009 !! test
6010 Self-link to section should not be bold
6011 !! options
6012 title=[[Main Page]]
6013 !! wikitext
6014 [[Main Page#section]]
6015 !! html
6016 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6017 </p>
6018 !! end
6019
6020 !! article
6021 00
6022 !! text
6023 This is 00.
6024 !! endarticle
6025
6026 !!test
6027 Self-link to numeric title
6028 !!options
6029 title=[[0]]
6030 !! wikitext
6031 [[0]]
6032 !! html
6033 <p><strong class="selflink">0</strong>
6034 </p>
6035 !!end
6036
6037 !!test
6038 Link to numeric-equivalent title
6039 !!options
6040 title=[[0]]
6041 !! wikitext
6042 [[00]]
6043 !! html
6044 <p><a href="/wiki/00" title="00">00</a>
6045 </p>
6046 !!end
6047
6048 !! test
6049 <nowiki> inside a link
6050 !! wikitext
6051 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6052 !! html
6053 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6054 </p>
6055 !! end
6056
6057 !! test
6058 Non-breaking spaces in title
6059 !! wikitext
6060 [[&nbsp; Main &nbsp; Page &nbsp;]]
6061 !! html
6062 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6063 </p>
6064 !!end
6065
6066 !! test
6067 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6068 !! options
6069 language=ca
6070 !! wikitext
6071 '''[[Main Page]]'''
6072 !! html
6073 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6074 </p>
6075 !! end
6076
6077 !! test
6078 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6079 !! options
6080 language=ca
6081 !! wikitext
6082 ''[[Main Page]]''
6083 !! html
6084 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6085 </p>
6086 !! end
6087
6088 !! test
6089 Internal link with en linktrail: no apostrophes (bug 27473)
6090 !! options
6091 language=en
6092 !! wikitext
6093 [[Something]]'nice
6094 !! html
6095 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6096 </p>
6097 !! end
6098
6099 !! test
6100 Internal link with ca linktrail with apostrophes (bug 27473)
6101 !! options
6102 language=ca
6103 !! wikitext
6104 [[Something]]'nice
6105 !! html
6106 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6107 </p>
6108 !! end
6109
6110 !! test
6111 Internal link with kaa linktrail with apostrophes (bug 27473)
6112 !! options
6113 language=kaa
6114 !! wikitext
6115 [[Something]]'nice
6116 !! html
6117 <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>
6118 </p>
6119 !! end
6120
6121 !! test
6122 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6123 !! wikitext
6124 [[User:Foo/Test/63636:Bar|Test]]
6125 !! html/php
6126 <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>
6127 </p>
6128 !! html/parsoid
6129 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar">Test</a></p>
6130 !! end
6131
6132 !! test
6133 1. Interaction of linktrail and template encapsulation
6134 !! options
6135 parsoid
6136 !! wikitext
6137 {{echo|[[Foo]]}}l
6138 !! html
6139 <p><a rel="mw:WikiLink" href="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
6140 !! end
6141
6142 !! test
6143 2. Interaction of linktrail and template encapsulation
6144 !! options
6145 parsoid
6146 !! wikitext
6147 {{echo|Some [[Fool]]}}s
6148 !! html
6149 <p data-parsoid='{}'><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" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
6150 !! end
6151
6152 !! test
6153 3. Interaction of linktrail and template encapsulation
6154 !! options
6155 parsoid
6156 !! wikitext
6157 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6158 !! html
6159 <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" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b data-parsoid="{}">bold and foolish</b></p>
6160 !! end
6161
6162 !! article
6163 Söfnuður
6164 !! text
6165 Test.
6166 !! endarticle
6167
6168 !! test
6169 Internal link with is link prefix
6170 !! options
6171 language=is
6172 !! wikitext
6173 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6174 !! html
6175 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6176 </p>
6177 !! end
6178
6179 !! article
6180 Mótmælendatrú
6181 !! text
6182 Test.
6183 !! endarticle
6184
6185 !! test
6186 Internal link with is link trail and link prefix
6187 !! options
6188 language=is
6189 !! wikitext
6190 [[mótmælendatrú|xxx]]ar
6191 [[mótmælendatrú]]ar
6192 mótmælenda[[söfnuður]]
6193 mótmælenda[[söfnuður|söfnuðir]]
6194 mótmælenda[[söfnuður|söfnuðir]]xxx
6195 !! html
6196 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6197 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6198 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6199 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6200 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6201 </p>
6202 !! end
6203
6204 !! test
6205 Parsoid link trail escaping
6206 !! options
6207 parsoid=html2wt,html2html
6208 !! wikitext
6209 [[apple]]<nowiki/>s
6210 !! html
6211 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
6212 !! end
6213
6214 !! test
6215 Parsoid link prefix escaping
6216 !! options
6217 language=is
6218 parsoid=html2wt,html2html
6219 !! wikitext
6220 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6221 !! html
6222 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
6223 !! end
6224
6225 !! test
6226 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6227 !! wikitext
6228 [[Foo| bar]]
6229
6230 [[Foo| ''bar'']]
6231
6232 [http://wp.org foo]
6233
6234 [http://wp.org ''foo'']
6235 !! html
6236 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
6237 </p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> <i>bar</i></a>
6238 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6239 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6240 </p>
6241 !! end
6242
6243 !! test
6244 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6245 !! options
6246 parsoid
6247 !! wikitext
6248 [[Foo|{{echo|a}} b {{echo|c}}]]
6249 !! html
6250 <p><a rel="mw:WikiLink" href="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>
6251 !! end
6252
6253 !! test
6254 Link with angle bracket after anchor
6255 !! wikitext
6256 [[Foo#<bar>]]
6257 !! html/parsoid
6258 <p><a rel="mw:WikiLink" href="./Foo#%3Cbar%3E" data-parsoid='{"stx":"simple","a":{"href":"./Foo#%3Cbar%3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
6259 !! end
6260
6261 ###
6262 ### Interwiki links (see maintenance/interwiki.sql)
6263 ###
6264
6265 !! test
6266 Inline interwiki link
6267 !! wikitext
6268 [[MeatBall:SoftSecurity]]
6269 !! html
6270 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6271 </p>
6272 !! end
6273
6274 !! test
6275 Inline interwiki link with empty title (bug 2372)
6276 !! wikitext
6277 [[MeatBall:]]
6278 !! html
6279 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6280 </p>
6281 !! end
6282
6283 !! test
6284 Interwiki link encoding conversion (bug 1636)
6285 !! wikitext
6286 *[[Wikipedia:ro:Olteni&#0355;a]]
6287 *[[Wikipedia:ro:Olteni&#355;a]]
6288 !! html
6289 <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>
6290 <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>
6291
6292 !! end
6293
6294 !! test
6295 Interwiki link with fragment (bug 2130)
6296 !! wikitext
6297 [[MeatBall:SoftSecurity#foo]]
6298 !! html
6299 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6300 </p>
6301 !! end
6302
6303 # Ideally the wikipedia: prefix here should be proto-relative too
6304 !! test
6305 Different interwiki prefixes mapping to the same URL
6306 !! wikitext
6307 [[:en:Foo]]
6308
6309 [[:en:Foo|Foo]]
6310
6311 [[wikipedia:Foo]]
6312
6313 [[:wikipedia:Foo|Foo]]
6314
6315 [[wikipedia:en:Foo]]
6316
6317 [[:wikipedia:en:Foo]]
6318 !! html/parsoid
6319 <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}'>en:Foo</a></p>
6320
6321 <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}'>Foo</a></p>
6322
6323 <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}'>wikipedia:Foo</a></p>
6324
6325 <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}'>Foo</a></p>
6326
6327 <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}'>wikipedia:en:Foo</a></p>
6328
6329 <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}'>wikipedia:en:Foo</a></p>
6330 !! end
6331
6332 !! test
6333 Interwiki links that cannot be represented in wiki syntax
6334 !! wikitext
6335 [[meatball:ok]]
6336 [[meatball:ok#foo|ok with fragment]]
6337 [[meatball:ok_as_well?|ok ending with ? mark]]
6338 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6339 [http://de.wikipedia.org/wiki/#foo is just fragment]
6340
6341 !! html/parsoid
6342 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
6343 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
6344 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?">ok ending with ? mark</a>
6345 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6346 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6347 !! end
6348
6349 !! test
6350 Interwiki links: trail
6351 !! options
6352 parsoid
6353 !! wikitext
6354 [[wikipedia:Foo|Ba]]r
6355 !! html
6356 <p data-parsoid='{}'><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"}'>Bar</a></p>
6357 !! end
6358
6359 ###
6360 ### Interlanguage links
6361 ### Language links (so that searching for '### language' matches..)
6362 ###
6363
6364 !! test
6365 Interlanguage link
6366 !! wikitext
6367 Blah blah blah
6368 [[zh:Chinese]]
6369 !! html
6370 <p>Blah blah blah
6371 </p>
6372 !! end
6373
6374 !! test
6375 Double interlanguage link
6376 !! wikitext
6377 Blah blah blah
6378 [[es:Spanish]]
6379 [[zh:Chinese]]
6380 !! html
6381 <p>Blah blah blah
6382 </p>
6383 !! end
6384
6385 !! test
6386 Interlanguage link, with prefix links
6387 !! options
6388 language=ln
6389 !! wikitext
6390 Blah blah blah
6391 [[zh:Chinese]]
6392 !! html
6393 <p>Blah blah blah
6394 </p>
6395 !! end
6396
6397 !! test
6398 Double interlanguage link, with prefix links (bug 8897)
6399 !! options
6400 language=ln
6401 !! wikitext
6402 Blah blah blah
6403 [[es:Spanish]]
6404 [[zh:Chinese]]
6405 !! html
6406 <p>Blah blah blah
6407 </p>
6408 !! end
6409
6410 !! test
6411 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
6412 !! options
6413 language=ln
6414 !! wikitext
6415 [[WW&nbsp;II]]
6416 !! html
6417 <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>
6418 </p>
6419 !! end
6420
6421 !! test
6422 Parsoid bug 53221: Wikilinks should be properly entity-escaped
6423 !! options
6424 parsoid=html2wt
6425 !! wikitext
6426 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
6427
6428 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
6429 !! html
6430 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6431 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6432 !! end
6433
6434 !! test
6435 Parsoid: handle constructor well
6436 !! options
6437 parsoid
6438 !! wikitext
6439 [[constructor]]
6440
6441 [[constructor:foo]]
6442 !! html
6443 <p><a rel="mw:WikiLink" href="./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>
6444
6445 <p><a rel="mw:WikiLink" href="./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>
6446 !! end
6447
6448 !! test
6449 Parsoid: recognize interlanguage links without a target page
6450 !! options
6451 parsoid
6452 !! wikitext
6453 [[ko:]]
6454 !! html
6455 <p><link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
6456 !! end
6457
6458 !! test
6459 Parsoid: recognize interwiki links without a target page
6460 !! options
6461 parsoid
6462 !! wikitext
6463 [[:ko:]]
6464 !! html
6465 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
6466 !! end
6467
6468 !! test
6469 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
6470 !! options
6471 parsoid
6472 !! wikitext
6473 [[en:Foo]]
6474 !! html
6475 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
6476 !! end
6477
6478 ###
6479 ### Redirects, Parsoid-only
6480 ###
6481 !! test
6482 1. Simple redirect to page
6483 !! options
6484 parsoid
6485 !! wikitext
6486 #REDIRECT [[Main Page]]
6487 !! html
6488 <link rel="mw:PageProp/redirect" href="./Main_Page">
6489 !! end
6490
6491 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
6492 !! test
6493 2. Other redirect variants
6494 !! options
6495 parsoid=wt2html,wt2wt
6496 !! wikitext
6497 #REDIRECT [[Main_Page]]
6498 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
6499 !! html
6500 <link rel="mw:PageProp/redirect" href="./Main_Page">
6501 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
6502 !! end
6503
6504 !! test
6505 Empty redirect
6506 !! options
6507 parsoid=wt2html,wt2wt
6508 !! wikitext
6509 #REDIRECT [[]]
6510 !! html
6511 <ol>
6512 <li>REDIRECT [[]]</li></ol>
6513 !! end
6514
6515 !! test
6516 Optional colon in #REDIRECT
6517 !! options
6518 # the colon is archaic syntax. we support it for wt2html, but we
6519 # don't care that it roundtrips back to the modern syntax.
6520 parsoid=wt2html,html2html
6521 !! wikitext
6522 #REDIRECT:[[Main Page]]
6523 !! html
6524 <link rel="mw:PageProp/redirect" href="./Main_Page">
6525 !! end
6526
6527 !! test
6528 Whitespace in #REDIRECT with optional colon
6529 !! options
6530 # the colon and gratuitous whitespace is archaic syntax. we support
6531 # it for wt2html, but we don't care that it roundtrips back to the
6532 # modern syntax (without extra whitespace)
6533 parsoid=wt2html,html2html
6534 !! wikitext
6535
6536 #REDIRECT
6537 :
6538 [[Main Page]]
6539 !! html
6540 <link rel="mw:PageProp/redirect" href="./Main_Page">
6541 !! end
6542
6543 !! test
6544 Piped link in #REDIRECT
6545 !! options
6546 # content after piped link is ignored. we support this syntax,
6547 # but don't care that the piped link is lost when we roundtrip this.
6548 parsoid=wt2html
6549 !! wikitext
6550 #REDIRECT [[Main Page|bar]]
6551 !! html
6552 <link rel="mw:PageProp/redirect" href="./Main_Page">
6553 !! end
6554
6555 !! test
6556 Redirect to category
6557 !! options
6558 parsoid=wt2html
6559 !! wikitext
6560 #REDIRECT [[Category:Foo]]
6561 !! html
6562 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6563 !! end
6564
6565 !! test
6566 Redirect to category with URL encoding
6567 !! options
6568 parsoid=wt2html
6569 !! wikitext
6570 #REDIRECT [[Category%3AFoo]]
6571 !! html
6572 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6573 !! end
6574
6575 !! test
6576 Redirect to category page
6577 !! options
6578 parsoid=wt2html,html2html
6579 !! wikitext
6580 #REDIRECT [[:Category:Foo]]
6581 !! html
6582 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
6583 !! end
6584
6585 !! test
6586 Redirect to image page (1)
6587 !! options
6588 parsoid
6589 !! wikitext
6590 #REDIRECT [[File:Wiki.png]]
6591 !! html
6592 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6593 !! end
6594
6595 !! test
6596 Redirect to image page (2)
6597 !! options
6598 parsoid
6599 !! wikitext
6600 #REDIRECT [[Image:Wiki.png]]
6601 !! html
6602 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6603 !! end
6604
6605 !! test
6606 Redirect to language
6607 !! options
6608 parsoid
6609 !! wikitext
6610 #REDIRECT [[en:File:Wiki.png]]
6611 !! html
6612 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6613 !! end
6614
6615 !! test
6616 Redirect to interwiki
6617 !! options
6618 parsoid
6619 !! wikitext
6620 #REDIRECT [[meatball:File:Wiki.png]]
6621 !! html
6622 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6623 !! end
6624
6625 !! test
6626 Non-English #REDIRECT
6627 !! options
6628 parsoid
6629 language=is
6630 !! wikitext
6631 #TILVÍSUN [[Main Page]]
6632 !! html
6633 <link rel="mw:PageProp/redirect" href="./Main_Page">
6634 !! end
6635
6636 !! test
6637 New redirect
6638 !! options
6639 parsoid=html2wt
6640 !! wikitext
6641 Foo
6642 #REDIRECT [[Foo]]
6643 !! html
6644 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
6645 !! end
6646
6647 ##
6648 ## XHTML tidiness
6649 ###
6650
6651 !! test
6652 <br> to <br />
6653 !! wikitext
6654 1<br>2<br />3
6655 !! html
6656 <p>1<br />2<br />3
6657 </p>
6658 !! end
6659
6660 !! test
6661 Broken br tag sanitization
6662 !! wikitext
6663 </br>
6664 !! html/php
6665 <p>&lt;/br&gt;
6666 </p>
6667 !! end
6668
6669 # TODO: Fix html2html mode (bug 51055)!
6670 !! test
6671 Parsoid: Broken br tag recognition
6672 !! options
6673 parsoid=wt2html
6674 !! wikitext
6675 </br>
6676
6677 <br/ >
6678 !! html/parsoid
6679 <p><br></p>
6680 <p><br/></p>
6681 !! end
6682
6683 !! test
6684 Incorrecly removing closing slashes from correctly formed XHTML
6685 !! wikitext
6686 <br style="clear:both;" />
6687 !! html
6688 <p><br style="clear:both;" />
6689 </p>
6690 !! end
6691
6692 !! test
6693 Failing to transform badly formed HTML into correct XHTML
6694 !! wikitext
6695 <br style="clear: left;">
6696 <br style="clear: right;">
6697 <br style="clear: both;">
6698 !! html
6699 <p><br style="clear: left;" />
6700 <br style="clear: right;" />
6701 <br style="clear: both;" />
6702 </p>
6703 !!end
6704
6705 !! test
6706 Handling html with a div self-closing tag
6707 !! wikitext
6708 <div title />
6709 <div title/>
6710 <div title/ >
6711 <div title=bar />
6712 <div title=bar/>
6713 <div title=bar/ >
6714 !! html
6715 <p>&lt;div title /&gt;
6716 &lt;div title/&gt;
6717 </p>
6718 <div>
6719 <p>&lt;div title=bar /&gt;
6720 &lt;div title=bar/&gt;
6721 </p>
6722 <div title="bar/"></div>
6723 </div>
6724
6725 !! end
6726
6727 !! test
6728 Handling html with a br self-closing tag
6729 !! wikitext
6730 <br title />
6731 <br title/>
6732 <br title/ >
6733 <br title=bar />
6734 <br title=bar/>
6735 <br title=bar/ >
6736 !! html
6737 <p><br title="title" />
6738 <br title="title" />
6739 <br />
6740 <br title="bar" />
6741 <br title="bar" />
6742 <br title="bar/" />
6743 </p>
6744 !! end
6745
6746 !! test
6747 Horizontal ruler (should it add that extra space?)
6748 !! wikitext
6749 <hr>
6750 <hr >
6751 foo <hr
6752 > bar
6753 !! html
6754 <hr />
6755 <hr />
6756 foo <hr /> bar
6757
6758 !! end
6759
6760 !! test
6761 Horizontal ruler -- 4+ dashes render hr
6762 !! wikitext
6763 ----
6764 !! html
6765 <hr />
6766
6767 !! end
6768
6769 !! test
6770 Horizontal ruler -- eats additional dashes on the same line
6771 !! wikitext
6772 ---------
6773 !! html
6774 <hr />
6775
6776 !! end
6777
6778 !! test
6779 Horizontal ruler -- does not collapse dashes on consecutive lines
6780 !! wikitext
6781 ----
6782 ----
6783 !! html
6784 <hr />
6785 <hr />
6786
6787 !! end
6788
6789 !! test
6790 Horizontal ruler -- <4 dashes render as plain text
6791 !! wikitext
6792 ---
6793 !! html
6794 <p>---
6795 </p>
6796 !! end
6797
6798 !! test
6799 Horizontal ruler -- Supports content following dashes on same line
6800 !! wikitext
6801 ---- Foo
6802 !! html
6803 <hr /> Foo
6804
6805 !! end
6806
6807 ###
6808 ### Block-level elements
6809 ###
6810 !! test
6811 Common list
6812 !! wikitext
6813 *Common list
6814 * item 2
6815 *item 3
6816 !! html
6817 <ul><li>Common list</li>
6818 <li> item 2</li>
6819 <li>item 3</li></ul>
6820
6821 !! end
6822
6823 !! test
6824 Numbered list
6825 !! wikitext
6826 #Numbered list
6827 #item 2
6828 # item 3
6829 !! html
6830 <ol><li>Numbered list</li>
6831 <li>item 2</li>
6832 <li> item 3</li></ol>
6833
6834 !! end
6835
6836 !! test
6837 Mixed list
6838 !! wikitext
6839 *Mixed list
6840 *# with numbers
6841 ** and bullets
6842 *# and numbers
6843 *bullets again
6844 **bullet level 2
6845 ***bullet level 3
6846 ***#Number on level 4
6847 **bullet level 2
6848 **#Number on level 3
6849 **#Number on level 3
6850 *#number level 2
6851 *Level 1
6852 *** Level 3
6853 #** Level 3, but ordered
6854 !! html
6855 <ul><li>Mixed list
6856 <ol><li> with numbers</li></ol>
6857 <ul><li> and bullets</li></ul>
6858 <ol><li> and numbers</li></ol></li>
6859 <li>bullets again
6860 <ul><li>bullet level 2
6861 <ul><li>bullet level 3
6862 <ol><li>Number on level 4</li></ol></li></ul></li>
6863 <li>bullet level 2
6864 <ol><li>Number on level 3</li>
6865 <li>Number on level 3</li></ol></li></ul>
6866 <ol><li>number level 2</li></ol></li>
6867 <li>Level 1
6868 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
6869 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
6870
6871 !! end
6872
6873 !! test
6874 Nested lists 1
6875 !! wikitext
6876 *foo
6877 **bar
6878 !! html
6879 <ul><li>foo
6880 <ul><li>bar</li></ul></li></ul>
6881
6882 !! end
6883
6884 !! test
6885 Nested lists 2
6886 !! wikitext
6887 **foo
6888 *bar
6889 !! html
6890 <ul><li><ul><li>foo</li></ul></li>
6891 <li>bar</li></ul>
6892
6893 !! end
6894
6895 !! test
6896 Nested lists 3 (first element empty)
6897 !! wikitext
6898 *
6899 **bar
6900 !! html
6901 <ul><li>
6902 <ul><li>bar</li></ul></li></ul>
6903
6904 !! end
6905
6906 !! test
6907 Nested lists 4 (first element empty)
6908 !! wikitext
6909 **
6910 *bar
6911 !! html
6912 <ul><li><ul><li></li></ul></li>
6913 <li>bar</li></ul>
6914
6915 !! end
6916
6917 !! test
6918 Nested lists 5 (both elements empty)
6919 !! wikitext
6920 **
6921 *
6922 !! html
6923 <ul><li><ul><li></li></ul></li>
6924 <li></li></ul>
6925
6926 !! end
6927
6928 !! test
6929 Nested lists 6 (both elements empty)
6930 !! wikitext
6931 *
6932 **
6933 !! html
6934 <ul><li>
6935 <ul><li></li></ul></li></ul>
6936
6937 !! end
6938
6939 !! test
6940 Nested lists 7 (skip initial nesting levels)
6941 !! wikitext
6942 *** foo
6943 !! html
6944 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
6945
6946 !! end
6947
6948 !! test
6949 Nested lists 8 (multiple nesting transitions)
6950 !! wikitext
6951 * foo
6952 *** bar
6953 ** baz
6954 * boo
6955 !! html
6956 <ul><li> foo
6957 <ul><li><ul><li> bar</li></ul></li>
6958 <li> baz</li></ul></li>
6959 <li> boo</li></ul>
6960
6961 !! end
6962
6963 !! test
6964 1. Lists with start-of-line-transparent tokens before bullets: Comments
6965 !! wikitext
6966 *foo
6967 *<!--cmt-->bar
6968 <!--cmt-->*baz
6969 !! html
6970 <ul><li>foo</li>
6971 <li>bar</li>
6972 <li>baz</li></ul>
6973
6974 !! end
6975
6976 !! test
6977 2. Lists with start-of-line-transparent tokens before bullets: Template close
6978 !! wikitext
6979 *foo {{echo|bar
6980 }}*baz
6981 !! html
6982 <ul><li>foo bar</li>
6983 <li>baz</li></ul>
6984
6985 !! end
6986
6987 !! test
6988 List items are not parsed correctly following a <pre> block (bug 785)
6989 !! wikitext
6990 * <pre>foo</pre>
6991 * <pre>bar</pre>
6992 * zar
6993 !! html
6994 <ul><li> <pre>foo</pre></li>
6995 <li> <pre>bar</pre></li>
6996 <li> zar</li></ul>
6997
6998 !! end
6999
7000 !! test
7001 List items from template
7002 !! wikitext
7003
7004 {{inner list}}
7005 * item 2
7006
7007 * item 0
7008 {{inner list}}
7009 * item 2
7010
7011 * item 0
7012 * notSOL{{inner list}}
7013 * item 2
7014 !! html
7015 <ul><li> item 1</li>
7016 <li> item 2</li></ul>
7017 <ul><li> item 0</li>
7018 <li> item 1</li>
7019 <li> item 2</li></ul>
7020 <ul><li> item 0</li>
7021 <li> notSOL</li>
7022 <li> item 1</li>
7023 <li> item 2</li></ul>
7024
7025 !! end
7026
7027 !! test
7028 List interrupted by empty line or heading
7029 !! wikitext
7030 * foo
7031
7032 ** bar
7033 == A heading ==
7034 * Another list item
7035 !! html
7036 <ul><li> foo</li></ul>
7037 <ul><li><ul><li> bar</li></ul></li></ul>
7038 <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>
7039 <ul><li> Another list item</li></ul>
7040
7041 !!end
7042
7043 !!test
7044 Multiple list tags generated by templates
7045 !! wikitext
7046 {{echo|<li>}}a
7047 {{echo|<li>}}b
7048 {{echo|<li>}}c
7049 !! html
7050 <li>a
7051 <li>b
7052 <li>c</li>
7053 </li>
7054 </li>
7055
7056 !!end
7057
7058 !!test
7059 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7060 !! wikitext
7061 *a
7062 <!--This line will NOT split the list-->
7063 *b
7064 <!--This line will NOT split the list either-->
7065 *c
7066 <!--foo--> <!----> <!--This line NOT split the list either-->
7067 *d
7068 !! html
7069 <ul><li>a</li>
7070 <li>b</li>
7071 <li>c</li>
7072 <li>d</li></ul>
7073
7074 !!end
7075
7076 !!test
7077 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7078 !! wikitext
7079 *a
7080 <!--This line will NOT split the list-->
7081 *b
7082 <!--This line will NOT split the list either-->
7083 *c
7084 <!--foo--> <!----> <!--This line NOT split the list
7085 either-->
7086 *d
7087 !! html
7088 <ul><li>a</li>
7089 <li>b</li>
7090 <li>c</li>
7091 <li>d</li></ul>
7092
7093 !!end
7094
7095 !!test
7096 Test the li-hack
7097 (Cannot test this with PHP parser since it relies on Tidy for the hack)
7098 !!options
7099 parsoid=wt2html,wt2wt
7100 !! wikitext
7101 * foo
7102 * <li>li-hack
7103 * {{echo|<li>templated li-hack}}
7104 * <!--foo--> <li> unsupported li-hack with preceding comments
7105
7106 <ul>
7107 <li><li>not a li-hack
7108 </li>
7109 </ul>
7110 !! html
7111 <ul>
7112 <li> foo</li>
7113 <li>li-hack</li>
7114 <li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>templated li-hack"}}}}]}'>templated li-hack</li>
7115 <li> <!--foo--> </li>
7116 <li> li-hack with preceding comments</li>
7117 </ul>
7118
7119 <ul>
7120 <li></li>
7121 <li>not a li-hack
7122 </li>
7123 </ul>
7124 !!end
7125
7126 !! test
7127 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
7128 !! options
7129 parsoid
7130 !! wikitext
7131 # foo
7132 ## bar
7133 * foo
7134 ** bar
7135 : foo
7136 :: bar
7137 !! html
7138 <ol>
7139 <li> foo<ol>
7140 <li> bar</li>
7141 </ol></li>
7142 </ol><ul>
7143 <li> foo<ul>
7144 <li> bar</li>
7145 </ul></li>
7146 </ul><dl>
7147 <dd> foo<dl>
7148 <dd> bar</dd>
7149 </dl></dd>
7150 </dl>
7151 !! end
7152
7153 !! test
7154 Parsoid: Test of whitespace serialization with Templated bullets
7155 !! options
7156 parsoid
7157 !! wikitext
7158 * {{bullet}}
7159 !! html
7160 <ul>
7161 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
7162 </ul>
7163 !! end
7164
7165 # ------------------------------------------------------------------------
7166 # The next set of tests are about Parsoid's ability to handle badly nested
7167 # tags (parse, minimize scope of fixup, and roundtrip back)
7168 # ------------------------------------------------------------------------
7169
7170 !! test
7171 Unbalanced closing block tags break a list
7172 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7173 !! wikitext
7174 <div>
7175 *a</div><div>
7176 *b</div>
7177 !! html/parsoid
7178 <div>
7179 <ul>
7180 <li>a
7181 </li>
7182 </ul></div><div>
7183 <ul>
7184 <li>b
7185 </li>
7186 </ul></div>
7187 !! end
7188
7189 !! test
7190 Unbalanced closing non-block tags don't break a list
7191 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7192 !! wikitext
7193 <span>
7194 *a</span><span>
7195 *b</span>
7196 !! html/parsoid
7197 <p><span></span>
7198 </p>
7199 <ul>
7200 <li>a<span></span>
7201 </li>
7202 <li>b
7203 </li>
7204 </ul>
7205 !! end
7206
7207 !! test
7208 Unclosed formatting tags that straddle lists are closed and reopened
7209 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7210 !! wikitext
7211 # <s> a
7212 # b </s>
7213 !! html/parsoid
7214 <ol>
7215 <li> <s> a </s>
7216 </li>
7217 <li> <s> b </s>
7218 </li>
7219 </ol>
7220 !! end
7221
7222 !!test
7223 List embedded in a non-block tag
7224 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
7225 !! wikitext
7226 <small>
7227 * foo
7228 </small>
7229 !! html/parsoid
7230 <p><small></small></p>
7231 <small>
7232 <ul>
7233 <li> foo</li>
7234 </ul>
7235 </small>
7236 <p><small></small></p>
7237 !!end
7238
7239 !! test
7240 Table with missing opening <tr> tag
7241 !! options
7242 parsoid=wt2html,wt2wt
7243 !! wikitext
7244 <table>
7245 <td>foo</td>
7246 </tr>
7247 </table>
7248 !! html/parsoid
7249 <table>
7250 <tr>
7251 <td>foo</td>
7252 </tr>
7253 </table>
7254 !! end
7255
7256 ###
7257 ### Magic Words
7258 ###
7259
7260 # Note that the current date is hard-coded as
7261 # 1970-01-01T00:02:03Z (a Thursday)
7262 # when running parser tests. The timezone is also fixed to GMT, so
7263 # local date will be identical to current date.
7264
7265 !! test
7266 Magic Word: {{CURRENTDAY}}
7267 !! wikitext
7268 {{CURRENTDAY}}
7269 !! html
7270 <p>1
7271 </p>
7272 !! end
7273
7274 !! test
7275 Magic Word: {{CURRENTDAY2}}
7276 !! wikitext
7277 {{CURRENTDAY2}}
7278 !! html
7279 <p>01
7280 </p>
7281 !! end
7282
7283 !! test
7284 Magic Word: {{CURRENTDAYNAME}}
7285 !! wikitext
7286 {{CURRENTDAYNAME}}
7287 !! html
7288 <p>Thursday
7289 </p>
7290 !! end
7291
7292 !! test
7293 Magic Word: {{CURRENTDOW}}
7294 !! wikitext
7295 {{CURRENTDOW}}
7296 !! html
7297 <p>4
7298 </p>
7299 !! end
7300
7301 !! test
7302 Magic Word: {{CURRENTMONTH}}
7303 !! wikitext
7304 {{CURRENTMONTH}}
7305 !! html
7306 <p>01
7307 </p>
7308 !! end
7309
7310 !! test
7311 Magic Word: {{CURRENTMONTH1}}
7312 !! wikitext
7313 {{CURRENTMONTH1}}
7314 !! html
7315 <p>1
7316 </p>
7317 !! end
7318
7319 !! test
7320 Magic Word: {{CURRENTMONTHABBREV}}
7321 !! wikitext
7322 {{CURRENTMONTHABBREV}}
7323 !! html
7324 <p>Jan
7325 </p>
7326 !! end
7327
7328 !! test
7329 Magic Word: {{CURRENTMONTHNAME}}
7330 !! wikitext
7331 {{CURRENTMONTHNAME}}
7332 !! html
7333 <p>January
7334 </p>
7335 !! end
7336
7337 !! test
7338 Magic Word: {{CURRENTMONTHNAMEGEN}}
7339 !! wikitext
7340 {{CURRENTMONTHNAMEGEN}}
7341 !! html
7342 <p>January
7343 </p>
7344 !! end
7345
7346 !! test
7347 Magic Word: {{CURRENTTIME}}
7348 !! wikitext
7349 {{CURRENTTIME}}
7350 !! html
7351 <p>00:02
7352 </p>
7353 !! end
7354
7355 !! test
7356 Magic Word: {{CURRENTHOUR}}
7357 !! wikitext
7358 {{CURRENTHOUR}}
7359 !! html
7360 <p>00
7361 </p>
7362 !! end
7363
7364 !! test
7365 Magic Word: {{CURRENTWEEK}} (@bug 4594)
7366 !! wikitext
7367 {{CURRENTWEEK}}
7368 !! html
7369 <p>1
7370 </p>
7371 !! end
7372
7373 !! test
7374 Magic Word: {{CURRENTYEAR}}
7375 !! wikitext
7376 {{CURRENTYEAR}}
7377 !! html
7378 <p>1970
7379 </p>
7380 !! end
7381
7382 !! test
7383 Magic Word: {{CURRENTTIMESTAMP}}
7384 !! wikitext
7385 {{CURRENTTIMESTAMP}}
7386 !! html
7387 <p>19700101000203
7388 </p>
7389 !! end
7390
7391 !! test
7392 Magic Words LOCAL (UTC)
7393 !! wikitext
7394 * {{LOCALMONTH}}
7395 * {{LOCALMONTH1}}
7396 * {{LOCALMONTHNAME}}
7397 * {{LOCALMONTHNAMEGEN}}
7398 * {{LOCALMONTHABBREV}}
7399 * {{LOCALDAY}}
7400 * {{LOCALDAY2}}
7401 * {{LOCALDAYNAME}}
7402 * {{LOCALYEAR}}
7403 * {{LOCALTIME}}
7404 * {{LOCALHOUR}}
7405 * {{LOCALWEEK}}
7406 * {{LOCALDOW}}
7407 * {{LOCALTIMESTAMP}}
7408 !! html
7409 <ul><li> 01</li>
7410 <li> 1</li>
7411 <li> January</li>
7412 <li> January</li>
7413 <li> Jan</li>
7414 <li> 1</li>
7415 <li> 01</li>
7416 <li> Thursday</li>
7417 <li> 1970</li>
7418 <li> 00:02</li>
7419 <li> 00</li>
7420 <li> 1</li>
7421 <li> 4</li>
7422 <li> 19700101000203</li></ul>
7423
7424 !! end
7425
7426 !! test
7427 Magic Word: {{FULLPAGENAME}}
7428 !! options
7429 title=[[User:Ævar Arnfjörð Bjarmason]]
7430 !! wikitext
7431 {{FULLPAGENAME}}
7432 !! html
7433 <p>User:Ævar Arnfjörð Bjarmason
7434 </p>
7435 !! end
7436
7437 !! test
7438 Magic Word: {{FULLPAGENAMEE}}
7439 !! options
7440 title=[[User:Ævar Arnfjörð Bjarmason]]
7441 !! wikitext
7442 {{FULLPAGENAMEE}}
7443 !! html
7444 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7445 </p>
7446 !! end
7447
7448 !! test
7449 Magic Word: {{TALKSPACE}}
7450 !! options
7451 title=[[User:Ævar Arnfjörð Bjarmason]]
7452 !! wikitext
7453 {{TALKSPACE}}
7454 !! html
7455 <p>User talk
7456 </p>
7457 !! end
7458
7459 !! test
7460 Magic Word: {{TALKSPACE}}, same namespace
7461 !! options
7462 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7463 !! wikitext
7464 {{TALKSPACE}}
7465 !! html
7466 <p>User talk
7467 </p>
7468 !! end
7469
7470 !! test
7471 Magic Word: {{TALKSPACE}}, main namespace
7472 !! options
7473 title=[[Parser Test]]
7474 !! wikitext
7475 {{TALKSPACE}}
7476 !! html
7477 <p>Talk
7478 </p>
7479 !! end
7480
7481 !! test
7482 Magic Word: {{TALKSPACEE}}
7483 !! options
7484 title=[[User:Ævar Arnfjörð Bjarmason]]
7485 !! wikitext
7486 {{TALKSPACEE}}
7487 !! html
7488 <p>User_talk
7489 </p>
7490 !! end
7491
7492 !! test
7493 Magic Word: {{SUBJECTSPACE}}
7494 !! options
7495 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7496 !! wikitext
7497 {{SUBJECTSPACE}}
7498 !! html
7499 <p>User
7500 </p>
7501 !! end
7502
7503 !! test
7504 Magic Word: {{SUBJECTSPACE}}, same namespace
7505 !! options
7506 title=[[User:Ævar Arnfjörð Bjarmason]]
7507 !! wikitext
7508 {{SUBJECTSPACE}}
7509 !! html
7510 <p>User
7511 </p>
7512 !! end
7513
7514 !! test
7515 Magic Word: {{SUBJECTSPACE}}, main namespace
7516 !! options
7517 title=[[Parser Test]]
7518 !! wikitext
7519 {{SUBJECTSPACE}}
7520 !! html
7521
7522 !! end
7523
7524 !! test
7525 Magic Word: {{SUBJECTSPACEE}}
7526 !! options
7527 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7528 !! wikitext
7529 {{SUBJECTSPACEE}}
7530 !! html
7531 <p>User
7532 </p>
7533 !! end
7534
7535 !! test
7536 Magic Word: {{NAMESPACE}}
7537 !! options
7538 title=[[User:Ævar Arnfjörð Bjarmason]]
7539 !! wikitext
7540 {{NAMESPACE}}
7541 !! html
7542 <p>User
7543 </p>
7544 !! end
7545
7546 !! test
7547 Magic Word: {{NAMESPACEE}}
7548 !! options
7549 title=[[User:Ævar Arnfjörð Bjarmason]]
7550 !! wikitext
7551 {{NAMESPACEE}}
7552 !! html
7553 <p>User
7554 </p>
7555 !! end
7556
7557 !! test
7558 Magic Word: {{NAMESPACENUMBER}}
7559 !! options
7560 title=[[User:Ævar Arnfjörð Bjarmason]]
7561 !! wikitext
7562 {{NAMESPACENUMBER}}
7563 !! html
7564 <p>2
7565 </p>
7566 !! end
7567
7568 !! test
7569 Magic Word: {{SUBPAGENAME}}
7570 !! options
7571 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7572 !! wikitext
7573 {{SUBPAGENAME}}
7574 !! html
7575 <p>sub ö
7576 </p>
7577 !! end
7578
7579 !! test
7580 Magic Word: {{SUBPAGENAMEE}}
7581 !! options
7582 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7583 !! wikitext
7584 {{SUBPAGENAMEE}}
7585 !! html
7586 <p>sub_%C3%B6
7587 </p>
7588 !! end
7589
7590 !! test
7591 Magic Word: {{ROOTPAGENAME}}
7592 !! options
7593 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7594 !! wikitext
7595 {{ROOTPAGENAME}}
7596 !! html
7597 <p>Ævar Arnfjörð Bjarmason
7598 </p>
7599 !! end
7600
7601 !! test
7602 Magic Word: {{ROOTPAGENAMEE}}
7603 !! options
7604 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7605 !! wikitext
7606 {{ROOTPAGENAMEE}}
7607 !! html
7608 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7609 </p>
7610 !! end
7611
7612 !! test
7613 Magic Word: {{BASEPAGENAME}}
7614 !! options
7615 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7616 !! wikitext
7617 {{BASEPAGENAME}}
7618 !! html
7619 <p>Ævar Arnfjörð Bjarmason
7620 </p>
7621 !! end
7622
7623 !! test
7624 Magic Word: {{BASEPAGENAMEE}}
7625 !! options
7626 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7627 !! wikitext
7628 {{BASEPAGENAMEE}}
7629 !! html
7630 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7631 </p>
7632 !! end
7633
7634 !! test
7635 Magic Word: {{TALKPAGENAME}}
7636 !! options
7637 title=[[User:Ævar Arnfjörð Bjarmason]]
7638 !! wikitext
7639 {{TALKPAGENAME}}
7640 !! html
7641 <p>User talk:Ævar Arnfjörð Bjarmason
7642 </p>
7643 !! end
7644
7645 !! test
7646 Magic Word: {{TALKPAGENAMEE}}
7647 !! options
7648 title=[[User:Ævar Arnfjörð Bjarmason]]
7649 !! wikitext
7650 {{TALKPAGENAMEE}}
7651 !! html
7652 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7653 </p>
7654 !! end
7655
7656 !! test
7657 Magic Word: {{SUBJECTPAGENAME}}
7658 !! options
7659 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7660 !! wikitext
7661 {{SUBJECTPAGENAME}}
7662 !! html
7663 <p>User:Ævar Arnfjörð Bjarmason
7664 </p>
7665 !! end
7666
7667 !! test
7668 Magic Word: {{SUBJECTPAGENAMEE}}
7669 !! options
7670 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7671 !! wikitext
7672 {{SUBJECTPAGENAMEE}}
7673 !! html
7674 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7675 </p>
7676 !! end
7677
7678 !! test
7679 Magic Word: {{NUMBEROFFILES}}
7680 !! wikitext
7681 {{NUMBEROFFILES}}
7682 !! html
7683 <p>5
7684 </p>
7685 !! end
7686
7687 !! test
7688 Magic Word: {{PAGENAME}}
7689 !! options
7690 title=[[User:Ævar Arnfjörð Bjarmason]]
7691 !! wikitext
7692 {{PAGENAME}}
7693 !! html
7694 <p>Ævar Arnfjörð Bjarmason
7695 </p>
7696 !! end
7697
7698 !! test
7699 Magic Word: {{PAGENAME}} with metacharacters
7700 !! options
7701 title=[['foo & bar = baz']]
7702 !! wikitext
7703 ''{{PAGENAME}}''
7704 !! html
7705 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7706 </p>
7707 !! end
7708
7709 !! test
7710 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7711 !! options
7712 title=[[*RFC 1234 http://example.com/]]
7713 !! wikitext
7714 {{PAGENAME}}
7715 !! html
7716 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7717 </p>
7718 !! end
7719
7720 !! test
7721 Magic Word: {{PAGENAMEE}}
7722 !! options
7723 title=[[User:Ævar Arnfjörð Bjarmason]]
7724 !! wikitext
7725 {{PAGENAMEE}}
7726 !! html
7727 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7728 </p>
7729 !! end
7730
7731 !! test
7732 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7733 !! options
7734 title=[[*RFC 1234 http://example.com/]]
7735 !! wikitext
7736 {{PAGENAMEE}}
7737 !! html
7738 <p>&#42;RFC_1234_http&#58;//example.com/
7739 </p>
7740 !! end
7741
7742 !! test
7743 Magic Word: {{REVISIONID}}
7744 !! wikitext
7745 {{REVISIONID}}
7746 !! html
7747 <p>1337
7748 </p>
7749 !! end
7750
7751 !! test
7752 Magic Word: {{SCRIPTPATH}}
7753 !! wikitext
7754 {{SCRIPTPATH}}
7755 !! html
7756 <p>/
7757 </p>
7758 !! end
7759
7760 !! test
7761 Magic Word: {{STYLEPATH}}
7762 !! wikitext
7763 {{STYLEPATH}}
7764 !! html
7765 <p>/skins
7766 </p>
7767 !! end
7768
7769 !! test
7770 Magic Word: {{SERVER}}
7771 !! wikitext
7772 {{SERVER}}
7773 !! html
7774 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7775 </p>
7776 !! end
7777
7778 !! test
7779 Magic Word: {{SERVERNAME}}
7780 !! wikitext
7781 {{SERVERNAME}}
7782 !! html
7783 <p>example.org
7784 </p>
7785 !! end
7786
7787 !! test
7788 Magic Word: {{SITENAME}}
7789 !! wikitext
7790 {{SITENAME}}
7791 !! html
7792 <p>MediaWiki
7793 </p>
7794 !! end
7795
7796 !! test
7797 Case-sensitive magic words, when cased differently, should just be template transclusions
7798 !! wikitext
7799 {{CurrentMonth}}
7800 {{currentday}}
7801 {{cURreNTweEK}}
7802 {{currentHour}}
7803 !! html
7804 <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>
7805 <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>
7806 <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>
7807 <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>
7808 </p>
7809 !! end
7810
7811 !! test
7812 Case-insensitive magic words should still work with weird casing.
7813 !! wikitext
7814 {{sErVeRNaMe}}
7815 {{LCFirst:AOEU}}
7816 {{ucFIRST:aoeu}}
7817 {{SERver}}
7818 !! html
7819 <p>example.org
7820 aOEU
7821 Aoeu
7822 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7823 </p>
7824 !! end
7825
7826 !! test
7827 Namespace 1 {{ns:1}}
7828 !! wikitext
7829 {{ns:1}}
7830 !! html
7831 <p>Talk
7832 </p>
7833 !! end
7834
7835 !! test
7836 Namespace 1 {{ns:01}}
7837 !! wikitext
7838 {{ns:01}}
7839 !! html
7840 <p>Talk
7841 </p>
7842 !! end
7843
7844 !! test
7845 Namespace 0 {{ns:0}} (bug 4783)
7846 !! wikitext
7847 {{ns:0}}
7848 !! html
7849
7850 !! end
7851
7852 !! test
7853 Namespace 0 {{ns:00}} (bug 4783)
7854 !! wikitext
7855 {{ns:00}}
7856 !! html
7857
7858 !! end
7859
7860 !! test
7861 Namespace -1 {{ns:-1}}
7862 !! wikitext
7863 {{ns:-1}}
7864 !! html
7865 <p>Special
7866 </p>
7867 !! end
7868
7869 !! test
7870 Namespace User {{ns:User}}
7871 !! wikitext
7872 {{ns:User}}
7873 !! html
7874 <p>User
7875 </p>
7876 !! end
7877
7878 !! test
7879 Namespace User talk {{ns:User_talk}}
7880 !! wikitext
7881 {{ns:User_talk}}
7882 !! html
7883 <p>User talk
7884 </p>
7885 !! end
7886
7887 !! test
7888 Namespace User talk {{ns:uSeR tAlK}}
7889 !! wikitext
7890 {{ns:uSeR tAlK}}
7891 !! html
7892 <p>User talk
7893 </p>
7894 !! end
7895
7896 !! test
7897 Namespace File {{ns:File}}
7898 !! wikitext
7899 {{ns:File}}
7900 !! html
7901 <p>File
7902 </p>
7903 !! end
7904
7905 !! test
7906 Namespace File {{ns:Image}}
7907 !! wikitext
7908 {{ns:Image}}
7909 !! html
7910 <p>File
7911 </p>
7912 !! end
7913
7914 !! test
7915 Namespace (lang=de) Benutzer {{ns:User}}
7916 !! options
7917 language=de
7918 !! wikitext
7919 {{ns:User}}
7920 !! html
7921 <p>Benutzer
7922 </p>
7923 !! end
7924
7925 !! test
7926 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7927 !! options
7928 language=de
7929 !! wikitext
7930 {{ns:3}}
7931 !! html
7932 <p>Benutzer Diskussion
7933 </p>
7934 !! end
7935
7936
7937 !! test
7938 Urlencode
7939 !! wikitext
7940 {{urlencode:hi world?!}}
7941 {{urlencode:hi world?!|WIKI}}
7942 {{urlencode:hi world?!|PATH}}
7943 {{urlencode:hi world?!|QUERY}}
7944 !! html
7945 <p>hi+world%3F%21
7946 hi_world%3F!
7947 hi%20world%3F%21
7948 hi+world%3F%21
7949 </p>
7950 !! end
7951
7952 !! test
7953 Magic Word: prioritize type info over data-parsoid
7954 !! options
7955 parsoid=html2wt
7956 !! wikitext
7957 __FORCETOC__
7958 !! html
7959 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
7960 !! end
7961
7962 !! test
7963 Magic Word: serialize on separate line (parsoid)
7964 !! options
7965 parsoid=wt2wt,html2wt
7966 !! wikitext
7967 foo
7968 __NOTOC__
7969 bar
7970 !! html
7971 foo<meta property="mw:PageProp/notoc"/>bar
7972 !! end
7973
7974 !! test
7975 Magic Word: rt non-english wikis
7976 !! options
7977 parsoid=wt2wt
7978 language=de
7979 !! wikitext
7980 __NOEDITSECTION__
7981 !! html
7982 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
7983 !! end
7984
7985 ###
7986 ### Magic links
7987 ###
7988 !! test
7989 Magic links: internal link to RFC (bug 479)
7990 !! wikitext
7991 [[RFC 123]]
7992 !! html
7993 <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>
7994 </p>
7995 !! end
7996
7997 !! test
7998 Magic links: RFC (bug 479)
7999 !! wikitext
8000 RFC 822
8001 !! html
8002 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8003 </p>
8004 !! end
8005
8006 !! test
8007 Magic links: ISBN (bug 1937)
8008 !! wikitext
8009 ISBN 0-306-40615-2
8010 !! html
8011 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8012 </p>
8013 !! end
8014
8015 !! test
8016 Magic links: PMID incorrectly converts space to underscore
8017 !! wikitext
8018 PMID 1234
8019 !! html
8020 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8021 </p>
8022 !! end
8023
8024 ###
8025 ### Templates
8026 ####
8027
8028 !! test
8029 Nonexistent template
8030 !! wikitext
8031 {{thistemplatedoesnotexist}}
8032 !! html
8033 <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>
8034 </p>
8035 !! end
8036
8037 !! test
8038 Template with invalid target containing tags
8039 !! wikitext
8040 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8041 !! html
8042 <p>{{a<b>b</b>|foo|a=b|a = b}}
8043 </p>
8044 !! end
8045
8046 !! test
8047 Template with invalid target containing unclosed tag
8048 !! wikitext
8049 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8050 !! html
8051 <p>{{a<b>|foo|a=b|a = b}}</b>
8052 </p>
8053 !! end
8054
8055 !! test
8056 Template with invalid target containing wikilink
8057 !! wikitext
8058 {{[[Main Page]]}}
8059 !! html/php
8060 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
8061 </p>
8062 !! html/parsoid
8063 <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>
8064 !! end
8065
8066 !! article
8067 Template:test
8068 !! text
8069 This is a test template
8070 !! endarticle
8071
8072 !! test
8073 Simple template
8074 !! wikitext
8075 {{test}}
8076 !! html
8077 <p>This is a test template
8078 </p>
8079 !! end
8080
8081 !! test
8082 Template with explicit namespace
8083 !! wikitext
8084 {{Template:test}}
8085 !! html
8086 <p>This is a test template
8087 </p>
8088 !! end
8089
8090
8091 !! article
8092 Template:paramtest
8093 !! text
8094 This is a test template with parameter {{{param}}}
8095 !! endarticle
8096
8097 !! test
8098 Template parameter
8099 !! wikitext
8100 {{paramtest|param=foo}}
8101 !! html
8102 <p>This is a test template with parameter foo
8103 </p>
8104 !! end
8105
8106 !! article
8107 Template:paramtestnum
8108 !! text
8109 [[{{{1}}}|{{{2}}}]]
8110 !! endarticle
8111
8112 !! test
8113 Template unnamed parameter
8114 !! wikitext
8115 {{paramtestnum|Main Page|the main page}}
8116 !! html
8117 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
8118 </p>
8119 !! end
8120
8121 !! article
8122 Template:templatesimple
8123 !! text
8124 (test)
8125 !! endarticle
8126
8127 !! article
8128 Template:templateredirect
8129 !! text
8130 #redirect [[Template:templatesimple]]
8131 !! endarticle
8132
8133 !! article
8134 Template:templateasargtestnum
8135 !! text
8136 {{{{{1}}}}}
8137 !! endarticle
8138
8139 !! article
8140 Template:templateasargtest
8141 !! text
8142 {{template{{{templ}}}}}
8143 !! endarticle
8144
8145 !! article
8146 Template:templateasargtest2
8147 !! text
8148 {{{{{templ}}}}}
8149 !! endarticle
8150
8151 !! test
8152 Template with template name as unnamed argument
8153 !! wikitext
8154 {{templateasargtestnum|templatesimple}}
8155 !! html
8156 <p>(test)
8157 </p>
8158 !! end
8159
8160 !! test
8161 Template with template name as argument
8162 !! wikitext
8163 {{templateasargtest|templ=simple}}
8164 !! html
8165 <p>(test)
8166 </p>
8167 !! end
8168
8169 !! test
8170 Template with template name as argument (2)
8171 !! wikitext
8172 {{templateasargtest2|templ=templatesimple}}
8173 !! html
8174 <p>(test)
8175 </p>
8176 !! end
8177
8178 !! article
8179 Template:templateasargtestdefault
8180 !! text
8181 {{{{{templ|templatesimple}}}}}
8182 !! endarticle
8183
8184 !! article
8185 Template:templa
8186 !! text
8187 '''templ'''
8188 !! endarticle
8189
8190 !! test
8191 Template with default value
8192 !! wikitext
8193 {{templateasargtestdefault}}
8194 !! html
8195 <p>(test)
8196 </p>
8197 !! end
8198
8199 !! test
8200 Template with default value (value set)
8201 !! wikitext
8202 {{templateasargtestdefault|templ=templa}}
8203 !! html
8204 <p><b>templ</b>
8205 </p>
8206 !! end
8207
8208 !! test
8209 Template redirect
8210 !! wikitext
8211 {{templateredirect}}
8212 !! html
8213 <p>(test)
8214 </p>
8215 !! end
8216
8217 !! test
8218 Template with argument in separate line
8219 !! wikitext
8220 {{ templateasargtest |
8221 templ = simple }}
8222 !! html
8223 <p>(test)
8224 </p>
8225 !! end
8226
8227 !! test
8228 Template with complex template as argument
8229 !! wikitext
8230 {{paramtest|
8231 param ={{ templateasargtest |
8232 templ = simple }}}}
8233 !! html
8234 <p>This is a test template with parameter (test)
8235 </p>
8236 !! end
8237
8238 !! test
8239 Template with thumb image (with link in description)
8240 !! wikitext
8241 {{paramtest|
8242 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
8243 !! html
8244 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>
8245
8246 !! end
8247
8248 !! article
8249 Template:complextemplate
8250 !! text
8251 {{{1}}} {{paramtest|
8252 param ={{{param}}}}}
8253 !! endarticle
8254
8255 !! test
8256 Template with complex arguments
8257 !! wikitext
8258 {{complextemplate|
8259 param ={{ templateasargtest |
8260 templ = simple }}|[[Template:complextemplate|link]]}}
8261 !! html
8262 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
8263 </p>
8264 !! end
8265
8266 !! test
8267 BUG 553: link with two variables in a piped link
8268 !! wikitext
8269 {|
8270 |[[{{{1}}}|{{{2}}}]]
8271 |}
8272 !! html
8273 <table>
8274 <tr>
8275 <td>[[{{{1}}}|{{{2}}}]]
8276 </td></tr></table>
8277
8278 !! end
8279
8280 !! test
8281 Magic variable as template parameter
8282 !! wikitext
8283 {{paramtest|param={{SITENAME}}}}
8284 !! html
8285 <p>This is a test template with parameter MediaWiki
8286 </p>
8287 !! end
8288
8289 !! article
8290 Template:linktest
8291 !! text
8292 [[{{{param}}}|link]]
8293 !! endarticle
8294
8295 !! test
8296 Template parameter as link source
8297 !! wikitext
8298 {{linktest|param=Main Page}}
8299 !! html
8300 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
8301 </p>
8302 !! end
8303
8304 !!test
8305 Template-generated attribute string (k='v')
8306 !! wikitext
8307 <span {{attr_str|id|v1}}>bar</span>
8308 !! html
8309 <p><span id="v1">bar</span>
8310 </p>
8311 !!end
8312
8313 !!article
8314 Template:paramtest2
8315 !! text
8316 including another template, {{paramtest|param={{{arg}}}}}
8317 !! endarticle
8318
8319 !! test
8320 Template passing argument to another template
8321 !! wikitext
8322 {{paramtest2|arg='hmm'}}
8323 !! html
8324 <p>including another template, This is a test template with parameter 'hmm'
8325 </p>
8326 !! end
8327
8328 !! article
8329 Template:Linktest2
8330 !! text
8331 Main Page
8332 !! endarticle
8333
8334 !! test
8335 Template as link source
8336 !! wikitext
8337 [[{{linktest2}}]]
8338
8339 [[{{linktest2}}|Main Page]]
8340
8341 [[{{linktest2}}]]Page
8342 !! html
8343 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8344 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8345 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
8346 </p>
8347 !! end
8348
8349
8350 !! article
8351 Template:loop1
8352 !! text
8353 {{loop2}}
8354 !! endarticle
8355
8356 !! article
8357 Template:loop2
8358 !! text
8359 {{loop1}}
8360 !! endarticle
8361
8362 !! test
8363 Template infinite loop
8364 !! wikitext
8365 {{loop1}}
8366 !! html
8367 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
8368 </p>
8369 !! end
8370
8371 !! test
8372 Template from main namespace
8373 !! wikitext
8374 {{:Main Page}}
8375 !! html
8376 <p>blah blah
8377 </p>
8378 !! end
8379
8380 !! article
8381 Template:table
8382 !! text
8383 {|
8384 | 1 || 2
8385 |-
8386 | 3 || 4
8387 |}
8388 !! endarticle
8389
8390 !! test
8391 BUG 529: Template with table, not included at beginning of line
8392 !! wikitext
8393 foo {{table}}
8394 !! html
8395 <p>foo
8396 </p>
8397 <table>
8398 <tr>
8399 <td> 1 </td>
8400 <td> 2
8401 </td></tr>
8402 <tr>
8403 <td> 3 </td>
8404 <td> 4
8405 </td></tr></table>
8406
8407 !! end
8408
8409 !! test
8410 BUG 523: Template shouldn't eat newline (or add an extra one before table)
8411 !! wikitext
8412 foo
8413 {{table}}
8414 !! html
8415 <p>foo
8416 </p>
8417 <table>
8418 <tr>
8419 <td> 1 </td>
8420 <td> 2
8421 </td></tr>
8422 <tr>
8423 <td> 3 </td>
8424 <td> 4
8425 </td></tr></table>
8426
8427 !! end
8428
8429 !! test
8430 BUG 41: Template parameters shown as broken links
8431 !! wikitext
8432 {{{parameter}}}
8433 !! html
8434 <p>{{{parameter}}}
8435 </p>
8436 !! end
8437
8438 !! test
8439 Template with targets containing wikilinks
8440 !! wikitext
8441 {{[[foo]]}}
8442
8443 {{[[{{echo|foo}}]]}}
8444
8445 {{{{echo|[[foo}}]]}}
8446 !! html
8447 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8448 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8449 </p><p>{{[[foo}}]]
8450 </p>
8451 !! end
8452
8453 !! article
8454 Template:MSGNW test
8455 !! text
8456 ''None'' of '''this''' should be
8457 * interpreted
8458 but rather passed unmodified
8459 {{test}}
8460 <gallery>
8461 File:Foobar.jpg
8462 </gallery>
8463 !! endarticle
8464
8465 # hmm, fix this or just deprecate msgnw and document its behavior?
8466 !! test
8467 msgnw keyword
8468 !! wikitext
8469 {{msgnw:MSGNW test}}
8470 !! html
8471 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
8472 &#42; interpreted
8473 &#32;but rather passed unmodified
8474 &#123;&#123;test&#125;&#125;
8475 &#60;gallery&#62;
8476 File:Foobar.jpg
8477 &#60;/gallery&#62;
8478 </p>
8479 !! end
8480
8481 !! test
8482 int keyword
8483 !! wikitext
8484 {{int:youhavenewmessages|lots of money|not!}}
8485 !! html
8486 <p>You have lots of money (not!).
8487 </p>
8488 !! end
8489
8490 !! article
8491 Template:Includes
8492 !! text
8493 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8494 !! endarticle
8495
8496 !! test
8497 <includeonly> and <noinclude> being included
8498 !! wikitext
8499 {{Includes}}
8500 !! html
8501 <p>Foobar
8502 </p>
8503 !! end
8504
8505 !! article
8506 Template:Includes2
8507 !! text
8508 <onlyinclude>Foo</onlyinclude>bar
8509 !! endarticle
8510
8511 !! test
8512 <onlyinclude> being included
8513 !! wikitext
8514 {{Includes2}}
8515 !! html
8516 <p>Foo
8517 </p>
8518 !! end
8519
8520
8521 !! article
8522 Template:Includes3
8523 !! text
8524 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8525 !! endarticle
8526
8527 !! test
8528 <onlyinclude> and <includeonly> being included
8529 !! wikitext
8530 {{Includes3}}
8531 !! html
8532 <p>Foo
8533 </p>
8534 !! end
8535
8536 !! test
8537 <includeonly> and <noinclude> on a page
8538 !! wikitext
8539 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8540 !! html
8541 <p>Foozar
8542 </p>
8543 !! end
8544
8545 !! test
8546 Un-closed <noinclude>
8547 !! wikitext
8548 <noinclude>
8549 !! html
8550 !! end
8551
8552 !! test
8553 <onlyinclude> on a page
8554 !! wikitext
8555 <onlyinclude>Foo</onlyinclude>bar
8556 !! html
8557 <p>Foobar
8558 </p>
8559 !! end
8560
8561 !! test
8562 Un-closed <onlyinclude>
8563 !! wikitext
8564 <onlyinclude>
8565 !! html
8566 !! end
8567
8568 !!test
8569 Self-closed noinclude, includeonly, onlyinclude tags
8570 !! wikitext
8571 <noinclude />
8572 <includeonly />
8573 <onlyinclude />
8574 !! html
8575 <p><br />
8576 </p>
8577 !!end
8578
8579 !!test
8580 Unbalanced includeonly and noinclude tags
8581 !! wikitext
8582 {|
8583 |a</noinclude>
8584 |b</noinclude></noinclude>
8585 |c</noinclude></includeonly>
8586 |d</includeonly></includeonly>
8587 |}
8588 !! html
8589 <table>
8590 <tr>
8591 <td>a
8592 </td>
8593 <td>b
8594 </td>
8595 <td>c&lt;/includeonly&gt;
8596 </td>
8597 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8598 </td></tr></table>
8599
8600 !!end
8601
8602 !! article
8603 Template:Includeonly section
8604 !! text
8605 <includeonly>
8606 ==Includeonly section==
8607 </includeonly>
8608 ==Section T-1==
8609 !!endarticle
8610
8611 !! test
8612 Bug 6563: Edit link generation for section shown by <includeonly>
8613 !! wikitext
8614 {{includeonly section}}
8615 !! html
8616 <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>
8617 <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>
8618
8619 !! end
8620
8621 # Uses same input as the contents of [[Template:Includeonly section]]
8622 !! test
8623 Bug 6563: Section extraction for section shown by <includeonly>
8624 !! options
8625 section=T-2
8626 !! wikitext
8627 <includeonly>
8628 ==Includeonly section==
8629 </includeonly>
8630 ==Section T-2==
8631 !! html
8632 ==Section T-2==
8633 !! end
8634
8635 !! test
8636 Bug 6563: Edit link generation for section suppressed by <includeonly>
8637 !! wikitext
8638 <includeonly>
8639 ==Includeonly section==
8640 </includeonly>
8641 ==Section 1==
8642 !! html
8643 <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>
8644
8645 !! end
8646
8647 !! test
8648 Bug 6563: Section extraction for section suppressed by <includeonly>
8649 !! options
8650 section=1
8651 !! wikitext
8652 <includeonly>
8653 ==Includeonly section==
8654 </includeonly>
8655 ==Section 1==
8656 !! html
8657 ==Section 1==
8658 !! end
8659
8660 !! test
8661 Un-closed <includeonly>
8662 !! wikitext
8663 <includeonly>
8664 !! html
8665 !! end
8666
8667 # TODO: test with DOM fragment reuse!
8668 !! test
8669 Parsoid: DOM fragment reuse
8670 !! options
8671 parsoid=wt2wt,wt2html
8672 !! wikitext
8673 a{{echo|b<table></table>c}}d
8674
8675 a{{echo|b
8676 <table></table>
8677 c}}d
8678
8679 {{echo|a
8680
8681 <table></table>
8682
8683 b}}
8684 !! html
8685 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8686 <table></table>c"}},"i":0}}]}'>b</span>
8687 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8688
8689
8690 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n<table></table>\nc"}},"i":0}},"d"]}'>ab</p><span about="#mwt2">
8691 </span>
8692 <table about="#mwt2"></table><span about="#mwt2">
8693 </span>
8694 <p about="#mwt2">cd</p>
8695
8696
8697 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n<table></table>\n\nb"}},"i":0}}]}'>a</p><span about="#mwt3">
8698
8699 </span>
8700 <table about="#mwt3"></table><span about="#mwt3">
8701
8702 </span>
8703 <p about="#mwt3">b</p>
8704 !! end
8705
8706 !! test
8707 Parsoid: Merge double tds (bug 50603)
8708 !! options
8709 parsoid
8710 !! wikitext
8711 {|
8712 |{{echo|{{!}} foo}}
8713 |}
8714 !! html
8715 <table><tbody>
8716 <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>
8717 </tbody></table>
8718 !! end
8719
8720 !! test
8721 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8722 !! options
8723 parsoid
8724 !! wikitext
8725 {{echo|<div>}}
8726 {|
8727 |{{echo|{{!}} foo}}
8728 |}
8729 {{echo|</div>}}
8730 !! html
8731 <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}}]}'>
8732 <table><tbody>
8733 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8734 </tbody></table>
8735 </div>
8736 !! end
8737
8738 ###
8739 ### <includeonly> and <noinclude> in attributes
8740 ###
8741 !!test
8742 0. includeonly around the entire attribute
8743 !! wikitext
8744 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8745 !! html
8746 <p><span id="v2">bar</span>
8747 </p>
8748 !!end
8749
8750 !!test
8751 1. includeonly in html attr key
8752 !! wikitext
8753 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8754 !! html
8755 <p><span id="foo">bar</span>
8756 </p>
8757 !!end
8758
8759 !!test
8760 2. includeonly in html attr value
8761 !! wikitext
8762 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8763 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8764 !! html
8765 <p><span id="v1">bar</span>
8766 <span id="v1">bar</span>
8767 </p>
8768 !!end
8769
8770 !!test
8771 3. includeonly in part of an attr value
8772 !! wikitext
8773 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8774 !! html
8775 <p><span style="color:red;">bar</span>
8776 </p>
8777 !!end
8778
8779 !!test
8780 4. includeonly in table attributes
8781 !! wikitext
8782 {|
8783 |- <noinclude>
8784 |-
8785 |a
8786 </noinclude>
8787 |- <includeonly>
8788 |-
8789 |b
8790 </includeonly>
8791 |}
8792 !! html
8793 <table>
8794
8795
8796 <tr>
8797 <td>a
8798 </td></tr>
8799 </table>
8800
8801 !!end
8802
8803 ###
8804 ### Token Stream Patcher tests
8805 ###
8806 ### These tests won't always pass wt2wt and other modes because
8807 ### on serialization, the table will be output on a new line.
8808 ### For now, we are blacklisting them, and using this to test selser.
8809 ###
8810
8811 !!test
8812 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
8813 !!options
8814 parsoid=wt2html,wt2wt
8815 !!wikitext
8816 {{echo|}}{| width = '100%'
8817 |foo
8818 |}
8819 !!html/parsoid
8820 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
8821 <table width="100%">
8822 <tbody>
8823 <tr>
8824 <td>foo</td></tr></tbody></table>
8825 !!end
8826
8827 !!test
8828 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
8829 !!options
8830 parsoid=wt2html,wt2wt
8831 !!wikitext
8832 <includeonly>a</includeonly>{| {{{b}}}
8833 |c
8834 |}
8835 !!html/parsoid
8836 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":"&lt;/includeonly>"}'/><span data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>{{{b}}}</span><table about="#mwt1" typeof="mw:Param" data-parsoid='{"a":{" ":null},"sa":{" ":""},"src":"{| {{{b}}}\n|c\n|}"}'>
8837 <tbody><tr><td>c</td></tr>
8838 </tbody></table>
8839 !!end
8840
8841 ###
8842 ### Testing parsing of templates where a template arg
8843 ### has the same name as the template itself.
8844 ###
8845
8846 !! article
8847 Template:quote
8848 !! text
8849 {{{quote|{{{1}}}}}}
8850 !! endarticle
8851
8852 !!test
8853 Templates: Template Name/Arg clash: 1. Use of positional param
8854 !! wikitext
8855 {{quote|foo}}
8856 !! html
8857 <p>foo
8858 </p>
8859 !!end
8860
8861 !!test
8862 Templates: Template Name/Arg clash: 2. Use of named param
8863 !! wikitext
8864 {{quote|quote=foo}}
8865 !! html
8866 <p>foo
8867 </p>
8868 !!end
8869
8870 !!test
8871 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8872 !! wikitext
8873 {{quote|quote}}
8874 !! html
8875 <p>quote
8876 </p>
8877 !!end
8878
8879 ###
8880 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8881 ###
8882
8883 !!test
8884 Templates: 1. Simple use
8885 !! wikitext
8886 {{echo|Foo}}
8887 !! html
8888 <p>Foo
8889 </p>
8890 !!end
8891
8892 !!test
8893 Templates: 2. Inside a block tag
8894 !! wikitext
8895 <div>{{echo|Foo}}</div>
8896 <blockquote>{{echo|Foo}}</blockquote>
8897 !! html
8898 <div>Foo</div>
8899 <blockquote>Foo</blockquote>
8900
8901 !!end
8902
8903 !!test
8904 Templates: P-wrapping: 1a. Templates on consecutive lines
8905 !! wikitext
8906 {{echo|Foo}}
8907 {{echo|bar}}
8908 !! html
8909 <p>Foo
8910 bar
8911 </p>
8912 !!end
8913
8914 !!test
8915 Templates: P-wrapping: 1b. Templates on consecutive lines
8916 !! wikitext
8917 Foo
8918
8919 {{echo|bar}}
8920 {{echo|baz}}
8921 !! html
8922 <p>Foo
8923 </p><p>bar
8924 baz
8925 </p>
8926 !!end
8927
8928 !!test
8929 Templates: P-wrapping: 1c. Templates on consecutive lines
8930 !! wikitext
8931 {{echo|Foo}}
8932 {{echo|bar}} <div>baz</div>
8933 !! html
8934 <p>Foo
8935 </p>
8936 bar <div>baz</div>
8937
8938 !!end
8939
8940 !!test
8941 Templates: P-wrapping: 1d. Template preceded by comment-only line
8942 !!options
8943 parsoid
8944 !! wikitext
8945 <!-- foo -->
8946 {{echo|Bar}}
8947 !! html
8948 <!-- foo -->
8949
8950 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8951 !!end
8952
8953 !!test
8954 Templates: Inline Text: 1. Multiple template uses
8955 !! wikitext
8956 {{echo|Foo}}bar{{echo|baz}}
8957 !! html
8958 <p>Foobarbaz
8959 </p>
8960 !!end
8961
8962 !!test
8963 Templates: Inline Text: 2. Back-to-back template uses
8964 !! wikitext
8965 {{echo|Foo}}{{echo|bar}}
8966 !! html
8967 <p>Foobar
8968 </p>
8969 !!end
8970
8971 !!test
8972 Templates: Block Tags: 1. Multiple template uses
8973 !! wikitext
8974 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
8975 !! html
8976 <div>Foo</div><div>bar</div><div>baz</div>
8977
8978 !!end
8979
8980 !!test
8981 Templates: Block Tags: 2. Back-to-back template uses
8982 !! wikitext
8983 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
8984 !! html
8985 <div>Foo</div><div>bar</div>
8986
8987 !!end
8988
8989 !!test
8990 Templates: Links: 1. Simple example
8991 !! wikitext
8992 {{echo|[[Foo|bar]]}}
8993 !! html
8994 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8995 </p>
8996 !!end
8997
8998 !!test
8999 Templates: Links: 2. Generation of link href
9000 !! wikitext
9001 [[{{echo|Foo}}|bar]]
9002 !! html
9003 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9004 </p>
9005 !!end
9006
9007 !!test
9008 Templates: Links: 3. Generation of part of a link href
9009 !! wikitext
9010 [[Fo{{echo|o}}|bar]]
9011
9012 [[Foo{{echo|bar}}]]
9013
9014 [[Foo{{echo|bar}}baz]]
9015
9016 [[Foo{{echo|bar}}|bar]]
9017
9018 [[:Foo{{echo|bar}}]]
9019
9020 [[:Foo{{echo|bar}}|bar]]
9021 !! html
9022 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9023 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9024 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
9025 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9026 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9027 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9028 </p>
9029 !!end
9030
9031 !!test
9032 Templates: Links: 4. Multiple templates generating link href
9033 !! wikitext
9034 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
9035 !! html
9036 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9037 </p>
9038 !!end
9039
9040 !!test
9041 Templates: Links: 5. Generation of link text
9042 !! wikitext
9043 [[Foo|{{echo|bar}}]]
9044 !! html
9045 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9046 </p>
9047 !!end
9048
9049 !!test
9050 Templates: Links: 5. Nested templates (only outermost template should be marked)
9051 !! wikitext
9052 {{echo|[[{{echo|Foo}}|bar]]}}
9053 !! html
9054 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9055 </p>
9056 !!end
9057
9058 !!test
9059 Templates: HTML Tag: 1. Generation of HTML attr. key
9060 !! wikitext
9061 <div {{echo|style}}="color:red;">foo</div>
9062 !! html
9063 <div style="color:red;">foo</div>
9064
9065 !!end
9066
9067 !!test
9068 Templates: HTML Tag: 2. Generation of HTML attr. value
9069 !! wikitext
9070 <div style={{echo|'color:red;'}}>foo</div>
9071 !! html
9072 <div style="color:red;">foo</div>
9073
9074 !!end
9075
9076 !!test
9077 Templates: HTML Tag: 3. Generation of HTML attr key and value
9078 !! wikitext
9079 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
9080 !! html
9081 <div style="color:red;">foo</div>
9082
9083 !!end
9084
9085 !!test
9086 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
9087 !! wikitext
9088 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
9089 !! html
9090 <div title="This is a long title with just one piece templated">foo</div>
9091
9092 !!end
9093
9094 !!test
9095 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
9096 !! wikitext
9097 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
9098 !! html
9099 <div title="This is a long title with just one piece templated">foo</div>
9100
9101 !!end
9102
9103 !!test
9104 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
9105 !! wikitext
9106 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
9107 !! html
9108 <div title="This is a long title with just one piece templated">foo</div>
9109
9110 !!end
9111
9112 !!test
9113 Templates: HTML Tag: 7. Generation of partial attribute key string
9114 !! wikitext
9115 <div st{{echo|yle}}="color:red;">foo</div>
9116 !! html
9117 <div style="color:red;">foo</div>
9118
9119 !!end
9120
9121 !!test
9122 Templates: HTML Tables: 1. Generating start of a HTML table
9123 !! wikitext
9124 {{echo|<table><tr><td>foo</td>}}</tr></table>
9125 !! html
9126 <table><tr><td>foo</td></tr></table>
9127
9128 !!end
9129
9130 !!test
9131 Templates: HTML Tables: 2a. Generating middle of a HTML table
9132 !! wikitext
9133 <table><tr>{{echo|<td>foo</td>}}</tr></table>
9134 !! html
9135 <table><tr><td>foo</td></tr></table>
9136
9137 !!end
9138
9139 !!test
9140 Templates: HTML Tables: 2b. Generating middle of a HTML table
9141 !! wikitext
9142 <table>{{echo|<tr><td>foo</td></tr>}}</table>
9143 !! html
9144 <table><tr><td>foo</td></tr></table>
9145
9146 !!end
9147
9148 !!test
9149 Templates: HTML Tables: 3. Generating end of a HTML table
9150 !! wikitext
9151 <table><tr>{{echo|<td>foo</td></tr></table>}}
9152 !! html
9153 <table><tr><td>foo</td></tr></table>
9154
9155 !!end
9156
9157 !!test
9158 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
9159 !! wikitext
9160 {{echo|<table>}}<tr><td>foo</td></tr></table>
9161 !! html
9162 <table><tr><td>foo</td></tr></table>
9163
9164 !!end
9165
9166 !!test
9167 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
9168 !! wikitext
9169 <table>{{echo|<tr>}}<td>foo</td></tr></table>
9170 !! html
9171 <table><tr><td>foo</td></tr></table>
9172
9173 !!end
9174
9175 !!test
9176 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
9177 !! wikitext
9178 <table><tr>{{echo|<td>}}foo</td></tr></table>
9179 !! html
9180 <table><tr><td>foo</td></tr></table>
9181
9182 !!end
9183
9184 !!test
9185 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
9186 !! wikitext
9187 <table><tr><td>foo{{echo|</td>}}</tr></table>
9188 !! html
9189 <table><tr><td>foo</td></tr></table>
9190
9191 !!end
9192
9193 !!test
9194 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
9195 !! wikitext
9196 <table><tr><td>foo</td>{{echo|</tr>}}</table>
9197 !! html
9198 <table><tr><td>foo</td></tr></table>
9199
9200 !!end
9201
9202 !!test
9203 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
9204 !! wikitext
9205 <table><tr><td>foo</td></tr>{{echo|</table>}}
9206 !! html
9207 <table><tr><td>foo</td></tr></table>
9208
9209 !!end
9210
9211 !!test
9212 Templates: HTML Tables: 5. Proper fostering of categories from inside
9213 !!options
9214 parsoid=wt2html,wt2wt
9215 !! wikitext
9216 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
9217 <!--Two categories (Bug 50330)-->
9218 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
9219 !! html
9220 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
9221 <!--Two categories (Bug 50330)-->
9222 <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>
9223 !!end
9224
9225 !!test
9226 Templates: Wiki Tables: 1a. Fostering of entire template content
9227 !! wikitext
9228 {|
9229 {{echo|a}}
9230 |}
9231 !! html
9232 <table>
9233 a
9234 <tr><td></td></tr></table>
9235
9236 !!end
9237
9238 !!test
9239 Templates: Wiki Tables: 1b. Fostering of entire template content
9240 !! wikitext
9241 {|
9242 {{echo|<div>}}
9243 foo
9244 {{echo|</div>}}
9245 |}
9246 !! html
9247 <table>
9248 <div>
9249 <p>foo
9250 </p>
9251 </div>
9252 <tr><td></td></tr></table>
9253
9254 !!end
9255
9256 !!test
9257 Templates: Wiki Tables: 2. Fostering of partial template content
9258 !! wikitext
9259 {|
9260 {{echo|a
9261 <div>b</div>}}
9262 |}
9263 !! html
9264 <table>
9265 a
9266 <div>b</div>
9267 <tr><td></td></tr></table>
9268
9269 !!end
9270
9271 !!test
9272 Templates: Wiki Tables: 3. td-content via multiple templates
9273 !! wikitext
9274 {|
9275 {{echo|{{pipe}}a}}{{echo|b}}
9276 |}
9277 !! html
9278 <table>
9279 <tr>
9280 <td>ab
9281 </td></tr></table>
9282
9283 !!end
9284
9285 !!test
9286 Templates: Wiki Tables: 4. Templated tags, no content
9287 !! wikitext
9288 {{tbl-start}}
9289 {{tbl-end}}
9290 !! html
9291 <table>
9292 <tr><td></td></tr></table>
9293
9294 !!end
9295
9296 !!test
9297 Templates: Wiki Tables: 5. Templated tags, regular td-tags
9298 !! wikitext
9299 {{tbl-start}}
9300 |foo
9301 {{tbl-end}}
9302 !! html
9303 <table>
9304 <tr>
9305 <td>foo
9306 </td></tr></table>
9307
9308 !!end
9309
9310 !!test
9311 Templates: Wiki Tables: 6. Templated tags, templated td-tags
9312 !! wikitext
9313 {{tbl-start}}
9314 {{!}}foo
9315 {{tbl-end}}
9316 !! html
9317 <table>
9318 <tr>
9319 <td>foo
9320 </td></tr></table>
9321
9322 !!end
9323
9324 !!test
9325 Templates: Lists: Multi-line list-items via templates
9326 !! wikitext
9327 *{{echo|a {{nonexistent|
9328 unused}}}}
9329 *{{echo|b {{nonexistent|
9330 unused}}}}
9331 !! html
9332 <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>
9333 <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>
9334
9335 !!end
9336
9337 !!test
9338 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
9339 !! wikitext
9340 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
9341 !! html
9342 <p><i>ab</i>c<i>d</i>e
9343 </p>
9344 !!end
9345
9346 !!test
9347 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
9348 (PHP parser generates misnested html)
9349 !! wikitext
9350 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
9351 !! html/parsoid
9352 <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>
9353 !!end
9354
9355 !!test
9356 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
9357 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
9358 !! options
9359 parsoid=wt2html,wt2wt
9360 !! wikitext
9361 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
9362 !! html
9363 <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>
9364 <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>
9365 <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>
9366 !!end
9367
9368 !!test
9369 Templates: Ugly nesting: 4. Divs opened/closed across templates
9370 !! wikitext
9371 a<div>b{{echo|c</div>d}}e
9372 !! html
9373 a<div>bc</div>de
9374
9375 !!end
9376
9377 !!test
9378 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
9379 (Parsoid-centric)
9380 !! options
9381 parsoid
9382 !! wikitext
9383 {|
9384 |{{echo|foo</table>}}
9385 |bar
9386 |}
9387 !! html
9388 <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|}"]}'>
9389
9390 <tbody>
9391 <tr>
9392 <td>foo</td></tr></tbody></table><span about="#mwt1">
9393 </span><span about="#mwt1">|bar</span><span about="#mwt1">
9394 |}</span>
9395 !!end
9396
9397 !!test
9398 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
9399 (Parsoid-centric)
9400 !! options
9401 parsoid
9402 !! wikitext
9403 <table>
9404 <tr>
9405 <td>
9406 <table>
9407 <tr>
9408 <td>1. {{echo|foo </table>}}</td>
9409 <td> bar </td>
9410 <td>2. {{echo|baz </table>}}</td>
9411 </tr>
9412 <tr>
9413 <td>abc</td>
9414 </tr>
9415 </table>
9416 </td>
9417 </tr>
9418 <tr>
9419 <td>xyz</td>
9420 </tr>
9421 </table>
9422 !! html
9423 <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>"]}'>
9424 <tbody><tr>
9425 <td>
9426 <table>
9427 <tbody><tr>
9428 <td>1. foo </td></tr></tbody></table></td>
9429 <td> bar </td>
9430 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
9431 </span><span about="#mwt2">
9432 </span><span about="#mwt2">
9433 </span><span about="#mwt2">abc</span><span about="#mwt2">
9434 </span><span about="#mwt2">
9435 </span><span about="#mwt2">
9436 </span><span about="#mwt2">
9437 </span><span about="#mwt2">
9438 </span><span about="#mwt2">
9439 </span><span about="#mwt2">xyz</span><span about="#mwt2">
9440 </span><span about="#mwt2">
9441 </span>
9442 !!end
9443
9444 !! test
9445 Templates: Ugly templates: 3. newline-only template parameter
9446 !! wikitext
9447 foo {{echo|
9448 }}
9449 !! html
9450 <p>foo
9451 </p>
9452 !! end
9453
9454 # This looks like a bug: a single newline triggers p/br for some reason.
9455 !! test
9456 Templates: Ugly templates: 4. newline-only template parameter inconsistency
9457 !! wikitext
9458 {{echo|
9459 }}
9460 !! html
9461 <p><br />
9462 </p>
9463 !! end
9464
9465 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
9466 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
9467 !! test
9468 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
9469 !! wikitext
9470 {{echo|<table>}}
9471 {{echo|<div>foo}}
9472 {{echo|</table>}}
9473 !! html/parsoid
9474 <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
9475 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9476 </table>
9477 !! end
9478
9479 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
9480 # that are "identical" and generate nesting cycles in the algorithm
9481 !! test
9482 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
9483 !! wikitext
9484 {{echo|<table><tr><td><table>}}
9485 {{echo|<div>}}
9486 {{echo|</div>}}
9487 !! html/parsoid
9488 <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"}'>
9489 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9490 </table></td></tr></tbody></table>
9491 !! end
9492
9493 !!test
9494 Parser Functions: 1. Simple example
9495 !! wikitext
9496 {{uc:foo}}
9497 !! html
9498 <p>FOO
9499 </p>
9500 !!end
9501
9502 !!test
9503 Parser Functions: 2. Nested use (only outermost should be marked up)
9504 !! wikitext
9505 {{uc:{{lc:FOO}}}}
9506 !! html
9507 <p>FOO
9508 </p>
9509 !!end
9510
9511 ###
9512 ### Pre-save transform tests
9513 ###
9514 !! test
9515 pre-save transform: subst:
9516 !! options
9517 PST
9518 !! wikitext
9519 {{subst:test}}
9520 !! html
9521 This is a test template
9522 !! end
9523
9524 !! test
9525 pre-save transform: normal template
9526 !! options
9527 PST
9528 !! wikitext
9529 {{test}}
9530 !! html
9531 {{test}}
9532 !! end
9533
9534 !! test
9535 pre-save transform: nonexistent template
9536 !! options
9537 PST
9538 !! wikitext
9539 {{thistemplatedoesnotexist}}
9540 !! html
9541 {{thistemplatedoesnotexist}}
9542 !! end
9543
9544
9545 !! test
9546 pre-save transform: subst magic variables
9547 !! options
9548 PST
9549 !! wikitext
9550 {{subst:SITENAME}}
9551 !! html
9552 MediaWiki
9553 !! end
9554
9555 # This is bug 89, which I fixed. -- wtm
9556 !! test
9557 pre-save transform: subst: templates with parameters
9558 !! options
9559 pst
9560 !! wikitext
9561 {{subst:paramtest|param="something else"}}
9562 !! html
9563 This is a test template with parameter "something else"
9564 !! end
9565
9566 !! article
9567 Template:nowikitest
9568 !! text
9569 <nowiki>'''not wiki'''</nowiki>
9570 !! endarticle
9571
9572 !! test
9573 pre-save transform: nowiki in subst (bug 1188)
9574 !! options
9575 pst
9576 !! wikitext
9577 {{subst:nowikitest}}
9578 !! html
9579 <nowiki>'''not wiki'''</nowiki>
9580 !! end
9581
9582
9583 !! article
9584 Template:commenttest
9585 !! text
9586 This template has <!-- a comment --> in it.
9587 !! endarticle
9588
9589 !! test
9590 pre-save transform: comment in subst (bug 1936)
9591 !! options
9592 pst
9593 !! wikitext
9594 {{subst:commenttest}}
9595 !! html
9596 This template has <!-- a comment --> in it.
9597 !! end
9598
9599 !! test
9600 pre-save transform: unclosed tag
9601 !! options
9602 pst noxml
9603 !! wikitext
9604 <nowiki>'''not wiki'''
9605 !! html
9606 <nowiki>'''not wiki'''
9607 !! end
9608
9609 !! test
9610 pre-save transform: mixed tag case
9611 !! options
9612 pst noxml
9613 !! wikitext
9614 <NOwiki>'''not wiki'''</noWIKI>
9615 !! html
9616 <NOwiki>'''not wiki'''</noWIKI>
9617 !! end
9618
9619 !! test
9620 pre-save transform: unclosed comment in <nowiki>
9621 !! options
9622 pst noxml
9623 !! wikitext
9624 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9625 !! html
9626 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9627 !!end
9628
9629 # Leading @ in this template definition works around a limitation
9630 # in parsoid's parserTests which otherwise strips the <span> from the
9631 # result (confusing it for a template wrapper)
9632 !! article
9633 Template:dangerous
9634 !!text
9635 @<span onmouseover="alert('crap')">Oh no</span>
9636 !!endarticle
9637
9638 !!test
9639 (confirming safety of fix for subst bug 1936)
9640 !! wikitext
9641 {{Template:dangerous}}
9642 !! html
9643 <p>@<span>Oh no</span>
9644 </p>
9645 !! end
9646
9647 !! test
9648 pre-save transform: comment containing gallery (bug 5024)
9649 !! options
9650 pst
9651 !! wikitext
9652 <!-- <gallery>data</gallery> -->
9653 !! html
9654 <!-- <gallery>data</gallery> -->
9655 !!end
9656
9657 !! test
9658 pre-save transform: comment containing extension
9659 !! options
9660 pst
9661 !! wikitext
9662 <!-- <tag>data</tag> -->
9663 !! html
9664 <!-- <tag>data</tag> -->
9665 !!end
9666
9667 !! test
9668 pre-save transform: comment containing nowiki
9669 !! options
9670 pst
9671 !! wikitext
9672 <!-- <nowiki>data</nowiki> -->
9673 !! html
9674 <!-- <nowiki>data</nowiki> -->
9675 !!end
9676
9677 !! test
9678 pre-save transform: <noinclude> in subst (bug 3298)
9679 !! options
9680 pst
9681 !! wikitext
9682 {{subst:Includes}}
9683 !! html
9684 Foobar
9685 !! end
9686
9687 !! test
9688 pre-save transform: <onlyinclude> in subst (bug 3298)
9689 !! options
9690 pst
9691 !! wikitext
9692 {{subst:Includes2}}
9693 !! html
9694 Foo
9695 !! end
9696
9697 !! article
9698 Template:SubstTest
9699 !!text
9700 {{<includeonly>subst:</includeonly>Includes}}
9701 !! endarticle
9702
9703 !! article
9704 Template:SafeSubstTest
9705 !! text
9706 {{<includeonly>safesubst:</includeonly>Includes}}
9707 !! endarticle
9708
9709 !! test
9710 bug 22297: safesubst: works during PST
9711 !! options
9712 pst
9713 !! wikitext
9714 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9715 !! html
9716 FoobarFoobar
9717 !! end
9718
9719 !! test
9720 bug 22297: safesubst: works during normal parse
9721 !! wikitext
9722 {{SafeSubstTest}}
9723 !! html
9724 <p>Foobar
9725 </p>
9726 !! end
9727
9728 !! test
9729 subst: does not work during normal parse
9730 !! wikitext
9731 {{SubstTest}}
9732 !! html
9733 <p>{{subst:Includes}}
9734 </p>
9735 !! end
9736
9737 !! test
9738 pre-save transform: context links ("pipe trick")
9739 !! options
9740 pst
9741 !! wikitext
9742 [[Article (context)|]]
9743 [[Bar:Article|]]
9744 [[:Bar:Article|]]
9745 [[Bar:Article (context)|]]
9746 [[:Bar:Article (context)|]]
9747 [[|Article]]
9748 [[|Article (context)]]
9749 [[Bar:X (Y) Z|]]
9750 [[:Bar:X (Y) Z|]]
9751 !! html
9752 [[Article (context)|Article]]
9753 [[Bar:Article|Article]]
9754 [[:Bar:Article|Article]]
9755 [[Bar:Article (context)|Article]]
9756 [[:Bar:Article (context)|Article]]
9757 [[Article]]
9758 [[Article (context)]]
9759 [[Bar:X (Y) Z|X (Y) Z]]
9760 [[:Bar:X (Y) Z|X (Y) Z]]
9761 !! end
9762
9763 !! test
9764 pre-save transform: context links ("pipe trick") with interwiki prefix
9765 !! options
9766 pst
9767 !! wikitext
9768 [[interwiki:Article|]]
9769 [[:interwiki:Article|]]
9770 [[interwiki:Bar:Article|]]
9771 [[:interwiki:Bar:Article|]]
9772 !! html
9773 [[interwiki:Article|Article]]
9774 [[:interwiki:Article|Article]]
9775 [[interwiki:Bar:Article|Bar:Article]]
9776 [[:interwiki:Bar:Article|Bar:Article]]
9777 !! end
9778
9779 !! test
9780 pre-save transform: context links ("pipe trick") with parens in title
9781 !! options
9782 pst title=[[Somearticle (context)]]
9783 !! wikitext
9784 [[|Article]]
9785 !! html
9786 [[Article (context)|Article]]
9787 !! end
9788
9789 !! test
9790 pre-save transform: context links ("pipe trick") with comma in title
9791 !! options
9792 pst title=[[Someplace, Somewhere]]
9793 !! wikitext
9794 [[|Otherplace]]
9795 [[Otherplace, Elsewhere|]]
9796 [[Otherplace, Elsewhere, Anywhere|]]
9797 !! html
9798 [[Otherplace, Somewhere|Otherplace]]
9799 [[Otherplace, Elsewhere|Otherplace]]
9800 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9801 !! end
9802
9803 !! test
9804 pre-save transform: context links ("pipe trick") with parens and comma
9805 !! options
9806 pst title=[[Someplace (IGNORED), Somewhere]]
9807 !! wikitext
9808 [[|Otherplace]]
9809 [[Otherplace (place), Elsewhere|]]
9810 !! html
9811 [[Otherplace, Somewhere|Otherplace]]
9812 [[Otherplace (place), Elsewhere|Otherplace]]
9813 !! end
9814
9815 !! test
9816 pre-save transform: context links ("pipe trick") with comma and parens
9817 !! options
9818 pst title=[[Who, me? (context)]]
9819 !! wikitext
9820 [[|Yes, you.]]
9821 [[Me, Myself, and I (1937 song)|]]
9822 !! html
9823 [[Yes, you. (context)|Yes, you.]]
9824 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9825 !! end
9826
9827 !! test
9828 pre-save transform: context links ("pipe trick") with namespace
9829 !! options
9830 pst title=[[Ns:Somearticle]]
9831 !! wikitext
9832 [[|Article]]
9833 !! html
9834 [[Ns:Article|Article]]
9835 !! end
9836
9837 !! test
9838 pre-save transform: context links ("pipe trick") with namespace and parens
9839 !! options
9840 pst title=[[Ns:Somearticle (context)]]
9841 !! wikitext
9842 [[|Article]]
9843 !! html
9844 [[Ns:Article (context)|Article]]
9845 !! end
9846
9847 !! test
9848 pre-save transform: context links ("pipe trick") with namespace and comma
9849 !! options
9850 pst title=[[Ns:Somearticle, Context, Whatever]]
9851 !! wikitext
9852 [[|Article]]
9853 !! html
9854 [[Ns:Article, Context, Whatever|Article]]
9855 !! end
9856
9857 !! test
9858 pre-save transform: context links ("pipe trick") with namespace, comma and parens
9859 !! options
9860 pst title=[[Ns:Somearticle, Context (context)]]
9861 !! wikitext
9862 [[|Article]]
9863 !! html
9864 [[Ns:Article (context)|Article]]
9865 !! end
9866
9867 !! test
9868 pre-save transform: context links ("pipe trick") with namespace, parens and comma
9869 !! options
9870 pst title=[[Ns:Somearticle (IGNORED), Context]]
9871 !! wikitext
9872 [[|Article]]
9873 !! html
9874 [[Ns:Article, Context|Article]]
9875 !! end
9876
9877 !! test
9878 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
9879 !! options
9880 pst
9881 !! wikitext
9882 [[Article(context)|]]
9883 [[Bar:Article(context)|]]
9884 [[:Bar:Article(context)|]]
9885 [[|Article(context)]]
9886 [[Bar:X(Y)Z|]]
9887 [[:Bar:X(Y)Z|]]
9888 !! html
9889 [[Article(context)|Article]]
9890 [[Bar:Article(context)|Article]]
9891 [[:Bar:Article(context)|Article]]
9892 [[Article(context)]]
9893 [[Bar:X(Y)Z|X(Y)Z]]
9894 [[:Bar:X(Y)Z|X(Y)Z]]
9895 !! end
9896
9897 !! test
9898 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9899 !! options
9900 pst
9901 !! wikitext
9902 [[Article (context)|]]
9903 [[Bar:Article (context)|]]
9904 [[:Bar:Article (context)|]]
9905 [[|Article (context)]]
9906 [[Bar:X (Y) Z|]]
9907 [[:Bar:X (Y) Z|]]
9908 !! html
9909 [[Article (context)|Article]]
9910 [[Bar:Article (context)|Article]]
9911 [[:Bar:Article (context)|Article]]
9912 [[Article (context)]]
9913 [[Bar:X (Y) Z|X (Y) Z]]
9914 [[:Bar:X (Y) Z|X (Y) Z]]
9915 !! end
9916
9917 !! test
9918 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
9919 !! options
9920 pst
9921 !! wikitext
9922 [[Article(context)|]]
9923 [[Bar:Article(context)|]]
9924 [[:Bar:Article(context)|]]
9925 [[|Article(context)]]
9926 [[Bar:X(Y)Z|]]
9927 [[:Bar:X(Y)Z|]]
9928 !! html
9929 [[Article(context)|Article]]
9930 [[Bar:Article(context)|Article]]
9931 [[:Bar:Article(context)|Article]]
9932 [[Article(context)]]
9933 [[Bar:X(Y)Z|X(Y)Z]]
9934 [[:Bar:X(Y)Z|X(Y)Z]]
9935 !! end
9936
9937 !! test
9938 pre-save transform: context links ("pipe trick") with commas (bug 21660)
9939 !! options
9940 pst
9941 !! wikitext
9942 [[Article (context), context|]]
9943 [[Article (context),context|]]
9944 [[Bar:Article (context), context|]]
9945 [[Bar:Article (context),context|]]
9946 [[:Bar:Article (context), context|]]
9947 [[:Bar:Article (context),context|]]
9948 !! html
9949 [[Article (context), context|Article]]
9950 [[Article (context),context|Article]]
9951 [[Bar:Article (context), context|Article]]
9952 [[Bar:Article (context),context|Article]]
9953 [[:Bar:Article (context), context|Article]]
9954 [[:Bar:Article (context),context|Article]]
9955 !! end
9956
9957 !! test
9958 pre-save transform: trim trailing empty lines
9959 !! options
9960 pst
9961 !! wikitext
9962 Empty lines are trimmed
9963
9964
9965
9966
9967 !! html
9968 Empty lines are trimmed
9969 !! end
9970
9971 !! test
9972 pre-save transform: Signature expansion
9973 !! options
9974 pst
9975 !! wikitext
9976 * ~~~
9977 * <noinclude>~~~</noinclude>
9978 * <includeonly>~~~</includeonly>
9979 * <onlyinclude>~~~</onlyinclude>
9980 !! html
9981 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
9982 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
9983 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
9984 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
9985 !! end
9986
9987
9988 !! test
9989 pre-save transform: Signature expansion in nowiki tags (bug 93)
9990 !! options
9991 pst disabled
9992 !! wikitext
9993 Shall not expand:
9994
9995 <nowiki>~~~~</nowiki>
9996
9997 <includeonly><nowiki>~~~~</nowiki></includeonly>
9998
9999 <noinclude><nowiki>~~~~</nowiki></noinclude>
10000
10001 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10002
10003 {{subst:Foo}} shall be converted to FOO
10004
10005 As well as inside noinclude/onlyinclude
10006 <noinclude>{{subst:Foo}}</noinclude>
10007 <onlyinclude>{{subst:Foo}}</onlyinclude>
10008
10009 But not inside includeonly
10010 <includeonly>{{subst:Foo}}</includeonly>
10011 !! html
10012 Shall not expand:
10013
10014 <nowiki>~~~~</nowiki>
10015
10016 <includeonly><nowiki>~~~~</nowiki></includeonly>
10017
10018 <noinclude><nowiki>~~~~</nowiki></noinclude>
10019
10020 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10021
10022 FOO shall be converted to FOO
10023
10024 As well as inside noinclude/onlyinclude
10025 <noinclude>FOO</noinclude>
10026 <onlyinclude>FOO</onlyinclude>
10027
10028 But not inside includeonly
10029 <includeonly>{{subst:Foo}}</includeonly>
10030 !! end
10031
10032 !! test
10033 Parsoid: Recognize nowiki with trailing space in tags
10034 !! options
10035 parsoid=wt2html
10036 !! wikitext
10037 <nowiki ><div>[[foo]]</nowiki >
10038
10039 a<nowiki / >b
10040
10041 c<nowiki />d
10042
10043 e<nowiki/ >f
10044 !! html
10045 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10046 <p>ab</p>
10047 <p>cd</p>
10048 <p>ef</p>
10049 !! end
10050
10051 !! test
10052 Parsoid: Recognize nowiki with odd capitalization
10053 !! options
10054 parsoid=wt2html
10055 !! wikitext
10056 <noWikI ><div>[[foo]]</Nowiki >
10057 !! html
10058 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10059 !! end
10060
10061
10062 !! test
10063 Parsoid: Escape nowiki with trailing space in tags
10064 !! options
10065 parsoid=html2wt
10066 !! wikitext
10067 &lt;nowiki &gt; foo &lt;/nowiki &gt;
10068
10069 a&lt;nowiki /&gt;b
10070
10071 c&lt;nowiki/ &gt;d
10072 !! html
10073 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
10074 <p>a&lt;nowiki /&gt;b</p>
10075 <p>c&lt;nowiki/ &gt;d</p>
10076 !! end
10077
10078 !! test
10079 Parsoid: Escape weird noWikI capitalizations
10080 !! options
10081 parsoid=html2wt
10082 !! wikitext
10083 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
10084 !! html
10085 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
10086 !! end
10087
10088 ###
10089 ### Message transform tests
10090 ###
10091 !! test
10092 message transform: magic variables
10093 !! options
10094 msg
10095 !! wikitext
10096 {{SITENAME}}
10097 !! html
10098 MediaWiki
10099 !! end
10100
10101 !! test
10102 message transform: should not transform wiki markup
10103 !! options
10104 msg
10105 !! wikitext
10106 ''test''
10107 !! html
10108 ''test''
10109 !! end
10110
10111 !! test
10112 message transform: <noinclude> in transcluded template (bug 4926)
10113 !! options
10114 msg
10115 !! wikitext
10116 {{Includes}}
10117 !! html
10118 Foobar
10119 !! end
10120
10121 !! test
10122 message transform: <onlyinclude> in transcluded template (bug 4926)
10123 !! options
10124 msg
10125 !! wikitext
10126 {{Includes2}}
10127 !! html
10128 Foo
10129 !! end
10130
10131 !! test
10132 {{#special:}} page name, known
10133 !! options
10134 msg
10135 !! wikitext
10136 {{#special:Recentchanges}}
10137 !! html
10138 Special:RecentChanges
10139 !! end
10140
10141 !! test
10142 {{#special:}} page name with subpage, known
10143 !! options
10144 msg
10145 !! wikitext
10146 {{#special:Recentchanges/param}}
10147 !! html
10148 Special:RecentChanges/param
10149 !! end
10150
10151 !! test
10152 {{#special:}} page name, unknown
10153 !! options
10154 msg
10155 !! wikitext
10156 {{#special:foobar nonexistent}}
10157 !! html
10158 Special:Foobar nonexistent
10159 !! end
10160
10161 !! test
10162 {{#speciale:}} page name, known
10163 !! options
10164 msg
10165 !! wikitext
10166 {{#speciale:Recentchanges}}
10167 !! html
10168 Special:RecentChanges
10169 !! end
10170
10171 !! test
10172 {{#speciale:}} page name with subpage, known
10173 !! options
10174 msg
10175 !! wikitext
10176 {{#speciale:Recentchanges/param}}
10177 !! html
10178 Special:RecentChanges/param
10179 !! end
10180
10181 !! test
10182 {{#speciale:}} page name, unknown
10183 !! options
10184 msg
10185 !! wikitext
10186 {{#speciale:foobar nonexistent}}
10187 !! html
10188 Special:Foobar_nonexistent
10189 !! end
10190
10191 ###
10192 ### Images
10193 ###
10194 ### For Parsoid-specific tests, see
10195 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10196
10197 !! test
10198 Simple image
10199 !! options
10200 parsoid=wt2html,wt2wt,html2html
10201 !! wikitext
10202 [[Image:foobar.jpg]]
10203 !! html/php
10204 <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>
10205 </p>
10206 !! html/parsoid
10207 <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>
10208 </p>
10209 !! end
10210
10211 !! test
10212 Simple image (using File: namespace, now canonical)
10213 !! wikitext
10214 [[File:Foobar.jpg]]
10215 !! html/php
10216 <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>
10217 </p>
10218 !! html/parsoid
10219 <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>
10220 </p>
10221 !! end
10222
10223 !! test
10224 Right-aligned image
10225 !! wikitext
10226 [[File:Foobar.jpg|right]]
10227 !! html/php
10228 <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>
10229
10230 !! html/parsoid
10231 <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>
10232 !! end
10233
10234 !! test
10235 Image with caption
10236 !! wikitext
10237 [[File:Foobar.jpg|right|Caption text]]
10238 !! html/php
10239 <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>
10240
10241 !! html/parsoid
10242 <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>
10243 !! end
10244
10245 !! test
10246 Image with caption, bug 53312 #1
10247 !! wikitext
10248 [[File:Foobar.jpg|right|Caption page stuff]]
10249 !! html/php
10250 <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>
10251
10252 !! html/parsoid
10253 <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>
10254 !! end
10255
10256 !! test
10257 Image with caption, bug 53312 #2
10258 !! wikitext
10259 [[File:Foobar.jpg|right|Caption page=]]
10260 !! html/php
10261 <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>
10262
10263 !! html/parsoid
10264 <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>
10265 !! end
10266
10267 !! test
10268 Image with caption, bug 53312 #3
10269 !! wikitext
10270 [[File:Foobar.jpg|right|Caption page=stuff]]
10271 !! html/php
10272 <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>
10273
10274 !! html/parsoid
10275 <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>
10276 !! end
10277
10278 !! test
10279 Allow empty links in image captions (Bug 60753)
10280 !! options
10281 thumbsize=220
10282 !! wikitext
10283 [[File:Foobar.jpg|thumb|Caption [[Link1]]
10284 [[]]
10285 [[Link2]]
10286 ]]
10287 !! html/php
10288 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></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>
10289
10290 !! html/parsoid
10291 <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"}],"dsr":[0,59,2,2]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"dsr":[2,null,null,null]}'><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 data-parsoid='{"dsr":[null,57,null,null]}'>Caption <a rel="mw:WikiLink" href="./Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"},"dsr":[32,41,2,2]}'>Link1</a>
10292 [[]]
10293 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
10294 </figcaption></figure>
10295 !! end
10296
10297 !! test
10298 Link with empty target
10299 !! wikitext
10300 [[]]
10301 !! html
10302 <p>[[]]
10303 </p>
10304 !! end
10305
10306 !! test
10307 Image with empty attribute
10308 !! options
10309 parsoid=wt2html,wt2wt,html2html
10310 !! wikitext
10311 [[File:Foobar.jpg|right||Caption text]]
10312 !! html/php
10313 <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>
10314
10315 !! html/parsoid
10316 <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>
10317 !! end
10318
10319 !! test
10320 1. Block image with individual attributes from templates
10321 !! wikitext
10322 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
10323 !! html/php
10324 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption</div></div></div>
10325
10326 !! html/parsoid
10327 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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}}]}\" 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]}\">137px&lt;/span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
10328 !! end
10329
10330 !! test
10331 2. Block Image with individual attributes from templates
10332 !! wikitext
10333 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
10334 !! html/php
10335 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption</div></div></div>
10336
10337 !! html/parsoid
10338 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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}}]}\" 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]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" 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}}]}\" 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]}\">137px&lt;/span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
10339 !! end
10340
10341 !! test
10342 3. Inline image with individual attributes from templates
10343 !! wikitext
10344 [[File:Foobar.jpg|{{echo|50px}}]]
10345 !! html/php
10346 <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>
10347 </p>
10348 !! html/parsoid
10349 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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}}]}\" 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]}\">50px&lt;/span>"}]]}' data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}'><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>
10350 !! end
10351
10352 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
10353 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
10354 !! test
10355 Image with multiple attributes from the same template
10356 !! wikitext
10357 [[File:Foobar.jpg|{{image_attribs}}]]
10358 !! html/php
10359 <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>
10360
10361 !! html/parsoid
10362 <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>
10363 !! end
10364
10365 !! test
10366 Image with link tails
10367 !! options
10368 thumbsize=220
10369 !! wikitext
10370 123[[File:Foobar.jpg]]456
10371 123[[File:Foobar.jpg|right]]456
10372 123[[File:Foobar.jpg|thumb]]456
10373 !! html/php
10374 <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
10375 </p>
10376 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
10377 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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>456
10378
10379 !! html/parsoid
10380 <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>
10381 123<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>456
10382 123<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>456
10383 !! end
10384
10385 !! test
10386 Image with multiple captions -- only last one is accepted
10387 !! wikitext
10388 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
10389 !! html/php
10390 <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>
10391
10392 !! html/parsoid
10393 <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>
10394 !! end
10395
10396 !! test
10397 Image with multiple widths -- use last
10398 !! wikitext
10399 [[File:Foobar.jpg|200px|300px|caption]]
10400 !! html/php
10401 <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>
10402 </p>
10403 !! html/parsoid
10404 <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>
10405 !! end
10406
10407 !! test
10408 Image with multiple alignments -- use first (bug 48664)
10409 !! options
10410 thumbsize=220
10411 !! wikitext
10412 [[File:Foobar.jpg|thumb|left|right|center|caption]]
10413
10414 [[File:Foobar.jpg|middle|text-top|caption]]
10415 !! html/php
10416 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10417 <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>
10418 </p>
10419 !! html/parsoid
10420 <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>
10421 <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>
10422 !! end
10423
10424 !! test
10425 Image with width attribute at different positions
10426 !! wikitext
10427 [[File:Foobar.jpg|200px|right|Caption]]
10428 [[File:Foobar.jpg|right|200px|Caption]]
10429 [[File:Foobar.jpg|right|Caption|200px]]
10430 !! html/php
10431 <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>
10432 <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>
10433 <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>
10434
10435 !! html/parsoid
10436 <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>
10437 <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>
10438 <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>
10439 !! end
10440
10441 # a sad bit of backward-compatibility
10442 !! test
10443 Image with size specified with pxpx (bug 13500, 51628)
10444 !! options
10445 parsoid=wt2html,wt2wt,html2html
10446 !! wikitext
10447 [[File:Foobar.jpg|20pxpx]]
10448 [[File:Foobar.jpg|200x20pxpx]]
10449 !! html/php
10450 <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>
10451 <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>
10452 </p>
10453 !! html/parsoid
10454 <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>
10455 !! end
10456
10457 !! test
10458 Image with link parameter, wiki target
10459 !! wikitext
10460 [[File:Foobar.jpg|link=Main Page]]
10461 !! html/php
10462 <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>
10463 </p>
10464 !! html/parsoid
10465 <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>
10466 !! end
10467
10468 # parsoid bug 49293 (part 1)
10469 !! test
10470 Image with link parameter, URL target
10471 !! wikitext
10472 [[File:Foobar.jpg|link=http://example.com/]]
10473 !! html/php
10474 <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>
10475 </p>
10476 !! html/parsoid
10477 <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>
10478 !! end
10479
10480 # parsoid bug 49293 (part 2)
10481 !! test
10482 Image with link parameter, protocol-less URL target
10483 !! wikitext
10484 [[File:Foobar.jpg|link=//example.com/]]
10485 !! html/php
10486 <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>
10487 </p>
10488 !! html/parsoid
10489 <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>
10490 !! end
10491
10492 !! test
10493 Image with link parameter, wgExternalLinkTarget
10494 !! wikitext
10495 [[Image:foobar.jpg|link=http://example.com/]]
10496 !! config
10497 wgExternalLinkTarget='foobar'
10498 !! html
10499 <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>
10500 </p>
10501 !! end
10502
10503 !! test
10504 Image with link parameter, wgNoFollowLinks set to false
10505 !! wikitext
10506 [[Image:foobar.jpg|link=http://example.com/]]
10507 !! config
10508 wgNoFollowLinks=false
10509 !! html
10510 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10511 </p>
10512 !! end
10513
10514 !! test
10515 Image with link parameter, wgNoFollowDomainExceptions
10516 !! wikitext
10517 [[Image:foobar.jpg|link=http://example.com/]]
10518 !! config
10519 wgNoFollowDomainExceptions='example.com'
10520 !! html
10521 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10522 </p>
10523 !! end
10524
10525 !! test
10526 Image with link parameter, wgExternalLinkTarget, unnamed parameter
10527 !! wikitext
10528 [[Image:foobar.jpg|link=http://example.com/|Title]]
10529 !! config
10530 wgExternalLinkTarget='foobar'
10531 !! html
10532 <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>
10533 </p>
10534 !! end
10535
10536 !! test
10537 Image with empty link parameter
10538 !! wikitext
10539 [[File:Foobar.jpg|link=]]
10540 !! html/php
10541 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10542 </p>
10543 !! html/parsoid
10544 <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>
10545 !! end
10546
10547 !! test
10548 Image with link parameter (wiki target) and unnamed parameter
10549 !! wikitext
10550 [[File:Foobar.jpg|link=Main_Page|Title]]
10551 !! html/php
10552 <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>
10553 </p>
10554 !! html/parsoid
10555 <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>
10556 !! end
10557
10558 !! test
10559 Image with link parameter (URL target) and unnamed parameter
10560 !! wikitext
10561 [[File:Foobar.jpg|link=http://example.com/|Title]]
10562 !! html/php
10563 <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>
10564 </p>
10565 !! html/parsoid
10566 <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>
10567 !! end
10568
10569 !! test
10570 Thumbnail image with link parameter
10571 !! options
10572 thumbsize=220
10573 parsoid=wt2html,wt2wt,html2html
10574 !! wikitext
10575 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
10576 !! html/php
10577 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10578
10579 !! html/parsoid
10580 <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>
10581 !! end
10582
10583 !! test
10584 Manually-specified thumbnail image
10585 !! options
10586 thumbsize=220
10587 !! wikitext
10588 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
10589 !! html/php
10590 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10591
10592 !! html/parsoid
10593 <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>
10594 !! end
10595
10596 !! test
10597 Manually-specified thumbnail image with explicit link to wiki page
10598 !! options
10599 thumbsize=220
10600 parsoid=wt2html,wt2wt,html2html
10601 !! wikitext
10602 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
10603 !! html/php
10604 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10605
10606 !! html/parsoid
10607 <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>
10608 !! end
10609
10610 !! test
10611 Manually-specified thumbnail image with explicit link to url
10612 !! options
10613 thumbsize=220
10614 parsoid=wt2html,wt2wt,html2html
10615 !! wikitext
10616 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10617 !! html/php
10618 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10619
10620 !! html/parsoid
10621 <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>
10622 !! end
10623
10624 !! test
10625 Manually-specified thumbnail image with explicit no link
10626 !! options
10627 thumbsize=220
10628 parsoid=wt2html,wt2wt,html2html
10629 !! wikitext
10630 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10631 !! html/php
10632 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10633
10634 !! html/parsoid
10635 <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>
10636 !! end
10637
10638 !! test
10639 Manually-specified thumbnail image with explicit link and alt text
10640 !! options
10641 thumbsize=220
10642 parsoid=wt2html,wt2wt,html2html
10643 !! wikitext
10644 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
10645 !! html/php
10646 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10647
10648 !! html/parsoid
10649 <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>
10650 !! end
10651
10652 !! test
10653 Image with frame and link
10654 !! options
10655 parsoid=wt2html,wt2wt,html2html
10656 !! wikitext
10657 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10658 !! html/php
10659 <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>
10660
10661 !! html/parsoid
10662 <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">Main Page</a></figcaption></figure>
10663 !! end
10664
10665 !! test
10666 Image with frame and link and explicit alt
10667 !! options
10668 parsoid=wt2html,wt2wt,html2html
10669 !! wikitext
10670 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10671 !! html/php
10672 <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>
10673
10674 !! html/parsoid
10675 <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">Main Page</a></figcaption></figure>
10676 !! end
10677
10678 !! test
10679 Image with wiki markup in implicit alt
10680 !! options
10681 parsoid=wt2html,wt2wt,html2html
10682 !! wikitext
10683 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10684
10685 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10686 !! html/php
10687 <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>
10688 </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>
10689 </p>
10690 !! html/parsoid
10691 <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>
10692 <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>
10693 !! end
10694
10695 ###################
10696 # Conflicting image format options.
10697 # First option specified should 'win'.
10698 # All three cases in each test should be identical.
10699
10700 !! test
10701 Image with 'frameless' first.
10702 !! options
10703 parsoid=wt2html,wt2wt,html2html
10704 !! wikitext
10705 [[File:Foobar.jpg|frameless|caption]]
10706
10707 [[File:Foobar.jpg|frameless|frame|caption]]
10708
10709 [[File:Foobar.jpg|frameless|thumb|caption]]
10710 !! html/php
10711 <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>
10712 </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>
10713 </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>
10714 </p>
10715 !! html/parsoid
10716 <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>
10717 <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>
10718 <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>
10719 !! end
10720
10721 !! test
10722 Image with 'frame' first.
10723 !! options
10724 parsoid=wt2html,wt2wt,html2html
10725 !! wikitext
10726 [[File:Foobar.jpg|frame|caption]]
10727 [[File:Foobar.jpg|frame|frameless|caption]]
10728 [[File:Foobar.jpg|frame|thumb|caption]]
10729 !! html/php
10730 <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>
10731 <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>
10732 <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>
10733
10734 !! html/parsoid
10735 <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><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><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>
10736 !! end
10737
10738 !! test
10739 Image with 'thumb' first.
10740 !! options
10741 parsoid=wt2html,wt2wt,html2html
10742 !! wikitext
10743 [[File:Foobar.jpg|thumb|caption]]
10744 [[File:Foobar.jpg|thumb|frameless|caption]]
10745 [[File:Foobar.jpg|thumb|frame|caption]]
10746 !! html/php
10747 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10748 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10749 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10750
10751 !! html/parsoid
10752 <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><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><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>
10753 !! end
10754
10755 ###################
10756 # Image sizing.
10757 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
10758 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
10759 # Foobar has actual size of 1941x220
10760 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
10761 # a scalable format.
10762 # 2. Framed images always ignore size options; always render at default size.
10763 # 3. "Unspecified format" and border are the only types which can be
10764 # enlarged.
10765
10766 !! test
10767 Image: "unspecified format" and border enlarge
10768 !! options
10769 parsoid=wt2html,wt2wt,html2html
10770 !! wikitext
10771 [[File:Foobar.jpg|2000px]]
10772
10773 [[File:Foobar.jpg|border|2000px]]
10774 !! html/php
10775 <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>
10776 </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>
10777 </p>
10778 !! html/parsoid
10779 <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>
10780 <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>
10781 !! end
10782
10783 !! test
10784 Image: "unspecified format" and border reduce
10785 !! options
10786 parsoid=wt2html,wt2wt,html2html
10787 !! wikitext
10788 [[File:Foobar.jpg|1000px]]
10789
10790 [[File:Foobar.jpg|border|1000px]]
10791 !! html/php
10792 <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>
10793 </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>
10794 </p>
10795 !! html/parsoid
10796 <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>
10797 <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>
10798 !! end
10799
10800 !! test
10801 Image: thumbs reduce
10802 !! options
10803 parsoid=wt2html,wt2wt,html2html
10804 !! wikitext
10805 [[File:Foobar.jpg|thumb|50px]]
10806 !! html/php
10807 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>
10808
10809 !! html/parsoid
10810 <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>
10811 !! end
10812
10813 !! test
10814 Image: bitmap thumbs can't be enlarged past original size, but vector can.
10815 !! options
10816 parsoid=wt2html,wt2wt,html2html
10817 !! wikitext
10818 [[File:Foobar.jpg|thumb|2000px]]
10819
10820 [[File:Foobar.svg|thumb|2000px]]
10821 !! html/php
10822 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>
10823 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>
10824
10825 !! html/parsoid
10826 <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>
10827 <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>
10828 !! end
10829
10830 !! test
10831 Image: frameless can reduce in size
10832 !! options
10833 parsoid=wt2html,wt2wt,html2html
10834 !! wikitext
10835 [[File:Foobar.jpg|frameless|50px]]
10836 !! html/php
10837 <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>
10838 </p>
10839 !! html/parsoid
10840 <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>
10841 !! end
10842
10843 !! test
10844 Image: bitmap frameless can't be enlarged past original size, but vector can
10845 !! options
10846 parsoid=wt2html,wt2wt,html2html
10847 !! wikitext
10848 [[File:Foobar.jpg|frameless|2000px]]
10849
10850 [[File:Foobar.svg|frameless|2000px]]
10851 !! html/php
10852 <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>
10853 </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>
10854 </p>
10855 !! html/parsoid
10856 <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>
10857 <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>
10858 !! end
10859
10860 !! test
10861 Image: framed images are always unscaled.
10862 !! options
10863 parsoid=wt2html,wt2wt,html2html
10864 !! wikitext
10865 [[File:Foobar.jpg|frame]]
10866
10867 [[File:Foobar.jpg|frame|50px]]
10868
10869 [[File:Foobar.jpg|frame|50x50px]]
10870
10871 [[File:Foobar.jpg|frame|2000px]]
10872 !! html/php
10873 <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>
10874 <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>
10875 <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>
10876 <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>
10877
10878 !! html/parsoid
10879 <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><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><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><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>
10880 !! end
10881
10882 ###################
10883
10884 !! test
10885 Link to image page- image page normally doesn't exists, hence edit link
10886 Add test with existing image page
10887 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10888 !! wikitext
10889 [[:Image:test]]
10890 !! html
10891 <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>
10892 </p>
10893 !! end
10894
10895 !! test
10896 bug 18784 Link to non-existent image page with caption should use caption as link text
10897 !! wikitext
10898 [[:Image:test|caption]]
10899 !! html
10900 <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>
10901 </p>
10902 !! end
10903
10904 !! test
10905 Frameless image caption with a free URL
10906 !! wikitext
10907 [[File:Foobar.jpg|http://example.com]]
10908 !! html/php
10909 <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>
10910 </p>
10911 !! html/parsoid
10912 <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>
10913 !! end
10914
10915 !! test
10916 Thumbnail image caption with a free URL
10917 !! options
10918 thumbsize=220
10919 !! wikitext
10920 [[File:Foobar.jpg|thumb|http://example.com]]
10921 !! html/php
10922 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
10923
10924 !! html/parsoid
10925 <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>
10926 !! end
10927
10928 !! test
10929 Thumbnail image caption with a free URL and explicit alt
10930 !! options
10931 thumbsize=220
10932 parsoid=wt2html,wt2wt,html2html
10933 !! wikitext
10934 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
10935 !! html/php
10936 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
10937
10938 !! html/parsoid
10939 <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>
10940 !! end
10941
10942 !! test
10943 SVG thumbnails with no language set
10944 !! options
10945 !! wikitext
10946 [[File:Foobar.svg|thumb|caption]]
10947 !! html/php
10948 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10949
10950 !! html/parsoid
10951 <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>
10952 !! end
10953
10954 !! test
10955 SVG thumbnails with language de
10956 !! options
10957 parsoid=wt2html,wt2wt,html2html
10958 !! wikitext
10959 [[File:Foobar.svg|thumb|caption|lang=de]]
10960 !! html/php
10961 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10962
10963 !! html/parsoid
10964 <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>
10965 !! end
10966
10967 !! test
10968 SVG thumbnails with invalid language code
10969 !! options
10970 parsoid=wt2html,wt2wt,html2html
10971 !! wikitext
10972 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
10973 !! html/php
10974 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>lang=invalid.language.code</div></div></div>
10975
10976 !! html/parsoid
10977 <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>
10978 !! end
10979
10980 !! test
10981 BUG 1887: A ISBN with a thumbnail
10982 !! wikitext
10983 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
10984 !! html/php
10985 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
10986
10987 !! html/parsoid
10988 <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>
10989 !! end
10990
10991 !! test
10992 BUG 1887: A RFC with a thumbnail
10993 !! wikitext
10994 [[File:Foobar.jpg|thumb|This is RFC 12354]]
10995 !! html/php
10996 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
10997
10998 !! html/parsoid
10999 <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>
11000 !! end
11001
11002 !! test
11003 BUG 1887: A mailto link with a thumbnail
11004 !! wikitext
11005 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
11006 !! html/php
11007 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
11008
11009 !! html/parsoid
11010 <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>
11011 !! end
11012
11013 # Pending resolution to bug 368
11014 !! test
11015 BUG 648: Frameless image caption with a link
11016 !! wikitext
11017 [[File:Foobar.jpg|text with a [[link]] in it]]
11018 !! html/php
11019 <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>
11020 </p>
11021 !! html/parsoid
11022 <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>
11023 !! end
11024
11025 !! test
11026 BUG 648: Frameless image caption with a link (suffix)
11027 !! wikitext
11028 [[File:Foobar.jpg|text with a [[link]]foo in it]]
11029 !! html/php
11030 <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>
11031 </p>
11032 !! html/parsoid
11033 <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>
11034 !! end
11035
11036 !! test
11037 BUG 648: Frameless image caption with an interwiki link
11038 !! wikitext
11039 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
11040 !! html/php
11041 <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>
11042 </p>
11043 !! html/parsoid
11044 <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>
11045 !! end
11046
11047 !! test
11048 BUG 648: Frameless image caption with a piped interwiki link
11049 !! wikitext
11050 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
11051 !! html/php
11052 <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>
11053 </p>
11054 !! html/parsoid
11055 <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>
11056 !! end
11057
11058 !! test
11059 Escape HTML special chars in image alt text
11060 !! wikitext
11061 [[File:Foobar.jpg|& < > "]]
11062 !! html/php
11063 <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>
11064 </p>
11065 !! html/parsoid
11066 <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>
11067 !! end
11068
11069 !! test
11070 BUG 499: Alt text should have &#1234;, not &amp;1234;
11071 !! wikitext
11072 [[File:Foobar.jpg|&#9792;]]
11073 !! html/php
11074 <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>
11075 </p>
11076 !! html/parsoid
11077 <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>
11078 !! end
11079
11080 !! test
11081 Broken image caption with link
11082 !! options
11083 parsoid=wt2html,wt2wt,html2html
11084 !! wikitext
11085 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
11086 !! html/php
11087 <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.
11088 </p>
11089 !! html/parsoid
11090 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a rel="mw:WikiLink" href="Main_Page">this</a> is just an ordinary link.</p>
11091 !! end
11092
11093 !! test
11094 Image caption containing another image
11095 !! wikitext
11096 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
11097 !! html/php
11098 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></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>
11099
11100 !! html/parsoid
11101 <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>
11102 !! end
11103
11104 !! test
11105 Image: caption containing a newline
11106 !! wikitext
11107 [[File:Foobar.jpg|This
11108 *is some text]]
11109 !! html/php
11110 <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>
11111 </p>
11112 !! html/parsoid
11113 <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>
11114 !!end
11115
11116 !!test
11117 Image: caption containing leading space
11118 (The leading space should not trigger nowiki escaping in wt2wt mode)
11119 !! wikitext
11120 [[File:Foobar.jpg|thumb| bar]]
11121 !! html/php
11122 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>bar</div></div></div>
11123
11124 !! html/parsoid
11125 <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>
11126 !!end
11127
11128 !! test
11129 Image: caption containing a table
11130 !! options
11131 parsoid=wt2html,wt2wt,html2html
11132 !! wikitext
11133 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
11134 {|
11135 ! Foo !! Bar
11136 |-
11137 | Foo1 || Bar1
11138 |}
11139 and some more text.]]
11140 !! html/php
11141 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></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>
11142
11143 !! html/parsoid
11144 <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
11145 <table>
11146 <tbody>
11147 <tr><th>Foo </th><th>Bar</th></tr>
11148 <tr>
11149 <td>Foo1 </td>
11150 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
11151 !! end
11152
11153 !! test
11154 Bug 3090: External links other than http: in image captions
11155 !! wikitext
11156 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
11157 !! html/php
11158 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></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>
11159
11160 !! html/parsoid
11161 <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>
11162 !! end
11163
11164 !! test
11165 Custom class
11166 !! options
11167 parsoid=wt2html,wt2wt,html2html
11168 !! wikitext
11169 [[Image:foobar.jpg|a|class=b]]
11170 !! html/php
11171 <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>
11172 </p>
11173 !! html/parsoid
11174 <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>
11175 !! end
11176
11177 !! test
11178 Localized image handling (1).
11179 !! options
11180 parsoid=wt2html,wt2wt,html2html
11181 language=es
11182 !! wikitext
11183 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
11184 !! html/php
11185 <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>
11186
11187 !! html/parsoid
11188 <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>
11189 !! end
11190
11191 !! test
11192 Localized image handling (2).
11193 !! options
11194 thumbsize=220
11195 parsoid=wt2html,wt2wt,html2html
11196 language=es
11197 !! wikitext
11198 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
11199 !! html/php
11200 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
11201
11202 !! html/parsoid
11203 <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>
11204 !! end
11205
11206 !! test
11207 "border", "frameless" and "class" attributes on an image.
11208 !! options
11209 thumbsize=220
11210 parsoid=wt2html,wt2wt,html2html
11211 !! wikitext
11212 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
11213 !! html/php
11214 <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>
11215 </p>
11216 !! html/parsoid
11217 <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>
11218 !! end
11219
11220 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
11221 !! test
11222 Invalid image attributes (bug 62500)
11223 !! options
11224 thumbsize=220
11225 parsoid=wt2html,wt2wt,html2html
11226 !! wikitext
11227 [[File:Foobar.jpg|thumb|float|left|caption]]
11228
11229 [[File:Foobar.jpg|thumb|righ|caption]]
11230
11231 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
11232 !! html/php
11233 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
11234 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
11235 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
11236
11237 !! html/parsoid
11238 <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><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><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>
11239 !! end
11240
11241 !! article
11242 File:Barfoo.jpg
11243 !! text
11244 #REDIRECT [[File:Barfoo.jpg]]
11245 !! endarticle
11246
11247 !! test
11248 Redirected image
11249 !! wikitext
11250 [[Image:Barfoo.jpg]]
11251 !! html
11252 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
11253 </p>
11254 !! end
11255
11256 !! test
11257 Missing image with uploads disabled
11258 !! options
11259 wgEnableUploads=0
11260 !! wikitext
11261 [[Image:Foobaz.jpg]]
11262 !! html
11263 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
11264 </p>
11265 !! end
11266
11267 # Parsoid-specific testing for images
11268 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11269 # Currently imperfect due to a flaw in the Parsoid testrunner
11270 # Work in progress
11271 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
11272 # image tests.
11273
11274 !! test
11275 Parsoid-specific image handling - simple image with size and middle alignment
11276 !! wikitext
11277 [[File:Foobar.jpg|middle|50px]]
11278 !! html/parsoid
11279 <p><span class="mw-valign-middle" typeof="mw:Image">
11280 <a href="File:Foobar.jpg">
11281 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11282 </a>
11283 </span>
11284 </p>
11285 !! end
11286
11287 !! test
11288 Parsoid-specific image handling - simple image with size, middle alignment,
11289 non-standard namespace alias
11290 !! options
11291 parsoid=wt2wt,wt2html,html2html
11292 !! wikitext
11293 [[Image:Foobar.jpg|middle|50px]]
11294 !! html/parsoid
11295 <p><span class="mw-valign-middle" typeof="mw:Image">
11296 <a href="File:Foobar.jpg">
11297 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11298 </a>
11299 </span>
11300 </p>
11301 !! end
11302
11303 !! test
11304 Parsoid-specific image handling - simple image with size and middle alignment
11305 (existing content)
11306 !! wikitext
11307 [[File:Foobar.jpg|50px|middle]]
11308 !! html/parsoid
11309 <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>
11310 !! end
11311
11312 !! test
11313 Parsoid-specific image handling - simple image with size and middle alignment
11314 and non-standard namespace name
11315 !! options
11316 parsoid=wt2html,wt2wt,html2html
11317 !! wikitext
11318 [[Image:Foobar.jpg|50px|middle]]
11319 !! html/parsoid
11320 <p><span class="mw-valign-middle" typeof="mw:Image">
11321 <a href="File:Foobar.jpg">
11322 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11323 </a>
11324 </span>
11325 </p>
11326 !! end
11327
11328 !! test
11329 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
11330 !! wikitext
11331 [[File:Foobar.jpg|500x10px|baseline|caption]]
11332 !! html/parsoid
11333 <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>
11334 !! end
11335
11336 !! test
11337 Parsoid-specific image handling - simple image with border and size spec
11338 !! wikitext
11339 [[File:Foobar.jpg|50px|border|caption]]
11340 !! html/parsoid
11341 <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>
11342 !! end
11343
11344 !! test
11345 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11346 !! wikitext
11347 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
11348 !! html/parsoid
11349 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
11350 <a href="File:Foobar.jpg">
11351 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
11352 </a>
11353 <figcaption>caption content</figcaption>
11354 </figure>
11355 !! end
11356
11357 !! test
11358 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11359 (existing content)
11360 !! wikitext
11361 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
11362 !! html/parsoid
11363 <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>
11364 !! end
11365
11366 !! test
11367 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
11368 !! wikitext
11369 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
11370 !! html/parsoid
11371 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
11372 <a href="File:Foobar.jpg">
11373 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
11374 </a>
11375 <figcaption>caption</figcaption>
11376 </figure>
11377 !! end
11378
11379 !! test
11380 Parsoid-specific image handling - thumbnail with specific size, halign,
11381 valign, and caption (existing content)
11382 !! wikitext
11383 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
11384 !! html/parsoid
11385 <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>
11386 !! end
11387
11388 !! test
11389 Parsoid-specific image handling - framed image with specific size and caption
11390 (size is ignored)
11391 !! options
11392 parsoid=wt2html,wt2wt,html2html
11393 !! wikitext
11394 [[File:Foobar.jpg|frame|500x50px|caption]]
11395 !! html/parsoid
11396 <figure typeof="mw:Image/Frame">
11397 <a href="File:Foobar.jpg">
11398 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11399 </a>
11400 <figcaption>caption</figcaption>
11401 </figure>
11402 !! end
11403
11404 !! test
11405 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
11406 (size is ignored)
11407 !! options
11408 parsoid=wt2html,wt2wt,html2html
11409 !! wikitext
11410 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
11411 !! html/parsoid
11412 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
11413 <a href="File:Foobar.jpg">
11414 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11415 </a>
11416 <figcaption>caption</figcaption>
11417 </figure>
11418 !! end
11419
11420 !! test
11421 Parsoid-specific image handling - frameless image with specific size, border, and caption
11422 !! wikitext
11423 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
11424 !! html/parsoid
11425 <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>
11426 !! end
11427
11428 !! test
11429 Parsoid-specific image handling - simple image with a formatted caption
11430 !! wikitext
11431 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
11432 !! html/parsoid
11433 <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>"}'>
11434 <a href="File:Foobar.jpg">
11435 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
11436 </a></span></p>
11437 !! end
11438
11439 !! test
11440 Parsoid-specific image handling - caption with a template in it
11441 !! wikitext
11442 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
11443 !! html/parsoid
11444 <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>
11445 !! end
11446
11447 !! test
11448 Parsoid-specific image handling - caption with unbalanced tags in it
11449 !! options
11450 parsoid=wt2html,wt2wt,html2html
11451 !! wikitext
11452 foo
11453 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
11454 bar
11455 !! html/parsoid
11456 <p>foo</p>
11457 <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>
11458 <p>bar</p>
11459 !! end
11460
11461 !! test
11462 Parsoid-specific image handling - empty caption (1)
11463 !! options
11464 parsoid=wt2html,wt2wt
11465 !! wikitext
11466 [[File:Foobar.jpg|thumb|]]
11467 !! html/parsoid
11468 <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>
11469 !! end
11470
11471 # empty captions don't get serialized unless we're in the "round trip" case
11472 !! test
11473 Parsoid-specific image handling - empty caption (2)
11474 !! options
11475 parsoid=html2wt
11476 !! html/parsoid
11477 <figure class="mw-default-size" typeof="mw:Image/Thumb">
11478 <a href="File:Foobar.jpg">
11479 <img resource="./File:Foobar.jpg"
11480 src="//example.com/images/3/3a/Foobar.jpg"
11481 height="25" width="220"/>
11482 </a>
11483 <figcaption></figcaption>
11484 </figure>
11485 !! wikitext
11486 [[File:Foobar.jpg|thumb]]
11487 !! end
11488
11489 !! test
11490 Parsoid-specific image handling - whitespace caption
11491 !! wikitext
11492 [[File:Foobar.jpg|thumb| ]]
11493 !! html/parsoid
11494 <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>
11495 !! end
11496
11497 !! test
11498 Parsoid-specific image handling - lang option
11499 !! wikitext
11500 foo
11501 [[File:Foobar.svg|lang=de|caption]]
11502 bar
11503 !! html/parsoid
11504 <p>foo
11505 <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>
11506 bar</p>
11507 !! end
11508
11509
11510 ###
11511 ### Subpages
11512 ###
11513 !! article
11514 Subpage test/subpage
11515 !! text
11516 foo
11517 !! endarticle
11518
11519 !! test
11520 Subpage link
11521 !! options
11522 subpage title=[[Subpage test]]
11523 !! wikitext
11524 [[/subpage]]
11525 !! html
11526 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
11527 </p>
11528 !! end
11529
11530 !! test
11531 Subpage noslash link
11532 !! options
11533 subpage title=[[Subpage test]]
11534 !! wikitext
11535 [[/subpage/]]
11536 !! html
11537 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
11538 </p>
11539 !! end
11540
11541 # TODO: make this PHP-parser compatible!
11542 !! test
11543 Relative subpage noslash link
11544 !! options
11545 parsoid=wt2wt,wt2html,html2html
11546 subpage title=[[Subpage test/1/2/3/4]]
11547 !! wikitext
11548 [[../../subpage/]]
11549
11550 [[../../subpage]]
11551 !! html
11552 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
11553 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
11554 !! end
11555
11556 !! test
11557 Parsoid: dot-slash prefixed wikilinks
11558 !! wikitext
11559 [[./foo]]
11560
11561 [[././bar]]
11562
11563 [[././baz/]]
11564 !! html/php
11565 <p>[[./foo]]
11566 </p><p>[[././bar]]
11567 </p><p>[[././baz/]]
11568 </p>
11569 !! html/parsoid
11570 <p>[[./foo]]
11571 </p><p>[[././bar]]
11572 </p><p>[[././baz/]]
11573 </p>
11574 !! end
11575
11576 !! test
11577 Render invalid page names as plain text (bug 51090)
11578 !! wikitext
11579 [[./../foo|bar]]
11580 [[foo�|bar]]
11581 [[foo/.|bar]]
11582 [[foo/..|bar]]
11583 [[foo~~~bar]]
11584 [[foo>bar]]
11585 [[foo[bar]]
11586 [[.]]
11587 [[..]]
11588 [[foo././bar]]
11589
11590 [[{{echo|./../foo}}|bar]]
11591 [[{{echo|foo/.}}|bar]]
11592 [[{{echo|foo/..}}|bar]]
11593 [[{{echo|foo~~~~bar}}]]
11594 [[{{echo|foo>bar}}]]
11595 [[{{echo|foo././bar}}]]
11596 [[{{echo|foo{bar}}]]
11597 [[{{echo|foo}bar}}]]
11598 [[{{echo|foo[bar}}]]
11599 [[{{echo|foo]bar}}]]
11600 [[{{echo|foo<bar}}]]
11601 !!html/php
11602 <p>[[./../foo|bar]]
11603 [[foo�|bar]]
11604 [[foo/.|bar]]
11605 [[foo/..|bar]]
11606 [[foo~~~bar]]
11607 [[foo&gt;bar]]
11608 [[foo[bar]]
11609 [[.]]
11610 [[..]]
11611 [[foo././bar]]
11612 </p><p>[[./../foo|bar]]
11613 [[foo/.|bar]]
11614 [[foo/..|bar]]
11615 [[foo~~~~bar]]
11616 [[foo&gt;bar]]
11617 [[foo././bar]]
11618 [[foo{bar]]
11619 [[foo}bar]]
11620 [[foo[bar]]
11621 [[foo]bar]]
11622 [[foo&lt;bar]]
11623 </p>
11624 !!html/parsoid
11625 <p>[[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]</p>
11626 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]][[<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>
11627 !!end
11628
11629 !! test
11630 Disabled subpages
11631 !! wikitext
11632 [[/subpage]]
11633 !! html
11634 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
11635 </p>
11636 !! end
11637
11638 !! test
11639 BUG 561: {{/Subpage}}
11640 !! options
11641 subpage title=[[Page]]
11642 !! wikitext
11643 {{/Subpage}}
11644 !! html
11645 <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>
11646 </p>
11647 !! end
11648
11649 ###
11650 ### Categories
11651 ###
11652 !! article
11653 Category:MediaWiki User's Guide
11654 !! text
11655 blah
11656 !! endarticle
11657
11658 !! test
11659 Link to category
11660 !! wikitext
11661 [[:Category:MediaWiki User's Guide]]
11662 !! html
11663 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
11664 </p>
11665 !! end
11666
11667 !! test
11668 Simple category
11669 !! options
11670 cat
11671 !! wikitext
11672 [[Category:MediaWiki User's Guide]]
11673 !! html
11674 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11675 !! end
11676
11677 !! test
11678 PAGESINCATEGORY invalid title fatal (r33546 fix)
11679 !! wikitext
11680 {{PAGESINCATEGORY:<bogus>}}
11681 !! html
11682 <p>0
11683 </p>
11684 !! end
11685
11686 !! test
11687 Category with different sort key
11688 !! options
11689 cat
11690 !! wikitext
11691 [[Category:MediaWiki User's Guide|Foo]]
11692 !! html
11693 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11694 !! end
11695
11696 !! test
11697 Category with identical sort key
11698 !! options
11699 cat
11700 !! wikitext
11701 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11702 !! html
11703 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11704 !! end
11705
11706 !! test
11707 Category with empty sort key
11708 !! options
11709 cat
11710 pst
11711 !! wikitext
11712 [[Category:MediaWiki User's Guide|]]
11713 !! html
11714 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11715 !! end
11716
11717 !! test
11718 Category with empty sort key and parentheses
11719 !! options
11720 cat
11721 pst
11722 !! wikitext
11723 [[Category:Foo (bar)|]]
11724 !! html
11725 [[Category:Foo (bar)|Foo]]
11726 !! end
11727
11728 !! test
11729 Category with link tail
11730 !! options
11731 cat
11732 pst
11733 !! wikitext
11734 123[[Category:Foo]]456
11735 !! html
11736 123[[Category:Foo]]456
11737 !! end
11738
11739 !! test
11740 Category with template
11741 !! options
11742 cat
11743 pst
11744 !! wikitext
11745 [[Category:{{echo|Foo}}]]
11746 !! html
11747 [[Category:{{echo|Foo}}]]
11748 !! end
11749
11750 !! test
11751 Category with template in sort key
11752 !! options
11753 cat
11754 pst
11755 !! wikitext
11756 [[Category:Foo|{{echo|Bar}}]]
11757 !! html
11758 [[Category:Foo|{{echo|Bar}}]]
11759 !! end
11760
11761 !! test
11762 Category with template in sort key and title
11763 !! options
11764 cat
11765 pst
11766 !! wikitext
11767 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11768 !! html
11769 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11770 !! end
11771
11772 !! test
11773 Category / paragraph interactions
11774 !! wikitext
11775 Foo [[Category:Baz]] Bar
11776
11777 Foo [[Category:Baz]]
11778 Bar
11779
11780 Foo
11781 [[Category:Baz]]
11782 Bar
11783
11784 Foo
11785 [[Category:Baz]] Bar
11786
11787 Foo
11788 [[Category:Baz]]
11789 [[Category:Baz]]
11790 [[Category:Baz]]
11791 Bar
11792
11793 [[Category:Baz]]
11794 [[Category:Baz]]
11795 [[Category:Baz]]
11796
11797 [[Category:Baz]]
11798 {{echo|[[Category:Baz]]}}
11799 [[Category:Baz]]
11800 !! html
11801 <p>Foo Bar
11802 </p><p>Foo
11803 Bar
11804 </p><p>Foo
11805 Bar
11806 </p><p>Foo Bar
11807 </p><p>Foo
11808 Bar
11809 </p>
11810 !! end
11811
11812 !! test
11813 Parsoid: Serialize link to category page with colon escape
11814 !! options
11815 parsoid
11816 !! wikitext
11817
11818 [[:Category:Foo]]
11819 [[:Category:Foo|Bar]]
11820 !! html
11821 <p>
11822 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11823 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11824 </p>
11825 !! end
11826
11827 !! test
11828 Parsoid: Link prefix/suffixes aren't applied to category links
11829 !! options
11830 parsoid=wt2html,wt2wt,html2html
11831 language=is
11832 !! wikitext
11833 x[[Category:Foo]]y
11834 !! html
11835 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11836 !! end
11837
11838 !! test
11839 Parsoid: Serialize link to file page with colon escape
11840 !! options
11841 parsoid
11842 !! wikitext
11843
11844 [[:File:Foo.png]]
11845 [[:File:Foo.png|Bar]]
11846 !! html
11847 <p>
11848 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11849 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11850 </p>
11851 !! end
11852
11853 !! test
11854 Parsoid: Serialize a genuine category link without colon escape
11855 !! options
11856 parsoid
11857 !! wikitext
11858 [[Category:Foo]]
11859 [[Category:Foo|Bar]]
11860 !! html
11861 <link rel="mw:PageProp/Category" href="Category:Foo">
11862 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11863 !! end
11864
11865 !! test
11866 Parsoid: Defaultsort
11867 !! options
11868 parsoid
11869 !! wikitext
11870 {{DEFAULTSORT:Foo}}
11871 !! html
11872 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11873 !! end
11874
11875 ###
11876 ### Inter-language links
11877 ###
11878 !! test
11879 Inter-language links
11880 !! options
11881 ill
11882 !! wikitext
11883 [[es:Alimento]]
11884 [[fr:Nourriture]]
11885 [[zh:&#39135;&#21697;]]
11886 !! html
11887 es:Alimento fr:Nourriture zh:食品
11888 !! end
11889
11890 !! test
11891 Duplicate interlanguage links (bug 24502)
11892 !! options
11893 ill
11894 !! wikitext
11895 [[es:1]]
11896 [[es:2]]
11897 [[fr:1]]
11898 [[fr:2]]
11899 !! html
11900 es:1 fr:1
11901 !! end
11902
11903 ###
11904 ### Sections
11905 ###
11906 !! test
11907 Basic section headings
11908 !! wikitext
11909 == Headline 1 ==
11910 Some text
11911
11912 ==Headline 2==
11913 More
11914 ===Smaller headline===
11915 Blah blah
11916 !! html
11917 <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>
11918 <p>Some text
11919 </p>
11920 <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>
11921 <p>More
11922 </p>
11923 <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>
11924 <p>Blah blah
11925 </p>
11926 !! end
11927
11928 !! test
11929 Section headings with TOC
11930 !! wikitext
11931 == Headline 1 ==
11932 === Subheadline 1 ===
11933 ===== Skipping a level =====
11934 ====== Skipping a level ======
11935
11936 == Headline 2 ==
11937 Some text
11938 ===Another headline===
11939 !! html
11940 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11941 <ul>
11942 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
11943 <ul>
11944 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
11945 <ul>
11946 <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>
11947 <ul>
11948 <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>
11949 </ul>
11950 </li>
11951 </ul>
11952 </li>
11953 </ul>
11954 </li>
11955 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
11956 <ul>
11957 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
11958 </ul>
11959 </li>
11960 </ul>
11961 </div>
11962
11963 <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>
11964 <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>
11965 <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>
11966 <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>
11967 <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>
11968 <p>Some text
11969 </p>
11970 <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>
11971
11972 !! end
11973
11974 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
11975 !! test
11976 Handling of sections up to level 6 and beyond
11977 !! wikitext
11978 = Level 1 Heading=
11979 == Level 2 Heading==
11980 === Level 3 Heading===
11981 ==== Level 4 Heading====
11982 ===== Level 5 Heading=====
11983 ====== Level 6 Heading======
11984 ======= Level 7 Heading=======
11985 ======== Level 8 Heading========
11986 ========= Level 9 Heading=========
11987 ========== Level 10 Heading==========
11988 !! html
11989 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11990 <ul>
11991 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
11992 <ul>
11993 <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>
11994 <ul>
11995 <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>
11996 <ul>
11997 <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>
11998 <ul>
11999 <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>
12000 <ul>
12001 <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>
12002 <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>
12003 <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>
12004 <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>
12005 <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>
12006 </ul>
12007 </li>
12008 </ul>
12009 </li>
12010 </ul>
12011 </li>
12012 </ul>
12013 </li>
12014 </ul>
12015 </li>
12016 </ul>
12017 </div>
12018
12019 <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>
12020 <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>
12021 <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>
12022 <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>
12023 <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>
12024 <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>
12025 <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>
12026 <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>
12027 <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>
12028 <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>
12029
12030 !! end
12031
12032 !! test
12033 TOC regression (bug 9764)
12034 !! wikitext
12035 == title 1 ==
12036 === title 1.1 ===
12037 ==== title 1.1.1 ====
12038 === title 1.2 ===
12039 == title 2 ==
12040 === title 2.1 ===
12041 !! html
12042 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12043 <ul>
12044 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12045 <ul>
12046 <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>
12047 <ul>
12048 <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>
12049 </ul>
12050 </li>
12051 <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>
12052 </ul>
12053 </li>
12054 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12055 <ul>
12056 <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>
12057 </ul>
12058 </li>
12059 </ul>
12060 </div>
12061
12062 <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>
12063 <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>
12064 <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>
12065 <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>
12066 <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>
12067 <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>
12068
12069 !! end
12070
12071 !! test
12072 TOC with wgMaxTocLevel=3 (bug 6204)
12073 !! options
12074 wgMaxTocLevel=3
12075 !! wikitext
12076 == title 1 ==
12077 === title 1.1 ===
12078 ==== title 1.1.1 ====
12079 === title 1.2 ===
12080 == title 2 ==
12081 === title 2.1 ===
12082 !! html
12083 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12084 <ul>
12085 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12086 <ul>
12087 <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>
12088 <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>
12089 </ul>
12090 </li>
12091 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12092 <ul>
12093 <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>
12094 </ul>
12095 </li>
12096 </ul>
12097 </div>
12098
12099 <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>
12100 <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>
12101 <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>
12102 <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>
12103 <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>
12104 <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>
12105
12106 !! end
12107
12108 !! test
12109 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
12110 !! options
12111 wgMaxTocLevel=3
12112 !! wikitext
12113 ==Section 1==
12114 ===Section 1.1===
12115 ====Section 1.1.1====
12116 ====Section 1.1.1.1====
12117 ==Section 2==
12118 !! html
12119 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12120 <ul>
12121 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
12122 <ul>
12123 <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>
12124 </ul>
12125 </li>
12126 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
12127 </ul>
12128 </div>
12129
12130 <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>
12131 <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>
12132 <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>
12133 <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>
12134 <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>
12135
12136 !! end
12137
12138
12139 !! test
12140 Resolving duplicate section names
12141 !! wikitext
12142 == Foo bar ==
12143 == Foo bar ==
12144 !! html
12145 <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>
12146 <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>
12147
12148 !! end
12149
12150 !! test
12151 Resolving duplicate section names with differing case (bug 10721)
12152 !! wikitext
12153 == Foo bar ==
12154 == Foo Bar ==
12155 !! html
12156 <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>
12157 <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>
12158
12159 !! end
12160
12161 !! article
12162 Template:sections
12163 !! text
12164 ===Section 1===
12165 ==Section 2==
12166 !! endarticle
12167
12168 !! test
12169 Template with sections, __NOTOC__
12170 !! wikitext
12171 __NOTOC__
12172 ==Section 0==
12173 {{sections}}
12174 ==Section 4==
12175 !! html
12176 <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>
12177 <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>
12178 <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>
12179 <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>
12180
12181 !! end
12182
12183 !! test
12184 __NOEDITSECTION__ keyword
12185 !! wikitext
12186 __NOEDITSECTION__
12187 ==Section 1==
12188 ==Section 2==
12189 !! html
12190 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
12191 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
12192
12193 !! end
12194
12195 !! test
12196 Link inside a section heading
12197 !! wikitext
12198 ==Section with a [[Main Page|link]] in it==
12199 !! html
12200 <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>
12201
12202 !! end
12203
12204 !! test
12205 TOC regression (bug 12077)
12206 !! wikitext
12207 __TOC__
12208 == title 1 ==
12209 === title 1.1 ===
12210 == title 2 ==
12211 !! html
12212 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12213 <ul>
12214 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12215 <ul>
12216 <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>
12217 </ul>
12218 </li>
12219 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
12220 </ul>
12221 </div>
12222
12223 <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>
12224 <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>
12225 <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>
12226
12227 !! end
12228
12229 !! test
12230 BUG 1219 URL next to image (good)
12231 !! wikitext
12232 http://example.com [[Image:foobar.jpg]]
12233 !! html
12234 <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>
12235 </p>
12236 !!end
12237
12238 !! test
12239 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
12240 !! wikitext
12241 ===
12242 The line above must have a trailing space!
12243 === <!--
12244 --> <!-- -->
12245 But just in case it doesn't...
12246 !! html
12247 <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>
12248 <p>The line above must have a trailing space!
12249 </p>
12250 <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>
12251 <p>But just in case it doesn't...
12252 </p>
12253 !! end
12254
12255 !! test
12256 Header with special characters (bug 25462)
12257 !! wikitext
12258 The tooltips shall not show entities to the user (ie. be double escaped)
12259
12260 == text > text ==
12261 section 1
12262
12263 == text < text ==
12264 section 2
12265
12266 == text & text ==
12267 section 3
12268
12269 == text ' text ==
12270 section 4
12271
12272 == text " text ==
12273 section 5
12274 !! html
12275 <p>The tooltips shall not show entities to the user (ie. be double escaped)
12276 </p>
12277 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12278 <ul>
12279 <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>
12280 <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>
12281 <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>
12282 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
12283 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
12284 </ul>
12285 </div>
12286
12287 <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>
12288 <p>section 1
12289 </p>
12290 <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>
12291 <p>section 2
12292 </p>
12293 <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>
12294 <p>section 3
12295 </p>
12296 <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>
12297 <p>section 4
12298 </p>
12299 <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>
12300 <p>section 5
12301 </p>
12302 !! end
12303
12304 !! test
12305 Headers with excess '=' characters
12306 (Are similar tests necessary beyond the 1st level?)
12307 !! wikitext
12308 =foo==
12309 ==foo=
12310 =''italic'' heading==
12311 ==''italic'' heading=
12312 !! html
12313 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12314 <ul>
12315 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
12316 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
12317 <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>
12318 <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>
12319 </ul>
12320 </div>
12321
12322 <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>
12323 <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>
12324 <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>
12325 <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>
12326
12327 !! end
12328
12329 !! test
12330 HTML headers vs TOC (bug 23393)
12331 (__NOEDITSECTION__ for clearer output, doesn't matter here)
12332 !! wikitext
12333 <h1>Header 1</h1>
12334 == Header 1.1 ==
12335 == Header 1.2 ==
12336
12337 <h1>Header 2
12338 </h1>
12339 == Header 2.1 ==
12340 == Header 2.2 ==
12341 __NOEDITSECTION__
12342 !! html
12343 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12344 <ul>
12345 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
12346 <ul>
12347 <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>
12348 <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>
12349 </ul>
12350 </li>
12351 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
12352 <ul>
12353 <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>
12354 <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>
12355 </ul>
12356 </li>
12357 </ul>
12358 </div>
12359
12360 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
12361 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
12362 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
12363 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
12364 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
12365 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
12366
12367 !! end
12368
12369 !! test
12370 Single-line or multiline-comments can follow headings
12371 !! options
12372 parsoid=wt2html,wt2wt
12373 !! wikitext
12374 ==foo==<!---->
12375 ==bar==<!--c1-->
12376 ==baz==<!--
12377 c2
12378 c3-->
12379 !! html
12380 <h2><span class="mw-headline" id="foo">foo</span></h2>
12381 <h2><span class="mw-headline" id="bar">bar</span></h2>
12382 <h2><span class="mw-headline" id="baz">baz</span></h2>
12383
12384 !! end
12385
12386 !! test
12387 BUG 1219 URL next to image (broken)
12388 !! wikitext
12389 http://example.com[[Image:foobar.jpg]]
12390 !! html
12391 <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>
12392 </p>
12393 !!end
12394
12395 !! test
12396 Bug 1186 news: in the middle of text
12397 !! wikitext
12398 http://en.wikinews.org/wiki/Wikinews:Workplace
12399 !! html
12400 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
12401 </p>
12402 !!end
12403
12404
12405 !! test
12406 Namespaced link must have a title
12407 !! wikitext
12408 [[Project:]]
12409 !! html
12410 <p>[[Project:]]
12411 </p>
12412 !!end
12413
12414 !! test
12415 Namespaced link must have a title (bad fragment version)
12416 !! wikitext
12417 [[Project:#fragment]]
12418 !! html
12419 <p>[[Project:#fragment]]
12420 </p>
12421 !!end
12422
12423
12424 ###
12425 ### HTML tags and HTML attributes
12426 ###
12427
12428 !! test
12429 div with no attributes
12430 !! wikitext
12431 <div>HTML rocks</div>
12432 !! html
12433 <div>HTML rocks</div>
12434
12435 !! end
12436
12437 !! test
12438 div with double-quoted attribute
12439 !! wikitext
12440 <div id="rock">HTML rocks</div>
12441 !! html
12442 <div id="rock">HTML rocks</div>
12443
12444 !! end
12445
12446 !! test
12447 div with single-quoted attribute
12448 !! wikitext
12449 <div id='rock'>HTML rocks</div>
12450 !! html
12451 <div id="rock">HTML rocks</div>
12452
12453 !! end
12454
12455 !! test
12456 div with unquoted attribute
12457 !! wikitext
12458 <div id=rock>HTML rocks</div>
12459 !! html
12460 <div id="rock">HTML rocks</div>
12461
12462 !! end
12463
12464 !! test
12465 div with illegal double attributes
12466 !! wikitext
12467 <div id="a" id="b">HTML rocks</div>
12468 !! html
12469 <div id="b">HTML rocks</div>
12470
12471 !!end
12472
12473 # FIXME: produce empty string instead of "class" in the PHP parser, following
12474 # the HTML5 spec.
12475 !! test
12476 div with empty attribute value, space before equals
12477 !! options
12478 parsoid
12479 !! wikitext
12480 <div class =>HTML rocks</div>
12481 !! html
12482 <div class="">HTML rocks</div>
12483
12484 !! end
12485
12486 # The PHP parser escapes the opening brace to &#123; for some reason, so
12487 # disabled this test for it.
12488 !! test
12489 div with braces in attribute value
12490 !! options
12491 parsoid
12492 !! wikitext
12493 <div title="{}">Foo</div>
12494 !! html
12495 <div title="{}">Foo</div>
12496 !! end
12497
12498 # This it very inconsistent in the PHP parser: it returns
12499 # class="class" if there is a space between the name and the equal sign (see
12500 # 'div with empty attribute value, space before equals'), but strips the
12501 # attribute completely if the space is missing. We hope that not much content
12502 # depends on this, so are implementing the behavior below in Parsoid for
12503 # consistencies' sake. Disabled for the PHP parser.
12504 # FIXME: fix this behavior in the PHP parser?
12505 !! test
12506 div with empty attribute value, no space before equals
12507 !! options
12508 parsoid
12509 !! wikitext
12510 <div class=>HTML rocks</div>
12511 !! html
12512 <div class="">HTML rocks</div>
12513
12514 !! end
12515
12516 !! test
12517 HTML multiple attributes correction
12518 !! wikitext
12519 <p class="error" class="awesome">Awesome!</p>
12520 !! html
12521 <p class="awesome">Awesome!</p>
12522
12523 !!end
12524
12525 !! test
12526 Table multiple attributes correction
12527 !! wikitext
12528 {|
12529 !+ class="error" class="awesome"| status
12530 |}
12531 !! html
12532 <table>
12533 <tr>
12534 <th class="awesome"> status
12535 </th></tr></table>
12536
12537 !!end
12538
12539 !! test
12540 DIV IN UPPERCASE
12541 !! wikitext
12542 <DIV ID="x">HTML ROCKS</DIV>
12543 !! html
12544 <div id="x">HTML ROCKS</div>
12545
12546 !!end
12547
12548 !! test
12549 Non-ASCII pseudo-tags are rendered as text
12550 !! wikitext
12551 <khyô>
12552 !! html
12553 <p>&lt;khyô&gt;
12554 </p>
12555 !! end
12556
12557 !! test
12558 Pseudo-tag with URL 'name' renders as url link
12559 !! wikitext
12560 <http://example.com/>
12561 !! html
12562 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
12563 </p>
12564 !! end
12565
12566 !! test
12567 text with amp in the middle of nowhere
12568 !! wikitext
12569 Remember AT&T?
12570 !! html
12571 <p>Remember AT&amp;T?
12572 </p>
12573 !! end
12574
12575 !! test
12576 text with character entity: eacute
12577 !! wikitext
12578 I always thought &eacute; was a cute letter.
12579 !! html
12580 <p>I always thought &#233; was a cute letter.
12581 </p>
12582 !! end
12583
12584 !! test
12585 text with entity-escaped character entity-like string: eacute
12586 !! wikitext
12587 I always thought &amp;eacute; was a cute letter.
12588 !! html
12589 <p>I always thought &amp;eacute; was a cute letter.
12590 </p>
12591 !! end
12592
12593 !! test
12594 text with undefined character entity: xacute
12595 !! wikitext
12596 I always thought &xacute; was a cute letter.
12597 !! html
12598 <p>I always thought &amp;xacute; was a cute letter.
12599 </p>
12600 !! end
12601
12602 # TODO: generalize to PHP parser?
12603 !! test
12604 HTML5 tags
12605 !! options
12606 parsoid
12607 !! wikitext
12608 <data value="5">five</data>
12609 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12610 <mark>This highlighted text</mark>
12611 !! html
12612 <p><data value="5">five</data>
12613 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12614 <mark>This highlighted text</mark></p>
12615 !! end
12616
12617 !! test
12618 HTML tag with leading space is parsed as text
12619 !! wikitext
12620 < div>foo< /div>
12621 !! html
12622 <p>&lt; div&gt;foo&lt; /div&gt;
12623 </p>
12624 !! end
12625
12626 ###
12627 ### Nesting tests (see bug 41545, 50604, 51081)
12628 ###
12629
12630 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
12631 # Note that html2wt is considerably more difficult if we use <b> in
12632 # the test case, instead of <big>
12633 !! test
12634 Ensure that HTML adoption agency algorithm is properly implemented.
12635 !! wikitext
12636 <big>X<big>Y</big>Z</big>
12637 !! html
12638 <p><big>X<big>Y</big>Z</big>
12639 </p>
12640 !! end
12641
12642 # This was bug 41545 in the PHP parser.
12643 !! test
12644 Nesting of <kbd>
12645 !! wikitext
12646 <kbd>X<kbd>Y</kbd>Z</kbd>
12647 !! html
12648 <p><kbd>X<kbd>Y</kbd>Z</kbd>
12649 </p>
12650 !! end
12651
12652 # The following cases were bug 51081 in the PHP parser.
12653 # Note that there are some other nestable tags (b, i, etc) which are
12654 # not covered; see bug 51081 for discussion.
12655 !! test
12656 Nesting of <em>
12657 !! wikitext
12658 <em>X<em>Y</em>Z</em>
12659 !! html
12660 <p><em>X<em>Y</em>Z</em>
12661 </p>
12662 !! end
12663
12664 !! test
12665 Nesting of <strong>
12666 !! wikitext
12667 <strong>X<strong>Y</strong>Z</strong>
12668 !! html
12669 <p><strong>X<strong>Y</strong>Z</strong>
12670 </p>
12671 !! end
12672
12673 !! test
12674 Nesting of <q>
12675 !! wikitext
12676 <q>X<q>Y</q>Z</q>
12677 !! html
12678 <p><q>X<q>Y</q>Z</q>
12679 </p>
12680 !! end
12681
12682 !! test
12683 Nesting of <ruby>
12684 !! wikitext
12685 <ruby>X<ruby>Y</ruby>Z</ruby>
12686 !! html
12687 <p><ruby>X<ruby>Y</ruby>Z</ruby>
12688 </p>
12689 !! end
12690
12691 !! test
12692 Nesting of <bdo>
12693 !! wikitext
12694 <bdo>X<bdo>Y</bdo>Z</bdo>
12695 !! html
12696 <p><bdo>X<bdo>Y</bdo>Z</bdo>
12697 </p>
12698 !! end
12699
12700
12701 ###
12702 ### Media links
12703 ###
12704
12705 !! test
12706 Media link
12707 !! wikitext
12708 [[Media:Foobar.jpg]]
12709 !! html
12710 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
12711 </p>
12712 !! end
12713
12714 !! test
12715 Media link with text
12716 !! wikitext
12717 [[Media:Foobar.jpg|A neat file to look at]]
12718 !! html
12719 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
12720 </p>
12721 !! end
12722
12723 # FIXME: this is still bad HTML tag nesting
12724 !! test
12725 Media link with nasty text
12726 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
12727 !! wikitext
12728 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12729 !! html
12730 <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>
12731
12732 !! end
12733
12734 !! test
12735 Media link to nonexistent file (bug 1702)
12736 !! wikitext
12737 [[Media:No such.jpg]]
12738 !! html
12739 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12740 </p>
12741 !! end
12742
12743 !! test
12744 Image link to nonexistent file (bug 1850 - good)
12745 !! wikitext
12746 [[Image:No such.jpg]]
12747 !! html
12748 <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>
12749 </p>
12750 !! end
12751
12752 !! test
12753 :Image link to nonexistent file (bug 1850 - bad)
12754 !! wikitext
12755 [[:Image:No such.jpg]]
12756 !! html
12757 <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>
12758 </p>
12759 !! end
12760
12761
12762
12763 !! test
12764 Character reference normalization in link text (bug 1938)
12765 !! wikitext
12766 [[Main Page|this&that]]
12767 !! html
12768 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12769 </p>
12770 !!end
12771
12772 !! article
12773 אַ
12774 !! text
12775 Test for unicode normalization
12776
12777 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12778 !! endarticle
12779
12780 !! test
12781 (bug 19451) Links should refer to the normalized form.
12782 !! wikitext
12783 [[&#xFB2E;]]
12784 [[&#x5d0;&#x5b7;]]
12785 [[&#x5d0;ַ]]
12786 [[א&#x5b7;]]
12787 [[אַ]]
12788 !! html
12789 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12790 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12791 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12792 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12793 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12794 </p>
12795 !! end
12796
12797 !! test
12798 Empty attribute crash test (bug 2067)
12799 !! wikitext
12800 <font color="">foo</font>
12801 !! html
12802 <p><font color="">foo</font>
12803 </p>
12804 !! end
12805
12806 !! test
12807 Empty attribute crash test single-quotes (bug 2067)
12808 !! wikitext
12809 <font color=''>foo</font>
12810 !! html
12811 <p><font color="">foo</font>
12812 </p>
12813 !! end
12814
12815 !! test
12816 Attribute test: equals, then nothing
12817 !! wikitext
12818 <font color=>foo</font>
12819 !! html
12820 <p><font>foo</font>
12821 </p>
12822 !! end
12823
12824 !! test
12825 Attribute test: unquoted value
12826 !! wikitext
12827 <font color=x>foo</font>
12828 !! html
12829 <p><font color="x">foo</font>
12830 </p>
12831 !! end
12832
12833 !! test
12834 Attribute test: unquoted but illegal value (hash)
12835 !! wikitext
12836 <font color=#x>foo</font>
12837 !! html
12838 <p><font color="#x">foo</font>
12839 </p>
12840 !! end
12841
12842 !! test
12843 Attribute test: no value
12844 !! wikitext
12845 <font color>foo</font>
12846 !! html
12847 <p><font color="color">foo</font>
12848 </p>
12849 !! end
12850
12851 !! test
12852 Bug 2095: link with three closing brackets
12853 !! wikitext
12854 [[Main Page]]]
12855 !! html/php
12856 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12857 </p>
12858 !! html/parsoid
12859 <p><a rel="mw:WikiLink" href="./Main_Page">Main Page</a>]</p>
12860 !! end
12861
12862 !! test
12863 Bug 2095: link with pipe and three closing brackets
12864 !! wikitext
12865 [[Main Page|link]]]
12866 !! html/php
12867 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12868 </p>
12869 !! html/parsoid
12870 <p><a rel="mw:WikiLink" href="./Main_Page">link</a>]</p>
12871 !! end
12872
12873 !! test
12874 Bug 2095: link with pipe and three closing brackets, version 2
12875 !! wikitext
12876 [[Main Page|[http://example.com/]]]
12877 !! html/php
12878 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12879 </p>
12880 !! html/parsoid
12881 <p><a rel="mw:WikiLink" href="./Main_Page">[http://example.com/]</a></p>
12882 !! end
12883
12884
12885 ###
12886 ### Safety
12887 ###
12888
12889 !! article
12890 Template:Dangerous attribute
12891 !! text
12892 " onmouseover="alert(document.cookie)
12893 !! endarticle
12894
12895 !! article
12896 Template:Dangerous style attribute
12897 !! text
12898 border-size: expression(alert(document.cookie))
12899 !! endarticle
12900
12901 !! article
12902 Template:Div style
12903 !! text
12904 <div style="float: right; {{{1}}}">Magic div</div>
12905 !! endarticle
12906
12907 !! test
12908 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
12909 !! wikitext
12910 <div title="{{test}}"></div>
12911 !! html
12912 <div title="This is a test template"></div>
12913
12914 !! end
12915
12916 !! test
12917 Bug 2304: HTML attribute safety (dangerous template; 2309)
12918 !! wikitext
12919 <div title="{{dangerous attribute}}"></div>
12920 !! html
12921 <div title=""></div>
12922
12923 !! end
12924
12925 !! test
12926 Bug 2304: HTML attribute safety (dangerous style template; 2309)
12927 !! wikitext
12928 <div style="{{dangerous style attribute}}"></div>
12929 !! html
12930 <div style="/* insecure input */"></div>
12931
12932 !! end
12933
12934 !! test
12935 Bug 2304: HTML attribute safety (safe parameter; 2309)
12936 !! wikitext
12937 {{div style|width: 200px}}
12938 !! html
12939 <div style="float: right; width: 200px">Magic div</div>
12940
12941 !! end
12942
12943 !! test
12944 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
12945 !! wikitext
12946 {{div style|width: expression(alert(document.cookie))}}
12947 !! html
12948 <div style="/* insecure input */">Magic div</div>
12949
12950 !! end
12951
12952 !! test
12953 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
12954 !! wikitext
12955 {{div style|"><script>alert(document.cookie)</script>}}
12956 !! html
12957 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12958
12959 !! end
12960
12961 !! test
12962 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
12963 !! wikitext
12964 {{div style|" ><script>alert(document.cookie)</script>}}
12965 !! html
12966 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12967
12968 !! end
12969
12970 !! test
12971 Bug 2304: HTML attribute safety (link)
12972 !! wikitext
12973 <div title="[[Main Page]]"></div>
12974 !! html
12975 <div title="&#91;&#91;Main Page]]"></div>
12976
12977 !! end
12978
12979 !! test
12980 Bug 2304: HTML attribute safety (italics)
12981 !! wikitext
12982 <div title="''foobar''"></div>
12983 !! html
12984 <div title="&#39;&#39;foobar&#39;&#39;"></div>
12985
12986 !! end
12987
12988 !! test
12989 Bug 2304: HTML attribute safety (bold)
12990 !! wikitext
12991 <div title="'''foobar'''"></div>
12992 !! html
12993 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
12994
12995 !! end
12996
12997
12998 !! test
12999 Bug 2304: HTML attribute safety (ISBN)
13000 !! wikitext
13001 <div title="ISBN 1234567890"></div>
13002 !! html
13003 <div title="&#73;SBN 1234567890"></div>
13004
13005 !! end
13006
13007 !! test
13008 Bug 2304: HTML attribute safety (RFC)
13009 !! wikitext
13010 <div title="RFC 1234"></div>
13011 !! html
13012 <div title="&#82;FC 1234"></div>
13013
13014 !! end
13015
13016 !! test
13017 Bug 2304: HTML attribute safety (PMID)
13018 !! wikitext
13019 <div title="PMID 1234567890"></div>
13020 !! html
13021 <div title="&#80;MID 1234567890"></div>
13022
13023 !! end
13024
13025 !! test
13026 Bug 2304: HTML attribute safety (web link)
13027 !! wikitext
13028 <div title="http://example.com/"></div>
13029 !! html
13030 <div title="http&#58;//example.com/"></div>
13031
13032 !! end
13033
13034 !! test
13035 Bug 2304: HTML attribute safety (named web link)
13036 !! wikitext
13037 <div title="[http://example.com/ link]"></div>
13038 !! html
13039 <div title="&#91;http&#58;//example.com/ link]"></div>
13040
13041 !! end
13042
13043 !! test
13044 Bug 3244: HTML attribute safety (extension; safe)
13045 !! wikitext
13046 <div style="<nowiki>background:blue</nowiki>"></div>
13047 !! html
13048 <div style="background:blue"></div>
13049
13050 !! end
13051
13052 !! test
13053 Bug 3244: HTML attribute safety (extension; unsafe)
13054 !! wikitext
13055 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
13056 !! html
13057 <div style="/* insecure input */"></div>
13058
13059 !! end
13060
13061 # More MSIE fun discovered by Tom Gilder
13062
13063 !! test
13064 MSIE CSS safety test: spurious slash
13065 !! wikitext
13066 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
13067 !! html
13068 <div style="/* insecure input */">evil</div>
13069
13070 !! end
13071
13072 !! test
13073 MSIE CSS safety test: hex code
13074 !! wikitext
13075 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
13076 !! html
13077 <div style="/* insecure input */">evil</div>
13078
13079 !! end
13080
13081 !! test
13082 MSIE CSS safety test: comment in url
13083 !! wikitext
13084 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
13085 !! html
13086 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
13087
13088 !! end
13089
13090 !! test
13091 MSIE CSS safety test: comment in expression
13092 !! wikitext
13093 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
13094 !! html
13095 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
13096
13097 !! end
13098
13099 !! test
13100 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
13101 !! wikitext
13102 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
13103 !! html
13104 <p style="/* invalid control char */">A</p>
13105
13106 !! end
13107
13108 !! test
13109 MSIE 6 CSS safety test: Fullwidth (bug 55332)
13110 !! wikitext
13111 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
13112 <div style="top:EXPRESSION(alert())">B</div>
13113 !! html
13114 <p style="/* insecure input */">A</p>
13115 <div style="/* insecure input */">B</div>
13116
13117 !! end
13118
13119 !! test
13120 MSIE 6 CSS safety test: IPA extensions (bug 55332)
13121 !! wikitext
13122 <div style="background-image:uʀʟ(javascript:alert())">A</div>
13123 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
13124 !! html
13125 <div style="/* insecure input */">A</div>
13126 <p style="/* insecure input */">B</p>
13127
13128 !! end
13129
13130 !! test
13131 MSIE 6 CSS safety test: sup/sub script (bug 55332)
13132 !! wikitext
13133 <div style="background-image:url⁽javascript:alert())">A</div>
13134 <div style="background-image:url₍javascript:alert())">B</div>
13135 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
13136 !! html
13137 <div style="/* insecure input */">A</div>
13138 <div style="/* insecure input */">B</div>
13139 <p style="/* insecure input */">C</p>
13140
13141 !! end
13142
13143 !! test
13144 Opera -o-link CSS
13145 !! wikitext
13146 <div
13147 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;"
13148 style="-o-link:attr(title);-o-link-source:current">X</div>
13149 !! html
13150 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
13151
13152 !! end
13153
13154 !! test
13155 MSIE 6 CSS safety test: Repetition markers (bug 55332)
13156 !! wikitext
13157 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
13158 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
13159 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
13160 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
13161 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
13162 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
13163 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
13164 !! html
13165 <p style="/* insecure input */">A</p>
13166 <p style="/* insecure input */">B</p>
13167 <p style="/* insecure input */">C</p>
13168 <p style="/* insecure input */">D</p>
13169 <p style="/* insecure input */">E</p>
13170 <p style="/* insecure input */">F</p>
13171 <p style="/* insecure input */">G</p>
13172
13173 !! end
13174
13175 !! test
13176 Table attribute legitimate extension
13177 !! wikitext
13178 {|
13179 !+ style="<nowiki>color:blue</nowiki>"| status
13180 |}
13181 !! html
13182 <table>
13183 <tr>
13184 <th style="color:blue"> status
13185 </th></tr></table>
13186
13187 !!end
13188
13189 !! test
13190 Table attribute safety
13191 !! wikitext
13192 {|
13193 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
13194 |}
13195 !! html
13196 <table>
13197 <tr>
13198 <th style="/* insecure input */"> status
13199 </th></tr></table>
13200
13201 !! end
13202
13203 !! test
13204 CSS line continuation 1
13205 !! wikitext
13206 <div style="background-image: u\&#10;rl(test.jpg);"></div>
13207 !! html
13208 <div style="/* insecure input */"></div>
13209
13210 !! end
13211
13212 !! test
13213 CSS line continuation 2
13214 !! wikitext
13215 <div style="background-image: u\&#13;rl(test.jpg); "></div>
13216 !! html
13217 <div style="/* insecure input */"></div>
13218
13219 !! end
13220
13221 !! article
13222 Template:Identity
13223 !! text
13224 {{{1}}}
13225 !! endarticle
13226
13227 !! test
13228 Expansion of multi-line templates in attribute values (bug 6255)
13229 !! wikitext
13230 <div style="background: {{identity|#00FF00}}">-</div>
13231 !! html
13232 <div style="background: #00FF00">-</div>
13233
13234 !! end
13235
13236
13237 !! test
13238 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
13239 !! wikitext
13240 <div style="background:
13241 #00FF00">-</div>
13242 !! html
13243 <div style="background: #00FF00">-</div>
13244
13245 !! end
13246
13247 !! test
13248 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
13249 !! wikitext
13250 <div style="background: &#10;#00FF00">-</div>
13251 !! html
13252 <div style="background: &#10;#00FF00">-</div>
13253
13254 !! end
13255
13256 ###
13257 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
13258 ###
13259 !! test
13260 Parser hook: empty input
13261 !! wikitext
13262 <tag></tag>
13263 !! html
13264 <pre>
13265 ''
13266 array (
13267 )
13268 </pre>
13269
13270 !! end
13271
13272 !! test
13273 Parser hook: empty input using terminated empty elements
13274 !! wikitext
13275 <tag/>
13276 !! html
13277 <pre>
13278 NULL
13279 array (
13280 )
13281 </pre>
13282
13283 !! end
13284
13285 !! test
13286 Parser hook: empty input using terminated empty elements (space before)
13287 !! wikitext
13288 <tag />
13289 !! html
13290 <pre>
13291 NULL
13292 array (
13293 )
13294 </pre>
13295
13296 !! end
13297
13298 !! test
13299 Parser hook: basic input
13300 !! wikitext
13301 <tag>input</tag>
13302 !! html
13303 <pre>
13304 'input'
13305 array (
13306 )
13307 </pre>
13308
13309 !! end
13310
13311
13312 !! test
13313 Parser hook: case insensitive
13314 !! wikitext
13315 <TAG>input</TAG>
13316 !! html
13317 <pre>
13318 'input'
13319 array (
13320 )
13321 </pre>
13322
13323 !! end
13324
13325
13326 !! test
13327 Parser hook: case insensitive, redux
13328 !! wikitext
13329 <TaG>input</TAg>
13330 !! html
13331 <pre>
13332 'input'
13333 array (
13334 )
13335 </pre>
13336
13337 !! end
13338
13339 !! test
13340 Parser hook: nested tags
13341 !! options
13342 noxml
13343 !! wikitext
13344 <tag><tag></tag></tag>
13345 !! html
13346 <pre>
13347 '<tag>'
13348 array (
13349 )
13350 </pre>&lt;/tag&gt;
13351
13352 !! end
13353
13354 !! test
13355 Parser hook: basic arguments
13356 !! wikitext
13357 <tag width=200 height = "100" depth = '50' square></tag>
13358 !! html
13359 <pre>
13360 ''
13361 array (
13362 'width' => '200',
13363 'height' => '100',
13364 'depth' => '50',
13365 'square' => 'square',
13366 )
13367 </pre>
13368
13369 !! end
13370
13371 !! test
13372 Parser hook: argument containing a forward slash (bug 5344)
13373 !! wikitext
13374 <tag filename='/tmp/bla'></tag>
13375 !! html
13376 <pre>
13377 ''
13378 array (
13379 'filename' => '/tmp/bla',
13380 )
13381 </pre>
13382
13383 !! end
13384
13385 !! test
13386 Parser hook: empty input using terminated empty elements (bug 2374)
13387 !! wikitext
13388 <tag foo=bar/>text
13389 !! html
13390 <pre>
13391 NULL
13392 array (
13393 'foo' => 'bar',
13394 )
13395 </pre>text
13396
13397 !! end
13398
13399 # </tag> should be output literally since there is no matching tag that begins it
13400 !! test
13401 Parser hook: basic arguments using terminated empty elements (bug 2374)
13402 !! wikitext
13403 <tag width=200 height = "100" depth = '50' square/>
13404 other stuff
13405 </tag>
13406 !! html
13407 <pre>
13408 NULL
13409 array (
13410 'width' => '200',
13411 'height' => '100',
13412 'depth' => '50',
13413 'square' => 'square',
13414 )
13415 </pre>
13416 <p>other stuff
13417 &lt;/tag&gt;
13418 </p>
13419 !! end
13420
13421 ###
13422 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
13423 ###
13424
13425 !! test
13426 Parser hook: static parser hook not inside a comment
13427 !! wikitext
13428 <statictag>hello, world</statictag>
13429 <statictag action=flush/>
13430 !! html
13431 <p>hello, world
13432 </p>
13433 !! end
13434
13435
13436 !! test
13437 Parser hook: static parser hook inside a comment
13438 !! wikitext
13439 <!-- <statictag>hello, world</statictag> -->
13440 <statictag action=flush/>
13441 !! html
13442 <p><br />
13443 </p>
13444 !! end
13445
13446 # Nested template calls; this case was broken by Parser.php rev 1.506,
13447 # since reverted.
13448
13449 !! article
13450 Template:One-parameter
13451 !! text
13452 (My parameter is: {{{1}}})
13453 !! endarticle
13454
13455 !! article
13456 Template:Map-one-parameter
13457 !! text
13458 {{{{{1}}}|{{{2}}}}}
13459 !! endarticle
13460
13461 !! test
13462 Nested template calls
13463 !! wikitext
13464 {{Map-one-parameter|One-parameter|param}}
13465 !! html
13466 <p>(My parameter is: param)
13467 </p>
13468 !! end
13469
13470
13471 ###
13472 ### Sanitizer
13473 ###
13474 !! test
13475 Sanitizer: Closing of open tags
13476 !! wikitext
13477 <s></s><table></table>
13478 !! html
13479 <s></s><table></table>
13480
13481 !! end
13482
13483 !! test
13484 Sanitizer: Closing of open but not closed tags
13485 !! wikitext
13486 <s>foo
13487 !! html
13488 <p><s>foo</s>
13489 </p>
13490 !! end
13491
13492 !! test
13493 Sanitizer: Closing of closed but not open tags
13494 !! wikitext
13495 </s>
13496 !! html
13497 <p>&lt;/s&gt;
13498 </p>
13499 !! end
13500
13501 !! test
13502 Sanitizer: Closing of closed but not open table tags
13503 !! wikitext
13504 Table not started</td></tr></table>
13505 !! html
13506 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
13507 </p>
13508 !! end
13509
13510 !! test
13511 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
13512 !! wikitext
13513 <span id="æ: v">byte</span>[[#æ: v|backlink]]
13514 !! html
13515 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
13516 </p>
13517 !! end
13518
13519 !! test
13520 Sanitizer: Validating the contents of the id attribute (bug 4515)
13521 !! options
13522 disabled
13523 !! wikitext
13524 <br id=9 />
13525 !! html
13526 Something, but definitely not <br id="9" />...
13527 !! end
13528
13529 !! test
13530 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
13531 !! options
13532 disabled
13533 !! wikitext
13534 <br id="foo" /><br id="foo" />
13535 !! html
13536 Something need to be done. foo-2 ?
13537 !! end
13538
13539 !! test
13540 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
13541 !! wikitext
13542 <div itemscope>
13543 <meta itemprop="hello" content="world">
13544 <meta http-equiv="refresh" content="5">
13545 <meta itemprop="hello" http-equiv="refresh" content="5">
13546 <link itemprop="hello" href="{{SERVER}}">
13547 <link rel="stylesheet" href="{{SERVER}}">
13548 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
13549 </div>
13550 !! html
13551 <div itemscope="itemscope">
13552 <p> <meta itemprop="hello" content="world" />
13553 &lt;meta http-equiv="refresh" content="5"&gt;
13554 <meta itemprop="hello" content="5" />
13555 </p>
13556 <link itemprop="hello" href="http&#58;//example.org" />
13557 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
13558 <link itemprop="hello" href="http&#58;//example.org" />
13559 </div>
13560
13561 !! end
13562
13563 !! test
13564 Language converter: output gets cut off unexpectedly (bug 5757)
13565 !! options
13566 language=zh
13567 !! wikitext
13568 this bit is safe: }-
13569
13570 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
13571
13572 then we get cut off here: }-
13573
13574 all additional text is vanished
13575 !! html
13576 <p>this bit is safe: }-
13577 </p><p>but if we add a conversion instance: xxx
13578 </p><p>then we get cut off here: }-
13579 </p><p>all additional text is vanished
13580 </p>
13581 !! end
13582
13583 !! test
13584 Self closed html pairs (bug 5487)
13585 !! options
13586 !! wikitext
13587 <center><font id="bug" />Centered text</center>
13588 <div><font id="bug2" />In div text</div>
13589 !! html
13590 <center>&lt;font id="bug" /&gt;Centered text</center>
13591 <div>&lt;font id="bug2" /&gt;In div text</div>
13592
13593 !! end
13594
13595 #
13596 #
13597 #
13598
13599 !! test
13600 Punctuation: nbsp before exclamation
13601 !! wikitext
13602 C'est grave !
13603 !! html
13604 <p>C'est grave&#160;!
13605 </p>
13606 !! end
13607
13608 !! test
13609 Punctuation: CSS !important (bug 11874)
13610 !! wikitext
13611 <div style="width:50% !important">important</div>
13612 !! html
13613 <div style="width:50% !important">important</div>
13614
13615 !!end
13616
13617 !! test
13618 Punctuation: CSS ! important (bug 11874; with space after)
13619 !! wikitext
13620 <div style="width:50% ! important">important</div>
13621 !! html
13622 <div style="width:50% ! important">important</div>
13623
13624 !!end
13625
13626
13627 !! test
13628 HTML bullet list, closed tags (bug 5497)
13629 !! wikitext
13630 <ul>
13631 <li>One</li>
13632 <li>Two</li>
13633 </ul>
13634 !! html
13635 <ul>
13636 <li>One</li>
13637 <li>Two</li>
13638 </ul>
13639
13640 !! end
13641
13642 !! test
13643 HTML bullet list, unclosed tags (bug 5497)
13644 !! options
13645 disabled
13646 !! wikitext
13647 <ul>
13648 <li>One
13649 <li>Two
13650 </ul>
13651 !! html
13652 <ul>
13653 <li>One
13654 </li>
13655 <li>Two
13656 </li>
13657 </ul>
13658
13659 !! end
13660
13661 !! test
13662 HTML ordered list, closed tags (bug 5497)
13663 !! wikitext
13664 <ol>
13665 <li>One</li>
13666 <li>Two</li>
13667 </ol>
13668 !! html
13669 <ol>
13670 <li>One</li>
13671 <li>Two</li>
13672 </ol>
13673
13674 !! end
13675
13676 !! test
13677 HTML ordered list, unclosed tags (bug 5497)
13678 !! options
13679 disabled
13680 !! wikitext
13681 <ol>
13682 <li>One
13683 <li>Two
13684 </ol>
13685 !! html
13686 <ol>
13687 <li>One
13688 </li>
13689 <li>Two
13690 </li>
13691 </ol>
13692
13693 !! end
13694
13695 !! test
13696 HTML nested bullet list, closed tags (bug 5497)
13697 !! wikitext
13698 <ul>
13699 <li>One</li>
13700 <li>Two:
13701 <ul>
13702 <li>Sub-one</li>
13703 <li>Sub-two</li>
13704 </ul>
13705 </li>
13706 </ul>
13707 !! html
13708 <ul>
13709 <li>One</li>
13710 <li>Two:
13711 <ul>
13712 <li>Sub-one</li>
13713 <li>Sub-two</li>
13714 </ul>
13715 </li>
13716 </ul>
13717
13718 !! end
13719
13720 !! test
13721 HTML nested bullet list, open tags (bug 5497)
13722 !! options
13723 disabled
13724 !! wikitext
13725 <ul>
13726 <li>One
13727 <li>Two:
13728 <ul>
13729 <li>Sub-one
13730 <li>Sub-two
13731 </ul>
13732 </ul>
13733 !! html
13734 <ul>
13735 <li>One
13736 </li>
13737 <li>Two:
13738 <ul>
13739 <li>Sub-one
13740 </li>
13741 <li>Sub-two
13742 </li>
13743 </ul>
13744 </li>
13745 </ul>
13746
13747 !! end
13748
13749 !! test
13750 HTML nested ordered list, closed tags (bug 5497)
13751 !! wikitext
13752 <ol>
13753 <li>One</li>
13754 <li>Two:
13755 <ol>
13756 <li>Sub-one</li>
13757 <li>Sub-two</li>
13758 </ol>
13759 </li>
13760 </ol>
13761 !! html
13762 <ol>
13763 <li>One</li>
13764 <li>Two:
13765 <ol>
13766 <li>Sub-one</li>
13767 <li>Sub-two</li>
13768 </ol>
13769 </li>
13770 </ol>
13771
13772 !! end
13773
13774 !! test
13775 HTML nested ordered list, open tags (bug 5497)
13776 !! options
13777 disabled
13778 !! wikitext
13779 <ol>
13780 <li>One
13781 <li>Two:
13782 <ol>
13783 <li>Sub-one
13784 <li>Sub-two
13785 </ol>
13786 </ol>
13787 !! html
13788 <ol>
13789 <li>One
13790 </li>
13791 <li>Two:
13792 <ol>
13793 <li>Sub-one
13794 </li>
13795 <li>Sub-two
13796 </li>
13797 </ol>
13798 </li>
13799 </ol>
13800
13801 !! end
13802
13803 !! test
13804 HTML ordered list item with parameters oddity
13805 !! wikitext
13806 <ol><li id="fragment">One</li>
13807 </ol>
13808 !! html
13809 <ol><li id="fragment">One</li>
13810 </ol>
13811
13812 !! end
13813
13814 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
13815 !!test
13816 bug 5918: autonumbering
13817 !! wikitext
13818 [http://first/] [http://second] [ftp://ftp]
13819
13820 ftp://inlineftp
13821
13822 [mailto:enclosed@mail.tld With target]
13823
13824 [mailto:enclosed@mail.tld]
13825
13826 mailto:inline@mail.tld
13827 !! html/php
13828 <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>
13829 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13830 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13831 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13832 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13833 </p>
13834 !! html/parsoid
13835 <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>
13836 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
13837 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
13838 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
13839 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
13840 !! end
13841
13842
13843 #
13844 # Security and HTML correctness
13845 # From Nick Jenkins' fuzz testing
13846 #
13847
13848 !! test
13849 Fuzz testing: Parser13
13850 !! wikitext
13851 {|
13852 | http://a|
13853 !! html
13854 <table>
13855 <tr>
13856 <td>
13857 </td>
13858 </tr>
13859 </table>
13860
13861 !! end
13862
13863 !! test
13864 Fuzz testing: Parser14
13865 !! wikitext
13866 == onmouseover= ==
13867 http://__TOC__
13868 !! html
13869 <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>
13870 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13871 <ul>
13872 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13873 </ul>
13874 </div>
13875
13876
13877 !! end
13878
13879 !! test
13880 Fuzz testing: Parser14-table
13881 !! wikitext
13882 ==a==
13883 {| STYLE=__TOC__
13884 !! html
13885 <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>
13886 <table style="&#95;_TOC&#95;_">
13887 <tr><td></td></tr>
13888 </table>
13889
13890 !! end
13891
13892 # Known to produce bogus xml (extra </td>)
13893 !! test
13894 Fuzz testing: Parser16
13895 !! options
13896 noxml
13897 !! wikitext
13898 {|
13899 !https://||||||
13900 !! html
13901 <table>
13902 <tr>
13903 <th>https://</th>
13904 <th></th>
13905 <th></th>
13906 <th>
13907 </td>
13908 </tr>
13909 </table>
13910
13911 !! end
13912
13913 !! test
13914 Fuzz testing: Parser21
13915 !! wikitext
13916 {|
13917 ! irc://{{ftp://a" onmouseover="alert('hello world');"
13918 |
13919 !! html
13920 <table>
13921 <tr>
13922 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
13923 </th>
13924 <td>
13925 </td>
13926 </tr>
13927 </table>
13928
13929 !! end
13930
13931 !! test
13932 Fuzz testing: Parser22
13933 !! wikitext
13934 http://===r:::https://b
13935
13936 {|
13937 !! html
13938 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
13939 </p>
13940 <table>
13941 <tr><td></td></tr>
13942 </table>
13943
13944 !! end
13945
13946 # Known to produce bad XML for now
13947 !! test
13948 Fuzz testing: Parser24
13949 !! options
13950 noxml
13951 !! wikitext
13952 {|
13953 {{{|
13954 <u CLASS=
13955 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
13956 <br style="onmouseover='alert(document.cookie);' " />
13957
13958 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13959 |
13960 !! html
13961 <table>
13962 {{{|
13963 <u class="&#124;">}}}} &gt;
13964 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
13965
13966 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13967 <tr>
13968 <td></u>
13969 </td>
13970 </tr>
13971 </table>
13972
13973 !! end
13974
13975 # Note: the current result listed for this is not what the original one was,
13976 # but the original bug was JavaScript injection, which is fixed in any case.
13977 # It's not clear that the original result listed was any more correct than the
13978 # current one. Original result:
13979 # <p>{{{|
13980 # </p>
13981 # <li class="&#124;&#124;">
13982 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13983 !!test
13984 Fuzz testing: Parser25 (bug 6055)
13985 !! wikitext
13986 {{{
13987 |
13988 <LI CLASS=||
13989 >
13990 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
13991 !! html
13992 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13993 </p>
13994 !! end
13995
13996 !!test
13997 Fuzz testing: URL adjacent extension (with space, clean)
13998 !! options
13999 !! wikitext
14000 http://example.com <nowiki>junk</nowiki>
14001 !! html
14002 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
14003 </p>
14004 !!end
14005
14006 !!test
14007 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
14008 !! options
14009 !! wikitext
14010 http://example.com<nowiki>junk</nowiki>
14011 !! html
14012 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
14013 </p>
14014 !!end
14015
14016 !!test
14017 Fuzz testing: URL adjacent extension (no space, dirty; pre)
14018 !! options
14019 !! wikitext
14020 http://example.com<pre>junk</pre>
14021 !! html
14022 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
14023
14024 !!end
14025
14026 !!test
14027 Fuzz testing: image with bogus manual thumbnail
14028 !! wikitext
14029 [[Image:foobar.jpg|thumbnail= ]]
14030 !! html/php
14031 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
14032
14033 !! html/parsoid
14034 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
14035 !!end
14036
14037 !! test
14038 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
14039 !! wikitext
14040 <pre dir="&#10;"></pre>
14041 !! html
14042 <pre dir="&#10;"></pre>
14043
14044 !! end
14045
14046 !! test
14047 Parsing optional HTML elements (Bug 6171)
14048 !! options
14049 !! wikitext
14050 <table>
14051 <tr>
14052 <td> Some tabular data</td>
14053 <td> More tabular data ...
14054 <td> And yet som tabular data</td>
14055 </tr>
14056 </table>
14057 !! html
14058 <table>
14059 <tr>
14060 <td> Some tabular data</td>
14061 <td> More tabular data ...
14062 </td><td> And yet som tabular data</td>
14063 </tr>
14064 </table>
14065
14066 !! end
14067
14068 !! test
14069 Correct handling of <td>, <tr> (Bug 6171)
14070 !! options
14071 !! wikitext
14072 <table>
14073 <tr>
14074 <td> Some tabular data</td>
14075 <td> More tabular data ...</td>
14076 <td> And yet som tabular data</td>
14077 </tr>
14078 </table>
14079 !! html
14080 <table>
14081 <tr>
14082 <td> Some tabular data</td>
14083 <td> More tabular data ...</td>
14084 <td> And yet som tabular data</td>
14085 </tr>
14086 </table>
14087
14088 !! end
14089
14090
14091 !! test
14092 Parsing crashing regression (fr:JavaScript)
14093 !! wikitext
14094 </body></x>
14095 !! html
14096 <p>&lt;/body&gt;&lt;/x&gt;
14097 </p>
14098 !! end
14099
14100 !! test
14101 Inline wiki vs wiki block nesting
14102 !! wikitext
14103 '''Bold paragraph
14104
14105 New wiki paragraph
14106 !! html
14107 <p><b>Bold paragraph</b>
14108 </p><p>New wiki paragraph
14109 </p>
14110 !! end
14111
14112 !! test
14113 Inline HTML vs wiki block nesting
14114 !! options
14115 disabled
14116 !! wikitext
14117 <b>Bold paragraph
14118
14119 New wiki paragraph
14120 !! html
14121 <p><b>Bold paragraph</b>
14122 </p><p>New wiki paragraph
14123 </p>
14124 !! end
14125
14126 # Original result was this:
14127 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
14128 # </p>
14129 # While that might be marginally more intuitive, maybe, the six-apostrophe
14130 # construct is clearly pathological and the result stated here (which is what
14131 # the parser actually does) is about as reasonable as anything.
14132 !!test
14133 Mixing markup for italics and bold
14134 !! options
14135 !! wikitext
14136 '''bold''''''bold''bolditalics'''''
14137 !! html
14138 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
14139 </p>
14140 !! end
14141
14142
14143 !! article
14144 Xyzzyx
14145 !! text
14146 Article for special page transclusion test
14147 !! endarticle
14148
14149 !! test
14150 Special page transclusion
14151 !! options
14152 !! wikitext
14153 {{Special:Prefixindex/Xyzzyx}}
14154 !! html
14155 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14156
14157 !! end
14158
14159 !! test
14160 Special page transclusion twice (bug 5021)
14161 !! options
14162 !! wikitext
14163 {{Special:Prefixindex/Xyzzyx}}
14164 {{Special:Prefixindex/Xyzzyx}}
14165 !! html
14166 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14167 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14168
14169 !! end
14170
14171 !! test
14172 Transclusion of default MediaWiki message
14173 !! wikitext
14174 {{MediaWiki:Mainpage}}
14175 !! html
14176 <p>Main Page
14177 </p>
14178 !! end
14179
14180 !! test
14181 Transclusion of nonexistent MediaWiki message
14182 !! wikitext
14183 {{MediaWiki:Mainpagexxx}}
14184 !! html
14185 <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>
14186 </p>
14187 !! end
14188
14189 !! test
14190 Transclusion of MediaWiki message with underscore
14191 !! wikitext
14192 {{MediaWiki:history_short}}
14193 !! html
14194 <p>History
14195 </p>
14196 !! end
14197
14198 !! test
14199 Transclusion of MediaWiki message with space
14200 !! wikitext
14201 {{MediaWiki:history short}}
14202 !! html
14203 <p>History
14204 </p>
14205 !! end
14206
14207 !! test
14208 Invalid header with following text
14209 !! wikitext
14210 = x = y
14211 !! html
14212 <p>= x = y
14213 </p>
14214 !! end
14215
14216
14217 !! test
14218 Section extraction test (section 0)
14219 !! options
14220 section=0
14221 !! wikitext
14222 start
14223 ==a==
14224 ===aa===
14225 ====aaa====
14226 ==b==
14227 ===ba===
14228 ===bb===
14229 ====bba====
14230 ===bc===
14231 ==c==
14232 ===ca===
14233 !! html
14234 start
14235 !! end
14236
14237 !! test
14238 Section extraction test (section 1)
14239 !! options
14240 section=1
14241 !! wikitext
14242 start
14243 ==a==
14244 ===aa===
14245 ====aaa====
14246 ==b==
14247 ===ba===
14248 ===bb===
14249 ====bba====
14250 ===bc===
14251 ==c==
14252 ===ca===
14253 !! html
14254 ==a==
14255 ===aa===
14256 ====aaa====
14257 !! end
14258
14259 !! test
14260 Section extraction test (section 2)
14261 !! options
14262 section=2
14263 !! wikitext
14264 start
14265 ==a==
14266 ===aa===
14267 ====aaa====
14268 ==b==
14269 ===ba===
14270 ===bb===
14271 ====bba====
14272 ===bc===
14273 ==c==
14274 ===ca===
14275 !! html
14276 ===aa===
14277 ====aaa====
14278 !! end
14279
14280 !! test
14281 Section extraction test (section 3)
14282 !! options
14283 section=3
14284 !! wikitext
14285 start
14286 ==a==
14287 ===aa===
14288 ====aaa====
14289 ==b==
14290 ===ba===
14291 ===bb===
14292 ====bba====
14293 ===bc===
14294 ==c==
14295 ===ca===
14296 !! html
14297 ====aaa====
14298 !! end
14299
14300 !! test
14301 Section extraction test (section 4)
14302 !! options
14303 section=4
14304 !! wikitext
14305 start
14306 ==a==
14307 ===aa===
14308 ====aaa====
14309 ==b==
14310 ===ba===
14311 ===bb===
14312 ====bba====
14313 ===bc===
14314 ==c==
14315 ===ca===
14316 !! html
14317 ==b==
14318 ===ba===
14319 ===bb===
14320 ====bba====
14321 ===bc===
14322 !! end
14323
14324 !! test
14325 Section extraction test (section 5)
14326 !! options
14327 section=5
14328 !! wikitext
14329 start
14330 ==a==
14331 ===aa===
14332 ====aaa====
14333 ==b==
14334 ===ba===
14335 ===bb===
14336 ====bba====
14337 ===bc===
14338 ==c==
14339 ===ca===
14340 !! html
14341 ===ba===
14342 !! end
14343
14344 !! test
14345 Section extraction test (section 6)
14346 !! options
14347 section=6
14348 !! wikitext
14349 start
14350 ==a==
14351 ===aa===
14352 ====aaa====
14353 ==b==
14354 ===ba===
14355 ===bb===
14356 ====bba====
14357 ===bc===
14358 ==c==
14359 ===ca===
14360 !! html
14361 ===bb===
14362 ====bba====
14363 !! end
14364
14365 !! test
14366 Section extraction test (section 7)
14367 !! options
14368 section=7
14369 !! wikitext
14370 start
14371 ==a==
14372 ===aa===
14373 ====aaa====
14374 ==b==
14375 ===ba===
14376 ===bb===
14377 ====bba====
14378 ===bc===
14379 ==c==
14380 ===ca===
14381 !! html
14382 ====bba====
14383 !! end
14384
14385 !! test
14386 Section extraction test (section 8)
14387 !! options
14388 section=8
14389 !! wikitext
14390 start
14391 ==a==
14392 ===aa===
14393 ====aaa====
14394 ==b==
14395 ===ba===
14396 ===bb===
14397 ====bba====
14398 ===bc===
14399 ==c==
14400 ===ca===
14401 !! html
14402 ===bc===
14403 !! end
14404
14405 !! test
14406 Section extraction test (section 9)
14407 !! options
14408 section=9
14409 !! wikitext
14410 start
14411 ==a==
14412 ===aa===
14413 ====aaa====
14414 ==b==
14415 ===ba===
14416 ===bb===
14417 ====bba====
14418 ===bc===
14419 ==c==
14420 ===ca===
14421 !! html
14422 ==c==
14423 ===ca===
14424 !! end
14425
14426 !! test
14427 Section extraction test (section 10)
14428 !! options
14429 section=10
14430 !! wikitext
14431 start
14432 ==a==
14433 ===aa===
14434 ====aaa====
14435 ==b==
14436 ===ba===
14437 ===bb===
14438 ====bba====
14439 ===bc===
14440 ==c==
14441 ===ca===
14442 !! html
14443 ===ca===
14444 !! end
14445
14446 !! test
14447 Section extraction test (nonexistent section 11)
14448 !! options
14449 section=11
14450 !! wikitext
14451 start
14452 ==a==
14453 ===aa===
14454 ====aaa====
14455 ==b==
14456 ===ba===
14457 ===bb===
14458 ====bba====
14459 ===bc===
14460 ==c==
14461 ===ca===
14462 !! html
14463 !! end
14464
14465 !! test
14466 Section extraction test with bogus heading (section 1)
14467 !! options
14468 section=1
14469 !! wikitext
14470 ==a==
14471 ==bogus== not a legal section
14472 ==b==
14473 !! html
14474 ==a==
14475 ==bogus== not a legal section
14476 !! end
14477
14478 !! test
14479 Section extraction test with bogus heading (section 2)
14480 !! options
14481 section=2
14482 !! wikitext
14483 ==a==
14484 ==bogus== not a legal section
14485 ==b==
14486 !! html
14487 ==b==
14488 !! end
14489
14490 !! test
14491 Section extraction test with comment after heading (section 1)
14492 !! options
14493 section=1
14494 !! wikitext
14495 ==a==
14496 ==b== <!-- -->
14497 ==c==
14498 !! html
14499 ==a==
14500 !! end
14501
14502 !! test
14503 Section extraction test with comment after heading (section 2)
14504 !! options
14505 section=2
14506 !! wikitext
14507 ==a==
14508 ==b== <!-- -->
14509 ==c==
14510 !! html
14511 ==b== <!-- -->
14512 !! end
14513
14514 !! test
14515 Section extraction test with bogus <nowiki> heading (section 1)
14516 !! options
14517 section=1
14518 !! wikitext
14519 ==a==
14520 ==bogus== <nowiki>not a legal section</nowiki>
14521 ==b==
14522 !! html
14523 ==a==
14524 ==bogus== <nowiki>not a legal section</nowiki>
14525 !! end
14526
14527 !! test
14528 Section extraction test with bogus <nowiki> heading (section 2)
14529 !! options
14530 section=2
14531 !! wikitext
14532 ==a==
14533 ==bogus== <nowiki>not a legal section</nowiki>
14534 ==b==
14535 !! html
14536 ==b==
14537 !! end
14538
14539
14540 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
14541 # instead of respecting commented sections
14542 !! test
14543 Section extraction prefixed by comment (section 1)
14544 !! options
14545 section=1
14546 !! wikitext
14547 <!-- -->==sec1==
14548 ==sec2==
14549 !! html
14550 ==sec2==
14551 !!end
14552
14553 !! test
14554 Section extraction prefixed by comment (section 2)
14555 !! options
14556 section=2
14557 !! wikitext
14558 <!-- -->==sec1==
14559 ==sec2==
14560 !! html
14561
14562 !!end
14563
14564
14565 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
14566 # instead of respecting HTML-style headings
14567 !! test
14568 Section extraction, mixed wiki and html (section 1)
14569 !! options
14570 section=1
14571 !! wikitext
14572 <h2>unmarked</h2>
14573 unmarked
14574 ==1==
14575 one
14576 ==2==
14577 two
14578 !! html
14579 ==1==
14580 one
14581 !! end
14582
14583 !! test
14584 Section extraction, mixed wiki and html (section 2)
14585 !! options
14586 section=2
14587 !! wikitext
14588 <h2>unmarked</h2>
14589 unmarked
14590 ==1==
14591 one
14592 ==2==
14593 two
14594 !! html
14595 ==2==
14596 two
14597 !! end
14598
14599
14600 # Formerly testing for bug 3342
14601 !! test
14602 Section extraction, heading surrounded by <noinclude>
14603 !! options
14604 section=1
14605 !! wikitext
14606 <noinclude>==unmarked==</noinclude>
14607 ==marked==
14608 !! html
14609 ==marked==
14610 !!end
14611
14612 # Test behavior of bug 19910
14613 !! test
14614 Sectiion with all-equals
14615 !! options
14616 section=2
14617 !! wikitext
14618 ===
14619 The line above must have a trailing space
14620 === <!--
14621 --> <!-- -->
14622 But just in case it doesn't...
14623 !! html
14624 === <!--
14625 --> <!-- -->
14626 But just in case it doesn't...
14627 !! end
14628
14629 !! test
14630 Section replacement test (section 0)
14631 !! options
14632 replace=0,"xxx"
14633 !! wikitext
14634 start
14635 ==a==
14636 ===aa===
14637 ====aaa====
14638 ==b==
14639 ===ba===
14640 ===bb===
14641 ====bba====
14642 ===bc===
14643 ==c==
14644 ===ca===
14645 !! html
14646 xxx
14647
14648 ==a==
14649 ===aa===
14650 ====aaa====
14651 ==b==
14652 ===ba===
14653 ===bb===
14654 ====bba====
14655 ===bc===
14656 ==c==
14657 ===ca===
14658 !! end
14659
14660 !! test
14661 Section replacement test (section 1)
14662 !! options
14663 replace=1,"xxx"
14664 !! wikitext
14665 start
14666 ==a==
14667 ===aa===
14668 ====aaa====
14669 ==b==
14670 ===ba===
14671 ===bb===
14672 ====bba====
14673 ===bc===
14674 ==c==
14675 ===ca===
14676 !! html
14677 start
14678 xxx
14679
14680 ==b==
14681 ===ba===
14682 ===bb===
14683 ====bba====
14684 ===bc===
14685 ==c==
14686 ===ca===
14687 !! end
14688
14689 !! test
14690 Section replacement test (section 2)
14691 !! options
14692 replace=2,"xxx"
14693 !! wikitext
14694 start
14695 ==a==
14696 ===aa===
14697 ====aaa====
14698 ==b==
14699 ===ba===
14700 ===bb===
14701 ====bba====
14702 ===bc===
14703 ==c==
14704 ===ca===
14705 !! html
14706 start
14707 ==a==
14708 xxx
14709
14710 ==b==
14711 ===ba===
14712 ===bb===
14713 ====bba====
14714 ===bc===
14715 ==c==
14716 ===ca===
14717 !! end
14718
14719 !! test
14720 Section replacement test (section 3)
14721 !! options
14722 replace=3,"xxx"
14723 !! wikitext
14724 start
14725 ==a==
14726 ===aa===
14727 ====aaa====
14728 ==b==
14729 ===ba===
14730 ===bb===
14731 ====bba====
14732 ===bc===
14733 ==c==
14734 ===ca===
14735 !! html
14736 start
14737 ==a==
14738 ===aa===
14739 xxx
14740
14741 ==b==
14742 ===ba===
14743 ===bb===
14744 ====bba====
14745 ===bc===
14746 ==c==
14747 ===ca===
14748 !! end
14749
14750 !! test
14751 Section replacement test (section 4)
14752 !! options
14753 replace=4,"xxx"
14754 !! wikitext
14755 start
14756 ==a==
14757 ===aa===
14758 ====aaa====
14759 ==b==
14760 ===ba===
14761 ===bb===
14762 ====bba====
14763 ===bc===
14764 ==c==
14765 ===ca===
14766 !! html
14767 start
14768 ==a==
14769 ===aa===
14770 ====aaa====
14771 xxx
14772
14773 ==c==
14774 ===ca===
14775 !! end
14776
14777 !! test
14778 Section replacement test (section 5)
14779 !! options
14780 replace=5,"xxx"
14781 !! wikitext
14782 start
14783 ==a==
14784 ===aa===
14785 ====aaa====
14786 ==b==
14787 ===ba===
14788 ===bb===
14789 ====bba====
14790 ===bc===
14791 ==c==
14792 ===ca===
14793 !! html
14794 start
14795 ==a==
14796 ===aa===
14797 ====aaa====
14798 ==b==
14799 xxx
14800
14801 ===bb===
14802 ====bba====
14803 ===bc===
14804 ==c==
14805 ===ca===
14806 !! end
14807
14808 !! test
14809 Section replacement test (section 6)
14810 !! options
14811 replace=6,"xxx"
14812 !! wikitext
14813 start
14814 ==a==
14815 ===aa===
14816 ====aaa====
14817 ==b==
14818 ===ba===
14819 ===bb===
14820 ====bba====
14821 ===bc===
14822 ==c==
14823 ===ca===
14824 !! html
14825 start
14826 ==a==
14827 ===aa===
14828 ====aaa====
14829 ==b==
14830 ===ba===
14831 xxx
14832
14833 ===bc===
14834 ==c==
14835 ===ca===
14836 !! end
14837
14838 !! test
14839 Section replacement test (section 7)
14840 !! options
14841 replace=7,"xxx"
14842 !! wikitext
14843 start
14844 ==a==
14845 ===aa===
14846 ====aaa====
14847 ==b==
14848 ===ba===
14849 ===bb===
14850 ====bba====
14851 ===bc===
14852 ==c==
14853 ===ca===
14854 !! html
14855 start
14856 ==a==
14857 ===aa===
14858 ====aaa====
14859 ==b==
14860 ===ba===
14861 ===bb===
14862 xxx
14863
14864 ===bc===
14865 ==c==
14866 ===ca===
14867 !! end
14868
14869 !! test
14870 Section replacement test (section 8)
14871 !! options
14872 replace=8,"xxx"
14873 !! wikitext
14874 start
14875 ==a==
14876 ===aa===
14877 ====aaa====
14878 ==b==
14879 ===ba===
14880 ===bb===
14881 ====bba====
14882 ===bc===
14883 ==c==
14884 ===ca===
14885 !! html
14886 start
14887 ==a==
14888 ===aa===
14889 ====aaa====
14890 ==b==
14891 ===ba===
14892 ===bb===
14893 ====bba====
14894 xxx
14895
14896 ==c==
14897 ===ca===
14898 !!end
14899
14900 !! test
14901 Section replacement test (section 9)
14902 !! options
14903 replace=9,"xxx"
14904 !! wikitext
14905 start
14906 ==a==
14907 ===aa===
14908 ====aaa====
14909 ==b==
14910 ===ba===
14911 ===bb===
14912 ====bba====
14913 ===bc===
14914 ==c==
14915 ===ca===
14916 !! html
14917 start
14918 ==a==
14919 ===aa===
14920 ====aaa====
14921 ==b==
14922 ===ba===
14923 ===bb===
14924 ====bba====
14925 ===bc===
14926 xxx
14927 !! end
14928
14929 !! test
14930 Section replacement test (section 10)
14931 !! options
14932 replace=10,"xxx"
14933 !! wikitext
14934 start
14935 ==a==
14936 ===aa===
14937 ====aaa====
14938 ==b==
14939 ===ba===
14940 ===bb===
14941 ====bba====
14942 ===bc===
14943 ==c==
14944 ===ca===
14945 !! html
14946 start
14947 ==a==
14948 ===aa===
14949 ====aaa====
14950 ==b==
14951 ===ba===
14952 ===bb===
14953 ====bba====
14954 ===bc===
14955 ==c==
14956 xxx
14957 !! end
14958
14959 !! test
14960 Section replacement test with initial whitespace (bug 13728)
14961 !! options
14962 replace=2,"xxx"
14963 !! wikitext
14964 Preformatted initial line
14965 ==a==
14966 ===a===
14967 !! html
14968 Preformatted initial line
14969 ==a==
14970 xxx
14971 !! end
14972
14973
14974 !! test
14975 Section extraction, heading followed by pre with 20 spaces (bug 6398)
14976 !! options
14977 section=1
14978 !! wikitext
14979 ==a==
14980 a
14981 !! html
14982 ==a==
14983 a
14984 !! end
14985
14986 !! test
14987 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
14988 !! options
14989 section=1
14990 !! wikitext
14991 ==a==
14992 a
14993 !! html
14994 ==a==
14995 a
14996 !! end
14997
14998
14999 !! test
15000 Section extraction, <pre> around bogus header (bug 10309)
15001 !! options
15002 noxml section=2
15003 !! wikitext
15004 == Section One ==
15005 <pre>
15006 =======
15007 </pre>
15008
15009 == Section Two ==
15010 stuff
15011 !! html
15012 == Section Two ==
15013 stuff
15014 !! end
15015
15016 !! test
15017 Section replacement, <pre> around bogus header (bug 10309)
15018 !! options
15019 noxml replace=2,"xxx"
15020 !! wikitext
15021 == Section One ==
15022 <pre>
15023 =======
15024 </pre>
15025
15026 == Section Two ==
15027 stuff
15028 !! html
15029 == Section One ==
15030 <pre>
15031 =======
15032 </pre>
15033
15034 xxx
15035 !! end
15036
15037
15038
15039 !! test
15040 Handling of &#x0A; in URLs
15041 !! wikitext
15042 ** irc://&#x0A;a
15043 !! html/php
15044 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15045
15046 !! html/parsoid
15047 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
15048 a">irc://
15049 a</a></li></ul></li></ul>
15050 !! end
15051
15052 !! test
15053 Handling of %0A in URLs
15054 !! wikitext
15055 ** irc://%0Aa
15056 !! html/php
15057 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15058
15059 !! html/parsoid
15060 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15061 !! end
15062
15063
15064 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
15065 !! test
15066 5 quotes, code coverage +1 line
15067 !! options
15068 parsoid=wt2html
15069 !! wikitext
15070 '''''
15071 !! html/php
15072 !! html/parsoid
15073 <p><b><i></i></b></p>
15074 !! end
15075
15076 # same html as previous, but wikitext adjusted to match parsoid html2wt
15077 # note that wt2html and html2html will put the <i> before the <b>
15078 !! test
15079 5 quotes, code coverage +1 line w/ nowiki (1)
15080 !! options
15081 parsoid=wt2wt,html2wt
15082 !! wikitext
15083 '''''<nowiki/>'''''
15084 !! html/php
15085 <p><i></i>
15086 </p>
15087 !! html/parsoid
15088 <p><b><i></i></b></p>
15089 !! end
15090
15091 # same as previous, just swapping the <i> and <b>
15092 !! test
15093 5 quotes, code coverage +1 line w/ nowiki (2)
15094 !! wikitext
15095 '''''<nowiki/>'''''
15096 !! html/php
15097 <p><i></i>
15098 </p>
15099 !! html/parsoid
15100 <p><i><b></b></i></p>
15101 !! end
15102
15103 !! test
15104 Special:Search page linking.
15105 !! wikitext
15106 {{Special:search}}
15107 !! html
15108 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
15109 </p>
15110 !! end
15111
15112 !! test
15113 Say the magic word
15114 !! options
15115 title=[[Parser test]]
15116 !! wikitext
15117 * {{PAGENAME}}
15118 * {{PAGENAMEE}}
15119 * {{FULLPAGENAME}}
15120 * {{FULLPAGENAMEE}}
15121 * {{BASEPAGENAME}}
15122 * {{BASEPAGENAMEE}}
15123 * {{SUBPAGENAME}}
15124 * {{SUBPAGENAMEE}}
15125 * {{ROOTPAGENAME}}
15126 * {{ROOTPAGENAMEE}}
15127 * {{TALKPAGENAME}}
15128 * {{TALKPAGENAMEE}}
15129 * {{SUBJECTPAGENAME}}
15130 * {{SUBJECTPAGENAMEE}}
15131 * {{NAMESPACEE}}
15132 * {{NAMESPACE}}
15133 * {{NAMESPACENUMBER}}
15134 * {{TALKSPACE}}
15135 * {{TALKSPACEE}}
15136 * {{SUBJECTSPACE}}
15137 * {{SUBJECTSPACEE}}
15138 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
15139 !! html
15140 <ul><li> Parser test</li>
15141 <li> Parser_test</li>
15142 <li> Parser test</li>
15143 <li> Parser_test</li>
15144 <li> Parser test</li>
15145 <li> Parser_test</li>
15146 <li> Parser test</li>
15147 <li> Parser_test</li>
15148 <li> Parser test</li>
15149 <li> Parser_test</li>
15150 <li> Talk:Parser test</li>
15151 <li> Talk:Parser_test</li>
15152 <li> Parser test</li>
15153 <li> Parser_test</li>
15154 <li> </li>
15155 <li> </li>
15156 <li> 0</li>
15157 <li> Talk</li>
15158 <li> Talk</li>
15159 <li> </li>
15160 <li> </li>
15161 <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>
15162
15163 !! end
15164 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
15165
15166 !! test
15167 Gallery
15168 !! wikitext
15169 <gallery>
15170 image1.png |
15171 image2.gif|||||
15172
15173 image3|
15174 image4 |300px| centre
15175 image5.svg| http://///////
15176 [[x|xx]]]]
15177 * image6
15178 </gallery>
15179 !! html
15180 <ul class="gallery mw-gallery-traditional">
15181 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15182 <div class="thumb" style="height: 150px;">Image1.png</div>
15183 <div class="gallerytext">
15184 </div>
15185 </div></li>
15186 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15187 <div class="thumb" style="height: 150px;">Image2.gif</div>
15188 <div class="gallerytext">
15189 <p>||||
15190 </p>
15191 </div>
15192 </div></li>
15193 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15194 <div class="thumb" style="height: 150px;">Image3</div>
15195 <div class="gallerytext">
15196 </div>
15197 </div></li>
15198 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15199 <div class="thumb" style="height: 150px;">Image4</div>
15200 <div class="gallerytext">
15201 <p>300px| centre
15202 </p>
15203 </div>
15204 </div></li>
15205 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15206 <div class="thumb" style="height: 150px;">Image5.svg</div>
15207 <div class="gallerytext">
15208 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
15209 </p>
15210 </div>
15211 </div></li>
15212 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15213 <div class="thumb" style="height: 150px;">* image6</div>
15214 <div class="gallerytext">
15215 </div>
15216 </div></li>
15217 </ul>
15218
15219 !! end
15220
15221 !! test
15222 Gallery (with options)
15223 !! wikitext
15224 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
15225 File:Nonexistant.jpg|caption
15226 File:Nonexistant.jpg
15227 image:foobar.jpg|some '''caption''' [[Main Page]]
15228 image:foobar.jpg
15229 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
15230 </gallery>
15231 !! html
15232 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
15233 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
15234 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15235 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15236 <div class="gallerytext">
15237 <p>caption
15238 </p>
15239 </div>
15240 </div></li>
15241 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15242 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15243 <div class="gallerytext">
15244 </div>
15245 </div></li>
15246 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15247 <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>
15248 <div class="gallerytext">
15249 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15250 </p>
15251 </div>
15252 </div></li>
15253 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15254 <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>
15255 <div class="gallerytext">
15256 </div>
15257 </div></li>
15258 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15259 <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>
15260 <div class="gallerytext">
15261 <p>Blabla|blabla.
15262 </p>
15263 </div>
15264 </div></li>
15265 </ul>
15266
15267 !! end
15268
15269 !! test
15270 Gallery with link that has fragment
15271 !! wikitext
15272 <gallery>
15273 image:foobar.jpg|link=Main_Page
15274 image:foobar.jpg|link=Main_Page#section
15275 image:foobar.jpg|link=Main Page#section|caption
15276 </gallery>
15277 !! html
15278 <ul class="gallery mw-gallery-traditional">
15279 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15280 <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>
15281 <div class="gallerytext">
15282 </div>
15283 </div></li>
15284 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15285 <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>
15286 <div class="gallerytext">
15287 </div>
15288 </div></li>
15289 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15290 <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>
15291 <div class="gallerytext">
15292 <p>caption
15293 </p>
15294 </div>
15295 </div></li>
15296 </ul>
15297
15298 !! end
15299
15300 !! test
15301 Gallery with wikitext inside caption
15302 !! wikitext
15303 <gallery>
15304 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
15305 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
15306 </gallery>
15307 !! html
15308 <ul class="gallery mw-gallery-traditional">
15309 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15310 <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>
15311 <div class="gallerytext">
15312 <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>
15313 </p>
15314 </div>
15315 </div></li>
15316 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15317 <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>
15318 <div class="gallerytext">
15319 <p>This is a test template
15320 </p>
15321 </div>
15322 </div></li>
15323 </ul>
15324
15325 !! end
15326
15327 !! test
15328 gallery (with showfilename option)
15329 !! wikitext
15330 <gallery showfilename>
15331 File:Nonexistant.jpg|caption
15332 File:Nonexistant.jpg
15333 image:foobar.jpg|some '''caption''' [[Main Page]]
15334 File:Foobar.jpg
15335 </gallery>
15336 !! html
15337 <ul class="gallery mw-gallery-traditional">
15338 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15339 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15340 <div class="gallerytext">
15341 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15342 caption
15343 </p>
15344 </div>
15345 </div></li>
15346 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15347 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15348 <div class="gallerytext">
15349 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15350 </p>
15351 </div>
15352 </div></li>
15353 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15354 <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>
15355 <div class="gallerytext">
15356 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15357 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15358 </p>
15359 </div>
15360 </div></li>
15361 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15362 <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>
15363 <div class="gallerytext">
15364 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15365 </p>
15366 </div>
15367 </div></li>
15368 </ul>
15369
15370 !! end
15371
15372 !! test
15373 Gallery (with namespace-less filenames)
15374 !! wikitext
15375 <gallery>
15376 File:Nonexistant.jpg
15377 Nonexistant.jpg
15378 image:foobar.jpg
15379 foobar.jpg
15380 </gallery>
15381 !! html
15382 <ul class="gallery mw-gallery-traditional">
15383 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15384 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15385 <div class="gallerytext">
15386 </div>
15387 </div></li>
15388 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15389 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15390 <div class="gallerytext">
15391 </div>
15392 </div></li>
15393 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15394 <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>
15395 <div class="gallerytext">
15396 </div>
15397 </div></li>
15398 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15399 <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>
15400 <div class="gallerytext">
15401 </div>
15402 </div></li>
15403 </ul>
15404
15405 !! end
15406
15407 !! test
15408 HTML Hex character encoding (spells the word "JavaScript")
15409 !! options
15410 parsoid=wt2html,wt2wt,html2html
15411 !! wikitext
15412 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
15413 !! html/php
15414 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
15415 </p>
15416 !! html/parsoid
15417 <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>
15418 !! end
15419
15420 !! test
15421 HTML Hex character encoding bogus encoding (bug 26437 regression check)
15422 !! wikitext
15423 &#xsee;&#XSEE;
15424 !! html/php
15425 <p>&amp;#xsee;&amp;#XSEE;
15426 </p>
15427 !! html/parsoid
15428 <p>&amp;#xsee;&amp;#XSEE;</p>
15429 !! end
15430
15431 !! test
15432 HTML Hex character encoding mixed case
15433 !! options
15434 parsoid=wt2html,wt2wt,html2html
15435 !! wikitext
15436 &#xEE;&#Xee;
15437 !! html/php
15438 <p>&#xee;&#xee;
15439 </p>
15440 !! html/parsoid
15441 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
15442 !! end
15443
15444 !! test
15445 __FORCETOC__ override
15446 !! wikitext
15447 __NEWSECTIONLINK__
15448 __FORCETOC__
15449 !! html
15450 <p><br />
15451 </p>
15452 !! end
15453
15454 !! test
15455 ISBN code coverage
15456 !! wikitext
15457 ISBN 978-0-1234-56&#x20;789
15458 !! html
15459 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
15460 </p>
15461 !! end
15462
15463 !! test
15464 ISBN followed by 5 spaces
15465 !! wikitext
15466 ISBN
15467 !! html
15468 <p>ISBN
15469 </p>
15470 !! end
15471
15472 !! test
15473 Double ISBN
15474 !! wikitext
15475 ISBN ISBN 1234567890
15476 !! html
15477 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15478 </p>
15479 !! end
15480
15481 !! test
15482 ISBN with an X
15483 !! wikitext
15484 ISBN 3-462-04561-X
15485 !! html
15486 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
15487 </p>
15488 !! end
15489
15490 !! test
15491 ISBN with empty prefix (parsoid test)
15492 !! wikitext
15493 ISBN 1234567890
15494 !! html/parsoid
15495 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
15496 !! end
15497
15498 !! test
15499 Bug 22905: <abbr> followed by ISBN followed by </a>
15500 !! wikitext
15501 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
15502 !! html
15503 <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>
15504 </p>
15505 !! end
15506
15507 !! test
15508 Double RFC
15509 !! wikitext
15510 RFC RFC 1234
15511 !! html
15512 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
15513 </p>
15514 !! end
15515
15516 !! test
15517 Double RFC with a wiki link
15518 !! wikitext
15519 RFC [[RFC 1234]]
15520 !! html
15521 <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>
15522 </p>
15523 !! end
15524
15525 !! test
15526 RFC code coverage
15527 !! wikitext
15528 RFC 983&#x20;987
15529 !! html
15530 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
15531 </p>
15532 !! end
15533
15534 !! test
15535 Centre-aligned image
15536 !! wikitext
15537 [[Image:foobar.jpg|centre]]
15538 !! html
15539 <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>
15540
15541 !!end
15542
15543 !! test
15544 None-aligned image
15545 !! wikitext
15546 [[Image:foobar.jpg|none]]
15547 !! html
15548 <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>
15549
15550 !!end
15551
15552 !! test
15553 Width + Height sized image (using px) (height is ignored)
15554 !! wikitext
15555 [[Image:foobar.jpg|640x480px]]
15556 !! html
15557 <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>
15558 </p>
15559 !!end
15560
15561 !! test
15562 Width-sized image (using px, no following whitespace)
15563 !! wikitext
15564 [[Image:foobar.jpg|640px]]
15565 !! html
15566 <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>
15567 </p>
15568 !!end
15569
15570 !! test
15571 Width-sized image (using px, with following whitespace - test regression from r39467)
15572 !! wikitext
15573 [[Image:foobar.jpg|640px ]]
15574 !! html
15575 <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>
15576 </p>
15577 !!end
15578
15579 !! test
15580 Width-sized image (using px, with preceding whitespace - test regression from r39467)
15581 !! wikitext
15582 [[Image:foobar.jpg| 640px]]
15583 !! html
15584 <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>
15585 </p>
15586 !!end
15587
15588 !! test
15589 Image with page parameter
15590 !! options
15591 djvu
15592 !! wikitext
15593 [[File:LoremIpsum.djvu|page=2]]
15594 !! html
15595 <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>
15596 </p>
15597 !! end
15598
15599 !! test
15600 Another italics / bold test
15601 !! wikitext
15602 ''' ''x'
15603 !! html
15604 <pre>'<i> </i>x'
15605 </pre>
15606 !!end
15607
15608 # Note the results may be incorrect, as parserTest output included this:
15609 # XML error: Mismatched tag at byte 6120:
15610 # ...<dd> </dt></dl> </dd...
15611 !! test
15612 dt/dd/dl test
15613 !! options
15614 disabled
15615 !! wikitext
15616 :;;;::
15617 !! html
15618 <dl>
15619 <dd><dl>
15620 <dt><dl>
15621 <dt><dl>
15622 <dt><dl>
15623 <dd><dl>
15624 <dd>
15625 </dd>
15626 </dl>
15627 </dd>
15628 </dl>
15629 </dt>
15630 </dl>
15631 </dt>
15632 </dl>
15633 </dt>
15634 </dl>
15635 </dd>
15636 </dl>
15637
15638 !!end
15639
15640
15641 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
15642 !! test
15643 Images with the "|" character in the comment
15644 !! wikitext
15645 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
15646 !! html/php
15647 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
15648
15649 !! html/parsoid
15650 <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>
15651 !! end
15652
15653 !! test
15654 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
15655 !! wikitext
15656 <html><script>alert(1);</script></html>
15657 !! html
15658 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
15659 </p>
15660 !! end
15661
15662 !! test
15663 HTML with raw HTML ($wgRawHtml==true)
15664 !! options
15665 wgRawHtml=1
15666 !! wikitext
15667 <html><script>alert(1);</script></html>
15668 !! html
15669 <p><script>alert(1);</script>
15670 </p>
15671 !! end
15672
15673 !! test
15674 Parents of subpages, one level up
15675 !! options
15676 subpage title=[[Subpage test/L1/L2/L3]]
15677 !! wikitext
15678 [[../|L2]]
15679 !! html
15680 <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>
15681 </p>
15682 !! end
15683
15684
15685 !! test
15686 Parents of subpages, one level up, not named
15687 !! options
15688 subpage title=[[Subpage test/L1/L2/L3]]
15689 !! wikitext
15690 [[../]]
15691 !! html
15692 <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>
15693 </p>
15694 !! end
15695
15696
15697
15698 !! test
15699 Parents of subpages, two levels up
15700 !! options
15701 subpage title=[[Subpage test/L1/L2/L3]]
15702 !! wikitext
15703 [[../../|L1]]2
15704
15705 [[../../|L1]]l
15706 !! html
15707 <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
15708 </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>
15709 </p>
15710 !! end
15711
15712 !! test
15713 Parents of subpages, two levels up, without trailing slash or name.
15714 !! options
15715 subpage title=[[Subpage test/L1/L2/L3]]
15716 !! wikitext
15717 [[../..]]
15718 !! html
15719 <p>[[../..]]
15720 </p>
15721 !! end
15722
15723 !! test
15724 Parents of subpages, two levels up, with lots of extra trailing slashes.
15725 !! options
15726 subpage title=[[Subpage test/L1/L2/L3]]
15727 !! wikitext
15728 [[../../////]]
15729 !! html
15730 <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)">///</a>
15731 </p>
15732 !! end
15733
15734 !! article
15735 Subpage test/L1/L2/L3Sibling
15736 !! text
15737 Sibling article
15738 !! endarticle
15739
15740 !! test
15741 Transclusion of a sibling page (one level up)
15742 !! options
15743 subpage title=[[Subpage test/L1/L2/L3]]
15744 !! wikitext
15745 {{../L3Sibling}}
15746 !! html
15747 <p>Sibling article
15748 </p>
15749 !! end
15750
15751 !! test
15752 Transclusion of a child page
15753 !! options
15754 subpage title=[[Subpage test/L1/L2]]
15755 !! wikitext
15756 {{/L3Sibling}}
15757 !! html
15758 <p>Sibling article
15759 </p>
15760 !! end
15761
15762 !! test
15763 Non-transclusion because of too many up levels
15764 !! options
15765 subpage title=[[Subpage test/L1/L2/L3]]
15766 !! wikitext
15767 {{../../../../More than parent}}
15768 !! html
15769 <p>{{../../../../More than parent}}
15770 </p>
15771 !! end
15772
15773 !! test
15774 Definition list code coverage
15775 !! wikitext
15776 ; title : def
15777 ; title : def
15778 ;title: def
15779 !! html
15780 <dl><dt> title &#160;</dt>
15781 <dd> def</dd>
15782 <dt> title&#160;</dt>
15783 <dd> def</dd>
15784 <dt>title</dt>
15785 <dd> def</dd></dl>
15786
15787 !! end
15788
15789 !! test
15790 Don't fall for the self-closing div
15791 !! wikitext
15792 <div>hello world</div/>
15793 !! html
15794 <div>hello world</div>
15795
15796 !! end
15797
15798 !! test
15799 MSGNW magic word
15800 !! wikitext
15801 {{MSGNW:msg}}
15802 !! html
15803 <p>&#91;&#91;:Template:Msg&#93;&#93;
15804 </p>
15805 !! end
15806
15807 !! test
15808 RAW magic word
15809 !! wikitext
15810 {{RAW:QUERTY}}
15811 !! html
15812 <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>
15813 </p>
15814 !! end
15815
15816 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15817 !! test
15818 Always escape literal '>' in output, not just after '<'
15819 !! wikitext
15820 ><>
15821 !! html
15822 <p>&gt;&lt;&gt;
15823 </p>
15824 !! end
15825
15826 !! test
15827 Template caching
15828 !! wikitext
15829 {{Test}}
15830 {{Test}}
15831 !! html
15832 <p>This is a test template
15833 This is a test template
15834 </p>
15835 !! end
15836
15837
15838 !! article
15839 MediaWiki:Fake
15840 !! text
15841 ==header==
15842 !! endarticle
15843
15844 !! test
15845 Inclusion of !userCanEdit() content
15846 !! wikitext
15847 {{MediaWiki:Fake}}
15848 !! html
15849 <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>
15850
15851 !! end
15852
15853
15854 !! test
15855 Out-of-order TOC heading levels
15856 !! wikitext
15857 ==2==
15858 ======6======
15859 ===3===
15860 =1=
15861 =====5=====
15862 ==2==
15863 !! html
15864 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15865 <ul>
15866 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15867 <ul>
15868 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15869 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15870 </ul>
15871 </li>
15872 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15873 <ul>
15874 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15875 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15876 </ul>
15877 </li>
15878 </ul>
15879 </div>
15880
15881 <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>
15882 <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>
15883 <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>
15884 <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>
15885 <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>
15886 <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>
15887
15888 !! end
15889
15890
15891 !! test
15892 ISBN with a dummy number
15893 !! wikitext
15894 ISBN ---
15895 !! html
15896 <p>ISBN ---
15897 </p>
15898 !! end
15899
15900
15901 !! test
15902 ISBN with space-delimited number
15903 !! wikitext
15904 ISBN 92 9017 032 8
15905 !! html
15906 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
15907 </p>
15908 !! end
15909
15910
15911 !! test
15912 ISBN with multiple spaces, no number
15913 !! wikitext
15914 ISBN foo
15915 !! html
15916 <p>ISBN foo
15917 </p>
15918 !! end
15919
15920
15921 !! test
15922 ISBN length
15923 !! wikitext
15924 ISBN 123456789
15925
15926 ISBN 1234567890
15927
15928 ISBN 12345678901
15929 !! html
15930 <p>ISBN 123456789
15931 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15932 </p><p>ISBN 12345678901
15933 </p>
15934 !! end
15935
15936
15937 !! test
15938 ISBN with trailing year (bug 8110)
15939 !! wikitext
15940 ISBN 1-234-56789-0 - 2006
15941
15942 ISBN 1 234 56789 0 - 2006
15943 !! html
15944 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
15945 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
15946 </p>
15947 !! end
15948
15949
15950 !! test
15951 anchorencode
15952 !! wikitext
15953 {{anchorencode:foo bar©#%n}}
15954 !! html
15955 <p>foo_bar.C2.A9.23.25n
15956 </p>
15957 !! end
15958
15959 !! test
15960 anchorencode trims spaces
15961 !! wikitext
15962 {{anchorencode: __pretty__please__}}
15963 !! html
15964 <p>pretty_please
15965 </p>
15966 !! end
15967
15968 !! test
15969 anchorencode deals with links
15970 !! wikitext
15971 {{anchorencode: [[hello|world]] [[hi]]}}
15972 !! html
15973 <p>world_hi
15974 </p>
15975 !! end
15976
15977 !! test
15978 anchorencode deals with templates
15979 !! wikitext
15980 {{anchorencode: {{Foo}} }}
15981 !! html
15982 <p>FOO
15983 </p>
15984 !! end
15985
15986 !! test
15987 anchorencode encodes like the TOC generator: (bug 18431)
15988 !! wikitext
15989 === _ +:.3A%3A&&amp;]] ===
15990 {{anchorencode: _ +:.3A%3A&&amp;]] }}
15991 __NOEDITSECTION__
15992 !! html
15993 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
15994 <p>.2B:.3A.253A.26.26.5D.5D
15995 </p>
15996 !! end
15997
15998 !! test
15999 Bug 6200: blockquotes and paragraph formatting
16000 !! wikitext
16001 <blockquote>
16002 foo
16003 </blockquote>
16004
16005 bar
16006
16007 baz
16008 !! html
16009 <blockquote>
16010 <p>foo
16011 </p>
16012 </blockquote>
16013 <p>bar
16014 </p>
16015 <pre>baz
16016 </pre>
16017 !! end
16018
16019 !! test
16020 Bug 8293: Use of center tag ruins paragraph formatting
16021 !! wikitext
16022 <center>
16023 foo
16024 </center>
16025
16026 bar
16027
16028 baz
16029 !! html
16030 <center>
16031 <p>foo
16032 </p>
16033 </center>
16034 <p>bar
16035 </p>
16036 <pre>baz
16037 </pre>
16038 !! end
16039
16040 !!test
16041 Parsing of overlapping (improperly nested) inline html tags
16042 !! wikitext
16043 <span><s>x</span></s>
16044 !! html/php
16045 <p><span><s>x&lt;/span&gt;</s></span>
16046 </p>
16047 !! html/parsoid
16048 <p><span><s>x</s></span>
16049 </p>
16050 !!end
16051
16052 ###
16053 ### Language variants related tests
16054 ###
16055 !! test
16056 Self-link in language variants
16057 !! options
16058 title=[[Dunav]] language=sr
16059 !! wikitext
16060 Both [[Dunav]] and [[Дунав]] are names for this river.
16061 !! html
16062 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
16063 </p>
16064 !!end
16065
16066 !! article
16067 Дуна
16068 !! text
16069 content
16070 !! endarticle
16071
16072 !! test
16073 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
16074 !! options
16075 title=[[Duna]] language=sr
16076 !! wikitext
16077 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
16078 !! html
16079 <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.
16080 </p>
16081 !! end
16082
16083 !! test
16084 Link to a section of a variant of this title shouldn't be parsed as self-link
16085 !! options
16086 title=[[Duna]] language=sr
16087 !! wikitext
16088 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
16089 !! html
16090 <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.
16091 </p>
16092 !! end
16093
16094 !! test
16095 Link to pages in language variants
16096 !! options
16097 language=sr
16098 !! wikitext
16099 Main Page can be written as [[Маин Паге]]
16100 !! html
16101 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
16102 </p>
16103 !!end
16104
16105
16106 !! test
16107 Multiple links to pages in language variants
16108 !! options
16109 language=sr
16110 !! wikitext
16111 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
16112 !! html
16113 <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>.
16114 </p>
16115 !!end
16116
16117
16118 !! test
16119 Simple template in language variants
16120 !! options
16121 language=sr
16122 !! wikitext
16123 {{тест}}
16124 !! html
16125 <p>This is a test template
16126 </p>
16127 !! end
16128
16129
16130 !! test
16131 Template with explicit namespace in language variants
16132 !! options
16133 language=sr
16134 !! wikitext
16135 {{Template:тест}}
16136 !! html
16137 <p>This is a test template
16138 </p>
16139 !! end
16140
16141
16142 !! test
16143 Basic test for template parameter in language variants
16144 !! options
16145 language=sr
16146 !! wikitext
16147 {{парамтест|param=foo}}
16148 !! html
16149 <p>This is a test template with parameter foo
16150 </p>
16151 !! end
16152
16153
16154 !! test
16155 Simple category in language variants
16156 !! options
16157 language=sr cat
16158 !! wikitext
16159 [[Category:МедиаWики Усер'с Гуиде]]
16160 !! html
16161 <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>
16162 !! end
16163
16164
16165 !! article
16166 Category:分类
16167 !! text
16168 blah
16169 !! endarticle
16170
16171 !! article
16172 Category:分類
16173 !! text
16174 blah
16175 !! endarticle
16176
16177 !! test
16178 Don't convert blue categorylinks to another variant (bug 33210)
16179 !! options
16180 language=zh cat
16181 !! wikitext
16182 [[A]][[Category:分类]]
16183 !! html
16184 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
16185 !! end
16186
16187
16188 !! test
16189 Stripping -{}- tags (language variants)
16190 !! options
16191 language=sr
16192 !! wikitext
16193 Latin proverb: -{Ne nuntium necare}-
16194 !! html
16195 <p>Latin proverb: Ne nuntium necare
16196 </p>
16197 !! end
16198
16199
16200 !! test
16201 Prevent conversion with -{}- tags (language variants)
16202 !! options
16203 language=sr variant=sr-ec
16204 !! wikitext
16205 Latinski: -{Ne nuntium necare}-
16206 !! html
16207 <p>Латински: Ne nuntium necare
16208 </p>
16209 !! end
16210
16211
16212 !! test
16213 Prevent conversion of text with -{}- tags (language variants)
16214 !! options
16215 language=sr variant=sr-ec
16216 !! wikitext
16217 Latinski: -{Ne nuntium necare}-
16218 !! html
16219 <p>Латински: Ne nuntium necare
16220 </p>
16221 !! end
16222
16223
16224 !! test
16225 Prevent conversion of links with -{}- tags (language variants)
16226 !! options
16227 language=sr variant=sr-ec
16228 !! wikitext
16229 -{[[Main Page]]}-
16230 !! html
16231 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16232 </p>
16233 !! end
16234
16235
16236 !! test
16237 -{}- tags within headlines (within html for parserConvert())
16238 !! options
16239 language=sr variant=sr-ec
16240 !! wikitext
16241 == -{Naslov}- ==
16242 !! html
16243 <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>
16244
16245 !! end
16246
16247
16248 !! test
16249 Explicit definition of language variant alternatives
16250 !! options
16251 language=zh variant=zh-tw
16252 !! wikitext
16253 -{zh:China;zh-tw:Taiwan}-, not China
16254 !! html
16255 <p>Taiwan, not China
16256 </p>
16257 !! end
16258
16259
16260 !! test
16261 Conversion around HTML tags
16262 !! options
16263 language=sr variant=sr-ec
16264 !! wikitext
16265 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
16266 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
16267 !! html
16268 <p>
16269 <span title="ЛаCтин">ски</span>
16270 </p>
16271 !! end
16272
16273
16274 !! test
16275 Explicit session-wise language variant mapping (A flag and - flag)
16276 !! options
16277 language=zh variant=zh-tw
16278 !! wikitext
16279 Taiwan is not China.
16280 But -{A|zh:China;zh-tw:Taiwan}- is China,
16281 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
16282 and -{China}- is China.
16283 !! html
16284 <p>Taiwan is not China.
16285 But Taiwan is Taiwan,
16286 (This should be stripped!)
16287 and China is China.
16288 </p>
16289 !! end
16290
16291 !! test
16292 Explicit session-wise language variant mapping (H flag for hide)
16293 !! options
16294 language=zh variant=zh-tw
16295 !! wikitext
16296 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
16297 Taiwan is China.
16298 !! html
16299 <p>(This should be stripped!)
16300 Taiwan is Taiwan.
16301 </p>
16302 !! end
16303
16304 !! test
16305 Adding explicit conversion rule for title (T flag)
16306 !! options
16307 language=zh variant=zh-tw showtitle
16308 !! wikitext
16309 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16310 !! html
16311 Taiwan
16312 <p>Should be stripped!
16313 </p>
16314 !! end
16315
16316 !! test
16317 Testing that changing the language variant here in the tests actually works
16318 !! options
16319 language=zh variant=zh showtitle
16320 !! wikitext
16321 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16322 !! html
16323 China
16324 <p>Should be stripped!
16325 </p>
16326 !! end
16327
16328 !! test
16329 Recursive conversion of alt and title attrs shouldn't clear converter state
16330 !! options
16331 language=zh variant=zh-cn showtitle
16332 !! wikitext
16333 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
16334 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
16335 !! html
16336 China
16337 <p>
16338 Should be stripped<span title="Exclamation">!</span>
16339 </p>
16340 !! end
16341
16342 !! test
16343 Bug 24072: more test on conversion rule for title
16344 !! options
16345 language=zh variant=zh-tw showtitle
16346 !! wikitext
16347 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16348 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
16349 !! html
16350 Taiwan
16351 <p>This should be stripped!
16352 This won't take interferes with the title rule.
16353 </p>
16354 !! end
16355
16356 !! test
16357 Partly disable title conversion if variant == main language code
16358 !! options
16359 language=zh variant=zh title=[[ZH]] showtitle
16360 !! wikitext
16361 -{T|zh-cn:CN;zh-tw:TW}-
16362 !! html
16363 ZH
16364 <p>
16365 </p>
16366 !! end
16367
16368 !! test
16369 Partly disable title conversion if variant == main language code, more
16370 !! options
16371 language=zh variant=zh title=[[ZH]] showtitle
16372 !! wikitext
16373 -{T|TW}-
16374 !! html
16375 ZH
16376 <p>
16377 </p>
16378 !! end
16379
16380 !! test
16381 Raw output of variant escape tags (R flag)
16382 !! options
16383 language=zh variant=zh-tw
16384 !! wikitext
16385 Raw: -{R|zh:China;zh-tw:Taiwan}-
16386 !! html
16387 <p>Raw: zh:China;zh-tw:Taiwan
16388 </p>
16389 !! end
16390
16391 !! test
16392 Nested using of manual convert syntax
16393 !! options
16394 language=zh variant=zh-hk
16395 !! wikitext
16396 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
16397 !! html
16398 <p>Nested: Hello Hong Kong!
16399 </p>
16400 !! end
16401
16402 !! test
16403 Proper conversion of text in external links
16404 !! options
16405 language=sr variant=sr-ec
16406 !! wikitext
16407 http://www.google.com
16408 gopher://www.google.com
16409 [http://www.google.com http://www.google.com]
16410 [gopher://www.google.com gopher://www.google.com]
16411 [https://www.google.com irc://www.google.com]
16412 [ftp://www.google.com www.google.com/ftp://dir]
16413 [//www.google.com www.google.com]
16414 !! html
16415 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16416 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16417 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16418 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16419 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
16420 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
16421 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
16422 </p>
16423 !! end
16424
16425 !! test
16426 Do not convert roman numbers to language variants
16427 !! options
16428 language=sr variant=sr-ec
16429 !! wikitext
16430 Fridrih IV je car.
16431 !! html
16432 <p>Фридрих IV је цар.
16433 </p>
16434 !! end
16435
16436 !! test
16437 Unclosed language converter markup "-{"
16438 !! options
16439 language=sr
16440 !! wikitext
16441 -{T|hello
16442 !! html
16443 <p>-{T|hello
16444 </p>
16445 !! end
16446
16447 !! test
16448 Don't convert raw rule "-{R|=&gt;}-" to "=>"
16449 !! options
16450 language=sr
16451 !! wikitext
16452 -{R|=&gt;}-
16453 !! html
16454 <p>=&gt;
16455 </p>
16456 !!end
16457
16458 !! test
16459 Don't break link parsing if language converter markup is in the caption.
16460 !! options
16461 language=sr variant=sr-ec
16462 !! wikitext
16463 [[Main Page|-{R|main page}-]]
16464 !! html
16465 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
16466 </p>
16467 !! end
16468
16469 # This test is currently broken in the PHP parser (bug 52661)
16470 !! test
16471 Don't break image parsing if language converter markup is in the caption.
16472 !! options
16473 language=sr
16474 disabled
16475 !! wikitext
16476 [[File:Foobar.jpg|-{R|caption}-]]
16477 !! html
16478 <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>
16479 </p>
16480 !! end
16481
16482 # This test is currently broken in the PHP parser (bug 52661)
16483 !! test
16484 Don't break list handling if language converter markup is in the item.
16485 !! options
16486 language=zh variant=zh-cn
16487 disabled
16488 !! wikitext
16489 ;-{zh-cn:AAA;zh-tw:BBB}-
16490 !! html
16491 <dl><dt>AAA
16492 </dt></dl>
16493
16494 !! end
16495
16496 # This test is currently broken in the PHP parser (bug 52661)
16497 !! test
16498 Don't break table handling if language converter markup is in the cell.
16499 !! options
16500 language=sr variant=sr-ec
16501 disabled
16502 !! wikitext
16503 {|
16504 |-
16505 | -{R|B}-
16506 |}
16507 !! html
16508 <table>
16509
16510 <tr>
16511 <td> B
16512 </td></tr></table>
16513
16514 !! end
16515
16516 !! test
16517 Bug 529: Uncovered bullet
16518 !! wikitext
16519 * Foo {{bullet}}
16520 !! html
16521 <ul><li> Foo </li>
16522 <li> Bar</li></ul>
16523
16524 !! end
16525
16526 # Plain MediaWiki does not remove empty lists, but tidy actually does.
16527 # Templates in Wikipedia rely on this behavior, as tidy has always been
16528 # enabled there. These tests are normally run *without* tidy, so specify the
16529 # full output here.
16530 # To test realistic parsing behavior, apply a tidy-like transformation to both
16531 # the expected output and your parser's output.
16532 !! test
16533 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
16534 !! wikitext
16535 ******* Foo {{bullet}}
16536 !! html
16537 <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>
16538 <li> Bar</li></ul>
16539
16540 !! end
16541
16542 !! test
16543 Bug 529: Uncovered table already at line-start
16544 !! wikitext
16545 x
16546
16547 {{table}}
16548 y
16549 !! html
16550 <p>x
16551 </p>
16552 <table>
16553 <tr>
16554 <td> 1 </td>
16555 <td> 2
16556 </td></tr>
16557 <tr>
16558 <td> 3 </td>
16559 <td> 4
16560 </td></tr></table>
16561 <p>y
16562 </p>
16563 !! end
16564
16565 !! test
16566 Bug 529: Uncovered bullet in parser function result
16567 !! wikitext
16568 * Foo {{lc:{{bullet}} }}
16569 !! html
16570 <ul><li> Foo </li>
16571 <li> bar</li></ul>
16572
16573 !! end
16574
16575 !! test
16576 Bug 5678: Double-parsed template argument
16577 !! wikitext
16578 {{lc:{{{1}}}|hello}}
16579 !! html
16580 <p>{{{1}}}
16581 </p>
16582 !! end
16583
16584 !! test
16585 Bug 5678: Double-parsed template invocation
16586 !! wikitext
16587 {{lc:{{paramtest {{!}} param = hello }} }}
16588 !! html
16589 <p>{{paramtest | param = hello }}
16590 </p>
16591 !! end
16592
16593 !! test
16594 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
16595 !! options
16596 language=cs
16597 title=[[Main Page]]
16598 !! wikitext
16599 {{PRVNÍVELKÉ:ěščř}}
16600 {{prvnívelké:ěščř}}
16601 {{PRVNÍMALÉ:ěščř}}
16602 {{prvnímalé:ěščř}}
16603 {{MALÁ:ěščř}}
16604 {{malá:ěščř}}
16605 {{VELKÁ:ěščř}}
16606 {{velká:ěščř}}
16607 !! html
16608 <p>Ěščř
16609 Ěščř
16610 ěščř
16611 ěščř
16612 ěščř
16613 ěščř
16614 ĚŠČŘ
16615 ĚŠČŘ
16616 </p>
16617 !! end
16618
16619 !! test
16620 Morwen/13: Unclosed link followed by heading
16621 !! wikitext
16622 [[link
16623 ==heading==
16624 !! html
16625 <p>[[link
16626 </p>
16627 <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>
16628
16629 !! end
16630
16631 !! test
16632 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
16633 !! wikitext
16634 {{foo|
16635 =heading=
16636 !! html
16637 <p>{{foo|
16638 </p>
16639 <h1><span class="mw-headline" id="heading">heading</span></h1>
16640
16641 !! end
16642
16643 !! test
16644 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
16645 !! wikitext
16646 {{foo|
16647 ==heading==
16648 !! html
16649 <p>{{foo|
16650 </p>
16651 <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>
16652
16653 !! end
16654
16655 !! test
16656 Tildes in comments
16657 !! options
16658 pst
16659 !! wikitext
16660 <!-- ~~~~ -->
16661 !! html
16662 <!-- ~~~~ -->
16663 !! end
16664
16665 !! test
16666 Paragraphs inside divs (no extra line breaks)
16667 !! wikitext
16668 <div>Line one
16669
16670 Line two</div>
16671 !! html
16672 <div>Line one
16673 Line two</div>
16674
16675 !! end
16676
16677 !! test
16678 Paragraphs inside divs (extra line break on open)
16679 !! wikitext
16680 <div>
16681 Line one
16682
16683 Line two</div>
16684 !! html
16685 <div>
16686 <p>Line one
16687 </p>
16688 Line two</div>
16689
16690 !! end
16691
16692 !! test
16693 Paragraphs inside divs (extra line break on close)
16694 !! wikitext
16695 <div>Line one
16696
16697 Line two
16698 </div>
16699 !! html
16700 <div>Line one
16701 <p>Line two
16702 </p>
16703 </div>
16704
16705 !! end
16706
16707 !! test
16708 Paragraphs inside divs (extra line break on open and close)
16709 !! wikitext
16710 <div>
16711 Line one
16712
16713 Line two
16714 </div>
16715 !! html
16716 <div>
16717 <p>Line one
16718 </p><p>Line two
16719 </p>
16720 </div>
16721
16722 !! end
16723
16724 !! test
16725 Nesting tags, paragraphs on lines which begin with <div>
16726 !! options
16727 disabled
16728 !! wikitext
16729 <div></div><strong>A
16730 B</strong>
16731 !! html
16732 <div></div>
16733 <p><strong>A
16734 B</strong>
16735 </p>
16736 !! end
16737
16738 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
16739 !! test
16740 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
16741 !! wikitext
16742 <blockquote>Line one
16743
16744 Line two</blockquote>
16745 !! html
16746 <blockquote>Line one
16747 Line two</blockquote>
16748
16749 !! end
16750
16751 !! test
16752 Bug 6200: paragraphs inside blockquotes (extra line break on open)
16753 !! wikitext
16754 <blockquote>
16755 Line one
16756
16757 Line two</blockquote>
16758 !! html
16759 <blockquote>
16760 <p>Line one
16761 </p>
16762 Line two</blockquote>
16763
16764 !! end
16765
16766 !! test
16767 Bug 6200: paragraphs inside blockquotes (extra line break on close)
16768 !! wikitext
16769 <blockquote>Line one
16770
16771 Line two
16772 </blockquote>
16773 !! html
16774 <blockquote>Line one
16775 <p>Line two
16776 </p>
16777 </blockquote>
16778
16779 !! end
16780
16781 !! test
16782 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16783 !! wikitext
16784 <blockquote>
16785 Line one
16786
16787 Line two
16788 </blockquote>
16789 !! html
16790 <blockquote>
16791 <p>Line one
16792 </p><p>Line two
16793 </p>
16794 </blockquote>
16795
16796 !! end
16797
16798 !! test
16799 Paragraphs inside blockquotes/divs (no extra line breaks)
16800 !! wikitext
16801 <blockquote><div>Line one
16802
16803 Line two</div></blockquote>
16804 !! html
16805 <blockquote><div>Line one
16806 Line two</div></blockquote>
16807
16808 !! end
16809
16810 !! test
16811 Paragraphs inside blockquotes/divs (extra line break on open)
16812 !! wikitext
16813 <blockquote><div>
16814 Line one
16815
16816 Line two</div></blockquote>
16817 !! html
16818 <blockquote><div>
16819 <p>Line one
16820 </p>
16821 Line two</div></blockquote>
16822
16823 !! end
16824
16825 !! test
16826 Paragraphs inside blockquotes/divs (extra line break on close)
16827 !! wikitext
16828 <blockquote><div>Line one
16829
16830 Line two
16831 </div></blockquote>
16832 !! html
16833 <blockquote><div>Line one
16834 <p>Line two
16835 </p>
16836 </div></blockquote>
16837
16838 !! end
16839
16840 !! test
16841 Paragraphs inside blockquotes/divs (extra line break on open and close)
16842 !! wikitext
16843 <blockquote><div>
16844 Line one
16845
16846 Line two
16847 </div></blockquote>
16848 !! html
16849 <blockquote><div>
16850 <p>Line one
16851 </p><p>Line two
16852 </p>
16853 </div></blockquote>
16854
16855 !! end
16856
16857 !! test
16858 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16859 !! options
16860 wgLinkHolderBatchSize=0
16861 !! wikitext
16862 [[meatball:1]]
16863 [[meatball:2]]
16864 [[meatball:3]]
16865 !! html
16866 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16867 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16868 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16869 </p>
16870 !! end
16871
16872 !! test
16873 Free external link invading image caption
16874 !! wikitext
16875 [[Image:Foobar.jpg|thumb|http://x|hello]]
16876 !! html
16877 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>hello</div></div></div>
16878
16879 !! end
16880
16881 !! test
16882 Bug 15196: localised external link numbers
16883 !! options
16884 language=fa
16885 !! wikitext
16886 [http://en.wikipedia.org/]
16887 !! html/php
16888 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16889 </p>
16890 !! html/parsoid
16891 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
16892 !! end
16893
16894 !! test
16895 Multibyte character in padleft
16896 !! wikitext
16897 {{padleft:-Hello|7|Æ}}
16898 !! html
16899 <p>Æ-Hello
16900 </p>
16901 !! end
16902
16903 !! test
16904 Multibyte character in padright
16905 !! wikitext
16906 {{padright:Hello-|7|Æ}}
16907 !! html
16908 <p>Hello-Æ
16909 </p>
16910 !! end
16911
16912 !!test
16913 formatdate parser function
16914 !! wikitext
16915 {{#formatdate:2009-03-24}}
16916 !! html
16917 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
16918 </p>
16919 !! end
16920
16921 !!test
16922 formatdate parser function, with default format
16923 !! wikitext
16924 {{#formatdate:2009-03-24|mdy}}
16925 !! html
16926 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
16927 </p>
16928 !! end
16929
16930 !! test
16931 Spacing of numbers in formatted dates
16932 !! wikitext
16933 {{#formatdate:January 15}}
16934 !! html
16935 <p><span class="mw-formatted-date" title="01-15">January 15</span>
16936 </p>
16937 !! end
16938
16939 !! test
16940 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
16941 !! options
16942 language=nl title=[[MediaWiki:Common.css]]
16943 !! wikitext
16944 {{#formatdate:2009-03-24|dmy}}
16945 !! html
16946 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
16947 </p>
16948 !! end
16949
16950 #
16951 #
16952 #
16953
16954 #
16955 # Edit comments
16956 #
16957
16958 !! test
16959 Edit comment with link
16960 !! options
16961 comment
16962 !! wikitext
16963 I like the [[Main Page]] a lot
16964 !! html
16965 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
16966 !!end
16967
16968 !! test
16969 Edit comment with link and link text
16970 !! options
16971 comment
16972 !! wikitext
16973 I like the [[Main Page|best pages]] a lot
16974 !! html
16975 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16976 !!end
16977
16978 !! test
16979 Edit comment with link and link text with suffix
16980 !! options
16981 comment
16982 !! wikitext
16983 I like the [[Main Page|best page]]s a lot
16984 !! html
16985 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16986 !!end
16987
16988 !! test
16989 Edit comment with section link (non-local, eg in history list)
16990 !! options
16991 comment title=[[Main Page]]
16992 !! wikitext
16993 /* External links */ removed bogus entries
16994 !! html
16995 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16996 !!end
16997
16998 !! test
16999 Edit comment with section link and text before it (non-local, eg in history list)
17000 !! options
17001 comment title=[[Main Page]]
17002 !! wikitext
17003 pre-comment text /* External links */ removed bogus entries
17004 !! html
17005 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>
17006 !!end
17007
17008 !! test
17009 Edit comment with section link (local, eg in diff view)
17010 !! options
17011 comment local title=[[Main Page]]
17012 !! wikitext
17013 /* External links */ removed bogus entries
17014 !! html
17015 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17016 !!end
17017
17018 !! test
17019 Edit comment with subpage link (bug 14080)
17020 !! options
17021 comment
17022 subpage
17023 title=[[Subpage test]]
17024 !! wikitext
17025 Poked at a [[/subpage]] here...
17026 !! html
17027 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
17028 !!end
17029
17030 !! test
17031 Edit comment with subpage link and link text (bug 14080)
17032 !! options
17033 comment
17034 subpage
17035 title=[[Subpage test]]
17036 !! wikitext
17037 Poked at a [[/subpage|neat little page]] here...
17038 !! html
17039 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
17040 !!end
17041
17042 !! test
17043 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
17044 !! options
17045 comment
17046 title=[[Subpage test]]
17047 !! wikitext
17048 Poked at a [[/subpage]] here...
17049 !! html
17050 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...
17051 !!end
17052
17053 !! test
17054 Edit comment with bare anchor link (local, as on diff)
17055 !! options
17056 comment
17057 local
17058 title=[[Main Page]]
17059 !! wikitext
17060 [[#section]]
17061 !! html
17062 <a href="#section">#section</a>
17063 !! end
17064
17065 !! test
17066 Edit comment with bare anchor link (non-local, as on history)
17067 !! options
17068 comment
17069 title=[[Main Page]]
17070 !! wikitext
17071 [[#section]]
17072 !! html
17073 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
17074 !! end
17075
17076 !! test
17077 Anchor starting with underscore
17078 !! wikitext
17079 [[#_ref|One]]
17080 !! html
17081 <p><a href="#_ref">One</a>
17082 </p>
17083 !! end
17084
17085 !! test
17086 Id starting with underscore
17087 !! wikitext
17088 <div id="_ref"></div>
17089 !! html
17090 <div id="_ref"></div>
17091
17092 !! end
17093
17094 !! test
17095 Space normalisation on autocomment (bug 22784)
17096 !! options
17097 comment
17098 title=[[Main Page]]
17099 !! wikitext
17100 /* __hello__world__ */
17101 !! html
17102 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
17103 !! end
17104
17105 !! test
17106 percent-encoding and + signs in comments (Bug 26410)
17107 !! options
17108 comment
17109 !! wikitext
17110 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
17111 !! html
17112 <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>
17113 !! end
17114
17115 !! test
17116 Bad images - basic functionality
17117 !! options
17118 disabled
17119 !! wikitext
17120 [[File:Bad.jpg]]
17121 !! html
17122 !! end
17123
17124 !! test
17125 Bad images - bug 16039: text after bad image disappears
17126 !! options
17127 disabled
17128 !! wikitext
17129 Foo bar
17130 [[File:Bad.jpg]]
17131 Bar foo
17132 !! html
17133 <p>Foo bar
17134 </p><p>Bar foo
17135 </p>
17136 !! end
17137
17138 !! test
17139 Verify that displaytitle works (bug #22501) no displaytitle
17140 !! options
17141 showtitle
17142 !! config
17143 wgAllowDisplayTitle=true
17144 wgRestrictDisplayTitle=false
17145 !! wikitext
17146 this is not the the title
17147 !! html
17148 Parser test
17149 <p>this is not the the title
17150 </p>
17151 !! end
17152
17153 !! test
17154 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
17155 !! options
17156 showtitle
17157 title=[[Screen]]
17158 !! config
17159 wgAllowDisplayTitle=true
17160 wgRestrictDisplayTitle=false
17161 !! wikitext
17162 this is not the the title
17163 {{DISPLAYTITLE:whatever}}
17164 !! html
17165 whatever
17166 <p>this is not the the title
17167 </p>
17168 !! end
17169
17170 !! test
17171 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
17172 !! options
17173 showtitle
17174 title=[[Screen]]
17175 !! config
17176 wgAllowDisplayTitle=true
17177 wgRestrictDisplayTitle=true
17178 !! wikitext
17179 this is not the the title
17180 {{DISPLAYTITLE:whatever}}
17181 !! html
17182 Screen
17183 <p>this is not the the title
17184 </p>
17185 !! end
17186
17187 !! test
17188 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
17189 !! options
17190 showtitle
17191 title=[[Screen]]
17192 !! config
17193 wgAllowDisplayTitle=true
17194 wgRestrictDisplayTitle=true
17195 !! wikitext
17196 this is not the the title
17197 {{DISPLAYTITLE:screen}}
17198 !! html
17199 screen
17200 <p>this is not the the title
17201 </p>
17202 !! end
17203
17204 !! test
17205 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
17206 !! options
17207 showtitle
17208 title=[[Screen]]
17209 !! config
17210 wgAllowDisplayTitle=false
17211 !! wikitext
17212 this is not the the title
17213 {{DISPLAYTITLE:screen}}
17214 !! html
17215 Screen
17216 <p>this is not the the title
17217 <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>
17218 </p>
17219 !! end
17220
17221 !! test
17222 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
17223 !! options
17224 showtitle
17225 title=[[Screen]]
17226 !! config
17227 wgAllowDisplayTitle=false
17228 !! wikitext
17229 this is not the the title
17230 !! html
17231 Screen
17232 <p>this is not the the title
17233 </p>
17234 !! end
17235
17236 !! test
17237 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
17238 !! options
17239 showtitle
17240 title=[[Screen]]
17241 !! config
17242 wgAllowDisplayTitle=true
17243 wgRestrictDisplayTitle=true
17244 !! wikitext
17245 this is not the the title
17246 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
17247 !! html
17248 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
17249 <p>this is not the the title
17250 </p>
17251 !! end
17252
17253 !! test
17254 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
17255 !! options
17256 showtitle
17257 title=[[Screen]]
17258 !! config
17259 wgAllowDisplayTitle=true
17260 wgRestrictDisplayTitle=true
17261 !! wikitext
17262 this is not the the title
17263 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
17264 !! html
17265 <span style="color: red;">s</span>creen
17266 <p>this is not the the title
17267 </p>
17268 !! end
17269
17270 !! test
17271 preload: check <noinclude> and <includeonly>
17272 !! options
17273 preload
17274 !! wikitext
17275 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
17276 !! html
17277 Hello kind world.
17278 !! end
17279
17280 !! test
17281 preload: check <onlyinclude>
17282 !! options
17283 preload
17284 !! wikitext
17285 Goodbye <onlyinclude>Hello world</onlyinclude>
17286 !! html
17287 Hello world
17288 !! end
17289
17290 !! test
17291 preload: can pass tags through if we want to
17292 !! options
17293 preload
17294 !! wikitext
17295 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
17296 !! html
17297 <includeonly>Hello world</includeonly>
17298 !! end
17299
17300 !! test
17301 preload: check that it doesn't try to do tricks
17302 !! options
17303 preload
17304 !! wikitext
17305 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17306 !! html
17307 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17308 !! end
17309
17310 !! test
17311 Play a bit with r67090 and bug 3158
17312 !! options
17313 disabled
17314 !! wikitext
17315 <div style="width:50% !important">&nbsp;</div>
17316 <div style="width:50%&nbsp;!important">&nbsp;</div>
17317 <div style="width:50%&#160;!important">&nbsp;</div>
17318 <div style="border : solid;">&nbsp;</div>
17319 !! html
17320 <div style="width:50% !important">&nbsp;</div>
17321 <div style="width:50% !important">&nbsp;</div>
17322 <div style="width:50% !important">&nbsp;</div>
17323 <div style="border&#160;: solid;">&nbsp;</div>
17324
17325 !! end
17326
17327 !! test
17328 HTML5 data attributes
17329 !! wikitext
17330 <span data-foo="bar">Baz</span>
17331 <p data-abc-def_hij="">Quuz</p>
17332 !! html
17333 <p><span data-foo="bar">Baz</span>
17334 </p>
17335 <p data-abc-def_hij="">Quuz</p>
17336
17337 !! end
17338
17339 !! test
17340 percent-encoding and + signs in internal links (Bug 26410)
17341 !! wikitext
17342 [[User:+%]] [[Page+title%]]
17343 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
17344 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
17345 [[%33%45]] [[%33%45+]]
17346 !! html
17347 <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>
17348 <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>
17349 <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>
17350 <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>
17351 </p>
17352 !! end
17353
17354 !! test
17355 Special characters in embedded file links (bug 27679)
17356 !! wikitext
17357 [[File:Contains & ampersand.jpg]]
17358 [[File:Does not exist.jpg|Title with & ampersand]]
17359 !! html
17360 <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>
17361 <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>
17362 </p>
17363 !! end
17364
17365
17366 !! test
17367 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
17368 !! wikitext
17369 Text&apos;s been normalized?
17370 !! html
17371 <p>Text&#39;s been normalized?
17372 </p>
17373 !! end
17374
17375 !! test
17376 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
17377 !! wikitext
17378 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
17379 !! html
17380 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
17381 </p>
17382 !! end
17383
17384 !! test
17385 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
17386 !! wikitext
17387 [http://www.example.org/ ideograms]
17388 !! html
17389 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
17390 </p>
17391 !! end
17392
17393 !! test
17394 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
17395 !! wikitext
17396 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
17397 !! html
17398 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
17399 </p>
17400 !! end
17401
17402 !! article
17403 Mediawiki:loop1
17404 !! text
17405 {{Identical|A}}
17406 !! endarticle
17407
17408 !! article
17409 Mediawiki:loop2
17410 !! text
17411 {{Identical|B}}
17412 !! endarticle
17413
17414 !! article
17415 Template:Identical
17416 !! text
17417 {{int:loop1}}
17418 {{int:loop2}}
17419 !! endarticle
17420
17421 !! test
17422 Bug 31098 Template which includes system messages which includes the template
17423 !! wikitext
17424 {{Identical}}
17425 !! html
17426 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17427 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17428 </p>
17429 !! end
17430
17431 !! test
17432 Bug31490 Turkish: ucfirst 'blah'
17433 !! options
17434 language=tr
17435 !! wikitext
17436 {{ucfirst:blah}}
17437 !! html
17438 <p>Blah
17439 </p>
17440 !! end
17441
17442 !! test
17443 Bug31490 Turkish: ucfirst 'ix'
17444 !! options
17445 language=tr
17446 !! wikitext
17447 {{ucfirst:ix}}
17448 !! html
17449 <p>İx
17450 </p>
17451 !! end
17452
17453 !! test
17454 Bug31490 Turkish: lcfirst 'BLAH'
17455 !! options
17456 language=tr
17457 !! wikitext
17458 {{lcfirst:BLAH}}
17459 !! html
17460 <p>bLAH
17461 </p>
17462 !! end
17463
17464 !! test
17465 Bug31490 Turkish: ucfırst (with a dotless i)
17466 !! options
17467 language=tr
17468 !! wikitext
17469 {{ucfırst:blah}}
17470 !! html
17471 <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>
17472 </p>
17473 !! end
17474
17475 !! test
17476 Bug31490 ucfırst (with a dotless i) with English language
17477 !! options
17478 language=en
17479 !! wikitext
17480 {{ucfırst:blah}}
17481 !! html
17482 <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>
17483 </p>
17484 !! end
17485
17486 !! test
17487 Bug 26375: TOC with italics
17488 !! options
17489 title=[[Main Page]]
17490 !! wikitext
17491 __TOC__
17492 == ''Lost'' episodes ==
17493 !! html
17494 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17495 <ul>
17496 <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>
17497 </ul>
17498 </div>
17499
17500 <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>
17501
17502 !! end
17503
17504 !! test
17505 Bug 26375: TOC with bold
17506 !! options
17507 title=[[Main Page]]
17508 !! wikitext
17509 __TOC__
17510 == '''should be bold''' then normal text ==
17511 !! html
17512 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17513 <ul>
17514 <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>
17515 </ul>
17516 </div>
17517
17518 <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>
17519
17520 !! end
17521
17522 !! test
17523 Bug 33845: Headings become cursive in TOC when they contain an image
17524 !! options
17525 title=[[Main Page]]
17526 !! wikitext
17527 __TOC__
17528 == Image [[Image:foobar.jpg]] ==
17529 !! html
17530 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17531 <ul>
17532 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
17533 </ul>
17534 </div>
17535
17536 <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>
17537
17538 !! end
17539
17540 !! test
17541 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
17542 !! options
17543 title=[[Main Page]]
17544 !! wikitext
17545 __TOC__
17546 == <blockquote>Quote</blockquote> ==
17547 !! html
17548 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17549 <ul>
17550 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
17551 </ul>
17552 </div>
17553
17554 <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>
17555
17556 !! end
17557
17558 !! test
17559 Unclosed tags in TOC
17560 !! options
17561 title=[[Main Page]]
17562 !! wikitext
17563 __TOC__
17564 == Proof: 2 < 3 ==
17565 <small>Hanc marginis exiguitas non caperet.</small>
17566 QED
17567 !! html
17568 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17569 <ul>
17570 <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>
17571 </ul>
17572 </div>
17573
17574 <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>
17575 <p><small>Hanc marginis exiguitas non caperet.</small>
17576 QED
17577 </p>
17578 !! end
17579
17580 !! test
17581 Multiple tags in TOC
17582 !! wikitext
17583 __TOC__
17584 == <i>Foo</i> <b>Bar</b> ==
17585
17586 == <i>Foo</i> <blockquote>Bar</blockquote> ==
17587 !! html
17588 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17589 <ul>
17590 <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>
17591 <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>
17592 </ul>
17593 </div>
17594
17595 <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>
17596 <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>
17597
17598 !! end
17599
17600 !! test
17601 Tags with parameters in TOC
17602 !! wikitext
17603 __TOC__
17604 == <sup class="in-h2">Hello</sup> ==
17605
17606 == <sup class="a > b">Evilbye</sup> ==
17607 !! html
17608 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17609 <ul>
17610 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
17611 <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>
17612 </ul>
17613 </div>
17614
17615 <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>
17616 <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>
17617
17618 !! end
17619
17620 !! test
17621 span tags with directionality in TOC
17622 !! wikitext
17623 __TOC__
17624 == <span dir="ltr">C++</span> ==
17625
17626 == <span dir="rtl">זבנג!</span> ==
17627
17628 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
17629
17630 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
17631
17632 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
17633 !! html
17634 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17635 <ul>
17636 <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>
17637 <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>
17638 <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>
17639 <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>
17640 <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>
17641 </ul>
17642 </div>
17643
17644 <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>
17645 <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>
17646 <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>
17647 <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>
17648 <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>
17649
17650 !! end
17651
17652 !! article
17653 MediaWiki:Bug32057
17654 !! text
17655 == {{int:headline_sample}} ==
17656 !! endarticle
17657
17658 !! test
17659 Bug 32057: Title needed when expanding <h> nodes.
17660 !! options
17661 title=[[Main Page]]
17662 !! wikitext
17663 {{int:Bug32057}}
17664 !! html
17665 <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>
17666
17667 !! end
17668
17669 !! test
17670 Strip marker in urlencode
17671 !! wikitext
17672 {{urlencode:x<nowiki/>y}}
17673 {{urlencode:x<nowiki/>y|wiki}}
17674 {{urlencode:x<nowiki/>y|path}}
17675 !! html
17676 <p>xy
17677 xy
17678 xy
17679 </p>
17680 !! end
17681
17682 !! test
17683 Strip marker in lc
17684 !! wikitext
17685 {{lc:x<nowiki/>y}}
17686 !! html
17687 <p>xy
17688 </p>
17689 !! end
17690
17691 !! test
17692 Strip marker in uc
17693 !! wikitext
17694 {{uc:x<nowiki/>y}}
17695 !! html
17696 <p>XY
17697 </p>
17698 !! end
17699
17700 !! test
17701 Strip marker in formatNum
17702 !! wikitext
17703 {{formatnum:1<nowiki/>2}}
17704 {{formatnum:1<nowiki/>2|R}}
17705 !! html
17706 <p>12
17707 12
17708 </p>
17709 !! end
17710
17711 !! test
17712 Check noCommafy in formatNum
17713 !! options
17714 language=be-tarask
17715 !! wikitext
17716 {{formatnum:123456.78}}
17717 {{formatnum:123456.78|NOSEP}}
17718 !! html
17719 <p>123 456,78
17720 123456.78
17721 </p>
17722 !! end
17723
17724 !! test
17725 Wrong option for formatNum (bug 56199)
17726 !! wikitext
17727 {{formatnum:1,234.56|Random}}
17728 {{formatnum:1,234.56|EVERYTHING}}
17729 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
17730 !! html
17731 <p>1,234.56
17732 1,234.56
17733 1,234.56
17734 </p>
17735 !! end
17736
17737 !! test
17738 Strip marker in grammar
17739 !! options
17740 language=fi
17741 !! wikitext
17742 {{grammar:elative|foo<nowiki/>bar}}
17743 !! html
17744 <p>foobarista
17745 </p>
17746 !! end
17747
17748 !! test
17749 Strip marker in padleft
17750 !! wikitext
17751 {{padleft:|2|x<nowiki/>y}}
17752 !! html
17753 <p>xy
17754 </p>
17755 !! end
17756
17757 !! test
17758 Strip marker in padright
17759 !! wikitext
17760 {{padright:|2|x<nowiki/>y}}
17761 !! html
17762 <p>xy
17763 </p>
17764 !! end
17765
17766 !! test
17767 Strip marker in anchorencode
17768 !! wikitext
17769 {{anchorencode:x<nowiki/>y}}
17770 !! html
17771 <p>xy
17772 </p>
17773 !! end
17774
17775 !! test
17776 nowiki inside link inside heading (bug 18295)
17777 !! wikitext
17778 ==[[foo|x<nowiki>y</nowiki>z]]==
17779 !! html
17780 <h2><span class="mw-headline" id="xyz"><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">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>
17781
17782 !! end
17783
17784 !! test
17785 new support for bdi element (bug 31817)
17786 !! wikitext
17787 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17788 !! html
17789 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17790
17791 !!end
17792
17793 !! test
17794 Ignore pipe between table row attributes
17795 !! wikitext
17796 {|
17797 | quux
17798 |- id=foo | style='color: red'
17799 | bar
17800 |}
17801 !! html
17802 <table>
17803 <tr>
17804 <td> quux
17805 </td></tr>
17806 <tr id="foo" style="color: red">
17807 <td> bar
17808 </td></tr></table>
17809
17810 !! end
17811
17812 !!test
17813 Gallery override link with WikiLink (bug 34852)
17814 !! wikitext
17815 <gallery>
17816 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17817 </gallery>
17818 !! html
17819 <ul class="gallery mw-gallery-traditional">
17820 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17821 <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>
17822 <div class="gallerytext">
17823 <p>caption
17824 </p>
17825 </div>
17826 </div></li>
17827 </ul>
17828
17829 !! end
17830
17831 !!test
17832 Gallery override link with absolute external link (bug 34852)
17833 !! wikitext
17834 <gallery>
17835 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17836 </gallery>
17837 !! html
17838 <ul class="gallery mw-gallery-traditional">
17839 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17840 <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>
17841 <div class="gallerytext">
17842 <p>caption
17843 </p>
17844 </div>
17845 </div></li>
17846 </ul>
17847
17848 !! end
17849
17850 !!test
17851 Gallery override link with malicious javascript (bug 34852)
17852 !! wikitext
17853 <gallery>
17854 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17855 </gallery>
17856 !! html
17857 <ul class="gallery mw-gallery-traditional">
17858 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17859 <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>
17860 <div class="gallerytext">
17861 <p>caption
17862 </p>
17863 </div>
17864 </div></li>
17865 </ul>
17866
17867 !! end
17868
17869 !!test
17870 Gallery with invalid title as link (bug 43964)
17871 !! wikitext
17872 <gallery>
17873 File:foobar.jpg|link=<
17874 </gallery>
17875 !! html
17876 <ul class="gallery mw-gallery-traditional">
17877 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17878 <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>
17879 <div class="gallerytext">
17880 </div>
17881 </div></li>
17882 </ul>
17883
17884 !! end
17885
17886 !!test
17887 Language parser function
17888 !! wikitext
17889 {{#language:ar}}
17890 !! html
17891 <p>العربية
17892 </p>
17893 !! end
17894
17895 !!test
17896 Padleft and padright as substr
17897 !! wikitext
17898 {{padleft:|3|abcde}}
17899 {{padright:|3|abcde}}
17900 !! html
17901 <p>abc
17902 abc
17903 </p>
17904 !! end
17905
17906 !!test
17907 Special parser function
17908 !! wikitext
17909 {{#special:RandomPage}}
17910 {{#special:BaDtItLe}}
17911 {{#special:Foobar}}
17912 !! html
17913 <p>Special:Random
17914 Special:Badtitle
17915 Special:Foobar
17916 </p>
17917 !! end
17918
17919 !!test
17920 Bug 34939 - Case insensitive link parsing ([HttP://])
17921 !! wikitext
17922 [HttP://MediaWiki.Org/]
17923 !! html/php
17924 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
17925 </p>
17926 !! html/parsoid
17927 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
17928 !! end
17929
17930 !!test
17931 Bug 34939 - Case insensitive link parsing ([HttP:// title])
17932 !! wikitext
17933 [HttP://MediaWiki.Org/ MediaWiki]
17934 !! html
17935 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
17936 </p>
17937 !! end
17938
17939 !!test
17940 Bug 34939 - Case insensitive link parsing (HttP://)
17941 !! wikitext
17942 HttP://MediaWiki.Org/
17943 !! html/php
17944 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
17945 </p>
17946 !! html/parsoid
17947 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
17948 !! end
17949
17950 !!test
17951 Disable TOC
17952 !! options
17953 notoc
17954 !! wikitext
17955 Lead
17956 == Section 1 ==
17957 == Section 2 ==
17958 == Section 3 ==
17959 == Section 4 ==
17960 == Section 5 ==
17961 !! html
17962 <p>Lead
17963 </p>
17964
17965 <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>
17966 <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>
17967 <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>
17968 <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>
17969 <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>
17970
17971 !! end
17972
17973
17974 ###
17975 ### Parsoid-specific tests
17976 ### Parsoid-PHP parser incompatibilities
17977 ###
17978 !!test
17979 1. SOL-sensitive wikitext tokens as template-args
17980 !!options
17981 parsoid=wt2html,wt2wt
17982 !! wikitext
17983 {{echo|*a}}
17984 {{echo|#a}}
17985 {{echo|:a}}
17986 !! html
17987 <span about="#mwt1" typeof="mw:Transclusion">
17988 </span><ul about="#mwt1"><li>a</li>
17989 </ul>
17990 <span about="#mwt2" typeof="mw:Transclusion">
17991 </span><ol about="#mwt2"><li>a</li>
17992 </ol>
17993 <span about="#mwt3" typeof="mw:Transclusion">
17994 </span><dl about="#mwt3"><dd>a</dd>
17995 </dl>
17996 !!end
17997
17998 #### -----------------------------------------------------------------
17999 #### Parsoid-specific functionality tests
18000 #### -----------------------------------------------------------------
18001
18002 # Bug 63642: Formatting elt fixup is cleaned up.
18003 # We know wt2wt will fail, but we expect selser to pass.
18004 # Due to the nature of our testing, wt2wt and selser tests will enter the
18005 # blacklist and we'll catch selser regressions based on changes to the
18006 # blacklist entries for selser tests.
18007 !! test
18008 Bad treebuilder fixup of formatting elt is cleaned up
18009 !! options
18010 parsoid=wt2html,wt2wt
18011 !! wikitext
18012 {|
18013 |
18014 <small>
18015 [[Image:Foobar.jpg|right|Test]]
18016 </small>
18017 |}
18018 !! html/parsoid
18019 <table>
18020 <tbody><tr><td>
18021 <p><small></small></p>
18022 <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><small>Test</small></figcaption></figure>
18023 <p></p></td></tr>
18024 </tbody></table>
18025 !! end
18026
18027 #### ----------------------------------------------------------------
18028 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
18029 #### tags. Parsoid's output for these tags differs from that of the
18030 #### PHP parser.
18031 #### ----------------------------------------------------------------
18032
18033 !!test
18034 Ref: 1. ref-location should be replaced with an index span
18035 !!options
18036 parsoid
18037 !! wikitext
18038 A <ref>foo</ref>
18039 B <ref name="x">foo</ref>
18040 C <ref name="y" />
18041 !! html
18042 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
18043 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-2">[2]</a></span>
18044 C <span about="#mwt3" class="reference" data-mw='{"name":"ref","attrs":{"name":"y"}}' id="cite_ref-y-3-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-y-3">[3]</a></span></p>
18045 !!end
18046
18047 !!test
18048 Ref: 2. ref-tags with identical names should all get the same index
18049 !!options
18050 parsoid
18051 !! wikitext
18052 A <ref name="x">foo</ref>
18053 B <ref name="x" />
18054 !! html
18055 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
18056 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span></p>
18057 !!end
18058
18059 !!test
18060 Ref: 3. spaces in ref-names should be ignored
18061 !!options
18062 parsoid
18063 !! wikitext
18064 A <ref name="x">foo</ref>
18065 B <ref name=" x " />
18066 C <ref name= x />
18067 !! html
18068 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
18069 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
18070 C <span about="#mwt3" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-2" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span></p>
18071 !!end
18072
18073 !!test
18074 Ref: 4. 'constructor' should be accepted as a valid ref-name
18075 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
18076 !!options
18077 parsoid
18078 !! wikitext
18079 A <ref name="constructor">foo</ref>
18080 !! html
18081 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"constructor"}}' id="cite_ref-constructor-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-constructor-1">[1]</a></span></p>
18082 !!end
18083
18084 !!test
18085 Ref: 5. body should accept generic wikitext
18086 !!options
18087 parsoid
18088 !! wikitext
18089 A <ref>
18090 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
18091 </ref>
18092
18093 <references />
18094 !! html
18095 <p>A <span about="#mwt2" class="reference" 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\" 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-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"transclusion\"}},\"i\":0}}]}&#39; data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]],\"dsr\":[55,76,null,null]}&#39;>transclusion&lt;/span>\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
18096
18097 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
18098 <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">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>
18099 </li>
18100 </ol>
18101 !!end
18102
18103 !!test
18104 Ref: 6. indent-pres should not be output in ref-body
18105 !!options
18106 parsoid
18107 !! wikitext
18108 A <ref>
18109 foo
18110 bar
18111 baz
18112 </ref>
18113
18114 <references />
18115 !! html
18116 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo\n bar\n baz\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
18117
18118 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
18119 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18120 bar
18121 baz
18122 </li>
18123 </ol>
18124 !!end
18125
18126 !!test
18127 Ref: 7. No p-wrapping in ref-body
18128 !!options
18129 parsoid
18130 !! wikitext
18131 A <ref>
18132 foo
18133
18134 bar
18135
18136
18137 baz
18138
18139
18140
18141 booz
18142 </ref>
18143
18144 <references />
18145 !! html
18146 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo\n\nbar\n\n\nbaz\n\n\n\nbooz\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
18147
18148 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18149 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18150
18151 bar
18152
18153
18154 baz
18155
18156
18157
18158 booz
18159 </li>
18160 </ol>
18161 !!end
18162
18163 !!test
18164 Ref: 8. transclusion wikitext has lower precedence
18165 !!options
18166 parsoid
18167 !! wikitext
18168 A <ref> foo {{echo|</ref> B C}}
18169
18170 <references />
18171 !! html
18172 <p>A <span class="reference" data-mw="{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;foo <span typeof=\&quot;mw:Nowiki\&quot; data-parsoid='{\&quot;src\&quot;:\&quot;{{\&quot;,\&quot;dsr\&quot;:[12,14,0,0]}'>{{</span>echo|&quot;},&quot;attrs&quot;:{}}" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C<span typeof="mw:Nowiki">}}</span></p>
18173 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
18174 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <span typeof="mw:Nowiki">{{</span>echo|</li>
18175 </ol>
18176 !!end
18177
18178 !!test
18179 Ref: 9. unclosed comments should not leak out of ref-body
18180 !!options
18181 parsoid
18182 !! wikitext
18183 A <ref> foo <!--</ref> B C
18184 <references />
18185 !! html
18186 <p>A <span class="reference" data-mw='{"name":"ref","body":{"html":"foo &lt;!---->"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C</p>
18187 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18188 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
18189 </ol>
18190 !!end
18191
18192 !!test
18193 Ref: 10. Unclosed HTML tags should not leak out of ref-body
18194 !!options
18195 parsoid
18196 !! wikitext
18197 A <ref> <b> foo </ref> B C
18198
18199 <references />
18200 !! html
18201 <p>A <span about="#mwt2" class="reference" 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":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref> &lt;b> foo &lt;/ref>"}'><a href="#cite_note-1">[1]</a></span> B C</p>
18202
18203
18204 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18205 <li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> <b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></li>
18206 </ol>
18207 !!end
18208
18209 !!test
18210 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
18211 !!options
18212 parsoid
18213 !! wikitext
18214 A <ref>foo</ref> B
18215 C <ref>bar</ref> D
18216 !! html
18217 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo&lt;/ref>"}'><a href="#cite_note-1">[1]</a></span> B
18218 C <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>bar&lt;/ref>"}'><a href="#cite_note-2">[2]</a></span> D</p>
18219 !!end
18220
18221 !!test
18222 Ref: 12. ref-tags act as trailing newline migration barrier
18223 !!options
18224 parsoid
18225 !! wikitext
18226 <!--the newline at the end of this line moves out of the p-tag-->a
18227
18228 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
18229 <ref />
18230
18231 c
18232 !! html
18233 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
18234
18235
18236 <p>b<!--the newline at the end of this line stays inside the p-tag--> <span about="#mwt1" class="reference" data-mw='{"name":"ref","attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
18237 <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span></p>
18238
18239
18240 <p>c</p>
18241 !!end
18242
18243 !!test
18244 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
18245 !!options
18246 parsoid
18247 !! wikitext
18248 <ref>foo</ref> A
18249 <ref>bar
18250 </ref> B
18251 !! html
18252 <p><span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> A
18253 <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"bar\n"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span> B</p>
18254 !!end
18255
18256 !!test
18257 Ref: 14. A nested ref-tag should be emitted as plain text
18258 !!options
18259 parsoid
18260 !! wikitext
18261 <ref>foo <ref>bar</ref> baz</ref>
18262
18263 <references />
18264 !! html
18265 <p><span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo &amp;lt;ref>bar&amp;lt;/ref> baz"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo &lt;ref>bar&lt;/ref> baz&lt;/ref>"}'><a href="#cite_note-1">[1]</a></span></p>
18266
18267 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18268 <li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo &lt;ref>bar&lt;/ref> baz</li>
18269 </ol>
18270 !!end
18271
18272 !!test
18273 Ref: 15. ref-tags with identical names should get identical indexes
18274 !!options
18275 parsoid
18276 !! wikitext
18277 A1 <ref name="a">foo</ref> A2 <ref name="a" />
18278 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
18279
18280 <references />
18281 !! html
18282 <p>A1 <span about="#mwt3" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a"}}' id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span> A2 <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"name":"a"}}' id="cite_ref-a-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span>
18283 B1 <span about="#mwt7" class="reference" data-mw='{"name":"ref","attrs":{"name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span> B2 <span about="#mwt8" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}' id="cite_ref-b-2-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span></p>
18284
18285 <ol about="#mwt10" class="references" typeof="mw:Extension/references" 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>
18286 </ol>
18287 !!end
18288
18289 ## We don't bother wt2wt-ing non-standard whitespace
18290 !!test
18291 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
18292 !!options
18293 parsoid=wt2html
18294 !! wikitext
18295 A <ref >foo</ref >
18296
18297 <references />
18298 !! html
18299 <p>A <span class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
18300
18301 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18302 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
18303 !!end
18304
18305 !!test
18306 References: 1. references tag without any refs should be handled properly
18307 !!options
18308 parsoid
18309 !! wikitext
18310 <references />
18311 !! html
18312 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
18313 !!end
18314
18315 !!test
18316 References: 2. references tag with group only outputs references from that group
18317 !!options
18318 parsoid
18319 !! wikitext
18320 A <ref group="a">foo</ref>
18321 B <ref group="b">bar</ref>
18322
18323 <references group="a" />
18324 !! html
18325 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"group":"a"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[a 1]</a></span>
18326 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"group":"b"}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[b 1]</a></span></p>
18327
18328 <ol about="#mwt6" class="references" typeof="mw:Extension/references" 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>
18329 </ol>
18330 !!end
18331
18332 !!test
18333 References: 3. ref list should be cleared after processing references
18334 !!options
18335 parsoid
18336 !! wikitext
18337 A <ref>foo</ref>
18338
18339 <references />
18340
18341 B <ref>bar</ref>
18342
18343 <references />
18344 !! html
18345 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
18346
18347 <ol about="#mwt4" class="references" typeof="mw:Extension/references" 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>
18348 </ol>
18349
18350 <p>B <span about="#mwt6" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[1]</a></span></p>
18351
18352 <ol about="#mwt8" class="references" typeof="mw:Extension/references" 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>
18353 </ol>
18354 !!end
18355
18356 !!test
18357 References: 4. only referenced group should be cleared after processing references
18358 !!options
18359 parsoid
18360 !! wikitext
18361 A <ref group="a">afoo</ref>
18362 B <ref>bfoo</ref>
18363
18364 <references group="a" />
18365
18366 C <ref>cfoo</ref>
18367
18368 <references />
18369 !! html
18370 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"afoo"},"attrs":{"group":"a"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[a 1]</a></span>
18371 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bfoo"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref>bfoo</ref>"}'><a href="#cite_note-2">[1]</a></span></p>
18372
18373 <ol about="#mwt6" class="references" typeof="mw:Extension/references" 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>
18374 </ol>
18375
18376 <p>C <span about="#mwt8" class="reference" data-mw='{"name":"ref","body":{"html":"cfoo"},"attrs":{}}' id="cite_ref-3-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-3">[2]</a></span></p>
18377
18378 <ol about="#mwt10" class="references" typeof="mw:Extension/references" 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>
18379 </ol>
18380 !!end
18381
18382 !!test
18383 References: 5. ref tags in references should be processed while ignoring all other content
18384 !!options
18385 parsoid
18386 !! wikitext
18387 A <ref name="a" />
18388 B <ref name="b">bar</ref>
18389
18390 <references>
18391 <ref name="a">foo</ref>
18392 This should just get lost.
18393 </references>
18394 !! html
18395 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"a"}}' id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref name=\"a\" />"}'><a href="#cite_note-a-1">[1]</a></span>
18396 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref name=\"b\">bar&lt;/ref>"}'><a href="#cite_note-b-2">[2]</a></span></p>
18397
18398
18399 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-parsoid='{"src":"&lt;references>\n&lt;ref name=\"a\">foo&lt;/ref>\nThis should just get lost.\n&lt;/references>"}' 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\" data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"a\"}}&#39; rel=\"dc:references\" typeof=\"mw:Extension/ref\">&lt;a href=\"#cite_note-a-1\">[1]&lt;/a>&lt;/span>\n"},"attrs":{}}'>
18400 <li about="#cite_note-a-1" id="cite_note-a-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-a-1-0">↑</a></span> foo</li>
18401 <li about="#cite_note-b-2" id="cite_note-b-2" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> bar</li>
18402 </ol>
18403 !!end
18404
18405 !!test
18406 References: 6. <references /> from a transclusion
18407 !!options
18408 parsoid
18409 !! wikitext
18410 <ref>Foo</ref> {{echo|<references />}}
18411 !! html
18412 <span about="#mwt3" class="reference" data-mw='{"name":"ref","body":{"html":"Foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> <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>
18413 !!end
18414
18415 !! test
18416 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
18417 !! options
18418 parsoid
18419 !! wikitext
18420 A <ref>foo bar for a</ref>
18421 B <ref group="X" name="b" />
18422
18423 <references />
18424
18425 <references group="X">
18426 <ref name="b">foo</ref>
18427 </references>
18428 !! html
18429 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo bar for a&lt;/ref>"}'><a href="#cite_note-2" data-parsoid="{}">[2]</a></span>
18430 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}' id="cite_ref-b-3-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref name=\"b\" group=\"X\" />"}'><a href="#cite_note-b-3" data-parsoid="{}">[X 1]</a></span></p>
18431
18432 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-b-1" id="cite_note-b-1" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}">↑</span> foo</li><li about="#cite_note-2" id="cite_note-2" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-2-0" data-parsoid="{}">↑</a></span> foo bar for a</li></ol>
18433
18434 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-parsoid='{"src":"&lt;references group=\"X\">\n&lt;ref name=\"b\">foo&lt;/ref>\n&lt;/references>","group":"X"}' data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"b\">foo&lt;/ref>","html":"\n&lt;span about=\"#mwt10\" class=\"reference\" data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"b\"}}&#39; rel=\"dc:references\" typeof=\"mw:Extension/ref\">&lt;a href=\"#cite_note-b-1\">[1]&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'><li about="#cite_note-b-3" id="cite_note-b-3" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-b-3-0" data-parsoid="{}">↑</a></span> </li></ol>
18435 !! end
18436
18437 !! test
18438 Entities in ref name
18439 !! options
18440 parsoid
18441 !! wikitext
18442 <ref name="test &amp; me">hi</ref>
18443 !! html
18444 <p data-parsoid='{}'><span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"hi"},"attrs":{"name":"test &amp; me"}}' 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>"}'><a href="#cite_note-test &amp; me-1" data-parsoid="{}">[1]</a></span></p>
18445 !! end
18446
18447 # This test is wt2html only because we're permitting the serializer to produce
18448 # dirty diffs, normalizing the unclosed references to the self-closed version.
18449 !! test
18450 Generate references for unclosed references tag
18451 !! options
18452 parsoid=wt2html
18453 !! wikitext
18454 a<ref>foo</ref>
18455
18456 <references>
18457 !! html
18458 <p data-parsoid='{}'>a<span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo&lt;/ref>"}'><a href="#cite_note-1" data-parsoid="{}">[1]</a></span></p>
18459
18460
18461 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
18462 <li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-1-0" data-parsoid="{}">↑</a></span> foo</li></ol>
18463 !! end
18464
18465 !! test
18466 New reference serializes on its own line
18467 !! options
18468 parsoid=wt2wt,html2wt
18469 !! wikitext
18470 foo
18471 <references />
18472 !! html
18473 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
18474 !! end
18475
18476 #### ----------------------------------------------------------------
18477 #### The following section of tests are primarily to test
18478 #### wikitext escaping capabilities of Parsoid. Given that
18479 #### escaping can be done any number of ways, the wikitext (input)
18480 #### is always adjusted to reflect how Parsoid adds nowiki
18481 #### escape tags.
18482 ####
18483 #### We are marking several tests as parsoid-only since the
18484 #### HTML in the result section is different from what the
18485 #### PHP parser generates for it.
18486 #### ----------------------------------------------------------------
18487
18488
18489 #### --------------- Headings ---------------
18490 #### 0. Unnested
18491 #### 1. Nested inside html <h1>=foo=</h1>
18492 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
18493 #### 3. Nested inside html with wikitext split by html tags
18494 #### 4. No escape needed
18495 #### 5. Empty headings <h1></h1>
18496 #### 6. Heading chars in SOL context
18497 #### ----------------------------------------
18498 !! test
18499 Headings: 0. Unnested
18500 !! options
18501 parsoid
18502 !! wikitext
18503 <nowiki>=foo=</nowiki>
18504
18505 <nowiki> =foo= </nowiki>
18506 <!--cmt-->
18507 <nowiki>=foo=</nowiki>
18508
18509 =foo''a''<nowiki>=</nowiki>
18510 !! html
18511 <p><span typeof="mw:Nowiki">=foo=</span></p>
18512
18513 <p><span typeof="mw:Nowiki"> =foo= </span>
18514 <!--cmt-->
18515 <span typeof="mw:Nowiki">=foo=</span></p>
18516
18517 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
18518 !!end
18519
18520 !! test
18521 Headings: 1. Nested inside html
18522 (New headings and existing headings are handled differently)
18523 !! options
18524 parsoid=html2wt
18525 !! wikitext
18526 = =foo= =
18527
18528 == =foo= ==
18529
18530 === =foo= ===
18531
18532 =<nowiki>=foo=</nowiki>=
18533 ==<nowiki>=foo=</nowiki>==
18534 ===<nowiki>=foo=</nowiki>===
18535 ====<nowiki>=foo=</nowiki>====
18536 =====<nowiki>=foo=</nowiki>=====
18537 ======<nowiki>=foo=</nowiki>======
18538
18539 !! html
18540 <h1>=foo=</h1>
18541 <h2>=foo=</h2>
18542 <h3>=foo=</h3>
18543
18544 <h1 data-parsoid='{}'>=foo=</h1>
18545 <h2 data-parsoid='{}'>=foo=</h2>
18546 <h3 data-parsoid='{}'>=foo=</h3>
18547 <h4 data-parsoid='{}'>=foo=</h4>
18548 <h5 data-parsoid='{}'>=foo=</h5>
18549 <h6 data-parsoid='{}'>=foo=</h6>
18550 !!end
18551
18552 !! test
18553 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
18554 !! options
18555 parsoid=html2wt
18556 !! wikitext
18557 = foo =
18558 <nowiki>*</nowiki>bar
18559
18560 = foo =
18561 =bar
18562
18563 = foo =
18564 <nowiki>=bar=</nowiki>
18565 !! html
18566 <h1>foo</h1>*bar
18567 <h1>foo</h1>=bar
18568 <h1>foo</h1>=bar=
18569 !!end
18570
18571 !! test
18572 Headings: 3. Nested inside html with wikitext split by html tags
18573 !! options
18574 parsoid=html2wt
18575 !! wikitext
18576 = ='''bold'''<nowiki>foo=</nowiki> =
18577 !! html
18578 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
18579 !!end
18580
18581 !! test
18582 Headings: 4a. No escaping needed (testing just h1 and h2)
18583 !! options
18584 parsoid=html2wt
18585 !! wikitext
18586 = =foo =
18587
18588 = foo= =
18589
18590 = =foo= =
18591
18592 = =foo= bar =
18593
18594 == =foo ==
18595
18596 == foo= ==
18597
18598 = ''=''foo= =
18599
18600 = <nowiki>=</nowiki> =
18601 !! html
18602 <h1>=foo</h1>
18603 <h1>foo=</h1>
18604 <h1> =foo= </h1>
18605 <h1>=foo= bar</h1>
18606 <h2>=foo</h2>
18607 <h2>foo=</h2>
18608 <h1><i>=</i>foo=</h1>
18609 <h1><span typeof="mw:Nowiki">=</span></h1>
18610 !!end
18611
18612 !! test
18613 Headings: 4b. No escaping needed (inside p-tags)
18614 !! options
18615 parsoid=html2wt
18616 !! wikitext
18617 ===
18618 =foo= x
18619 =foo= <s></s>
18620 !! html
18621 <p>===
18622 =foo= x
18623 =foo= <s></s>
18624 </p>
18625 !!end
18626
18627 !! test
18628 Headings: 5. Empty headings
18629 !! options
18630 parsoid
18631 !! wikitext
18632 =<nowiki/>=
18633
18634 ==<nowiki/>==
18635
18636 ===<nowiki/>===
18637
18638 ====<nowiki/>====
18639
18640 =====<nowiki/>=====
18641
18642 ======<nowiki/>======
18643 !! html
18644 <h1></h1>
18645 <h2></h2>
18646 <h3></h3>
18647 <h4></h4>
18648 <h5></h5>
18649 <h6></h6>
18650 !!end
18651
18652 !! test
18653 Headings: 6a. Heading chars in SOL context (with trailing spaces)
18654 !! options
18655 parsoid
18656 !! wikitext
18657 <nowiki>=a=</nowiki>
18658
18659 <nowiki>=a=</nowiki>
18660
18661 <nowiki>=a=</nowiki>
18662
18663 <nowiki>=a=</nowiki>
18664 !! html
18665 <p>=a=</p>
18666 <p>=a= </p>
18667 <p>=a= </p>
18668 <p>=a= </p>
18669 !!end
18670
18671 !! test
18672 Headings: 6b. Heading chars in SOL context (with trailing newlines)
18673 !! options
18674 parsoid
18675 !! wikitext
18676 <nowiki>=a=
18677 b</nowiki>
18678
18679 <nowiki>=a=
18680 b</nowiki>
18681
18682 <nowiki>=a=
18683 b</nowiki>
18684
18685 <nowiki>=a=
18686 b</nowiki>
18687 !! html
18688 <p>=a=
18689 b</p>
18690 <p>=a=
18691 b</p>
18692 <p>=a=
18693 b</p>
18694 <p>=a=
18695 b</p>
18696 </p>
18697 !!end
18698
18699 !! test
18700 Headings: 6c. Heading chars in SOL context (leading newline break)
18701 !! options
18702 parsoid
18703 !! wikitext
18704 a
18705 <nowiki>=b=</nowiki>
18706 !! html
18707 <p>a
18708 =b=</p>
18709 !!end
18710
18711 !! test
18712 Headings: 6d. Heading chars in SOL context (with interspersed comments)
18713 !! options
18714 parsoid
18715 !! wikitext
18716 <!--c0--><nowiki>=a=</nowiki>
18717
18718 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
18719 !! html
18720 <p><!--c0-->=a=</p>
18721 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
18722 !!end
18723
18724 !! test
18725 Headings: 6d. Heading chars in SOL context (No escaping needed)
18726 !! options
18727 parsoid=html2wt
18728 !! wikitext
18729 =a=<div>b</div>
18730 !! html
18731 =a=<div>b</div>
18732 !!end
18733
18734 #### --------------- Lists ---------------
18735 #### 0. Outside nests (*foo, etc.)
18736 #### 1. Nested inside html <ul><li>*foo</li></ul>
18737 #### 2. Inside definition lists
18738 #### 3. Only bullets at start should be escaped
18739 #### 4. No escapes needed
18740 #### 5. No unnecessary escapes
18741 #### 6. Escape bullets in SOL position
18742 #### 7. Escape bullets in a multi-line context
18743 #### ----------------------------------------
18744
18745 !! test
18746 Lists: 0. Outside nests
18747 !! wikitext
18748 <nowiki>*</nowiki>foo
18749
18750 <nowiki>#</nowiki>foo
18751
18752 <nowiki>;Foo:</nowiki>bar
18753 !! html
18754 <p>*foo
18755 </p><p>#foo
18756 </p><p>;Foo:bar
18757 </p>
18758 !!end
18759
18760 !! test
18761 Lists: 1. Nested inside html
18762 !! wikitext
18763 *<nowiki>*foo</nowiki>
18764
18765 *<nowiki>#foo</nowiki>
18766
18767 *<nowiki>:foo</nowiki>
18768
18769 *<nowiki>;foo</nowiki>
18770
18771 #<nowiki>*foo</nowiki>
18772
18773 #<nowiki>#foo</nowiki>
18774
18775 #<nowiki>:foo</nowiki>
18776
18777 #<nowiki>;foo</nowiki>
18778 !! html
18779 <ul><li>*foo</li></ul>
18780 <ul><li>#foo</li></ul>
18781 <ul><li>:foo</li></ul>
18782 <ul><li>;foo</li></ul>
18783 <ol><li>*foo</li></ol>
18784 <ol><li>#foo</li></ol>
18785 <ol><li>:foo</li></ol>
18786 <ol><li>;foo</li></ol>
18787
18788 !!end
18789
18790 !! test
18791 Lists: 2. Inside definition lists
18792 !! wikitext
18793 ;<nowiki>;foo</nowiki>
18794
18795 ;<nowiki>:foo</nowiki>
18796
18797 ;<nowiki>:foo</nowiki>
18798 :bar
18799
18800 :<nowiki>:foo</nowiki>
18801 !! html
18802 <dl><dt>;foo</dt></dl>
18803 <dl><dt>:foo</dt></dl>
18804 <dl><dt>:foo</dt>
18805 <dd>bar</dd></dl>
18806 <dl><dd>:foo</dd></dl>
18807
18808 !!end
18809
18810 !! test
18811 Lists: 3. Only bullets at start of text should be escaped
18812 !! wikitext
18813 *<nowiki>*foo*bar</nowiki>
18814
18815 *<nowiki>*foo</nowiki>''it''*bar
18816 !! html
18817 <ul><li>*foo*bar</li></ul>
18818 <ul><li>*foo<i>it</i>*bar</li></ul>
18819
18820 !!end
18821
18822 !! test
18823 Lists: 4. No escapes needed
18824 !! options
18825 parsoid
18826 !! wikitext
18827 *foo*bar
18828
18829 *''foo''*bar
18830
18831 *[[Foo]]: bar
18832
18833 *[[Foo]]*bar
18834 !! html
18835 <ul>
18836 <li>foo*bar
18837 </li>
18838 </ul>
18839 <ul>
18840 <li><i>foo</i>*bar
18841 </li>
18842 </ul>
18843 <ul>
18844 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18845 </li>
18846 </ul>
18847 <ul>
18848 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18849 </li>
18850 </ul>
18851 !!end
18852
18853 !! test
18854 Lists: 5. No unnecessary escapes
18855 !! wikitext
18856 * bar <span><nowiki>[[foo]]</nowiki></span>
18857
18858 *=bar <span><nowiki>[[foo]]</nowiki></span>
18859
18860 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18861
18862 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18863
18864 *=bar <span>foo]]</span>=
18865
18866 * <s></s>: a
18867 !! html
18868 <ul><li> bar <span>[[foo]]</span></li></ul>
18869 <ul><li>=bar <span>[[foo]]</span></li></ul>
18870 <ul><li>[[bar <span>[[foo]]</span></li></ul>
18871 <ul><li>]]bar <span>[[foo]]</span></li></ul>
18872 <ul><li>=bar <span>foo]]</span>=</li></ul>
18873 <ul><li> <s></s>: a</li></ul>
18874
18875 !!end
18876
18877 !! test
18878 Lists: 6. Escape bullets in SOL position
18879 !! options
18880 parsoid
18881 !! wikitext
18882 <!--cmt--><nowiki>*foo</nowiki>
18883 !! html
18884 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18885 !!end
18886
18887 !! test
18888 Lists: 7. Escape bullets in a multi-line context
18889 !! wikitext
18890 a
18891 <nowiki>*</nowiki>b
18892 !! html
18893 <p>a
18894 *b
18895 </p>
18896 !!end
18897
18898 #### --------------- HRs ---------------
18899 #### 1. Single line
18900 #### -----------------------------------
18901
18902 !! test
18903 HRs: 1. Single line
18904 !! options
18905 parsoid
18906 !! wikitext
18907 ----<nowiki>----</nowiki>
18908 ----=foo=
18909 ----*foo
18910 !! html
18911 <hr><span typeof="mw:Nowiki">----</span>
18912 <hr>=foo=
18913 <hr>*foo
18914 !! end
18915
18916 #### --------------- Tables ---------------
18917 #### 1a. Simple example
18918 #### 1b. No escaping needed (!foo)
18919 #### 1c. No escaping needed (|foo)
18920 #### 1d. No escaping needed (|}foo)
18921 ####
18922 #### 2a. Nested in td (<td>foo|bar</td>)
18923 #### 2b. Nested in td (<td>foo||bar</td>)
18924 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
18925 ####
18926 #### 3a. Nested in th (<th>foo!bar</th>)
18927 #### 3b. Nested in th (<th>foo!!bar</th>)
18928 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
18929 ####
18930 #### 4a. Escape -
18931 #### 4b. Escape +
18932 #### 4c. No escaping needed
18933 #### --------------------------------------
18934
18935 !! test
18936 Tables: 1a. Simple example
18937 !! wikitext
18938 <nowiki>{|
18939 |}</nowiki>
18940 !! html
18941 <p>{|
18942 |}
18943 </p>
18944 !! end
18945
18946 !! test
18947 Tables: 1b. No escaping needed
18948 !! wikitext
18949 !foo
18950 !! html
18951 <p>!foo
18952 </p>
18953 !! end
18954
18955 !! test
18956 Tables: 1c. No escaping needed
18957 !! wikitext
18958 |foo
18959 !! html
18960 <p>|foo
18961 </p>
18962 !! end
18963
18964 !! test
18965 Tables: 1d. No escaping needed
18966 !! wikitext
18967 |}foo
18968 !! html
18969 <p>|}foo
18970 </p>
18971 !! end
18972
18973 !! test
18974 Tables: 2a. Nested in td
18975 !! options
18976 parsoid=html2wt
18977 !! wikitext
18978 {|
18979 |<nowiki>foo|bar</nowiki>
18980 |-
18981 |x<div><nowiki>a|b</nowiki></div>
18982 |}
18983 !! html
18984 <table><tbody><tr>
18985 <td>foo|bar</td></tr>
18986 <tr><td>x<div>a|b</div></td>
18987 </tbody></table>
18988 !! end
18989
18990 !! test
18991 Tables: 2b. Nested in td
18992 !! options
18993 parsoid
18994 !! wikitext
18995 {|
18996 |<nowiki>foo||bar</nowiki>
18997 |''it''<nowiki>foo||bar</nowiki>
18998 |}
18999 !! html
19000 <table><tbody><tr>
19001 <td><span typeof="mw:Nowiki">foo||bar</span></td>
19002 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
19003 !! end
19004
19005 !! test
19006 Tables: 2c. Nested in td -- no escaping needed
19007 !! options
19008 parsoid
19009 !! wikitext
19010 {|
19011 |foo!!bar
19012 |}
19013 !! html
19014 <table><tbody><tr><td>foo!!bar
19015 </td></tr></tbody></table>
19016
19017 !! end
19018
19019 !! test
19020 Tables: 3a. Nested in th
19021 !! options
19022 parsoid
19023 !! wikitext
19024 {|
19025 !foo!bar
19026 |}
19027 !! html
19028 <table><tbody><tr><th>foo!bar
19029 </th></tr></tbody></table>
19030
19031 !! end
19032
19033 !! test
19034 Tables: 3b. Nested in th
19035 !! options
19036 parsoid
19037 !! wikitext
19038 {|
19039 !<nowiki>foo!!bar</nowiki>
19040 |}
19041 !! html
19042 <table>
19043 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
19044 </tbody></table>
19045 !! end
19046
19047 !! test
19048 Tables: 3c. Nested in th -- no escaping needed
19049 !! options
19050 parsoid
19051 !! wikitext
19052 {|
19053 !<nowiki>foo||bar</nowiki>
19054 |}
19055 !! html
19056 <table><tbody><tr>
19057 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
19058 !! end
19059
19060 !! test
19061 Tables: 4a. Escape -
19062 !! options
19063 parsoid
19064 !! wikitext
19065 {|
19066 !-bar
19067 |-
19068 |<nowiki>-bar</nowiki>
19069 |}
19070 !! html
19071 <table><tbody>
19072 <tr><th>-bar</th></tr>
19073 <tr>
19074 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
19075 !! end
19076
19077 !! test
19078 Tables: 4b. Escape +
19079 !! options
19080 parsoid
19081 !! wikitext
19082 {|
19083 !+bar
19084 |-
19085 |<nowiki>+bar</nowiki>
19086 |}
19087 !! html
19088 <table><tbody>
19089 <tr><th>+bar</th></tr>
19090 <tr>
19091 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
19092 !! end
19093
19094 !! test
19095 Tables: 4c. No escaping needed
19096 !! options
19097 parsoid
19098 !! wikitext
19099 {|
19100 |foo-bar
19101 |foo+bar
19102 |-
19103 |''foo''-bar
19104 |''foo''+bar
19105 |-
19106 |foo
19107 bar|baz
19108 +bar
19109 -bar
19110 |-
19111 |x
19112 <div>a|b</div>
19113 |}
19114 !! html
19115 <table><tbody>
19116 <tr><td>foo-bar</td><td>foo+bar</td></tr>
19117 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
19118 <tr><td>foo
19119 <p>bar|baz
19120 +bar
19121 -bar</p></td></tr>
19122 <tr><td>x
19123 <div>a|b</div></td>
19124 </tbody></table>
19125 !! end
19126
19127 !! test
19128 Tables: 4d. No escaping needed
19129 !! options
19130 parsoid
19131 !! wikitext
19132 {|
19133 |[[Foo]]-bar
19134 ||+1
19135 ||-2
19136 |}
19137 !! html
19138 <table>
19139 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
19140 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
19141 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
19142 </tbody></table>
19143 !! end
19144
19145 !! test
19146 Tables: Digest broken attributes on table and tr tag
19147 !! options
19148 parsoid=wt2html
19149 !! wikitext
19150 {| || |} ++
19151 |- || || ++ --
19152 |- > [
19153 |}
19154 !! html
19155 <table>
19156 <tbody>
19157 <tr></tr>
19158 <tr></tr>
19159 </tbody></table>
19160 !! end
19161
19162 #### --------------- Links ----------------
19163 #### 1. Quote marks in link text
19164 #### 2. Wikilinks: Escapes needed
19165 #### 3. Wikilinks: No escapes needed
19166 #### 4. Extlinks: Escapes needed
19167 #### 5. Extlinks: No escapes needed
19168 #### --------------------------------------
19169 !! test
19170 Links 1. Quote marks in link text
19171 !! options
19172 parsoid
19173 !! wikitext
19174 [[Foo|Foo<nowiki>''boo''</nowiki>]]
19175 !! html
19176 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
19177 !! end
19178
19179 !! test
19180 Links 2. WikiLinks: Escapes needed
19181 !! options
19182 parsoid
19183 !! wikitext
19184 [[Foo|[Foobar]]]
19185 [[Foo|<nowiki>Foobar]</nowiki>]]
19186 [[Foo|x [Foobar] x]]
19187 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
19188 [[Foo|<nowiki>[[Bar]]</nowiki>]]
19189 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
19190 [[Foo|<nowiki>|Bar</nowiki>]]
19191 [[Foo|<nowiki>]]bar</nowiki>]]
19192 [[Foo|<nowiki>[[bar</nowiki>]]
19193 [[Foo|<nowiki>x [[ y</nowiki>]]
19194 [[Foo|<nowiki>x ]] y</nowiki>]]
19195 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
19196 !! html
19197 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
19198 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
19199 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
19200 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
19201 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
19202 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
19203 <a href="Foo" rel="mw:WikiLink">|Bar</a>
19204 <a href="Foo" rel="mw:WikiLink">]]bar</a>
19205 <a href="Foo" rel="mw:WikiLink">[[bar</a>
19206 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
19207 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
19208 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
19209 !! end
19210
19211 !! test
19212 Links 3. WikiLinks: No escapes needed
19213 !! options
19214 parsoid
19215 !! wikitext
19216 [[Foo|[Foobar]]
19217 [[Foo|foo|bar]]
19218 !! html
19219 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
19220 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
19221 !! end
19222
19223 !! test
19224 Links 4. ExtLinks: Escapes needed
19225 !! options
19226 parsoid
19227 !! wikitext
19228 [http://google.com <nowiki>[google]</nowiki>]
19229 [http://google.com <nowiki>google]</nowiki>]
19230
19231 <nowiki>[http://google.com]</nowiki>
19232
19233 <nowiki>[http://google.com google]</nowiki>
19234
19235 !! html
19236 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
19237 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
19238 <p>[http://google.com]</p>
19239 <p>[http://google.com google]</p>
19240 !! end
19241
19242 !! test
19243 Links 5. ExtLinks: No escapes needed
19244 !! options
19245 parsoid
19246 !! wikitext
19247 [http://google.com [google]
19248 !! html
19249 <a href="http://google.com" rel="mw:ExtLink">[google</a>
19250 !! end
19251
19252 !! test
19253 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
19254 !! html/parsoid
19255 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
19256 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
19257 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
19258 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
19259 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
19260 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
19261 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19262 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
19263 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19264 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
19265 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
19266 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
19267 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
19268 </p>
19269 !! wikitext
19270 x<nowiki/>http://example.com<nowiki/>y
19271 http://example.com<nowiki/>?x
19272 http://example.com<nowiki/>&x
19273 http://example.com<nowiki/>'x
19274 http://example.com<nowiki/>,x
19275 http://example.com<nowiki/>.x
19276 http://example.com<nowiki/>;x
19277 http://example.com<nowiki/>:x
19278 http://example.com<nowiki/>;x
19279 http://example.com<nowiki/>!x
19280 http://example.com<nowiki/>=x
19281 http://example.com<nowiki/>(x)
19282 http://example.com(x<nowiki/>)
19283 !! end
19284
19285 !! test
19286 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19287 !! html/parsoid
19288 <p>x
19289 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
19290 y
19291 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
19292 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
19293 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
19294 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
19295 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
19296 </p>
19297 !! wikitext
19298 x
19299 http://example.com
19300 y
19301 "http://example.com"
19302 (http://example.com)
19303 (http://example.com) foo
19304 http://example.com,
19305 http://example.com, foo
19306 !! end
19307
19308 ## Parsoid currently fails wt2html on this one!
19309 !! test
19310 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19311 !! html/parsoid
19312 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
19313 !! wikitext
19314 http://example.com.,;:!?
19315 !! end
19316
19317 !! test
19318 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
19319 !! html/parsoid
19320 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
19321 !! wikitext
19322 RFC 123<nowiki/>4
19323 !! end
19324
19325 !! test
19326 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
19327 !! html/parsoid
19328 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19329 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19330 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
19331 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
19332 </p>
19333 !! wikitext
19334 xRFC 123y
19335 XRFC 123y
19336 RFC 123?foo
19337 RFC 123&foo
19338 !! end
19339
19340 !! test
19341 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
19342 !! html/parsoid
19343 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
19344 !! wikitext
19345 PMID 123<nowiki/>4
19346 !! end
19347
19348 !! test
19349 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
19350 !! html/parsoid
19351 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19352 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19353 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
19354 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
19355 </p>
19356 !! wikitext
19357 xPMID 123y
19358 XPMID 123y
19359 PMID 123?foo
19360 PMID 123&foo
19361 !! end
19362
19363 !! test
19364 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
19365 !! html/parsoid
19366 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
19367 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
19368 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
19369 </p>
19370 !! wikitext
19371 ISBN 1234567890<nowiki/>1
19372 ISBN 1234567890<nowiki/>x
19373 ISBN 1234567890<nowiki/>b
19374 !! end
19375
19376 !! test
19377 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
19378 !! html/parsoid
19379 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
19380 !! wikitext
19381 ISBN 1234567890's
19382 !! end
19383
19384 #### --------------- Quotes ---------------
19385 #### 1. Quotes inside <b> and <i>
19386 #### 2. Link fragments separated by <i> and <b> tags
19387 #### 3. Link fragments inside <i> and <b>
19388 #### 4. No escaping needed
19389 #### --------------------------------------
19390 !! test
19391 1. Quotes inside <b> and <i>
19392 !! options
19393 parsoid=html2wt,wt2wt
19394 !! wikitext
19395 ''<nowiki>'foo'</nowiki>''
19396 ''<nowiki>''foo''</nowiki>''
19397 ''<nowiki>'''foo'''</nowiki>''
19398 ''foo''<nowiki/>'s
19399 '''<nowiki>'foo'</nowiki>'''
19400 '''<nowiki>''foo''</nowiki>'''
19401 '''<nowiki>'''foo'''</nowiki>'''
19402 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
19403 '''foo'''<nowiki/>'s
19404 '''foo''
19405 ''foo''<nowiki/>'
19406 '<nowiki/>''foo''<nowiki/>'
19407 ''''foo'''
19408 '''foo'''<nowiki/>'
19409 '<nowiki/>'''foo'''<nowiki/>'
19410 ''fools'<span> errand</span>''
19411 ''<span>fool</span>'s errand''
19412 !! html
19413 <p><i>'foo'</i>
19414 <i>''foo''</i>
19415 <i>'''foo'''</i>
19416 <i>foo</i>'s
19417 <b>'foo'</b>
19418 <b>''foo''</b>
19419 <b>'''foo'''</b>
19420 <b>foo'<i>bar'</i>baz</b>
19421 <b>foo</b>'s
19422 '<i>foo</i>
19423 <i>foo</i>'
19424 '<i>foo</i>'
19425 '<b>foo</b>
19426 <b>foo</b>'
19427 '<b>foo</b>'</p>
19428 <i>fools'<span> errand</span></i>
19429 <i><span>fool</span>'s errand</i>
19430 !! end
19431
19432 !! test
19433 2. Link fragments separated by <i> and <b> tags
19434 !! wikitext
19435 [[''foo''<nowiki>hello]]</nowiki>
19436
19437 [['''foo'''<nowiki>hello]]</nowiki>
19438 !! html
19439 <p>[[<i>foo</i>hello]]
19440 </p><p>[[<b>foo</b>hello]]
19441 </p>
19442 !! end
19443
19444 !! test
19445 3. Link fragments inside <i> and <b>
19446 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
19447 this is one of the shortcomings of this format)
19448 !! wikitext
19449 ''[[foo''<nowiki>]]</nowiki>
19450
19451 '''[[foo'''<nowiki>]]</nowiki>
19452 !! html
19453 <p><i>[[foo</i>]]
19454 </p><p><b>[[foo</b>]]
19455 </p>
19456 !! end
19457
19458 !! test
19459 4. No escaping needed
19460 !! wikitext
19461 '<span>''bar''</span>'
19462 '<span>'''bar'''</span>'
19463 !! html
19464 <p>'<span><i>bar</i></span>'
19465 '<span><b>bar</b></span>'
19466 </p>
19467 !! end
19468
19469 #### ----------- Paragraphs ---------------
19470 #### 1. No unnecessary escapes
19471 #### --------------------------------------
19472
19473 !! test
19474 1. No unnecessary escapes
19475 !! wikitext
19476 bar <span><nowiki>[[foo]]</nowiki></span>
19477
19478 =bar <span><nowiki>[[foo]]</nowiki></span>
19479
19480 [[bar <span><nowiki>[[foo]]</nowiki></span>
19481
19482 ]]bar <span><nowiki>[[foo]]</nowiki></span>
19483
19484 =bar <span>foo]]</span><nowiki>=</nowiki>
19485 !! html
19486 <p>bar <span>[[foo]]</span>
19487 </p><p>=bar <span>[[foo]]</span>
19488 </p><p>[[bar <span>[[foo]]</span>
19489 </p><p>]]bar <span>[[foo]]</span>
19490 </p><p>=bar <span>foo]]</span>=
19491 </p>
19492 !!end
19493
19494 #### ----------------------- PRE --------------------------
19495 #### 1. Leading whitespace in SOL context should be escaped
19496 #### ------------------------------------------------------
19497 !! test
19498 1. Leading whitespace in SOL context should be escaped
19499 !! options
19500 parsoid
19501 !! wikitext
19502 <nowiki> </nowiki>a
19503
19504 <nowiki> </nowiki> a
19505
19506 <nowiki> </nowiki>a(tab)
19507
19508 <nowiki> </nowiki> a
19509 <!--cmt-->
19510 <nowiki> </nowiki> a
19511
19512 a
19513 <nowiki> </nowiki>b
19514
19515 a
19516 <nowiki> </nowiki>b
19517
19518 a
19519 <nowiki> </nowiki> b
19520 !! html
19521 <p> a</p>
19522 <p> a</p>
19523 <p> a(tab)</p>
19524 <p> a</p>
19525 <p><!--cmt--> a</p>
19526 <p>a
19527 b</p>
19528 <p>a
19529 b</p>
19530 <p>a
19531 b</p>
19532 !! end
19533
19534 !! test
19535 2. Leading whitespace in non-indent-pre contexts should not be escaped
19536 !! options
19537 parsoid
19538 !! wikitext
19539 foo <ref>''a''
19540 b</ref>
19541 !! html
19542 <p>foo <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[9,14,2,2]}&#39;>a&lt;/i>\n b"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
19543 !! end
19544
19545 !! test
19546 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
19547 !! options
19548 parsoid
19549 !! wikitext
19550 <blockquote>
19551 a
19552 <span>b</span>
19553 c
19554 </blockquote>
19555 !! html
19556 <blockquote>
19557 <p>
19558 a
19559 <span>b</span>
19560 c</p>
19561 </blockquote>
19562 !! end
19563
19564 !! test
19565 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
19566 !! options
19567 parsoid
19568 !! wikitext
19569 [[File:Foobar.jpg|thumb|caption]]
19570 !! html
19571 !! html/parsoid
19572 <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>
19573 !! end
19574
19575 #### --------------- Behavior Switches --------------------
19576 !! test
19577 1. Valid behavior switches should be escaped
19578 !! options
19579 parsoid=html2wt
19580 !! wikitext
19581 <nowiki>__TOC__</nowiki>
19582 ''<nowiki>__TOC__</nowiki>''
19583 !! html
19584 __TOC__
19585 <i>__TOC__</i>
19586 !! end
19587
19588 !! test
19589 2. Invalid behavior switches should not be escaped
19590 !! options
19591 parsoid=html2wt
19592 !! wikitext
19593 __TOO__
19594 __|__
19595 !! html
19596 __TOO__
19597 __|__
19598 !! end
19599
19600 #### --------------- HTML tags ---------------
19601 #### 1. a tags
19602 #### 2. other tags
19603 #### 3. multi-line html tag
19604 #### 4. extension tags
19605 #### -----------------------------------------
19606 !! test
19607 1. a tags
19608 !! options
19609 parsoid
19610 !! wikitext
19611 <a href="http://google.com">google</a>
19612 !! html
19613 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
19614 !! end
19615
19616 !! test
19617 2. other tags
19618 !! wikitext
19619 <nowiki><div>foo</div>
19620 <div style="color:red">foo</div></nowiki>
19621 !! html
19622 <p>&lt;div&gt;foo&lt;/div&gt;
19623 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
19624 </p>
19625 !! end
19626
19627 !! test
19628 3. multi-line html tag
19629 !! wikitext
19630 <nowiki><div
19631 >foo</div
19632 ></nowiki>
19633 !! html
19634 <p>&lt;div
19635 &gt;foo&lt;/div
19636 &gt;
19637 </p>
19638 !! end
19639
19640 !! test
19641 4. extension tags
19642 !! wikitext
19643 <nowiki><ref>foo</ref></nowiki>
19644
19645 <nowiki><ref>bar</nowiki>
19646
19647 baz<nowiki></ref></nowiki>
19648 !! html
19649 <p>&lt;ref&gt;foo&lt;/ref&gt;
19650 </p><p>&lt;ref&gt;bar
19651 </p><p>baz&lt;/ref&gt;
19652 </p>
19653 !! end
19654
19655 #### --------------- Others ---------------
19656 !! test
19657 Escaping nowikis
19658 !! wikitext
19659 &lt;nowiki&gt;foo&lt;/nowiki&gt;
19660 !! html
19661 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
19662 </p>
19663 !! end
19664
19665 ## The quote-char in the input is necessary for triggering the bug
19666 !! test
19667 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
19668 !! options
19669 parsoid=wt2wt,html2wt
19670 !! wikitext
19671 foo's bar :
19672 !! html
19673 <p>foo's bar :</p>
19674 !! end
19675
19676 !! test
19677
19678 Tag-like HTML structures are passed through as text
19679 !! wikitext
19680 <x y>
19681
19682 <x.y>
19683
19684 <x-y>
19685
19686 1>2
19687
19688 x<y
19689
19690 a>b
19691
19692 1<d e>f
19693 !! html
19694 <p>&lt;x y&gt;
19695 </p><p>&lt;x.y&gt;
19696 </p><p>&lt;x-y&gt;
19697 </p><p>1&gt;2
19698 </p><p>x&lt;y
19699 </p><p>a&gt;b
19700 </p><p>1&lt;d e&gt;f
19701 </p>
19702 !! end
19703
19704
19705 # This was a bug in the PHP parser (see bug 17663 and its dups,
19706 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
19707 !! test
19708 Tag names followed by punctuation should not be recognized as tags
19709 !! wikitext
19710 <s.ome> text
19711 !! html
19712 <p>&lt;s.ome&gt; text
19713 </p>
19714 !! end
19715
19716 !! test
19717 HTML tag with necessary entities in attributes
19718 !! wikitext
19719 <span title="&amp;amp;">foo</span>
19720 !! html
19721 <p><span title="&amp;amp;">foo</span>
19722 </p>
19723 !! end
19724
19725 !! test
19726 HTML tag with 'unnecessary' entity encoding in attributes
19727 !! wikitext
19728 <span title="&amp;">foo</span>
19729 !! html
19730 <p><span title="&amp;">foo</span>
19731 </p>
19732 !! end
19733
19734 !! test
19735 HTML tag with broken attribute value quoting
19736 !! wikitext
19737 <span title="Hello world>Foo</span>
19738 !! html
19739 <p><span>Foo</span>
19740 </p>
19741 !! end
19742
19743 !! test
19744 Parsoid-only: HTML tag with broken attribute value quoting
19745 !! options
19746 parsoid
19747 !! wikitext
19748 <span title="Hello world>Foo</span>
19749 !! html
19750 <p><span title="Hello world">Foo</span>
19751 </p>
19752 !! end
19753
19754 !! test
19755 Table with broken attribute value quoting
19756 !! wikitext
19757 {|
19758 | title="Hello world|Foo
19759 |}
19760 !! html
19761 <table>
19762 <tr>
19763 <td>Foo
19764 </td></tr></table>
19765
19766 !! end
19767
19768 !! test
19769 Table with broken attribute value quoting on consecutive lines
19770 !! wikitext
19771 {|
19772 | title="Hello world|Foo
19773 | style="color:red|Bar
19774 |}
19775 !! html
19776 <table>
19777 <tr>
19778 <td>Foo
19779 </td>
19780 <td>Bar
19781 </td></tr></table>
19782
19783 !! end
19784
19785 !! test
19786 Parsoid-only: Table with broken attribute value quoting on consecutive lines
19787 !! options
19788 parsoid
19789 !! wikitext
19790 {|
19791 | title="Hello world|Foo
19792 | style="color:red|Bar
19793 |}
19794 !! html
19795 <table><tbody>
19796 <tr>
19797 <td title="Hello world">Foo
19798 </td><td style="color: red">Bar
19799 </td></tr></tbody></table>
19800
19801 !! end
19802
19803 !! test
19804 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19805 !! options
19806 parsoid
19807 !! wikitext
19808 {{}}
19809 !! html
19810 {{}}
19811 !! end
19812
19813 !! test
19814 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19815 !! options
19816 parsoid
19817 !! wikitext
19818 }}{{
19819 !! html
19820 }}{{
19821 !! end
19822
19823 !!test
19824 Accept empty td cell attribute
19825 !! wikitext
19826 {|
19827 | align="center" | foo || |
19828 |}
19829 !! html
19830 <table>
19831 <tr>
19832 <td align="center"> foo </td>
19833 <td>
19834 </td></tr></table>
19835
19836 !!end
19837
19838 !!test
19839 Non-empty attributes in th-cells
19840 !! wikitext
19841 {|
19842 ! Foo !! style="color: red" | Bar
19843 |}
19844 !! html
19845 <table>
19846 <tr>
19847 <th> Foo </th>
19848 <th style="color: red"> Bar
19849 </th></tr></table>
19850
19851 !!end
19852
19853 !!test
19854 Accept empty attributes in th-cells
19855 !! wikitext
19856 {|
19857 !| foo !!| bar
19858 |}
19859 !! html
19860 <table>
19861 <tr>
19862 <th> foo </th>
19863 <th> bar
19864 </th></tr></table>
19865
19866 !!end
19867
19868 !!test
19869 Empty table rows go away
19870 !! wikitext
19871 {|
19872 | Hello
19873 | there
19874 |- class="foo"
19875 |-
19876 |}
19877 !! html
19878 <table>
19879 <tr>
19880 <td> Hello
19881 </td>
19882 <td> there
19883 </td></tr>
19884
19885 </table>
19886
19887 !! end
19888
19889 ###
19890 ### Parsoid-centric tests for testing RTing of inter-element separators
19891 ### Edge cases not tested by existing parser tests and specific to
19892 ### Parsoid-specific serialization strategies.
19893 ###
19894
19895 !!test
19896 RT-ed inter-element separators should be valid separators
19897 !! wikitext
19898 {|
19899 |- [[foo]]
19900 |}
19901 !! html
19902 <table>
19903
19904 </table>
19905
19906 !!end
19907
19908 !!test
19909 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
19910 (Parsoid-only since PHP parser relies on Tidy for correct output)
19911 !!options
19912 parsoid
19913 !! wikitext
19914 {|
19915 |<small>foo
19916 bar
19917 |}
19918
19919 {|
19920 |<small>foo<small>
19921 |}
19922 !! html
19923 !!end
19924
19925 !!test
19926 Empty TD followed by TD with tpl-generated attribute
19927 !! wikitext
19928 {|
19929 |-
19930 |
19931 |{{echo|style='color:red'}}|foo
19932 |}
19933 !! html
19934 <table>
19935
19936 <tr>
19937 <td>
19938 </td>
19939 <td>foo
19940 </td></tr></table>
19941
19942 !!end
19943
19944 !!test
19945 Indented table with an empty td
19946 !! wikitext
19947 {|
19948 |-
19949 |
19950 |foo
19951 |}
19952 !! html
19953 <table>
19954
19955 <tr>
19956 <td>
19957 </td>
19958 <td>foo
19959 </td></tr></table>
19960
19961 !!end
19962
19963 !!test
19964 Indented block & table
19965 !! wikitext
19966 <div>foo</div>
19967 {|
19968 |foo
19969 |}
19970 !! html/parsoid
19971 <div data-parsoid='{"stx":"html"}'>foo</div>
19972 <table><tbody>
19973 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
19974 </tbody></table>
19975 !!end
19976
19977 !! test
19978 Indent and comment before table row
19979 !! wikitext
19980 {|
19981 <!--hi-->|-
19982 | there
19983 |}
19984 !! html/parsoid
19985 <table data-parsoid='{}'>
19986 <!--hi--><tbody data-parsoid='{}'><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
19987 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
19988 </tbody></table>
19989 !! end
19990
19991 !!test
19992 Empty TR followed by a template-generated TR
19993 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
19994 !!options
19995 parsoid
19996 !! wikitext
19997 {|
19998 |-
19999 {{echo|<tr><td>foo</td></tr>}}
20000 |}
20001 !! html
20002 <table>
20003 <tbody>
20004 <tr></tr>
20005 <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}}]}'>
20006 <td>foo</td></tr>
20007 </tbody></table>
20008 !!end
20009
20010 ## PHP and parsoid output differ for this, and since this is primarily
20011 ## for testing Parsoid's serializer, marking this Parsoid only
20012 !!test
20013 Empty TR followed by mixed-ws-comment line should RT correctly
20014 !!options
20015 parsoid
20016 !! wikitext
20017 {|
20018 |-
20019 <!--c-->
20020 |-
20021 <!--c--> <!--d-->
20022 |}
20023 !! html
20024 <table>
20025 <tbody>
20026 <tr></tr>
20027 <!--c-->
20028 <tr>
20029 <!--c--> </tr><!--d-->
20030 </tbody></table>
20031
20032 !!end
20033
20034 !!test
20035 Multi-line image caption generated by templates with/without trailing newlines
20036 !!options
20037 parsoid
20038 !! wikitext
20039 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
20040 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
20041 !! html
20042 <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>
20043 <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>
20044
20045 !!end
20046
20047 !! test
20048 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
20049 !! options
20050 parsoid=html2wt
20051 !! wikitext
20052 <includeonly>foo</includeonly>
20053 new para
20054
20055 [[./Category:Foo]]
20056
20057 = new heading =
20058 !! html
20059 <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>
20060
20061 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
20062 !! end
20063
20064 ## PHP emits broken html for this, and since this is primarily
20065 ## a Parsoid serializer test, marking this Parsoid only
20066 !!test
20067 Improperly nested inline or quotes tags with whitespace in between
20068 !!options
20069 parsoid
20070 !! wikitext
20071 <span> <s>x</span> </s>
20072 ''' ''x''' ''
20073 !! html
20074 <p><span> <s>x</s></span><s> </s>
20075 <b> <i>x</i></b><i> </i>
20076 </p>
20077 !!end
20078
20079 !!test
20080 Encapsulate protected attributes from wt
20081 !!options
20082 parsoid
20083 !! wikitext
20084 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
20085 !! html
20086 <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>
20087 </body>
20088 !!end
20089
20090 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
20091 ## Having nested or stray pre tags results in the attempt to add duplicates,
20092 ## causing an assertion fail. This test tries to prevent that situation.
20093 !!test
20094 Ensure ParagraphWrapper can deal with stray closing pre tags
20095 !!options
20096 parsoid=wt2html
20097 !! wikitext
20098 plain text</pre>
20099 !! html
20100 plain text
20101 !!end
20102
20103 !!test
20104 1. Ensure fostered text content is wrapped in spans
20105 !!options
20106 parsoid=wt2html
20107 !! wikitext
20108 <table>hi</table><table>ho</table>
20109 !! html
20110 <span>hi</span>
20111 <table></table>
20112 <span>ho</span>
20113 <table></table>
20114 !!end
20115
20116 !!test
20117 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
20118 !!options
20119 parsoid=wt2html,wt2wt
20120 !! wikitext
20121 <table>
20122 <tr> || ||
20123 <td> a
20124 </table>
20125 !! html
20126 <span> || ||</span>
20127 <table>
20128 <tbody>
20129 <tr>
20130 <td> a</td></tr>
20131 </tbody></table>
20132 !!end
20133
20134 !!test
20135 Encapsulation properly handles null DSR information from foster box
20136 !!options
20137 parsoid=wt2html,wt2wt
20138 !! wikitext
20139 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
20140 !! html
20141 <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;
20142 <table>foo
20143 <tr>
20144 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
20145 <table>
20146 <tbody>
20147 <tr>
20148 <td>bar</td></tr></tbody></table>
20149 !!end
20150
20151 !!test
20152 1. Encapsulate foster-parented transclusion content
20153 !!options
20154 parsoid=wt2wt,wt2html
20155 !! wikitext
20156 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
20157 !! html
20158 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20159 <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
20160 <tr>
20161 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
20162 <table>
20163 <tbody>
20164 <tr>
20165 <td>bar</td></tr></tbody></table>
20166 !!end
20167
20168 !!test
20169 2. Encapsulate foster-parented transclusion content
20170 !!options
20171 parsoid=wt2wt,wt2html
20172 !! wikitext
20173 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
20174 !! html
20175 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20176 <table>
20177 <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>
20178 <tr>
20179 <td>bar</td></tr></table>&quot;]}">foo</div>
20180 <table>
20181 <tbody>
20182 <tr>
20183 <td>bar</td></tr></tbody></table>
20184 !!end
20185
20186 !!test
20187 3. Encapsulate foster-parented transclusion content
20188 !!options
20189 parsoid=wt2wt,wt2html
20190 !! wikitext
20191 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20192 !! html
20193 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20194 <table>
20195 <div>
20196 <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>
20197 <tr>
20198 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20199 <p>foo</p></div>
20200 <table>
20201 <tbody>
20202 <tr>
20203 <td>bar</td></tr></tbody></table>
20204 !!end
20205
20206 !!test
20207 4. Encapsulate foster-parented transclusion content
20208 !!options
20209 parsoid=wt2wt,wt2html
20210 !! wikitext
20211 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20212 !! html
20213 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20214 <table>
20215 <div>
20216 <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>
20217 <tr>
20218 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20219 <p>foo</p></div>
20220 <table>
20221 <tbody>
20222 <tr>
20223 <td>bar</td></tr></tbody></table>
20224 !!end
20225
20226 !!test
20227 5. Encapsulate foster-parented transclusion content
20228 !!options
20229 parsoid=wt2wt,wt2html
20230 !! wikitext
20231 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
20232 !! html
20233 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20234 <table>
20235 <tr>
20236 <td>
20237 <div>
20238 <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</span>
20239 <table>
20240 <tbody>
20241 <tr>
20242 <td>
20243 <div>
20244 <p>foo</p></div></td></tr></tbody></table>
20245 !!end
20246
20247 !!test
20248 6. Encapsulate foster-parented transclusion content
20249 !!options
20250 parsoid=wt2wt,wt2html
20251 !! wikitext
20252 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
20253 !! html
20254 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20255 <table>
20256 <tr>
20257 <td>
20258 <div>
20259 <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</span>
20260 <table>
20261 <tbody>
20262 <tr>
20263 <td>
20264 <div>
20265 <p>foo</p></div></td></tr></tbody></table>
20266 <p>ok</p>
20267 !!end
20268
20269 !!test
20270 7. Encapsulate foster-parented transclusion content
20271 !!options
20272 parsoid=wt2wt,wt2html
20273 !! wikitext
20274 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
20275 !! html
20276 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20277 <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;
20278 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
20279 <td>bar</td></table>&quot;]}">foo</p>
20280 <table>
20281 <tbody>
20282 <tr>
20283 <td>bar</td></tr></tbody></table>
20284 !!end
20285
20286 !!test
20287 8. Encapsulate foster-parented transclusion content
20288 !!options
20289 parsoid=wt2wt,wt2html
20290 !! wikitext
20291 {{echo|a
20292 }}{|{{echo|style='color:red'}}
20293 |-
20294 |b
20295 |}
20296 !! html
20297 <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><span 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}}}</span>
20298 <table>
20299 <tbody>
20300 <tr>
20301 <td>b</td></tr></tbody></table>
20302 !!end
20303
20304 !!test
20305 9. Encapsulate foster-parented transclusion content
20306 !!options
20307 parsoid=wt2wt,wt2html
20308 !! wikitext
20309 <table>{{echo|hi</table>hello}}
20310 !! html
20311 <span 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</span>
20312 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
20313 !!end
20314
20315 !!test
20316 Table in fosterable position
20317 !!options
20318 parsoid=wt2html,wt2wt
20319 !! wikitext
20320 {{OpenTable}}
20321 <div>
20322 {|
20323 |}
20324 </div>
20325 |}
20326 !! html
20327 <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" data-parsoid="{}">
20328 </span>
20329 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
20330
20331 <table>
20332 </table>
20333 !!end
20334
20335 # Parsoid only for bug 64747
20336 !! test
20337 Properly encapsulate empty-content transclusions in fosterable positions
20338 !! wikitext
20339 <table>
20340 {{#if:|
20341 <td>foo</td>
20342 }}
20343 </table>
20344 !! html/parsoid
20345 <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>"}'>
20346
20347 </table>
20348 !! end
20349
20350 !!test
20351 Support <object> element with .data attribute
20352 !!options
20353 parsoid=html2wt
20354 !! wikitext
20355 <object data="test.swf"></object>
20356 !! html
20357 <object data="test.swf"></object>
20358 !!end
20359
20360 # -----------------------------------------------------------------
20361 # The following section of tests are primarily to spec requirements
20362 # around serialization of new/edited content.
20363 #
20364 # All these tests are marked Parsoid html2wt and html2html only
20365 # ----------------------------------------------------------------
20366
20367 !! test
20368 Image: Modifying size of an image (1)
20369 !! options
20370 parsoid={
20371 "modes": ["wt2wt"],
20372 "changes": [
20373 ["img[height]", "attr", "height", "22"],
20374 ["img[width]", "attr", "width", "200"]
20375 ]
20376 }
20377 !! wikitext
20378 [[Image:Foobar.jpg|230x230px]]
20379 !! wikitext/edited
20380 [[Image:Foobar.jpg|200x200px]]
20381 !!end
20382
20383 !! test
20384 Image: Modifying size of an image (2)
20385 !! options
20386 parsoid={
20387 "modes": ["wt2wt"],
20388 "changes": [
20389 ["img[height]", "attr", "height", "100"],
20390 ["img[width]", "attr", "width", "500"]
20391 ]
20392 }
20393 !! wikitext
20394 [[Image:Foobar.jpg|230x230px]]
20395 !! wikitext/edited
20396 [[Image:Foobar.jpg|500x500px]]
20397 !!end
20398
20399 # Change in size is ignored so long as class='mw-default-size'
20400 !! test
20401 Image: Modifying size of an image (3)
20402 !! options
20403 parsoid={
20404 "modes": ["wt2wt"],
20405 "changes": [
20406 ["figure[class]", "removeClass", "mw-default-size"],
20407 ["figure img", "attr", "height", "19"],
20408 ["figure img", "attr", "width", "170"]
20409 ]
20410 }
20411 !! wikitext
20412 [[Image:Foobar.jpg|thumb]]
20413 !! wikitext/edited
20414 [[Image:Foobar.jpg|thumb|170x170px]]
20415 !!end
20416
20417 !! test
20418 Image: Modifying alignment of an image (bug 48665)
20419 !! options
20420 parsoid={
20421 "modes": ["wt2wt"],
20422 "changes": [
20423 ["figure[class]", "removeClass", "mw-halign-right"],
20424 ["figure[class]", "addClass", "mw-halign-left"]
20425 ]
20426 }
20427 !! wikitext
20428 [[Image:Foobar.jpg|thumb|caption|right]]
20429 !! wikitext/edited
20430 [[Image:Foobar.jpg|thumb|caption|left]]
20431 !! end
20432
20433 !! test
20434 Image: Modifying mw-default-size of an frameless image (bug 62805)
20435 !! options
20436 parsoid={
20437 "modes": ["wt2wt"],
20438 "changes": [
20439 ["figure.mw-default-size", "removeClass", "mw-default-size"]
20440 ]
20441 }
20442 !! wikitext
20443 [[Image:Foobar.jpg|frameless|right]]
20444 !! wikitext/edited
20445 [[Image:Foobar.jpg|frameless|right|220x220px]]
20446 !! end
20447
20448 !! test
20449 Image: Modifying valign of an image (bug 49221)
20450 !! options
20451 parsoid={
20452 "modes": ["wt2wt"],
20453 "changes": [
20454 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
20455 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
20456 ]
20457 }
20458 !! wikitext
20459 [[File:Foobar.jpg|20px|middle]]
20460 !! wikitext/edited
20461 [[File:Foobar.jpg|20px|text-top]]
20462 !! end
20463
20464 !! test
20465 Image: Modifying alt attribute of an image (bug 56400)
20466 !! options
20467 parsoid={
20468 "modes": ["wt2wt"],
20469 "changes": [
20470 ["img[alt]", "attr", "alt", "some alternate edited text"]
20471 ]
20472 }
20473 !! wikitext
20474 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
20475 !! wikitext/edited
20476 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
20477 !!end
20478
20479 !! test
20480 Image: Modifying caption of an image
20481 !! options
20482 parsoid={
20483 "modes": ["wt2wt"],
20484 "changes": [
20485 ["figcaption", "text", "new caption"]
20486 ]
20487 }
20488 !! wikitext
20489 [[Image:Foobar.jpg|thumb|original caption]]
20490 !! wikitext/edited
20491 [[Image:Foobar.jpg|thumb|new caption]]
20492 !!end
20493
20494 !! test
20495 Image: empty alt attribute (bug 48924)
20496 !! options
20497 parsoid
20498 !! wikitext
20499 [[File:Foobar.jpg|thumb|alt=|bar]]
20500 !! html
20501 <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>
20502 !! end
20503
20504 #!! test
20505 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
20506 #!! options
20507 #parsoid=html2wt
20508 #language=ar
20509 #!! input
20510 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
20511 #!! result
20512 #<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>
20513 #!! end
20514
20515 !! test
20516 Image: Block level image should have \n before and after
20517 !! options
20518 parsoid
20519 !! wikitext
20520 123
20521 [[File:Foobar.jpg|right|thumb|150x150px]]
20522 456
20523 !! html
20524 <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>
20525 !!end
20526
20527 !! test
20528 Image: New block level image should have \n before and after (existing
20529 content)
20530 !! options
20531 parsoid
20532 !! wikitext
20533 123
20534 [[File:Foobar.jpg|right|thumb|150x150px]]
20535 456
20536 !! html
20537 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
20538 <figure class="mw-halign-right" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"right","ak":"right"},{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"150x150px"}],"dsr":[4,45,2,2]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"dsr":[6,43,null,null]}'><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>
20539 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
20540 !!end
20541
20542 !! test
20543 Image: upright option (parsoid)
20544 !! options
20545 parsoid
20546 !! wikitext
20547 [[File:Foobar.jpg|thumb|upright|caption]]
20548 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
20549 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
20550 !! html
20551 <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><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><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>
20552 !!end
20553
20554 !! test
20555 Image: upright option is ignored on inline and frame images (parsoid)
20556 !! options
20557 parsoid
20558 !! wikitext
20559 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
20560 !! html
20561 <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>
20562 !!end
20563
20564 !! test
20565 Image: from basic HTML (1)
20566 !! options
20567 parsoid=html2wt
20568 !! html/parsoid
20569 <span typeof="mw:Image">
20570 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20571 </span>
20572 !! wikitext
20573 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20574 !! end
20575
20576 !! test
20577 Image: from basic HTML (2)
20578 !! options
20579 parsoid=html2wt
20580 !! html/parsoid
20581 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20582 !! wikitext
20583 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20584 !! end
20585
20586 !! test
20587 Image: from basic HTML (3)
20588 !! options
20589 parsoid=html2wt
20590 !! html/parsoid
20591 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
20592 !! wikitext
20593 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
20594 !! end
20595
20596 !! test
20597 Image: from basic HTML (4)
20598 !! options
20599 parsoid=html2wt
20600 !! html/parsoid
20601 <img src="File:Foobar.jpg">
20602 !! wikitext
20603 [[File:Foobar.jpg|link=]]
20604 !! end
20605
20606 !! test
20607 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
20608 !! options
20609 parsoid=html2wt
20610 !! wikitext
20611 * foo
20612 !! html
20613 <ul>
20614 <li><p>foo</p></li>
20615 </ul>
20616 !! end
20617
20618 !! test
20619 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
20620 !! options
20621 parsoid=html2wt
20622 !! wikitext
20623 * foo
20624 !! html
20625 <ul> <li>foo</li></ul>
20626 !! end
20627
20628 !! test
20629 Don't strip leading whitespace when handling indent-pre suppressing tags
20630 !! options
20631 parsoid=html2wt
20632 !! wikitext
20633 {|
20634 | indented row
20635 |}
20636 <blockquote>
20637 '''This is very bold of you!'''
20638
20639 {|
20640 |
20641 indented cell (no pre-wrapping!)
20642 |}
20643 </blockquote>
20644 foo
20645 <div>bar</div>
20646 !! html
20647 <table>
20648 <tr><td> indented row</td></tr>
20649 </table>
20650 <blockquote><p>
20651 <b>This is very bold of you!</b>
20652 </p>
20653 <table><tr><td>
20654 indented cell (no pre-wrapping!)
20655 </td></tr></table>
20656 </blockquote>
20657 <p>foo</p>
20658 <div>bar</div>
20659 !! end
20660
20661 !! test
20662 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
20663 !! options
20664 parsoid=html2wt
20665 !! wikitext
20666 foo
20667 <nowiki> </nowiki><span>bar</span>
20668
20669 <span>foo2
20670 <nowiki> </nowiki></span>bar2
20671
20672 <div>foo</div>
20673 <nowiki> </nowiki><span>bar</span>
20674
20675 <div>
20676 <nowiki> </nowiki><span>foo</span>
20677 </div>
20678 !! html
20679 <p>foo</p>
20680 <span>bar</span>
20681
20682 <span>foo2
20683 </span>bar2
20684
20685 <div>foo</div>
20686 <span>bar</span>
20687
20688 <div>
20689 <span>foo</span>
20690 </div>
20691 !! end
20692
20693 !! test
20694 Lists: Add space after bullets
20695 !! options
20696 parsoid=html2wt
20697 !! wikitext
20698 * foo
20699 * bar
20700 * <span> baz</span>
20701 !! html
20702 <ul>
20703 <li>foo</li>
20704 <li> bar</li>
20705 <li><span> baz</span></li>
20706 </ul>
20707 !! end
20708
20709 !! test
20710 Lists: Dont insert newlines in a serialized list item.
20711 !! options
20712 parsoid=html2wt
20713 !! wikitext
20714 * a<br>b
20715 * c
20716 !! html
20717 <ul><li>a<br>b</li><li>c</li></ul>
20718 !! end
20719
20720 !! test
20721 Headings: Add space before/after == (Bug 51744)
20722 !! options
20723 parsoid=html2wt
20724 !! wikitext
20725 == foo ==
20726
20727 == bar ==
20728
20729 == baz ==
20730
20731 == <span> baz</span> ==
20732 !! html
20733 <h2>foo</h2>
20734 <h2> bar</h2>
20735 <h2>baz </h2>
20736 <h2><span> baz</span></h2>
20737 !! end
20738
20739 !! test
20740 Parsoid: Serialize positional parameters with = in them as named parameter
20741 !! options
20742 parsoid=html2wt
20743 !! wikitext
20744 {{echo|1 = f=oo}}
20745
20746 {{echo|1 = f=oo|2 = bar}}
20747
20748 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20749 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20750 {{echo|<nowiki>f=oo</nowiki>|bar}}
20751 !! html
20752 <p about="#mwt1" typeof="mw:Transclusion"
20753 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
20754
20755 <p about="#mwt1" typeof="mw:Transclusion"
20756 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
20757
20758 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20759 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20760 <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>
20761 !! end
20762
20763 !! test
20764 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
20765 !! options
20766 parsoid=html2wt
20767 !! wikitext
20768 <div>a
20769 b
20770 </div>
20771 <div>a
20772 b
20773 </div>
20774 <div>
20775 a
20776
20777 b
20778 </div>
20779 !! html
20780 <div>a<p>b</p></div>
20781 <div>a
20782 <p>b</p></div>
20783 <div>
20784 a
20785 <p>b</p></div>
20786 !! end
20787
20788 !! test
20789 Substrings resembling wikitext in hrefs should not get nowiki escapes
20790 !! options
20791 parsoid=html2wt
20792 !! wikitext
20793 [[Foo''bar''baz]]
20794 !! html
20795 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
20796 !! end
20797
20798 #-----------------------------
20799 # I/B quote minimization tests
20800 #-----------------------------
20801
20802 !! test
20803 1. I/B quote minimization: wikitext-only tags should be combined
20804 !! options
20805 parsoid=html2wt
20806 !! wikitext
20807 ''AB''
20808
20809 '''AB'''
20810
20811 ''A'''B'''''
20812
20813 '''A''B'''''
20814
20815 '''A''BC''D'''
20816
20817 '''''AB'''''
20818
20819 '''''AB'''''
20820
20821 '''''AB'''''
20822 !! html
20823 <p><i>A</i><i>B</i></p>
20824 <p><b>A</b><b>B</b></p>
20825 <p><i>A</i><b><i>B</i></b></p>
20826 <p><b>A</b><i><b>B</b></i></p>
20827 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
20828 <p><i><b>A</b></i><i><b>B</b></i></p>
20829 <p><i><b>A</b></i><b><i>B</i></b></p>
20830 <p><b><i>A</i></b><i><b>B</b></i></p>
20831 !! end
20832
20833 !! test
20834 2. I/B quote minimization: wikitext and html tags should not be combined
20835 !! options
20836 parsoid=html2wt
20837 !! wikitext
20838 ''A''<i>B</i>
20839
20840 ''A'''''<i>B</i>'''
20841 !! html
20842 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
20843 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
20844 !! end
20845
20846 !! test
20847 3. I/B quote minimization: templated content stops minimization
20848 !! options
20849 parsoid=html2wt
20850 !! wikitext
20851 ''A''{{echo|''B''}}
20852
20853 ''A''{{echo|'''''B'''''}}
20854 !! html
20855 <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>
20856 <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>
20857 !! end
20858
20859 !! test
20860 4. I/B quote minimization: new content should be mimimized with adjacent old content
20861 !! options
20862 parsoid=html2wt
20863 !! wikitext
20864 ''AB''
20865
20866 '''AB'''
20867
20868 ''A'''B'''''
20869 !! html
20870 <p><i>A</i><i data-parsoid='{}'>B</i></p>
20871 <p><b data-parsoid='{}'>A</b><b>B</b></p>
20872 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
20873 !! end
20874
20875 #------------------------------------
20876 # End of I/B quote minimization tests
20877 #------------------------------------
20878
20879 !!test
20880 Bug 54262: New entities
20881 !! options
20882 parsoid=html2wt
20883 !! wikitext
20884 &nbsp;
20885 !! html
20886 <span typeof="mw:Entity">&nbsp;</span>
20887 !! end
20888
20889 ## Note that there is no wikitext output for 'unknownproperty' ##
20890 ## Unknown magic words are silently dropped ##
20891
20892 !! test
20893 Magic words
20894 !! options
20895 parsoid=html2wt
20896 !! wikitext
20897 __TOC__
20898 __NOTOC__
20899 __FORCETOC__
20900 __INDEX__
20901 __NOINDEX__
20902 __NOGALLERY__
20903 __NOEDITSECTION__
20904 __NOTITLECONVERT__
20905 __NOCONTENTCONVERT__
20906 !! html
20907 <meta property='mw:PageProp/toc' />
20908 <meta property='mw:PageProp/notoc' />
20909 <meta property='mw:PageProp/forcetoc' />
20910 <meta property='mw:PageProp/index' />
20911 <meta property='mw:PageProp/noindex' />
20912 <meta property='mw:PageProp/nogallery' />
20913 <meta property='mw:PageProp/noeditsection' />
20914 <meta property='mw:PageProp/notitleconvert' />
20915 <meta property='mw:PageProp/nocontentconvert' />
20916 <meta property='mw:PageProp/unknownproperty' />
20917 !! end
20918
20919 !! test
20920 Consecutive <pre>s should not get merged
20921 !! options
20922 parsoid=html2wt,html2html
20923 !! wikitext
20924 a
20925
20926 b
20927
20928 c
20929
20930 d
20931
20932 e
20933
20934
20935
20936 f
20937 !! html
20938 <pre>a</pre><pre>b</pre>
20939
20940 <pre>c
20941 </pre><pre>
20942 d</pre>
20943
20944 <pre>e
20945
20946 </pre><pre>
20947
20948 f</pre>
20949 !! end
20950
20951 !! test
20952 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
20953 !! options
20954 parsoid=html2wt
20955 !! wikitext
20956 [[Special:BookSources/1234567890|ISBN 1234567895]]
20957 !! html
20958 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
20959 !! end
20960
20961 !! test
20962 Edited RFC links not serializable as RFC links should serialize as extlinks
20963 !! options
20964 parsoid=html2wt
20965 !! wikitext
20966 [//tools.ietf.org/html/rfc123 New RFC]
20967 !! html
20968 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
20969 !! end
20970
20971 !! test
20972 Edited PMID links not serializable as PMID links should serialize as extlinks
20973 !! options
20974 parsoid=html2wt
20975 !! wikitext
20976 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
20977 !! html
20978 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
20979 !! end
20980
20981 !! test
20982 Edited Redirect link should emit a non-piped wikitext link
20983 !! options
20984 parsoid=html2wt
20985 !! wikitext
20986 #REDIRECT [[Bar]]
20987 !! html
20988 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
20989 !! end
20990
20991 # -----------------------------------------------------------------
20992 # End of section for Parsoid-only html2wt tests for serialization
20993 # of new content
20994 # -----------------------------------------------------------------
20995
20996 TODO:
20997 more images
20998 more tables
20999 character entities
21000 and much more
21001 Try for 100% code coverage