Merge "mediawiki.language.init: Ignore case of language code"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well-formedness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-specific options (not run by PHP parser unless
25 # the test includes an html/php section)
26 # php php-only test (not run by the parsoid parser unless
27 # the test includes an html/parsoid section)
28 # showtitle make the first line the title
29 # comment run through Linker::formatComment() instead of main parser
30 # local format section links in edit comment text as local links
31 # notoc disable table of contents
32 # thumbsize=NNN set the default thumb size to NNNpx for this test
33 #
34 # You can also set the following parser properties via test options:
35 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
36 # wgLinkHolderBatchSize, wgRawHtml
37 #
38 # For testing purposes, temporary articles can created:
39 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
40 # where '/' denotes a newline.
41
42 # This is the standard article assumed to exist.
43 !! article
44 Main Page
45 !! text
46 blah blah
47 !! endarticle
48
49 !!article
50 Foo
51 !!text
52 FOO
53 !!endarticle
54
55 !!article
56 Template:Foo
57 !!text
58 FOO
59 !!endarticle
60
61 !! article
62 Template:Blank
63 !! text
64 !! endarticle
65
66 !! article
67 Template:pipe
68 !! text
69 |
70 !! endarticle
71
72 !!article
73 MediaWiki:bad image list
74 !!text
75 * [[File:Bad.jpg]] except [[Nasty page]]
76 !!endarticle
77
78 !! article
79 Template:inner list
80 !! text
81 * item 1
82 !! endarticle
83
84 !! article
85 Template:tbl-start
86 !! text
87 {|
88 !! endarticle
89
90 !! article
91 Template:tbl-end
92 !! text
93 |}
94 !! endarticle
95
96 !! article
97 Template:echo
98 !! text
99 {{{1}}}
100 !! endarticle
101
102 !! article
103 Template:echo_with_span
104 !! text
105 <span>{{{1}}}</span>
106 !! endarticle
107
108 !! article
109 Template:echo_with_div
110 !! text
111 <div>{{{1}}}</div>
112 !! endarticle
113
114 !! article
115 Template: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 ## See T48811 for details
135 !! article
136 Template:mixed_attr_content_template
137 !! text
138 style="color:red;" title="T48811"
139 |-
140 |foo
141 !! endarticle
142
143 !! article
144 A?b
145 !! text
146 Weirdo titles!
147 !! endarticle
148
149 !!article
150 Template:Bullet
151 !!text
152 * Bar
153 !!endarticle
154
155 !!article
156 Template:OpenTable
157 !!text
158 {|
159 !!endarticle
160
161 !!article
162 Template:EmptyLITest
163 !!text
164 *a
165 *
166 *
167 *b
168 !!endarticle
169
170 !!article
171 Template:EmptyTRTest
172 !!text
173 {|
174 |-
175 |-
176 |foo
177 |-
178 |-
179 |bar
180 |}
181 !!endarticle
182
183 !!article
184 Template:EmptyTRWithHTMLAttrTest
185 !!text
186 <table>
187 <tr align="center"></tr>
188 <tr><td>foo</td></tr>
189 <tr align="center"></tr>
190 <tr><td>bar</td></tr>
191 </table>
192 !!endarticle
193
194 ###
195 ### Basic tests
196 ###
197 !! test
198 Blank input
199 !! wikitext
200 !! html
201 !! end
202
203
204 !! test
205 Simple paragraph
206 !! wikitext
207 This is a simple paragraph.
208 !! html
209 <p>This is a simple paragraph.
210 </p>
211 !! end
212
213 !! test
214 Paragraphs with extra newline spacing
215 !! wikitext
216 foo
217
218 bar
219
220
221 baz
222
223
224
225 booz
226 !! html
227 <p>foo
228 </p><p>bar
229 </p><p><br />
230 baz
231 </p><p><br />
232 </p><p>booz
233 </p>
234 !! end
235
236 !! test
237 Paragraphs with newline spacing with comment lines in between
238 !! wikitext
239 ----
240 a
241 <!--foo-->
242 b
243 ----
244 a
245 <!--foo--><!--More than 1 comment, still stripped-->
246 b
247 ----
248 a
249 <!--foo--> <!----> <!-- bar -->
250 b
251 ----
252 a
253 <!--foo-->
254
255 b
256 ----
257 a
258
259 <!--foo-->
260 b
261 ----
262 a
263 <!--foo-->
264
265
266 b
267 ----
268 a
269
270
271 <!--foo-->
272 b
273 ----
274 !! html
275 <hr />
276 <p>a
277 b
278 </p>
279 <hr />
280 <p>a
281 b
282 </p>
283 <hr />
284 <p>a
285 b
286 </p>
287 <hr />
288 <p>a
289 </p><p>b
290 </p>
291 <hr />
292 <p>a
293 </p><p>b
294 </p>
295 <hr />
296 <p>a
297 </p><p><br />
298 b
299 </p>
300 <hr />
301 <p>a
302 </p><p><br />
303 b
304 </p>
305 <hr />
306
307 !! end
308
309 !! test
310 Paragraphs with newline spacing with non-empty white-space lines in between
311 !! wikitext
312 ----
313 a
314
315 b
316 ----
317 a
318
319
320 b
321 ----
322 !! html
323 <hr />
324 <p>a
325 </p><p>b
326 </p>
327 <hr />
328 <p>a
329 </p><p><br />
330 b
331 </p>
332 <hr />
333
334 !! end
335
336 !! test
337 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
338 !! wikitext
339 ----
340 a
341 <!--foo-->
342 b
343 ----
344 a
345 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
346 b
347 ----
348 a
349
350 <!--foo-->
351 <!--bar-->
352 b
353 ----
354 a
355
356 <!--foo-->
357 <!--bar-->
358
359 b
360 ----
361 !! html
362 <hr />
363 <p>a
364 b
365 </p>
366 <hr />
367 <p>a
368 b
369 </p>
370 <hr />
371 <p>a
372 </p><p>b
373 </p>
374 <hr />
375 <p>a
376 </p><p><br />
377 b
378 </p>
379 <hr />
380
381 !! end
382
383 !! test
384 Extra newlines: More paragraphs with indented comment
385 !! wikitext
386 a
387
388 <!--boo-->
389
390 b
391 !! html
392 <p>a
393 </p><p><br />
394 b
395 </p>
396 !!end
397
398 !! test
399 Extra newlines followed by heading
400 !! wikitext
401 a
402
403
404
405 =b=
406 [[a]]
407
408
409 =b=
410 !! html
411 <p>a
412 </p><p><br />
413 </p>
414 <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>
415 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
416 </p><p><br />
417 </p>
418 <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>
419
420 !! end
421
422 !! test
423 Extra newlines between heading and content are swallowed
424 !! wikitext
425 =b=
426
427
428
429 [[a]]
430 !! html
431 <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>
432 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
433 </p>
434 !! end
435
436 !! test
437 Parsing an URL
438 !! wikitext
439 http://fr.wikipedia.org/wiki/🍺
440 <!-- EasterEgg we love beer, better be able be able to link to it -->
441 !! html
442 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
443 </p>
444 !! end
445
446 # Note that the html+tidy output removes the spaces after the <li>,
447 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
448 # This is an issue for all tests with lists. We intentionally do
449 # *not* add html+tidy clauses for these, as we don't want to
450 # document/test the broken behavior. (Parsoid matches the non-tidy
451 # output in these cases.)
452
453 !! test
454 Simple list
455 !! wikitext
456 * Item 1
457 * Item 2
458 !! html
459 <ul><li> Item 1</li>
460 <li> Item 2</li></ul>
461
462 !! end
463
464 !! test
465 Italics and bold
466 !! wikitext
467 * plain
468 * plain''italic''plain
469 * plain''italic''plain''italic''plain
470 * plain'''bold'''plain
471 * plain'''bold'''plain'''bold'''plain
472 * plain''italic''plain'''bold'''plain
473 * plain'''bold'''plain''italic''plain
474 * plain''italic'''bold-italic'''italic''plain
475 * plain'''bold''bold-italic''bold'''plain
476 * plain'''''bold-italic'''italic''plain
477 * plain'''''bold-italic''bold'''plain
478 * plain''italic'''bold-italic'''''plain
479 * plain'''bold''bold-italic'''''plain
480 * plain l'''italic''plain
481 * plain l''''bold''' plain
482 !! html
483 <ul><li> plain</li>
484 <li> plain<i>italic</i>plain</li>
485 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
486 <li> plain<b>bold</b>plain</li>
487 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
488 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
489 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
490 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
491 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
492 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
493 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
494 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
495 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
496 <li> plain l'<i>italic</i>plain</li>
497 <li> plain l'<b>bold</b> plain</li></ul>
498
499 !! end
500
501 # this example taken from the [[simple:Moon]] article (bug 47326)
502 !! test
503 Italics and possessives (1)
504 !! wikitext
505 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
506 !! html
507 <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
508 </p>
509 !! end
510
511 # this example taken from [[en:Flaming Pie]] (bug 49926)
512 !! test
513 Italics and possessives (2)
514 !! wikitext
515 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
516 !! html
517 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
518 </p>
519 !! end
520
521 # this example taken from [[en:Dictionary]] (bug 49926)
522 !! test
523 Italics and possessives (3)
524 !! wikitext
525 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''.
526 !! html
527 <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>.
528 </p>
529 !! end
530
531
532 ###
533 ### 2-quote opening sequence tests
534 ###
535 !! test
536 Italics and bold: 2-quote opening sequence: (2,2)
537 !! wikitext
538 ''foo''
539 !! html
540 <p><i>foo</i>
541 </p>
542 !!end
543
544 !! test
545 Italics and bold: 2-quote opening sequence: (2,3)
546 !! wikitext
547 ''foo'''
548 !! html/*
549 <p><i>foo'</i>
550 </p>
551 !!end
552
553 !! test
554 Italics and bold: 2-quote opening sequence: (2,4)
555 !! options
556 parsoid=wt2html
557 !! wikitext
558 ''foo''''
559 !! html/*
560 <p><i>foo''</i>
561 </p>
562 !!end
563
564 # same html as previous, but wikitext adjusted to match parsoid html2wt
565 !! test
566 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
567 !! wikitext
568 ''foo<nowiki>''</nowiki>''
569 !! html
570 <p><i>foo''</i>
571 </p>
572 !! end
573
574 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
575 !! test
576 Italics and bold: 2-quote opening sequence: (2,5)
577 !! options
578 parsoid=wt2html
579 !! wikitext
580 ''foo'''''
581 !! html/php
582 <p><i>foo</i>
583 </p>
584 !! html/parsoid
585 <p><i>foo</i><b></b>
586 </p>
587 !!end
588
589 # same html as previous, but wikitext adjusted to match parsoid html2wt
590 !! test
591 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
592 !! wikitext
593 ''foo'''''<nowiki/>'''
594 !! html/php
595 <p><i>foo</i>
596 </p>
597 !! html/parsoid
598 <p><i>foo</i><b></b>
599 </p>
600 !! end
601
602
603 ###
604 ### 3-quote opening sequence tests
605 ###
606
607 !! test
608 Italics and bold: 3-quote opening sequence: (3,2)
609 !! wikitext
610 '''foo''
611 !! html/*
612 <p>'<i>foo</i>
613 </p>
614 !!end
615
616 !! test
617 Italics and bold: 3-quote opening sequence: (3,3)
618 !! wikitext
619 '''foo'''
620 !! html
621 <p><b>foo</b>
622 </p>
623 !!end
624
625 !! test
626 Italics and bold: 3-quote opening sequence: (3,4)
627 !! wikitext
628 '''foo''''
629 !! html/*
630 <p><b>foo'</b>
631 </p>
632 !!end
633
634 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
635 !! test
636 Italics and bold: 3-quote opening sequence: (3,5)
637 !! options
638 parsoid=wt2html
639 !! wikitext
640 '''foo'''''
641 !! html/php
642 <p><b>foo</b>
643 </p>
644 !! html/parsoid
645 <p><b>foo</b><i></i>
646 </p>
647 !!end
648
649 # same html as previous, but wikitext adjusted to match parsoid html2wt
650 !! test
651 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
652 !! wikitext
653 '''foo'''''<nowiki/>''
654 !! html/php
655 <p><b>foo</b>
656 </p>
657 !! html/parsoid
658 <p><b>foo</b><i></i>
659 </p>
660 !! end
661
662
663 ###
664 ### 4-quote opening sequence tests
665 ###
666
667 !! test
668 Italics and bold: 4-quote opening sequence: (4,2)
669 !! options
670 parsoid=wt2html
671 !! wikitext
672 ''''foo''
673 !! html/*
674 <p>''<i>foo</i>
675 </p>
676 !!end
677
678 # same html as previous, but wikitext adjusted to match parsoid html2wt
679 !! test
680 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
681 !! wikitext
682 <nowiki>''</nowiki>''foo''
683 !! html
684 <p>''<i>foo</i>
685 </p>
686 !! end
687
688 !! test
689 Italics and bold: 4-quote opening sequence: (4,3)
690 !! wikitext
691 ''''foo'''
692 !! html/*
693 <p>'<b>foo</b>
694 </p>
695 !!end
696
697 !! test
698 Italics and bold: 4-quote opening sequence: (4,4)
699 !! options
700 parsoid=wt2html
701 !! wikitext
702 ''''foo''''
703 !! html/*
704 <p>'<b>foo'</b>
705 </p>
706 !!end
707
708 # same html as previous, but wikitext adjusted to match parsoid html2wt
709 !! test
710 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
711 !! wikitext
712 '<nowiki/>'''foo''''
713 !! html
714 <p>'<b>foo'</b>
715 </p>
716 !! end
717
718 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
719 !! test
720 Italics and bold: 4-quote opening sequence: (4,5)
721 !! options
722 parsoid=wt2html
723 !! wikitext
724 ''''foo'''''
725 !! html/php
726 <p>'<b>foo</b>
727 </p>
728 !! html/parsoid
729 <p>'<b>foo</b><i></i>
730 </p>
731 !!end
732
733 # same html as previous, but wikitext adjusted to match parsoid html2wt
734 !! test
735 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
736 !! wikitext
737 '<nowiki/>'''foo'''''<nowiki/>''
738 !! html/php
739 <p>'<b>foo</b>
740 </p>
741 !! html/parsoid
742 <p>'<b>foo</b><i></i>
743 </p>
744 !! end
745
746
747 ###
748 ### 5-quote opening sequence tests
749 ###
750
751 !! test
752 Italics and bold: 5-quote opening sequence: (5,2)
753 !! options
754 parsoid=wt2html
755 !! wikitext
756 '''''foo''
757 !! html/*
758 <p><b><i>foo</i></b>
759 </p>
760 !!end
761
762 # same html as previous, but wikitext adjusted to match parsoid html2wt
763 # skipping wt2html and html2html because it wants to put <i> before <b>
764 !! test
765 Italics and bold: 5-quote opening sequence: (5,2+3)
766 !! options
767 parsoid=wt2wt,html2wt
768 !! wikitext
769 '''''foo'''''
770 !! html
771 <p><b><i>foo</i></b>
772 </p>
773 !! end
774
775 !! test
776 Italics and bold: 5-quote opening sequence: (5,3)
777 !! options
778 parsoid=wt2html
779 !! wikitext
780 '''''foo'''
781 !! html/*
782 <p><i><b>foo</b></i>
783 </p>
784 !!end
785
786 # same html as previous, but wikitext adjusted to match parsoid html2wt
787 !! test
788 Italics and bold: 5-quote opening sequence: (5,3+2)
789 !! wikitext
790 '''''foo'''''
791 !! html
792 <p><i><b>foo</b></i>
793 </p>
794 !! end
795
796 !! test
797 Italics and bold: 5-quote opening sequence: (5,4)
798 !! options
799 parsoid=wt2html
800 !! wikitext
801 '''''foo''''
802 !! html/*
803 <p><i><b>foo'</b></i>
804 </p>
805 !!end
806
807 !! test
808 Italics and bold: 5-quote opening sequence: (5,5)
809 !! wikitext
810 '''''foo'''''
811 !! html
812 <p><i><b>foo</b></i>
813 </p>
814 !!end
815
816 !! test
817 Italics and bold: 5-quote opening sequence: (5,6)
818 !! wikitext
819 '''''foo''''''
820 !! html/*
821 <p><i><b>foo'</b></i>
822 </p>
823 !! end
824
825 ###
826 ### multiple quote sequences in a line
827 ###
828 !! test
829 Italics and bold: multiple quote sequences: (2,4,2)
830 !! options
831 parsoid=wt2html
832 !! wikitext
833 ''foo''''bar''
834 !! html/*
835 <p><i>foo'<b>bar</b></i>
836 </p>
837 !!end
838
839
840 # same html as previous, but wikitext adjusted to match parsoid html2wt
841 !! test
842 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
843 !! wikitext
844 ''foo'<nowiki/>'''bar'''''
845 !! html
846 <p><i>foo'<b>bar</b></i>
847 </p>
848 !! end
849
850
851 !! test
852 Italics and bold: multiple quote sequences: (2,4,3)
853 !! options
854 parsoid=wt2html
855 !! wikitext
856 ''foo''''bar'''
857 !! html/*
858 <p><i>foo'<b>bar</b></i>
859 </p>
860 !!end
861
862
863 # same html as previous, but wikitext adjusted to match parsoid html2wt
864 !! test
865 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
866 !! wikitext
867 ''foo'<nowiki/>'''bar'''''
868 !! html
869 <p><i>foo'<b>bar</b></i>
870 </p>
871 !! end
872
873
874 !! test
875 Italics and bold: multiple quote sequences: (2,4,4)
876 !! options
877 parsoid=wt2html
878 !! wikitext
879 ''foo''''bar''''
880 !! html/*
881 <p><i>foo'<b>bar'</b></i>
882 </p>
883 !!end
884
885
886 # same html as previous, but wikitext adjusted to match parsoid html2wt
887 !! test
888 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
889 !! wikitext
890 ''foo'<nowiki/>'''bar'<nowiki/>'''''
891 !! html
892 <p><i>foo'<b>bar'</b></i>
893 </p>
894 !! end
895
896
897 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
898 !! test
899 Italics and bold: multiple quote sequences: (3,4,2)
900 !! options
901 parsoid=wt2html
902 !! wikitext
903 '''foo''''bar''
904 !! html/php
905 <p><b>foo'</b>bar
906 </p>
907 !! html/parsoid
908 <p><b>foo'</b>bar<i></i>
909 </p>
910 !!end
911
912 # same html as previous, but wikitext adjusted to match parsoid html2wt
913 !! test
914 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
915 !! options
916 parsoid
917 !! wikitext
918 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
919 !! html/php
920 <p><b>foo'</b>bar
921 </p>
922 !! html/parsoid
923 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
924 </p>
925 !! end
926
927
928 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
929 !! test
930 Italics and bold: multiple quote sequences: (3,4,3)
931 !! options
932 parsoid=wt2html
933 !! wikitext
934 '''foo''''bar'''
935 !! html/php
936 <p><b>foo'</b>bar
937 </p>
938 !! html/parsoid
939 <p><b>foo'</b>bar<b></b>
940 </p>
941 !!end
942
943 # same html as previous, but wikitext adjusted to match parsoid html2wt
944 !! test
945 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
946 !! wikitext
947 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
948 !! html/php
949 <p><b>foo'</b>bar
950 </p>
951 !! html/parsoid
952 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
953 </p>
954 !! end
955
956 ###
957 ### other quote tests
958 ###
959 !! test
960 Italics and bold: other quote tests: (2,3,5)
961 !! wikitext
962 ''this is about '''foo's family'''''
963 !! html
964 <p><i>this is about <b>foo's family</b></i>
965 </p>
966 !!end
967
968
969 !! test
970 Italics and bold: other quote tests: (2,(3,3),2)
971 !! wikitext
972 ''this is about '''foo's''' family''
973 !! html
974 <p><i>this is about <b>foo's</b> family</i>
975 </p>
976 !!end
977
978
979 !! test
980 Italics and bold: other quote tests: (3,2,3,2)
981 !! options
982 parsoid=wt2html
983 !! wikitext
984 '''this is about ''foo'''s family''
985 !! html/*
986 <p><b>this is about <i>foo</i></b><i>s family</i>
987 </p>
988 !!end
989
990
991 # same html as previous, but wikitext adjusted to match parsoid html2wt
992 !! test
993 Italics and bold: other quote tests: (3,2,3+2+2,2)
994 !! wikitext
995 '''this is about ''foo'''''<nowiki/>''s family''
996 !! html
997 <p><b>this is about <i>foo</i></b><i>s family</i>
998 </p>
999 !! end
1000
1001
1002 !! test
1003 Italics and bold: other quote tests: (3,2,3,3)
1004 !! wikitext
1005 '''this is about ''foo'''s family'''
1006 !! html/*
1007 <p>'<i>this is about </i>foo<b>s family</b>
1008 </p>
1009 !!end
1010
1011
1012 !! test
1013 Italics and bold: other quote tests: (3,(2,2),3)
1014 !! wikitext
1015 '''this is about ''foo's'' family'''
1016 !! html
1017 <p><b>this is about <i>foo's</i> family</b>
1018 </p>
1019 !!end
1020
1021
1022 !! test
1023 Italicized possessive
1024 !! wikitext
1025 The ''[[Main Page]]'''s talk page.
1026 !! html/php
1027 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1028 </p>
1029 !! html/parsoid
1030 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1031 !! end
1032
1033 !! test
1034 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1035 (Requires tidy for PHP parser output to be fixed up)
1036 !! options
1037 parsoid=wt2html,wt2wt
1038 !! wikitext
1039 {|
1040 !''a!!''b
1041 |''a||''b
1042 |}
1043 !! html/php+tidy
1044 <table>
1045 <tr>
1046 <th><i>a</i></th>
1047 <th><i>b</i></th>
1048 <td><i>a</i></td>
1049 <td><i>b</i></td>
1050 </tr>
1051 </table>
1052 !! html/parsoid
1053 <table>
1054 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1055 <td><i>a</i></td><td><i>b</i></td></tr>
1056 </tbody></table>
1057 !! end
1058
1059 ###
1060 ### Non-html5 tags
1061 ###
1062
1063 !! test
1064 Non-html5 tags should be accepted
1065 !! wikitext
1066 <center>''foo''</center>
1067 <big>''foo''</big>
1068 <font>''foo''</font>
1069 <strike>''foo''</strike>
1070 <tt>''foo''</tt>
1071 !! html
1072 <center><i>foo</i></center>
1073 <p><big><i>foo</i></big>
1074 <font><i>foo</i></font>
1075 <strike><i>foo</i></strike>
1076 <tt><i>foo</i></tt>
1077 </p>
1078 !! end
1079
1080 !! test
1081 <wbr> is valid wikitext (bug 52468)
1082 !! wikitext
1083 <wbr>
1084 !! html
1085 <p><wbr />
1086 </p>
1087 !! end
1088
1089 # <strike> is HTML4, <s> is HTML4/5.
1090 !! test
1091 <s> or <strike> for strikethrough
1092 !! wikitext
1093 <strike>strike</strike>
1094
1095 <s>s</s>
1096 !! html
1097 <p><strike>strike</strike>
1098 </p><p><s>s</s>
1099 </p>
1100 !! end
1101
1102 ## a not permitted
1103 ## i,b,br omitted
1104 !! test
1105 Text-level semantic html elements in wikitext
1106 !! wikitext
1107 <em>text</em>
1108 <strong>text</strong>
1109 <small>text</small>
1110 <s>text</s>
1111 <cite>text</cite>
1112 <q>text</q>
1113 <dfn>text</dfn>
1114 <abbr>text</abbr>
1115 <data>text</data>
1116 <time>text</time>
1117 <code>text</code>
1118 <var>text</var>
1119 <samp>text</samp>
1120 <kbd>text</kbd>
1121 <sub>text</sub>
1122 <u>text</u>
1123 <mark>text</mark>
1124 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1125 <bdi>text</bdi>
1126 <bdo>text</bdo>
1127 <span>text</span>
1128 <wbr />
1129 !! html
1130 <p><em>text</em>
1131 <strong>text</strong>
1132 <small>text</small>
1133 <s>text</s>
1134 <cite>text</cite>
1135 <q>text</q>
1136 <dfn>text</dfn>
1137 <abbr>text</abbr>
1138 <data>text</data>
1139 <time>text</time>
1140 <code>text</code>
1141 <var>text</var>
1142 <samp>text</samp>
1143 <kbd>text</kbd>
1144 <sub>text</sub>
1145 <u>text</u>
1146 <mark>text</mark>
1147 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1148 <bdi>text</bdi>
1149 <bdo>text</bdo>
1150 <span>text</span>
1151 <wbr />
1152 </p>
1153 !! end
1154
1155 # test cases taken from
1156 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1157 !! test
1158 Ruby markup (W3C-style)
1159 !! wikitext
1160 ; Mono-ruby for individual base characters
1161 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1162 ; Group ruby
1163 : <ruby>今日<rt>きょう</rt></ruby>
1164 ; Jukugo ruby
1165 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1166 ; Inline ruby
1167 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1168 ; Double-sided ruby
1169 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1170 <ruby>
1171 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1172 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1173 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1174 </ruby>
1175 !! html
1176 <dl><dt> Mono-ruby for individual base characters</dt>
1177 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1178 <dt> Group ruby</dt>
1179 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1180 <dt> Jukugo ruby</dt>
1181 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1182 <dt> Inline ruby</dt>
1183 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1184 <dt> Double-sided ruby</dt>
1185 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1186 <p><ruby>
1187 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1188 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1189 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1190 </ruby>
1191 </p>
1192 !! end
1193
1194 # The next two test different paths in the sanitizer.
1195 !! test
1196 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1197 !! wikitext
1198 <b→> doesn't terminate </b→>
1199
1200 <bä> doesn't terminate </bä>
1201
1202 <boo> doesn't terminate </boo>
1203
1204 <s.foo> doesn't terminate </s.foo>
1205
1206 <sub-ID#1>
1207 !! html
1208 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1209 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1210 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1211 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1212 </p><p>&lt;sub-ID#1&gt;
1213 </p>
1214 !! end
1215
1216 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1217 !! test
1218 Non-word characters don't terminate tag names + tidy
1219 !! wikitext
1220 <b→> doesn't terminate </b→>
1221
1222 <bä> doesn't terminate </bä>
1223
1224 <boo> doesn't terminate </boo>
1225
1226 <s.foo> doesn't terminate </s.foo>
1227
1228 <sub-ID#1>
1229 !! html+tidy
1230 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1231 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1232 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1233 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1234 <p>&lt;sub-ID#1&gt;</p>
1235 !! end
1236
1237 !! test
1238 Isolated close tags should be treated as literal text (bug 52760)
1239 !! wikitext
1240 </b>
1241
1242 <s.foo>s</s>
1243 !! html
1244 <p>&lt;/b&gt;
1245 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1246 </p>
1247 !! end
1248
1249 ###
1250 ### Special characters
1251 ###
1252
1253 !! test
1254 Bare pipe character (bug 52363)
1255 !! wikitext
1256 |
1257 !! html
1258 <p>|
1259 </p>
1260 !! end
1261
1262 !! test
1263 Bare pipe character from a template (bug 52363)
1264 !! wikitext
1265 {{pipe}}
1266 !! html
1267 <p>|
1268 </p>
1269 !! end
1270
1271 ###
1272 ### <nowiki> test cases
1273 ###
1274
1275 !! test
1276 <nowiki> unordered list
1277 !! wikitext
1278 <nowiki>* This is not an unordered list item.</nowiki>
1279 !! html
1280 <p>* This is not an unordered list item.
1281 </p>
1282 !! end
1283
1284 !! test
1285 <nowiki> spacing
1286 !! wikitext
1287 <nowiki>Lorem ipsum dolor
1288
1289 sed abit.
1290 sed nullum.
1291
1292 :and a colon
1293 </nowiki>
1294 !! html
1295 <p>Lorem ipsum dolor
1296
1297 sed abit.
1298 sed nullum.
1299
1300 :and a colon
1301
1302 </p>
1303 !! end
1304
1305 !! test
1306 nowiki 3
1307 !! wikitext
1308 :There is not nowiki.
1309 :There is <nowiki>nowiki</nowiki>.
1310
1311 #There is not nowiki.
1312 #There is <nowiki>nowiki</nowiki>.
1313
1314 *There is not nowiki.
1315 *There is <nowiki>nowiki</nowiki>.
1316 !! html
1317 <dl><dd>There is not nowiki.</dd>
1318 <dd>There is nowiki.</dd></dl>
1319 <ol><li>There is not nowiki.</li>
1320 <li>There is nowiki.</li></ol>
1321 <ul><li>There is not nowiki.</li>
1322 <li>There is nowiki.</li></ul>
1323
1324 !! end
1325
1326 !! test
1327 Entities inside <nowiki>
1328 !! wikitext
1329 <nowiki>&lt;</nowiki>
1330 !! html
1331 <p>&lt;
1332 </p>
1333 !! end
1334
1335 !! test
1336 Entities inside template parameters
1337 !! options
1338 parsoid
1339 !! wikitext
1340 {{echo|&ndash;}}
1341 !! html
1342 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1343 !! end
1344
1345 !! test
1346 Properly escape nowiki when combined with other wiki markup
1347 !! options
1348 parsoid=html2wt
1349 !! html
1350 <p>* &lt;/nowiki&gt; tag</p>
1351 !! wikitext
1352 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1353 !! end
1354
1355 ###
1356 ### Comments
1357 ###
1358 !! test
1359 Comments and Indent-Pre
1360 !! wikitext
1361 <!-- comment 1 --> asdf
1362
1363 <!-- comment 1 --> asdf
1364 <!-- comment 2 -->
1365
1366 <!-- comment 1 --> asdf
1367 <!-- comment 2 -->xyz
1368
1369 <!-- comment 1 --> asdf
1370 <!-- comment 2 --> xyz
1371 !! html
1372 <pre>asdf
1373 </pre>
1374 <pre>asdf
1375 </pre>
1376 <pre>asdf
1377 </pre>
1378 <p>xyz
1379 </p>
1380 <pre>asdf
1381 xyz
1382 </pre>
1383 !! end
1384
1385 !! test
1386 Comment test 2a
1387 !! wikitext
1388 asdf
1389 <!-- comment 1 -->
1390 jkl
1391 !! html
1392 <p>asdf
1393 jkl
1394 </p>
1395 !! end
1396
1397 !! test
1398 Comment test 2b
1399 !! wikitext
1400 asdf
1401 <!-- comment 1 -->
1402
1403 jkl
1404 !! html
1405 <p>asdf
1406 </p><p>jkl
1407 </p>
1408 !! end
1409
1410 !! test
1411 Comment test 3
1412 !! wikitext
1413 asdf
1414 <!-- comment 1 -->
1415 <!-- comment 2 -->
1416 jkl
1417 !! html
1418 <p>asdf
1419 jkl
1420 </p>
1421 !! end
1422
1423 !! test
1424 Comment test 4
1425 !! wikitext
1426 asdf<!-- comment 1 -->jkl
1427 !! html
1428 <p>asdfjkl
1429 </p>
1430 !! end
1431
1432 !! test
1433 Comment spacing
1434 !! wikitext
1435 a
1436 <!-- foo --> b <!-- bar -->
1437 c
1438 !! html
1439 <p>a
1440 </p>
1441 <pre> b
1442 </pre>
1443 <p>c
1444 </p>
1445 !! end
1446
1447 !! test
1448 Comment whitespace
1449 !! wikitext
1450 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1451 !! html
1452
1453 !! end
1454
1455 !! test
1456 Comment semantics and delimiters
1457 !! wikitext
1458 <!-- --><!----><!-----><!------>
1459 !! html
1460
1461 !! end
1462
1463 !! test
1464 Comment semantics and delimiters, redux
1465 !! wikitext
1466 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1467 -- foo -- funky huh? ... -->
1468 !! html
1469
1470 !! end
1471
1472 !! test
1473 Comment semantics and delimiters: directors cut
1474 !! wikitext
1475 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1476 everything starting with < followed by !-- until the first -- and > we see,
1477 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1478 -->-->
1479 !! html
1480 <p>--&gt;
1481 </p>
1482 !! end
1483
1484 !! test
1485 Comment semantics: nesting
1486 !! wikitext
1487 <!--<!-- no, we're not going to do anything fancy here -->-->
1488 !! html
1489 <p>--&gt;
1490 </p>
1491 !! end
1492
1493 !! test
1494 Comment semantics: unclosed comment at end
1495 !! wikitext
1496 <!--This comment will run out to the end of the document
1497 !! html
1498
1499 !! end
1500
1501 # Bug 58184: document parsoid's behaviour
1502 !! test
1503 Suppress comment closing tag in lenient browsers
1504 !! options
1505 parsoid=wt2html,html2html
1506 !! wikitext
1507 <!-- Browsers--!> think this is closed -->
1508 !! html/php
1509
1510 !! html/parsoid
1511 <!-- Browsers--¡> think this is closed -->
1512 !! end
1513
1514 !! test
1515 Comment in template title
1516 !! wikitext
1517 {{f<!---->oo}}
1518 !! html
1519 <p>FOO
1520 </p>
1521 !! end
1522
1523 !! test
1524 Comment on its own line post-expand
1525 !! wikitext
1526 a
1527 {{blank}}<!---->
1528 b
1529 !! html
1530 <p>a
1531 </p><p>b
1532 </p>
1533 !! end
1534
1535 !! test
1536 Comment on its own line post-expand with non-significant whitespace
1537 !! wikitext
1538 a
1539 {{blank}} <!---->
1540 b
1541 !! html
1542 <p>a
1543 </p><p>b
1544 </p>
1545 !! end
1546
1547 !! test
1548 Multiple comments should still parse as SOL-transparent
1549 !! options
1550 parsoid=wt2html,wt2wt
1551 !! wikitext
1552 <!--c1-->*a
1553 <!--c2--><!--c3--><!--c4-->*b
1554 !! html
1555 <ul>
1556 <li>a
1557 </li>
1558 <li>b
1559 </li>
1560 </ul>
1561 !! end
1562
1563 ###
1564 ### paragraph wrapping tests
1565 ###
1566 !! test
1567 No block tags
1568 !! wikitext
1569 a
1570
1571 b
1572 !! html
1573 <p>a
1574 </p><p>b
1575 </p>
1576 !! end
1577
1578 !! test
1579 Block tag on one line (<div>)
1580 !! wikitext
1581 a <div>foo</div>
1582
1583 b
1584 !! html
1585 a <div>foo</div>
1586 <p>b
1587 </p>
1588 !! html+tidy
1589 <p>a</p>
1590 <div>foo</div>
1591 <p>b</p>
1592 !! end
1593
1594 !! test
1595 Block tag on one line (<blockquote>)
1596 !! wikitext
1597 a <blockquote>foo</blockquote>
1598
1599 b
1600 !! html
1601 a <blockquote>foo</blockquote>
1602 <p>b
1603 </p>
1604 !! html+tidy
1605 <p>a</p>
1606 <blockquote>
1607 <p>foo</p>
1608 </blockquote>
1609 <p>b</p>
1610 !! end
1611
1612 !! test
1613 Block tag on both lines (<div>)
1614 !! wikitext
1615 a <div>foo</div>
1616
1617 b <div>foo</div>
1618 !! html
1619 a <div>foo</div>
1620 b <div>foo</div>
1621
1622 !! html+tidy
1623 <p>a</p>
1624 <div>foo</div>
1625 <p>b</p>
1626 <div>foo</div>
1627 !! end
1628
1629 !! test
1630 Block tag on both lines (<blockquote>)
1631 !! wikitext
1632 a <blockquote>foo</blockquote>
1633
1634 b <blockquote>foo</blockquote>
1635 !! html
1636 a <blockquote>foo</blockquote>
1637 b <blockquote>foo</blockquote>
1638
1639 !! html+tidy
1640 <p>a</p>
1641 <blockquote>
1642 <p>foo</p>
1643 </blockquote>
1644 <p>b</p>
1645 <blockquote>
1646 <p>foo</p>
1647 </blockquote>
1648 !! end
1649
1650 !! test
1651 Multiple lines without block tags
1652 !! wikitext
1653 <div>foo</div> a
1654 b
1655 c
1656 d<!--foo--> e
1657 x <div>foo</div> z
1658 !! html
1659 <div>foo</div> a
1660 <p>b
1661 c
1662 d e
1663 </p>
1664 x <div>foo</div> z
1665
1666 !! html+tidy
1667 <div>foo</div>
1668 <p>a</p>
1669 <p>b c d e</p>
1670 <p>x</p>
1671 <div>foo</div>
1672 <p>z</p>
1673 !! end
1674
1675 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1676 # So, we have a separate section for Parsoid. We don't want
1677 # to mimic this stripping behavior in Parsoid. It affects
1678 # editing experience and also requires us to maintain additional
1679 # info for RT-ing.
1680 !! test
1681 Empty lines between lines with block tags
1682 !! wikitext
1683 <div></div>
1684
1685
1686 <div></div>a
1687
1688 b
1689 <div>a</div>b
1690
1691 <div>b</div>d
1692
1693
1694 <div>e</div>
1695 !! html
1696 <div></div>
1697 <p><br />
1698 </p>
1699 <div></div>a
1700 <p>b
1701 </p>
1702 <div>a</div>b
1703 <div>b</div>d
1704 <p><br />
1705 </p>
1706 <div>e</div>
1707
1708 !! html+tidy
1709 <p><br /></p>
1710 <p>a</p>
1711 <p>b</p>
1712 <div>a</div>
1713 <p>b</p>
1714 <div>b</div>
1715 <p>d</p>
1716 <p><br /></p>
1717 <div>e</div>
1718 !! html/parsoid
1719 <div data-parsoid='{"stx":"html"}'></div>
1720
1721 <p><br /></p>
1722 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1723
1724 <p>b</p>
1725 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1726
1727 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1728
1729 <p><br /></p>
1730 <div data-parsoid='{"stx":"html"}'>e</div>
1731 !! end
1732
1733 ## PHP parser emits output which is broken
1734 ## XXX The parsoid output doesn't match the tidy output.
1735 !! test
1736 Unclosed HTML p-tags should be handled properly
1737 !! wikitext
1738 <div><p>foo</div>
1739 a
1740
1741 b
1742 !! html/php+tidy
1743 <div>
1744 <p>foo&lt;/div&gt;</p>
1745 <p>a</p>
1746 b</div>
1747 !! html/parsoid
1748 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1749 <p>a</p>
1750 <p>b</p>
1751 !! end
1752
1753 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
1754 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
1755 ## them for now.
1756 !! test
1757 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
1758 !! options
1759 parsoid=wt2html
1760 !! wikitext
1761 a [[Category:A1]] [[Category:A2]]
1762 [[Category:A3]]
1763 [[Category:A4]]
1764 !! html/parsoid
1765 <p>a</p>
1766 <link href="Category:A1"/> <link href="Category:A2"/> <link href="Category:A3"/> <link href="Category:A4"/>
1767 !! end
1768
1769 !! test
1770 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
1771 !! options
1772 parsoid=wt2html
1773 !! wikitext
1774 [[Category:A1]]a
1775 !! html/parsoid
1776 <link href="Category:A1"/><p>a</p>
1777 !! end
1778
1779 ###
1780 ### Preformatted text
1781 ###
1782 !! test
1783 Preformatted text
1784 !! wikitext
1785 This is some
1786 Preformatted text
1787 With ''italic''
1788 And '''bold'''
1789 And a [[Main Page|link]]
1790 !! html
1791 <pre>This is some
1792 Preformatted text
1793 With <i>italic</i>
1794 And <b>bold</b>
1795 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1796 </pre>
1797 !! end
1798
1799 !! test
1800 Tabs don't trigger preformatted text
1801 !! wikitext
1802 This is not
1803 preformatted text.
1804 This is preformatted text.
1805 So is this.
1806 !! html
1807 <p> This is not
1808 preformatted text.
1809 </p>
1810 <pre>This is preformatted text.
1811 So is this.
1812 </pre>
1813 !! end
1814
1815 !! test
1816 Ident preformatting with inline content
1817 !! wikitext
1818 a
1819 ''b''
1820 !! html
1821 <pre>a
1822 <i>b</i>
1823 </pre>
1824 !! end
1825
1826 !! test
1827 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1828 !! wikitext
1829 <pre><nowiki>
1830 <b>
1831 <cite>
1832 <em>
1833 </nowiki></pre>
1834 !! html
1835 <pre>
1836 &lt;b&gt;
1837 &lt;cite&gt;
1838 &lt;em&gt;
1839 </pre>
1840
1841 !! end
1842
1843 !! test
1844 Regression with preformatted in <center>
1845 !! wikitext
1846 <center>
1847 Blah
1848 </center>
1849 !! html
1850 <center>
1851 <pre>Blah
1852 </pre>
1853 </center>
1854
1855 !! end
1856
1857 !! test
1858 Bug 52763: Preformatted in <blockquote>
1859 !! wikitext
1860 <blockquote>
1861 Blah
1862 {|
1863 |
1864 indented cell (no pre-wrapping!)
1865 |}
1866 </blockquote>
1867 !! html
1868 <blockquote>
1869 <p> Blah
1870 </p>
1871 <table>
1872 <tr>
1873 <td>
1874 <p> indented cell (no pre-wrapping!)
1875 </p>
1876 </td></tr></table>
1877 </blockquote>
1878
1879 !! end
1880
1881 !! test
1882 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1883 !! wikitext
1884 <blockquote>
1885 Foo
1886
1887 Bar
1888 </blockquote>
1889 !! html
1890 <blockquote>
1891 <p>Foo
1892 </p><p>Bar
1893 </p>
1894 </blockquote>
1895
1896 !! end
1897
1898 !! test
1899 Bug 15491: <ins>/<del> in blockquote
1900 !! wikitext
1901 <blockquote>
1902 Foo <del>bar</del> <ins>baz</ins> quux
1903 </blockquote>
1904 !! html
1905 <blockquote>
1906 <p>Foo <del>bar</del> <ins>baz</ins> quux
1907 </p>
1908 </blockquote>
1909
1910 !! end
1911
1912 # Note that the p-wrapping is newline sensitive, which could be
1913 # considered a bug: tidy will wrap only the 'Foo' in the example
1914 # below in a <p> tag. (see comment 23-25 of bug #6200)
1915 !! test
1916 Bug 15491: <ins>/<del> in blockquote (2)
1917 !! wikitext
1918 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1919 </blockquote>
1920 !! html
1921 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1922 </blockquote>
1923
1924 !! html+tidy
1925 <blockquote>
1926 <p>Foo</p>
1927 <del>bar</del> <ins>baz</ins> quux</blockquote>
1928 !! end
1929
1930 !! test
1931 <pre> with attributes (bug 3202)
1932 !! wikitext
1933 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1934 !! html
1935 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1936
1937 !! end
1938
1939 !! test
1940 <pre> with width attribute (bug 3202)
1941 !! wikitext
1942 <pre width="8">Narrow screen goodies</pre>
1943 !! html
1944 <pre width="8">Narrow screen goodies</pre>
1945
1946 !! end
1947
1948 !! test
1949 <pre> with forbidden attribute (bug 3202)
1950 !! wikitext
1951 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1952 !! html
1953 <pre width="8">Narrow screen goodies</pre>
1954
1955 !! end
1956
1957 !! test
1958 Entities inside <pre>
1959 !! wikitext
1960 <pre>&lt;</pre>
1961 !! html
1962 <pre>&lt;</pre>
1963
1964 !! end
1965
1966 !! test
1967 <pre> with forbidden attribute values (bug 3202)
1968 !! wikitext
1969 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1970 !! html
1971 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1972
1973 !! end
1974
1975 !! test
1976 <nowiki> inside <pre> (bug 13238)
1977 !! wikitext
1978 <pre>
1979 <nowiki>
1980 </pre>
1981 <pre>
1982 <nowiki></nowiki>
1983 </pre>
1984 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1985 !! html
1986 <pre>
1987 &lt;nowiki&gt;
1988 </pre>
1989 <pre>
1990
1991 </pre>
1992 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1993
1994 !! end
1995
1996 !! test
1997 <nowiki> and <pre> preference (first one wins)
1998 !! wikitext
1999 <pre>
2000 <nowiki>
2001 </pre>
2002 </nowiki>
2003 </pre>
2004
2005 <nowiki>
2006 <pre>
2007 <nowiki>
2008 </pre>
2009 </nowiki>
2010 </pre>
2011
2012 !! html
2013 <pre>
2014 &lt;nowiki&gt;
2015 </pre>
2016 <p>&lt;/nowiki&gt;
2017 &lt;/pre&gt;
2018 </p><p>
2019 &lt;pre&gt;
2020 &lt;nowiki&gt;
2021 &lt;/pre&gt;
2022
2023 &lt;/pre&gt;
2024 </p>
2025 !! end
2026
2027 !! test
2028 </pre> inside nowiki
2029 !! wikitext
2030 <nowiki></pre></nowiki>
2031 !! html
2032 <p>&lt;/pre&gt;
2033 </p>
2034 !! end
2035
2036 # Parsoid doesn't strip empty tags, like Tidy does.
2037 !! test
2038 Empty pre; pre inside other HTML tags (bug 54946)
2039 !! options
2040 parsoid=wt2html,wt2wt
2041 !! wikitext
2042 a
2043
2044 <div><pre>
2045 foo
2046 </pre></div>
2047 <pre></pre>
2048 !! html/php
2049 <p>a
2050 </p>
2051 <div><pre>
2052 foo
2053 </pre></div>
2054 <pre></pre>
2055
2056 !! html/php+tidy
2057 <p>a</p>
2058 <div>
2059 <pre>
2060 foo
2061 </pre></div>
2062 !! html/parsoid
2063 <p>a</p>
2064
2065 <div><pre>foo
2066 </pre></div>
2067 <pre></pre>
2068 !! end
2069
2070 !! test
2071 HTML pre followed by indent-pre
2072 !! wikitext
2073 <pre>foo</pre>
2074 bar
2075 !! html
2076 <pre>foo</pre>
2077 <pre>bar
2078 </pre>
2079 !! end
2080
2081 !!test
2082 Block tag pre
2083 !!options
2084 parsoid
2085 !! wikitext
2086 <p><pre>foo</pre></p>
2087 !! html
2088 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2089 !!end
2090
2091 !!test
2092 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2093 !! wikitext
2094 {{echo|}}
2095 !! html
2096
2097 !!end
2098
2099 !!test
2100 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2101 !! wikitext
2102 {{echo|
2103 foo}}
2104 !! html
2105 <p>foo
2106 </p>
2107 !!end
2108
2109 !! test
2110 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2111 !! wikitext
2112 {{echo|a
2113 b}}
2114 !! html
2115 <pre>a
2116 </pre>
2117 <p>b
2118 </p>
2119 !!end
2120
2121 !! test
2122 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2123 !! wikitext
2124 {{echo|a
2125 b
2126 c
2127 d
2128 e
2129 }}
2130 !! html
2131 <pre>a
2132 </pre>
2133 <p>b
2134 c
2135 </p>
2136 <pre>d
2137 </pre>
2138 <p>e
2139 </p>
2140 !!end
2141
2142 !!test
2143 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2144 !! wikitext
2145 {{echo| foo}}
2146
2147 {{echo| foo}}{{echo| bar}}
2148
2149 {{echo| foo}}
2150 {{echo| bar}}
2151
2152 {{echo|<!--cmt--> foo}}
2153
2154 <!--cmt-->{{echo| foo}}
2155
2156 {{echo|{{echo| }}bar}}
2157 !! html
2158 <pre>foo
2159 </pre>
2160 <pre>foo bar
2161 </pre>
2162 <pre>foo
2163 bar
2164 </pre>
2165 <pre>foo
2166 </pre>
2167 <pre>foo
2168 </pre>
2169 <pre>bar
2170 </pre>
2171 !!end
2172
2173 !! test
2174 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2175 !! wikitext
2176 {{echo| }}a
2177
2178 {{echo|
2179 }}a
2180
2181 {{echo|
2182 b}}
2183
2184 {{echo|a
2185 }}b
2186
2187 {{echo|a
2188 }} b
2189 !! html
2190 <pre>a
2191 </pre>
2192 <p><br />
2193 </p>
2194 <pre>a
2195 </pre>
2196 <p><br />
2197 </p>
2198 <pre>b
2199 </pre>
2200 <p>a
2201 </p>
2202 <pre>b
2203 </pre>
2204 <p>a
2205 </p>
2206 <pre>b
2207 </pre>
2208 !!end
2209
2210 !! test
2211 Things that look like <pre> tags aren't treated as such
2212 !! wikitext
2213 Barack Obama <President> of the United States
2214 <President></President>
2215 !! html
2216 <p>Barack Obama &lt;President&gt; of the United States
2217 &lt;President&gt;&lt;/President&gt;
2218 </p>
2219 !! end
2220
2221 ## PHP parser discards the "<pre " string
2222 !! test
2223 Handle broken pre-like tags (bug 64025)
2224 !! options
2225 parsoid=wt2html
2226 !! wikitext
2227 {{echo|<pre <pre>x</pre>}}
2228
2229 <table><pre </table>
2230 !! html/php
2231 <pre>x</pre>
2232 <table><pre></pre></table>
2233
2234 !! html/parsoid
2235 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2236
2237
2238 <p>&lt;pre </p>
2239
2240 <table></table>
2241 !! end
2242
2243 !! test
2244 Parsoid: handle pre with space after attribute
2245 !! options
2246 parsoid=wt2html
2247 !! wikitext
2248 <pre style="width:50%;" >{{echo|foo}}</pre>
2249 !! html
2250 <pre style="width:50%;">{{echo|foo}}</pre>
2251 !! end
2252
2253 # TODO / maybe: fix wt2wt for this
2254 !! test
2255 Parsoid: Don't paragraph-wrap fosterable content
2256 !! options
2257 parsoid=wt2html
2258 !! wikitext
2259 {|
2260 <td></td>
2261 <td></td>
2262
2263
2264
2265 |}
2266 !! html
2267 <table>
2268
2269 <tbody>
2270 <tr>
2271 <td></td>
2272
2273 <td></td></tr>
2274
2275
2276
2277 </tbody></table>
2278 !! end
2279
2280 !! test
2281 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2282 !! options
2283 parsoid=wt2html
2284 !! wikitext
2285 {|
2286 <td>
2287 <td>
2288 </td>
2289
2290
2291
2292 |}
2293 !! html
2294 <table>
2295
2296 <tbody>
2297 <tr>
2298 <td></td>
2299
2300 <td>
2301 </td></tr>
2302
2303
2304
2305 </tbody></table>
2306 !! end
2307
2308
2309 #--------------------------------------------------------------------
2310 # Transclusion parameter whitespace stripping tests
2311 # Behavior is different for positional and named parameters
2312 #--------------------------------------------------------------------
2313 !! test
2314 Templates: Strip leading and trailing whitespace from named-param values
2315 !! wikitext
2316 {{echo|1= a }}
2317
2318 {{echo|1= {{echo|b}} }}
2319
2320 {{echo| 1 =
2321 c }}
2322
2323 {{echo| 1 =
2324 * d
2325 }}
2326 !! html
2327 <p>a
2328 </p><p>b
2329 </p><p>c
2330 </p>
2331 <ul><li> d</li></ul>
2332
2333 !! end
2334
2335 !! test
2336 Templates: Don't strip whitespace from positional-param values
2337 !! wikitext
2338 {{echo|a }}
2339
2340 {{echo|{{echo|b}} }}
2341
2342 {{echo| c
2343 }}
2344
2345 {{echo| {{echo|d}}
2346 }}
2347
2348 {{echo|
2349 e}}
2350
2351 {{echo|
2352 * f}}
2353
2354 {{echo|
2355 }}g
2356 !! html
2357 <p>a
2358 </p><p>b
2359 </p>
2360 <pre>c
2361 </pre>
2362 <p><br />
2363 </p>
2364 <pre>d
2365 </pre>
2366 <p><br />
2367 </p>
2368 <pre>e
2369 </pre>
2370 <p><br />
2371 </p>
2372 <ul><li> f</li></ul>
2373 <p><br />
2374 </p>
2375 <pre>g
2376 </pre>
2377 !! end
2378
2379 !! test
2380 Templates: Handle empty comment-and-ws-only lines correctly
2381 !! wikitext
2382 {{echo|foo
2383 <!--should be ignored-->
2384 <!--should be ignored as well-->
2385 bar}}
2386 !! html
2387 <p>foo
2388 bar
2389 </p>
2390 !! end
2391
2392 !! test
2393 Templates: Handle comments in the target
2394 !! wikitext
2395 {{echo
2396 <!-- should be ignored -->
2397 |foo}}
2398
2399 {{echo<!-- should be ignored -->
2400 |foo}}
2401
2402 {{echo<!-- should be ignored -->|foo}}
2403
2404 {{<!-- should be ignored -->echo|foo}}
2405 !!html/parsoid
2406 <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>
2407
2408 <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>
2409
2410 <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>
2411
2412 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2413 !!end
2414
2415 !! test
2416 Templates: Handle comments in parameter names (bug 67657)
2417 !! wikitext
2418 {{echo|1
2419 <!-- should be ignored -->
2420 =foo}}
2421
2422 {{echo|
2423 <!-- should be ignored -->
2424 1 = foo}}
2425
2426 {{echo|1<!-- should be ignored --> = foo}}
2427
2428 {{echo|<!-- should be ignored -->1 = foo}}
2429 !!html/parsoid
2430 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2431
2432 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2433
2434 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2435
2436 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2437 !!end
2438
2439 !! test
2440 Templates: Other wikitext in parameter names (bug 67657)
2441 !! wikitext
2442 {{echo|''1''=foo}}
2443 !!html/parsoid
2444 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2445 !!html/php
2446 <p>{{{1}}}
2447 </p>
2448 !!end
2449
2450 #--------------------------------------------------------------------
2451 # Transclusion parameter escaping tests
2452 #--------------------------------------------------------------------
2453 !! test
2454 Templates: Parsoid parameter escaping test 1
2455 !! options
2456 parsoid
2457 !! wikitext
2458 {{echo|[foo]|{{echo|[bar]}}}}
2459 !! html
2460 <p about="#mwt1" typeof="mw:Transclusion"
2461 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2462 !! end
2463
2464 !! test
2465 Parsoid: Pipes in external links in template parameter
2466 !! options
2467 parsoid
2468 !! wikitext
2469 {{echo|[{{echo|http://example.com}} link]}}
2470 !! html
2471 <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>
2472 !! end
2473
2474 !! test
2475 Parsoid: pipe in transclusion parameter
2476 !! options
2477 parsoid
2478 !! wikitext
2479 {{echo|http://foo.com/a&#124;b}}
2480 !! html
2481 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2482 typeof="mw:Transclusion"
2483 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>
2484 !! end
2485
2486 !! test
2487 Parsoid: Pipe in external link target and content in template parameter
2488 !! options
2489 parsoid=html2wt,wt2wt
2490 !! wikitext
2491 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2492 !! html
2493 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2494 typeof="mw:Transclusion"
2495 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2496 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2497 !! end
2498
2499 !! test
2500 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2501 !! options
2502 parsoid
2503 !! wikitext
2504 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2505 !! html
2506 <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>
2507 !! end
2508
2509 !! test
2510 Templates: Don't escape already nowiki-escaped text in template parameters
2511 !! options
2512 parsoid=html2wt,wt2wt
2513 !! wikitext
2514 {{echo|foo<nowiki>|</nowiki>bar}}
2515 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2516 {{echo|<nowiki></nowiki>}}
2517 !! html
2518 <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>
2519 <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>
2520 <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>
2521 </p>
2522 !! end
2523
2524 ## Bug 52824
2525 !! test
2526 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2527 !! options
2528 parsoid=html2wt,wt2wt
2529 !! wikitext
2530 {{echo|{{echo|1=bar}}}}
2531 !! html
2532 <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>
2533 !! end
2534
2535 ## Bug 56733
2536 !! test
2537 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2538 !! options
2539 parsoid
2540 !! wikitext
2541 {{echo|a : b}}
2542 !! html
2543 <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>
2544 !! end
2545
2546 ## Bug T73412
2547 !! test
2548 Templates: Preserve blank parameter names
2549 !! wikitext
2550 {{echo|=foo}}
2551 !! html/php
2552 <p>{{{1}}}
2553 </p>
2554 !! html/parsoid
2555 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2556 !! end
2557
2558 ###
2559 ### Parsoid-centric tests for testing RT edge cases for pre
2560 ###
2561
2562 !!test
2563 1a. Indent-Pre and Comments
2564 !! wikitext
2565 a
2566 <!--a-->
2567 c
2568 !! html
2569 <pre>a
2570 </pre>
2571 <p>c
2572 </p>
2573 !!end
2574
2575 !!test
2576 1b. Indent-Pre and Comments
2577 !! wikitext
2578 a
2579 <!--a-->
2580 c
2581 !! html
2582 <pre>a
2583 </pre>
2584 <p>c
2585 </p>
2586 !!end
2587
2588 !!test
2589 1c. Indent-Pre and Comments
2590 !! wikitext
2591 <!--a--> a
2592
2593 <!--a--> a
2594 !! html
2595 <pre> a
2596 </pre>
2597 <pre> a
2598 </pre>
2599 !!end
2600
2601 !!test
2602 1d. Indent-Pre and Comments
2603 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2604 !! wikitext
2605 <!--a--> a
2606
2607 <!--b-->b
2608 !! html
2609 <pre>a
2610 </pre>
2611 <pre>b
2612 </pre>
2613 !!end
2614
2615 !!test
2616 2a. Indent-Pre and tables
2617 !! wikitext
2618 {|
2619 |-
2620 !h1!!h2
2621 |foo||bar
2622 |}
2623 !! html
2624 <table>
2625
2626 <tr>
2627 <th>h1</th>
2628 <th>h2
2629 </th>
2630 <td>foo</td>
2631 <td>bar
2632 </td></tr></table>
2633
2634 !!end
2635
2636 !!test
2637 2b. Indent-Pre and tables
2638 !! wikitext
2639 {|
2640 |-
2641 |foo
2642 |}
2643 !! html
2644 <table>
2645
2646 <tr>
2647 <td>foo
2648 </td></tr></table>
2649
2650 !!end
2651
2652 !!test
2653 2c. Indent-Pre and tables (bug 42252)
2654 !! wikitext
2655 {|
2656 |+ foo
2657 ! | bar
2658 |}
2659 !! html
2660 <table>
2661 <caption> foo
2662 </caption>
2663 <tr>
2664 <th> bar
2665 </th></tr></table>
2666
2667 !!end
2668
2669 !!test
2670 2d. Indent-Pre and tables
2671 !! wikitext
2672 a
2673 {|
2674 | b
2675 |}
2676 !! html/php
2677 <pre>a
2678 </pre>
2679 <table>
2680 <tr>
2681 <td> b
2682 </td></tr></table>
2683
2684 !! html/parsoid
2685 <pre>a</pre>
2686 <table>
2687 <tbody><tr><td> b</td></tr>
2688 </tbody></table>
2689 !!end
2690
2691 !!test
2692 2e. Indent-Pre and table-line syntax
2693 !! wikitext
2694 a
2695 | b
2696 | c
2697 !! html/php
2698 <pre>a
2699 | b
2700 | c
2701 </pre>
2702 !!end
2703
2704 !!test
2705 2f. Indent-pre started by table-line syntax
2706 !! wikitext
2707 a
2708 | b
2709 | c
2710 !! html/php
2711 <p>a
2712 </p>
2713 <pre>| b
2714 | c
2715 </pre>
2716 !! html/parsoid
2717 <p>a</p>
2718 <pre>
2719 | b
2720 | c</pre>
2721 !!end
2722
2723 !!test
2724 3a. Indent-Pre and block tags (single-line html)
2725 !! wikitext
2726 a <p> foo </p>
2727 b <div> foo </div>
2728 c <blockquote> foo </blockquote>
2729 <span> foo </span>
2730 !! html
2731 a <p> foo </p>
2732 b <div> foo </div>
2733 c <blockquote> foo </blockquote>
2734 <pre><span> foo </span>
2735 </pre>
2736 !! html/parsoid
2737 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
2738 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
2739 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
2740 <pre><span> foo </span>
2741 </pre>
2742 !! html+tidy
2743 <p>a</p>
2744 <p>foo</p>
2745 <p>b</p>
2746 <div>foo</div>
2747 <p>c</p>
2748 <blockquote>
2749 <p>foo</p>
2750 </blockquote>
2751 <pre>
2752 <span> foo </span>
2753 </pre>
2754 !! end
2755
2756 !!test
2757 3b. Indent-Pre and block tags (multi-line html)
2758 !! wikitext
2759 a <span>foo</span>
2760 b <div> foo </div>
2761 !! html
2762 <pre>a <span>foo</span>
2763 </pre>
2764 b <div> foo </div>
2765
2766 !! html/parsoid
2767 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
2768 b <div data-parsoid='{"stx":"html"}'> foo </div>
2769 !! html+tidy
2770 <pre>
2771 a <span>foo</span>
2772 </pre>
2773 <p>b</p>
2774 <div>foo</div>
2775 !!end
2776
2777 !!test
2778 3c. Indent-Pre and block tags (pre-content on separate line)
2779 !! wikitext
2780 <p>
2781 foo
2782 </p>
2783
2784 <div>
2785 foo
2786 </div>
2787
2788 <center>
2789 foo
2790 </center>
2791
2792 <blockquote>
2793 foo
2794 </blockquote>
2795
2796 <blockquote>
2797 <pre>
2798 foo
2799 </pre>
2800 </blockquote>
2801
2802 <table><tr><td>
2803 foo
2804 </td></tr></table>
2805
2806 <ul><li>
2807 foo
2808 </li></ul>
2809
2810 !! html
2811 <p>
2812 foo
2813 </p>
2814 <div>
2815 <pre>foo
2816 </pre>
2817 </div>
2818 <center>
2819 <pre>foo
2820 </pre>
2821 </center>
2822 <blockquote>
2823 <p> foo
2824 </p>
2825 </blockquote>
2826 <blockquote>
2827 <pre>
2828 foo
2829 </pre>
2830 </blockquote>
2831 <table><tr><td>
2832 <pre>foo
2833 </pre>
2834 </td></tr></table>
2835 <ul><li>
2836 foo
2837 </li></ul>
2838
2839 !!end
2840
2841 !!test
2842 4. Indent-Pre and extension tags
2843 !! wikitext
2844 a <gallery>
2845 File:foobar.jpg
2846 </gallery>
2847 !! html
2848 a <ul class="gallery mw-gallery-traditional">
2849 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2850 <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>
2851 <div class="gallerytext">
2852 </div>
2853 </div></li>
2854 </ul>
2855
2856 !! html+tidy
2857 <p>a</p>
2858 <ul class="gallery mw-gallery-traditional">
2859 <li class="gallerybox" style="width: 155px">
2860 <div style="width: 155px">
2861 <div class="thumb" style="width: 150px;">
2862 <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>
2863 </div>
2864 <div class="gallerytext"></div>
2865 </div>
2866 </li>
2867 </ul>
2868 !!end
2869
2870 !! test
2871 Table wikitext syntax outside wiki-tables
2872 !! wikitext
2873 a
2874 ! not a table heading
2875 |- not a table row
2876 | not a table cell
2877 | class="foo bar" | baz
2878 b
2879 |}
2880 |-
2881 c
2882 !! html
2883 <p>a
2884 ! not a table heading
2885 |- not a table row
2886 | not a table cell
2887 | class="foo bar" | baz
2888 b
2889 |}
2890 |-
2891 c
2892 </p>
2893 !! end
2894
2895 !!test
2896 Render paragraphs when indent-pre is suppressed in blocklevels
2897 !! wikitext
2898 <blockquote>
2899 foo
2900
2901 bar
2902 </blockquote>
2903 !! html
2904 <blockquote>
2905 <p> foo
2906 </p><p> bar
2907 </p>
2908 </blockquote>
2909
2910 !!end
2911
2912 !!test
2913 4. Multiple spaces at start-of-line
2914 !! wikitext
2915 <p> foo </p>
2916 foo
2917 {|
2918 |foo
2919 |}
2920 !! html
2921 <p> foo </p>
2922 <pre> foo
2923 </pre>
2924 <table>
2925 <tr>
2926 <td>foo
2927 </td></tr></table>
2928
2929 !!end
2930
2931 ## NOTE: the leading white-space chars on empty line are significant
2932 !! test
2933 5a. White-space in indent-pre
2934 !! wikitext
2935 a<br />
2936
2937 b
2938 !! html
2939 <pre>a<br />
2940
2941 b
2942 </pre>
2943 !! end
2944
2945 ## NOTE: the leading white-space chars on empty line are significant
2946 !! test
2947 5b. White-space in indent-pre
2948 !! wikitext
2949 a
2950
2951 b
2952
2953
2954 c
2955 !! html
2956 <pre>a
2957
2958 b
2959
2960
2961 c
2962 </pre>
2963 !! end
2964
2965 !! test
2966 5c. White-space in indent-pre
2967 !! wikitext
2968 ''a''
2969 ''b''
2970 ''c''
2971 !! html
2972 <pre><i>a</i>
2973 <i>b</i>
2974 <i>c</i>
2975 </pre>
2976 !! end
2977
2978 !! test
2979 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2980 !! wikitext
2981 a
2982
2983 <!-- continue -->
2984 b
2985
2986 c
2987
2988 d
2989 !! html
2990 <pre>a
2991
2992 b
2993 </pre>
2994 <pre>c
2995
2996 </pre>
2997 <p>d
2998 </p>
2999 !! end
3000
3001 !! test
3002 7a. Indent-pre and category links
3003 !! options
3004 parsoid=wt2html,wt2wt
3005 !! wikitext
3006 [[Category:foo]] <!-- No pre-wrapping -->
3007 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3008 !! html
3009 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
3010 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
3011 !! end
3012
3013 !! test
3014 7b. Indent-pre and category links
3015 !! options
3016 parsoid=wt2html,wt2wt
3017 !! wikitext
3018 [[Category:foo]] a
3019 [[Category:foo]] {{echo|b}}
3020 !! html
3021 <pre>
3022 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
3023 <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>
3024 !! end
3025
3026 ###
3027 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3028 ###
3029
3030 !!test
3031 HTML-pre: 1. embedded newlines
3032 !! wikitext
3033 <pre>foo</pre>
3034
3035 <pre>
3036 foo
3037 </pre>
3038
3039 <pre>
3040
3041 foo
3042 </pre>
3043
3044 <pre>
3045
3046
3047 foo
3048 </pre>
3049 !! html
3050 <pre>foo</pre>
3051 <pre>
3052 foo
3053 </pre>
3054 <pre>
3055
3056 foo
3057 </pre>
3058 <pre>
3059
3060
3061 foo
3062 </pre>
3063
3064 !! html/parsoid
3065 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3066
3067 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3068 foo
3069 </pre>
3070
3071 <pre data-parsoid='{"stx":"html"}'>
3072
3073 foo
3074 </pre>
3075
3076 <pre data-parsoid='{"stx":"html"}'>
3077
3078
3079 foo
3080 </pre>
3081 !!end
3082
3083 !! test
3084 HTML-pre: big spaces
3085 !! wikitext
3086 <pre>
3087
3088
3089
3090
3091 haha
3092
3093
3094
3095
3096 haha
3097
3098
3099
3100
3101 </pre>
3102 !! html
3103 <pre>
3104
3105
3106
3107
3108 haha
3109
3110
3111
3112
3113 haha
3114
3115
3116
3117
3118 </pre>
3119
3120 !! html/parsoid
3121 <pre data-parsoid='{"stx":"html"}'>
3122
3123
3124
3125
3126 haha
3127
3128
3129
3130
3131 haha
3132
3133
3134
3135
3136 </pre>
3137 !! end
3138
3139 !!test
3140 HTML-pre: 2: indented text
3141 !! wikitext
3142 <pre>
3143 foo
3144 </pre>
3145 !! html
3146 <pre>
3147 foo
3148 </pre>
3149
3150 !!end
3151
3152 !!test
3153 HTML-pre: 3: other wikitext
3154 !! wikitext
3155 <pre>
3156 * foo
3157 # bar
3158 = no-h =
3159 '' no-italic ''
3160 [[ NoLink ]]
3161 </pre>
3162 !! html
3163 <pre>
3164 * foo
3165 # bar
3166 = no-h =
3167 '' no-italic ''
3168 [[ NoLink ]]
3169 </pre>
3170
3171 !!end
3172
3173 ###
3174 ### Definition lists
3175 ###
3176 !! test
3177 Simple definition
3178 !! wikitext
3179 ; name : Definition
3180 !! html
3181 <dl><dt> name&#160;</dt>
3182 <dd> Definition</dd></dl>
3183
3184 !! end
3185
3186 !! test
3187 Definition list for indentation only
3188 !! wikitext
3189 : Indented text
3190 !! html
3191 <dl><dd> Indented text</dd></dl>
3192
3193 !! end
3194
3195 !! test
3196 Definition list with no space
3197 !! wikitext
3198 ;name:Definition
3199 !! html
3200 <dl><dt>name</dt>
3201 <dd>Definition</dd></dl>
3202
3203 !!end
3204
3205 !! test
3206 Definition list with URL link
3207 !! wikitext
3208 ; http://example.com/ : definition
3209 !! html
3210 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3211 <dd> definition</dd></dl>
3212
3213 !! end
3214
3215 !! test
3216 Definition list with bracketed URL link
3217 !! wikitext
3218 ;[http://www.example.com/ Example]:Something about it
3219 !! html
3220 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3221 <dd>Something about it</dd></dl>
3222
3223 !! end
3224
3225 !! test
3226 Definition list with wikilink containing colon
3227 !! wikitext
3228 ; [[Help:FAQ]]: The least-read page on Wikipedia
3229 !! html
3230 <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>
3231 <dd> The least-read page on Wikipedia</dd></dl>
3232
3233 !! end
3234
3235 # At Brion's and JeLuF's insistence... :)
3236 !! test
3237 Definition list with news link containing colon
3238 !! wikitext
3239 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3240 !! html/php
3241 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3242 <dd> This isn't even a real newsgroup!</dd></dl>
3243
3244 !! html/parsoid
3245 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3246 !! end
3247
3248 !! test
3249 Malformed definition list with colon
3250 !! wikitext
3251 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3252 !! html
3253 <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>
3254
3255 !! end
3256
3257 !! test
3258 Definition lists: colon in external link text
3259 !! wikitext
3260 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3261 !! html
3262 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3263 <dd> OK, I made that up</dd></dl>
3264
3265 !! end
3266
3267 !! test
3268 Definition lists: colon in HTML attribute
3269 !! wikitext
3270 ;<b style="display: inline">bold</b>
3271 !! html
3272 <dl><dt><b style="display: inline">bold</b></dt></dl>
3273
3274 !! end
3275
3276 !! test
3277 Definition lists: self-closed tag
3278 !! wikitext
3279 ;one<br/>two : two-line fun
3280 !! html
3281 <dl><dt>one<br />two&#160;</dt>
3282 <dd> two-line fun</dd></dl>
3283
3284 !! end
3285
3286 !! test
3287 Bug 11748: Literal closing tags
3288 !! wikitext
3289 <dl>
3290 <dt>test 1</dt>
3291 <dd>test test test test test</dd>
3292 <dt>test 2</dt>
3293 <dd>test test test test test</dd>
3294 </dl>
3295 !! html
3296 <dl>
3297 <dt>test 1</dt>
3298 <dd>test test test test test</dd>
3299 <dt>test 2</dt>
3300 <dd>test test test test test</dd>
3301 </dl>
3302
3303 !! end
3304
3305 !! test
3306 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3307 !! wikitext
3308 <ul><li>
3309 ; term : description
3310 * unordered
3311 </li></ul>
3312 !! html
3313 <ul><li>
3314 <dl><dt> term&#160;</dt>
3315 <dd> description</dd></dl>
3316 <ul><li> unordered</li></ul>
3317 </li></ul>
3318
3319 !! end
3320
3321 !! test
3322
3323 Definition list with empty definition and following paragraph
3324 !! wikitext
3325 ; term:
3326 Paragraph text
3327 !! html
3328 <dl><dt> term</dt>
3329 <dd></dd></dl>
3330 <p>Paragraph text
3331 </p>
3332 !! end
3333
3334 !! test
3335 Nested definition lists using html syntax
3336 !! wikitext
3337 <dl><dt>x</dt>
3338 <dd>a</dd>
3339 <dd>b</dd></dl>
3340
3341 !! end
3342
3343 !! test
3344 Definition Lists: No nesting: Multiple dd's
3345 !! wikitext
3346 ;x
3347 :a
3348 :b
3349 !! html
3350 <dl><dt>x</dt>
3351 <dd>a</dd>
3352 <dd>b</dd></dl>
3353
3354 !! end
3355
3356 !! test
3357 Definition Lists: Indentation: Regular
3358 !! wikitext
3359 :i1
3360 ::i2
3361 :::i3
3362 !! html
3363 <dl><dd>i1
3364 <dl><dd>i2
3365 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3366
3367 !! end
3368
3369 !! test
3370 Definition Lists: Indentation: Missing 1st level
3371 !! wikitext
3372 ::i2
3373 :::i3
3374 !! html
3375 <dl><dd><dl><dd>i2
3376 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3377
3378 !! end
3379
3380 !! test
3381 Definition Lists: Indentation: Multi-level indent
3382 !! wikitext
3383 :::i3
3384 !! html
3385 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3386
3387 !! end
3388
3389 !! test
3390 Definition Lists: Hacky use to indent tables
3391 !! wikitext
3392 ::{|
3393 |foo
3394 |bar
3395 |}
3396 this text
3397 should be left alone
3398 !! html
3399 <dl><dd><dl><dd><table>
3400 <tr>
3401 <td>foo
3402 </td>
3403 <td>bar
3404 </td></tr></table></dd></dl></dd></dl>
3405 <p>this text
3406 should be left alone
3407 </p>
3408 !! end
3409
3410 !! test
3411 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3412 !! wikitext
3413 <!-- foo -->
3414 ::{|
3415 |foo
3416 |bar
3417 |}<!-- bar -->
3418 this text
3419 should be left alone
3420 !! html/parsoid
3421 <!-- foo -->
3422 <dl><dd><dl><dd><table><tr>
3423 <td>foo</td>
3424 <td>bar</td>
3425 </tr></table><!-- bar --></dd></dl></dd></dl>
3426 <p>this text
3427 should be left alone</p>
3428 !! end
3429
3430 !! test
3431 Definition Lists: Hacky use to indent tables, with comment before table
3432 !! wikitext
3433 ::<!-- foo -->{|
3434 |foo
3435 |}
3436 !! html/parsoid
3437 <dl><dd><dl><dd><!-- foo --><table><tr>
3438 <td>foo</td>
3439 </tr></table></dd></dl></dd></dl>
3440 !! end
3441
3442 # Bug 52473
3443 !! test
3444 Definition Lists: Hacky use to indent tables (WS-insensitive)
3445 !! options
3446 parsoid
3447 !! wikitext
3448 : {|
3449 |a
3450 |}
3451 !! html
3452 <dl>
3453 <dd> <table><tr><td>a</td></tr></table> </dd>
3454 </dl>
3455 !! end
3456 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3457 ## as an empty dt item. It also ignores all but the last ";" when followed
3458 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3459 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3460 ## ";"s.
3461 ##
3462 ## Ex: ";;t2 ::d2" is transformed into:
3463 ##
3464 ## <dl>
3465 ## <dt>t2 </dt>
3466 ## <dd>
3467 ## <dl>
3468 ## <dt></dt>
3469 ## <dd>d2</dd>
3470 ## </dl>
3471 ## </dd>
3472 ## </dl>
3473 ##
3474 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3475 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3476 ##
3477 ## <dl>
3478 ## <dt>
3479 ## <dl>
3480 ## <dt>t2 </dt>
3481 ## <dd>:d2</dd>
3482 ## </dl>
3483 ## </dt>
3484 ## </dl>
3485 ##
3486 ## All Parsoid only definition list tests have this difference.
3487 ##
3488 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3489 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3490
3491 !! test
3492 Table / list interaction: indented table with lists in table contents
3493 !! wikitext
3494 :{|
3495 |-
3496 | a
3497 * b
3498 |-
3499 | c
3500 * d
3501 |}
3502 !! html
3503 <dl><dd><table>
3504
3505 <tr>
3506 <td> a
3507 <ul><li> b</li></ul>
3508 </td></tr>
3509 <tr>
3510 <td> c
3511 <ul><li> d</li></ul>
3512 </td></tr></table></dd></dl>
3513
3514 !! end
3515
3516 !!test
3517 Table / list interaction: lists nested in tables nested in indented lists
3518 !! wikitext
3519 :{|
3520 |
3521 :a
3522 :b
3523 |
3524 *c
3525 *d
3526 |}
3527
3528 *e
3529 *f
3530 !! html
3531 <dl><dd><table>
3532 <tr>
3533 <td>
3534 <dl><dd>a</dd>
3535 <dd>b</dd></dl>
3536 </td>
3537 <td>
3538 <ul><li>c</li>
3539 <li>d</li></ul>
3540 </td></tr></table></dd></dl>
3541 <ul><li>e</li>
3542 <li>f</li></ul>
3543
3544 !!end
3545
3546 !! test
3547 Definition Lists: Nesting: Multi-level (Parsoid only)
3548 !! options
3549 parsoid
3550 !! wikitext
3551 ;t1 :d1
3552 ;;t2 ::d2
3553 ;;;t3 :::d3
3554 !! html
3555 <dl>
3556 <dt>t1 </dt>
3557 <dd>d1</dd>
3558 <dt>
3559 <dl>
3560 <dt>t2 </dt>
3561 <dd>:d2</dd>
3562 <dt>
3563 <dl>
3564 <dt>t3 </dt>
3565 <dd>::d3</dd>
3566 </dl>
3567 </dt>
3568 </dl>
3569 </dt>
3570 </dl>
3571
3572
3573 !! end
3574
3575
3576 !! test
3577 Definition Lists: Nesting: Test 2 (Parsoid only)
3578 !! options
3579 parsoid
3580 !! wikitext
3581 ;t1
3582 ::d2
3583 !! html
3584 <dl>
3585 <dt>t1</dt>
3586 <dd>
3587 <dl>
3588 <dd>d2</dd>
3589 </dl>
3590 </dd>
3591 </dl>
3592
3593 !! end
3594
3595
3596 !! test
3597 Definition Lists: Nesting: Test 3 (Parsoid only)
3598 !! options
3599 parsoid
3600 !! wikitext
3601 :;t1
3602 ::::d2
3603 !! html
3604 <dl>
3605 <dd>
3606 <dl>
3607 <dt>t1</dt>
3608 <dd>
3609 <dl>
3610 <dd>
3611 <dl>
3612 <dd>d2</dd>
3613 </dl>
3614 </dd>
3615 </dl>
3616 </dd>
3617 </dl>
3618 </dd>
3619 </dl>
3620
3621 !! end
3622
3623
3624 !! test
3625 Definition Lists: Nesting: Test 4
3626 !! wikitext
3627 ::;t3
3628 :::d3
3629 !! html
3630 <dl><dd><dl><dd><dl><dt>t3</dt>
3631 <dd>d3</dd></dl></dd></dl></dd></dl>
3632
3633 !! end
3634
3635
3636 ## The Parsoid team believes the following three test exposes a
3637 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3638 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3639 ## It also exposes a "misfeature" in tidy, which doesn't like
3640 ## <dl> tags with a single <dt> child; it converts the <dt> into
3641 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3642 !! test
3643 Definition Lists: Mixed Lists: Test 1
3644 !! wikitext
3645 :;* foo
3646 ::* bar
3647 :; baz
3648 !! html/php
3649 <dl><dd><dl><dt><ul><li> foo</li>
3650 <li> bar</li></ul></dt></dl>
3651 <dl><dt> baz</dt></dl></dd></dl>
3652
3653 !! html/php+tidy
3654 <dl>
3655 <dd>
3656 <dl>
3657 <dd>
3658 <ul>
3659 <li>foo</li>
3660 <li>bar</li>
3661 </ul>
3662 </dd>
3663 </dl>
3664 <dl>
3665 <dt>baz</dt>
3666 </dl>
3667 </dd>
3668 </dl>
3669 !! html/parsoid
3670 <dl>
3671 <dd><dl>
3672 <dt><ul>
3673 <li> foo
3674 </li>
3675 </ul></dt>
3676 <dd><ul>
3677 <li> bar
3678 </li>
3679 </ul></dd>
3680 <dt> baz</dt>
3681 </dl></dd>
3682 </dl>
3683 !! end
3684
3685 !! test
3686 Definition Lists: Mixed Lists: Test 2
3687 !! wikitext
3688 *: d1
3689 *: d2
3690 !! html
3691 <ul><li><dl><dd> d1</dd>
3692 <dd> d2</dd></dl></li></ul>
3693
3694 !! end
3695
3696
3697 !! test
3698 Definition Lists: Mixed Lists: Test 3
3699 !! wikitext
3700 *::: d1
3701 *::: d2
3702 !! html
3703 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3704 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3705
3706 !! end
3707
3708
3709 !! test
3710 Definition Lists: Mixed Lists: Test 4
3711 !! wikitext
3712 *;d1 :d2
3713 *;d3 :d4
3714 !! html
3715 <ul><li><dl><dt>d1&#160;</dt>
3716 <dd>d2</dd>
3717 <dt>d3&#160;</dt>
3718 <dd>d4</dd></dl></li></ul>
3719
3720 !! end
3721
3722
3723 !! test
3724 Definition Lists: Mixed Lists: Test 5
3725 !! wikitext
3726 *:d1
3727 *:: d2
3728 !! html
3729 <ul><li><dl><dd>d1
3730 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3731
3732 !! end
3733
3734
3735 !! test
3736 Definition Lists: Mixed Lists: Test 6
3737 !! wikitext
3738 #*:d1
3739 #*::: d3
3740 !! html
3741 <ol><li><ul><li><dl><dd>d1
3742 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3743
3744 !! end
3745
3746
3747 !! test
3748 Definition Lists: Mixed Lists: Test 7
3749 !! wikitext
3750 :* d1
3751 :* d2
3752 !! html
3753 <dl><dd><ul><li> d1</li>
3754 <li> d2</li></ul></dd></dl>
3755
3756 !! end
3757
3758
3759 !! test
3760 Definition Lists: Mixed Lists: Test 8
3761 !! wikitext
3762 :* d1
3763 ::* d2
3764 !! html
3765 <dl><dd><ul><li> d1</li></ul>
3766 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3767
3768 !! end
3769
3770
3771 !! test
3772 Definition Lists: Mixed Lists: Test 9
3773 !! wikitext
3774 *;foo :bar
3775 !! html
3776 <ul><li><dl><dt>foo&#160;</dt>
3777 <dd>bar</dd></dl></li></ul>
3778
3779 !! end
3780
3781
3782 !! test
3783 Definition Lists: Mixed Lists: Test 10
3784 !! wikitext
3785 *#;foo :bar
3786 !! html
3787 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3788 <dd>bar</dd></dl></li></ol></li></ul>
3789
3790 !! end
3791
3792 # The Parsoid team disagrees with the PHP parser's seemingly-random
3793 # rules regarding dd/dt on the next two tests. Parsoid is more
3794 # consistent, and recognizes the shared nesting and keeps the
3795 # still-open tags around until the nesting is complete.
3796 # (And tidy again converts <dt> to <dd> before 'bar'.)
3797
3798 !! test
3799 Definition Lists: Mixed Lists: Test 11
3800 !! wikitext
3801 *#*#;*;;foo :bar
3802 *#*#;boo :baz
3803 !! html/php
3804 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3805 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3806 <dl><dt>boo&#160;</dt>
3807 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3808
3809 !! html/php+tidy
3810 <ul>
3811 <li>
3812 <ol>
3813 <li>
3814 <ul>
3815 <li>
3816 <ol>
3817 <li>
3818 <dl>
3819 <dt>foo&#160;</dt>
3820 <dd>
3821 <ul>
3822 <li>
3823 <dl>
3824 <dd>
3825 <dl>
3826 <dt>bar</dt>
3827 </dl>
3828 </dd>
3829 </dl>
3830 </li>
3831 </ul>
3832 </dd>
3833 </dl>
3834 <dl>
3835 <dt>boo&#160;</dt>
3836 <dd>baz</dd>
3837 </dl>
3838 </li>
3839 </ol>
3840 </li>
3841 </ul>
3842 </li>
3843 </ol>
3844 </li>
3845 </ul>
3846 !! html/parsoid
3847 <ul>
3848 <li>
3849 <ol>
3850 <li>
3851 <ul>
3852 <li>
3853 <ol>
3854 <li>
3855 <dl>
3856 <dt>
3857 <ul>
3858 <li>
3859 <dl>
3860 <dt>
3861 <dl>
3862 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3863 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3864 </dl></dt>
3865 </dl></li>
3866 </ul></dt>
3867 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3868 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3869 </dl></li>
3870 </ol></li>
3871 </ul></li>
3872 </ol></li>
3873 </ul>
3874 !! end
3875
3876
3877 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
3878 !! test
3879 Definition Lists: Weird Ones: Test 1
3880 !! wikitext
3881 *#;*::;; foo : bar (who uses this?)
3882 !! html/php
3883 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3884 <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>
3885
3886 !! html/php+tidy
3887 <ul>
3888 <li>
3889 <ol>
3890 <li>
3891 <dl>
3892 <dt>foo&#160;</dt>
3893 <dd>
3894 <ul>
3895 <li>
3896 <dl>
3897 <dd>
3898 <dl>
3899 <dd>
3900 <dl>
3901 <dd>
3902 <dl>
3903 <dt>bar (who uses this?)</dt>
3904 </dl>
3905 </dd>
3906 </dl>
3907 </dd>
3908 </dl>
3909 </dd>
3910 </dl>
3911 </li>
3912 </ul>
3913 </dd>
3914 </dl>
3915 </li>
3916 </ol>
3917 </li>
3918 </ul>
3919 !! html/parsoid
3920 <ul>
3921 <li>
3922 <ol>
3923 <li>
3924 <dl>
3925 <dt>
3926 <ul>
3927 <li>
3928 <dl>
3929 <dd>
3930 <dl>
3931 <dd>
3932 <dl>
3933 <dt>
3934 <dl>
3935 <dt> foo<span typeof="mw:Placeholder">&nbsp;</span></dt>
3936 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3937 </dl></dt>
3938 </dl></dd>
3939 </dl></dd>
3940 </dl></li>
3941 </ul></dt>
3942 </dl></li>
3943 </ol></li>
3944 </ul>
3945 !! end
3946
3947 !! test
3948 Definition Lists: colons occurring in tags
3949 !! wikitext
3950 ;a:b
3951 ;'''a:b'''
3952 ;<i>a:b</i>
3953 ;<span>a:b</span>
3954 ;<div>a:b</div>
3955 ;{{echo|a:b}}
3956 ;{{echo|''a:b''}}
3957 !! html
3958 <dl><dt>a</dt>
3959 <dd>b</dd>
3960 <dt><b>a:b</b></dt>
3961 <dt><i>a:b</i></dt>
3962 <dt><span>a:b</span></dt>
3963 <dt><div>a:b</div></dt>
3964 <dt>a</dt>
3965 <dd>b</dd>
3966 <dt><i>a:b</i></dt></dl>
3967
3968 !! end
3969
3970 !! test
3971 Definition Lists: colons and tables 1
3972 !! wikitext
3973 :{|
3974 | x
3975 |}
3976 :{|
3977 | y
3978 |}
3979 !! html
3980 <dl><dd><table>
3981 <tr>
3982 <td> x
3983 </td></tr></table></dd></dl>
3984 <dl><dd><table>
3985 <tr>
3986 <td> y
3987 </td></tr></table></dd></dl>
3988
3989 !! end
3990
3991 # Parsoid's output (as documented below) differs from php's in this case.
3992 # This is probably a bug. If we fixup parsoid to match php's output, the
3993 # above test should pass and the below test case can be removed. It is
3994 # unclear which output is more desirable.
3995
3996 !! test
3997 Definition Lists: colons and tables 2
3998 !! wikitext
3999 :{|
4000 | x
4001 |}
4002 :{|
4003 | y
4004 |}
4005 !! html/parsoid
4006 <dl><dd><table>
4007 <tr>
4008 <td> x
4009 </td></tr></table></dd>
4010 <dd><table>
4011 <tr>
4012 <td> y
4013 </td></tr></table></dd></dl>
4014 !! end
4015
4016
4017 ###
4018 ### External links
4019 ###
4020 !! test
4021 External links: non-bracketed
4022 !! wikitext
4023 Non-bracketed: http://example.com
4024 !! html
4025 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4026 </p>
4027 !! end
4028
4029 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4030 !! test
4031 External links: numbered
4032 !! wikitext
4033 Numbered: [http://example.com]
4034 Numbered: [http://example.net]
4035 Numbered: [http://example.com]
4036 !! html/php
4037 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4038 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4039 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4040 </p>
4041 !! html/parsoid
4042 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4043 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4044 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4045 !!end
4046
4047 !! test
4048 External links: specified text
4049 !! wikitext
4050 Specified text: [http://example.com link]
4051 !! html
4052 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4053 </p>
4054 !!end
4055
4056 !! test
4057 External links: trail
4058 !! wikitext
4059 Linktrails should not work for external links: [http://example.com link]s
4060 !! html
4061 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4062 </p>
4063 !! end
4064
4065 !! test
4066 External links: dollar sign in URL
4067 !! wikitext
4068 http://example.com/1$2345
4069 !! html
4070 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4071 </p>
4072 !! end
4073
4074 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4075 !! test
4076 External links: dollar sign in URL (autonumber)
4077 !! wikitext
4078 [http://example.com/1$2345]
4079 !! html/php
4080 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4081 </p>
4082 !! html/parsoid
4083 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4084 !!end
4085
4086 !! test
4087 External links: open square bracket forbidden in URL (bug 4377)
4088 !! options
4089 parsoid=wt2html,wt2wt,html2html
4090 !! wikitext
4091 http://example.com/1[2345
4092 !! html/php
4093 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4094 </p>
4095 !! html/parsoid
4096 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4097 !! end
4098
4099 !! test
4100 External links: open square bracket forbidden in URL (named) (bug 4377)
4101 !! options
4102 parsoid=wt2html,html2html
4103 !! wikitext
4104 [http://example.com/1[2345]
4105 !! html/php
4106 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4107 </p>
4108 !! html/parsoid
4109 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4110 !!end
4111
4112 # parsoid adds a space before the link name
4113 !! test
4114 External links: open square bracket forbidden in URL (named) (bug 4377)
4115 Parsoid variant.
4116 !! wikitext
4117 [http://example.com/1 [2345]
4118 !! html
4119 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4120 </p>
4121 !!end
4122
4123 !! test
4124 External links: nowiki in URL link text (bug 6230)
4125 !! wikitext
4126 [http://example.com/ <nowiki>''example site''</nowiki>]
4127 !! html
4128 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4129 </p>
4130 !! end
4131
4132 !! test
4133 External links: newline forbidden in text (bug 6230 regression check)
4134 !! wikitext
4135 [http://example.com/ first
4136 second]
4137 !! html
4138 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4139 second]
4140 </p>
4141 !!end
4142
4143 !! test
4144 External links: Pipe char between url and text
4145 !! wikitext
4146 [http://example.com | link]
4147 !! html
4148 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4149 </p>
4150 !!end
4151
4152 !! test
4153 External links: protocol-relative URL in brackets
4154 !! wikitext
4155 [//example.com/ Test]
4156 !! html
4157 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4158 </p>
4159 !! end
4160
4161 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4162 !! test
4163 External links: protocol-relative URL in brackets without text
4164 !! wikitext
4165 [//example.com]
4166 !! html/php
4167 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4168 </p>
4169 !! html/parsoid
4170 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4171 !! end
4172
4173 !! test
4174 External links: protocol-relative URL in free text is left alone
4175 !! wikitext
4176 //example.com/Foo
4177 !! html
4178 <p>//example.com/Foo
4179 </p>
4180 !!end
4181
4182 !! test
4183 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4184 !! wikitext
4185 foo//example.com/Foo
4186 !! html
4187 <p>foo//example.com/Foo
4188 </p>
4189 !! end
4190
4191 !! test
4192 External links: with no contents
4193 !! wikitext
4194 [http://en.wikipedia.org/wiki/Foo]
4195
4196 [[wikipedia:Foo|Bar]]
4197
4198 [[wikipedia:Foo|<span>Bar</span>]]
4199 !! html/php
4200 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4201 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4202 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4203 </p>
4204 !! html/parsoid
4205 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4206 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4207 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4208 !! end
4209
4210 !! test
4211 External links: Free with trailing punctuation
4212 !! wikitext
4213 http://example.com,
4214 http://example.com;
4215 http://example.com\
4216 http://example.com.
4217 http://example.com:
4218 http://example.com!
4219 http://example.com?
4220 http://example.com)
4221 http://example.com/url_with_(brackets)
4222 (http://example.com/url_without_brackets)
4223 http://example.com/url_with_entity&nbsp;
4224 http://example.com/url_with_entity&#xA0;
4225 http://example.com/url_with_entity&#160;
4226 http://example.com/url_with_entity&lt;
4227 http://example.com/url_with_entity&#x3C;
4228 http://example.com/url_with_entity&#60;
4229 !! html/php
4230 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4231 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4232 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4233 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4234 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4235 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4236 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4237 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4238 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4239 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4240 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4241 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4242 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4243 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4244 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4245 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4246 </p>
4247 !! html/parsoid
4248 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4249 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4250 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4251 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4252 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4253 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4254 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4255 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4256 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4257 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4258 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4259 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4260 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4261 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4262 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4263 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4264 !! end
4265
4266 !! test
4267 External links: No preceding word characters allowed (bug 65278)
4268 !! wikitext
4269 NOPEhttp://example.com
4270 N0http://example.com
4271 ok:http://example.com
4272 ok-http://example.com
4273 !! html
4274 <p>NOPEhttp://example.com
4275 N0http://example.com
4276 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4277 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4278 </p>
4279 !! end
4280
4281 !! test
4282 External image
4283 !! wikitext
4284 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4285 !! html
4286 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4287 </p>
4288 !! end
4289
4290 !! test
4291 External image from https
4292 !! wikitext
4293 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4294 !! html
4295 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4296 </p>
4297 !! end
4298
4299 !! test
4300 External image (when not allowed)
4301 !! options
4302 wgAllowExternalImages=0
4303 !! wikitext
4304 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4305 !! html
4306 <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>
4307 </p>
4308 !! end
4309
4310 !! test
4311 Link to non-http image, no img tag
4312 !! wikitext
4313 Link to non-http image, no img tag: ftp://example.com/test.jpg
4314 !! html
4315 <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>
4316 </p>
4317 !! end
4318
4319 !! test
4320 External links: terminating separator
4321 !! wikitext
4322 Terminating separator: http://example.com/thing,
4323 !! html
4324 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4325 </p>
4326 !! end
4327
4328 !! test
4329 External links: intervening separator
4330 !! wikitext
4331 Intervening separator: http://example.com/1,2,3
4332 !! html
4333 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4334 </p>
4335 !! end
4336
4337 !! test
4338 External links: old bug with URL in query
4339 !! wikitext
4340 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4341 !! html
4342 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4343 </p>
4344 !! end
4345
4346 !! test
4347 External links: old URL-in-URL bug, mixed protocols
4348 !! wikitext
4349 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4350 !! html
4351 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4352 </p>
4353 !!end
4354
4355 !! test
4356 External links: URL in text
4357 !! wikitext
4358 URL in text: [http://example.com http://example.com]
4359 !! html
4360 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4361 </p>
4362 !! end
4363
4364 !! test
4365 External links: Clickable images
4366 !! wikitext
4367 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4368 !! html/php
4369 <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>
4370 </p>
4371 !! html/parsoid
4372 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4373 !! end
4374
4375 !! test
4376 External links: raw ampersand
4377 !! wikitext
4378 Old &amp; use: http://x&y
4379 !! html
4380 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4381 </p>
4382 !! end
4383
4384 !! test
4385 External links: encoded ampersand
4386 !! wikitext
4387 Old &amp; use: http://x&amp;y
4388 !! html/php
4389 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4390 </p>
4391 !! html/parsoid
4392 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4393 !! end
4394
4395 !! test
4396 External links: encoded equals (bug 6102)
4397 !! wikitext
4398 http://example.com/?foo&#61;bar
4399 !! html/php
4400 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4401 </p>
4402 !! html/parsoid
4403 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4404 !! end
4405
4406 ##
4407 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4408 ## does it number them. As discussed in bug 53505, we can identify
4409 ## autonumbered links via CSS.
4410 ##
4411
4412 !! test
4413 External links: [raw ampersand]
4414 !! wikitext
4415 Old &amp; use: [http://x&y]
4416 !! html/php
4417 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4418 </p>
4419 !! html/parsoid
4420 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4421 !! end
4422
4423 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4424 # mode will return the [raw ampersand] wikitext
4425 !! test
4426 External links: [encoded ampersand]
4427 !! options
4428 parsoid=wt2html,wt2wt,html2html
4429 !! wikitext
4430 Old &amp; use: [http://x&amp;y]
4431 !! html/php
4432 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4433 </p>
4434 !! html/parsoid
4435 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4436 !! end
4437
4438 !! test
4439 External links: [raw equals]
4440 !! wikitext
4441 [http://example.com/?foo=bar]
4442 !! html/php
4443 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4444 </p>
4445 !! html/parsoid
4446 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4447 !! end
4448
4449 # note that parsoid html is identical to [raw equals] case; so html2wt
4450 # mode will return the [raw equals] wikitext
4451 !! test
4452 External links: [encoded equals] (bug 6102)
4453 !! options
4454 parsoid=wt2html,wt2wt,html2html
4455 !! wikitext
4456 [http://example.com/?foo&#61;bar]
4457 !! html/php
4458 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4459 </p>
4460 !! html/parsoid
4461 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4462 !! end
4463
4464 # xxx parsoid strips the IDN character, so the round-trip tests will
4465 # obviously fail and are disabled. --cscott
4466 !! test
4467 External links: [IDN ignored character reference in hostname; strip it right off]
4468 !! options
4469 parsoid=wt2html,wt2wt,html2html
4470 !! wikitext
4471 [http://e&zwnj;xample.com/]
4472 !! html/php
4473 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4474 </p>
4475 !! html/parsoid
4476 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4477 !! end
4478
4479 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4480 # Where an external link could easily circumvent the sanitization of the text of
4481 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4482 # test demands a higher standard. That's a bit strange.
4483 #
4484 # Example:
4485 #
4486 # http://e‌xample.com -> [http://example.com|http://example.com]
4487 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4488 #
4489 # The first example is sanitized, but the second is not. Any security benefits
4490 # from this production are trivial to circumvent. Either remove this test and
4491 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4492 # the test accordingly.
4493 #
4494 # All our love,
4495 # The Parsoid team.
4496 # xxx parsoid strips the IDN character, so the round-trip tests will
4497 # obviously fail and are disabled. --cscott
4498 !! test
4499 External links: IDN ignored character reference in hostname; strip it right off
4500 !! options
4501 parsoid=wt2html,html2html
4502 !! wikitext
4503 http://e&zwnj;xample.com/
4504 !! html/php
4505 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4506 </p>
4507 !! html/parsoid
4508 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4509 !! end
4510
4511 !! test
4512 External links: www.jpeg.org (bug 554)
4513 !! wikitext
4514 http://www.jpeg.org
4515 !! html
4516 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4517 </p>
4518 !! end
4519
4520 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4521 !! test
4522 External links: URL within URL (original bug 2)
4523 !! wikitext
4524 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4525 !! html/php
4526 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4527 </p>
4528 !! html/parsoid
4529 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4530 !! end
4531
4532 !! test
4533 BUG 361: URL inside bracketed URL
4534 !! wikitext
4535 [http://www.example.com/foo http://www.example.com/bar]
4536 !! html
4537 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4538 </p>
4539 !! end
4540
4541 !! test
4542 BUG 361: URL within URL, not bracketed
4543 !! wikitext
4544 http://www.example.com/foo?=http://www.example.com/bar
4545 !! html
4546 <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>
4547 </p>
4548 !! end
4549
4550 !! test
4551 BUG 289: ">"-token in URL-tail
4552 !! wikitext
4553 http://www.example.com/<hello>
4554 !! html
4555 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4556 </p>
4557 !!end
4558
4559 !! test
4560 BUG 289: literal ">"-token in URL-tail
4561 !! wikitext
4562 http://www.example.com/<b>html</b>
4563 !! html/php
4564 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4565 </p>
4566 !! html/parsoid
4567 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
4568 !! end
4569
4570 !! test
4571 BUG 289: ">"-token in bracketed URL
4572 !! wikitext
4573 [http://www.example.com/<hello> stuff]
4574 !! html
4575 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4576 </p>
4577 !!end
4578
4579 !! test
4580 BUG 289: literal ">"-token in bracketed URL
4581 !! wikitext
4582 [http://www.example.com/<b>html</b> stuff]
4583 !! html
4584 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4585 </p>
4586 !!end
4587
4588 !! test
4589 BUG 289: literal double quote at end of URL
4590 !! wikitext
4591 http://www.example.com/"hello"
4592 !! html
4593 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4594 </p>
4595 !!end
4596
4597 !! test
4598 BUG 289: literal double quote in bracketed URL
4599 !! wikitext
4600 [http://www.example.com/"hello" stuff]
4601 !! html
4602 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4603 </p>
4604 !!end
4605
4606 !! test
4607 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4608 !! wikitext
4609 [http://www.example.com test]
4610 !! html
4611 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4612 </p>
4613 !! end
4614
4615 !! test
4616 External links: link text with spaces
4617 !! wikitext
4618 [http://www.example.com a b c]
4619 [http://www.example.com ''a'' ''b'']
4620 !! html
4621 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4622 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4623 </p>
4624 !! end
4625
4626 !! test
4627 External links: wiki links within external link (Bug 3695)
4628 !! wikitext
4629 [http://example.com [[wikilink]] embedded in ext link]
4630 !! html/php
4631 <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>
4632 </p>
4633 !! html/parsoid
4634 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
4635 !! end
4636
4637 !! test
4638 BUG 787: Links with one slash after the url protocol are invalid
4639 !! wikitext
4640 http:/example.com
4641
4642 [http:/example.com title]
4643 !! html
4644 <p>http:/example.com
4645 </p><p>[http:/example.com title]
4646 </p>
4647 !! end
4648
4649 !! test
4650 Bracketed external links with template-generated invalid target
4651 !! wikitext
4652 [{{echo|http:/example.com}} title]
4653 !! html
4654 <p>[http:/example.com title]
4655 </p>
4656 !! end
4657
4658 !! test
4659 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4660 !! wikitext
4661 ''[http://example.com text'']
4662 [http://example.com '''text]'''
4663 ''Something [http://example.com in italic'']
4664 ''Something [http://example.com mixed''''', even bold]'''
4665 '''''Now [http://example.com both''''']
4666 !! html
4667 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4668 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4669 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4670 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4671 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4672 </p>
4673 !! end
4674
4675
4676 !! test
4677 Bug 4781: %26 in URL
4678 !! wikitext
4679 http://www.example.com/?title=AT%26T
4680 !! html/php
4681 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4682 </p>
4683 !! html/parsoid
4684 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4685 !! end
4686
4687 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4688 # % is actually legal in HTML5. Any change in output would need testing though.
4689 !! test
4690 Bug 4781, 5267: %25 in URL
4691 !! wikitext
4692 http://www.example.com/?title=100%25_Bran
4693 !! html/php
4694 <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>
4695 </p>
4696 !! html/parsoid
4697 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4698 !! end
4699
4700 !! test
4701 Bug 4781, 5267: %28, %29 in URL
4702 !! wikitext
4703 http://www.example.com/?title=Ben-Hur_%281959_film%29
4704 !! html/php
4705 <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>
4706 </p>
4707 !! html/parsoid
4708 <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>
4709 !! end
4710
4711
4712 !! test
4713 Bug 4781: %26 in autonumber URL
4714 !! wikitext
4715 [http://www.example.com/?title=AT%26T]
4716 !! html/php
4717 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4718 </p>
4719 !! html/parsoid
4720 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4721 !! end
4722
4723 !! test
4724 Bug 4781, 5267: %26 in autonumber URL
4725 !! wikitext
4726 [http://www.example.com/?title=100%25_Bran]
4727 !! html/php
4728 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4729 </p>
4730 !! html/parsoid
4731 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4732 !! end
4733
4734 !! test
4735 Bug 4781, 5267: %28, %29 in autonumber URL
4736 !! wikitext
4737 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4738 !! html/php
4739 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4740 </p>
4741 !! html/parsoid
4742 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4743 !! end
4744
4745
4746 !! test
4747 Bug 4781: %26 in bracketed URL
4748 !! wikitext
4749 [http://www.example.com/?title=AT%26T link]
4750 !! html/php
4751 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4752 </p>
4753 !! html/parsoid
4754 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4755 !! end
4756
4757 !! test
4758 Bug 4781, 5267: %25 in bracketed URL
4759 !! wikitext
4760 [http://www.example.com/?title=100%25_Bran link]
4761 !! html
4762 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4763 </p>
4764 !! end
4765
4766 !! test
4767 Bug 4781, 5267: %28, %29 in bracketed URL
4768 !! wikitext
4769 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4770 !! html/php
4771 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4772 </p>
4773 !! html/parsoid
4774 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4775 !! end
4776
4777 !! test
4778 External link containing a period in the anchor. (bug 63947)
4779 !! wikitext
4780 [//foo.org/bar#baz. bang]
4781
4782 [//foo.org/bar. bang]
4783 !! html/php
4784 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4785 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4786 </p>
4787 !! html/parsoid
4788 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4789 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4790 !! end
4791
4792 !! test
4793 External link containing a single quote. (bug 63947)
4794 !! wikitext
4795 [//foo.org/bar'baz]
4796
4797 [//foo.org/bar'baz bang]
4798 !! html/php
4799 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4800 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4801 </p>
4802 !! html/parsoid
4803 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4804 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4805 !! end
4806
4807
4808 !! test
4809 External link containing a period in the anchor. (bug 63947)
4810 !! wikitext
4811 [//foo.org/bar#baz. bang]
4812
4813 [//foo.org/bar. bang]
4814 !! html/php
4815 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4816 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4817 </p>
4818 !! html/parsoid
4819 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4820 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4821 !! end
4822
4823 !! test
4824 External link containing a single quote. (bug 63947)
4825 !! wikitext
4826 [//foo.org/bar'baz]
4827
4828 [//foo.org/bar'baz bang]
4829 !! html/php
4830 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4831 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4832 </p>
4833 !! html/parsoid
4834 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4835 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4836 !! end
4837
4838
4839 !! test
4840 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4841 !! wikitext
4842 Some [http://example.com/ pretty ''italics'' and stuff]!
4843 !! html
4844 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4845 </p>
4846 !! end
4847
4848 !! test
4849 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4850 !! wikitext
4851 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4852 !! html
4853 <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>
4854 </p>
4855 !! end
4856
4857 !! test
4858 External link containing double-single-quotes with no space separating the url from text in italics
4859 !! wikitext
4860 [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]].]
4861 !! html/php
4862 <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>
4863 </p>
4864 !! html/php+tidy
4865 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
4866 !! html/parsoid
4867 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
4868 !! end
4869
4870 !! test
4871 External link with comments in link text
4872 !! wikitext
4873 [http://www.google.com Google <!-- comment -->]
4874 !! html
4875 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4876 </p>
4877 !! end
4878
4879 !! test
4880 URL-encoding in URL functions (single parameter)
4881 !! wikitext
4882 {{localurl:Some page|amp=&}}
4883 !! html
4884 <p>/index.php?title=Some_page&amp;amp=&amp;
4885 </p>
4886 !! end
4887
4888 !! test
4889 URL-encoding in URL functions (multiple parameters)
4890 !! wikitext
4891 {{localurl:Some page|q=?&amp=&}}
4892 !! html
4893 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4894 </p>
4895 !! end
4896
4897 !! test
4898 Brackets in urls
4899 !! wikitext
4900 http://example.com/index.php?foozoid%5B%5D=bar
4901
4902 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4903 !! html/php
4904 <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>
4905 </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>
4906 </p>
4907 !! html/parsoid
4908 <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>
4909
4910 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4911 !! end
4912
4913 !! test
4914 IPv6 urls (bug 21261)
4915 !! options
4916 disabled
4917 !! wikitext
4918 http://[2404:130:0:1000::187:2]/index.php
4919 !! html
4920 <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>
4921 </p>
4922 !! end
4923
4924 !! test
4925 Non-extlinks in brackets
4926 !! wikitext
4927 [foo]
4928 [foo bar]
4929 [foo ''bar'']
4930 [fool's] errand
4931 [fool's errand]
4932 [{{echo|foo}}]
4933 [{{echo|foo}} bar]
4934 [{{echo|foo}} ''bar'']
4935 [{{echo|foo}}l's] errand
4936 [{{echo|foo}}l's errand]
4937 [url={{echo|foo}}]
4938 [url=http://example.com]
4939 !! html
4940 <p>[foo]
4941 [foo bar]
4942 [foo <i>bar</i>]
4943 [fool's] errand
4944 [fool's errand]
4945 [foo]
4946 [foo bar]
4947 [foo <i>bar</i>]
4948 [fool's] errand
4949 [fool's errand]
4950 [url=foo]
4951 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4952 </p>
4953 !! end
4954
4955 !! test
4956 Percent encoding in external links
4957 !! wikitext
4958 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4959 !! html/php
4960 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4961 </p>
4962 !! html/parsoid
4963 <p><a rel="mw:ExtLink"
4964 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4965 !! end
4966
4967 !! test
4968 Use url link syntax for links where the content is equal the link target
4969 !! wikitext
4970 http://example.com
4971 !! html/php
4972 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4973 </p>
4974 !! html/parsoid
4975 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4976 !! end
4977
4978 !! test
4979 Parenthesis in external links, especially URL links
4980 !! wikitext
4981 http://example.com)
4982
4983 http://example.com/test)
4984
4985 http://example.com/(test)
4986
4987 http://example.com/((test)
4988
4989 (http://example.com/(test))
4990
4991 (http://example.com/(test)))))
4992
4993 http://example.com/a)b
4994
4995 [http://example.com) foo]
4996 !! html/php
4997 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4998 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4999 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5000 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5001 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5002 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5003 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5004 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5005 </p>
5006 !! html/parsoid
5007 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5008 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5009 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5010 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5011 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5012 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5013 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5014 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5015 !! end
5016
5017 !! test
5018 Parenthesis in external links, w/ transclusion or comment
5019 !! wikitext
5020 (http://example.com/{{echo|hi}})
5021
5022 (http://example.com<!-- hi -->)
5023 !! html/php
5024 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5025 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5026 </p>
5027 !! html/parsoid
5028 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5029
5030 <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>
5031 !! end
5032
5033 !! test
5034 Replace invalid link targets when serializing
5035 !! options
5036 parsoid=html2wt
5037 !! html
5038 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
5039 !! wikitext
5040 [[MediaWiki:Badtitletext|Manual]]
5041 !! end
5042
5043 ###
5044 ### Quotes
5045 ###
5046
5047 !! test
5048 Quotes
5049 !! wikitext
5050 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5051
5052 Normal text. '''''Bold italic text.''''' Normal text.
5053 !! html
5054 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5055 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5056 </p>
5057 !! end
5058
5059
5060 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5061 # parser strips. The wikitext contains just the first half of the bold
5062 # quote pair.
5063 !! test
5064 Unclosed and unmatched quotes
5065 !! wikitext
5066 '''''Bold italic text '''with bold deactivated''' in between.'''''
5067
5068 '''''Bold italic text ''with italic deactivated'' in between.'''''
5069
5070 '''Bold text..
5071
5072 ..spanning two paragraphs (should not work).'''
5073
5074 '''Bold tag left open
5075
5076 ''Italic tag left open
5077
5078 Normal text.
5079
5080 <!-- Unmatching number of opening, closing tags: -->
5081 '''This year''''s election ''should'' beat '''last year''''s.
5082
5083 ''Tom'''s car is bigger than ''Susan'''s.
5084
5085 Plain ''italic'''s plain
5086 !! html/php
5087 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5088 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5089 </p><p><b>Bold text..</b>
5090 </p><p>..spanning two paragraphs (should not work).
5091 </p><p><b>Bold tag left open</b>
5092 </p><p><i>Italic tag left open</i>
5093 </p><p>Normal text.
5094 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5095 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5096 </p><p>Plain <i>italic'</i>s plain
5097 </p>
5098 !! html/parsoid
5099 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5100 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5101 </p><p><b>Bold text..</b>
5102 </p><p>..spanning two paragraphs (should not work).<b></b>
5103 </p><p><b>Bold tag left open</b>
5104 </p><p><i>Italic tag left open</i>
5105 </p><p>Normal text.
5106 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5107 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5108 </p><p>Plain <i>italic'</i>s plain
5109 </p>
5110 !! end
5111
5112 ###
5113 ### Tables
5114 ###
5115 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5116 ###
5117
5118 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5119 # is the bare minimum required by the spec, see:
5120 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5121 # Parsoid team replies: empty table tags are legal in HTML5
5122 !! test
5123 A table with no data.
5124 !! options
5125 parsoid=wt2html
5126 !! wikitext
5127 {||}
5128 !! html/php
5129
5130 !! html/parsoid
5131 <table></table>
5132
5133 !! end
5134
5135 !! test
5136 A table with stray table end tags on start tag line (wt2html)
5137 !! options
5138 parsoid=wt2html
5139 !! wikitext
5140 {|style="color: red;"|}
5141
5142 {|style="color: red;" |}
5143 |foo
5144 |}
5145
5146 {|style="color: red;"|} id="foo"
5147 |foo
5148 |}
5149
5150 {|style="color: red;" |} id="foo"
5151 |foo
5152 |}
5153 !! html
5154 <table style="color: red;"></table>
5155
5156 <table style="color: red;">
5157 <tbody><tr>
5158 <td>foo</td>
5159 </tr></tbody>
5160 </table>
5161
5162 <table style="color: red;" id="foo">
5163 <tbody><tr>
5164 <td>foo</td>
5165 </tr></tbody>
5166 </table>
5167
5168 <table style="color: red;" id="foo">
5169 <tbody><tr>
5170 <td>foo</td>
5171 </tr></tbody>
5172 </table>
5173
5174 !! end
5175
5176 !! test
5177 A table with no data (take 2)
5178 !! wikitext
5179 {|
5180 |}
5181 !! html/parsoid
5182 <table></table>
5183 !! end
5184
5185 # A table with nothing but a caption is invalid XHTML, we might want to render
5186 # this as <p>caption</p>
5187 # Parsoid team replies: table with only a caption is legal in HTML5
5188 !! test
5189 A table with nothing but a caption
5190 !! wikitext
5191 {|
5192 |+ caption
5193 |}
5194 !! html/php
5195 <table>
5196 <caption> caption
5197 </caption><tr><td></td></tr></table>
5198
5199 !! html/parsoid
5200 <table><caption> caption</caption></table>
5201 !! end
5202
5203 !! test
5204 A table with caption with default-spaced attributes and a table row
5205 !! wikitext
5206 {|
5207 |+ style="color: red;" | caption1
5208 |-
5209 | foo
5210 |}
5211 !! html
5212 <table>
5213 <caption style="color: red;"> caption1
5214 </caption>
5215 <tr>
5216 <td> foo
5217 </td></tr></table>
5218
5219 !! end
5220
5221 !! test
5222 A table with captions with non-default spaced attributes and a table row
5223 !! wikitext
5224 {|
5225 |+style="color: red;"|caption2
5226 |+ style="color: red;"| caption3
5227 |-
5228 | foo
5229 |}
5230 !! html
5231 <table>
5232 <caption style="color: red;">caption2
5233 </caption>
5234 <caption style="color: red;"> caption3
5235 </caption>
5236 <tr>
5237 <td> foo
5238 </td></tr></table>
5239
5240 !! end
5241
5242 !! test
5243 Table td-cell syntax variations
5244 !! wikitext
5245 {|
5246 | foo bar foo | baz
5247 | foo bar foo || baz
5248 | style='color:red;' | baz
5249 | style='color:red;' || baz
5250 |}
5251 !! html
5252 <table>
5253 <tr>
5254 <td> baz
5255 </td>
5256 <td> foo bar foo </td>
5257 <td> baz
5258 </td>
5259 <td style="color:red;"> baz
5260 </td>
5261 <td> style='color:red;' </td>
5262 <td> baz
5263 </td></tr></table>
5264
5265 !! end
5266
5267 !! test
5268 Simple table
5269 !! wikitext
5270 {|
5271 | 1 || 2
5272 |-
5273 | 3 || 4
5274 |}
5275 !! html
5276 <table>
5277 <tr>
5278 <td> 1 </td>
5279 <td> 2
5280 </td></tr>
5281 <tr>
5282 <td> 3 </td>
5283 <td> 4
5284 </td></tr></table>
5285
5286 !! end
5287
5288 !! test
5289 Simple table but with multiple dashes for row wikitext
5290 !! wikitext
5291 {|
5292 | foo
5293 |-----
5294 | bar
5295 |}
5296 !! html
5297 <table>
5298 <tr>
5299 <td> foo
5300 </td></tr>
5301 <tr>
5302 <td> bar
5303 </td></tr></table>
5304
5305 !! end
5306 !! test
5307 Multiplication table
5308 !! wikitext
5309 {| border="1" cellpadding="2"
5310 |+Multiplication table
5311 |-
5312 ! &times; !! 1 !! 2 !! 3
5313 |-
5314 ! 1
5315 | 1 || 2 || 3
5316 |-
5317 ! 2
5318 | 2 || 4 || 6
5319 |-
5320 ! 3
5321 | 3 || 6 || 9
5322 |-
5323 ! 4
5324 | 4 || 8 || 12
5325 |-
5326 ! 5
5327 | 5 || 10 || 15
5328 |}
5329 !! html
5330 <table border="1" cellpadding="2">
5331 <caption>Multiplication table
5332 </caption>
5333 <tr>
5334 <th> &#215; </th>
5335 <th> 1 </th>
5336 <th> 2 </th>
5337 <th> 3
5338 </th></tr>
5339 <tr>
5340 <th> 1
5341 </th>
5342 <td> 1 </td>
5343 <td> 2 </td>
5344 <td> 3
5345 </td></tr>
5346 <tr>
5347 <th> 2
5348 </th>
5349 <td> 2 </td>
5350 <td> 4 </td>
5351 <td> 6
5352 </td></tr>
5353 <tr>
5354 <th> 3
5355 </th>
5356 <td> 3 </td>
5357 <td> 6 </td>
5358 <td> 9
5359 </td></tr>
5360 <tr>
5361 <th> 4
5362 </th>
5363 <td> 4 </td>
5364 <td> 8 </td>
5365 <td> 12
5366 </td></tr>
5367 <tr>
5368 <th> 5
5369 </th>
5370 <td> 5 </td>
5371 <td> 10 </td>
5372 <td> 15
5373 </td></tr></table>
5374
5375 !! end
5376
5377 !! test
5378 Accept "||" in table headings
5379 !! wikitext
5380 {|
5381 !h1 || h2
5382 |}
5383 !! html
5384 <table>
5385 <tr>
5386 <th>h1 </th>
5387 <th> h2
5388 </th></tr></table>
5389
5390 !! end
5391
5392 !! test
5393 Accept "!!" in table data
5394 !! wikitext
5395 {|
5396 | Foo!! ||
5397 |}
5398 !! html
5399 <table>
5400 <tr>
5401 <td> Foo!! </td>
5402 <td>
5403 </td></tr></table>
5404
5405 !! html/parsoid
5406 <table>
5407 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
5408 </tbody></table>
5409 !! end
5410
5411 !! test
5412 Accept "||" in indented table headings
5413 !! wikitext
5414 :{|
5415 !h1 || h2
5416 |}
5417 !! html
5418 <dl><dd><table>
5419 <tr>
5420 <th>h1 </th>
5421 <th> h2
5422 </th></tr></table></dd></dl>
5423
5424 !! end
5425
5426 !! test
5427 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5428 !! wikitext
5429 {|
5430 !| h1
5431 || a
5432 |}
5433 !! html
5434 <table>
5435 <tr>
5436 <th> h1
5437 </th>
5438 <td> a
5439 </td></tr></table>
5440
5441 !! end
5442
5443 !!test
5444 Accept "| !" at start of line in tables (ignore !-attribute)
5445 !! wikitext
5446 {|
5447 |-
5448 | !style="color:red" | bar
5449 |}
5450 !! html
5451 <table>
5452
5453 <tr>
5454 <td> bar
5455 </td></tr></table>
5456
5457 !!end
5458
5459 !!test
5460 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 +/-
5461 !! wikitext
5462 {|
5463 |-
5464 |style='color:red;'|+1
5465 |style='color:blue;'|-1
5466 |-
5467 | 1 || 2 || 3
5468 | 1 ||+2 ||-3
5469 |-
5470 | +1
5471 | -1
5472 |}
5473 !! html
5474 <table>
5475
5476 <tr>
5477 <td style="color:red;">+1
5478 </td>
5479 <td style="color:blue;">-1
5480 </td></tr>
5481 <tr>
5482 <td> 1 </td>
5483 <td> 2 </td>
5484 <td> 3
5485 </td>
5486 <td> 1 </td>
5487 <td>+2 </td>
5488 <td>-3
5489 </td></tr>
5490 <tr>
5491 <td> +1
5492 </td>
5493 <td> -1
5494 </td></tr></table>
5495
5496 !!end
5497
5498 !! test
5499 Table rowspan
5500 !! wikitext
5501 {| border=1
5502 | Cell 1, row 1
5503 |rowspan=2| Cell 2, row 1 (and 2)
5504 | Cell 3, row 1
5505 |-
5506 | Cell 1, row 2
5507 | Cell 3, row 2
5508 |}
5509 !! html
5510 <table border="1">
5511 <tr>
5512 <td> Cell 1, row 1
5513 </td>
5514 <td rowspan="2"> Cell 2, row 1 (and 2)
5515 </td>
5516 <td> Cell 3, row 1
5517 </td></tr>
5518 <tr>
5519 <td> Cell 1, row 2
5520 </td>
5521 <td> Cell 3, row 2
5522 </td></tr></table>
5523
5524 !! end
5525
5526 !! test
5527 Nested table
5528 !! wikitext
5529 {| border=1
5530 | &alpha;
5531 |
5532 {| bgcolor=#ABCDEF border=2
5533 |nested
5534 |-
5535 |table
5536 |}
5537 |the original table again
5538 |}
5539 !! html
5540 <table border="1">
5541 <tr>
5542 <td> &#945;
5543 </td>
5544 <td>
5545 <table bgcolor="#ABCDEF" border="2">
5546 <tr>
5547 <td>nested
5548 </td></tr>
5549 <tr>
5550 <td>table
5551 </td></tr></table>
5552 </td>
5553 <td>the original table again
5554 </td></tr></table>
5555
5556 !! end
5557
5558 !! test
5559 Invalid attributes in table cell (bug 1830)
5560 !! wikitext
5561 {|
5562 |Cell:|broken
5563 |}
5564 !! html
5565 <table>
5566 <tr>
5567 <td>broken
5568 </td></tr></table>
5569
5570 !! end
5571
5572 # The "|}" to close the table is missing from the input, so parsoid's
5573 # *2wt modes will fail.
5574 !! test
5575 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5576 !! options
5577 parsoid=wt2html,html2html
5578 !! wikitext
5579 {|
5580 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5581 !! html/php
5582 <table>
5583 <tr>
5584 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5585 <td>]" onmouseover="alert(document.cookie)"&gt;test
5586 </td>
5587 </tr>
5588 </table>
5589
5590 !! html/parsoid
5591 <table><tbody>
5592 <tr>
5593 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5594 !! end
5595
5596 # FIXME: The php output is broken.
5597 !! test
5598 ! and || in td attributes should not be parsed as <th>/<td>
5599 !! wikitext
5600 {|
5601 | style="color: red !important;" data-contrived="put this here ||" | foo
5602 |}
5603 !! html/php
5604 <table>
5605 <tr>
5606 <td> style="color: red !important;" data-contrived="put this here </td>
5607 <td> foo
5608 </td></tr></table>
5609
5610 !! html/parsoid
5611 <table>
5612 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
5613 </tbody></table>
5614 !! end
5615
5616 !! test
5617 Indented table markup mixed with indented pre content (proposed in bug 6200)
5618 !! wikitext
5619 <table>
5620 <tr>
5621 <td>
5622 Text that should be rendered preformatted
5623 </td>
5624 </tr>
5625 </table>
5626 !! html
5627 <table>
5628 <tr>
5629 <td>
5630 <pre>Text that should be rendered preformatted
5631 </pre>
5632 </td>
5633 </tr>
5634 </table>
5635
5636 !! end
5637
5638 !! test
5639 Template-generated table cell attributes and cell content
5640 !! wikitext
5641 {|
5642 |{{table_attribs}}
5643 | {{table_attribs}}
5644 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
5645 |align=center {{table_attribs}}
5646 | <!--foo--> align=center <!--bar--> {{table_attribs}}
5647 |}
5648 !! html
5649 <table>
5650 <tr>
5651 <td style="color: red"> Foo
5652 </td>
5653 <td style="color: red"> Foo
5654 </td>
5655 <td style="color: red"> Foo
5656 </td>
5657 <td align="center" style="color: red"> Foo
5658 </td>
5659 <td align="center" style="color: red"> Foo
5660 </td></tr></table>
5661
5662 !! end
5663
5664 !! test
5665 Template-generated table cell attributes and cell content (2)
5666 !! wikitext
5667 {|
5668 |align=center {{table_cells}}
5669 |}
5670 !! html
5671 <table>
5672 <tr>
5673 <td align="center" style="color: red"> Foo </td>
5674 <td> Bar </td>
5675 <td> Baz
5676 </td></tr></table>
5677
5678 !! end
5679
5680 !! test
5681 Table with row followed by newlines and table heading
5682 !! wikitext
5683 {|
5684 |-
5685
5686 ! foo
5687 |}
5688 !! html
5689 <table>
5690
5691
5692 <tr>
5693 <th> foo
5694 </th></tr></table>
5695
5696 !! end
5697
5698 !! test
5699 Table with empty line following the start tag
5700 !! wikitext
5701 {|
5702
5703 |-
5704 | foo
5705 |}
5706 !! html
5707 <table>
5708
5709
5710 <tr>
5711 <td> foo
5712 </td></tr></table>
5713
5714 !! end
5715
5716 # FIXME: Preserve the attribute properly (with an empty string as value) in
5717 # the PHP parser. Parsoid implements the behavior below.
5718 !! test
5719 Table attributes with empty value
5720 !! wikitext
5721 {|
5722 | style=| hello
5723 |}
5724 !! html/parsoid
5725 <table>
5726 <tbody>
5727 <tr>
5728 <td style=""> hello
5729 </td></tr></tbody></table>
5730
5731 !! end
5732
5733 !! test
5734 Wikitext table with a lot of comments
5735 !! wikitext
5736 {|
5737 <!-- c0 -->
5738 | foo
5739 <!-- c1 -->
5740 |- <!-- c2 -->
5741 <!-- c3 -->
5742 |<!-- c4 -->
5743 <!-- c5 -->
5744 |}
5745 !! html
5746 <table>
5747 <tr>
5748 <td> foo
5749 </td></tr>
5750 <tr>
5751 <td>
5752 </td></tr></table>
5753
5754 !! end
5755
5756 !! test
5757 Wikitext table with double-line table cell
5758 !! wikitext
5759 {|
5760 |a
5761 b
5762 |}
5763 !! html
5764 <table>
5765 <tr>
5766 <td>a
5767 <p>b
5768 </p>
5769 </td></tr></table>
5770
5771 !! end
5772
5773 !! test
5774 Table cell with a single comment
5775 !! wikitext
5776 {|
5777 | <!-- c1 -->
5778 | a
5779 |}
5780 !! html
5781 <table>
5782 <tr>
5783 <td>
5784 </td>
5785 <td> a
5786 </td></tr></table>
5787
5788 !! end
5789
5790 !! test
5791 Table-cell after a comment-only-empty-line
5792 !! wikitext
5793 {|
5794 |a
5795 <!--c1-->
5796 <!--c2-->| b
5797 |}
5798 !! html
5799 <table>
5800 <tr>
5801 <td>a
5802 </td>
5803 <td> b
5804 </td></tr></table>
5805
5806 !! html/parsoid
5807 <table>
5808 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5809 <!--c1-->
5810 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5811 </tbody></table>
5812
5813 !! end
5814
5815 !! test
5816 Build table with {{!}}
5817 !! wikitext
5818 {{{!}} class="wikitable"
5819 ! header
5820 ! second header
5821 {{!}}- style="color:red;"
5822 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
5823 {{!}}}
5824 !! html
5825 <table class="wikitable">
5826 <tr>
5827 <th> header
5828 </th>
5829 <th> second header
5830 </th></tr>
5831 <tr style="color:red;">
5832 <td> data </td>
5833 <td style="color:red;"> second data
5834 </td></tr></table>
5835
5836 !! end
5837
5838 !! test
5839 Build table with pipe as data
5840 !! wikitext
5841 {| class="wikitable"
5842 ! header
5843 ! second header
5844 |- style="color:red;"
5845 | data || style="color:red;" | second data
5846 |-
5847 | style="color:red;" | data with | || style="color:red;" | second data with |
5848 |-
5849 || data with | ||| second data with |
5850 |}
5851 !! html
5852 <table class="wikitable">
5853 <tr>
5854 <th> header
5855 </th>
5856 <th> second header
5857 </th></tr>
5858 <tr style="color:red;">
5859 <td> data </td>
5860 <td style="color:red;"> second data
5861 </td></tr>
5862 <tr>
5863 <td style="color:red;"> data with | </td>
5864 <td style="color:red;"> second data with |
5865 </td></tr>
5866 <tr>
5867 <td> data with | </td>
5868 <td> second data with |
5869 </td></tr></table>
5870
5871 !! end
5872
5873 !! test
5874 Build table with wikilink
5875 !! wikitext
5876 {| class="wikitable"
5877 ! header || second header
5878 |- style="color:red;"
5879 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
5880 |-
5881 | data || second data [[Main Page|link|text with pipe]]
5882 |}
5883 !! html
5884 <table class="wikitable">
5885 <tr>
5886 <th> header </th>
5887 <th> second header
5888 </th></tr>
5889 <tr style="color:red;">
5890 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
5891 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
5892 </td></tr>
5893 <tr>
5894 <td> data </td>
5895 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
5896 </td></tr></table>
5897
5898 !! end
5899
5900 # The expected HTML structure in this test is debatable. The PHP parser does
5901 # not parse this kind of table at all. The main focus for Parsoid is on
5902 # round-tripping, so this output is ok for now. TODO: revisit!
5903 !! test
5904 Wikitext table with html-syntax row
5905 !! wikitext
5906 {|
5907 |-
5908 <td>foo</td>
5909 |}
5910 !! html/parsoid
5911 <table>
5912 <tbody>
5913 <tr>
5914 <td>foo</td></tr></tbody></table>
5915 !! end
5916
5917 ## Note that Parsoid output differs from PHP and PHP+tidy here.
5918 ## The lack of <tr> tags in the PHP output is arguably a bug in the
5919 ## PHP parser, which tidy then compounds by fostering the content
5920 ## entirely out of the table. Parsoid recognizes the table context
5921 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
5922 ## depends on PHP's treatment of broken table markup!
5923 !! test
5924 Implicit <td> after a |-
5925 !! options
5926 parsoid=wt2html,html2html
5927 !! wikitext
5928 {|
5929 |-
5930 a
5931 |}
5932 !! html/php
5933 <table>
5934
5935 a
5936 </table>
5937
5938 !! html/php+tidy
5939 <p>a</p>
5940 !! html/parsoid
5941 <table>
5942 <tr><td>a</td></tr>
5943 </table>
5944 !! end
5945
5946 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
5947 !! test
5948 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
5949 !! options
5950 parsoid=wt2html,html2html
5951 !! wikitext
5952 {|
5953 |-
5954 |
5955 a
5956 |-
5957 b
5958 |}
5959 !! html/php
5960 <table>
5961
5962 <tr>
5963 <td>
5964 <pre>a
5965 </pre>
5966 </td></tr>
5967 b
5968 </table>
5969
5970 !! html/php+tidy
5971 <p>b</p>
5972 <table>
5973 <tr>
5974 <td>
5975 <pre>
5976 a
5977 </pre></td>
5978 </tr>
5979 </table>
5980 !! html/parsoid
5981 <table>
5982 <tbody>
5983 <tr><td><pre>a</pre></td></tr>
5984 <tr><td> b</td></tr>
5985 </tbody>
5986 </table>
5987 !! end
5988
5989 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
5990 # Parsoid generates the missing <td>, so wt2wt won't succeed.
5991 !! test
5992 Lists should be recognized in an implicit <td> context
5993 !! options
5994 parsoid=wt2html,html2html
5995 !! wikitext
5996 {|
5997 |-
5998 *a
5999 |}
6000 !! html/php
6001 <table>
6002
6003 <ul><li>a</li></ul>
6004 </table>
6005
6006 !! html/php+tidy
6007 <ul>
6008 <li>a</li>
6009 </ul>
6010 !! html/parsoid
6011 <table>
6012 <tr>
6013 <td><ul>
6014 <li>a</li>
6015 </ul></td>
6016 </tr>
6017 </table>
6018 !! end
6019
6020 !! test
6021 Parsoid: Round-trip tables directly followed by content (bug 51219)
6022 !! options
6023 parsoid=wt2html,wt2wt
6024 !! wikitext
6025 {|
6026 |foo
6027 |} bar
6028
6029 {|
6030 |baz
6031 |}<b>quux</b>
6032 !! html+tidy
6033 <table>
6034 <tr>
6035 <td>foo</td>
6036 </tr>
6037 </table>
6038 <p>bar</p>
6039 <table>
6040 <tr>
6041 <td>baz</td>
6042 </tr>
6043 </table>
6044 <p><b>quux</b></p>
6045 !! end
6046
6047 !! test
6048 Parsoid: Default to a newline after tables in new content (bug 51219)
6049 !! options
6050 parsoid=html2wt
6051 !! html
6052 <table><tbody>
6053 <tr><td>foo</td></tr></tbody></table> bar
6054 <table><tbody>
6055 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6056 !! wikitext
6057 {|
6058 |foo
6059 |}
6060 <nowiki> </nowiki>bar
6061 {|
6062 |baz
6063 |}
6064 '''quux'''
6065 !! end
6066
6067 !! test
6068 Parsoid: newline inducing block nodes don't suppress <nowiki>
6069 !! options
6070 parsoid=html2wt
6071 !! html
6072 a<h1>foo</h1>
6073 !! wikitext
6074 <nowiki> </nowiki>a
6075
6076 = foo =
6077 !! end
6078
6079 !! test
6080 Parsoid: Row-syntax table headings followed by comment & table cells
6081 !! options
6082 parsoid=wt2html,wt2wt
6083 !! wikitext
6084 {|
6085 ! foo || bar
6086 <!-- foo --> || baz || quux
6087 |}
6088 !! html/php
6089 <table>
6090 <tr>
6091 <th> foo </th>
6092 <th> bar
6093 </th>
6094 <td> baz </td>
6095 <td> quux
6096 </td></tr></table>
6097
6098 !! html/parsoid
6099 <table>
6100 <tbody><tr><th> foo </th><th> bar
6101 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6102 </tbody></table>
6103 !! end
6104
6105
6106 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6107 # preserves it.
6108 !!test
6109 Parsoid: Recover better from broken table attributes
6110 !!options
6111 parsoid=wt2html
6112 !!wikitext
6113 {| class="foo
6114 | class="bar" |
6115 foo
6116 |}
6117 !!html/php+tidy
6118 <table>
6119 <tr>
6120 <td class="bar">
6121 <p>foo</p>
6122 </td>
6123 </tr>
6124 </table>
6125 !!html/parsoid
6126 <table class="foo">
6127 <tr>
6128 <td class="bar">
6129 <p>foo</p></td></tr>
6130 </tbody></table>
6131 !!end
6132
6133 !! test
6134 Strip unsupported table tags
6135 !! options
6136 parsoid=html2wt
6137 !! html
6138 <table>
6139 <thead>
6140 <tr>
6141 <th>Month</th>
6142 <th>Savings</th>
6143 </tr>
6144 </thead>
6145 <tbody>
6146 <tr>
6147 <td>January</td>
6148 <td>$100</td>
6149 </tr>
6150 <tr>
6151 <td>February</td>
6152 <td>$80</td>
6153 </tr>
6154 </tbody>
6155 <tfoot>
6156 <tr>
6157 <td>Sum</td>
6158 <td>$180</td>
6159 </tr>
6160 </tfoot>
6161 </table>
6162 !! wikitext
6163 {|
6164
6165 !Month
6166 !Savings
6167
6168 |January
6169 |$100
6170
6171 |-
6172 |February
6173 |$80
6174
6175 |Sum
6176 |$180
6177
6178 |}
6179 !! end
6180
6181 ###
6182 ### Internal links
6183 ###
6184 !! test
6185 Plain link, capitalized
6186 !! wikitext
6187 [[Main Page]]
6188 !! html
6189 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6190 </p>
6191 !! end
6192
6193 !! test
6194 Plain link, uncapitalized
6195 !! wikitext
6196 [[main Page]]
6197 !! html
6198 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6199 </p>
6200 !! end
6201
6202 !! test
6203 Piped link
6204 !! wikitext
6205 [[Main Page|The Main Page]]
6206 !! html
6207 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6208 </p>
6209 !! end
6210
6211 !! test
6212 Piped link with comment in link text
6213 !! wikitext
6214 [[Main Page|The Main<!--front--> Page]]
6215 !! html
6216 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6217 </p>
6218 !! end
6219
6220 !! test
6221 Piped link with multiple pipe characters in link text
6222 !! wikitext
6223 [[Main Page||The|Main|Page|]]
6224 !! html/php
6225 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6226 </p>
6227 !! html/parsoid
6228 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6229 !! end
6230
6231 !! test
6232 Broken link
6233 !! wikitext
6234 [[Zigzagzogzagzig]]
6235 !! html
6236 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6237 </p>
6238 !! end
6239
6240 !! test
6241 Broken link with fragment
6242 !! wikitext
6243 [[Zigzagzogzagzig#zug]]
6244 !! html
6245 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6246 </p>
6247 !! end
6248
6249 !! test
6250 Special page link with fragment
6251 !! wikitext
6252 [[Special:Version#anchor]]
6253 !! html
6254 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6255 </p>
6256 !! end
6257
6258 !! test
6259 Nonexistent special page link with fragment
6260 !! wikitext
6261 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6262 !! html
6263 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6264 </p>
6265 !! end
6266
6267 !! test
6268 Link with prefix
6269 !! wikitext
6270 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6271 !! html
6272 <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>
6273 </p>
6274 !! end
6275
6276 !! test
6277 Link with suffix
6278 !! wikitext
6279 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6280 !! html
6281 <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>!!!
6282 </p>
6283 !! end
6284
6285 !! article
6286 prefixed article
6287 !! text
6288 Some text
6289 !! endarticle
6290
6291 !! test
6292 Bug 43661: Piped links with identical prefixes
6293 !! wikitext
6294 [[prefixed article|prefixed articles with spaces]]
6295
6296 [[prefixed article|prefixed articlesaoeu]]
6297
6298 [[Main Page|Main Page test]]
6299 !! html
6300 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6301 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6302 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6303 </p>
6304 !! end
6305
6306
6307 !! test
6308 Link with HTML entity in suffix / tail
6309 !! wikitext
6310 [[Main Page]]&quot;, [[Main Page]]&#97;
6311 !! html/php
6312 <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;
6313 </p>
6314 !! html/parsoid
6315 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;quot;","srcContent":"\""}'>"</span>, <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#97;","srcContent":"a"}'>a</span></p>
6316 !! end
6317
6318 !! test
6319 Link with 3 brackets
6320 !! wikitext
6321 [[[Main Page]]]
6322 !! html
6323 <p>[[[Main Page]]]
6324 </p>
6325 !! end
6326
6327 !! test
6328 Link with 4 brackets
6329 !! wikitext
6330 [[[[Main Page]]]]
6331 !! html
6332 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6333 </p>
6334 !! end
6335
6336 !! test
6337 Piped link with 3 brackets
6338 !! wikitext
6339 [[[main page|the main page]]]
6340 !! html
6341 <p>[[[main page|the main page]]]
6342 </p>
6343 !! end
6344
6345 !! test
6346 Piped link with extlink-like text
6347 !! wikitext
6348 [[Main Page|[bar]]]
6349 [[Main Page|This is a [bar]]]
6350 !! html/php
6351 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6352 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6353 </p>
6354 !! html/parsoid
6355 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
6356 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
6357 !! end
6358
6359 !! test
6360 Link with multiple pipes
6361 !! wikitext
6362 [[Main Page|The|Main|Page]]
6363 !! html
6364 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6365 </p>
6366 !! end
6367
6368 # Note that parsoid does not munge anchor text; all non-space
6369 # characters are valid in HTML5 ids.
6370 !! test
6371 Anchor containing a #. (bug 63430)
6372 !! wikitext
6373 [[Main Page#And#Link]]
6374 !! html/php
6375 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6376 </p>
6377 !! html/parsoid
6378 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6379 !! end
6380
6381 !! test
6382 Link to namespaces
6383 !! wikitext
6384 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6385 !! html
6386 <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>
6387 </p>
6388 !! end
6389
6390 !! test
6391 Link with space in namespace
6392 !! wikitext
6393 [[User talk:Foo bar]]
6394 !! html
6395 <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>
6396 </p>
6397 !! end
6398
6399 !! article
6400 MemoryAlpha:AlphaTest
6401 !! text
6402 This is an article in the MemoryAlpha namespace
6403 (which shadows the memoryalpha interwiki link).
6404 !! endarticle
6405
6406 !! test
6407 Namespace takes precedence over interwiki link (bug 51680)
6408 !! wikitext
6409 [[MemoryAlpha:AlphaTest]]
6410 !! html
6411 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6412 </p>
6413 !! end
6414
6415 # The previous test doesn't work correctly in html2*, due to not recognizing the
6416 # link as an internal one. This one checks for the correct behavior.
6417 !! test
6418 Link to namespace preferred over interwiki with correct rel attribute
6419 !! options
6420 parsoid=html2wt,html2html
6421 !! html
6422 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
6423 !! wikitext
6424 [[MemoryAlpha:AlphaTest]]
6425 !! end
6426
6427 !! test
6428 Piped link to namespace
6429 !! wikitext
6430 [[Meta:Disclaimers|The disclaimers]]
6431 !! html
6432 <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>
6433 </p>
6434 !! end
6435
6436 !! test
6437 Link containing }
6438 !! wikitext
6439 [[Usually caused by a typo (oops}]]
6440 !! html
6441 <p>[[Usually caused by a typo (oops}]]
6442 </p>
6443 !! end
6444
6445 !! article
6446 7% Solution
6447 !! text
6448 Just a test of an article title containing a percent.
6449 !! endarticle
6450
6451 !! test
6452 Link containing % (not as a hex sequence)
6453 !! wikitext
6454 [[7% Solution]]
6455 !! html/php
6456 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6457 </p>
6458 !! html/parsoid
6459 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6460 !! end
6461
6462 # note that the parsoid HTML is identical to the previous test output,
6463 # so the previous test ensures that the html2wt mode will generate the
6464 # "not as a hex sequence" wikitext.
6465 !! test
6466 Link containing % as a single hex sequence interpreted to char
6467 !! options
6468 parsoid=wt2wt,wt2html,html2html
6469 !! wikitext
6470 [[7%25 Solution]]
6471 !! html/php
6472 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6473 </p>
6474 !! html/parsoid
6475 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6476 !!end
6477
6478 !! test
6479 Link containing % as a double hex sequence interpreted to hex sequence
6480 !! wikitext
6481 [[7%2525 Solution]]
6482 !! html
6483 <p>[[7%2525 Solution]]
6484 </p>
6485 !!end
6486
6487 # note that parsoid does not munge anchor text; all non-space
6488 # characters are valid in HTML5 anchors.
6489 !! test
6490 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6491 Example for such a section: == < ==
6492 !! wikitext
6493 [[%23%3c]][[%23%3e]]
6494 !! html/php
6495 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6496 </p>
6497 !! html/parsoid
6498 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E" title="Main Page">#></a></p>
6499 !! end
6500
6501 !! test
6502 Link containing "<#" and ">#" as a hex sequences
6503 !! wikitext
6504 [[%3c%23]][[%3e%23]]
6505 !! html
6506 <p>[[%3c%23]][[%3e%23]]
6507 </p>
6508 !! end
6509
6510 !! test
6511 Link containing an equals sign
6512 !! wikitext
6513 [[Special:BookSources/isbn=4-00-026157-6]]
6514 !! html/php
6515 <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>
6516 </p>
6517 !! html/parsoid
6518 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
6519 !! end
6520
6521 !! article
6522 Foo~bar
6523 !! text
6524 Just a test of an article title containing a tilde.
6525 !! endarticle
6526
6527 # note that links containing signatures, like [[Foo~~~~]], are
6528 # massaged by the pre-save transform (PST) and so the tildes are never
6529 # seen by the parser.
6530 !! test
6531 Link containing a tilde
6532 !! wikitext
6533 [[Foo~bar]]
6534 !! html/php
6535 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6536 </p>
6537 !! html/parsoid
6538 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6539 !! end
6540
6541 !! test
6542 Link containing double-single-quotes '' (bug 4598)
6543 !! wikitext
6544 [[Lista d''e paise d''o munno]]
6545 !! html/php
6546 <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>
6547 </p>
6548 !! html/parsoid
6549 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
6550 !! end
6551
6552 !! test
6553 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6554 !! wikitext
6555 Some [[Link|pretty ''italics'' and stuff]]!
6556 !! html/php
6557 <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>!
6558 </p>
6559 !! html/parsoid
6560 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6561 !! end
6562
6563 !! test
6564 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6565 !! wikitext
6566 ''Some [[Link|pretty ''italics'' and stuff]]!''
6567 !! html
6568 <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>
6569 </p>
6570 !! end
6571
6572 !! test
6573 Link with double quotes in title part (literal) and alternate part (interpreted)
6574 !! wikitext
6575 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
6576
6577 [[''Pentecoste'']]
6578
6579 [[''Pentecoste''|Pentecoste]]
6580
6581 [[''Pentecoste''|''Pentecoste'']]
6582 !! html/php
6583 <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>
6584 </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>
6585 </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>
6586 </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>
6587 </p>
6588 !! html/parsoid
6589 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></span></p>
6590 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6591 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6592 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6593 !! end
6594
6595 !! test
6596 Broken image links with HTML captions (bug 39700)
6597 !! wikitext
6598 [[File:Nonexistent|<script></script>]]
6599 [[File:Nonexistent|100x100px|<script></script>]]
6600 [[File:Nonexistent|&lt;]]
6601 [[File:Nonexistent|a<i>b</i>c]]
6602 !! html/php
6603 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6604 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6605 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6606 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6607 </p>
6608 !! html/parsoid
6609 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&lt;/script>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
6610 <span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100"/></a></span>
6611 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
6612 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i>b&lt;/i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p>
6613 !! end
6614
6615 !! test
6616 Plain link to URL
6617 !! wikitext
6618 [[http://www.example.com]]
6619 !! html/php
6620 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6621 </p>
6622 !! html/parsoid
6623 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6624 !! end
6625
6626 !! test
6627 Plain link to URL with link text
6628 !! wikitext
6629 [[http://www.example.com Link text]]
6630 !! html
6631 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6632 </p>
6633 !! end
6634
6635 !! test
6636 Plain link to protocol-relative URL
6637 !! wikitext
6638 [[//www.example.com]]
6639 !! html/php
6640 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6641 </p>
6642 !! html/parsoid
6643 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6644 !! end
6645
6646 !! test
6647 Plain link to protocol-relative URL with link text
6648 !! wikitext
6649 [[//www.example.com Link text]]
6650 !! html
6651 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6652 </p>
6653 !! end
6654
6655 !! test
6656 Plain link to page with question mark in title
6657 !! wikitext
6658 [[A?b]]
6659
6660 [[A?b|Baz]]
6661 !! html
6662 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6663 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6664 </p>
6665 !! end
6666
6667
6668 # I'm fairly sure the expected result here is wrong.
6669 # We want these to be URL links, not pseudo-pages with URLs for titles....
6670 # However the current output is also pretty screwy.
6671 #
6672 # ----
6673 # I'm changing it to match the current output--it arguably makes more
6674 # sense in the light of the test above. Old expected result was:
6675 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6676 #</p>
6677 # But I think this test is bordering on "garbage in, garbage out" anyway.
6678 # -- wtm
6679 !! test
6680 Piped link to URL
6681 !! wikitext
6682 Piped link to URL: [[http://www.example.com|an example URL]]
6683 !! html/php
6684 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6685 </p>
6686 !! html/parsoid
6687 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6688 !! end
6689
6690 !! test
6691 BUG 2: [[page|http://url/]] should link to page, not http://url/
6692 !! wikitext
6693 [[Main Page|http://url/]]
6694 !! html/php
6695 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6696 </p>
6697 !! html/parsoid
6698 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6699 !! end
6700
6701 # Parsoid does not mark self-links, by design.
6702 !! test
6703 BUG 337: Escaped self-links should be bold
6704 !! options
6705 title=[[Bug462]]
6706 !! wikitext
6707 [[Bu&#103;462]] [[Bug462]]
6708 !! html/php
6709 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6710 </p>
6711 !! html/php+tidy
6712 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6713 !! html/parsoid
6714 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6715 !! end
6716
6717 !! test
6718 Self-link to section should not be bold
6719 !! options
6720 title=[[Main Page]]
6721 !! wikitext
6722 [[Main Page#section]]
6723 !! html
6724 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6725 </p>
6726 !! end
6727
6728 !! article
6729 00
6730 !! text
6731 This is 00.
6732 !! endarticle
6733
6734 !!test
6735 Self-link to numeric title
6736 !!options
6737 title=[[0]]
6738 !! wikitext
6739 [[0]]
6740 !! html
6741 <p><strong class="selflink">0</strong>
6742 </p>
6743 !!end
6744
6745 !!test
6746 Link to numeric-equivalent title
6747 !!options
6748 title=[[0]]
6749 !! wikitext
6750 [[00]]
6751 !! html
6752 <p><a href="/wiki/00" title="00">00</a>
6753 </p>
6754 !!end
6755
6756 !! test
6757 <nowiki> inside a link
6758 !! wikitext
6759 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6760 !! html
6761 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6762 </p>
6763 !! end
6764
6765 !! test
6766 Non-breaking spaces in title
6767 !! wikitext
6768 [[&nbsp; Main &nbsp; Page &nbsp;]]
6769 !! html
6770 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6771 </p>
6772 !!end
6773
6774 !! test
6775 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6776 !! options
6777 language=ca
6778 !! wikitext
6779 '''[[Main Page]]'''
6780 !! html
6781 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6782 </p>
6783 !! end
6784
6785 !! test
6786 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6787 !! options
6788 language=ca
6789 !! wikitext
6790 ''[[Main Page]]''
6791 !! html
6792 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6793 </p>
6794 !! end
6795
6796 !! test
6797 Internal link with en linktrail: no apostrophes (bug 27473)
6798 !! options
6799 language=en
6800 !! wikitext
6801 [[Something]]'nice
6802 !! html
6803 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6804 </p>
6805 !! end
6806
6807 !! test
6808 Internal link with ca linktrail with apostrophes (bug 27473)
6809 !! options
6810 language=ca
6811 !! wikitext
6812 [[Something]]'nice
6813 !! html
6814 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6815 </p>
6816 !! end
6817
6818 !! test
6819 Internal link with kaa linktrail with apostrophes (bug 27473)
6820 !! options
6821 language=kaa
6822 !! wikitext
6823 [[Something]]'nice
6824 !! html
6825 <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>
6826 </p>
6827 !! end
6828
6829 !! test
6830 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6831 !! wikitext
6832 [[User:Foo/Test/63636:Bar|Test]]
6833 !! html/php
6834 <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>
6835 </p>
6836 !! html/parsoid
6837 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
6838 !! end
6839
6840 !! test
6841 Purely hash wikilink
6842 !! options
6843 title=[[User:test/123]]
6844 !! wikitext
6845 [[#a|b]]
6846 !! html/php
6847 <p><a href="#a">b</a>
6848 </p>
6849 !! html/parsoid
6850 <p><a rel="mw:WikiLink" href="../User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"../User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
6851 !! end
6852
6853 !! test
6854 1. Interaction of linktrail and template encapsulation
6855 !! options
6856 parsoid
6857 !! wikitext
6858 {{echo|[[Foo]]}}l
6859 !! html
6860 <p><a rel="mw:WikiLink" href="Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
6861 !! end
6862
6863 !! test
6864 2. Interaction of linktrail and template encapsulation
6865 !! options
6866 parsoid
6867 !! wikitext
6868 {{echo|Some [[Fool]]}}s
6869 !! html
6870 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
6871 !! end
6872
6873 !! test
6874 3. Interaction of linktrail and template encapsulation
6875 !! options
6876 parsoid
6877 !! wikitext
6878 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6879 !! html
6880 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
6881 !! end
6882
6883 !! article
6884 Söfnuður
6885 !! text
6886 Test.
6887 !! endarticle
6888
6889 !! test
6890 Internal link with is link prefix
6891 !! options
6892 language=is
6893 !! wikitext
6894 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6895 !! html
6896 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6897 </p>
6898 !! end
6899
6900 !! article
6901 Mótmælendatrú
6902 !! text
6903 Test.
6904 !! endarticle
6905
6906 !! test
6907 Internal link with is link trail and link prefix
6908 !! options
6909 language=is
6910 !! wikitext
6911 [[mótmælendatrú|xxx]]ar
6912 [[mótmælendatrú]]ar
6913 mótmælenda[[söfnuður]]
6914 mótmælenda[[söfnuður|söfnuðir]]
6915 mótmælenda[[söfnuður|söfnuðir]]xxx
6916 !! html
6917 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6918 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6919 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6920 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6921 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6922 </p>
6923 !! end
6924
6925 !! test
6926 Parsoid link trail escaping
6927 !! options
6928 parsoid=html2wt,html2html
6929 !! html
6930 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
6931 !! wikitext
6932 [[apple]]<nowiki/>s
6933 !! end
6934
6935 !! test
6936 Parsoid link prefix escaping
6937 !! options
6938 language=is
6939 parsoid=html2wt,html2html
6940 !! html
6941 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
6942 !! wikitext
6943 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6944 !! end
6945
6946 !! test
6947 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6948 !! wikitext
6949 [[Foo| bar]]
6950
6951 [[Foo| ''bar'']]
6952
6953 [http://wp.org foo]
6954
6955 [http://wp.org ''foo'']
6956 !! html
6957 <p><a href="/wiki/Foo" title="Foo"> bar</a>
6958 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
6959 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6960 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6961 </p>
6962 !! end
6963
6964 !! test
6965 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6966 !! options
6967 parsoid
6968 !! wikitext
6969 [[Foo|{{echo|a}} b {{echo|c}}]]
6970 !! html
6971 <p><a rel="mw:WikiLink" href="Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
6972 !! end
6973
6974 !! test
6975 Link with angle bracket after anchor
6976 !! wikitext
6977 [[Foo#<bar>]]
6978 !! html/php
6979 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
6980 </p>
6981 !! html/parsoid
6982 <p><a rel="mw:WikiLink" href="./Foo#%3Cbar%3E" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#%3Cbar%3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
6983 !! end
6984
6985 ###
6986 ### Interwiki links (see maintenance/interwiki.sql)
6987 ###
6988
6989 !! test
6990 Inline interwiki link
6991 !! options
6992 parsoid=wt2html,wt2wt,html2html
6993 !! wikitext
6994 [[MeatBall:SoftSecurity]]
6995 !! html/php
6996 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6997 </p>
6998 !! html/parsoid
6999 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7000 !! end
7001
7002 !! test
7003 Inline interwiki link with empty title (bug 2372)
7004 !! options
7005 parsoid=wt2html,wt2wt,html2html
7006 !! wikitext
7007 [[MeatBall:]]
7008 !! html/php
7009 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7010 </p>
7011 !! html/parsoid
7012 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7013 !! end
7014
7015 !! test
7016 Interwiki link encoding conversion (bug 1636)
7017 !! wikitext
7018 *[[Wikipedia:ro:Olteni&#0355;a]]
7019 *[[Wikipedia:ro:Olteni&#355;a]]
7020 !! html
7021 <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>
7022 <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>
7023
7024 !! html+tidy
7025 <ul>
7026 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
7027 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
7028 </ul>
7029 !! end
7030
7031 !! test
7032 Interwiki link with fragment (bug 2130)
7033 !! wikitext
7034 [[MeatBall:SoftSecurity#foo]]
7035 !! html
7036 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7037 </p>
7038 !! end
7039
7040 # Ideally the wikipedia: prefix here should be proto-relative too
7041 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7042 # define the 'en' prefix, and originally the test used 'wikipedia',
7043 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7044 # article.
7045 !! test
7046 Different interwiki prefixes mapping to the same URL
7047 !! wikitext
7048 [[:en:Foo]]
7049
7050 [[:en:Foo|Foo]]
7051
7052 [[wikipedia:Foo]]
7053
7054 [[:wikipedia:Foo|Foo]]
7055
7056 [[wikipedia:en:Foo]]
7057
7058 [[:wikipedia:en:Foo]]
7059
7060 [[ wikiPEdia :Foo]]
7061 !! html/parsoid
7062 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">en:Foo</a></p>
7063
7064 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">Foo</a></p>
7065
7066 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">wikipedia:Foo</a></p>
7067
7068 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">Foo</a></p>
7069
7070 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
7071
7072 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
7073
7074 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":" wikiPEdia :Foo"},"isIW":true}' title="wikipedia:Foo"> wikiPEdia :Foo</a></p>
7075 !! end
7076
7077 !! test
7078 Interwiki links that cannot be represented in wiki syntax
7079 !! wikitext
7080 [[meatball:ok]]
7081 [[meatball:ok#foo|ok with fragment]]
7082 [[meatball:ok_as_well?|ok ending with ? mark]]
7083 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7084 [http://de.wikipedia.org/wiki/#foo is just fragment]
7085
7086 !! html/php
7087 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7088 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7089 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with ? mark</a>
7090 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7091 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7092 </p>
7093 !! html/parsoid
7094 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7095 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7096 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
7097 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7098 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7099 !! end
7100
7101 !! test
7102 Interwiki links: trail
7103 !! wikitext
7104 [[wikipedia:Foo|Ba]]r
7105 !! html/php
7106 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7107 </p>
7108 !! html/parsoid
7109 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo">Bar</a></p>
7110 !! end
7111
7112 !! test
7113 Local interwiki link
7114 !! options
7115 parsoid=wt2html,wt2wt,html2html
7116 !! wikitext
7117 [[local:Template:Foo]]
7118 !! html/php
7119 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7120 </p>
7121 !! html/parsoid
7122 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7123 !! end
7124
7125 # Parsoid does not mark self-links, by design.
7126 !! test
7127 Local interwiki link: self-link to current page
7128 !! options
7129 title=[[Main Page]]
7130 parsoid=wt2html,wt2wt,html2html
7131 !! wikitext
7132 [[local:Main Page]]
7133 !! html/php
7134 <p><strong class="selflink">local:Main Page</strong>
7135 </p>
7136 !! html/parsoid
7137 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7138 !! end
7139
7140 !! test
7141 Local interwiki link: prefix only (bug 64167)
7142 !! options
7143 parsoid=wt2html,wt2wt,html2html
7144 !! wikitext
7145 [[local:]]
7146 !! html/php
7147 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7148 </p>
7149 !! html/parsoid
7150 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7151 !! end
7152
7153 !! test
7154 Local interwiki link: with additional interwiki prefix (bug 61357)
7155 !! options
7156 parsoid=wt2html,wt2wt,html2html
7157 !! wikitext
7158 [[local:meatball:Hello]]
7159 !! html/php
7160 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7161 </p>
7162 !! html/parsoid
7163 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7164 !! end
7165
7166 !! test
7167 Multiple local interwiki link prefixes
7168 !! wikitext
7169 [[local:local:local:local:mi:local:Foo]]
7170 !! options
7171 parsoid=wt2html,wt2wt,html2html
7172 !! html/php
7173 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7174 </p>
7175 !! html/parsoid
7176 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7177 !! end
7178
7179 ###
7180 ### Interlanguage links
7181 ### Language links (so that searching for '### language' matches..)
7182 ###
7183
7184 !! test
7185 Interlanguage link
7186 !! options
7187 parsoid=wt2html,wt2wt,html2html
7188 !! wikitext
7189 Blah blah blah
7190 [[zh:Chinese]]
7191 !! html/php
7192 <p>Blah blah blah
7193 </p>
7194 !! html/parsoid
7195 <p>Blah blah blah</p>
7196 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7197 !! end
7198
7199 !! test
7200 Interlanguage link with spacing
7201 !! options
7202 parsoid=wt2html,wt2wt,html2html
7203 !! wikitext
7204 Blah blah blah
7205 [[ zh : Chinese ]]
7206 !! html/php
7207 <p>Blah blah blah
7208 </p>
7209 !! html/parsoid
7210 <p>Blah blah blah</p>
7211 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7212 !! end
7213
7214 !! test
7215 Double interlanguage link
7216 !! options
7217 parsoid=wt2html,wt2wt,html2html
7218 !! wikitext
7219 Blah blah blah
7220 [[es:Spanish]]
7221 [[zh:Chinese]]
7222 !! html/php
7223 <p>Blah blah blah
7224 </p>
7225 !! html/parsoid
7226 <p>Blah blah blah</p>
7227 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7228 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7229 !! end
7230
7231 !! test
7232 Interlanguage link variations
7233 !! options
7234 parsoid=wt2html,wt2wt,html2html
7235 !! wikitext
7236 Blah blah blah
7237 [[ es :Spanish]]
7238 [[ ZH :Chinese]]
7239 [[es:Foo_bar]]
7240 [[es:Foo bar]]
7241 !! html/php
7242 <p>Blah blah blah
7243 </p>
7244 !! html/parsoid
7245 <p>Blah blah blah</p>
7246 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7247 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7248 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7249 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7250 !! end
7251
7252 !! test
7253 Interlanguage link, with prefix links
7254 !! options
7255 language=ln
7256 !! wikitext
7257 Blah blah blah
7258 [[zh:Chinese]]
7259 !! html/php
7260 <p>Blah blah blah
7261 </p>
7262 !! html/parsoid
7263 <p>Blah blah blah</p>
7264 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7265 !! end
7266
7267 !! test
7268 Double interlanguage link, with prefix links (bug 8897)
7269 !! options
7270 language=ln
7271 !! wikitext
7272 Blah blah blah
7273 [[es:Spanish]]
7274 [[zh:Chinese]]
7275 !! html/php
7276 <p>Blah blah blah
7277 </p>
7278 !! html/parsoid
7279 <p>Blah blah blah</p>
7280 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7281 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7282 !! end
7283
7284 !! test
7285 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7286 !! wikitext
7287 Blah blah blah
7288 [[mul:Article]]
7289 !! html/php
7290 <p>Blah blah blah
7291 </p>
7292 !! html/parsoid
7293 <p>Blah blah blah</p>
7294 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7295 !! end
7296
7297 !! test
7298 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7299 !! options
7300 language=ln
7301 !! wikitext
7302 [[WW&nbsp;II]]
7303 !! html
7304 <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>
7305 </p>
7306 !! end
7307
7308 !! test
7309 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7310 !! options
7311 parsoid=html2wt
7312 !! html
7313 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7314 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7315 !! wikitext
7316 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7317
7318 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7319 !! end
7320
7321 !! test
7322 Parsoid: handle constructor well
7323 !! wikitext
7324 [[constructor]]
7325
7326 [[constructor:foo]]
7327 !! html/php
7328 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7329 </p><p><a href="/index.php?title=Constructor:foo&amp;action=edit&amp;redlink=1" class="new" title="Constructor:foo (page does not exist)">constructor:foo</a>
7330 </p>
7331 !! html/parsoid
7332 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;}}">constructor</a></p>
7333
7334 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;}}">constructor:foo</a></p>
7335 !! end
7336
7337 !! article
7338 ko:
7339 !! text
7340 Test.
7341 !! endarticle
7342
7343 # Note that `ko` isn't a known interlanguage prefix
7344 !! test
7345 Parsoid: recognize interlanguage links without a target page
7346 !! options
7347 ill
7348 !! wikitext
7349 [[es:]]
7350
7351 [[ko:]]
7352 !! html/php
7353 es:
7354 !! html/parsoid
7355 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7356
7357 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7358 !! end
7359
7360 # Note that `ko` isn't a known interwiki prefix
7361 !! test
7362 Parsoid: recognize interwiki links without a target page
7363 !! options
7364 parsoid=wt2html,wt2wt,html2html
7365 !! wikitext
7366 [[:es:]]
7367
7368 [[:ko:]]
7369 !! html/php
7370 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7371 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7372 </p>
7373 !! html/parsoid
7374 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7375 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7376 !! end
7377
7378 !! test
7379 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7380 !! wikitext
7381 [[mi:Foo]]
7382 !! html/php
7383 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7384 </p>
7385 !! html/parsoid
7386 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7387 !! end
7388
7389 !! test
7390 Interlanguage link with preceding local interwiki link (bug 68085)
7391 !! options
7392 parsoid=wt2html,wt2wt,html2html
7393 !! wikitext
7394 Blah blah blah
7395 [[local:es:Spanish]]
7396 !! html/php
7397 <p>Blah blah blah
7398 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7399 </p>
7400 !! html/parsoid
7401 <p>Blah blah blah
7402 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7403 !! end
7404
7405 !! test
7406 Looks like an interlanguage link, but is actually a local interwiki
7407 !! options
7408 parsoid=wt2html,wt2wt,html2html
7409 !! wikitext
7410 Blah blah blah
7411 [[mi:Template:Foo]]
7412 !! html/php
7413 <p>Blah blah blah
7414 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7415 </p>
7416 !! html/parsoid
7417 <p>Blah blah blah
7418 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7419 !! end
7420
7421 ###
7422 ### Redirects, Parsoid-only
7423 ###
7424 !! test
7425 1. Simple redirect to page
7426 !! options
7427 parsoid
7428 !! wikitext
7429 #REDIRECT [[Main Page]]
7430 !! html
7431 <link rel="mw:PageProp/redirect" href="./Main_Page">
7432 !! end
7433
7434 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
7435 !! test
7436 2. Other redirect variants
7437 !! options
7438 parsoid=wt2html,wt2wt
7439 !! wikitext
7440 #REDIRECT [[Main_Page]]
7441 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
7442 !! html/parsoid
7443 <link rel="mw:PageProp/redirect" href="./Main_Page"><link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
7444 !! end
7445
7446 !! test
7447 Empty redirect
7448 !! options
7449 parsoid=wt2html,wt2wt
7450 !! wikitext
7451 #REDIRECT [[]]
7452 !! html
7453 <ol>
7454 <li>REDIRECT [[]]</li></ol>
7455 !! end
7456
7457 !! test
7458 Optional colon in #REDIRECT
7459 !! options
7460 # the colon is archaic syntax. we support it for wt2html, but we
7461 # don't care that it roundtrips back to the modern syntax.
7462 parsoid=wt2html,html2html
7463 !! wikitext
7464 #REDIRECT:[[Main Page]]
7465 !! html
7466 <link rel="mw:PageProp/redirect" href="./Main_Page">
7467 !! end
7468
7469 !! test
7470 Whitespace in #REDIRECT with optional colon
7471 !! options
7472 # the colon and gratuitous whitespace is archaic syntax. we support
7473 # it for wt2html, but we don't care that it roundtrips back to the
7474 # modern syntax (without extra whitespace)
7475 parsoid=wt2html,html2html
7476 !! wikitext
7477
7478 #REDIRECT
7479 :
7480 [[Main Page]]
7481 !! html
7482 <link rel="mw:PageProp/redirect" href="./Main_Page">
7483 !! end
7484
7485 !! test
7486 Piped link in #REDIRECT
7487 !! options
7488 # content after piped link is ignored. we support this syntax,
7489 # but don't care that the piped link is lost when we roundtrip this.
7490 parsoid=wt2html
7491 !! wikitext
7492 #REDIRECT [[Main Page|bar]]
7493 !! html
7494 <link rel="mw:PageProp/redirect" href="./Main_Page">
7495 !! end
7496
7497 !! test
7498 Redirect to category
7499 !! options
7500 parsoid=wt2html
7501 !! wikitext
7502 #REDIRECT [[Category:Foo]]
7503 !! html
7504 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7505 !! end
7506
7507 !! test
7508 Redirect to category with URL encoding
7509 !! options
7510 parsoid=wt2html
7511 !! wikitext
7512 #REDIRECT [[Category%3AFoo]]
7513 !! html
7514 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7515 !! end
7516
7517 !! test
7518 Redirect to category page
7519 !! options
7520 parsoid=wt2html,html2html
7521 !! wikitext
7522 #REDIRECT [[:Category:Foo]]
7523 !! html
7524 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7525 !! end
7526
7527 !! test
7528 Redirect to image page (1)
7529 !! options
7530 parsoid
7531 !! wikitext
7532 #REDIRECT [[File:Wiki.png]]
7533 !! html
7534 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7535 !! end
7536
7537 !! test
7538 Redirect to image page (2)
7539 !! options
7540 parsoid
7541 !! wikitext
7542 #REDIRECT [[Image:Wiki.png]]
7543 !! html
7544 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7545 !! end
7546
7547 !! test
7548 Redirect to language
7549 !! options
7550 parsoid
7551 !! wikitext
7552 #REDIRECT [[en:File:Wiki.png]]
7553 !! html
7554 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7555 !! end
7556
7557 !! test
7558 Redirect to interwiki
7559 !! options
7560 parsoid
7561 !! wikitext
7562 #REDIRECT [[meatball:File:Wiki.png]]
7563 !! html
7564 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7565 !! end
7566
7567 !! test
7568 Non-English #REDIRECT
7569 !! options
7570 parsoid
7571 language=is
7572 !! wikitext
7573 #TILVÍSUN [[Main Page]]
7574 !! html
7575 <link rel="mw:PageProp/redirect" href="./Main_Page">
7576 !! end
7577
7578 !! test
7579 New redirect
7580 !! options
7581 parsoid=html2wt
7582 !! html
7583 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7584 !! wikitext
7585 Foo
7586 #REDIRECT [[Foo]]
7587 !! end
7588
7589 ##
7590 ## XHTML tidiness
7591 ###
7592
7593 !! test
7594 <br> to <br />
7595 !! wikitext
7596 1<br>2<br />3
7597 !! html
7598 <p>1<br />2<br />3
7599 </p>
7600 !! end
7601
7602 !! test
7603 Broken br tag sanitization
7604 !! wikitext
7605 </br>
7606 !! html/php
7607 <p>&lt;/br&gt;
7608 </p>
7609 !! end
7610
7611 # TODO: Fix html2html mode (bug 51055)!
7612 # This </br> handling was added as part of bug 50831; but it
7613 # differs from how PHP+tidy handles this. We should investigate
7614 # this.
7615 !! test
7616 Parsoid: Broken br tag recognition
7617 !! options
7618 parsoid=wt2html
7619 !! wikitext
7620 </br>
7621
7622 <br/ >
7623 !! html/php+tidy
7624 <p>&lt;/br&gt;</p>
7625 <p><br /></p>
7626 !! html/parsoid
7627 <p><br></p>
7628 <p><br/></p>
7629 !! end
7630
7631 !! test
7632 Incorrecly removing closing slashes from correctly formed XHTML
7633 !! wikitext
7634 <br style="clear:both;" />
7635 !! html
7636 <p><br style="clear:both;" />
7637 </p>
7638 !! end
7639
7640 !! test
7641 Failing to transform badly formed HTML into correct XHTML
7642 !! wikitext
7643 <br style="clear: left;">
7644 <br style="clear: right;">
7645 <br style="clear: both;">
7646 !! html
7647 <p><br style="clear: left;" />
7648 <br style="clear: right;" />
7649 <br style="clear: both;" />
7650 </p>
7651 !!end
7652
7653 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
7654 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
7655 !! test
7656 Handling html with a div self-closing tag
7657 !! wikitext
7658 <div title />
7659 <div title/>
7660 <div title/ >
7661 <div title=bar />
7662 <div title=bar/>
7663 <div title=bar/ >
7664 !! html/php
7665 <p>&lt;div title /&gt;
7666 &lt;div title/&gt;
7667 </p>
7668 <div>
7669 <p>&lt;div title=bar /&gt;
7670 &lt;div title=bar/&gt;
7671 </p>
7672 <div title="bar/"></div>
7673 </div>
7674
7675 !! html/parsoid
7676 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7677 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7678 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
7679 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7680 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7681 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
7682 !! end
7683
7684 !! test
7685 Handling html with a br self-closing tag
7686 !! wikitext
7687 <br title />
7688 <br title/>
7689 <br title/ >
7690 <br title=bar />
7691 <br title=bar/>
7692 <br title=bar/ >
7693 !! html/php
7694 <p><br title="title" />
7695 <br title="title" />
7696 <br />
7697 <br title="bar" />
7698 <br title="bar" />
7699 <br title="bar/" />
7700 </p>
7701 !! html/parsoid
7702 <p><br title="" />
7703 <br title="" />
7704 <br title="" />
7705 <br title="bar" />
7706 <br title="bar" />
7707 <br title="bar/" />
7708 </p>
7709 !! end
7710
7711 !! test
7712 Horizontal ruler (should it add that extra space?)
7713 !! wikitext
7714 <hr>
7715 <hr >
7716 foo <hr
7717 > bar
7718 !! html+tidy
7719 <hr />
7720 <hr />
7721 <p>foo</p>
7722 <hr />
7723 <p>bar</p>
7724 !! end
7725
7726 !! test
7727 Horizontal ruler -- 4+ dashes render hr
7728 !! wikitext
7729 ----
7730 !! html
7731 <hr />
7732
7733 !! end
7734
7735 !! test
7736 Horizontal ruler -- eats additional dashes on the same line
7737 !! wikitext
7738 ---------
7739 !! html
7740 <hr />
7741
7742 !! end
7743
7744 !! test
7745 Horizontal ruler -- does not collapse dashes on consecutive lines
7746 !! wikitext
7747 ----
7748 ----
7749 !! html
7750 <hr />
7751 <hr />
7752
7753 !! end
7754
7755 !! test
7756 Horizontal ruler -- <4 dashes render as plain text
7757 !! wikitext
7758 ---
7759 !! html
7760 <p>---
7761 </p>
7762 !! end
7763
7764 !! test
7765 Horizontal ruler -- Supports content following dashes on same line
7766 !! wikitext
7767 ---- Foo
7768 !! html
7769 <hr /> Foo
7770
7771 !! html+tidy
7772 <hr />
7773 <p>Foo</p>
7774 !! end
7775
7776 ###
7777 ### Block-level elements
7778 ###
7779 !! test
7780 Common list
7781 !! wikitext
7782 *Common list
7783 * item 2
7784 *item 3
7785 !! html
7786 <ul><li>Common list</li>
7787 <li> item 2</li>
7788 <li>item 3</li></ul>
7789
7790 !! end
7791
7792 !! test
7793 Numbered list
7794 !! wikitext
7795 #Numbered list
7796 #item 2
7797 # item 3
7798 !! html
7799 <ol><li>Numbered list</li>
7800 <li>item 2</li>
7801 <li> item 3</li></ol>
7802
7803 !! end
7804
7805 !! test
7806 Mixed list
7807 !! wikitext
7808 *Mixed list
7809 *# with numbers
7810 ** and bullets
7811 *# and numbers
7812 *bullets again
7813 **bullet level 2
7814 ***bullet level 3
7815 ***#Number on level 4
7816 **bullet level 2
7817 **#Number on level 3
7818 **#Number on level 3
7819 *#number level 2
7820 *Level 1
7821 *** Level 3
7822 #** Level 3, but ordered
7823 !! html
7824 <ul><li>Mixed list
7825 <ol><li> with numbers</li></ol>
7826 <ul><li> and bullets</li></ul>
7827 <ol><li> and numbers</li></ol></li>
7828 <li>bullets again
7829 <ul><li>bullet level 2
7830 <ul><li>bullet level 3
7831 <ol><li>Number on level 4</li></ol></li></ul></li>
7832 <li>bullet level 2
7833 <ol><li>Number on level 3</li>
7834 <li>Number on level 3</li></ol></li></ul>
7835 <ol><li>number level 2</li></ol></li>
7836 <li>Level 1
7837 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7838 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7839
7840 !! end
7841
7842 !! test
7843 Nested lists 1
7844 !! wikitext
7845 *foo
7846 **bar
7847 !! html
7848 <ul><li>foo
7849 <ul><li>bar</li></ul></li></ul>
7850
7851 !! end
7852
7853 !! test
7854 Nested lists 2
7855 !! wikitext
7856 **foo
7857 *bar
7858 !! html
7859 <ul><li><ul><li>foo</li></ul></li>
7860 <li>bar</li></ul>
7861
7862 !! end
7863
7864 !! test
7865 Nested lists 3 (first element empty)
7866 !! wikitext
7867 *
7868 **bar
7869 !! html
7870 <ul><li>
7871 <ul><li>bar</li></ul></li></ul>
7872
7873 !! end
7874
7875 !! test
7876 Nested lists 4 (first element empty)
7877 !! wikitext
7878 **
7879 *bar
7880 !! html
7881 <ul><li><ul><li></li></ul></li>
7882 <li>bar</li></ul>
7883
7884 !! end
7885
7886 !! test
7887 Nested lists 5 (both elements empty)
7888 !! wikitext
7889 **
7890 *
7891 !! html
7892 <ul><li><ul><li></li></ul></li>
7893 <li></li></ul>
7894
7895 !! end
7896
7897 !! test
7898 Nested lists 6 (both elements empty)
7899 !! wikitext
7900 *
7901 **
7902 !! html
7903 <ul><li>
7904 <ul><li></li></ul></li></ul>
7905
7906 !! end
7907
7908 !! test
7909 Nested lists 7 (skip initial nesting levels)
7910 !! wikitext
7911 *** foo
7912 !! html
7913 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7914
7915 !! end
7916
7917 !! test
7918 Nested lists 8 (multiple nesting transitions)
7919 !! wikitext
7920 * foo
7921 *** bar
7922 ** baz
7923 * boo
7924 !! html
7925 <ul><li> foo
7926 <ul><li><ul><li> bar</li></ul></li>
7927 <li> baz</li></ul></li>
7928 <li> boo</li></ul>
7929
7930 !! end
7931
7932 !! test
7933 1. Lists with start-of-line-transparent tokens before bullets: Comments
7934 !! wikitext
7935 *foo
7936 *<!--cmt-->bar
7937 <!--cmt-->*baz
7938 !! html
7939 <ul><li>foo</li>
7940 <li>bar</li>
7941 <li>baz</li></ul>
7942
7943 !! end
7944
7945 !! test
7946 2. Lists with start-of-line-transparent tokens before bullets: Template close
7947 !! wikitext
7948 *foo {{echo|bar
7949 }}*baz
7950 !! html
7951 <ul><li>foo bar</li>
7952 <li>baz</li></ul>
7953
7954 !! end
7955
7956 !! test
7957 List items are not parsed correctly following a <pre> block (bug 785)
7958 !! wikitext
7959 * <pre>foo</pre>
7960 * <pre>bar</pre>
7961 * zar
7962 !! html
7963 <ul><li> <pre>foo</pre></li>
7964 <li> <pre>bar</pre></li>
7965 <li> zar</li></ul>
7966
7967 !! end
7968
7969 !! test
7970 List items from template
7971 !! wikitext
7972
7973 {{inner list}}
7974 * item 2
7975
7976 * item 0
7977 {{inner list}}
7978 * item 2
7979
7980 * item 0
7981 * notSOL{{inner list}}
7982 * item 2
7983 !! html
7984 <ul><li> item 1</li>
7985 <li> item 2</li></ul>
7986 <ul><li> item 0</li>
7987 <li> item 1</li>
7988 <li> item 2</li></ul>
7989 <ul><li> item 0</li>
7990 <li> notSOL</li>
7991 <li> item 1</li>
7992 <li> item 2</li></ul>
7993
7994 !! end
7995
7996 !! test
7997 List interrupted by empty line or heading
7998 !! wikitext
7999 * foo
8000
8001 ** bar
8002 == A heading ==
8003 * Another list item
8004 !! html
8005 <ul><li> foo</li></ul>
8006 <ul><li><ul><li> bar</li></ul></li></ul>
8007 <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>
8008 <ul><li> Another list item</li></ul>
8009
8010 !!end
8011
8012 !!test
8013 Multiple list tags generated by templates
8014 !! wikitext
8015 {{echo|<li>}}a
8016 {{echo|<li>}}b
8017 {{echo|<li>}}c
8018 !! html
8019 <li>a
8020 <li>b
8021 <li>c</li>
8022 </li>
8023 </li>
8024
8025 !! html+tidy
8026 <ul>
8027 <li>a</li>
8028 <li>b</li>
8029 <li>c</li>
8030 </ul>
8031 !!end
8032
8033 !!test
8034 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8035 !! wikitext
8036 *a
8037 <!--This line will NOT split the list-->
8038 *b
8039 <!--This line will NOT split the list either-->
8040 *c
8041 <!--foo--> <!----> <!--This line NOT split the list either-->
8042 *d
8043 !! html
8044 <ul><li>a</li>
8045 <li>b</li>
8046 <li>c</li>
8047 <li>d</li></ul>
8048
8049 !!end
8050
8051 !!test
8052 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8053 !! wikitext
8054 *a
8055 <!--This line will NOT split the list-->
8056 *b
8057 <!--This line will NOT split the list either-->
8058 *c
8059 <!--foo--> <!----> <!--This line NOT split the list
8060 either-->
8061 *d
8062 !! html
8063 <ul><li>a</li>
8064 <li>b</li>
8065 <li>c</li>
8066 <li>d</li></ul>
8067
8068 !!end
8069
8070 !!test
8071 Test the li-hack
8072 (The PHP parser relies on Tidy for the hack)
8073 !!options
8074 parsoid=wt2html,wt2wt
8075 !! wikitext
8076 * foo
8077 * <li>li-hack
8078 * {{echo|<li>templated li-hack}}
8079 * <!--foo--> <li> unsupported li-hack with preceding comments
8080
8081 <ul>
8082 <li><li>not a li-hack
8083 </li>
8084 </ul>
8085 !! html+tidy
8086 <ul>
8087 <li>foo</li>
8088 <li>li-hack</li>
8089 <li>templated li-hack</li>
8090 <li>unsupported li-hack with preceding comments</li>
8091 </ul>
8092 <ul>
8093 <li>not a li-hack</li>
8094 </ul>
8095 !!end
8096
8097 !! test
8098 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8099 !! options
8100 parsoid
8101 !! wikitext
8102 # foo
8103 ## bar
8104 * foo
8105 ** bar
8106 : foo
8107 :: bar
8108 !! html
8109 <ol>
8110 <li> foo<ol>
8111 <li> bar</li>
8112 </ol></li>
8113 </ol><ul>
8114 <li> foo<ul>
8115 <li> bar</li>
8116 </ul></li>
8117 </ul><dl>
8118 <dd> foo<dl>
8119 <dd> bar</dd>
8120 </dl></dd>
8121 </dl>
8122 !! end
8123
8124 !! test
8125 Parsoid: Test of whitespace serialization with Templated bullets
8126 !! options
8127 parsoid
8128 !! wikitext
8129 * {{bullet}}
8130 !! html
8131 <ul>
8132 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8133 </ul>
8134 !! end
8135
8136 # ------------------------------------------------------------------------
8137 # The next set of tests are about Parsoid's ability to handle badly nested
8138 # tags (parse, minimize scope of fixup, and roundtrip back)
8139 # ------------------------------------------------------------------------
8140
8141 !! test
8142 Unbalanced closing block tags break a list
8143 (php parser relies on Tidy to fix up)
8144 !! wikitext
8145 <div>
8146 *a</div><div>
8147 *b</div>
8148 !! html+tidy
8149 <div>
8150 <ul>
8151 <li>a</li>
8152 </ul>
8153 </div>
8154 <div>
8155 <ul>
8156 <li>b</li>
8157 </ul>
8158 </div>
8159 !! end
8160
8161 # Parsoid fails this test, but it might be tricky to support properly.
8162 # See bug 68395.
8163 !! test
8164 Unbalanced closing non-block tags don't break a list
8165 (php parser relies on Tidy to fix up)
8166 !! wikitext
8167 <span>
8168 *a</span><span>
8169 *b</span>
8170 !! html/php+tidy
8171 <ul>
8172 <li><span>a</span></li>
8173 <li><span>b</span></li>
8174 </ul>
8175 !! html/parsoid
8176 <span>
8177 <ul>
8178 <li>a<span></span>
8179 </li>
8180 <li>b
8181 </li>
8182 </ul>
8183 </span>
8184 !! end
8185
8186 !! test
8187 Unclosed formatting tags that straddle lists are closed and reopened
8188 (php parser relies on Tidy to fix up)
8189 !! options
8190 parsoid=wt2html,wt2wt,html2html
8191 !! wikitext
8192 # <s> a
8193 # b </s>
8194 !! html/php+tidy
8195 <ol>
8196 <li><s>a</s></li>
8197 <li><s>b</s></li>
8198 </ol>
8199 !! html/parsoid
8200 <ol><li> <s> a</s></li>
8201 <li><s> b </s></li></ol>
8202 !! end
8203
8204 # Parsoid fails this test, but it might be tricky to support properly.
8205 # See bug 68395.
8206 !!test
8207 List embedded in a non-block tag
8208 (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
8209 !! wikitext
8210 <small>
8211 * foo
8212 </small>
8213 !! html/php+tidy
8214 <ul>
8215 <li><small>foo</small></li>
8216 </ul>
8217 !! html/parsoid
8218 <small>
8219 <ul>
8220 <li> foo</li>
8221 </ul>
8222 </small>
8223 !!end
8224
8225 # This is a bug in the PHP parser + tidy combination.
8226 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8227 # and then fostered out of the table by tidy.)
8228 # We believe the Parsoid output to be correct.
8229 !! test
8230 Table with missing opening <tr> tag
8231 !! options
8232 parsoid=wt2html,wt2wt
8233 !! wikitext
8234 <table>
8235 <td>foo</td>
8236 </tr>
8237 </table>
8238 !! html/php+tidy
8239 <p>&lt;/tr&gt;</p>
8240 <table>
8241 <tr>
8242 <td>foo</td>
8243 </tr>
8244 </table>
8245 !! html/parsoid
8246 <table>
8247 <tr>
8248 <td>foo</td>
8249 </tr>
8250 </table>
8251 !! end
8252
8253 ###
8254 ### Magic Words
8255 ###
8256
8257 # Note that the current date is hard-coded as
8258 # 1970-01-01T00:02:03Z (a Thursday)
8259 # when running parser tests. The timezone is also fixed to GMT, so
8260 # local date will be identical to current date.
8261
8262 !! test
8263 Magic Word: {{CURRENTDAY}}
8264 !! wikitext
8265 {{CURRENTDAY}}
8266 !! html
8267 <p>1
8268 </p>
8269 !! end
8270
8271 !! test
8272 Magic Word: {{CURRENTDAY2}}
8273 !! wikitext
8274 {{CURRENTDAY2}}
8275 !! html
8276 <p>01
8277 </p>
8278 !! end
8279
8280 !! test
8281 Magic Word: {{CURRENTDAYNAME}}
8282 !! wikitext
8283 {{CURRENTDAYNAME}}
8284 !! html
8285 <p>Thursday
8286 </p>
8287 !! end
8288
8289 !! test
8290 Magic Word: {{CURRENTDOW}}
8291 !! wikitext
8292 {{CURRENTDOW}}
8293 !! html
8294 <p>4
8295 </p>
8296 !! end
8297
8298 !! test
8299 Magic Word: {{CURRENTMONTH}}
8300 !! wikitext
8301 {{CURRENTMONTH}}
8302 !! html
8303 <p>01
8304 </p>
8305 !! end
8306
8307 !! test
8308 Magic Word: {{CURRENTMONTH1}}
8309 !! wikitext
8310 {{CURRENTMONTH1}}
8311 !! html
8312 <p>1
8313 </p>
8314 !! end
8315
8316 !! test
8317 Magic Word: {{CURRENTMONTHABBREV}}
8318 !! wikitext
8319 {{CURRENTMONTHABBREV}}
8320 !! html
8321 <p>Jan
8322 </p>
8323 !! end
8324
8325 !! test
8326 Magic Word: {{CURRENTMONTHNAME}}
8327 !! wikitext
8328 {{CURRENTMONTHNAME}}
8329 !! html
8330 <p>January
8331 </p>
8332 !! end
8333
8334 !! test
8335 Magic Word: {{CURRENTMONTHNAMEGEN}}
8336 !! wikitext
8337 {{CURRENTMONTHNAMEGEN}}
8338 !! html
8339 <p>January
8340 </p>
8341 !! end
8342
8343 !! test
8344 Magic Word: {{CURRENTTIME}}
8345 !! wikitext
8346 {{CURRENTTIME}}
8347 !! html
8348 <p>00:02
8349 </p>
8350 !! end
8351
8352 !! test
8353 Magic Word: {{CURRENTHOUR}}
8354 !! wikitext
8355 {{CURRENTHOUR}}
8356 !! html
8357 <p>00
8358 </p>
8359 !! end
8360
8361 !! test
8362 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8363 !! wikitext
8364 {{CURRENTWEEK}}
8365 !! html
8366 <p>1
8367 </p>
8368 !! end
8369
8370 !! test
8371 Magic Word: {{CURRENTYEAR}}
8372 !! wikitext
8373 {{CURRENTYEAR}}
8374 !! html
8375 <p>1970
8376 </p>
8377 !! end
8378
8379 !! test
8380 Magic Word: {{CURRENTTIMESTAMP}}
8381 !! wikitext
8382 {{CURRENTTIMESTAMP}}
8383 !! html
8384 <p>19700101000203
8385 </p>
8386 !! end
8387
8388 !! test
8389 Magic Words LOCAL (UTC)
8390 !! wikitext
8391 * {{LOCALMONTH}}
8392 * {{LOCALMONTH1}}
8393 * {{LOCALMONTHNAME}}
8394 * {{LOCALMONTHNAMEGEN}}
8395 * {{LOCALMONTHABBREV}}
8396 * {{LOCALDAY}}
8397 * {{LOCALDAY2}}
8398 * {{LOCALDAYNAME}}
8399 * {{LOCALYEAR}}
8400 * {{LOCALTIME}}
8401 * {{LOCALHOUR}}
8402 * {{LOCALWEEK}}
8403 * {{LOCALDOW}}
8404 * {{LOCALTIMESTAMP}}
8405 !! html
8406 <ul><li> 01</li>
8407 <li> 1</li>
8408 <li> January</li>
8409 <li> January</li>
8410 <li> Jan</li>
8411 <li> 1</li>
8412 <li> 01</li>
8413 <li> Thursday</li>
8414 <li> 1970</li>
8415 <li> 00:02</li>
8416 <li> 00</li>
8417 <li> 1</li>
8418 <li> 4</li>
8419 <li> 19700101000203</li></ul>
8420
8421 !! end
8422
8423 !! test
8424 Magic Word: {{FULLPAGENAME}}
8425 !! options
8426 title=[[User:Ævar Arnfjörð Bjarmason]]
8427 !! wikitext
8428 {{FULLPAGENAME}}
8429 !! html
8430 <p>User:Ævar Arnfjörð Bjarmason
8431 </p>
8432 !! end
8433
8434 !! test
8435 Magic Word: {{FULLPAGENAMEE}}
8436 !! options
8437 title=[[User:Ævar Arnfjörð Bjarmason]]
8438 !! wikitext
8439 {{FULLPAGENAMEE}}
8440 !! html
8441 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8442 </p>
8443 !! end
8444
8445 !! test
8446 Magic Word: {{TALKSPACE}}
8447 !! options
8448 title=[[User:Ævar Arnfjörð Bjarmason]]
8449 !! wikitext
8450 {{TALKSPACE}}
8451 !! html
8452 <p>User talk
8453 </p>
8454 !! end
8455
8456 !! test
8457 Magic Word: {{TALKSPACE}}, same namespace
8458 !! options
8459 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8460 !! wikitext
8461 {{TALKSPACE}}
8462 !! html
8463 <p>User talk
8464 </p>
8465 !! end
8466
8467 !! test
8468 Magic Word: {{TALKSPACE}}, main namespace
8469 !! options
8470 title=[[Parser Test]]
8471 !! wikitext
8472 {{TALKSPACE}}
8473 !! html
8474 <p>Talk
8475 </p>
8476 !! end
8477
8478 !! test
8479 Magic Word: {{TALKSPACEE}}
8480 !! options
8481 title=[[User:Ævar Arnfjörð Bjarmason]]
8482 !! wikitext
8483 {{TALKSPACEE}}
8484 !! html
8485 <p>User_talk
8486 </p>
8487 !! end
8488
8489 !! test
8490 Magic Word: {{SUBJECTSPACE}}
8491 !! options
8492 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8493 !! wikitext
8494 {{SUBJECTSPACE}}
8495 !! html
8496 <p>User
8497 </p>
8498 !! end
8499
8500 !! test
8501 Magic Word: {{SUBJECTSPACE}}, same namespace
8502 !! options
8503 title=[[User:Ævar Arnfjörð Bjarmason]]
8504 !! wikitext
8505 {{SUBJECTSPACE}}
8506 !! html
8507 <p>User
8508 </p>
8509 !! end
8510
8511 !! test
8512 Magic Word: {{SUBJECTSPACE}}, main namespace
8513 !! options
8514 title=[[Parser Test]]
8515 !! wikitext
8516 {{SUBJECTSPACE}}
8517 !! html
8518
8519 !! end
8520
8521 !! test
8522 Magic Word: {{SUBJECTSPACEE}}
8523 !! options
8524 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8525 !! wikitext
8526 {{SUBJECTSPACEE}}
8527 !! html
8528 <p>User
8529 </p>
8530 !! end
8531
8532 !! test
8533 Magic Word: {{NAMESPACE}}
8534 !! options
8535 title=[[User:Ævar Arnfjörð Bjarmason]]
8536 !! wikitext
8537 {{NAMESPACE}}
8538 !! html
8539 <p>User
8540 </p>
8541 !! end
8542
8543 !! test
8544 Magic Word: {{NAMESPACEE}}
8545 !! options
8546 title=[[User:Ævar Arnfjörð Bjarmason]]
8547 !! wikitext
8548 {{NAMESPACEE}}
8549 !! html
8550 <p>User
8551 </p>
8552 !! end
8553
8554 !! test
8555 Magic Word: {{NAMESPACENUMBER}}
8556 !! options
8557 title=[[User:Ævar Arnfjörð Bjarmason]]
8558 !! wikitext
8559 {{NAMESPACENUMBER}}
8560 !! html
8561 <p>2
8562 </p>
8563 !! end
8564
8565 !! test
8566 Magic Word: {{SUBPAGENAME}}
8567 !! options
8568 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8569 !! wikitext
8570 {{SUBPAGENAME}}
8571 !! html
8572 <p>sub ö
8573 </p>
8574 !! end
8575
8576 !! test
8577 Magic Word: {{SUBPAGENAMEE}}
8578 !! options
8579 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8580 !! wikitext
8581 {{SUBPAGENAMEE}}
8582 !! html
8583 <p>sub_%C3%B6
8584 </p>
8585 !! end
8586
8587 !! test
8588 Magic Word: {{ROOTPAGENAME}}
8589 !! options
8590 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8591 !! wikitext
8592 {{ROOTPAGENAME}}
8593 !! html
8594 <p>Ævar Arnfjörð Bjarmason
8595 </p>
8596 !! end
8597
8598 !! test
8599 Magic Word: {{ROOTPAGENAMEE}}
8600 !! options
8601 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8602 !! wikitext
8603 {{ROOTPAGENAMEE}}
8604 !! html
8605 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8606 </p>
8607 !! end
8608
8609 !! test
8610 Magic Word: {{BASEPAGENAME}}
8611 !! options
8612 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8613 !! wikitext
8614 {{BASEPAGENAME}}
8615 !! html
8616 <p>Ævar Arnfjörð Bjarmason
8617 </p>
8618 !! end
8619
8620 !! test
8621 Magic Word: {{BASEPAGENAMEE}}
8622 !! options
8623 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8624 !! wikitext
8625 {{BASEPAGENAMEE}}
8626 !! html
8627 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8628 </p>
8629 !! end
8630
8631 !! test
8632 Magic Word: {{TALKPAGENAME}}
8633 !! options
8634 title=[[User:Ævar Arnfjörð Bjarmason]]
8635 !! wikitext
8636 {{TALKPAGENAME}}
8637 !! html
8638 <p>User talk:Ævar Arnfjörð Bjarmason
8639 </p>
8640 !! end
8641
8642 !! test
8643 Magic Word: {{TALKPAGENAMEE}}
8644 !! options
8645 title=[[User:Ævar Arnfjörð Bjarmason]]
8646 !! wikitext
8647 {{TALKPAGENAMEE}}
8648 !! html
8649 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8650 </p>
8651 !! end
8652
8653 !! test
8654 Magic Word: {{SUBJECTPAGENAME}}
8655 !! options
8656 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8657 !! wikitext
8658 {{SUBJECTPAGENAME}}
8659 !! html
8660 <p>User:Ævar Arnfjörð Bjarmason
8661 </p>
8662 !! end
8663
8664 !! test
8665 Magic Word: {{SUBJECTPAGENAMEE}}
8666 !! options
8667 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8668 !! wikitext
8669 {{SUBJECTPAGENAMEE}}
8670 !! html
8671 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8672 </p>
8673 !! end
8674
8675 !! test
8676 Magic Word: {{NUMBEROFFILES}}
8677 !! wikitext
8678 {{NUMBEROFFILES}}
8679 !! html
8680 <p>5
8681 </p>
8682 !! end
8683
8684 !! test
8685 Magic Word: {{PAGENAME}}
8686 !! options
8687 title=[[User:Ævar Arnfjörð Bjarmason]]
8688 !! wikitext
8689 {{PAGENAME}}
8690 !! html
8691 <p>Ævar Arnfjörð Bjarmason
8692 </p>
8693 !! end
8694
8695 !! test
8696 Magic Word: {{PAGENAME}} with metacharacters
8697 !! options
8698 title=[['foo & bar = baz']]
8699 !! wikitext
8700 ''{{PAGENAME}}''
8701 !! html/php
8702 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8703 </p>
8704 !! html+tidy
8705 <p><i>'foo &amp; bar = baz'</i></p>
8706 !! end
8707
8708 !! test
8709 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8710 !! options
8711 title=[[*RFC 1234 http://example.com/]]
8712 !! wikitext
8713 {{PAGENAME}}
8714 !! html/php
8715 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8716 </p>
8717 !! html+tidy
8718 <p>*RFC 1234 http://example.com/</p>
8719 !! end
8720
8721 !! test
8722 Magic Word: {{PAGENAMEE}}
8723 !! options
8724 title=[[User:Ævar Arnfjörð Bjarmason]]
8725 !! wikitext
8726 {{PAGENAMEE}}
8727 !! html
8728 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8729 </p>
8730 !! end
8731
8732 !! test
8733 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8734 !! options
8735 title=[[*RFC 1234 http://example.com/]]
8736 !! wikitext
8737 {{PAGENAMEE}}
8738 !! html/php
8739 <p>&#42;RFC_1234_http&#58;//example.com/
8740 </p>
8741 !! html+tidy
8742 <p>*RFC_1234_http://example.com/</p>
8743 !! end
8744
8745 !! test
8746 Magic Word: {{REVISIONID}}
8747 !! wikitext
8748 {{REVISIONID}}
8749 !! html
8750 <p>1337
8751 </p>
8752 !! end
8753
8754 !! test
8755 Magic Word: {{SCRIPTPATH}}
8756 !! wikitext
8757 {{SCRIPTPATH}}
8758 !! html
8759 <p>/
8760 </p>
8761 !! end
8762
8763 !! test
8764 Magic Word: {{STYLEPATH}}
8765 !! wikitext
8766 {{STYLEPATH}}
8767 !! html
8768 <p>/skins
8769 </p>
8770 !! end
8771
8772 !! test
8773 Magic Word: {{SERVER}}
8774 !! wikitext
8775 {{SERVER}}
8776 !! html
8777 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8778 </p>
8779 !! end
8780
8781 !! test
8782 Magic Word: {{SERVERNAME}}
8783 !! wikitext
8784 {{SERVERNAME}}
8785 !! html
8786 <p>example.org
8787 </p>
8788 !! end
8789
8790 !! test
8791 Magic Word: {{SITENAME}}
8792 !! wikitext
8793 {{SITENAME}}
8794 !! html
8795 <p>MediaWiki
8796 </p>
8797 !! end
8798
8799 !! test
8800 Case-sensitive magic words, when cased differently, should just be template transclusions
8801 !! wikitext
8802 {{CurrentMonth}}
8803 {{currentday}}
8804 {{cURreNTweEK}}
8805 {{currentHour}}
8806 !! html
8807 <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>
8808 <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>
8809 <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>
8810 <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>
8811 </p>
8812 !! end
8813
8814 !! test
8815 Case-insensitive magic words should still work with weird casing.
8816 !! wikitext
8817 {{sErVeRNaMe}}
8818 {{LCFirst:AOEU}}
8819 {{ucFIRST:aoeu}}
8820 {{SERver}}
8821 !! html
8822 <p>example.org
8823 aOEU
8824 Aoeu
8825 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8826 </p>
8827 !! end
8828
8829 # From plwiki:PLOS_ONE
8830 !! test
8831 Parsoid: Page property magic word with magic word contents
8832 !! options
8833 parsoid
8834 !! wikitext
8835 {{DISPLAYTITLE:''{{PAGENAME}}''}}
8836 !! html
8837 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=\"{&amp;quot;dsr&amp;quot;:[15,31,2,2]}\">&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[17,29,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;PAGENAME&amp;quot;,&amp;quot;function&amp;quot;:&amp;quot;pagename&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">Main Page&lt;/span>&lt;/i>"}]]}'/>
8838 !! end
8839
8840 !! test
8841 Namespace 1 {{ns:1}}
8842 !! wikitext
8843 {{ns:1}}
8844 !! html
8845 <p>Talk
8846 </p>
8847 !! end
8848
8849 !! test
8850 Namespace 1 {{ns:01}}
8851 !! wikitext
8852 {{ns:01}}
8853 !! html
8854 <p>Talk
8855 </p>
8856 !! end
8857
8858 !! test
8859 Namespace 0 {{ns:0}} (bug 4783)
8860 !! wikitext
8861 {{ns:0}}
8862 !! html
8863
8864 !! end
8865
8866 !! test
8867 Namespace 0 {{ns:00}} (bug 4783)
8868 !! wikitext
8869 {{ns:00}}
8870 !! html
8871
8872 !! end
8873
8874 !! test
8875 Namespace -1 {{ns:-1}}
8876 !! wikitext
8877 {{ns:-1}}
8878 !! html
8879 <p>Special
8880 </p>
8881 !! end
8882
8883 !! test
8884 Namespace User {{ns:User}}
8885 !! wikitext
8886 {{ns:User}}
8887 !! html
8888 <p>User
8889 </p>
8890 !! end
8891
8892 !! test
8893 Namespace User talk {{ns:User_talk}}
8894 !! wikitext
8895 {{ns:User_talk}}
8896 !! html
8897 <p>User talk
8898 </p>
8899 !! end
8900
8901 !! test
8902 Namespace User talk {{ns:uSeR tAlK}}
8903 !! wikitext
8904 {{ns:uSeR tAlK}}
8905 !! html
8906 <p>User talk
8907 </p>
8908 !! end
8909
8910 !! test
8911 Namespace File {{ns:File}}
8912 !! wikitext
8913 {{ns:File}}
8914 !! html
8915 <p>File
8916 </p>
8917 !! end
8918
8919 !! test
8920 Namespace File {{ns:Image}}
8921 !! wikitext
8922 {{ns:Image}}
8923 !! html
8924 <p>File
8925 </p>
8926 !! end
8927
8928 !! test
8929 Namespace (lang=de) Benutzer {{ns:User}}
8930 !! options
8931 language=de
8932 !! wikitext
8933 {{ns:User}}
8934 !! html
8935 <p>Benutzer
8936 </p>
8937 !! end
8938
8939 !! test
8940 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
8941 !! options
8942 language=de
8943 !! wikitext
8944 {{ns:3}}
8945 !! html
8946 <p>Benutzer Diskussion
8947 </p>
8948 !! end
8949
8950
8951 !! test
8952 Urlencode
8953 !! wikitext
8954 {{urlencode:hi world?!}}
8955 {{urlencode:hi world?!|WIKI}}
8956 {{urlencode:hi world?!|PATH}}
8957 {{urlencode:hi world?!|QUERY}}
8958 !! html
8959 <p>hi+world%3F%21
8960 hi_world%3F!
8961 hi%20world%3F%21
8962 hi+world%3F%21
8963 </p>
8964 !! end
8965
8966 !! test
8967 Magic Word: prioritize type info over data-parsoid
8968 !! options
8969 parsoid=html2wt
8970 !! html
8971 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
8972 !! wikitext
8973 __FORCETOC__
8974 !! end
8975
8976 !! test
8977 Magic Word: serialize on separate line (parsoid)
8978 !! options
8979 parsoid=wt2wt,html2wt
8980 !! wikitext
8981 foo
8982 __NOTOC__
8983 bar
8984 !! html
8985 foo<meta property="mw:PageProp/notoc"/>bar
8986 !! end
8987
8988 !! test
8989 Magic Word: rt non-english wikis
8990 !! options
8991 parsoid=wt2wt
8992 language=de
8993 !! wikitext
8994 __NOEDITSECTION__
8995 !! html
8996 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
8997 !! end
8998
8999 ###
9000 ### Magic links
9001 ###
9002 !! test
9003 Magic links: internal link to RFC (bug 479)
9004 !! wikitext
9005 [[RFC 123]]
9006 !! html
9007 <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>
9008 </p>
9009 !! end
9010
9011 !! test
9012 Magic links: RFC (bug 479)
9013 !! wikitext
9014 RFC 822
9015 !! html
9016 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9017 </p>
9018 !! end
9019
9020 !! test
9021 Magic links: RFC (bug 65278)
9022 !! wikitext
9023 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9024 !! html
9025 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
9026 </p>
9027 !! end
9028
9029 !! test
9030 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9031 !! wikitext
9032 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9033 RFC
9034 822
9035 !! html
9036 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9037 RFC
9038 822
9039 </p>
9040 !! end
9041
9042 !! test
9043 Magic links: ISBN (bug 1937)
9044 !! wikitext
9045 ISBN 0-306-40615-2
9046 !! html
9047 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9048 </p>
9049 !! end
9050
9051 !! test
9052 Magic links: ISBN (bug 65278)
9053 !! wikitext
9054 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9055 !! html/php
9056 <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9057 </p>
9058 !! html/parsoid
9059 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:ExtLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
9060 !! end
9061
9062 !! test
9063 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9064 !! wikitext
9065 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9066 ISBN
9067 9780316098113
9068 ISBN 978
9069 0316098113
9070 !! html
9071 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9072 ISBN
9073 9780316098113
9074 ISBN 978
9075 0316098113
9076 </p>
9077 !! end
9078
9079 !! test
9080 Magic links: PMID incorrectly converts space to underscore
9081 !! wikitext
9082 PMID 1234
9083 !! html
9084 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9085 </p>
9086 !! end
9087
9088 !! test
9089 Magic links: PMID (bug 65278)
9090 !! wikitext
9091 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9092 !! html
9093 <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
9094 </p>
9095 !! end
9096
9097 !! test
9098 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9099 !! wikitext
9100 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9101 PMID
9102 1234
9103 !! html
9104 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9105 PMID
9106 1234
9107 </p>
9108 !! end
9109
9110 ###
9111 ### Templates
9112 ####
9113
9114 !! test
9115 Nonexistent template
9116 !! wikitext
9117 {{thistemplatedoesnotexist}}
9118 !! html
9119 <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>
9120 </p>
9121 !! end
9122
9123 !! test
9124 Template with invalid target containing tags
9125 !! wikitext
9126 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9127 !! html
9128 <p>{{a<b>b</b>|foo|a=b|a = b}}
9129 </p>
9130 !! end
9131
9132 !! test
9133 Template with invalid target containing unclosed tag
9134 !! wikitext
9135 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9136 !! html
9137 <p>{{a<b>|foo|a=b|a = b}}</b>
9138 </p>
9139 !! end
9140
9141 !! test
9142 Template with invalid target containing wikilink
9143 !! wikitext
9144 {{[[Main Page]]}}
9145 !! html/php
9146 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
9147 </p>
9148 !! html/parsoid
9149 <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>
9150 !! end
9151
9152 !! test
9153 Template with just whitespace in it, bug #68421
9154 !! wikitext
9155 {{echo|{{ }}}}
9156 !! html/parsoid
9157 <p><span typeof="mw:Transclusion mw:Nowiki" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</span></p>
9158 !! end
9159
9160 !! article
9161 Template:test
9162 !! text
9163 This is a test template
9164 !! endarticle
9165
9166 !! test
9167 Simple template
9168 !! wikitext
9169 {{test}}
9170 !! html
9171 <p>This is a test template
9172 </p>
9173 !! end
9174
9175 !! test
9176 Template with explicit namespace
9177 !! wikitext
9178 {{Template:test}}
9179 !! html
9180 <p>This is a test template
9181 </p>
9182 !! end
9183
9184
9185 !! article
9186 Template:paramtest
9187 !! text
9188 This is a test template with parameter {{{param}}}
9189 !! endarticle
9190
9191 !! test
9192 Template parameter
9193 !! wikitext
9194 {{paramtest|param=foo}}
9195 !! html
9196 <p>This is a test template with parameter foo
9197 </p>
9198 !! end
9199
9200 !! article
9201 Template:paramtestnum
9202 !! text
9203 [[{{{1}}}|{{{2}}}]]
9204 !! endarticle
9205
9206 !! test
9207 Template unnamed parameter
9208 !! wikitext
9209 {{paramtestnum|Main Page|the main page}}
9210 !! html
9211 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9212 </p>
9213 !! end
9214
9215 !! article
9216 Template:templatesimple
9217 !! text
9218 (test)
9219 !! endarticle
9220
9221 !! article
9222 Template:templateredirect
9223 !! text
9224 #redirect [[Template:templatesimple]]
9225 !! endarticle
9226
9227 !! article
9228 Template:templateasargtestnum
9229 !! text
9230 {{{{{1}}}}}
9231 !! endarticle
9232
9233 !! article
9234 Template:templateasargtest
9235 !! text
9236 {{template{{{templ}}}}}
9237 !! endarticle
9238
9239 !! article
9240 Template:templateasargtest2
9241 !! text
9242 {{{{{templ}}}}}
9243 !! endarticle
9244
9245 !! test
9246 Template with template name as unnamed argument
9247 !! wikitext
9248 {{templateasargtestnum|templatesimple}}
9249 !! html
9250 <p>(test)
9251 </p>
9252 !! end
9253
9254 !! test
9255 Template with template name as argument
9256 !! wikitext
9257 {{templateasargtest|templ=simple}}
9258 !! html
9259 <p>(test)
9260 </p>
9261 !! end
9262
9263 !! test
9264 Template with template name as argument (2)
9265 !! wikitext
9266 {{templateasargtest2|templ=templatesimple}}
9267 !! html
9268 <p>(test)
9269 </p>
9270 !! end
9271
9272 !! article
9273 Template:templateasargtestdefault
9274 !! text
9275 {{{{{templ|templatesimple}}}}}
9276 !! endarticle
9277
9278 !! article
9279 Template:templa
9280 !! text
9281 '''templ'''
9282 !! endarticle
9283
9284 !! test
9285 Template with default value
9286 !! wikitext
9287 {{templateasargtestdefault}}
9288 !! html
9289 <p>(test)
9290 </p>
9291 !! end
9292
9293 !! test
9294 Template with default value (value set)
9295 !! wikitext
9296 {{templateasargtestdefault|templ=templa}}
9297 !! html
9298 <p><b>templ</b>
9299 </p>
9300 !! end
9301
9302 !! test
9303 Template redirect
9304 !! wikitext
9305 {{templateredirect}}
9306 !! html
9307 <p>(test)
9308 </p>
9309 !! end
9310
9311 !! test
9312 Template with argument in separate line
9313 !! wikitext
9314 {{ templateasargtest |
9315 templ = simple }}
9316 !! html
9317 <p>(test)
9318 </p>
9319 !! end
9320
9321 !! test
9322 Template with complex template as argument
9323 !! wikitext
9324 {{paramtest|
9325 param ={{ templateasargtest |
9326 templ = simple }}}}
9327 !! html
9328 <p>This is a test template with parameter (test)
9329 </p>
9330 !! end
9331
9332 !! test
9333 Template with thumb image (with link in description)
9334 !! wikitext
9335 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9336 !! html/php
9337 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>
9338
9339 !! html+tidy
9340 <p>This is a test template with parameter</p>
9341 <div class="thumb tright">
9342 <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>
9343 <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>
9344 </div>
9345 </div>
9346 !! html/parsoid
9347 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
9348 !! end
9349
9350 !! article
9351 Template:complextemplate
9352 !! text
9353 {{{1}}} {{paramtest|
9354 param ={{{param}}}}}
9355 !! endarticle
9356
9357 !! test
9358 Template with complex arguments
9359 !! wikitext
9360 {{complextemplate|
9361 param ={{ templateasargtest |
9362 templ = simple }}|[[Template:complextemplate|link]]}}
9363 !! html
9364 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
9365 </p>
9366 !! end
9367
9368 !! test
9369 BUG 553: link with two variables in a piped link
9370 !! wikitext
9371 {|
9372 |[[{{{1}}}|{{{2}}}]]
9373 |}
9374 !! html
9375 <table>
9376 <tr>
9377 <td>[[{{{1}}}|{{{2}}}]]
9378 </td></tr></table>
9379
9380 !! end
9381
9382 !! test
9383 Magic variable as template parameter
9384 !! wikitext
9385 {{paramtest|param={{SITENAME}}}}
9386 !! html
9387 <p>This is a test template with parameter MediaWiki
9388 </p>
9389 !! end
9390
9391 !! article
9392 Template:linktest
9393 !! text
9394 [[{{{param}}}|link]]
9395 !! endarticle
9396
9397 !! test
9398 Template parameter as link source
9399 !! wikitext
9400 {{linktest|param=Main Page}}
9401 !! html
9402 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
9403 </p>
9404 !! end
9405
9406 !!article
9407 Template:paramtest2
9408 !! text
9409 including another template, {{paramtest|param={{{arg}}}}}
9410 !! endarticle
9411
9412 !! test
9413 Template passing argument to another template
9414 !! wikitext
9415 {{paramtest2|arg='hmm'}}
9416 !! html
9417 <p>including another template, This is a test template with parameter 'hmm'
9418 </p>
9419 !! end
9420
9421 !! article
9422 Template:Linktest2
9423 !! text
9424 Main Page
9425 !! endarticle
9426
9427 !! test
9428 Template as link source
9429 !! wikitext
9430 [[{{linktest2}}]]
9431
9432 [[{{linktest2}}|Main Page]]
9433
9434 [[{{linktest2}}]]Page
9435 !! html
9436 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9437 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9438 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
9439 </p>
9440 !! end
9441
9442
9443 !! article
9444 Template:loop1
9445 !! text
9446 {{loop2}}
9447 !! endarticle
9448
9449 !! article
9450 Template:loop2
9451 !! text
9452 {{loop1}}
9453 !! endarticle
9454
9455 !! test
9456 Template infinite loop
9457 !! wikitext
9458 {{loop1}}
9459 !! html
9460 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
9461 </p>
9462 !! end
9463
9464 !! test
9465 Template from main namespace
9466 !! wikitext
9467 {{:Main Page}}
9468 !! html
9469 <p>blah blah
9470 </p>
9471 !! end
9472
9473 !! article
9474 Template:table
9475 !! text
9476 {|
9477 | 1 || 2
9478 |-
9479 | 3 || 4
9480 |}
9481 !! endarticle
9482
9483 !! test
9484 BUG 529: Template with table, not included at beginning of line
9485 !! wikitext
9486 foo {{table}}
9487 !! html
9488 <p>foo
9489 </p>
9490 <table>
9491 <tr>
9492 <td> 1 </td>
9493 <td> 2
9494 </td></tr>
9495 <tr>
9496 <td> 3 </td>
9497 <td> 4
9498 </td></tr></table>
9499
9500 !! end
9501
9502 !! test
9503 BUG 523: Template shouldn't eat newline (or add an extra one before table)
9504 !! wikitext
9505 foo
9506 {{table}}
9507 !! html
9508 <p>foo
9509 </p>
9510 <table>
9511 <tr>
9512 <td> 1 </td>
9513 <td> 2
9514 </td></tr>
9515 <tr>
9516 <td> 3 </td>
9517 <td> 4
9518 </td></tr></table>
9519
9520 !! end
9521
9522 !! test
9523 BUG 41: Template parameters shown as broken links
9524 !! wikitext
9525 {{{parameter}}}
9526 !! html
9527 <p>{{{parameter}}}
9528 </p>
9529 !! end
9530
9531 !! test
9532 Template with targets containing wikilinks
9533 !! wikitext
9534 {{[[foo]]}}
9535
9536 {{[[{{echo|foo}}]]}}
9537
9538 {{{{echo|[[foo}}]]}}
9539 !! html
9540 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9541 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9542 </p><p>{{[[foo}}]]
9543 </p>
9544 !! end
9545
9546 !! article
9547 Template:MSGNW test
9548 !! text
9549 ''None'' of '''this''' should be
9550 * interpreted
9551 but rather passed unmodified
9552 {{test}}
9553 <gallery>
9554 File:Foobar.jpg
9555 </gallery>
9556 !! endarticle
9557
9558 # hmm, fix this or just deprecate msgnw and document its behavior?
9559 !! test
9560 msgnw keyword
9561 !! wikitext
9562 {{msgnw:MSGNW test}}
9563 !! html
9564 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
9565 &#42; interpreted
9566 &#32;but rather passed unmodified
9567 &#123;&#123;test&#125;&#125;
9568 &#60;gallery&#62;
9569 File:Foobar.jpg
9570 &#60;/gallery&#62;
9571 </p>
9572 !! end
9573
9574 !! test
9575 int keyword
9576 !! wikitext
9577 {{int:youhavenewmessages|lots of money|not!}}
9578 !! html
9579 <p>You have lots of money (not!).
9580 </p>
9581 !! end
9582
9583 !! article
9584 Template:Includes
9585 !! text
9586 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9587 !! endarticle
9588
9589 !! test
9590 <includeonly> and <noinclude> being included
9591 !! wikitext
9592 {{Includes}}
9593 !! html
9594 <p>Foobar
9595 </p>
9596 !! end
9597
9598 !! article
9599 Template:Includes2
9600 !! text
9601 <onlyinclude>Foo</onlyinclude>bar
9602 !! endarticle
9603
9604 !! test
9605 <onlyinclude> being included
9606 !! wikitext
9607 {{Includes2}}
9608 !! html
9609 <p>Foo
9610 </p>
9611 !! end
9612
9613
9614 !! article
9615 Template:Includes3
9616 !! text
9617 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9618 !! endarticle
9619
9620 !! test
9621 <onlyinclude> and <includeonly> being included
9622 !! wikitext
9623 {{Includes3}}
9624 !! html
9625 <p>Foo
9626 </p>
9627 !! end
9628
9629 !! test
9630 <includeonly> and <noinclude> on a page
9631 !! wikitext
9632 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9633 !! html
9634 <p>Foozar
9635 </p>
9636 !! end
9637
9638 !! test
9639 Un-closed <noinclude>
9640 !! wikitext
9641 <noinclude>
9642 !! html
9643 !! end
9644
9645 !! test
9646 <onlyinclude> on a page
9647 !! wikitext
9648 <onlyinclude>Foo</onlyinclude>bar
9649 !! html
9650 <p>Foobar
9651 </p>
9652 !! end
9653
9654 !! test
9655 Un-closed <onlyinclude>
9656 !! wikitext
9657 <onlyinclude>
9658 !! html
9659 !! end
9660
9661 !!test
9662 Self-closed noinclude, includeonly, onlyinclude tags
9663 !! wikitext
9664 <noinclude />
9665 <includeonly />
9666 <onlyinclude />
9667 !! html
9668 <p><br />
9669 </p>
9670 !!end
9671
9672 !!test
9673 Unbalanced includeonly and noinclude tags
9674 !! wikitext
9675 {|
9676 |a</noinclude>
9677 |b</noinclude></noinclude>
9678 |c</noinclude></includeonly>
9679 |d</includeonly></includeonly>
9680 |}
9681 !! html
9682 <table>
9683 <tr>
9684 <td>a
9685 </td>
9686 <td>b
9687 </td>
9688 <td>c&lt;/includeonly&gt;
9689 </td>
9690 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9691 </td></tr></table>
9692
9693 !!end
9694
9695 !! article
9696 Template:Includeonly section
9697 !! text
9698 <includeonly>
9699 ==Includeonly section==
9700 </includeonly>
9701 ==Section T-1==
9702 !!endarticle
9703
9704 !! test
9705 Bug 6563: Edit link generation for section shown by <includeonly>
9706 !! wikitext
9707 {{includeonly section}}
9708 !! html
9709 <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>
9710 <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>
9711
9712 !! end
9713
9714 # Uses same input as the contents of [[Template:Includeonly section]]
9715 !! test
9716 Bug 6563: Section extraction for section shown by <includeonly>
9717 !! options
9718 section=T-2
9719 !! wikitext
9720 <includeonly>
9721 ==Includeonly section==
9722 </includeonly>
9723 ==Section T-2==
9724 !! html
9725 ==Section T-2==
9726 !! end
9727
9728 !! test
9729 Bug 6563: Edit link generation for section suppressed by <includeonly>
9730 !! wikitext
9731 <includeonly>
9732 ==Includeonly section==
9733 </includeonly>
9734 ==Section 1==
9735 !! html
9736 <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>
9737
9738 !! end
9739
9740 !! test
9741 Bug 6563: Section extraction for section suppressed by <includeonly>
9742 !! options
9743 section=1
9744 !! wikitext
9745 <includeonly>
9746 ==Includeonly section==
9747 </includeonly>
9748 ==Section 1==
9749 !! html
9750 ==Section 1==
9751 !! end
9752
9753 !! test
9754 Un-closed <includeonly>
9755 !! wikitext
9756 <includeonly>
9757 !! html
9758 !! end
9759
9760 !! test
9761 Includes and comments at SOL
9762 !! wikitext
9763 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
9764
9765 <noinclude>
9766 some
9767 </noinclude>* stuff
9768 * here
9769
9770 <includeonly>can have stuff</includeonly>=== here ===
9771
9772 !! html/php
9773 <h2><span class="mw-headline" id="hu">hu</span></h2>
9774 <p>some
9775 </p>
9776 <ul><li> stuff</li>
9777 <li> here</li></ul>
9778 <h3><span class="mw-headline" id="here">here</span></h3>
9779
9780 !! html/parsoid
9781 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment --><h2> hu </h2>
9782
9783 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
9784 <p>some</p>
9785 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
9786 <li> here</li></ul>
9787
9788 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3> here </h3>
9789
9790 !! end
9791
9792 # TODO: test with DOM fragment reuse!
9793 !! test
9794 Parsoid: DOM fragment reuse
9795 !! options
9796 parsoid=wt2wt,wt2html
9797 !! wikitext
9798 a{{echo|b<table></table>c}}d
9799
9800 a{{echo|b
9801 <table></table>
9802 c}}d
9803
9804 {{echo|a
9805
9806 <table></table>
9807
9808 b}}
9809 !! html
9810 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
9811
9812 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>ab</p><span about="#mwt2">
9813 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
9814 </span><p about="#mwt2">cd</p>
9815
9816 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>a</p><span about="#mwt3">
9817
9818 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
9819
9820 </span><p about="#mwt3">b</p>
9821 !! end
9822
9823 !! test
9824 Parsoid: Merge double tds (bug 50603)
9825 !! options
9826 parsoid
9827 !! wikitext
9828 {|
9829 |{{echo|{{!}} foo}}
9830 |}
9831 !! html
9832 <table><tbody>
9833 <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>
9834 </tbody></table>
9835 !! end
9836
9837 !! test
9838 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9839 !! options
9840 parsoid
9841 !! wikitext
9842 {{echo|<div>}}
9843 {|
9844 |{{echo|{{!}} foo}}
9845 |}
9846 {{echo|</div>}}
9847 !! html
9848 <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}}]}'>
9849 <table><tbody>
9850 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9851 </tbody></table>
9852 </div>
9853 !! end
9854
9855 ###
9856 ### <includeonly> and <noinclude> in attributes
9857 ###
9858 !!test
9859 0. includeonly around the entire attribute
9860 !! wikitext
9861 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9862 !! html
9863 <p><span id="v2">bar</span>
9864 </p>
9865 !!end
9866
9867 !!test
9868 1. includeonly in html attr key
9869 !! wikitext
9870 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9871 !! html
9872 <p><span id="foo">bar</span>
9873 </p>
9874 !!end
9875
9876 !!test
9877 2. includeonly in html attr value
9878 !! wikitext
9879 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9880 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9881 !! html
9882 <p><span id="v1">bar</span>
9883 <span id="v1">bar</span>
9884 </p>
9885 !!end
9886
9887 !!test
9888 3. includeonly in part of an attr value
9889 !! wikitext
9890 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9891 !! html
9892 <p><span style="color:red;">bar</span>
9893 </p>
9894 !!end
9895
9896 !!test
9897 4. includeonly in table attributes
9898 !! wikitext
9899 {|
9900 |- <noinclude>
9901 |-
9902 |a
9903 </noinclude>
9904 |- <includeonly>
9905 |-
9906 |b
9907 </includeonly>
9908 |}
9909 !! html
9910 <table>
9911
9912
9913 <tr>
9914 <td>a
9915 </td></tr>
9916 </table>
9917
9918 !!end
9919
9920 ###
9921 ### Token Stream Patcher tests
9922 ###
9923 ### These tests won't always pass wt2wt and other modes because
9924 ### on serialization, the table will be output on a new line.
9925 ### For now, we are blacklisting them, and using this to test selser.
9926 ###
9927
9928 !!test
9929 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
9930 !!options
9931 parsoid=wt2html,wt2wt
9932 !!wikitext
9933 {{echo|}}{| width = '100%'
9934 |foo
9935 |}
9936 !!html/parsoid
9937 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
9938 <tbody><tr><td>foo</td></tr>
9939 </tbody></table>
9940 !!end
9941
9942 !!test
9943 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
9944 !!options
9945 parsoid=wt2html,wt2wt
9946 !!wikitext
9947 <includeonly>a</includeonly>{| {{{b}}}
9948 |c
9949 |}
9950 !!html/parsoid
9951 <meta typeof="mw:Includes/IncludeOnly"/><meta typeof="mw:Includes/IncludeOnly/End"/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[31,38,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{b}}}&amp;quot;}\">{{{b}}}&lt;/span>"},{"html":""}]]}' data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}'>
9952 <tbody><tr><td>c</td></tr>
9953 </tbody></table>
9954
9955 !!end
9956
9957 ###
9958 ### Testing parsing of templates where a template arg
9959 ### has the same name as the template itself.
9960 ###
9961
9962 !! article
9963 Template:quote
9964 !! text
9965 {{{quote|{{{1}}}}}}
9966 !! endarticle
9967
9968 !!test
9969 Templates: Template Name/Arg clash: 1. Use of positional param
9970 !! wikitext
9971 {{quote|foo}}
9972 !! html
9973 <p>foo
9974 </p>
9975 !!end
9976
9977 !!test
9978 Templates: Template Name/Arg clash: 2. Use of named param
9979 !! wikitext
9980 {{quote|quote=foo}}
9981 !! html
9982 <p>foo
9983 </p>
9984 !!end
9985
9986 !!test
9987 Templates: Template Name/Arg clash: 3. Use of named param with empty input
9988 !! wikitext
9989 {{quote|quote}}
9990 !! html
9991 <p>quote
9992 </p>
9993 !!end
9994
9995 ###
9996 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
9997 ###
9998
9999 !!test
10000 Templates: 1. Simple use
10001 !! wikitext
10002 {{echo|Foo}}
10003 !! html
10004 <p>Foo
10005 </p>
10006 !!end
10007
10008 !!test
10009 Templates: 2. Inside a block tag
10010 !! wikitext
10011 <div>{{echo|Foo}}</div>
10012 <blockquote>{{echo|Foo}}</blockquote>
10013 !! html
10014 <div>Foo</div>
10015 <blockquote>Foo</blockquote>
10016
10017 !! html+tidy
10018 <div>Foo</div>
10019 <blockquote>
10020 <p>Foo</p>
10021 </blockquote>
10022 !!end
10023
10024 !!test
10025 Templates: P-wrapping: 1a. Templates on consecutive lines
10026 !! wikitext
10027 {{echo|Foo}}
10028 {{echo|bar}}
10029 !! html
10030 <p>Foo
10031 bar
10032 </p>
10033 !!end
10034
10035 !!test
10036 Templates: P-wrapping: 1b. Templates on consecutive lines
10037 !! wikitext
10038 Foo
10039
10040 {{echo|bar}}
10041 {{echo|baz}}
10042 !! html
10043 <p>Foo
10044 </p><p>bar
10045 baz
10046 </p>
10047 !!end
10048
10049 !!test
10050 Templates: P-wrapping: 1c. Templates on consecutive lines
10051 !! wikitext
10052 {{echo|Foo}}
10053 {{echo|bar}} <div>baz</div>
10054 !! html
10055 <p>Foo
10056 </p>
10057 bar <div>baz</div>
10058
10059 !! html+tidy
10060 <p>Foo</p>
10061 <p>bar</p>
10062 <div>baz</div>
10063 !! end
10064
10065 !!test
10066 Templates: P-wrapping: 1d. Template preceded by comment-only line
10067 !!options
10068 parsoid
10069 !! wikitext
10070 <!-- foo -->
10071 {{echo|Bar}}
10072 !! html
10073 <!-- foo -->
10074
10075 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10076 !!end
10077
10078 !!test
10079 Templates: Inline Text: 1. Multiple template uses
10080 !! wikitext
10081 {{echo|Foo}}bar{{echo|baz}}
10082 !! html
10083 <p>Foobarbaz
10084 </p>
10085 !!end
10086
10087 !!test
10088 Templates: Inline Text: 2. Back-to-back template uses
10089 !! wikitext
10090 {{echo|Foo}}{{echo|bar}}
10091 !! html
10092 <p>Foobar
10093 </p>
10094 !!end
10095
10096 !!test
10097 Templates: Block Tags: 1. Multiple template uses
10098 !! wikitext
10099 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10100 !! html
10101 <div>Foo</div><div>bar</div><div>baz</div>
10102
10103 !!end
10104
10105 !!test
10106 Templates: Block Tags: 2. Back-to-back template uses
10107 !! wikitext
10108 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
10109 !! html
10110 <div>Foo</div><div>bar</div>
10111
10112 !!end
10113
10114 # This is an edge case relating to paragraph wrapping.
10115 !!test
10116 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
10117 !! wikitext
10118 {{echo|a
10119 b</p>}}
10120 !! html/parsoid
10121 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\nb&lt;/p>"}},"i":0}}]}'>a
10122 b</p>
10123 !!end
10124
10125 !!test
10126 Templates: Links: 1. Simple example
10127 !! wikitext
10128 {{echo|[[Foo|bar]]}}
10129 !! html
10130 <p><a href="/wiki/Foo" title="Foo">bar</a>
10131 </p>
10132 !!end
10133
10134 !!test
10135 Templates: Links: 2. Generation of link href
10136 !! wikitext
10137 [[{{echo|Foo}}|bar]]
10138 !! html
10139 <p><a href="/wiki/Foo" title="Foo">bar</a>
10140 </p>
10141 !!end
10142
10143 !!test
10144 Templates: Links: 3. Generation of part of a link href
10145 !! wikitext
10146 [[Fo{{echo|o}}|bar]]
10147
10148 [[Foo{{echo|bar}}]]
10149
10150 [[Foo{{echo|bar}}baz]]
10151
10152 [[Foo{{echo|bar}}|bar]]
10153
10154 [[:Foo{{echo|bar}}]]
10155
10156 [[:Foo{{echo|bar}}|bar]]
10157 !! html
10158 <p><a href="/wiki/Foo" title="Foo">bar</a>
10159 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10160 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10161 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10162 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10163 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10164 </p>
10165 !!end
10166
10167 !!test
10168 Templates: Links: 4. Multiple templates generating link href
10169 !! wikitext
10170 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10171 !! html
10172 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10173 </p>
10174 !!end
10175
10176 !!test
10177 Templates: Links: 5. Generation of link text
10178 !! wikitext
10179 [[Foo|{{echo|bar}}]]
10180 !! html
10181 <p><a href="/wiki/Foo" title="Foo">bar</a>
10182 </p>
10183 !!end
10184
10185 !!test
10186 Templates: Links: 5. Nested templates (only outermost template should be marked)
10187 !! wikitext
10188 {{echo|[[{{echo|Foo}}|bar]]}}
10189 !! html
10190 <p><a href="/wiki/Foo" title="Foo">bar</a>
10191 </p>
10192 !!end
10193
10194 !!test
10195 Templates: HTML Tag: 1. Generation of HTML attr. key
10196 !! wikitext
10197 <div {{echo|style}}="color:red;">foo</div>
10198 !! html
10199 <div style="color:red;">foo</div>
10200
10201 !!end
10202
10203 !!test
10204 Templates: HTML Tag: 2. Generation of HTML attr. value
10205 !! wikitext
10206 <div style={{echo|'color:red;'}}>foo</div>
10207 !! html
10208 <div style="color:red;">foo</div>
10209
10210 !!end
10211
10212 !!test
10213 Templates: HTML Tag: 3. Generation of HTML attr key and value
10214 !! wikitext
10215 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10216 !! html
10217 <div style="color:red;">foo</div>
10218
10219 !!end
10220
10221 !!test
10222 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10223 !! wikitext
10224 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10225 !! html
10226 <div title="This is a long title with just one piece templated">foo</div>
10227
10228 !!end
10229
10230 !!test
10231 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10232 !! wikitext
10233 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10234 !! html
10235 <div title="This is a long title with just one piece templated">foo</div>
10236
10237 !!end
10238
10239 !!test
10240 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10241 !! wikitext
10242 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10243 !! html
10244 <div title="This is a long title with just one piece templated">foo</div>
10245
10246 !!end
10247
10248 # SSS FIXME: While it is great we added support for all this,
10249 # do we want to make this part of the spec? Maybe we want to
10250 # deprecate this kind of usage in the future?
10251 !!test
10252 Templates: HTML Tag: 7. Generation of partial attribute key string
10253 !! wikitext
10254 <div st{{echo|yle}}="color:red;">foo</div>
10255 !! html
10256 <div style="color:red;">foo</div>
10257
10258 !!end
10259
10260 !! test
10261 Templates: HTML Tag: 8. Template-generated attribute (k=v)
10262 !! wikitext
10263 <div {{echo|1=id="v1"}}>bar</div>
10264 !! html
10265 <div id="v1">bar</div>
10266
10267 !!end
10268
10269 !! test
10270 Templates: HTML Tag: 9. Multiple template-generated attributes
10271 !! wikitext
10272 <div {{echo|1=id="v1" title="foo"}}>bar</div>
10273 !! html
10274 <div id="v1" title="foo">bar</div>
10275
10276 !!end
10277
10278 !! test
10279 Templates: Support for templates generating attributes and content
10280 !! wikitext
10281 {| {{mixed_attr_content_template}}
10282 |-
10283 |bar
10284 |}
10285 !! html/php
10286 <table style="color:red;" title="T48811">
10287
10288 <tr>
10289 <td>foo
10290 </td></tr>
10291 <tr>
10292 <td>bar
10293 </td></tr></table>
10294
10295 !! html/parsoid
10296 <table style="color:red;" title="T48811" about="#mwt1" typeof="mw:Transclusion mw:ExpandedAttrs" data-mw='{"parts":["{| ",{"template":{"target":{"wt":"mixed_attr_content_template","href":"./Template:Mixed_attr_content_template"},"params":{},"i":0}},"\n|-\n|bar\n|}"]}'>
10297 <tbody><tr>
10298 <td>foo</td></tr>
10299 <tr>
10300 <td>bar</td></tr>
10301 </tbody></table>
10302 !!end
10303
10304 !!test
10305 Templates: HTML Tables: 1. Generating start of a HTML table
10306 !! wikitext
10307 {{echo|<table><tr><td>foo</td>}}</tr></table>
10308 !! html
10309 <table><tr><td>foo</td></tr></table>
10310
10311 !!end
10312
10313 !!test
10314 Templates: HTML Tables: 2a. Generating middle of a HTML table
10315 !! wikitext
10316 <table><tr>{{echo|<td>foo</td>}}</tr></table>
10317 !! html
10318 <table><tr><td>foo</td></tr></table>
10319
10320 !!end
10321
10322 !!test
10323 Templates: HTML Tables: 2b. Generating middle of a HTML table
10324 !! wikitext
10325 <table>{{echo|<tr><td>foo</td></tr>}}</table>
10326 !! html
10327 <table><tr><td>foo</td></tr></table>
10328
10329 !!end
10330
10331 !!test
10332 Templates: HTML Tables: 3. Generating end of a HTML table
10333 !! wikitext
10334 <table><tr>{{echo|<td>foo</td></tr></table>}}
10335 !! html
10336 <table><tr><td>foo</td></tr></table>
10337
10338 !!end
10339
10340 !!test
10341 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
10342 !! wikitext
10343 {{echo|<table>}}<tr><td>foo</td></tr></table>
10344 !! html
10345 <table><tr><td>foo</td></tr></table>
10346
10347 !!end
10348
10349 !!test
10350 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
10351 !! wikitext
10352 <table>{{echo|<tr>}}<td>foo</td></tr></table>
10353 !! html
10354 <table><tr><td>foo</td></tr></table>
10355
10356 !!end
10357
10358 !!test
10359 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
10360 !! wikitext
10361 <table><tr>{{echo|<td>}}foo</td></tr></table>
10362 !! html
10363 <table><tr><td>foo</td></tr></table>
10364
10365 !!end
10366
10367 !!test
10368 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
10369 !! wikitext
10370 <table><tr><td>foo{{echo|</td>}}</tr></table>
10371 !! html
10372 <table><tr><td>foo</td></tr></table>
10373
10374 !!end
10375
10376 !!test
10377 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
10378 !! wikitext
10379 <table><tr><td>foo</td>{{echo|</tr>}}</table>
10380 !! html
10381 <table><tr><td>foo</td></tr></table>
10382
10383 !!end
10384
10385 !!test
10386 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
10387 !! wikitext
10388 <table><tr><td>foo</td></tr>{{echo|</table>}}
10389 !! html
10390 <table><tr><td>foo</td></tr></table>
10391
10392 !!end
10393
10394 !!test
10395 Templates: HTML Tables: 5. Proper fostering of categories from inside
10396 !!options
10397 parsoid=wt2html,wt2wt
10398 !! wikitext
10399 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
10400 <!--Two categories (Bug 50330)-->
10401 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
10402 !! html
10403 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
10404 <!--Two categories (Bug 50330)-->
10405 <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>
10406 !!end
10407
10408 !!test
10409 Templates: Wiki Tables: 1a. Fostering of entire template content
10410 !! wikitext
10411 {|
10412 {{echo|a}}
10413 |}
10414 !! html
10415 <table>
10416 a
10417 <tr><td></td></tr></table>
10418
10419 !! html+tidy
10420 <p>a</p>
10421 <table>
10422 <tr>
10423 <td></td>
10424 </tr>
10425 </table>
10426 !! end
10427
10428 !!test
10429 Templates: Wiki Tables: 1b. Fostering of entire template content
10430 !! wikitext
10431 {|
10432 {{echo|<div>}}
10433 foo
10434 {{echo|</div>}}
10435 |}
10436 !! html
10437 <table>
10438 <div>
10439 <p>foo
10440 </p>
10441 </div>
10442 <tr><td></td></tr></table>
10443
10444 !! html+tidy
10445 <div>
10446 <p>foo</p>
10447 </div>
10448 <table>
10449 <tr>
10450 <td></td>
10451 </tr>
10452 </table>
10453 !! end
10454
10455 !!test
10456 Templates: Wiki Tables: 2. Fostering of partial template content
10457 !! wikitext
10458 {|
10459 {{echo|a
10460 <div>b</div>}}
10461 |}
10462 !! html
10463 <table>
10464 a
10465 <div>b</div>
10466 <tr><td></td></tr></table>
10467
10468 !! html+tidy
10469 <p>a</p>
10470 <div>b</div>
10471 <table>
10472 <tr>
10473 <td></td>
10474 </tr>
10475 </table>
10476 !! end
10477
10478 !!test
10479 Templates: Wiki Tables: 3. td-content via multiple templates
10480 !! wikitext
10481 {|
10482 {{echo|{{pipe}}a}}{{echo|b}}
10483 |}
10484 !! html
10485 <table>
10486 <tr>
10487 <td>ab
10488 </td></tr></table>
10489
10490 !!end
10491
10492 !!test
10493 Templates: Wiki Tables: 4. Templated tags, no content
10494 !! wikitext
10495 {{tbl-start}}
10496 {{tbl-end}}
10497 !! html
10498 <table>
10499 <tr><td></td></tr></table>
10500
10501 !!end
10502
10503 !!test
10504 Templates: Wiki Tables: 5. Templated tags, regular td-tags
10505 !! wikitext
10506 {{tbl-start}}
10507 |foo
10508 {{tbl-end}}
10509 !! html
10510 <table>
10511 <tr>
10512 <td>foo
10513 </td></tr></table>
10514
10515 !!end
10516
10517 !!test
10518 Templates: Wiki Tables: 6. Templated tags, templated td-tags
10519 !! wikitext
10520 {{tbl-start}}
10521 {{!}}foo
10522 {{tbl-end}}
10523 !! html
10524 <table>
10525 <tr>
10526 <td>foo
10527 </td></tr></table>
10528
10529 !!end
10530
10531 !!test
10532 Templates: Lists: Multi-line list-items via templates
10533 !! wikitext
10534 *{{echo|a {{nonexistent|
10535 unused}}}}
10536 *{{echo|b {{nonexistent|
10537 unused}}}}
10538 !! html
10539 <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>
10540 <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>
10541
10542 !!end
10543
10544 !!test
10545 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
10546 !! wikitext
10547 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
10548 !! html
10549 <p><i>ab</i>c<i>d</i>e
10550 </p>
10551 !!end
10552
10553 !!test
10554 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
10555 (PHP parser generates misnested html)
10556 !! wikitext
10557 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
10558 !! html/parsoid
10559 <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>
10560 !!end
10561
10562 !!test
10563 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
10564 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
10565 !! options
10566 parsoid=wt2html,wt2wt
10567 !! wikitext
10568 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
10569 !! html
10570 <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>
10571 <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>
10572 <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>
10573 !!end
10574
10575 !!test
10576 Templates: Ugly nesting: 4. Divs opened/closed across templates
10577 !! wikitext
10578 a<div>b{{echo|c</div>d}}e
10579 !! html
10580 a<div>bc</div>de
10581
10582 !! html+tidy
10583 <p>a</p>
10584 <div>bc</div>
10585 <p>de</p>
10586 !! end
10587
10588 !!test
10589 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10590 (Parsoid-centric)
10591 !! options
10592 parsoid
10593 !! wikitext
10594 {|
10595 |{{echo|foo</table>}}
10596 |bar
10597 |}
10598 !! html
10599 <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|}"]}'>
10600
10601 <tbody>
10602 <tr>
10603 <td>foo</td></tr></tbody></table><span about="#mwt1">
10604 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10605 |}</span>
10606 !!end
10607
10608 !!test
10609 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10610 (Parsoid-centric)
10611 !! options
10612 parsoid
10613 !! wikitext
10614 <table>
10615 <tr>
10616 <td>
10617 <table>
10618 <tr>
10619 <td>1. {{echo|foo </table>}}</td>
10620 <td> bar </td>
10621 <td>2. {{echo|baz </table>}}</td>
10622 </tr>
10623 <tr>
10624 <td>abc</td>
10625 </tr>
10626 </table>
10627 </td>
10628 </tr>
10629 <tr>
10630 <td>xyz</td>
10631 </tr>
10632 </table>
10633 !! html
10634 <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>"]}'>
10635 <tbody><tr>
10636 <td>
10637 <table>
10638 <tbody><tr>
10639 <td>1. foo </td></tr></tbody></table></td>
10640 <td> bar </td>
10641 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10642 </span><span about="#mwt2">
10643 </span><span about="#mwt2">
10644 </span><span about="#mwt2">abc</span><span about="#mwt2">
10645 </span><span about="#mwt2">
10646 </span><span about="#mwt2">
10647 </span><span about="#mwt2">
10648 </span><span about="#mwt2">
10649 </span><span about="#mwt2">
10650 </span><span about="#mwt2">xyz</span><span about="#mwt2">
10651 </span><span about="#mwt2">
10652 </span>
10653 !!end
10654
10655 !! test
10656 Templates: Ugly templates: 3. newline-only template parameter
10657 !! wikitext
10658 foo {{echo|
10659 }}
10660 !! html
10661 <p>foo
10662 </p>
10663 !! end
10664
10665 # This looks like a bug: a single newline triggers p/br for some reason.
10666 !! test
10667 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10668 !! wikitext
10669 {{echo|
10670 }}
10671 !! html
10672 <p><br />
10673 </p>
10674 !! end
10675
10676 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10677 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10678 !! test
10679 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10680 !! wikitext
10681 {{echo|<table>}}
10682 {{echo|<div>foo}}
10683 {{echo|</table>}}
10684 !! html/parsoid
10685 <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
10686 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10687 </table>
10688 !! end
10689
10690 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10691 # that are "identical" and generate nesting cycles in the algorithm
10692 !! test
10693 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
10694 !! wikitext
10695 {{echo|<table><tr><td><table>}}
10696 {{echo|<div>}}
10697 {{echo|</div>}}
10698 !! html/parsoid
10699 <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"}'>
10700 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10701 </table></td></tr></tbody></table>
10702 !! end
10703
10704 !!test
10705 Parser Functions: 1. Simple example
10706 !! wikitext
10707 {{uc:foo}}
10708 !! html
10709 <p>FOO
10710 </p>
10711 !!end
10712
10713 !!test
10714 Parser Functions: 2. Nested use (only outermost should be marked up)
10715 !! wikitext
10716 {{uc:{{lc:FOO}}}}
10717 !! html
10718 <p>FOO
10719 </p>
10720 !!end
10721
10722 ###
10723 ### Pre-save transform tests
10724 ###
10725 !! test
10726 pre-save transform: subst:
10727 !! options
10728 PST
10729 !! wikitext
10730 {{subst:test}}
10731 !! html
10732 This is a test template
10733 !! end
10734
10735 !! test
10736 pre-save transform: normal template
10737 !! options
10738 PST
10739 !! wikitext
10740 {{test}}
10741 !! html
10742 {{test}}
10743 !! end
10744
10745 !! test
10746 pre-save transform: nonexistent template
10747 !! options
10748 PST
10749 !! wikitext
10750 {{thistemplatedoesnotexist}}
10751 !! html
10752 {{thistemplatedoesnotexist}}
10753 !! end
10754
10755
10756 !! test
10757 pre-save transform: subst magic variables
10758 !! options
10759 PST
10760 !! wikitext
10761 {{subst:SITENAME}}
10762 !! html
10763 MediaWiki
10764 !! end
10765
10766 # This is bug 89, which I fixed. -- wtm
10767 !! test
10768 pre-save transform: subst: templates with parameters
10769 !! options
10770 pst
10771 !! wikitext
10772 {{subst:paramtest|param="something else"}}
10773 !! html
10774 This is a test template with parameter "something else"
10775 !! end
10776
10777 !! article
10778 Template:nowikitest
10779 !! text
10780 <nowiki>'''not wiki'''</nowiki>
10781 !! endarticle
10782
10783 !! test
10784 pre-save transform: nowiki in subst (bug 1188)
10785 !! options
10786 pst
10787 !! wikitext
10788 {{subst:nowikitest}}
10789 !! html
10790 <nowiki>'''not wiki'''</nowiki>
10791 !! end
10792
10793
10794 !! article
10795 Template:commenttest
10796 !! text
10797 This template has <!-- a comment --> in it.
10798 !! endarticle
10799
10800 !! test
10801 pre-save transform: comment in subst (bug 1936)
10802 !! options
10803 pst
10804 !! wikitext
10805 {{subst:commenttest}}
10806 !! html
10807 This template has <!-- a comment --> in it.
10808 !! end
10809
10810 !! test
10811 pre-save transform: unclosed tag
10812 !! options
10813 pst noxml
10814 !! wikitext
10815 <nowiki>'''not wiki'''
10816 !! html
10817 <nowiki>'''not wiki'''
10818 !! end
10819
10820 !! test
10821 pre-save transform: mixed tag case
10822 !! options
10823 pst noxml
10824 !! wikitext
10825 <NOwiki>'''not wiki'''</noWIKI>
10826 !! html
10827 <NOwiki>'''not wiki'''</noWIKI>
10828 !! end
10829
10830 !! test
10831 pre-save transform: unclosed comment in <nowiki>
10832 !! options
10833 pst noxml
10834 !! wikitext
10835 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10836 !! html
10837 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10838 !!end
10839
10840 # Leading @ in this template definition works around a limitation
10841 # in parsoid's parserTests which otherwise strips the <span> from the
10842 # result (confusing it for a template wrapper)
10843 !! article
10844 Template:dangerous
10845 !!text
10846 @<span onmouseover="alert('crap')">Oh no</span>
10847 !!endarticle
10848
10849 !!test
10850 (confirming safety of fix for subst bug 1936)
10851 !! wikitext
10852 {{Template:dangerous}}
10853 !! html
10854 <p>@<span>Oh no</span>
10855 </p>
10856 !! end
10857
10858 !! test
10859 pre-save transform: comment containing gallery (bug 5024)
10860 !! options
10861 pst
10862 !! wikitext
10863 <!-- <gallery>data</gallery> -->
10864 !! html
10865 <!-- <gallery>data</gallery> -->
10866 !!end
10867
10868 !! test
10869 pre-save transform: comment containing extension
10870 !! options
10871 pst
10872 !! wikitext
10873 <!-- <tag>data</tag> -->
10874 !! html
10875 <!-- <tag>data</tag> -->
10876 !!end
10877
10878 !! test
10879 pre-save transform: comment containing nowiki
10880 !! options
10881 pst
10882 !! wikitext
10883 <!-- <nowiki>data</nowiki> -->
10884 !! html
10885 <!-- <nowiki>data</nowiki> -->
10886 !!end
10887
10888 !! test
10889 pre-save transform: <noinclude> in subst (bug 3298)
10890 !! options
10891 pst
10892 !! wikitext
10893 {{subst:Includes}}
10894 !! html
10895 Foobar
10896 !! end
10897
10898 !! test
10899 pre-save transform: <onlyinclude> in subst (bug 3298)
10900 !! options
10901 pst
10902 !! wikitext
10903 {{subst:Includes2}}
10904 !! html
10905 Foo
10906 !! end
10907
10908 !! article
10909 Template:SubstTest
10910 !!text
10911 {{<includeonly>subst:</includeonly>Includes}}
10912 !! endarticle
10913
10914 !! article
10915 Template:SafeSubstTest
10916 !! text
10917 {{<includeonly>safesubst:</includeonly>Includes}}
10918 !! endarticle
10919
10920 !! test
10921 bug 22297: safesubst: works during PST
10922 !! options
10923 pst
10924 !! wikitext
10925 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
10926 !! html
10927 FoobarFoobar
10928 !! end
10929
10930 !! test
10931 bug 22297: safesubst: works during normal parse
10932 !! wikitext
10933 {{SafeSubstTest}}
10934 !! html
10935 <p>Foobar
10936 </p>
10937 !! end
10938
10939 !! test
10940 subst: does not work during normal parse
10941 !! wikitext
10942 {{SubstTest}}
10943 !! html
10944 <p>{{subst:Includes}}
10945 </p>
10946 !! end
10947
10948 !! test
10949 pre-save transform: context links ("pipe trick")
10950 !! options
10951 pst
10952 !! wikitext
10953 [[Article (context)|]]
10954 [[Bar:Article|]]
10955 [[:Bar:Article|]]
10956 [[Bar:Article (context)|]]
10957 [[:Bar:Article (context)|]]
10958 [[|Article]]
10959 [[|Article (context)]]
10960 [[Bar:X (Y) Z|]]
10961 [[:Bar:X (Y) Z|]]
10962 !! html
10963 [[Article (context)|Article]]
10964 [[Bar:Article|Article]]
10965 [[:Bar:Article|Article]]
10966 [[Bar:Article (context)|Article]]
10967 [[:Bar:Article (context)|Article]]
10968 [[Article]]
10969 [[Article (context)]]
10970 [[Bar:X (Y) Z|X (Y) Z]]
10971 [[:Bar:X (Y) Z|X (Y) Z]]
10972 !! end
10973
10974 !! test
10975 pre-save transform: context links ("pipe trick") with interwiki prefix
10976 !! options
10977 pst
10978 !! wikitext
10979 [[interwiki:Article|]]
10980 [[:interwiki:Article|]]
10981 [[interwiki:Bar:Article|]]
10982 [[:interwiki:Bar:Article|]]
10983 !! html
10984 [[interwiki:Article|Article]]
10985 [[:interwiki:Article|Article]]
10986 [[interwiki:Bar:Article|Bar:Article]]
10987 [[:interwiki:Bar:Article|Bar:Article]]
10988 !! end
10989
10990 !! test
10991 pre-save transform: context links ("pipe trick") with parens in title
10992 !! options
10993 pst title=[[Somearticle (context)]]
10994 !! wikitext
10995 [[|Article]]
10996 !! html
10997 [[Article (context)|Article]]
10998 !! end
10999
11000 !! test
11001 pre-save transform: context links ("pipe trick") with comma in title
11002 !! options
11003 pst title=[[Someplace, Somewhere]]
11004 !! wikitext
11005 [[|Otherplace]]
11006 [[Otherplace, Elsewhere|]]
11007 [[Otherplace, Elsewhere, Anywhere|]]
11008 !! html
11009 [[Otherplace, Somewhere|Otherplace]]
11010 [[Otherplace, Elsewhere|Otherplace]]
11011 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
11012 !! end
11013
11014 !! test
11015 pre-save transform: context links ("pipe trick") with parens and comma
11016 !! options
11017 pst title=[[Someplace (IGNORED), Somewhere]]
11018 !! wikitext
11019 [[|Otherplace]]
11020 [[Otherplace (place), Elsewhere|]]
11021 !! html
11022 [[Otherplace, Somewhere|Otherplace]]
11023 [[Otherplace (place), Elsewhere|Otherplace]]
11024 !! end
11025
11026 !! test
11027 pre-save transform: context links ("pipe trick") with comma and parens
11028 !! options
11029 pst title=[[Who, me? (context)]]
11030 !! wikitext
11031 [[|Yes, you.]]
11032 [[Me, Myself, and I (1937 song)|]]
11033 !! html
11034 [[Yes, you. (context)|Yes, you.]]
11035 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
11036 !! end
11037
11038 !! test
11039 pre-save transform: context links ("pipe trick") with namespace
11040 !! options
11041 pst title=[[Ns:Somearticle]]
11042 !! wikitext
11043 [[|Article]]
11044 !! html
11045 [[Ns:Article|Article]]
11046 !! end
11047
11048 !! test
11049 pre-save transform: context links ("pipe trick") with namespace and parens
11050 !! options
11051 pst title=[[Ns:Somearticle (context)]]
11052 !! wikitext
11053 [[|Article]]
11054 !! html
11055 [[Ns:Article (context)|Article]]
11056 !! end
11057
11058 !! test
11059 pre-save transform: context links ("pipe trick") with namespace and comma
11060 !! options
11061 pst title=[[Ns:Somearticle, Context, Whatever]]
11062 !! wikitext
11063 [[|Article]]
11064 !! html
11065 [[Ns:Article, Context, Whatever|Article]]
11066 !! end
11067
11068 !! test
11069 pre-save transform: context links ("pipe trick") with namespace, comma and parens
11070 !! options
11071 pst title=[[Ns:Somearticle, Context (context)]]
11072 !! wikitext
11073 [[|Article]]
11074 !! html
11075 [[Ns:Article (context)|Article]]
11076 !! end
11077
11078 !! test
11079 pre-save transform: context links ("pipe trick") with namespace, parens and comma
11080 !! options
11081 pst title=[[Ns:Somearticle (IGNORED), Context]]
11082 !! wikitext
11083 [[|Article]]
11084 !! html
11085 [[Ns:Article, Context|Article]]
11086 !! end
11087
11088 !! test
11089 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
11090 !! options
11091 pst
11092 !! wikitext
11093 [[Article(context)|]]
11094 [[Bar:Article(context)|]]
11095 [[:Bar:Article(context)|]]
11096 [[|Article(context)]]
11097 [[Bar:X(Y)Z|]]
11098 [[:Bar:X(Y)Z|]]
11099 !! html
11100 [[Article(context)|Article]]
11101 [[Bar:Article(context)|Article]]
11102 [[:Bar:Article(context)|Article]]
11103 [[Article(context)]]
11104 [[Bar:X(Y)Z|X(Y)Z]]
11105 [[:Bar:X(Y)Z|X(Y)Z]]
11106 !! end
11107
11108 !! test
11109 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
11110 !! options
11111 pst
11112 !! wikitext
11113 [[Article (context)|]]
11114 [[Bar:Article (context)|]]
11115 [[:Bar:Article (context)|]]
11116 [[|Article (context)]]
11117 [[Bar:X (Y) Z|]]
11118 [[:Bar:X (Y) Z|]]
11119 !! html
11120 [[Article (context)|Article]]
11121 [[Bar:Article (context)|Article]]
11122 [[:Bar:Article (context)|Article]]
11123 [[Article (context)]]
11124 [[Bar:X (Y) Z|X (Y) Z]]
11125 [[:Bar:X (Y) Z|X (Y) Z]]
11126 !! end
11127
11128 !! test
11129 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
11130 !! options
11131 pst
11132 !! wikitext
11133 [[Article(context)|]]
11134 [[Bar:Article(context)|]]
11135 [[:Bar:Article(context)|]]
11136 [[|Article(context)]]
11137 [[Bar:X(Y)Z|]]
11138 [[:Bar:X(Y)Z|]]
11139 !! html
11140 [[Article(context)|Article]]
11141 [[Bar:Article(context)|Article]]
11142 [[:Bar:Article(context)|Article]]
11143 [[Article(context)]]
11144 [[Bar:X(Y)Z|X(Y)Z]]
11145 [[:Bar:X(Y)Z|X(Y)Z]]
11146 !! end
11147
11148 !! test
11149 pre-save transform: context links ("pipe trick") with commas (bug 21660)
11150 !! options
11151 pst
11152 !! wikitext
11153 [[Article (context), context|]]
11154 [[Article (context),context|]]
11155 [[Bar:Article (context), context|]]
11156 [[Bar:Article (context),context|]]
11157 [[:Bar:Article (context), context|]]
11158 [[:Bar:Article (context),context|]]
11159 !! html
11160 [[Article (context), context|Article]]
11161 [[Article (context),context|Article]]
11162 [[Bar:Article (context), context|Article]]
11163 [[Bar:Article (context),context|Article]]
11164 [[:Bar:Article (context), context|Article]]
11165 [[:Bar:Article (context),context|Article]]
11166 !! end
11167
11168 !! test
11169 pre-save transform: trim trailing empty lines
11170 !! options
11171 pst
11172 !! wikitext
11173 Empty lines are trimmed
11174
11175
11176
11177
11178 !! html
11179 Empty lines are trimmed
11180 !! end
11181
11182 !! test
11183 pre-save transform: Signature expansion
11184 !! options
11185 pst
11186 !! wikitext
11187 * ~~~
11188 * <noinclude>~~~</noinclude>
11189 * <includeonly>~~~</includeonly>
11190 * <onlyinclude>~~~</onlyinclude>
11191 !! html
11192 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
11193 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
11194 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
11195 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
11196 !! end
11197
11198
11199 !! test
11200 pre-save transform: Signature expansion in nowiki tags (bug 93)
11201 !! options
11202 pst disabled
11203 !! wikitext
11204 Shall not expand:
11205
11206 <nowiki>~~~~</nowiki>
11207
11208 <includeonly><nowiki>~~~~</nowiki></includeonly>
11209
11210 <noinclude><nowiki>~~~~</nowiki></noinclude>
11211
11212 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11213
11214 {{subst:Foo}} shall be converted to FOO
11215
11216 As well as inside noinclude/onlyinclude
11217 <noinclude>{{subst:Foo}}</noinclude>
11218 <onlyinclude>{{subst:Foo}}</onlyinclude>
11219
11220 But not inside includeonly
11221 <includeonly>{{subst:Foo}}</includeonly>
11222 !! html
11223 Shall not expand:
11224
11225 <nowiki>~~~~</nowiki>
11226
11227 <includeonly><nowiki>~~~~</nowiki></includeonly>
11228
11229 <noinclude><nowiki>~~~~</nowiki></noinclude>
11230
11231 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11232
11233 FOO shall be converted to FOO
11234
11235 As well as inside noinclude/onlyinclude
11236 <noinclude>FOO</noinclude>
11237 <onlyinclude>FOO</onlyinclude>
11238
11239 But not inside includeonly
11240 <includeonly>{{subst:Foo}}</includeonly>
11241 !! end
11242
11243 !! test
11244 Parsoid: Recognize nowiki with trailing space in tags
11245 !! options
11246 parsoid=wt2html
11247 !! wikitext
11248 <nowiki ><div>[[foo]]</nowiki >
11249
11250 a<nowiki / >b
11251
11252 c<nowiki />d
11253
11254 e<nowiki/ >f
11255 !! html
11256 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11257 <p>ab</p>
11258 <p>cd</p>
11259 <p>ef</p>
11260 !! end
11261
11262 !! test
11263 Parsoid: Recognize nowiki with odd capitalization
11264 !! options
11265 parsoid=wt2html
11266 !! wikitext
11267 <noWikI ><div>[[foo]]</Nowiki >
11268 !! html
11269 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11270 !! end
11271
11272
11273 !! test
11274 Parsoid: Escape nowiki with trailing space in tags
11275 !! options
11276 parsoid=html2wt
11277 !! html
11278 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
11279 <p>a&lt;nowiki /&gt;b</p>
11280 <p>c&lt;nowiki/ &gt;d</p>
11281 !! wikitext
11282 &lt;nowiki &gt; foo &lt;/nowiki &gt;
11283
11284 a&lt;nowiki /&gt;b
11285
11286 c&lt;nowiki/ &gt;d
11287 !! end
11288
11289 !! test
11290 Parsoid: Escape weird noWikI capitalizations
11291 !! options
11292 parsoid=html2wt
11293 !! html
11294 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
11295 !! wikitext
11296 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
11297 !! end
11298
11299 ###
11300 ### Message transform tests
11301 ###
11302 !! test
11303 message transform: magic variables
11304 !! options
11305 msg
11306 !! wikitext
11307 {{SITENAME}}
11308 !! html
11309 MediaWiki
11310 !! end
11311
11312 !! test
11313 message transform: should not transform wiki markup
11314 !! options
11315 msg
11316 !! wikitext
11317 ''test''
11318 !! html
11319 ''test''
11320 !! end
11321
11322 !! test
11323 message transform: <noinclude> in transcluded template (bug 4926)
11324 !! options
11325 msg
11326 !! wikitext
11327 {{Includes}}
11328 !! html
11329 Foobar
11330 !! end
11331
11332 !! test
11333 message transform: <onlyinclude> in transcluded template (bug 4926)
11334 !! options
11335 msg
11336 !! wikitext
11337 {{Includes2}}
11338 !! html
11339 Foo
11340 !! end
11341
11342 !! test
11343 {{#special:}} page name, known
11344 !! options
11345 msg
11346 !! wikitext
11347 {{#special:Recentchanges}}
11348 !! html
11349 Special:RecentChanges
11350 !! end
11351
11352 !! test
11353 {{#special:}} page name with subpage, known
11354 !! options
11355 msg
11356 !! wikitext
11357 {{#special:Recentchanges/param}}
11358 !! html
11359 Special:RecentChanges/param
11360 !! end
11361
11362 !! test
11363 {{#special:}} page name, unknown
11364 !! options
11365 msg
11366 !! wikitext
11367 {{#special:foobar nonexistent}}
11368 !! html
11369 Special:Foobar nonexistent
11370 !! end
11371
11372 !! test
11373 {{#speciale:}} page name, known
11374 !! options
11375 msg
11376 !! wikitext
11377 {{#speciale:Recentchanges}}
11378 !! html
11379 Special:RecentChanges
11380 !! end
11381
11382 !! test
11383 {{#speciale:}} page name with subpage, known
11384 !! options
11385 msg
11386 !! wikitext
11387 {{#speciale:Recentchanges/param}}
11388 !! html
11389 Special:RecentChanges/param
11390 !! end
11391
11392 !! test
11393 {{#speciale:}} page name, unknown
11394 !! options
11395 msg
11396 !! wikitext
11397 {{#speciale:foobar nonexistent}}
11398 !! html
11399 Special:Foobar_nonexistent
11400 !! end
11401
11402 ###
11403 ### Images
11404 ###
11405 ### For Parsoid-specific tests, see
11406 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11407
11408 !! test
11409 Simple image
11410 !! options
11411 parsoid=wt2html,wt2wt,html2html
11412 !! wikitext
11413 [[Image:foobar.jpg]]
11414 !! html/php
11415 <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>
11416 </p>
11417 !! html/parsoid
11418 <p><span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
11419 !! end
11420
11421 !! test
11422 Simple image (using File: namespace, now canonical)
11423 !! wikitext
11424 [[File:Foobar.jpg]]
11425 !! html/php
11426 <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>
11427 </p>
11428 !! html/parsoid
11429 <p><span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
11430 !! end
11431
11432 !! test
11433 Right-aligned image
11434 !! wikitext
11435 [[File:Foobar.jpg|right]]
11436 !! html/php
11437 <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>
11438
11439 !! html/parsoid
11440 <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>
11441 !! end
11442
11443 !! test
11444 Image with caption
11445 !! wikitext
11446 [[File:Foobar.jpg|right|Caption text]]
11447 !! html/php
11448 <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>
11449
11450 !! html/parsoid
11451 <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>
11452 !! end
11453
11454 !! test
11455 Image with caption, bug 53312 #1
11456 !! wikitext
11457 [[File:Foobar.jpg|right|Caption page stuff]]
11458 !! html/php
11459 <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>
11460
11461 !! html/parsoid
11462 <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>
11463 !! end
11464
11465 !! test
11466 Image with caption, bug 53312 #2
11467 !! wikitext
11468 [[File:Foobar.jpg|right|Caption page=]]
11469 !! html/php
11470 <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>
11471
11472 !! html/parsoid
11473 <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>
11474 !! end
11475
11476 !! test
11477 Image with caption, bug 53312 #3
11478 !! wikitext
11479 [[File:Foobar.jpg|right|Caption page=stuff]]
11480 !! html/php
11481 <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>
11482
11483 !! html/parsoid
11484 <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>
11485 !! end
11486
11487 !! test
11488 Allow empty links in image captions (Bug 60753)
11489 !! options
11490 thumbsize=220
11491 !! wikitext
11492 [[File:Foobar.jpg|thumb|Caption [[Link1]]
11493 [[]]
11494 [[Link2]]
11495 ]]
11496 !! html/php
11497 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Caption <a href="/index.php?title=Link1&amp;action=edit&amp;redlink=1" class="new" title="Link1 (page does not exist)">Link1</a> [[]] <a href="/index.php?title=Link2&amp;action=edit&amp;redlink=1" class="new" title="Link2 (page does not exist)">Link2</a></div></div></div>
11498
11499 !! html/parsoid
11500 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption [[Link1]]\n[[]]\n[[Link2]]\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption <a rel="mw:WikiLink" href="./Link1" title="Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"}}'>Link1</a>
11501 [[]]
11502 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
11503 </figcaption></figure>
11504 !! end
11505
11506 !! test
11507 Titles in unlinked images (T23454)
11508 !! wikitext
11509 [[File:Foobar.jpg|link=|stuff]]
11510 !! html/php
11511 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
11512 </p>
11513 !! end
11514
11515 !! test
11516 Link with empty target
11517 !! wikitext
11518 [[]]
11519 !! html
11520 <p>[[]]
11521 </p>
11522 !! end
11523
11524 !! test
11525 Image with link trail
11526 !! wikitext
11527 Linktrails should not work for images: [[File:Foobar.jpg]]s
11528 !! html/php
11529 <p>Linktrails should not work for images: <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>s
11530 </p>
11531 !! html/parsoid
11532 <p>Linktrails should not work for images: <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>s</p>
11533 !! end
11534
11535 !! test
11536 Image with empty attribute
11537 !! options
11538 parsoid=wt2html,wt2wt,html2html
11539 !! wikitext
11540 [[File:Foobar.jpg|right||Caption text]]
11541 !! html/php
11542 <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>
11543
11544 !! html/parsoid
11545 <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>
11546 !! end
11547
11548 !! test
11549 1. Block image with individual attributes from templates
11550 !! wikitext
11551 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
11552 !! html/php
11553 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
11554
11555 !! html/parsoid
11556 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[24,38,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
11557 !! end
11558
11559 !! test
11560 2. Block Image with individual attributes from templates
11561 !! wikitext
11562 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
11563 !! html/php
11564 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
11565
11566 !! html/parsoid
11567 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,32,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[33,47,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
11568 !! end
11569
11570 !! test
11571 3. Inline image with individual attributes from templates
11572 !! wikitext
11573 [[File:Foobar.jpg|{{echo|50px}}]]
11574 !! html/php
11575 <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>
11576 </p>
11577 !! html/parsoid
11578 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;50px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">50px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50"/></a></span></p>
11579 !! end
11580
11581 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
11582 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
11583 !! test
11584 Image with multiple attributes from the same template
11585 !! wikitext
11586 [[File:Foobar.jpg|{{image_attribs}}]]
11587 !! html/php
11588 <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>
11589
11590 !! html/parsoid
11591 <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>
11592 !! end
11593
11594 !! test
11595 Image with link tails
11596 !! options
11597 thumbsize=220
11598 !! wikitext
11599 123[[File:Foobar.jpg]]456
11600 123[[File:Foobar.jpg|right]]456
11601 123[[File:Foobar.jpg|thumb]]456
11602 !! html/php
11603 <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
11604 </p>
11605 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
11606 123<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>456
11607
11608 !! html/php+tidy
11609 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456</p>
11610 <p>123</p>
11611 <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>
11612 <p>456 123</p>
11613 <div class="thumb tright">
11614 <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>
11615 <div class="thumbcaption">
11616 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11617 </div>
11618 </div>
11619 </div>
11620 <p>456</p>
11621 !! html/parsoid
11622 <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>
11623 <p>123</p><figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></figure><p>456</p>
11624 <p>123</p><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220"></a></figure><p>456</p>
11625 !! end
11626
11627 !! test
11628 Image with multiple captions -- only last one is accepted
11629 !! wikitext
11630 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11631 !! html/php
11632 <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>
11633
11634 !! html/parsoid
11635 <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>
11636 !! end
11637
11638 !! test
11639 Image with multiple widths -- use last
11640 !! wikitext
11641 [[File:Foobar.jpg|200px|300px|caption]]
11642 !! html/php
11643 <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>
11644 </p>
11645 !! html/parsoid
11646 <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>
11647 !! end
11648
11649 !! test
11650 Image with multiple alignments -- use first (bug 48664)
11651 !! options
11652 thumbsize=220
11653 !! wikitext
11654 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11655
11656 [[File:Foobar.jpg|middle|text-top|caption]]
11657 !! html/php
11658 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
11659 <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>
11660 </p>
11661 !! html/parsoid
11662 <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>
11663 <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>
11664 !! end
11665
11666 !! test
11667 Image with width attribute at different positions
11668 !! wikitext
11669 [[File:Foobar.jpg|200px|right|Caption]]
11670 [[File:Foobar.jpg|right|200px|Caption]]
11671 [[File:Foobar.jpg|right|Caption|200px]]
11672 !! html/php
11673 <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>
11674 <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>
11675 <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>
11676
11677 !! html/parsoid
11678 <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>
11679 <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>
11680 <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>
11681 !! end
11682
11683 # a sad bit of backward-compatibility
11684 !! test
11685 Image with size specified with pxpx (bug 13500, 51628)
11686 !! options
11687 parsoid=wt2html,wt2wt,html2html
11688 !! wikitext
11689 [[File:Foobar.jpg|20pxpx]]
11690 [[File:Foobar.jpg|200x20pxpx]]
11691 !! html/php
11692 <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>
11693 <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>
11694 </p>
11695 !! html/parsoid
11696 <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>
11697 !! end
11698
11699 !! test
11700 Image with link parameter, wiki target
11701 !! wikitext
11702 [[File:Foobar.jpg|link=Main Page]]
11703 !! html/php
11704 <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>
11705 </p>
11706 !! html/parsoid
11707 <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>
11708 !! end
11709
11710 # parsoid bug 49293 (part 1)
11711 !! test
11712 Image with link parameter, URL target
11713 !! wikitext
11714 [[File:Foobar.jpg|link=http://example.com/]]
11715 !! html/php
11716 <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>
11717 </p>
11718 !! html/parsoid
11719 <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>
11720 !! end
11721
11722 # parsoid bug 49293 (part 2)
11723 !! test
11724 Image with link parameter, protocol-less URL target
11725 !! wikitext
11726 [[File:Foobar.jpg|link=//example.com/]]
11727 !! html/php
11728 <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>
11729 </p>
11730 !! html/parsoid
11731 <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>
11732 !! end
11733
11734 !! test
11735 Image with link parameter, wgExternalLinkTarget
11736 !! wikitext
11737 [[Image:foobar.jpg|link=http://example.com/]]
11738 !! config
11739 wgExternalLinkTarget='foobar'
11740 !! html
11741 <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>
11742 </p>
11743 !! end
11744
11745 !! test
11746 Image with link parameter, wgNoFollowLinks set to false
11747 !! wikitext
11748 [[Image:foobar.jpg|link=http://example.com/]]
11749 !! config
11750 wgNoFollowLinks=false
11751 !! html
11752 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11753 </p>
11754 !! end
11755
11756 !! test
11757 Image with link parameter, wgNoFollowDomainExceptions
11758 !! wikitext
11759 [[Image:foobar.jpg|link=http://example.com/]]
11760 !! config
11761 wgNoFollowDomainExceptions='example.com'
11762 !! html
11763 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11764 </p>
11765 !! end
11766
11767 !! test
11768 Image with link parameter, wgExternalLinkTarget, unnamed parameter
11769 !! wikitext
11770 [[Image:foobar.jpg|link=http://example.com/|Title]]
11771 !! config
11772 wgExternalLinkTarget='foobar'
11773 !! html
11774 <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>
11775 </p>
11776 !! end
11777
11778 !! test
11779 Image with empty link parameter
11780 !! wikitext
11781 [[File:Foobar.jpg|link=]]
11782 !! html/php
11783 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
11784 </p>
11785 !! html/parsoid
11786 <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>
11787 !! end
11788
11789 !! test
11790 Image with link parameter (wiki target) and unnamed parameter
11791 !! wikitext
11792 [[File:Foobar.jpg|link=Main_Page|Title]]
11793 !! html/php
11794 <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>
11795 </p>
11796 !! html/parsoid
11797 <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>
11798 !! end
11799
11800 !! test
11801 Image with link parameter (URL target) and unnamed parameter
11802 !! wikitext
11803 [[File:Foobar.jpg|link=http://example.com/|Title]]
11804 !! html/php
11805 <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>
11806 </p>
11807 !! html/parsoid
11808 <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>
11809 !! end
11810
11811 !! test
11812 Thumbnail image with link parameter
11813 !! options
11814 thumbsize=220
11815 parsoid=wt2html,wt2wt,html2html
11816 !! wikitext
11817 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
11818 !! html/php
11819 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
11820
11821 !! html/parsoid
11822 <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>
11823 !! end
11824
11825 !! test
11826 Manually-specified thumbnail image
11827 !! options
11828 thumbsize=220
11829 !! wikitext
11830 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
11831 !! html/php
11832 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
11833
11834 !! html/parsoid
11835 <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>
11836 !! end
11837
11838 !! test
11839 Manually-specified thumbnail image with explicit link to wiki page
11840 !! options
11841 thumbsize=220
11842 parsoid=wt2html,wt2wt,html2html
11843 !! wikitext
11844 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
11845 !! html/php
11846 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
11847
11848 !! html/parsoid
11849 <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>
11850 !! end
11851
11852 !! test
11853 Manually-specified thumbnail image with explicit link to url
11854 !! options
11855 thumbsize=220
11856 parsoid=wt2html,wt2wt,html2html
11857 !! wikitext
11858 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
11859 !! html/php
11860 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
11861
11862 !! html/parsoid
11863 <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>
11864 !! end
11865
11866 !! test
11867 Manually-specified thumbnail image with explicit no link
11868 !! options
11869 thumbsize=220
11870 parsoid=wt2html,wt2wt,html2html
11871 !! wikitext
11872 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
11873 !! html/php
11874 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
11875
11876 !! html/parsoid
11877 <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>
11878 !! end
11879
11880 !! test
11881 Manually-specified thumbnail image with explicit link and alt text
11882 !! options
11883 thumbsize=220
11884 parsoid=wt2html,wt2wt,html2html
11885 !! wikitext
11886 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
11887 !! html/php
11888 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
11889
11890 !! html/parsoid
11891 <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>
11892 !! end
11893
11894 !! test
11895 Image with frame and link
11896 !! options
11897 parsoid=wt2html,wt2wt,html2html
11898 !! wikitext
11899 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
11900 !! html/php
11901 <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>
11902
11903 !! html/parsoid
11904 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a></figcaption></figure>
11905 !! end
11906
11907 !! test
11908 Image with frame and link and explicit alt
11909 !! options
11910 parsoid=wt2html,wt2wt,html2html
11911 !! wikitext
11912 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
11913 !! html/php
11914 <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>
11915
11916 !! html/parsoid
11917 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img alt="Altitude" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a></figcaption></figure>
11918 !! end
11919
11920 !! test
11921 Image with wiki markup in implicit alt
11922 !! options
11923 parsoid=wt2html,wt2wt,html2html
11924 !! wikitext
11925 [[Image:Foobar.jpg|testing '''bold''' in alt]]
11926
11927 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
11928 !! html/php
11929 <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>
11930 </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>
11931 </p>
11932 !! html/parsoid
11933 <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>
11934 <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>
11935 !! end
11936
11937 ###################
11938 # Conflicting image format options.
11939 # First option specified should 'win'.
11940 # All three cases in each test should be identical.
11941
11942 !! test
11943 Image with 'frameless' first.
11944 !! options
11945 parsoid=wt2html,wt2wt,html2html
11946 !! wikitext
11947 [[File:Foobar.jpg|frameless|caption]]
11948
11949 [[File:Foobar.jpg|frameless|frame|caption]]
11950
11951 [[File:Foobar.jpg|frameless|thumb|caption]]
11952 !! html/php
11953 <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>
11954 </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>
11955 </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>
11956 </p>
11957 !! html/parsoid
11958 <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>
11959 <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>
11960 <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>
11961 !! end
11962
11963 !! test
11964 Image with 'frame' first.
11965 !! options
11966 parsoid=wt2html,wt2wt,html2html
11967 !! wikitext
11968 [[File:Foobar.jpg|frame|caption]]
11969 [[File:Foobar.jpg|frame|frameless|caption]]
11970 [[File:Foobar.jpg|frame|thumb|caption]]
11971 !! html/php
11972 <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>
11973 <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>
11974 <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>
11975
11976 !! html/parsoid
11977 <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>
11978 <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>
11979 <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>
11980 !! end
11981
11982 !! test
11983 Image with 'thumb' first.
11984 !! options
11985 parsoid=wt2html,wt2wt,html2html
11986 !! wikitext
11987 [[File:Foobar.jpg|thumb|caption]]
11988 [[File:Foobar.jpg|thumb|frameless|caption]]
11989 [[File:Foobar.jpg|thumb|frame|caption]]
11990 !! html/php
11991 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
11992 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
11993 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
11994
11995 !! html/parsoid
11996 <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>
11997 <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>
11998 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
11999 !! end
12000
12001 ###################
12002 # Image sizing.
12003 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
12004 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
12005 # Foobar has actual size of 1941x220
12006 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
12007 # a scalable format.
12008 # 2. Framed images always ignore size options; always render at default size.
12009 # 3. "Unspecified format" and border are the only types which can be
12010 # enlarged.
12011
12012 !! test
12013 Image: "unspecified format" and border enlarge
12014 !! options
12015 parsoid=wt2html,wt2wt,html2html
12016 !! wikitext
12017 [[File:Foobar.jpg|2000px]]
12018
12019 [[File:Foobar.jpg|border|2000px]]
12020 !! html/php
12021 <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>
12022 </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>
12023 </p>
12024 !! html/parsoid
12025 <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>
12026 <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>
12027 !! end
12028
12029 !! test
12030 Image: "unspecified format" and border reduce
12031 !! options
12032 parsoid=wt2html,wt2wt,html2html
12033 !! wikitext
12034 [[File:Foobar.jpg|1000px]]
12035
12036 [[File:Foobar.jpg|border|1000px]]
12037 !! html/php
12038 <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>
12039 </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>
12040 </p>
12041 !! html/parsoid
12042 <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>
12043 <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>
12044 !! end
12045
12046 !! test
12047 Image: thumbs reduce
12048 !! options
12049 parsoid=wt2html,wt2wt,html2html
12050 !! wikitext
12051 [[File:Foobar.jpg|thumb|50px]]
12052 !! html/php
12053 <div class="thumb tright"><div class="thumbinner" style="width:52px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
12054
12055 !! html/parsoid
12056 <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>
12057 !! end
12058
12059 !! test
12060 Image: bitmap thumbs can't be enlarged past original size, but vector can.
12061 !! options
12062 parsoid=wt2html,wt2wt,html2html
12063 !! wikitext
12064 [[File:Foobar.jpg|thumb|2000px]]
12065
12066 [[File:Foobar.svg|thumb|2000px]]
12067 !! html/php
12068 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
12069 <div class="thumb tright"><div class="thumbinner" style="width:2002px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div></div></div></div>
12070
12071 !! html/parsoid
12072 <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>
12073 <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>
12074 !! end
12075
12076 !! test
12077 Image: frameless can reduce in size
12078 !! options
12079 parsoid=wt2html,wt2wt,html2html
12080 !! wikitext
12081 [[File:Foobar.jpg|frameless|50px]]
12082 !! html/php
12083 <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>
12084 </p>
12085 !! html/parsoid
12086 <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>
12087 !! end
12088
12089 !! test
12090 Image: bitmap frameless can't be enlarged past original size, but vector can
12091 !! options
12092 parsoid=wt2html,wt2wt,html2html
12093 !! wikitext
12094 [[File:Foobar.jpg|frameless|2000px]]
12095
12096 [[File:Foobar.svg|frameless|2000px]]
12097 !! html/php
12098 <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>
12099 </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>
12100 </p>
12101 !! html/parsoid
12102 <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>
12103 <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>
12104 !! end
12105
12106 !! test
12107 Image: framed images are always unscaled.
12108 !! options
12109 parsoid=wt2html,wt2wt,html2html
12110 !! wikitext
12111 [[File:Foobar.jpg|frame]]
12112
12113 [[File:Foobar.jpg|frame|50px]]
12114
12115 [[File:Foobar.jpg|frame|50x50px]]
12116
12117 [[File:Foobar.jpg|frame|2000px]]
12118 !! html/php
12119 <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>
12120 <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>
12121 <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>
12122 <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>
12123
12124 !! html/parsoid
12125 <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>
12126 <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>
12127 <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>
12128 <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>
12129 !! end
12130
12131 ###################
12132
12133 !! test
12134 Link to image page- image page normally doesn't exists, hence edit link
12135 Add test with existing image page
12136 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
12137 !! wikitext
12138 [[:Image:test]]
12139 !! html
12140 <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>
12141 </p>
12142 !! end
12143
12144 !! test
12145 bug 18784 Link to non-existent image page with caption should use caption as link text
12146 !! wikitext
12147 [[:Image:test|caption]]
12148 !! html
12149 <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>
12150 </p>
12151 !! end
12152
12153 !! test
12154 Frameless image caption with a free URL
12155 !! wikitext
12156 [[File:Foobar.jpg|http://example.com]]
12157 !! html/php
12158 <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>
12159 </p>
12160 !! html/parsoid
12161 <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>
12162 !! end
12163
12164 !! test
12165 Thumbnail image caption with a free URL
12166 !! options
12167 thumbsize=220
12168 !! wikitext
12169 [[File:Foobar.jpg|thumb|http://example.com]]
12170 !! html/php
12171 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
12172
12173 !! html/parsoid
12174 <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>
12175 !! end
12176
12177 !! test
12178 Thumbnail image caption with a free URL and explicit alt
12179 !! options
12180 thumbsize=220
12181 parsoid=wt2html,wt2wt,html2html
12182 !! wikitext
12183 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
12184 !! html/php
12185 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
12186
12187 !! html/parsoid
12188 <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>
12189 !! end
12190
12191 !! test
12192 SVG thumbnails with no language set
12193 !! options
12194 !! wikitext
12195 [[File:Foobar.svg|thumb|caption]]
12196 !! html/php
12197 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
12198
12199 !! html/parsoid
12200 <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>
12201 !! end
12202
12203 !! test
12204 SVG thumbnails with language de
12205 !! options
12206 parsoid=wt2html,wt2wt,html2html
12207 !! wikitext
12208 [[File:Foobar.svg|thumb|caption|lang=de]]
12209 !! html/php
12210 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=File:Foobar.svg&amp;lang=de" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
12211
12212 !! html/parsoid
12213 <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>
12214 !! end
12215
12216 !! test
12217 SVG thumbnails with invalid language code
12218 !! options
12219 parsoid=wt2html,wt2wt,html2html
12220 !! wikitext
12221 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
12222 !! html/php
12223 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>lang=invalid.language.code</div></div></div>
12224
12225 !! html/parsoid
12226 <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>
12227 !! end
12228
12229 !! test
12230 BUG 1887: A ISBN with a thumbnail
12231 !! wikitext
12232 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
12233 !! html/php
12234 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
12235
12236 !! html/parsoid
12237 <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>
12238 !! end
12239
12240 !! test
12241 BUG 1887: A RFC with a thumbnail
12242 !! wikitext
12243 [[File:Foobar.jpg|thumb|This is RFC 12354]]
12244 !! html/php
12245 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
12246
12247 !! html/parsoid
12248 <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>
12249 !! end
12250
12251 !! test
12252 BUG 1887: A mailto link with a thumbnail
12253 !! wikitext
12254 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
12255 !! html/php
12256 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
12257
12258 !! html/parsoid
12259 <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>
12260 !! end
12261
12262 # Pending resolution to bug 368
12263 !! test
12264 BUG 648: Frameless image caption with a link
12265 !! wikitext
12266 [[File:Foobar.jpg|text with a [[link]] in it]]
12267 !! html/php
12268 <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>
12269 </p>
12270 !! html/parsoid
12271 <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>
12272 !! end
12273
12274 !! test
12275 BUG 648: Frameless image caption with a link (suffix)
12276 !! wikitext
12277 [[File:Foobar.jpg|text with a [[link]]foo in it]]
12278 !! html/php
12279 <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>
12280 </p>
12281 !! html/parsoid
12282 <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>
12283 !! end
12284
12285 !! test
12286 BUG 648: Frameless image caption with an interwiki link
12287 !! wikitext
12288 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
12289 !! html/php
12290 <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>
12291 </p>
12292 !! html/parsoid
12293 <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>
12294 !! end
12295
12296 !! test
12297 BUG 648: Frameless image caption with a piped interwiki link
12298 !! wikitext
12299 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
12300 !! html/php
12301 <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>
12302 </p>
12303 !! html/parsoid
12304 <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>
12305 !! end
12306
12307 !! test
12308 Escape HTML special chars in image alt text
12309 !! wikitext
12310 [[File:Foobar.jpg|& < > "]]
12311 !! html/php
12312 <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>
12313 </p>
12314 !! html/parsoid
12315 <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>
12316 !! end
12317
12318 !! test
12319 BUG 499: Alt text should have &#1234;, not &amp;1234;
12320 !! wikitext
12321 [[File:Foobar.jpg|&#9792;]]
12322 !! html/php
12323 <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>
12324 </p>
12325 !! html/parsoid
12326 <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>
12327 !! end
12328
12329 !! test
12330 Broken image caption with link
12331 !! options
12332 parsoid=wt2html,wt2wt,html2html
12333 !! wikitext
12334 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
12335 !! html/php
12336 <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.
12337 </p>
12338 !! html/parsoid
12339 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a rel="mw:WikiLink" href="Main_Page" title="Main Page">this</a> is just an ordinary link.</p>
12340 !! end
12341
12342 !! test
12343 Image caption containing another image
12344 !! wikitext
12345 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
12346 !! html/php
12347 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption with another <a href="/wiki/File:Thumb.png" class="image" title="image"><img alt="image" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" /></a> inside it!</div></div></div>
12348
12349 !! html/parsoid
12350 <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>
12351 !! end
12352
12353 !! test
12354 Image: caption containing a newline
12355 !! wikitext
12356 [[File:Foobar.jpg|This
12357 *is some text]]
12358 !! html/php
12359 <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>
12360 </p>
12361 !! html/parsoid
12362 <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>
12363 !!end
12364
12365 !!test
12366 Image: caption containing leading space
12367 (The leading space should not trigger nowiki escaping in wt2wt mode)
12368 !! wikitext
12369 [[File:Foobar.jpg|thumb| bar]]
12370 !! html/php
12371 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>bar</div></div></div>
12372
12373 !! html/parsoid
12374 <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>
12375 !!end
12376
12377 !! test
12378 Image: caption containing a table
12379 !! options
12380 parsoid=wt2html,wt2wt,html2html
12381 !! wikitext
12382 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
12383 {|
12384 ! Foo !! Bar
12385 |-
12386 | Foo1 || Bar1
12387 |}
12388 and some more text.]]
12389 !! html/php
12390 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is an example image thumbnail caption with a table <table> <tr> <th> Foo </th> <th> Bar </th></tr> <tr> <td> Foo1 </td> <td> Bar1 </td></tr></table> and some more text.</div></div></div>
12391
12392 !! html/parsoid
12393 <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
12394 <table>
12395 <tbody>
12396 <tr><th>Foo </th><th>Bar</th></tr>
12397 <tr>
12398 <td>Foo1 </td>
12399 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
12400 !! end
12401
12402 !! test
12403 Bug 3090: External links other than http: in image captions
12404 !! wikitext
12405 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
12406 !! html/php
12407 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
12408
12409 !! html/parsoid
12410 <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>
12411 !! end
12412
12413 !! test
12414 Custom class
12415 !! options
12416 parsoid=wt2html,wt2wt,html2html
12417 !! wikitext
12418 [[Image:foobar.jpg|a|class=b]]
12419 !! html/php
12420 <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>
12421 </p>
12422 !! html/parsoid
12423 <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>
12424 !! end
12425
12426 !! test
12427 Localized image handling (1).
12428 !! options
12429 parsoid=wt2html,wt2wt,html2html
12430 language=es
12431 !! wikitext
12432 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
12433 !! html/php
12434 <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>
12435
12436 !! html/parsoid
12437 <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>
12438 !! end
12439
12440 !! test
12441 Localized image handling (2).
12442 !! options
12443 thumbsize=220
12444 parsoid=wt2html,wt2wt,html2html
12445 language=es
12446 !! wikitext
12447 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
12448 !! html/php
12449 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"></a></div>caption</div></div></div>
12450
12451 !! html/parsoid
12452 <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>
12453 !! end
12454
12455 !! test
12456 "border", "frameless" and "class" attributes on an image.
12457 !! options
12458 thumbsize=220
12459 parsoid=wt2html,wt2wt,html2html
12460 !! wikitext
12461 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
12462 !! html/php
12463 <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>
12464 </p>
12465 !! html/parsoid
12466 <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>
12467 !! end
12468
12469 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
12470 !! test
12471 Invalid image attributes (bug 62500)
12472 !! options
12473 thumbsize=220
12474 parsoid=wt2html,wt2wt,html2html
12475 !! wikitext
12476 [[File:Foobar.jpg|thumb|float|left|caption]]
12477
12478 [[File:Foobar.jpg|thumb|righ|caption]]
12479
12480 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
12481 !! html/php
12482 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
12483 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
12484 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
12485
12486 !! html/parsoid
12487 <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>
12488 <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>
12489 <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>
12490 !! end
12491
12492 !! article
12493 File:Barfoo.jpg
12494 !! text
12495 #REDIRECT [[File:Barfoo.jpg]]
12496 !! endarticle
12497
12498 # FIXME: Parsoid should run this test -- but we'd need to teach the
12499 # mockAPI about the redirected Barfoo.jpg image.
12500 !! test
12501 Redirected image
12502 !! wikitext
12503 [[Image:Barfoo.jpg]]
12504 !! html/php
12505 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
12506 </p>
12507 !! end
12508
12509 !! test
12510 Missing image with uploads disabled
12511 !! options
12512 wgEnableUploads=0
12513 !! wikitext
12514 [[File:Foobaz.jpg]]
12515 !! html/php
12516 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
12517 </p>
12518 !! html/parsoid
12519 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="File:Foobaz.jpg"><img resource="./File:Foobaz.jpg" src="./Special:FilePath/Foobaz.jpg" height="220" width="220"/></a></span></p>
12520 !! end
12521
12522 # Parsoid-specific testing for images
12523 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12524 # Currently imperfect due to a flaw in the Parsoid testrunner
12525 # Work in progress
12526 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
12527 # image tests.
12528
12529 !! test
12530 Parsoid-specific image handling - simple image with size and middle alignment
12531 !! wikitext
12532 [[File:Foobar.jpg|middle|50px]]
12533 !! html/parsoid
12534 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50"></a></span></p>
12535 !! end
12536
12537 !! test
12538 Parsoid-specific image handling - simple image with size, middle alignment,
12539 non-standard namespace alias
12540 !! options
12541 parsoid=wt2wt,wt2html,html2html
12542 !! wikitext
12543 [[Image:Foobar.jpg|middle|50px]]
12544 !! html/parsoid
12545 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50"></a></span></p>
12546 !! end
12547
12548 !! test
12549 Parsoid-specific image handling - simple image with size and middle alignment
12550 (existing content)
12551 !! wikitext
12552 [[File:Foobar.jpg|50px|middle]]
12553 !! html/parsoid
12554 <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>
12555 !! end
12556
12557 !! test
12558 Parsoid-specific image handling - simple image with size and middle alignment
12559 and non-standard namespace name
12560 !! options
12561 parsoid=wt2html,wt2wt,html2html
12562 !! wikitext
12563 [[Image:Foobar.jpg|50px|middle]]
12564 !! html/parsoid
12565 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50"></a></span></p>
12566 !! end
12567
12568 !! test
12569 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
12570 !! wikitext
12571 [[File:Foobar.jpg|500x10px|baseline|caption]]
12572 !! html/parsoid
12573 <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>
12574 !! end
12575
12576 !! test
12577 Parsoid-specific image handling - simple image with border and size spec
12578 !! wikitext
12579 [[File:Foobar.jpg|50px|border|caption]]
12580 !! html/parsoid
12581 <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>
12582 !! end
12583
12584 !! test
12585 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12586 !! wikitext
12587 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
12588 !! html/parsoid
12589 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" /></a><figcaption>caption content</figcaption></figure>
12590 !! end
12591
12592 !! test
12593 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12594 (existing content)
12595 !! wikitext
12596 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12597 !! html/parsoid
12598 <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>
12599 !! end
12600
12601 !! test
12602 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12603 !! wikitext
12604 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12605 !! html/parsoid
12606 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" /></a><figcaption>caption</figcaption></figure>
12607 !! end
12608
12609 !! test
12610 Parsoid-specific image handling - thumbnail with specific size, halign,
12611 valign, and caption (existing content)
12612 !! wikitext
12613 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12614 !! html/parsoid
12615 <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>
12616 !! end
12617
12618 !! test
12619 Parsoid-specific image handling - framed image with specific size and caption
12620 (size is ignored)
12621 !! options
12622 parsoid=wt2html,wt2wt,html2html
12623 !! wikitext
12624 [[File:Foobar.jpg|frame|500x50px|caption]]
12625 !! html/parsoid
12626 <figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" /></a><figcaption>caption</figcaption></figure>
12627 !! end
12628
12629 !! test
12630 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12631 (size is ignored)
12632 !! options
12633 parsoid=wt2html,wt2wt,html2html
12634 !! wikitext
12635 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12636 !! html/parsoid
12637 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" /></a><figcaption>caption</figcaption></figure>
12638 !! end
12639
12640 !! test
12641 Parsoid-specific image handling - frameless image with specific size, border, and caption
12642 !! wikitext
12643 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12644 !! html/parsoid
12645 <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>
12646 !! end
12647
12648 !! test
12649 Parsoid-specific image handling - simple image with a formatted caption
12650 !! wikitext
12651 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12652 !! html/parsoid
12653 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;table>&lt;tr>&lt;td>a&lt;/td>&lt;td>b&lt;/td>&lt;/tr>&lt;tr>&lt;td>c&lt;/td>&lt;/tr>&lt;/table>"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
12654 !! end
12655
12656 !! test
12657 Parsoid-specific image handling - caption with a template in it
12658 !! wikitext
12659 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12660 !! html/parsoid
12661 <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>
12662 !! end
12663
12664 !! test
12665 Parsoid-specific image handling - caption with unbalanced tags in it
12666 !! options
12667 parsoid=wt2html,wt2wt,html2html
12668 !! wikitext
12669 foo
12670 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12671 bar
12672 !! html/parsoid
12673 <p>foo</p>
12674 <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>
12675 <p>bar</p>
12676 !! end
12677
12678 !! test
12679 Parsoid-specific image handling - empty caption (1)
12680 !! options
12681 parsoid=wt2html,wt2wt
12682 !! wikitext
12683 [[File:Foobar.jpg|thumb|]]
12684 !! html/parsoid
12685 <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>
12686 !! end
12687
12688 # empty captions don't get serialized unless we're in the "round trip" case
12689 !! test
12690 Parsoid-specific image handling - empty caption (2)
12691 !! options
12692 parsoid=html2wt
12693 !! html/parsoid
12694 <figure class="mw-default-size" typeof="mw:Image/Thumb">
12695 <a href="File:Foobar.jpg">
12696 <img resource="./File:Foobar.jpg"
12697 src="//example.com/images/3/3a/Foobar.jpg"
12698 height="25" width="220"/>
12699 </a>
12700 <figcaption></figcaption>
12701 </figure>
12702 !! wikitext
12703 [[File:Foobar.jpg|thumb]]
12704 !! end
12705
12706 !! test
12707 Parsoid-specific image handling - whitespace caption
12708 !! wikitext
12709 [[File:Foobar.jpg|thumb| ]]
12710 !! html/parsoid
12711 <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>
12712 !! end
12713
12714 !! test
12715 Parsoid-specific image handling - lang option
12716 !! wikitext
12717 foo
12718 [[File:Foobar.svg|lang=de|caption]]
12719 bar
12720 !! html/parsoid
12721 <p>foo
12722 <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>
12723 bar</p>
12724 !! end
12725
12726
12727 ###
12728 ### Subpages
12729 ###
12730 !! article
12731 Subpage test/subpage
12732 !! text
12733 foo
12734 !! endarticle
12735
12736 !! test
12737 Subpage link
12738 !! options
12739 subpage title=[[Subpage test]]
12740 !! wikitext
12741 [[/subpage]]
12742 !! html
12743 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
12744 </p>
12745 !! end
12746
12747 !! test
12748 Subpage noslash link
12749 !! options
12750 subpage title=[[Subpage test]]
12751 !! wikitext
12752 [[/subpage/]]
12753 !! html
12754 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
12755 </p>
12756 !! end
12757
12758 !! article
12759 Subpage test/1/2/subpage
12760 !! text
12761 blah
12762 !! endarticle
12763
12764 !! test
12765 Relative subpage noslash link
12766 !! options
12767 parsoid=wt2wt,wt2html,html2html
12768 subpage title=[[Subpage test/1/2/3/4]]
12769 !! wikitext
12770 [[../../subpage/]]
12771
12772 [[../../subpage]]
12773 !! html/php
12774 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
12775 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
12776 </p>
12777 !! html/parsoid
12778 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
12779 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
12780 !! end
12781
12782 !! test
12783 Parsoid: dot-slash prefixed wikilinks
12784 !! wikitext
12785 [[./foo]]
12786
12787 [[././bar]]
12788
12789 [[././baz/]]
12790 !! html/php
12791 <p>[[./foo]]
12792 </p><p>[[././bar]]
12793 </p><p>[[././baz/]]
12794 </p>
12795 !! html/parsoid
12796 <p>[[./foo]]
12797 </p><p>[[././bar]]
12798 </p><p>[[././baz/]]
12799 </p>
12800 !! end
12801
12802 !! test
12803 Render invalid page names as plain text (bug 51090)
12804 !! wikitext
12805 [[./../foo|bar]]
12806 [[foo�|bar]]
12807 [[foo/.|bar]]
12808 [[foo/..|bar]]
12809 [[foo~~~bar]]
12810 [[foo>bar]]
12811 [[foo[bar]]
12812 [[.]]
12813 [[..]]
12814 [[foo././bar]]
12815
12816 [[{{echo|./../foo}}|bar]]
12817 [[{{echo|foo/.}}|bar]]
12818 [[{{echo|foo/..}}|bar]]
12819 [[{{echo|foo~~~~bar}}]]
12820 [[{{echo|foo>bar}}]]
12821 [[{{echo|foo././bar}}]]
12822 [[{{echo|foo{bar}}]]
12823 [[{{echo|foo}bar}}]]
12824 [[{{echo|foo[bar}}]]
12825 [[{{echo|foo]bar}}]]
12826 [[{{echo|foo<bar}}]]
12827 !!html/php
12828 <p>[[./../foo|bar]]
12829 [[foo�|bar]]
12830 [[foo/.|bar]]
12831 [[foo/..|bar]]
12832 [[foo~~~bar]]
12833 [[foo&gt;bar]]
12834 [[foo[bar]]
12835 [[.]]
12836 [[..]]
12837 [[foo././bar]]
12838 </p><p>[[./../foo|bar]]
12839 [[foo/.|bar]]
12840 [[foo/..|bar]]
12841 [[foo~~~~bar]]
12842 [[foo&gt;bar]]
12843 [[foo././bar]]
12844 [[foo{bar]]
12845 [[foo}bar]]
12846 [[foo[bar]]
12847 [[foo]bar]]
12848 [[foo&lt;bar]]
12849 </p>
12850 !!html/parsoid
12851 <p>[[./../foo|bar]]
12852 [[foo�|bar]]
12853 [[foo/.|bar]]
12854 [[foo/..|bar]]
12855 [[foo~~~bar]]
12856 [[foo>bar]]
12857 [[foo[bar]]
12858 [[.]]
12859 [[..]]
12860 [[foo././bar]]</p>
12861
12862 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
12863 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
12864 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
12865 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
12866 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
12867 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
12868 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
12869 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
12870 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
12871 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
12872 [[<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>
12873 !!end
12874
12875 !! test
12876 Disabled subpages
12877 !! wikitext
12878 [[/subpage]]
12879 !! html
12880 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
12881 </p>
12882 !! end
12883
12884 !! test
12885 BUG 561: {{/Subpage}}
12886 !! options
12887 subpage title=[[Page]]
12888 !! wikitext
12889 {{/Subpage}}
12890 !! html
12891 <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>
12892 </p>
12893 !! end
12894
12895 ###
12896 ### Categories
12897 ###
12898 !! article
12899 Category:MediaWiki User's Guide
12900 !! text
12901 blah
12902 !! endarticle
12903
12904 !! test
12905 Link to category
12906 !! wikitext
12907 [[:Category:MediaWiki User's Guide]]
12908 !! html
12909 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
12910 </p>
12911 !! end
12912
12913 !! test
12914 Simple category
12915 !! options
12916 cat
12917 !! wikitext
12918 [[Category:MediaWiki User's Guide]]
12919 !! html
12920 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12921 !! end
12922
12923 !! test
12924 PAGESINCATEGORY invalid title fatal (r33546 fix)
12925 !! wikitext
12926 {{PAGESINCATEGORY:<bogus>}}
12927 !! html
12928 <p>0
12929 </p>
12930 !! end
12931
12932 !! test
12933 Category with different sort key
12934 !! options
12935 cat
12936 !! wikitext
12937 [[Category:MediaWiki User's Guide|Foo]]
12938 !! html
12939 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12940 !! end
12941
12942 !! test
12943 Category with identical sort key
12944 !! options
12945 cat
12946 !! wikitext
12947 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12948 !! html
12949 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12950 !! end
12951
12952 !! test
12953 Category with empty sort key
12954 !! options
12955 cat
12956 pst
12957 !! wikitext
12958 [[Category:MediaWiki User's Guide|]]
12959 !! html
12960 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12961 !! end
12962
12963 !! test
12964 Category with empty sort key and parentheses
12965 !! options
12966 cat
12967 pst
12968 !! wikitext
12969 [[Category:Foo (bar)|]]
12970 !! html
12971 [[Category:Foo (bar)|Foo]]
12972 !! end
12973
12974 !! test
12975 Category with link tail
12976 !! options
12977 cat
12978 pst
12979 !! wikitext
12980 123[[Category:Foo]]456
12981 !! html
12982 123[[Category:Foo]]456
12983 !! end
12984
12985 !! test
12986 Category with template
12987 !! options
12988 cat
12989 pst
12990 !! wikitext
12991 [[Category:{{echo|Foo}}]]
12992 !! html
12993 [[Category:{{echo|Foo}}]]
12994 !! end
12995
12996 !! test
12997 Category with template in sort key
12998 !! options
12999 cat
13000 pst
13001 !! wikitext
13002 [[Category:Foo|{{echo|Bar}}]]
13003 !! html
13004 [[Category:Foo|{{echo|Bar}}]]
13005 !! end
13006
13007 !! test
13008 Category with template in sort key and title
13009 !! options
13010 cat
13011 pst
13012 !! wikitext
13013 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13014 !! html
13015 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13016 !! end
13017
13018 !! test
13019 Category / paragraph interactions
13020 !! wikitext
13021 Foo [[Category:Baz]] Bar
13022
13023 Foo [[Category:Baz]]
13024 Bar
13025
13026 Foo
13027 [[Category:Baz]]
13028 Bar
13029
13030 Foo
13031 [[Category:Baz]] Bar
13032
13033 Foo
13034 [[Category:Baz]]
13035 [[Category:Baz]]
13036 [[Category:Baz]]
13037 Bar
13038
13039 [[Category:Baz]]
13040 [[Category:Baz]]
13041 [[Category:Baz]]
13042
13043 [[Category:Baz]]
13044 {{echo|[[Category:Baz]]}}
13045 [[Category:Baz]]
13046 !! html
13047 <p>Foo Bar
13048 </p><p>Foo
13049 Bar
13050 </p><p>Foo
13051 Bar
13052 </p><p>Foo Bar
13053 </p><p>Foo
13054 Bar
13055 </p>
13056 !! end
13057
13058 !! test
13059 Parsoid: Serialize link to category page with colon escape
13060 !! options
13061 parsoid
13062 !! wikitext
13063
13064 [[:Category:Foo]]
13065 [[:Category:Foo|Bar]]
13066 !! html
13067 <p>
13068 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
13069 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
13070 </p>
13071 !! end
13072
13073 !! test
13074 Parsoid: Link prefix/suffixes aren't applied to category links
13075 !! options
13076 parsoid=wt2html,wt2wt,html2html
13077 language=is
13078 !! wikitext
13079 x[[Category:Foo]]y
13080 !! html
13081 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
13082 !! end
13083
13084 !! test
13085 Parsoid: Serialize link to file page with colon escape
13086 !! options
13087 parsoid
13088 !! wikitext
13089
13090 [[:File:Foo.png]]
13091 [[:File:Foo.png|Bar]]
13092 !! html
13093 <p>
13094 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
13095 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
13096 </p>
13097 !! end
13098
13099 !! test
13100 Parsoid: Serialize a genuine category link without colon escape
13101 !! options
13102 parsoid
13103 !! wikitext
13104 [[Category:Foo]]
13105 [[Category:Foo|Bar]]
13106 !! html
13107 <link rel="mw:PageProp/Category" href="Category:Foo">
13108 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
13109 !! end
13110
13111 !! test
13112 Normalize hrefs properly before testing for invalid link targets (bug 70894)
13113 !! options
13114 parsoid=html2wt
13115 !! html
13116 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
13117 !! wikitext
13118 [[Category:Toxine bactérienne]]
13119 !! end
13120
13121 !! test
13122 Parsoid: Defaultsort
13123 !! options
13124 parsoid
13125 !! wikitext
13126 {{DEFAULTSORT:Foo}}
13127 !! html
13128 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
13129 !! end
13130
13131 ###
13132 ### Inter-language links
13133 ###
13134 !! test
13135 Interlanguage links
13136 !! options
13137 ill
13138 !! wikitext
13139 [[es:Alimento]]
13140 [[fr:Nourriture]]
13141 [[zh:食品]]
13142 !! html/php
13143 es:Alimento fr:Nourriture zh:食品
13144 !! html/parsoid
13145 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
13146 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
13147 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
13148 !! end
13149
13150 !! test
13151 Duplicate interlanguage links (bug 24502)
13152 !! options
13153 ill
13154 !! wikitext
13155 [[es:1]]
13156 [[es:2]]
13157 [[fr:1]]
13158 [[fr:2]]
13159 !! html/php
13160 es:1 fr:1
13161 !! html/parsoid
13162 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
13163 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
13164 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
13165 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
13166 !! end
13167
13168 ###
13169 ### Sections
13170 ###
13171 !! test
13172 Basic section headings
13173 !! wikitext
13174 == Headline 1 ==
13175 Some text
13176
13177 ==Headline 2==
13178 More
13179 ===Smaller headline===
13180 Blah blah
13181 !! html
13182 <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>
13183 <p>Some text
13184 </p>
13185 <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>
13186 <p>More
13187 </p>
13188 <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>
13189 <p>Blah blah
13190 </p>
13191 !! end
13192
13193 !! test
13194 Section headings with TOC
13195 !! wikitext
13196 == Headline 1 ==
13197 === Subheadline 1 ===
13198 ===== Skipping a level =====
13199 ====== Skipping a level ======
13200
13201 == Headline 2 ==
13202 Some text
13203 ===Another headline===
13204 !! html
13205 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13206 <ul>
13207 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
13208 <ul>
13209 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
13210 <ul>
13211 <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>
13212 <ul>
13213 <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>
13214 </ul>
13215 </li>
13216 </ul>
13217 </li>
13218 </ul>
13219 </li>
13220 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
13221 <ul>
13222 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
13223 </ul>
13224 </li>
13225 </ul>
13226 </div>
13227
13228 <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>
13229 <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>
13230 <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>
13231 <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>
13232 <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>
13233 <p>Some text
13234 </p>
13235 <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>
13236
13237 !! end
13238
13239 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
13240 !! test
13241 Handling of sections up to level 6 and beyond
13242 !! wikitext
13243 = Level 1 Heading=
13244 == Level 2 Heading==
13245 === Level 3 Heading===
13246 ==== Level 4 Heading====
13247 ===== Level 5 Heading=====
13248 ====== Level 6 Heading======
13249 ======= Level 7 Heading=======
13250 ======== Level 8 Heading========
13251 ========= Level 9 Heading=========
13252 ========== Level 10 Heading==========
13253 !! html
13254 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13255 <ul>
13256 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
13257 <ul>
13258 <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>
13259 <ul>
13260 <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>
13261 <ul>
13262 <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>
13263 <ul>
13264 <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>
13265 <ul>
13266 <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>
13267 <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>
13268 <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>
13269 <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>
13270 <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>
13271 </ul>
13272 </li>
13273 </ul>
13274 </li>
13275 </ul>
13276 </li>
13277 </ul>
13278 </li>
13279 </ul>
13280 </li>
13281 </ul>
13282 </div>
13283
13284 <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>
13285 <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>
13286 <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>
13287 <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>
13288 <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>
13289 <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>
13290 <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>
13291 <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>
13292 <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>
13293 <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>
13294
13295 !! end
13296
13297 !! test
13298 TOC regression (bug 9764)
13299 !! wikitext
13300 == title 1 ==
13301 === title 1.1 ===
13302 ==== title 1.1.1 ====
13303 === title 1.2 ===
13304 == title 2 ==
13305 === title 2.1 ===
13306 !! html
13307 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13308 <ul>
13309 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13310 <ul>
13311 <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>
13312 <ul>
13313 <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>
13314 </ul>
13315 </li>
13316 <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>
13317 </ul>
13318 </li>
13319 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13320 <ul>
13321 <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>
13322 </ul>
13323 </li>
13324 </ul>
13325 </div>
13326
13327 <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>
13328 <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>
13329 <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>
13330 <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>
13331 <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>
13332 <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>
13333
13334 !! end
13335
13336 !! test
13337 TOC with wgMaxTocLevel=3 (bug 6204)
13338 !! options
13339 wgMaxTocLevel=3
13340 !! wikitext
13341 == title 1 ==
13342 === title 1.1 ===
13343 ==== title 1.1.1 ====
13344 === title 1.2 ===
13345 == title 2 ==
13346 === title 2.1 ===
13347 !! html
13348 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13349 <ul>
13350 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13351 <ul>
13352 <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>
13353 <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>
13354 </ul>
13355 </li>
13356 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13357 <ul>
13358 <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>
13359 </ul>
13360 </li>
13361 </ul>
13362 </div>
13363
13364 <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>
13365 <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>
13366 <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>
13367 <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>
13368 <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>
13369 <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>
13370
13371 !! end
13372
13373 !! test
13374 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
13375 !! options
13376 wgMaxTocLevel=3
13377 !! wikitext
13378 ==Section 1==
13379 ===Section 1.1===
13380 ====Section 1.1.1====
13381 ====Section 1.1.1.1====
13382 ==Section 2==
13383 !! html
13384 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13385 <ul>
13386 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
13387 <ul>
13388 <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>
13389 </ul>
13390 </li>
13391 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
13392 </ul>
13393 </div>
13394
13395 <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>
13396 <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>
13397 <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>
13398 <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>
13399 <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>
13400
13401 !! end
13402
13403
13404 !! test
13405 Resolving duplicate section names
13406 !! wikitext
13407 == Foo bar ==
13408 == Foo bar ==
13409 !! html
13410 <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>
13411 <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>
13412
13413 !! end
13414
13415 !! test
13416 Resolving duplicate section names with differing case (bug 10721)
13417 !! wikitext
13418 == Foo bar ==
13419 == Foo Bar ==
13420 !! html
13421 <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>
13422 <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>
13423
13424 !! end
13425
13426 !! article
13427 Template:sections
13428 !! text
13429 ===Section 1===
13430 ==Section 2==
13431 !! endarticle
13432
13433 !! test
13434 Template with sections, __NOTOC__
13435 !! wikitext
13436 __NOTOC__
13437 ==Section 0==
13438 {{sections}}
13439 ==Section 4==
13440 !! html
13441 <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>
13442 <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>
13443 <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>
13444 <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>
13445
13446 !! end
13447
13448 !! test
13449 __NOEDITSECTION__ keyword
13450 !! wikitext
13451 __NOEDITSECTION__
13452 ==Section 1==
13453 ==Section 2==
13454 !! html
13455 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
13456 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
13457
13458 !! end
13459
13460 !! test
13461 Link inside a section heading
13462 !! wikitext
13463 ==Section with a [[Main Page|link]] in it==
13464 !! html
13465 <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>
13466
13467 !! end
13468
13469 !! test
13470 TOC regression (bug 12077)
13471 !! wikitext
13472 __TOC__
13473 == title 1 ==
13474 === title 1.1 ===
13475 == title 2 ==
13476 !! html
13477 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13478 <ul>
13479 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13480 <ul>
13481 <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>
13482 </ul>
13483 </li>
13484 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13485 </ul>
13486 </div>
13487
13488 <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>
13489 <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>
13490 <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>
13491
13492 !! end
13493
13494 !! test
13495 BUG 1219 URL next to image (good)
13496 !! wikitext
13497 http://example.com [[File:Foobar.jpg]]
13498 !! html/php
13499 <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>
13500 </p>
13501 !! html/parsoid
13502 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> <span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
13503 !!end
13504
13505 !! test
13506 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13507 !! wikitext
13508 ===
13509 The line above must have a trailing space!
13510 === <!--
13511 --> <!-- -->
13512 But just in case it doesn't...
13513 !! html
13514 <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>
13515 <p>The line above must have a trailing space!
13516 </p>
13517 <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>
13518 <p>But just in case it doesn't...
13519 </p>
13520 !! end
13521
13522 !! test
13523 Header with special characters (bug 25462)
13524 !! wikitext
13525 The tooltips shall not show entities to the user (ie. be double escaped)
13526
13527 == text > text ==
13528 section 1
13529
13530 == text < text ==
13531 section 2
13532
13533 == text & text ==
13534 section 3
13535
13536 == text ' text ==
13537 section 4
13538
13539 == text " text ==
13540 section 5
13541 !! html
13542 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13543 </p>
13544 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13545 <ul>
13546 <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>
13547 <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>
13548 <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>
13549 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13550 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13551 </ul>
13552 </div>
13553
13554 <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>
13555 <p>section 1
13556 </p>
13557 <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>
13558 <p>section 2
13559 </p>
13560 <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>
13561 <p>section 3
13562 </p>
13563 <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>
13564 <p>section 4
13565 </p>
13566 <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>
13567 <p>section 5
13568 </p>
13569 !! end
13570
13571 !! test
13572 Header with space, plus and underscore as entity
13573 !! wikitext
13574 Id should not contain + for spaces
13575
13576 == Space between Text ==
13577 section 1
13578
13579 == Space-Entity&#32;between&#32;Text ==
13580 section 2
13581
13582 == Plus+between+Text ==
13583 section 3
13584
13585 == Plus-Entity&#43;between&#43;Text ==
13586 section 4
13587
13588 == Underscore_between_Text ==
13589 section 5
13590
13591 == Underscore-Entity&#95;between&#95;Text ==
13592 section 6
13593
13594 [[#Space between Text]]
13595 [[#Space-Entity&#32;between&#32;Text]]
13596 [[#Plus+between+Text]]
13597 [[#Plus-Entity&#43;between&#43;Text]]
13598 [[#Underscore_between_Text]]
13599 [[#Underscore-Entity&#95;between&#95;Text]]
13600 !! html
13601 <p>Id should not contain + for spaces
13602 </p>
13603 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13604 <ul>
13605 <li class="toclevel-1 tocsection-1"><a href="#Space_between_Text"><span class="tocnumber">1</span> <span class="toctext">Space between Text</span></a></li>
13606 <li class="toclevel-1 tocsection-2"><a href="#Space-Entity_between_Text"><span class="tocnumber">2</span> <span class="toctext">Space-Entity&#32;between&#32;Text</span></a></li>
13607 <li class="toclevel-1 tocsection-3"><a href="#Plus.2Bbetween.2BText"><span class="tocnumber">3</span> <span class="toctext">Plus+between+Text</span></a></li>
13608 <li class="toclevel-1 tocsection-4"><a href="#Plus-Entity.2Bbetween.2BText"><span class="tocnumber">4</span> <span class="toctext">Plus-Entity&#43;between&#43;Text</span></a></li>
13609 <li class="toclevel-1 tocsection-5"><a href="#Underscore_between_Text"><span class="tocnumber">5</span> <span class="toctext">Underscore_between_Text</span></a></li>
13610 <li class="toclevel-1 tocsection-6"><a href="#Underscore-Entity_between_Text"><span class="tocnumber">6</span> <span class="toctext">Underscore-Entity&#95;between&#95;Text</span></a></li>
13611 </ul>
13612 </div>
13613
13614 <h2><span class="mw-headline" id="Space_between_Text">Space between Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Space between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13615 <p>section 1
13616 </p>
13617 <h2><span class="mw-headline" id="Space-Entity_between_Text">Space-Entity&#32;between&#32;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Space-Entity between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13618 <p>section 2
13619 </p>
13620 <h2><span class="mw-headline" id="Plus.2Bbetween.2BText">Plus+between+Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Plus+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13621 <p>section 3
13622 </p>
13623 <h2><span class="mw-headline" id="Plus-Entity.2Bbetween.2BText">Plus-Entity&#43;between&#43;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Plus-Entity+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13624 <p>section 4
13625 </p>
13626 <h2><span class="mw-headline" id="Underscore_between_Text">Underscore_between_Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Underscore between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13627 <p>section 5
13628 </p>
13629 <h2><span class="mw-headline" id="Underscore-Entity_between_Text">Underscore-Entity&#95;between&#95;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Underscore-Entity_between_Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13630 <p>section 6
13631 </p><p><a href="#Space_between_Text">#Space between Text</a>
13632 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
13633 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
13634 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
13635 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
13636 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
13637 </p>
13638 !! end
13639
13640 !! test
13641 Headers with excess '=' characters
13642 (Are similar tests necessary beyond the 1st level?)
13643 !! wikitext
13644 =foo==
13645 ==foo=
13646 =''italic'' heading==
13647 ==''italic'' heading=
13648 !! html
13649 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13650 <ul>
13651 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
13652 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
13653 <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>
13654 <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>
13655 </ul>
13656 </div>
13657
13658 <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>
13659 <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>
13660 <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>
13661 <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>
13662
13663 !! end
13664
13665 !! test
13666 HTML headers vs TOC (bug 23393)
13667 (__NOEDITSECTION__ for clearer output, doesn't matter here)
13668 !! wikitext
13669 <h1>Header 1</h1>
13670 == Header 1.1 ==
13671 == Header 1.2 ==
13672
13673 <h1>Header 2
13674 </h1>
13675 == Header 2.1 ==
13676 == Header 2.2 ==
13677 __NOEDITSECTION__
13678 !! html
13679 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13680 <ul>
13681 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
13682 <ul>
13683 <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>
13684 <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>
13685 </ul>
13686 </li>
13687 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
13688 <ul>
13689 <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>
13690 <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>
13691 </ul>
13692 </li>
13693 </ul>
13694 </div>
13695
13696 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
13697 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
13698 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
13699 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
13700 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
13701 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
13702
13703 !! end
13704
13705 !! test
13706 Single-line or multiline-comments can follow headings
13707 !! options
13708 parsoid=wt2html,wt2wt
13709 !! wikitext
13710 ==foo==<!---->
13711 ==bar==<!--c1-->
13712 ==baz==<!--
13713 c2
13714 c3-->
13715 !! html
13716 <h2><span class="mw-headline" id="foo">foo</span></h2>
13717 <h2><span class="mw-headline" id="bar">bar</span></h2>
13718 <h2><span class="mw-headline" id="baz">baz</span></h2>
13719
13720 !! end
13721
13722 !! test
13723 BUG 1219 URL next to image (broken)
13724 !! wikitext
13725 http://example.com[[File:Foobar.jpg]]
13726 !! html/php
13727 <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>
13728 </p>
13729 !! html/parsoid
13730 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
13731 !!end
13732
13733 !! test
13734 Bug 1186 news: in the middle of text
13735 !! wikitext
13736 http://en.wikinews.org/wiki/Wikinews:Workplace
13737 !! html
13738 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
13739 </p>
13740 !!end
13741
13742
13743 !! test
13744 Namespaced link must have a title
13745 !! wikitext
13746 [[Project:]]
13747 !! html
13748 <p>[[Project:]]
13749 </p>
13750 !!end
13751
13752 !! test
13753 Namespaced link must have a title (bad fragment version)
13754 !! wikitext
13755 [[Project:#fragment]]
13756 !! html
13757 <p>[[Project:#fragment]]
13758 </p>
13759 !!end
13760
13761
13762 ###
13763 ### HTML tags and HTML attributes
13764 ###
13765
13766 !! test
13767 div with no attributes
13768 !! wikitext
13769 <div>HTML rocks</div>
13770 !! html
13771 <div>HTML rocks</div>
13772
13773 !! end
13774
13775 !! test
13776 div with double-quoted attribute
13777 !! wikitext
13778 <div id="rock">HTML rocks</div>
13779 !! html
13780 <div id="rock">HTML rocks</div>
13781
13782 !! end
13783
13784 !! test
13785 div with single-quoted attribute
13786 !! wikitext
13787 <div id='rock'>HTML rocks</div>
13788 !! html
13789 <div id="rock">HTML rocks</div>
13790
13791 !! end
13792
13793 !! test
13794 div with unquoted attribute
13795 !! wikitext
13796 <div id=rock>HTML rocks</div>
13797 !! html
13798 <div id="rock">HTML rocks</div>
13799
13800 !! end
13801
13802 !! test
13803 div with illegal double attributes
13804 !! wikitext
13805 <div id="a" id="b">HTML rocks</div>
13806 !! html
13807 <div id="b">HTML rocks</div>
13808
13809 !!end
13810
13811 # FIXME: produce empty string instead of "class" in the PHP parser, following
13812 # the HTML5 spec.
13813 !! test
13814 div with empty attribute value, space before equals
13815 !! options
13816 parsoid
13817 !! wikitext
13818 <div class =>HTML rocks</div>
13819 !! html
13820 <div class="">HTML rocks</div>
13821
13822 !! end
13823
13824 !! test
13825 div with multiple empty attribute values
13826 !! options
13827 parsoid
13828 !! wikitext
13829 <div id= title=>HTML rocks</div>
13830 !! html
13831 <div id="" title="">HTML rocks</div>
13832
13833 !! end
13834
13835 !! test
13836 table with multiple empty attribute values
13837 !! options
13838 parsoid
13839 !! wikitext
13840 {| title= id=
13841 | hi
13842 |}
13843 !! html
13844 <table title="" id="">
13845 <tbody><tr><td> hi</td></tr>
13846 </tbody></table>
13847 !! end
13848
13849 !! test
13850 div with braces in attribute value
13851 !! wikitext
13852 <div title="{}">Foo</div>
13853 !! html/php
13854 <div title="&#123;}">Foo</div>
13855
13856 !! html/parsoid
13857 <div title="{}">Foo</div>
13858 !! end
13859
13860 # This it very inconsistent in the PHP parser: it returns
13861 # class="class" if there is a space between the name and the equal sign (see
13862 # 'div with empty attribute value, space before equals'), but strips the
13863 # attribute completely if the space is missing. We hope that not much content
13864 # depends on this, so are implementing the behavior below in Parsoid for
13865 # consistencies' sake.
13866 # FIXME: fix this behavior in the PHP parser?
13867 !! test
13868 div with empty attribute value, no space before equals
13869 !! options
13870 parsoid=wt2html,html2html
13871 !! wikitext
13872 <div class=>HTML rocks</div>
13873 !! html/php
13874 <div>HTML rocks</div>
13875
13876 !! html/parsoid
13877 <div class="">HTML rocks</div>
13878 !! end
13879
13880 !! test
13881 HTML multiple attributes correction
13882 !! wikitext
13883 <p class="error" class="awesome">Awesome!</p>
13884 !! html
13885 <p class="awesome">Awesome!</p>
13886
13887 !!end
13888
13889 !! test
13890 Table multiple attributes correction
13891 !! wikitext
13892 {|
13893 !+ class="error" class="awesome"| status
13894 |}
13895 !! html
13896 <table>
13897 <tr>
13898 <th class="awesome"> status
13899 </th></tr></table>
13900
13901 !!end
13902
13903 !! test
13904 DIV IN UPPERCASE
13905 !! wikitext
13906 <DIV ID="x">HTML ROCKS</DIV>
13907 !! html
13908 <div id="x">HTML ROCKS</div>
13909
13910 !!end
13911
13912 !! test
13913 Non-ASCII pseudo-tags are rendered as text
13914 !! wikitext
13915 <khyô>
13916 !! html
13917 <p>&lt;khyô&gt;
13918 </p>
13919 !! end
13920
13921 !! test
13922 Pseudo-tag with URL 'name' renders as url link
13923 !! wikitext
13924 <http://example.com/>
13925 !! html
13926 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
13927 </p>
13928 !! end
13929
13930 !! test
13931 text with amp in the middle of nowhere
13932 !! wikitext
13933 Remember AT&T?
13934 !! html
13935 <p>Remember AT&amp;T?
13936 </p>
13937 !! end
13938
13939 !! test
13940 text with character entity: eacute
13941 !! wikitext
13942 I always thought &eacute; was a cute letter.
13943 !! html
13944 <p>I always thought &#233; was a cute letter.
13945 </p>
13946 !! html+tidy
13947 <p>I always thought é was a cute letter.</p>
13948 !! end
13949
13950 !! test
13951 text with entity-escaped character entity-like string: eacute
13952 !! wikitext
13953 I always thought &amp;eacute; was a cute letter.
13954 !! html
13955 <p>I always thought &amp;eacute; was a cute letter.
13956 </p>
13957 !! end
13958
13959 !! test
13960 text with undefined character entity: xacute
13961 !! wikitext
13962 I always thought &xacute; was a cute letter.
13963 !! html
13964 <p>I always thought &amp;xacute; was a cute letter.
13965 </p>
13966 !! end
13967
13968 # TODO: generalize to PHP parser?
13969 !! test
13970 HTML5 tags
13971 !! options
13972 parsoid
13973 !! wikitext
13974 <data value="5">five</data>
13975 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13976 <mark>This highlighted text</mark>
13977 !! html
13978 <p><data value="5">five</data>
13979 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13980 <mark>This highlighted text</mark></p>
13981 !! end
13982
13983 !! test
13984 HTML tag with leading space is parsed as text
13985 !! wikitext
13986 < div>foo< /div>
13987 !! html
13988 <p>&lt; div&gt;foo&lt; /div&gt;
13989 </p>
13990 !! end
13991
13992 ###
13993 ### Nesting tests (see bug 41545, 50604, 51081)
13994 ###
13995
13996 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
13997 # Note that html2wt is considerably more difficult if we use <b> in
13998 # the test case, instead of <big>
13999 !! test
14000 Ensure that HTML adoption agency algorithm is properly implemented.
14001 !! wikitext
14002 <big>X<big>Y</big>Z</big>
14003 !! html
14004 <p><big>X<big>Y</big>Z</big>
14005 </p>
14006 !! end
14007
14008 # This was bug 41545 in the PHP parser.
14009 # Note that tidy doesn't handle this correctly.
14010 !! test
14011 Nesting of <kbd>
14012 !! wikitext
14013 <kbd>X<kbd>Y</kbd>Z</kbd>
14014 !! html
14015 <p><kbd>X<kbd>Y</kbd>Z</kbd>
14016 </p>
14017 !! end
14018
14019 # The following cases were bug 51081 in the PHP parser.
14020 # Note that there are some other nestable tags (b, i, etc) which are
14021 # not covered; see bug 51081 for discussion.
14022
14023 # Note that tidy doesn't handle this correctly.
14024 !! test
14025 Nesting of <em>
14026 !! wikitext
14027 <em>X<em>Y</em>Z</em>
14028 !! html
14029 <p><em>X<em>Y</em>Z</em>
14030 </p>
14031 !! end
14032
14033 # Note that tidy doesn't handle this correctly.
14034 !! test
14035 Nesting of <strong>
14036 !! wikitext
14037 <strong>X<strong>Y</strong>Z</strong>
14038 !! html
14039 <p><strong>X<strong>Y</strong>Z</strong>
14040 </p>
14041 !! end
14042
14043 !! test
14044 Nesting of <q>
14045 !! wikitext
14046 <q>X<q>Y</q>Z</q>
14047 !! html+tidy
14048 <p><q>X<q>Y</q>Z</q></p>
14049 !! end
14050
14051 # Note that tidy doesn't handle this correctly.
14052 !! test
14053 Nesting of <ruby>
14054 !! wikitext
14055 <ruby>X<ruby>Y</ruby>Z</ruby>
14056 !! html
14057 <p><ruby>X<ruby>Y</ruby>Z</ruby>
14058 </p>
14059 !! end
14060
14061 # Note that tidy doesn't handle this correctly.
14062 !! test
14063 Nesting of <bdo>
14064 !! wikitext
14065 <bdo>X<bdo>Y</bdo>Z</bdo>
14066 !! html
14067 <p><bdo>X<bdo>Y</bdo>Z</bdo>
14068 </p>
14069 !! end
14070
14071
14072 ###
14073 ### Media links
14074 ###
14075
14076 !! test
14077 Media link
14078 !! wikitext
14079 [[Media:Foobar.jpg]]
14080 !! html
14081 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
14082 </p>
14083 !! end
14084
14085 !! test
14086 Media link with text
14087 !! wikitext
14088 [[Media:Foobar.jpg|A neat file to look at]]
14089 !! html
14090 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
14091 </p>
14092 !! end
14093
14094 # FIXME: this is still bad HTML tag nesting
14095 !! test
14096 Media link with nasty text
14097 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
14098 !! wikitext
14099 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
14100 !! html
14101 <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>
14102
14103 !! html+tidy
14104 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link&lt;div style="display:none"&gt;" onmouseover="alert(document.cookie)" onfoo="&lt;/div&gt;</a></p>
14105 !! end
14106
14107 !! test
14108 Media link to nonexistent file (bug 1702)
14109 !! wikitext
14110 [[Media:No such.jpg]]
14111 !! html
14112 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
14113 </p>
14114 !! end
14115
14116 !! test
14117 Image link to nonexistent file (bug 1850 - good)
14118 !! wikitext
14119 [[File:No_such.jpg]]
14120 !! html/php
14121 <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>
14122 </p>
14123 !! html/parsoid
14124 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="File:No_such.jpg"><img resource="./File:No_such.jpg" src="./Special:FilePath/No_such.jpg" height="220" width="220"/></a></span></p>
14125 !! end
14126
14127 !! test
14128 :Image link to nonexistent file (bug 1850 - bad)
14129 !! wikitext
14130 [[:Image:No such.jpg]]
14131 !! html/php
14132 <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>
14133 </p>
14134 !! html/parsoid
14135 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
14136 !! end
14137
14138
14139
14140 !! test
14141 Character reference normalization in link text (bug 1938)
14142 !! wikitext
14143 [[Main Page|this&that]]
14144 !! html
14145 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
14146 </p>
14147 !!end
14148
14149 !! article
14150 אַ
14151 !! text
14152 Test for unicode normalization
14153
14154 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
14155 !! endarticle
14156
14157 !! test
14158 (bug 19451) Links should refer to the normalized form.
14159 !! wikitext
14160 [[&#xFB2E;]]
14161 [[&#x5d0;&#x5b7;]]
14162 [[&#x5d0;ַ]]
14163 [[א&#x5b7;]]
14164 [[אַ]]
14165 !! html
14166 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
14167 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
14168 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
14169 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
14170 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
14171 </p>
14172 !! end
14173
14174 !! test
14175 Empty attribute crash test (bug 2067)
14176 !! wikitext
14177 <font color="">foo</font>
14178 !! html
14179 <p><font color="">foo</font>
14180 </p>
14181 !! end
14182
14183 !! test
14184 Empty attribute crash test single-quotes (bug 2067)
14185 !! wikitext
14186 <font color=''>foo</font>
14187 !! html
14188 <p><font color="">foo</font>
14189 </p>
14190 !! end
14191
14192 !! test
14193 Attribute test: equals, then nothing
14194 !! wikitext
14195 <font color=>foo</font>
14196 !! html
14197 <p><font>foo</font>
14198 </p>
14199 !! end
14200
14201 !! test
14202 Attribute test: unquoted value
14203 !! wikitext
14204 <font color=x>foo</font>
14205 !! html
14206 <p><font color="x">foo</font>
14207 </p>
14208 !! end
14209
14210 !! test
14211 Attribute test: unquoted but illegal value (hash)
14212 !! wikitext
14213 <font color=#x>foo</font>
14214 !! html
14215 <p><font color="#x">foo</font>
14216 </p>
14217 !! end
14218
14219 !! test
14220 Attribute test: no value
14221 !! wikitext
14222 <font color>foo</font>
14223 !! html
14224 <p><font color="color">foo</font>
14225 </p>
14226 !! end
14227
14228 !! test
14229 Bug 2095: link with three closing brackets
14230 !! wikitext
14231 [[Main Page]]]
14232 !! html/php
14233 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
14234 </p>
14235 !! html/parsoid
14236 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
14237 !! end
14238
14239 !! test
14240 Bug 2095: link with pipe and three closing brackets
14241 !! wikitext
14242 [[Main Page|link]]]
14243 !! html/php
14244 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
14245 </p>
14246 !! html/parsoid
14247 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
14248 !! end
14249
14250 !! test
14251 Bug 2095: link with pipe and three closing brackets, version 2
14252 !! wikitext
14253 [[Main Page|[http://example.com/]]]
14254 !! html/php
14255 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
14256 </p>
14257 !! html/parsoid
14258 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
14259 !! end
14260
14261
14262 ###
14263 ### Safety
14264 ###
14265
14266 !! article
14267 Template:Dangerous attribute
14268 !! text
14269 " onmouseover="alert(document.cookie)
14270 !! endarticle
14271
14272 !! article
14273 Template:Dangerous style attribute
14274 !! text
14275 border-size: expression(alert(document.cookie))
14276 !! endarticle
14277
14278 !! article
14279 Template:Div style
14280 !! text
14281 <div style="float: right; {{{1}}}">Magic div</div>
14282 !! endarticle
14283
14284 !! test
14285 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
14286 !! wikitext
14287 <div title="{{test}}"></div>
14288 !! html
14289 <div title="This is a test template"></div>
14290
14291 !! end
14292
14293 # Parsoid has enough context to handle this case
14294 !! test
14295 Bug 2304: HTML attribute safety (dangerous template; 2309)
14296 !! wikitext
14297 <div title="{{dangerous attribute}}"></div>
14298 !! html/php
14299 <div title=""></div>
14300
14301 !! html/parsoid
14302 <div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[12,35,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;dangerous attribute&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Dangerous_attribute&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
14303 !! end
14304
14305 !! test
14306 Bug 2304: HTML attribute safety (dangerous style template; 2309)
14307 !! wikitext
14308 <div style="{{dangerous style attribute}}"></div>
14309 !! html
14310 <div style="/* insecure input */"></div>
14311
14312 !! end
14313
14314 !! test
14315 Bug 2304: HTML attribute safety (safe parameter; 2309)
14316 !! wikitext
14317 {{div style|width: 200px}}
14318 !! html
14319 <div style="float: right; width: 200px">Magic div</div>
14320
14321 !! end
14322
14323 !! test
14324 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
14325 !! wikitext
14326 {{div style|width: expression(alert(document.cookie))}}
14327 !! html
14328 <div style="/* insecure input */">Magic div</div>
14329
14330 !! end
14331
14332 !! test
14333 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
14334 !! wikitext
14335 {{div style|"><script>alert(document.cookie)</script>}}
14336 !! html
14337 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14338
14339 !! end
14340
14341 !! test
14342 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
14343 !! wikitext
14344 {{div style|" ><script>alert(document.cookie)</script>}}
14345 !! html
14346 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14347
14348 !! end
14349
14350 !! test
14351 Bug 2304: HTML attribute safety (link)
14352 !! wikitext
14353 <div title="[[Main Page]]"></div>
14354 !! html
14355 <div title="&#91;&#91;Main Page]]"></div>
14356
14357 !! end
14358
14359 !! test
14360 Bug 2304: HTML attribute safety (italics)
14361 !! wikitext
14362 <div title="''foobar''"></div>
14363 !! html
14364 <div title="&#39;&#39;foobar&#39;&#39;"></div>
14365
14366 !! end
14367
14368 !! test
14369 Bug 2304: HTML attribute safety (bold)
14370 !! wikitext
14371 <div title="'''foobar'''"></div>
14372 !! html
14373 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
14374
14375 !! end
14376
14377
14378 !! test
14379 Bug 2304: HTML attribute safety (ISBN)
14380 !! wikitext
14381 <div title="ISBN 1234567890"></div>
14382 !! html
14383 <div title="&#73;SBN 1234567890"></div>
14384
14385 !! end
14386
14387 !! test
14388 Bug 2304: HTML attribute safety (RFC)
14389 !! wikitext
14390 <div title="RFC 1234"></div>
14391 !! html
14392 <div title="&#82;FC 1234"></div>
14393
14394 !! end
14395
14396 !! test
14397 Bug 2304: HTML attribute safety (PMID)
14398 !! wikitext
14399 <div title="PMID 1234567890"></div>
14400 !! html
14401 <div title="&#80;MID 1234567890"></div>
14402
14403 !! end
14404
14405 !! test
14406 Bug 2304: HTML attribute safety (web link)
14407 !! wikitext
14408 <div title="http://example.com/"></div>
14409 !! html
14410 <div title="http&#58;//example.com/"></div>
14411
14412 !! end
14413
14414 !! test
14415 Bug 2304: HTML attribute safety (named web link)
14416 !! wikitext
14417 <div title="[http://example.com/ link]"></div>
14418 !! html
14419 <div title="&#91;http&#58;//example.com/ link]"></div>
14420
14421 !! end
14422
14423 !! test
14424 Bug 3244: HTML attribute safety (extension; safe)
14425 !! wikitext
14426 <div style="<nowiki>background:blue</nowiki>"></div>
14427 !! html
14428 <div style="background:blue"></div>
14429
14430 !! end
14431
14432 !! test
14433 Bug 3244: HTML attribute safety (extension; unsafe)
14434 !! wikitext
14435 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14436 !! html
14437 <div style="/* insecure input */"></div>
14438
14439 !! end
14440
14441 # More MSIE fun discovered by Tom Gilder
14442
14443 !! test
14444 MSIE CSS safety test: spurious slash
14445 !! wikitext
14446 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14447 !! html
14448 <div style="/* insecure input */">evil</div>
14449
14450 !! end
14451
14452 !! test
14453 MSIE CSS safety test: hex code
14454 !! wikitext
14455 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14456 !! html
14457 <div style="/* insecure input */">evil</div>
14458
14459 !! end
14460
14461 !! test
14462 MSIE CSS safety test: comment in url
14463 !! wikitext
14464 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14465 !! html
14466 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14467
14468 !! end
14469
14470 !! test
14471 MSIE CSS safety test: comment in expression
14472 !! wikitext
14473 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14474 !! html
14475 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14476
14477 !! end
14478
14479 !! test
14480 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14481 !! wikitext
14482 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14483 !! html
14484 <p style="/* invalid control char */">A</p>
14485
14486 !! end
14487
14488 !! test
14489 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14490 !! wikitext
14491 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14492 <div style="top:EXPRESSION(alert())">B</div>
14493 !! html
14494 <p style="/* insecure input */">A</p>
14495 <div style="/* insecure input */">B</div>
14496
14497 !! end
14498
14499 !! test
14500 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14501 !! wikitext
14502 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14503 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14504 !! html
14505 <div style="/* insecure input */">A</div>
14506 <p style="/* insecure input */">B</p>
14507
14508 !! end
14509
14510 !! test
14511 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14512 !! wikitext
14513 <div style="background-image:url⁽javascript:alert())">A</div>
14514 <div style="background-image:url₍javascript:alert())">B</div>
14515 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14516 !! html
14517 <div style="/* insecure input */">A</div>
14518 <div style="/* insecure input */">B</div>
14519 <p style="/* insecure input */">C</p>
14520
14521 !! end
14522
14523 !! test
14524 Opera -o-link CSS
14525 !! wikitext
14526 <div
14527 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;"
14528 style="-o-link:attr(title);-o-link-source:current">X</div>
14529 !! html
14530 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14531
14532 !! end
14533
14534 !! test
14535 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14536 !! wikitext
14537 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14538 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14539 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14540 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14541 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14542 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14543 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14544 !! html
14545 <p style="/* insecure input */">A</p>
14546 <p style="/* insecure input */">B</p>
14547 <p style="/* insecure input */">C</p>
14548 <p style="/* insecure input */">D</p>
14549 <p style="/* insecure input */">E</p>
14550 <p style="/* insecure input */">F</p>
14551 <p style="/* insecure input */">G</p>
14552
14553 !! end
14554
14555 !! test
14556 Table attribute legitimate extension
14557 !! wikitext
14558 {|
14559 !+ style="<nowiki>color:blue</nowiki>"| status
14560 |}
14561 !! html
14562 <table>
14563 <tr>
14564 <th style="color:blue"> status
14565 </th></tr></table>
14566
14567 !!end
14568
14569 !! test
14570 Table attribute safety
14571 !! wikitext
14572 {|
14573 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14574 |}
14575 !! html
14576 <table>
14577 <tr>
14578 <th style="/* insecure input */"> status
14579 </th></tr></table>
14580
14581 !! end
14582
14583 !! test
14584 CSS line continuation 1
14585 !! wikitext
14586 <div style="background-image: u\&#10;rl(test.jpg);"></div>
14587 !! html
14588 <div style="/* insecure input */"></div>
14589
14590 !! end
14591
14592 !! test
14593 CSS line continuation 2
14594 !! wikitext
14595 <div style="background-image: u\&#13;rl(test.jpg); "></div>
14596 !! html
14597 <div style="/* insecure input */"></div>
14598
14599 !! end
14600
14601 !! article
14602 Template:Identity
14603 !! text
14604 {{{1}}}
14605 !! endarticle
14606
14607 !! test
14608 Expansion of multi-line templates in attribute values (bug 6255)
14609 !! wikitext
14610 <div style="background: {{identity|#00FF00}}">-</div>
14611 !! html
14612 <div style="background: #00FF00">-</div>
14613
14614 !! end
14615
14616
14617 !! test
14618 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
14619 !! wikitext
14620 <div style="background:
14621 #00FF00">-</div>
14622 !! html/php
14623 <div style="background: #00FF00">-</div>
14624
14625 !! html/parsoid
14626 <div style="background:
14627 #00FF00">-</div>
14628 !! end
14629
14630 !! test
14631 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
14632 !! wikitext
14633 <div style="background: &#10;#00FF00">-</div>
14634 !! html
14635 <div style="background: &#10;#00FF00">-</div>
14636
14637 !! end
14638
14639 !! test
14640 evil <math>-wiki-tags without Extension:Math enabled
14641 !! wikitext
14642 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
14643 !! html+tidy
14644 <p>&lt;math&gt;&lt;img src="some evil external link"&gt;&lt;script&gt;some_evil_javascript();&lt;/script&gt;&lt;/math&gt;</p>
14645 !! end
14646
14647 ###
14648 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
14649 ###
14650 !! test
14651 Parser hook: empty input
14652 !! wikitext
14653 <tag></tag>
14654 !! html
14655 <pre>
14656 ''
14657 array (
14658 )
14659 </pre>
14660
14661 !! end
14662
14663 !! test
14664 Parser hook: empty input using terminated empty elements
14665 !! wikitext
14666 <tag/>
14667 !! html
14668 <pre>
14669 NULL
14670 array (
14671 )
14672 </pre>
14673
14674 !! end
14675
14676 !! test
14677 Parser hook: empty input using terminated empty elements (space before)
14678 !! wikitext
14679 <tag />
14680 !! html
14681 <pre>
14682 NULL
14683 array (
14684 )
14685 </pre>
14686
14687 !! end
14688
14689 !! test
14690 Parser hook: basic input
14691 !! wikitext
14692 <tag>input</tag>
14693 !! html
14694 <pre>
14695 'input'
14696 array (
14697 )
14698 </pre>
14699
14700 !! end
14701
14702
14703 !! test
14704 Parser hook: case insensitive
14705 !! wikitext
14706 <TAG>input</TAG>
14707 !! html
14708 <pre>
14709 'input'
14710 array (
14711 )
14712 </pre>
14713
14714 !! end
14715
14716
14717 !! test
14718 Parser hook: case insensitive, redux
14719 !! wikitext
14720 <TaG>input</TAg>
14721 !! html
14722 <pre>
14723 'input'
14724 array (
14725 )
14726 </pre>
14727
14728 !! end
14729
14730 !! test
14731 Parser hook: nested tags
14732 !! options
14733 noxml
14734 !! wikitext
14735 <tag><tag></tag></tag>
14736 !! html
14737 <pre>
14738 '<tag>'
14739 array (
14740 )
14741 </pre>&lt;/tag&gt;
14742
14743 !! end
14744
14745 !! test
14746 Parser hook: basic arguments
14747 !! wikitext
14748 <tag width=200 height = "100" depth = '50' square></tag>
14749 !! html
14750 <pre>
14751 ''
14752 array (
14753 'width' => '200',
14754 'height' => '100',
14755 'depth' => '50',
14756 'square' => 'square',
14757 )
14758 </pre>
14759
14760 !! end
14761
14762 !! test
14763 Parser hook: argument containing a forward slash (bug 5344)
14764 !! wikitext
14765 <tag filename='/tmp/bla'></tag>
14766 !! html
14767 <pre>
14768 ''
14769 array (
14770 'filename' => '/tmp/bla',
14771 )
14772 </pre>
14773
14774 !! end
14775
14776 !! test
14777 Parser hook: empty input using terminated empty elements (bug 2374)
14778 !! wikitext
14779 <tag foo=bar/>text
14780 !! html
14781 <pre>
14782 NULL
14783 array (
14784 'foo' => 'bar',
14785 )
14786 </pre>text
14787
14788 !! end
14789
14790 # </tag> should be output literally since there is no matching tag that begins it
14791 !! test
14792 Parser hook: basic arguments using terminated empty elements (bug 2374)
14793 !! wikitext
14794 <tag width=200 height = "100" depth = '50' square/>
14795 other stuff
14796 </tag>
14797 !! html
14798 <pre>
14799 NULL
14800 array (
14801 'width' => '200',
14802 'height' => '100',
14803 'depth' => '50',
14804 'square' => 'square',
14805 )
14806 </pre>
14807 <p>other stuff
14808 &lt;/tag&gt;
14809 </p>
14810 !! end
14811
14812 ###
14813 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14814 ###
14815
14816 !! test
14817 Parser hook: static parser hook not inside a comment
14818 !! wikitext
14819 <statictag>hello, world</statictag>
14820 <statictag action=flush/>
14821 !! html
14822 <p>hello, world
14823 </p>
14824 !! end
14825
14826
14827 !! test
14828 Parser hook: static parser hook inside a comment
14829 !! wikitext
14830 <!-- <statictag>hello, world</statictag> -->
14831 <statictag action=flush/>
14832 !! html
14833 <p><br />
14834 </p>
14835 !! end
14836
14837 # Nested template calls; this case was broken by Parser.php rev 1.506,
14838 # since reverted.
14839
14840 !! article
14841 Template:One-parameter
14842 !! text
14843 (My parameter is: {{{1}}})
14844 !! endarticle
14845
14846 !! article
14847 Template:Map-one-parameter
14848 !! text
14849 {{{{{1}}}|{{{2}}}}}
14850 !! endarticle
14851
14852 !! test
14853 Nested template calls
14854 !! wikitext
14855 {{Map-one-parameter|One-parameter|param}}
14856 !! html
14857 <p>(My parameter is: param)
14858 </p>
14859 !! end
14860
14861
14862 ###
14863 ### Sanitizer
14864 ###
14865
14866 # HTML+Tidy effectively strips out the empty tags completely
14867 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
14868 # which Tidy would have done for the PHP parser had there been content inside it.
14869 !! test
14870 Sanitizer: Closing of open tags
14871 !! wikitext
14872 <s></s><table></table>
14873 !! html
14874 <s></s><table></table>
14875
14876 !! html/parsoid
14877 <p><s></s></p><table></table>
14878 !! end
14879
14880 !! test
14881 Sanitizer: Closing of open but not closed tags
14882 !! wikitext
14883 <s>foo
14884 !! html
14885 <p><s>foo</s>
14886 </p>
14887 !! end
14888
14889 !! test
14890 Sanitizer: Closing of closed but not open tags
14891 !! wikitext
14892 </s>
14893 !! html
14894 <p>&lt;/s&gt;
14895 </p>
14896 !! end
14897
14898 !! test
14899 Sanitizer: Closing of closed but not open table tags
14900 !! wikitext
14901 Table not started</td></tr></table>
14902 !! html
14903 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
14904 </p>
14905 !! end
14906
14907 !! test
14908 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
14909 !! wikitext
14910 <span id="æ: v">byte</span>[[#æ: v|backlink]]
14911 !! html
14912 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
14913 </p>
14914 !! end
14915
14916 # In HTML5, the restrictions are that id must contain at least one character,
14917 # and must not contain any space characters.
14918 !! test
14919 Sanitizer: Validating the contents of the id attribute (bug 4515)
14920 !! options
14921 disabled
14922 !! wikitext
14923 <br id="" /><br id="a space" />
14924 !! html
14925 Something ...
14926 !! end
14927
14928 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
14929 !! test
14930 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
14931 !! options
14932 disabled
14933 !! wikitext
14934 <br id="foo" /><br id="foo" />
14935 !! html
14936 Something need to be done. foo-2 ?
14937 !! end
14938
14939 !! test
14940 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
14941 !! wikitext
14942 <div itemscope>
14943 <meta itemprop="hello" content="world">
14944 <meta http-equiv="refresh" content="5">
14945 <meta itemprop="hello" http-equiv="refresh" content="5">
14946 <link itemprop="hello" href="{{SERVER}}">
14947 <link rel="stylesheet" href="{{SERVER}}">
14948 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
14949 </div>
14950 !! html
14951 <div itemscope="itemscope">
14952 <p> <meta itemprop="hello" content="world" />
14953 &lt;meta http-equiv="refresh" content="5"&gt;
14954 <meta itemprop="hello" content="5" />
14955 </p>
14956 <link itemprop="hello" href="http&#58;//example.org" />
14957 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
14958 <link itemprop="hello" href="http&#58;//example.org" />
14959 </div>
14960
14961 !! end
14962
14963 !! test
14964 Language converter: output gets cut off unexpectedly (bug 5757)
14965 !! options
14966 language=zh
14967 !! wikitext
14968 this bit is safe: }-
14969
14970 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
14971
14972 then we get cut off here: }-
14973
14974 all additional text is vanished
14975 !! html
14976 <p>this bit is safe: }-
14977 </p><p>but if we add a conversion instance: xxx
14978 </p><p>then we get cut off here: }-
14979 </p><p>all additional text is vanished
14980 </p>
14981 !! end
14982
14983 !! test
14984 Self closed html pairs (bug 5487)
14985 !! options
14986 !! wikitext
14987 <center><font id="bug" />Centered text</center>
14988 <div><font id="bug2" />In div text</div>
14989 !! html
14990 <center>&lt;font id="bug" /&gt;Centered text</center>
14991 <div>&lt;font id="bug2" /&gt;In div text</div>
14992
14993 !! end
14994
14995 #
14996 #
14997 #
14998
14999 !! test
15000 Punctuation: nbsp before exclamation
15001 !! wikitext
15002 C'est grave !
15003 !! html
15004 <p>C'est grave&#160;!
15005 </p>
15006 !! end
15007
15008 !! test
15009 Punctuation: CSS !important (bug 11874)
15010 !! wikitext
15011 <div style="width:50% !important">important</div>
15012 !! html
15013 <div style="width:50% !important">important</div>
15014
15015 !!end
15016
15017 !! test
15018 Punctuation: CSS ! important (bug 11874; with space after)
15019 !! wikitext
15020 <div style="width:50% ! important">important</div>
15021 !! html
15022 <div style="width:50% ! important">important</div>
15023
15024 !!end
15025
15026 !! test
15027 HTML bullet list, closed tags (bug 5497)
15028 !! wikitext
15029 <ul>
15030 <li>One</li>
15031 <li>Two</li>
15032 </ul>
15033 !! html/php
15034 <ul>
15035 <li>One</li>
15036 <li>Two</li>
15037 </ul>
15038
15039 !! html/parsoid
15040 <ul data-parsoid='{"stx":"html"}'>
15041 <li data-parsoid='{"stx":"html"}'>One</li>
15042 <li data-parsoid='{"stx":"html"}'>Two</li>
15043 </ul>
15044
15045 !! end
15046
15047 !! test
15048 HTML bullet list, unclosed tags (bug 5497)
15049 !! wikitext
15050 <ul>
15051 <li>One
15052 <li>Two
15053 </ul>
15054 !! html/php+tidy
15055 <ul>
15056 <li>One</li>
15057 <li>Two</li>
15058 </ul>
15059 !! html/parsoid
15060 <ul data-parsoid='{"stx":"html"}'>
15061 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15062 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15063 </ul>
15064
15065 !! end
15066
15067 !! test
15068 HTML ordered list, closed tags (bug 5497)
15069 !! wikitext
15070 <ol>
15071 <li>One</li>
15072 <li>Two</li>
15073 </ol>
15074 !! html/php
15075 <ol>
15076 <li>One</li>
15077 <li>Two</li>
15078 </ol>
15079
15080 !! html/parsoid
15081 <ol data-parsoid='{"stx":"html"}'>
15082 <li data-parsoid='{"stx":"html"}'>One</li>
15083 <li data-parsoid='{"stx":"html"}'>Two</li>
15084 </ol>
15085
15086 !! end
15087
15088 !! test
15089 HTML ordered list, unclosed tags (bug 5497)
15090 !! options
15091 !! wikitext
15092 <ol>
15093 <li>One
15094 <li>Two
15095 </ol>
15096 !! html/php+tidy
15097 <ol>
15098 <li>One</li>
15099 <li>Two</li>
15100 </ol>
15101 !! html/parsoid
15102 <ol data-parsoid='{"stx":"html"}'>
15103 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15104 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15105 </ol>
15106
15107 !! end
15108
15109 !! test
15110 HTML nested bullet list, closed tags (bug 5497)
15111 !! wikitext
15112 <ul>
15113 <li>One</li>
15114 <li>Two:
15115 <ul>
15116 <li>Sub-one</li>
15117 <li>Sub-two</li>
15118 </ul>
15119 </li>
15120 </ul>
15121 !! html
15122 <ul>
15123 <li>One</li>
15124 <li>Two:
15125 <ul>
15126 <li>Sub-one</li>
15127 <li>Sub-two</li>
15128 </ul>
15129 </li>
15130 </ul>
15131
15132 !! end
15133
15134 !! test
15135 HTML nested bullet list, open tags (bug 5497)
15136 !! wikitext
15137 <ul>
15138 <li>One
15139 <li>Two:
15140 <ul>
15141 <li>Sub-one
15142 <li>Sub-two
15143 </ul>
15144 </ul>
15145 !! html/php+tidy
15146 <ul>
15147 <li>One</li>
15148 <li>Two:
15149 <ul>
15150 <li>Sub-one</li>
15151 <li>Sub-two</li>
15152 </ul>
15153 </li>
15154 </ul>
15155 !! html/parsoid
15156 <ul>
15157 <li>One
15158 </li>
15159 <li>Two:
15160 <ul>
15161 <li>Sub-one
15162 </li>
15163 <li>Sub-two
15164 </li>
15165 </ul>
15166 </li>
15167 </ul>
15168
15169 !! end
15170
15171 !! test
15172 HTML nested ordered list, closed tags (bug 5497)
15173 !! wikitext
15174 <ol>
15175 <li>One</li>
15176 <li>Two:
15177 <ol>
15178 <li>Sub-one</li>
15179 <li>Sub-two</li>
15180 </ol>
15181 </li>
15182 </ol>
15183 !! html
15184 <ol>
15185 <li>One</li>
15186 <li>Two:
15187 <ol>
15188 <li>Sub-one</li>
15189 <li>Sub-two</li>
15190 </ol>
15191 </li>
15192 </ol>
15193
15194 !! end
15195
15196 !! test
15197 HTML nested ordered list, open tags (bug 5497)
15198 !! wikitext
15199 <ol>
15200 <li>One
15201 <li>Two:
15202 <ol>
15203 <li>Sub-one
15204 <li>Sub-two
15205 </ol>
15206 </ol>
15207 !! html/php
15208 <ol>
15209 <li>One
15210 <li>Two:
15211 <ol>
15212 <li>Sub-one
15213 <li>Sub-two
15214 </ol>
15215 </ol>
15216
15217 !! html/parsoid
15218 <ol>
15219 <li>One
15220 </li>
15221 <li>Two:
15222 <ol>
15223 <li>Sub-one
15224 </li>
15225 <li>Sub-two
15226 </li>
15227 </ol>
15228 </li>
15229 </ol>
15230
15231 !! end
15232
15233 !! test
15234 HTML ordered list item with parameters oddity
15235 !! wikitext
15236 <ol><li id="fragment">One</li>
15237 </ol>
15238 !! html
15239 <ol><li id="fragment">One</li>
15240 </ol>
15241
15242 !! end
15243
15244 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
15245 !!test
15246 bug 5918: autonumbering
15247 !! wikitext
15248 [http://first/] [http://second] [ftp://ftp]
15249
15250 ftp://inlineftp
15251
15252 [mailto:enclosed@mail.tld With target]
15253
15254 [mailto:enclosed@mail.tld]
15255
15256 mailto:inline@mail.tld
15257 !! html/php
15258 <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>
15259 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
15260 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
15261 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
15262 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
15263 </p>
15264 !! html/parsoid
15265 <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>
15266 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
15267 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
15268 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
15269 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
15270 !! end
15271
15272
15273 #
15274 # Security and HTML correctness
15275 # From Nick Jenkins' fuzz testing
15276 #
15277
15278 !! test
15279 Fuzz testing: Parser13
15280 !! wikitext
15281 {|
15282 | http://a|
15283 !! html
15284 <table>
15285 <tr>
15286 <td>
15287 </td>
15288 </tr>
15289 </table>
15290
15291 !! end
15292
15293 !! test
15294 Fuzz testing: Parser14
15295 !! wikitext
15296 == onmouseover= ==
15297 http://__TOC__
15298 !! html
15299 <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>
15300 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15301 <ul>
15302 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15303 </ul>
15304 </div>
15305
15306
15307 !! html+tidy
15308 <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>
15309 <p>http://</p>
15310 <div id="toc" class="toc">
15311 <div id="toctitle">
15312 <h2>Contents</h2>
15313 </div>
15314 <ul>
15315 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15316 </ul>
15317 </div>
15318 !! end
15319
15320 !! test
15321 Fuzz testing: Parser14-table
15322 !! wikitext
15323 ==a==
15324 {| STYLE=__TOC__
15325 !! html
15326 <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>
15327 <table style="&#95;_TOC&#95;_">
15328 <tr><td></td></tr>
15329 </table>
15330
15331 !! html+tidy
15332 <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>
15333 <table style="__TOC__">
15334 <tr>
15335 <td></td>
15336 </tr>
15337 </table>
15338 !! end
15339
15340 # Known to produce bogus xml (extra </td>)
15341 !! test
15342 Fuzz testing: Parser16
15343 !! options
15344 noxml
15345 !! wikitext
15346 {|
15347 !https://||||||
15348 !! html
15349 <table>
15350 <tr>
15351 <th>https://</th>
15352 <th></th>
15353 <th></th>
15354 <th>
15355 </td>
15356 </tr>
15357 </table>
15358
15359 !! html+tidy
15360 <table>
15361 <tr>
15362 <th>https://</th>
15363 <th></th>
15364 <th></th>
15365 <th></th>
15366 </tr>
15367 </table>
15368 !! end
15369
15370 !! test
15371 Fuzz testing: Parser21
15372 !! wikitext
15373 {|
15374 ! irc://{{ftp://a" onmouseover="alert('hello world');"
15375 |
15376 !! html
15377 <table>
15378 <tr>
15379 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
15380 </th>
15381 <td>
15382 </td>
15383 </tr>
15384 </table>
15385
15386 !! end
15387
15388 !! test
15389 Fuzz testing: Parser22
15390 !! wikitext
15391 http://===r:::https://b
15392
15393 {|
15394 !! html
15395 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
15396 </p>
15397 <table>
15398 <tr><td></td></tr>
15399 </table>
15400
15401 !! end
15402
15403 # Known to produce bad XML for now
15404 !! test
15405 Fuzz testing: Parser24
15406 !! options
15407 noxml
15408 !! wikitext
15409 {|
15410 {{{|
15411 <u CLASS=
15412 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
15413 <br style="onmouseover='alert(document.cookie);' " />
15414
15415 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15416 |
15417 !! html
15418 <table>
15419 {{{|
15420 <u class="&#124;">}}}} &gt;
15421 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
15422
15423 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15424 <tr>
15425 <td></u>
15426 </td>
15427 </tr>
15428 </table>
15429
15430 !! end
15431
15432 # Note: the current result listed for this is not what the original one was,
15433 # but the original bug was JavaScript injection, which is fixed in any case.
15434 # It's not clear that the original result listed was any more correct than the
15435 # current one. Original result:
15436 # <p>{{{|
15437 # </p>
15438 # <li class="&#124;&#124;">
15439 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15440 !!test
15441 Fuzz testing: Parser25 (bug 6055)
15442 !! wikitext
15443 {{{
15444 |
15445 <LI CLASS=||
15446 >
15447 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15448 !! html
15449 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15450 </p>
15451 !! end
15452
15453 !!test
15454 Fuzz testing: URL adjacent extension (with space, clean)
15455 !! wikitext
15456 http://example.com <nowiki>junk</nowiki>
15457 !! html/php
15458 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15459 </p>
15460 !! html/parsoid
15461 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
15462 !! end
15463
15464 !!test
15465 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15466 !! wikitext
15467 http://example.com<nowiki>junk</nowiki>
15468 !! html/php
15469 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15470 </p>
15471 !! html/parsoid
15472 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
15473 !! end
15474
15475 !!test
15476 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15477 !! wikitext
15478 http://example.com<pre>junk</pre>
15479 !! html/php
15480 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15481
15482 !! html/php+tidy
15483 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15484 <pre>
15485 junk
15486 </pre>
15487 !! html/parsoid
15488 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a></p><pre data-parsoid='{"stx":"html"}'>junk</pre>
15489 !!end
15490
15491 !!test
15492 Fuzz testing: image with bogus manual thumbnail
15493 !! wikitext
15494 [[Image:foobar.jpg|thumbnail= ]]
15495 !! html/php
15496 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
15497
15498 !! html/parsoid
15499 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,2,2]}' data-mw='{"errors":[{"key":"missing-thumbnail","message":"This thumbnail does not exist.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{},"dsr":[2,30,null,null]}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
15500 !!end
15501
15502 !! test
15503 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15504 !! wikitext
15505 <pre dir="&#10;"></pre>
15506 !! html
15507 <pre dir="&#10;"></pre>
15508
15509 !! end
15510
15511 !! test
15512 Parsing optional HTML elements (Bug 6171)
15513 !! options
15514 !! wikitext
15515 <table>
15516 <tr>
15517 <td> Some tabular data</td>
15518 <td> More tabular data ...
15519 <td> And yet som tabular data</td>
15520 </tr>
15521 </table>
15522 !! html
15523 <table>
15524 <tr>
15525 <td> Some tabular data</td>
15526 <td> More tabular data ...
15527 </td><td> And yet som tabular data</td>
15528 </tr>
15529 </table>
15530
15531 !! end
15532
15533 !! test
15534 Correct handling of <td>, <tr> (Bug 6171)
15535 !! options
15536 !! wikitext
15537 <table>
15538 <tr>
15539 <td> Some tabular data</td>
15540 <td> More tabular data ...</td>
15541 <td> And yet som tabular data</td>
15542 </tr>
15543 </table>
15544 !! html
15545 <table>
15546 <tr>
15547 <td> Some tabular data</td>
15548 <td> More tabular data ...</td>
15549 <td> And yet som tabular data</td>
15550 </tr>
15551 </table>
15552
15553 !! end
15554
15555
15556 !! test
15557 Parsing crashing regression (fr:JavaScript)
15558 !! wikitext
15559 </body></x>
15560 !! html
15561 <p>&lt;/body&gt;&lt;/x&gt;
15562 </p>
15563 !! end
15564
15565 !! test
15566 Inline wiki vs wiki block nesting
15567 !! wikitext
15568 '''Bold paragraph
15569
15570 New wiki paragraph
15571 !! html
15572 <p><b>Bold paragraph</b>
15573 </p><p>New wiki paragraph
15574 </p>
15575 !! end
15576
15577 # FIXME: The current php output is documented
15578 # and desired output is the parsoid target.
15579 !! test
15580 Inline HTML vs wiki block nesting
15581 !! wikitext
15582 <b>Bold paragraph
15583
15584 New wiki paragraph
15585 !! html/php
15586 <p><b>Bold paragraph
15587 </p><p>New wiki paragraph</b>
15588 </p>
15589 !! html/parsoid
15590 <p><b>Bold paragraph</b>
15591 </p><p>New wiki paragraph
15592 </p>
15593 !! end
15594
15595 # Original result was this:
15596 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
15597 # </p>
15598 # While that might be marginally more intuitive, maybe, the six-apostrophe
15599 # construct is clearly pathological and the result stated here (which is what
15600 # the parser actually does) is about as reasonable as anything.
15601 !!test
15602 Mixing markup for italics and bold
15603 !! options
15604 !! wikitext
15605 '''bold''''''bold''bolditalics'''''
15606 !! html
15607 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
15608 </p>
15609 !! end
15610
15611
15612 !! article
15613 Xyzzyx
15614 !! text
15615 Article for special page transclusion test
15616 !! endarticle
15617
15618 !! test
15619 Special page transclusion
15620 !! options
15621 !! wikitext
15622 {{Special:Prefixindex/Xyzzyx}}
15623 !! html
15624 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15625
15626 !! end
15627
15628 !! test
15629 Special page transclusion twice (bug 5021)
15630 !! options
15631 !! wikitext
15632 {{Special:Prefixindex/Xyzzyx}}
15633 {{Special:Prefixindex/Xyzzyx}}
15634 !! html
15635 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15636 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15637
15638 !! end
15639
15640 !! test
15641 Transclusion of default MediaWiki message
15642 !! wikitext
15643 {{MediaWiki:Mainpage}}
15644 !! html
15645 <p>Main Page
15646 </p>
15647 !! end
15648
15649 !! test
15650 Transclusion of nonexistent MediaWiki message
15651 !! wikitext
15652 {{MediaWiki:Mainpagexxx}}
15653 !! html
15654 <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>
15655 </p>
15656 !! end
15657
15658 !! test
15659 Transclusion of MediaWiki message with underscore
15660 !! wikitext
15661 {{MediaWiki:history_short}}
15662 !! html
15663 <p>History
15664 </p>
15665 !! end
15666
15667 !! test
15668 Transclusion of MediaWiki message with space
15669 !! wikitext
15670 {{MediaWiki:history short}}
15671 !! html
15672 <p>History
15673 </p>
15674 !! end
15675
15676 !! test
15677 Invalid header with following text
15678 !! wikitext
15679 = x = y
15680 !! html
15681 <p>= x = y
15682 </p>
15683 !! end
15684
15685
15686 !! test
15687 Section extraction test (section 0)
15688 !! options
15689 section=0
15690 !! wikitext
15691 start
15692 ==a==
15693 ===aa===
15694 ====aaa====
15695 ==b==
15696 ===ba===
15697 ===bb===
15698 ====bba====
15699 ===bc===
15700 ==c==
15701 ===ca===
15702 !! html
15703 start
15704 !! end
15705
15706 !! test
15707 Section extraction test (section 1)
15708 !! options
15709 section=1
15710 !! wikitext
15711 start
15712 ==a==
15713 ===aa===
15714 ====aaa====
15715 ==b==
15716 ===ba===
15717 ===bb===
15718 ====bba====
15719 ===bc===
15720 ==c==
15721 ===ca===
15722 !! html
15723 ==a==
15724 ===aa===
15725 ====aaa====
15726 !! end
15727
15728 !! test
15729 Section extraction test (section 2)
15730 !! options
15731 section=2
15732 !! wikitext
15733 start
15734 ==a==
15735 ===aa===
15736 ====aaa====
15737 ==b==
15738 ===ba===
15739 ===bb===
15740 ====bba====
15741 ===bc===
15742 ==c==
15743 ===ca===
15744 !! html
15745 ===aa===
15746 ====aaa====
15747 !! end
15748
15749 !! test
15750 Section extraction test (section 3)
15751 !! options
15752 section=3
15753 !! wikitext
15754 start
15755 ==a==
15756 ===aa===
15757 ====aaa====
15758 ==b==
15759 ===ba===
15760 ===bb===
15761 ====bba====
15762 ===bc===
15763 ==c==
15764 ===ca===
15765 !! html
15766 ====aaa====
15767 !! end
15768
15769 !! test
15770 Section extraction test (section 4)
15771 !! options
15772 section=4
15773 !! wikitext
15774 start
15775 ==a==
15776 ===aa===
15777 ====aaa====
15778 ==b==
15779 ===ba===
15780 ===bb===
15781 ====bba====
15782 ===bc===
15783 ==c==
15784 ===ca===
15785 !! html
15786 ==b==
15787 ===ba===
15788 ===bb===
15789 ====bba====
15790 ===bc===
15791 !! end
15792
15793 !! test
15794 Section extraction test (section 5)
15795 !! options
15796 section=5
15797 !! wikitext
15798 start
15799 ==a==
15800 ===aa===
15801 ====aaa====
15802 ==b==
15803 ===ba===
15804 ===bb===
15805 ====bba====
15806 ===bc===
15807 ==c==
15808 ===ca===
15809 !! html
15810 ===ba===
15811 !! end
15812
15813 !! test
15814 Section extraction test (section 6)
15815 !! options
15816 section=6
15817 !! wikitext
15818 start
15819 ==a==
15820 ===aa===
15821 ====aaa====
15822 ==b==
15823 ===ba===
15824 ===bb===
15825 ====bba====
15826 ===bc===
15827 ==c==
15828 ===ca===
15829 !! html
15830 ===bb===
15831 ====bba====
15832 !! end
15833
15834 !! test
15835 Section extraction test (section 7)
15836 !! options
15837 section=7
15838 !! wikitext
15839 start
15840 ==a==
15841 ===aa===
15842 ====aaa====
15843 ==b==
15844 ===ba===
15845 ===bb===
15846 ====bba====
15847 ===bc===
15848 ==c==
15849 ===ca===
15850 !! html
15851 ====bba====
15852 !! end
15853
15854 !! test
15855 Section extraction test (section 8)
15856 !! options
15857 section=8
15858 !! wikitext
15859 start
15860 ==a==
15861 ===aa===
15862 ====aaa====
15863 ==b==
15864 ===ba===
15865 ===bb===
15866 ====bba====
15867 ===bc===
15868 ==c==
15869 ===ca===
15870 !! html
15871 ===bc===
15872 !! end
15873
15874 !! test
15875 Section extraction test (section 9)
15876 !! options
15877 section=9
15878 !! wikitext
15879 start
15880 ==a==
15881 ===aa===
15882 ====aaa====
15883 ==b==
15884 ===ba===
15885 ===bb===
15886 ====bba====
15887 ===bc===
15888 ==c==
15889 ===ca===
15890 !! html
15891 ==c==
15892 ===ca===
15893 !! end
15894
15895 !! test
15896 Section extraction test (section 10)
15897 !! options
15898 section=10
15899 !! wikitext
15900 start
15901 ==a==
15902 ===aa===
15903 ====aaa====
15904 ==b==
15905 ===ba===
15906 ===bb===
15907 ====bba====
15908 ===bc===
15909 ==c==
15910 ===ca===
15911 !! html
15912 ===ca===
15913 !! end
15914
15915 !! test
15916 Section extraction test (nonexistent section 11)
15917 !! options
15918 section=11
15919 !! wikitext
15920 start
15921 ==a==
15922 ===aa===
15923 ====aaa====
15924 ==b==
15925 ===ba===
15926 ===bb===
15927 ====bba====
15928 ===bc===
15929 ==c==
15930 ===ca===
15931 !! html
15932 !! end
15933
15934 !! test
15935 Section extraction test with bogus heading (section 1)
15936 !! options
15937 section=1
15938 !! wikitext
15939 ==a==
15940 ==bogus== not a legal section
15941 ==b==
15942 !! html
15943 ==a==
15944 ==bogus== not a legal section
15945 !! end
15946
15947 !! test
15948 Section extraction test with bogus heading (section 2)
15949 !! options
15950 section=2
15951 !! wikitext
15952 ==a==
15953 ==bogus== not a legal section
15954 ==b==
15955 !! html
15956 ==b==
15957 !! end
15958
15959 !! test
15960 Section extraction test with comment after heading (section 1)
15961 !! options
15962 section=1
15963 !! wikitext
15964 ==a==
15965 ==b== <!-- -->
15966 ==c==
15967 !! html
15968 ==a==
15969 !! end
15970
15971 !! test
15972 Section extraction test with comment after heading (section 2)
15973 !! options
15974 section=2
15975 !! wikitext
15976 ==a==
15977 ==b== <!-- -->
15978 ==c==
15979 !! html
15980 ==b== <!-- -->
15981 !! end
15982
15983 !! test
15984 Section extraction test with bogus <nowiki> heading (section 1)
15985 !! options
15986 section=1
15987 !! wikitext
15988 ==a==
15989 ==bogus== <nowiki>not a legal section</nowiki>
15990 ==b==
15991 !! html
15992 ==a==
15993 ==bogus== <nowiki>not a legal section</nowiki>
15994 !! end
15995
15996 !! test
15997 Section extraction test with bogus <nowiki> heading (section 2)
15998 !! options
15999 section=2
16000 !! wikitext
16001 ==a==
16002 ==bogus== <nowiki>not a legal section</nowiki>
16003 ==b==
16004 !! html
16005 ==b==
16006 !! end
16007
16008
16009 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
16010 # instead of respecting commented sections
16011 !! test
16012 Section extraction prefixed by comment (section 1)
16013 !! options
16014 section=1
16015 !! wikitext
16016 <!-- -->==sec1==
16017 ==sec2==
16018 !! html
16019 ==sec2==
16020 !!end
16021
16022 !! test
16023 Section extraction prefixed by comment (section 2)
16024 !! options
16025 section=2
16026 !! wikitext
16027 <!-- -->==sec1==
16028 ==sec2==
16029 !! html
16030
16031 !!end
16032
16033
16034 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
16035 # instead of respecting HTML-style headings
16036 !! test
16037 Section extraction, mixed wiki and html (section 1)
16038 !! options
16039 section=1
16040 !! wikitext
16041 <h2>unmarked</h2>
16042 unmarked
16043 ==1==
16044 one
16045 ==2==
16046 two
16047 !! html
16048 ==1==
16049 one
16050 !! end
16051
16052 !! test
16053 Section extraction, mixed wiki and html (section 2)
16054 !! options
16055 section=2
16056 !! wikitext
16057 <h2>unmarked</h2>
16058 unmarked
16059 ==1==
16060 one
16061 ==2==
16062 two
16063 !! html
16064 ==2==
16065 two
16066 !! end
16067
16068
16069 # Formerly testing for bug 3342
16070 !! test
16071 Section extraction, heading surrounded by <noinclude>
16072 !! options
16073 section=1
16074 !! wikitext
16075 <noinclude>==unmarked==</noinclude>
16076 ==marked==
16077 !! html
16078 ==marked==
16079 !!end
16080
16081 # Test behavior of bug 19910
16082 !! test
16083 Sectiion with all-equals
16084 !! options
16085 section=2
16086 !! wikitext
16087 ===
16088 The line above must have a trailing space
16089 === <!--
16090 --> <!-- -->
16091 But just in case it doesn't...
16092 !! html
16093 === <!--
16094 --> <!-- -->
16095 But just in case it doesn't...
16096 !! end
16097
16098 !! test
16099 Section replacement test (section 0)
16100 !! options
16101 replace=0,"xxx"
16102 !! wikitext
16103 start
16104 ==a==
16105 ===aa===
16106 ====aaa====
16107 ==b==
16108 ===ba===
16109 ===bb===
16110 ====bba====
16111 ===bc===
16112 ==c==
16113 ===ca===
16114 !! html
16115 xxx
16116
16117 ==a==
16118 ===aa===
16119 ====aaa====
16120 ==b==
16121 ===ba===
16122 ===bb===
16123 ====bba====
16124 ===bc===
16125 ==c==
16126 ===ca===
16127 !! end
16128
16129 !! test
16130 Section replacement test (section 1)
16131 !! options
16132 replace=1,"xxx"
16133 !! wikitext
16134 start
16135 ==a==
16136 ===aa===
16137 ====aaa====
16138 ==b==
16139 ===ba===
16140 ===bb===
16141 ====bba====
16142 ===bc===
16143 ==c==
16144 ===ca===
16145 !! html
16146 start
16147 xxx
16148
16149 ==b==
16150 ===ba===
16151 ===bb===
16152 ====bba====
16153 ===bc===
16154 ==c==
16155 ===ca===
16156 !! end
16157
16158 !! test
16159 Section replacement test (section 2)
16160 !! options
16161 replace=2,"xxx"
16162 !! wikitext
16163 start
16164 ==a==
16165 ===aa===
16166 ====aaa====
16167 ==b==
16168 ===ba===
16169 ===bb===
16170 ====bba====
16171 ===bc===
16172 ==c==
16173 ===ca===
16174 !! html
16175 start
16176 ==a==
16177 xxx
16178
16179 ==b==
16180 ===ba===
16181 ===bb===
16182 ====bba====
16183 ===bc===
16184 ==c==
16185 ===ca===
16186 !! end
16187
16188 !! test
16189 Section replacement test (section 3)
16190 !! options
16191 replace=3,"xxx"
16192 !! wikitext
16193 start
16194 ==a==
16195 ===aa===
16196 ====aaa====
16197 ==b==
16198 ===ba===
16199 ===bb===
16200 ====bba====
16201 ===bc===
16202 ==c==
16203 ===ca===
16204 !! html
16205 start
16206 ==a==
16207 ===aa===
16208 xxx
16209
16210 ==b==
16211 ===ba===
16212 ===bb===
16213 ====bba====
16214 ===bc===
16215 ==c==
16216 ===ca===
16217 !! end
16218
16219 !! test
16220 Section replacement test (section 4)
16221 !! options
16222 replace=4,"xxx"
16223 !! wikitext
16224 start
16225 ==a==
16226 ===aa===
16227 ====aaa====
16228 ==b==
16229 ===ba===
16230 ===bb===
16231 ====bba====
16232 ===bc===
16233 ==c==
16234 ===ca===
16235 !! html
16236 start
16237 ==a==
16238 ===aa===
16239 ====aaa====
16240 xxx
16241
16242 ==c==
16243 ===ca===
16244 !! end
16245
16246 !! test
16247 Section replacement test (section 5)
16248 !! options
16249 replace=5,"xxx"
16250 !! wikitext
16251 start
16252 ==a==
16253 ===aa===
16254 ====aaa====
16255 ==b==
16256 ===ba===
16257 ===bb===
16258 ====bba====
16259 ===bc===
16260 ==c==
16261 ===ca===
16262 !! html
16263 start
16264 ==a==
16265 ===aa===
16266 ====aaa====
16267 ==b==
16268 xxx
16269
16270 ===bb===
16271 ====bba====
16272 ===bc===
16273 ==c==
16274 ===ca===
16275 !! end
16276
16277 !! test
16278 Section replacement test (section 6)
16279 !! options
16280 replace=6,"xxx"
16281 !! wikitext
16282 start
16283 ==a==
16284 ===aa===
16285 ====aaa====
16286 ==b==
16287 ===ba===
16288 ===bb===
16289 ====bba====
16290 ===bc===
16291 ==c==
16292 ===ca===
16293 !! html
16294 start
16295 ==a==
16296 ===aa===
16297 ====aaa====
16298 ==b==
16299 ===ba===
16300 xxx
16301
16302 ===bc===
16303 ==c==
16304 ===ca===
16305 !! end
16306
16307 !! test
16308 Section replacement test (section 7)
16309 !! options
16310 replace=7,"xxx"
16311 !! wikitext
16312 start
16313 ==a==
16314 ===aa===
16315 ====aaa====
16316 ==b==
16317 ===ba===
16318 ===bb===
16319 ====bba====
16320 ===bc===
16321 ==c==
16322 ===ca===
16323 !! html
16324 start
16325 ==a==
16326 ===aa===
16327 ====aaa====
16328 ==b==
16329 ===ba===
16330 ===bb===
16331 xxx
16332
16333 ===bc===
16334 ==c==
16335 ===ca===
16336 !! end
16337
16338 !! test
16339 Section replacement test (section 8)
16340 !! options
16341 replace=8,"xxx"
16342 !! wikitext
16343 start
16344 ==a==
16345 ===aa===
16346 ====aaa====
16347 ==b==
16348 ===ba===
16349 ===bb===
16350 ====bba====
16351 ===bc===
16352 ==c==
16353 ===ca===
16354 !! html
16355 start
16356 ==a==
16357 ===aa===
16358 ====aaa====
16359 ==b==
16360 ===ba===
16361 ===bb===
16362 ====bba====
16363 xxx
16364
16365 ==c==
16366 ===ca===
16367 !!end
16368
16369 !! test
16370 Section replacement test (section 9)
16371 !! options
16372 replace=9,"xxx"
16373 !! wikitext
16374 start
16375 ==a==
16376 ===aa===
16377 ====aaa====
16378 ==b==
16379 ===ba===
16380 ===bb===
16381 ====bba====
16382 ===bc===
16383 ==c==
16384 ===ca===
16385 !! html
16386 start
16387 ==a==
16388 ===aa===
16389 ====aaa====
16390 ==b==
16391 ===ba===
16392 ===bb===
16393 ====bba====
16394 ===bc===
16395 xxx
16396 !! end
16397
16398 !! test
16399 Section replacement test (section 10)
16400 !! options
16401 replace=10,"xxx"
16402 !! wikitext
16403 start
16404 ==a==
16405 ===aa===
16406 ====aaa====
16407 ==b==
16408 ===ba===
16409 ===bb===
16410 ====bba====
16411 ===bc===
16412 ==c==
16413 ===ca===
16414 !! html
16415 start
16416 ==a==
16417 ===aa===
16418 ====aaa====
16419 ==b==
16420 ===ba===
16421 ===bb===
16422 ====bba====
16423 ===bc===
16424 ==c==
16425 xxx
16426 !! end
16427
16428 !! test
16429 Section replacement test with initial whitespace (bug 13728)
16430 !! options
16431 replace=2,"xxx"
16432 !! wikitext
16433 Preformatted initial line
16434 ==a==
16435 ===a===
16436 !! html
16437 Preformatted initial line
16438 ==a==
16439 xxx
16440 !! end
16441
16442
16443 !! test
16444 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16445 !! options
16446 section=1
16447 !! wikitext
16448 ==a==
16449 a
16450 !! html
16451 ==a==
16452 a
16453 !! end
16454
16455 !! test
16456 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16457 !! options
16458 section=1
16459 !! wikitext
16460 ==a==
16461 a
16462 !! html
16463 ==a==
16464 a
16465 !! end
16466
16467
16468 !! test
16469 Section extraction, <pre> around bogus header (bug 10309)
16470 !! options
16471 noxml section=2
16472 !! wikitext
16473 == Section One ==
16474 <pre>
16475 =======
16476 </pre>
16477
16478 == Section Two ==
16479 stuff
16480 !! html
16481 == Section Two ==
16482 stuff
16483 !! end
16484
16485 !! test
16486 Section replacement, <pre> around bogus header (bug 10309)
16487 !! options
16488 noxml replace=2,"xxx"
16489 !! wikitext
16490 == Section One ==
16491 <pre>
16492 =======
16493 </pre>
16494
16495 == Section Two ==
16496 stuff
16497 !! html
16498 == Section One ==
16499 <pre>
16500 =======
16501 </pre>
16502
16503 xxx
16504 !! end
16505
16506
16507
16508 !! test
16509 Handling of &#x0A; in URLs
16510 !! wikitext
16511 ** irc://&#x0A;a
16512 !! html/php
16513 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16514
16515 !! html/parsoid
16516 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16517 a">irc://
16518 a</a></li></ul></li></ul>
16519 !! end
16520
16521 !! test
16522 Handling of %0A in URLs
16523 !! wikitext
16524 ** irc://%0Aa
16525 !! html/php
16526 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16527
16528 !! html/parsoid
16529 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16530 !! end
16531
16532
16533 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16534 !! test
16535 5 quotes, code coverage +1 line
16536 !! options
16537 parsoid=wt2html
16538 !! wikitext
16539 '''''
16540 !! html/php
16541 !! html/parsoid
16542 <p><b><i></i></b></p>
16543 !! end
16544
16545 # same html as previous, but wikitext adjusted to match parsoid html2wt
16546 # note that wt2html and html2html will put the <i> before the <b>
16547 !! test
16548 5 quotes, code coverage +1 line w/ nowiki (1)
16549 !! options
16550 parsoid=wt2wt,html2wt
16551 !! wikitext
16552 '''''<nowiki/>'''''
16553 !! html/php
16554 <p><i></i>
16555 </p>
16556 !! html/parsoid
16557 <p><b><i></i></b></p>
16558 !! end
16559
16560 # same as previous, just swapping the <i> and <b>
16561 !! test
16562 5 quotes, code coverage +1 line w/ nowiki (2)
16563 !! wikitext
16564 '''''<nowiki/>'''''
16565 !! html/php
16566 <p><i></i>
16567 </p>
16568 !! html/parsoid
16569 <p><i><b></b></i></p>
16570 !! end
16571
16572 !! test
16573 Special:Search page linking.
16574 !! wikitext
16575 {{Special:search}}
16576 !! html
16577 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16578 </p>
16579 !! end
16580
16581 !! test
16582 {{!}} is a magic word
16583 !! wikitext
16584 {{!}} is a magic word there and {{!}} is still a magic word here
16585 !! html/php
16586 <p>| is a magic word there and | is still a magic word here
16587 </p>
16588 !! html/parsoid
16589 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is still a magic word here</p>
16590 !! end
16591
16592 !! test
16593 Say the magic word
16594 !! options
16595 title=[[Parser test]]
16596 !! wikitext
16597 * {{PAGENAME}}
16598 * {{PAGENAMEE}}
16599 * {{FULLPAGENAME}}
16600 * {{FULLPAGENAMEE}}
16601 * {{BASEPAGENAME}}
16602 * {{BASEPAGENAMEE}}
16603 * {{SUBPAGENAME}}
16604 * {{SUBPAGENAMEE}}
16605 * {{ROOTPAGENAME}}
16606 * {{ROOTPAGENAMEE}}
16607 * {{TALKPAGENAME}}
16608 * {{TALKPAGENAMEE}}
16609 * {{SUBJECTPAGENAME}}
16610 * {{SUBJECTPAGENAMEE}}
16611 * {{NAMESPACEE}}
16612 * {{NAMESPACE}}
16613 * {{NAMESPACENUMBER}}
16614 * {{TALKSPACE}}
16615 * {{TALKSPACEE}}
16616 * {{SUBJECTSPACE}}
16617 * {{SUBJECTSPACEE}}
16618 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
16619 !! html
16620 <ul><li> Parser test</li>
16621 <li> Parser_test</li>
16622 <li> Parser test</li>
16623 <li> Parser_test</li>
16624 <li> Parser test</li>
16625 <li> Parser_test</li>
16626 <li> Parser test</li>
16627 <li> Parser_test</li>
16628 <li> Parser test</li>
16629 <li> Parser_test</li>
16630 <li> Talk:Parser test</li>
16631 <li> Talk:Parser_test</li>
16632 <li> Parser test</li>
16633 <li> Parser_test</li>
16634 <li> </li>
16635 <li> </li>
16636 <li> 0</li>
16637 <li> Talk</li>
16638 <li> Talk</li>
16639 <li> </li>
16640 <li> </li>
16641 <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>
16642
16643 !! end
16644 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
16645
16646 !! test
16647 Gallery
16648 !! wikitext
16649 <gallery>
16650 image1.png |
16651 image2.gif|||||
16652
16653 image3|
16654 image4 |300px| centre
16655 image5.svg| http://///////
16656 [[x|xx]]]]
16657 * image6
16658 </gallery>
16659 !! html
16660 <ul class="gallery mw-gallery-traditional">
16661 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16662 <div class="thumb" style="height: 150px;">Image1.png</div>
16663 <div class="gallerytext">
16664 </div>
16665 </div></li>
16666 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16667 <div class="thumb" style="height: 150px;">Image2.gif</div>
16668 <div class="gallerytext">
16669 <p>||||
16670 </p>
16671 </div>
16672 </div></li>
16673 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16674 <div class="thumb" style="height: 150px;">Image3</div>
16675 <div class="gallerytext">
16676 </div>
16677 </div></li>
16678 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16679 <div class="thumb" style="height: 150px;">Image4</div>
16680 <div class="gallerytext">
16681 <p>300px| centre
16682 </p>
16683 </div>
16684 </div></li>
16685 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16686 <div class="thumb" style="height: 150px;">Image5.svg</div>
16687 <div class="gallerytext">
16688 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
16689 </p>
16690 </div>
16691 </div></li>
16692 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16693 <div class="thumb" style="height: 150px;">* image6</div>
16694 <div class="gallerytext">
16695 </div>
16696 </div></li>
16697 </ul>
16698
16699 !! end
16700
16701 !! test
16702 Gallery (with options)
16703 !! wikitext
16704 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
16705 File:Nonexistent.jpg|caption
16706 File:Nonexistent.jpg
16707 image:foobar.jpg|some '''caption''' [[Main Page]]
16708 image:foobar.jpg
16709 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
16710 </gallery>
16711 !! html
16712 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
16713 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
16714 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16715 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16716 <div class="gallerytext">
16717 <p>caption
16718 </p>
16719 </div>
16720 </div></li>
16721 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16722 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16723 <div class="gallerytext">
16724 </div>
16725 </div></li>
16726 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16727 <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>
16728 <div class="gallerytext">
16729 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16730 </p>
16731 </div>
16732 </div></li>
16733 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16734 <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>
16735 <div class="gallerytext">
16736 </div>
16737 </div></li>
16738 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16739 <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>
16740 <div class="gallerytext">
16741 <p>Blabla|blabla.
16742 </p>
16743 </div>
16744 </div></li>
16745 </ul>
16746
16747 !! end
16748
16749 !! test
16750 Gallery with link that has fragment
16751 !! wikitext
16752 <gallery>
16753 image:foobar.jpg|link=Main_Page
16754 image:foobar.jpg|link=Main_Page#section
16755 image:foobar.jpg|link=Main Page#section|caption
16756 </gallery>
16757 !! html
16758 <ul class="gallery mw-gallery-traditional">
16759 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16760 <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>
16761 <div class="gallerytext">
16762 </div>
16763 </div></li>
16764 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16765 <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>
16766 <div class="gallerytext">
16767 </div>
16768 </div></li>
16769 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16770 <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>
16771 <div class="gallerytext">
16772 <p>caption
16773 </p>
16774 </div>
16775 </div></li>
16776 </ul>
16777
16778 !! end
16779
16780 !! test
16781 Gallery with wikitext inside caption
16782 !! wikitext
16783 <gallery>
16784 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
16785 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
16786 </gallery>
16787 !! html
16788 <ul class="gallery mw-gallery-traditional">
16789 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16790 <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>
16791 <div class="gallerytext">
16792 <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>
16793 </p>
16794 </div>
16795 </div></li>
16796 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16797 <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>
16798 <div class="gallerytext">
16799 <p>This is a test template
16800 </p>
16801 </div>
16802 </div></li>
16803 </ul>
16804
16805 !! end
16806
16807 !! test
16808 gallery (with showfilename option)
16809 !! wikitext
16810 <gallery showfilename>
16811 File:Nonexistent.jpg|caption
16812 File:Nonexistent.jpg
16813 image:foobar.jpg|some '''caption''' [[Main Page]]
16814 File:Foobar.jpg
16815 </gallery>
16816 !! html
16817 <ul class="gallery mw-gallery-traditional">
16818 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16819 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16820 <div class="gallerytext">
16821 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16822 caption
16823 </p>
16824 </div>
16825 </div></li>
16826 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16827 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16828 <div class="gallerytext">
16829 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16830 </p>
16831 </div>
16832 </div></li>
16833 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16834 <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>
16835 <div class="gallerytext">
16836 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16837 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16838 </p>
16839 </div>
16840 </div></li>
16841 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16842 <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>
16843 <div class="gallerytext">
16844 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16845 </p>
16846 </div>
16847 </div></li>
16848 </ul>
16849
16850 !! end
16851
16852 !! test
16853 Gallery (with namespace-less filenames)
16854 !! wikitext
16855 <gallery>
16856 File:Nonexistent.jpg
16857 Nonexistent.jpg
16858 image:foobar.jpg
16859 foobar.jpg
16860 </gallery>
16861 !! html
16862 <ul class="gallery mw-gallery-traditional">
16863 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16864 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16865 <div class="gallerytext">
16866 </div>
16867 </div></li>
16868 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16869 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16870 <div class="gallerytext">
16871 </div>
16872 </div></li>
16873 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16874 <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>
16875 <div class="gallerytext">
16876 </div>
16877 </div></li>
16878 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16879 <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>
16880 <div class="gallerytext">
16881 </div>
16882 </div></li>
16883 </ul>
16884
16885 !! end
16886
16887 !! test
16888 HTML Hex character encoding (spells the word "JavaScript")
16889 !! options
16890 parsoid=wt2html,wt2wt,html2html
16891 !! wikitext
16892 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
16893 !! html/php
16894 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
16895 </p>
16896 !! html/php+tidy
16897 <p>JavaScript</p>
16898 !! html/parsoid
16899 <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>
16900 !! end
16901
16902 !! test
16903 HTML Hex character encoding bogus encoding (bug 26437 regression check)
16904 !! wikitext
16905 &#xsee;&#XSEE;
16906 !! html/php
16907 <p>&amp;#xsee;&amp;#XSEE;
16908 </p>
16909 !! html/parsoid
16910 <p>&amp;#xsee;&amp;#XSEE;</p>
16911 !! end
16912
16913 !! test
16914 HTML Hex character encoding mixed case
16915 !! options
16916 parsoid=wt2html,wt2wt,html2html
16917 !! wikitext
16918 &#xEE;&#Xee;
16919 !! html/php
16920 <p>&#xee;&#xee;
16921 </p>
16922 !! html/php+tidy
16923 <p>îî</p>
16924 !! html/parsoid
16925 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
16926 !! end
16927
16928 !! test
16929 __FORCETOC__ override
16930 !! wikitext
16931 __NEWSECTIONLINK__
16932 __FORCETOC__
16933 !! html
16934 <p><br />
16935 </p>
16936 !! end
16937
16938 !! test
16939 ISBN code coverage
16940 !! wikitext
16941 ISBN 978-0-1234-56&#x20;789
16942 !! html
16943 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
16944 </p>
16945 !! html+tidy
16946 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
16947 !! html/parsoid
16948 <p><a href="./Special:BookSources/9780123456" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
16949 !! end
16950
16951 !! test
16952 ISBN followed by 5 spaces
16953 !! wikitext
16954 ISBN
16955 !! html
16956 <p>ISBN
16957 </p>
16958 !! end
16959
16960 !! test
16961 Double ISBN
16962 !! wikitext
16963 ISBN ISBN 1234567890
16964 !! html/php
16965 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16966 </p>
16967 !! html/parsoid
16968 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
16969 !! end
16970
16971 !! test
16972 ISBN with an X
16973 !! wikitext
16974 ISBN 3-462-04561-X
16975 ISBN 080442957X
16976 ISBN 978080442957X
16977 !! html/php
16978 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
16979 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
16980 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
16981 </p>
16982 !! html/parsoid
16983 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
16984 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
16985 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p>
16986 !! end
16987
16988 !! test
16989 ISBN with empty prefix (parsoid test)
16990 !! wikitext
16991 ISBN 1234567890
16992 !! html/php
16993 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16994 </p>
16995 !! html/parsoid
16996 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
16997 !! end
16998
16999 !! test
17000 Bug 22905: <abbr> followed by ISBN followed by </a>
17001 !! wikitext
17002 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
17003 !! html/php
17004 <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>
17005 </p>
17006 !! html/parsoid
17007 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p>
17008 !! end
17009
17010 !! test
17011 Double RFC
17012 !! wikitext
17013 RFC RFC 1234
17014 !! html
17015 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
17016 </p>
17017 !! end
17018
17019 !! test
17020 Double RFC with a wiki link
17021 !! wikitext
17022 RFC [[RFC 1234]]
17023 !! html
17024 <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>
17025 </p>
17026 !! end
17027
17028 !! test
17029 RFC code coverage
17030 !! wikitext
17031 RFC 983&#x20;987
17032 !! html
17033 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
17034 </p>
17035 !! html+tidy
17036 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
17037 !! end
17038
17039 !! test
17040 Centre-aligned image
17041 !! wikitext
17042 [[Image:foobar.jpg|centre]]
17043 !! html
17044 <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>
17045
17046 !!end
17047
17048 !! test
17049 None-aligned image
17050 !! wikitext
17051 [[Image:foobar.jpg|none]]
17052 !! html
17053 <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>
17054
17055 !!end
17056
17057 !! test
17058 Width + Height sized image (using px) (height is ignored)
17059 !! wikitext
17060 [[Image:foobar.jpg|640x480px]]
17061 !! html
17062 <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>
17063 </p>
17064 !!end
17065
17066 !! test
17067 Width-sized image (using px, no following whitespace)
17068 !! wikitext
17069 [[Image:foobar.jpg|640px]]
17070 !! html
17071 <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>
17072 </p>
17073 !!end
17074
17075 !! test
17076 Width-sized image (using px, with following whitespace - test regression from r39467)
17077 !! wikitext
17078 [[Image:foobar.jpg|640px ]]
17079 !! html
17080 <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>
17081 </p>
17082 !!end
17083
17084 !! test
17085 Width-sized image (using px, with preceding whitespace - test regression from r39467)
17086 !! wikitext
17087 [[Image:foobar.jpg| 640px]]
17088 !! html
17089 <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>
17090 </p>
17091 !!end
17092
17093 !! test
17094 Image with page parameter
17095 !! options
17096 djvu
17097 !! wikitext
17098 [[File:LoremIpsum.djvu|page=2]]
17099 !! html/php
17100 <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>
17101 </p>
17102 !! html/parsoid
17103 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"page","ak":"page=2"}]}'><a href="./File:LoremIpsum.djvu" data-parsoid='{"a":{"href":"./File:LoremIpsum.djvu"},"sa":{}}'><img resource="./File:LoremIpsum.djvu" src="//example.com/images/5/5f/LoremIpsum.djvu" height="3508" width="2480" data-parsoid='{"a":{"resource":"./File:LoremIpsum.djvu","height":"3508","width":"2480"},"sa":{"resource":"File:LoremIpsum.djvu"}}'/></a></span></p>
17104 !! end
17105
17106 !! test
17107 Another italics / bold test
17108 !! wikitext
17109 ''' ''x'
17110 !! html
17111 <pre>'<i> </i>x'
17112 </pre>
17113 !!end
17114
17115 # FIXME: The php output seems broken. It's interleaving some open/close tags.
17116 !! test
17117 dt/dd/dl test
17118 !! wikitext
17119 :;;;::
17120 !! html/php
17121 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
17122
17123 !! html/parsoid
17124 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
17125
17126 !!end
17127
17128
17129 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
17130 !! test
17131 Images with the "|" character in the comment
17132 !! wikitext
17133 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
17134 !! html/php
17135 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
17136
17137 !! html/parsoid
17138 <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>
17139 !! end
17140
17141 !! test
17142 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
17143 !! wikitext
17144 <html><script>alert(1);</script></html>
17145 !! html
17146 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
17147 </p>
17148 !! end
17149
17150 !! test
17151 HTML with raw HTML ($wgRawHtml==true)
17152 !! options
17153 wgRawHtml=1
17154 !! wikitext
17155 <html><script>alert(1);</script></html>
17156 !! html
17157 <p><script>alert(1);</script>
17158 </p>
17159 !! end
17160
17161 !! test
17162 Parents of subpages, one level up
17163 !! options
17164 subpage title=[[Subpage test/L1/L2/L3]]
17165 !! wikitext
17166 [[../|L2]]
17167 !! html
17168 <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>
17169 </p>
17170 !! end
17171
17172
17173 !! test
17174 Parents of subpages, one level up, not named
17175 !! options
17176 subpage title=[[Subpage test/L1/L2/L3]]
17177 !! wikitext
17178 [[../]]
17179 !! html
17180 <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>
17181 </p>
17182 !! end
17183
17184
17185
17186 !! test
17187 Parents of subpages, two levels up
17188 !! options
17189 subpage title=[[Subpage test/L1/L2/L3]]
17190 !! wikitext
17191 [[../../|L1]]2
17192
17193 [[../../|L1]]l
17194 !! html
17195 <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
17196 </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>
17197 </p>
17198 !! end
17199
17200 !! test
17201 Parents of subpages, two levels up, without trailing slash or name.
17202 !! options
17203 subpage title=[[Subpage test/L1/L2/L3]]
17204 !! wikitext
17205 [[../..]]
17206 !! html
17207 <p>[[../..]]
17208 </p>
17209 !! end
17210
17211 !! test
17212 Parents of subpages, two levels up, with lots of extra trailing slashes.
17213 !! options
17214 subpage title=[[Subpage test/L1/L2/L3]]
17215 !! wikitext
17216 [[../../////]]
17217 !! html
17218 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">Subpage test/L1</a>
17219 </p>
17220 !! end
17221
17222 !! article
17223 Subpage test/L1/L2/L3Sibling
17224 !! text
17225 Sibling article
17226 !! endarticle
17227
17228 !! test
17229 Transclusion of a sibling page (one level up)
17230 !! options
17231 subpage title=[[Subpage test/L1/L2/L3]]
17232 !! wikitext
17233 {{../L3Sibling}}
17234 !! html
17235 <p>Sibling article
17236 </p>
17237 !! end
17238
17239 !! test
17240 Transclusion of a child page
17241 !! options
17242 subpage title=[[Subpage test/L1/L2]]
17243 !! wikitext
17244 {{/L3Sibling}}
17245 !! html
17246 <p>Sibling article
17247 </p>
17248 !! end
17249
17250 !! test
17251 Non-transclusion because of too many up levels
17252 !! options
17253 subpage title=[[Subpage test/L1/L2/L3]]
17254 !! wikitext
17255 {{../../../../More than parent}}
17256 !! html
17257 <p>{{../../../../More than parent}}
17258 </p>
17259 !! end
17260
17261 !! test
17262 Definition list code coverage
17263 !! wikitext
17264 ; title : def
17265 ; title : def
17266 ;title: def
17267 !! html/php
17268 <dl><dt> title &#160;</dt>
17269 <dd> def</dd>
17270 <dt> title&#160;</dt>
17271 <dd> def</dd>
17272 <dt>title</dt>
17273 <dd> def</dd></dl>
17274
17275 !! html/parsoid
17276 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17277 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17278 <dt>title</dt><dd> def</dd></dl>
17279 !! end
17280
17281 !! test
17282 Don't fall for the self-closing div
17283 !! wikitext
17284 <div>hello world</div/>
17285 !! html
17286 <div>hello world</div>
17287
17288 !! end
17289
17290 !! test
17291 MSGNW magic word
17292 !! wikitext
17293 {{MSGNW:msg}}
17294 !! html
17295 <p>&#91;&#91;:Template:Msg&#93;&#93;
17296 </p>
17297 !! end
17298
17299 !! test
17300 RAW magic word
17301 !! wikitext
17302 {{RAW:QUERTY}}
17303 !! html
17304 <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>
17305 </p>
17306 !! end
17307
17308 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
17309 !! test
17310 Always escape literal '>' in output, not just after '<'
17311 !! wikitext
17312 ><>
17313 !! html
17314 <p>&gt;&lt;&gt;
17315 </p>
17316 !! end
17317
17318 !! test
17319 Template caching
17320 !! wikitext
17321 {{Test}}
17322 {{Test}}
17323 !! html
17324 <p>This is a test template
17325 This is a test template
17326 </p>
17327 !! end
17328
17329
17330 !! article
17331 MediaWiki:Fake
17332 !! text
17333 ==header==
17334 !! endarticle
17335
17336 !! test
17337 Inclusion of !userCanEdit() content
17338 !! wikitext
17339 {{MediaWiki:Fake}}
17340 !! html
17341 <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>
17342
17343 !! end
17344
17345
17346 !! test
17347 Out-of-order TOC heading levels
17348 !! wikitext
17349 ==2==
17350 ======6======
17351 ===3===
17352 =1=
17353 =====5=====
17354 ==2==
17355 !! html
17356 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17357 <ul>
17358 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
17359 <ul>
17360 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
17361 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
17362 </ul>
17363 </li>
17364 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
17365 <ul>
17366 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
17367 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
17368 </ul>
17369 </li>
17370 </ul>
17371 </div>
17372
17373 <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>
17374 <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>
17375 <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>
17376 <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>
17377 <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>
17378 <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>
17379
17380 !! end
17381
17382
17383 !! test
17384 ISBN with a dummy number
17385 !! wikitext
17386 ISBN ---
17387 !! html
17388 <p>ISBN ---
17389 </p>
17390 !! end
17391
17392
17393 !! test
17394 ISBN with space-delimited number
17395 !! wikitext
17396 ISBN 92 9017 032 8
17397 !! html
17398 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
17399 </p>
17400 !! end
17401
17402
17403 !! test
17404 ISBN with multiple spaces, no number
17405 !! wikitext
17406 ISBN foo
17407 !! html
17408 <p>ISBN foo
17409 </p>
17410 !! end
17411
17412
17413 !! test
17414 ISBN length
17415 !! wikitext
17416 ISBN 123456789
17417
17418 ISBN 1234567890
17419
17420 ISBN 12345678901
17421 !! html
17422 <p>ISBN 123456789
17423 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17424 </p><p>ISBN 12345678901
17425 </p>
17426 !! end
17427
17428
17429 !! test
17430 ISBN with trailing year (bug 8110)
17431 !! wikitext
17432 ISBN 1-234-56789-0 - 2006
17433
17434 ISBN 1 234 56789 0 - 2006
17435 !! html
17436 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
17437 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
17438 </p>
17439 !! end
17440
17441
17442 !! test
17443 anchorencode
17444 !! wikitext
17445 {{anchorencode:foo bar©#%n}}
17446 !! html
17447 <p>foo_bar.C2.A9.23.25n
17448 </p>
17449 !! end
17450
17451 !! test
17452 anchorencode trims spaces
17453 !! wikitext
17454 {{anchorencode: __pretty__please__}}
17455 !! html
17456 <p>pretty_please
17457 </p>
17458 !! end
17459
17460 !! test
17461 anchorencode deals with links
17462 !! wikitext
17463 {{anchorencode: [[hello|world]] [[hi]]}}
17464 !! html
17465 <p>world_hi
17466 </p>
17467 !! end
17468
17469 !! test
17470 anchorencode deals with templates
17471 !! wikitext
17472 {{anchorencode: {{Foo}} }}
17473 !! html
17474 <p>FOO
17475 </p>
17476 !! end
17477
17478 !! test
17479 anchorencode encodes like the TOC generator: (bug 18431)
17480 !! wikitext
17481 === _ +:.3A%3A&&amp;]] ===
17482 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17483 __NOEDITSECTION__
17484 !! html
17485 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17486 <p>.2B:.3A.253A.26.26.5D.5D
17487 </p>
17488 !! end
17489
17490 !! test
17491 Bug 6200: blockquotes and paragraph formatting
17492 !! wikitext
17493 <blockquote>
17494 foo
17495 </blockquote>
17496
17497 bar
17498
17499 baz
17500 !! html
17501 <blockquote>
17502 <p>foo
17503 </p>
17504 </blockquote>
17505 <p>bar
17506 </p>
17507 <pre>baz
17508 </pre>
17509 !! end
17510
17511 !! test
17512 Bug 8293: Use of center tag ruins paragraph formatting
17513 !! wikitext
17514 <center>
17515 foo
17516 </center>
17517
17518 bar
17519
17520 baz
17521 !! html
17522 <center>
17523 <p>foo
17524 </p>
17525 </center>
17526 <p>bar
17527 </p>
17528 <pre>baz
17529 </pre>
17530 !! end
17531
17532 !!test
17533 Parsing of overlapping (improperly nested) inline html tags
17534 !! wikitext
17535 <span><s>x</span></s>
17536 !! html/php
17537 <p><span><s>x&lt;/span&gt;</s></span>
17538 </p>
17539 !! html/parsoid
17540 <p><span><s>x</s></span>
17541 </p>
17542 !!end
17543
17544 ###
17545 ### Language variants related tests
17546 ###
17547 !! test
17548 Self-link in language variants
17549 !! options
17550 title=[[Dunav]] language=sr
17551 !! wikitext
17552 Both [[Dunav]] and [[Дунав]] are names for this river.
17553 !! html
17554 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17555 </p>
17556 !!end
17557
17558 !! article
17559 Дуна
17560 !! text
17561 content
17562 !! endarticle
17563
17564 !! test
17565 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17566 !! options
17567 title=[[Duna]] language=sr
17568 !! wikitext
17569 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17570 !! html
17571 <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.
17572 </p>
17573 !! end
17574
17575 !! test
17576 Link to a section of a variant of this title shouldn't be parsed as self-link
17577 !! options
17578 title=[[Duna]] language=sr
17579 !! wikitext
17580 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
17581 !! html
17582 <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.
17583 </p>
17584 !! end
17585
17586 !! test
17587 Link to pages in language variants
17588 !! options
17589 language=sr
17590 !! wikitext
17591 Main Page can be written as [[Маин Паге]]
17592 !! html
17593 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
17594 </p>
17595 !!end
17596
17597
17598 !! test
17599 Multiple links to pages in language variants
17600 !! options
17601 language=sr
17602 !! wikitext
17603 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
17604 !! html
17605 <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>.
17606 </p>
17607 !!end
17608
17609
17610 !! test
17611 Simple template in language variants
17612 !! options
17613 language=sr
17614 !! wikitext
17615 {{тест}}
17616 !! html
17617 <p>This is a test template
17618 </p>
17619 !! end
17620
17621
17622 !! test
17623 Template with explicit namespace in language variants
17624 !! options
17625 language=sr
17626 !! wikitext
17627 {{Template:тест}}
17628 !! html
17629 <p>This is a test template
17630 </p>
17631 !! end
17632
17633
17634 !! test
17635 Basic test for template parameter in language variants
17636 !! options
17637 language=sr
17638 !! wikitext
17639 {{парамтест|param=foo}}
17640 !! html
17641 <p>This is a test template with parameter foo
17642 </p>
17643 !! end
17644
17645
17646 !! test
17647 Simple category in language variants
17648 !! options
17649 language=sr cat
17650 !! wikitext
17651 [[Category:МедиаWики Усер'с Гуиде]]
17652 !! html
17653 <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>
17654 !! end
17655
17656
17657 !! article
17658 Category:分类
17659 !! text
17660 blah
17661 !! endarticle
17662
17663 !! article
17664 Category:分類
17665 !! text
17666 blah
17667 !! endarticle
17668
17669 !! test
17670 Don't convert blue categorylinks to another variant (bug 33210)
17671 !! options
17672 language=zh cat
17673 !! wikitext
17674 [[A]][[Category:分类]]
17675 !! html
17676 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
17677 !! end
17678
17679
17680 !! test
17681 Stripping -{}- tags (language variants)
17682 !! options
17683 language=sr
17684 !! wikitext
17685 Latin proverb: -{Ne nuntium necare}-
17686 !! html
17687 <p>Latin proverb: Ne nuntium necare
17688 </p>
17689 !! end
17690
17691
17692 !! test
17693 Prevent conversion with -{}- tags (language variants)
17694 !! options
17695 language=sr variant=sr-ec
17696 !! wikitext
17697 Latinski: -{Ne nuntium necare}-
17698 !! html
17699 <p>Латински: Ne nuntium necare
17700 </p>
17701 !! end
17702
17703
17704 !! test
17705 Prevent conversion of text with -{}- tags (language variants)
17706 !! options
17707 language=sr variant=sr-ec
17708 !! wikitext
17709 Latinski: -{Ne nuntium necare}-
17710 !! html
17711 <p>Латински: Ne nuntium necare
17712 </p>
17713 !! end
17714
17715
17716 !! test
17717 Prevent conversion of links with -{}- tags (language variants)
17718 !! options
17719 language=sr variant=sr-ec
17720 !! wikitext
17721 -{[[Main Page]]}-
17722 !! html
17723 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17724 </p>
17725 !! end
17726
17727
17728 !! test
17729 -{}- tags within headlines (within html for parserConvert())
17730 !! options
17731 language=sr variant=sr-ec
17732 !! wikitext
17733 == -{Naslov}- ==
17734 !! html
17735 <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>
17736
17737 !! end
17738
17739
17740 !! test
17741 Explicit definition of language variant alternatives
17742 !! options
17743 language=zh variant=zh-tw
17744 !! wikitext
17745 -{zh:China;zh-tw:Taiwan}-, not China
17746 !! html
17747 <p>Taiwan, not China
17748 </p>
17749 !! end
17750
17751
17752 !! test
17753 Conversion around HTML tags
17754 !! options
17755 language=sr variant=sr-ec
17756 !! wikitext
17757 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
17758 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
17759 !! html
17760 <p>
17761 <span title="ЛаCтин">ски</span>
17762 </p>
17763 !! end
17764
17765
17766 !! test
17767 Explicit session-wise language variant mapping (A flag and - flag)
17768 !! options
17769 language=zh variant=zh-tw
17770 !! wikitext
17771 Taiwan is not China.
17772 But -{A|zh:China;zh-tw:Taiwan}- is China,
17773 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
17774 and -{China}- is China.
17775 !! html
17776 <p>Taiwan is not China.
17777 But Taiwan is Taiwan,
17778 (This should be stripped!)
17779 and China is China.
17780 </p>
17781 !! end
17782
17783 !! test
17784 Explicit session-wise language variant mapping (H flag for hide)
17785 !! options
17786 language=zh variant=zh-tw
17787 !! wikitext
17788 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
17789 Taiwan is China.
17790 !! html
17791 <p>(This should be stripped!)
17792 Taiwan is Taiwan.
17793 </p>
17794 !! end
17795
17796 !! test
17797 Adding explicit conversion rule for title (T flag)
17798 !! options
17799 language=zh variant=zh-tw showtitle
17800 !! wikitext
17801 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17802 !! html
17803 Taiwan
17804 <p>Should be stripped!
17805 </p>
17806 !! end
17807
17808 !! test
17809 Testing that changing the language variant here in the tests actually works
17810 !! options
17811 language=zh variant=zh showtitle
17812 !! wikitext
17813 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17814 !! html
17815 China
17816 <p>Should be stripped!
17817 </p>
17818 !! end
17819
17820 !! test
17821 Recursive conversion of alt and title attrs shouldn't clear converter state
17822 !! options
17823 language=zh variant=zh-cn showtitle
17824 !! wikitext
17825 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
17826 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
17827 !! html
17828 China
17829 <p>
17830 Should be stripped<span title="Exclamation">!</span>
17831 </p>
17832 !! end
17833
17834 !! test
17835 Bug 24072: more test on conversion rule for title
17836 !! options
17837 language=zh variant=zh-tw showtitle
17838 !! wikitext
17839 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17840 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
17841 !! html
17842 Taiwan
17843 <p>This should be stripped!
17844 This won't take interferes with the title rule.
17845 </p>
17846 !! end
17847
17848 !! test
17849 Partly disable title conversion if variant == main language code
17850 !! options
17851 language=zh variant=zh title=[[ZH]] showtitle
17852 !! wikitext
17853 -{T|zh-cn:CN;zh-tw:TW}-
17854 !! html
17855 ZH
17856 <p>
17857 </p>
17858 !! end
17859
17860 !! test
17861 Partly disable title conversion if variant == main language code, more
17862 !! options
17863 language=zh variant=zh title=[[ZH]] showtitle
17864 !! wikitext
17865 -{T|TW}-
17866 !! html
17867 ZH
17868 <p>
17869 </p>
17870 !! end
17871
17872 !! test
17873 Raw output of variant escape tags (R flag)
17874 !! options
17875 language=zh variant=zh-tw
17876 !! wikitext
17877 Raw: -{R|zh:China;zh-tw:Taiwan}-
17878 !! html
17879 <p>Raw: zh:China;zh-tw:Taiwan
17880 </p>
17881 !! end
17882
17883 !! test
17884 Nested using of manual convert syntax
17885 !! options
17886 language=zh variant=zh-hk
17887 !! wikitext
17888 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
17889 !! html
17890 <p>Nested: Hello Hong Kong!
17891 </p>
17892 !! end
17893
17894 !! test
17895 Proper conversion of text in external links
17896 !! options
17897 language=sr variant=sr-ec
17898 !! wikitext
17899 http://www.google.com
17900 gopher://www.google.com
17901 [http://www.google.com http://www.google.com]
17902 [gopher://www.google.com gopher://www.google.com]
17903 [https://www.google.com irc://www.google.com]
17904 [ftp://www.google.com www.google.com/ftp://dir]
17905 [//www.google.com www.google.com]
17906 !! html
17907 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17908 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17909 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17910 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17911 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
17912 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
17913 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
17914 </p>
17915 !! end
17916
17917 !! test
17918 Do not convert roman numbers to language variants
17919 !! options
17920 language=sr variant=sr-ec
17921 !! wikitext
17922 Fridrih IV je car.
17923 !! html
17924 <p>Фридрих IV је цар.
17925 </p>
17926 !! end
17927
17928 !! test
17929 Unclosed language converter markup "-{"
17930 !! options
17931 language=sr
17932 !! wikitext
17933 -{T|hello
17934 !! html
17935 <p>-{T|hello
17936 </p>
17937 !! end
17938
17939 !! test
17940 Don't convert raw rule "-{R|=&gt;}-" to "=>"
17941 !! options
17942 language=sr
17943 !! wikitext
17944 -{R|=&gt;}-
17945 !! html
17946 <p>=&gt;
17947 </p>
17948 !!end
17949
17950 !! test
17951 Don't break link parsing if language converter markup is in the caption.
17952 !! options
17953 language=sr variant=sr-ec
17954 !! wikitext
17955 [[Main Page|-{R|main page}-]]
17956 !! html
17957 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
17958 </p>
17959 !! end
17960
17961 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17962 !! test
17963 Don't break image parsing if language converter markup is in the caption.
17964 !! options
17965 language=sr
17966 !! wikitext
17967 [[File:Foobar.jpg|-{R|caption}-]]
17968 !! html/parsoid
17969 <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>
17970 </p>
17971 !! end
17972
17973 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17974 !! test
17975 Don't break list handling if language converter markup is in the item.
17976 !! options
17977 language=zh variant=zh-cn
17978 !! wikitext
17979 ;-{zh-cn:AAA;zh-tw:BBB}-
17980 !! html/php
17981 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
17982
17983 !! html/parsoid
17984 <dl><dt>AAA
17985 </dt></dl>
17986 !! end
17987
17988 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17989 !! test
17990 Don't break table handling if language converter markup is in the cell.
17991 !! options
17992 language=sr variant=sr-ec
17993 !! wikitext
17994 {|
17995 |-
17996 | -{R|B}-
17997 |}
17998 !! html/php
17999 <table>
18000
18001 <tr>
18002 <td>Б}-
18003 </td></tr></table>
18004
18005 !! html/parsoid
18006 <table>
18007
18008 <tr>
18009 <td> B
18010 </td></tr></table>
18011
18012 !! end
18013
18014 !! test
18015 Bug 529: Uncovered bullet
18016 !! wikitext
18017 * Foo {{bullet}}
18018 !! html
18019 <ul><li> Foo </li>
18020 <li> Bar</li></ul>
18021
18022 !! end
18023
18024 # Plain MediaWiki does not remove empty lists, but tidy actually does.
18025 # Templates in Wikipedia rely on this behavior, as tidy has always been
18026 # enabled there. These tests are normally run *without* tidy, so specify the
18027 # full output here.
18028 # To test realistic parsing behavior, apply a tidy-like transformation to both
18029 # the expected output and your parser's output.
18030 !! test
18031 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
18032 !! wikitext
18033 ******* Foo {{bullet}}
18034 !! html
18035 <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>
18036 <li> Bar</li></ul>
18037
18038 !! end
18039
18040 !! test
18041 Bug 529: Uncovered table already at line-start
18042 !! wikitext
18043 x
18044
18045 {{table}}
18046 y
18047 !! html
18048 <p>x
18049 </p>
18050 <table>
18051 <tr>
18052 <td> 1 </td>
18053 <td> 2
18054 </td></tr>
18055 <tr>
18056 <td> 3 </td>
18057 <td> 4
18058 </td></tr></table>
18059 <p>y
18060 </p>
18061 !! end
18062
18063 !! test
18064 Bug 529: Uncovered bullet in parser function result
18065 !! wikitext
18066 * Foo {{lc:{{bullet}} }}
18067 !! html
18068 <ul><li> Foo </li>
18069 <li> bar</li></ul>
18070
18071 !! end
18072
18073 !! test
18074 Bug 5678: Double-parsed template argument
18075 !! wikitext
18076 {{lc:{{{1}}}|hello}}
18077 !! html
18078 <p>{{{1}}}
18079 </p>
18080 !! end
18081
18082 !! test
18083 Bug 5678: Double-parsed template invocation
18084 !! wikitext
18085 {{lc:{{paramtest {{!}} param = hello }} }}
18086 !! html
18087 <p>{{paramtest | param = hello }}
18088 </p>
18089 !! end
18090
18091 !! test
18092 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
18093 !! options
18094 language=cs
18095 title=[[Main Page]]
18096 !! wikitext
18097 {{PRVNÍVELKÉ:ěščř}}
18098 {{prvnívelké:ěščř}}
18099 {{PRVNÍMALÉ:ěščř}}
18100 {{prvnímalé:ěščř}}
18101 {{MALÁ:ěščř}}
18102 {{malá:ěščř}}
18103 {{VELKÁ:ěščř}}
18104 {{velká:ěščř}}
18105 !! html
18106 <p>Ěščř
18107 Ěščř
18108 ěščř
18109 ěščř
18110 ěščř
18111 ěščř
18112 ĚŠČŘ
18113 ĚŠČŘ
18114 </p>
18115 !! end
18116
18117 !! test
18118 Morwen/13: Unclosed link followed by heading
18119 !! wikitext
18120 [[link
18121 ==heading==
18122 !! html
18123 <p>[[link
18124 </p>
18125 <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>
18126
18127 !! end
18128
18129 !! test
18130 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
18131 !! wikitext
18132 {{foo|
18133 =heading=
18134 !! html
18135 <p>{{foo|
18136 </p>
18137 <h1><span class="mw-headline" id="heading">heading</span></h1>
18138
18139 !! end
18140
18141 !! test
18142 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
18143 !! wikitext
18144 {{foo|
18145 ==heading==
18146 !! html
18147 <p>{{foo|
18148 </p>
18149 <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>
18150
18151 !! end
18152
18153 !! test
18154 Tildes in comments
18155 !! options
18156 pst
18157 !! wikitext
18158 <!-- ~~~~ -->
18159 !! html
18160 <!-- ~~~~ -->
18161 !! end
18162
18163 !! test
18164 Paragraphs inside divs (no extra line breaks)
18165 !! wikitext
18166 <div>Line one
18167
18168 Line two</div>
18169 !! html
18170 <div>Line one
18171 Line two</div>
18172
18173 !! end
18174
18175 !! test
18176 Paragraphs inside divs (extra line break on open)
18177 !! wikitext
18178 <div>
18179 Line one
18180
18181 Line two</div>
18182 !! html
18183 <div>
18184 <p>Line one
18185 </p>
18186 Line two</div>
18187
18188 !! end
18189
18190 !! test
18191 Paragraphs inside divs (extra line break on close)
18192 !! wikitext
18193 <div>Line one
18194
18195 Line two
18196 </div>
18197 !! html
18198 <div>Line one
18199 <p>Line two
18200 </p>
18201 </div>
18202
18203 !! end
18204
18205 !! test
18206 Paragraphs inside divs (extra line break on open and close)
18207 !! wikitext
18208 <div>
18209 Line one
18210
18211 Line two
18212 </div>
18213 !! html
18214 <div>
18215 <p>Line one
18216 </p><p>Line two
18217 </p>
18218 </div>
18219
18220 !! end
18221
18222 !! test
18223 Nesting tags, paragraphs on lines which begin with <div>
18224 !! wikitext
18225 <div></div><strong>A
18226 B</strong>
18227 !! html/php+tidy
18228 <p><strong>A</strong></p>
18229 <p><strong>B</strong></p>
18230 !! html/parsoid
18231 <div></div>
18232 <p><strong>A
18233 B</strong>
18234 </p>
18235 !! end
18236
18237 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
18238 !! test
18239 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
18240 !! wikitext
18241 <blockquote>Line one
18242
18243 Line two</blockquote>
18244 !! html
18245 <blockquote>Line one
18246 Line two</blockquote>
18247
18248 !! html+tidy
18249 <blockquote>
18250 <p>Line one Line two</p>
18251 </blockquote>
18252 !! end
18253
18254 !! test
18255 Bug 6200: paragraphs inside blockquotes (extra line break on open)
18256 !! wikitext
18257 <blockquote>
18258 Line one
18259
18260 Line two</blockquote>
18261 !! html
18262 <blockquote>
18263 <p>Line one
18264 </p>
18265 Line two</blockquote>
18266
18267 !! html+tidy
18268 <blockquote>
18269 <p>Line one</p>
18270 Line two</blockquote>
18271 !! end
18272
18273 !! test
18274 Bug 6200: paragraphs inside blockquotes (extra line break on close)
18275 !! wikitext
18276 <blockquote>Line one
18277
18278 Line two
18279 </blockquote>
18280 !! html
18281 <blockquote>Line one
18282 <p>Line two
18283 </p>
18284 </blockquote>
18285
18286 !! html+tidy
18287 <blockquote>
18288 <p>Line one</p>
18289 <p>Line two</p>
18290 </blockquote>
18291 !! end
18292
18293 !! test
18294 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
18295 !! wikitext
18296 <blockquote>
18297 Line one
18298
18299 Line two
18300 </blockquote>
18301 !! html
18302 <blockquote>
18303 <p>Line one
18304 </p><p>Line two
18305 </p>
18306 </blockquote>
18307
18308 !! html+tidy
18309 <blockquote>
18310 <p>Line one</p>
18311 <p>Line two</p>
18312 </blockquote>
18313 !! end
18314
18315 !! test
18316 Paragraphs inside blockquotes/divs (no extra line breaks)
18317 !! wikitext
18318 <blockquote><div>Line one
18319
18320 Line two</div></blockquote>
18321 !! html
18322 <blockquote><div>Line one
18323 Line two</div></blockquote>
18324
18325 !! end
18326
18327 !! test
18328 Paragraphs inside blockquotes/divs (extra line break on open)
18329 !! wikitext
18330 <blockquote><div>
18331 Line one
18332
18333 Line two</div></blockquote>
18334 !! html
18335 <blockquote><div>
18336 <p>Line one
18337 </p>
18338 Line two</div></blockquote>
18339
18340 !! end
18341
18342 !! test
18343 Paragraphs inside blockquotes/divs (extra line break on close)
18344 !! wikitext
18345 <blockquote><div>Line one
18346
18347 Line two
18348 </div></blockquote>
18349 !! html
18350 <blockquote><div>Line one
18351 <p>Line two
18352 </p>
18353 </div></blockquote>
18354
18355 !! end
18356
18357 !! test
18358 Paragraphs inside blockquotes/divs (extra line break on open and close)
18359 !! wikitext
18360 <blockquote><div>
18361 Line one
18362
18363 Line two
18364 </div></blockquote>
18365 !! html
18366 <blockquote><div>
18367 <p>Line one
18368 </p><p>Line two
18369 </p>
18370 </div></blockquote>
18371
18372 !! end
18373
18374 !! test
18375 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
18376 !! options
18377 wgLinkHolderBatchSize=0
18378 !! wikitext
18379 [[meatball:1]]
18380 [[meatball:2]]
18381 [[meatball:3]]
18382 !! html
18383 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
18384 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
18385 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
18386 </p>
18387 !! end
18388
18389 !! test
18390 Free external link invading image caption
18391 !! wikitext
18392 [[Image:Foobar.jpg|thumb|http://x|hello]]
18393 !! html
18394 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>hello</div></div></div>
18395
18396 !! end
18397
18398 !! test
18399 Bug 15196: localised external link numbers
18400 !! options
18401 language=fa
18402 !! wikitext
18403 [http://en.wikipedia.org/]
18404 !! html/php
18405 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
18406 </p>
18407 !! html/parsoid
18408 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
18409 !! end
18410
18411 !! test
18412 Multibyte character in padleft
18413 !! wikitext
18414 {{padleft:-Hello|7|Æ}}
18415 !! html
18416 <p>Æ-Hello
18417 </p>
18418 !! end
18419
18420 !! test
18421 Multibyte character in padright
18422 !! wikitext
18423 {{padright:Hello-|7|Æ}}
18424 !! html
18425 <p>Hello-Æ
18426 </p>
18427 !! end
18428
18429 !!test
18430 formatdate parser function
18431 !! wikitext
18432 {{#formatdate:2009-03-24}}
18433 !! html
18434 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
18435 </p>
18436 !! end
18437
18438 !!test
18439 formatdate parser function, with default format
18440 !! wikitext
18441 {{#formatdate:2009-03-24|mdy}}
18442 !! html
18443 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
18444 </p>
18445 !! end
18446
18447 !! test
18448 Spacing of numbers in formatted dates
18449 !! wikitext
18450 {{#formatdate:January 15}}
18451 !! html
18452 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18453 </p>
18454 !! end
18455
18456 !! test
18457 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
18458 !! options
18459 language=nl title=[[MediaWiki:Common.css]]
18460 !! wikitext
18461 {{#formatdate:2009-03-24|dmy}}
18462 !! html
18463 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18464 </p>
18465 !! end
18466
18467 #
18468 #
18469 #
18470
18471 #
18472 # Edit comments
18473 #
18474
18475 !! test
18476 Edit comment with link
18477 !! options
18478 comment
18479 !! wikitext
18480 I like the [[Main Page]] a lot
18481 !! html
18482 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18483 !!end
18484
18485 !! test
18486 Edit comment with link and link text
18487 !! options
18488 comment
18489 !! wikitext
18490 I like the [[Main Page|best pages]] a lot
18491 !! html
18492 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18493 !!end
18494
18495 !! test
18496 Edit comment with link and link text with suffix
18497 !! options
18498 comment
18499 !! wikitext
18500 I like the [[Main Page|best page]]s a lot
18501 !! html
18502 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18503 !!end
18504
18505 !! test
18506 Edit comment with section link (non-local, eg in history list)
18507 !! options
18508 comment title=[[Main Page]]
18509 !! wikitext
18510 /* External links */ removed bogus entries
18511 !! html
18512 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18513 !!end
18514
18515 !! test
18516 Edit comment with section link and text before it (non-local, eg in history list)
18517 !! options
18518 comment title=[[Main Page]]
18519 !! wikitext
18520 pre-comment text /* External links */ removed bogus entries
18521 !! html
18522 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>
18523 !!end
18524
18525 !! test
18526 Edit comment with section link (local, eg in diff view)
18527 !! options
18528 comment local title=[[Main Page]]
18529 !! wikitext
18530 /* External links */ removed bogus entries
18531 !! html
18532 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18533 !!end
18534
18535 !! test
18536 Edit comment with subpage link (bug 14080)
18537 !! options
18538 comment
18539 subpage
18540 title=[[Subpage test]]
18541 !! wikitext
18542 Poked at a [[/subpage]] here...
18543 !! html
18544 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
18545 !!end
18546
18547 !! test
18548 Edit comment with subpage link and link text (bug 14080)
18549 !! options
18550 comment
18551 subpage
18552 title=[[Subpage test]]
18553 !! wikitext
18554 Poked at a [[/subpage|neat little page]] here...
18555 !! html
18556 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
18557 !!end
18558
18559 !! test
18560 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
18561 !! options
18562 comment
18563 title=[[Subpage test]]
18564 !! wikitext
18565 Poked at a [[/subpage]] here...
18566 !! html
18567 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...
18568 !!end
18569
18570 !! test
18571 Edit comment with bare anchor link (local, as on diff)
18572 !! options
18573 comment
18574 local
18575 title=[[Main Page]]
18576 !! wikitext
18577 [[#section]]
18578 !! html
18579 <a href="#section">#section</a>
18580 !! end
18581
18582 !! test
18583 Edit comment with bare anchor link (non-local, as on history)
18584 !! options
18585 comment
18586 title=[[Main Page]]
18587 !! wikitext
18588 [[#section]]
18589 !! html
18590 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
18591 !! end
18592
18593 !! test
18594 Anchor starting with underscore
18595 !! wikitext
18596 [[#_ref|One]]
18597 !! html
18598 <p><a href="#_ref">One</a>
18599 </p>
18600 !! end
18601
18602 !! test
18603 Id starting with underscore
18604 !! wikitext
18605 <div id="_ref"></div>
18606 !! html
18607 <div id="_ref"></div>
18608
18609 !! end
18610
18611 !! test
18612 Space normalisation on autocomment (bug 22784)
18613 !! options
18614 comment
18615 title=[[Main Page]]
18616 !! wikitext
18617 /* __hello__world__ */
18618 !! html
18619 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
18620 !! end
18621
18622 !! test
18623 percent-encoding and + signs in comments (Bug 26410)
18624 !! options
18625 comment
18626 !! wikitext
18627 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
18628 !! html
18629 <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>
18630 !! end
18631
18632 # Parsoid doesn't support this yet: see bug 73581
18633 # but it *should* omit the 'src' attribute if the image is bad.
18634 # PHP side of tests was disabled in
18635 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
18636 # because of issues in the PHP parserTests infrastructure
18637 # (but the output below is indeed what the PHP side emits)
18638 !! test
18639 Bad images - basic functionality
18640 !! wikitext
18641 [[File:Bad.jpg]]
18642 !! DISABLED/html/php
18643 !! html/parsoid
18644 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span></p>
18645 !! end
18646
18647 !! test
18648 Bad images - bug 16039: text after bad image disappears
18649 !! wikitext
18650 Foo bar
18651 [[File:Bad.jpg]]
18652 Bar foo
18653 !! DISABLED/html/php
18654 <p>Foo bar
18655 </p><p>Bar foo
18656 </p>
18657 !! html/parsoid
18658 <p>Foo bar
18659 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span>
18660 Bar foo</p>
18661 !! end
18662
18663 !! test
18664 Verify that displaytitle works (bug #22501) no displaytitle
18665 !! options
18666 showtitle
18667 !! config
18668 wgAllowDisplayTitle=true
18669 wgRestrictDisplayTitle=false
18670 !! wikitext
18671 this is not the the title
18672 !! html
18673 Parser test
18674 <p>this is not the the title
18675 </p>
18676 !! end
18677
18678 !! test
18679 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
18680 !! options
18681 showtitle
18682 title=[[Screen]]
18683 !! config
18684 wgAllowDisplayTitle=true
18685 wgRestrictDisplayTitle=false
18686 !! wikitext
18687 this is not the the title
18688 {{DISPLAYTITLE:whatever}}
18689 !! html
18690 whatever
18691 <p>this is not the the title
18692 </p>
18693 !! end
18694
18695 !! test
18696 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
18697 !! options
18698 showtitle
18699 title=[[Screen]]
18700 !! config
18701 wgAllowDisplayTitle=true
18702 wgRestrictDisplayTitle=true
18703 !! wikitext
18704 this is not the the title
18705 {{DISPLAYTITLE:whatever}}
18706 !! html
18707 Screen
18708 <p>this is not the the title
18709 </p>
18710 !! end
18711
18712 !! test
18713 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
18714 !! options
18715 showtitle
18716 title=[[Screen]]
18717 !! config
18718 wgAllowDisplayTitle=true
18719 wgRestrictDisplayTitle=true
18720 !! wikitext
18721 this is not the the title
18722 {{DISPLAYTITLE:screen}}
18723 !! html
18724 screen
18725 <p>this is not the the title
18726 </p>
18727 !! end
18728
18729 !! test
18730 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
18731 !! options
18732 showtitle
18733 title=[[Screen]]
18734 !! config
18735 wgAllowDisplayTitle=false
18736 !! wikitext
18737 this is not the the title
18738 {{DISPLAYTITLE:screen}}
18739 !! html
18740 Screen
18741 <p>this is not the the title
18742 <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>
18743 </p>
18744 !! end
18745
18746 !! test
18747 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
18748 !! options
18749 showtitle
18750 title=[[Screen]]
18751 !! config
18752 wgAllowDisplayTitle=false
18753 !! wikitext
18754 this is not the the title
18755 !! html
18756 Screen
18757 <p>this is not the the title
18758 </p>
18759 !! end
18760
18761 !! test
18762 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
18763 !! options
18764 showtitle
18765 title=[[Screen]]
18766 !! config
18767 wgAllowDisplayTitle=true
18768 wgRestrictDisplayTitle=true
18769 !! wikitext
18770 this is not the the title
18771 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
18772 !! html
18773 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
18774 <p>this is not the the title
18775 </p>
18776 !! end
18777
18778 !! test
18779 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
18780 !! options
18781 showtitle
18782 title=[[Screen]]
18783 !! config
18784 wgAllowDisplayTitle=true
18785 wgRestrictDisplayTitle=true
18786 !! wikitext
18787 this is not the the title
18788 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
18789 !! html
18790 <span style="color: red;">s</span>creen
18791 <p>this is not the the title
18792 </p>
18793 !! end
18794
18795 !! test
18796 preload: check <noinclude> and <includeonly>
18797 !! options
18798 preload
18799 !! wikitext
18800 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
18801 !! html
18802 Hello kind world.
18803 !! end
18804
18805 !! test
18806 preload: check <onlyinclude>
18807 !! options
18808 preload
18809 !! wikitext
18810 Goodbye <onlyinclude>Hello world</onlyinclude>
18811 !! html
18812 Hello world
18813 !! end
18814
18815 !! test
18816 preload: can pass tags through if we want to
18817 !! options
18818 preload
18819 !! wikitext
18820 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
18821 !! html
18822 <includeonly>Hello world</includeonly>
18823 !! end
18824
18825 !! test
18826 preload: check that it doesn't try to do tricks
18827 !! options
18828 preload
18829 !! wikitext
18830 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18831 !! html
18832 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18833 !! end
18834
18835 !! test
18836 Play a bit with r67090 and bug 3158
18837 !! wikitext
18838 <div style="width:50% !important">&nbsp;</div>
18839 <div style="width:50%&nbsp;!important">&nbsp;</div>
18840 <div style="width:50%&#160;!important">&nbsp;</div>
18841 <div style="border : solid;">&nbsp;</div>
18842 !! html/php
18843 <div style="width:50% !important">&#160;</div>
18844 <div style="width:50% !important">&#160;</div>
18845 <div style="width:50% !important">&#160;</div>
18846 <div style="border&#160;: solid;">&#160;</div>
18847
18848 !! html/parsoid
18849 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
18850 <div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&amp;nbsp;!important"}}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
18851 <div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&amp;#160;!important"}}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
18852 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
18853
18854 !! end
18855
18856 !! test
18857 HTML5 data attributes
18858 !! wikitext
18859 <span data-foo="bar">Baz</span>
18860 <p data-abc-def_hij="">Quuz</p>
18861 !! html
18862 <p><span data-foo="bar">Baz</span>
18863 </p>
18864 <p data-abc-def_hij="">Quuz</p>
18865
18866 !! end
18867
18868 !! test
18869 percent-encoding and + signs in internal links (Bug 26410)
18870 !! wikitext
18871 [[User:+%]] [[Page+title%]]
18872 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
18873 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
18874 [[%33%45]] [[%33%45+]]
18875 !! html/php
18876 <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>
18877 <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>
18878 <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>
18879 <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>
18880 </p>
18881 !! html/parsoid
18882 <p><a rel="mw:WikiLink" href="User:+%" title="User:+%">User:+%</a> <a rel="mw:WikiLink" href="Page+title%" title="Page+title%">Page+title%</a> <a rel="mw:WikiLink" href="%+" title="%+">%+</a> <a rel="mw:WikiLink" href="%+" title="%+">%20</a> <a rel="mw:WikiLink" href="%+" title="%+">%+ </a> <a rel="mw:WikiLink" href="%+r" title="%+r">%+r</a> <a rel="mw:WikiLink" href="%" title="%">%</a> <a rel="mw:WikiLink" href="+" title="+">+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"[[bar]]"}'><a href="File:%+abc9"><img resource="./File:%25+abc9" src="./Special:FilePath/%+abc9" height="220" width="220"/></a></span> <a rel="mw:WikiLink" href="3E" title="3E">3E</a> <a rel="mw:WikiLink" href="3E+" title="3E+">3E+</a></p>
18883 !! end
18884
18885 !! test
18886 Special characters in embedded file links (bug 27679)
18887 !! wikitext
18888 [[File:Contains & ampersand.jpg]]
18889 [[File:Does not exist.jpg|Title with & ampersand]]
18890 !! html/php
18891 <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>
18892 <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>
18893 </p>
18894 !! html/parsoid
18895 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="File:Contains_&amp;_ampersand.jpg"><img resource="./File:Contains_&amp;_ampersand.jpg" src="./Special:FilePath/Contains_&amp;_ampersand.jpg" height="220" width="220"/></a></span>
18896 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"Title with &amp; ampersand"}'><a href="File:Does_not_exist.jpg"><img resource="./File:Does_not_exist.jpg" src="./Special:FilePath/Does_not_exist.jpg" height="220" width="220"/></a></span></p>
18897 !! end
18898
18899 !! test
18900 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
18901 !! wikitext
18902 Text&apos;s been normalized?
18903 !! html
18904 <p>Text&#39;s been normalized?
18905 </p>
18906 !! end
18907
18908 !! test
18909 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
18910 !! wikitext
18911 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
18912 !! html
18913 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
18914 </p>
18915 !! end
18916
18917 !! test
18918 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
18919 !! wikitext
18920 [http://www.example.org/ ideograms]
18921 !! html
18922 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
18923 </p>
18924 !! end
18925
18926 !! test
18927 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
18928 !! wikitext
18929 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
18930 !! html
18931 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
18932 </p>
18933 !! end
18934
18935 !! article
18936 Mediawiki:loop1
18937 !! text
18938 {{Identical|A}}
18939 !! endarticle
18940
18941 !! article
18942 Mediawiki:loop2
18943 !! text
18944 {{Identical|B}}
18945 !! endarticle
18946
18947 !! article
18948 Template:Identical
18949 !! text
18950 {{int:loop1}}
18951 {{int:loop2}}
18952 !! endarticle
18953
18954 !! test
18955 Bug 31098 Template which includes system messages which includes the template
18956 !! wikitext
18957 {{Identical}}
18958 !! html
18959 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18960 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18961 </p>
18962 !! end
18963
18964 !! test
18965 Bug31490 Turkish: ucfirst 'blah'
18966 !! options
18967 language=tr
18968 !! wikitext
18969 {{ucfirst:blah}}
18970 !! html
18971 <p>Blah
18972 </p>
18973 !! end
18974
18975 !! test
18976 Bug31490 Turkish: ucfirst 'ix'
18977 !! options
18978 language=tr
18979 !! wikitext
18980 {{ucfirst:ix}}
18981 !! html
18982 <p>İx
18983 </p>
18984 !! end
18985
18986 !! test
18987 Bug31490 Turkish: lcfirst 'BLAH'
18988 !! options
18989 language=tr
18990 !! wikitext
18991 {{lcfirst:BLAH}}
18992 !! html
18993 <p>bLAH
18994 </p>
18995 !! end
18996
18997 !! test
18998 Bug31490 Turkish: ucfırst (with a dotless i)
18999 !! options
19000 language=tr
19001 !! wikitext
19002 {{ucfırst:blah}}
19003 !! html
19004 <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>
19005 </p>
19006 !! end
19007
19008 !! test
19009 Bug31490 ucfırst (with a dotless i) with English language
19010 !! options
19011 language=en
19012 !! wikitext
19013 {{ucfırst:blah}}
19014 !! html
19015 <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>
19016 </p>
19017 !! end
19018
19019 !! test
19020 Bug 26375: TOC with italics
19021 !! options
19022 title=[[Main Page]]
19023 !! wikitext
19024 __TOC__
19025 == ''Lost'' episodes ==
19026 !! html
19027 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19028 <ul>
19029 <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>
19030 </ul>
19031 </div>
19032
19033 <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>
19034
19035 !! end
19036
19037 !! test
19038 Bug 26375: TOC with bold
19039 !! options
19040 title=[[Main Page]]
19041 !! wikitext
19042 __TOC__
19043 == '''should be bold''' then normal text ==
19044 !! html
19045 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19046 <ul>
19047 <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>
19048 </ul>
19049 </div>
19050
19051 <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>
19052
19053 !! end
19054
19055 !! test
19056 Bug 33845: Headings become cursive in TOC when they contain an image
19057 !! options
19058 title=[[Main Page]]
19059 !! wikitext
19060 __TOC__
19061 == Image [[Image:foobar.jpg]] ==
19062 !! html
19063 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19064 <ul>
19065 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
19066 </ul>
19067 </div>
19068
19069 <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>
19070
19071 !! end
19072
19073 !! test
19074 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
19075 !! options
19076 title=[[Main Page]]
19077 !! wikitext
19078 __TOC__
19079 == <blockquote>Quote</blockquote> ==
19080 !! html
19081 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19082 <ul>
19083 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19084 </ul>
19085 </div>
19086
19087 <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>
19088
19089 !! html+tidy
19090 <div id="toc" class="toc">
19091 <div id="toctitle">
19092 <h2>Contents</h2>
19093 </div>
19094 <ul>
19095 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19096 </ul>
19097 </div>
19098 <h2><span class="mw-headline" id="Quote"></span></h2>
19099 <blockquote>
19100 <p><span class="mw-headline" id="Quote">Quote</span></p>
19101 </blockquote>
19102 <p><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a><span class="mw-editsection-bracket">]</span></span></p>
19103 !! end
19104
19105 !! test
19106 Unclosed tags in TOC
19107 !! options
19108 title=[[Main Page]]
19109 !! wikitext
19110 __TOC__
19111 == Proof: 2 < 3 ==
19112 <small>Hanc marginis exiguitas non caperet.</small>
19113 QED
19114 !! html
19115 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19116 <ul>
19117 <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>
19118 </ul>
19119 </div>
19120
19121 <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>
19122 <p><small>Hanc marginis exiguitas non caperet.</small>
19123 QED
19124 </p>
19125 !! end
19126
19127 !! test
19128 Multiple tags in TOC
19129 !! wikitext
19130 __TOC__
19131 == <i>Foo</i> <b>Bar</b> ==
19132
19133 == <i>Foo</i> <blockquote>Bar</blockquote> ==
19134 !! html
19135 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19136 <ul>
19137 <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>
19138 <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>
19139 </ul>
19140 </div>
19141
19142 <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>
19143 <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>
19144
19145 !! html+tidy
19146 <div id="toc" class="toc">
19147 <div id="toctitle">
19148 <h2>Contents</h2>
19149 </div>
19150 <ul>
19151 <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>
19152 <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>
19153 </ul>
19154 </div>
19155 <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>
19156 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
19157 <blockquote>
19158 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
19159 </blockquote>
19160 <p><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></p>
19161 !! end
19162
19163 !! test
19164 Tags with parameters in TOC
19165 !! wikitext
19166 __TOC__
19167 == <sup class="in-h2">Hello</sup> ==
19168
19169 == <sup class="a > b">Evilbye</sup> ==
19170 !! html
19171 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19172 <ul>
19173 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
19174 <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>
19175 </ul>
19176 </div>
19177
19178 <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>
19179 <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>
19180
19181 !! end
19182
19183 !! test
19184 span tags with directionality in TOC
19185 !! wikitext
19186 __TOC__
19187 == <span dir="ltr">C++</span> ==
19188
19189 == <span dir="rtl">זבנג!</span> ==
19190
19191 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
19192
19193 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
19194
19195 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
19196 !! html
19197 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19198 <ul>
19199 <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>
19200 <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>
19201 <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>
19202 <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>
19203 <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>
19204 </ul>
19205 </div>
19206
19207 <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>
19208 <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>
19209 <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>
19210 <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>
19211 <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>
19212
19213 !! end
19214
19215 !! test
19216 Bug 72884: bdi element in ToC
19217 !! wikitext
19218 __TOC__
19219 == <bdi>test</bdi> ==
19220 !! html
19221 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19222 <ul>
19223 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
19224 </ul>
19225 </div>
19226
19227 <h2><span class="mw-headline" id="test"><bdi>test</bdi></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: test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19228
19229 !! end
19230
19231 !! article
19232 MediaWiki:Bug32057
19233 !! text
19234 == {{int:headline_sample}} ==
19235 !! endarticle
19236
19237 !! test
19238 Bug 32057: Title needed when expanding <h> nodes.
19239 !! options
19240 title=[[Main Page]]
19241 !! wikitext
19242 {{int:Bug32057}}
19243 !! html
19244 <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>
19245
19246 !! end
19247
19248 !! test
19249 Strip marker in urlencode
19250 !! wikitext
19251 {{urlencode:x<nowiki/>y}}
19252 {{urlencode:x<nowiki/>y|wiki}}
19253 {{urlencode:x<nowiki/>y|path}}
19254 !! html
19255 <p>xy
19256 xy
19257 xy
19258 </p>
19259 !! end
19260
19261 !! test
19262 Strip marker in lc
19263 !! wikitext
19264 {{lc:x<nowiki/>y}}
19265 !! html
19266 <p>xy
19267 </p>
19268 !! end
19269
19270 !! test
19271 Strip marker in uc
19272 !! wikitext
19273 {{uc:x<nowiki/>y}}
19274 !! html
19275 <p>XY
19276 </p>
19277 !! end
19278
19279 !! test
19280 Strip marker in formatNum
19281 !! wikitext
19282 {{formatnum:1<nowiki/>2}}
19283 {{formatnum:1<nowiki/>2|R}}
19284 !! html
19285 <p>12
19286 12
19287 </p>
19288 !! end
19289
19290 !! test
19291 Check noCommafy in formatNum
19292 !! options
19293 language=be-tarask
19294 !! wikitext
19295 {{formatnum:123456.78}}
19296 {{formatnum:123456.78|NOSEP}}
19297 !! html
19298 <p>123 456,78
19299 123456.78
19300 </p>
19301 !! end
19302
19303 !! test
19304 Wrong option for formatNum (bug 56199)
19305 !! wikitext
19306 {{formatnum:1,234.56|Random}}
19307 {{formatnum:1,234.56|EVERYTHING}}
19308 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
19309 !! html
19310 <p>1,234.56
19311 1,234.56
19312 1,234.56
19313 </p>
19314 !! end
19315
19316 !! test
19317 Strip marker in grammar
19318 !! options
19319 language=fi
19320 !! wikitext
19321 {{grammar:elative|foo<nowiki/>bar}}
19322 !! html
19323 <p>foobarista
19324 </p>
19325 !! end
19326
19327 !! test
19328 Strip marker in padleft
19329 !! wikitext
19330 {{padleft:|2|x<nowiki/>y}}
19331 !! html
19332 <p>xy
19333 </p>
19334 !! end
19335
19336 !! test
19337 Strip marker in padright
19338 !! wikitext
19339 {{padright:|2|x<nowiki/>y}}
19340 !! html
19341 <p>xy
19342 </p>
19343 !! end
19344
19345 !! test
19346 Strip marker in anchorencode
19347 !! wikitext
19348 {{anchorencode:x<nowiki/>y}}
19349 !! html
19350 <p>xy
19351 </p>
19352 !! end
19353
19354 !! test
19355 nowiki inside link inside heading (bug 18295)
19356 !! wikitext
19357 ==[[foo|x<nowiki>y</nowiki>z]]==
19358 !! html
19359 <h2><span class="mw-headline" id="xyz"><a href="/wiki/Foo" title="Foo">xyz</a></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19360
19361 !! end
19362
19363 !! test
19364 new support for bdi element (bug 31817)
19365 !! wikitext
19366 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19367 !! html
19368 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19369
19370 !!end
19371
19372 !! test
19373 Ignore pipe between table row attributes
19374 !! wikitext
19375 {|
19376 | quux
19377 |- id=foo | style='color: red'
19378 | bar
19379 |}
19380 !! html
19381 <table>
19382 <tr>
19383 <td> quux
19384 </td></tr>
19385 <tr id="foo" style="color: red">
19386 <td> bar
19387 </td></tr></table>
19388
19389 !! end
19390
19391 !!test
19392 Gallery override link with WikiLink (bug 34852)
19393 !! wikitext
19394 <gallery>
19395 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
19396 </gallery>
19397 !! html
19398 <ul class="gallery mw-gallery-traditional">
19399 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19400 <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>
19401 <div class="gallerytext">
19402 <p>caption
19403 </p>
19404 </div>
19405 </div></li>
19406 </ul>
19407
19408 !! end
19409
19410 !!test
19411 Gallery override link with absolute external link (bug 34852)
19412 !! wikitext
19413 <gallery>
19414 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19415 </gallery>
19416 !! html
19417 <ul class="gallery mw-gallery-traditional">
19418 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19419 <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>
19420 <div class="gallerytext">
19421 <p>caption
19422 </p>
19423 </div>
19424 </div></li>
19425 </ul>
19426
19427 !! end
19428
19429 !!test
19430 Gallery override link with malicious javascript (bug 34852)
19431 !! wikitext
19432 <gallery>
19433 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19434 </gallery>
19435 !! html
19436 <ul class="gallery mw-gallery-traditional">
19437 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19438 <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>
19439 <div class="gallerytext">
19440 <p>caption
19441 </p>
19442 </div>
19443 </div></li>
19444 </ul>
19445
19446 !! end
19447
19448 !!test
19449 Gallery with invalid title as link (bug 43964)
19450 !! wikitext
19451 <gallery>
19452 File:foobar.jpg|link=<
19453 </gallery>
19454 !! html
19455 <ul class="gallery mw-gallery-traditional">
19456 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19457 <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>
19458 <div class="gallerytext">
19459 </div>
19460 </div></li>
19461 </ul>
19462
19463 !! end
19464
19465 !!test
19466 Language parser function
19467 !! wikitext
19468 {{#language:ar}}
19469 !! html
19470 <p>العربية
19471 </p>
19472 !! end
19473
19474 !!test
19475 Padleft and padright as substr
19476 !! wikitext
19477 {{padleft:|3|abcde}}
19478 {{padright:|3|abcde}}
19479 !! html
19480 <p>abc
19481 abc
19482 </p>
19483 !! end
19484
19485 !!test
19486 Special parser function
19487 !! wikitext
19488 {{#special:RandomPage}}
19489 {{#special:BaDtItLe}}
19490 {{#special:Foobar}}
19491 !! html
19492 <p>Special:Random
19493 Special:Badtitle
19494 Special:Foobar
19495 </p>
19496 !! end
19497
19498 !!test
19499 Bug 34939 - Case insensitive link parsing ([HttP://])
19500 !! wikitext
19501 [HttP://MediaWiki.Org/]
19502 !! html/php
19503 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
19504 </p>
19505 !! html/parsoid
19506 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
19507 !! end
19508
19509 !!test
19510 Bug 34939 - Case insensitive link parsing ([HttP:// title])
19511 !! wikitext
19512 [HttP://MediaWiki.Org/ MediaWiki]
19513 !! html
19514 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
19515 </p>
19516 !! end
19517
19518 !!test
19519 Bug 34939 - Case insensitive link parsing (HttP://)
19520 !! wikitext
19521 HttP://MediaWiki.Org/
19522 !! html/php
19523 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
19524 </p>
19525 !! html/parsoid
19526 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
19527 !! end
19528
19529 !!test
19530 Disable TOC
19531 !! options
19532 notoc
19533 !! wikitext
19534 Lead
19535 == Section 1 ==
19536 == Section 2 ==
19537 == Section 3 ==
19538 == Section 4 ==
19539 == Section 5 ==
19540 !! html
19541 <p>Lead
19542 </p>
19543
19544 <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>
19545 <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>
19546 <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>
19547 <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>
19548 <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>
19549
19550 !! end
19551
19552
19553 ###
19554 ### Parsoid-specific tests
19555 ### Parsoid-PHP parser incompatibilities
19556 ###
19557 !!test
19558 1. SOL-sensitive wikitext tokens as template-args
19559 !!options
19560 parsoid=wt2html,wt2wt
19561 !! wikitext
19562 {{echo|*a}}
19563 {{echo|#a}}
19564 {{echo|:a}}
19565 !! html
19566 <span about="#mwt1" typeof="mw:Transclusion">
19567 </span><ul about="#mwt1"><li>a</li>
19568 </ul>
19569 <span about="#mwt2" typeof="mw:Transclusion">
19570 </span><ol about="#mwt2"><li>a</li>
19571 </ol>
19572 <span about="#mwt3" typeof="mw:Transclusion">
19573 </span><dl about="#mwt3"><dd>a</dd>
19574 </dl>
19575 !!end
19576
19577 #### -----------------------------------------------------------------
19578 #### Parsoid-specific functionality tests
19579 #### -----------------------------------------------------------------
19580
19581 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
19582 # We know wt2wt will fail, but we expect selser to pass.
19583 # Due to the nature of our testing, wt2wt and selser tests will enter the
19584 # blacklist and we'll catch selser regressions based on changes to the
19585 # blacklist entries for selser tests.
19586 !! test
19587 1. Bad treebuilder fixup of formatting elt is cleaned up
19588 !! options
19589 parsoid=wt2html,wt2wt
19590 !! wikitext
19591 {|
19592 |
19593 <small>
19594 [[Image:Foobar.jpg|right|Test]]
19595 </small>
19596 |}
19597 !! html/parsoid
19598 <table>
19599 <tbody><tr><td>
19600 <small>
19601 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Test</figcaption></figure>
19602 </small>
19603 </td></tr>
19604 </tbody></table>
19605 !! end
19606
19607 !! test
19608 2. Bad treebuilder fixup of formatting elt is cleaned up
19609 !! options
19610 parsoid=wt2html,wt2wt
19611 !! wikitext
19612 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
19613
19614 <small>[[Image:Foobar.jpg|right|300px]]</small>
19615 !! html/parsoid
19616 <p><b>foo</b></p>
19617 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption><b>caption</b></figcaption></figure>
19618 <p><b>bar</b></p>
19619 <small><figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="34" width="300"/></a></figure></small>
19620 !! end
19621
19622 #### ----------------------------------------------------------------
19623 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
19624 #### tags. Parsoid's output for these tags differs from that of the
19625 #### PHP parser.
19626 #### ----------------------------------------------------------------
19627
19628 !!test
19629 Ref: 1. ref-location should be replaced with an index span
19630 !!options
19631 parsoid
19632 !! wikitext
19633 A <ref>foo</ref>
19634 B <ref name="x">foo</ref>
19635 C <ref name="y" />
19636 !! html
19637 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
19638 B <span about="#mwt4" class="reference" id="cite_ref-x_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}'><a href="#cite_note-x-2">[2]</a></span>
19639 C <span about="#mwt6" class="reference" id="cite_ref-y_3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"y"}}'><a href="#cite_note-y-3">[3]</a></span></p>
19640 !!end
19641
19642 !!test
19643 Ref: 2. ref-tags with identical names should all get the same index
19644 !!options
19645 parsoid
19646 !! wikitext
19647 A <ref name="x">foo</ref>
19648 B <ref name="x" />
19649 !! html
19650 <p>A <span about="#mwt2" class="reference" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span>
19651 B <span about="#mwt4" class="reference" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span></p>
19652 !!end
19653
19654 !!test
19655 Ref: 3. spaces in ref-names should be ignored
19656 !!options
19657 parsoid
19658 !! wikitext
19659 A <ref name="x">foo</ref>
19660 B <ref name=" x " />
19661 C <ref name= x />
19662 !! html
19663 <p>A <span about="#mwt2" class="reference" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span>
19664 B <span about="#mwt4" class="reference" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span>
19665 C <span about="#mwt6" class="reference" id="cite_ref-x_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span></p>
19666 !!end
19667
19668 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
19669 !!test
19670 Ref: 4. 'constructor' should be accepted as a valid ref-name
19671 !!options
19672 parsoid
19673 !! wikitext
19674 A <ref name="constructor">foo</ref>
19675 !! html
19676 <p>A <span about="#mwt2" class="reference" id="cite_ref-constructor_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"constructor"}}'><a href="#cite_note-constructor-1">[1]</a></span></p>
19677 !!end
19678
19679 !!test
19680 Ref: 5. body should accept generic wikitext
19681 !!options
19682 parsoid
19683 !! wikitext
19684 A <ref>
19685 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
19686 </ref>
19687
19688 <references />
19689 !! html
19690 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"This is a &lt;b data-parsoid=&#39;{\"dsr\":[19,40,3,3]}&#39;>&lt;a rel=\"mw:WikiLink\" href=\"./Bolded_link\" title=\"Bolded link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bolded_link\"},\"sa\":{\"href\":\"bolded link\"},\"dsr\":[22,37,2,2]}&#39;>bolded link&lt;/a>&lt;/b> and this is a &lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]],\"dsr\":[55,76,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"transclusion\"}},\"i\":0}}]}&#39;>transclusion&lt;/span>\n"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19691
19692 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19693 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> This is a <b><a rel="mw:WikiLink" href="./Bolded_link" title="Bolded link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
19694 </li>
19695 </ol>
19696 !!end
19697
19698 !!test
19699 Ref: 6. indent-pres should not be output in ref-body
19700 !!options
19701 parsoid
19702 !! wikitext
19703 A <ref>
19704 foo
19705 bar
19706 baz
19707 </ref>
19708
19709 <references />
19710 !! html
19711 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo\n bar\n baz\n"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19712
19713 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19714 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo
19715 bar
19716 baz
19717 </li>
19718 </ol>
19719 !!end
19720
19721 !!test
19722 Ref: 7. No p-wrapping in ref-body
19723 !!options
19724 parsoid
19725 !! wikitext
19726 A <ref>
19727 foo
19728
19729 bar
19730
19731
19732 baz
19733
19734
19735
19736 booz
19737 </ref>
19738
19739 <references />
19740 !! html
19741 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo\n\nbar\n\n\nbaz\n\n\n\nbooz\n"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19742
19743 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19744 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo
19745
19746 bar
19747
19748
19749 baz
19750
19751
19752
19753 booz
19754 </li>
19755 </ol>
19756 !!end
19757
19758 !!test
19759 Ref: 8. transclusion wikitext has lower precedence
19760 !!options
19761 parsoid
19762 !! wikitext
19763 A <ref> foo {{echo|</ref> B C}}
19764
19765 <references />
19766 !! html
19767 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo &lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"src\":\"{{\",\"dsr\":[12,14,0,0]}&#39;>{{&lt;/span>echo|"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C<span typeof="mw:Nowiki">}}</span></p>
19768 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19769 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo <span typeof="mw:Nowiki">{{</span>echo|</li>
19770 </ol>
19771 !!end
19772
19773 !!test
19774 Ref: 9. unclosed comments should not leak out of ref-body
19775 !!options
19776 parsoid
19777 !! wikitext
19778 A <ref> foo <!--</ref> B C
19779 <references />
19780 !! html
19781 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo &lt;!---->"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C</p>
19782 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19783 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo <!----></li>
19784 </ol>
19785 !!end
19786
19787 !!test
19788 Ref: 10. Unclosed HTML tags should not leak out of ref-body
19789 !!options
19790 parsoid
19791 !! wikitext
19792 A <ref> <b> foo </ref> B C
19793
19794 <references />
19795 !! html
19796 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"&lt;b data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[8,16,3,0]}&#39;> foo &lt;/b>"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C</p>
19797
19798
19799 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19800 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></li>
19801 </ol>
19802 !!end
19803
19804 !!test
19805 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
19806 !!options
19807 parsoid
19808 !! wikitext
19809 A <ref>foo</ref> B
19810 C <ref>bar</ref> D
19811 !! html
19812 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B
19813 C <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}'><a href="#cite_note-2">[2]</a></span> D</p>
19814 !!end
19815
19816 !!test
19817 Ref: 12. ref-tags act as trailing newline migration barrier
19818 !!options
19819 parsoid
19820 !! wikitext
19821 <!--the newline at the end of this line moves out of the p-tag-->a
19822
19823 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
19824 <ref />
19825
19826 c
19827 !! html
19828 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
19829
19830
19831 <p>b<!--the newline at the end of this line stays inside the p-tag--> <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-1">[1]</a></span>
19832 <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-2">[2]</a></span></p>
19833
19834 <p>c</p>
19835 !!end
19836
19837 !!test
19838 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
19839 !!options
19840 parsoid
19841 !! wikitext
19842 <ref>foo</ref> A
19843 <ref>bar
19844 </ref> B
19845 !! html
19846 <p><span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> A
19847 <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar\n"},"attrs":{}}'><a href="#cite_note-2">[2]</a></span> B</p>
19848 !!end
19849
19850 !!test
19851 Ref: 14. A nested ref-tag should be emitted as plain text
19852 !!options
19853 parsoid
19854 !! wikitext
19855 <ref>foo <ref>bar</ref> baz</ref>
19856
19857 <references />
19858 !! html
19859 <p><span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo &amp;lt;ref>bar&amp;lt;/ref> baz"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19860
19861 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19862 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo &lt;ref>bar&lt;/ref> baz</li>
19863 </ol>
19864 !!end
19865
19866 !!test
19867 Ref: 15. ref-tags with identical names should get identical indexes
19868 !!options
19869 parsoid
19870 !! wikitext
19871 A1 <ref name="a">foo</ref> A2 <ref name="a" />
19872 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
19873
19874 <references />
19875 !! html
19876 <p>A1 <span about="#mwt3" class="reference" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a"}}'><a href="#cite_note-a-1">[1]</a></span> A2 <span about="#mwt4" class="reference" id="cite_ref-a_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="#cite_note-a-1">[1]</a></span>
19877 B1 <span about="#mwt7" class="reference" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span> B2 <span about="#mwt8" class="reference" id="cite_ref-b_2-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span></p>
19878
19879 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-a_1-0">1.0</a> <a href="#cite_ref-a_1-1">1.1</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy">↑ <a href="#cite_ref-b_2-0">2.0</a> <a href="#cite_ref-b_2-1">2.1</a></span> bar</li>
19880 </ol>
19881 !!end
19882
19883 ## We don't bother wt2wt-ing non-standard whitespace
19884 !!test
19885 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
19886 !!options
19887 parsoid=wt2html
19888 !! wikitext
19889 A <ref >foo</ref >
19890
19891 <references />
19892 !! html
19893 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19894
19895 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19896 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li></ol>
19897 !!end
19898
19899 !!test
19900 Ref: 17. Generate valid HTML5 id/about attributes
19901 !!options
19902 parsoid
19903 !!wikitext
19904 <ref name="a b">foo</ref>
19905
19906 <references />
19907 !!html
19908 <p><span class="reference" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a b"}}'><a href="#cite_note-a_b-1">[1]</a></span>
19909 </p>
19910
19911 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19912 <li id="cite_note-a_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_b_1-0">↑</a></span> foo</li>
19913 !!end
19914
19915 !!test
19916 Ref: 18. T58916: Extension attributes should be parsed as plain text
19917 !!options
19918 parsoid
19919 !!wikitext
19920 <ref name="{{echo|a}}">foo</ref>
19921
19922 <references />
19923 !!html
19924 <p><span class="reference" id="cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"{{echo|a}}"}}'><a href="#cite_note-.7B.7Becho.7Ca.7D.7D-1">[1]</a></span>
19925 </p>
19926
19927 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19928 <li id="cite_note-.7B.7Becho.7Ca.7D.7D-1"><span rel="mw:referencedBy"><a href="#cite_ref-.7B.7Becho.7Ca.7D.7D_1-0">↑</a></span> foo</li>
19929 !!end
19930
19931 !!test
19932 Ref: 19. ref-tags with identical name encodings should get identical indexes
19933 !!options
19934 parsoid
19935 !! wikitext
19936 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
19937
19938 <references />
19939 !! html
19940 <p>1 <span about="#mwt3" class="reference" id="cite_ref-a_.26_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a &amp; b"}}'><a href="#cite_note-a_.26_b-1">[1]</a></span> 2 <span about="#mwt4" class="reference" id="cite_ref-a_.26_b_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a &amp;amp; b"}}'><a href="#cite_note-a_.26_b-1">[1]</a></span>
19941
19942 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a_.26_b-1" id="cite_note-a_.26_b-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-a_.26_b_1-0">1.0</a> <a href="#cite_ref-a_.26_b_1-1">1.1</a></span> foo</li>
19943 </ol>
19944 !!end
19945
19946 !!test
19947 References: 1. references tag without any refs should be handled properly
19948 !!options
19949 parsoid
19950 !! wikitext
19951 <references />
19952 !! html
19953 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
19954 !!end
19955
19956 !!test
19957 References: 2. references tag with group only outputs references from that group
19958 !!options
19959 parsoid
19960 !! wikitext
19961 A <ref group="a">foo</ref>
19962 B <ref group="b">bar</ref>
19963
19964 <references group="a" />
19965 !! html
19966 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
19967 B <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"group":"b"}}'><a href="#cite_note-2">[b 1]</a></span></p>
19968
19969 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li>
19970 </ol>
19971 !!end
19972
19973 !!test
19974 References: 3. ref list should be cleared after processing references
19975 !!options
19976 parsoid
19977 !! wikitext
19978 A <ref>foo</ref>
19979
19980 <references />
19981
19982 B <ref>bar</ref>
19983
19984 <references />
19985 !! html
19986 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19987
19988 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li>
19989 </ol>
19990
19991 <p>B <span about="#mwt6" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}'><a href="#cite_note-2">[1]</a></span></p>
19992
19993 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> bar</li>
19994 </ol>
19995 !!end
19996
19997 !!test
19998 References: 4. only referenced group should be cleared after processing references
19999 !!options
20000 parsoid
20001 !! wikitext
20002 A <ref group="a">afoo</ref>
20003 B <ref>bfoo</ref>
20004
20005 <references group="a" />
20006
20007 C <ref>cfoo</ref>
20008
20009 <references />
20010 !! html
20011 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"afoo"},"attrs":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
20012 B <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bfoo"},"attrs":{}}'><a href="#cite_note-2">[1]</a></span></p>
20013
20014 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> afoo</li>
20015 </ol>
20016
20017 <p>C <span about="#mwt8" class="reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"cfoo"},"attrs":{}}'><a href="#cite_note-3">[2]</a></span></p>
20018
20019 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> bfoo</li><li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3">↑</a></span> cfoo</li>
20020 </ol>
20021 !!end
20022
20023 !!test
20024 References: 5. ref tags in references should be processed while ignoring all other content
20025 !!options
20026 parsoid
20027 !! wikitext
20028 A <ref name="a" />
20029 B <ref name="b">bar</ref>
20030
20031 <references>
20032 <ref name="a">foo</ref>
20033 This should just get lost.
20034 </references>
20035 !! html
20036 <p>A <span about="#mwt2" class="reference" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="#cite_note-a-1">[1]</a></span>
20037 B <span about="#mwt4" class="reference" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span></p>
20038
20039
20040 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"a\">foo&lt;/ref>\nThis should just get lost.","html":"\n&lt;span about=\"#mwt8\" class=\"reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"src\":\"&amp;lt;ref name=\\\"a\\\">foo&amp;lt;/ref>\",\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"#cite_note-a-1\">[1]&lt;/a>&lt;/span>\n"},"attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_1-0">↑</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b_2-0">↑</a></span> bar</li>
20041 </ol>
20042 !!end
20043
20044 !!test
20045 References: 6. <references /> from a transclusion
20046 !!options
20047 parsoid
20048 !! wikitext
20049 <ref>Foo</ref> {{echo|<references />}}
20050 !! html
20051 <p><span about="#mwt3" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"Foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p> <ol class="references" typeof="mw:Extension/references mw:Transclusion" about="#mwt4" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;references />"}},"i":0}}]}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> Foo</li></ol>
20052 !!end
20053
20054 !! test
20055 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
20056 !! options
20057 parsoid
20058 !! wikitext
20059 A <ref>foo bar for a</ref>
20060 B <ref group="X" name="b" />
20061
20062 <references />
20063
20064 <references group="X">
20065 <ref name="b">foo</ref>
20066 </references>
20067 !! html
20068 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
20069 B <span about="#mwt4" class="reference" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}'><a href="#cite_note-b-2">[X 1]</a></span></p>
20070
20071 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo bar for a</li></ol>
20072
20073 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"b\">foo&lt;/ref>","html":"\n&lt;span about=\"#mwt10\" class=\"reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"src\":\"&amp;lt;ref name=\\\"b\\\">foo&amp;lt;/ref>\",\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"#cite_note-b-2\">[X 1]&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b_2-0">↑</a></span> foo</li></ol>
20074 !! end
20075
20076 !! test
20077 Entities in ref name
20078 !! options
20079 parsoid
20080 !! wikitext
20081 <ref name="test &amp; me">hi</ref>
20082 !! html
20083 <p><span about="#mwt2" class="reference" id="cite_ref-test_.26_me_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"hi"},"attrs":{"name":"test &amp;amp; me"}}'><a href="#cite_note-test_.26_me-1">[1]</a></span></p>
20084 !! end
20085
20086 # This test is wt2html only because we're permitting the serializer to produce
20087 # dirty diffs, normalizing the unclosed references to the self-closed version.
20088 !! test
20089 Generate references for unclosed references tag
20090 !! options
20091 parsoid=wt2html
20092 !! wikitext
20093 a<ref>foo</ref>
20094
20095 <references>
20096 !! html
20097 <p>a<span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
20098
20099
20100 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20101 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li></ol>
20102 !! end
20103
20104 !! test
20105 New reference serializes on its own line
20106 !! options
20107 parsoid=wt2wt,html2wt
20108 !! wikitext
20109 foo
20110 <references />
20111 !! html
20112 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
20113 !! end
20114
20115 #--------- Test stripping of empty nodes in template content ----------
20116 !!test
20117 Empty LI and TR nodes should be stripped from template content
20118 !!wikitext
20119 {{EmptyLITest}}
20120 {{EmptyTRTest}}
20121 !!html/parsoid
20122 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
20123 <li>a</li>
20124 <li>b</li>
20125 </ul>
20126 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
20127 <tbody>
20128 <tr>
20129 <td>foo</td>
20130 </tr>
20131 <tr>
20132 <td>bar</td>
20133 </tr>
20134 </tbody>
20135 </table>
20136 !!end
20137
20138 !!test
20139 Empty LI and TR nodes should not be stripped from top-level content
20140 !!wikitext
20141 * a
20142 *
20143 * b
20144 {|
20145 |-
20146 |-
20147 |foo
20148 |}
20149 !!html/parsoid
20150 <ul>
20151 <li> a</li>
20152 <li></li>
20153 <li> b</li>
20154 </ul>
20155 <table>
20156 <tbody>
20157 <tr></tr>
20158 <tr>
20159 <td>foo</td>
20160 </tr>
20161 </tbody>
20162 </table>
20163 !!end
20164
20165 !!test
20166 Empty TR nodes should not be stripped if they have any attributes set
20167 !!wikitext
20168 {{EmptyTRWithHTMLAttrTest}}
20169 !!html/parsoid
20170 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
20171 <tr align="center"></tr>
20172 <tr><td>foo</td></tr>
20173 <tr align="center"></tr>
20174 <tr><td>bar</td></tr>
20175 </table>
20176 !!end
20177
20178 #### ----------------------------------------------------------------
20179 #### The following section of tests are primarily to test
20180 #### wikitext escaping capabilities of Parsoid. Given that
20181 #### escaping can be done any number of ways, the wikitext (input)
20182 #### is always adjusted to reflect how Parsoid adds nowiki
20183 #### escape tags.
20184 ####
20185 #### We are marking several tests as parsoid-only since the
20186 #### HTML in the result section is different from what the
20187 #### PHP parser generates for it.
20188 #### ----------------------------------------------------------------
20189
20190
20191 #### --------------- Headings ---------------
20192 #### 0. Unnested
20193 #### 1. Nested inside html <h1>=foo=</h1>
20194 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
20195 #### 3. Nested inside html with wikitext split by html tags
20196 #### 4. No escape needed
20197 #### 5. Empty headings <h1></h1>
20198 #### 6. Heading chars in SOL context
20199 #### ----------------------------------------
20200 !! test
20201 Headings: 0. Unnested
20202 !! options
20203 parsoid
20204 !! wikitext
20205 <nowiki>=foo=</nowiki>
20206
20207 <nowiki> =foo= </nowiki>
20208 <!--cmt-->
20209 <nowiki>=foo=</nowiki>
20210
20211 =foo''a''<nowiki>=</nowiki>
20212 !! html
20213 <p><span typeof="mw:Nowiki">=foo=</span></p>
20214
20215 <p><span typeof="mw:Nowiki"> =foo= </span>
20216 <!--cmt-->
20217 <span typeof="mw:Nowiki">=foo=</span></p>
20218
20219 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
20220 !!end
20221
20222 # New headings and existing headings are handled differently
20223 !! test
20224 Headings: 1. Nested inside html
20225 !! options
20226 parsoid=html2wt
20227 !! html
20228 <h1>=foo=</h1>
20229 <h2>=foo=</h2>
20230 <h3>=foo=</h3>
20231
20232 <h1 data-parsoid=''>=foo=</h1>
20233 <h2 data-parsoid=''>=foo=</h2>
20234 <h3 data-parsoid=''>=foo=</h3>
20235 <h4 data-parsoid=''>=foo=</h4>
20236 <h5 data-parsoid=''>=foo=</h5>
20237 <h6 data-parsoid=''>=foo=</h6>
20238 !! wikitext
20239 = =foo= =
20240
20241 == =foo= ==
20242
20243 === =foo= ===
20244
20245 =<nowiki>=foo=</nowiki>=
20246 ==<nowiki>=foo=</nowiki>==
20247 ===<nowiki>=foo=</nowiki>===
20248 ====<nowiki>=foo=</nowiki>====
20249 =====<nowiki>=foo=</nowiki>=====
20250 ======<nowiki>=foo=</nowiki>======
20251
20252 !!end
20253
20254 !! test
20255 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
20256 !! options
20257 parsoid=html2wt
20258 !! html
20259 <h1>foo</h1>*bar
20260 <h1>foo</h1>=bar
20261 <h1>foo</h1>=bar=
20262 !! wikitext
20263 = foo =
20264 <nowiki>*</nowiki>bar
20265
20266 = foo =
20267 =bar
20268
20269 = foo =
20270 <nowiki>=bar=</nowiki>
20271 !!end
20272
20273 !! test
20274 Headings: 3. Nested inside html with wikitext split by html tags
20275 !! options
20276 parsoid=html2wt,wt2wt
20277 !! wikitext
20278 = ='''bold'''<nowiki>foo=</nowiki> =
20279 !! html/parsoid
20280 <h1>=<b>bold</b>foo=</h1>
20281 !!end
20282
20283 !! test
20284 Headings: 4a. No escaping needed (testing just h1 and h2)
20285 !! wikitext
20286 = =foo =
20287
20288 = foo= =
20289
20290 = =foo= =
20291
20292 = =foo= bar =
20293
20294 == =foo ==
20295
20296 == foo= ==
20297
20298 = = =
20299
20300 = ''=''foo= =
20301 !! html/parsoid
20302 <h1>=foo</h1>
20303 <h1>foo=</h1>
20304 <h1> =foo= </h1>
20305 <h1>=foo= bar</h1>
20306 <h2>=foo</h2>
20307 <h2>foo=</h2>
20308 <h1>=</h1>
20309 <h1><i>=</i>foo=</h1>
20310 !!end
20311
20312 !! test
20313 Headings: 4b. No escaping needed (inside p-tags)
20314 !! options
20315 parsoid=html2wt
20316 !! html
20317 <p>===
20318 =foo= x
20319 =foo= <s></s>
20320 </p>
20321 !! wikitext
20322 ===
20323 =foo= x
20324 =foo= <s></s>
20325 !!end
20326
20327 !! test
20328 Headings: 5. Empty headings
20329 !! options
20330 parsoid
20331 !! wikitext
20332 =<nowiki/>=
20333
20334 ==<nowiki/>==
20335
20336 ===<nowiki/>===
20337
20338 ====<nowiki/>====
20339
20340 =====<nowiki/>=====
20341
20342 ======<nowiki/>======
20343 !! html
20344 <h1></h1>
20345 <h2></h2>
20346 <h3></h3>
20347 <h4></h4>
20348 <h5></h5>
20349 <h6></h6>
20350 !!end
20351
20352 !! test
20353 Headings: 6a. Heading chars in SOL context (with trailing spaces)
20354 !! options
20355 parsoid
20356 !! wikitext
20357 <nowiki>=a=</nowiki>
20358
20359 <nowiki>=a=</nowiki>
20360
20361 <nowiki>=a=</nowiki>
20362
20363 <nowiki>=a=</nowiki>
20364 !! html
20365 <p>=a=</p>
20366 <p>=a= </p>
20367 <p>=a= </p>
20368 <p>=a= </p>
20369 !!end
20370
20371 !! test
20372 Headings: 6b. Heading chars in SOL context (with trailing newlines)
20373 !! options
20374 parsoid
20375 !! wikitext
20376 <nowiki>=a=
20377 b</nowiki>
20378
20379 <nowiki>=a=
20380 b</nowiki>
20381
20382 <nowiki>=a=
20383 b</nowiki>
20384
20385 <nowiki>=a=
20386 b</nowiki>
20387 !! html
20388 <p>=a=
20389 b</p>
20390 <p>=a=
20391 b</p>
20392 <p>=a=
20393 b</p>
20394 <p>=a=
20395 b</p>
20396 </p>
20397 !!end
20398
20399 !! test
20400 Headings: 6c. Heading chars in SOL context (leading newline break)
20401 !! options
20402 parsoid
20403 !! wikitext
20404 a
20405 <nowiki>=b=</nowiki>
20406 !! html
20407 <p>a
20408 =b=</p>
20409 !!end
20410
20411 !! test
20412 Headings: 6d. Heading chars in SOL context (with interspersed comments)
20413 !! options
20414 parsoid
20415 !! wikitext
20416 <!--c0--><nowiki>=a=</nowiki>
20417
20418 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
20419 !! html
20420 <p><!--c0-->=a=</p>
20421 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
20422 !!end
20423
20424 !! test
20425 Headings: 6d. Heading chars in SOL context (No escaping needed)
20426 !! options
20427 parsoid=html2wt
20428 !! html
20429 =a=<div>b</div>
20430 !! wikitext
20431 =a=<div>b</div>
20432 !!end
20433
20434 !! test
20435 Headings: 7. Insert a newline between new content and headings
20436 !! options
20437 parsoid=html2wt
20438 !! html
20439 <h2>NEW</h2>
20440 <p>new</p>
20441 <h2 data-parsoid='{"dsr":[0,5,2,2]}'>A</h2>
20442 <p data-parsoid='{"dsr":[6,7,0,0]}'>a</p>
20443 !! wikitext
20444 == NEW ==
20445 new
20446
20447 ==A==
20448 a
20449
20450 !! end
20451
20452 #### --------------- Lists ---------------
20453 #### 0. Outside nests (*foo, etc.)
20454 #### 1. Nested inside html <ul><li>*foo</li></ul>
20455 #### 2. Inside definition lists
20456 #### 3. Only bullets at start should be escaped
20457 #### 4. No escapes needed
20458 #### 5. No unnecessary escapes
20459 #### 6. Escape bullets in SOL position
20460 #### 7. Escape bullets in a multi-line context
20461 #### ----------------------------------------
20462
20463 !! test
20464 Lists: 0. Outside nests
20465 !! wikitext
20466 <nowiki>*</nowiki>foo
20467
20468 <nowiki>#</nowiki>foo
20469
20470 <nowiki>;Foo:</nowiki>bar
20471 !! html
20472 <p>*foo
20473 </p><p>#foo
20474 </p><p>;Foo:bar
20475 </p>
20476 !!end
20477
20478 !! test
20479 Lists: 1. Nested inside html
20480 !! wikitext
20481 *<nowiki>*foo</nowiki>
20482
20483 *<nowiki>#foo</nowiki>
20484
20485 *<nowiki>:foo</nowiki>
20486
20487 *<nowiki>;foo</nowiki>
20488
20489 #<nowiki>*foo</nowiki>
20490
20491 #<nowiki>#foo</nowiki>
20492
20493 #<nowiki>:foo</nowiki>
20494
20495 #<nowiki>;foo</nowiki>
20496 !! html
20497 <ul><li>*foo</li></ul>
20498 <ul><li>#foo</li></ul>
20499 <ul><li>:foo</li></ul>
20500 <ul><li>;foo</li></ul>
20501 <ol><li>*foo</li></ol>
20502 <ol><li>#foo</li></ol>
20503 <ol><li>:foo</li></ol>
20504 <ol><li>;foo</li></ol>
20505
20506 !!end
20507
20508 !! test
20509 Lists: 2. Inside definition lists
20510 !! wikitext
20511 ;<nowiki>;foo</nowiki>
20512
20513 ;<nowiki>:foo</nowiki>
20514
20515 ;<nowiki>:foo</nowiki>
20516 :bar
20517
20518 :<nowiki>:foo</nowiki>
20519 !! html
20520 <dl><dt>;foo</dt></dl>
20521 <dl><dt>:foo</dt></dl>
20522 <dl><dt>:foo</dt>
20523 <dd>bar</dd></dl>
20524 <dl><dd>:foo</dd></dl>
20525
20526 !!end
20527
20528 !! test
20529 Lists: 3. Only bullets at start of text should be escaped
20530 !! wikitext
20531 *<nowiki>*foo*bar</nowiki>
20532
20533 *<nowiki>*foo</nowiki>''it''*bar
20534 !! html
20535 <ul><li>*foo*bar</li></ul>
20536 <ul><li>*foo<i>it</i>*bar</li></ul>
20537
20538 !!end
20539
20540 !! test
20541 Lists: 4. No escapes needed
20542 !! options
20543 parsoid
20544 !! wikitext
20545 *foo*bar
20546
20547 *''foo''*bar
20548
20549 *[[Foo]]: bar
20550
20551 *[[Foo]]*bar
20552 !! html
20553 <ul>
20554 <li>foo*bar
20555 </li>
20556 </ul>
20557 <ul>
20558 <li><i>foo</i>*bar
20559 </li>
20560 </ul>
20561 <ul>
20562 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
20563 </li>
20564 </ul>
20565 <ul>
20566 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
20567 </li>
20568 </ul>
20569 !!end
20570
20571 !! test
20572 Lists: 5. No unnecessary escapes
20573 !! wikitext
20574 * bar <span><nowiki>[[foo]]</nowiki></span>
20575
20576 * =bar <span><nowiki>[[foo]]</nowiki></span>
20577
20578 * [[bar <span><nowiki>[[foo]]</nowiki></span>
20579
20580 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
20581
20582 * =bar <span>foo]]</span>=
20583
20584 * <s></s>: a
20585
20586 * ''* foo''
20587 !! html
20588 <ul><li> bar <span>[[foo]]</span></li></ul>
20589 <ul><li> =bar <span>[[foo]]</span></li></ul>
20590 <ul><li> [[bar <span>[[foo]]</span></li></ul>
20591 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
20592 <ul><li> =bar <span>foo]]</span>=</li></ul>
20593 <ul><li> <s></s>: a</li></ul>
20594 <ul><li> <i>* foo</i></li></ul>
20595
20596 !!end
20597
20598 !! test
20599 Lists: 6. Escape bullets in SOL position
20600 !! options
20601 parsoid=html2wt
20602 !! html
20603 <p><!--cmt-->*foo</p>
20604 !! wikitext
20605 <!--cmt--><nowiki>*</nowiki>foo
20606 !!end
20607
20608 !! test
20609 Lists: 7. Escape bullets in a multi-line context
20610 !! wikitext
20611 a
20612 <nowiki>*</nowiki>b
20613 !! html
20614 <p>a
20615 *b
20616 </p>
20617 !!end
20618
20619 !! test
20620 Lists: 8. Escape colons only if not present in tags
20621 !! options
20622 parsoid=html2wt
20623 !! html
20624 <dl><dt>a:b<i>c:d</i></dt></dl>
20625 !! wikitext
20626 ; <nowiki>a:b</nowiki>''c:d''
20627 !! end
20628
20629 #### --------------- HRs ---------------
20630 #### 1. Single line
20631 #### -----------------------------------
20632
20633 !! test
20634 HRs: 1. Single line
20635 !! wikitext
20636 ----<nowiki>----</nowiki>
20637 ----=foo=
20638 ----*foo
20639 !! html+tidy
20640 <hr />
20641 <p>----</p>
20642 <hr />
20643 <p>=foo=</p>
20644 <hr />
20645 <p>*foo</p>
20646 !! end
20647
20648 #### --------------- Tables ---------------
20649 #### 1a. Simple example
20650 #### 1b. No escaping needed (!foo)
20651 #### 1c. No escaping needed (|foo)
20652 #### 1d. No escaping needed (|}foo)
20653 ####
20654 #### 2a. Nested in td (<td>foo|bar</td>)
20655 #### 2b. Nested in td (<td>foo||bar</td>)
20656 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
20657 ####
20658 #### 3a. Nested in th (<th>foo!bar</th>)
20659 #### 3b. Nested in th (<th>foo!!bar</th>)
20660 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
20661 ####
20662 #### 4a. Escape -
20663 #### 4b. Escape +
20664 #### 4c. No escaping needed
20665 #### --------------------------------------
20666
20667 !! test
20668 Tables: 1a. Simple example
20669 !! wikitext
20670 <nowiki>{|
20671 |}</nowiki>
20672 !! html
20673 <p>{|
20674 |}
20675 </p>
20676 !! end
20677
20678 !! test
20679 Tables: 1b. No escaping needed
20680 !! wikitext
20681 !foo
20682 !! html
20683 <p>!foo
20684 </p>
20685 !! end
20686
20687 !! test
20688 Tables: 1c. No escaping needed
20689 !! wikitext
20690 |foo
20691 !! html
20692 <p>|foo
20693 </p>
20694 !! end
20695
20696 !! test
20697 Tables: 1d. No escaping needed
20698 !! wikitext
20699 |}foo
20700 !! html
20701 <p>|}foo
20702 </p>
20703 !! end
20704
20705 !! test
20706 Tables: 2a. Nested in td
20707 !! options
20708 parsoid=html2wt
20709 !! html/parsoid
20710 <table><tbody><tr>
20711 <td>foo|bar</td></tr>
20712 <tr><td>x<div>a|b</div></td>
20713 </tbody></table>
20714 !! wikitext
20715 {|
20716 |<nowiki>foo|bar</nowiki>
20717 |-
20718 |x<div><nowiki>a|b</nowiki></div>
20719 |}
20720 !! html/php+tidy
20721 <table>
20722 <tr>
20723 <td>foo|bar</td>
20724 </tr>
20725 <tr>
20726 <td>x
20727 <div>a|b</div>
20728 </td>
20729 </tr>
20730 </table>
20731 !! end
20732
20733 !! test
20734 Tables: 2b. Nested in td
20735 !! options
20736 parsoid=html2wt
20737 !! html/parsoid
20738 <table><tbody><tr>
20739 <td>foo||bar</td>
20740 <td>a<i>b||c</i></td>
20741 <td>a<i><div>b||c</div></i></td>
20742 </tr></tbody></table>
20743 !! wikitext
20744 {|
20745 |<nowiki>foo||bar</nowiki>
20746 |a''<nowiki>b||c</nowiki>''
20747 |a''<div><nowiki>b||c</nowiki></div>''
20748 |}
20749 !! html/php
20750 <table>
20751 <tr>
20752 <td>foo||bar
20753 </td>
20754 <td>a<i>b||c</i>
20755 </td>
20756 <td>a<i><div>b||c</div></i>
20757 </td></tr></table>
20758
20759 !! end
20760
20761 !! test
20762 Tables: 2c. Nested in td -- no escaping needed
20763 !! wikitext
20764 {|
20765
20766 |foo!!bar
20767 |}
20768 !! html/*
20769 <table>
20770
20771 <tr>
20772 <td>foo!!bar
20773 </td></tr></table>
20774
20775 !! end
20776
20777 !! test
20778 Tables: 3a. Nested in th
20779 !! wikitext
20780 {|
20781
20782 !foo!bar
20783 |}
20784 !! html/*
20785 <table>
20786
20787 <tr>
20788 <th>foo!bar
20789 </th></tr></table>
20790
20791 !! end
20792
20793 !! test
20794 Tables: 3b. Nested in th
20795 !! options
20796 parsoid=html2wt
20797 !! html/parsoid
20798 <table><tbody>
20799 <tr><th>foo!!bar</th>
20800 <th><i>foo|bar</i></th>
20801 <th><i>foo!!bar</i></th>
20802 <th><i><span>foo!!bar</span></i></th>
20803 </tr></tbody></table>
20804 !! wikitext
20805 {|
20806 !<nowiki>foo!!bar</nowiki>
20807 !''<nowiki>foo|bar</nowiki>''
20808 !''<nowiki>foo!!bar</nowiki>''
20809 !''<span><nowiki>foo!!bar</nowiki></span>''
20810 |}
20811 !! html/php
20812 <table>
20813 <tr>
20814 <th>foo!!bar
20815 </th>
20816 <th><i>foo|bar</i>
20817 </th>
20818 <th><i>foo!!bar</i>
20819 </th>
20820 <th><i><span>foo!!bar</span></i>
20821 </th></tr></table>
20822
20823 !! end
20824
20825 !! test
20826 Tables: 3c. Nested in th
20827 !! options
20828 parsoid=html2wt
20829 !! html/parsoid
20830 <table><tbody>
20831 <tr><th>foo||bar</th>
20832 <th><span typeof="mw:Nowiki">foo||bar</span></th>
20833 </tr></tbody></table>
20834 !! wikitext
20835 {|
20836 !<nowiki>foo||bar</nowiki>
20837 !<nowiki>foo||bar</nowiki>
20838 |}
20839 !! html/php
20840 <table>
20841 <tr>
20842 <th>foo||bar
20843 </th>
20844 <th>foo||bar
20845 </th></tr></table>
20846
20847 !! end
20848
20849 !! test
20850 Tables: 4a. Escape -
20851 !! options
20852 parsoid=html2wt
20853 !! html/*
20854 <table>
20855
20856 <tr>
20857 <th>-bar
20858 </th></tr>
20859 <tr>
20860 <td>-bar
20861 </td></tr></table>
20862
20863 !! wikitext
20864 {|
20865
20866 !-bar
20867
20868 |-
20869 |<nowiki>-bar</nowiki>
20870 |}
20871 !! end
20872
20873 !! test
20874 Tables: 4b. Escape +
20875 !! options
20876 parsoid=html2wt
20877 !! html/*
20878 <table>
20879
20880 <tr>
20881 <th>+bar
20882 </th></tr>
20883 <tr>
20884 <td>+bar
20885 </td></tr></table>
20886
20887 !! wikitext
20888 {|
20889
20890 !+bar
20891
20892 |-
20893 |<nowiki>+bar</nowiki>
20894 |}
20895 !! end
20896
20897 !! test
20898 Tables: 4c. No escaping needed
20899 !! wikitext
20900 {|
20901 |foo-bar
20902 |foo+bar
20903 |-
20904 |''foo''-bar
20905 |''foo''+bar
20906 |-
20907 |foo
20908 bar|baz
20909 +bar
20910 -bar
20911 |-
20912 |x
20913 <div>a|b</div>
20914 |}
20915 !! html/php
20916 <table>
20917 <tr>
20918 <td>foo-bar
20919 </td>
20920 <td>foo+bar
20921 </td></tr>
20922 <tr>
20923 <td><i>foo</i>-bar
20924 </td>
20925 <td><i>foo</i>+bar
20926 </td></tr>
20927 <tr>
20928 <td>foo
20929 <p>bar|baz
20930 +bar
20931 -bar
20932 </p>
20933 </td></tr>
20934 <tr>
20935 <td>x
20936 <div>a|b</div>
20937 </td></tr></table>
20938
20939 !! html/parsoid
20940 <table><tbody>
20941 <tr><td>foo-bar</td><td>foo+bar</td></tr>
20942 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
20943 <tr><td>foo
20944 <p>bar|baz
20945 +bar
20946 -bar</p></td></tr>
20947 <tr><td>x
20948 <div>a|b</div></td>
20949 </tbody></table>
20950 !! end
20951
20952 !! test
20953 Tables: 4d. No escaping needed
20954 !! wikitext
20955 {|
20956 |[[Foo]]-bar
20957 ||+1
20958 ||-2
20959 |}
20960 !! html/php
20961 <table>
20962 <tr>
20963 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
20964 </td>
20965 <td>+1
20966 </td>
20967 <td>-2
20968 </td></tr></table>
20969
20970 !! html/parsoid
20971 <table>
20972 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
20973 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
20974 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
20975 </tbody></table>
20976 !! end
20977
20978 !! test
20979 Tables: Digest broken attributes on table and tr tag
20980 !! options
20981 parsoid=wt2html
20982 !! wikitext
20983 {| || |} ++
20984 |- || || ++ --
20985 |- > [
20986 |}
20987 !! html
20988 <table>
20989 <tbody>
20990 <tr></tr>
20991 <tr></tr>
20992 </tbody></table>
20993 !! end
20994
20995 #### --------------- Links ----------------
20996 #### 1. Quote marks in link text
20997 #### 2. Wikilinks: Escapes needed
20998 #### 3. Wikilinks: No escapes needed
20999 #### 4. Extlinks: Escapes needed
21000 #### 5. Extlinks: No escapes needed
21001 #### --------------------------------------
21002 !! test
21003 Links 1. WikiLinks: No escapes needed
21004 !! wikitext
21005 [[Foo|Foo''boo'']]
21006 [[Foo|[Foobar]]]
21007 [[Foo|x [Foobar] x]]
21008 !! html/php
21009 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
21010 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
21011 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
21012 </p>
21013 !! html/parsoid
21014 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
21015 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
21016 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
21017 !! end
21018
21019 !! test
21020 Links 2. WikiLinks: Escapes needed
21021 !! options
21022 parsoid=html2wt
21023 !! html/parsoid
21024 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
21025 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
21026 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
21027 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
21028 <a href="Foo" rel="mw:WikiLink">|Bar</a>
21029 <a href="Foo" rel="mw:WikiLink">]]bar</a>
21030 <a href="Foo" rel="mw:WikiLink">[[bar</a>
21031 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
21032 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
21033 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
21034 !! wikitext
21035 [[Foo|<nowiki>Foobar]</nowiki>]]
21036 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
21037 [[Foo|<nowiki>[[Bar]]</nowiki>]]
21038 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
21039 [[Foo|<nowiki>|Bar</nowiki>]]
21040 [[Foo|<nowiki>]]bar</nowiki>]]
21041 [[Foo|<nowiki>[[bar</nowiki>]]
21042 [[Foo|<nowiki>x [[ y</nowiki>]]
21043 [[Foo|<nowiki>x ]] y</nowiki>]]
21044 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
21045 !! html/php
21046 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
21047 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
21048 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
21049 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
21050 <a href="/wiki/Foo" title="Foo">|Bar</a>
21051 <a href="/wiki/Foo" title="Foo">]]bar</a>
21052 <a href="/wiki/Foo" title="Foo">[[bar</a>
21053 <a href="/wiki/Foo" title="Foo">x [[ y</a>
21054 <a href="/wiki/Foo" title="Foo">x ]] y</a>
21055 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
21056 </p>
21057 !! end
21058
21059 !! test
21060 Links 3. WikiLinks: No escapes needed
21061 !! wikitext
21062 [[Foo|[Foobar]]
21063 [[Foo|foo|bar]]
21064 !! html/php
21065 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
21066 <a href="/wiki/Foo" title="Foo">foo|bar</a>
21067 </p>
21068 !! html/parsoid
21069 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
21070 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
21071 !! end
21072
21073 !! test
21074 Links 4. ExtLinks: Escapes needed
21075 !! options
21076 parsoid=html2wt
21077 !! html/parsoid
21078 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
21079 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
21080 <p>[http://google.com]</p>
21081 <p>[http://google.com google]</p>
21082 !! wikitext
21083 [http://google.com <nowiki>[google]</nowiki>]
21084 [http://google.com <nowiki>google]</nowiki>]
21085
21086 <nowiki>[http://google.com]</nowiki>
21087
21088 <nowiki>[http://google.com google]</nowiki>
21089
21090 !! html/php
21091 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
21092 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
21093 </p><p>[http://google.com]
21094 </p><p>[http://google.com google]
21095 </p>
21096 !! end
21097
21098 !! test
21099 Links 5. ExtLinks: No escapes needed
21100 !! wikitext
21101 [http://google.com [google]
21102 !! html/php
21103 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
21104 </p>
21105 !! html/parsoid
21106 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
21107 !! end
21108
21109 !! test
21110 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
21111 !! html/parsoid
21112 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
21113 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
21114 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
21115 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
21116 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
21117 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
21118 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21119 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
21120 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21121 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
21122 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
21123 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
21124 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
21125 </p>
21126 !! wikitext
21127 x<nowiki/>http://example.com<nowiki/>y
21128 http://example.com<nowiki/>?x
21129 http://example.com<nowiki/>&x
21130 http://example.com<nowiki/>'x
21131 http://example.com<nowiki/>,x
21132 http://example.com<nowiki/>.x
21133 http://example.com<nowiki/>;x
21134 http://example.com<nowiki/>:x
21135 http://example.com<nowiki/>;x
21136 http://example.com<nowiki/>!x
21137 http://example.com<nowiki/>=x
21138 http://example.com<nowiki/>(x)
21139 http://example.com(x<nowiki/>)
21140 !! end
21141
21142 !! test
21143 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21144 !! html/parsoid
21145 <p>x
21146 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
21147 y
21148 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
21149 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
21150 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
21151 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
21152 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
21153 </p>
21154 !! wikitext
21155 x
21156 http://example.com
21157 y
21158 "http://example.com"
21159 (http://example.com)
21160 (http://example.com) foo
21161 http://example.com,
21162 http://example.com, foo
21163 !! html/php
21164 <p>x
21165 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
21166 y
21167 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
21168 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
21169 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
21170 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
21171 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
21172 </p>
21173 !! end
21174
21175 !! test
21176 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21177 !! html/parsoid
21178 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
21179 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
21180 !! wikitext
21181 http://example.com.,;:!?\
21182 -http://example.com:
21183 !! html/php
21184 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
21185 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
21186 </p>
21187 !! end
21188
21189 !! test
21190 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
21191 !! html/parsoid
21192 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
21193 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
21194 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
21195 !! wikitext
21196 RFC 123<nowiki/>4
21197 RFC 123<nowiki/>y
21198 X<nowiki/>RFC 123<nowiki/>y
21199 !! end
21200
21201 !! test
21202 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
21203 !! html/parsoid
21204 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
21205 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
21206 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
21207 </p>
21208 !! wikitext
21209 RFC 123?foo
21210 RFC 123&foo
21211 -RFC 123-
21212 !! html/php
21213 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
21214 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
21215 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
21216 </p>
21217 !! end
21218
21219 !! test
21220 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
21221 !! html/parsoid
21222 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
21223 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21224 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21225 !! wikitext
21226 PMID 123<nowiki/>4
21227 PMID 123<nowiki/>y
21228 X<nowiki/>PMID 123<nowiki/>y
21229 !! end
21230
21231 !! test
21232 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
21233 !! html/parsoid
21234 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
21235 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
21236 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
21237 </p>
21238 !! wikitext
21239 PMID 123?foo
21240 PMID 123&foo
21241 -PMID 123-
21242 !! html/php
21243 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
21244 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
21245 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
21246 </p>
21247 !! end
21248
21249 !! test
21250 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
21251 !! html/parsoid
21252 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
21253 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
21254 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
21255 </p>
21256 !! wikitext
21257 ISBN 1234567890<nowiki/>1
21258 ISBN 1234567890<nowiki/>x
21259 a<nowiki/>ISBN 1234567890<nowiki/>b
21260 !! end
21261
21262 !! test
21263 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
21264 !! html/parsoid
21265 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
21266 !! wikitext
21267 -ISBN 1234567890's
21268 !! html/php
21269 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
21270 </p>
21271 !! end
21272
21273 !! test
21274 Links 14. Protect link-like plain text. (Parsoid bug T78425)
21275 !! options
21276 parsoid=html2wt
21277 !! html/*
21278 <p>this is not a link: http://example.com
21279 </p>
21280 !! wikitext
21281 this is not a link: <nowiki>http://example.com</nowiki>
21282 !! end
21283
21284 !! test
21285 Links 15. Link trails can't become link prefixes.
21286 !! options
21287 language=is
21288 !! wikitext
21289 [[Söfnuður]]-[[00]]
21290 !! html/php
21291 <p><a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">Söfnuður-</a><a href="/wiki/00" title="00">00</a>
21292 </p>
21293 !! html/parsoid
21294 <p><a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður" data-parsoid='{"stx":"simple","tail":"-"}'>Söfnuður-</a><a rel="mw:WikiLink" href="00" title="00">00</a></p>
21295 !! end
21296
21297 #### --------------- Quotes ---------------
21298 #### 1. Quotes inside <b> and <i>
21299 #### 2. Link fragments separated by <i> and <b> tags
21300 #### 3. Link fragments inside <i> and <b>
21301 #### 4. No escaping needed
21302 #### --------------------------------------
21303 !! test
21304 1a. Quotes inside <b> and <i>
21305 !! options
21306 parsoid=html2wt,wt2wt
21307 !! wikitext
21308 ''<nowiki/>'foo'''
21309 ''<nowiki>''foo''</nowiki>''
21310 ''<nowiki>'''foo'''</nowiki>''
21311 ''foo''<nowiki/>'s
21312 '''<nowiki/>'foo''''
21313 '''<nowiki>''foo''</nowiki>'''
21314 '''<nowiki>'''foo'''</nowiki>'''
21315 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
21316 '''foo'''<nowiki/>'s
21317 '''foo''
21318 ''foo''<nowiki/>'
21319 ''foo'''<nowiki/>'
21320 '''foo''<nowiki/>'
21321 ''''foo'''
21322 '''foo'''<nowiki/>'
21323 ''''foo'''<nowiki/>'
21324 ''fools'<span> errand</span>''
21325 ''<span>fool</span>'s errand''
21326 '<nowiki/>''foo'' bar '''baz''
21327 a|!*#-:;+-~[]{}b'''x''
21328 !! html/*
21329 <p><i>'foo'</i>
21330 <i>''foo''</i>
21331 <i>'''foo'''</i>
21332 <i>foo</i>'s
21333 <b>'foo'</b>
21334 <b>''foo''</b>
21335 <b>'''foo'''</b>
21336 <b>foo'<i>bar'</i>baz</b>
21337 <b>foo</b>'s
21338 '<i>foo</i>
21339 <i>foo</i>'
21340 <i>foo'</i>'
21341 '<i>foo</i>'
21342 '<b>foo</b>
21343 <b>foo</b>'
21344 '<b>foo</b>'
21345 <i>fools'<span> errand</span></i>
21346 <i><span>fool</span>'s errand</i>
21347 '<i>foo</i> bar '<i>baz</i>
21348 a|!*#-:;+-~[]{}b'<i>x</i>
21349 </p>
21350 !! end
21351
21352 !! test
21353 1b. Quotes inside <b> and <i> with other tags on same line
21354 !! options
21355 parsoid=html2wt,wt2wt
21356 !! wikitext
21357 '''a'' foo ''[[bar]]''
21358 ''a''' foo ''[[bar]]''
21359 ''a''' foo '''{{echo|[[bar]]}}'''
21360 [[foo]] x'''[[bar]]''
21361 '''foo'' <ref>test</ref>
21362 '''foo'' <div title="name">test</div>
21363 '''foo'' and <br> bar
21364 !! html
21365 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21366 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21367 <i>a'</i> foo <b><a rel="mw:WikiLink" href="Bar" title="Bar" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[bar]]"}},"i":0}}]}'>bar</a></b>
21368 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
21369 '<i>foo</i> <span class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"test"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
21370 '<i>foo</i> <div title="name">test</div>
21371 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
21372 !! end
21373
21374 !! test
21375 2. Link fragments separated by <i> and <b> tags
21376 !! wikitext
21377 [[''foo''<nowiki>hello]]</nowiki>
21378
21379 [['''foo'''<nowiki>hello]]</nowiki>
21380 !! html
21381 <p>[[<i>foo</i>hello]]
21382 </p><p>[[<b>foo</b>hello]]
21383 </p>
21384 !! end
21385
21386 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
21387 # this is one of the shortcomings of this format
21388 !! test
21389 3. Link fragments inside <i> and <b>
21390 !! wikitext
21391 ''[[foo''<nowiki>]]</nowiki>
21392
21393 '''[[foo'''<nowiki>]]</nowiki>
21394 !! html
21395 <p><i>[[foo</i>]]
21396 </p><p><b>[[foo</b>]]
21397 </p>
21398 !! end
21399
21400 !! test
21401 4. No escaping needed
21402 !! wikitext
21403 '<span>''bar''</span>'
21404 '<span>'''bar'''</span>'
21405 'a:b'foo
21406 !! html
21407 <p>'<span><i>bar</i></span>'
21408 '<span><b>bar</b></span>'
21409 'a:b'foo
21410 </p>
21411 !! end
21412
21413 #### ----------- Paragraphs ---------------
21414 #### 1. No unnecessary escapes
21415 #### --------------------------------------
21416
21417 !! test
21418 1. No unnecessary escapes
21419 !! wikitext
21420 bar <span><nowiki>[[foo]]</nowiki></span>
21421
21422 =bar <span><nowiki>[[foo]]</nowiki></span>
21423
21424 [[bar <span><nowiki>[[foo]]</nowiki></span>
21425
21426 ]]bar <span><nowiki>[[foo]]</nowiki></span>
21427
21428 =bar <span>foo]]</span><nowiki>=</nowiki>
21429 !! html
21430 <p>bar <span>[[foo]]</span>
21431 </p><p>=bar <span>[[foo]]</span>
21432 </p><p>[[bar <span>[[foo]]</span>
21433 </p><p>]]bar <span>[[foo]]</span>
21434 </p><p>=bar <span>foo]]</span>=
21435 </p>
21436 !!end
21437
21438 #### ----------------------- PRE --------------------------
21439 #### 1. Leading whitespace in SOL context should be escaped
21440 #### ------------------------------------------------------
21441 !! test
21442 1. Leading whitespace in SOL context should be escaped
21443 !! options
21444 parsoid
21445 !! wikitext
21446 <nowiki> </nowiki>a
21447
21448 <nowiki> </nowiki> a
21449
21450 <nowiki> </nowiki>a(tab)
21451
21452 <nowiki> </nowiki> a
21453 <!--cmt-->
21454 <nowiki> </nowiki> a
21455
21456 a
21457 <nowiki> </nowiki>b
21458
21459 a
21460 <nowiki> </nowiki>b
21461
21462 a
21463 <nowiki> </nowiki> b
21464 !! html
21465 <p> a</p>
21466 <p> a</p>
21467 <p> a(tab)</p>
21468 <p> a</p>
21469 <p><!--cmt--> a</p>
21470 <p>a
21471 b</p>
21472 <p>a
21473 b</p>
21474 <p>a
21475 b</p>
21476 !! end
21477
21478 !! test
21479 2. Leading whitespace in non-indent-pre contexts should not be escaped
21480 !! options
21481 parsoid
21482 !! wikitext
21483 foo <ref>''a''
21484 b</ref>
21485 !! html
21486 <p>foo <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[9,14,2,2]}&#39;>a&lt;/i>\n b"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
21487 !! end
21488
21489 !! test
21490 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
21491 !! options
21492 parsoid
21493 !! wikitext
21494 <blockquote>
21495 a
21496 <span>b</span>
21497 c
21498 </blockquote>
21499 !! html
21500 <blockquote>
21501 <p>
21502 a
21503 <span>b</span>
21504 c</p>
21505 </blockquote>
21506 !! end
21507
21508 !! test
21509 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
21510 !! options
21511 parsoid
21512 !! wikitext
21513 [[File:Foobar.jpg|thumb|caption]]
21514 !! html
21515 !! html/parsoid
21516 <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>
21517 !! end
21518
21519 !! test
21520 5. Nowiki escaping should account for indent-pres
21521 !! options
21522 parsoid=html2wt
21523 !! html
21524 <pre>==foo==</pre>
21525 !! wikitext
21526 ==foo==
21527 !! end
21528
21529 #### --------------- Behavior Switches --------------------
21530 !! test
21531 1. Valid behavior switches should be escaped
21532 !! options
21533 parsoid=html2wt
21534 !! html
21535 __TOC__
21536 <i>__TOC__</i>
21537 !! wikitext
21538 <nowiki>__TOC__</nowiki>
21539 ''<nowiki>__TOC__</nowiki>''
21540 !! end
21541
21542 !! test
21543 2. Invalid behavior switches should not be escaped
21544 !! options
21545 parsoid=html2wt
21546 !! html
21547 __TOO__
21548 __|__
21549 !! wikitext
21550 __TOO__
21551 __|__
21552 !! end
21553
21554 #### --------------- HTML tags ---------------
21555 #### 1. a tags
21556 #### 2. other tags
21557 #### 3. multi-line html tag
21558 #### 4. extension tags
21559 #### -----------------------------------------
21560 !! test
21561 1. a tags
21562 !! options
21563 parsoid
21564 !! wikitext
21565 <a href="http://google.com">google</a>
21566 !! html
21567 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
21568 !! end
21569
21570 !! test
21571 2. other tags
21572 !! wikitext
21573 <nowiki><div>foo</div>
21574 <div style="color:red">foo</div></nowiki>
21575 !! html
21576 <p>&lt;div&gt;foo&lt;/div&gt;
21577 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
21578 </p>
21579 !! end
21580
21581 !! test
21582 3. multi-line html tag
21583 !! wikitext
21584 <nowiki><div
21585 >foo</div
21586 ></nowiki>
21587 !! html
21588 <p>&lt;div
21589 &gt;foo&lt;/div
21590 &gt;
21591 </p>
21592 !! end
21593
21594 !! test
21595 4. extension tags
21596 !! wikitext
21597 <nowiki><ref>foo</ref></nowiki>
21598
21599 <nowiki><ref>bar</nowiki>
21600
21601 baz<nowiki></ref></nowiki>
21602 !! html
21603 <p>&lt;ref&gt;foo&lt;/ref&gt;
21604 </p><p>&lt;ref&gt;bar
21605 </p><p>baz&lt;/ref&gt;
21606 </p>
21607 !! end
21608
21609 #### --------------- Others ---------------
21610 !! test
21611 Escaping nowikis
21612 !! wikitext
21613 &lt;nowiki&gt;foo&lt;/nowiki&gt;
21614 !! html
21615 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
21616 </p>
21617 !! end
21618
21619 ## The quote-char in the input is necessary for triggering the bug
21620 !! test
21621 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
21622 !! options
21623 parsoid=wt2wt,html2wt
21624 !! wikitext
21625 foo's bar :
21626 !! html
21627 <p>foo's bar :</p>
21628 !! end
21629
21630 !! test
21631
21632 Tag-like HTML structures are passed through as text
21633 !! wikitext
21634 <x y>
21635
21636 <x.y>
21637
21638 <x-y>
21639
21640 1>2
21641
21642 x<y
21643
21644 a>b
21645
21646 1<d e>f
21647 !! html
21648 <p>&lt;x y&gt;
21649 </p><p>&lt;x.y&gt;
21650 </p><p>&lt;x-y&gt;
21651 </p><p>1&gt;2
21652 </p><p>x&lt;y
21653 </p><p>a&gt;b
21654 </p><p>1&lt;d e&gt;f
21655 </p>
21656 !! end
21657
21658
21659 # This was a bug in the PHP parser (see bug 17663 and its dups,
21660 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
21661 !! test
21662 Tag names followed by punctuation should not be recognized as tags
21663 !! wikitext
21664 <s.ome> text
21665 !! html
21666 <p>&lt;s.ome&gt; text
21667 </p>
21668 !! end
21669
21670 !! test
21671 HTML tag with necessary entities in attributes
21672 !! wikitext
21673 <span title="&amp;amp;">foo</span>
21674 !! html
21675 <p><span title="&amp;amp;">foo</span>
21676 </p>
21677 !! end
21678
21679 !! test
21680 HTML tag with 'unnecessary' entity encoding in attributes
21681 !! wikitext
21682 <span title="&amp;">foo</span>
21683 !! html
21684 <p><span title="&amp;">foo</span>
21685 </p>
21686 !! end
21687
21688 !! test
21689 HTML tag with broken attribute value quoting
21690 !! wikitext
21691 <span title="Hello world>Foo</span>
21692 !! html/php
21693 <p><span>Foo</span>
21694 </p>
21695 !! html/parsoid
21696 <p><span title="Hello world">Foo</span>
21697 </p>
21698 !! end
21699
21700 !! test
21701 Parsoid-only: HTML tag with broken attribute value quoting
21702 !! options
21703 parsoid
21704 !! wikitext
21705 <span title="Hello world>Foo</span>
21706 !! html
21707 <p><span title="Hello world">Foo</span>
21708 </p>
21709 !! end
21710
21711 !! test
21712 Table with broken attribute value quoting
21713 !! wikitext
21714 {|
21715 | title="Hello world|Foo
21716 |}
21717 !! html/php
21718 <table>
21719 <tr>
21720 <td>Foo
21721 </td></tr></table>
21722
21723 !! html/parsoid
21724 <table>
21725 <tr>
21726 <td title="Hello world">Foo
21727 </td></tr></table>
21728
21729 !! end
21730
21731 !! test
21732 Table with broken attribute value quoting on consecutive lines
21733 !! wikitext
21734 {|
21735 | title="Hello world|Foo
21736 | style="color:red|Bar
21737 |}
21738 !! html/php
21739 <table>
21740 <tr>
21741 <td>Foo
21742 </td>
21743 <td>Bar
21744 </td></tr></table>
21745
21746 !! html/parsoid
21747 <table><tbody>
21748 <tr>
21749 <td title="Hello world">Foo
21750 </td><td style="color: red">Bar
21751 </td></tr></tbody></table>
21752
21753 !! end
21754
21755 !! test
21756 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21757 !! options
21758 parsoid
21759 !! wikitext
21760 {{}}
21761 !! html
21762 {{}}
21763 !! end
21764
21765 !! test
21766 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21767 !! options
21768 parsoid
21769 !! wikitext
21770 }}{{
21771 !! html
21772 }}{{
21773 !! end
21774
21775 !!test
21776 Accept empty td cell attribute
21777 !! wikitext
21778 {|
21779 | align="center" | foo || |
21780 |}
21781 !! html
21782 <table>
21783 <tr>
21784 <td align="center"> foo </td>
21785 <td>
21786 </td></tr></table>
21787
21788 !!end
21789
21790 !!test
21791 Non-empty attributes in th-cells
21792 !! wikitext
21793 {|
21794 ! Foo !! style="color: red" | Bar
21795 |}
21796 !! html
21797 <table>
21798 <tr>
21799 <th> Foo </th>
21800 <th style="color: red"> Bar
21801 </th></tr></table>
21802
21803 !!end
21804
21805 !!test
21806 Accept empty attributes in th-cells
21807 !! wikitext
21808 {|
21809 !| foo !!| bar
21810 |}
21811 !! html
21812 <table>
21813 <tr>
21814 <th> foo </th>
21815 <th> bar
21816 </th></tr></table>
21817
21818 !!end
21819
21820 !!test
21821 Empty table rows go away
21822 !! wikitext
21823 {|
21824 | Hello
21825 | there
21826 |- class="foo"
21827 |-
21828 |}
21829 !! html
21830 <table>
21831 <tr>
21832 <td> Hello
21833 </td>
21834 <td> there
21835 </td></tr>
21836
21837 </table>
21838
21839 !! end
21840
21841 ###
21842 ### Parsoid-centric tests for testing RTing of inter-element separators
21843 ### Edge cases not tested by existing parser tests and specific to
21844 ### Parsoid-specific serialization strategies.
21845 ###
21846
21847 !!test
21848 RT-ed inter-element separators should be valid separators
21849 !! wikitext
21850 {|
21851 |- [[foo]]
21852 |}
21853 !! html
21854 <table>
21855
21856 </table>
21857
21858 !!end
21859
21860 # Parsoid-only since PHP parser relies on Tidy for correct output
21861 !!test
21862 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
21863 !!options
21864 parsoid
21865 !! wikitext
21866 {|
21867 |<small>foo
21868 bar
21869 |}
21870
21871 {|
21872 |<small>foo<small>
21873 |}
21874 !! html
21875 <table>
21876 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
21877 <p>bar</p></small></td></tr>
21878 </tbody></table>
21879
21880 <table>
21881 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo<small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></small></td></tr>
21882 </tbody></table>
21883 !!end
21884
21885 !!test
21886 Empty TD followed by TD with tpl-generated attribute
21887 !! wikitext
21888 {|
21889 |-
21890 |
21891 |{{echo|style='color:red'}}|foo
21892 |}
21893 !! html
21894 <table>
21895
21896 <tr>
21897 <td>
21898 </td>
21899 <td>foo
21900 </td></tr></table>
21901
21902 !!end
21903
21904 !!test
21905 Indented table with an empty td
21906 !! wikitext
21907 {|
21908 |-
21909 |
21910 |foo
21911 |}
21912 !! html
21913 <table>
21914
21915 <tr>
21916 <td>
21917 </td>
21918 <td>foo
21919 </td></tr></table>
21920
21921 !!end
21922
21923 ## We have some newline diffs RT-ing this edge case
21924 ## and it is not important enough -- we seem to be emitting
21925 ## at most 2 newlines after a </tr> and this is unrelated to
21926 ## the issue from T85627 that this is testing.
21927 !!test
21928 Indented table with blank lines in between (T85627)
21929 !! options
21930 parsoid=wt2html
21931 !! wikitext
21932 {|
21933 |foo
21934
21935
21936 |}
21937 !! html
21938 <table>
21939
21940 <tr>
21941 <td>foo
21942 </td></tr></table>
21943
21944 !!end
21945
21946 !!test
21947 Indented block & table
21948 !! wikitext
21949 <div>foo</div>
21950 {|
21951 |foo
21952 |}
21953 !! html/php
21954 <div>foo</div>
21955 <table>
21956 <tr>
21957 <td>foo
21958 </td></tr></table>
21959
21960 !! html/parsoid
21961 <div data-parsoid='{"stx":"html"}'>foo</div>
21962 <table><tbody>
21963 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
21964 </tbody></table>
21965 !!end
21966
21967 !! test
21968 Indent and comment before table row
21969 !! wikitext
21970 {|
21971 <!--hi-->|-
21972 | there
21973 |}
21974 !! html/php
21975 <table>
21976
21977 <tr>
21978 <td> there
21979 </td></tr></table>
21980
21981 !! html/parsoid
21982 <table>
21983 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
21984 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
21985 </tbody></table>
21986 !! end
21987
21988 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
21989 !!test
21990 Empty TR followed by a template-generated TR
21991 !!options
21992 parsoid
21993 !! wikitext
21994 {|
21995 |-
21996 {{echo|<tr><td>foo</td></tr>}}
21997 |}
21998 !! html
21999 <table>
22000 <tbody>
22001 <tr></tr>
22002 <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}}]}'>
22003 <td>foo</td></tr>
22004 </tbody></table>
22005 !!end
22006
22007 ## PHP and parsoid output differ for this, and since this is primarily
22008 ## for testing Parsoid's serializer, marking this Parsoid only
22009 !!test
22010 Empty TR followed by mixed-ws-comment line should RT correctly
22011 !!options
22012 parsoid
22013 !! wikitext
22014 {|
22015 |-
22016 <!--c-->
22017 |-
22018 <!--c--> <!--d-->
22019 |}
22020 !! html
22021 <table>
22022 <tbody>
22023 <tr></tr>
22024 <!--c-->
22025 <tr>
22026 <!--c--> </tr><!--d-->
22027 </tbody></table>
22028
22029 !!end
22030
22031 !!test
22032 Multi-line image caption generated by templates with/without trailing newlines
22033 !! wikitext
22034 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
22035 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
22036 !! html/parsoid
22037 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" height="34" width="300"/></a><figcaption>foo\n<span about="#mwt9" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"A"}},"i":0}}]}'>A</span>\n<span about="#mwt10" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"B"}},"i":0}}]}'>B</span>\n<span about="#mwt11" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"C"}},"i":0}}]}'>C</span></figcaption></figure>
22038 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" height="34" width="300"/></a><figcaption>foo\n<span about="#mwt12" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"A"}},"i":0}}]}'>A</span>\n<span about="#mwt13" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"B"}},"i":0}}]}'>B</span>\n<span about="#mwt14" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"C"}},"i":0}}]}'>C</span>\n\n</figcaption></figure>
22039 !!end
22040
22041 !! test
22042 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
22043 !! options
22044 parsoid=html2wt
22045 !! html
22046 <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>
22047
22048 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
22049 !! wikitext
22050 <includeonly>foo</includeonly>
22051 new para
22052
22053 [[./Category:Foo]]
22054
22055 = new heading =
22056 !! end
22057
22058 ## PHP emits broken html for this, and since this is primarily
22059 ## a Parsoid serializer test, marking this Parsoid only
22060 !!test
22061 Improperly nested inline or quotes tags with whitespace in between
22062 !!options
22063 parsoid
22064 !! wikitext
22065 <span> <s>x</span> </s>
22066 ''' ''x''' ''
22067 !! html
22068 <p><span> <s>x</s></span><s> </s>
22069 <b> <i>x</i></b><i> </i>
22070 </p>
22071 !!end
22072
22073 !!test
22074 Encapsulate protected attributes from wt
22075 !!options
22076 parsoid
22077 !! wikitext
22078 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
22079 !! html
22080 <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>
22081 </body>
22082 !!end
22083
22084 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
22085 ## Having nested or stray pre tags results in the attempt to add duplicates,
22086 ## causing an assertion fail. This test tries to prevent that situation.
22087 !!test
22088 Ensure ParagraphWrapper can deal with stray closing pre tags
22089 !!options
22090 parsoid=wt2html
22091 !! wikitext
22092 plain text</pre>
22093 !! html
22094 plain text
22095 !!end
22096
22097 !!test
22098 1. Ensure fostered text content is wrapped in element nodes
22099 !!options
22100 parsoid=wt2html
22101 !! wikitext
22102 <table>hi</table><table>ho</table>
22103 !! html
22104 <p>hi</p>
22105 <table></table>
22106 <p>ho</p>
22107 <table></table>
22108 !!end
22109
22110 !!test
22111 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
22112 !!options
22113 parsoid=wt2html,wt2wt
22114 !! wikitext
22115 <table>
22116 <tr> || ||
22117 <td> a
22118 </table>
22119 !! html
22120 <p> || ||
22121 </p><table>
22122 <tbody><tr><td> a</td></tr>
22123 </tbody></table>
22124 !!end
22125
22126 !!test
22127 Encapsulation properly handles null DSR information from foster box
22128 !!options
22129 parsoid=wt2html,wt2wt
22130 !! wikitext
22131 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
22132 !! html
22133 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;<table>foo<tr><td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span><table><tbody><tr><td>bar</td></tr></tbody></table>
22134 !!end
22135
22136 !!test
22137 1. Encapsulate foster-parented transclusion content
22138 !!options
22139 parsoid=wt2wt,wt2html
22140 !! wikitext
22141 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
22142 !! html
22143 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo<tr><td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</p><table>
22144 <tbody>
22145 <tr>
22146 <td>bar</td>
22147 </tr>
22148 </tbody>
22149 </table>
22150 !!end
22151
22152 !!test
22153 2. Encapsulate foster-parented transclusion content
22154 !!options
22155 parsoid=wt2wt,wt2html
22156 !! wikitext
22157 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
22158 !! html
22159 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo&quot;}},&quot;i&quot;:0}},&quot;</div><tr><td>bar</td></tr></table>&quot;]}">foo</div>
22160 <table>
22161 <tbody>
22162 <tr>
22163 <td>bar</td>
22164 </tr>
22165 </tbody>
22166 </table>
22167 !!end
22168
22169 !!test
22170 3. Encapsulate foster-parented transclusion content
22171 !!options
22172 parsoid=wt2wt,wt2html
22173 !! wikitext
22174 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22175 !! html
22176 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div><p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div><tr><td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
22177 <p>foo</p>
22178 </div>
22179 <table>
22180 <tbody>
22181 <tr>
22182 <td>bar</td>
22183 </tr>
22184 </tbody>
22185 </table>
22186 !!end
22187
22188 !!test
22189 4. Encapsulate foster-parented transclusion content
22190 !!options
22191 parsoid=wt2wt,wt2html
22192 !! wikitext
22193 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22194 !! html
22195 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div><p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div><tr><td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
22196 <p>foo</p>
22197 </div>
22198 <table>
22199 <tbody>
22200 <tr>
22201 <td>bar</td>
22202 </tr>
22203 </tbody>
22204 </table>
22205 !!end
22206
22207 !!test
22208 5. Encapsulate foster-parented transclusion content
22209 !!options
22210 parsoid=wt2wt,wt2html
22211 !! wikitext
22212 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
22213 !! html
22214 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><tr><td><div><p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div></td>foo&quot;}},&quot;i&quot;:0}},&quot;</tr></table>&quot;]}">foo</p>
22215 <table>
22216 <tbody>
22217 <tr>
22218 <td>
22219 <div>
22220 <p>foo</p>
22221 </div>
22222 </td>
22223 </tr>
22224 </tbody>
22225 </table>
22226 !!end
22227
22228 !!test
22229 6. Encapsulate foster-parented transclusion content
22230 !!options
22231 parsoid=wt2wt,wt2html
22232 !! wikitext
22233 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
22234 !! html
22235 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><tr><td><div><p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div></td>foo</tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</p>
22236 <table>
22237 <tbody>
22238 <tr>
22239 <td>
22240 <div>
22241 <p>foo</p>
22242 </div>
22243 </td>
22244 </tr>
22245 </tbody>
22246 </table>
22247 <p>ok</p>
22248 !!end
22249
22250 !!test
22251 7. Encapsulate foster-parented transclusion content
22252 !!options
22253 parsoid=wt2wt,wt2html
22254 !! wikitext
22255 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
22256 !! html
22257 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;<p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;<td>bar</td></table>&quot;]}">foo</p>
22258 <table>
22259 <tbody>
22260 <tr>
22261 <td>bar</td>
22262 </tr>
22263 </tbody>
22264 </table>
22265 !!end
22266
22267 !!test
22268 8. Encapsulate foster-parented transclusion content
22269 !!options
22270 parsoid=wt2wt,wt2html
22271 !! wikitext
22272 {{echo|a
22273 }}{|{{echo|style='color:red'}}
22274 |-
22275 |b
22276 |}
22277 !! html
22278 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a\n&quot;}},&quot;i&quot;:0}}]}">a</p><p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;{|&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;style&quot;:{&quot;wt&quot;:&quot;'color:red'&quot;}},&quot;i&quot;:0}},&quot;\n|-\n|b\n|}&quot;]}">{{{1}}}</p><table>
22279 <tbody>
22280 <tr>
22281 <td>b</td>
22282 </tr>
22283 </tbody>
22284 </table>
22285 !!end
22286
22287 !!test
22288 9. Encapsulate foster-parented transclusion content
22289 !!options
22290 parsoid=wt2wt,wt2html
22291 !! wikitext
22292 <table>{{echo|hi</table>hello}}
22293 !! html
22294 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["&lt;table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi&lt;/table>hello"}},"i":0}}]}' data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"pi":[[{"k":"1","spc":["","","",""]}]]}'>hi</p><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><p about="#mwt2">hello</p>
22295 !!end
22296
22297 !!test
22298 Table in fosterable position
22299 !!options
22300 parsoid=wt2html,wt2wt
22301 !! wikitext
22302 {{OpenTable}}
22303 <div>
22304 {|
22305 |}
22306 </div>
22307 |}
22308 !! html
22309 <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">
22310 </span>
22311 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
22312
22313 <table>
22314 </table>
22315 !!end
22316
22317 # Parsoid only for bug 64747
22318 !! test
22319 Properly encapsulate empty-content transclusions in fosterable positions
22320 !! wikitext
22321 <table>
22322 {{#if:|
22323 <td>foo</td>
22324 }}
22325 </table>
22326 !! html/parsoid
22327 <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":["","","",""]}]]}'>
22328
22329 </table>
22330 !! end
22331
22332 !!test
22333 Support <object> element with .data attribute
22334 !!options
22335 parsoid=html2wt
22336 !! html
22337 <object data="test.swf"></object>
22338 !! wikitext
22339 <object data="test.swf"></object>
22340 !!end
22341
22342 !! test
22343 Don't block XML namespace declaration
22344 !! wikitext
22345 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
22346 !! html/php
22347 <p><span>MediaWiki</span>
22348 </p>
22349 !! html/parsoid
22350 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
22351 !! end
22352
22353 # -----------------------------------------------------------------
22354 # The following section of tests are primarily to spec requirements
22355 # around serialization of new/edited content.
22356 #
22357 # All these tests are marked Parsoid html2wt and html2html only
22358 # ----------------------------------------------------------------
22359
22360 # 'mi' is a localinterwiki prefix as well as a language
22361 !! test
22362 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
22363 !! options
22364 parsoid=html2wt
22365 !! html
22366 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
22367 !! wikitext
22368 [[Foo]]
22369 !! end
22370
22371 !! test
22372 New wiki links (href variations)
22373 !! options
22374 parsoid=html2wt
22375 !! html
22376 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22377 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
22378 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
22379 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
22380 !! wikitext
22381 [[Foo_bar]]
22382 [[Foo_bar]]
22383 [[Foo_bar]]
22384 [[Toxine bactérienne]]
22385 !! end
22386
22387 !! test
22388 New wiki links (content string variations)
22389 !! options
22390 parsoid=html2wt
22391 !! html
22392 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22393 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
22394 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
22395 !! wikitext
22396 [[Foo_bar]]
22397 [[Foo bar]]
22398 [[Foo_bar|./Foo_bar]]
22399 !! end
22400
22401 !! test
22402 New category links (href variations)
22403 !! options
22404 parsoid=html2wt
22405 !! html
22406 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
22407 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
22408 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
22409 !! wikitext
22410 [[Category:Toxine bactérienne]]
22411 [[Category:Toxine bactérienne]]
22412 [[Category:Toxine bactérienne]]
22413 !! end
22414
22415 !! test
22416 New interlanguage links (href variations)
22417 !! options
22418 parsoid=html2wt
22419 !! html
22420 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
22421 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
22422 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
22423 !! wikitext
22424 [[es:Toxine bactérienne]]
22425 [[es:Toxine_bactérienne]]
22426 [[es:Toxine_bactérienne]]
22427 !! end
22428
22429 !! test
22430 Image: Modifying size of an image (1)
22431 !! options
22432 parsoid={
22433 "modes": ["wt2wt"],
22434 "changes": [
22435 ["img[height]", "attr", "height", "22"],
22436 ["img[width]", "attr", "width", "200"]
22437 ]
22438 }
22439 !! wikitext
22440 [[Image:Foobar.jpg|230x230px]]
22441 !! wikitext/edited
22442 [[Image:Foobar.jpg|200x200px]]
22443 !!end
22444
22445 !! test
22446 Image: Modifying size of an image (2)
22447 !! options
22448 parsoid={
22449 "modes": ["wt2wt"],
22450 "changes": [
22451 ["img[height]", "attr", "height", "100"],
22452 ["img[width]", "attr", "width", "500"]
22453 ]
22454 }
22455 !! wikitext
22456 [[Image:Foobar.jpg|230x230px]]
22457 !! wikitext/edited
22458 [[Image:Foobar.jpg|500x500px]]
22459 !!end
22460
22461 # Change in size is ignored so long as class='mw-default-size'
22462 !! test
22463 Image: Modifying size of an image (3)
22464 !! options
22465 parsoid={
22466 "modes": ["wt2wt"],
22467 "changes": [
22468 ["figure[class]", "removeClass", "mw-default-size"],
22469 ["figure img", "attr", "height", "19"],
22470 ["figure img", "attr", "width", "170"]
22471 ]
22472 }
22473 !! wikitext
22474 [[Image:Foobar.jpg|thumb]]
22475 !! wikitext/edited
22476 [[Image:Foobar.jpg|thumb|170x170px]]
22477 !!end
22478
22479 !! test
22480 Image: Modifying alignment of an image (bug 48665)
22481 !! options
22482 parsoid={
22483 "modes": ["wt2wt"],
22484 "changes": [
22485 ["figure[class]", "removeClass", "mw-halign-right"],
22486 ["figure[class]", "addClass", "mw-halign-left"]
22487 ]
22488 }
22489 !! wikitext
22490 [[Image:Foobar.jpg|thumb|caption|right]]
22491 !! wikitext/edited
22492 [[Image:Foobar.jpg|thumb|caption|left]]
22493 !! end
22494
22495 !! test
22496 Image: Modifying mw-default-size of an frameless image (bug 62805)
22497 !! options
22498 parsoid={
22499 "modes": ["wt2wt"],
22500 "changes": [
22501 ["figure.mw-default-size", "removeClass", "mw-default-size"]
22502 ]
22503 }
22504 !! wikitext
22505 [[Image:Foobar.jpg|frameless|right]]
22506 !! wikitext/edited
22507 [[Image:Foobar.jpg|frameless|right|220x220px]]
22508 !! end
22509
22510 !! test
22511 Image: Modifying valign of an image (bug 49221)
22512 !! options
22513 parsoid={
22514 "modes": ["wt2wt"],
22515 "changes": [
22516 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
22517 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
22518 ]
22519 }
22520 !! wikitext
22521 [[File:Foobar.jpg|20px|middle]]
22522 !! wikitext/edited
22523 [[File:Foobar.jpg|20px|text-top]]
22524 !! end
22525
22526 !! test
22527 Image: Modifying alt attribute of an image (bug 56400)
22528 !! options
22529 parsoid={
22530 "modes": ["wt2wt"],
22531 "changes": [
22532 ["img[alt]", "attr", "alt", "some alternate edited text"]
22533 ]
22534 }
22535 !! wikitext
22536 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
22537 !! wikitext/edited
22538 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
22539 !!end
22540
22541 !! test
22542 Image: Modifying caption of an image
22543 !! options
22544 parsoid={
22545 "modes": ["wt2wt"],
22546 "changes": [
22547 ["figcaption", "text", "new caption"]
22548 ]
22549 }
22550 !! wikitext
22551 [[Image:Foobar.jpg|thumb|original caption]]
22552 !! wikitext/edited
22553 [[Image:Foobar.jpg|thumb|new caption]]
22554 !!end
22555
22556 !! test
22557 Image: empty alt attribute (bug 48924)
22558 !! options
22559 parsoid
22560 !! wikitext
22561 [[File:Foobar.jpg|thumb|alt=|bar]]
22562 !! html
22563 <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>
22564 !! end
22565
22566 #!! test
22567 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
22568 #!! options
22569 #parsoid=html2wt
22570 #language=ar
22571 #!! html
22572 #<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>
22573 #!! wikitext
22574 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
22575 #!! end
22576
22577 !! test
22578 Image: Block level image should have \n before and after
22579 !! wikitext
22580 123
22581 [[File:Foobar.jpg|right|thumb|150x150px]]
22582 456
22583 !! html/parsoid
22584 <p>123</p>
22585 <figure class="mw-halign-right" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="17" width="150"/></a></figure>
22586 <p>456</p>
22587 !!end
22588
22589 !! test
22590 Image: New block level image should have \n before and after (existing content)
22591 !! wikitext
22592 123
22593 [[File:Foobar.jpg|right|thumb|150x150px]]
22594 456
22595 !! html/parsoid
22596 <p>123</p>
22597 <figure class="mw-halign-right" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"right","ak":"right"},{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"150x150px"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" height="17" width="150" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"17","width":"150"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure>
22598 <p>456</p>
22599 !!end
22600
22601 !! test
22602 Image: upright option (parsoid)
22603 !! options
22604 parsoid
22605 !! wikitext
22606 [[File:Foobar.jpg|thumb|upright|caption]]
22607 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
22608 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
22609 !! html
22610 <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>
22611 <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>
22612 <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>
22613 !!end
22614
22615 !! test
22616 Image: upright option is ignored on inline and frame images (parsoid)
22617 !! options
22618 parsoid
22619 !! wikitext
22620 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
22621 !! html
22622 <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>
22623 !!end
22624
22625 !! test
22626 Image: from basic HTML (1)
22627 !! options
22628 parsoid=html2wt
22629 !! html/parsoid
22630 <span typeof="mw:Image">
22631 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22632 </span>
22633 !! wikitext
22634 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22635 !! end
22636
22637 !! test
22638 Image: from basic HTML (2)
22639 !! options
22640 parsoid=html2wt
22641 !! html/parsoid
22642 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22643 !! wikitext
22644 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22645 !! end
22646
22647 !! test
22648 Image: from basic HTML (3)
22649 !! options
22650 parsoid=html2wt
22651 !! html/parsoid
22652 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
22653 !! wikitext
22654 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
22655 !! end
22656
22657 !! test
22658 Image: from basic HTML (4)
22659 !! options
22660 parsoid=html2wt
22661 !! html/parsoid
22662 <img src="File:Foobar.jpg">
22663 !! wikitext
22664 [[File:Foobar.jpg|link=]]
22665 !! end
22666
22667 !! test
22668 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
22669 !! options
22670 parsoid=html2wt
22671 !! html
22672 <ul>
22673 <li><p>foo</p></li>
22674 </ul>
22675 !! wikitext
22676 * foo
22677 !! end
22678
22679 !! test
22680 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
22681 !! options
22682 parsoid=html2wt
22683 !! html
22684 <ul> <li>foo</li></ul>
22685 !! wikitext
22686 * foo
22687 !! end
22688
22689 !! test
22690 Don't strip leading whitespace when handling indent-pre suppressing tags
22691 !! options
22692 parsoid=html2wt
22693 !! html
22694 <table>
22695 <tr><td> indented row</td></tr>
22696 </table>
22697 <blockquote><p>
22698 <b>This is very bold of you!</b>
22699 </p>
22700 <table><tr><td>
22701 indented cell (no pre-wrapping!)
22702 </td></tr></table>
22703 </blockquote>
22704 <p>foo</p>
22705 <div>bar</div>
22706 !! wikitext
22707 {|
22708 | indented row
22709 |}
22710 <blockquote>
22711 '''This is very bold of you!'''
22712
22713 {|
22714 |
22715 indented cell (no pre-wrapping!)
22716 |}
22717 </blockquote>
22718 foo
22719 <div>bar</div>
22720 !! end
22721
22722 !! test
22723 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
22724 !! options
22725 parsoid=html2wt
22726 !! wikitext
22727 foo
22728 <nowiki> </nowiki><span>bar</span>
22729
22730 <span>foo2
22731 <nowiki> </nowiki></span>bar2
22732
22733 <div>foo</div>
22734 <nowiki> </nowiki><span>bar</span>
22735
22736 <div>
22737 <nowiki> </nowiki><span>foo</span>
22738 </div>
22739 !! html
22740 <p>foo</p>
22741 <span>bar</span>
22742
22743 <span>foo2
22744 </span>bar2
22745
22746 <div>foo</div>
22747 <span>bar</span>
22748
22749 <div>
22750 <span>foo</span>
22751 </div>
22752 !! end
22753
22754 !! test
22755 Lists: Add space after bullets
22756 !! options
22757 parsoid=html2wt
22758 !! html
22759 <ul>
22760 <li>foo</li>
22761 <li> bar</li>
22762 <li><span> baz</span></li>
22763 </ul>
22764 !! wikitext
22765 * foo
22766 * bar
22767 * <span> baz</span>
22768 !! end
22769
22770 !! test
22771 Lists: Dont insert newlines in a serialized list item.
22772 !! options
22773 parsoid=html2wt
22774 !! html
22775 <ul><li>a<br>b</li><li>c</li></ul>
22776 !! wikitext
22777 * a<br>b
22778 * c
22779 !! end
22780
22781 !! test
22782 Headings: Add space before/after == (Bug 51744)
22783 !! options
22784 parsoid=html2wt
22785 !! html
22786 <h2>foo</h2>
22787 <h2> bar</h2>
22788 <h2>baz </h2>
22789 <h2><span> baz</span></h2>
22790 !! wikitext
22791 == foo ==
22792
22793 == bar ==
22794
22795 == baz ==
22796
22797 == <span> baz</span> ==
22798 !! end
22799
22800 !! test
22801 Headings: Force metas to serialize before/after
22802 !! options
22803 parsoid=html2wt
22804 !! html
22805 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
22806 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
22807 !! wikitext
22808 == hello there ==
22809 [[Category:A1]]
22810
22811 [[Category:A2]]
22812 == hi pal ==
22813 !! end
22814
22815 !! test
22816 Parsoid: Serialize positional parameters with = in them as named parameter
22817 !! options
22818 parsoid=html2wt
22819 !! html
22820 <p about="#mwt1" typeof="mw:Transclusion"
22821 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
22822
22823 <p about="#mwt1" typeof="mw:Transclusion"
22824 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
22825
22826 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22827 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22828 <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>
22829 !! wikitext
22830 {{echo|1 = f=oo}}
22831
22832 {{echo|1 = f=oo|2 = bar}}
22833
22834 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22835 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22836 {{echo|<nowiki>f=oo</nowiki>|bar}}
22837 !! end
22838
22839 !! test
22840 Parsoid: Serialize positional parameters with = in extlink as named parameter
22841 !! options
22842 parsoid=html2wt
22843 !! html
22844 <p><a rel="mw:ExtLink" href="http://stuff?is=ok" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://stuff?is=ok"}},"i":0}}]}'>http://stuff?is=ok</a></p>
22845 !! wikitext
22846 {{echo|1 = http://stuff?is=ok}}
22847 !! end
22848
22849 !! test
22850 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
22851 !! options
22852 parsoid=html2wt
22853 !! html
22854 <div>a<p>b</p></div>
22855 <div>a
22856 <p>b</p></div>
22857 <div>
22858 a
22859 <p>b</p></div>
22860 !! wikitext
22861 <div>a
22862 b
22863 </div>
22864 <div>a
22865 b
22866 </div>
22867 <div>
22868 a
22869
22870 b
22871 </div>
22872 !! end
22873
22874 !! test
22875 Substrings resembling wikitext in hrefs should not get nowiki escapes
22876 !! options
22877 parsoid=html2wt
22878 !! html
22879 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
22880 !! wikitext
22881 [[Foo''bar''baz]]
22882 !! end
22883
22884 #-----------------------------
22885 # I/B quote minimization tests
22886 #-----------------------------
22887
22888 !! test
22889 1. I/B quote minimization: wikitext-only tags should be combined
22890 !! options
22891 parsoid=html2wt
22892 !! html
22893 <p><i>A</i><i>B</i></p>
22894 <p><b>A</b><b>B</b></p>
22895 <p><i>A</i><b><i>B</i></b></p>
22896 <p><b>A</b><i><b>B</b></i></p>
22897 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
22898 <p><i><b>A</b></i><i><b>B</b></i></p>
22899 <p><i><b>A</b></i><b><i>B</i></b></p>
22900 <p><b><i>A</i></b><i><b>B</b></i></p>
22901 !! wikitext
22902 ''AB''
22903
22904 '''AB'''
22905
22906 ''A'''B'''''
22907
22908 '''A''B'''''
22909
22910 '''A''BC''D'''
22911
22912 '''''AB'''''
22913
22914 '''''AB'''''
22915
22916 '''''AB'''''
22917 !! end
22918
22919 !! test
22920 2. I/B quote minimization: wikitext and html tags should not be combined
22921 !! options
22922 parsoid=html2wt
22923 !! html
22924 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
22925 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
22926 !! wikitext
22927 ''A''<i>B</i>
22928
22929 ''A''<nowiki/>'''<i>B</i>'''
22930 !! end
22931
22932 !! test
22933 3. I/B quote minimization: templated content stops minimization
22934 !! options
22935 parsoid=html2wt
22936 !! html
22937 <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>
22938 <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>
22939 !! wikitext
22940 ''A''{{echo|''B''}}
22941
22942 ''A''{{echo|'''''B'''''}}
22943 !! end
22944
22945 !! test
22946 4. I/B quote minimization: new content should be mimimized with adjacent old content
22947 !! options
22948 parsoid=html2wt
22949 !! html
22950 <p><i>A</i><i>B</i></p>
22951 <p><b>A</b><b>B</b></p>
22952 <p><i>A</i><b><i>B</i></b></p>
22953 !! wikitext
22954 ''AB''
22955
22956 '''AB'''
22957
22958 ''A'''B'''''
22959 !! end
22960
22961 !! test
22962 5a. Merge adjacent quote nodes if they've been edited
22963 !! options
22964 parsoid={
22965 "modes": ["wt2wt"],
22966 "changes": [
22967 ["p", "contents", "remove", ":contains('b')"]
22968 ]
22969 }
22970 !! wikitext
22971 ''a''b''c''
22972 !! wikitext/edited
22973 ''ac''
22974 !! end
22975
22976 !! test
22977 5b. Merge adjacent quote nodes if they've been edited
22978 !! options
22979 parsoid={
22980 "modes": ["wt2wt"],
22981 "changes": [
22982 ["#x", "remove"]
22983 ]
22984 }
22985 !! wikitext
22986 ''a''<span id="x">b</span>''c''
22987 !! wikitext/edited
22988 ''ac''
22989 !! end
22990
22991 #------------------------------------
22992 # End of I/B quote minimization tests
22993 #------------------------------------
22994
22995 !!test
22996 Bug 54262: New entities
22997 !! options
22998 parsoid=html2wt
22999 !! wikitext
23000 &nbsp;
23001 !! html
23002 <span typeof="mw:Entity">&nbsp;</span>
23003 !! end
23004
23005 ## Note that there is no wikitext output for 'unknownproperty' ##
23006 ## Unknown magic words are silently dropped ##
23007
23008 !! test
23009 Magic words
23010 !! options
23011 parsoid=html2wt
23012 !! html
23013 <meta property='mw:PageProp/toc' />
23014 <meta property='mw:PageProp/notoc' />
23015 <meta property='mw:PageProp/forcetoc' />
23016 <meta property='mw:PageProp/index' />
23017 <meta property='mw:PageProp/noindex' />
23018 <meta property='mw:PageProp/nogallery' />
23019 <meta property='mw:PageProp/noeditsection' />
23020 <meta property='mw:PageProp/notitleconvert' />
23021 <meta property='mw:PageProp/nocontentconvert' />
23022 <meta property='mw:PageProp/unknownproperty' />
23023 !! wikitext
23024 __TOC__
23025 __NOTOC__
23026 __FORCETOC__
23027 __INDEX__
23028 __NOINDEX__
23029 __NOGALLERY__
23030 __NOEDITSECTION__
23031 __NOTITLECONVERT__
23032 __NOCONTENTCONVERT__
23033 !! end
23034
23035 !! test
23036 Consecutive <pre>s should not get merged
23037 !! options
23038 parsoid=html2wt,html2html
23039 !! html
23040 <pre>a</pre><pre>b</pre>
23041
23042 <pre>c
23043 </pre><pre>
23044 d</pre>
23045
23046 <pre>e
23047
23048 </pre><pre>
23049
23050 f</pre>
23051 !! wikitext
23052 a
23053
23054 b
23055
23056 c
23057
23058 d
23059
23060 e
23061
23062
23063
23064 f
23065 !! end
23066
23067 !! test
23068 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
23069 !! options
23070 parsoid=html2wt
23071 !! html
23072 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
23073 !! wikitext
23074 [[Special:BookSources/1234567890|ISBN 1234567895]]
23075 !! end
23076
23077 !! test
23078 Edited RFC links not serializable as RFC links should serialize as extlinks
23079 !! options
23080 parsoid=html2wt
23081 !! html
23082 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
23083 !! wikitext
23084 [//tools.ietf.org/html/rfc123 New RFC]
23085 !! end
23086
23087 !! test
23088 Edited PMID links not serializable as PMID links should serialize as extlinks
23089 !! options
23090 parsoid=html2wt
23091 !! html
23092 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
23093 !! wikitext
23094 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
23095 !! end
23096
23097 !! test
23098 WTS of autolinks with trailing/surrounding context
23099 !! options
23100 parsoid=html2wt
23101 !! html/parsoid
23102 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
23103 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
23104 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
23105 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
23106 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
23107 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
23108 !! wikitext
23109 http://cscott.net<nowiki/>'''foo'''
23110
23111 http://cscott.net<b>foo</b>
23112
23113 '''http://cscott.net<nowiki/>'''
23114
23115 '''http://cscott.net '''
23116
23117 '''http://cscott.net<nowiki/>x'''
23118
23119 http://cscott.net<nowiki/>x
23120 !! end
23121
23122 !! test
23123 WTS of autolinks with nowikis (round-trip)
23124 !! wikitext
23125 x<nowiki/>http://cscott.net<nowiki/>x
23126 !! html/parsoid
23127 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
23128 !! end
23129
23130 # this is the "easy" test because it leaves in place all the
23131 # data-parsoid information indicating this is an autolink
23132 !! test
23133 WTS of autolinks with escapes (editing)
23134 !! options
23135 parsoid={
23136 "modes": ["wt2wt"],
23137 "changes": [
23138 [ "meta", "remove" ]
23139 ]
23140 }
23141 !! wikitext
23142 x<nowiki/>http://cscott.net<nowiki/>x
23143 !! wikitext/edited
23144 x<nowiki/>http://cscott.net<nowiki/>x
23145 !! end
23146
23147 !! test
23148 Edited Redirect link should emit a non-piped wikitext link
23149 !! options
23150 parsoid=html2wt
23151 !! html
23152 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
23153 !! wikitext
23154 #REDIRECT [[Bar]]
23155 !! end
23156
23157 !! test
23158 T75121: Infer extension name from typeOf if data-mw is not present
23159 !! options
23160 parsoid=html2wt
23161 !! html
23162 <div typeOf="mw:Extension/foo"></div>
23163 !! wikitext
23164 <foo />
23165 !! end
23166
23167 # -----------------------------------------------------------------
23168 # End of section for Parsoid-only html2wt tests for serialization
23169 # of new content
23170 # -----------------------------------------------------------------
23171
23172 TODO:
23173 more images
23174 more tables
23175 character entities
23176 and much more
23177 Try for 100% code coverage