Merge "Add parser test for "extra interlanguage links"."
[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 "Extra" interlanguage links (bug 32189 / gerrit 111390)
6412 !! wikitext
6413 Blah blah blah
6414 [[mul:Multilingual]]
6415 !! html
6416 <p>Blah blah blah
6417 </p>
6418 !! end
6419
6420 !! test
6421 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
6422 !! options
6423 language=ln
6424 !! wikitext
6425 [[WW&nbsp;II]]
6426 !! html
6427 <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>
6428 </p>
6429 !! end
6430
6431 !! test
6432 Parsoid bug 53221: Wikilinks should be properly entity-escaped
6433 !! options
6434 parsoid=html2wt
6435 !! wikitext
6436 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
6437
6438 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
6439 !! html
6440 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6441 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6442 !! end
6443
6444 !! test
6445 Parsoid: handle constructor well
6446 !! options
6447 parsoid
6448 !! wikitext
6449 [[constructor]]
6450
6451 [[constructor:foo]]
6452 !! html
6453 <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>
6454
6455 <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>
6456 !! end
6457
6458 !! test
6459 Parsoid: recognize interlanguage links without a target page
6460 !! options
6461 parsoid
6462 !! wikitext
6463 [[ko:]]
6464 !! html
6465 <p><link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
6466 !! end
6467
6468 !! test
6469 Parsoid: recognize interwiki links without a target page
6470 !! options
6471 parsoid
6472 !! wikitext
6473 [[:ko:]]
6474 !! html
6475 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
6476 !! end
6477
6478 !! test
6479 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
6480 !! options
6481 parsoid
6482 !! wikitext
6483 [[en:Foo]]
6484 !! html
6485 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
6486 !! end
6487
6488 ###
6489 ### Redirects, Parsoid-only
6490 ###
6491 !! test
6492 1. Simple redirect to page
6493 !! options
6494 parsoid
6495 !! wikitext
6496 #REDIRECT [[Main Page]]
6497 !! html
6498 <link rel="mw:PageProp/redirect" href="./Main_Page">
6499 !! end
6500
6501 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
6502 !! test
6503 2. Other redirect variants
6504 !! options
6505 parsoid=wt2html,wt2wt
6506 !! wikitext
6507 #REDIRECT [[Main_Page]]
6508 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
6509 !! html
6510 <link rel="mw:PageProp/redirect" href="./Main_Page">
6511 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
6512 !! end
6513
6514 !! test
6515 Empty redirect
6516 !! options
6517 parsoid=wt2html,wt2wt
6518 !! wikitext
6519 #REDIRECT [[]]
6520 !! html
6521 <ol>
6522 <li>REDIRECT [[]]</li></ol>
6523 !! end
6524
6525 !! test
6526 Optional colon in #REDIRECT
6527 !! options
6528 # the colon is archaic syntax. we support it for wt2html, but we
6529 # don't care that it roundtrips back to the modern syntax.
6530 parsoid=wt2html,html2html
6531 !! wikitext
6532 #REDIRECT:[[Main Page]]
6533 !! html
6534 <link rel="mw:PageProp/redirect" href="./Main_Page">
6535 !! end
6536
6537 !! test
6538 Whitespace in #REDIRECT with optional colon
6539 !! options
6540 # the colon and gratuitous whitespace is archaic syntax. we support
6541 # it for wt2html, but we don't care that it roundtrips back to the
6542 # modern syntax (without extra whitespace)
6543 parsoid=wt2html,html2html
6544 !! wikitext
6545
6546 #REDIRECT
6547 :
6548 [[Main Page]]
6549 !! html
6550 <link rel="mw:PageProp/redirect" href="./Main_Page">
6551 !! end
6552
6553 !! test
6554 Piped link in #REDIRECT
6555 !! options
6556 # content after piped link is ignored. we support this syntax,
6557 # but don't care that the piped link is lost when we roundtrip this.
6558 parsoid=wt2html
6559 !! wikitext
6560 #REDIRECT [[Main Page|bar]]
6561 !! html
6562 <link rel="mw:PageProp/redirect" href="./Main_Page">
6563 !! end
6564
6565 !! test
6566 Redirect to category
6567 !! options
6568 parsoid=wt2html
6569 !! wikitext
6570 #REDIRECT [[Category:Foo]]
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 with URL encoding
6577 !! options
6578 parsoid=wt2html
6579 !! wikitext
6580 #REDIRECT [[Category%3AFoo]]
6581 !! html
6582 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6583 !! end
6584
6585 !! test
6586 Redirect to category page
6587 !! options
6588 parsoid=wt2html,html2html
6589 !! wikitext
6590 #REDIRECT [[:Category:Foo]]
6591 !! html
6592 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
6593 !! end
6594
6595 !! test
6596 Redirect to image page (1)
6597 !! options
6598 parsoid
6599 !! wikitext
6600 #REDIRECT [[File:Wiki.png]]
6601 !! html
6602 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6603 !! end
6604
6605 !! test
6606 Redirect to image page (2)
6607 !! options
6608 parsoid
6609 !! wikitext
6610 #REDIRECT [[Image:Wiki.png]]
6611 !! html
6612 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6613 !! end
6614
6615 !! test
6616 Redirect to language
6617 !! options
6618 parsoid
6619 !! wikitext
6620 #REDIRECT [[en:File:Wiki.png]]
6621 !! html
6622 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6623 !! end
6624
6625 !! test
6626 Redirect to interwiki
6627 !! options
6628 parsoid
6629 !! wikitext
6630 #REDIRECT [[meatball:File:Wiki.png]]
6631 !! html
6632 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6633 !! end
6634
6635 !! test
6636 Non-English #REDIRECT
6637 !! options
6638 parsoid
6639 language=is
6640 !! wikitext
6641 #TILVÍSUN [[Main Page]]
6642 !! html
6643 <link rel="mw:PageProp/redirect" href="./Main_Page">
6644 !! end
6645
6646 !! test
6647 New redirect
6648 !! options
6649 parsoid=html2wt
6650 !! wikitext
6651 Foo
6652 #REDIRECT [[Foo]]
6653 !! html
6654 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
6655 !! end
6656
6657 ##
6658 ## XHTML tidiness
6659 ###
6660
6661 !! test
6662 <br> to <br />
6663 !! wikitext
6664 1<br>2<br />3
6665 !! html
6666 <p>1<br />2<br />3
6667 </p>
6668 !! end
6669
6670 !! test
6671 Broken br tag sanitization
6672 !! wikitext
6673 </br>
6674 !! html/php
6675 <p>&lt;/br&gt;
6676 </p>
6677 !! end
6678
6679 # TODO: Fix html2html mode (bug 51055)!
6680 !! test
6681 Parsoid: Broken br tag recognition
6682 !! options
6683 parsoid=wt2html
6684 !! wikitext
6685 </br>
6686
6687 <br/ >
6688 !! html/parsoid
6689 <p><br></p>
6690 <p><br/></p>
6691 !! end
6692
6693 !! test
6694 Incorrecly removing closing slashes from correctly formed XHTML
6695 !! wikitext
6696 <br style="clear:both;" />
6697 !! html
6698 <p><br style="clear:both;" />
6699 </p>
6700 !! end
6701
6702 !! test
6703 Failing to transform badly formed HTML into correct XHTML
6704 !! wikitext
6705 <br style="clear: left;">
6706 <br style="clear: right;">
6707 <br style="clear: both;">
6708 !! html
6709 <p><br style="clear: left;" />
6710 <br style="clear: right;" />
6711 <br style="clear: both;" />
6712 </p>
6713 !!end
6714
6715 !! test
6716 Handling html with a div self-closing tag
6717 !! wikitext
6718 <div title />
6719 <div title/>
6720 <div title/ >
6721 <div title=bar />
6722 <div title=bar/>
6723 <div title=bar/ >
6724 !! html
6725 <p>&lt;div title /&gt;
6726 &lt;div title/&gt;
6727 </p>
6728 <div>
6729 <p>&lt;div title=bar /&gt;
6730 &lt;div title=bar/&gt;
6731 </p>
6732 <div title="bar/"></div>
6733 </div>
6734
6735 !! end
6736
6737 !! test
6738 Handling html with a br self-closing tag
6739 !! wikitext
6740 <br title />
6741 <br title/>
6742 <br title/ >
6743 <br title=bar />
6744 <br title=bar/>
6745 <br title=bar/ >
6746 !! html
6747 <p><br title="title" />
6748 <br title="title" />
6749 <br />
6750 <br title="bar" />
6751 <br title="bar" />
6752 <br title="bar/" />
6753 </p>
6754 !! end
6755
6756 !! test
6757 Horizontal ruler (should it add that extra space?)
6758 !! wikitext
6759 <hr>
6760 <hr >
6761 foo <hr
6762 > bar
6763 !! html
6764 <hr />
6765 <hr />
6766 foo <hr /> bar
6767
6768 !! end
6769
6770 !! test
6771 Horizontal ruler -- 4+ dashes render hr
6772 !! wikitext
6773 ----
6774 !! html
6775 <hr />
6776
6777 !! end
6778
6779 !! test
6780 Horizontal ruler -- eats additional dashes on the same line
6781 !! wikitext
6782 ---------
6783 !! html
6784 <hr />
6785
6786 !! end
6787
6788 !! test
6789 Horizontal ruler -- does not collapse dashes on consecutive lines
6790 !! wikitext
6791 ----
6792 ----
6793 !! html
6794 <hr />
6795 <hr />
6796
6797 !! end
6798
6799 !! test
6800 Horizontal ruler -- <4 dashes render as plain text
6801 !! wikitext
6802 ---
6803 !! html
6804 <p>---
6805 </p>
6806 !! end
6807
6808 !! test
6809 Horizontal ruler -- Supports content following dashes on same line
6810 !! wikitext
6811 ---- Foo
6812 !! html
6813 <hr /> Foo
6814
6815 !! end
6816
6817 ###
6818 ### Block-level elements
6819 ###
6820 !! test
6821 Common list
6822 !! wikitext
6823 *Common list
6824 * item 2
6825 *item 3
6826 !! html
6827 <ul><li>Common list</li>
6828 <li> item 2</li>
6829 <li>item 3</li></ul>
6830
6831 !! end
6832
6833 !! test
6834 Numbered list
6835 !! wikitext
6836 #Numbered list
6837 #item 2
6838 # item 3
6839 !! html
6840 <ol><li>Numbered list</li>
6841 <li>item 2</li>
6842 <li> item 3</li></ol>
6843
6844 !! end
6845
6846 !! test
6847 Mixed list
6848 !! wikitext
6849 *Mixed list
6850 *# with numbers
6851 ** and bullets
6852 *# and numbers
6853 *bullets again
6854 **bullet level 2
6855 ***bullet level 3
6856 ***#Number on level 4
6857 **bullet level 2
6858 **#Number on level 3
6859 **#Number on level 3
6860 *#number level 2
6861 *Level 1
6862 *** Level 3
6863 #** Level 3, but ordered
6864 !! html
6865 <ul><li>Mixed list
6866 <ol><li> with numbers</li></ol>
6867 <ul><li> and bullets</li></ul>
6868 <ol><li> and numbers</li></ol></li>
6869 <li>bullets again
6870 <ul><li>bullet level 2
6871 <ul><li>bullet level 3
6872 <ol><li>Number on level 4</li></ol></li></ul></li>
6873 <li>bullet level 2
6874 <ol><li>Number on level 3</li>
6875 <li>Number on level 3</li></ol></li></ul>
6876 <ol><li>number level 2</li></ol></li>
6877 <li>Level 1
6878 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
6879 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
6880
6881 !! end
6882
6883 !! test
6884 Nested lists 1
6885 !! wikitext
6886 *foo
6887 **bar
6888 !! html
6889 <ul><li>foo
6890 <ul><li>bar</li></ul></li></ul>
6891
6892 !! end
6893
6894 !! test
6895 Nested lists 2
6896 !! wikitext
6897 **foo
6898 *bar
6899 !! html
6900 <ul><li><ul><li>foo</li></ul></li>
6901 <li>bar</li></ul>
6902
6903 !! end
6904
6905 !! test
6906 Nested lists 3 (first element empty)
6907 !! wikitext
6908 *
6909 **bar
6910 !! html
6911 <ul><li>
6912 <ul><li>bar</li></ul></li></ul>
6913
6914 !! end
6915
6916 !! test
6917 Nested lists 4 (first element empty)
6918 !! wikitext
6919 **
6920 *bar
6921 !! html
6922 <ul><li><ul><li></li></ul></li>
6923 <li>bar</li></ul>
6924
6925 !! end
6926
6927 !! test
6928 Nested lists 5 (both elements empty)
6929 !! wikitext
6930 **
6931 *
6932 !! html
6933 <ul><li><ul><li></li></ul></li>
6934 <li></li></ul>
6935
6936 !! end
6937
6938 !! test
6939 Nested lists 6 (both elements empty)
6940 !! wikitext
6941 *
6942 **
6943 !! html
6944 <ul><li>
6945 <ul><li></li></ul></li></ul>
6946
6947 !! end
6948
6949 !! test
6950 Nested lists 7 (skip initial nesting levels)
6951 !! wikitext
6952 *** foo
6953 !! html
6954 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
6955
6956 !! end
6957
6958 !! test
6959 Nested lists 8 (multiple nesting transitions)
6960 !! wikitext
6961 * foo
6962 *** bar
6963 ** baz
6964 * boo
6965 !! html
6966 <ul><li> foo
6967 <ul><li><ul><li> bar</li></ul></li>
6968 <li> baz</li></ul></li>
6969 <li> boo</li></ul>
6970
6971 !! end
6972
6973 !! test
6974 1. Lists with start-of-line-transparent tokens before bullets: Comments
6975 !! wikitext
6976 *foo
6977 *<!--cmt-->bar
6978 <!--cmt-->*baz
6979 !! html
6980 <ul><li>foo</li>
6981 <li>bar</li>
6982 <li>baz</li></ul>
6983
6984 !! end
6985
6986 !! test
6987 2. Lists with start-of-line-transparent tokens before bullets: Template close
6988 !! wikitext
6989 *foo {{echo|bar
6990 }}*baz
6991 !! html
6992 <ul><li>foo bar</li>
6993 <li>baz</li></ul>
6994
6995 !! end
6996
6997 !! test
6998 List items are not parsed correctly following a <pre> block (bug 785)
6999 !! wikitext
7000 * <pre>foo</pre>
7001 * <pre>bar</pre>
7002 * zar
7003 !! html
7004 <ul><li> <pre>foo</pre></li>
7005 <li> <pre>bar</pre></li>
7006 <li> zar</li></ul>
7007
7008 !! end
7009
7010 !! test
7011 List items from template
7012 !! wikitext
7013
7014 {{inner list}}
7015 * item 2
7016
7017 * item 0
7018 {{inner list}}
7019 * item 2
7020
7021 * item 0
7022 * notSOL{{inner list}}
7023 * item 2
7024 !! html
7025 <ul><li> item 1</li>
7026 <li> item 2</li></ul>
7027 <ul><li> item 0</li>
7028 <li> item 1</li>
7029 <li> item 2</li></ul>
7030 <ul><li> item 0</li>
7031 <li> notSOL</li>
7032 <li> item 1</li>
7033 <li> item 2</li></ul>
7034
7035 !! end
7036
7037 !! test
7038 List interrupted by empty line or heading
7039 !! wikitext
7040 * foo
7041
7042 ** bar
7043 == A heading ==
7044 * Another list item
7045 !! html
7046 <ul><li> foo</li></ul>
7047 <ul><li><ul><li> bar</li></ul></li></ul>
7048 <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>
7049 <ul><li> Another list item</li></ul>
7050
7051 !!end
7052
7053 !!test
7054 Multiple list tags generated by templates
7055 !! wikitext
7056 {{echo|<li>}}a
7057 {{echo|<li>}}b
7058 {{echo|<li>}}c
7059 !! html
7060 <li>a
7061 <li>b
7062 <li>c</li>
7063 </li>
7064 </li>
7065
7066 !!end
7067
7068 !!test
7069 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7070 !! wikitext
7071 *a
7072 <!--This line will NOT split the list-->
7073 *b
7074 <!--This line will NOT split the list either-->
7075 *c
7076 <!--foo--> <!----> <!--This line NOT split the list either-->
7077 *d
7078 !! html
7079 <ul><li>a</li>
7080 <li>b</li>
7081 <li>c</li>
7082 <li>d</li></ul>
7083
7084 !!end
7085
7086 !!test
7087 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7088 !! wikitext
7089 *a
7090 <!--This line will NOT split the list-->
7091 *b
7092 <!--This line will NOT split the list either-->
7093 *c
7094 <!--foo--> <!----> <!--This line NOT split the list
7095 either-->
7096 *d
7097 !! html
7098 <ul><li>a</li>
7099 <li>b</li>
7100 <li>c</li>
7101 <li>d</li></ul>
7102
7103 !!end
7104
7105 !!test
7106 Test the li-hack
7107 (Cannot test this with PHP parser since it relies on Tidy for the hack)
7108 !!options
7109 parsoid=wt2html,wt2wt
7110 !! wikitext
7111 * foo
7112 * <li>li-hack
7113 * {{echo|<li>templated li-hack}}
7114 * <!--foo--> <li> unsupported li-hack with preceding comments
7115
7116 <ul>
7117 <li><li>not a li-hack
7118 </li>
7119 </ul>
7120 !! html
7121 <ul>
7122 <li> foo</li>
7123 <li>li-hack</li>
7124 <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>
7125 <li> <!--foo--> </li>
7126 <li> li-hack with preceding comments</li>
7127 </ul>
7128
7129 <ul>
7130 <li></li>
7131 <li>not a li-hack
7132 </li>
7133 </ul>
7134 !!end
7135
7136 !! test
7137 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
7138 !! options
7139 parsoid
7140 !! wikitext
7141 # foo
7142 ## bar
7143 * foo
7144 ** bar
7145 : foo
7146 :: bar
7147 !! html
7148 <ol>
7149 <li> foo<ol>
7150 <li> bar</li>
7151 </ol></li>
7152 </ol><ul>
7153 <li> foo<ul>
7154 <li> bar</li>
7155 </ul></li>
7156 </ul><dl>
7157 <dd> foo<dl>
7158 <dd> bar</dd>
7159 </dl></dd>
7160 </dl>
7161 !! end
7162
7163 !! test
7164 Parsoid: Test of whitespace serialization with Templated bullets
7165 !! options
7166 parsoid
7167 !! wikitext
7168 * {{bullet}}
7169 !! html
7170 <ul>
7171 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
7172 </ul>
7173 !! end
7174
7175 # ------------------------------------------------------------------------
7176 # The next set of tests are about Parsoid's ability to handle badly nested
7177 # tags (parse, minimize scope of fixup, and roundtrip back)
7178 # ------------------------------------------------------------------------
7179
7180 !! test
7181 Unbalanced closing block tags break a list
7182 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7183 !! wikitext
7184 <div>
7185 *a</div><div>
7186 *b</div>
7187 !! html/parsoid
7188 <div>
7189 <ul>
7190 <li>a
7191 </li>
7192 </ul></div><div>
7193 <ul>
7194 <li>b
7195 </li>
7196 </ul></div>
7197 !! end
7198
7199 !! test
7200 Unbalanced closing non-block tags don't break a list
7201 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7202 !! wikitext
7203 <span>
7204 *a</span><span>
7205 *b</span>
7206 !! html/parsoid
7207 <p><span></span>
7208 </p>
7209 <ul>
7210 <li>a<span></span>
7211 </li>
7212 <li>b
7213 </li>
7214 </ul>
7215 !! end
7216
7217 !! test
7218 Unclosed formatting tags that straddle lists are closed and reopened
7219 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7220 !! wikitext
7221 # <s> a
7222 # b </s>
7223 !! html/parsoid
7224 <ol>
7225 <li> <s> a </s>
7226 </li>
7227 <li> <s> b </s>
7228 </li>
7229 </ol>
7230 !! end
7231
7232 !!test
7233 List embedded in a non-block tag
7234 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
7235 !! wikitext
7236 <small>
7237 * foo
7238 </small>
7239 !! html/parsoid
7240 <p><small></small></p>
7241 <small>
7242 <ul>
7243 <li> foo</li>
7244 </ul>
7245 </small>
7246 <p><small></small></p>
7247 !!end
7248
7249 !! test
7250 Table with missing opening <tr> tag
7251 !! options
7252 parsoid=wt2html,wt2wt
7253 !! wikitext
7254 <table>
7255 <td>foo</td>
7256 </tr>
7257 </table>
7258 !! html/parsoid
7259 <table>
7260 <tr>
7261 <td>foo</td>
7262 </tr>
7263 </table>
7264 !! end
7265
7266 ###
7267 ### Magic Words
7268 ###
7269
7270 # Note that the current date is hard-coded as
7271 # 1970-01-01T00:02:03Z (a Thursday)
7272 # when running parser tests. The timezone is also fixed to GMT, so
7273 # local date will be identical to current date.
7274
7275 !! test
7276 Magic Word: {{CURRENTDAY}}
7277 !! wikitext
7278 {{CURRENTDAY}}
7279 !! html
7280 <p>1
7281 </p>
7282 !! end
7283
7284 !! test
7285 Magic Word: {{CURRENTDAY2}}
7286 !! wikitext
7287 {{CURRENTDAY2}}
7288 !! html
7289 <p>01
7290 </p>
7291 !! end
7292
7293 !! test
7294 Magic Word: {{CURRENTDAYNAME}}
7295 !! wikitext
7296 {{CURRENTDAYNAME}}
7297 !! html
7298 <p>Thursday
7299 </p>
7300 !! end
7301
7302 !! test
7303 Magic Word: {{CURRENTDOW}}
7304 !! wikitext
7305 {{CURRENTDOW}}
7306 !! html
7307 <p>4
7308 </p>
7309 !! end
7310
7311 !! test
7312 Magic Word: {{CURRENTMONTH}}
7313 !! wikitext
7314 {{CURRENTMONTH}}
7315 !! html
7316 <p>01
7317 </p>
7318 !! end
7319
7320 !! test
7321 Magic Word: {{CURRENTMONTH1}}
7322 !! wikitext
7323 {{CURRENTMONTH1}}
7324 !! html
7325 <p>1
7326 </p>
7327 !! end
7328
7329 !! test
7330 Magic Word: {{CURRENTMONTHABBREV}}
7331 !! wikitext
7332 {{CURRENTMONTHABBREV}}
7333 !! html
7334 <p>Jan
7335 </p>
7336 !! end
7337
7338 !! test
7339 Magic Word: {{CURRENTMONTHNAME}}
7340 !! wikitext
7341 {{CURRENTMONTHNAME}}
7342 !! html
7343 <p>January
7344 </p>
7345 !! end
7346
7347 !! test
7348 Magic Word: {{CURRENTMONTHNAMEGEN}}
7349 !! wikitext
7350 {{CURRENTMONTHNAMEGEN}}
7351 !! html
7352 <p>January
7353 </p>
7354 !! end
7355
7356 !! test
7357 Magic Word: {{CURRENTTIME}}
7358 !! wikitext
7359 {{CURRENTTIME}}
7360 !! html
7361 <p>00:02
7362 </p>
7363 !! end
7364
7365 !! test
7366 Magic Word: {{CURRENTHOUR}}
7367 !! wikitext
7368 {{CURRENTHOUR}}
7369 !! html
7370 <p>00
7371 </p>
7372 !! end
7373
7374 !! test
7375 Magic Word: {{CURRENTWEEK}} (@bug 4594)
7376 !! wikitext
7377 {{CURRENTWEEK}}
7378 !! html
7379 <p>1
7380 </p>
7381 !! end
7382
7383 !! test
7384 Magic Word: {{CURRENTYEAR}}
7385 !! wikitext
7386 {{CURRENTYEAR}}
7387 !! html
7388 <p>1970
7389 </p>
7390 !! end
7391
7392 !! test
7393 Magic Word: {{CURRENTTIMESTAMP}}
7394 !! wikitext
7395 {{CURRENTTIMESTAMP}}
7396 !! html
7397 <p>19700101000203
7398 </p>
7399 !! end
7400
7401 !! test
7402 Magic Words LOCAL (UTC)
7403 !! wikitext
7404 * {{LOCALMONTH}}
7405 * {{LOCALMONTH1}}
7406 * {{LOCALMONTHNAME}}
7407 * {{LOCALMONTHNAMEGEN}}
7408 * {{LOCALMONTHABBREV}}
7409 * {{LOCALDAY}}
7410 * {{LOCALDAY2}}
7411 * {{LOCALDAYNAME}}
7412 * {{LOCALYEAR}}
7413 * {{LOCALTIME}}
7414 * {{LOCALHOUR}}
7415 * {{LOCALWEEK}}
7416 * {{LOCALDOW}}
7417 * {{LOCALTIMESTAMP}}
7418 !! html
7419 <ul><li> 01</li>
7420 <li> 1</li>
7421 <li> January</li>
7422 <li> January</li>
7423 <li> Jan</li>
7424 <li> 1</li>
7425 <li> 01</li>
7426 <li> Thursday</li>
7427 <li> 1970</li>
7428 <li> 00:02</li>
7429 <li> 00</li>
7430 <li> 1</li>
7431 <li> 4</li>
7432 <li> 19700101000203</li></ul>
7433
7434 !! end
7435
7436 !! test
7437 Magic Word: {{FULLPAGENAME}}
7438 !! options
7439 title=[[User:Ævar Arnfjörð Bjarmason]]
7440 !! wikitext
7441 {{FULLPAGENAME}}
7442 !! html
7443 <p>User:Ævar Arnfjörð Bjarmason
7444 </p>
7445 !! end
7446
7447 !! test
7448 Magic Word: {{FULLPAGENAMEE}}
7449 !! options
7450 title=[[User:Ævar Arnfjörð Bjarmason]]
7451 !! wikitext
7452 {{FULLPAGENAMEE}}
7453 !! html
7454 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7455 </p>
7456 !! end
7457
7458 !! test
7459 Magic Word: {{TALKSPACE}}
7460 !! options
7461 title=[[User:Ævar Arnfjörð Bjarmason]]
7462 !! wikitext
7463 {{TALKSPACE}}
7464 !! html
7465 <p>User talk
7466 </p>
7467 !! end
7468
7469 !! test
7470 Magic Word: {{TALKSPACE}}, same namespace
7471 !! options
7472 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7473 !! wikitext
7474 {{TALKSPACE}}
7475 !! html
7476 <p>User talk
7477 </p>
7478 !! end
7479
7480 !! test
7481 Magic Word: {{TALKSPACE}}, main namespace
7482 !! options
7483 title=[[Parser Test]]
7484 !! wikitext
7485 {{TALKSPACE}}
7486 !! html
7487 <p>Talk
7488 </p>
7489 !! end
7490
7491 !! test
7492 Magic Word: {{TALKSPACEE}}
7493 !! options
7494 title=[[User:Ævar Arnfjörð Bjarmason]]
7495 !! wikitext
7496 {{TALKSPACEE}}
7497 !! html
7498 <p>User_talk
7499 </p>
7500 !! end
7501
7502 !! test
7503 Magic Word: {{SUBJECTSPACE}}
7504 !! options
7505 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7506 !! wikitext
7507 {{SUBJECTSPACE}}
7508 !! html
7509 <p>User
7510 </p>
7511 !! end
7512
7513 !! test
7514 Magic Word: {{SUBJECTSPACE}}, same namespace
7515 !! options
7516 title=[[User:Ævar Arnfjörð Bjarmason]]
7517 !! wikitext
7518 {{SUBJECTSPACE}}
7519 !! html
7520 <p>User
7521 </p>
7522 !! end
7523
7524 !! test
7525 Magic Word: {{SUBJECTSPACE}}, main namespace
7526 !! options
7527 title=[[Parser Test]]
7528 !! wikitext
7529 {{SUBJECTSPACE}}
7530 !! html
7531
7532 !! end
7533
7534 !! test
7535 Magic Word: {{SUBJECTSPACEE}}
7536 !! options
7537 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7538 !! wikitext
7539 {{SUBJECTSPACEE}}
7540 !! html
7541 <p>User
7542 </p>
7543 !! end
7544
7545 !! test
7546 Magic Word: {{NAMESPACE}}
7547 !! options
7548 title=[[User:Ævar Arnfjörð Bjarmason]]
7549 !! wikitext
7550 {{NAMESPACE}}
7551 !! html
7552 <p>User
7553 </p>
7554 !! end
7555
7556 !! test
7557 Magic Word: {{NAMESPACEE}}
7558 !! options
7559 title=[[User:Ævar Arnfjörð Bjarmason]]
7560 !! wikitext
7561 {{NAMESPACEE}}
7562 !! html
7563 <p>User
7564 </p>
7565 !! end
7566
7567 !! test
7568 Magic Word: {{NAMESPACENUMBER}}
7569 !! options
7570 title=[[User:Ævar Arnfjörð Bjarmason]]
7571 !! wikitext
7572 {{NAMESPACENUMBER}}
7573 !! html
7574 <p>2
7575 </p>
7576 !! end
7577
7578 !! test
7579 Magic Word: {{SUBPAGENAME}}
7580 !! options
7581 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7582 !! wikitext
7583 {{SUBPAGENAME}}
7584 !! html
7585 <p>sub ö
7586 </p>
7587 !! end
7588
7589 !! test
7590 Magic Word: {{SUBPAGENAMEE}}
7591 !! options
7592 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7593 !! wikitext
7594 {{SUBPAGENAMEE}}
7595 !! html
7596 <p>sub_%C3%B6
7597 </p>
7598 !! end
7599
7600 !! test
7601 Magic Word: {{ROOTPAGENAME}}
7602 !! options
7603 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7604 !! wikitext
7605 {{ROOTPAGENAME}}
7606 !! html
7607 <p>Ævar Arnfjörð Bjarmason
7608 </p>
7609 !! end
7610
7611 !! test
7612 Magic Word: {{ROOTPAGENAMEE}}
7613 !! options
7614 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7615 !! wikitext
7616 {{ROOTPAGENAMEE}}
7617 !! html
7618 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7619 </p>
7620 !! end
7621
7622 !! test
7623 Magic Word: {{BASEPAGENAME}}
7624 !! options
7625 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7626 !! wikitext
7627 {{BASEPAGENAME}}
7628 !! html
7629 <p>Ævar Arnfjörð Bjarmason
7630 </p>
7631 !! end
7632
7633 !! test
7634 Magic Word: {{BASEPAGENAMEE}}
7635 !! options
7636 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7637 !! wikitext
7638 {{BASEPAGENAMEE}}
7639 !! html
7640 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7641 </p>
7642 !! end
7643
7644 !! test
7645 Magic Word: {{TALKPAGENAME}}
7646 !! options
7647 title=[[User:Ævar Arnfjörð Bjarmason]]
7648 !! wikitext
7649 {{TALKPAGENAME}}
7650 !! html
7651 <p>User talk:Ævar Arnfjörð Bjarmason
7652 </p>
7653 !! end
7654
7655 !! test
7656 Magic Word: {{TALKPAGENAMEE}}
7657 !! options
7658 title=[[User:Ævar Arnfjörð Bjarmason]]
7659 !! wikitext
7660 {{TALKPAGENAMEE}}
7661 !! html
7662 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7663 </p>
7664 !! end
7665
7666 !! test
7667 Magic Word: {{SUBJECTPAGENAME}}
7668 !! options
7669 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7670 !! wikitext
7671 {{SUBJECTPAGENAME}}
7672 !! html
7673 <p>User:Ævar Arnfjörð Bjarmason
7674 </p>
7675 !! end
7676
7677 !! test
7678 Magic Word: {{SUBJECTPAGENAMEE}}
7679 !! options
7680 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7681 !! wikitext
7682 {{SUBJECTPAGENAMEE}}
7683 !! html
7684 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7685 </p>
7686 !! end
7687
7688 !! test
7689 Magic Word: {{NUMBEROFFILES}}
7690 !! wikitext
7691 {{NUMBEROFFILES}}
7692 !! html
7693 <p>5
7694 </p>
7695 !! end
7696
7697 !! test
7698 Magic Word: {{PAGENAME}}
7699 !! options
7700 title=[[User:Ævar Arnfjörð Bjarmason]]
7701 !! wikitext
7702 {{PAGENAME}}
7703 !! html
7704 <p>Ævar Arnfjörð Bjarmason
7705 </p>
7706 !! end
7707
7708 !! test
7709 Magic Word: {{PAGENAME}} with metacharacters
7710 !! options
7711 title=[['foo & bar = baz']]
7712 !! wikitext
7713 ''{{PAGENAME}}''
7714 !! html
7715 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7716 </p>
7717 !! end
7718
7719 !! test
7720 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7721 !! options
7722 title=[[*RFC 1234 http://example.com/]]
7723 !! wikitext
7724 {{PAGENAME}}
7725 !! html
7726 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7727 </p>
7728 !! end
7729
7730 !! test
7731 Magic Word: {{PAGENAMEE}}
7732 !! options
7733 title=[[User:Ævar Arnfjörð Bjarmason]]
7734 !! wikitext
7735 {{PAGENAMEE}}
7736 !! html
7737 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7738 </p>
7739 !! end
7740
7741 !! test
7742 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7743 !! options
7744 title=[[*RFC 1234 http://example.com/]]
7745 !! wikitext
7746 {{PAGENAMEE}}
7747 !! html
7748 <p>&#42;RFC_1234_http&#58;//example.com/
7749 </p>
7750 !! end
7751
7752 !! test
7753 Magic Word: {{REVISIONID}}
7754 !! wikitext
7755 {{REVISIONID}}
7756 !! html
7757 <p>1337
7758 </p>
7759 !! end
7760
7761 !! test
7762 Magic Word: {{SCRIPTPATH}}
7763 !! wikitext
7764 {{SCRIPTPATH}}
7765 !! html
7766 <p>/
7767 </p>
7768 !! end
7769
7770 !! test
7771 Magic Word: {{STYLEPATH}}
7772 !! wikitext
7773 {{STYLEPATH}}
7774 !! html
7775 <p>/skins
7776 </p>
7777 !! end
7778
7779 !! test
7780 Magic Word: {{SERVER}}
7781 !! wikitext
7782 {{SERVER}}
7783 !! html
7784 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7785 </p>
7786 !! end
7787
7788 !! test
7789 Magic Word: {{SERVERNAME}}
7790 !! wikitext
7791 {{SERVERNAME}}
7792 !! html
7793 <p>example.org
7794 </p>
7795 !! end
7796
7797 !! test
7798 Magic Word: {{SITENAME}}
7799 !! wikitext
7800 {{SITENAME}}
7801 !! html
7802 <p>MediaWiki
7803 </p>
7804 !! end
7805
7806 !! test
7807 Case-sensitive magic words, when cased differently, should just be template transclusions
7808 !! wikitext
7809 {{CurrentMonth}}
7810 {{currentday}}
7811 {{cURreNTweEK}}
7812 {{currentHour}}
7813 !! html
7814 <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>
7815 <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>
7816 <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>
7817 <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>
7818 </p>
7819 !! end
7820
7821 !! test
7822 Case-insensitive magic words should still work with weird casing.
7823 !! wikitext
7824 {{sErVeRNaMe}}
7825 {{LCFirst:AOEU}}
7826 {{ucFIRST:aoeu}}
7827 {{SERver}}
7828 !! html
7829 <p>example.org
7830 aOEU
7831 Aoeu
7832 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7833 </p>
7834 !! end
7835
7836 !! test
7837 Namespace 1 {{ns:1}}
7838 !! wikitext
7839 {{ns:1}}
7840 !! html
7841 <p>Talk
7842 </p>
7843 !! end
7844
7845 !! test
7846 Namespace 1 {{ns:01}}
7847 !! wikitext
7848 {{ns:01}}
7849 !! html
7850 <p>Talk
7851 </p>
7852 !! end
7853
7854 !! test
7855 Namespace 0 {{ns:0}} (bug 4783)
7856 !! wikitext
7857 {{ns:0}}
7858 !! html
7859
7860 !! end
7861
7862 !! test
7863 Namespace 0 {{ns:00}} (bug 4783)
7864 !! wikitext
7865 {{ns:00}}
7866 !! html
7867
7868 !! end
7869
7870 !! test
7871 Namespace -1 {{ns:-1}}
7872 !! wikitext
7873 {{ns:-1}}
7874 !! html
7875 <p>Special
7876 </p>
7877 !! end
7878
7879 !! test
7880 Namespace User {{ns:User}}
7881 !! wikitext
7882 {{ns:User}}
7883 !! html
7884 <p>User
7885 </p>
7886 !! end
7887
7888 !! test
7889 Namespace User talk {{ns:User_talk}}
7890 !! wikitext
7891 {{ns:User_talk}}
7892 !! html
7893 <p>User talk
7894 </p>
7895 !! end
7896
7897 !! test
7898 Namespace User talk {{ns:uSeR tAlK}}
7899 !! wikitext
7900 {{ns:uSeR tAlK}}
7901 !! html
7902 <p>User talk
7903 </p>
7904 !! end
7905
7906 !! test
7907 Namespace File {{ns:File}}
7908 !! wikitext
7909 {{ns:File}}
7910 !! html
7911 <p>File
7912 </p>
7913 !! end
7914
7915 !! test
7916 Namespace File {{ns:Image}}
7917 !! wikitext
7918 {{ns:Image}}
7919 !! html
7920 <p>File
7921 </p>
7922 !! end
7923
7924 !! test
7925 Namespace (lang=de) Benutzer {{ns:User}}
7926 !! options
7927 language=de
7928 !! wikitext
7929 {{ns:User}}
7930 !! html
7931 <p>Benutzer
7932 </p>
7933 !! end
7934
7935 !! test
7936 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7937 !! options
7938 language=de
7939 !! wikitext
7940 {{ns:3}}
7941 !! html
7942 <p>Benutzer Diskussion
7943 </p>
7944 !! end
7945
7946
7947 !! test
7948 Urlencode
7949 !! wikitext
7950 {{urlencode:hi world?!}}
7951 {{urlencode:hi world?!|WIKI}}
7952 {{urlencode:hi world?!|PATH}}
7953 {{urlencode:hi world?!|QUERY}}
7954 !! html
7955 <p>hi+world%3F%21
7956 hi_world%3F!
7957 hi%20world%3F%21
7958 hi+world%3F%21
7959 </p>
7960 !! end
7961
7962 !! test
7963 Magic Word: prioritize type info over data-parsoid
7964 !! options
7965 parsoid=html2wt
7966 !! wikitext
7967 __FORCETOC__
7968 !! html
7969 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
7970 !! end
7971
7972 !! test
7973 Magic Word: serialize on separate line (parsoid)
7974 !! options
7975 parsoid=wt2wt,html2wt
7976 !! wikitext
7977 foo
7978 __NOTOC__
7979 bar
7980 !! html
7981 foo<meta property="mw:PageProp/notoc"/>bar
7982 !! end
7983
7984 !! test
7985 Magic Word: rt non-english wikis
7986 !! options
7987 parsoid=wt2wt
7988 language=de
7989 !! wikitext
7990 __NOEDITSECTION__
7991 !! html
7992 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
7993 !! end
7994
7995 ###
7996 ### Magic links
7997 ###
7998 !! test
7999 Magic links: internal link to RFC (bug 479)
8000 !! wikitext
8001 [[RFC 123]]
8002 !! html
8003 <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>
8004 </p>
8005 !! end
8006
8007 !! test
8008 Magic links: RFC (bug 479)
8009 !! wikitext
8010 RFC 822
8011 !! html
8012 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8013 </p>
8014 !! end
8015
8016 !! test
8017 Magic links: ISBN (bug 1937)
8018 !! wikitext
8019 ISBN 0-306-40615-2
8020 !! html
8021 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8022 </p>
8023 !! end
8024
8025 !! test
8026 Magic links: PMID incorrectly converts space to underscore
8027 !! wikitext
8028 PMID 1234
8029 !! html
8030 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8031 </p>
8032 !! end
8033
8034 ###
8035 ### Templates
8036 ####
8037
8038 !! test
8039 Nonexistent template
8040 !! wikitext
8041 {{thistemplatedoesnotexist}}
8042 !! html
8043 <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>
8044 </p>
8045 !! end
8046
8047 !! test
8048 Template with invalid target containing tags
8049 !! wikitext
8050 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8051 !! html
8052 <p>{{a<b>b</b>|foo|a=b|a = b}}
8053 </p>
8054 !! end
8055
8056 !! test
8057 Template with invalid target containing unclosed tag
8058 !! wikitext
8059 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8060 !! html
8061 <p>{{a<b>|foo|a=b|a = b}}</b>
8062 </p>
8063 !! end
8064
8065 !! test
8066 Template with invalid target containing wikilink
8067 !! wikitext
8068 {{[[Main Page]]}}
8069 !! html/php
8070 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
8071 </p>
8072 !! html/parsoid
8073 <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>
8074 !! end
8075
8076 !! article
8077 Template:test
8078 !! text
8079 This is a test template
8080 !! endarticle
8081
8082 !! test
8083 Simple template
8084 !! wikitext
8085 {{test}}
8086 !! html
8087 <p>This is a test template
8088 </p>
8089 !! end
8090
8091 !! test
8092 Template with explicit namespace
8093 !! wikitext
8094 {{Template:test}}
8095 !! html
8096 <p>This is a test template
8097 </p>
8098 !! end
8099
8100
8101 !! article
8102 Template:paramtest
8103 !! text
8104 This is a test template with parameter {{{param}}}
8105 !! endarticle
8106
8107 !! test
8108 Template parameter
8109 !! wikitext
8110 {{paramtest|param=foo}}
8111 !! html
8112 <p>This is a test template with parameter foo
8113 </p>
8114 !! end
8115
8116 !! article
8117 Template:paramtestnum
8118 !! text
8119 [[{{{1}}}|{{{2}}}]]
8120 !! endarticle
8121
8122 !! test
8123 Template unnamed parameter
8124 !! wikitext
8125 {{paramtestnum|Main Page|the main page}}
8126 !! html
8127 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
8128 </p>
8129 !! end
8130
8131 !! article
8132 Template:templatesimple
8133 !! text
8134 (test)
8135 !! endarticle
8136
8137 !! article
8138 Template:templateredirect
8139 !! text
8140 #redirect [[Template:templatesimple]]
8141 !! endarticle
8142
8143 !! article
8144 Template:templateasargtestnum
8145 !! text
8146 {{{{{1}}}}}
8147 !! endarticle
8148
8149 !! article
8150 Template:templateasargtest
8151 !! text
8152 {{template{{{templ}}}}}
8153 !! endarticle
8154
8155 !! article
8156 Template:templateasargtest2
8157 !! text
8158 {{{{{templ}}}}}
8159 !! endarticle
8160
8161 !! test
8162 Template with template name as unnamed argument
8163 !! wikitext
8164 {{templateasargtestnum|templatesimple}}
8165 !! html
8166 <p>(test)
8167 </p>
8168 !! end
8169
8170 !! test
8171 Template with template name as argument
8172 !! wikitext
8173 {{templateasargtest|templ=simple}}
8174 !! html
8175 <p>(test)
8176 </p>
8177 !! end
8178
8179 !! test
8180 Template with template name as argument (2)
8181 !! wikitext
8182 {{templateasargtest2|templ=templatesimple}}
8183 !! html
8184 <p>(test)
8185 </p>
8186 !! end
8187
8188 !! article
8189 Template:templateasargtestdefault
8190 !! text
8191 {{{{{templ|templatesimple}}}}}
8192 !! endarticle
8193
8194 !! article
8195 Template:templa
8196 !! text
8197 '''templ'''
8198 !! endarticle
8199
8200 !! test
8201 Template with default value
8202 !! wikitext
8203 {{templateasargtestdefault}}
8204 !! html
8205 <p>(test)
8206 </p>
8207 !! end
8208
8209 !! test
8210 Template with default value (value set)
8211 !! wikitext
8212 {{templateasargtestdefault|templ=templa}}
8213 !! html
8214 <p><b>templ</b>
8215 </p>
8216 !! end
8217
8218 !! test
8219 Template redirect
8220 !! wikitext
8221 {{templateredirect}}
8222 !! html
8223 <p>(test)
8224 </p>
8225 !! end
8226
8227 !! test
8228 Template with argument in separate line
8229 !! wikitext
8230 {{ templateasargtest |
8231 templ = simple }}
8232 !! html
8233 <p>(test)
8234 </p>
8235 !! end
8236
8237 !! test
8238 Template with complex template as argument
8239 !! wikitext
8240 {{paramtest|
8241 param ={{ templateasargtest |
8242 templ = simple }}}}
8243 !! html
8244 <p>This is a test template with parameter (test)
8245 </p>
8246 !! end
8247
8248 !! test
8249 Template with thumb image (with link in description)
8250 !! wikitext
8251 {{paramtest|
8252 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
8253 !! html
8254 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>
8255
8256 !! end
8257
8258 !! article
8259 Template:complextemplate
8260 !! text
8261 {{{1}}} {{paramtest|
8262 param ={{{param}}}}}
8263 !! endarticle
8264
8265 !! test
8266 Template with complex arguments
8267 !! wikitext
8268 {{complextemplate|
8269 param ={{ templateasargtest |
8270 templ = simple }}|[[Template:complextemplate|link]]}}
8271 !! html
8272 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
8273 </p>
8274 !! end
8275
8276 !! test
8277 BUG 553: link with two variables in a piped link
8278 !! wikitext
8279 {|
8280 |[[{{{1}}}|{{{2}}}]]
8281 |}
8282 !! html
8283 <table>
8284 <tr>
8285 <td>[[{{{1}}}|{{{2}}}]]
8286 </td></tr></table>
8287
8288 !! end
8289
8290 !! test
8291 Magic variable as template parameter
8292 !! wikitext
8293 {{paramtest|param={{SITENAME}}}}
8294 !! html
8295 <p>This is a test template with parameter MediaWiki
8296 </p>
8297 !! end
8298
8299 !! article
8300 Template:linktest
8301 !! text
8302 [[{{{param}}}|link]]
8303 !! endarticle
8304
8305 !! test
8306 Template parameter as link source
8307 !! wikitext
8308 {{linktest|param=Main Page}}
8309 !! html
8310 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
8311 </p>
8312 !! end
8313
8314 !!test
8315 Template-generated attribute string (k='v')
8316 !! wikitext
8317 <span {{attr_str|id|v1}}>bar</span>
8318 !! html
8319 <p><span id="v1">bar</span>
8320 </p>
8321 !!end
8322
8323 !!article
8324 Template:paramtest2
8325 !! text
8326 including another template, {{paramtest|param={{{arg}}}}}
8327 !! endarticle
8328
8329 !! test
8330 Template passing argument to another template
8331 !! wikitext
8332 {{paramtest2|arg='hmm'}}
8333 !! html
8334 <p>including another template, This is a test template with parameter 'hmm'
8335 </p>
8336 !! end
8337
8338 !! article
8339 Template:Linktest2
8340 !! text
8341 Main Page
8342 !! endarticle
8343
8344 !! test
8345 Template as link source
8346 !! wikitext
8347 [[{{linktest2}}]]
8348
8349 [[{{linktest2}}|Main Page]]
8350
8351 [[{{linktest2}}]]Page
8352 !! html
8353 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8354 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8355 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
8356 </p>
8357 !! end
8358
8359
8360 !! article
8361 Template:loop1
8362 !! text
8363 {{loop2}}
8364 !! endarticle
8365
8366 !! article
8367 Template:loop2
8368 !! text
8369 {{loop1}}
8370 !! endarticle
8371
8372 !! test
8373 Template infinite loop
8374 !! wikitext
8375 {{loop1}}
8376 !! html
8377 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
8378 </p>
8379 !! end
8380
8381 !! test
8382 Template from main namespace
8383 !! wikitext
8384 {{:Main Page}}
8385 !! html
8386 <p>blah blah
8387 </p>
8388 !! end
8389
8390 !! article
8391 Template:table
8392 !! text
8393 {|
8394 | 1 || 2
8395 |-
8396 | 3 || 4
8397 |}
8398 !! endarticle
8399
8400 !! test
8401 BUG 529: Template with table, not included at beginning of line
8402 !! wikitext
8403 foo {{table}}
8404 !! html
8405 <p>foo
8406 </p>
8407 <table>
8408 <tr>
8409 <td> 1 </td>
8410 <td> 2
8411 </td></tr>
8412 <tr>
8413 <td> 3 </td>
8414 <td> 4
8415 </td></tr></table>
8416
8417 !! end
8418
8419 !! test
8420 BUG 523: Template shouldn't eat newline (or add an extra one before table)
8421 !! wikitext
8422 foo
8423 {{table}}
8424 !! html
8425 <p>foo
8426 </p>
8427 <table>
8428 <tr>
8429 <td> 1 </td>
8430 <td> 2
8431 </td></tr>
8432 <tr>
8433 <td> 3 </td>
8434 <td> 4
8435 </td></tr></table>
8436
8437 !! end
8438
8439 !! test
8440 BUG 41: Template parameters shown as broken links
8441 !! wikitext
8442 {{{parameter}}}
8443 !! html
8444 <p>{{{parameter}}}
8445 </p>
8446 !! end
8447
8448 !! test
8449 Template with targets containing wikilinks
8450 !! wikitext
8451 {{[[foo]]}}
8452
8453 {{[[{{echo|foo}}]]}}
8454
8455 {{{{echo|[[foo}}]]}}
8456 !! html
8457 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8458 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8459 </p><p>{{[[foo}}]]
8460 </p>
8461 !! end
8462
8463 !! article
8464 Template:MSGNW test
8465 !! text
8466 ''None'' of '''this''' should be
8467 * interpreted
8468 but rather passed unmodified
8469 {{test}}
8470 <gallery>
8471 File:Foobar.jpg
8472 </gallery>
8473 !! endarticle
8474
8475 # hmm, fix this or just deprecate msgnw and document its behavior?
8476 !! test
8477 msgnw keyword
8478 !! wikitext
8479 {{msgnw:MSGNW test}}
8480 !! html
8481 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
8482 &#42; interpreted
8483 &#32;but rather passed unmodified
8484 &#123;&#123;test&#125;&#125;
8485 &#60;gallery&#62;
8486 File:Foobar.jpg
8487 &#60;/gallery&#62;
8488 </p>
8489 !! end
8490
8491 !! test
8492 int keyword
8493 !! wikitext
8494 {{int:youhavenewmessages|lots of money|not!}}
8495 !! html
8496 <p>You have lots of money (not!).
8497 </p>
8498 !! end
8499
8500 !! article
8501 Template:Includes
8502 !! text
8503 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8504 !! endarticle
8505
8506 !! test
8507 <includeonly> and <noinclude> being included
8508 !! wikitext
8509 {{Includes}}
8510 !! html
8511 <p>Foobar
8512 </p>
8513 !! end
8514
8515 !! article
8516 Template:Includes2
8517 !! text
8518 <onlyinclude>Foo</onlyinclude>bar
8519 !! endarticle
8520
8521 !! test
8522 <onlyinclude> being included
8523 !! wikitext
8524 {{Includes2}}
8525 !! html
8526 <p>Foo
8527 </p>
8528 !! end
8529
8530
8531 !! article
8532 Template:Includes3
8533 !! text
8534 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8535 !! endarticle
8536
8537 !! test
8538 <onlyinclude> and <includeonly> being included
8539 !! wikitext
8540 {{Includes3}}
8541 !! html
8542 <p>Foo
8543 </p>
8544 !! end
8545
8546 !! test
8547 <includeonly> and <noinclude> on a page
8548 !! wikitext
8549 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8550 !! html
8551 <p>Foozar
8552 </p>
8553 !! end
8554
8555 !! test
8556 Un-closed <noinclude>
8557 !! wikitext
8558 <noinclude>
8559 !! html
8560 !! end
8561
8562 !! test
8563 <onlyinclude> on a page
8564 !! wikitext
8565 <onlyinclude>Foo</onlyinclude>bar
8566 !! html
8567 <p>Foobar
8568 </p>
8569 !! end
8570
8571 !! test
8572 Un-closed <onlyinclude>
8573 !! wikitext
8574 <onlyinclude>
8575 !! html
8576 !! end
8577
8578 !!test
8579 Self-closed noinclude, includeonly, onlyinclude tags
8580 !! wikitext
8581 <noinclude />
8582 <includeonly />
8583 <onlyinclude />
8584 !! html
8585 <p><br />
8586 </p>
8587 !!end
8588
8589 !!test
8590 Unbalanced includeonly and noinclude tags
8591 !! wikitext
8592 {|
8593 |a</noinclude>
8594 |b</noinclude></noinclude>
8595 |c</noinclude></includeonly>
8596 |d</includeonly></includeonly>
8597 |}
8598 !! html
8599 <table>
8600 <tr>
8601 <td>a
8602 </td>
8603 <td>b
8604 </td>
8605 <td>c&lt;/includeonly&gt;
8606 </td>
8607 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8608 </td></tr></table>
8609
8610 !!end
8611
8612 !! article
8613 Template:Includeonly section
8614 !! text
8615 <includeonly>
8616 ==Includeonly section==
8617 </includeonly>
8618 ==Section T-1==
8619 !!endarticle
8620
8621 !! test
8622 Bug 6563: Edit link generation for section shown by <includeonly>
8623 !! wikitext
8624 {{includeonly section}}
8625 !! html
8626 <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>
8627 <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>
8628
8629 !! end
8630
8631 # Uses same input as the contents of [[Template:Includeonly section]]
8632 !! test
8633 Bug 6563: Section extraction for section shown by <includeonly>
8634 !! options
8635 section=T-2
8636 !! wikitext
8637 <includeonly>
8638 ==Includeonly section==
8639 </includeonly>
8640 ==Section T-2==
8641 !! html
8642 ==Section T-2==
8643 !! end
8644
8645 !! test
8646 Bug 6563: Edit link generation for section suppressed by <includeonly>
8647 !! wikitext
8648 <includeonly>
8649 ==Includeonly section==
8650 </includeonly>
8651 ==Section 1==
8652 !! html
8653 <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>
8654
8655 !! end
8656
8657 !! test
8658 Bug 6563: Section extraction for section suppressed by <includeonly>
8659 !! options
8660 section=1
8661 !! wikitext
8662 <includeonly>
8663 ==Includeonly section==
8664 </includeonly>
8665 ==Section 1==
8666 !! html
8667 ==Section 1==
8668 !! end
8669
8670 !! test
8671 Un-closed <includeonly>
8672 !! wikitext
8673 <includeonly>
8674 !! html
8675 !! end
8676
8677 # TODO: test with DOM fragment reuse!
8678 !! test
8679 Parsoid: DOM fragment reuse
8680 !! options
8681 parsoid=wt2wt,wt2html
8682 !! wikitext
8683 a{{echo|b<table></table>c}}d
8684
8685 a{{echo|b
8686 <table></table>
8687 c}}d
8688
8689 {{echo|a
8690
8691 <table></table>
8692
8693 b}}
8694 !! html
8695 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8696 <table></table>c"}},"i":0}}]}'>b</span>
8697 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8698
8699
8700 <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">
8701 </span>
8702 <table about="#mwt2"></table><span about="#mwt2">
8703 </span>
8704 <p about="#mwt2">cd</p>
8705
8706
8707 <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">
8708
8709 </span>
8710 <table about="#mwt3"></table><span about="#mwt3">
8711
8712 </span>
8713 <p about="#mwt3">b</p>
8714 !! end
8715
8716 !! test
8717 Parsoid: Merge double tds (bug 50603)
8718 !! options
8719 parsoid
8720 !! wikitext
8721 {|
8722 |{{echo|{{!}} foo}}
8723 |}
8724 !! html
8725 <table><tbody>
8726 <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>
8727 </tbody></table>
8728 !! end
8729
8730 !! test
8731 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8732 !! options
8733 parsoid
8734 !! wikitext
8735 {{echo|<div>}}
8736 {|
8737 |{{echo|{{!}} foo}}
8738 |}
8739 {{echo|</div>}}
8740 !! html
8741 <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}}]}'>
8742 <table><tbody>
8743 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8744 </tbody></table>
8745 </div>
8746 !! end
8747
8748 ###
8749 ### <includeonly> and <noinclude> in attributes
8750 ###
8751 !!test
8752 0. includeonly around the entire attribute
8753 !! wikitext
8754 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8755 !! html
8756 <p><span id="v2">bar</span>
8757 </p>
8758 !!end
8759
8760 !!test
8761 1. includeonly in html attr key
8762 !! wikitext
8763 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8764 !! html
8765 <p><span id="foo">bar</span>
8766 </p>
8767 !!end
8768
8769 !!test
8770 2. includeonly in html attr value
8771 !! wikitext
8772 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8773 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8774 !! html
8775 <p><span id="v1">bar</span>
8776 <span id="v1">bar</span>
8777 </p>
8778 !!end
8779
8780 !!test
8781 3. includeonly in part of an attr value
8782 !! wikitext
8783 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8784 !! html
8785 <p><span style="color:red;">bar</span>
8786 </p>
8787 !!end
8788
8789 !!test
8790 4. includeonly in table attributes
8791 !! wikitext
8792 {|
8793 |- <noinclude>
8794 |-
8795 |a
8796 </noinclude>
8797 |- <includeonly>
8798 |-
8799 |b
8800 </includeonly>
8801 |}
8802 !! html
8803 <table>
8804
8805
8806 <tr>
8807 <td>a
8808 </td></tr>
8809 </table>
8810
8811 !!end
8812
8813 ###
8814 ### Token Stream Patcher tests
8815 ###
8816 ### These tests won't always pass wt2wt and other modes because
8817 ### on serialization, the table will be output on a new line.
8818 ### For now, we are blacklisting them, and using this to test selser.
8819 ###
8820
8821 !!test
8822 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
8823 !!options
8824 parsoid=wt2html,wt2wt
8825 !!wikitext
8826 {{echo|}}{| width = '100%'
8827 |foo
8828 |}
8829 !!html/parsoid
8830 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
8831 <table width="100%">
8832 <tbody>
8833 <tr>
8834 <td>foo</td></tr></tbody></table>
8835 !!end
8836
8837 !!test
8838 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
8839 !!options
8840 parsoid=wt2html,wt2wt
8841 !!wikitext
8842 <includeonly>a</includeonly>{| {{{b}}}
8843 |c
8844 |}
8845 !!html/parsoid
8846 <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|}"}'>
8847 <tbody><tr><td>c</td></tr>
8848 </tbody></table>
8849 !!end
8850
8851 ###
8852 ### Testing parsing of templates where a template arg
8853 ### has the same name as the template itself.
8854 ###
8855
8856 !! article
8857 Template:quote
8858 !! text
8859 {{{quote|{{{1}}}}}}
8860 !! endarticle
8861
8862 !!test
8863 Templates: Template Name/Arg clash: 1. Use of positional param
8864 !! wikitext
8865 {{quote|foo}}
8866 !! html
8867 <p>foo
8868 </p>
8869 !!end
8870
8871 !!test
8872 Templates: Template Name/Arg clash: 2. Use of named param
8873 !! wikitext
8874 {{quote|quote=foo}}
8875 !! html
8876 <p>foo
8877 </p>
8878 !!end
8879
8880 !!test
8881 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8882 !! wikitext
8883 {{quote|quote}}
8884 !! html
8885 <p>quote
8886 </p>
8887 !!end
8888
8889 ###
8890 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8891 ###
8892
8893 !!test
8894 Templates: 1. Simple use
8895 !! wikitext
8896 {{echo|Foo}}
8897 !! html
8898 <p>Foo
8899 </p>
8900 !!end
8901
8902 !!test
8903 Templates: 2. Inside a block tag
8904 !! wikitext
8905 <div>{{echo|Foo}}</div>
8906 <blockquote>{{echo|Foo}}</blockquote>
8907 !! html
8908 <div>Foo</div>
8909 <blockquote>Foo</blockquote>
8910
8911 !!end
8912
8913 !!test
8914 Templates: P-wrapping: 1a. Templates on consecutive lines
8915 !! wikitext
8916 {{echo|Foo}}
8917 {{echo|bar}}
8918 !! html
8919 <p>Foo
8920 bar
8921 </p>
8922 !!end
8923
8924 !!test
8925 Templates: P-wrapping: 1b. Templates on consecutive lines
8926 !! wikitext
8927 Foo
8928
8929 {{echo|bar}}
8930 {{echo|baz}}
8931 !! html
8932 <p>Foo
8933 </p><p>bar
8934 baz
8935 </p>
8936 !!end
8937
8938 !!test
8939 Templates: P-wrapping: 1c. Templates on consecutive lines
8940 !! wikitext
8941 {{echo|Foo}}
8942 {{echo|bar}} <div>baz</div>
8943 !! html
8944 <p>Foo
8945 </p>
8946 bar <div>baz</div>
8947
8948 !!end
8949
8950 !!test
8951 Templates: P-wrapping: 1d. Template preceded by comment-only line
8952 !!options
8953 parsoid
8954 !! wikitext
8955 <!-- foo -->
8956 {{echo|Bar}}
8957 !! html
8958 <!-- foo -->
8959
8960 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8961 !!end
8962
8963 !!test
8964 Templates: Inline Text: 1. Multiple template uses
8965 !! wikitext
8966 {{echo|Foo}}bar{{echo|baz}}
8967 !! html
8968 <p>Foobarbaz
8969 </p>
8970 !!end
8971
8972 !!test
8973 Templates: Inline Text: 2. Back-to-back template uses
8974 !! wikitext
8975 {{echo|Foo}}{{echo|bar}}
8976 !! html
8977 <p>Foobar
8978 </p>
8979 !!end
8980
8981 !!test
8982 Templates: Block Tags: 1. Multiple template uses
8983 !! wikitext
8984 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
8985 !! html
8986 <div>Foo</div><div>bar</div><div>baz</div>
8987
8988 !!end
8989
8990 !!test
8991 Templates: Block Tags: 2. Back-to-back template uses
8992 !! wikitext
8993 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
8994 !! html
8995 <div>Foo</div><div>bar</div>
8996
8997 !!end
8998
8999 !!test
9000 Templates: Links: 1. Simple example
9001 !! wikitext
9002 {{echo|[[Foo|bar]]}}
9003 !! html
9004 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9005 </p>
9006 !!end
9007
9008 !!test
9009 Templates: Links: 2. Generation of link href
9010 !! wikitext
9011 [[{{echo|Foo}}|bar]]
9012 !! html
9013 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9014 </p>
9015 !!end
9016
9017 !!test
9018 Templates: Links: 3. Generation of part of a link href
9019 !! wikitext
9020 [[Fo{{echo|o}}|bar]]
9021
9022 [[Foo{{echo|bar}}]]
9023
9024 [[Foo{{echo|bar}}baz]]
9025
9026 [[Foo{{echo|bar}}|bar]]
9027
9028 [[:Foo{{echo|bar}}]]
9029
9030 [[:Foo{{echo|bar}}|bar]]
9031 !! html
9032 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9033 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9034 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
9035 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9036 </p><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><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9038 </p>
9039 !!end
9040
9041 !!test
9042 Templates: Links: 4. Multiple templates generating link href
9043 !! wikitext
9044 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
9045 !! html
9046 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9047 </p>
9048 !!end
9049
9050 !!test
9051 Templates: Links: 5. Generation of link text
9052 !! wikitext
9053 [[Foo|{{echo|bar}}]]
9054 !! html
9055 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9056 </p>
9057 !!end
9058
9059 !!test
9060 Templates: Links: 5. Nested templates (only outermost template should be marked)
9061 !! wikitext
9062 {{echo|[[{{echo|Foo}}|bar]]}}
9063 !! html
9064 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9065 </p>
9066 !!end
9067
9068 !!test
9069 Templates: HTML Tag: 1. Generation of HTML attr. key
9070 !! wikitext
9071 <div {{echo|style}}="color:red;">foo</div>
9072 !! html
9073 <div style="color:red;">foo</div>
9074
9075 !!end
9076
9077 !!test
9078 Templates: HTML Tag: 2. Generation of HTML attr. value
9079 !! wikitext
9080 <div style={{echo|'color:red;'}}>foo</div>
9081 !! html
9082 <div style="color:red;">foo</div>
9083
9084 !!end
9085
9086 !!test
9087 Templates: HTML Tag: 3. Generation of HTML attr key and value
9088 !! wikitext
9089 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
9090 !! html
9091 <div style="color:red;">foo</div>
9092
9093 !!end
9094
9095 !!test
9096 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
9097 !! wikitext
9098 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
9099 !! html
9100 <div title="This is a long title with just one piece templated">foo</div>
9101
9102 !!end
9103
9104 !!test
9105 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
9106 !! wikitext
9107 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
9108 !! html
9109 <div title="This is a long title with just one piece templated">foo</div>
9110
9111 !!end
9112
9113 !!test
9114 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
9115 !! wikitext
9116 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
9117 !! html
9118 <div title="This is a long title with just one piece templated">foo</div>
9119
9120 !!end
9121
9122 !!test
9123 Templates: HTML Tag: 7. Generation of partial attribute key string
9124 !! wikitext
9125 <div st{{echo|yle}}="color:red;">foo</div>
9126 !! html
9127 <div style="color:red;">foo</div>
9128
9129 !!end
9130
9131 !!test
9132 Templates: HTML Tables: 1. Generating start of a HTML table
9133 !! wikitext
9134 {{echo|<table><tr><td>foo</td>}}</tr></table>
9135 !! html
9136 <table><tr><td>foo</td></tr></table>
9137
9138 !!end
9139
9140 !!test
9141 Templates: HTML Tables: 2a. Generating middle of a HTML table
9142 !! wikitext
9143 <table><tr>{{echo|<td>foo</td>}}</tr></table>
9144 !! html
9145 <table><tr><td>foo</td></tr></table>
9146
9147 !!end
9148
9149 !!test
9150 Templates: HTML Tables: 2b. Generating middle of a HTML table
9151 !! wikitext
9152 <table>{{echo|<tr><td>foo</td></tr>}}</table>
9153 !! html
9154 <table><tr><td>foo</td></tr></table>
9155
9156 !!end
9157
9158 !!test
9159 Templates: HTML Tables: 3. Generating end of a HTML table
9160 !! wikitext
9161 <table><tr>{{echo|<td>foo</td></tr></table>}}
9162 !! html
9163 <table><tr><td>foo</td></tr></table>
9164
9165 !!end
9166
9167 !!test
9168 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
9169 !! wikitext
9170 {{echo|<table>}}<tr><td>foo</td></tr></table>
9171 !! html
9172 <table><tr><td>foo</td></tr></table>
9173
9174 !!end
9175
9176 !!test
9177 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
9178 !! wikitext
9179 <table>{{echo|<tr>}}<td>foo</td></tr></table>
9180 !! html
9181 <table><tr><td>foo</td></tr></table>
9182
9183 !!end
9184
9185 !!test
9186 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
9187 !! wikitext
9188 <table><tr>{{echo|<td>}}foo</td></tr></table>
9189 !! html
9190 <table><tr><td>foo</td></tr></table>
9191
9192 !!end
9193
9194 !!test
9195 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
9196 !! wikitext
9197 <table><tr><td>foo{{echo|</td>}}</tr></table>
9198 !! html
9199 <table><tr><td>foo</td></tr></table>
9200
9201 !!end
9202
9203 !!test
9204 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
9205 !! wikitext
9206 <table><tr><td>foo</td>{{echo|</tr>}}</table>
9207 !! html
9208 <table><tr><td>foo</td></tr></table>
9209
9210 !!end
9211
9212 !!test
9213 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
9214 !! wikitext
9215 <table><tr><td>foo</td></tr>{{echo|</table>}}
9216 !! html
9217 <table><tr><td>foo</td></tr></table>
9218
9219 !!end
9220
9221 !!test
9222 Templates: HTML Tables: 5. Proper fostering of categories from inside
9223 !!options
9224 parsoid=wt2html,wt2wt
9225 !! wikitext
9226 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
9227 <!--Two categories (Bug 50330)-->
9228 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
9229 !! html
9230 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
9231 <!--Two categories (Bug 50330)-->
9232 <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>
9233 !!end
9234
9235 !!test
9236 Templates: Wiki Tables: 1a. Fostering of entire template content
9237 !! wikitext
9238 {|
9239 {{echo|a}}
9240 |}
9241 !! html
9242 <table>
9243 a
9244 <tr><td></td></tr></table>
9245
9246 !!end
9247
9248 !!test
9249 Templates: Wiki Tables: 1b. Fostering of entire template content
9250 !! wikitext
9251 {|
9252 {{echo|<div>}}
9253 foo
9254 {{echo|</div>}}
9255 |}
9256 !! html
9257 <table>
9258 <div>
9259 <p>foo
9260 </p>
9261 </div>
9262 <tr><td></td></tr></table>
9263
9264 !!end
9265
9266 !!test
9267 Templates: Wiki Tables: 2. Fostering of partial template content
9268 !! wikitext
9269 {|
9270 {{echo|a
9271 <div>b</div>}}
9272 |}
9273 !! html
9274 <table>
9275 a
9276 <div>b</div>
9277 <tr><td></td></tr></table>
9278
9279 !!end
9280
9281 !!test
9282 Templates: Wiki Tables: 3. td-content via multiple templates
9283 !! wikitext
9284 {|
9285 {{echo|{{pipe}}a}}{{echo|b}}
9286 |}
9287 !! html
9288 <table>
9289 <tr>
9290 <td>ab
9291 </td></tr></table>
9292
9293 !!end
9294
9295 !!test
9296 Templates: Wiki Tables: 4. Templated tags, no content
9297 !! wikitext
9298 {{tbl-start}}
9299 {{tbl-end}}
9300 !! html
9301 <table>
9302 <tr><td></td></tr></table>
9303
9304 !!end
9305
9306 !!test
9307 Templates: Wiki Tables: 5. Templated tags, regular td-tags
9308 !! wikitext
9309 {{tbl-start}}
9310 |foo
9311 {{tbl-end}}
9312 !! html
9313 <table>
9314 <tr>
9315 <td>foo
9316 </td></tr></table>
9317
9318 !!end
9319
9320 !!test
9321 Templates: Wiki Tables: 6. Templated tags, templated td-tags
9322 !! wikitext
9323 {{tbl-start}}
9324 {{!}}foo
9325 {{tbl-end}}
9326 !! html
9327 <table>
9328 <tr>
9329 <td>foo
9330 </td></tr></table>
9331
9332 !!end
9333
9334 !!test
9335 Templates: Lists: Multi-line list-items via templates
9336 !! wikitext
9337 *{{echo|a {{nonexistent|
9338 unused}}}}
9339 *{{echo|b {{nonexistent|
9340 unused}}}}
9341 !! html
9342 <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>
9343 <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>
9344
9345 !!end
9346
9347 !!test
9348 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
9349 !! wikitext
9350 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
9351 !! html
9352 <p><i>ab</i>c<i>d</i>e
9353 </p>
9354 !!end
9355
9356 !!test
9357 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
9358 (PHP parser generates misnested html)
9359 !! wikitext
9360 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
9361 !! html/parsoid
9362 <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>
9363 !!end
9364
9365 !!test
9366 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
9367 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
9368 !! options
9369 parsoid=wt2html,wt2wt
9370 !! wikitext
9371 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
9372 !! html
9373 <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>
9374 <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>
9375 <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>
9376 !!end
9377
9378 !!test
9379 Templates: Ugly nesting: 4. Divs opened/closed across templates
9380 !! wikitext
9381 a<div>b{{echo|c</div>d}}e
9382 !! html
9383 a<div>bc</div>de
9384
9385 !!end
9386
9387 !!test
9388 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
9389 (Parsoid-centric)
9390 !! options
9391 parsoid
9392 !! wikitext
9393 {|
9394 |{{echo|foo</table>}}
9395 |bar
9396 |}
9397 !! html
9398 <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|}"]}'>
9399
9400 <tbody>
9401 <tr>
9402 <td>foo</td></tr></tbody></table><span about="#mwt1">
9403 </span><span about="#mwt1">|bar</span><span about="#mwt1">
9404 |}</span>
9405 !!end
9406
9407 !!test
9408 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
9409 (Parsoid-centric)
9410 !! options
9411 parsoid
9412 !! wikitext
9413 <table>
9414 <tr>
9415 <td>
9416 <table>
9417 <tr>
9418 <td>1. {{echo|foo </table>}}</td>
9419 <td> bar </td>
9420 <td>2. {{echo|baz </table>}}</td>
9421 </tr>
9422 <tr>
9423 <td>abc</td>
9424 </tr>
9425 </table>
9426 </td>
9427 </tr>
9428 <tr>
9429 <td>xyz</td>
9430 </tr>
9431 </table>
9432 !! html
9433 <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>"]}'>
9434 <tbody><tr>
9435 <td>
9436 <table>
9437 <tbody><tr>
9438 <td>1. foo </td></tr></tbody></table></td>
9439 <td> bar </td>
9440 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
9441 </span><span about="#mwt2">
9442 </span><span about="#mwt2">
9443 </span><span about="#mwt2">abc</span><span about="#mwt2">
9444 </span><span about="#mwt2">
9445 </span><span about="#mwt2">
9446 </span><span about="#mwt2">
9447 </span><span about="#mwt2">
9448 </span><span about="#mwt2">
9449 </span><span about="#mwt2">xyz</span><span about="#mwt2">
9450 </span><span about="#mwt2">
9451 </span>
9452 !!end
9453
9454 !! test
9455 Templates: Ugly templates: 3. newline-only template parameter
9456 !! wikitext
9457 foo {{echo|
9458 }}
9459 !! html
9460 <p>foo
9461 </p>
9462 !! end
9463
9464 # This looks like a bug: a single newline triggers p/br for some reason.
9465 !! test
9466 Templates: Ugly templates: 4. newline-only template parameter inconsistency
9467 !! wikitext
9468 {{echo|
9469 }}
9470 !! html
9471 <p><br />
9472 </p>
9473 !! end
9474
9475 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
9476 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
9477 !! test
9478 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
9479 !! wikitext
9480 {{echo|<table>}}
9481 {{echo|<div>foo}}
9482 {{echo|</table>}}
9483 !! html/parsoid
9484 <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
9485 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9486 </table>
9487 !! end
9488
9489 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
9490 # that are "identical" and generate nesting cycles in the algorithm
9491 !! test
9492 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
9493 !! wikitext
9494 {{echo|<table><tr><td><table>}}
9495 {{echo|<div>}}
9496 {{echo|</div>}}
9497 !! html/parsoid
9498 <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"}'>
9499 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9500 </table></td></tr></tbody></table>
9501 !! end
9502
9503 !!test
9504 Parser Functions: 1. Simple example
9505 !! wikitext
9506 {{uc:foo}}
9507 !! html
9508 <p>FOO
9509 </p>
9510 !!end
9511
9512 !!test
9513 Parser Functions: 2. Nested use (only outermost should be marked up)
9514 !! wikitext
9515 {{uc:{{lc:FOO}}}}
9516 !! html
9517 <p>FOO
9518 </p>
9519 !!end
9520
9521 ###
9522 ### Pre-save transform tests
9523 ###
9524 !! test
9525 pre-save transform: subst:
9526 !! options
9527 PST
9528 !! wikitext
9529 {{subst:test}}
9530 !! html
9531 This is a test template
9532 !! end
9533
9534 !! test
9535 pre-save transform: normal template
9536 !! options
9537 PST
9538 !! wikitext
9539 {{test}}
9540 !! html
9541 {{test}}
9542 !! end
9543
9544 !! test
9545 pre-save transform: nonexistent template
9546 !! options
9547 PST
9548 !! wikitext
9549 {{thistemplatedoesnotexist}}
9550 !! html
9551 {{thistemplatedoesnotexist}}
9552 !! end
9553
9554
9555 !! test
9556 pre-save transform: subst magic variables
9557 !! options
9558 PST
9559 !! wikitext
9560 {{subst:SITENAME}}
9561 !! html
9562 MediaWiki
9563 !! end
9564
9565 # This is bug 89, which I fixed. -- wtm
9566 !! test
9567 pre-save transform: subst: templates with parameters
9568 !! options
9569 pst
9570 !! wikitext
9571 {{subst:paramtest|param="something else"}}
9572 !! html
9573 This is a test template with parameter "something else"
9574 !! end
9575
9576 !! article
9577 Template:nowikitest
9578 !! text
9579 <nowiki>'''not wiki'''</nowiki>
9580 !! endarticle
9581
9582 !! test
9583 pre-save transform: nowiki in subst (bug 1188)
9584 !! options
9585 pst
9586 !! wikitext
9587 {{subst:nowikitest}}
9588 !! html
9589 <nowiki>'''not wiki'''</nowiki>
9590 !! end
9591
9592
9593 !! article
9594 Template:commenttest
9595 !! text
9596 This template has <!-- a comment --> in it.
9597 !! endarticle
9598
9599 !! test
9600 pre-save transform: comment in subst (bug 1936)
9601 !! options
9602 pst
9603 !! wikitext
9604 {{subst:commenttest}}
9605 !! html
9606 This template has <!-- a comment --> in it.
9607 !! end
9608
9609 !! test
9610 pre-save transform: unclosed tag
9611 !! options
9612 pst noxml
9613 !! wikitext
9614 <nowiki>'''not wiki'''
9615 !! html
9616 <nowiki>'''not wiki'''
9617 !! end
9618
9619 !! test
9620 pre-save transform: mixed tag case
9621 !! options
9622 pst noxml
9623 !! wikitext
9624 <NOwiki>'''not wiki'''</noWIKI>
9625 !! html
9626 <NOwiki>'''not wiki'''</noWIKI>
9627 !! end
9628
9629 !! test
9630 pre-save transform: unclosed comment in <nowiki>
9631 !! options
9632 pst noxml
9633 !! wikitext
9634 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9635 !! html
9636 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9637 !!end
9638
9639 # Leading @ in this template definition works around a limitation
9640 # in parsoid's parserTests which otherwise strips the <span> from the
9641 # result (confusing it for a template wrapper)
9642 !! article
9643 Template:dangerous
9644 !!text
9645 @<span onmouseover="alert('crap')">Oh no</span>
9646 !!endarticle
9647
9648 !!test
9649 (confirming safety of fix for subst bug 1936)
9650 !! wikitext
9651 {{Template:dangerous}}
9652 !! html
9653 <p>@<span>Oh no</span>
9654 </p>
9655 !! end
9656
9657 !! test
9658 pre-save transform: comment containing gallery (bug 5024)
9659 !! options
9660 pst
9661 !! wikitext
9662 <!-- <gallery>data</gallery> -->
9663 !! html
9664 <!-- <gallery>data</gallery> -->
9665 !!end
9666
9667 !! test
9668 pre-save transform: comment containing extension
9669 !! options
9670 pst
9671 !! wikitext
9672 <!-- <tag>data</tag> -->
9673 !! html
9674 <!-- <tag>data</tag> -->
9675 !!end
9676
9677 !! test
9678 pre-save transform: comment containing nowiki
9679 !! options
9680 pst
9681 !! wikitext
9682 <!-- <nowiki>data</nowiki> -->
9683 !! html
9684 <!-- <nowiki>data</nowiki> -->
9685 !!end
9686
9687 !! test
9688 pre-save transform: <noinclude> in subst (bug 3298)
9689 !! options
9690 pst
9691 !! wikitext
9692 {{subst:Includes}}
9693 !! html
9694 Foobar
9695 !! end
9696
9697 !! test
9698 pre-save transform: <onlyinclude> in subst (bug 3298)
9699 !! options
9700 pst
9701 !! wikitext
9702 {{subst:Includes2}}
9703 !! html
9704 Foo
9705 !! end
9706
9707 !! article
9708 Template:SubstTest
9709 !!text
9710 {{<includeonly>subst:</includeonly>Includes}}
9711 !! endarticle
9712
9713 !! article
9714 Template:SafeSubstTest
9715 !! text
9716 {{<includeonly>safesubst:</includeonly>Includes}}
9717 !! endarticle
9718
9719 !! test
9720 bug 22297: safesubst: works during PST
9721 !! options
9722 pst
9723 !! wikitext
9724 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9725 !! html
9726 FoobarFoobar
9727 !! end
9728
9729 !! test
9730 bug 22297: safesubst: works during normal parse
9731 !! wikitext
9732 {{SafeSubstTest}}
9733 !! html
9734 <p>Foobar
9735 </p>
9736 !! end
9737
9738 !! test
9739 subst: does not work during normal parse
9740 !! wikitext
9741 {{SubstTest}}
9742 !! html
9743 <p>{{subst:Includes}}
9744 </p>
9745 !! end
9746
9747 !! test
9748 pre-save transform: context links ("pipe trick")
9749 !! options
9750 pst
9751 !! wikitext
9752 [[Article (context)|]]
9753 [[Bar:Article|]]
9754 [[:Bar:Article|]]
9755 [[Bar:Article (context)|]]
9756 [[:Bar:Article (context)|]]
9757 [[|Article]]
9758 [[|Article (context)]]
9759 [[Bar:X (Y) Z|]]
9760 [[:Bar:X (Y) Z|]]
9761 !! html
9762 [[Article (context)|Article]]
9763 [[Bar:Article|Article]]
9764 [[:Bar:Article|Article]]
9765 [[Bar:Article (context)|Article]]
9766 [[:Bar:Article (context)|Article]]
9767 [[Article]]
9768 [[Article (context)]]
9769 [[Bar:X (Y) Z|X (Y) Z]]
9770 [[:Bar:X (Y) Z|X (Y) Z]]
9771 !! end
9772
9773 !! test
9774 pre-save transform: context links ("pipe trick") with interwiki prefix
9775 !! options
9776 pst
9777 !! wikitext
9778 [[interwiki:Article|]]
9779 [[:interwiki:Article|]]
9780 [[interwiki:Bar:Article|]]
9781 [[:interwiki:Bar:Article|]]
9782 !! html
9783 [[interwiki:Article|Article]]
9784 [[:interwiki:Article|Article]]
9785 [[interwiki:Bar:Article|Bar:Article]]
9786 [[:interwiki:Bar:Article|Bar:Article]]
9787 !! end
9788
9789 !! test
9790 pre-save transform: context links ("pipe trick") with parens in title
9791 !! options
9792 pst title=[[Somearticle (context)]]
9793 !! wikitext
9794 [[|Article]]
9795 !! html
9796 [[Article (context)|Article]]
9797 !! end
9798
9799 !! test
9800 pre-save transform: context links ("pipe trick") with comma in title
9801 !! options
9802 pst title=[[Someplace, Somewhere]]
9803 !! wikitext
9804 [[|Otherplace]]
9805 [[Otherplace, Elsewhere|]]
9806 [[Otherplace, Elsewhere, Anywhere|]]
9807 !! html
9808 [[Otherplace, Somewhere|Otherplace]]
9809 [[Otherplace, Elsewhere|Otherplace]]
9810 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9811 !! end
9812
9813 !! test
9814 pre-save transform: context links ("pipe trick") with parens and comma
9815 !! options
9816 pst title=[[Someplace (IGNORED), Somewhere]]
9817 !! wikitext
9818 [[|Otherplace]]
9819 [[Otherplace (place), Elsewhere|]]
9820 !! html
9821 [[Otherplace, Somewhere|Otherplace]]
9822 [[Otherplace (place), Elsewhere|Otherplace]]
9823 !! end
9824
9825 !! test
9826 pre-save transform: context links ("pipe trick") with comma and parens
9827 !! options
9828 pst title=[[Who, me? (context)]]
9829 !! wikitext
9830 [[|Yes, you.]]
9831 [[Me, Myself, and I (1937 song)|]]
9832 !! html
9833 [[Yes, you. (context)|Yes, you.]]
9834 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9835 !! end
9836
9837 !! test
9838 pre-save transform: context links ("pipe trick") with namespace
9839 !! options
9840 pst title=[[Ns:Somearticle]]
9841 !! wikitext
9842 [[|Article]]
9843 !! html
9844 [[Ns:Article|Article]]
9845 !! end
9846
9847 !! test
9848 pre-save transform: context links ("pipe trick") with namespace and parens
9849 !! options
9850 pst title=[[Ns:Somearticle (context)]]
9851 !! wikitext
9852 [[|Article]]
9853 !! html
9854 [[Ns:Article (context)|Article]]
9855 !! end
9856
9857 !! test
9858 pre-save transform: context links ("pipe trick") with namespace and comma
9859 !! options
9860 pst title=[[Ns:Somearticle, Context, Whatever]]
9861 !! wikitext
9862 [[|Article]]
9863 !! html
9864 [[Ns:Article, Context, Whatever|Article]]
9865 !! end
9866
9867 !! test
9868 pre-save transform: context links ("pipe trick") with namespace, comma and parens
9869 !! options
9870 pst title=[[Ns:Somearticle, Context (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 namespace, parens and comma
9879 !! options
9880 pst title=[[Ns:Somearticle (IGNORED), Context]]
9881 !! wikitext
9882 [[|Article]]
9883 !! html
9884 [[Ns:Article, Context|Article]]
9885 !! end
9886
9887 !! test
9888 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
9889 !! options
9890 pst
9891 !! wikitext
9892 [[Article(context)|]]
9893 [[Bar:Article(context)|]]
9894 [[:Bar:Article(context)|]]
9895 [[|Article(context)]]
9896 [[Bar:X(Y)Z|]]
9897 [[:Bar:X(Y)Z|]]
9898 !! html
9899 [[Article(context)|Article]]
9900 [[Bar:Article(context)|Article]]
9901 [[:Bar:Article(context)|Article]]
9902 [[Article(context)]]
9903 [[Bar:X(Y)Z|X(Y)Z]]
9904 [[:Bar:X(Y)Z|X(Y)Z]]
9905 !! end
9906
9907 !! test
9908 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9909 !! options
9910 pst
9911 !! wikitext
9912 [[Article (context)|]]
9913 [[Bar:Article (context)|]]
9914 [[:Bar:Article (context)|]]
9915 [[|Article (context)]]
9916 [[Bar:X (Y) Z|]]
9917 [[:Bar:X (Y) Z|]]
9918 !! html
9919 [[Article (context)|Article]]
9920 [[Bar:Article (context)|Article]]
9921 [[:Bar:Article (context)|Article]]
9922 [[Article (context)]]
9923 [[Bar:X (Y) Z|X (Y) Z]]
9924 [[:Bar:X (Y) Z|X (Y) Z]]
9925 !! end
9926
9927 !! test
9928 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
9929 !! options
9930 pst
9931 !! wikitext
9932 [[Article(context)|]]
9933 [[Bar:Article(context)|]]
9934 [[:Bar:Article(context)|]]
9935 [[|Article(context)]]
9936 [[Bar:X(Y)Z|]]
9937 [[:Bar:X(Y)Z|]]
9938 !! html
9939 [[Article(context)|Article]]
9940 [[Bar:Article(context)|Article]]
9941 [[:Bar:Article(context)|Article]]
9942 [[Article(context)]]
9943 [[Bar:X(Y)Z|X(Y)Z]]
9944 [[:Bar:X(Y)Z|X(Y)Z]]
9945 !! end
9946
9947 !! test
9948 pre-save transform: context links ("pipe trick") with commas (bug 21660)
9949 !! options
9950 pst
9951 !! wikitext
9952 [[Article (context), context|]]
9953 [[Article (context),context|]]
9954 [[Bar:Article (context), context|]]
9955 [[Bar:Article (context),context|]]
9956 [[:Bar:Article (context), context|]]
9957 [[:Bar:Article (context),context|]]
9958 !! html
9959 [[Article (context), context|Article]]
9960 [[Article (context),context|Article]]
9961 [[Bar:Article (context), context|Article]]
9962 [[Bar:Article (context),context|Article]]
9963 [[:Bar:Article (context), context|Article]]
9964 [[:Bar:Article (context),context|Article]]
9965 !! end
9966
9967 !! test
9968 pre-save transform: trim trailing empty lines
9969 !! options
9970 pst
9971 !! wikitext
9972 Empty lines are trimmed
9973
9974
9975
9976
9977 !! html
9978 Empty lines are trimmed
9979 !! end
9980
9981 !! test
9982 pre-save transform: Signature expansion
9983 !! options
9984 pst
9985 !! wikitext
9986 * ~~~
9987 * <noinclude>~~~</noinclude>
9988 * <includeonly>~~~</includeonly>
9989 * <onlyinclude>~~~</onlyinclude>
9990 !! html
9991 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
9992 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
9993 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
9994 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
9995 !! end
9996
9997
9998 !! test
9999 pre-save transform: Signature expansion in nowiki tags (bug 93)
10000 !! options
10001 pst disabled
10002 !! wikitext
10003 Shall not expand:
10004
10005 <nowiki>~~~~</nowiki>
10006
10007 <includeonly><nowiki>~~~~</nowiki></includeonly>
10008
10009 <noinclude><nowiki>~~~~</nowiki></noinclude>
10010
10011 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10012
10013 {{subst:Foo}} shall be converted to FOO
10014
10015 As well as inside noinclude/onlyinclude
10016 <noinclude>{{subst:Foo}}</noinclude>
10017 <onlyinclude>{{subst:Foo}}</onlyinclude>
10018
10019 But not inside includeonly
10020 <includeonly>{{subst:Foo}}</includeonly>
10021 !! html
10022 Shall not expand:
10023
10024 <nowiki>~~~~</nowiki>
10025
10026 <includeonly><nowiki>~~~~</nowiki></includeonly>
10027
10028 <noinclude><nowiki>~~~~</nowiki></noinclude>
10029
10030 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10031
10032 FOO shall be converted to FOO
10033
10034 As well as inside noinclude/onlyinclude
10035 <noinclude>FOO</noinclude>
10036 <onlyinclude>FOO</onlyinclude>
10037
10038 But not inside includeonly
10039 <includeonly>{{subst:Foo}}</includeonly>
10040 !! end
10041
10042 !! test
10043 Parsoid: Recognize nowiki with trailing space in tags
10044 !! options
10045 parsoid=wt2html
10046 !! wikitext
10047 <nowiki ><div>[[foo]]</nowiki >
10048
10049 a<nowiki / >b
10050
10051 c<nowiki />d
10052
10053 e<nowiki/ >f
10054 !! html
10055 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10056 <p>ab</p>
10057 <p>cd</p>
10058 <p>ef</p>
10059 !! end
10060
10061 !! test
10062 Parsoid: Recognize nowiki with odd capitalization
10063 !! options
10064 parsoid=wt2html
10065 !! wikitext
10066 <noWikI ><div>[[foo]]</Nowiki >
10067 !! html
10068 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10069 !! end
10070
10071
10072 !! test
10073 Parsoid: Escape nowiki with trailing space in tags
10074 !! options
10075 parsoid=html2wt
10076 !! wikitext
10077 &lt;nowiki &gt; foo &lt;/nowiki &gt;
10078
10079 a&lt;nowiki /&gt;b
10080
10081 c&lt;nowiki/ &gt;d
10082 !! html
10083 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
10084 <p>a&lt;nowiki /&gt;b</p>
10085 <p>c&lt;nowiki/ &gt;d</p>
10086 !! end
10087
10088 !! test
10089 Parsoid: Escape weird noWikI capitalizations
10090 !! options
10091 parsoid=html2wt
10092 !! wikitext
10093 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
10094 !! html
10095 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
10096 !! end
10097
10098 ###
10099 ### Message transform tests
10100 ###
10101 !! test
10102 message transform: magic variables
10103 !! options
10104 msg
10105 !! wikitext
10106 {{SITENAME}}
10107 !! html
10108 MediaWiki
10109 !! end
10110
10111 !! test
10112 message transform: should not transform wiki markup
10113 !! options
10114 msg
10115 !! wikitext
10116 ''test''
10117 !! html
10118 ''test''
10119 !! end
10120
10121 !! test
10122 message transform: <noinclude> in transcluded template (bug 4926)
10123 !! options
10124 msg
10125 !! wikitext
10126 {{Includes}}
10127 !! html
10128 Foobar
10129 !! end
10130
10131 !! test
10132 message transform: <onlyinclude> in transcluded template (bug 4926)
10133 !! options
10134 msg
10135 !! wikitext
10136 {{Includes2}}
10137 !! html
10138 Foo
10139 !! end
10140
10141 !! test
10142 {{#special:}} page name, known
10143 !! options
10144 msg
10145 !! wikitext
10146 {{#special:Recentchanges}}
10147 !! html
10148 Special:RecentChanges
10149 !! end
10150
10151 !! test
10152 {{#special:}} page name with subpage, known
10153 !! options
10154 msg
10155 !! wikitext
10156 {{#special:Recentchanges/param}}
10157 !! html
10158 Special:RecentChanges/param
10159 !! end
10160
10161 !! test
10162 {{#special:}} page name, unknown
10163 !! options
10164 msg
10165 !! wikitext
10166 {{#special:foobar nonexistent}}
10167 !! html
10168 Special:Foobar nonexistent
10169 !! end
10170
10171 !! test
10172 {{#speciale:}} page name, known
10173 !! options
10174 msg
10175 !! wikitext
10176 {{#speciale:Recentchanges}}
10177 !! html
10178 Special:RecentChanges
10179 !! end
10180
10181 !! test
10182 {{#speciale:}} page name with subpage, known
10183 !! options
10184 msg
10185 !! wikitext
10186 {{#speciale:Recentchanges/param}}
10187 !! html
10188 Special:RecentChanges/param
10189 !! end
10190
10191 !! test
10192 {{#speciale:}} page name, unknown
10193 !! options
10194 msg
10195 !! wikitext
10196 {{#speciale:foobar nonexistent}}
10197 !! html
10198 Special:Foobar_nonexistent
10199 !! end
10200
10201 ###
10202 ### Images
10203 ###
10204 ### For Parsoid-specific tests, see
10205 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10206
10207 !! test
10208 Simple image
10209 !! options
10210 parsoid=wt2html,wt2wt,html2html
10211 !! wikitext
10212 [[Image:foobar.jpg]]
10213 !! html/php
10214 <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>
10215 </p>
10216 !! html/parsoid
10217 <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>
10218 </p>
10219 !! end
10220
10221 !! test
10222 Simple image (using File: namespace, now canonical)
10223 !! wikitext
10224 [[File:Foobar.jpg]]
10225 !! html/php
10226 <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>
10227 </p>
10228 !! html/parsoid
10229 <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>
10230 </p>
10231 !! end
10232
10233 !! test
10234 Right-aligned image
10235 !! wikitext
10236 [[File:Foobar.jpg|right]]
10237 !! html/php
10238 <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>
10239
10240 !! html/parsoid
10241 <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>
10242 !! end
10243
10244 !! test
10245 Image with caption
10246 !! wikitext
10247 [[File:Foobar.jpg|right|Caption text]]
10248 !! html/php
10249 <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>
10250
10251 !! html/parsoid
10252 <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>
10253 !! end
10254
10255 !! test
10256 Image with caption, bug 53312 #1
10257 !! wikitext
10258 [[File:Foobar.jpg|right|Caption page stuff]]
10259 !! html/php
10260 <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>
10261
10262 !! html/parsoid
10263 <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>
10264 !! end
10265
10266 !! test
10267 Image with caption, bug 53312 #2
10268 !! wikitext
10269 [[File:Foobar.jpg|right|Caption page=]]
10270 !! html/php
10271 <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>
10272
10273 !! html/parsoid
10274 <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>
10275 !! end
10276
10277 !! test
10278 Image with caption, bug 53312 #3
10279 !! wikitext
10280 [[File:Foobar.jpg|right|Caption page=stuff]]
10281 !! html/php
10282 <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>
10283
10284 !! html/parsoid
10285 <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>
10286 !! end
10287
10288 !! test
10289 Allow empty links in image captions (Bug 60753)
10290 !! options
10291 thumbsize=220
10292 !! wikitext
10293 [[File:Foobar.jpg|thumb|Caption [[Link1]]
10294 [[]]
10295 [[Link2]]
10296 ]]
10297 !! html/php
10298 <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>
10299
10300 !! html/parsoid
10301 <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>
10302 [[]]
10303 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
10304 </figcaption></figure>
10305 !! end
10306
10307 !! test
10308 Link with empty target
10309 !! wikitext
10310 [[]]
10311 !! html
10312 <p>[[]]
10313 </p>
10314 !! end
10315
10316 !! test
10317 Image with empty attribute
10318 !! options
10319 parsoid=wt2html,wt2wt,html2html
10320 !! wikitext
10321 [[File:Foobar.jpg|right||Caption text]]
10322 !! html/php
10323 <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>
10324
10325 !! html/parsoid
10326 <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>
10327 !! end
10328
10329 !! test
10330 1. Block image with individual attributes from templates
10331 !! wikitext
10332 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
10333 !! html/php
10334 <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>
10335
10336 !! html/parsoid
10337 <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>
10338 !! end
10339
10340 !! test
10341 2. Block Image with individual attributes from templates
10342 !! wikitext
10343 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
10344 !! html/php
10345 <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>
10346
10347 !! html/parsoid
10348 <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>
10349 !! end
10350
10351 !! test
10352 3. Inline image with individual attributes from templates
10353 !! wikitext
10354 [[File:Foobar.jpg|{{echo|50px}}]]
10355 !! html/php
10356 <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>
10357 </p>
10358 !! html/parsoid
10359 <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>
10360 !! end
10361
10362 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
10363 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
10364 !! test
10365 Image with multiple attributes from the same template
10366 !! wikitext
10367 [[File:Foobar.jpg|{{image_attribs}}]]
10368 !! html/php
10369 <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>
10370
10371 !! html/parsoid
10372 <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>
10373 !! end
10374
10375 !! test
10376 Image with link tails
10377 !! options
10378 thumbsize=220
10379 !! wikitext
10380 123[[File:Foobar.jpg]]456
10381 123[[File:Foobar.jpg|right]]456
10382 123[[File:Foobar.jpg|thumb]]456
10383 !! html/php
10384 <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
10385 </p>
10386 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
10387 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
10388
10389 !! html/parsoid
10390 <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>
10391 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
10392 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
10393 !! end
10394
10395 !! test
10396 Image with multiple captions -- only last one is accepted
10397 !! wikitext
10398 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
10399 !! html/php
10400 <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>
10401
10402 !! html/parsoid
10403 <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>
10404 !! end
10405
10406 !! test
10407 Image with multiple widths -- use last
10408 !! wikitext
10409 [[File:Foobar.jpg|200px|300px|caption]]
10410 !! html/php
10411 <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>
10412 </p>
10413 !! html/parsoid
10414 <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>
10415 !! end
10416
10417 !! test
10418 Image with multiple alignments -- use first (bug 48664)
10419 !! options
10420 thumbsize=220
10421 !! wikitext
10422 [[File:Foobar.jpg|thumb|left|right|center|caption]]
10423
10424 [[File:Foobar.jpg|middle|text-top|caption]]
10425 !! html/php
10426 <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>
10427 <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>
10428 </p>
10429 !! html/parsoid
10430 <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>
10431 <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>
10432 !! end
10433
10434 !! test
10435 Image with width attribute at different positions
10436 !! wikitext
10437 [[File:Foobar.jpg|200px|right|Caption]]
10438 [[File:Foobar.jpg|right|200px|Caption]]
10439 [[File:Foobar.jpg|right|Caption|200px]]
10440 !! html/php
10441 <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>
10442 <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>
10443 <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>
10444
10445 !! html/parsoid
10446 <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>
10447 <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>
10448 <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>
10449 !! end
10450
10451 # a sad bit of backward-compatibility
10452 !! test
10453 Image with size specified with pxpx (bug 13500, 51628)
10454 !! options
10455 parsoid=wt2html,wt2wt,html2html
10456 !! wikitext
10457 [[File:Foobar.jpg|20pxpx]]
10458 [[File:Foobar.jpg|200x20pxpx]]
10459 !! html/php
10460 <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>
10461 <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>
10462 </p>
10463 !! html/parsoid
10464 <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>
10465 !! end
10466
10467 !! test
10468 Image with link parameter, wiki target
10469 !! wikitext
10470 [[File:Foobar.jpg|link=Main Page]]
10471 !! html/php
10472 <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>
10473 </p>
10474 !! html/parsoid
10475 <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>
10476 !! end
10477
10478 # parsoid bug 49293 (part 1)
10479 !! test
10480 Image with link parameter, URL target
10481 !! wikitext
10482 [[File:Foobar.jpg|link=http://example.com/]]
10483 !! html/php
10484 <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>
10485 </p>
10486 !! html/parsoid
10487 <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>
10488 !! end
10489
10490 # parsoid bug 49293 (part 2)
10491 !! test
10492 Image with link parameter, protocol-less URL target
10493 !! wikitext
10494 [[File:Foobar.jpg|link=//example.com/]]
10495 !! html/php
10496 <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>
10497 </p>
10498 !! html/parsoid
10499 <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>
10500 !! end
10501
10502 !! test
10503 Image with link parameter, wgExternalLinkTarget
10504 !! wikitext
10505 [[Image:foobar.jpg|link=http://example.com/]]
10506 !! config
10507 wgExternalLinkTarget='foobar'
10508 !! html
10509 <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>
10510 </p>
10511 !! end
10512
10513 !! test
10514 Image with link parameter, wgNoFollowLinks set to false
10515 !! wikitext
10516 [[Image:foobar.jpg|link=http://example.com/]]
10517 !! config
10518 wgNoFollowLinks=false
10519 !! html
10520 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10521 </p>
10522 !! end
10523
10524 !! test
10525 Image with link parameter, wgNoFollowDomainExceptions
10526 !! wikitext
10527 [[Image:foobar.jpg|link=http://example.com/]]
10528 !! config
10529 wgNoFollowDomainExceptions='example.com'
10530 !! html
10531 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10532 </p>
10533 !! end
10534
10535 !! test
10536 Image with link parameter, wgExternalLinkTarget, unnamed parameter
10537 !! wikitext
10538 [[Image:foobar.jpg|link=http://example.com/|Title]]
10539 !! config
10540 wgExternalLinkTarget='foobar'
10541 !! html
10542 <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>
10543 </p>
10544 !! end
10545
10546 !! test
10547 Image with empty link parameter
10548 !! wikitext
10549 [[File:Foobar.jpg|link=]]
10550 !! html/php
10551 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10552 </p>
10553 !! html/parsoid
10554 <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>
10555 !! end
10556
10557 !! test
10558 Image with link parameter (wiki target) and unnamed parameter
10559 !! wikitext
10560 [[File:Foobar.jpg|link=Main_Page|Title]]
10561 !! html/php
10562 <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>
10563 </p>
10564 !! html/parsoid
10565 <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>
10566 !! end
10567
10568 !! test
10569 Image with link parameter (URL target) and unnamed parameter
10570 !! wikitext
10571 [[File:Foobar.jpg|link=http://example.com/|Title]]
10572 !! html/php
10573 <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>
10574 </p>
10575 !! html/parsoid
10576 <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>
10577 !! end
10578
10579 !! test
10580 Thumbnail image with link parameter
10581 !! options
10582 thumbsize=220
10583 parsoid=wt2html,wt2wt,html2html
10584 !! wikitext
10585 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
10586 !! html/php
10587 <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>
10588
10589 !! html/parsoid
10590 <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>
10591 !! end
10592
10593 !! test
10594 Manually-specified thumbnail image
10595 !! options
10596 thumbsize=220
10597 !! wikitext
10598 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
10599 !! html/php
10600 <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>
10601
10602 !! html/parsoid
10603 <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>
10604 !! end
10605
10606 !! test
10607 Manually-specified thumbnail image with explicit link to wiki page
10608 !! options
10609 thumbsize=220
10610 parsoid=wt2html,wt2wt,html2html
10611 !! wikitext
10612 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
10613 !! html/php
10614 <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>
10615
10616 !! html/parsoid
10617 <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>
10618 !! end
10619
10620 !! test
10621 Manually-specified thumbnail image with explicit link to url
10622 !! options
10623 thumbsize=220
10624 parsoid=wt2html,wt2wt,html2html
10625 !! wikitext
10626 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10627 !! html/php
10628 <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>
10629
10630 !! html/parsoid
10631 <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>
10632 !! end
10633
10634 !! test
10635 Manually-specified thumbnail image with explicit no link
10636 !! options
10637 thumbsize=220
10638 parsoid=wt2html,wt2wt,html2html
10639 !! wikitext
10640 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10641 !! html/php
10642 <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>
10643
10644 !! html/parsoid
10645 <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>
10646 !! end
10647
10648 !! test
10649 Manually-specified thumbnail image with explicit link and alt text
10650 !! options
10651 thumbsize=220
10652 parsoid=wt2html,wt2wt,html2html
10653 !! wikitext
10654 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
10655 !! html/php
10656 <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>
10657
10658 !! html/parsoid
10659 <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>
10660 !! end
10661
10662 !! test
10663 Image with frame and link
10664 !! options
10665 parsoid=wt2html,wt2wt,html2html
10666 !! wikitext
10667 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10668 !! html/php
10669 <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>
10670
10671 !! html/parsoid
10672 <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>
10673 !! end
10674
10675 !! test
10676 Image with frame and link and explicit alt
10677 !! options
10678 parsoid=wt2html,wt2wt,html2html
10679 !! wikitext
10680 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10681 !! html/php
10682 <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>
10683
10684 !! html/parsoid
10685 <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>
10686 !! end
10687
10688 !! test
10689 Image with wiki markup in implicit alt
10690 !! options
10691 parsoid=wt2html,wt2wt,html2html
10692 !! wikitext
10693 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10694
10695 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10696 !! html/php
10697 <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>
10698 </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>
10699 </p>
10700 !! html/parsoid
10701 <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>
10702 <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>
10703 !! end
10704
10705 ###################
10706 # Conflicting image format options.
10707 # First option specified should 'win'.
10708 # All three cases in each test should be identical.
10709
10710 !! test
10711 Image with 'frameless' first.
10712 !! options
10713 parsoid=wt2html,wt2wt,html2html
10714 !! wikitext
10715 [[File:Foobar.jpg|frameless|caption]]
10716
10717 [[File:Foobar.jpg|frameless|frame|caption]]
10718
10719 [[File:Foobar.jpg|frameless|thumb|caption]]
10720 !! html/php
10721 <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>
10722 </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>
10723 </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>
10724 </p>
10725 !! html/parsoid
10726 <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>
10727 <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>
10728 <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>
10729 !! end
10730
10731 !! test
10732 Image with 'frame' first.
10733 !! options
10734 parsoid=wt2html,wt2wt,html2html
10735 !! wikitext
10736 [[File:Foobar.jpg|frame|caption]]
10737 [[File:Foobar.jpg|frame|frameless|caption]]
10738 [[File:Foobar.jpg|frame|thumb|caption]]
10739 !! html/php
10740 <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>
10741 <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>
10742 <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>
10743
10744 !! html/parsoid
10745 <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>
10746 !! end
10747
10748 !! test
10749 Image with 'thumb' first.
10750 !! options
10751 parsoid=wt2html,wt2wt,html2html
10752 !! wikitext
10753 [[File:Foobar.jpg|thumb|caption]]
10754 [[File:Foobar.jpg|thumb|frameless|caption]]
10755 [[File:Foobar.jpg|thumb|frame|caption]]
10756 !! html/php
10757 <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>
10758 <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>
10759 <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>
10760
10761 !! html/parsoid
10762 <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>
10763 !! end
10764
10765 ###################
10766 # Image sizing.
10767 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
10768 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
10769 # Foobar has actual size of 1941x220
10770 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
10771 # a scalable format.
10772 # 2. Framed images always ignore size options; always render at default size.
10773 # 3. "Unspecified format" and border are the only types which can be
10774 # enlarged.
10775
10776 !! test
10777 Image: "unspecified format" and border enlarge
10778 !! options
10779 parsoid=wt2html,wt2wt,html2html
10780 !! wikitext
10781 [[File:Foobar.jpg|2000px]]
10782
10783 [[File:Foobar.jpg|border|2000px]]
10784 !! html/php
10785 <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>
10786 </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>
10787 </p>
10788 !! html/parsoid
10789 <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>
10790 <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>
10791 !! end
10792
10793 !! test
10794 Image: "unspecified format" and border reduce
10795 !! options
10796 parsoid=wt2html,wt2wt,html2html
10797 !! wikitext
10798 [[File:Foobar.jpg|1000px]]
10799
10800 [[File:Foobar.jpg|border|1000px]]
10801 !! html/php
10802 <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>
10803 </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>
10804 </p>
10805 !! html/parsoid
10806 <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>
10807 <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>
10808 !! end
10809
10810 !! test
10811 Image: thumbs reduce
10812 !! options
10813 parsoid=wt2html,wt2wt,html2html
10814 !! wikitext
10815 [[File:Foobar.jpg|thumb|50px]]
10816 !! html/php
10817 <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>
10818
10819 !! html/parsoid
10820 <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>
10821 !! end
10822
10823 !! test
10824 Image: bitmap thumbs can't be enlarged past original size, but vector can.
10825 !! options
10826 parsoid=wt2html,wt2wt,html2html
10827 !! wikitext
10828 [[File:Foobar.jpg|thumb|2000px]]
10829
10830 [[File:Foobar.svg|thumb|2000px]]
10831 !! html/php
10832 <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>
10833 <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>
10834
10835 !! html/parsoid
10836 <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>
10837 <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>
10838 !! end
10839
10840 !! test
10841 Image: frameless can reduce in size
10842 !! options
10843 parsoid=wt2html,wt2wt,html2html
10844 !! wikitext
10845 [[File:Foobar.jpg|frameless|50px]]
10846 !! html/php
10847 <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>
10848 </p>
10849 !! html/parsoid
10850 <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>
10851 !! end
10852
10853 !! test
10854 Image: bitmap frameless can't be enlarged past original size, but vector can
10855 !! options
10856 parsoid=wt2html,wt2wt,html2html
10857 !! wikitext
10858 [[File:Foobar.jpg|frameless|2000px]]
10859
10860 [[File:Foobar.svg|frameless|2000px]]
10861 !! html/php
10862 <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>
10863 </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>
10864 </p>
10865 !! html/parsoid
10866 <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>
10867 <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>
10868 !! end
10869
10870 !! test
10871 Image: framed images are always unscaled.
10872 !! options
10873 parsoid=wt2html,wt2wt,html2html
10874 !! wikitext
10875 [[File:Foobar.jpg|frame]]
10876
10877 [[File:Foobar.jpg|frame|50px]]
10878
10879 [[File:Foobar.jpg|frame|50x50px]]
10880
10881 [[File:Foobar.jpg|frame|2000px]]
10882 !! html/php
10883 <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>
10884 <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>
10885 <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>
10886 <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>
10887
10888 !! html/parsoid
10889 <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>
10890 !! end
10891
10892 ###################
10893
10894 !! test
10895 Link to image page- image page normally doesn't exists, hence edit link
10896 Add test with existing image page
10897 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10898 !! wikitext
10899 [[:Image:test]]
10900 !! html
10901 <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>
10902 </p>
10903 !! end
10904
10905 !! test
10906 bug 18784 Link to non-existent image page with caption should use caption as link text
10907 !! wikitext
10908 [[:Image:test|caption]]
10909 !! html
10910 <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>
10911 </p>
10912 !! end
10913
10914 !! test
10915 Frameless image caption with a free URL
10916 !! wikitext
10917 [[File:Foobar.jpg|http://example.com]]
10918 !! html/php
10919 <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>
10920 </p>
10921 !! html/parsoid
10922 <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>
10923 !! end
10924
10925 !! test
10926 Thumbnail image caption with a free URL
10927 !! options
10928 thumbsize=220
10929 !! wikitext
10930 [[File:Foobar.jpg|thumb|http://example.com]]
10931 !! html/php
10932 <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>
10933
10934 !! html/parsoid
10935 <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>
10936 !! end
10937
10938 !! test
10939 Thumbnail image caption with a free URL and explicit alt
10940 !! options
10941 thumbsize=220
10942 parsoid=wt2html,wt2wt,html2html
10943 !! wikitext
10944 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
10945 !! html/php
10946 <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>
10947
10948 !! html/parsoid
10949 <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>
10950 !! end
10951
10952 !! test
10953 SVG thumbnails with no language set
10954 !! options
10955 !! wikitext
10956 [[File:Foobar.svg|thumb|caption]]
10957 !! html/php
10958 <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>
10959
10960 !! html/parsoid
10961 <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>
10962 !! end
10963
10964 !! test
10965 SVG thumbnails with language de
10966 !! options
10967 parsoid=wt2html,wt2wt,html2html
10968 !! wikitext
10969 [[File:Foobar.svg|thumb|caption|lang=de]]
10970 !! html/php
10971 <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>
10972
10973 !! html/parsoid
10974 <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>
10975 !! end
10976
10977 !! test
10978 SVG thumbnails with invalid language code
10979 !! options
10980 parsoid=wt2html,wt2wt,html2html
10981 !! wikitext
10982 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
10983 !! html/php
10984 <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>
10985
10986 !! html/parsoid
10987 <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>
10988 !! end
10989
10990 !! test
10991 BUG 1887: A ISBN with a thumbnail
10992 !! wikitext
10993 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
10994 !! html/php
10995 <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>
10996
10997 !! html/parsoid
10998 <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>
10999 !! end
11000
11001 !! test
11002 BUG 1887: A RFC with a thumbnail
11003 !! wikitext
11004 [[File:Foobar.jpg|thumb|This is RFC 12354]]
11005 !! html/php
11006 <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>
11007
11008 !! html/parsoid
11009 <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>
11010 !! end
11011
11012 !! test
11013 BUG 1887: A mailto link with a thumbnail
11014 !! wikitext
11015 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
11016 !! html/php
11017 <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>
11018
11019 !! html/parsoid
11020 <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>
11021 !! end
11022
11023 # Pending resolution to bug 368
11024 !! test
11025 BUG 648: Frameless image caption with a link
11026 !! wikitext
11027 [[File:Foobar.jpg|text with a [[link]] in it]]
11028 !! html/php
11029 <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>
11030 </p>
11031 !! html/parsoid
11032 <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>
11033 !! end
11034
11035 !! test
11036 BUG 648: Frameless image caption with a link (suffix)
11037 !! wikitext
11038 [[File:Foobar.jpg|text with a [[link]]foo in it]]
11039 !! html/php
11040 <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>
11041 </p>
11042 !! html/parsoid
11043 <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>
11044 !! end
11045
11046 !! test
11047 BUG 648: Frameless image caption with an interwiki link
11048 !! wikitext
11049 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
11050 !! html/php
11051 <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>
11052 </p>
11053 !! html/parsoid
11054 <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>
11055 !! end
11056
11057 !! test
11058 BUG 648: Frameless image caption with a piped interwiki link
11059 !! wikitext
11060 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
11061 !! html/php
11062 <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>
11063 </p>
11064 !! html/parsoid
11065 <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>
11066 !! end
11067
11068 !! test
11069 Escape HTML special chars in image alt text
11070 !! wikitext
11071 [[File:Foobar.jpg|& < > "]]
11072 !! html/php
11073 <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>
11074 </p>
11075 !! html/parsoid
11076 <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>
11077 !! end
11078
11079 !! test
11080 BUG 499: Alt text should have &#1234;, not &amp;1234;
11081 !! wikitext
11082 [[File:Foobar.jpg|&#9792;]]
11083 !! html/php
11084 <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>
11085 </p>
11086 !! html/parsoid
11087 <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>
11088 !! end
11089
11090 !! test
11091 Broken image caption with link
11092 !! options
11093 parsoid=wt2html,wt2wt,html2html
11094 !! wikitext
11095 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
11096 !! html/php
11097 <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.
11098 </p>
11099 !! html/parsoid
11100 <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>
11101 !! end
11102
11103 !! test
11104 Image caption containing another image
11105 !! wikitext
11106 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
11107 !! html/php
11108 <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>
11109
11110 !! html/parsoid
11111 <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>
11112 !! end
11113
11114 !! test
11115 Image: caption containing a newline
11116 !! wikitext
11117 [[File:Foobar.jpg|This
11118 *is some text]]
11119 !! html/php
11120 <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>
11121 </p>
11122 !! html/parsoid
11123 <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>
11124 !!end
11125
11126 !!test
11127 Image: caption containing leading space
11128 (The leading space should not trigger nowiki escaping in wt2wt mode)
11129 !! wikitext
11130 [[File:Foobar.jpg|thumb| bar]]
11131 !! html/php
11132 <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>
11133
11134 !! html/parsoid
11135 <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>
11136 !!end
11137
11138 !! test
11139 Image: caption containing a table
11140 !! options
11141 parsoid=wt2html,wt2wt,html2html
11142 !! wikitext
11143 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
11144 {|
11145 ! Foo !! Bar
11146 |-
11147 | Foo1 || Bar1
11148 |}
11149 and some more text.]]
11150 !! html/php
11151 <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>
11152
11153 !! html/parsoid
11154 <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
11155 <table>
11156 <tbody>
11157 <tr><th>Foo </th><th>Bar</th></tr>
11158 <tr>
11159 <td>Foo1 </td>
11160 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
11161 !! end
11162
11163 !! test
11164 Bug 3090: External links other than http: in image captions
11165 !! wikitext
11166 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
11167 !! html/php
11168 <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>
11169
11170 !! html/parsoid
11171 <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>
11172 !! end
11173
11174 !! test
11175 Custom class
11176 !! options
11177 parsoid=wt2html,wt2wt,html2html
11178 !! wikitext
11179 [[Image:foobar.jpg|a|class=b]]
11180 !! html/php
11181 <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>
11182 </p>
11183 !! html/parsoid
11184 <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>
11185 !! end
11186
11187 !! test
11188 Localized image handling (1).
11189 !! options
11190 parsoid=wt2html,wt2wt,html2html
11191 language=es
11192 !! wikitext
11193 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
11194 !! html/php
11195 <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>
11196
11197 !! html/parsoid
11198 <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>
11199 !! end
11200
11201 !! test
11202 Localized image handling (2).
11203 !! options
11204 thumbsize=220
11205 parsoid=wt2html,wt2wt,html2html
11206 language=es
11207 !! wikitext
11208 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
11209 !! html/php
11210 <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>
11211
11212 !! html/parsoid
11213 <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>
11214 !! end
11215
11216 !! test
11217 "border", "frameless" and "class" attributes on an image.
11218 !! options
11219 thumbsize=220
11220 parsoid=wt2html,wt2wt,html2html
11221 !! wikitext
11222 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
11223 !! html/php
11224 <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>
11225 </p>
11226 !! html/parsoid
11227 <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>
11228 !! end
11229
11230 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
11231 !! test
11232 Invalid image attributes (bug 62500)
11233 !! options
11234 thumbsize=220
11235 parsoid=wt2html,wt2wt,html2html
11236 !! wikitext
11237 [[File:Foobar.jpg|thumb|float|left|caption]]
11238
11239 [[File:Foobar.jpg|thumb|righ|caption]]
11240
11241 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
11242 !! html/php
11243 <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>
11244 <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>
11245 <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>
11246
11247 !! html/parsoid
11248 <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>
11249 !! end
11250
11251 !! article
11252 File:Barfoo.jpg
11253 !! text
11254 #REDIRECT [[File:Barfoo.jpg]]
11255 !! endarticle
11256
11257 !! test
11258 Redirected image
11259 !! wikitext
11260 [[Image:Barfoo.jpg]]
11261 !! html
11262 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
11263 </p>
11264 !! end
11265
11266 !! test
11267 Missing image with uploads disabled
11268 !! options
11269 wgEnableUploads=0
11270 !! wikitext
11271 [[Image:Foobaz.jpg]]
11272 !! html
11273 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
11274 </p>
11275 !! end
11276
11277 # Parsoid-specific testing for images
11278 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11279 # Currently imperfect due to a flaw in the Parsoid testrunner
11280 # Work in progress
11281 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
11282 # image tests.
11283
11284 !! test
11285 Parsoid-specific image handling - simple image with size and middle alignment
11286 !! wikitext
11287 [[File:Foobar.jpg|middle|50px]]
11288 !! html/parsoid
11289 <p><span class="mw-valign-middle" typeof="mw:Image">
11290 <a href="File:Foobar.jpg">
11291 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11292 </a>
11293 </span>
11294 </p>
11295 !! end
11296
11297 !! test
11298 Parsoid-specific image handling - simple image with size, middle alignment,
11299 non-standard namespace alias
11300 !! options
11301 parsoid=wt2wt,wt2html,html2html
11302 !! wikitext
11303 [[Image:Foobar.jpg|middle|50px]]
11304 !! html/parsoid
11305 <p><span class="mw-valign-middle" typeof="mw:Image">
11306 <a href="File:Foobar.jpg">
11307 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11308 </a>
11309 </span>
11310 </p>
11311 !! end
11312
11313 !! test
11314 Parsoid-specific image handling - simple image with size and middle alignment
11315 (existing content)
11316 !! wikitext
11317 [[File:Foobar.jpg|50px|middle]]
11318 !! html/parsoid
11319 <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>
11320 !! end
11321
11322 !! test
11323 Parsoid-specific image handling - simple image with size and middle alignment
11324 and non-standard namespace name
11325 !! options
11326 parsoid=wt2html,wt2wt,html2html
11327 !! wikitext
11328 [[Image:Foobar.jpg|50px|middle]]
11329 !! html/parsoid
11330 <p><span class="mw-valign-middle" typeof="mw:Image">
11331 <a href="File:Foobar.jpg">
11332 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11333 </a>
11334 </span>
11335 </p>
11336 !! end
11337
11338 !! test
11339 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
11340 !! wikitext
11341 [[File:Foobar.jpg|500x10px|baseline|caption]]
11342 !! html/parsoid
11343 <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>
11344 !! end
11345
11346 !! test
11347 Parsoid-specific image handling - simple image with border and size spec
11348 !! wikitext
11349 [[File:Foobar.jpg|50px|border|caption]]
11350 !! html/parsoid
11351 <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>
11352 !! end
11353
11354 !! test
11355 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11356 !! wikitext
11357 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
11358 !! html/parsoid
11359 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
11360 <a href="File:Foobar.jpg">
11361 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
11362 </a>
11363 <figcaption>caption content</figcaption>
11364 </figure>
11365 !! end
11366
11367 !! test
11368 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11369 (existing content)
11370 !! wikitext
11371 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
11372 !! html/parsoid
11373 <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>
11374 !! end
11375
11376 !! test
11377 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
11378 !! wikitext
11379 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
11380 !! html/parsoid
11381 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
11382 <a href="File:Foobar.jpg">
11383 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
11384 </a>
11385 <figcaption>caption</figcaption>
11386 </figure>
11387 !! end
11388
11389 !! test
11390 Parsoid-specific image handling - thumbnail with specific size, halign,
11391 valign, and caption (existing content)
11392 !! wikitext
11393 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
11394 !! html/parsoid
11395 <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>
11396 !! end
11397
11398 !! test
11399 Parsoid-specific image handling - framed image with specific size and caption
11400 (size is ignored)
11401 !! options
11402 parsoid=wt2html,wt2wt,html2html
11403 !! wikitext
11404 [[File:Foobar.jpg|frame|500x50px|caption]]
11405 !! html/parsoid
11406 <figure typeof="mw:Image/Frame">
11407 <a href="File:Foobar.jpg">
11408 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11409 </a>
11410 <figcaption>caption</figcaption>
11411 </figure>
11412 !! end
11413
11414 !! test
11415 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
11416 (size is ignored)
11417 !! options
11418 parsoid=wt2html,wt2wt,html2html
11419 !! wikitext
11420 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
11421 !! html/parsoid
11422 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
11423 <a href="File:Foobar.jpg">
11424 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11425 </a>
11426 <figcaption>caption</figcaption>
11427 </figure>
11428 !! end
11429
11430 !! test
11431 Parsoid-specific image handling - frameless image with specific size, border, and caption
11432 !! wikitext
11433 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
11434 !! html/parsoid
11435 <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>
11436 !! end
11437
11438 !! test
11439 Parsoid-specific image handling - simple image with a formatted caption
11440 !! wikitext
11441 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
11442 !! html/parsoid
11443 <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>"}'>
11444 <a href="File:Foobar.jpg">
11445 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
11446 </a></span></p>
11447 !! end
11448
11449 !! test
11450 Parsoid-specific image handling - caption with a template in it
11451 !! wikitext
11452 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
11453 !! html/parsoid
11454 <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>
11455 !! end
11456
11457 !! test
11458 Parsoid-specific image handling - caption with unbalanced tags in it
11459 !! options
11460 parsoid=wt2html,wt2wt,html2html
11461 !! wikitext
11462 foo
11463 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
11464 bar
11465 !! html/parsoid
11466 <p>foo</p>
11467 <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>
11468 <p>bar</p>
11469 !! end
11470
11471 !! test
11472 Parsoid-specific image handling - empty caption (1)
11473 !! options
11474 parsoid=wt2html,wt2wt
11475 !! wikitext
11476 [[File:Foobar.jpg|thumb|]]
11477 !! html/parsoid
11478 <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>
11479 !! end
11480
11481 # empty captions don't get serialized unless we're in the "round trip" case
11482 !! test
11483 Parsoid-specific image handling - empty caption (2)
11484 !! options
11485 parsoid=html2wt
11486 !! html/parsoid
11487 <figure class="mw-default-size" typeof="mw:Image/Thumb">
11488 <a href="File:Foobar.jpg">
11489 <img resource="./File:Foobar.jpg"
11490 src="//example.com/images/3/3a/Foobar.jpg"
11491 height="25" width="220"/>
11492 </a>
11493 <figcaption></figcaption>
11494 </figure>
11495 !! wikitext
11496 [[File:Foobar.jpg|thumb]]
11497 !! end
11498
11499 !! test
11500 Parsoid-specific image handling - whitespace caption
11501 !! wikitext
11502 [[File:Foobar.jpg|thumb| ]]
11503 !! html/parsoid
11504 <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>
11505 !! end
11506
11507 !! test
11508 Parsoid-specific image handling - lang option
11509 !! wikitext
11510 foo
11511 [[File:Foobar.svg|lang=de|caption]]
11512 bar
11513 !! html/parsoid
11514 <p>foo
11515 <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>
11516 bar</p>
11517 !! end
11518
11519
11520 ###
11521 ### Subpages
11522 ###
11523 !! article
11524 Subpage test/subpage
11525 !! text
11526 foo
11527 !! endarticle
11528
11529 !! test
11530 Subpage link
11531 !! options
11532 subpage title=[[Subpage test]]
11533 !! wikitext
11534 [[/subpage]]
11535 !! html
11536 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
11537 </p>
11538 !! end
11539
11540 !! test
11541 Subpage noslash link
11542 !! options
11543 subpage title=[[Subpage test]]
11544 !! wikitext
11545 [[/subpage/]]
11546 !! html
11547 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
11548 </p>
11549 !! end
11550
11551 # TODO: make this PHP-parser compatible!
11552 !! test
11553 Relative subpage noslash link
11554 !! options
11555 parsoid=wt2wt,wt2html,html2html
11556 subpage title=[[Subpage test/1/2/3/4]]
11557 !! wikitext
11558 [[../../subpage/]]
11559
11560 [[../../subpage]]
11561 !! html
11562 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
11563 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
11564 !! end
11565
11566 !! test
11567 Parsoid: dot-slash prefixed wikilinks
11568 !! wikitext
11569 [[./foo]]
11570
11571 [[././bar]]
11572
11573 [[././baz/]]
11574 !! html/php
11575 <p>[[./foo]]
11576 </p><p>[[././bar]]
11577 </p><p>[[././baz/]]
11578 </p>
11579 !! html/parsoid
11580 <p>[[./foo]]
11581 </p><p>[[././bar]]
11582 </p><p>[[././baz/]]
11583 </p>
11584 !! end
11585
11586 !! test
11587 Render invalid page names as plain text (bug 51090)
11588 !! wikitext
11589 [[./../foo|bar]]
11590 [[foo�|bar]]
11591 [[foo/.|bar]]
11592 [[foo/..|bar]]
11593 [[foo~~~bar]]
11594 [[foo>bar]]
11595 [[foo[bar]]
11596 [[.]]
11597 [[..]]
11598 [[foo././bar]]
11599
11600 [[{{echo|./../foo}}|bar]]
11601 [[{{echo|foo/.}}|bar]]
11602 [[{{echo|foo/..}}|bar]]
11603 [[{{echo|foo~~~~bar}}]]
11604 [[{{echo|foo>bar}}]]
11605 [[{{echo|foo././bar}}]]
11606 [[{{echo|foo{bar}}]]
11607 [[{{echo|foo}bar}}]]
11608 [[{{echo|foo[bar}}]]
11609 [[{{echo|foo]bar}}]]
11610 [[{{echo|foo<bar}}]]
11611 !!html/php
11612 <p>[[./../foo|bar]]
11613 [[foo�|bar]]
11614 [[foo/.|bar]]
11615 [[foo/..|bar]]
11616 [[foo~~~bar]]
11617 [[foo&gt;bar]]
11618 [[foo[bar]]
11619 [[.]]
11620 [[..]]
11621 [[foo././bar]]
11622 </p><p>[[./../foo|bar]]
11623 [[foo/.|bar]]
11624 [[foo/..|bar]]
11625 [[foo~~~~bar]]
11626 [[foo&gt;bar]]
11627 [[foo././bar]]
11628 [[foo{bar]]
11629 [[foo}bar]]
11630 [[foo[bar]]
11631 [[foo]bar]]
11632 [[foo&lt;bar]]
11633 </p>
11634 !!html/parsoid
11635 <p>[[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]</p>
11636 <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>
11637 !!end
11638
11639 !! test
11640 Disabled subpages
11641 !! wikitext
11642 [[/subpage]]
11643 !! html
11644 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
11645 </p>
11646 !! end
11647
11648 !! test
11649 BUG 561: {{/Subpage}}
11650 !! options
11651 subpage title=[[Page]]
11652 !! wikitext
11653 {{/Subpage}}
11654 !! html
11655 <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>
11656 </p>
11657 !! end
11658
11659 ###
11660 ### Categories
11661 ###
11662 !! article
11663 Category:MediaWiki User's Guide
11664 !! text
11665 blah
11666 !! endarticle
11667
11668 !! test
11669 Link to category
11670 !! wikitext
11671 [[:Category:MediaWiki User's Guide]]
11672 !! html
11673 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
11674 </p>
11675 !! end
11676
11677 !! test
11678 Simple category
11679 !! options
11680 cat
11681 !! wikitext
11682 [[Category:MediaWiki User's Guide]]
11683 !! html
11684 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11685 !! end
11686
11687 !! test
11688 PAGESINCATEGORY invalid title fatal (r33546 fix)
11689 !! wikitext
11690 {{PAGESINCATEGORY:<bogus>}}
11691 !! html
11692 <p>0
11693 </p>
11694 !! end
11695
11696 !! test
11697 Category with different sort key
11698 !! options
11699 cat
11700 !! wikitext
11701 [[Category:MediaWiki User's Guide|Foo]]
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 identical sort key
11708 !! options
11709 cat
11710 !! wikitext
11711 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11712 !! html
11713 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11714 !! end
11715
11716 !! test
11717 Category with empty sort key
11718 !! options
11719 cat
11720 pst
11721 !! wikitext
11722 [[Category:MediaWiki User's Guide|]]
11723 !! html
11724 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11725 !! end
11726
11727 !! test
11728 Category with empty sort key and parentheses
11729 !! options
11730 cat
11731 pst
11732 !! wikitext
11733 [[Category:Foo (bar)|]]
11734 !! html
11735 [[Category:Foo (bar)|Foo]]
11736 !! end
11737
11738 !! test
11739 Category with link tail
11740 !! options
11741 cat
11742 pst
11743 !! wikitext
11744 123[[Category:Foo]]456
11745 !! html
11746 123[[Category:Foo]]456
11747 !! end
11748
11749 !! test
11750 Category with template
11751 !! options
11752 cat
11753 pst
11754 !! wikitext
11755 [[Category:{{echo|Foo}}]]
11756 !! html
11757 [[Category:{{echo|Foo}}]]
11758 !! end
11759
11760 !! test
11761 Category with template in sort key
11762 !! options
11763 cat
11764 pst
11765 !! wikitext
11766 [[Category:Foo|{{echo|Bar}}]]
11767 !! html
11768 [[Category:Foo|{{echo|Bar}}]]
11769 !! end
11770
11771 !! test
11772 Category with template in sort key and title
11773 !! options
11774 cat
11775 pst
11776 !! wikitext
11777 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11778 !! html
11779 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11780 !! end
11781
11782 !! test
11783 Category / paragraph interactions
11784 !! wikitext
11785 Foo [[Category:Baz]] Bar
11786
11787 Foo [[Category:Baz]]
11788 Bar
11789
11790 Foo
11791 [[Category:Baz]]
11792 Bar
11793
11794 Foo
11795 [[Category:Baz]] Bar
11796
11797 Foo
11798 [[Category:Baz]]
11799 [[Category:Baz]]
11800 [[Category:Baz]]
11801 Bar
11802
11803 [[Category:Baz]]
11804 [[Category:Baz]]
11805 [[Category:Baz]]
11806
11807 [[Category:Baz]]
11808 {{echo|[[Category:Baz]]}}
11809 [[Category:Baz]]
11810 !! html
11811 <p>Foo Bar
11812 </p><p>Foo
11813 Bar
11814 </p><p>Foo
11815 Bar
11816 </p><p>Foo Bar
11817 </p><p>Foo
11818 Bar
11819 </p>
11820 !! end
11821
11822 !! test
11823 Parsoid: Serialize link to category page with colon escape
11824 !! options
11825 parsoid
11826 !! wikitext
11827
11828 [[:Category:Foo]]
11829 [[:Category:Foo|Bar]]
11830 !! html
11831 <p>
11832 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11833 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11834 </p>
11835 !! end
11836
11837 !! test
11838 Parsoid: Link prefix/suffixes aren't applied to category links
11839 !! options
11840 parsoid=wt2html,wt2wt,html2html
11841 language=is
11842 !! wikitext
11843 x[[Category:Foo]]y
11844 !! html
11845 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11846 !! end
11847
11848 !! test
11849 Parsoid: Serialize link to file page with colon escape
11850 !! options
11851 parsoid
11852 !! wikitext
11853
11854 [[:File:Foo.png]]
11855 [[:File:Foo.png|Bar]]
11856 !! html
11857 <p>
11858 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11859 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11860 </p>
11861 !! end
11862
11863 !! test
11864 Parsoid: Serialize a genuine category link without colon escape
11865 !! options
11866 parsoid
11867 !! wikitext
11868 [[Category:Foo]]
11869 [[Category:Foo|Bar]]
11870 !! html
11871 <link rel="mw:PageProp/Category" href="Category:Foo">
11872 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11873 !! end
11874
11875 !! test
11876 Parsoid: Defaultsort
11877 !! options
11878 parsoid
11879 !! wikitext
11880 {{DEFAULTSORT:Foo}}
11881 !! html
11882 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11883 !! end
11884
11885 ###
11886 ### Inter-language links
11887 ###
11888 !! test
11889 Inter-language links
11890 !! options
11891 ill
11892 !! wikitext
11893 [[es:Alimento]]
11894 [[fr:Nourriture]]
11895 [[zh:&#39135;&#21697;]]
11896 !! html
11897 es:Alimento fr:Nourriture zh:食品
11898 !! end
11899
11900 !! test
11901 Duplicate interlanguage links (bug 24502)
11902 !! options
11903 ill
11904 !! wikitext
11905 [[es:1]]
11906 [[es:2]]
11907 [[fr:1]]
11908 [[fr:2]]
11909 !! html
11910 es:1 fr:1
11911 !! end
11912
11913 ###
11914 ### Sections
11915 ###
11916 !! test
11917 Basic section headings
11918 !! wikitext
11919 == Headline 1 ==
11920 Some text
11921
11922 ==Headline 2==
11923 More
11924 ===Smaller headline===
11925 Blah blah
11926 !! html
11927 <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>
11928 <p>Some text
11929 </p>
11930 <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>
11931 <p>More
11932 </p>
11933 <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>
11934 <p>Blah blah
11935 </p>
11936 !! end
11937
11938 !! test
11939 Section headings with TOC
11940 !! wikitext
11941 == Headline 1 ==
11942 === Subheadline 1 ===
11943 ===== Skipping a level =====
11944 ====== Skipping a level ======
11945
11946 == Headline 2 ==
11947 Some text
11948 ===Another headline===
11949 !! html
11950 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11951 <ul>
11952 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
11953 <ul>
11954 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
11955 <ul>
11956 <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>
11957 <ul>
11958 <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>
11959 </ul>
11960 </li>
11961 </ul>
11962 </li>
11963 </ul>
11964 </li>
11965 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
11966 <ul>
11967 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
11968 </ul>
11969 </li>
11970 </ul>
11971 </div>
11972
11973 <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>
11974 <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>
11975 <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>
11976 <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>
11977 <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>
11978 <p>Some text
11979 </p>
11980 <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>
11981
11982 !! end
11983
11984 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
11985 !! test
11986 Handling of sections up to level 6 and beyond
11987 !! wikitext
11988 = Level 1 Heading=
11989 == Level 2 Heading==
11990 === Level 3 Heading===
11991 ==== Level 4 Heading====
11992 ===== Level 5 Heading=====
11993 ====== Level 6 Heading======
11994 ======= Level 7 Heading=======
11995 ======== Level 8 Heading========
11996 ========= Level 9 Heading=========
11997 ========== Level 10 Heading==========
11998 !! html
11999 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12000 <ul>
12001 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
12002 <ul>
12003 <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>
12004 <ul>
12005 <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>
12006 <ul>
12007 <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>
12008 <ul>
12009 <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>
12010 <ul>
12011 <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>
12012 <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>
12013 <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>
12014 <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>
12015 <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>
12016 </ul>
12017 </li>
12018 </ul>
12019 </li>
12020 </ul>
12021 </li>
12022 </ul>
12023 </li>
12024 </ul>
12025 </li>
12026 </ul>
12027 </div>
12028
12029 <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>
12030 <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>
12031 <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>
12032 <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>
12033 <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>
12034 <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>
12035 <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>
12036 <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>
12037 <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>
12038 <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>
12039
12040 !! end
12041
12042 !! test
12043 TOC regression (bug 9764)
12044 !! wikitext
12045 == title 1 ==
12046 === title 1.1 ===
12047 ==== title 1.1.1 ====
12048 === title 1.2 ===
12049 == title 2 ==
12050 === title 2.1 ===
12051 !! html
12052 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12053 <ul>
12054 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12055 <ul>
12056 <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>
12057 <ul>
12058 <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>
12059 </ul>
12060 </li>
12061 <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>
12062 </ul>
12063 </li>
12064 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12065 <ul>
12066 <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>
12067 </ul>
12068 </li>
12069 </ul>
12070 </div>
12071
12072 <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>
12073 <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>
12074 <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>
12075 <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>
12076 <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>
12077 <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>
12078
12079 !! end
12080
12081 !! test
12082 TOC with wgMaxTocLevel=3 (bug 6204)
12083 !! options
12084 wgMaxTocLevel=3
12085 !! wikitext
12086 == title 1 ==
12087 === title 1.1 ===
12088 ==== title 1.1.1 ====
12089 === title 1.2 ===
12090 == title 2 ==
12091 === title 2.1 ===
12092 !! html
12093 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12094 <ul>
12095 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12096 <ul>
12097 <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>
12098 <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>
12099 </ul>
12100 </li>
12101 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12102 <ul>
12103 <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>
12104 </ul>
12105 </li>
12106 </ul>
12107 </div>
12108
12109 <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>
12110 <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>
12111 <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>
12112 <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>
12113 <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>
12114 <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>
12115
12116 !! end
12117
12118 !! test
12119 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
12120 !! options
12121 wgMaxTocLevel=3
12122 !! wikitext
12123 ==Section 1==
12124 ===Section 1.1===
12125 ====Section 1.1.1====
12126 ====Section 1.1.1.1====
12127 ==Section 2==
12128 !! html
12129 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12130 <ul>
12131 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
12132 <ul>
12133 <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>
12134 </ul>
12135 </li>
12136 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
12137 </ul>
12138 </div>
12139
12140 <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>
12141 <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>
12142 <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>
12143 <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>
12144 <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>
12145
12146 !! end
12147
12148
12149 !! test
12150 Resolving duplicate section names
12151 !! wikitext
12152 == Foo bar ==
12153 == Foo bar ==
12154 !! html
12155 <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>
12156 <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>
12157
12158 !! end
12159
12160 !! test
12161 Resolving duplicate section names with differing case (bug 10721)
12162 !! wikitext
12163 == Foo bar ==
12164 == Foo Bar ==
12165 !! html
12166 <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>
12167 <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>
12168
12169 !! end
12170
12171 !! article
12172 Template:sections
12173 !! text
12174 ===Section 1===
12175 ==Section 2==
12176 !! endarticle
12177
12178 !! test
12179 Template with sections, __NOTOC__
12180 !! wikitext
12181 __NOTOC__
12182 ==Section 0==
12183 {{sections}}
12184 ==Section 4==
12185 !! html
12186 <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>
12187 <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>
12188 <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>
12189 <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>
12190
12191 !! end
12192
12193 !! test
12194 __NOEDITSECTION__ keyword
12195 !! wikitext
12196 __NOEDITSECTION__
12197 ==Section 1==
12198 ==Section 2==
12199 !! html
12200 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
12201 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
12202
12203 !! end
12204
12205 !! test
12206 Link inside a section heading
12207 !! wikitext
12208 ==Section with a [[Main Page|link]] in it==
12209 !! html
12210 <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>
12211
12212 !! end
12213
12214 !! test
12215 TOC regression (bug 12077)
12216 !! wikitext
12217 __TOC__
12218 == title 1 ==
12219 === title 1.1 ===
12220 == title 2 ==
12221 !! html
12222 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12223 <ul>
12224 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12225 <ul>
12226 <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>
12227 </ul>
12228 </li>
12229 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
12230 </ul>
12231 </div>
12232
12233 <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>
12234 <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>
12235 <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>
12236
12237 !! end
12238
12239 !! test
12240 BUG 1219 URL next to image (good)
12241 !! wikitext
12242 http://example.com [[Image:foobar.jpg]]
12243 !! html
12244 <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>
12245 </p>
12246 !!end
12247
12248 !! test
12249 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
12250 !! wikitext
12251 ===
12252 The line above must have a trailing space!
12253 === <!--
12254 --> <!-- -->
12255 But just in case it doesn't...
12256 !! html
12257 <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>
12258 <p>The line above must have a trailing space!
12259 </p>
12260 <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>
12261 <p>But just in case it doesn't...
12262 </p>
12263 !! end
12264
12265 !! test
12266 Header with special characters (bug 25462)
12267 !! wikitext
12268 The tooltips shall not show entities to the user (ie. be double escaped)
12269
12270 == text > text ==
12271 section 1
12272
12273 == text < text ==
12274 section 2
12275
12276 == text & text ==
12277 section 3
12278
12279 == text ' text ==
12280 section 4
12281
12282 == text " text ==
12283 section 5
12284 !! html
12285 <p>The tooltips shall not show entities to the user (ie. be double escaped)
12286 </p>
12287 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12288 <ul>
12289 <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>
12290 <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>
12291 <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>
12292 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
12293 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
12294 </ul>
12295 </div>
12296
12297 <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>
12298 <p>section 1
12299 </p>
12300 <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>
12301 <p>section 2
12302 </p>
12303 <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>
12304 <p>section 3
12305 </p>
12306 <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>
12307 <p>section 4
12308 </p>
12309 <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>
12310 <p>section 5
12311 </p>
12312 !! end
12313
12314 !! test
12315 Headers with excess '=' characters
12316 (Are similar tests necessary beyond the 1st level?)
12317 !! wikitext
12318 =foo==
12319 ==foo=
12320 =''italic'' heading==
12321 ==''italic'' heading=
12322 !! html
12323 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12324 <ul>
12325 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
12326 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
12327 <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>
12328 <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>
12329 </ul>
12330 </div>
12331
12332 <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>
12333 <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>
12334 <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>
12335 <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>
12336
12337 !! end
12338
12339 !! test
12340 HTML headers vs TOC (bug 23393)
12341 (__NOEDITSECTION__ for clearer output, doesn't matter here)
12342 !! wikitext
12343 <h1>Header 1</h1>
12344 == Header 1.1 ==
12345 == Header 1.2 ==
12346
12347 <h1>Header 2
12348 </h1>
12349 == Header 2.1 ==
12350 == Header 2.2 ==
12351 __NOEDITSECTION__
12352 !! html
12353 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12354 <ul>
12355 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
12356 <ul>
12357 <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>
12358 <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>
12359 </ul>
12360 </li>
12361 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
12362 <ul>
12363 <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>
12364 <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>
12365 </ul>
12366 </li>
12367 </ul>
12368 </div>
12369
12370 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
12371 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
12372 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
12373 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
12374 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
12375 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
12376
12377 !! end
12378
12379 !! test
12380 Single-line or multiline-comments can follow headings
12381 !! options
12382 parsoid=wt2html,wt2wt
12383 !! wikitext
12384 ==foo==<!---->
12385 ==bar==<!--c1-->
12386 ==baz==<!--
12387 c2
12388 c3-->
12389 !! html
12390 <h2><span class="mw-headline" id="foo">foo</span></h2>
12391 <h2><span class="mw-headline" id="bar">bar</span></h2>
12392 <h2><span class="mw-headline" id="baz">baz</span></h2>
12393
12394 !! end
12395
12396 !! test
12397 BUG 1219 URL next to image (broken)
12398 !! wikitext
12399 http://example.com[[Image:foobar.jpg]]
12400 !! html
12401 <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>
12402 </p>
12403 !!end
12404
12405 !! test
12406 Bug 1186 news: in the middle of text
12407 !! wikitext
12408 http://en.wikinews.org/wiki/Wikinews:Workplace
12409 !! html
12410 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
12411 </p>
12412 !!end
12413
12414
12415 !! test
12416 Namespaced link must have a title
12417 !! wikitext
12418 [[Project:]]
12419 !! html
12420 <p>[[Project:]]
12421 </p>
12422 !!end
12423
12424 !! test
12425 Namespaced link must have a title (bad fragment version)
12426 !! wikitext
12427 [[Project:#fragment]]
12428 !! html
12429 <p>[[Project:#fragment]]
12430 </p>
12431 !!end
12432
12433
12434 ###
12435 ### HTML tags and HTML attributes
12436 ###
12437
12438 !! test
12439 div with no attributes
12440 !! wikitext
12441 <div>HTML rocks</div>
12442 !! html
12443 <div>HTML rocks</div>
12444
12445 !! end
12446
12447 !! test
12448 div with double-quoted attribute
12449 !! wikitext
12450 <div id="rock">HTML rocks</div>
12451 !! html
12452 <div id="rock">HTML rocks</div>
12453
12454 !! end
12455
12456 !! test
12457 div with single-quoted attribute
12458 !! wikitext
12459 <div id='rock'>HTML rocks</div>
12460 !! html
12461 <div id="rock">HTML rocks</div>
12462
12463 !! end
12464
12465 !! test
12466 div with unquoted attribute
12467 !! wikitext
12468 <div id=rock>HTML rocks</div>
12469 !! html
12470 <div id="rock">HTML rocks</div>
12471
12472 !! end
12473
12474 !! test
12475 div with illegal double attributes
12476 !! wikitext
12477 <div id="a" id="b">HTML rocks</div>
12478 !! html
12479 <div id="b">HTML rocks</div>
12480
12481 !!end
12482
12483 # FIXME: produce empty string instead of "class" in the PHP parser, following
12484 # the HTML5 spec.
12485 !! test
12486 div with empty attribute value, space before equals
12487 !! options
12488 parsoid
12489 !! wikitext
12490 <div class =>HTML rocks</div>
12491 !! html
12492 <div class="">HTML rocks</div>
12493
12494 !! end
12495
12496 # The PHP parser escapes the opening brace to &#123; for some reason, so
12497 # disabled this test for it.
12498 !! test
12499 div with braces in attribute value
12500 !! options
12501 parsoid
12502 !! wikitext
12503 <div title="{}">Foo</div>
12504 !! html
12505 <div title="{}">Foo</div>
12506 !! end
12507
12508 # This it very inconsistent in the PHP parser: it returns
12509 # class="class" if there is a space between the name and the equal sign (see
12510 # 'div with empty attribute value, space before equals'), but strips the
12511 # attribute completely if the space is missing. We hope that not much content
12512 # depends on this, so are implementing the behavior below in Parsoid for
12513 # consistencies' sake. Disabled for the PHP parser.
12514 # FIXME: fix this behavior in the PHP parser?
12515 !! test
12516 div with empty attribute value, no space before equals
12517 !! options
12518 parsoid
12519 !! wikitext
12520 <div class=>HTML rocks</div>
12521 !! html
12522 <div class="">HTML rocks</div>
12523
12524 !! end
12525
12526 !! test
12527 HTML multiple attributes correction
12528 !! wikitext
12529 <p class="error" class="awesome">Awesome!</p>
12530 !! html
12531 <p class="awesome">Awesome!</p>
12532
12533 !!end
12534
12535 !! test
12536 Table multiple attributes correction
12537 !! wikitext
12538 {|
12539 !+ class="error" class="awesome"| status
12540 |}
12541 !! html
12542 <table>
12543 <tr>
12544 <th class="awesome"> status
12545 </th></tr></table>
12546
12547 !!end
12548
12549 !! test
12550 DIV IN UPPERCASE
12551 !! wikitext
12552 <DIV ID="x">HTML ROCKS</DIV>
12553 !! html
12554 <div id="x">HTML ROCKS</div>
12555
12556 !!end
12557
12558 !! test
12559 Non-ASCII pseudo-tags are rendered as text
12560 !! wikitext
12561 <khyô>
12562 !! html
12563 <p>&lt;khyô&gt;
12564 </p>
12565 !! end
12566
12567 !! test
12568 Pseudo-tag with URL 'name' renders as url link
12569 !! wikitext
12570 <http://example.com/>
12571 !! html
12572 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
12573 </p>
12574 !! end
12575
12576 !! test
12577 text with amp in the middle of nowhere
12578 !! wikitext
12579 Remember AT&T?
12580 !! html
12581 <p>Remember AT&amp;T?
12582 </p>
12583 !! end
12584
12585 !! test
12586 text with character entity: eacute
12587 !! wikitext
12588 I always thought &eacute; was a cute letter.
12589 !! html
12590 <p>I always thought &#233; was a cute letter.
12591 </p>
12592 !! end
12593
12594 !! test
12595 text with entity-escaped character entity-like string: eacute
12596 !! wikitext
12597 I always thought &amp;eacute; was a cute letter.
12598 !! html
12599 <p>I always thought &amp;eacute; was a cute letter.
12600 </p>
12601 !! end
12602
12603 !! test
12604 text with undefined character entity: xacute
12605 !! wikitext
12606 I always thought &xacute; was a cute letter.
12607 !! html
12608 <p>I always thought &amp;xacute; was a cute letter.
12609 </p>
12610 !! end
12611
12612 # TODO: generalize to PHP parser?
12613 !! test
12614 HTML5 tags
12615 !! options
12616 parsoid
12617 !! wikitext
12618 <data value="5">five</data>
12619 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12620 <mark>This highlighted text</mark>
12621 !! html
12622 <p><data value="5">five</data>
12623 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12624 <mark>This highlighted text</mark></p>
12625 !! end
12626
12627 !! test
12628 HTML tag with leading space is parsed as text
12629 !! wikitext
12630 < div>foo< /div>
12631 !! html
12632 <p>&lt; div&gt;foo&lt; /div&gt;
12633 </p>
12634 !! end
12635
12636 ###
12637 ### Nesting tests (see bug 41545, 50604, 51081)
12638 ###
12639
12640 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
12641 # Note that html2wt is considerably more difficult if we use <b> in
12642 # the test case, instead of <big>
12643 !! test
12644 Ensure that HTML adoption agency algorithm is properly implemented.
12645 !! wikitext
12646 <big>X<big>Y</big>Z</big>
12647 !! html
12648 <p><big>X<big>Y</big>Z</big>
12649 </p>
12650 !! end
12651
12652 # This was bug 41545 in the PHP parser.
12653 !! test
12654 Nesting of <kbd>
12655 !! wikitext
12656 <kbd>X<kbd>Y</kbd>Z</kbd>
12657 !! html
12658 <p><kbd>X<kbd>Y</kbd>Z</kbd>
12659 </p>
12660 !! end
12661
12662 # The following cases were bug 51081 in the PHP parser.
12663 # Note that there are some other nestable tags (b, i, etc) which are
12664 # not covered; see bug 51081 for discussion.
12665 !! test
12666 Nesting of <em>
12667 !! wikitext
12668 <em>X<em>Y</em>Z</em>
12669 !! html
12670 <p><em>X<em>Y</em>Z</em>
12671 </p>
12672 !! end
12673
12674 !! test
12675 Nesting of <strong>
12676 !! wikitext
12677 <strong>X<strong>Y</strong>Z</strong>
12678 !! html
12679 <p><strong>X<strong>Y</strong>Z</strong>
12680 </p>
12681 !! end
12682
12683 !! test
12684 Nesting of <q>
12685 !! wikitext
12686 <q>X<q>Y</q>Z</q>
12687 !! html
12688 <p><q>X<q>Y</q>Z</q>
12689 </p>
12690 !! end
12691
12692 !! test
12693 Nesting of <ruby>
12694 !! wikitext
12695 <ruby>X<ruby>Y</ruby>Z</ruby>
12696 !! html
12697 <p><ruby>X<ruby>Y</ruby>Z</ruby>
12698 </p>
12699 !! end
12700
12701 !! test
12702 Nesting of <bdo>
12703 !! wikitext
12704 <bdo>X<bdo>Y</bdo>Z</bdo>
12705 !! html
12706 <p><bdo>X<bdo>Y</bdo>Z</bdo>
12707 </p>
12708 !! end
12709
12710
12711 ###
12712 ### Media links
12713 ###
12714
12715 !! test
12716 Media link
12717 !! wikitext
12718 [[Media:Foobar.jpg]]
12719 !! html
12720 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
12721 </p>
12722 !! end
12723
12724 !! test
12725 Media link with text
12726 !! wikitext
12727 [[Media:Foobar.jpg|A neat file to look at]]
12728 !! html
12729 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
12730 </p>
12731 !! end
12732
12733 # FIXME: this is still bad HTML tag nesting
12734 !! test
12735 Media link with nasty text
12736 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
12737 !! wikitext
12738 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12739 !! html
12740 <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>
12741
12742 !! end
12743
12744 !! test
12745 Media link to nonexistent file (bug 1702)
12746 !! wikitext
12747 [[Media:No such.jpg]]
12748 !! html
12749 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12750 </p>
12751 !! end
12752
12753 !! test
12754 Image link to nonexistent file (bug 1850 - good)
12755 !! wikitext
12756 [[Image:No such.jpg]]
12757 !! html
12758 <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>
12759 </p>
12760 !! end
12761
12762 !! test
12763 :Image link to nonexistent file (bug 1850 - bad)
12764 !! wikitext
12765 [[:Image:No such.jpg]]
12766 !! html
12767 <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>
12768 </p>
12769 !! end
12770
12771
12772
12773 !! test
12774 Character reference normalization in link text (bug 1938)
12775 !! wikitext
12776 [[Main Page|this&that]]
12777 !! html
12778 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12779 </p>
12780 !!end
12781
12782 !! article
12783 אַ
12784 !! text
12785 Test for unicode normalization
12786
12787 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12788 !! endarticle
12789
12790 !! test
12791 (bug 19451) Links should refer to the normalized form.
12792 !! wikitext
12793 [[&#xFB2E;]]
12794 [[&#x5d0;&#x5b7;]]
12795 [[&#x5d0;ַ]]
12796 [[א&#x5b7;]]
12797 [[אַ]]
12798 !! html
12799 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12800 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12801 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12802 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12803 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12804 </p>
12805 !! end
12806
12807 !! test
12808 Empty attribute crash test (bug 2067)
12809 !! wikitext
12810 <font color="">foo</font>
12811 !! html
12812 <p><font color="">foo</font>
12813 </p>
12814 !! end
12815
12816 !! test
12817 Empty attribute crash test single-quotes (bug 2067)
12818 !! wikitext
12819 <font color=''>foo</font>
12820 !! html
12821 <p><font color="">foo</font>
12822 </p>
12823 !! end
12824
12825 !! test
12826 Attribute test: equals, then nothing
12827 !! wikitext
12828 <font color=>foo</font>
12829 !! html
12830 <p><font>foo</font>
12831 </p>
12832 !! end
12833
12834 !! test
12835 Attribute test: unquoted value
12836 !! wikitext
12837 <font color=x>foo</font>
12838 !! html
12839 <p><font color="x">foo</font>
12840 </p>
12841 !! end
12842
12843 !! test
12844 Attribute test: unquoted but illegal value (hash)
12845 !! wikitext
12846 <font color=#x>foo</font>
12847 !! html
12848 <p><font color="#x">foo</font>
12849 </p>
12850 !! end
12851
12852 !! test
12853 Attribute test: no value
12854 !! wikitext
12855 <font color>foo</font>
12856 !! html
12857 <p><font color="color">foo</font>
12858 </p>
12859 !! end
12860
12861 !! test
12862 Bug 2095: link with three closing brackets
12863 !! wikitext
12864 [[Main Page]]]
12865 !! html/php
12866 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12867 </p>
12868 !! html/parsoid
12869 <p><a rel="mw:WikiLink" href="./Main_Page">Main Page</a>]</p>
12870 !! end
12871
12872 !! test
12873 Bug 2095: link with pipe and three closing brackets
12874 !! wikitext
12875 [[Main Page|link]]]
12876 !! html/php
12877 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12878 </p>
12879 !! html/parsoid
12880 <p><a rel="mw:WikiLink" href="./Main_Page">link</a>]</p>
12881 !! end
12882
12883 !! test
12884 Bug 2095: link with pipe and three closing brackets, version 2
12885 !! wikitext
12886 [[Main Page|[http://example.com/]]]
12887 !! html/php
12888 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12889 </p>
12890 !! html/parsoid
12891 <p><a rel="mw:WikiLink" href="./Main_Page">[http://example.com/]</a></p>
12892 !! end
12893
12894
12895 ###
12896 ### Safety
12897 ###
12898
12899 !! article
12900 Template:Dangerous attribute
12901 !! text
12902 " onmouseover="alert(document.cookie)
12903 !! endarticle
12904
12905 !! article
12906 Template:Dangerous style attribute
12907 !! text
12908 border-size: expression(alert(document.cookie))
12909 !! endarticle
12910
12911 !! article
12912 Template:Div style
12913 !! text
12914 <div style="float: right; {{{1}}}">Magic div</div>
12915 !! endarticle
12916
12917 !! test
12918 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
12919 !! wikitext
12920 <div title="{{test}}"></div>
12921 !! html
12922 <div title="This is a test template"></div>
12923
12924 !! end
12925
12926 !! test
12927 Bug 2304: HTML attribute safety (dangerous template; 2309)
12928 !! wikitext
12929 <div title="{{dangerous attribute}}"></div>
12930 !! html
12931 <div title=""></div>
12932
12933 !! end
12934
12935 !! test
12936 Bug 2304: HTML attribute safety (dangerous style template; 2309)
12937 !! wikitext
12938 <div style="{{dangerous style attribute}}"></div>
12939 !! html
12940 <div style="/* insecure input */"></div>
12941
12942 !! end
12943
12944 !! test
12945 Bug 2304: HTML attribute safety (safe parameter; 2309)
12946 !! wikitext
12947 {{div style|width: 200px}}
12948 !! html
12949 <div style="float: right; width: 200px">Magic div</div>
12950
12951 !! end
12952
12953 !! test
12954 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
12955 !! wikitext
12956 {{div style|width: expression(alert(document.cookie))}}
12957 !! html
12958 <div style="/* insecure input */">Magic div</div>
12959
12960 !! end
12961
12962 !! test
12963 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
12964 !! wikitext
12965 {{div style|"><script>alert(document.cookie)</script>}}
12966 !! html
12967 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12968
12969 !! end
12970
12971 !! test
12972 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
12973 !! wikitext
12974 {{div style|" ><script>alert(document.cookie)</script>}}
12975 !! html
12976 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12977
12978 !! end
12979
12980 !! test
12981 Bug 2304: HTML attribute safety (link)
12982 !! wikitext
12983 <div title="[[Main Page]]"></div>
12984 !! html
12985 <div title="&#91;&#91;Main Page]]"></div>
12986
12987 !! end
12988
12989 !! test
12990 Bug 2304: HTML attribute safety (italics)
12991 !! wikitext
12992 <div title="''foobar''"></div>
12993 !! html
12994 <div title="&#39;&#39;foobar&#39;&#39;"></div>
12995
12996 !! end
12997
12998 !! test
12999 Bug 2304: HTML attribute safety (bold)
13000 !! wikitext
13001 <div title="'''foobar'''"></div>
13002 !! html
13003 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
13004
13005 !! end
13006
13007
13008 !! test
13009 Bug 2304: HTML attribute safety (ISBN)
13010 !! wikitext
13011 <div title="ISBN 1234567890"></div>
13012 !! html
13013 <div title="&#73;SBN 1234567890"></div>
13014
13015 !! end
13016
13017 !! test
13018 Bug 2304: HTML attribute safety (RFC)
13019 !! wikitext
13020 <div title="RFC 1234"></div>
13021 !! html
13022 <div title="&#82;FC 1234"></div>
13023
13024 !! end
13025
13026 !! test
13027 Bug 2304: HTML attribute safety (PMID)
13028 !! wikitext
13029 <div title="PMID 1234567890"></div>
13030 !! html
13031 <div title="&#80;MID 1234567890"></div>
13032
13033 !! end
13034
13035 !! test
13036 Bug 2304: HTML attribute safety (web link)
13037 !! wikitext
13038 <div title="http://example.com/"></div>
13039 !! html
13040 <div title="http&#58;//example.com/"></div>
13041
13042 !! end
13043
13044 !! test
13045 Bug 2304: HTML attribute safety (named web link)
13046 !! wikitext
13047 <div title="[http://example.com/ link]"></div>
13048 !! html
13049 <div title="&#91;http&#58;//example.com/ link]"></div>
13050
13051 !! end
13052
13053 !! test
13054 Bug 3244: HTML attribute safety (extension; safe)
13055 !! wikitext
13056 <div style="<nowiki>background:blue</nowiki>"></div>
13057 !! html
13058 <div style="background:blue"></div>
13059
13060 !! end
13061
13062 !! test
13063 Bug 3244: HTML attribute safety (extension; unsafe)
13064 !! wikitext
13065 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
13066 !! html
13067 <div style="/* insecure input */"></div>
13068
13069 !! end
13070
13071 # More MSIE fun discovered by Tom Gilder
13072
13073 !! test
13074 MSIE CSS safety test: spurious slash
13075 !! wikitext
13076 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
13077 !! html
13078 <div style="/* insecure input */">evil</div>
13079
13080 !! end
13081
13082 !! test
13083 MSIE CSS safety test: hex code
13084 !! wikitext
13085 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
13086 !! html
13087 <div style="/* insecure input */">evil</div>
13088
13089 !! end
13090
13091 !! test
13092 MSIE CSS safety test: comment in url
13093 !! wikitext
13094 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
13095 !! html
13096 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
13097
13098 !! end
13099
13100 !! test
13101 MSIE CSS safety test: comment in expression
13102 !! wikitext
13103 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
13104 !! html
13105 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
13106
13107 !! end
13108
13109 !! test
13110 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
13111 !! wikitext
13112 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
13113 !! html
13114 <p style="/* invalid control char */">A</p>
13115
13116 !! end
13117
13118 !! test
13119 MSIE 6 CSS safety test: Fullwidth (bug 55332)
13120 !! wikitext
13121 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
13122 <div style="top:EXPRESSION(alert())">B</div>
13123 !! html
13124 <p style="/* insecure input */">A</p>
13125 <div style="/* insecure input */">B</div>
13126
13127 !! end
13128
13129 !! test
13130 MSIE 6 CSS safety test: IPA extensions (bug 55332)
13131 !! wikitext
13132 <div style="background-image:uʀʟ(javascript:alert())">A</div>
13133 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
13134 !! html
13135 <div style="/* insecure input */">A</div>
13136 <p style="/* insecure input */">B</p>
13137
13138 !! end
13139
13140 !! test
13141 MSIE 6 CSS safety test: sup/sub script (bug 55332)
13142 !! wikitext
13143 <div style="background-image:url⁽javascript:alert())">A</div>
13144 <div style="background-image:url₍javascript:alert())">B</div>
13145 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
13146 !! html
13147 <div style="/* insecure input */">A</div>
13148 <div style="/* insecure input */">B</div>
13149 <p style="/* insecure input */">C</p>
13150
13151 !! end
13152
13153 !! test
13154 Opera -o-link CSS
13155 !! wikitext
13156 <div
13157 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;"
13158 style="-o-link:attr(title);-o-link-source:current">X</div>
13159 !! html
13160 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
13161
13162 !! end
13163
13164 !! test
13165 MSIE 6 CSS safety test: Repetition markers (bug 55332)
13166 !! wikitext
13167 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
13168 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
13169 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
13170 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
13171 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
13172 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
13173 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
13174 !! html
13175 <p style="/* insecure input */">A</p>
13176 <p style="/* insecure input */">B</p>
13177 <p style="/* insecure input */">C</p>
13178 <p style="/* insecure input */">D</p>
13179 <p style="/* insecure input */">E</p>
13180 <p style="/* insecure input */">F</p>
13181 <p style="/* insecure input */">G</p>
13182
13183 !! end
13184
13185 !! test
13186 Table attribute legitimate extension
13187 !! wikitext
13188 {|
13189 !+ style="<nowiki>color:blue</nowiki>"| status
13190 |}
13191 !! html
13192 <table>
13193 <tr>
13194 <th style="color:blue"> status
13195 </th></tr></table>
13196
13197 !!end
13198
13199 !! test
13200 Table attribute safety
13201 !! wikitext
13202 {|
13203 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
13204 |}
13205 !! html
13206 <table>
13207 <tr>
13208 <th style="/* insecure input */"> status
13209 </th></tr></table>
13210
13211 !! end
13212
13213 !! test
13214 CSS line continuation 1
13215 !! wikitext
13216 <div style="background-image: u\&#10;rl(test.jpg);"></div>
13217 !! html
13218 <div style="/* insecure input */"></div>
13219
13220 !! end
13221
13222 !! test
13223 CSS line continuation 2
13224 !! wikitext
13225 <div style="background-image: u\&#13;rl(test.jpg); "></div>
13226 !! html
13227 <div style="/* insecure input */"></div>
13228
13229 !! end
13230
13231 !! article
13232 Template:Identity
13233 !! text
13234 {{{1}}}
13235 !! endarticle
13236
13237 !! test
13238 Expansion of multi-line templates in attribute values (bug 6255)
13239 !! wikitext
13240 <div style="background: {{identity|#00FF00}}">-</div>
13241 !! html
13242 <div style="background: #00FF00">-</div>
13243
13244 !! end
13245
13246
13247 !! test
13248 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
13249 !! wikitext
13250 <div style="background:
13251 #00FF00">-</div>
13252 !! html
13253 <div style="background: #00FF00">-</div>
13254
13255 !! end
13256
13257 !! test
13258 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
13259 !! wikitext
13260 <div style="background: &#10;#00FF00">-</div>
13261 !! html
13262 <div style="background: &#10;#00FF00">-</div>
13263
13264 !! end
13265
13266 ###
13267 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
13268 ###
13269 !! test
13270 Parser hook: empty input
13271 !! wikitext
13272 <tag></tag>
13273 !! html
13274 <pre>
13275 ''
13276 array (
13277 )
13278 </pre>
13279
13280 !! end
13281
13282 !! test
13283 Parser hook: empty input using terminated empty elements
13284 !! wikitext
13285 <tag/>
13286 !! html
13287 <pre>
13288 NULL
13289 array (
13290 )
13291 </pre>
13292
13293 !! end
13294
13295 !! test
13296 Parser hook: empty input using terminated empty elements (space before)
13297 !! wikitext
13298 <tag />
13299 !! html
13300 <pre>
13301 NULL
13302 array (
13303 )
13304 </pre>
13305
13306 !! end
13307
13308 !! test
13309 Parser hook: basic input
13310 !! wikitext
13311 <tag>input</tag>
13312 !! html
13313 <pre>
13314 'input'
13315 array (
13316 )
13317 </pre>
13318
13319 !! end
13320
13321
13322 !! test
13323 Parser hook: case insensitive
13324 !! wikitext
13325 <TAG>input</TAG>
13326 !! html
13327 <pre>
13328 'input'
13329 array (
13330 )
13331 </pre>
13332
13333 !! end
13334
13335
13336 !! test
13337 Parser hook: case insensitive, redux
13338 !! wikitext
13339 <TaG>input</TAg>
13340 !! html
13341 <pre>
13342 'input'
13343 array (
13344 )
13345 </pre>
13346
13347 !! end
13348
13349 !! test
13350 Parser hook: nested tags
13351 !! options
13352 noxml
13353 !! wikitext
13354 <tag><tag></tag></tag>
13355 !! html
13356 <pre>
13357 '<tag>'
13358 array (
13359 )
13360 </pre>&lt;/tag&gt;
13361
13362 !! end
13363
13364 !! test
13365 Parser hook: basic arguments
13366 !! wikitext
13367 <tag width=200 height = "100" depth = '50' square></tag>
13368 !! html
13369 <pre>
13370 ''
13371 array (
13372 'width' => '200',
13373 'height' => '100',
13374 'depth' => '50',
13375 'square' => 'square',
13376 )
13377 </pre>
13378
13379 !! end
13380
13381 !! test
13382 Parser hook: argument containing a forward slash (bug 5344)
13383 !! wikitext
13384 <tag filename='/tmp/bla'></tag>
13385 !! html
13386 <pre>
13387 ''
13388 array (
13389 'filename' => '/tmp/bla',
13390 )
13391 </pre>
13392
13393 !! end
13394
13395 !! test
13396 Parser hook: empty input using terminated empty elements (bug 2374)
13397 !! wikitext
13398 <tag foo=bar/>text
13399 !! html
13400 <pre>
13401 NULL
13402 array (
13403 'foo' => 'bar',
13404 )
13405 </pre>text
13406
13407 !! end
13408
13409 # </tag> should be output literally since there is no matching tag that begins it
13410 !! test
13411 Parser hook: basic arguments using terminated empty elements (bug 2374)
13412 !! wikitext
13413 <tag width=200 height = "100" depth = '50' square/>
13414 other stuff
13415 </tag>
13416 !! html
13417 <pre>
13418 NULL
13419 array (
13420 'width' => '200',
13421 'height' => '100',
13422 'depth' => '50',
13423 'square' => 'square',
13424 )
13425 </pre>
13426 <p>other stuff
13427 &lt;/tag&gt;
13428 </p>
13429 !! end
13430
13431 ###
13432 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
13433 ###
13434
13435 !! test
13436 Parser hook: static parser hook not inside a comment
13437 !! wikitext
13438 <statictag>hello, world</statictag>
13439 <statictag action=flush/>
13440 !! html
13441 <p>hello, world
13442 </p>
13443 !! end
13444
13445
13446 !! test
13447 Parser hook: static parser hook inside a comment
13448 !! wikitext
13449 <!-- <statictag>hello, world</statictag> -->
13450 <statictag action=flush/>
13451 !! html
13452 <p><br />
13453 </p>
13454 !! end
13455
13456 # Nested template calls; this case was broken by Parser.php rev 1.506,
13457 # since reverted.
13458
13459 !! article
13460 Template:One-parameter
13461 !! text
13462 (My parameter is: {{{1}}})
13463 !! endarticle
13464
13465 !! article
13466 Template:Map-one-parameter
13467 !! text
13468 {{{{{1}}}|{{{2}}}}}
13469 !! endarticle
13470
13471 !! test
13472 Nested template calls
13473 !! wikitext
13474 {{Map-one-parameter|One-parameter|param}}
13475 !! html
13476 <p>(My parameter is: param)
13477 </p>
13478 !! end
13479
13480
13481 ###
13482 ### Sanitizer
13483 ###
13484 !! test
13485 Sanitizer: Closing of open tags
13486 !! wikitext
13487 <s></s><table></table>
13488 !! html
13489 <s></s><table></table>
13490
13491 !! end
13492
13493 !! test
13494 Sanitizer: Closing of open but not closed tags
13495 !! wikitext
13496 <s>foo
13497 !! html
13498 <p><s>foo</s>
13499 </p>
13500 !! end
13501
13502 !! test
13503 Sanitizer: Closing of closed but not open tags
13504 !! wikitext
13505 </s>
13506 !! html
13507 <p>&lt;/s&gt;
13508 </p>
13509 !! end
13510
13511 !! test
13512 Sanitizer: Closing of closed but not open table tags
13513 !! wikitext
13514 Table not started</td></tr></table>
13515 !! html
13516 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
13517 </p>
13518 !! end
13519
13520 !! test
13521 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
13522 !! wikitext
13523 <span id="æ: v">byte</span>[[#æ: v|backlink]]
13524 !! html
13525 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
13526 </p>
13527 !! end
13528
13529 !! test
13530 Sanitizer: Validating the contents of the id attribute (bug 4515)
13531 !! options
13532 disabled
13533 !! wikitext
13534 <br id=9 />
13535 !! html
13536 Something, but definitely not <br id="9" />...
13537 !! end
13538
13539 !! test
13540 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
13541 !! options
13542 disabled
13543 !! wikitext
13544 <br id="foo" /><br id="foo" />
13545 !! html
13546 Something need to be done. foo-2 ?
13547 !! end
13548
13549 !! test
13550 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
13551 !! wikitext
13552 <div itemscope>
13553 <meta itemprop="hello" content="world">
13554 <meta http-equiv="refresh" content="5">
13555 <meta itemprop="hello" http-equiv="refresh" content="5">
13556 <link itemprop="hello" href="{{SERVER}}">
13557 <link rel="stylesheet" href="{{SERVER}}">
13558 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
13559 </div>
13560 !! html
13561 <div itemscope="itemscope">
13562 <p> <meta itemprop="hello" content="world" />
13563 &lt;meta http-equiv="refresh" content="5"&gt;
13564 <meta itemprop="hello" content="5" />
13565 </p>
13566 <link itemprop="hello" href="http&#58;//example.org" />
13567 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
13568 <link itemprop="hello" href="http&#58;//example.org" />
13569 </div>
13570
13571 !! end
13572
13573 !! test
13574 Language converter: output gets cut off unexpectedly (bug 5757)
13575 !! options
13576 language=zh
13577 !! wikitext
13578 this bit is safe: }-
13579
13580 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
13581
13582 then we get cut off here: }-
13583
13584 all additional text is vanished
13585 !! html
13586 <p>this bit is safe: }-
13587 </p><p>but if we add a conversion instance: xxx
13588 </p><p>then we get cut off here: }-
13589 </p><p>all additional text is vanished
13590 </p>
13591 !! end
13592
13593 !! test
13594 Self closed html pairs (bug 5487)
13595 !! options
13596 !! wikitext
13597 <center><font id="bug" />Centered text</center>
13598 <div><font id="bug2" />In div text</div>
13599 !! html
13600 <center>&lt;font id="bug" /&gt;Centered text</center>
13601 <div>&lt;font id="bug2" /&gt;In div text</div>
13602
13603 !! end
13604
13605 #
13606 #
13607 #
13608
13609 !! test
13610 Punctuation: nbsp before exclamation
13611 !! wikitext
13612 C'est grave !
13613 !! html
13614 <p>C'est grave&#160;!
13615 </p>
13616 !! end
13617
13618 !! test
13619 Punctuation: CSS !important (bug 11874)
13620 !! wikitext
13621 <div style="width:50% !important">important</div>
13622 !! html
13623 <div style="width:50% !important">important</div>
13624
13625 !!end
13626
13627 !! test
13628 Punctuation: CSS ! important (bug 11874; with space after)
13629 !! wikitext
13630 <div style="width:50% ! important">important</div>
13631 !! html
13632 <div style="width:50% ! important">important</div>
13633
13634 !!end
13635
13636
13637 !! test
13638 HTML bullet list, closed tags (bug 5497)
13639 !! wikitext
13640 <ul>
13641 <li>One</li>
13642 <li>Two</li>
13643 </ul>
13644 !! html
13645 <ul>
13646 <li>One</li>
13647 <li>Two</li>
13648 </ul>
13649
13650 !! end
13651
13652 !! test
13653 HTML bullet list, unclosed tags (bug 5497)
13654 !! options
13655 disabled
13656 !! wikitext
13657 <ul>
13658 <li>One
13659 <li>Two
13660 </ul>
13661 !! html
13662 <ul>
13663 <li>One
13664 </li>
13665 <li>Two
13666 </li>
13667 </ul>
13668
13669 !! end
13670
13671 !! test
13672 HTML ordered list, closed tags (bug 5497)
13673 !! wikitext
13674 <ol>
13675 <li>One</li>
13676 <li>Two</li>
13677 </ol>
13678 !! html
13679 <ol>
13680 <li>One</li>
13681 <li>Two</li>
13682 </ol>
13683
13684 !! end
13685
13686 !! test
13687 HTML ordered list, unclosed tags (bug 5497)
13688 !! options
13689 disabled
13690 !! wikitext
13691 <ol>
13692 <li>One
13693 <li>Two
13694 </ol>
13695 !! html
13696 <ol>
13697 <li>One
13698 </li>
13699 <li>Two
13700 </li>
13701 </ol>
13702
13703 !! end
13704
13705 !! test
13706 HTML nested bullet list, closed tags (bug 5497)
13707 !! wikitext
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 !! html
13718 <ul>
13719 <li>One</li>
13720 <li>Two:
13721 <ul>
13722 <li>Sub-one</li>
13723 <li>Sub-two</li>
13724 </ul>
13725 </li>
13726 </ul>
13727
13728 !! end
13729
13730 !! test
13731 HTML nested bullet list, open tags (bug 5497)
13732 !! options
13733 disabled
13734 !! wikitext
13735 <ul>
13736 <li>One
13737 <li>Two:
13738 <ul>
13739 <li>Sub-one
13740 <li>Sub-two
13741 </ul>
13742 </ul>
13743 !! html
13744 <ul>
13745 <li>One
13746 </li>
13747 <li>Two:
13748 <ul>
13749 <li>Sub-one
13750 </li>
13751 <li>Sub-two
13752 </li>
13753 </ul>
13754 </li>
13755 </ul>
13756
13757 !! end
13758
13759 !! test
13760 HTML nested ordered list, closed tags (bug 5497)
13761 !! wikitext
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 !! html
13772 <ol>
13773 <li>One</li>
13774 <li>Two:
13775 <ol>
13776 <li>Sub-one</li>
13777 <li>Sub-two</li>
13778 </ol>
13779 </li>
13780 </ol>
13781
13782 !! end
13783
13784 !! test
13785 HTML nested ordered list, open tags (bug 5497)
13786 !! options
13787 disabled
13788 !! wikitext
13789 <ol>
13790 <li>One
13791 <li>Two:
13792 <ol>
13793 <li>Sub-one
13794 <li>Sub-two
13795 </ol>
13796 </ol>
13797 !! html
13798 <ol>
13799 <li>One
13800 </li>
13801 <li>Two:
13802 <ol>
13803 <li>Sub-one
13804 </li>
13805 <li>Sub-two
13806 </li>
13807 </ol>
13808 </li>
13809 </ol>
13810
13811 !! end
13812
13813 !! test
13814 HTML ordered list item with parameters oddity
13815 !! wikitext
13816 <ol><li id="fragment">One</li>
13817 </ol>
13818 !! html
13819 <ol><li id="fragment">One</li>
13820 </ol>
13821
13822 !! end
13823
13824 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
13825 !!test
13826 bug 5918: autonumbering
13827 !! wikitext
13828 [http://first/] [http://second] [ftp://ftp]
13829
13830 ftp://inlineftp
13831
13832 [mailto:enclosed@mail.tld With target]
13833
13834 [mailto:enclosed@mail.tld]
13835
13836 mailto:inline@mail.tld
13837 !! html/php
13838 <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>
13839 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13840 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13841 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13842 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13843 </p>
13844 !! html/parsoid
13845 <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>
13846 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
13847 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
13848 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
13849 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
13850 !! end
13851
13852
13853 #
13854 # Security and HTML correctness
13855 # From Nick Jenkins' fuzz testing
13856 #
13857
13858 !! test
13859 Fuzz testing: Parser13
13860 !! wikitext
13861 {|
13862 | http://a|
13863 !! html
13864 <table>
13865 <tr>
13866 <td>
13867 </td>
13868 </tr>
13869 </table>
13870
13871 !! end
13872
13873 !! test
13874 Fuzz testing: Parser14
13875 !! wikitext
13876 == onmouseover= ==
13877 http://__TOC__
13878 !! html
13879 <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>
13880 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13881 <ul>
13882 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13883 </ul>
13884 </div>
13885
13886
13887 !! end
13888
13889 !! test
13890 Fuzz testing: Parser14-table
13891 !! wikitext
13892 ==a==
13893 {| STYLE=__TOC__
13894 !! html
13895 <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>
13896 <table style="&#95;_TOC&#95;_">
13897 <tr><td></td></tr>
13898 </table>
13899
13900 !! end
13901
13902 # Known to produce bogus xml (extra </td>)
13903 !! test
13904 Fuzz testing: Parser16
13905 !! options
13906 noxml
13907 !! wikitext
13908 {|
13909 !https://||||||
13910 !! html
13911 <table>
13912 <tr>
13913 <th>https://</th>
13914 <th></th>
13915 <th></th>
13916 <th>
13917 </td>
13918 </tr>
13919 </table>
13920
13921 !! end
13922
13923 !! test
13924 Fuzz testing: Parser21
13925 !! wikitext
13926 {|
13927 ! irc://{{ftp://a" onmouseover="alert('hello world');"
13928 |
13929 !! html
13930 <table>
13931 <tr>
13932 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
13933 </th>
13934 <td>
13935 </td>
13936 </tr>
13937 </table>
13938
13939 !! end
13940
13941 !! test
13942 Fuzz testing: Parser22
13943 !! wikitext
13944 http://===r:::https://b
13945
13946 {|
13947 !! html
13948 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
13949 </p>
13950 <table>
13951 <tr><td></td></tr>
13952 </table>
13953
13954 !! end
13955
13956 # Known to produce bad XML for now
13957 !! test
13958 Fuzz testing: Parser24
13959 !! options
13960 noxml
13961 !! wikitext
13962 {|
13963 {{{|
13964 <u CLASS=
13965 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
13966 <br style="onmouseover='alert(document.cookie);' " />
13967
13968 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13969 |
13970 !! html
13971 <table>
13972 {{{|
13973 <u class="&#124;">}}}} &gt;
13974 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
13975
13976 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13977 <tr>
13978 <td></u>
13979 </td>
13980 </tr>
13981 </table>
13982
13983 !! end
13984
13985 # Note: the current result listed for this is not what the original one was,
13986 # but the original bug was JavaScript injection, which is fixed in any case.
13987 # It's not clear that the original result listed was any more correct than the
13988 # current one. Original result:
13989 # <p>{{{|
13990 # </p>
13991 # <li class="&#124;&#124;">
13992 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13993 !!test
13994 Fuzz testing: Parser25 (bug 6055)
13995 !! wikitext
13996 {{{
13997 |
13998 <LI CLASS=||
13999 >
14000 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
14001 !! html
14002 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14003 </p>
14004 !! end
14005
14006 !!test
14007 Fuzz testing: URL adjacent extension (with space, clean)
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; nowiki)
14018 !! options
14019 !! wikitext
14020 http://example.com<nowiki>junk</nowiki>
14021 !! html
14022 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
14023 </p>
14024 !!end
14025
14026 !!test
14027 Fuzz testing: URL adjacent extension (no space, dirty; pre)
14028 !! options
14029 !! wikitext
14030 http://example.com<pre>junk</pre>
14031 !! html
14032 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
14033
14034 !!end
14035
14036 !!test
14037 Fuzz testing: image with bogus manual thumbnail
14038 !! wikitext
14039 [[Image:foobar.jpg|thumbnail= ]]
14040 !! html/php
14041 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
14042
14043 !! html/parsoid
14044 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
14045 !!end
14046
14047 !! test
14048 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
14049 !! wikitext
14050 <pre dir="&#10;"></pre>
14051 !! html
14052 <pre dir="&#10;"></pre>
14053
14054 !! end
14055
14056 !! test
14057 Parsing optional HTML elements (Bug 6171)
14058 !! options
14059 !! wikitext
14060 <table>
14061 <tr>
14062 <td> Some tabular data</td>
14063 <td> More tabular data ...
14064 <td> And yet som tabular data</td>
14065 </tr>
14066 </table>
14067 !! html
14068 <table>
14069 <tr>
14070 <td> Some tabular data</td>
14071 <td> More tabular data ...
14072 </td><td> And yet som tabular data</td>
14073 </tr>
14074 </table>
14075
14076 !! end
14077
14078 !! test
14079 Correct handling of <td>, <tr> (Bug 6171)
14080 !! options
14081 !! wikitext
14082 <table>
14083 <tr>
14084 <td> Some tabular data</td>
14085 <td> More tabular data ...</td>
14086 <td> And yet som tabular data</td>
14087 </tr>
14088 </table>
14089 !! html
14090 <table>
14091 <tr>
14092 <td> Some tabular data</td>
14093 <td> More tabular data ...</td>
14094 <td> And yet som tabular data</td>
14095 </tr>
14096 </table>
14097
14098 !! end
14099
14100
14101 !! test
14102 Parsing crashing regression (fr:JavaScript)
14103 !! wikitext
14104 </body></x>
14105 !! html
14106 <p>&lt;/body&gt;&lt;/x&gt;
14107 </p>
14108 !! end
14109
14110 !! test
14111 Inline wiki vs wiki block nesting
14112 !! wikitext
14113 '''Bold paragraph
14114
14115 New wiki paragraph
14116 !! html
14117 <p><b>Bold paragraph</b>
14118 </p><p>New wiki paragraph
14119 </p>
14120 !! end
14121
14122 !! test
14123 Inline HTML vs wiki block nesting
14124 !! options
14125 disabled
14126 !! wikitext
14127 <b>Bold paragraph
14128
14129 New wiki paragraph
14130 !! html
14131 <p><b>Bold paragraph</b>
14132 </p><p>New wiki paragraph
14133 </p>
14134 !! end
14135
14136 # Original result was this:
14137 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
14138 # </p>
14139 # While that might be marginally more intuitive, maybe, the six-apostrophe
14140 # construct is clearly pathological and the result stated here (which is what
14141 # the parser actually does) is about as reasonable as anything.
14142 !!test
14143 Mixing markup for italics and bold
14144 !! options
14145 !! wikitext
14146 '''bold''''''bold''bolditalics'''''
14147 !! html
14148 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
14149 </p>
14150 !! end
14151
14152
14153 !! article
14154 Xyzzyx
14155 !! text
14156 Article for special page transclusion test
14157 !! endarticle
14158
14159 !! test
14160 Special page transclusion
14161 !! options
14162 !! wikitext
14163 {{Special:Prefixindex/Xyzzyx}}
14164 !! html
14165 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14166
14167 !! end
14168
14169 !! test
14170 Special page transclusion twice (bug 5021)
14171 !! options
14172 !! wikitext
14173 {{Special:Prefixindex/Xyzzyx}}
14174 {{Special:Prefixindex/Xyzzyx}}
14175 !! html
14176 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14177 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14178
14179 !! end
14180
14181 !! test
14182 Transclusion of default MediaWiki message
14183 !! wikitext
14184 {{MediaWiki:Mainpage}}
14185 !! html
14186 <p>Main Page
14187 </p>
14188 !! end
14189
14190 !! test
14191 Transclusion of nonexistent MediaWiki message
14192 !! wikitext
14193 {{MediaWiki:Mainpagexxx}}
14194 !! html
14195 <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>
14196 </p>
14197 !! end
14198
14199 !! test
14200 Transclusion of MediaWiki message with underscore
14201 !! wikitext
14202 {{MediaWiki:history_short}}
14203 !! html
14204 <p>History
14205 </p>
14206 !! end
14207
14208 !! test
14209 Transclusion of MediaWiki message with space
14210 !! wikitext
14211 {{MediaWiki:history short}}
14212 !! html
14213 <p>History
14214 </p>
14215 !! end
14216
14217 !! test
14218 Invalid header with following text
14219 !! wikitext
14220 = x = y
14221 !! html
14222 <p>= x = y
14223 </p>
14224 !! end
14225
14226
14227 !! test
14228 Section extraction test (section 0)
14229 !! options
14230 section=0
14231 !! wikitext
14232 start
14233 ==a==
14234 ===aa===
14235 ====aaa====
14236 ==b==
14237 ===ba===
14238 ===bb===
14239 ====bba====
14240 ===bc===
14241 ==c==
14242 ===ca===
14243 !! html
14244 start
14245 !! end
14246
14247 !! test
14248 Section extraction test (section 1)
14249 !! options
14250 section=1
14251 !! wikitext
14252 start
14253 ==a==
14254 ===aa===
14255 ====aaa====
14256 ==b==
14257 ===ba===
14258 ===bb===
14259 ====bba====
14260 ===bc===
14261 ==c==
14262 ===ca===
14263 !! html
14264 ==a==
14265 ===aa===
14266 ====aaa====
14267 !! end
14268
14269 !! test
14270 Section extraction test (section 2)
14271 !! options
14272 section=2
14273 !! wikitext
14274 start
14275 ==a==
14276 ===aa===
14277 ====aaa====
14278 ==b==
14279 ===ba===
14280 ===bb===
14281 ====bba====
14282 ===bc===
14283 ==c==
14284 ===ca===
14285 !! html
14286 ===aa===
14287 ====aaa====
14288 !! end
14289
14290 !! test
14291 Section extraction test (section 3)
14292 !! options
14293 section=3
14294 !! wikitext
14295 start
14296 ==a==
14297 ===aa===
14298 ====aaa====
14299 ==b==
14300 ===ba===
14301 ===bb===
14302 ====bba====
14303 ===bc===
14304 ==c==
14305 ===ca===
14306 !! html
14307 ====aaa====
14308 !! end
14309
14310 !! test
14311 Section extraction test (section 4)
14312 !! options
14313 section=4
14314 !! wikitext
14315 start
14316 ==a==
14317 ===aa===
14318 ====aaa====
14319 ==b==
14320 ===ba===
14321 ===bb===
14322 ====bba====
14323 ===bc===
14324 ==c==
14325 ===ca===
14326 !! html
14327 ==b==
14328 ===ba===
14329 ===bb===
14330 ====bba====
14331 ===bc===
14332 !! end
14333
14334 !! test
14335 Section extraction test (section 5)
14336 !! options
14337 section=5
14338 !! wikitext
14339 start
14340 ==a==
14341 ===aa===
14342 ====aaa====
14343 ==b==
14344 ===ba===
14345 ===bb===
14346 ====bba====
14347 ===bc===
14348 ==c==
14349 ===ca===
14350 !! html
14351 ===ba===
14352 !! end
14353
14354 !! test
14355 Section extraction test (section 6)
14356 !! options
14357 section=6
14358 !! wikitext
14359 start
14360 ==a==
14361 ===aa===
14362 ====aaa====
14363 ==b==
14364 ===ba===
14365 ===bb===
14366 ====bba====
14367 ===bc===
14368 ==c==
14369 ===ca===
14370 !! html
14371 ===bb===
14372 ====bba====
14373 !! end
14374
14375 !! test
14376 Section extraction test (section 7)
14377 !! options
14378 section=7
14379 !! wikitext
14380 start
14381 ==a==
14382 ===aa===
14383 ====aaa====
14384 ==b==
14385 ===ba===
14386 ===bb===
14387 ====bba====
14388 ===bc===
14389 ==c==
14390 ===ca===
14391 !! html
14392 ====bba====
14393 !! end
14394
14395 !! test
14396 Section extraction test (section 8)
14397 !! options
14398 section=8
14399 !! wikitext
14400 start
14401 ==a==
14402 ===aa===
14403 ====aaa====
14404 ==b==
14405 ===ba===
14406 ===bb===
14407 ====bba====
14408 ===bc===
14409 ==c==
14410 ===ca===
14411 !! html
14412 ===bc===
14413 !! end
14414
14415 !! test
14416 Section extraction test (section 9)
14417 !! options
14418 section=9
14419 !! wikitext
14420 start
14421 ==a==
14422 ===aa===
14423 ====aaa====
14424 ==b==
14425 ===ba===
14426 ===bb===
14427 ====bba====
14428 ===bc===
14429 ==c==
14430 ===ca===
14431 !! html
14432 ==c==
14433 ===ca===
14434 !! end
14435
14436 !! test
14437 Section extraction test (section 10)
14438 !! options
14439 section=10
14440 !! wikitext
14441 start
14442 ==a==
14443 ===aa===
14444 ====aaa====
14445 ==b==
14446 ===ba===
14447 ===bb===
14448 ====bba====
14449 ===bc===
14450 ==c==
14451 ===ca===
14452 !! html
14453 ===ca===
14454 !! end
14455
14456 !! test
14457 Section extraction test (nonexistent section 11)
14458 !! options
14459 section=11
14460 !! wikitext
14461 start
14462 ==a==
14463 ===aa===
14464 ====aaa====
14465 ==b==
14466 ===ba===
14467 ===bb===
14468 ====bba====
14469 ===bc===
14470 ==c==
14471 ===ca===
14472 !! html
14473 !! end
14474
14475 !! test
14476 Section extraction test with bogus heading (section 1)
14477 !! options
14478 section=1
14479 !! wikitext
14480 ==a==
14481 ==bogus== not a legal section
14482 ==b==
14483 !! html
14484 ==a==
14485 ==bogus== not a legal section
14486 !! end
14487
14488 !! test
14489 Section extraction test with bogus heading (section 2)
14490 !! options
14491 section=2
14492 !! wikitext
14493 ==a==
14494 ==bogus== not a legal section
14495 ==b==
14496 !! html
14497 ==b==
14498 !! end
14499
14500 !! test
14501 Section extraction test with comment after heading (section 1)
14502 !! options
14503 section=1
14504 !! wikitext
14505 ==a==
14506 ==b== <!-- -->
14507 ==c==
14508 !! html
14509 ==a==
14510 !! end
14511
14512 !! test
14513 Section extraction test with comment after heading (section 2)
14514 !! options
14515 section=2
14516 !! wikitext
14517 ==a==
14518 ==b== <!-- -->
14519 ==c==
14520 !! html
14521 ==b== <!-- -->
14522 !! end
14523
14524 !! test
14525 Section extraction test with bogus <nowiki> heading (section 1)
14526 !! options
14527 section=1
14528 !! wikitext
14529 ==a==
14530 ==bogus== <nowiki>not a legal section</nowiki>
14531 ==b==
14532 !! html
14533 ==a==
14534 ==bogus== <nowiki>not a legal section</nowiki>
14535 !! end
14536
14537 !! test
14538 Section extraction test with bogus <nowiki> heading (section 2)
14539 !! options
14540 section=2
14541 !! wikitext
14542 ==a==
14543 ==bogus== <nowiki>not a legal section</nowiki>
14544 ==b==
14545 !! html
14546 ==b==
14547 !! end
14548
14549
14550 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
14551 # instead of respecting commented sections
14552 !! test
14553 Section extraction prefixed by comment (section 1)
14554 !! options
14555 section=1
14556 !! wikitext
14557 <!-- -->==sec1==
14558 ==sec2==
14559 !! html
14560 ==sec2==
14561 !!end
14562
14563 !! test
14564 Section extraction prefixed by comment (section 2)
14565 !! options
14566 section=2
14567 !! wikitext
14568 <!-- -->==sec1==
14569 ==sec2==
14570 !! html
14571
14572 !!end
14573
14574
14575 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
14576 # instead of respecting HTML-style headings
14577 !! test
14578 Section extraction, mixed wiki and html (section 1)
14579 !! options
14580 section=1
14581 !! wikitext
14582 <h2>unmarked</h2>
14583 unmarked
14584 ==1==
14585 one
14586 ==2==
14587 two
14588 !! html
14589 ==1==
14590 one
14591 !! end
14592
14593 !! test
14594 Section extraction, mixed wiki and html (section 2)
14595 !! options
14596 section=2
14597 !! wikitext
14598 <h2>unmarked</h2>
14599 unmarked
14600 ==1==
14601 one
14602 ==2==
14603 two
14604 !! html
14605 ==2==
14606 two
14607 !! end
14608
14609
14610 # Formerly testing for bug 3342
14611 !! test
14612 Section extraction, heading surrounded by <noinclude>
14613 !! options
14614 section=1
14615 !! wikitext
14616 <noinclude>==unmarked==</noinclude>
14617 ==marked==
14618 !! html
14619 ==marked==
14620 !!end
14621
14622 # Test behavior of bug 19910
14623 !! test
14624 Sectiion with all-equals
14625 !! options
14626 section=2
14627 !! wikitext
14628 ===
14629 The line above must have a trailing space
14630 === <!--
14631 --> <!-- -->
14632 But just in case it doesn't...
14633 !! html
14634 === <!--
14635 --> <!-- -->
14636 But just in case it doesn't...
14637 !! end
14638
14639 !! test
14640 Section replacement test (section 0)
14641 !! options
14642 replace=0,"xxx"
14643 !! wikitext
14644 start
14645 ==a==
14646 ===aa===
14647 ====aaa====
14648 ==b==
14649 ===ba===
14650 ===bb===
14651 ====bba====
14652 ===bc===
14653 ==c==
14654 ===ca===
14655 !! html
14656 xxx
14657
14658 ==a==
14659 ===aa===
14660 ====aaa====
14661 ==b==
14662 ===ba===
14663 ===bb===
14664 ====bba====
14665 ===bc===
14666 ==c==
14667 ===ca===
14668 !! end
14669
14670 !! test
14671 Section replacement test (section 1)
14672 !! options
14673 replace=1,"xxx"
14674 !! wikitext
14675 start
14676 ==a==
14677 ===aa===
14678 ====aaa====
14679 ==b==
14680 ===ba===
14681 ===bb===
14682 ====bba====
14683 ===bc===
14684 ==c==
14685 ===ca===
14686 !! html
14687 start
14688 xxx
14689
14690 ==b==
14691 ===ba===
14692 ===bb===
14693 ====bba====
14694 ===bc===
14695 ==c==
14696 ===ca===
14697 !! end
14698
14699 !! test
14700 Section replacement test (section 2)
14701 !! options
14702 replace=2,"xxx"
14703 !! wikitext
14704 start
14705 ==a==
14706 ===aa===
14707 ====aaa====
14708 ==b==
14709 ===ba===
14710 ===bb===
14711 ====bba====
14712 ===bc===
14713 ==c==
14714 ===ca===
14715 !! html
14716 start
14717 ==a==
14718 xxx
14719
14720 ==b==
14721 ===ba===
14722 ===bb===
14723 ====bba====
14724 ===bc===
14725 ==c==
14726 ===ca===
14727 !! end
14728
14729 !! test
14730 Section replacement test (section 3)
14731 !! options
14732 replace=3,"xxx"
14733 !! wikitext
14734 start
14735 ==a==
14736 ===aa===
14737 ====aaa====
14738 ==b==
14739 ===ba===
14740 ===bb===
14741 ====bba====
14742 ===bc===
14743 ==c==
14744 ===ca===
14745 !! html
14746 start
14747 ==a==
14748 ===aa===
14749 xxx
14750
14751 ==b==
14752 ===ba===
14753 ===bb===
14754 ====bba====
14755 ===bc===
14756 ==c==
14757 ===ca===
14758 !! end
14759
14760 !! test
14761 Section replacement test (section 4)
14762 !! options
14763 replace=4,"xxx"
14764 !! wikitext
14765 start
14766 ==a==
14767 ===aa===
14768 ====aaa====
14769 ==b==
14770 ===ba===
14771 ===bb===
14772 ====bba====
14773 ===bc===
14774 ==c==
14775 ===ca===
14776 !! html
14777 start
14778 ==a==
14779 ===aa===
14780 ====aaa====
14781 xxx
14782
14783 ==c==
14784 ===ca===
14785 !! end
14786
14787 !! test
14788 Section replacement test (section 5)
14789 !! options
14790 replace=5,"xxx"
14791 !! wikitext
14792 start
14793 ==a==
14794 ===aa===
14795 ====aaa====
14796 ==b==
14797 ===ba===
14798 ===bb===
14799 ====bba====
14800 ===bc===
14801 ==c==
14802 ===ca===
14803 !! html
14804 start
14805 ==a==
14806 ===aa===
14807 ====aaa====
14808 ==b==
14809 xxx
14810
14811 ===bb===
14812 ====bba====
14813 ===bc===
14814 ==c==
14815 ===ca===
14816 !! end
14817
14818 !! test
14819 Section replacement test (section 6)
14820 !! options
14821 replace=6,"xxx"
14822 !! wikitext
14823 start
14824 ==a==
14825 ===aa===
14826 ====aaa====
14827 ==b==
14828 ===ba===
14829 ===bb===
14830 ====bba====
14831 ===bc===
14832 ==c==
14833 ===ca===
14834 !! html
14835 start
14836 ==a==
14837 ===aa===
14838 ====aaa====
14839 ==b==
14840 ===ba===
14841 xxx
14842
14843 ===bc===
14844 ==c==
14845 ===ca===
14846 !! end
14847
14848 !! test
14849 Section replacement test (section 7)
14850 !! options
14851 replace=7,"xxx"
14852 !! wikitext
14853 start
14854 ==a==
14855 ===aa===
14856 ====aaa====
14857 ==b==
14858 ===ba===
14859 ===bb===
14860 ====bba====
14861 ===bc===
14862 ==c==
14863 ===ca===
14864 !! html
14865 start
14866 ==a==
14867 ===aa===
14868 ====aaa====
14869 ==b==
14870 ===ba===
14871 ===bb===
14872 xxx
14873
14874 ===bc===
14875 ==c==
14876 ===ca===
14877 !! end
14878
14879 !! test
14880 Section replacement test (section 8)
14881 !! options
14882 replace=8,"xxx"
14883 !! wikitext
14884 start
14885 ==a==
14886 ===aa===
14887 ====aaa====
14888 ==b==
14889 ===ba===
14890 ===bb===
14891 ====bba====
14892 ===bc===
14893 ==c==
14894 ===ca===
14895 !! html
14896 start
14897 ==a==
14898 ===aa===
14899 ====aaa====
14900 ==b==
14901 ===ba===
14902 ===bb===
14903 ====bba====
14904 xxx
14905
14906 ==c==
14907 ===ca===
14908 !!end
14909
14910 !! test
14911 Section replacement test (section 9)
14912 !! options
14913 replace=9,"xxx"
14914 !! wikitext
14915 start
14916 ==a==
14917 ===aa===
14918 ====aaa====
14919 ==b==
14920 ===ba===
14921 ===bb===
14922 ====bba====
14923 ===bc===
14924 ==c==
14925 ===ca===
14926 !! html
14927 start
14928 ==a==
14929 ===aa===
14930 ====aaa====
14931 ==b==
14932 ===ba===
14933 ===bb===
14934 ====bba====
14935 ===bc===
14936 xxx
14937 !! end
14938
14939 !! test
14940 Section replacement test (section 10)
14941 !! options
14942 replace=10,"xxx"
14943 !! wikitext
14944 start
14945 ==a==
14946 ===aa===
14947 ====aaa====
14948 ==b==
14949 ===ba===
14950 ===bb===
14951 ====bba====
14952 ===bc===
14953 ==c==
14954 ===ca===
14955 !! html
14956 start
14957 ==a==
14958 ===aa===
14959 ====aaa====
14960 ==b==
14961 ===ba===
14962 ===bb===
14963 ====bba====
14964 ===bc===
14965 ==c==
14966 xxx
14967 !! end
14968
14969 !! test
14970 Section replacement test with initial whitespace (bug 13728)
14971 !! options
14972 replace=2,"xxx"
14973 !! wikitext
14974 Preformatted initial line
14975 ==a==
14976 ===a===
14977 !! html
14978 Preformatted initial line
14979 ==a==
14980 xxx
14981 !! end
14982
14983
14984 !! test
14985 Section extraction, heading followed by pre with 20 spaces (bug 6398)
14986 !! options
14987 section=1
14988 !! wikitext
14989 ==a==
14990 a
14991 !! html
14992 ==a==
14993 a
14994 !! end
14995
14996 !! test
14997 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
14998 !! options
14999 section=1
15000 !! wikitext
15001 ==a==
15002 a
15003 !! html
15004 ==a==
15005 a
15006 !! end
15007
15008
15009 !! test
15010 Section extraction, <pre> around bogus header (bug 10309)
15011 !! options
15012 noxml section=2
15013 !! wikitext
15014 == Section One ==
15015 <pre>
15016 =======
15017 </pre>
15018
15019 == Section Two ==
15020 stuff
15021 !! html
15022 == Section Two ==
15023 stuff
15024 !! end
15025
15026 !! test
15027 Section replacement, <pre> around bogus header (bug 10309)
15028 !! options
15029 noxml replace=2,"xxx"
15030 !! wikitext
15031 == Section One ==
15032 <pre>
15033 =======
15034 </pre>
15035
15036 == Section Two ==
15037 stuff
15038 !! html
15039 == Section One ==
15040 <pre>
15041 =======
15042 </pre>
15043
15044 xxx
15045 !! end
15046
15047
15048
15049 !! test
15050 Handling of &#x0A; in URLs
15051 !! wikitext
15052 ** irc://&#x0A;a
15053 !! html/php
15054 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15055
15056 !! html/parsoid
15057 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
15058 a">irc://
15059 a</a></li></ul></li></ul>
15060 !! end
15061
15062 !! test
15063 Handling of %0A in URLs
15064 !! wikitext
15065 ** irc://%0Aa
15066 !! html/php
15067 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15068
15069 !! html/parsoid
15070 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15071 !! end
15072
15073
15074 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
15075 !! test
15076 5 quotes, code coverage +1 line
15077 !! options
15078 parsoid=wt2html
15079 !! wikitext
15080 '''''
15081 !! html/php
15082 !! html/parsoid
15083 <p><b><i></i></b></p>
15084 !! end
15085
15086 # same html as previous, but wikitext adjusted to match parsoid html2wt
15087 # note that wt2html and html2html will put the <i> before the <b>
15088 !! test
15089 5 quotes, code coverage +1 line w/ nowiki (1)
15090 !! options
15091 parsoid=wt2wt,html2wt
15092 !! wikitext
15093 '''''<nowiki/>'''''
15094 !! html/php
15095 <p><i></i>
15096 </p>
15097 !! html/parsoid
15098 <p><b><i></i></b></p>
15099 !! end
15100
15101 # same as previous, just swapping the <i> and <b>
15102 !! test
15103 5 quotes, code coverage +1 line w/ nowiki (2)
15104 !! wikitext
15105 '''''<nowiki/>'''''
15106 !! html/php
15107 <p><i></i>
15108 </p>
15109 !! html/parsoid
15110 <p><i><b></b></i></p>
15111 !! end
15112
15113 !! test
15114 Special:Search page linking.
15115 !! wikitext
15116 {{Special:search}}
15117 !! html
15118 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
15119 </p>
15120 !! end
15121
15122 !! test
15123 Say the magic word
15124 !! options
15125 title=[[Parser test]]
15126 !! wikitext
15127 * {{PAGENAME}}
15128 * {{PAGENAMEE}}
15129 * {{FULLPAGENAME}}
15130 * {{FULLPAGENAMEE}}
15131 * {{BASEPAGENAME}}
15132 * {{BASEPAGENAMEE}}
15133 * {{SUBPAGENAME}}
15134 * {{SUBPAGENAMEE}}
15135 * {{ROOTPAGENAME}}
15136 * {{ROOTPAGENAMEE}}
15137 * {{TALKPAGENAME}}
15138 * {{TALKPAGENAMEE}}
15139 * {{SUBJECTPAGENAME}}
15140 * {{SUBJECTPAGENAMEE}}
15141 * {{NAMESPACEE}}
15142 * {{NAMESPACE}}
15143 * {{NAMESPACENUMBER}}
15144 * {{TALKSPACE}}
15145 * {{TALKSPACEE}}
15146 * {{SUBJECTSPACE}}
15147 * {{SUBJECTSPACEE}}
15148 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
15149 !! html
15150 <ul><li> Parser test</li>
15151 <li> Parser_test</li>
15152 <li> Parser test</li>
15153 <li> Parser_test</li>
15154 <li> Parser test</li>
15155 <li> Parser_test</li>
15156 <li> Parser test</li>
15157 <li> Parser_test</li>
15158 <li> Parser test</li>
15159 <li> Parser_test</li>
15160 <li> Talk:Parser test</li>
15161 <li> Talk:Parser_test</li>
15162 <li> Parser test</li>
15163 <li> Parser_test</li>
15164 <li> </li>
15165 <li> </li>
15166 <li> 0</li>
15167 <li> Talk</li>
15168 <li> Talk</li>
15169 <li> </li>
15170 <li> </li>
15171 <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>
15172
15173 !! end
15174 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
15175
15176 !! test
15177 Gallery
15178 !! wikitext
15179 <gallery>
15180 image1.png |
15181 image2.gif|||||
15182
15183 image3|
15184 image4 |300px| centre
15185 image5.svg| http://///////
15186 [[x|xx]]]]
15187 * image6
15188 </gallery>
15189 !! html
15190 <ul class="gallery mw-gallery-traditional">
15191 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15192 <div class="thumb" style="height: 150px;">Image1.png</div>
15193 <div class="gallerytext">
15194 </div>
15195 </div></li>
15196 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15197 <div class="thumb" style="height: 150px;">Image2.gif</div>
15198 <div class="gallerytext">
15199 <p>||||
15200 </p>
15201 </div>
15202 </div></li>
15203 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15204 <div class="thumb" style="height: 150px;">Image3</div>
15205 <div class="gallerytext">
15206 </div>
15207 </div></li>
15208 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15209 <div class="thumb" style="height: 150px;">Image4</div>
15210 <div class="gallerytext">
15211 <p>300px| centre
15212 </p>
15213 </div>
15214 </div></li>
15215 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15216 <div class="thumb" style="height: 150px;">Image5.svg</div>
15217 <div class="gallerytext">
15218 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
15219 </p>
15220 </div>
15221 </div></li>
15222 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15223 <div class="thumb" style="height: 150px;">* image6</div>
15224 <div class="gallerytext">
15225 </div>
15226 </div></li>
15227 </ul>
15228
15229 !! end
15230
15231 !! test
15232 Gallery (with options)
15233 !! wikitext
15234 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
15235 File:Nonexistant.jpg|caption
15236 File:Nonexistant.jpg
15237 image:foobar.jpg|some '''caption''' [[Main Page]]
15238 image:foobar.jpg
15239 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
15240 </gallery>
15241 !! html
15242 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
15243 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
15244 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15245 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15246 <div class="gallerytext">
15247 <p>caption
15248 </p>
15249 </div>
15250 </div></li>
15251 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15252 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15253 <div class="gallerytext">
15254 </div>
15255 </div></li>
15256 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15257 <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>
15258 <div class="gallerytext">
15259 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15260 </p>
15261 </div>
15262 </div></li>
15263 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15264 <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>
15265 <div class="gallerytext">
15266 </div>
15267 </div></li>
15268 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15269 <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>
15270 <div class="gallerytext">
15271 <p>Blabla|blabla.
15272 </p>
15273 </div>
15274 </div></li>
15275 </ul>
15276
15277 !! end
15278
15279 !! test
15280 Gallery with link that has fragment
15281 !! wikitext
15282 <gallery>
15283 image:foobar.jpg|link=Main_Page
15284 image:foobar.jpg|link=Main_Page#section
15285 image:foobar.jpg|link=Main Page#section|caption
15286 </gallery>
15287 !! html
15288 <ul class="gallery mw-gallery-traditional">
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"><img alt="Foobar.jpg" 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 </div>
15293 </div></li>
15294 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15295 <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>
15296 <div class="gallerytext">
15297 </div>
15298 </div></li>
15299 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15300 <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>
15301 <div class="gallerytext">
15302 <p>caption
15303 </p>
15304 </div>
15305 </div></li>
15306 </ul>
15307
15308 !! end
15309
15310 !! test
15311 Gallery with wikitext inside caption
15312 !! wikitext
15313 <gallery>
15314 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
15315 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
15316 </gallery>
15317 !! html
15318 <ul class="gallery mw-gallery-traditional">
15319 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15320 <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>
15321 <div class="gallerytext">
15322 <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>
15323 </p>
15324 </div>
15325 </div></li>
15326 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15327 <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>
15328 <div class="gallerytext">
15329 <p>This is a test template
15330 </p>
15331 </div>
15332 </div></li>
15333 </ul>
15334
15335 !! end
15336
15337 !! test
15338 gallery (with showfilename option)
15339 !! wikitext
15340 <gallery showfilename>
15341 File:Nonexistant.jpg|caption
15342 File:Nonexistant.jpg
15343 image:foobar.jpg|some '''caption''' [[Main Page]]
15344 File:Foobar.jpg
15345 </gallery>
15346 !! html
15347 <ul class="gallery mw-gallery-traditional">
15348 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15349 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15350 <div class="gallerytext">
15351 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15352 caption
15353 </p>
15354 </div>
15355 </div></li>
15356 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15357 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15358 <div class="gallerytext">
15359 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15360 </p>
15361 </div>
15362 </div></li>
15363 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15364 <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>
15365 <div class="gallerytext">
15366 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15367 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15368 </p>
15369 </div>
15370 </div></li>
15371 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15372 <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>
15373 <div class="gallerytext">
15374 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15375 </p>
15376 </div>
15377 </div></li>
15378 </ul>
15379
15380 !! end
15381
15382 !! test
15383 Gallery (with namespace-less filenames)
15384 !! wikitext
15385 <gallery>
15386 File:Nonexistant.jpg
15387 Nonexistant.jpg
15388 image:foobar.jpg
15389 foobar.jpg
15390 </gallery>
15391 !! html
15392 <ul class="gallery mw-gallery-traditional">
15393 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15394 <div class="thumb" style="height: 150px;">Nonexistant.jpg</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="height: 150px;">Nonexistant.jpg</div>
15400 <div class="gallerytext">
15401 </div>
15402 </div></li>
15403 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15404 <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>
15405 <div class="gallerytext">
15406 </div>
15407 </div></li>
15408 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15409 <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>
15410 <div class="gallerytext">
15411 </div>
15412 </div></li>
15413 </ul>
15414
15415 !! end
15416
15417 !! test
15418 HTML Hex character encoding (spells the word "JavaScript")
15419 !! options
15420 parsoid=wt2html,wt2wt,html2html
15421 !! wikitext
15422 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
15423 !! html/php
15424 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
15425 </p>
15426 !! html/parsoid
15427 <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>
15428 !! end
15429
15430 !! test
15431 HTML Hex character encoding bogus encoding (bug 26437 regression check)
15432 !! wikitext
15433 &#xsee;&#XSEE;
15434 !! html/php
15435 <p>&amp;#xsee;&amp;#XSEE;
15436 </p>
15437 !! html/parsoid
15438 <p>&amp;#xsee;&amp;#XSEE;</p>
15439 !! end
15440
15441 !! test
15442 HTML Hex character encoding mixed case
15443 !! options
15444 parsoid=wt2html,wt2wt,html2html
15445 !! wikitext
15446 &#xEE;&#Xee;
15447 !! html/php
15448 <p>&#xee;&#xee;
15449 </p>
15450 !! html/parsoid
15451 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
15452 !! end
15453
15454 !! test
15455 __FORCETOC__ override
15456 !! wikitext
15457 __NEWSECTIONLINK__
15458 __FORCETOC__
15459 !! html
15460 <p><br />
15461 </p>
15462 !! end
15463
15464 !! test
15465 ISBN code coverage
15466 !! wikitext
15467 ISBN 978-0-1234-56&#x20;789
15468 !! html
15469 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
15470 </p>
15471 !! end
15472
15473 !! test
15474 ISBN followed by 5 spaces
15475 !! wikitext
15476 ISBN
15477 !! html
15478 <p>ISBN
15479 </p>
15480 !! end
15481
15482 !! test
15483 Double ISBN
15484 !! wikitext
15485 ISBN ISBN 1234567890
15486 !! html
15487 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15488 </p>
15489 !! end
15490
15491 !! test
15492 ISBN with an X
15493 !! wikitext
15494 ISBN 3-462-04561-X
15495 !! html
15496 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
15497 </p>
15498 !! end
15499
15500 !! test
15501 ISBN with empty prefix (parsoid test)
15502 !! wikitext
15503 ISBN 1234567890
15504 !! html/parsoid
15505 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
15506 !! end
15507
15508 !! test
15509 Bug 22905: <abbr> followed by ISBN followed by </a>
15510 !! wikitext
15511 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
15512 !! html
15513 <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>
15514 </p>
15515 !! end
15516
15517 !! test
15518 Double RFC
15519 !! wikitext
15520 RFC RFC 1234
15521 !! html
15522 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
15523 </p>
15524 !! end
15525
15526 !! test
15527 Double RFC with a wiki link
15528 !! wikitext
15529 RFC [[RFC 1234]]
15530 !! html
15531 <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>
15532 </p>
15533 !! end
15534
15535 !! test
15536 RFC code coverage
15537 !! wikitext
15538 RFC 983&#x20;987
15539 !! html
15540 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
15541 </p>
15542 !! end
15543
15544 !! test
15545 Centre-aligned image
15546 !! wikitext
15547 [[Image:foobar.jpg|centre]]
15548 !! html
15549 <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>
15550
15551 !!end
15552
15553 !! test
15554 None-aligned image
15555 !! wikitext
15556 [[Image:foobar.jpg|none]]
15557 !! html
15558 <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>
15559
15560 !!end
15561
15562 !! test
15563 Width + Height sized image (using px) (height is ignored)
15564 !! wikitext
15565 [[Image:foobar.jpg|640x480px]]
15566 !! html
15567 <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>
15568 </p>
15569 !!end
15570
15571 !! test
15572 Width-sized image (using px, no following whitespace)
15573 !! wikitext
15574 [[Image:foobar.jpg|640px]]
15575 !! html
15576 <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>
15577 </p>
15578 !!end
15579
15580 !! test
15581 Width-sized image (using px, with following whitespace - test regression from r39467)
15582 !! wikitext
15583 [[Image:foobar.jpg|640px ]]
15584 !! html
15585 <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>
15586 </p>
15587 !!end
15588
15589 !! test
15590 Width-sized image (using px, with preceding whitespace - test regression from r39467)
15591 !! wikitext
15592 [[Image:foobar.jpg| 640px]]
15593 !! html
15594 <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>
15595 </p>
15596 !!end
15597
15598 !! test
15599 Image with page parameter
15600 !! options
15601 djvu
15602 !! wikitext
15603 [[File:LoremIpsum.djvu|page=2]]
15604 !! html
15605 <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>
15606 </p>
15607 !! end
15608
15609 !! test
15610 Another italics / bold test
15611 !! wikitext
15612 ''' ''x'
15613 !! html
15614 <pre>'<i> </i>x'
15615 </pre>
15616 !!end
15617
15618 # Note the results may be incorrect, as parserTest output included this:
15619 # XML error: Mismatched tag at byte 6120:
15620 # ...<dd> </dt></dl> </dd...
15621 !! test
15622 dt/dd/dl test
15623 !! options
15624 disabled
15625 !! wikitext
15626 :;;;::
15627 !! html
15628 <dl>
15629 <dd><dl>
15630 <dt><dl>
15631 <dt><dl>
15632 <dt><dl>
15633 <dd><dl>
15634 <dd>
15635 </dd>
15636 </dl>
15637 </dd>
15638 </dl>
15639 </dt>
15640 </dl>
15641 </dt>
15642 </dl>
15643 </dt>
15644 </dl>
15645 </dd>
15646 </dl>
15647
15648 !!end
15649
15650
15651 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
15652 !! test
15653 Images with the "|" character in the comment
15654 !! wikitext
15655 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
15656 !! html/php
15657 <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>
15658
15659 !! html/parsoid
15660 <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>
15661 !! end
15662
15663 !! test
15664 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
15665 !! wikitext
15666 <html><script>alert(1);</script></html>
15667 !! html
15668 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
15669 </p>
15670 !! end
15671
15672 !! test
15673 HTML with raw HTML ($wgRawHtml==true)
15674 !! options
15675 wgRawHtml=1
15676 !! wikitext
15677 <html><script>alert(1);</script></html>
15678 !! html
15679 <p><script>alert(1);</script>
15680 </p>
15681 !! end
15682
15683 !! test
15684 Parents of subpages, one level up
15685 !! options
15686 subpage title=[[Subpage test/L1/L2/L3]]
15687 !! wikitext
15688 [[../|L2]]
15689 !! html
15690 <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>
15691 </p>
15692 !! end
15693
15694
15695 !! test
15696 Parents of subpages, one level up, not named
15697 !! options
15698 subpage title=[[Subpage test/L1/L2/L3]]
15699 !! wikitext
15700 [[../]]
15701 !! html
15702 <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>
15703 </p>
15704 !! end
15705
15706
15707
15708 !! test
15709 Parents of subpages, two levels up
15710 !! options
15711 subpage title=[[Subpage test/L1/L2/L3]]
15712 !! wikitext
15713 [[../../|L1]]2
15714
15715 [[../../|L1]]l
15716 !! html
15717 <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
15718 </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>
15719 </p>
15720 !! end
15721
15722 !! test
15723 Parents of subpages, two levels up, without trailing slash or name.
15724 !! options
15725 subpage title=[[Subpage test/L1/L2/L3]]
15726 !! wikitext
15727 [[../..]]
15728 !! html
15729 <p>[[../..]]
15730 </p>
15731 !! end
15732
15733 !! test
15734 Parents of subpages, two levels up, with lots of extra trailing slashes.
15735 !! options
15736 subpage title=[[Subpage test/L1/L2/L3]]
15737 !! wikitext
15738 [[../../////]]
15739 !! html
15740 <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>
15741 </p>
15742 !! end
15743
15744 !! article
15745 Subpage test/L1/L2/L3Sibling
15746 !! text
15747 Sibling article
15748 !! endarticle
15749
15750 !! test
15751 Transclusion of a sibling page (one level up)
15752 !! options
15753 subpage title=[[Subpage test/L1/L2/L3]]
15754 !! wikitext
15755 {{../L3Sibling}}
15756 !! html
15757 <p>Sibling article
15758 </p>
15759 !! end
15760
15761 !! test
15762 Transclusion of a child page
15763 !! options
15764 subpage title=[[Subpage test/L1/L2]]
15765 !! wikitext
15766 {{/L3Sibling}}
15767 !! html
15768 <p>Sibling article
15769 </p>
15770 !! end
15771
15772 !! test
15773 Non-transclusion because of too many up levels
15774 !! options
15775 subpage title=[[Subpage test/L1/L2/L3]]
15776 !! wikitext
15777 {{../../../../More than parent}}
15778 !! html
15779 <p>{{../../../../More than parent}}
15780 </p>
15781 !! end
15782
15783 !! test
15784 Definition list code coverage
15785 !! wikitext
15786 ; title : def
15787 ; title : def
15788 ;title: def
15789 !! html
15790 <dl><dt> title &#160;</dt>
15791 <dd> def</dd>
15792 <dt> title&#160;</dt>
15793 <dd> def</dd>
15794 <dt>title</dt>
15795 <dd> def</dd></dl>
15796
15797 !! end
15798
15799 !! test
15800 Don't fall for the self-closing div
15801 !! wikitext
15802 <div>hello world</div/>
15803 !! html
15804 <div>hello world</div>
15805
15806 !! end
15807
15808 !! test
15809 MSGNW magic word
15810 !! wikitext
15811 {{MSGNW:msg}}
15812 !! html
15813 <p>&#91;&#91;:Template:Msg&#93;&#93;
15814 </p>
15815 !! end
15816
15817 !! test
15818 RAW magic word
15819 !! wikitext
15820 {{RAW:QUERTY}}
15821 !! html
15822 <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>
15823 </p>
15824 !! end
15825
15826 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15827 !! test
15828 Always escape literal '>' in output, not just after '<'
15829 !! wikitext
15830 ><>
15831 !! html
15832 <p>&gt;&lt;&gt;
15833 </p>
15834 !! end
15835
15836 !! test
15837 Template caching
15838 !! wikitext
15839 {{Test}}
15840 {{Test}}
15841 !! html
15842 <p>This is a test template
15843 This is a test template
15844 </p>
15845 !! end
15846
15847
15848 !! article
15849 MediaWiki:Fake
15850 !! text
15851 ==header==
15852 !! endarticle
15853
15854 !! test
15855 Inclusion of !userCanEdit() content
15856 !! wikitext
15857 {{MediaWiki:Fake}}
15858 !! html
15859 <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>
15860
15861 !! end
15862
15863
15864 !! test
15865 Out-of-order TOC heading levels
15866 !! wikitext
15867 ==2==
15868 ======6======
15869 ===3===
15870 =1=
15871 =====5=====
15872 ==2==
15873 !! html
15874 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15875 <ul>
15876 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15877 <ul>
15878 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15879 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15880 </ul>
15881 </li>
15882 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15883 <ul>
15884 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15885 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15886 </ul>
15887 </li>
15888 </ul>
15889 </div>
15890
15891 <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>
15892 <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>
15893 <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>
15894 <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>
15895 <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>
15896 <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>
15897
15898 !! end
15899
15900
15901 !! test
15902 ISBN with a dummy number
15903 !! wikitext
15904 ISBN ---
15905 !! html
15906 <p>ISBN ---
15907 </p>
15908 !! end
15909
15910
15911 !! test
15912 ISBN with space-delimited number
15913 !! wikitext
15914 ISBN 92 9017 032 8
15915 !! html
15916 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
15917 </p>
15918 !! end
15919
15920
15921 !! test
15922 ISBN with multiple spaces, no number
15923 !! wikitext
15924 ISBN foo
15925 !! html
15926 <p>ISBN foo
15927 </p>
15928 !! end
15929
15930
15931 !! test
15932 ISBN length
15933 !! wikitext
15934 ISBN 123456789
15935
15936 ISBN 1234567890
15937
15938 ISBN 12345678901
15939 !! html
15940 <p>ISBN 123456789
15941 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15942 </p><p>ISBN 12345678901
15943 </p>
15944 !! end
15945
15946
15947 !! test
15948 ISBN with trailing year (bug 8110)
15949 !! wikitext
15950 ISBN 1-234-56789-0 - 2006
15951
15952 ISBN 1 234 56789 0 - 2006
15953 !! html
15954 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
15955 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
15956 </p>
15957 !! end
15958
15959
15960 !! test
15961 anchorencode
15962 !! wikitext
15963 {{anchorencode:foo bar©#%n}}
15964 !! html
15965 <p>foo_bar.C2.A9.23.25n
15966 </p>
15967 !! end
15968
15969 !! test
15970 anchorencode trims spaces
15971 !! wikitext
15972 {{anchorencode: __pretty__please__}}
15973 !! html
15974 <p>pretty_please
15975 </p>
15976 !! end
15977
15978 !! test
15979 anchorencode deals with links
15980 !! wikitext
15981 {{anchorencode: [[hello|world]] [[hi]]}}
15982 !! html
15983 <p>world_hi
15984 </p>
15985 !! end
15986
15987 !! test
15988 anchorencode deals with templates
15989 !! wikitext
15990 {{anchorencode: {{Foo}} }}
15991 !! html
15992 <p>FOO
15993 </p>
15994 !! end
15995
15996 !! test
15997 anchorencode encodes like the TOC generator: (bug 18431)
15998 !! wikitext
15999 === _ +:.3A%3A&&amp;]] ===
16000 {{anchorencode: _ +:.3A%3A&&amp;]] }}
16001 __NOEDITSECTION__
16002 !! html
16003 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
16004 <p>.2B:.3A.253A.26.26.5D.5D
16005 </p>
16006 !! end
16007
16008 !! test
16009 Bug 6200: blockquotes and paragraph formatting
16010 !! wikitext
16011 <blockquote>
16012 foo
16013 </blockquote>
16014
16015 bar
16016
16017 baz
16018 !! html
16019 <blockquote>
16020 <p>foo
16021 </p>
16022 </blockquote>
16023 <p>bar
16024 </p>
16025 <pre>baz
16026 </pre>
16027 !! end
16028
16029 !! test
16030 Bug 8293: Use of center tag ruins paragraph formatting
16031 !! wikitext
16032 <center>
16033 foo
16034 </center>
16035
16036 bar
16037
16038 baz
16039 !! html
16040 <center>
16041 <p>foo
16042 </p>
16043 </center>
16044 <p>bar
16045 </p>
16046 <pre>baz
16047 </pre>
16048 !! end
16049
16050 !!test
16051 Parsing of overlapping (improperly nested) inline html tags
16052 !! wikitext
16053 <span><s>x</span></s>
16054 !! html/php
16055 <p><span><s>x&lt;/span&gt;</s></span>
16056 </p>
16057 !! html/parsoid
16058 <p><span><s>x</s></span>
16059 </p>
16060 !!end
16061
16062 ###
16063 ### Language variants related tests
16064 ###
16065 !! test
16066 Self-link in language variants
16067 !! options
16068 title=[[Dunav]] language=sr
16069 !! wikitext
16070 Both [[Dunav]] and [[Дунав]] are names for this river.
16071 !! html
16072 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
16073 </p>
16074 !!end
16075
16076 !! article
16077 Дуна
16078 !! text
16079 content
16080 !! endarticle
16081
16082 !! test
16083 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
16084 !! options
16085 title=[[Duna]] language=sr
16086 !! wikitext
16087 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
16088 !! html
16089 <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.
16090 </p>
16091 !! end
16092
16093 !! test
16094 Link to a section of a variant of this title shouldn't be parsed as self-link
16095 !! options
16096 title=[[Duna]] language=sr
16097 !! wikitext
16098 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
16099 !! html
16100 <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.
16101 </p>
16102 !! end
16103
16104 !! test
16105 Link to pages in language variants
16106 !! options
16107 language=sr
16108 !! wikitext
16109 Main Page can be written as [[Маин Паге]]
16110 !! html
16111 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
16112 </p>
16113 !!end
16114
16115
16116 !! test
16117 Multiple links to pages in language variants
16118 !! options
16119 language=sr
16120 !! wikitext
16121 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
16122 !! html
16123 <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>.
16124 </p>
16125 !!end
16126
16127
16128 !! test
16129 Simple template in language variants
16130 !! options
16131 language=sr
16132 !! wikitext
16133 {{тест}}
16134 !! html
16135 <p>This is a test template
16136 </p>
16137 !! end
16138
16139
16140 !! test
16141 Template with explicit namespace in language variants
16142 !! options
16143 language=sr
16144 !! wikitext
16145 {{Template:тест}}
16146 !! html
16147 <p>This is a test template
16148 </p>
16149 !! end
16150
16151
16152 !! test
16153 Basic test for template parameter in language variants
16154 !! options
16155 language=sr
16156 !! wikitext
16157 {{парамтест|param=foo}}
16158 !! html
16159 <p>This is a test template with parameter foo
16160 </p>
16161 !! end
16162
16163
16164 !! test
16165 Simple category in language variants
16166 !! options
16167 language=sr cat
16168 !! wikitext
16169 [[Category:МедиаWики Усер'с Гуиде]]
16170 !! html
16171 <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>
16172 !! end
16173
16174
16175 !! article
16176 Category:分类
16177 !! text
16178 blah
16179 !! endarticle
16180
16181 !! article
16182 Category:分類
16183 !! text
16184 blah
16185 !! endarticle
16186
16187 !! test
16188 Don't convert blue categorylinks to another variant (bug 33210)
16189 !! options
16190 language=zh cat
16191 !! wikitext
16192 [[A]][[Category:分类]]
16193 !! html
16194 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
16195 !! end
16196
16197
16198 !! test
16199 Stripping -{}- tags (language variants)
16200 !! options
16201 language=sr
16202 !! wikitext
16203 Latin proverb: -{Ne nuntium necare}-
16204 !! html
16205 <p>Latin proverb: Ne nuntium necare
16206 </p>
16207 !! end
16208
16209
16210 !! test
16211 Prevent conversion with -{}- tags (language variants)
16212 !! options
16213 language=sr variant=sr-ec
16214 !! wikitext
16215 Latinski: -{Ne nuntium necare}-
16216 !! html
16217 <p>Латински: Ne nuntium necare
16218 </p>
16219 !! end
16220
16221
16222 !! test
16223 Prevent conversion of text with -{}- tags (language variants)
16224 !! options
16225 language=sr variant=sr-ec
16226 !! wikitext
16227 Latinski: -{Ne nuntium necare}-
16228 !! html
16229 <p>Латински: Ne nuntium necare
16230 </p>
16231 !! end
16232
16233
16234 !! test
16235 Prevent conversion of links with -{}- tags (language variants)
16236 !! options
16237 language=sr variant=sr-ec
16238 !! wikitext
16239 -{[[Main Page]]}-
16240 !! html
16241 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16242 </p>
16243 !! end
16244
16245
16246 !! test
16247 -{}- tags within headlines (within html for parserConvert())
16248 !! options
16249 language=sr variant=sr-ec
16250 !! wikitext
16251 == -{Naslov}- ==
16252 !! html
16253 <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>
16254
16255 !! end
16256
16257
16258 !! test
16259 Explicit definition of language variant alternatives
16260 !! options
16261 language=zh variant=zh-tw
16262 !! wikitext
16263 -{zh:China;zh-tw:Taiwan}-, not China
16264 !! html
16265 <p>Taiwan, not China
16266 </p>
16267 !! end
16268
16269
16270 !! test
16271 Conversion around HTML tags
16272 !! options
16273 language=sr variant=sr-ec
16274 !! wikitext
16275 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
16276 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
16277 !! html
16278 <p>
16279 <span title="ЛаCтин">ски</span>
16280 </p>
16281 !! end
16282
16283
16284 !! test
16285 Explicit session-wise language variant mapping (A flag and - flag)
16286 !! options
16287 language=zh variant=zh-tw
16288 !! wikitext
16289 Taiwan is not China.
16290 But -{A|zh:China;zh-tw:Taiwan}- is China,
16291 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
16292 and -{China}- is China.
16293 !! html
16294 <p>Taiwan is not China.
16295 But Taiwan is Taiwan,
16296 (This should be stripped!)
16297 and China is China.
16298 </p>
16299 !! end
16300
16301 !! test
16302 Explicit session-wise language variant mapping (H flag for hide)
16303 !! options
16304 language=zh variant=zh-tw
16305 !! wikitext
16306 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
16307 Taiwan is China.
16308 !! html
16309 <p>(This should be stripped!)
16310 Taiwan is Taiwan.
16311 </p>
16312 !! end
16313
16314 !! test
16315 Adding explicit conversion rule for title (T flag)
16316 !! options
16317 language=zh variant=zh-tw showtitle
16318 !! wikitext
16319 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16320 !! html
16321 Taiwan
16322 <p>Should be stripped!
16323 </p>
16324 !! end
16325
16326 !! test
16327 Testing that changing the language variant here in the tests actually works
16328 !! options
16329 language=zh variant=zh showtitle
16330 !! wikitext
16331 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16332 !! html
16333 China
16334 <p>Should be stripped!
16335 </p>
16336 !! end
16337
16338 !! test
16339 Recursive conversion of alt and title attrs shouldn't clear converter state
16340 !! options
16341 language=zh variant=zh-cn showtitle
16342 !! wikitext
16343 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
16344 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
16345 !! html
16346 China
16347 <p>
16348 Should be stripped<span title="Exclamation">!</span>
16349 </p>
16350 !! end
16351
16352 !! test
16353 Bug 24072: more test on conversion rule for title
16354 !! options
16355 language=zh variant=zh-tw showtitle
16356 !! wikitext
16357 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16358 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
16359 !! html
16360 Taiwan
16361 <p>This should be stripped!
16362 This won't take interferes with the title rule.
16363 </p>
16364 !! end
16365
16366 !! test
16367 Partly disable title conversion if variant == main language code
16368 !! options
16369 language=zh variant=zh title=[[ZH]] showtitle
16370 !! wikitext
16371 -{T|zh-cn:CN;zh-tw:TW}-
16372 !! html
16373 ZH
16374 <p>
16375 </p>
16376 !! end
16377
16378 !! test
16379 Partly disable title conversion if variant == main language code, more
16380 !! options
16381 language=zh variant=zh title=[[ZH]] showtitle
16382 !! wikitext
16383 -{T|TW}-
16384 !! html
16385 ZH
16386 <p>
16387 </p>
16388 !! end
16389
16390 !! test
16391 Raw output of variant escape tags (R flag)
16392 !! options
16393 language=zh variant=zh-tw
16394 !! wikitext
16395 Raw: -{R|zh:China;zh-tw:Taiwan}-
16396 !! html
16397 <p>Raw: zh:China;zh-tw:Taiwan
16398 </p>
16399 !! end
16400
16401 !! test
16402 Nested using of manual convert syntax
16403 !! options
16404 language=zh variant=zh-hk
16405 !! wikitext
16406 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
16407 !! html
16408 <p>Nested: Hello Hong Kong!
16409 </p>
16410 !! end
16411
16412 !! test
16413 Proper conversion of text in external links
16414 !! options
16415 language=sr variant=sr-ec
16416 !! wikitext
16417 http://www.google.com
16418 gopher://www.google.com
16419 [http://www.google.com http://www.google.com]
16420 [gopher://www.google.com gopher://www.google.com]
16421 [https://www.google.com irc://www.google.com]
16422 [ftp://www.google.com www.google.com/ftp://dir]
16423 [//www.google.com www.google.com]
16424 !! html
16425 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16426 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16427 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16428 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16429 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
16430 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
16431 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
16432 </p>
16433 !! end
16434
16435 !! test
16436 Do not convert roman numbers to language variants
16437 !! options
16438 language=sr variant=sr-ec
16439 !! wikitext
16440 Fridrih IV je car.
16441 !! html
16442 <p>Фридрих IV је цар.
16443 </p>
16444 !! end
16445
16446 !! test
16447 Unclosed language converter markup "-{"
16448 !! options
16449 language=sr
16450 !! wikitext
16451 -{T|hello
16452 !! html
16453 <p>-{T|hello
16454 </p>
16455 !! end
16456
16457 !! test
16458 Don't convert raw rule "-{R|=&gt;}-" to "=>"
16459 !! options
16460 language=sr
16461 !! wikitext
16462 -{R|=&gt;}-
16463 !! html
16464 <p>=&gt;
16465 </p>
16466 !!end
16467
16468 !! test
16469 Don't break link parsing if language converter markup is in the caption.
16470 !! options
16471 language=sr variant=sr-ec
16472 !! wikitext
16473 [[Main Page|-{R|main page}-]]
16474 !! html
16475 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
16476 </p>
16477 !! end
16478
16479 # This test is currently broken in the PHP parser (bug 52661)
16480 !! test
16481 Don't break image parsing if language converter markup is in the caption.
16482 !! options
16483 language=sr
16484 disabled
16485 !! wikitext
16486 [[File:Foobar.jpg|-{R|caption}-]]
16487 !! html
16488 <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>
16489 </p>
16490 !! end
16491
16492 # This test is currently broken in the PHP parser (bug 52661)
16493 !! test
16494 Don't break list handling if language converter markup is in the item.
16495 !! options
16496 language=zh variant=zh-cn
16497 disabled
16498 !! wikitext
16499 ;-{zh-cn:AAA;zh-tw:BBB}-
16500 !! html
16501 <dl><dt>AAA
16502 </dt></dl>
16503
16504 !! end
16505
16506 # This test is currently broken in the PHP parser (bug 52661)
16507 !! test
16508 Don't break table handling if language converter markup is in the cell.
16509 !! options
16510 language=sr variant=sr-ec
16511 disabled
16512 !! wikitext
16513 {|
16514 |-
16515 | -{R|B}-
16516 |}
16517 !! html
16518 <table>
16519
16520 <tr>
16521 <td> B
16522 </td></tr></table>
16523
16524 !! end
16525
16526 !! test
16527 Bug 529: Uncovered bullet
16528 !! wikitext
16529 * Foo {{bullet}}
16530 !! html
16531 <ul><li> Foo </li>
16532 <li> Bar</li></ul>
16533
16534 !! end
16535
16536 # Plain MediaWiki does not remove empty lists, but tidy actually does.
16537 # Templates in Wikipedia rely on this behavior, as tidy has always been
16538 # enabled there. These tests are normally run *without* tidy, so specify the
16539 # full output here.
16540 # To test realistic parsing behavior, apply a tidy-like transformation to both
16541 # the expected output and your parser's output.
16542 !! test
16543 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
16544 !! wikitext
16545 ******* Foo {{bullet}}
16546 !! html
16547 <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>
16548 <li> Bar</li></ul>
16549
16550 !! end
16551
16552 !! test
16553 Bug 529: Uncovered table already at line-start
16554 !! wikitext
16555 x
16556
16557 {{table}}
16558 y
16559 !! html
16560 <p>x
16561 </p>
16562 <table>
16563 <tr>
16564 <td> 1 </td>
16565 <td> 2
16566 </td></tr>
16567 <tr>
16568 <td> 3 </td>
16569 <td> 4
16570 </td></tr></table>
16571 <p>y
16572 </p>
16573 !! end
16574
16575 !! test
16576 Bug 529: Uncovered bullet in parser function result
16577 !! wikitext
16578 * Foo {{lc:{{bullet}} }}
16579 !! html
16580 <ul><li> Foo </li>
16581 <li> bar</li></ul>
16582
16583 !! end
16584
16585 !! test
16586 Bug 5678: Double-parsed template argument
16587 !! wikitext
16588 {{lc:{{{1}}}|hello}}
16589 !! html
16590 <p>{{{1}}}
16591 </p>
16592 !! end
16593
16594 !! test
16595 Bug 5678: Double-parsed template invocation
16596 !! wikitext
16597 {{lc:{{paramtest {{!}} param = hello }} }}
16598 !! html
16599 <p>{{paramtest | param = hello }}
16600 </p>
16601 !! end
16602
16603 !! test
16604 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
16605 !! options
16606 language=cs
16607 title=[[Main Page]]
16608 !! wikitext
16609 {{PRVNÍVELKÉ:ěščř}}
16610 {{prvnívelké:ěščř}}
16611 {{PRVNÍMALÉ:ěščř}}
16612 {{prvnímalé:ěščř}}
16613 {{MALÁ:ěščř}}
16614 {{malá:ěščř}}
16615 {{VELKÁ:ěščř}}
16616 {{velká:ěščř}}
16617 !! html
16618 <p>Ěščř
16619 Ěščř
16620 ěščř
16621 ěščř
16622 ěščř
16623 ěščř
16624 ĚŠČŘ
16625 ĚŠČŘ
16626 </p>
16627 !! end
16628
16629 !! test
16630 Morwen/13: Unclosed link followed by heading
16631 !! wikitext
16632 [[link
16633 ==heading==
16634 !! html
16635 <p>[[link
16636 </p>
16637 <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>
16638
16639 !! end
16640
16641 !! test
16642 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
16643 !! wikitext
16644 {{foo|
16645 =heading=
16646 !! html
16647 <p>{{foo|
16648 </p>
16649 <h1><span class="mw-headline" id="heading">heading</span></h1>
16650
16651 !! end
16652
16653 !! test
16654 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
16655 !! wikitext
16656 {{foo|
16657 ==heading==
16658 !! html
16659 <p>{{foo|
16660 </p>
16661 <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>
16662
16663 !! end
16664
16665 !! test
16666 Tildes in comments
16667 !! options
16668 pst
16669 !! wikitext
16670 <!-- ~~~~ -->
16671 !! html
16672 <!-- ~~~~ -->
16673 !! end
16674
16675 !! test
16676 Paragraphs inside divs (no extra line breaks)
16677 !! wikitext
16678 <div>Line one
16679
16680 Line two</div>
16681 !! html
16682 <div>Line one
16683 Line two</div>
16684
16685 !! end
16686
16687 !! test
16688 Paragraphs inside divs (extra line break on open)
16689 !! wikitext
16690 <div>
16691 Line one
16692
16693 Line two</div>
16694 !! html
16695 <div>
16696 <p>Line one
16697 </p>
16698 Line two</div>
16699
16700 !! end
16701
16702 !! test
16703 Paragraphs inside divs (extra line break on close)
16704 !! wikitext
16705 <div>Line one
16706
16707 Line two
16708 </div>
16709 !! html
16710 <div>Line one
16711 <p>Line two
16712 </p>
16713 </div>
16714
16715 !! end
16716
16717 !! test
16718 Paragraphs inside divs (extra line break on open and close)
16719 !! wikitext
16720 <div>
16721 Line one
16722
16723 Line two
16724 </div>
16725 !! html
16726 <div>
16727 <p>Line one
16728 </p><p>Line two
16729 </p>
16730 </div>
16731
16732 !! end
16733
16734 !! test
16735 Nesting tags, paragraphs on lines which begin with <div>
16736 !! options
16737 disabled
16738 !! wikitext
16739 <div></div><strong>A
16740 B</strong>
16741 !! html
16742 <div></div>
16743 <p><strong>A
16744 B</strong>
16745 </p>
16746 !! end
16747
16748 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
16749 !! test
16750 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
16751 !! wikitext
16752 <blockquote>Line one
16753
16754 Line two</blockquote>
16755 !! html
16756 <blockquote>Line one
16757 Line two</blockquote>
16758
16759 !! end
16760
16761 !! test
16762 Bug 6200: paragraphs inside blockquotes (extra line break on open)
16763 !! wikitext
16764 <blockquote>
16765 Line one
16766
16767 Line two</blockquote>
16768 !! html
16769 <blockquote>
16770 <p>Line one
16771 </p>
16772 Line two</blockquote>
16773
16774 !! end
16775
16776 !! test
16777 Bug 6200: paragraphs inside blockquotes (extra line break on close)
16778 !! wikitext
16779 <blockquote>Line one
16780
16781 Line two
16782 </blockquote>
16783 !! html
16784 <blockquote>Line one
16785 <p>Line two
16786 </p>
16787 </blockquote>
16788
16789 !! end
16790
16791 !! test
16792 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16793 !! wikitext
16794 <blockquote>
16795 Line one
16796
16797 Line two
16798 </blockquote>
16799 !! html
16800 <blockquote>
16801 <p>Line one
16802 </p><p>Line two
16803 </p>
16804 </blockquote>
16805
16806 !! end
16807
16808 !! test
16809 Paragraphs inside blockquotes/divs (no extra line breaks)
16810 !! wikitext
16811 <blockquote><div>Line one
16812
16813 Line two</div></blockquote>
16814 !! html
16815 <blockquote><div>Line one
16816 Line two</div></blockquote>
16817
16818 !! end
16819
16820 !! test
16821 Paragraphs inside blockquotes/divs (extra line break on open)
16822 !! wikitext
16823 <blockquote><div>
16824 Line one
16825
16826 Line two</div></blockquote>
16827 !! html
16828 <blockquote><div>
16829 <p>Line one
16830 </p>
16831 Line two</div></blockquote>
16832
16833 !! end
16834
16835 !! test
16836 Paragraphs inside blockquotes/divs (extra line break on close)
16837 !! wikitext
16838 <blockquote><div>Line one
16839
16840 Line two
16841 </div></blockquote>
16842 !! html
16843 <blockquote><div>Line one
16844 <p>Line two
16845 </p>
16846 </div></blockquote>
16847
16848 !! end
16849
16850 !! test
16851 Paragraphs inside blockquotes/divs (extra line break on open and close)
16852 !! wikitext
16853 <blockquote><div>
16854 Line one
16855
16856 Line two
16857 </div></blockquote>
16858 !! html
16859 <blockquote><div>
16860 <p>Line one
16861 </p><p>Line two
16862 </p>
16863 </div></blockquote>
16864
16865 !! end
16866
16867 !! test
16868 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16869 !! options
16870 wgLinkHolderBatchSize=0
16871 !! wikitext
16872 [[meatball:1]]
16873 [[meatball:2]]
16874 [[meatball:3]]
16875 !! html
16876 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16877 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16878 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16879 </p>
16880 !! end
16881
16882 !! test
16883 Free external link invading image caption
16884 !! wikitext
16885 [[Image:Foobar.jpg|thumb|http://x|hello]]
16886 !! html
16887 <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>
16888
16889 !! end
16890
16891 !! test
16892 Bug 15196: localised external link numbers
16893 !! options
16894 language=fa
16895 !! wikitext
16896 [http://en.wikipedia.org/]
16897 !! html/php
16898 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16899 </p>
16900 !! html/parsoid
16901 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
16902 !! end
16903
16904 !! test
16905 Multibyte character in padleft
16906 !! wikitext
16907 {{padleft:-Hello|7|Æ}}
16908 !! html
16909 <p>Æ-Hello
16910 </p>
16911 !! end
16912
16913 !! test
16914 Multibyte character in padright
16915 !! wikitext
16916 {{padright:Hello-|7|Æ}}
16917 !! html
16918 <p>Hello-Æ
16919 </p>
16920 !! end
16921
16922 !!test
16923 formatdate parser function
16924 !! wikitext
16925 {{#formatdate:2009-03-24}}
16926 !! html
16927 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
16928 </p>
16929 !! end
16930
16931 !!test
16932 formatdate parser function, with default format
16933 !! wikitext
16934 {{#formatdate:2009-03-24|mdy}}
16935 !! html
16936 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
16937 </p>
16938 !! end
16939
16940 !! test
16941 Spacing of numbers in formatted dates
16942 !! wikitext
16943 {{#formatdate:January 15}}
16944 !! html
16945 <p><span class="mw-formatted-date" title="01-15">January 15</span>
16946 </p>
16947 !! end
16948
16949 !! test
16950 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
16951 !! options
16952 language=nl title=[[MediaWiki:Common.css]]
16953 !! wikitext
16954 {{#formatdate:2009-03-24|dmy}}
16955 !! html
16956 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
16957 </p>
16958 !! end
16959
16960 #
16961 #
16962 #
16963
16964 #
16965 # Edit comments
16966 #
16967
16968 !! test
16969 Edit comment with link
16970 !! options
16971 comment
16972 !! wikitext
16973 I like the [[Main Page]] a lot
16974 !! html
16975 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
16976 !!end
16977
16978 !! test
16979 Edit comment with link and link text
16980 !! options
16981 comment
16982 !! wikitext
16983 I like the [[Main Page|best pages]] 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 link and link text with suffix
16990 !! options
16991 comment
16992 !! wikitext
16993 I like the [[Main Page|best page]]s a lot
16994 !! html
16995 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16996 !!end
16997
16998 !! test
16999 Edit comment with section link (non-local, eg in history list)
17000 !! options
17001 comment title=[[Main Page]]
17002 !! wikitext
17003 /* External links */ removed bogus entries
17004 !! html
17005 <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 and text before it (non-local, eg in history list)
17010 !! options
17011 comment title=[[Main Page]]
17012 !! wikitext
17013 pre-comment text /* External links */ removed bogus entries
17014 !! html
17015 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>
17016 !!end
17017
17018 !! test
17019 Edit comment with section link (local, eg in diff view)
17020 !! options
17021 comment local title=[[Main Page]]
17022 !! wikitext
17023 /* External links */ removed bogus entries
17024 !! html
17025 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17026 !!end
17027
17028 !! test
17029 Edit comment with subpage link (bug 14080)
17030 !! options
17031 comment
17032 subpage
17033 title=[[Subpage test]]
17034 !! wikitext
17035 Poked at a [[/subpage]] here...
17036 !! html
17037 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
17038 !!end
17039
17040 !! test
17041 Edit comment with subpage link and link text (bug 14080)
17042 !! options
17043 comment
17044 subpage
17045 title=[[Subpage test]]
17046 !! wikitext
17047 Poked at a [[/subpage|neat little page]] here...
17048 !! html
17049 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
17050 !!end
17051
17052 !! test
17053 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
17054 !! options
17055 comment
17056 title=[[Subpage test]]
17057 !! wikitext
17058 Poked at a [[/subpage]] here...
17059 !! html
17060 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...
17061 !!end
17062
17063 !! test
17064 Edit comment with bare anchor link (local, as on diff)
17065 !! options
17066 comment
17067 local
17068 title=[[Main Page]]
17069 !! wikitext
17070 [[#section]]
17071 !! html
17072 <a href="#section">#section</a>
17073 !! end
17074
17075 !! test
17076 Edit comment with bare anchor link (non-local, as on history)
17077 !! options
17078 comment
17079 title=[[Main Page]]
17080 !! wikitext
17081 [[#section]]
17082 !! html
17083 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
17084 !! end
17085
17086 !! test
17087 Anchor starting with underscore
17088 !! wikitext
17089 [[#_ref|One]]
17090 !! html
17091 <p><a href="#_ref">One</a>
17092 </p>
17093 !! end
17094
17095 !! test
17096 Id starting with underscore
17097 !! wikitext
17098 <div id="_ref"></div>
17099 !! html
17100 <div id="_ref"></div>
17101
17102 !! end
17103
17104 !! test
17105 Space normalisation on autocomment (bug 22784)
17106 !! options
17107 comment
17108 title=[[Main Page]]
17109 !! wikitext
17110 /* __hello__world__ */
17111 !! html
17112 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
17113 !! end
17114
17115 !! test
17116 percent-encoding and + signs in comments (Bug 26410)
17117 !! options
17118 comment
17119 !! wikitext
17120 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
17121 !! html
17122 <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>
17123 !! end
17124
17125 !! test
17126 Bad images - basic functionality
17127 !! options
17128 disabled
17129 !! wikitext
17130 [[File:Bad.jpg]]
17131 !! html
17132 !! end
17133
17134 !! test
17135 Bad images - bug 16039: text after bad image disappears
17136 !! options
17137 disabled
17138 !! wikitext
17139 Foo bar
17140 [[File:Bad.jpg]]
17141 Bar foo
17142 !! html
17143 <p>Foo bar
17144 </p><p>Bar foo
17145 </p>
17146 !! end
17147
17148 !! test
17149 Verify that displaytitle works (bug #22501) no displaytitle
17150 !! options
17151 showtitle
17152 !! config
17153 wgAllowDisplayTitle=true
17154 wgRestrictDisplayTitle=false
17155 !! wikitext
17156 this is not the the title
17157 !! html
17158 Parser test
17159 <p>this is not the the title
17160 </p>
17161 !! end
17162
17163 !! test
17164 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
17165 !! options
17166 showtitle
17167 title=[[Screen]]
17168 !! config
17169 wgAllowDisplayTitle=true
17170 wgRestrictDisplayTitle=false
17171 !! wikitext
17172 this is not the the title
17173 {{DISPLAYTITLE:whatever}}
17174 !! html
17175 whatever
17176 <p>this is not the the title
17177 </p>
17178 !! end
17179
17180 !! test
17181 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
17182 !! options
17183 showtitle
17184 title=[[Screen]]
17185 !! config
17186 wgAllowDisplayTitle=true
17187 wgRestrictDisplayTitle=true
17188 !! wikitext
17189 this is not the the title
17190 {{DISPLAYTITLE:whatever}}
17191 !! html
17192 Screen
17193 <p>this is not the the title
17194 </p>
17195 !! end
17196
17197 !! test
17198 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
17199 !! options
17200 showtitle
17201 title=[[Screen]]
17202 !! config
17203 wgAllowDisplayTitle=true
17204 wgRestrictDisplayTitle=true
17205 !! wikitext
17206 this is not the the title
17207 {{DISPLAYTITLE:screen}}
17208 !! html
17209 screen
17210 <p>this is not the the title
17211 </p>
17212 !! end
17213
17214 !! test
17215 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
17216 !! options
17217 showtitle
17218 title=[[Screen]]
17219 !! config
17220 wgAllowDisplayTitle=false
17221 !! wikitext
17222 this is not the the title
17223 {{DISPLAYTITLE:screen}}
17224 !! html
17225 Screen
17226 <p>this is not the the title
17227 <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>
17228 </p>
17229 !! end
17230
17231 !! test
17232 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
17233 !! options
17234 showtitle
17235 title=[[Screen]]
17236 !! config
17237 wgAllowDisplayTitle=false
17238 !! wikitext
17239 this is not the the title
17240 !! html
17241 Screen
17242 <p>this is not the the title
17243 </p>
17244 !! end
17245
17246 !! test
17247 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
17248 !! options
17249 showtitle
17250 title=[[Screen]]
17251 !! config
17252 wgAllowDisplayTitle=true
17253 wgRestrictDisplayTitle=true
17254 !! wikitext
17255 this is not the the title
17256 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
17257 !! html
17258 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
17259 <p>this is not the the title
17260 </p>
17261 !! end
17262
17263 !! test
17264 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
17265 !! options
17266 showtitle
17267 title=[[Screen]]
17268 !! config
17269 wgAllowDisplayTitle=true
17270 wgRestrictDisplayTitle=true
17271 !! wikitext
17272 this is not the the title
17273 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
17274 !! html
17275 <span style="color: red;">s</span>creen
17276 <p>this is not the the title
17277 </p>
17278 !! end
17279
17280 !! test
17281 preload: check <noinclude> and <includeonly>
17282 !! options
17283 preload
17284 !! wikitext
17285 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
17286 !! html
17287 Hello kind world.
17288 !! end
17289
17290 !! test
17291 preload: check <onlyinclude>
17292 !! options
17293 preload
17294 !! wikitext
17295 Goodbye <onlyinclude>Hello world</onlyinclude>
17296 !! html
17297 Hello world
17298 !! end
17299
17300 !! test
17301 preload: can pass tags through if we want to
17302 !! options
17303 preload
17304 !! wikitext
17305 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
17306 !! html
17307 <includeonly>Hello world</includeonly>
17308 !! end
17309
17310 !! test
17311 preload: check that it doesn't try to do tricks
17312 !! options
17313 preload
17314 !! wikitext
17315 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17316 !! html
17317 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17318 !! end
17319
17320 !! test
17321 Play a bit with r67090 and bug 3158
17322 !! options
17323 disabled
17324 !! wikitext
17325 <div style="width:50% !important">&nbsp;</div>
17326 <div style="width:50%&nbsp;!important">&nbsp;</div>
17327 <div style="width:50%&#160;!important">&nbsp;</div>
17328 <div style="border : solid;">&nbsp;</div>
17329 !! html
17330 <div style="width:50% !important">&nbsp;</div>
17331 <div style="width:50% !important">&nbsp;</div>
17332 <div style="width:50% !important">&nbsp;</div>
17333 <div style="border&#160;: solid;">&nbsp;</div>
17334
17335 !! end
17336
17337 !! test
17338 HTML5 data attributes
17339 !! wikitext
17340 <span data-foo="bar">Baz</span>
17341 <p data-abc-def_hij="">Quuz</p>
17342 !! html
17343 <p><span data-foo="bar">Baz</span>
17344 </p>
17345 <p data-abc-def_hij="">Quuz</p>
17346
17347 !! end
17348
17349 !! test
17350 percent-encoding and + signs in internal links (Bug 26410)
17351 !! wikitext
17352 [[User:+%]] [[Page+title%]]
17353 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
17354 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
17355 [[%33%45]] [[%33%45+]]
17356 !! html
17357 <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>
17358 <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>
17359 <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>
17360 <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>
17361 </p>
17362 !! end
17363
17364 !! test
17365 Special characters in embedded file links (bug 27679)
17366 !! wikitext
17367 [[File:Contains & ampersand.jpg]]
17368 [[File:Does not exist.jpg|Title with & ampersand]]
17369 !! html
17370 <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>
17371 <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>
17372 </p>
17373 !! end
17374
17375
17376 !! test
17377 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
17378 !! wikitext
17379 Text&apos;s been normalized?
17380 !! html
17381 <p>Text&#39;s been normalized?
17382 </p>
17383 !! end
17384
17385 !! test
17386 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
17387 !! wikitext
17388 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
17389 !! html
17390 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
17391 </p>
17392 !! end
17393
17394 !! test
17395 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
17396 !! wikitext
17397 [http://www.example.org/ ideograms]
17398 !! html
17399 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
17400 </p>
17401 !! end
17402
17403 !! test
17404 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
17405 !! wikitext
17406 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
17407 !! html
17408 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
17409 </p>
17410 !! end
17411
17412 !! article
17413 Mediawiki:loop1
17414 !! text
17415 {{Identical|A}}
17416 !! endarticle
17417
17418 !! article
17419 Mediawiki:loop2
17420 !! text
17421 {{Identical|B}}
17422 !! endarticle
17423
17424 !! article
17425 Template:Identical
17426 !! text
17427 {{int:loop1}}
17428 {{int:loop2}}
17429 !! endarticle
17430
17431 !! test
17432 Bug 31098 Template which includes system messages which includes the template
17433 !! wikitext
17434 {{Identical}}
17435 !! html
17436 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17437 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17438 </p>
17439 !! end
17440
17441 !! test
17442 Bug31490 Turkish: ucfirst 'blah'
17443 !! options
17444 language=tr
17445 !! wikitext
17446 {{ucfirst:blah}}
17447 !! html
17448 <p>Blah
17449 </p>
17450 !! end
17451
17452 !! test
17453 Bug31490 Turkish: ucfirst 'ix'
17454 !! options
17455 language=tr
17456 !! wikitext
17457 {{ucfirst:ix}}
17458 !! html
17459 <p>İx
17460 </p>
17461 !! end
17462
17463 !! test
17464 Bug31490 Turkish: lcfirst 'BLAH'
17465 !! options
17466 language=tr
17467 !! wikitext
17468 {{lcfirst:BLAH}}
17469 !! html
17470 <p>bLAH
17471 </p>
17472 !! end
17473
17474 !! test
17475 Bug31490 Turkish: ucfırst (with a dotless i)
17476 !! options
17477 language=tr
17478 !! wikitext
17479 {{ucfırst:blah}}
17480 !! html
17481 <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>
17482 </p>
17483 !! end
17484
17485 !! test
17486 Bug31490 ucfırst (with a dotless i) with English language
17487 !! options
17488 language=en
17489 !! wikitext
17490 {{ucfırst:blah}}
17491 !! html
17492 <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>
17493 </p>
17494 !! end
17495
17496 !! test
17497 Bug 26375: TOC with italics
17498 !! options
17499 title=[[Main Page]]
17500 !! wikitext
17501 __TOC__
17502 == ''Lost'' episodes ==
17503 !! html
17504 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17505 <ul>
17506 <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>
17507 </ul>
17508 </div>
17509
17510 <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>
17511
17512 !! end
17513
17514 !! test
17515 Bug 26375: TOC with bold
17516 !! options
17517 title=[[Main Page]]
17518 !! wikitext
17519 __TOC__
17520 == '''should be bold''' then normal text ==
17521 !! html
17522 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17523 <ul>
17524 <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>
17525 </ul>
17526 </div>
17527
17528 <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>
17529
17530 !! end
17531
17532 !! test
17533 Bug 33845: Headings become cursive in TOC when they contain an image
17534 !! options
17535 title=[[Main Page]]
17536 !! wikitext
17537 __TOC__
17538 == Image [[Image:foobar.jpg]] ==
17539 !! html
17540 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17541 <ul>
17542 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
17543 </ul>
17544 </div>
17545
17546 <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>
17547
17548 !! end
17549
17550 !! test
17551 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
17552 !! options
17553 title=[[Main Page]]
17554 !! wikitext
17555 __TOC__
17556 == <blockquote>Quote</blockquote> ==
17557 !! html
17558 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17559 <ul>
17560 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
17561 </ul>
17562 </div>
17563
17564 <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>
17565
17566 !! end
17567
17568 !! test
17569 Unclosed tags in TOC
17570 !! options
17571 title=[[Main Page]]
17572 !! wikitext
17573 __TOC__
17574 == Proof: 2 < 3 ==
17575 <small>Hanc marginis exiguitas non caperet.</small>
17576 QED
17577 !! html
17578 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17579 <ul>
17580 <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>
17581 </ul>
17582 </div>
17583
17584 <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>
17585 <p><small>Hanc marginis exiguitas non caperet.</small>
17586 QED
17587 </p>
17588 !! end
17589
17590 !! test
17591 Multiple tags in TOC
17592 !! wikitext
17593 __TOC__
17594 == <i>Foo</i> <b>Bar</b> ==
17595
17596 == <i>Foo</i> <blockquote>Bar</blockquote> ==
17597 !! html
17598 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17599 <ul>
17600 <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>
17601 <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>
17602 </ul>
17603 </div>
17604
17605 <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>
17606 <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>
17607
17608 !! end
17609
17610 !! test
17611 Tags with parameters in TOC
17612 !! wikitext
17613 __TOC__
17614 == <sup class="in-h2">Hello</sup> ==
17615
17616 == <sup class="a > b">Evilbye</sup> ==
17617 !! html
17618 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17619 <ul>
17620 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
17621 <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>
17622 </ul>
17623 </div>
17624
17625 <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>
17626 <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>
17627
17628 !! end
17629
17630 !! test
17631 span tags with directionality in TOC
17632 !! wikitext
17633 __TOC__
17634 == <span dir="ltr">C++</span> ==
17635
17636 == <span dir="rtl">זבנג!</span> ==
17637
17638 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
17639
17640 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
17641
17642 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
17643 !! html
17644 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17645 <ul>
17646 <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>
17647 <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>
17648 <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>
17649 <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>
17650 <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>
17651 </ul>
17652 </div>
17653
17654 <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>
17655 <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>
17656 <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>
17657 <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>
17658 <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>
17659
17660 !! end
17661
17662 !! article
17663 MediaWiki:Bug32057
17664 !! text
17665 == {{int:headline_sample}} ==
17666 !! endarticle
17667
17668 !! test
17669 Bug 32057: Title needed when expanding <h> nodes.
17670 !! options
17671 title=[[Main Page]]
17672 !! wikitext
17673 {{int:Bug32057}}
17674 !! html
17675 <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>
17676
17677 !! end
17678
17679 !! test
17680 Strip marker in urlencode
17681 !! wikitext
17682 {{urlencode:x<nowiki/>y}}
17683 {{urlencode:x<nowiki/>y|wiki}}
17684 {{urlencode:x<nowiki/>y|path}}
17685 !! html
17686 <p>xy
17687 xy
17688 xy
17689 </p>
17690 !! end
17691
17692 !! test
17693 Strip marker in lc
17694 !! wikitext
17695 {{lc:x<nowiki/>y}}
17696 !! html
17697 <p>xy
17698 </p>
17699 !! end
17700
17701 !! test
17702 Strip marker in uc
17703 !! wikitext
17704 {{uc:x<nowiki/>y}}
17705 !! html
17706 <p>XY
17707 </p>
17708 !! end
17709
17710 !! test
17711 Strip marker in formatNum
17712 !! wikitext
17713 {{formatnum:1<nowiki/>2}}
17714 {{formatnum:1<nowiki/>2|R}}
17715 !! html
17716 <p>12
17717 12
17718 </p>
17719 !! end
17720
17721 !! test
17722 Check noCommafy in formatNum
17723 !! options
17724 language=be-tarask
17725 !! wikitext
17726 {{formatnum:123456.78}}
17727 {{formatnum:123456.78|NOSEP}}
17728 !! html
17729 <p>123 456,78
17730 123456.78
17731 </p>
17732 !! end
17733
17734 !! test
17735 Wrong option for formatNum (bug 56199)
17736 !! wikitext
17737 {{formatnum:1,234.56|Random}}
17738 {{formatnum:1,234.56|EVERYTHING}}
17739 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
17740 !! html
17741 <p>1,234.56
17742 1,234.56
17743 1,234.56
17744 </p>
17745 !! end
17746
17747 !! test
17748 Strip marker in grammar
17749 !! options
17750 language=fi
17751 !! wikitext
17752 {{grammar:elative|foo<nowiki/>bar}}
17753 !! html
17754 <p>foobarista
17755 </p>
17756 !! end
17757
17758 !! test
17759 Strip marker in padleft
17760 !! wikitext
17761 {{padleft:|2|x<nowiki/>y}}
17762 !! html
17763 <p>xy
17764 </p>
17765 !! end
17766
17767 !! test
17768 Strip marker in padright
17769 !! wikitext
17770 {{padright:|2|x<nowiki/>y}}
17771 !! html
17772 <p>xy
17773 </p>
17774 !! end
17775
17776 !! test
17777 Strip marker in anchorencode
17778 !! wikitext
17779 {{anchorencode:x<nowiki/>y}}
17780 !! html
17781 <p>xy
17782 </p>
17783 !! end
17784
17785 !! test
17786 nowiki inside link inside heading (bug 18295)
17787 !! wikitext
17788 ==[[foo|x<nowiki>y</nowiki>z]]==
17789 !! html
17790 <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>
17791
17792 !! end
17793
17794 !! test
17795 new support for bdi element (bug 31817)
17796 !! wikitext
17797 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17798 !! html
17799 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17800
17801 !!end
17802
17803 !! test
17804 Ignore pipe between table row attributes
17805 !! wikitext
17806 {|
17807 | quux
17808 |- id=foo | style='color: red'
17809 | bar
17810 |}
17811 !! html
17812 <table>
17813 <tr>
17814 <td> quux
17815 </td></tr>
17816 <tr id="foo" style="color: red">
17817 <td> bar
17818 </td></tr></table>
17819
17820 !! end
17821
17822 !!test
17823 Gallery override link with WikiLink (bug 34852)
17824 !! wikitext
17825 <gallery>
17826 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17827 </gallery>
17828 !! html
17829 <ul class="gallery mw-gallery-traditional">
17830 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17831 <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>
17832 <div class="gallerytext">
17833 <p>caption
17834 </p>
17835 </div>
17836 </div></li>
17837 </ul>
17838
17839 !! end
17840
17841 !!test
17842 Gallery override link with absolute external link (bug 34852)
17843 !! wikitext
17844 <gallery>
17845 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17846 </gallery>
17847 !! html
17848 <ul class="gallery mw-gallery-traditional">
17849 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17850 <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>
17851 <div class="gallerytext">
17852 <p>caption
17853 </p>
17854 </div>
17855 </div></li>
17856 </ul>
17857
17858 !! end
17859
17860 !!test
17861 Gallery override link with malicious javascript (bug 34852)
17862 !! wikitext
17863 <gallery>
17864 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17865 </gallery>
17866 !! html
17867 <ul class="gallery mw-gallery-traditional">
17868 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17869 <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>
17870 <div class="gallerytext">
17871 <p>caption
17872 </p>
17873 </div>
17874 </div></li>
17875 </ul>
17876
17877 !! end
17878
17879 !!test
17880 Gallery with invalid title as link (bug 43964)
17881 !! wikitext
17882 <gallery>
17883 File:foobar.jpg|link=<
17884 </gallery>
17885 !! html
17886 <ul class="gallery mw-gallery-traditional">
17887 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17888 <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>
17889 <div class="gallerytext">
17890 </div>
17891 </div></li>
17892 </ul>
17893
17894 !! end
17895
17896 !!test
17897 Language parser function
17898 !! wikitext
17899 {{#language:ar}}
17900 !! html
17901 <p>العربية
17902 </p>
17903 !! end
17904
17905 !!test
17906 Padleft and padright as substr
17907 !! wikitext
17908 {{padleft:|3|abcde}}
17909 {{padright:|3|abcde}}
17910 !! html
17911 <p>abc
17912 abc
17913 </p>
17914 !! end
17915
17916 !!test
17917 Special parser function
17918 !! wikitext
17919 {{#special:RandomPage}}
17920 {{#special:BaDtItLe}}
17921 {{#special:Foobar}}
17922 !! html
17923 <p>Special:Random
17924 Special:Badtitle
17925 Special:Foobar
17926 </p>
17927 !! end
17928
17929 !!test
17930 Bug 34939 - Case insensitive link parsing ([HttP://])
17931 !! wikitext
17932 [HttP://MediaWiki.Org/]
17933 !! html/php
17934 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
17935 </p>
17936 !! html/parsoid
17937 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
17938 !! end
17939
17940 !!test
17941 Bug 34939 - Case insensitive link parsing ([HttP:// title])
17942 !! wikitext
17943 [HttP://MediaWiki.Org/ MediaWiki]
17944 !! html
17945 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
17946 </p>
17947 !! end
17948
17949 !!test
17950 Bug 34939 - Case insensitive link parsing (HttP://)
17951 !! wikitext
17952 HttP://MediaWiki.Org/
17953 !! html/php
17954 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
17955 </p>
17956 !! html/parsoid
17957 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
17958 !! end
17959
17960 !!test
17961 Disable TOC
17962 !! options
17963 notoc
17964 !! wikitext
17965 Lead
17966 == Section 1 ==
17967 == Section 2 ==
17968 == Section 3 ==
17969 == Section 4 ==
17970 == Section 5 ==
17971 !! html
17972 <p>Lead
17973 </p>
17974
17975 <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>
17976 <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>
17977 <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>
17978 <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>
17979 <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>
17980
17981 !! end
17982
17983
17984 ###
17985 ### Parsoid-specific tests
17986 ### Parsoid-PHP parser incompatibilities
17987 ###
17988 !!test
17989 1. SOL-sensitive wikitext tokens as template-args
17990 !!options
17991 parsoid=wt2html,wt2wt
17992 !! wikitext
17993 {{echo|*a}}
17994 {{echo|#a}}
17995 {{echo|:a}}
17996 !! html
17997 <span about="#mwt1" typeof="mw:Transclusion">
17998 </span><ul about="#mwt1"><li>a</li>
17999 </ul>
18000 <span about="#mwt2" typeof="mw:Transclusion">
18001 </span><ol about="#mwt2"><li>a</li>
18002 </ol>
18003 <span about="#mwt3" typeof="mw:Transclusion">
18004 </span><dl about="#mwt3"><dd>a</dd>
18005 </dl>
18006 !!end
18007
18008 #### -----------------------------------------------------------------
18009 #### Parsoid-specific functionality tests
18010 #### -----------------------------------------------------------------
18011
18012 # Bug 63642: Formatting elt fixup is cleaned up.
18013 # We know wt2wt will fail, but we expect selser to pass.
18014 # Due to the nature of our testing, wt2wt and selser tests will enter the
18015 # blacklist and we'll catch selser regressions based on changes to the
18016 # blacklist entries for selser tests.
18017 !! test
18018 Bad treebuilder fixup of formatting elt is cleaned up
18019 !! options
18020 parsoid=wt2html,wt2wt
18021 !! wikitext
18022 {|
18023 |
18024 <small>
18025 [[Image:Foobar.jpg|right|Test]]
18026 </small>
18027 |}
18028 !! html/parsoid
18029 <table>
18030 <tbody><tr><td>
18031 <p><small></small></p>
18032 <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>
18033 <p></p></td></tr>
18034 </tbody></table>
18035 !! end
18036
18037 #### ----------------------------------------------------------------
18038 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
18039 #### tags. Parsoid's output for these tags differs from that of the
18040 #### PHP parser.
18041 #### ----------------------------------------------------------------
18042
18043 !!test
18044 Ref: 1. ref-location should be replaced with an index span
18045 !!options
18046 parsoid
18047 !! wikitext
18048 A <ref>foo</ref>
18049 B <ref name="x">foo</ref>
18050 C <ref name="y" />
18051 !! html
18052 <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>
18053 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>
18054 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>
18055 !!end
18056
18057 !!test
18058 Ref: 2. ref-tags with identical names should all get the same index
18059 !!options
18060 parsoid
18061 !! wikitext
18062 A <ref name="x">foo</ref>
18063 B <ref name="x" />
18064 !! html
18065 <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>
18066 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>
18067 !!end
18068
18069 !!test
18070 Ref: 3. spaces in ref-names should be ignored
18071 !!options
18072 parsoid
18073 !! wikitext
18074 A <ref name="x">foo</ref>
18075 B <ref name=" x " />
18076 C <ref name= x />
18077 !! html
18078 <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>
18079 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>
18080 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>
18081 !!end
18082
18083 !!test
18084 Ref: 4. 'constructor' should be accepted as a valid ref-name
18085 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
18086 !!options
18087 parsoid
18088 !! wikitext
18089 A <ref name="constructor">foo</ref>
18090 !! html
18091 <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>
18092 !!end
18093
18094 !!test
18095 Ref: 5. body should accept generic wikitext
18096 !!options
18097 parsoid
18098 !! wikitext
18099 A <ref>
18100 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
18101 </ref>
18102
18103 <references />
18104 !! html
18105 <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>
18106
18107 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
18108 <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>
18109 </li>
18110 </ol>
18111 !!end
18112
18113 !!test
18114 Ref: 6. indent-pres should not be output in ref-body
18115 !!options
18116 parsoid
18117 !! wikitext
18118 A <ref>
18119 foo
18120 bar
18121 baz
18122 </ref>
18123
18124 <references />
18125 !! html
18126 <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>
18127
18128 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
18129 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18130 bar
18131 baz
18132 </li>
18133 </ol>
18134 !!end
18135
18136 !!test
18137 Ref: 7. No p-wrapping in ref-body
18138 !!options
18139 parsoid
18140 !! wikitext
18141 A <ref>
18142 foo
18143
18144 bar
18145
18146
18147 baz
18148
18149
18150
18151 booz
18152 </ref>
18153
18154 <references />
18155 !! html
18156 <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>
18157
18158 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18159 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18160
18161 bar
18162
18163
18164 baz
18165
18166
18167
18168 booz
18169 </li>
18170 </ol>
18171 !!end
18172
18173 !!test
18174 Ref: 8. transclusion wikitext has lower precedence
18175 !!options
18176 parsoid
18177 !! wikitext
18178 A <ref> foo {{echo|</ref> B C}}
18179
18180 <references />
18181 !! html
18182 <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>
18183 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
18184 <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>
18185 </ol>
18186 !!end
18187
18188 !!test
18189 Ref: 9. unclosed comments should not leak out of ref-body
18190 !!options
18191 parsoid
18192 !! wikitext
18193 A <ref> foo <!--</ref> B C
18194 <references />
18195 !! html
18196 <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>
18197 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18198 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
18199 </ol>
18200 !!end
18201
18202 !!test
18203 Ref: 10. Unclosed HTML tags should not leak out of ref-body
18204 !!options
18205 parsoid
18206 !! wikitext
18207 A <ref> <b> foo </ref> B C
18208
18209 <references />
18210 !! html
18211 <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>
18212
18213
18214 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18215 <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>
18216 </ol>
18217 !!end
18218
18219 !!test
18220 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
18221 !!options
18222 parsoid
18223 !! wikitext
18224 A <ref>foo</ref> B
18225 C <ref>bar</ref> D
18226 !! html
18227 <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
18228 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>
18229 !!end
18230
18231 !!test
18232 Ref: 12. ref-tags act as trailing newline migration barrier
18233 !!options
18234 parsoid
18235 !! wikitext
18236 <!--the newline at the end of this line moves out of the p-tag-->a
18237
18238 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
18239 <ref />
18240
18241 c
18242 !! html
18243 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
18244
18245
18246 <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>
18247 <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>
18248
18249
18250 <p>c</p>
18251 !!end
18252
18253 !!test
18254 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
18255 !!options
18256 parsoid
18257 !! wikitext
18258 <ref>foo</ref> A
18259 <ref>bar
18260 </ref> B
18261 !! html
18262 <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
18263 <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>
18264 !!end
18265
18266 !!test
18267 Ref: 14. A nested ref-tag should be emitted as plain text
18268 !!options
18269 parsoid
18270 !! wikitext
18271 <ref>foo <ref>bar</ref> baz</ref>
18272
18273 <references />
18274 !! html
18275 <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>
18276
18277 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18278 <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>
18279 </ol>
18280 !!end
18281
18282 !!test
18283 Ref: 15. ref-tags with identical names should get identical indexes
18284 !!options
18285 parsoid
18286 !! wikitext
18287 A1 <ref name="a">foo</ref> A2 <ref name="a" />
18288 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
18289
18290 <references />
18291 !! html
18292 <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>
18293 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>
18294
18295 <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>
18296 </ol>
18297 !!end
18298
18299 ## We don't bother wt2wt-ing non-standard whitespace
18300 !!test
18301 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
18302 !!options
18303 parsoid=wt2html
18304 !! wikitext
18305 A <ref >foo</ref >
18306
18307 <references />
18308 !! html
18309 <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>
18310
18311 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18312 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
18313 !!end
18314
18315 !!test
18316 References: 1. references tag without any refs should be handled properly
18317 !!options
18318 parsoid
18319 !! wikitext
18320 <references />
18321 !! html
18322 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
18323 !!end
18324
18325 !!test
18326 References: 2. references tag with group only outputs references from that group
18327 !!options
18328 parsoid
18329 !! wikitext
18330 A <ref group="a">foo</ref>
18331 B <ref group="b">bar</ref>
18332
18333 <references group="a" />
18334 !! html
18335 <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>
18336 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>
18337
18338 <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>
18339 </ol>
18340 !!end
18341
18342 !!test
18343 References: 3. ref list should be cleared after processing references
18344 !!options
18345 parsoid
18346 !! wikitext
18347 A <ref>foo</ref>
18348
18349 <references />
18350
18351 B <ref>bar</ref>
18352
18353 <references />
18354 !! html
18355 <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>
18356
18357 <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>
18358 </ol>
18359
18360 <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>
18361
18362 <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>
18363 </ol>
18364 !!end
18365
18366 !!test
18367 References: 4. only referenced group should be cleared after processing references
18368 !!options
18369 parsoid
18370 !! wikitext
18371 A <ref group="a">afoo</ref>
18372 B <ref>bfoo</ref>
18373
18374 <references group="a" />
18375
18376 C <ref>cfoo</ref>
18377
18378 <references />
18379 !! html
18380 <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>
18381 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>
18382
18383 <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>
18384 </ol>
18385
18386 <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>
18387
18388 <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>
18389 </ol>
18390 !!end
18391
18392 !!test
18393 References: 5. ref tags in references should be processed while ignoring all other content
18394 !!options
18395 parsoid
18396 !! wikitext
18397 A <ref name="a" />
18398 B <ref name="b">bar</ref>
18399
18400 <references>
18401 <ref name="a">foo</ref>
18402 This should just get lost.
18403 </references>
18404 !! html
18405 <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>
18406 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>
18407
18408
18409 <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":{}}'>
18410 <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>
18411 <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>
18412 </ol>
18413 !!end
18414
18415 !!test
18416 References: 6. <references /> from a transclusion
18417 !!options
18418 parsoid
18419 !! wikitext
18420 <ref>Foo</ref> {{echo|<references />}}
18421 !! html
18422 <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>
18423 !!end
18424
18425 !! test
18426 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
18427 !! options
18428 parsoid
18429 !! wikitext
18430 A <ref>foo bar for a</ref>
18431 B <ref group="X" name="b" />
18432
18433 <references />
18434
18435 <references group="X">
18436 <ref name="b">foo</ref>
18437 </references>
18438 !! html
18439 <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>
18440 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>
18441
18442 <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>
18443
18444 <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>
18445 !! end
18446
18447 !! test
18448 Entities in ref name
18449 !! options
18450 parsoid
18451 !! wikitext
18452 <ref name="test &amp; me">hi</ref>
18453 !! html
18454 <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>
18455 !! end
18456
18457 # This test is wt2html only because we're permitting the serializer to produce
18458 # dirty diffs, normalizing the unclosed references to the self-closed version.
18459 !! test
18460 Generate references for unclosed references tag
18461 !! options
18462 parsoid=wt2html
18463 !! wikitext
18464 a<ref>foo</ref>
18465
18466 <references>
18467 !! html
18468 <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>
18469
18470
18471 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
18472 <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>
18473 !! end
18474
18475 !! test
18476 New reference serializes on its own line
18477 !! options
18478 parsoid=wt2wt,html2wt
18479 !! wikitext
18480 foo
18481 <references />
18482 !! html
18483 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
18484 !! end
18485
18486 #### ----------------------------------------------------------------
18487 #### The following section of tests are primarily to test
18488 #### wikitext escaping capabilities of Parsoid. Given that
18489 #### escaping can be done any number of ways, the wikitext (input)
18490 #### is always adjusted to reflect how Parsoid adds nowiki
18491 #### escape tags.
18492 ####
18493 #### We are marking several tests as parsoid-only since the
18494 #### HTML in the result section is different from what the
18495 #### PHP parser generates for it.
18496 #### ----------------------------------------------------------------
18497
18498
18499 #### --------------- Headings ---------------
18500 #### 0. Unnested
18501 #### 1. Nested inside html <h1>=foo=</h1>
18502 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
18503 #### 3. Nested inside html with wikitext split by html tags
18504 #### 4. No escape needed
18505 #### 5. Empty headings <h1></h1>
18506 #### 6. Heading chars in SOL context
18507 #### ----------------------------------------
18508 !! test
18509 Headings: 0. Unnested
18510 !! options
18511 parsoid
18512 !! wikitext
18513 <nowiki>=foo=</nowiki>
18514
18515 <nowiki> =foo= </nowiki>
18516 <!--cmt-->
18517 <nowiki>=foo=</nowiki>
18518
18519 =foo''a''<nowiki>=</nowiki>
18520 !! html
18521 <p><span typeof="mw:Nowiki">=foo=</span></p>
18522
18523 <p><span typeof="mw:Nowiki"> =foo= </span>
18524 <!--cmt-->
18525 <span typeof="mw:Nowiki">=foo=</span></p>
18526
18527 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
18528 !!end
18529
18530 !! test
18531 Headings: 1. Nested inside html
18532 (New headings and existing headings are handled differently)
18533 !! options
18534 parsoid=html2wt
18535 !! wikitext
18536 = =foo= =
18537
18538 == =foo= ==
18539
18540 === =foo= ===
18541
18542 =<nowiki>=foo=</nowiki>=
18543 ==<nowiki>=foo=</nowiki>==
18544 ===<nowiki>=foo=</nowiki>===
18545 ====<nowiki>=foo=</nowiki>====
18546 =====<nowiki>=foo=</nowiki>=====
18547 ======<nowiki>=foo=</nowiki>======
18548
18549 !! html
18550 <h1>=foo=</h1>
18551 <h2>=foo=</h2>
18552 <h3>=foo=</h3>
18553
18554 <h1 data-parsoid='{}'>=foo=</h1>
18555 <h2 data-parsoid='{}'>=foo=</h2>
18556 <h3 data-parsoid='{}'>=foo=</h3>
18557 <h4 data-parsoid='{}'>=foo=</h4>
18558 <h5 data-parsoid='{}'>=foo=</h5>
18559 <h6 data-parsoid='{}'>=foo=</h6>
18560 !!end
18561
18562 !! test
18563 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
18564 !! options
18565 parsoid=html2wt
18566 !! wikitext
18567 = foo =
18568 <nowiki>*</nowiki>bar
18569
18570 = foo =
18571 =bar
18572
18573 = foo =
18574 <nowiki>=bar=</nowiki>
18575 !! html
18576 <h1>foo</h1>*bar
18577 <h1>foo</h1>=bar
18578 <h1>foo</h1>=bar=
18579 !!end
18580
18581 !! test
18582 Headings: 3. Nested inside html with wikitext split by html tags
18583 !! options
18584 parsoid=html2wt
18585 !! wikitext
18586 = ='''bold'''<nowiki>foo=</nowiki> =
18587 !! html
18588 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
18589 !!end
18590
18591 !! test
18592 Headings: 4a. No escaping needed (testing just h1 and h2)
18593 !! options
18594 parsoid=html2wt
18595 !! wikitext
18596 = =foo =
18597
18598 = foo= =
18599
18600 = =foo= =
18601
18602 = =foo= bar =
18603
18604 == =foo ==
18605
18606 == foo= ==
18607
18608 = ''=''foo= =
18609
18610 = <nowiki>=</nowiki> =
18611 !! html
18612 <h1>=foo</h1>
18613 <h1>foo=</h1>
18614 <h1> =foo= </h1>
18615 <h1>=foo= bar</h1>
18616 <h2>=foo</h2>
18617 <h2>foo=</h2>
18618 <h1><i>=</i>foo=</h1>
18619 <h1><span typeof="mw:Nowiki">=</span></h1>
18620 !!end
18621
18622 !! test
18623 Headings: 4b. No escaping needed (inside p-tags)
18624 !! options
18625 parsoid=html2wt
18626 !! wikitext
18627 ===
18628 =foo= x
18629 =foo= <s></s>
18630 !! html
18631 <p>===
18632 =foo= x
18633 =foo= <s></s>
18634 </p>
18635 !!end
18636
18637 !! test
18638 Headings: 5. Empty headings
18639 !! options
18640 parsoid
18641 !! wikitext
18642 =<nowiki/>=
18643
18644 ==<nowiki/>==
18645
18646 ===<nowiki/>===
18647
18648 ====<nowiki/>====
18649
18650 =====<nowiki/>=====
18651
18652 ======<nowiki/>======
18653 !! html
18654 <h1></h1>
18655 <h2></h2>
18656 <h3></h3>
18657 <h4></h4>
18658 <h5></h5>
18659 <h6></h6>
18660 !!end
18661
18662 !! test
18663 Headings: 6a. Heading chars in SOL context (with trailing spaces)
18664 !! options
18665 parsoid
18666 !! wikitext
18667 <nowiki>=a=</nowiki>
18668
18669 <nowiki>=a=</nowiki>
18670
18671 <nowiki>=a=</nowiki>
18672
18673 <nowiki>=a=</nowiki>
18674 !! html
18675 <p>=a=</p>
18676 <p>=a= </p>
18677 <p>=a= </p>
18678 <p>=a= </p>
18679 !!end
18680
18681 !! test
18682 Headings: 6b. Heading chars in SOL context (with trailing newlines)
18683 !! options
18684 parsoid
18685 !! wikitext
18686 <nowiki>=a=
18687 b</nowiki>
18688
18689 <nowiki>=a=
18690 b</nowiki>
18691
18692 <nowiki>=a=
18693 b</nowiki>
18694
18695 <nowiki>=a=
18696 b</nowiki>
18697 !! html
18698 <p>=a=
18699 b</p>
18700 <p>=a=
18701 b</p>
18702 <p>=a=
18703 b</p>
18704 <p>=a=
18705 b</p>
18706 </p>
18707 !!end
18708
18709 !! test
18710 Headings: 6c. Heading chars in SOL context (leading newline break)
18711 !! options
18712 parsoid
18713 !! wikitext
18714 a
18715 <nowiki>=b=</nowiki>
18716 !! html
18717 <p>a
18718 =b=</p>
18719 !!end
18720
18721 !! test
18722 Headings: 6d. Heading chars in SOL context (with interspersed comments)
18723 !! options
18724 parsoid
18725 !! wikitext
18726 <!--c0--><nowiki>=a=</nowiki>
18727
18728 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
18729 !! html
18730 <p><!--c0-->=a=</p>
18731 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
18732 !!end
18733
18734 !! test
18735 Headings: 6d. Heading chars in SOL context (No escaping needed)
18736 !! options
18737 parsoid=html2wt
18738 !! wikitext
18739 =a=<div>b</div>
18740 !! html
18741 =a=<div>b</div>
18742 !!end
18743
18744 #### --------------- Lists ---------------
18745 #### 0. Outside nests (*foo, etc.)
18746 #### 1. Nested inside html <ul><li>*foo</li></ul>
18747 #### 2. Inside definition lists
18748 #### 3. Only bullets at start should be escaped
18749 #### 4. No escapes needed
18750 #### 5. No unnecessary escapes
18751 #### 6. Escape bullets in SOL position
18752 #### 7. Escape bullets in a multi-line context
18753 #### ----------------------------------------
18754
18755 !! test
18756 Lists: 0. Outside nests
18757 !! wikitext
18758 <nowiki>*</nowiki>foo
18759
18760 <nowiki>#</nowiki>foo
18761
18762 <nowiki>;Foo:</nowiki>bar
18763 !! html
18764 <p>*foo
18765 </p><p>#foo
18766 </p><p>;Foo:bar
18767 </p>
18768 !!end
18769
18770 !! test
18771 Lists: 1. Nested inside html
18772 !! wikitext
18773 *<nowiki>*foo</nowiki>
18774
18775 *<nowiki>#foo</nowiki>
18776
18777 *<nowiki>:foo</nowiki>
18778
18779 *<nowiki>;foo</nowiki>
18780
18781 #<nowiki>*foo</nowiki>
18782
18783 #<nowiki>#foo</nowiki>
18784
18785 #<nowiki>:foo</nowiki>
18786
18787 #<nowiki>;foo</nowiki>
18788 !! html
18789 <ul><li>*foo</li></ul>
18790 <ul><li>#foo</li></ul>
18791 <ul><li>:foo</li></ul>
18792 <ul><li>;foo</li></ul>
18793 <ol><li>*foo</li></ol>
18794 <ol><li>#foo</li></ol>
18795 <ol><li>:foo</li></ol>
18796 <ol><li>;foo</li></ol>
18797
18798 !!end
18799
18800 !! test
18801 Lists: 2. Inside definition lists
18802 !! wikitext
18803 ;<nowiki>;foo</nowiki>
18804
18805 ;<nowiki>:foo</nowiki>
18806
18807 ;<nowiki>:foo</nowiki>
18808 :bar
18809
18810 :<nowiki>:foo</nowiki>
18811 !! html
18812 <dl><dt>;foo</dt></dl>
18813 <dl><dt>:foo</dt></dl>
18814 <dl><dt>:foo</dt>
18815 <dd>bar</dd></dl>
18816 <dl><dd>:foo</dd></dl>
18817
18818 !!end
18819
18820 !! test
18821 Lists: 3. Only bullets at start of text should be escaped
18822 !! wikitext
18823 *<nowiki>*foo*bar</nowiki>
18824
18825 *<nowiki>*foo</nowiki>''it''*bar
18826 !! html
18827 <ul><li>*foo*bar</li></ul>
18828 <ul><li>*foo<i>it</i>*bar</li></ul>
18829
18830 !!end
18831
18832 !! test
18833 Lists: 4. No escapes needed
18834 !! options
18835 parsoid
18836 !! wikitext
18837 *foo*bar
18838
18839 *''foo''*bar
18840
18841 *[[Foo]]: bar
18842
18843 *[[Foo]]*bar
18844 !! html
18845 <ul>
18846 <li>foo*bar
18847 </li>
18848 </ul>
18849 <ul>
18850 <li><i>foo</i>*bar
18851 </li>
18852 </ul>
18853 <ul>
18854 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18855 </li>
18856 </ul>
18857 <ul>
18858 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18859 </li>
18860 </ul>
18861 !!end
18862
18863 !! test
18864 Lists: 5. No unnecessary escapes
18865 !! wikitext
18866 * bar <span><nowiki>[[foo]]</nowiki></span>
18867
18868 *=bar <span><nowiki>[[foo]]</nowiki></span>
18869
18870 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18871
18872 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18873
18874 *=bar <span>foo]]</span>=
18875
18876 * <s></s>: a
18877 !! html
18878 <ul><li> bar <span>[[foo]]</span></li></ul>
18879 <ul><li>=bar <span>[[foo]]</span></li></ul>
18880 <ul><li>[[bar <span>[[foo]]</span></li></ul>
18881 <ul><li>]]bar <span>[[foo]]</span></li></ul>
18882 <ul><li>=bar <span>foo]]</span>=</li></ul>
18883 <ul><li> <s></s>: a</li></ul>
18884
18885 !!end
18886
18887 !! test
18888 Lists: 6. Escape bullets in SOL position
18889 !! options
18890 parsoid
18891 !! wikitext
18892 <!--cmt--><nowiki>*foo</nowiki>
18893 !! html
18894 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18895 !!end
18896
18897 !! test
18898 Lists: 7. Escape bullets in a multi-line context
18899 !! wikitext
18900 a
18901 <nowiki>*</nowiki>b
18902 !! html
18903 <p>a
18904 *b
18905 </p>
18906 !!end
18907
18908 #### --------------- HRs ---------------
18909 #### 1. Single line
18910 #### -----------------------------------
18911
18912 !! test
18913 HRs: 1. Single line
18914 !! options
18915 parsoid
18916 !! wikitext
18917 ----<nowiki>----</nowiki>
18918 ----=foo=
18919 ----*foo
18920 !! html
18921 <hr><span typeof="mw:Nowiki">----</span>
18922 <hr>=foo=
18923 <hr>*foo
18924 !! end
18925
18926 #### --------------- Tables ---------------
18927 #### 1a. Simple example
18928 #### 1b. No escaping needed (!foo)
18929 #### 1c. No escaping needed (|foo)
18930 #### 1d. No escaping needed (|}foo)
18931 ####
18932 #### 2a. Nested in td (<td>foo|bar</td>)
18933 #### 2b. Nested in td (<td>foo||bar</td>)
18934 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
18935 ####
18936 #### 3a. Nested in th (<th>foo!bar</th>)
18937 #### 3b. Nested in th (<th>foo!!bar</th>)
18938 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
18939 ####
18940 #### 4a. Escape -
18941 #### 4b. Escape +
18942 #### 4c. No escaping needed
18943 #### --------------------------------------
18944
18945 !! test
18946 Tables: 1a. Simple example
18947 !! wikitext
18948 <nowiki>{|
18949 |}</nowiki>
18950 !! html
18951 <p>{|
18952 |}
18953 </p>
18954 !! end
18955
18956 !! test
18957 Tables: 1b. No escaping needed
18958 !! wikitext
18959 !foo
18960 !! html
18961 <p>!foo
18962 </p>
18963 !! end
18964
18965 !! test
18966 Tables: 1c. No escaping needed
18967 !! wikitext
18968 |foo
18969 !! html
18970 <p>|foo
18971 </p>
18972 !! end
18973
18974 !! test
18975 Tables: 1d. No escaping needed
18976 !! wikitext
18977 |}foo
18978 !! html
18979 <p>|}foo
18980 </p>
18981 !! end
18982
18983 !! test
18984 Tables: 2a. Nested in td
18985 !! options
18986 parsoid=html2wt
18987 !! wikitext
18988 {|
18989 |<nowiki>foo|bar</nowiki>
18990 |-
18991 |x<div><nowiki>a|b</nowiki></div>
18992 |}
18993 !! html
18994 <table><tbody><tr>
18995 <td>foo|bar</td></tr>
18996 <tr><td>x<div>a|b</div></td>
18997 </tbody></table>
18998 !! end
18999
19000 !! test
19001 Tables: 2b. Nested in td
19002 !! options
19003 parsoid
19004 !! wikitext
19005 {|
19006 |<nowiki>foo||bar</nowiki>
19007 |''it''<nowiki>foo||bar</nowiki>
19008 |}
19009 !! html
19010 <table><tbody><tr>
19011 <td><span typeof="mw:Nowiki">foo||bar</span></td>
19012 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
19013 !! end
19014
19015 !! test
19016 Tables: 2c. Nested in td -- no escaping needed
19017 !! options
19018 parsoid
19019 !! wikitext
19020 {|
19021 |foo!!bar
19022 |}
19023 !! html
19024 <table><tbody><tr><td>foo!!bar
19025 </td></tr></tbody></table>
19026
19027 !! end
19028
19029 !! test
19030 Tables: 3a. Nested in th
19031 !! options
19032 parsoid
19033 !! wikitext
19034 {|
19035 !foo!bar
19036 |}
19037 !! html
19038 <table><tbody><tr><th>foo!bar
19039 </th></tr></tbody></table>
19040
19041 !! end
19042
19043 !! test
19044 Tables: 3b. Nested in th
19045 !! options
19046 parsoid
19047 !! wikitext
19048 {|
19049 !<nowiki>foo!!bar</nowiki>
19050 |}
19051 !! html
19052 <table>
19053 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
19054 </tbody></table>
19055 !! end
19056
19057 !! test
19058 Tables: 3c. Nested in th -- no escaping needed
19059 !! options
19060 parsoid
19061 !! wikitext
19062 {|
19063 !<nowiki>foo||bar</nowiki>
19064 |}
19065 !! html
19066 <table><tbody><tr>
19067 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
19068 !! end
19069
19070 !! test
19071 Tables: 4a. Escape -
19072 !! options
19073 parsoid
19074 !! wikitext
19075 {|
19076 !-bar
19077 |-
19078 |<nowiki>-bar</nowiki>
19079 |}
19080 !! html
19081 <table><tbody>
19082 <tr><th>-bar</th></tr>
19083 <tr>
19084 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
19085 !! end
19086
19087 !! test
19088 Tables: 4b. Escape +
19089 !! options
19090 parsoid
19091 !! wikitext
19092 {|
19093 !+bar
19094 |-
19095 |<nowiki>+bar</nowiki>
19096 |}
19097 !! html
19098 <table><tbody>
19099 <tr><th>+bar</th></tr>
19100 <tr>
19101 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
19102 !! end
19103
19104 !! test
19105 Tables: 4c. No escaping needed
19106 !! options
19107 parsoid
19108 !! wikitext
19109 {|
19110 |foo-bar
19111 |foo+bar
19112 |-
19113 |''foo''-bar
19114 |''foo''+bar
19115 |-
19116 |foo
19117 bar|baz
19118 +bar
19119 -bar
19120 |-
19121 |x
19122 <div>a|b</div>
19123 |}
19124 !! html
19125 <table><tbody>
19126 <tr><td>foo-bar</td><td>foo+bar</td></tr>
19127 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
19128 <tr><td>foo
19129 <p>bar|baz
19130 +bar
19131 -bar</p></td></tr>
19132 <tr><td>x
19133 <div>a|b</div></td>
19134 </tbody></table>
19135 !! end
19136
19137 !! test
19138 Tables: 4d. No escaping needed
19139 !! options
19140 parsoid
19141 !! wikitext
19142 {|
19143 |[[Foo]]-bar
19144 ||+1
19145 ||-2
19146 |}
19147 !! html
19148 <table>
19149 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
19150 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
19151 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
19152 </tbody></table>
19153 !! end
19154
19155 !! test
19156 Tables: Digest broken attributes on table and tr tag
19157 !! options
19158 parsoid=wt2html
19159 !! wikitext
19160 {| || |} ++
19161 |- || || ++ --
19162 |- > [
19163 |}
19164 !! html
19165 <table>
19166 <tbody>
19167 <tr></tr>
19168 <tr></tr>
19169 </tbody></table>
19170 !! end
19171
19172 #### --------------- Links ----------------
19173 #### 1. Quote marks in link text
19174 #### 2. Wikilinks: Escapes needed
19175 #### 3. Wikilinks: No escapes needed
19176 #### 4. Extlinks: Escapes needed
19177 #### 5. Extlinks: No escapes needed
19178 #### --------------------------------------
19179 !! test
19180 Links 1. Quote marks in link text
19181 !! options
19182 parsoid
19183 !! wikitext
19184 [[Foo|Foo<nowiki>''boo''</nowiki>]]
19185 !! html
19186 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
19187 !! end
19188
19189 !! test
19190 Links 2. WikiLinks: Escapes needed
19191 !! options
19192 parsoid
19193 !! wikitext
19194 [[Foo|[Foobar]]]
19195 [[Foo|<nowiki>Foobar]</nowiki>]]
19196 [[Foo|x [Foobar] x]]
19197 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
19198 [[Foo|<nowiki>[[Bar]]</nowiki>]]
19199 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
19200 [[Foo|<nowiki>|Bar</nowiki>]]
19201 [[Foo|<nowiki>]]bar</nowiki>]]
19202 [[Foo|<nowiki>[[bar</nowiki>]]
19203 [[Foo|<nowiki>x [[ y</nowiki>]]
19204 [[Foo|<nowiki>x ]] y</nowiki>]]
19205 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
19206 !! html
19207 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
19208 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
19209 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
19210 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
19211 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
19212 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
19213 <a href="Foo" rel="mw:WikiLink">|Bar</a>
19214 <a href="Foo" rel="mw:WikiLink">]]bar</a>
19215 <a href="Foo" rel="mw:WikiLink">[[bar</a>
19216 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
19217 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
19218 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
19219 !! end
19220
19221 !! test
19222 Links 3. WikiLinks: No escapes needed
19223 !! options
19224 parsoid
19225 !! wikitext
19226 [[Foo|[Foobar]]
19227 [[Foo|foo|bar]]
19228 !! html
19229 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
19230 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
19231 !! end
19232
19233 !! test
19234 Links 4. ExtLinks: Escapes needed
19235 !! options
19236 parsoid
19237 !! wikitext
19238 [http://google.com <nowiki>[google]</nowiki>]
19239 [http://google.com <nowiki>google]</nowiki>]
19240
19241 <nowiki>[http://google.com]</nowiki>
19242
19243 <nowiki>[http://google.com google]</nowiki>
19244
19245 !! html
19246 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
19247 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
19248 <p>[http://google.com]</p>
19249 <p>[http://google.com google]</p>
19250 !! end
19251
19252 !! test
19253 Links 5. ExtLinks: No escapes needed
19254 !! options
19255 parsoid
19256 !! wikitext
19257 [http://google.com [google]
19258 !! html
19259 <a href="http://google.com" rel="mw:ExtLink">[google</a>
19260 !! end
19261
19262 !! test
19263 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
19264 !! html/parsoid
19265 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
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" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
19268 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
19269 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
19270 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
19271 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19272 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
19273 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19274 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
19275 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
19276 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
19277 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
19278 </p>
19279 !! wikitext
19280 x<nowiki/>http://example.com<nowiki/>y
19281 http://example.com<nowiki/>?x
19282 http://example.com<nowiki/>&x
19283 http://example.com<nowiki/>'x
19284 http://example.com<nowiki/>,x
19285 http://example.com<nowiki/>.x
19286 http://example.com<nowiki/>;x
19287 http://example.com<nowiki/>:x
19288 http://example.com<nowiki/>;x
19289 http://example.com<nowiki/>!x
19290 http://example.com<nowiki/>=x
19291 http://example.com<nowiki/>(x)
19292 http://example.com(x<nowiki/>)
19293 !! end
19294
19295 !! test
19296 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19297 !! html/parsoid
19298 <p>x
19299 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
19300 y
19301 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
19302 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
19303 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
19304 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
19305 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
19306 </p>
19307 !! wikitext
19308 x
19309 http://example.com
19310 y
19311 "http://example.com"
19312 (http://example.com)
19313 (http://example.com) foo
19314 http://example.com,
19315 http://example.com, foo
19316 !! end
19317
19318 ## Parsoid currently fails wt2html on this one!
19319 !! test
19320 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19321 !! html/parsoid
19322 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
19323 !! wikitext
19324 http://example.com.,;:!?
19325 !! end
19326
19327 !! test
19328 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
19329 !! html/parsoid
19330 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
19331 !! wikitext
19332 RFC 123<nowiki/>4
19333 !! end
19334
19335 !! test
19336 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
19337 !! html/parsoid
19338 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19339 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19340 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
19341 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
19342 </p>
19343 !! wikitext
19344 xRFC 123y
19345 XRFC 123y
19346 RFC 123?foo
19347 RFC 123&foo
19348 !! end
19349
19350 !! test
19351 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
19352 !! html/parsoid
19353 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
19354 !! wikitext
19355 PMID 123<nowiki/>4
19356 !! end
19357
19358 !! test
19359 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
19360 !! html/parsoid
19361 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19362 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19363 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
19364 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
19365 </p>
19366 !! wikitext
19367 xPMID 123y
19368 XPMID 123y
19369 PMID 123?foo
19370 PMID 123&foo
19371 !! end
19372
19373 !! test
19374 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
19375 !! html/parsoid
19376 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
19377 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
19378 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
19379 </p>
19380 !! wikitext
19381 ISBN 1234567890<nowiki/>1
19382 ISBN 1234567890<nowiki/>x
19383 ISBN 1234567890<nowiki/>b
19384 !! end
19385
19386 !! test
19387 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
19388 !! html/parsoid
19389 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
19390 !! wikitext
19391 ISBN 1234567890's
19392 !! end
19393
19394 #### --------------- Quotes ---------------
19395 #### 1. Quotes inside <b> and <i>
19396 #### 2. Link fragments separated by <i> and <b> tags
19397 #### 3. Link fragments inside <i> and <b>
19398 #### 4. No escaping needed
19399 #### --------------------------------------
19400 !! test
19401 1. Quotes inside <b> and <i>
19402 !! options
19403 parsoid=html2wt,wt2wt
19404 !! wikitext
19405 ''<nowiki>'foo'</nowiki>''
19406 ''<nowiki>''foo''</nowiki>''
19407 ''<nowiki>'''foo'''</nowiki>''
19408 ''foo''<nowiki/>'s
19409 '''<nowiki>'foo'</nowiki>'''
19410 '''<nowiki>''foo''</nowiki>'''
19411 '''<nowiki>'''foo'''</nowiki>'''
19412 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
19413 '''foo'''<nowiki/>'s
19414 '''foo''
19415 ''foo''<nowiki/>'
19416 '<nowiki/>''foo''<nowiki/>'
19417 ''''foo'''
19418 '''foo'''<nowiki/>'
19419 '<nowiki/>'''foo'''<nowiki/>'
19420 ''fools'<span> errand</span>''
19421 ''<span>fool</span>'s errand''
19422 !! html
19423 <p><i>'foo'</i>
19424 <i>''foo''</i>
19425 <i>'''foo'''</i>
19426 <i>foo</i>'s
19427 <b>'foo'</b>
19428 <b>''foo''</b>
19429 <b>'''foo'''</b>
19430 <b>foo'<i>bar'</i>baz</b>
19431 <b>foo</b>'s
19432 '<i>foo</i>
19433 <i>foo</i>'
19434 '<i>foo</i>'
19435 '<b>foo</b>
19436 <b>foo</b>'
19437 '<b>foo</b>'</p>
19438 <i>fools'<span> errand</span></i>
19439 <i><span>fool</span>'s errand</i>
19440 !! end
19441
19442 !! test
19443 2. Link fragments separated by <i> and <b> tags
19444 !! wikitext
19445 [[''foo''<nowiki>hello]]</nowiki>
19446
19447 [['''foo'''<nowiki>hello]]</nowiki>
19448 !! html
19449 <p>[[<i>foo</i>hello]]
19450 </p><p>[[<b>foo</b>hello]]
19451 </p>
19452 !! end
19453
19454 !! test
19455 3. Link fragments inside <i> and <b>
19456 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
19457 this is one of the shortcomings of this format)
19458 !! wikitext
19459 ''[[foo''<nowiki>]]</nowiki>
19460
19461 '''[[foo'''<nowiki>]]</nowiki>
19462 !! html
19463 <p><i>[[foo</i>]]
19464 </p><p><b>[[foo</b>]]
19465 </p>
19466 !! end
19467
19468 !! test
19469 4. No escaping needed
19470 !! wikitext
19471 '<span>''bar''</span>'
19472 '<span>'''bar'''</span>'
19473 !! html
19474 <p>'<span><i>bar</i></span>'
19475 '<span><b>bar</b></span>'
19476 </p>
19477 !! end
19478
19479 #### ----------- Paragraphs ---------------
19480 #### 1. No unnecessary escapes
19481 #### --------------------------------------
19482
19483 !! test
19484 1. No unnecessary escapes
19485 !! wikitext
19486 bar <span><nowiki>[[foo]]</nowiki></span>
19487
19488 =bar <span><nowiki>[[foo]]</nowiki></span>
19489
19490 [[bar <span><nowiki>[[foo]]</nowiki></span>
19491
19492 ]]bar <span><nowiki>[[foo]]</nowiki></span>
19493
19494 =bar <span>foo]]</span><nowiki>=</nowiki>
19495 !! html
19496 <p>bar <span>[[foo]]</span>
19497 </p><p>=bar <span>[[foo]]</span>
19498 </p><p>[[bar <span>[[foo]]</span>
19499 </p><p>]]bar <span>[[foo]]</span>
19500 </p><p>=bar <span>foo]]</span>=
19501 </p>
19502 !!end
19503
19504 #### ----------------------- PRE --------------------------
19505 #### 1. Leading whitespace in SOL context should be escaped
19506 #### ------------------------------------------------------
19507 !! test
19508 1. Leading whitespace in SOL context should be escaped
19509 !! options
19510 parsoid
19511 !! wikitext
19512 <nowiki> </nowiki>a
19513
19514 <nowiki> </nowiki> a
19515
19516 <nowiki> </nowiki>a(tab)
19517
19518 <nowiki> </nowiki> a
19519 <!--cmt-->
19520 <nowiki> </nowiki> a
19521
19522 a
19523 <nowiki> </nowiki>b
19524
19525 a
19526 <nowiki> </nowiki>b
19527
19528 a
19529 <nowiki> </nowiki> b
19530 !! html
19531 <p> a</p>
19532 <p> a</p>
19533 <p> a(tab)</p>
19534 <p> a</p>
19535 <p><!--cmt--> a</p>
19536 <p>a
19537 b</p>
19538 <p>a
19539 b</p>
19540 <p>a
19541 b</p>
19542 !! end
19543
19544 !! test
19545 2. Leading whitespace in non-indent-pre contexts should not be escaped
19546 !! options
19547 parsoid
19548 !! wikitext
19549 foo <ref>''a''
19550 b</ref>
19551 !! html
19552 <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>
19553 !! end
19554
19555 !! test
19556 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
19557 !! options
19558 parsoid
19559 !! wikitext
19560 <blockquote>
19561 a
19562 <span>b</span>
19563 c
19564 </blockquote>
19565 !! html
19566 <blockquote>
19567 <p>
19568 a
19569 <span>b</span>
19570 c</p>
19571 </blockquote>
19572 !! end
19573
19574 !! test
19575 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
19576 !! options
19577 parsoid
19578 !! wikitext
19579 [[File:Foobar.jpg|thumb|caption]]
19580 !! html
19581 !! html/parsoid
19582 <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>
19583 !! end
19584
19585 #### --------------- Behavior Switches --------------------
19586 !! test
19587 1. Valid behavior switches should be escaped
19588 !! options
19589 parsoid=html2wt
19590 !! wikitext
19591 <nowiki>__TOC__</nowiki>
19592 ''<nowiki>__TOC__</nowiki>''
19593 !! html
19594 __TOC__
19595 <i>__TOC__</i>
19596 !! end
19597
19598 !! test
19599 2. Invalid behavior switches should not be escaped
19600 !! options
19601 parsoid=html2wt
19602 !! wikitext
19603 __TOO__
19604 __|__
19605 !! html
19606 __TOO__
19607 __|__
19608 !! end
19609
19610 #### --------------- HTML tags ---------------
19611 #### 1. a tags
19612 #### 2. other tags
19613 #### 3. multi-line html tag
19614 #### 4. extension tags
19615 #### -----------------------------------------
19616 !! test
19617 1. a tags
19618 !! options
19619 parsoid
19620 !! wikitext
19621 <a href="http://google.com">google</a>
19622 !! html
19623 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
19624 !! end
19625
19626 !! test
19627 2. other tags
19628 !! wikitext
19629 <nowiki><div>foo</div>
19630 <div style="color:red">foo</div></nowiki>
19631 !! html
19632 <p>&lt;div&gt;foo&lt;/div&gt;
19633 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
19634 </p>
19635 !! end
19636
19637 !! test
19638 3. multi-line html tag
19639 !! wikitext
19640 <nowiki><div
19641 >foo</div
19642 ></nowiki>
19643 !! html
19644 <p>&lt;div
19645 &gt;foo&lt;/div
19646 &gt;
19647 </p>
19648 !! end
19649
19650 !! test
19651 4. extension tags
19652 !! wikitext
19653 <nowiki><ref>foo</ref></nowiki>
19654
19655 <nowiki><ref>bar</nowiki>
19656
19657 baz<nowiki></ref></nowiki>
19658 !! html
19659 <p>&lt;ref&gt;foo&lt;/ref&gt;
19660 </p><p>&lt;ref&gt;bar
19661 </p><p>baz&lt;/ref&gt;
19662 </p>
19663 !! end
19664
19665 #### --------------- Others ---------------
19666 !! test
19667 Escaping nowikis
19668 !! wikitext
19669 &lt;nowiki&gt;foo&lt;/nowiki&gt;
19670 !! html
19671 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
19672 </p>
19673 !! end
19674
19675 ## The quote-char in the input is necessary for triggering the bug
19676 !! test
19677 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
19678 !! options
19679 parsoid=wt2wt,html2wt
19680 !! wikitext
19681 foo's bar :
19682 !! html
19683 <p>foo's bar :</p>
19684 !! end
19685
19686 !! test
19687
19688 Tag-like HTML structures are passed through as text
19689 !! wikitext
19690 <x y>
19691
19692 <x.y>
19693
19694 <x-y>
19695
19696 1>2
19697
19698 x<y
19699
19700 a>b
19701
19702 1<d e>f
19703 !! html
19704 <p>&lt;x y&gt;
19705 </p><p>&lt;x.y&gt;
19706 </p><p>&lt;x-y&gt;
19707 </p><p>1&gt;2
19708 </p><p>x&lt;y
19709 </p><p>a&gt;b
19710 </p><p>1&lt;d e&gt;f
19711 </p>
19712 !! end
19713
19714
19715 # This was a bug in the PHP parser (see bug 17663 and its dups,
19716 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
19717 !! test
19718 Tag names followed by punctuation should not be recognized as tags
19719 !! wikitext
19720 <s.ome> text
19721 !! html
19722 <p>&lt;s.ome&gt; text
19723 </p>
19724 !! end
19725
19726 !! test
19727 HTML tag with necessary entities in attributes
19728 !! wikitext
19729 <span title="&amp;amp;">foo</span>
19730 !! html
19731 <p><span title="&amp;amp;">foo</span>
19732 </p>
19733 !! end
19734
19735 !! test
19736 HTML tag with 'unnecessary' entity encoding in attributes
19737 !! wikitext
19738 <span title="&amp;">foo</span>
19739 !! html
19740 <p><span title="&amp;">foo</span>
19741 </p>
19742 !! end
19743
19744 !! test
19745 HTML tag with broken attribute value quoting
19746 !! wikitext
19747 <span title="Hello world>Foo</span>
19748 !! html
19749 <p><span>Foo</span>
19750 </p>
19751 !! end
19752
19753 !! test
19754 Parsoid-only: HTML tag with broken attribute value quoting
19755 !! options
19756 parsoid
19757 !! wikitext
19758 <span title="Hello world>Foo</span>
19759 !! html
19760 <p><span title="Hello world">Foo</span>
19761 </p>
19762 !! end
19763
19764 !! test
19765 Table with broken attribute value quoting
19766 !! wikitext
19767 {|
19768 | title="Hello world|Foo
19769 |}
19770 !! html
19771 <table>
19772 <tr>
19773 <td>Foo
19774 </td></tr></table>
19775
19776 !! end
19777
19778 !! test
19779 Table with broken attribute value quoting on consecutive lines
19780 !! wikitext
19781 {|
19782 | title="Hello world|Foo
19783 | style="color:red|Bar
19784 |}
19785 !! html
19786 <table>
19787 <tr>
19788 <td>Foo
19789 </td>
19790 <td>Bar
19791 </td></tr></table>
19792
19793 !! end
19794
19795 !! test
19796 Parsoid-only: Table with broken attribute value quoting on consecutive lines
19797 !! options
19798 parsoid
19799 !! wikitext
19800 {|
19801 | title="Hello world|Foo
19802 | style="color:red|Bar
19803 |}
19804 !! html
19805 <table><tbody>
19806 <tr>
19807 <td title="Hello world">Foo
19808 </td><td style="color: red">Bar
19809 </td></tr></tbody></table>
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 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19825 !! options
19826 parsoid
19827 !! wikitext
19828 }}{{
19829 !! html
19830 }}{{
19831 !! end
19832
19833 !!test
19834 Accept empty td cell attribute
19835 !! wikitext
19836 {|
19837 | align="center" | foo || |
19838 |}
19839 !! html
19840 <table>
19841 <tr>
19842 <td align="center"> foo </td>
19843 <td>
19844 </td></tr></table>
19845
19846 !!end
19847
19848 !!test
19849 Non-empty attributes in th-cells
19850 !! wikitext
19851 {|
19852 ! Foo !! style="color: red" | Bar
19853 |}
19854 !! html
19855 <table>
19856 <tr>
19857 <th> Foo </th>
19858 <th style="color: red"> Bar
19859 </th></tr></table>
19860
19861 !!end
19862
19863 !!test
19864 Accept empty attributes in th-cells
19865 !! wikitext
19866 {|
19867 !| foo !!| bar
19868 |}
19869 !! html
19870 <table>
19871 <tr>
19872 <th> foo </th>
19873 <th> bar
19874 </th></tr></table>
19875
19876 !!end
19877
19878 !!test
19879 Empty table rows go away
19880 !! wikitext
19881 {|
19882 | Hello
19883 | there
19884 |- class="foo"
19885 |-
19886 |}
19887 !! html
19888 <table>
19889 <tr>
19890 <td> Hello
19891 </td>
19892 <td> there
19893 </td></tr>
19894
19895 </table>
19896
19897 !! end
19898
19899 ###
19900 ### Parsoid-centric tests for testing RTing of inter-element separators
19901 ### Edge cases not tested by existing parser tests and specific to
19902 ### Parsoid-specific serialization strategies.
19903 ###
19904
19905 !!test
19906 RT-ed inter-element separators should be valid separators
19907 !! wikitext
19908 {|
19909 |- [[foo]]
19910 |}
19911 !! html
19912 <table>
19913
19914 </table>
19915
19916 !!end
19917
19918 !!test
19919 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
19920 (Parsoid-only since PHP parser relies on Tidy for correct output)
19921 !!options
19922 parsoid
19923 !! wikitext
19924 {|
19925 |<small>foo
19926 bar
19927 |}
19928
19929 {|
19930 |<small>foo<small>
19931 |}
19932 !! html
19933 !!end
19934
19935 !!test
19936 Empty TD followed by TD with tpl-generated attribute
19937 !! wikitext
19938 {|
19939 |-
19940 |
19941 |{{echo|style='color:red'}}|foo
19942 |}
19943 !! html
19944 <table>
19945
19946 <tr>
19947 <td>
19948 </td>
19949 <td>foo
19950 </td></tr></table>
19951
19952 !!end
19953
19954 !!test
19955 Indented table with an empty td
19956 !! wikitext
19957 {|
19958 |-
19959 |
19960 |foo
19961 |}
19962 !! html
19963 <table>
19964
19965 <tr>
19966 <td>
19967 </td>
19968 <td>foo
19969 </td></tr></table>
19970
19971 !!end
19972
19973 !!test
19974 Indented block & table
19975 !! wikitext
19976 <div>foo</div>
19977 {|
19978 |foo
19979 |}
19980 !! html/parsoid
19981 <div data-parsoid='{"stx":"html"}'>foo</div>
19982 <table><tbody>
19983 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
19984 </tbody></table>
19985 !!end
19986
19987 !! test
19988 Indent and comment before table row
19989 !! wikitext
19990 {|
19991 <!--hi-->|-
19992 | there
19993 |}
19994 !! html/parsoid
19995 <table data-parsoid='{}'>
19996 <!--hi--><tbody data-parsoid='{}'><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
19997 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
19998 </tbody></table>
19999 !! end
20000
20001 !!test
20002 Empty TR followed by a template-generated TR
20003 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
20004 !!options
20005 parsoid
20006 !! wikitext
20007 {|
20008 |-
20009 {{echo|<tr><td>foo</td></tr>}}
20010 |}
20011 !! html
20012 <table>
20013 <tbody>
20014 <tr></tr>
20015 <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}}]}'>
20016 <td>foo</td></tr>
20017 </tbody></table>
20018 !!end
20019
20020 ## PHP and parsoid output differ for this, and since this is primarily
20021 ## for testing Parsoid's serializer, marking this Parsoid only
20022 !!test
20023 Empty TR followed by mixed-ws-comment line should RT correctly
20024 !!options
20025 parsoid
20026 !! wikitext
20027 {|
20028 |-
20029 <!--c-->
20030 |-
20031 <!--c--> <!--d-->
20032 |}
20033 !! html
20034 <table>
20035 <tbody>
20036 <tr></tr>
20037 <!--c-->
20038 <tr>
20039 <!--c--> </tr><!--d-->
20040 </tbody></table>
20041
20042 !!end
20043
20044 !!test
20045 Multi-line image caption generated by templates with/without trailing newlines
20046 !!options
20047 parsoid
20048 !! wikitext
20049 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
20050 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
20051 !! html
20052 <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>
20053 <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>
20054
20055 !!end
20056
20057 !! test
20058 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
20059 !! options
20060 parsoid=html2wt
20061 !! wikitext
20062 <includeonly>foo</includeonly>
20063 new para
20064
20065 [[./Category:Foo]]
20066
20067 = new heading =
20068 !! html
20069 <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>
20070
20071 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
20072 !! end
20073
20074 ## PHP emits broken html for this, and since this is primarily
20075 ## a Parsoid serializer test, marking this Parsoid only
20076 !!test
20077 Improperly nested inline or quotes tags with whitespace in between
20078 !!options
20079 parsoid
20080 !! wikitext
20081 <span> <s>x</span> </s>
20082 ''' ''x''' ''
20083 !! html
20084 <p><span> <s>x</s></span><s> </s>
20085 <b> <i>x</i></b><i> </i>
20086 </p>
20087 !!end
20088
20089 !!test
20090 Encapsulate protected attributes from wt
20091 !!options
20092 parsoid
20093 !! wikitext
20094 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
20095 !! html
20096 <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>
20097 </body>
20098 !!end
20099
20100 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
20101 ## Having nested or stray pre tags results in the attempt to add duplicates,
20102 ## causing an assertion fail. This test tries to prevent that situation.
20103 !!test
20104 Ensure ParagraphWrapper can deal with stray closing pre tags
20105 !!options
20106 parsoid=wt2html
20107 !! wikitext
20108 plain text</pre>
20109 !! html
20110 plain text
20111 !!end
20112
20113 !!test
20114 1. Ensure fostered text content is wrapped in spans
20115 !!options
20116 parsoid=wt2html
20117 !! wikitext
20118 <table>hi</table><table>ho</table>
20119 !! html
20120 <span>hi</span>
20121 <table></table>
20122 <span>ho</span>
20123 <table></table>
20124 !!end
20125
20126 !!test
20127 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
20128 !!options
20129 parsoid=wt2html,wt2wt
20130 !! wikitext
20131 <table>
20132 <tr> || ||
20133 <td> a
20134 </table>
20135 !! html
20136 <span> || ||</span>
20137 <table>
20138 <tbody>
20139 <tr>
20140 <td> a</td></tr>
20141 </tbody></table>
20142 !!end
20143
20144 !!test
20145 Encapsulation properly handles null DSR information from foster box
20146 !!options
20147 parsoid=wt2html,wt2wt
20148 !! wikitext
20149 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
20150 !! html
20151 <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;
20152 <table>foo
20153 <tr>
20154 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
20155 <table>
20156 <tbody>
20157 <tr>
20158 <td>bar</td></tr></tbody></table>
20159 !!end
20160
20161 !!test
20162 1. Encapsulate foster-parented transclusion content
20163 !!options
20164 parsoid=wt2wt,wt2html
20165 !! wikitext
20166 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
20167 !! html
20168 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20169 <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
20170 <tr>
20171 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
20172 <table>
20173 <tbody>
20174 <tr>
20175 <td>bar</td></tr></tbody></table>
20176 !!end
20177
20178 !!test
20179 2. Encapsulate foster-parented transclusion content
20180 !!options
20181 parsoid=wt2wt,wt2html
20182 !! wikitext
20183 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
20184 !! html
20185 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20186 <table>
20187 <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>
20188 <tr>
20189 <td>bar</td></tr></table>&quot;]}">foo</div>
20190 <table>
20191 <tbody>
20192 <tr>
20193 <td>bar</td></tr></tbody></table>
20194 !!end
20195
20196 !!test
20197 3. Encapsulate foster-parented transclusion content
20198 !!options
20199 parsoid=wt2wt,wt2html
20200 !! wikitext
20201 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20202 !! html
20203 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20204 <table>
20205 <div>
20206 <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>
20207 <tr>
20208 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20209 <p>foo</p></div>
20210 <table>
20211 <tbody>
20212 <tr>
20213 <td>bar</td></tr></tbody></table>
20214 !!end
20215
20216 !!test
20217 4. Encapsulate foster-parented transclusion content
20218 !!options
20219 parsoid=wt2wt,wt2html
20220 !! wikitext
20221 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20222 !! html
20223 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20224 <table>
20225 <div>
20226 <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>
20227 <tr>
20228 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20229 <p>foo</p></div>
20230 <table>
20231 <tbody>
20232 <tr>
20233 <td>bar</td></tr></tbody></table>
20234 !!end
20235
20236 !!test
20237 5. Encapsulate foster-parented transclusion content
20238 !!options
20239 parsoid=wt2wt,wt2html
20240 !! wikitext
20241 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
20242 !! html
20243 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20244 <table>
20245 <tr>
20246 <td>
20247 <div>
20248 <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>
20249 <table>
20250 <tbody>
20251 <tr>
20252 <td>
20253 <div>
20254 <p>foo</p></div></td></tr></tbody></table>
20255 !!end
20256
20257 !!test
20258 6. Encapsulate foster-parented transclusion content
20259 !!options
20260 parsoid=wt2wt,wt2html
20261 !! wikitext
20262 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
20263 !! html
20264 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20265 <table>
20266 <tr>
20267 <td>
20268 <div>
20269 <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>
20270 <table>
20271 <tbody>
20272 <tr>
20273 <td>
20274 <div>
20275 <p>foo</p></div></td></tr></tbody></table>
20276 <p>ok</p>
20277 !!end
20278
20279 !!test
20280 7. Encapsulate foster-parented transclusion content
20281 !!options
20282 parsoid=wt2wt,wt2html
20283 !! wikitext
20284 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
20285 !! html
20286 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20287 <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;
20288 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
20289 <td>bar</td></table>&quot;]}">foo</p>
20290 <table>
20291 <tbody>
20292 <tr>
20293 <td>bar</td></tr></tbody></table>
20294 !!end
20295
20296 !!test
20297 8. Encapsulate foster-parented transclusion content
20298 !!options
20299 parsoid=wt2wt,wt2html
20300 !! wikitext
20301 {{echo|a
20302 }}{|{{echo|style='color:red'}}
20303 |-
20304 |b
20305 |}
20306 !! html
20307 <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>
20308 <table>
20309 <tbody>
20310 <tr>
20311 <td>b</td></tr></tbody></table>
20312 !!end
20313
20314 !!test
20315 9. Encapsulate foster-parented transclusion content
20316 !!options
20317 parsoid=wt2wt,wt2html
20318 !! wikitext
20319 <table>{{echo|hi</table>hello}}
20320 !! html
20321 <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>
20322 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
20323 !!end
20324
20325 !!test
20326 Table in fosterable position
20327 !!options
20328 parsoid=wt2html,wt2wt
20329 !! wikitext
20330 {{OpenTable}}
20331 <div>
20332 {|
20333 |}
20334 </div>
20335 |}
20336 !! html
20337 <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="{}">
20338 </span>
20339 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
20340
20341 <table>
20342 </table>
20343 !!end
20344
20345 # Parsoid only for bug 64747
20346 !! test
20347 Properly encapsulate empty-content transclusions in fosterable positions
20348 !! wikitext
20349 <table>
20350 {{#if:|
20351 <td>foo</td>
20352 }}
20353 </table>
20354 !! html/parsoid
20355 <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>"}'>
20356
20357 </table>
20358 !! end
20359
20360 !!test
20361 Support <object> element with .data attribute
20362 !!options
20363 parsoid=html2wt
20364 !! wikitext
20365 <object data="test.swf"></object>
20366 !! html
20367 <object data="test.swf"></object>
20368 !!end
20369
20370 # -----------------------------------------------------------------
20371 # The following section of tests are primarily to spec requirements
20372 # around serialization of new/edited content.
20373 #
20374 # All these tests are marked Parsoid html2wt and html2html only
20375 # ----------------------------------------------------------------
20376
20377 !! test
20378 Image: Modifying size of an image (1)
20379 !! options
20380 parsoid={
20381 "modes": ["wt2wt"],
20382 "changes": [
20383 ["img[height]", "attr", "height", "22"],
20384 ["img[width]", "attr", "width", "200"]
20385 ]
20386 }
20387 !! wikitext
20388 [[Image:Foobar.jpg|230x230px]]
20389 !! wikitext/edited
20390 [[Image:Foobar.jpg|200x200px]]
20391 !!end
20392
20393 !! test
20394 Image: Modifying size of an image (2)
20395 !! options
20396 parsoid={
20397 "modes": ["wt2wt"],
20398 "changes": [
20399 ["img[height]", "attr", "height", "100"],
20400 ["img[width]", "attr", "width", "500"]
20401 ]
20402 }
20403 !! wikitext
20404 [[Image:Foobar.jpg|230x230px]]
20405 !! wikitext/edited
20406 [[Image:Foobar.jpg|500x500px]]
20407 !!end
20408
20409 # Change in size is ignored so long as class='mw-default-size'
20410 !! test
20411 Image: Modifying size of an image (3)
20412 !! options
20413 parsoid={
20414 "modes": ["wt2wt"],
20415 "changes": [
20416 ["figure[class]", "removeClass", "mw-default-size"],
20417 ["figure img", "attr", "height", "19"],
20418 ["figure img", "attr", "width", "170"]
20419 ]
20420 }
20421 !! wikitext
20422 [[Image:Foobar.jpg|thumb]]
20423 !! wikitext/edited
20424 [[Image:Foobar.jpg|thumb|170x170px]]
20425 !!end
20426
20427 !! test
20428 Image: Modifying alignment of an image (bug 48665)
20429 !! options
20430 parsoid={
20431 "modes": ["wt2wt"],
20432 "changes": [
20433 ["figure[class]", "removeClass", "mw-halign-right"],
20434 ["figure[class]", "addClass", "mw-halign-left"]
20435 ]
20436 }
20437 !! wikitext
20438 [[Image:Foobar.jpg|thumb|caption|right]]
20439 !! wikitext/edited
20440 [[Image:Foobar.jpg|thumb|caption|left]]
20441 !! end
20442
20443 !! test
20444 Image: Modifying mw-default-size of an frameless image (bug 62805)
20445 !! options
20446 parsoid={
20447 "modes": ["wt2wt"],
20448 "changes": [
20449 ["figure.mw-default-size", "removeClass", "mw-default-size"]
20450 ]
20451 }
20452 !! wikitext
20453 [[Image:Foobar.jpg|frameless|right]]
20454 !! wikitext/edited
20455 [[Image:Foobar.jpg|frameless|right|220x220px]]
20456 !! end
20457
20458 !! test
20459 Image: Modifying valign of an image (bug 49221)
20460 !! options
20461 parsoid={
20462 "modes": ["wt2wt"],
20463 "changes": [
20464 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
20465 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
20466 ]
20467 }
20468 !! wikitext
20469 [[File:Foobar.jpg|20px|middle]]
20470 !! wikitext/edited
20471 [[File:Foobar.jpg|20px|text-top]]
20472 !! end
20473
20474 !! test
20475 Image: Modifying alt attribute of an image (bug 56400)
20476 !! options
20477 parsoid={
20478 "modes": ["wt2wt"],
20479 "changes": [
20480 ["img[alt]", "attr", "alt", "some alternate edited text"]
20481 ]
20482 }
20483 !! wikitext
20484 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
20485 !! wikitext/edited
20486 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
20487 !!end
20488
20489 !! test
20490 Image: Modifying caption of an image
20491 !! options
20492 parsoid={
20493 "modes": ["wt2wt"],
20494 "changes": [
20495 ["figcaption", "text", "new caption"]
20496 ]
20497 }
20498 !! wikitext
20499 [[Image:Foobar.jpg|thumb|original caption]]
20500 !! wikitext/edited
20501 [[Image:Foobar.jpg|thumb|new caption]]
20502 !!end
20503
20504 !! test
20505 Image: empty alt attribute (bug 48924)
20506 !! options
20507 parsoid
20508 !! wikitext
20509 [[File:Foobar.jpg|thumb|alt=|bar]]
20510 !! html
20511 <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>
20512 !! end
20513
20514 #!! test
20515 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
20516 #!! options
20517 #parsoid=html2wt
20518 #language=ar
20519 #!! input
20520 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
20521 #!! result
20522 #<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>
20523 #!! end
20524
20525 !! test
20526 Image: Block level image should have \n before and after
20527 !! options
20528 parsoid
20529 !! wikitext
20530 123
20531 [[File:Foobar.jpg|right|thumb|150x150px]]
20532 456
20533 !! html
20534 <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>
20535 !!end
20536
20537 !! test
20538 Image: New block level image should have \n before and after (existing
20539 content)
20540 !! options
20541 parsoid
20542 !! wikitext
20543 123
20544 [[File:Foobar.jpg|right|thumb|150x150px]]
20545 456
20546 !! html
20547 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
20548 <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>
20549 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
20550 !!end
20551
20552 !! test
20553 Image: upright option (parsoid)
20554 !! options
20555 parsoid
20556 !! wikitext
20557 [[File:Foobar.jpg|thumb|upright|caption]]
20558 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
20559 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
20560 !! html
20561 <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>
20562 !!end
20563
20564 !! test
20565 Image: upright option is ignored on inline and frame images (parsoid)
20566 !! options
20567 parsoid
20568 !! wikitext
20569 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
20570 !! html
20571 <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>
20572 !!end
20573
20574 !! test
20575 Image: from basic HTML (1)
20576 !! options
20577 parsoid=html2wt
20578 !! html/parsoid
20579 <span typeof="mw:Image">
20580 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20581 </span>
20582 !! wikitext
20583 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20584 !! end
20585
20586 !! test
20587 Image: from basic HTML (2)
20588 !! options
20589 parsoid=html2wt
20590 !! html/parsoid
20591 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20592 !! wikitext
20593 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20594 !! end
20595
20596 !! test
20597 Image: from basic HTML (3)
20598 !! options
20599 parsoid=html2wt
20600 !! html/parsoid
20601 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
20602 !! wikitext
20603 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
20604 !! end
20605
20606 !! test
20607 Image: from basic HTML (4)
20608 !! options
20609 parsoid=html2wt
20610 !! html/parsoid
20611 <img src="File:Foobar.jpg">
20612 !! wikitext
20613 [[File:Foobar.jpg|link=]]
20614 !! end
20615
20616 !! test
20617 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
20618 !! options
20619 parsoid=html2wt
20620 !! wikitext
20621 * foo
20622 !! html
20623 <ul>
20624 <li><p>foo</p></li>
20625 </ul>
20626 !! end
20627
20628 !! test
20629 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
20630 !! options
20631 parsoid=html2wt
20632 !! wikitext
20633 * foo
20634 !! html
20635 <ul> <li>foo</li></ul>
20636 !! end
20637
20638 !! test
20639 Don't strip leading whitespace when handling indent-pre suppressing tags
20640 !! options
20641 parsoid=html2wt
20642 !! wikitext
20643 {|
20644 | indented row
20645 |}
20646 <blockquote>
20647 '''This is very bold of you!'''
20648
20649 {|
20650 |
20651 indented cell (no pre-wrapping!)
20652 |}
20653 </blockquote>
20654 foo
20655 <div>bar</div>
20656 !! html
20657 <table>
20658 <tr><td> indented row</td></tr>
20659 </table>
20660 <blockquote><p>
20661 <b>This is very bold of you!</b>
20662 </p>
20663 <table><tr><td>
20664 indented cell (no pre-wrapping!)
20665 </td></tr></table>
20666 </blockquote>
20667 <p>foo</p>
20668 <div>bar</div>
20669 !! end
20670
20671 !! test
20672 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
20673 !! options
20674 parsoid=html2wt
20675 !! wikitext
20676 foo
20677 <nowiki> </nowiki><span>bar</span>
20678
20679 <span>foo2
20680 <nowiki> </nowiki></span>bar2
20681
20682 <div>foo</div>
20683 <nowiki> </nowiki><span>bar</span>
20684
20685 <div>
20686 <nowiki> </nowiki><span>foo</span>
20687 </div>
20688 !! html
20689 <p>foo</p>
20690 <span>bar</span>
20691
20692 <span>foo2
20693 </span>bar2
20694
20695 <div>foo</div>
20696 <span>bar</span>
20697
20698 <div>
20699 <span>foo</span>
20700 </div>
20701 !! end
20702
20703 !! test
20704 Lists: Add space after bullets
20705 !! options
20706 parsoid=html2wt
20707 !! wikitext
20708 * foo
20709 * bar
20710 * <span> baz</span>
20711 !! html
20712 <ul>
20713 <li>foo</li>
20714 <li> bar</li>
20715 <li><span> baz</span></li>
20716 </ul>
20717 !! end
20718
20719 !! test
20720 Lists: Dont insert newlines in a serialized list item.
20721 !! options
20722 parsoid=html2wt
20723 !! wikitext
20724 * a<br>b
20725 * c
20726 !! html
20727 <ul><li>a<br>b</li><li>c</li></ul>
20728 !! end
20729
20730 !! test
20731 Headings: Add space before/after == (Bug 51744)
20732 !! options
20733 parsoid=html2wt
20734 !! wikitext
20735 == foo ==
20736
20737 == bar ==
20738
20739 == baz ==
20740
20741 == <span> baz</span> ==
20742 !! html
20743 <h2>foo</h2>
20744 <h2> bar</h2>
20745 <h2>baz </h2>
20746 <h2><span> baz</span></h2>
20747 !! end
20748
20749 !! test
20750 Parsoid: Serialize positional parameters with = in them as named parameter
20751 !! options
20752 parsoid=html2wt
20753 !! wikitext
20754 {{echo|1 = f=oo}}
20755
20756 {{echo|1 = f=oo|2 = bar}}
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 {{echo|<nowiki>f=oo</nowiki>|bar}}
20761 !! html
20762 <p about="#mwt1" typeof="mw:Transclusion"
20763 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
20764
20765 <p about="#mwt1" typeof="mw:Transclusion"
20766 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
20767
20768 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20769 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20770 <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>
20771 !! end
20772
20773 !! test
20774 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
20775 !! options
20776 parsoid=html2wt
20777 !! wikitext
20778 <div>a
20779 b
20780 </div>
20781 <div>a
20782 b
20783 </div>
20784 <div>
20785 a
20786
20787 b
20788 </div>
20789 !! html
20790 <div>a<p>b</p></div>
20791 <div>a
20792 <p>b</p></div>
20793 <div>
20794 a
20795 <p>b</p></div>
20796 !! end
20797
20798 !! test
20799 Substrings resembling wikitext in hrefs should not get nowiki escapes
20800 !! options
20801 parsoid=html2wt
20802 !! wikitext
20803 [[Foo''bar''baz]]
20804 !! html
20805 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
20806 !! end
20807
20808 #-----------------------------
20809 # I/B quote minimization tests
20810 #-----------------------------
20811
20812 !! test
20813 1. I/B quote minimization: wikitext-only tags should be combined
20814 !! options
20815 parsoid=html2wt
20816 !! wikitext
20817 ''AB''
20818
20819 '''AB'''
20820
20821 ''A'''B'''''
20822
20823 '''A''B'''''
20824
20825 '''A''BC''D'''
20826
20827 '''''AB'''''
20828
20829 '''''AB'''''
20830
20831 '''''AB'''''
20832 !! html
20833 <p><i>A</i><i>B</i></p>
20834 <p><b>A</b><b>B</b></p>
20835 <p><i>A</i><b><i>B</i></b></p>
20836 <p><b>A</b><i><b>B</b></i></p>
20837 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
20838 <p><i><b>A</b></i><i><b>B</b></i></p>
20839 <p><i><b>A</b></i><b><i>B</i></b></p>
20840 <p><b><i>A</i></b><i><b>B</b></i></p>
20841 !! end
20842
20843 !! test
20844 2. I/B quote minimization: wikitext and html tags should not be combined
20845 !! options
20846 parsoid=html2wt
20847 !! wikitext
20848 ''A''<i>B</i>
20849
20850 ''A'''''<i>B</i>'''
20851 !! html
20852 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
20853 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
20854 !! end
20855
20856 !! test
20857 3. I/B quote minimization: templated content stops minimization
20858 !! options
20859 parsoid=html2wt
20860 !! wikitext
20861 ''A''{{echo|''B''}}
20862
20863 ''A''{{echo|'''''B'''''}}
20864 !! html
20865 <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>
20866 <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>
20867 !! end
20868
20869 !! test
20870 4. I/B quote minimization: new content should be mimimized with adjacent old content
20871 !! options
20872 parsoid=html2wt
20873 !! wikitext
20874 ''AB''
20875
20876 '''AB'''
20877
20878 ''A'''B'''''
20879 !! html
20880 <p><i>A</i><i data-parsoid='{}'>B</i></p>
20881 <p><b data-parsoid='{}'>A</b><b>B</b></p>
20882 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
20883 !! end
20884
20885 #------------------------------------
20886 # End of I/B quote minimization tests
20887 #------------------------------------
20888
20889 !!test
20890 Bug 54262: New entities
20891 !! options
20892 parsoid=html2wt
20893 !! wikitext
20894 &nbsp;
20895 !! html
20896 <span typeof="mw:Entity">&nbsp;</span>
20897 !! end
20898
20899 ## Note that there is no wikitext output for 'unknownproperty' ##
20900 ## Unknown magic words are silently dropped ##
20901
20902 !! test
20903 Magic words
20904 !! options
20905 parsoid=html2wt
20906 !! wikitext
20907 __TOC__
20908 __NOTOC__
20909 __FORCETOC__
20910 __INDEX__
20911 __NOINDEX__
20912 __NOGALLERY__
20913 __NOEDITSECTION__
20914 __NOTITLECONVERT__
20915 __NOCONTENTCONVERT__
20916 !! html
20917 <meta property='mw:PageProp/toc' />
20918 <meta property='mw:PageProp/notoc' />
20919 <meta property='mw:PageProp/forcetoc' />
20920 <meta property='mw:PageProp/index' />
20921 <meta property='mw:PageProp/noindex' />
20922 <meta property='mw:PageProp/nogallery' />
20923 <meta property='mw:PageProp/noeditsection' />
20924 <meta property='mw:PageProp/notitleconvert' />
20925 <meta property='mw:PageProp/nocontentconvert' />
20926 <meta property='mw:PageProp/unknownproperty' />
20927 !! end
20928
20929 !! test
20930 Consecutive <pre>s should not get merged
20931 !! options
20932 parsoid=html2wt,html2html
20933 !! wikitext
20934 a
20935
20936 b
20937
20938 c
20939
20940 d
20941
20942 e
20943
20944
20945
20946 f
20947 !! html
20948 <pre>a</pre><pre>b</pre>
20949
20950 <pre>c
20951 </pre><pre>
20952 d</pre>
20953
20954 <pre>e
20955
20956 </pre><pre>
20957
20958 f</pre>
20959 !! end
20960
20961 !! test
20962 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
20963 !! options
20964 parsoid=html2wt
20965 !! wikitext
20966 [[Special:BookSources/1234567890|ISBN 1234567895]]
20967 !! html
20968 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
20969 !! end
20970
20971 !! test
20972 Edited RFC links not serializable as RFC links should serialize as extlinks
20973 !! options
20974 parsoid=html2wt
20975 !! wikitext
20976 [//tools.ietf.org/html/rfc123 New RFC]
20977 !! html
20978 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
20979 !! end
20980
20981 !! test
20982 Edited PMID links not serializable as PMID links should serialize as extlinks
20983 !! options
20984 parsoid=html2wt
20985 !! wikitext
20986 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
20987 !! html
20988 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
20989 !! end
20990
20991 !! test
20992 Edited Redirect link should emit a non-piped wikitext link
20993 !! options
20994 parsoid=html2wt
20995 !! wikitext
20996 #REDIRECT [[Bar]]
20997 !! html
20998 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
20999 !! end
21000
21001 # -----------------------------------------------------------------
21002 # End of section for Parsoid-only html2wt tests for serialization
21003 # of new content
21004 # -----------------------------------------------------------------
21005
21006 TODO:
21007 more images
21008 more tables
21009 character entities
21010 and much more
21011 Try for 100% code coverage