Empty attribute syntax
[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 # showindicators make the first lines the page status indicators
30 # comment run through Linker::formatComment() instead of main parser
31 # local format section links in edit comment text as local links
32 # notoc disable table of contents
33 # thumbsize=NNN set the default thumb size to NNNpx for this test
34 #
35 # You can also set the following parser properties via test options:
36 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
37 # wgLinkHolderBatchSize, wgRawHtml
38 #
39 # For testing purposes, temporary articles can created:
40 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
41 # where '/' denotes a newline.
42
43 # This is the standard article assumed to exist.
44 !! article
45 Main Page
46 !! text
47 blah blah
48 !! endarticle
49
50 !!article
51 Foo
52 !!text
53 FOO
54 !!endarticle
55
56 !!article
57 Template:Foo
58 !!text
59 FOO
60 !!endarticle
61
62 !! article
63 Template:Blank
64 !! text
65 !! endarticle
66
67 !! article
68 Template:pipe
69 !! text
70 |
71 !! endarticle
72
73 !! article
74 Template:=
75 !! text
76 <nowiki>=</nowiki>
77 !! endarticle
78
79 !!article
80 MediaWiki:bad image list
81 !!text
82 * [[File:Bad.jpg]] except [[Nasty page]]
83 !!endarticle
84
85 !! article
86 Template:inner list
87 !! text
88 * item 1
89 !! endarticle
90
91 !! article
92 Template:tbl-start
93 !! text
94 {|
95 !! endarticle
96
97 !! article
98 Template:tbl-end
99 !! text
100 |}
101 !! endarticle
102
103 !! article
104 Template:echo
105 !! text
106 {{{1}}}
107 !! endarticle
108
109 !! article
110 Template:echo_with_span
111 !! text
112 <span>{{{1}}}</span>
113 !! endarticle
114
115 !! article
116 Template:echo_with_div
117 !! text
118 <div>{{{1}}}</div>
119 !! endarticle
120
121 !! article
122 Template:table_attribs
123 !! text
124 <noinclude>
125 |</noinclude>style="color:red;"|Foo
126 !! endarticle
127
128 !! article
129 Template:table_attribs_2
130 !! text
131 <noinclude>
132 |</noinclude>style="color:red;"|Foo
133 |Bar||Baz
134 !! endarticle
135
136 !! article
137 Template:table_attribs_3
138 !! text
139 <noinclude>
140 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
141 !! endarticle
142
143 !! article
144 Template:table_attribs_4
145 !! text
146 | style="background-color:#DC241f;" width="10px" |
147 !! endarticle
148
149 !! article
150 Template:table_attribs_5
151 !! text
152 <noinclude>
153 |</noinclude>style="color:red;"||Bar
154 !! endarticle
155
156 !! article
157 Template:table_header_cells
158 !! text
159 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
160 !! endarticle
161
162 !! article
163 Template:table_cells
164 !! text
165 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
166 !! endarticle
167
168 !! article
169 Template:image_attribs
170 !! text
171 <noinclude>
172 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
173 !! endarticle
174
175 ## See T48811 for details
176 !! article
177 Template:mixed_attr_content_template
178 !! text
179 style="color:red;" title="T48811"
180 |-
181 |foo
182 !! endarticle
183
184 !! article
185 Template:definition_list
186 !! text
187 one
188 ::two
189 !! endarticle
190
191 !! article
192 A?b
193 !! text
194 Weirdo titles!
195 !! endarticle
196
197 !!article
198 Template:Bullet
199 !!text
200 * Bar
201 !!endarticle
202
203 !!article
204 Template:OpenTable
205 !!text
206 {|
207 !!endarticle
208
209 !!article
210 Template:EmptyLITest
211 !!text
212 *a
213 *
214 *
215 *b
216 !!endarticle
217
218 !!article
219 Template:EmptyTRTest
220 !!text
221 {|
222 |-
223 |-
224 |foo
225 |-
226 |-
227 |bar
228 |}
229 !!endarticle
230
231 !!article
232 Template:EmptyTRWithHTMLAttrTest
233 !!text
234 <table>
235 <tr align="center"></tr>
236 <tr><td>foo</td></tr>
237 <tr align="center"></tr>
238 <tr><td>bar</td></tr>
239 </table>
240 !!endarticle
241
242 ###
243 ### Basic tests
244 ###
245 !! test
246 Blank input
247 !! wikitext
248 !! html
249 !! end
250
251
252 !! test
253 Simple paragraph
254 !! wikitext
255 This is a simple paragraph.
256 !! html
257 <p>This is a simple paragraph.
258 </p>
259 !! end
260
261 !! test
262 Paragraphs with extra newline spacing
263 !! wikitext
264 foo
265
266 bar
267
268
269 baz
270
271
272
273 booz
274 !! html
275 <p>foo
276 </p><p>bar
277 </p><p><br />
278 baz
279 </p><p><br />
280 </p><p>booz
281 </p>
282 !! end
283
284 !! test
285 Paragraphs with newline spacing with comment lines in between
286 !! wikitext
287 ----
288 a
289 <!--foo-->
290 b
291 ----
292 a
293 <!--foo--><!--More than 1 comment, still stripped-->
294 b
295 ----
296 a
297 <!--foo--> <!----> <!-- bar -->
298 b
299 ----
300 a
301 <!--foo-->
302
303 b
304 ----
305 a
306
307 <!--foo-->
308 b
309 ----
310 a
311 <!--foo-->
312
313
314 b
315 ----
316 a
317
318
319 <!--foo-->
320 b
321 ----
322 !! html
323 <hr />
324 <p>a
325 b
326 </p>
327 <hr />
328 <p>a
329 b
330 </p>
331 <hr />
332 <p>a
333 b
334 </p>
335 <hr />
336 <p>a
337 </p><p>b
338 </p>
339 <hr />
340 <p>a
341 </p><p>b
342 </p>
343 <hr />
344 <p>a
345 </p><p><br />
346 b
347 </p>
348 <hr />
349 <p>a
350 </p><p><br />
351 b
352 </p>
353 <hr />
354
355 !! end
356
357 !! test
358 Paragraphs with newline spacing with non-empty white-space lines in between
359 !! wikitext
360 ----
361 a
362
363 b
364 ----
365 a
366
367
368 b
369 ----
370 !! html
371 <hr />
372 <p>a
373 </p><p>b
374 </p>
375 <hr />
376 <p>a
377 </p><p><br />
378 b
379 </p>
380 <hr />
381
382 !! end
383
384 !! test
385 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
386 !! wikitext
387 ----
388 a
389 <!--foo-->
390 b
391 ----
392 a
393 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
394 b
395 ----
396 a
397
398 <!--foo-->
399 <!--bar-->
400 b
401 ----
402 a
403
404 <!--foo-->
405 <!--bar-->
406
407 b
408 ----
409 !! html
410 <hr />
411 <p>a
412 b
413 </p>
414 <hr />
415 <p>a
416 b
417 </p>
418 <hr />
419 <p>a
420 </p><p>b
421 </p>
422 <hr />
423 <p>a
424 </p><p><br />
425 b
426 </p>
427 <hr />
428
429 !! end
430
431 !! test
432 Extra newlines: More paragraphs with indented comment
433 !! wikitext
434 a
435
436 <!--boo-->
437
438 b
439 !! html
440 <p>a
441 </p><p><br />
442 b
443 </p>
444 !!end
445
446 !! test
447 Extra newlines followed by heading
448 !! wikitext
449 a
450
451
452
453 =b=
454 [[a]]
455
456
457 =b=
458 !! html
459 <p>a
460 </p><p><br />
461 </p>
462 <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>
463 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
464 </p><p><br />
465 </p>
466 <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>
467
468 !! end
469
470 !! test
471 Extra newlines between heading and content are swallowed
472 !! wikitext
473 =b=
474
475
476
477 [[a]]
478 !! html
479 <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>
480 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
481 </p>
482 !! end
483
484 !! test
485 Parsing an URL
486 !! wikitext
487 http://fr.wikipedia.org/wiki/🍺
488 <!-- EasterEgg we love beer, better be able be able to link to it -->
489 !! html
490 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
491 </p>
492 !! end
493
494 # Note that the html+tidy output removes the spaces after the <li>,
495 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
496 # This is an issue for all tests with lists. We intentionally do
497 # *not* add html+tidy clauses for these, as we don't want to
498 # document/test the broken behavior. (Parsoid matches the non-tidy
499 # output in these cases.)
500
501 !! test
502 Simple list
503 !! wikitext
504 * Item 1
505 * Item 2
506 !! html
507 <ul><li> Item 1</li>
508 <li> Item 2</li></ul>
509
510 !! end
511
512 !! test
513 Italics and bold
514 !! wikitext
515 * plain
516 * plain''italic''plain
517 * plain''italic''plain''italic''plain
518 * plain'''bold'''plain
519 * plain'''bold'''plain'''bold'''plain
520 * plain''italic''plain'''bold'''plain
521 * plain'''bold'''plain''italic''plain
522 * plain''italic'''bold-italic'''italic''plain
523 * plain'''bold''bold-italic''bold'''plain
524 * plain'''''bold-italic'''italic''plain
525 * plain'''''bold-italic''bold'''plain
526 * plain''italic'''bold-italic'''''plain
527 * plain'''bold''bold-italic'''''plain
528 * plain l'''italic''plain
529 * plain l''''bold''' plain
530 !! html
531 <ul><li> plain</li>
532 <li> plain<i>italic</i>plain</li>
533 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
534 <li> plain<b>bold</b>plain</li>
535 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
536 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
537 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
538 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
539 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
540 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
541 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
542 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
543 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
544 <li> plain l'<i>italic</i>plain</li>
545 <li> plain l'<b>bold</b> plain</li></ul>
546
547 !! end
548
549 # this example taken from the [[simple:Moon]] article (bug 47326)
550 !! test
551 Italics and possessives (1)
552 !! wikitext
553 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
554 !! html
555 <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
556 </p>
557 !! end
558
559 # this example taken from [[en:Flaming Pie]] (bug 49926)
560 !! test
561 Italics and possessives (2)
562 !! wikitext
563 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
564 !! html
565 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
566 </p>
567 !! end
568
569 # this example taken from [[en:Dictionary]] (bug 49926)
570 !! test
571 Italics and possessives (3)
572 !! wikitext
573 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''.
574 !! html
575 <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>.
576 </p>
577 !! end
578
579
580 ###
581 ### 2-quote opening sequence tests
582 ###
583 !! test
584 Italics and bold: 2-quote opening sequence: (2,2)
585 !! wikitext
586 ''foo''
587 !! html
588 <p><i>foo</i>
589 </p>
590 !!end
591
592 !! test
593 Italics and bold: 2-quote opening sequence: (2,3)
594 !! wikitext
595 ''foo'''
596 !! html/*
597 <p><i>foo'</i>
598 </p>
599 !!end
600
601 !! test
602 Italics and bold: 2-quote opening sequence: (2,4)
603 !! options
604 parsoid=wt2html
605 !! wikitext
606 ''foo''''
607 !! html/*
608 <p><i>foo''</i>
609 </p>
610 !!end
611
612 # same html as previous, but wikitext adjusted to match parsoid html2wt
613 !! test
614 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
615 !! wikitext
616 ''foo<nowiki>''</nowiki>''
617 !! html
618 <p><i>foo''</i>
619 </p>
620 !! end
621
622 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
623 !! test
624 Italics and bold: 2-quote opening sequence: (2,5)
625 !! options
626 parsoid=wt2html
627 !! wikitext
628 ''foo'''''
629 !! html/php
630 <p><i>foo</i>
631 </p>
632 !! html/parsoid
633 <p><i>foo</i><b></b>
634 </p>
635 !!end
636
637 # same html as previous, but wikitext adjusted to match parsoid html2wt
638 !! test
639 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
640 !! wikitext
641 ''foo'''''<nowiki/>'''
642 !! html/php
643 <p><i>foo</i>
644 </p>
645 !! html/parsoid
646 <p><i>foo</i><b></b>
647 </p>
648 !! end
649
650
651 ###
652 ### 3-quote opening sequence tests
653 ###
654
655 !! test
656 Italics and bold: 3-quote opening sequence: (3,2)
657 !! wikitext
658 '''foo''
659 !! html/*
660 <p>'<i>foo</i>
661 </p>
662 !!end
663
664 !! test
665 Italics and bold: 3-quote opening sequence: (3,3)
666 !! wikitext
667 '''foo'''
668 !! html
669 <p><b>foo</b>
670 </p>
671 !!end
672
673 !! test
674 Italics and bold: 3-quote opening sequence: (3,4)
675 !! wikitext
676 '''foo''''
677 !! html/*
678 <p><b>foo'</b>
679 </p>
680 !!end
681
682 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
683 !! test
684 Italics and bold: 3-quote opening sequence: (3,5)
685 !! options
686 parsoid=wt2html
687 !! wikitext
688 '''foo'''''
689 !! html/php
690 <p><b>foo</b>
691 </p>
692 !! html/parsoid
693 <p><b>foo</b><i></i>
694 </p>
695 !!end
696
697 # same html as previous, but wikitext adjusted to match parsoid html2wt
698 !! test
699 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
700 !! wikitext
701 '''foo'''''<nowiki/>''
702 !! html/php
703 <p><b>foo</b>
704 </p>
705 !! html/parsoid
706 <p><b>foo</b><i></i>
707 </p>
708 !! end
709
710
711 ###
712 ### 4-quote opening sequence tests
713 ###
714
715 !! test
716 Italics and bold: 4-quote opening sequence: (4,2)
717 !! options
718 parsoid=wt2html
719 !! wikitext
720 ''''foo''
721 !! html/*
722 <p>''<i>foo</i>
723 </p>
724 !!end
725
726 # same html as previous, but wikitext adjusted to match parsoid html2wt
727 !! test
728 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
729 !! wikitext
730 <nowiki>''</nowiki>''foo''
731 !! html
732 <p>''<i>foo</i>
733 </p>
734 !! end
735
736 !! test
737 Italics and bold: 4-quote opening sequence: (4,3)
738 !! wikitext
739 ''''foo'''
740 !! html/*
741 <p>'<b>foo</b>
742 </p>
743 !!end
744
745 !! test
746 Italics and bold: 4-quote opening sequence: (4,4)
747 !! options
748 parsoid=wt2html
749 !! wikitext
750 ''''foo''''
751 !! html/*
752 <p>'<b>foo'</b>
753 </p>
754 !!end
755
756 # same html as previous, but wikitext adjusted to match parsoid html2wt
757 !! test
758 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
759 !! wikitext
760 '<nowiki/>'''foo''''
761 !! html
762 <p>'<b>foo'</b>
763 </p>
764 !! end
765
766 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
767 !! test
768 Italics and bold: 4-quote opening sequence: (4,5)
769 !! options
770 parsoid=wt2html
771 !! wikitext
772 ''''foo'''''
773 !! html/php
774 <p>'<b>foo</b>
775 </p>
776 !! html/parsoid
777 <p>'<b>foo</b><i></i>
778 </p>
779 !!end
780
781 # same html as previous, but wikitext adjusted to match parsoid html2wt
782 !! test
783 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
784 !! wikitext
785 '<nowiki/>'''foo'''''<nowiki/>''
786 !! html/php
787 <p>'<b>foo</b>
788 </p>
789 !! html/parsoid
790 <p>'<b>foo</b><i></i>
791 </p>
792 !! end
793
794
795 ###
796 ### 5-quote opening sequence tests
797 ###
798
799 !! test
800 Italics and bold: 5-quote opening sequence: (5,2)
801 !! options
802 parsoid=wt2html
803 !! wikitext
804 '''''foo''
805 !! html/*
806 <p><b><i>foo</i></b>
807 </p>
808 !!end
809
810 # same html as previous, but wikitext adjusted to match parsoid html2wt
811 # skipping wt2html and html2html because it wants to put <i> before <b>
812 !! test
813 Italics and bold: 5-quote opening sequence: (5,2+3)
814 !! options
815 parsoid=wt2wt,html2wt
816 !! wikitext
817 '''''foo'''''
818 !! html
819 <p><b><i>foo</i></b>
820 </p>
821 !! end
822
823 !! test
824 Italics and bold: 5-quote opening sequence: (5,3)
825 !! options
826 parsoid=wt2html
827 !! wikitext
828 '''''foo'''
829 !! html/*
830 <p><i><b>foo</b></i>
831 </p>
832 !!end
833
834 # same html as previous, but wikitext adjusted to match parsoid html2wt
835 !! test
836 Italics and bold: 5-quote opening sequence: (5,3+2)
837 !! wikitext
838 '''''foo'''''
839 !! html
840 <p><i><b>foo</b></i>
841 </p>
842 !! end
843
844 !! test
845 Italics and bold: 5-quote opening sequence: (5,4)
846 !! options
847 parsoid=wt2html
848 !! wikitext
849 '''''foo''''
850 !! html/*
851 <p><i><b>foo'</b></i>
852 </p>
853 !!end
854
855 !! test
856 Italics and bold: 5-quote opening sequence: (5,5)
857 !! wikitext
858 '''''foo'''''
859 !! html
860 <p><i><b>foo</b></i>
861 </p>
862 !!end
863
864 !! test
865 Italics and bold: 5-quote opening sequence: (5,6)
866 !! wikitext
867 '''''foo''''''
868 !! html/*
869 <p><i><b>foo'</b></i>
870 </p>
871 !! end
872
873 ###
874 ### multiple quote sequences in a line
875 ###
876 !! test
877 Italics and bold: multiple quote sequences: (2,4,2)
878 !! options
879 parsoid=wt2html
880 !! wikitext
881 ''foo''''bar''
882 !! html/*
883 <p><i>foo'<b>bar</b></i>
884 </p>
885 !!end
886
887
888 # same html as previous, but wikitext adjusted to match parsoid html2wt
889 !! test
890 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
891 !! wikitext
892 ''foo'<nowiki/>'''bar'''''
893 !! html
894 <p><i>foo'<b>bar</b></i>
895 </p>
896 !! end
897
898
899 !! test
900 Italics and bold: multiple quote sequences: (2,4,3)
901 !! options
902 parsoid=wt2html
903 !! wikitext
904 ''foo''''bar'''
905 !! html/*
906 <p><i>foo'<b>bar</b></i>
907 </p>
908 !!end
909
910
911 # same html as previous, but wikitext adjusted to match parsoid html2wt
912 !! test
913 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
914 !! wikitext
915 ''foo'<nowiki/>'''bar'''''
916 !! html
917 <p><i>foo'<b>bar</b></i>
918 </p>
919 !! end
920
921
922 !! test
923 Italics and bold: multiple quote sequences: (2,4,4)
924 !! options
925 parsoid=wt2html
926 !! wikitext
927 ''foo''''bar''''
928 !! html/*
929 <p><i>foo'<b>bar'</b></i>
930 </p>
931 !!end
932
933
934 # same html as previous, but wikitext adjusted to match parsoid html2wt
935 !! test
936 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
937 !! wikitext
938 ''foo'<nowiki/>'''bar'<nowiki/>'''''
939 !! html
940 <p><i>foo'<b>bar'</b></i>
941 </p>
942 !! end
943
944
945 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
946 !! test
947 Italics and bold: multiple quote sequences: (3,4,2)
948 !! options
949 parsoid=wt2html
950 !! wikitext
951 '''foo''''bar''
952 !! html/php
953 <p><b>foo'</b>bar
954 </p>
955 !! html/parsoid
956 <p><b>foo'</b>bar<i></i>
957 </p>
958 !!end
959
960 # same html as previous, but wikitext adjusted to match parsoid html2wt
961 !! test
962 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
963 !! options
964 parsoid
965 !! wikitext
966 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
967 !! html/php
968 <p><b>foo'</b>bar
969 </p>
970 !! html/parsoid
971 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
972 </p>
973 !! end
974
975
976 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
977 !! test
978 Italics and bold: multiple quote sequences: (3,4,3)
979 !! options
980 parsoid=wt2html
981 !! wikitext
982 '''foo''''bar'''
983 !! html/php
984 <p><b>foo'</b>bar
985 </p>
986 !! html/parsoid
987 <p><b>foo'</b>bar<b></b>
988 </p>
989 !!end
990
991 # same html as previous, but wikitext adjusted to match parsoid html2wt
992 !! test
993 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
994 !! wikitext
995 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
996 !! html/php
997 <p><b>foo'</b>bar
998 </p>
999 !! html/parsoid
1000 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1001 </p>
1002 !! end
1003
1004 ###
1005 ### other quote tests
1006 ###
1007 !! test
1008 Italics and bold: other quote tests: (2,3,5)
1009 !! wikitext
1010 ''this is about '''foo's family'''''
1011 !! html
1012 <p><i>this is about <b>foo's family</b></i>
1013 </p>
1014 !!end
1015
1016
1017 !! test
1018 Italics and bold: other quote tests: (2,(3,3),2)
1019 !! wikitext
1020 ''this is about '''foo's''' family''
1021 !! html
1022 <p><i>this is about <b>foo's</b> family</i>
1023 </p>
1024 !!end
1025
1026
1027 !! test
1028 Italics and bold: other quote tests: (3,2,3,2)
1029 !! options
1030 parsoid=wt2html
1031 !! wikitext
1032 '''this is about ''foo'''s family''
1033 !! html/*
1034 <p><b>this is about <i>foo</i></b><i>s family</i>
1035 </p>
1036 !!end
1037
1038
1039 # same html as previous, but wikitext adjusted to match parsoid html2wt
1040 !! test
1041 Italics and bold: other quote tests: (3,2,3+2+2,2)
1042 !! wikitext
1043 '''this is about ''foo'''''<nowiki/>''s family''
1044 !! html
1045 <p><b>this is about <i>foo</i></b><i>s family</i>
1046 </p>
1047 !! end
1048
1049
1050 !! test
1051 Italics and bold: other quote tests: (3,2,3,3)
1052 !! wikitext
1053 '''this is about ''foo'''s family'''
1054 !! html/*
1055 <p>'<i>this is about </i>foo<b>s family</b>
1056 </p>
1057 !!end
1058
1059
1060 !! test
1061 Italics and bold: other quote tests: (3,(2,2),3)
1062 !! wikitext
1063 '''this is about ''foo's'' family'''
1064 !! html
1065 <p><b>this is about <i>foo's</i> family</b>
1066 </p>
1067 !!end
1068
1069
1070 !! test
1071 Italicized possessive
1072 !! wikitext
1073 The ''[[Main Page]]'''s talk page.
1074 !! html/php
1075 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1076 </p>
1077 !! html/parsoid
1078 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1079 !! end
1080
1081 !! test
1082 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1083 (Requires tidy for PHP parser output to be fixed up)
1084 !! options
1085 parsoid=wt2html,wt2wt
1086 !! wikitext
1087 {|
1088 !''a!!''b
1089 |''a||''b
1090 |}
1091 !! html/php+tidy
1092 <table>
1093 <tr>
1094 <th><i>a</i></th>
1095 <th><i>b</i></th>
1096 <td><i>a</i></td>
1097 <td><i>b</i></td>
1098 </tr>
1099 </table>
1100 !! html/parsoid
1101 <table>
1102 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1103 <td><i>a</i></td><td><i>b</i></td></tr>
1104 </tbody></table>
1105 !! end
1106
1107 ###
1108 ### Non-html5 tags
1109 ###
1110
1111 !! test
1112 Non-html5 tags should be accepted
1113 !! wikitext
1114 <center>''foo''</center>
1115 <big>''foo''</big>
1116 <font>''foo''</font>
1117 <strike>''foo''</strike>
1118 <tt>''foo''</tt>
1119 !! html
1120 <center><i>foo</i></center>
1121 <p><big><i>foo</i></big>
1122 <font><i>foo</i></font>
1123 <strike><i>foo</i></strike>
1124 <tt><i>foo</i></tt>
1125 </p>
1126 !! end
1127
1128 !! test
1129 <wbr> is valid wikitext (bug 52468)
1130 !! wikitext
1131 <wbr>
1132 !! html
1133 <p><wbr />
1134 </p>
1135 !! end
1136
1137 # <strike> is HTML4, <s> is HTML4/5.
1138 !! test
1139 <s> or <strike> for strikethrough
1140 !! wikitext
1141 <strike>strike</strike>
1142
1143 <s>s</s>
1144 !! html
1145 <p><strike>strike</strike>
1146 </p><p><s>s</s>
1147 </p>
1148 !! end
1149
1150 ## a not permitted
1151 ## i,b,br omitted
1152 !! test
1153 Text-level semantic html elements in wikitext
1154 !! wikitext
1155 <em>text</em>
1156 <strong>text</strong>
1157 <small>text</small>
1158 <s>text</s>
1159 <cite>text</cite>
1160 <q>text</q>
1161 <dfn>text</dfn>
1162 <abbr>text</abbr>
1163 <data>text</data>
1164 <time>text</time>
1165 <code>text</code>
1166 <var>text</var>
1167 <samp>text</samp>
1168 <kbd>text</kbd>
1169 <sub>text</sub>
1170 <u>text</u>
1171 <mark>text</mark>
1172 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1173 <bdi>text</bdi>
1174 <bdo>text</bdo>
1175 <span>text</span>
1176 <wbr />
1177 !! html
1178 <p><em>text</em>
1179 <strong>text</strong>
1180 <small>text</small>
1181 <s>text</s>
1182 <cite>text</cite>
1183 <q>text</q>
1184 <dfn>text</dfn>
1185 <abbr>text</abbr>
1186 <data>text</data>
1187 <time>text</time>
1188 <code>text</code>
1189 <var>text</var>
1190 <samp>text</samp>
1191 <kbd>text</kbd>
1192 <sub>text</sub>
1193 <u>text</u>
1194 <mark>text</mark>
1195 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1196 <bdi>text</bdi>
1197 <bdo>text</bdo>
1198 <span>text</span>
1199 <wbr />
1200 </p>
1201 !! end
1202
1203 # test cases taken from
1204 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1205 !! test
1206 Ruby markup (W3C-style)
1207 !! wikitext
1208 ; Mono-ruby for individual base characters
1209 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1210 ; Group ruby
1211 : <ruby>今日<rt>きょう</rt></ruby>
1212 ; Jukugo ruby
1213 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1214 ; Inline ruby
1215 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1216 ; Double-sided ruby
1217 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1218 <ruby>
1219 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1220 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1221 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1222 </ruby>
1223 !! html
1224 <dl><dt> Mono-ruby for individual base characters</dt>
1225 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1226 <dt> Group ruby</dt>
1227 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1228 <dt> Jukugo ruby</dt>
1229 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1230 <dt> Inline ruby</dt>
1231 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1232 <dt> Double-sided ruby</dt>
1233 <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>
1234 <p><ruby>
1235 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1236 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1237 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1238 </ruby>
1239 </p>
1240 !! end
1241
1242 # The next two test different paths in the sanitizer.
1243 !! test
1244 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1245 !! wikitext
1246 <blockquote|>a</blockquote>
1247
1248 <b→> doesn't terminate </b→>
1249
1250 <bä> doesn't terminate </bä>
1251
1252 <boo> doesn't terminate </boo>
1253
1254 <s.foo> doesn't terminate </s.foo>
1255
1256 <sub-ID#1>
1257 !! html
1258 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1259 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1260 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1261 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1262 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1263 </p><p>&lt;sub-ID#1&gt;
1264 </p>
1265 !! end
1266
1267 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1268 # If the non-word-character tag made it through the sanitizer, tidy
1269 # would munge it up.
1270 !! test
1271 Non-word characters don't terminate tag names + tidy
1272 !! wikitext
1273 <blockquote|>a</blockquote>
1274
1275 <b→> doesn't terminate </b→>
1276
1277 <bä> doesn't terminate </bä>
1278
1279 <boo> doesn't terminate </boo>
1280
1281 <s.foo> doesn't terminate </s.foo>
1282
1283 <sub-ID#1>
1284 !! html+tidy
1285 <p>&lt;blockquote|&gt;a</p>
1286 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1287 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1288 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1289 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1290 <p>&lt;sub-ID#1&gt;</p>
1291 !! end
1292
1293 ###
1294 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1295 ### This checks that HTML5 tags (with non-word characters in the tag
1296 ### name) make it safely through the parser -- the Sanitizer will
1297 ### munge them later, as it should.
1298 ###
1299 !! test
1300 Non-word characters are valid in extension tags (T19663)
1301 !! wikitext
1302 <tåg>tåg</tåg>
1303 !! html
1304 <pre>
1305 'tåg'
1306 array (
1307 )
1308 </pre>
1309
1310 !! end
1311
1312 !! test
1313 Isolated close tags should be treated as literal text (bug 52760)
1314 !! wikitext
1315 </b>
1316
1317 <s.foo>s</s>
1318 !! html+tidy
1319 <p>&lt;s.foo&gt;s</p>
1320 !! end
1321
1322 ###
1323 ### Special characters
1324 ###
1325
1326 !! test
1327 Bare pipe character (bug 52363)
1328 !! wikitext
1329 |
1330 !! html
1331 <p>|
1332 </p>
1333 !! end
1334
1335 !! test
1336 Bare pipe character from a template (bug 52363)
1337 !! wikitext
1338 {{pipe}}
1339 !! html
1340 <p>|
1341 </p>
1342 !! end
1343
1344 ###
1345 ### <nowiki> test cases
1346 ###
1347
1348 !! test
1349 <nowiki> unordered list
1350 !! wikitext
1351 <nowiki>* This is not an unordered list item.</nowiki>
1352 !! html
1353 <p>* This is not an unordered list item.
1354 </p>
1355 !! end
1356
1357 !! test
1358 <nowiki> spacing
1359 !! wikitext
1360 <nowiki>Lorem ipsum dolor
1361
1362 sed abit.
1363 sed nullum.
1364
1365 :and a colon
1366 </nowiki>
1367 !! html
1368 <p>Lorem ipsum dolor
1369
1370 sed abit.
1371 sed nullum.
1372
1373 :and a colon
1374
1375 </p>
1376 !! end
1377
1378 !! test
1379 nowiki 3
1380 !! wikitext
1381 :There is not nowiki.
1382 :There is <nowiki>nowiki</nowiki>.
1383
1384 #There is not nowiki.
1385 #There is <nowiki>nowiki</nowiki>.
1386
1387 *There is not nowiki.
1388 *There is <nowiki>nowiki</nowiki>.
1389 !! html
1390 <dl><dd>There is not nowiki.</dd>
1391 <dd>There is nowiki.</dd></dl>
1392 <ol><li>There is not nowiki.</li>
1393 <li>There is nowiki.</li></ol>
1394 <ul><li>There is not nowiki.</li>
1395 <li>There is nowiki.</li></ul>
1396
1397 !! end
1398
1399 !! test
1400 Entities inside <nowiki>
1401 !! wikitext
1402 <nowiki>&lt;</nowiki>
1403 !! html
1404 <p>&lt;
1405 </p>
1406 !! end
1407
1408 !! test
1409 Entities inside template parameters
1410 !! options
1411 parsoid
1412 !! wikitext
1413 {{echo|&ndash;}}
1414 !! html
1415 <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>
1416 !! end
1417
1418 !! test
1419 Properly escape nowiki when combined with other wiki markup
1420 !! options
1421 parsoid=html2wt
1422 !! html
1423 <p>* &lt;/nowiki&gt; tag</p>
1424 !! wikitext
1425 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1426 !! end
1427
1428 !! test
1429 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1430 !! options
1431 parsoid=html2wt
1432 !! html
1433 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1434 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1435 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1436 !! wikitext
1437 This text: L'[[Foo]]
1438 This text: L<nowiki>''</nowiki>[[Foo]]
1439 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1440 !! end
1441
1442 # This test fails because wikitext whitespace is not normalized before comparing.
1443 !! test
1444 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1445 !! options
1446 parsoid=html2wt
1447 !! html
1448 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1449 </p>
1450 !! wikitext
1451 This text : L<nowiki>''</nowiki>[[Foo]]
1452 !! end
1453
1454 # This test and the next one are html2wt only as they test that incorrect wikitext
1455 # passed in template arguments gets escaped or wrapped in nowikis where required.
1456 !! test
1457 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1458 !! options
1459 parsoid=html2wt
1460 !! html/parsoid
1461 <p><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;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1462 <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;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1463 !! wikitext
1464 {{echo|foo{{!}}bar}}
1465 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1466 !! end
1467
1468 !! test
1469 T53961: Output correct nowikis in template arguments
1470 !! options
1471 parsoid=html2wt
1472 !! html/parsoid
1473 <p><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;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1474 <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;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1475 <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;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1476 <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;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1477 <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;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1478 !! wikitext
1479 {{echo|a [ b}}
1480 {{echo|a <nowiki>}}</nowiki> b}}
1481 {{echo|<nowiki>a [[ b</nowiki>}}
1482 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1483 {{echo|a <nowiki>}</nowiki>}}
1484 !! end
1485
1486 ###
1487 ### Comments
1488 ###
1489 !! test
1490 Comments and Indent-Pre
1491 !! wikitext
1492 <!-- comment 1 --> asdf
1493
1494 <!-- comment 1 --> asdf
1495 <!-- comment 2 -->
1496
1497 <!-- comment 1 --> asdf
1498 <!-- comment 2 -->xyz
1499
1500 <!-- comment 1 --> asdf
1501 <!-- comment 2 --> xyz
1502 !! html
1503 <pre>asdf
1504 </pre>
1505 <pre>asdf
1506 </pre>
1507 <pre>asdf
1508 </pre>
1509 <p>xyz
1510 </p>
1511 <pre>asdf
1512 xyz
1513 </pre>
1514 !! end
1515
1516 !! test
1517 Comment test 2a
1518 !! wikitext
1519 asdf
1520 <!-- comment 1 -->
1521 jkl
1522 !! html
1523 <p>asdf
1524 jkl
1525 </p>
1526 !! end
1527
1528 !! test
1529 Comment test 2b
1530 !! wikitext
1531 asdf
1532 <!-- comment 1 -->
1533
1534 jkl
1535 !! html
1536 <p>asdf
1537 </p><p>jkl
1538 </p>
1539 !! end
1540
1541 !! test
1542 Comment test 3
1543 !! wikitext
1544 asdf
1545 <!-- comment 1 -->
1546 <!-- comment 2 -->
1547 jkl
1548 !! html
1549 <p>asdf
1550 jkl
1551 </p>
1552 !! end
1553
1554 !! test
1555 Comment test 4
1556 !! wikitext
1557 asdf<!-- comment 1 -->jkl
1558 !! html
1559 <p>asdfjkl
1560 </p>
1561 !! end
1562
1563 !! test
1564 Comment spacing
1565 !! wikitext
1566 a
1567 <!-- foo --> b <!-- bar -->
1568 c
1569 !! html
1570 <p>a
1571 </p>
1572 <pre> b
1573 </pre>
1574 <p>c
1575 </p>
1576 !! end
1577
1578 !! test
1579 Comment whitespace
1580 !! wikitext
1581 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1582 !! html
1583
1584 !! end
1585
1586 !! test
1587 Comment semantics and delimiters
1588 !! wikitext
1589 <!-- --><!----><!-----><!------>
1590 !! html
1591
1592 !! end
1593
1594 !! test
1595 Comment semantics and delimiters, redux
1596 !! wikitext
1597 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1598 -- foo -- funky huh? ... -->
1599 !! html
1600
1601 !! end
1602
1603 !! test
1604 Comment semantics and delimiters: directors cut
1605 !! wikitext
1606 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1607 everything starting with < followed by !-- until the first -- and > we see,
1608 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1609 -->-->
1610 !! html
1611 <p>--&gt;
1612 </p>
1613 !! end
1614
1615 !! test
1616 Comment semantics: nesting
1617 !! wikitext
1618 <!--<!-- no, we're not going to do anything fancy here -->-->
1619 !! html
1620 <p>--&gt;
1621 </p>
1622 !! end
1623
1624 !! test
1625 Comment semantics: unclosed comment at end
1626 !! wikitext
1627 <!--This comment will run out to the end of the document
1628 !! html
1629
1630 !! end
1631
1632 # Bug 58184: document parsoid's behaviour
1633 !! test
1634 Suppress comment closing tag in lenient browsers
1635 !! options
1636 parsoid=wt2html,html2html
1637 !! wikitext
1638 <!-- Browsers--!> think this is closed -->
1639 !! html/php
1640
1641 !! html/parsoid
1642 <!-- Browsers--¡> think this is closed -->
1643 !! end
1644
1645 !! test
1646 Comment in template title
1647 !! wikitext
1648 {{f<!---->oo}}
1649 !! html
1650 <p>FOO
1651 </p>
1652 !! end
1653
1654 !! test
1655 Comment on its own line post-expand
1656 !! wikitext
1657 a
1658 {{blank}}<!---->
1659 b
1660 !! html
1661 <p>a
1662 </p><p>b
1663 </p>
1664 !! end
1665
1666 !! test
1667 Comment on its own line post-expand with non-significant whitespace
1668 !! wikitext
1669 a
1670 {{blank}} <!---->
1671 b
1672 !! html
1673 <p>a
1674 </p><p>b
1675 </p>
1676 !! end
1677
1678 !! test
1679 Multiple comments should still parse as SOL-transparent
1680 !! options
1681 parsoid=wt2html,wt2wt
1682 !! wikitext
1683 <!--c1-->*a
1684 <!--c2--><!--c3--><!--c4-->*b
1685 !! html
1686 <ul>
1687 <li>a
1688 </li>
1689 <li>b
1690 </li>
1691 </ul>
1692 !! end
1693
1694 ###
1695 ### paragraph wrapping tests
1696 ###
1697 !! test
1698 No block tags
1699 !! wikitext
1700 a
1701
1702 b
1703 !! html
1704 <p>a
1705 </p><p>b
1706 </p>
1707 !! end
1708
1709 !! test
1710 Block tag on one line (<div>)
1711 !! wikitext
1712 a <div>foo</div>
1713
1714 b
1715 !! html
1716 a <div>foo</div>
1717 <p>b
1718 </p>
1719 !! html+tidy
1720 <p>a</p>
1721 <div>foo</div>
1722 <p>b</p>
1723 !! end
1724
1725 !! test
1726 Block tag on one line (<blockquote>)
1727 !! wikitext
1728 a <blockquote>foo</blockquote>
1729
1730 b
1731 !! html
1732 a <blockquote>foo</blockquote>
1733 <p>b
1734 </p>
1735 !! html+tidy
1736 <p>a</p>
1737 <blockquote>
1738 <p>foo</p>
1739 </blockquote>
1740 <p>b</p>
1741 !! end
1742
1743 !! test
1744 Block tag on both lines (<div>)
1745 !! wikitext
1746 a <div>foo</div>
1747
1748 b <div>foo</div>
1749 !! html
1750 a <div>foo</div>
1751 b <div>foo</div>
1752
1753 !! html+tidy
1754 <p>a</p>
1755 <div>foo</div>
1756 <p>b</p>
1757 <div>foo</div>
1758 !! end
1759
1760 !! test
1761 Block tag on both lines (<blockquote>)
1762 !! wikitext
1763 a <blockquote>foo</blockquote>
1764
1765 b <blockquote>foo</blockquote>
1766 !! html
1767 a <blockquote>foo</blockquote>
1768 b <blockquote>foo</blockquote>
1769
1770 !! html+tidy
1771 <p>a</p>
1772 <blockquote>
1773 <p>foo</p>
1774 </blockquote>
1775 <p>b</p>
1776 <blockquote>
1777 <p>foo</p>
1778 </blockquote>
1779 !! end
1780
1781 !! test
1782 Multiple lines without block tags
1783 !! wikitext
1784 <div>foo</div> a
1785 b
1786 c
1787 d<!--foo--> e
1788 x <div>foo</div> z
1789 !! html
1790 <div>foo</div> a
1791 <p>b
1792 c
1793 d e
1794 </p>
1795 x <div>foo</div> z
1796
1797 !! html+tidy
1798 <div>foo</div>
1799 <p>a</p>
1800 <p>b c d e</p>
1801 <p>x</p>
1802 <div>foo</div>
1803 <p>z</p>
1804 !! end
1805
1806 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1807 # So, we have a separate section for Parsoid. We don't want
1808 # to mimic this stripping behavior in Parsoid. It affects
1809 # editing experience and also requires us to maintain additional
1810 # info for RT-ing.
1811 !! test
1812 Empty lines between lines with block tags
1813 !! wikitext
1814 <div></div>
1815
1816
1817 <div></div>a
1818
1819 b
1820 <div>a</div>b
1821
1822 <div>b</div>d
1823
1824
1825 <div>e</div>
1826 !! html
1827 <div></div>
1828 <p><br />
1829 </p>
1830 <div></div>a
1831 <p>b
1832 </p>
1833 <div>a</div>b
1834 <div>b</div>d
1835 <p><br />
1836 </p>
1837 <div>e</div>
1838
1839 !! html+tidy
1840 <p><br /></p>
1841 <p>a</p>
1842 <p>b</p>
1843 <div>a</div>
1844 <p>b</p>
1845 <div>b</div>
1846 <p>d</p>
1847 <p><br /></p>
1848 <div>e</div>
1849 !! html/parsoid
1850 <div data-parsoid='{"stx":"html"}'></div>
1851
1852 <p><br /></p>
1853 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1854
1855 <p>b</p>
1856 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1857
1858 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1859
1860 <p><br /></p>
1861 <div data-parsoid='{"stx":"html"}'>e</div>
1862 !! end
1863
1864 ## PHP parser emits output which is broken
1865 !! test
1866 Unclosed HTML p-tags should be handled properly
1867 !! wikitext
1868 <div><p>foo</div>
1869 a
1870
1871 b
1872 !! html/php+tidy
1873 <div>
1874 <p>foo</p>
1875 </div>
1876 <p>a</p>
1877 <p>b</p>
1878 !! html/parsoid
1879 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1880 <p>a</p>
1881 <p>b</p>
1882 !! end
1883
1884 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
1885 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
1886 ## them for now.
1887 !! test
1888 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
1889 !! options
1890 parsoid=wt2html
1891 !! wikitext
1892 a [[Category:A1]] [[Category:A2]]
1893 [[Category:A3]]
1894 [[Category:A4]]
1895 !! html/parsoid
1896 <p>a</p>
1897 <link href="Category:A1"/> <link href="Category:A2"/> <link href="Category:A3"/> <link href="Category:A4"/>
1898 !! end
1899
1900 !! test
1901 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
1902 !! options
1903 parsoid=wt2html
1904 !! wikitext
1905 [[Category:A1]]a
1906 !! html/parsoid
1907 <link href="Category:A1"/><p>a</p>
1908 !! end
1909
1910 ###
1911 ### Preformatted text
1912 ###
1913 !! test
1914 Preformatted text
1915 !! wikitext
1916 This is some
1917 Preformatted text
1918 With ''italic''
1919 And '''bold'''
1920 And a [[Main Page|link]]
1921 !! html
1922 <pre>This is some
1923 Preformatted text
1924 With <i>italic</i>
1925 And <b>bold</b>
1926 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1927 </pre>
1928 !! end
1929
1930 !! test
1931 Tabs don't trigger preformatted text
1932 !! wikitext
1933 This is not
1934 preformatted text.
1935 This is preformatted text.
1936 So is this.
1937 !! html
1938 <p> This is not
1939 preformatted text.
1940 </p>
1941 <pre>This is preformatted text.
1942 So is this.
1943 </pre>
1944 !! end
1945
1946 !! test
1947 Ident preformatting with inline content
1948 !! wikitext
1949 a
1950 ''b''
1951 !! html
1952 <pre>a
1953 <i>b</i>
1954 </pre>
1955 !! end
1956
1957 !! test
1958 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1959 !! wikitext
1960 <pre><nowiki>
1961 <b>
1962 <cite>
1963 <em>
1964 </nowiki></pre>
1965 !! html
1966 <pre>
1967 &lt;b&gt;
1968 &lt;cite&gt;
1969 &lt;em&gt;
1970 </pre>
1971
1972 !! end
1973
1974 !! test
1975 Regression with preformatted in <center>
1976 !! wikitext
1977 <center>
1978 Blah
1979 </center>
1980 !! html
1981 <center>
1982 <pre>Blah
1983 </pre>
1984 </center>
1985
1986 !! end
1987
1988 !! test
1989 Bug 52763: Preformatted in <blockquote>
1990 !! wikitext
1991 <blockquote>
1992 Blah
1993 {|
1994 |
1995 indented cell (no pre-wrapping!)
1996 |}
1997 </blockquote>
1998 !! html
1999 <blockquote>
2000 <p> Blah
2001 </p>
2002 <table>
2003 <tr>
2004 <td>
2005 <p> indented cell (no pre-wrapping!)
2006 </p>
2007 </td></tr></table>
2008 </blockquote>
2009
2010 !! end
2011
2012 !! test
2013 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2014 !! wikitext
2015 <blockquote>
2016 Foo
2017
2018 Bar
2019 </blockquote>
2020 !! html
2021 <blockquote>
2022 <p>Foo
2023 </p><p>Bar
2024 </p>
2025 </blockquote>
2026
2027 !! end
2028
2029 !! test
2030 Bug 15491: <ins>/<del> in blockquote
2031 !! wikitext
2032 <blockquote>
2033 Foo <del>bar</del> <ins>baz</ins> quux
2034 </blockquote>
2035 !! html
2036 <blockquote>
2037 <p>Foo <del>bar</del> <ins>baz</ins> quux
2038 </p>
2039 </blockquote>
2040
2041 !! end
2042
2043 # Note that the p-wrapping is newline sensitive, which could be
2044 # considered a bug: tidy will wrap only the 'Foo' in the example
2045 # below in a <p> tag. (see comment 23-25 of bug #6200)
2046 !! test
2047 Bug 15491: <ins>/<del> in blockquote (2)
2048 !! wikitext
2049 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2050 </blockquote>
2051 !! html
2052 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2053 </blockquote>
2054
2055 !! html+tidy
2056 <blockquote>
2057 <p>Foo</p>
2058 <del>bar</del> <ins>baz</ins> quux</blockquote>
2059 !! end
2060
2061 !! test
2062 <pre> with attributes (bug 3202)
2063 !! wikitext
2064 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2065 !! html
2066 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2067
2068 !! end
2069
2070 !! test
2071 <pre> with width attribute (bug 3202)
2072 !! wikitext
2073 <pre width="8">Narrow screen goodies</pre>
2074 !! html
2075 <pre width="8">Narrow screen goodies</pre>
2076
2077 !! end
2078
2079 !! test
2080 <pre> with forbidden attribute (bug 3202)
2081 !! wikitext
2082 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2083 !! html
2084 <pre width="8">Narrow screen goodies</pre>
2085
2086 !! end
2087
2088 !! test
2089 Entities inside <pre>
2090 !! wikitext
2091 <pre>&lt;</pre>
2092 !! html
2093 <pre>&lt;</pre>
2094
2095 !! end
2096
2097 !! test
2098 <pre> with forbidden attribute values (bug 3202)
2099 !! wikitext
2100 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2101 !! html
2102 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2103
2104 !! end
2105
2106 !! test
2107 <nowiki> inside <pre> (bug 13238)
2108 !! wikitext
2109 <pre>
2110 <nowiki>
2111 </pre>
2112 <pre>
2113 <nowiki></nowiki>
2114 </pre>
2115 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2116 !! html
2117 <pre>
2118 &lt;nowiki&gt;
2119 </pre>
2120 <pre>
2121
2122 </pre>
2123 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2124
2125 !! end
2126
2127 !! test
2128 <nowiki> and <pre> preference (first one wins)
2129 !! wikitext
2130 <pre>
2131 <nowiki>
2132 </pre>
2133 </nowiki>
2134 </pre>
2135
2136 <nowiki>
2137 <pre>
2138 <nowiki>
2139 </pre>
2140 </nowiki>
2141 </pre>
2142
2143 !! html
2144 <pre>
2145 &lt;nowiki&gt;
2146 </pre>
2147 <p>&lt;/nowiki&gt;
2148 &lt;/pre&gt;
2149 </p><p>
2150 &lt;pre&gt;
2151 &lt;nowiki&gt;
2152 &lt;/pre&gt;
2153
2154 &lt;/pre&gt;
2155 </p>
2156 !! end
2157
2158 !! test
2159 </pre> inside nowiki
2160 !! wikitext
2161 <nowiki></pre></nowiki>
2162 !! html
2163 <p>&lt;/pre&gt;
2164 </p>
2165 !! end
2166
2167 # Parsoid doesn't strip empty tags, like Tidy does.
2168 !! test
2169 Empty pre; pre inside other HTML tags (bug 54946)
2170 !! options
2171 parsoid=wt2html,wt2wt
2172 !! wikitext
2173 a
2174
2175 <div><pre>
2176 foo
2177 </pre></div>
2178 <pre></pre>
2179 !! html/php
2180 <p>a
2181 </p>
2182 <div><pre>
2183 foo
2184 </pre></div>
2185 <pre></pre>
2186
2187 !! html/php+tidy
2188 <p>a</p>
2189 <div>
2190 <pre>
2191 foo
2192 </pre></div>
2193 !! html/parsoid
2194 <p>a</p>
2195
2196 <div><pre>foo
2197 </pre></div>
2198 <pre></pre>
2199 !! end
2200
2201 !! test
2202 HTML pre followed by indent-pre
2203 !! wikitext
2204 <pre>foo</pre>
2205 bar
2206 !! html
2207 <pre>foo</pre>
2208 <pre>bar
2209 </pre>
2210 !! end
2211
2212 !!test
2213 Block tag pre
2214 !!options
2215 parsoid
2216 !! wikitext
2217 <p><pre>foo</pre></p>
2218 !! html
2219 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2220 !!end
2221
2222 !!test
2223 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2224 !! wikitext
2225 {{echo|}}
2226 !! html
2227
2228 !!end
2229
2230 !!test
2231 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2232 !! wikitext
2233 {{echo|
2234 foo}}
2235 !! html
2236 <p>foo
2237 </p>
2238 !!end
2239
2240 !! test
2241 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2242 !! wikitext
2243 {{echo|a
2244 b}}
2245 !! html
2246 <pre>a
2247 </pre>
2248 <p>b
2249 </p>
2250 !!end
2251
2252 !! test
2253 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2254 !! wikitext
2255 {{echo|a
2256 b
2257 c
2258 d
2259 e
2260 }}
2261 !! html
2262 <pre>a
2263 </pre>
2264 <p>b
2265 c
2266 </p>
2267 <pre>d
2268 </pre>
2269 <p>e
2270 </p>
2271 !!end
2272
2273 !!test
2274 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2275 !! wikitext
2276 {{echo| foo}}
2277
2278 {{echo| foo}}{{echo| bar}}
2279
2280 {{echo| foo}}
2281 {{echo| bar}}
2282
2283 {{echo|<!--cmt--> foo}}
2284
2285 <!--cmt-->{{echo| foo}}
2286
2287 {{echo|{{echo| }}bar}}
2288 !! html
2289 <pre>foo
2290 </pre>
2291 <pre>foo bar
2292 </pre>
2293 <pre>foo
2294 bar
2295 </pre>
2296 <pre>foo
2297 </pre>
2298 <pre>foo
2299 </pre>
2300 <pre>bar
2301 </pre>
2302 !!end
2303
2304 !! test
2305 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2306 !! wikitext
2307 {{echo| }}a
2308
2309 {{echo|
2310 }}a
2311
2312 {{echo|
2313 b}}
2314
2315 {{echo|a
2316 }}b
2317
2318 {{echo|a
2319 }} b
2320 !! html
2321 <pre>a
2322 </pre>
2323 <p><br />
2324 </p>
2325 <pre>a
2326 </pre>
2327 <p><br />
2328 </p>
2329 <pre>b
2330 </pre>
2331 <p>a
2332 </p>
2333 <pre>b
2334 </pre>
2335 <p>a
2336 </p>
2337 <pre>b
2338 </pre>
2339 !!end
2340
2341 !! test
2342 Things that look like <pre> tags aren't treated as such
2343 !! wikitext
2344 Barack Obama <President> of the United States
2345 <President></President>
2346 !! html
2347 <p>Barack Obama &lt;President&gt; of the United States
2348 &lt;President&gt;&lt;/President&gt;
2349 </p>
2350 !! end
2351
2352 ## PHP parser discards the "<pre " string
2353 !! test
2354 Handle broken pre-like tags (bug 64025)
2355 !! options
2356 parsoid=wt2html
2357 !! wikitext
2358 {{echo|<pre <pre>x</pre>}}
2359
2360 <table><pre </table>
2361 !! html/php
2362 <pre>x</pre>
2363 <table><pre></pre></table>
2364
2365 !! html/parsoid
2366 <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>
2367
2368
2369 <p>&lt;pre </p>
2370
2371 <table></table>
2372 !! end
2373
2374 !! test
2375 Parsoid: handle pre with space after attribute
2376 !! options
2377 parsoid=wt2html
2378 !! wikitext
2379 <pre style="width:50%;" >{{echo|foo}}</pre>
2380 !! html
2381 <pre style="width:50%;">{{echo|foo}}</pre>
2382 !! end
2383
2384 # TODO / maybe: fix wt2wt for this
2385 !! test
2386 Parsoid: Don't paragraph-wrap fosterable content
2387 !! options
2388 parsoid=wt2html
2389 !! wikitext
2390 {|
2391 <td></td>
2392 <td></td>
2393
2394
2395
2396 |}
2397 !! html
2398 <table>
2399
2400 <tbody>
2401 <tr>
2402 <td></td>
2403
2404 <td></td></tr>
2405
2406
2407
2408 </tbody></table>
2409 !! end
2410
2411 !! test
2412 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2413 !! options
2414 parsoid=wt2html
2415 !! wikitext
2416 {|
2417 <td>
2418 <td>
2419 </td>
2420
2421
2422
2423 |}
2424 !! html
2425 <table>
2426
2427 <tbody>
2428 <tr>
2429 <td></td>
2430
2431 <td>
2432 </td></tr>
2433
2434
2435
2436 </tbody></table>
2437 !! end
2438
2439
2440 #--------------------------------------------------------------------
2441 # Transclusion parameter whitespace stripping tests
2442 # Behavior is different for positional and named parameters
2443 #--------------------------------------------------------------------
2444 !! test
2445 Templates: Strip leading and trailing whitespace from named-param values
2446 !! wikitext
2447 {{echo|1= a }}
2448
2449 {{echo|1= {{echo|b}} }}
2450
2451 {{echo| 1 =
2452 c }}
2453
2454 {{echo| 1 =
2455 * d
2456 }}
2457 !! html
2458 <p>a
2459 </p><p>b
2460 </p><p>c
2461 </p>
2462 <ul><li> d</li></ul>
2463
2464 !! end
2465
2466 !! test
2467 Templates: Don't strip whitespace from positional-param values
2468 !! wikitext
2469 {{echo|a }}
2470
2471 {{echo|{{echo|b}} }}
2472
2473 {{echo| c
2474 }}
2475
2476 {{echo| {{echo|d}}
2477 }}
2478
2479 {{echo|
2480 e}}
2481
2482 {{echo|
2483 * f}}
2484
2485 {{echo|
2486 }}g
2487 !! html
2488 <p>a
2489 </p><p>b
2490 </p>
2491 <pre>c
2492 </pre>
2493 <p><br />
2494 </p>
2495 <pre>d
2496 </pre>
2497 <p><br />
2498 </p>
2499 <pre>e
2500 </pre>
2501 <p><br />
2502 </p>
2503 <ul><li> f</li></ul>
2504 <p><br />
2505 </p>
2506 <pre>g
2507 </pre>
2508 !! end
2509
2510 !! test
2511 Templates: Handle empty comment-and-ws-only lines correctly
2512 !! wikitext
2513 {{echo|foo
2514 <!--should be ignored-->
2515 <!--should be ignored as well-->
2516 bar}}
2517 !! html
2518 <p>foo
2519 bar
2520 </p>
2521 !! end
2522
2523 !! test
2524 Templates: Handle comments in the target
2525 !! wikitext
2526 {{echo
2527 <!-- should be ignored -->
2528 |foo}}
2529
2530 {{echo<!-- should be ignored -->
2531 |foo}}
2532
2533 {{echo<!-- should be ignored -->|foo}}
2534
2535 {{<!-- should be ignored -->echo|foo}}
2536 !!html/parsoid
2537 <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>
2538
2539 <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>
2540
2541 <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>
2542
2543 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2544 !!end
2545
2546 !! test
2547 Templates: Handle comments in parameter names (bug 67657)
2548 !! wikitext
2549 {{echo|1
2550 <!-- should be ignored -->
2551 =foo}}
2552
2553 {{echo|
2554 <!-- should be ignored -->
2555 1 = foo}}
2556
2557 {{echo|1<!-- should be ignored --> = foo}}
2558
2559 {{echo|<!-- should be ignored -->1 = foo}}
2560 !!html/parsoid
2561 <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>
2562
2563 <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>
2564
2565 <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>
2566
2567 <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>
2568 !!end
2569
2570 !! test
2571 Templates: Other wikitext in parameter names (bug 67657)
2572 !! wikitext
2573 {{echo|''1''=foo}}
2574 !!html/parsoid
2575 <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>
2576 !!html/php
2577 <p>{{{1}}}
2578 </p>
2579 !!end
2580
2581 #--------------------------------------------------------------------
2582 # Transclusion parameter escaping tests
2583 #--------------------------------------------------------------------
2584 !! test
2585 Templates: Parsoid parameter escaping test 1
2586 !! options
2587 parsoid
2588 !! wikitext
2589 {{echo|[foo]|{{echo|[bar]}}}}
2590 !! html
2591 <p about="#mwt1" typeof="mw:Transclusion"
2592 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2593 !! end
2594
2595 !! test
2596 Parsoid: Pipes in external links in template parameter
2597 !! options
2598 parsoid
2599 !! wikitext
2600 {{echo|[{{echo|http://example.com}} link]}}
2601 !! html
2602 <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>
2603 !! end
2604
2605 !! test
2606 Parsoid: pipe in transclusion parameter
2607 !! options
2608 parsoid
2609 !! wikitext
2610 {{echo|http://foo.com/a&#124;b}}
2611 !! html
2612 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2613 typeof="mw:Transclusion"
2614 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>
2615 !! end
2616
2617 !! test
2618 Parsoid: Pipe in external link target and content in template parameter
2619 !! options
2620 parsoid=html2wt,wt2wt
2621 !! wikitext
2622 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2623 !! html
2624 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2625 typeof="mw:Transclusion"
2626 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2627 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2628 !! end
2629
2630 !! test
2631 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2632 !! options
2633 parsoid
2634 !! wikitext
2635 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2636 !! html
2637 <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>
2638 !! end
2639
2640 !! test
2641 Templates: Don't escape already nowiki-escaped text in template parameters
2642 !! options
2643 parsoid=html2wt,wt2wt
2644 !! wikitext
2645 {{echo|foo<nowiki>|</nowiki>bar}}
2646 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2647 {{echo|<nowiki></nowiki>}}
2648 !! html
2649 <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>
2650 <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>
2651 <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>
2652 </p>
2653 !! end
2654
2655 ## Bug 52824
2656 !! test
2657 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2658 !! options
2659 parsoid=html2wt,wt2wt
2660 !! wikitext
2661 {{echo|{{echo|1=bar}}}}
2662 !! html
2663 <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>
2664 !! end
2665
2666 ## Bug 56733
2667 !! test
2668 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2669 !! options
2670 parsoid
2671 !! wikitext
2672 {{echo|a : b}}
2673 !! html
2674 <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>
2675 !! end
2676
2677 ## Bug T73412
2678 !! test
2679 Templates: Preserve blank parameter names
2680 !! wikitext
2681 {{echo|=foo}}
2682 !! html/php
2683 <p>{{{1}}}
2684 </p>
2685 !! html/parsoid
2686 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2687 !! end
2688
2689 ###
2690 ### Parsoid-centric tests for testing RT edge cases for pre
2691 ###
2692
2693 !!test
2694 1a. Indent-Pre and Comments
2695 !! wikitext
2696 a
2697 <!--a-->
2698 c
2699 !! html
2700 <pre>a
2701 </pre>
2702 <p>c
2703 </p>
2704 !!end
2705
2706 !!test
2707 1b. Indent-Pre and Comments
2708 !! wikitext
2709 a
2710 <!--a-->
2711 c
2712 !! html
2713 <pre>a
2714 </pre>
2715 <p>c
2716 </p>
2717 !!end
2718
2719 !!test
2720 1c. Indent-Pre and Comments
2721 !! wikitext
2722 <!--a--> a
2723
2724 <!--a--> a
2725 !! html
2726 <pre> a
2727 </pre>
2728 <pre> a
2729 </pre>
2730 !!end
2731
2732 !!test
2733 1d. Indent-Pre and Comments
2734 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2735 !! wikitext
2736 <!--a--> a
2737
2738 <!--b-->b
2739 !! html
2740 <pre>a
2741 </pre>
2742 <pre>b
2743 </pre>
2744 !!end
2745
2746 !!test
2747 2a. Indent-Pre and tables
2748 !! wikitext
2749 {|
2750 |-
2751 !h1!!h2
2752 |foo||bar
2753 |}
2754 !! html
2755 <table>
2756
2757 <tr>
2758 <th>h1</th>
2759 <th>h2
2760 </th>
2761 <td>foo</td>
2762 <td>bar
2763 </td></tr></table>
2764
2765 !!end
2766
2767 !!test
2768 2b. Indent-Pre and tables
2769 !! wikitext
2770 {|
2771 |-
2772 |foo
2773 |}
2774 !! html
2775 <table>
2776
2777 <tr>
2778 <td>foo
2779 </td></tr></table>
2780
2781 !!end
2782
2783 !!test
2784 2c. Indent-Pre and tables (bug 42252)
2785 !! wikitext
2786 {|
2787 |+ foo
2788 ! | bar
2789 |}
2790 !! html
2791 <table>
2792 <caption> foo
2793 </caption>
2794 <tr>
2795 <th> bar
2796 </th></tr></table>
2797
2798 !!end
2799
2800 !!test
2801 2d. Indent-Pre and tables
2802 !! wikitext
2803 a
2804 {|
2805 | b
2806 |}
2807 !! html/php
2808 <pre>a
2809 </pre>
2810 <table>
2811 <tr>
2812 <td> b
2813 </td></tr></table>
2814
2815 !! html/parsoid
2816 <pre>a</pre>
2817 <table>
2818 <tbody><tr><td> b</td></tr>
2819 </tbody></table>
2820 !!end
2821
2822 !!test
2823 2e. Indent-Pre and table-line syntax
2824 !! wikitext
2825 a
2826 | b
2827 | c
2828 !! html/php
2829 <pre>a
2830 | b
2831 | c
2832 </pre>
2833 !!end
2834
2835 !!test
2836 2f. Indent-pre started by table-line syntax
2837 !! wikitext
2838 a
2839 | b
2840 | c
2841 !! html/php
2842 <p>a
2843 </p>
2844 <pre>| b
2845 | c
2846 </pre>
2847 !! html/parsoid
2848 <p>a</p>
2849 <pre>
2850 | b
2851 | c</pre>
2852 !!end
2853
2854 !!test
2855 3a. Indent-Pre and block tags (single-line html)
2856 !! wikitext
2857 a <p> foo </p>
2858 b <div> foo </div>
2859 c <blockquote> foo </blockquote>
2860 <span> foo </span>
2861 !! html
2862 a <p> foo </p>
2863 b <div> foo </div>
2864 c <blockquote> foo </blockquote>
2865 <pre><span> foo </span>
2866 </pre>
2867 !! html/parsoid
2868 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
2869 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
2870 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
2871 <pre><span> foo </span>
2872 </pre>
2873 !! html+tidy
2874 <p>a</p>
2875 <p>foo</p>
2876 <p>b</p>
2877 <div>foo</div>
2878 <p>c</p>
2879 <blockquote>
2880 <p>foo</p>
2881 </blockquote>
2882 <pre>
2883 <span> foo </span>
2884 </pre>
2885 !! end
2886
2887 !!test
2888 3b. Indent-Pre and block tags (multi-line html)
2889 !! wikitext
2890 a <span>foo</span>
2891 b <div> foo </div>
2892 !! html
2893 <pre>a <span>foo</span>
2894 </pre>
2895 b <div> foo </div>
2896
2897 !! html/parsoid
2898 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
2899 b <div data-parsoid='{"stx":"html"}'> foo </div>
2900 !! html+tidy
2901 <pre>
2902 a <span>foo</span>
2903 </pre>
2904 <p>b</p>
2905 <div>foo</div>
2906 !!end
2907
2908 !!test
2909 3c. Indent-Pre and block tags (pre-content on separate line)
2910 !! wikitext
2911 <p>
2912 foo
2913 </p>
2914
2915 <div>
2916 foo
2917 </div>
2918
2919 <center>
2920 foo
2921 </center>
2922
2923 <blockquote>
2924 foo
2925 </blockquote>
2926
2927 <blockquote>
2928 <pre>
2929 foo
2930 </pre>
2931 </blockquote>
2932
2933 <table><tr><td>
2934 foo
2935 </td></tr></table>
2936
2937 <ul><li>
2938 foo
2939 </li></ul>
2940
2941 !! html
2942 <p>
2943 foo
2944 </p>
2945 <div>
2946 <pre>foo
2947 </pre>
2948 </div>
2949 <center>
2950 <pre>foo
2951 </pre>
2952 </center>
2953 <blockquote>
2954 <p> foo
2955 </p>
2956 </blockquote>
2957 <blockquote>
2958 <pre>
2959 foo
2960 </pre>
2961 </blockquote>
2962 <table><tr><td>
2963 <pre>foo
2964 </pre>
2965 </td></tr></table>
2966 <ul><li>
2967 foo
2968 </li></ul>
2969
2970 !!end
2971
2972 !!test
2973 4. Indent-Pre and extension tags
2974 !! wikitext
2975 a <gallery>
2976 File:foobar.jpg
2977 </gallery>
2978 !! html
2979 a <ul class="gallery mw-gallery-traditional">
2980 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2981 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
2982 <div class="gallerytext">
2983 </div>
2984 </div></li>
2985 </ul>
2986
2987 !! html+tidy
2988 <p>a</p>
2989 <ul class="gallery mw-gallery-traditional">
2990 <li class="gallerybox" style="width: 155px">
2991 <div style="width: 155px">
2992 <div class="thumb" style="width: 150px;">
2993 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div>
2994 </div>
2995 <div class="gallerytext"></div>
2996 </div>
2997 </li>
2998 </ul>
2999 !!end
3000
3001 !! test
3002 Table wikitext syntax outside wiki-tables
3003 !! wikitext
3004 a
3005 ! not a table heading
3006 |- not a table row
3007 | not a table cell
3008 | class="foo bar" | baz
3009 b
3010 |}
3011 |-
3012 c
3013 !! html
3014 <p>a
3015 ! not a table heading
3016 |- not a table row
3017 | not a table cell
3018 | class="foo bar" | baz
3019 b
3020 |}
3021 |-
3022 c
3023 </p>
3024 !! end
3025
3026 !!test
3027 Render paragraphs when indent-pre is suppressed in blocklevels
3028 !! wikitext
3029 <blockquote>
3030 foo
3031
3032 bar
3033 </blockquote>
3034 !! html
3035 <blockquote>
3036 <p> foo
3037 </p><p> bar
3038 </p>
3039 </blockquote>
3040
3041 !!end
3042
3043 !!test
3044 4. Multiple spaces at start-of-line
3045 !! wikitext
3046 <p> foo </p>
3047 foo
3048 {|
3049 |foo
3050 |}
3051 !! html
3052 <p> foo </p>
3053 <pre> foo
3054 </pre>
3055 <table>
3056 <tr>
3057 <td>foo
3058 </td></tr></table>
3059
3060 !!end
3061
3062 ## NOTE: the leading white-space chars on empty line are significant
3063 !! test
3064 5a. White-space in indent-pre
3065 !! wikitext
3066 a<br />
3067
3068 b
3069 !! html
3070 <pre>a<br />
3071
3072 b
3073 </pre>
3074 !! end
3075
3076 ## NOTE: the leading white-space chars on empty line are significant
3077 !! test
3078 5b. White-space in indent-pre
3079 !! wikitext
3080 a
3081
3082 b
3083
3084
3085 c
3086 !! html
3087 <pre>a
3088
3089 b
3090
3091
3092 c
3093 </pre>
3094 !! end
3095
3096 !! test
3097 5c. White-space in indent-pre
3098 !! wikitext
3099 ''a''
3100 ''b''
3101 ''c''
3102 !! html
3103 <pre><i>a</i>
3104 <i>b</i>
3105 <i>c</i>
3106 </pre>
3107 !! end
3108
3109 !! test
3110 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3111 !! wikitext
3112 a
3113
3114 <!-- continue -->
3115 b
3116
3117 c
3118
3119 d
3120 !! html
3121 <pre>a
3122
3123 b
3124 </pre>
3125 <pre>c
3126
3127 </pre>
3128 <p>d
3129 </p>
3130 !! end
3131
3132 !! test
3133 7a. Indent-pre and category links
3134 !! options
3135 parsoid=wt2html,wt2wt
3136 !! wikitext
3137 [[Category:foo]] <!-- No pre-wrapping -->
3138 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3139 !! html
3140 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
3141 <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 -->
3142 !! end
3143
3144 !! test
3145 7b. Indent-pre and category links
3146 !! options
3147 parsoid=wt2html,wt2wt
3148 !! wikitext
3149 [[Category:foo]] a
3150 [[Category:foo]] {{echo|b}}
3151 !! html
3152 <pre>
3153 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
3154 <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>
3155 !! end
3156
3157 ###
3158 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3159 ###
3160
3161 !!test
3162 HTML-pre: 1. embedded newlines
3163 !! wikitext
3164 <pre>foo</pre>
3165
3166 <pre>
3167 foo
3168 </pre>
3169
3170 <pre>
3171
3172 foo
3173 </pre>
3174
3175 <pre>
3176
3177
3178 foo
3179 </pre>
3180 !! html
3181 <pre>foo</pre>
3182 <pre>
3183 foo
3184 </pre>
3185 <pre>
3186
3187 foo
3188 </pre>
3189 <pre>
3190
3191
3192 foo
3193 </pre>
3194
3195 !! html/parsoid
3196 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3197
3198 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3199 foo
3200 </pre>
3201
3202 <pre data-parsoid='{"stx":"html"}'>
3203
3204 foo
3205 </pre>
3206
3207 <pre data-parsoid='{"stx":"html"}'>
3208
3209
3210 foo
3211 </pre>
3212 !!end
3213
3214 !! test
3215 HTML-pre: big spaces
3216 !! wikitext
3217 <pre>
3218
3219
3220
3221
3222 haha
3223
3224
3225
3226
3227 haha
3228
3229
3230
3231
3232 </pre>
3233 !! html
3234 <pre>
3235
3236
3237
3238
3239 haha
3240
3241
3242
3243
3244 haha
3245
3246
3247
3248
3249 </pre>
3250
3251 !! html/parsoid
3252 <pre data-parsoid='{"stx":"html"}'>
3253
3254
3255
3256
3257 haha
3258
3259
3260
3261
3262 haha
3263
3264
3265
3266
3267 </pre>
3268 !! end
3269
3270 !!test
3271 HTML-pre: 2: indented text
3272 !! wikitext
3273 <pre>
3274 foo
3275 </pre>
3276 !! html
3277 <pre>
3278 foo
3279 </pre>
3280
3281 !!end
3282
3283 !!test
3284 HTML-pre: 3: other wikitext
3285 !! wikitext
3286 <pre>
3287 * foo
3288 # bar
3289 = no-h =
3290 '' no-italic ''
3291 [[ NoLink ]]
3292 </pre>
3293 !! html
3294 <pre>
3295 * foo
3296 # bar
3297 = no-h =
3298 '' no-italic ''
3299 [[ NoLink ]]
3300 </pre>
3301
3302 !!end
3303
3304 ###
3305 ### Definition lists
3306 ###
3307 !! test
3308 Simple definition
3309 !! wikitext
3310 ; name : Definition
3311 !! html
3312 <dl><dt> name&#160;</dt>
3313 <dd> Definition</dd></dl>
3314
3315 !! end
3316
3317 !! test
3318 Definition list for indentation only
3319 !! wikitext
3320 : Indented text
3321 !! html
3322 <dl><dd> Indented text</dd></dl>
3323
3324 !! end
3325
3326 !! test
3327 Definition list with no space
3328 !! wikitext
3329 ;name:Definition
3330 !! html
3331 <dl><dt>name</dt>
3332 <dd>Definition</dd></dl>
3333
3334 !!end
3335
3336 !! test
3337 Definition list with URL link
3338 !! wikitext
3339 ; http://example.com/ : definition
3340 !! html
3341 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3342 <dd> definition</dd></dl>
3343
3344 !! end
3345
3346 !! test
3347 Definition list with bracketed URL link
3348 !! wikitext
3349 ;[http://www.example.com/ Example]:Something about it
3350 !! html
3351 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3352 <dd>Something about it</dd></dl>
3353
3354 !! end
3355
3356 !! test
3357 Definition list with wikilink containing colon
3358 !! wikitext
3359 ; [[Help:FAQ]]: The least-read page on Wikipedia
3360 !! html
3361 <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>
3362 <dd> The least-read page on Wikipedia</dd></dl>
3363
3364 !! end
3365
3366 # At Brion's and JeLuF's insistence... :)
3367 !! test
3368 Definition list with news link containing colon
3369 !! wikitext
3370 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3371 !! html/php
3372 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3373 <dd> This isn't even a real newsgroup!</dd></dl>
3374
3375 !! html/parsoid
3376 <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>
3377 !! end
3378
3379 !! test
3380 Malformed definition list with colon
3381 !! wikitext
3382 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3383 !! html
3384 <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>
3385
3386 !! end
3387
3388 !! test
3389 Definition lists: colon in external link text
3390 !! wikitext
3391 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3392 !! html
3393 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3394 <dd> OK, I made that up</dd></dl>
3395
3396 !! end
3397
3398 !! test
3399 Definition lists: colon in HTML attribute
3400 !! wikitext
3401 ;<b style="display: inline">bold</b>
3402 !! html
3403 <dl><dt><b style="display: inline">bold</b></dt></dl>
3404
3405 !! end
3406
3407 !! test
3408 Definition lists: self-closed tag
3409 !! wikitext
3410 ;one<br/>two : two-line fun
3411 !! html
3412 <dl><dt>one<br />two&#160;</dt>
3413 <dd> two-line fun</dd></dl>
3414
3415 !! end
3416
3417 !! test
3418 Bug 11748: Literal closing tags
3419 !! wikitext
3420 <dl>
3421 <dt>test 1</dt>
3422 <dd>test test test test test</dd>
3423 <dt>test 2</dt>
3424 <dd>test test test test test</dd>
3425 </dl>
3426 !! html
3427 <dl>
3428 <dt>test 1</dt>
3429 <dd>test test test test test</dd>
3430 <dt>test 2</dt>
3431 <dd>test test test test test</dd>
3432 </dl>
3433
3434 !! end
3435
3436 !! test
3437 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3438 !! wikitext
3439 <ul><li>
3440 ; term : description
3441 * unordered
3442 </li></ul>
3443 !! html
3444 <ul><li>
3445 <dl><dt> term&#160;</dt>
3446 <dd> description</dd></dl>
3447 <ul><li> unordered</li></ul>
3448 </li></ul>
3449
3450 !! end
3451
3452 !! test
3453
3454 Definition list with empty definition and following paragraph
3455 !! wikitext
3456 ; term:
3457 Paragraph text
3458 !! html
3459 <dl><dt> term</dt>
3460 <dd></dd></dl>
3461 <p>Paragraph text
3462 </p>
3463 !! end
3464
3465 !! test
3466 Nested definition lists using html syntax
3467 !! wikitext
3468 <dl><dt>x</dt>
3469 <dd>a</dd>
3470 <dd>b</dd></dl>
3471
3472 !! end
3473
3474 !! test
3475 Definition Lists: No nesting: Multiple dd's
3476 !! wikitext
3477 ;x
3478 :a
3479 :b
3480 !! html
3481 <dl><dt>x</dt>
3482 <dd>a</dd>
3483 <dd>b</dd></dl>
3484
3485 !! end
3486
3487 !! test
3488 Definition Lists: Indentation: Regular
3489 !! wikitext
3490 :i1
3491 ::i2
3492 :::i3
3493 !! html
3494 <dl><dd>i1
3495 <dl><dd>i2
3496 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3497
3498 !! end
3499
3500 !! test
3501 Definition Lists: Indentation: Missing 1st level
3502 !! wikitext
3503 ::i2
3504 :::i3
3505 !! html
3506 <dl><dd><dl><dd>i2
3507 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3508
3509 !! end
3510
3511 !! test
3512 Definition Lists: Indentation: Multi-level indent
3513 !! wikitext
3514 :::i3
3515 !! html
3516 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3517
3518 !! end
3519
3520 !! test
3521 Definition Lists: Hacky use to indent tables
3522 !! wikitext
3523 ::{|
3524 |foo
3525 |bar
3526 |}
3527 this text
3528 should be left alone
3529 !! html
3530 <dl><dd><dl><dd><table>
3531 <tr>
3532 <td>foo
3533 </td>
3534 <td>bar
3535 </td></tr></table></dd></dl></dd></dl>
3536 <p>this text
3537 should be left alone
3538 </p>
3539 !! end
3540
3541 !! test
3542 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3543 !! wikitext
3544 <!-- foo -->
3545 ::{|
3546 |foo
3547 |bar
3548 |}<!-- bar -->
3549 this text
3550 should be left alone
3551 !! html/parsoid
3552 <!-- foo -->
3553 <dl><dd><dl><dd><table><tr>
3554 <td>foo</td>
3555 <td>bar</td>
3556 </tr></table><!-- bar --></dd></dl></dd></dl>
3557 <p>this text
3558 should be left alone</p>
3559 !! end
3560
3561 !! test
3562 Definition Lists: Hacky use to indent tables, with comment before table
3563 !! wikitext
3564 ::<!-- foo -->{|
3565 |foo
3566 |}
3567 !! html/parsoid
3568 <dl><dd><dl><dd><!-- foo --><table><tr>
3569 <td>foo</td>
3570 </tr></table></dd></dl></dd></dl>
3571 !! end
3572
3573 # Bug 52473
3574 !! test
3575 Definition Lists: Hacky use to indent tables (WS-insensitive)
3576 !! options
3577 parsoid
3578 !! wikitext
3579 : {|
3580 |a
3581 |}
3582 !! html
3583 <dl>
3584 <dd> <table><tr><td>a</td></tr></table> </dd>
3585 </dl>
3586 !! end
3587 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3588 ## as an empty dt item. It also ignores all but the last ";" when followed
3589 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3590 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3591 ## ";"s.
3592 ##
3593 ## Ex: ";;t2 ::d2" is transformed into:
3594 ##
3595 ## <dl>
3596 ## <dt>t2 </dt>
3597 ## <dd>
3598 ## <dl>
3599 ## <dt></dt>
3600 ## <dd>d2</dd>
3601 ## </dl>
3602 ## </dd>
3603 ## </dl>
3604 ##
3605 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3606 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3607 ##
3608 ## <dl>
3609 ## <dt>
3610 ## <dl>
3611 ## <dt>t2 </dt>
3612 ## <dd>:d2</dd>
3613 ## </dl>
3614 ## </dt>
3615 ## </dl>
3616 ##
3617 ## All Parsoid only definition list tests have this difference.
3618 ##
3619 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3620 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3621
3622 !! test
3623 Table / list interaction: indented table with lists in table contents
3624 !! wikitext
3625 :{|
3626 |-
3627 | a
3628 * b
3629 |-
3630 | c
3631 * d
3632 |}
3633 !! html
3634 <dl><dd><table>
3635
3636 <tr>
3637 <td> a
3638 <ul><li> b</li></ul>
3639 </td></tr>
3640 <tr>
3641 <td> c
3642 <ul><li> d</li></ul>
3643 </td></tr></table></dd></dl>
3644
3645 !! end
3646
3647 !!test
3648 Table / list interaction: lists nested in tables nested in indented lists
3649 !! wikitext
3650 :{|
3651 |
3652 :a
3653 :b
3654 |
3655 *c
3656 *d
3657 |}
3658
3659 *e
3660 *f
3661 !! html
3662 <dl><dd><table>
3663 <tr>
3664 <td>
3665 <dl><dd>a</dd>
3666 <dd>b</dd></dl>
3667 </td>
3668 <td>
3669 <ul><li>c</li>
3670 <li>d</li></ul>
3671 </td></tr></table></dd></dl>
3672 <ul><li>e</li>
3673 <li>f</li></ul>
3674
3675 !!end
3676
3677 !! test
3678 Definition Lists: Nesting: Multi-level (Parsoid only)
3679 !! options
3680 parsoid
3681 !! wikitext
3682 ;t1 :d1
3683 ;;t2 ::d2
3684 ;;;t3 :::d3
3685 !! html
3686 <dl>
3687 <dt>t1 </dt>
3688 <dd>d1</dd>
3689 <dt>
3690 <dl>
3691 <dt>t2 </dt>
3692 <dd>:d2</dd>
3693 <dt>
3694 <dl>
3695 <dt>t3 </dt>
3696 <dd>::d3</dd>
3697 </dl>
3698 </dt>
3699 </dl>
3700 </dt>
3701 </dl>
3702
3703
3704 !! end
3705
3706
3707 !! test
3708 Definition Lists: Nesting: Test 2 (Parsoid only)
3709 !! options
3710 parsoid
3711 !! wikitext
3712 ;t1
3713 ::d2
3714 !! html
3715 <dl>
3716 <dt>t1</dt>
3717 <dd>
3718 <dl>
3719 <dd>d2</dd>
3720 </dl>
3721 </dd>
3722 </dl>
3723
3724 !! end
3725
3726
3727 !! test
3728 Definition Lists: Nesting: Test 3 (Parsoid only)
3729 !! options
3730 parsoid
3731 !! wikitext
3732 :;t1
3733 ::::d2
3734 !! html
3735 <dl>
3736 <dd>
3737 <dl>
3738 <dt>t1</dt>
3739 <dd>
3740 <dl>
3741 <dd>
3742 <dl>
3743 <dd>d2</dd>
3744 </dl>
3745 </dd>
3746 </dl>
3747 </dd>
3748 </dl>
3749 </dd>
3750 </dl>
3751
3752 !! end
3753
3754
3755 !! test
3756 Definition Lists: Nesting: Test 4
3757 !! wikitext
3758 ::;t3
3759 :::d3
3760 !! html
3761 <dl><dd><dl><dd><dl><dt>t3</dt>
3762 <dd>d3</dd></dl></dd></dl></dd></dl>
3763
3764 !! end
3765
3766
3767 ## The Parsoid team believes the following three test exposes a
3768 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3769 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3770 ## It also exposes a "misfeature" in tidy, which doesn't like
3771 ## <dl> tags with a single <dt> child; it converts the <dt> into
3772 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3773 !! test
3774 Definition Lists: Mixed Lists: Test 1
3775 !! wikitext
3776 :;* foo
3777 ::* bar
3778 :; baz
3779 !! html/php
3780 <dl><dd><dl><dt><ul><li> foo</li>
3781 <li> bar</li></ul></dt></dl>
3782 <dl><dt> baz</dt></dl></dd></dl>
3783
3784 !! html/php+tidy
3785 <dl>
3786 <dd>
3787 <dl>
3788 <dd>
3789 <ul>
3790 <li>foo</li>
3791 <li>bar</li>
3792 </ul>
3793 </dd>
3794 </dl>
3795 <dl>
3796 <dt>baz</dt>
3797 </dl>
3798 </dd>
3799 </dl>
3800 !! html/parsoid
3801 <dl>
3802 <dd><dl>
3803 <dt><ul>
3804 <li> foo
3805 </li>
3806 </ul></dt>
3807 <dd><ul>
3808 <li> bar
3809 </li>
3810 </ul></dd>
3811 <dt> baz</dt>
3812 </dl></dd>
3813 </dl>
3814 !! end
3815
3816 !! test
3817 Definition Lists: Mixed Lists: Test 2
3818 !! wikitext
3819 *: d1
3820 *: d2
3821 !! html
3822 <ul><li><dl><dd> d1</dd>
3823 <dd> d2</dd></dl></li></ul>
3824
3825 !! end
3826
3827
3828 !! test
3829 Definition Lists: Mixed Lists: Test 3
3830 !! wikitext
3831 *::: d1
3832 *::: d2
3833 !! html
3834 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3835 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3836
3837 !! end
3838
3839
3840 !! test
3841 Definition Lists: Mixed Lists: Test 4
3842 !! wikitext
3843 *;d1 :d2
3844 *;d3 :d4
3845 !! html
3846 <ul><li><dl><dt>d1&#160;</dt>
3847 <dd>d2</dd>
3848 <dt>d3&#160;</dt>
3849 <dd>d4</dd></dl></li></ul>
3850
3851 !! end
3852
3853
3854 !! test
3855 Definition Lists: Mixed Lists: Test 5
3856 !! wikitext
3857 *:d1
3858 *:: d2
3859 !! html
3860 <ul><li><dl><dd>d1
3861 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3862
3863 !! end
3864
3865
3866 !! test
3867 Definition Lists: Mixed Lists: Test 6
3868 !! wikitext
3869 #*:d1
3870 #*::: d3
3871 !! html
3872 <ol><li><ul><li><dl><dd>d1
3873 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3874
3875 !! end
3876
3877
3878 !! test
3879 Definition Lists: Mixed Lists: Test 7
3880 !! wikitext
3881 :* d1
3882 :* d2
3883 !! html
3884 <dl><dd><ul><li> d1</li>
3885 <li> d2</li></ul></dd></dl>
3886
3887 !! end
3888
3889
3890 !! test
3891 Definition Lists: Mixed Lists: Test 8
3892 !! wikitext
3893 :* d1
3894 ::* d2
3895 !! html
3896 <dl><dd><ul><li> d1</li></ul>
3897 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3898
3899 !! end
3900
3901
3902 !! test
3903 Definition Lists: Mixed Lists: Test 9
3904 !! wikitext
3905 *;foo :bar
3906 !! html
3907 <ul><li><dl><dt>foo&#160;</dt>
3908 <dd>bar</dd></dl></li></ul>
3909
3910 !! end
3911
3912
3913 !! test
3914 Definition Lists: Mixed Lists: Test 10
3915 !! wikitext
3916 *#;foo :bar
3917 !! html
3918 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3919 <dd>bar</dd></dl></li></ol></li></ul>
3920
3921 !! end
3922
3923 # The Parsoid team disagrees with the PHP parser's seemingly-random
3924 # rules regarding dd/dt on the next two tests. Parsoid is more
3925 # consistent, and recognizes the shared nesting and keeps the
3926 # still-open tags around until the nesting is complete.
3927 # (And tidy again converts <dt> to <dd> before 'bar'.)
3928
3929 !! test
3930 Definition Lists: Mixed Lists: Test 11
3931 !! wikitext
3932 *#*#;*;;foo :bar
3933 *#*#;boo :baz
3934 !! html/php
3935 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3936 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3937 <dl><dt>boo&#160;</dt>
3938 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3939
3940 !! html/php+tidy
3941 <ul>
3942 <li>
3943 <ol>
3944 <li>
3945 <ul>
3946 <li>
3947 <ol>
3948 <li>
3949 <dl>
3950 <dt>foo&#160;</dt>
3951 <dd>
3952 <ul>
3953 <li>
3954 <dl>
3955 <dd>
3956 <dl>
3957 <dt>bar</dt>
3958 </dl>
3959 </dd>
3960 </dl>
3961 </li>
3962 </ul>
3963 </dd>
3964 </dl>
3965 <dl>
3966 <dt>boo&#160;</dt>
3967 <dd>baz</dd>
3968 </dl>
3969 </li>
3970 </ol>
3971 </li>
3972 </ul>
3973 </li>
3974 </ol>
3975 </li>
3976 </ul>
3977 !! html/parsoid
3978 <ul>
3979 <li>
3980 <ol>
3981 <li>
3982 <ul>
3983 <li>
3984 <ol>
3985 <li>
3986 <dl>
3987 <dt>
3988 <ul>
3989 <li>
3990 <dl>
3991 <dt>
3992 <dl>
3993 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3994 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3995 </dl></dt>
3996 </dl></li>
3997 </ul></dt>
3998 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3999 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4000 </dl></li>
4001 </ol></li>
4002 </ul></li>
4003 </ol></li>
4004 </ul>
4005 !! end
4006
4007
4008 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4009 !! test
4010 Definition Lists: Weird Ones: Test 1
4011 !! wikitext
4012 *#;*::;; foo : bar (who uses this?)
4013 !! html/php
4014 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4015 <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>
4016
4017 !! html/php+tidy
4018 <ul>
4019 <li>
4020 <ol>
4021 <li>
4022 <dl>
4023 <dt>foo&#160;</dt>
4024 <dd>
4025 <ul>
4026 <li>
4027 <dl>
4028 <dd>
4029 <dl>
4030 <dd>
4031 <dl>
4032 <dd>
4033 <dl>
4034 <dt>bar (who uses this?)</dt>
4035 </dl>
4036 </dd>
4037 </dl>
4038 </dd>
4039 </dl>
4040 </dd>
4041 </dl>
4042 </li>
4043 </ul>
4044 </dd>
4045 </dl>
4046 </li>
4047 </ol>
4048 </li>
4049 </ul>
4050 !! html/parsoid
4051 <ul>
4052 <li>
4053 <ol>
4054 <li>
4055 <dl>
4056 <dt>
4057 <ul>
4058 <li>
4059 <dl>
4060 <dd>
4061 <dl>
4062 <dd>
4063 <dl>
4064 <dt>
4065 <dl>
4066 <dt> foo<span typeof="mw:Placeholder">&nbsp;</span></dt>
4067 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4068 </dl></dt>
4069 </dl></dd>
4070 </dl></dd>
4071 </dl></li>
4072 </ul></dt>
4073 </dl></li>
4074 </ol></li>
4075 </ul>
4076 !! end
4077
4078 !! test
4079 Definition Lists: colons occurring in tags
4080 !! wikitext
4081 ;a:b
4082 ;'''a:b'''
4083 ;<i>a:b</i>
4084 ;<span>a:b</span>
4085 ;<div>a:b</div>
4086 ;<div>a
4087 :b</div>
4088 ;{{echo|a:b}}
4089 ;{{echo|''a:b''}}
4090 ;;;''a:b''
4091 !! html+tidy
4092 <dl>
4093 <dt>a</dt>
4094 <dd>b</dd>
4095 <dt><b>a:b</b></dt>
4096 <dt><i>a:b</i></dt>
4097 <dt><span>a:b</span></dt>
4098 <dd>
4099 <div>a:b</div>
4100 </dd>
4101 <dd>
4102 <div>a
4103 <dl>
4104 <dd>b</dd>
4105 </dl>
4106 </div>
4107 </dd>
4108 <dt>a</dt>
4109 <dd>b</dd>
4110 <dt><i>a:b</i></dt>
4111 </dl>
4112 <dl>
4113 <dd>
4114 <dl>
4115 <dd>
4116 <dl>
4117 <dt><i>a:b</i></dt>
4118 </dl>
4119 </dd>
4120 </dl>
4121 </dd>
4122 </dl>
4123 !! end
4124
4125 !! test
4126 Definition Lists: colons and tables 1
4127 !! wikitext
4128 :{|
4129 | x
4130 |}
4131 :{|
4132 | y
4133 |}
4134 !! html
4135 <dl><dd><table>
4136 <tr>
4137 <td> x
4138 </td></tr></table></dd></dl>
4139 <dl><dd><table>
4140 <tr>
4141 <td> y
4142 </td></tr></table></dd></dl>
4143
4144 !! end
4145
4146 # Parsoid's output (as documented below) differs from php's in this case.
4147 # This is probably a bug. If we fixup parsoid to match php's output, the
4148 # above test should pass and the below test case can be removed. It is
4149 # unclear which output is more desirable.
4150
4151 !! test
4152 Definition Lists: colons and tables 2
4153 !! wikitext
4154 :{|
4155 | x
4156 |}
4157 :{|
4158 | y
4159 |}
4160 !! html/parsoid
4161 <dl><dd><table>
4162 <tr>
4163 <td> x
4164 </td></tr></table></dd>
4165 <dd><table>
4166 <tr>
4167 <td> y
4168 </td></tr></table></dd></dl>
4169 !! end
4170
4171 !! test
4172 Definition Lists: template interaction
4173 !! wikitext
4174 ::{{definition_list}}
4175
4176 :one
4177 ::{{definition_list}}
4178 :::two
4179 :::three
4180 ::four
4181 !! html/parsoid
4182 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4183 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4184
4185 <dl><dd data-parsoid='{}'>one
4186 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4187 </span><dd about="#mwt2">two
4188 <dl><dd>two</dd>
4189 <dd>three</dd></dl></dd>
4190 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4191 !! end
4192
4193
4194 ###
4195 ### External links
4196 ###
4197 !! test
4198 External links: non-bracketed
4199 !! wikitext
4200 Non-bracketed: http://example.com
4201 !! html
4202 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4203 </p>
4204 !! end
4205
4206 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4207 !! test
4208 External links: numbered
4209 !! wikitext
4210 Numbered: [http://example.com]
4211 Numbered: [http://example.net]
4212 Numbered: [http://example.com]
4213 !! html/php
4214 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4215 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4216 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4217 </p>
4218 !! html/parsoid
4219 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4220 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4221 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4222 !!end
4223
4224 !! test
4225 External links: specified text
4226 !! wikitext
4227 Specified text: [http://example.com link]
4228 !! html
4229 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4230 </p>
4231 !!end
4232
4233 !! test
4234 External links: trail
4235 !! wikitext
4236 Linktrails should not work for external links: [http://example.com link]s
4237 !! html
4238 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4239 </p>
4240 !! end
4241
4242 !! test
4243 External links: dollar sign in URL
4244 !! wikitext
4245 http://example.com/1$2345
4246 !! html
4247 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4248 </p>
4249 !! end
4250
4251 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4252 !! test
4253 External links: dollar sign in URL (autonumber)
4254 !! wikitext
4255 [http://example.com/1$2345]
4256 !! html/php
4257 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4258 </p>
4259 !! html/parsoid
4260 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4261 !!end
4262
4263 !! test
4264 External links: open square bracket forbidden in URL (bug 4377)
4265 !! options
4266 parsoid=wt2html,wt2wt,html2html
4267 !! wikitext
4268 http://example.com/1[2345
4269 !! html/php
4270 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4271 </p>
4272 !! html/parsoid
4273 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4274 !! end
4275
4276 !! test
4277 External links: open square bracket forbidden in URL (named) (bug 4377)
4278 !! options
4279 parsoid=wt2html,html2html
4280 !! wikitext
4281 [http://example.com/1[2345]
4282 !! html/php
4283 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4284 </p>
4285 !! html/parsoid
4286 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4287 !!end
4288
4289 # parsoid adds a space before the link name
4290 !! test
4291 External links: open square bracket forbidden in URL (named) (bug 4377)
4292 Parsoid variant.
4293 !! wikitext
4294 [http://example.com/1 [2345]
4295 !! html
4296 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4297 </p>
4298 !!end
4299
4300 !! test
4301 External links: nowiki in URL link text (bug 6230)
4302 !! wikitext
4303 [http://example.com/ <nowiki>''example site''</nowiki>]
4304 !! html
4305 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4306 </p>
4307 !! end
4308
4309 !! test
4310 External links: newline forbidden in text (bug 6230 regression check)
4311 !! wikitext
4312 [http://example.com/ first
4313 second]
4314 !! html
4315 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4316 second]
4317 </p>
4318 !!end
4319
4320 !! test
4321 External links: Pipe char between url and text
4322 !! wikitext
4323 [http://example.com | link]
4324 !! html
4325 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4326 </p>
4327 !!end
4328
4329 !! test
4330 External links: protocol-relative URL in brackets
4331 !! wikitext
4332 [//example.com/ Test]
4333 !! html
4334 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4335 </p>
4336 !! end
4337
4338 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4339 !! test
4340 External links: protocol-relative URL in brackets without text
4341 !! wikitext
4342 [//example.com]
4343 !! html/php
4344 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4345 </p>
4346 !! html/parsoid
4347 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4348 !! end
4349
4350 !! test
4351 External links: protocol-relative URL in free text is left alone
4352 !! wikitext
4353 //example.com/Foo
4354 !! html
4355 <p>//example.com/Foo
4356 </p>
4357 !!end
4358
4359 !! test
4360 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4361 !! wikitext
4362 foo//example.com/Foo
4363 !! html
4364 <p>foo//example.com/Foo
4365 </p>
4366 !! end
4367
4368 !! test
4369 External links: with no contents
4370 !! wikitext
4371 [http://en.wikipedia.org/wiki/Foo]
4372
4373 [[wikipedia:Foo|Bar]]
4374
4375 [[wikipedia:Foo|<span>Bar</span>]]
4376 !! html/php
4377 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4378 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4379 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4380 </p>
4381 !! html/parsoid
4382 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4383 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4384 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4385 !! end
4386
4387 !! test
4388 External links: Free with trailing punctuation
4389 !! wikitext
4390 http://example.com,
4391 http://example.com;
4392 http://example.com\
4393 http://example.com.
4394 http://example.com:
4395 http://example.com!
4396 http://example.com?
4397 http://example.com)
4398 http://example.com/url_with_(brackets)
4399 (http://example.com/url_without_brackets)
4400 http://example.com/url_with_entity&nbsp;
4401 http://example.com/url_with_entity&#xA0;
4402 http://example.com/url_with_entity&#160;
4403 http://example.com/url_with_entity&lt;
4404 http://example.com/url_with_entity&#x3C;
4405 http://example.com/url_with_entity&#60;
4406 !! html/php
4407 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4408 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4409 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4410 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4411 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4412 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4413 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4414 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4415 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4416 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4417 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4418 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4419 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4420 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4421 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4422 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4423 </p>
4424 !! html/parsoid
4425 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4426 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4427 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4428 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4429 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4430 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4431 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4432 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4433 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4434 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4435 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4436 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4437 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4438 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4439 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4440 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4441 !! end
4442
4443 !! test
4444 External links: No preceding word characters allowed (bug 65278)
4445 !! wikitext
4446 NOPEhttp://example.com
4447 N0http://example.com
4448 ok:http://example.com
4449 ok-http://example.com
4450 !! html
4451 <p>NOPEhttp://example.com
4452 N0http://example.com
4453 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4454 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4455 </p>
4456 !! end
4457
4458 !! test
4459 External image
4460 !! wikitext
4461 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4462 !! html
4463 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4464 </p>
4465 !! end
4466
4467 !! test
4468 External image from https
4469 !! wikitext
4470 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4471 !! html
4472 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4473 </p>
4474 !! end
4475
4476 !! test
4477 External image (when not allowed)
4478 !! options
4479 wgAllowExternalImages=0
4480 !! wikitext
4481 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4482 !! html
4483 <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>
4484 </p>
4485 !! end
4486
4487 !! test
4488 Link to non-http image, no img tag
4489 !! wikitext
4490 Link to non-http image, no img tag: ftp://example.com/test.jpg
4491 !! html
4492 <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>
4493 </p>
4494 !! end
4495
4496 !! test
4497 External links: terminating separator
4498 !! wikitext
4499 Terminating separator: http://example.com/thing,
4500 !! html
4501 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4502 </p>
4503 !! end
4504
4505 !! test
4506 External links: intervening separator
4507 !! wikitext
4508 Intervening separator: http://example.com/1,2,3
4509 !! html
4510 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4511 </p>
4512 !! end
4513
4514 !! test
4515 External links: old bug with URL in query
4516 !! wikitext
4517 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4518 !! html
4519 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4520 </p>
4521 !! end
4522
4523 !! test
4524 External links: old URL-in-URL bug, mixed protocols
4525 !! wikitext
4526 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4527 !! html
4528 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4529 </p>
4530 !!end
4531
4532 !! test
4533 External links: URL in text
4534 !! wikitext
4535 URL in text: [http://example.com http://example.com]
4536 !! html
4537 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4538 </p>
4539 !! end
4540
4541 !! test
4542 External links: Clickable images
4543 !! wikitext
4544 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4545 !! html/php
4546 <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>
4547 </p>
4548 !! html/parsoid
4549 <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>
4550 !! end
4551
4552 !! test
4553 External links: raw ampersand
4554 !! wikitext
4555 Old &amp; use: http://x&y
4556 !! html
4557 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4558 </p>
4559 !! end
4560
4561 !! test
4562 External links: encoded ampersand
4563 !! wikitext
4564 Old &amp; use: http://x&amp;y
4565 !! html/php
4566 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4567 </p>
4568 !! html/parsoid
4569 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4570 !! end
4571
4572 !! test
4573 External links: encoded equals (bug 6102)
4574 !! wikitext
4575 http://example.com/?foo&#61;bar
4576 !! html/php
4577 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4578 </p>
4579 !! html/parsoid
4580 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4581 !! end
4582
4583 ##
4584 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4585 ## does it number them. As discussed in bug 53505, we can identify
4586 ## autonumbered links via CSS.
4587 ##
4588
4589 !! test
4590 External links: [raw ampersand]
4591 !! wikitext
4592 Old &amp; use: [http://x&y]
4593 !! html/php
4594 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4595 </p>
4596 !! html/parsoid
4597 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4598 !! end
4599
4600 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4601 # mode will return the [raw ampersand] wikitext
4602 !! test
4603 External links: [encoded ampersand]
4604 !! options
4605 parsoid=wt2html,wt2wt,html2html
4606 !! wikitext
4607 Old &amp; use: [http://x&amp;y]
4608 !! html/php
4609 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4610 </p>
4611 !! html/parsoid
4612 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4613 !! end
4614
4615 !! test
4616 External links: [raw equals]
4617 !! wikitext
4618 [http://example.com/?foo=bar]
4619 !! html/php
4620 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4621 </p>
4622 !! html/parsoid
4623 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4624 !! end
4625
4626 # note that parsoid html is identical to [raw equals] case; so html2wt
4627 # mode will return the [raw equals] wikitext
4628 !! test
4629 External links: [encoded equals] (bug 6102)
4630 !! options
4631 parsoid=wt2html,wt2wt,html2html
4632 !! wikitext
4633 [http://example.com/?foo&#61;bar]
4634 !! html/php
4635 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4636 </p>
4637 !! html/parsoid
4638 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4639 !! end
4640
4641 # xxx parsoid strips the IDN character, so the round-trip tests will
4642 # obviously fail and are disabled. --cscott
4643 !! test
4644 External links: [IDN ignored character reference in hostname; strip it right off]
4645 !! options
4646 parsoid=wt2html,wt2wt,html2html
4647 !! wikitext
4648 [http://e&zwnj;xample.com/]
4649 !! html/php
4650 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4651 </p>
4652 !! html/parsoid
4653 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4654 !! end
4655
4656 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4657 # Where an external link could easily circumvent the sanitization of the text of
4658 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4659 # test demands a higher standard. That's a bit strange.
4660 #
4661 # Example:
4662 #
4663 # http://e‌xample.com -> [http://example.com|http://example.com]
4664 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4665 #
4666 # The first example is sanitized, but the second is not. Any security benefits
4667 # from this production are trivial to circumvent. Either remove this test and
4668 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4669 # the test accordingly.
4670 #
4671 # All our love,
4672 # The Parsoid team.
4673 # xxx parsoid strips the IDN character, so the round-trip tests will
4674 # obviously fail and are disabled. --cscott
4675 !! test
4676 External links: IDN ignored character reference in hostname; strip it right off
4677 !! options
4678 parsoid=wt2html,html2html
4679 !! wikitext
4680 http://e&zwnj;xample.com/
4681 !! html/php
4682 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4683 </p>
4684 !! html/parsoid
4685 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4686 !! end
4687
4688 !! test
4689 External links: www.jpeg.org (bug 554)
4690 !! wikitext
4691 http://www.jpeg.org
4692 !! html
4693 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4694 </p>
4695 !! end
4696
4697 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4698 !! test
4699 External links: URL within URL (original bug 2)
4700 !! wikitext
4701 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4702 !! html/php
4703 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4704 </p>
4705 !! html/parsoid
4706 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4707 !! end
4708
4709 !! test
4710 BUG 361: URL inside bracketed URL
4711 !! wikitext
4712 [http://www.example.com/foo http://www.example.com/bar]
4713 !! html
4714 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4715 </p>
4716 !! end
4717
4718 !! test
4719 BUG 361: URL within URL, not bracketed
4720 !! wikitext
4721 http://www.example.com/foo?=http://www.example.com/bar
4722 !! html
4723 <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>
4724 </p>
4725 !! end
4726
4727 !! test
4728 BUG 289: ">"-token in URL-tail
4729 !! wikitext
4730 http://www.example.com/<hello>
4731 !! html
4732 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4733 </p>
4734 !!end
4735
4736 !! test
4737 BUG 289: literal ">"-token in URL-tail
4738 !! wikitext
4739 http://www.example.com/<b>html</b>
4740 !! html/php
4741 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4742 </p>
4743 !! html/parsoid
4744 <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>
4745 !! end
4746
4747 !! test
4748 BUG 289: ">"-token in bracketed URL
4749 !! wikitext
4750 [http://www.example.com/<hello> stuff]
4751 !! html
4752 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4753 </p>
4754 !!end
4755
4756 !! test
4757 BUG 289: literal ">"-token in bracketed URL
4758 !! wikitext
4759 [http://www.example.com/<b>html</b> stuff]
4760 !! html
4761 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4762 </p>
4763 !!end
4764
4765 !! test
4766 BUG 289: literal double quote at end of URL
4767 !! wikitext
4768 http://www.example.com/"hello"
4769 !! html
4770 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4771 </p>
4772 !!end
4773
4774 !! test
4775 BUG 289: literal double quote in bracketed URL
4776 !! wikitext
4777 [http://www.example.com/"hello" stuff]
4778 !! html
4779 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4780 </p>
4781 !!end
4782
4783 !! test
4784 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4785 !! wikitext
4786 [http://www.example.com test]
4787 !! html
4788 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4789 </p>
4790 !! end
4791
4792 !! test
4793 External links: link text with spaces
4794 !! wikitext
4795 [http://www.example.com a b c]
4796 [http://www.example.com ''a'' ''b'']
4797 !! html
4798 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4799 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4800 </p>
4801 !! end
4802
4803 !! test
4804 External links: wiki links within external link (Bug 3695)
4805 !! wikitext
4806 [http://example.com [[wikilink]] embedded in ext link]
4807 !! html/php
4808 <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>
4809 </p>
4810 !! html/parsoid
4811 <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>
4812 !! end
4813
4814 !! test
4815 BUG 787: Links with one slash after the url protocol are invalid
4816 !! wikitext
4817 http:/example.com
4818
4819 [http:/example.com title]
4820 !! html
4821 <p>http:/example.com
4822 </p><p>[http:/example.com title]
4823 </p>
4824 !! end
4825
4826 !! test
4827 Bracketed external links with template-generated invalid target
4828 !! wikitext
4829 [{{echo|http:/example.com}} title]
4830 !! html
4831 <p>[http:/example.com title]
4832 </p>
4833 !! end
4834
4835 !! test
4836 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4837 !! wikitext
4838 ''[http://example.com text'']
4839 [http://example.com '''text]'''
4840 ''Something [http://example.com in italic'']
4841 ''Something [http://example.com mixed''''', even bold]'''
4842 '''''Now [http://example.com both''''']
4843 !! html
4844 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4845 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4846 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4847 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4848 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4849 </p>
4850 !! end
4851
4852
4853 !! test
4854 Bug 4781: %26 in URL
4855 !! wikitext
4856 http://www.example.com/?title=AT%26T
4857 !! html/php
4858 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4859 </p>
4860 !! html/parsoid
4861 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4862 !! end
4863
4864 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
4865 # % is actually legal in HTML5. Any change in output would need testing though.
4866 !! test
4867 Bug 4781, 5267: %25 in URL
4868 !! wikitext
4869 http://www.example.com/?title=100%25_Bran
4870 !! html/php
4871 <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>
4872 </p>
4873 !! html/parsoid
4874 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4875 !! end
4876
4877 !! test
4878 Bug 4781, 5267: %28, %29 in URL
4879 !! wikitext
4880 http://www.example.com/?title=Ben-Hur_%281959_film%29
4881 !! html/php
4882 <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>
4883 </p>
4884 !! html/parsoid
4885 <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>
4886 !! end
4887
4888
4889 !! test
4890 Bug 4781: %26 in autonumber URL
4891 !! wikitext
4892 [http://www.example.com/?title=AT%26T]
4893 !! html/php
4894 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4895 </p>
4896 !! html/parsoid
4897 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4898 !! end
4899
4900 !! test
4901 Bug 4781, 5267: %26 in autonumber URL
4902 !! wikitext
4903 [http://www.example.com/?title=100%25_Bran]
4904 !! html/php
4905 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4906 </p>
4907 !! html/parsoid
4908 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4909 !! end
4910
4911 !! test
4912 Bug 4781, 5267: %28, %29 in autonumber URL
4913 !! wikitext
4914 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4915 !! html/php
4916 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4917 </p>
4918 !! html/parsoid
4919 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4920 !! end
4921
4922
4923 !! test
4924 Bug 4781: %26 in bracketed URL
4925 !! wikitext
4926 [http://www.example.com/?title=AT%26T link]
4927 !! html/php
4928 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4929 </p>
4930 !! html/parsoid
4931 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4932 !! end
4933
4934 !! test
4935 Bug 4781, 5267: %25 in bracketed URL
4936 !! wikitext
4937 [http://www.example.com/?title=100%25_Bran link]
4938 !! html
4939 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4940 </p>
4941 !! end
4942
4943 !! test
4944 Bug 4781, 5267: %28, %29 in bracketed URL
4945 !! wikitext
4946 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4947 !! html/php
4948 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4949 </p>
4950 !! html/parsoid
4951 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4952 !! end
4953
4954 !! test
4955 External link containing a period in the anchor. (bug 63947)
4956 !! wikitext
4957 [//foo.org/bar#baz. bang]
4958
4959 [//foo.org/bar. bang]
4960 !! html/php
4961 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4962 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4963 </p>
4964 !! html/parsoid
4965 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4966 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4967 !! end
4968
4969 !! test
4970 External link containing a single quote. (bug 63947)
4971 !! wikitext
4972 [//foo.org/bar'baz]
4973
4974 [//foo.org/bar'baz bang]
4975 !! html/php
4976 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4977 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4978 </p>
4979 !! html/parsoid
4980 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4981 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4982 !! end
4983
4984
4985 !! test
4986 External link containing a period in the anchor. (bug 63947)
4987 !! wikitext
4988 [//foo.org/bar#baz. bang]
4989
4990 [//foo.org/bar. bang]
4991 !! html/php
4992 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4993 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4994 </p>
4995 !! html/parsoid
4996 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4997 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4998 !! end
4999
5000 !! test
5001 External link containing a single quote. (bug 63947)
5002 !! wikitext
5003 [//foo.org/bar'baz]
5004
5005 [//foo.org/bar'baz bang]
5006 !! html/php
5007 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5008 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5009 </p>
5010 !! html/parsoid
5011 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5012 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5013 !! end
5014
5015
5016 !! test
5017 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5018 !! wikitext
5019 Some [http://example.com/ pretty ''italics'' and stuff]!
5020 !! html
5021 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5022 </p>
5023 !! end
5024
5025 !! test
5026 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5027 !! wikitext
5028 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5029 !! html
5030 <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>
5031 </p>
5032 !! end
5033
5034 !! test
5035 External link containing double-single-quotes with no space separating the url from text in italics
5036 !! wikitext
5037 [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]].]
5038 !! html/php
5039 <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>
5040 </p>
5041 !! html/php+tidy
5042 <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>
5043 !! html/parsoid
5044 <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>
5045 !! end
5046
5047 !! test
5048 External link with comments in link text
5049 !! wikitext
5050 [http://www.google.com Google <!-- comment -->]
5051 !! html
5052 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5053 </p>
5054 !! end
5055
5056 !! test
5057 URL-encoding in URL functions (single parameter)
5058 !! wikitext
5059 {{localurl:Some page|amp=&}}
5060 !! html
5061 <p>/index.php?title=Some_page&amp;amp=&amp;
5062 </p>
5063 !! end
5064
5065 !! test
5066 URL-encoding in URL functions (multiple parameters)
5067 !! wikitext
5068 {{localurl:Some page|q=?&amp=&}}
5069 !! html
5070 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5071 </p>
5072 !! end
5073
5074 !! test
5075 Brackets in urls
5076 !! wikitext
5077 http://example.com/index.php?foozoid%5B%5D=bar
5078
5079 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5080 !! html/php
5081 <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>
5082 </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>
5083 </p>
5084 !! html/parsoid
5085 <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>
5086
5087 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5088 !! end
5089
5090 !! test
5091 IPv6 urls (bug 21261)
5092 !! options
5093 disabled
5094 !! wikitext
5095 http://[2404:130:0:1000::187:2]/index.php
5096 !! html
5097 <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>
5098 </p>
5099 !! end
5100
5101 !! test
5102 Non-extlinks in brackets
5103 !! wikitext
5104 [foo]
5105 [foo bar]
5106 [foo ''bar'']
5107 [fool's] errand
5108 [fool's errand]
5109 [{{echo|foo}}]
5110 [{{echo|foo}} bar]
5111 [{{echo|foo}} ''bar'']
5112 [{{echo|foo}}l's] errand
5113 [{{echo|foo}}l's errand]
5114 [url={{echo|foo}}]
5115 [url=http://example.com]
5116 !! html
5117 <p>[foo]
5118 [foo bar]
5119 [foo <i>bar</i>]
5120 [fool's] errand
5121 [fool's errand]
5122 [foo]
5123 [foo bar]
5124 [foo <i>bar</i>]
5125 [fool's] errand
5126 [fool's errand]
5127 [url=foo]
5128 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5129 </p>
5130 !! end
5131
5132 !! test
5133 Percent encoding in external links
5134 !! wikitext
5135 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5136 !! html/php
5137 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5138 </p>
5139 !! html/parsoid
5140 <p><a rel="mw:ExtLink"
5141 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5142 !! end
5143
5144 !! test
5145 Use url link syntax for links where the content is equal the link target
5146 !! wikitext
5147 http://example.com
5148 !! html/php
5149 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5150 </p>
5151 !! html/parsoid
5152 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5153 !! end
5154
5155 !! test
5156 Parenthesis in external links, especially URL links
5157 !! wikitext
5158 http://example.com)
5159
5160 http://example.com/test)
5161
5162 http://example.com/(test)
5163
5164 http://example.com/((test)
5165
5166 (http://example.com/(test))
5167
5168 (http://example.com/(test)))))
5169
5170 http://example.com/a)b
5171
5172 [http://example.com) foo]
5173 !! html/php
5174 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5175 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5176 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5177 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5178 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5179 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5180 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5181 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5182 </p>
5183 !! html/parsoid
5184 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5185 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5186 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5187 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5188 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5189 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5190 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5191 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5192 !! end
5193
5194 !! test
5195 Parenthesis in external links, w/ transclusion or comment
5196 !! wikitext
5197 (http://example.com/{{echo|hi}})
5198
5199 (http://example.com<!-- hi -->)
5200 !! html/php
5201 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5202 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5203 </p>
5204 !! html/parsoid
5205 <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>
5206
5207 <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>
5208 !! end
5209
5210 !! test
5211 Replace invalid link targets when serializing
5212 !! options
5213 parsoid=html2wt
5214 !! html
5215 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
5216 !! wikitext
5217 [[MediaWiki:Badtitletext|Manual]]
5218 !! end
5219
5220 ###
5221 ### Quotes
5222 ###
5223
5224 !! test
5225 Quotes
5226 !! wikitext
5227 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5228
5229 Normal text. '''''Bold italic text.''''' Normal text.
5230 !! html
5231 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5232 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5233 </p>
5234 !! end
5235
5236
5237 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5238 # parser strips. The wikitext contains just the first half of the bold
5239 # quote pair.
5240 !! test
5241 Unclosed and unmatched quotes
5242 !! wikitext
5243 '''''Bold italic text '''with bold deactivated''' in between.'''''
5244
5245 '''''Bold italic text ''with italic deactivated'' in between.'''''
5246
5247 '''Bold text..
5248
5249 ..spanning two paragraphs (should not work).'''
5250
5251 '''Bold tag left open
5252
5253 ''Italic tag left open
5254
5255 Normal text.
5256
5257 <!-- Unmatching number of opening, closing tags: -->
5258 '''This year''''s election ''should'' beat '''last year''''s.
5259
5260 ''Tom'''s car is bigger than ''Susan'''s.
5261
5262 Plain ''italic'''s plain
5263 !! html/php
5264 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5265 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5266 </p><p><b>Bold text..</b>
5267 </p><p>..spanning two paragraphs (should not work).
5268 </p><p><b>Bold tag left open</b>
5269 </p><p><i>Italic tag left open</i>
5270 </p><p>Normal text.
5271 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5272 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5273 </p><p>Plain <i>italic'</i>s plain
5274 </p>
5275 !! html/parsoid
5276 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5277 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5278 </p><p><b>Bold text..</b>
5279 </p><p>..spanning two paragraphs (should not work).<b></b>
5280 </p><p><b>Bold tag left open</b>
5281 </p><p><i>Italic tag left open</i>
5282 </p><p>Normal text.
5283 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5284 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5285 </p><p>Plain <i>italic'</i>s plain
5286 </p>
5287 !! end
5288
5289 ###
5290 ### Tables
5291 ###
5292 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5293 ###
5294
5295 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5296 # is the bare minimum required by the spec, see:
5297 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5298 # Parsoid team replies: empty table tags are legal in HTML5
5299 !! test
5300 A table with no data.
5301 !! options
5302 parsoid=wt2html
5303 !! wikitext
5304 {||}
5305 !! html/php
5306
5307 !! html/parsoid
5308 <table></table>
5309
5310 !! end
5311
5312 !! test
5313 A table with stray table end tags on start tag line (wt2html)
5314 !! options
5315 parsoid=wt2html
5316 !! wikitext
5317 {|style="color: red;"|}
5318
5319 {|style="color: red;" |}
5320 |foo
5321 |}
5322
5323 {|style="color: red;"|} id="foo"
5324 |foo
5325 |}
5326
5327 {|style="color: red;" |} id="foo"
5328 |foo
5329 |}
5330 !! html
5331 <table style="color: red;"></table>
5332
5333 <table style="color: red;">
5334 <tbody><tr>
5335 <td>foo</td>
5336 </tr></tbody>
5337 </table>
5338
5339 <table style="color: red;" id="foo">
5340 <tbody><tr>
5341 <td>foo</td>
5342 </tr></tbody>
5343 </table>
5344
5345 <table style="color: red;" id="foo">
5346 <tbody><tr>
5347 <td>foo</td>
5348 </tr></tbody>
5349 </table>
5350
5351 !! end
5352
5353 !! test
5354 A table with no data (take 2)
5355 !! wikitext
5356 {|
5357 |}
5358 !! html/parsoid
5359 <table></table>
5360 !! end
5361
5362 # A table with nothing but a caption is invalid XHTML, we might want to render
5363 # this as <p>caption</p>
5364 # Parsoid team replies: table with only a caption is legal in HTML5
5365 !! test
5366 A table with nothing but a caption
5367 !! wikitext
5368 {|
5369 |+ caption
5370 |}
5371 !! html/php
5372 <table>
5373 <caption> caption
5374 </caption><tr><td></td></tr></table>
5375
5376 !! html/parsoid
5377 <table><caption> caption</caption></table>
5378 !! end
5379
5380 !! test
5381 A table with caption with default-spaced attributes and a table row
5382 !! wikitext
5383 {|
5384 |+ style="color: red;" | caption1
5385 |-
5386 | foo
5387 |}
5388 !! html
5389 <table>
5390 <caption style="color: red;"> caption1
5391 </caption>
5392 <tr>
5393 <td> foo
5394 </td></tr></table>
5395
5396 !! end
5397
5398 !! test
5399 A table with captions with non-default spaced attributes and a table row
5400 !! wikitext
5401 {|
5402 |+style="color: red;"|caption2
5403 |+ style="color: red;"| caption3
5404 |-
5405 | foo
5406 |}
5407 !! html
5408 <table>
5409 <caption style="color: red;">caption2
5410 </caption>
5411 <caption style="color: red;"> caption3
5412 </caption>
5413 <tr>
5414 <td> foo
5415 </td></tr></table>
5416
5417 !! end
5418
5419 !! test
5420 Table td-cell syntax variations
5421 !! wikitext
5422 {|
5423 | foo bar foo | baz
5424 | foo bar foo || baz
5425 | style='color:red;' | baz
5426 | style='color:red;' || baz
5427 |}
5428 !! html
5429 <table>
5430 <tr>
5431 <td> baz
5432 </td>
5433 <td> foo bar foo </td>
5434 <td> baz
5435 </td>
5436 <td style="color:red;"> baz
5437 </td>
5438 <td> style='color:red;' </td>
5439 <td> baz
5440 </td></tr></table>
5441
5442 !! end
5443
5444 !! test
5445 Simple table
5446 !! wikitext
5447 {|
5448 | 1 || 2
5449 |-
5450 | 3 || 4
5451 |}
5452 !! html
5453 <table>
5454 <tr>
5455 <td> 1 </td>
5456 <td> 2
5457 </td></tr>
5458 <tr>
5459 <td> 3 </td>
5460 <td> 4
5461 </td></tr></table>
5462
5463 !! end
5464
5465 !! test
5466 Simple table but with multiple dashes for row wikitext
5467 !! wikitext
5468 {|
5469 | foo
5470 |-----
5471 | bar
5472 |}
5473 !! html
5474 <table>
5475 <tr>
5476 <td> foo
5477 </td></tr>
5478 <tr>
5479 <td> bar
5480 </td></tr></table>
5481
5482 !! end
5483 !! test
5484 Multiplication table
5485 !! wikitext
5486 {| border="1" cellpadding="2"
5487 |+Multiplication table
5488 |-
5489 ! &times; !! 1 !! 2 !! 3
5490 |-
5491 ! 1
5492 | 1 || 2 || 3
5493 |-
5494 ! 2
5495 | 2 || 4 || 6
5496 |-
5497 ! 3
5498 | 3 || 6 || 9
5499 |-
5500 ! 4
5501 | 4 || 8 || 12
5502 |-
5503 ! 5
5504 | 5 || 10 || 15
5505 |}
5506 !! html
5507 <table border="1" cellpadding="2">
5508 <caption>Multiplication table
5509 </caption>
5510 <tr>
5511 <th> &#215; </th>
5512 <th> 1 </th>
5513 <th> 2 </th>
5514 <th> 3
5515 </th></tr>
5516 <tr>
5517 <th> 1
5518 </th>
5519 <td> 1 </td>
5520 <td> 2 </td>
5521 <td> 3
5522 </td></tr>
5523 <tr>
5524 <th> 2
5525 </th>
5526 <td> 2 </td>
5527 <td> 4 </td>
5528 <td> 6
5529 </td></tr>
5530 <tr>
5531 <th> 3
5532 </th>
5533 <td> 3 </td>
5534 <td> 6 </td>
5535 <td> 9
5536 </td></tr>
5537 <tr>
5538 <th> 4
5539 </th>
5540 <td> 4 </td>
5541 <td> 8 </td>
5542 <td> 12
5543 </td></tr>
5544 <tr>
5545 <th> 5
5546 </th>
5547 <td> 5 </td>
5548 <td> 10 </td>
5549 <td> 15
5550 </td></tr></table>
5551
5552 !! end
5553
5554 !! test
5555 Accept "||" in table headings
5556 !! wikitext
5557 {|
5558 !h1 || h2
5559 |}
5560 !! html
5561 <table>
5562 <tr>
5563 <th>h1 </th>
5564 <th> h2
5565 </th></tr></table>
5566
5567 !! end
5568
5569 !! test
5570 Accept "!!" in table data
5571 !! wikitext
5572 {|
5573 | Foo!! ||
5574 |}
5575 !! html
5576 <table>
5577 <tr>
5578 <td> Foo!! </td>
5579 <td>
5580 </td></tr></table>
5581
5582 !! html/parsoid
5583 <table>
5584 <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>
5585 </tbody></table>
5586 !! end
5587
5588 !! test
5589 Accept "||" in indented table headings
5590 !! wikitext
5591 :{|
5592 !h1 || h2
5593 |}
5594 !! html
5595 <dl><dd><table>
5596 <tr>
5597 <th>h1 </th>
5598 <th> h2
5599 </th></tr></table></dd></dl>
5600
5601 !! end
5602
5603 !! test
5604 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5605 !! wikitext
5606 {|
5607 !| h1
5608 || a
5609 |}
5610 !! html
5611 <table>
5612 <tr>
5613 <th> h1
5614 </th>
5615 <td> a
5616 </td></tr></table>
5617
5618 !! end
5619
5620 !!test
5621 Accept "| !" at start of line in tables (ignore !-attribute)
5622 !! wikitext
5623 {|
5624 |-
5625 | !style="color:red" | bar
5626 |}
5627 !! html
5628 <table>
5629
5630 <tr>
5631 <td> bar
5632 </td></tr></table>
5633
5634 !!end
5635
5636 !!test
5637 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 +/-
5638 !! wikitext
5639 {|
5640 |-
5641 |style='color:red;'|+1
5642 |style='color:blue;'|-1
5643 |-
5644 | 1 || 2 || 3
5645 | 1 ||+2 ||-3
5646 |-
5647 | +1
5648 | -1
5649 |}
5650 !! html
5651 <table>
5652
5653 <tr>
5654 <td style="color:red;">+1
5655 </td>
5656 <td style="color:blue;">-1
5657 </td></tr>
5658 <tr>
5659 <td> 1 </td>
5660 <td> 2 </td>
5661 <td> 3
5662 </td>
5663 <td> 1 </td>
5664 <td>+2 </td>
5665 <td>-3
5666 </td></tr>
5667 <tr>
5668 <td> +1
5669 </td>
5670 <td> -1
5671 </td></tr></table>
5672
5673 !!end
5674
5675 !! test
5676 Table rowspan
5677 !! wikitext
5678 {| border=1
5679 | Cell 1, row 1
5680 |rowspan=2| Cell 2, row 1 (and 2)
5681 | Cell 3, row 1
5682 |-
5683 | Cell 1, row 2
5684 | Cell 3, row 2
5685 |}
5686 !! html
5687 <table border="1">
5688 <tr>
5689 <td> Cell 1, row 1
5690 </td>
5691 <td rowspan="2"> Cell 2, row 1 (and 2)
5692 </td>
5693 <td> Cell 3, row 1
5694 </td></tr>
5695 <tr>
5696 <td> Cell 1, row 2
5697 </td>
5698 <td> Cell 3, row 2
5699 </td></tr></table>
5700
5701 !! end
5702
5703 !! test
5704 Nested table
5705 !! wikitext
5706 {| border=1
5707 | &alpha;
5708 |
5709 {| bgcolor=#ABCDEF border=2
5710 |nested
5711 |-
5712 |table
5713 |}
5714 |the original table again
5715 |}
5716 !! html
5717 <table border="1">
5718 <tr>
5719 <td> &#945;
5720 </td>
5721 <td>
5722 <table bgcolor="#ABCDEF" border="2">
5723 <tr>
5724 <td>nested
5725 </td></tr>
5726 <tr>
5727 <td>table
5728 </td></tr></table>
5729 </td>
5730 <td>the original table again
5731 </td></tr></table>
5732
5733 !! end
5734
5735 !! test
5736 Invalid attributes in table cell (bug 1830)
5737 !! wikitext
5738 {|
5739 |Cell:|broken
5740 |}
5741 !! html
5742 <table>
5743 <tr>
5744 <td>broken
5745 </td></tr></table>
5746
5747 !! end
5748
5749 # The "|}" to close the table is missing from the input, so parsoid's
5750 # *2wt modes will fail.
5751 !! test
5752 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5753 !! options
5754 parsoid=wt2html,html2html
5755 !! wikitext
5756 {|
5757 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5758 !! html/php
5759 <table>
5760 <tr>
5761 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5762 <td>]" onmouseover="alert(document.cookie)"&gt;test
5763 </td>
5764 </tr>
5765 </table>
5766
5767 !! html/parsoid
5768 <table><tbody>
5769 <tr>
5770 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5771 !! end
5772
5773 # FIXME: The php output is broken.
5774 !! test
5775 ! and || in td attributes should not be parsed as <th>/<td>
5776 !! wikitext
5777 {|
5778 | style="color: red !important;" data-contrived="put this here ||" | foo
5779 |}
5780 !! html/php
5781 <table>
5782 <tr>
5783 <td> style="color: red !important;" data-contrived="put this here </td>
5784 <td> foo
5785 </td></tr></table>
5786
5787 !! html/parsoid
5788 <table>
5789 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
5790 </tbody></table>
5791 !! end
5792
5793 !! test
5794 Indented table markup mixed with indented pre content (proposed in bug 6200)
5795 !! wikitext
5796 <table>
5797 <tr>
5798 <td>
5799 Text that should be rendered preformatted
5800 </td>
5801 </tr>
5802 </table>
5803 !! html
5804 <table>
5805 <tr>
5806 <td>
5807 <pre>Text that should be rendered preformatted
5808 </pre>
5809 </td>
5810 </tr>
5811 </table>
5812
5813 !! end
5814
5815 !! test
5816 1. Template-generated table cell attributes and cell content
5817 !! wikitext
5818 {|
5819 |{{table_attribs}}
5820 | {{table_attribs}}
5821 || {{table_attribs_5}}
5822 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
5823 |align=center {{table_attribs}}
5824 | <!--foo--> align=center <!--bar--> {{table_attribs}}
5825 |}
5826 !! html
5827 <table>
5828 <tr>
5829 <td style="color:red;">Foo
5830 </td>
5831 <td style="color:red;">Foo
5832 </td>
5833 <td> style="color:red;"</td>
5834 <td>Bar
5835 </td>
5836 <td style="color:red;">Foo
5837 </td>
5838 <td align="center" style="color:red;">Foo
5839 </td>
5840 <td align="center" style="color:red;">Foo
5841 </td></tr></table>
5842
5843 !! end
5844
5845 !! test
5846 2. Template-generated table cell attributes and cell content
5847 !! wikitext
5848 {|
5849 |{{table_attribs_2}}
5850 |}
5851 !! html/php
5852 <table>
5853 <tr>
5854 <td style="color:red;">Foo
5855 </td>
5856 <td>Bar</td>
5857 <td>Baz
5858 </td></tr></table>
5859
5860 !! html/parsoid
5861 <table>
5862 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
5863 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
5864 </tbody></table>
5865 !! end
5866
5867 !! test
5868 3. Template-generated table cell attributes and cell content
5869 !! wikitext
5870 {|
5871 !align=center {{table_header_cells}}
5872 |-
5873 |align=center {{table_cells}}
5874 |}
5875 !! html/php
5876 <table>
5877 <tr>
5878 <th align="center" style="color:red;">Foo</th>
5879 <th style="color:red;"><i>Bar</i></th>
5880 <th style="color:brown;"><i>Foo</i> and Baz
5881 </th></tr>
5882 <tr>
5883 <td align="center" style="color:red;">Foo</td>
5884 <td style="color:red;"><i>Bar</i></td>
5885 <td style="color:brown;"><i>Foo</i> and Baz
5886 </td></tr></table>
5887
5888 !! html/parsoid
5889 <table>
5890 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
5891 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
5892 </tbody></table>
5893 !! end
5894
5895 !! test
5896 Table with row followed by newlines and table heading
5897 !! wikitext
5898 {|
5899 |-
5900
5901 ! foo
5902 |}
5903 !! html
5904 <table>
5905
5906
5907 <tr>
5908 <th> foo
5909 </th></tr></table>
5910
5911 !! end
5912
5913 !! test
5914 Table with empty line following the start tag
5915 !! wikitext
5916 {|
5917
5918 |-
5919 | foo
5920 |}
5921 !! html
5922 <table>
5923
5924
5925 <tr>
5926 <td> foo
5927 </td></tr></table>
5928
5929 !! end
5930
5931 # FIXME: Preserve the attribute properly (with an empty string as value) in
5932 # the PHP parser. Parsoid implements the behavior below.
5933 !! test
5934 Table attributes with empty value
5935 !! wikitext
5936 {|
5937 | style=| hello
5938 |}
5939 !! html/parsoid
5940 <table>
5941 <tbody>
5942 <tr>
5943 <td style=""> hello
5944 </td></tr></tbody></table>
5945
5946 !! end
5947
5948 !! test
5949 Wikitext table with a lot of comments
5950 !! wikitext
5951 {|
5952 <!-- c0 -->
5953 | foo
5954 <!-- c1 -->
5955 |-<!-- c2 -->
5956 <!-- c3 -->
5957 |<!-- c4 -->
5958 <!-- c5 -->
5959 |}
5960 !! html
5961 <table>
5962 <tr>
5963 <td> foo
5964 </td></tr>
5965 <tr>
5966 <td>
5967 </td></tr></table>
5968
5969 !! end
5970
5971 !! test
5972 Wikitext table comments represented in parsoid dom
5973 !! wikitext
5974 {|<!--c1--><!--c2-->
5975 |-<!--c3-->
5976 | x
5977 |}
5978 !! html/php+tidy
5979 <table>
5980 <tr>
5981 <td>x</td>
5982 </tr>
5983 </table>
5984 !! html/parsoid
5985 <table><!--c1--><!--c2-->
5986 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
5987 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
5988 </tbody></table>
5989 !! end
5990
5991 !! test
5992 Wikitext table with double-line table cell
5993 !! wikitext
5994 {|
5995 |a
5996 b
5997 |}
5998 !! html
5999 <table>
6000 <tr>
6001 <td>a
6002 <p>b
6003 </p>
6004 </td></tr></table>
6005
6006 !! end
6007
6008 !! test
6009 Table cell with a single comment
6010 !! wikitext
6011 {|
6012 | <!-- c1 -->
6013 | a
6014 |}
6015 !! html
6016 <table>
6017 <tr>
6018 <td>
6019 </td>
6020 <td> a
6021 </td></tr></table>
6022
6023 !! end
6024
6025 !! test
6026 Table-cell after a comment-only-empty-line
6027 !! wikitext
6028 {|
6029 |a
6030 <!--c1-->
6031 <!--c2-->| b
6032 |}
6033 !! html
6034 <table>
6035 <tr>
6036 <td>a
6037 </td>
6038 <td> b
6039 </td></tr></table>
6040
6041 !! html/parsoid
6042 <table>
6043 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6044 <!--c1-->
6045 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6046 </tbody></table>
6047
6048 !! end
6049
6050 !! test
6051 Build table with {{!}}
6052 !! wikitext
6053 {{{!}} class="wikitable"
6054 ! header
6055 ! second header
6056 {{!}}- style="color:red;"
6057 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6058 {{!}}}
6059 !! html
6060 <table class="wikitable">
6061 <tr>
6062 <th> header
6063 </th>
6064 <th> second header
6065 </th></tr>
6066 <tr style="color:red;">
6067 <td> data </td>
6068 <td style="color:red;"> second data
6069 </td></tr></table>
6070
6071 !! end
6072
6073 !! test
6074 Build table with pipe as data
6075 !! wikitext
6076 {| class="wikitable"
6077 ! header
6078 ! second header
6079 |- style="color:red;"
6080 | data || style="color:red;" | second data
6081 |-
6082 | style="color:red;" | data with | || style="color:red;" | second data with |
6083 |-
6084 || data with | ||| second data with |
6085 |}
6086 !! html
6087 <table class="wikitable">
6088 <tr>
6089 <th> header
6090 </th>
6091 <th> second header
6092 </th></tr>
6093 <tr style="color:red;">
6094 <td> data </td>
6095 <td style="color:red;"> second data
6096 </td></tr>
6097 <tr>
6098 <td style="color:red;"> data with | </td>
6099 <td style="color:red;"> second data with |
6100 </td></tr>
6101 <tr>
6102 <td> data with | </td>
6103 <td> second data with |
6104 </td></tr></table>
6105
6106 !! end
6107
6108 !! test
6109 Build table with wikilink
6110 !! wikitext
6111 {| class="wikitable"
6112 ! header || second header
6113 |- style="color:red;"
6114 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6115 |-
6116 | data || second data [[Main Page|link|text with pipe]]
6117 |}
6118 !! html
6119 <table class="wikitable">
6120 <tr>
6121 <th> header </th>
6122 <th> second header
6123 </th></tr>
6124 <tr style="color:red;">
6125 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6126 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6127 </td></tr>
6128 <tr>
6129 <td> data </td>
6130 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6131 </td></tr></table>
6132
6133 !! end
6134
6135 # The expected HTML structure in this test is debatable. The PHP parser does
6136 # not parse this kind of table at all. The main focus for Parsoid is on
6137 # round-tripping, so this output is ok for now. TODO: revisit!
6138 !! test
6139 Wikitext table with html-syntax row
6140 !! wikitext
6141 {|
6142 |-
6143 <td>foo</td>
6144 |}
6145 !! html/parsoid
6146 <table>
6147 <tbody>
6148 <tr>
6149 <td>foo</td></tr></tbody></table>
6150 !! end
6151
6152 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6153 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6154 ## PHP parser, which tidy then compounds by fostering the content
6155 ## entirely out of the table. Parsoid recognizes the table context
6156 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6157 ## depends on PHP's treatment of broken table markup!
6158 !! test
6159 Implicit <td> after a |-
6160 !! options
6161 parsoid=wt2html,html2html
6162 !! wikitext
6163 {|
6164 |-
6165 a
6166 |}
6167 !! html/php
6168 <table>
6169
6170 a
6171 </table>
6172
6173 !! html/php+tidy
6174 <p>a</p>
6175 !! html/parsoid
6176 <table>
6177 <tr><td>a</td></tr>
6178 </table>
6179 !! end
6180
6181 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6182 !! test
6183 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6184 !! options
6185 parsoid=wt2html,html2html
6186 !! wikitext
6187 {|
6188 |-
6189 |
6190 a
6191 |-
6192 b
6193 |}
6194 !! html/php
6195 <table>
6196
6197 <tr>
6198 <td>
6199 <pre>a
6200 </pre>
6201 </td></tr>
6202 b
6203 </table>
6204
6205 !! html/php+tidy
6206 <p>b</p>
6207 <table>
6208 <tr>
6209 <td>
6210 <pre>
6211 a
6212 </pre></td>
6213 </tr>
6214 </table>
6215 !! html/parsoid
6216 <table>
6217 <tbody>
6218 <tr><td><pre>a</pre></td></tr>
6219 <tr><td> b</td></tr>
6220 </tbody>
6221 </table>
6222 !! end
6223
6224 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6225 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6226 !! test
6227 Lists should be recognized in an implicit <td> context
6228 !! options
6229 parsoid=wt2html,html2html
6230 !! wikitext
6231 {|
6232 |-
6233 *a
6234 |}
6235 !! html/php
6236 <table>
6237
6238 <ul><li>a</li></ul>
6239 </table>
6240
6241 !! html/php+tidy
6242 <ul>
6243 <li>a</li>
6244 </ul>
6245 !! html/parsoid
6246 <table>
6247 <tr>
6248 <td><ul>
6249 <li>a</li>
6250 </ul></td>
6251 </tr>
6252 </table>
6253 !! end
6254
6255 !! test
6256 Table cells not properly parsed in an implicit-td context
6257 !! wikitext
6258 {|
6259 |-
6260 {{table_attribs_4}} || a || b
6261 |}
6262 !! html/php+tidy
6263 <table>
6264 <tr>
6265 <td style="background-color:#DC241f;" width="10px"></td>
6266 <td>a</td>
6267 <td>b</td>
6268 </tr>
6269 </table>
6270 !! html/parsoid
6271 <table>
6272 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6273 <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["",{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," "]}'> </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> a </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> b</td></tr>
6274 </tbody></table>
6275 !! end
6276
6277 !! test
6278 Parsoid: Round-trip tables directly followed by content (bug 51219)
6279 !! options
6280 parsoid=wt2html,wt2wt
6281 !! wikitext
6282 {|
6283 |foo
6284 |} bar
6285
6286 {|
6287 |baz
6288 |}<b>quux</b>
6289 !! html+tidy
6290 <table>
6291 <tr>
6292 <td>foo</td>
6293 </tr>
6294 </table>
6295 <p>bar</p>
6296 <table>
6297 <tr>
6298 <td>baz</td>
6299 </tr>
6300 </table>
6301 <p><b>quux</b></p>
6302 !! end
6303
6304 !! test
6305 Parsoid: Default to a newline after tables in new content (bug 51219)
6306 !! options
6307 parsoid=html2wt
6308 !! html
6309 <table><tbody>
6310 <tr><td>foo</td></tr></tbody></table> bar
6311 <table><tbody>
6312 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6313 !! wikitext
6314 {|
6315 |foo
6316 |}
6317 <nowiki> </nowiki>bar
6318 {|
6319 |baz
6320 |}
6321 '''quux'''
6322 !! end
6323
6324 !! test
6325 Parsoid: newline inducing block nodes don't suppress <nowiki>
6326 !! options
6327 parsoid=html2wt
6328 !! html
6329 a<h1>foo</h1>
6330 !! wikitext
6331 <nowiki> </nowiki>a
6332
6333 = foo =
6334 !! end
6335
6336 !! test
6337 Parsoid: Row-syntax table headings followed by comment & table cells
6338 !! options
6339 parsoid=wt2html,wt2wt
6340 !! wikitext
6341 {|
6342 ! foo || bar
6343 <!-- foo --> || baz || quux
6344 |}
6345 !! html/php
6346 <table>
6347 <tr>
6348 <th> foo </th>
6349 <th> bar
6350 </th>
6351 <td> baz </td>
6352 <td> quux
6353 </td></tr></table>
6354
6355 !! html/parsoid
6356 <table>
6357 <tbody><tr><th> foo </th><th> bar
6358 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6359 </tbody></table>
6360 !! end
6361
6362
6363 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6364 # preserves it.
6365 !!test
6366 Parsoid: Recover better from broken table attributes
6367 !!options
6368 parsoid=wt2html
6369 !!wikitext
6370 {| class="foo
6371 | class="bar" |
6372 foo
6373 |}
6374 !!html/php+tidy
6375 <table>
6376 <tr>
6377 <td class="bar">
6378 <p>foo</p>
6379 </td>
6380 </tr>
6381 </table>
6382 !!html/parsoid
6383 <table class="foo">
6384 <tr>
6385 <td class="bar">
6386 <p>foo</p></td></tr>
6387 </tbody></table>
6388 !!end
6389
6390 !! test
6391 Strip unsupported table tags
6392 !! options
6393 parsoid=html2wt
6394 !! html
6395 <table>
6396 <thead>
6397 <tr>
6398 <th>Month</th>
6399 <th>Savings</th>
6400 </tr>
6401 </thead>
6402 <tbody>
6403 <tr>
6404 <td>January</td>
6405 <td>$100</td>
6406 </tr>
6407 <tr>
6408 <td>February</td>
6409 <td>$80</td>
6410 </tr>
6411 </tbody>
6412 <tfoot>
6413 <tr>
6414 <td>Sum</td>
6415 <td>$180</td>
6416 </tr>
6417 </tfoot>
6418 </table>
6419 !! wikitext
6420 {|
6421
6422 !Month
6423 !Savings
6424
6425 |January
6426 |$100
6427
6428 |-
6429 |February
6430 |$80
6431
6432 |Sum
6433 |$180
6434
6435 |}
6436 !! end
6437
6438 !!test
6439 Testing serialization after deletion of table cells
6440 !!options
6441 parsoid={
6442 "modes": ["wt2wt", "selser"],
6443 "changes": [
6444 ["#x", "remove"]
6445 ]
6446 }
6447 !!wikitext
6448 {|
6449 !h1 !!h2 !!h3
6450 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
6451 |}
6452 !! wikitext/edited
6453 {|
6454 !h1 !!h2 !!h3
6455 |c2 |||c3
6456 |}
6457 !!end
6458
6459 ###
6460 ### Internal links
6461 ###
6462 !! test
6463 Plain link, capitalized
6464 !! wikitext
6465 [[Main Page]]
6466 !! html
6467 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6468 </p>
6469 !! end
6470
6471 !! test
6472 Plain link, uncapitalized
6473 !! wikitext
6474 [[main Page]]
6475 !! html
6476 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6477 </p>
6478 !! end
6479
6480 !! test
6481 Piped link
6482 !! wikitext
6483 [[Main Page|The Main Page]]
6484 !! html
6485 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6486 </p>
6487 !! end
6488
6489 !! test
6490 Piped link with comment in link text
6491 !! wikitext
6492 [[Main Page|The Main<!--front--> Page]]
6493 !! html
6494 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6495 </p>
6496 !! end
6497
6498 !! test
6499 Piped link with multiple pipe characters in link text
6500 !! wikitext
6501 [[Main Page||The|Main|Page|]]
6502 !! html/php
6503 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6504 </p>
6505 !! html/parsoid
6506 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6507 !! end
6508
6509 !! test
6510 Broken link
6511 !! wikitext
6512 [[Zigzagzogzagzig]]
6513 !! html
6514 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6515 </p>
6516 !! end
6517
6518 !! test
6519 Broken link with fragment
6520 !! wikitext
6521 [[Zigzagzogzagzig#zug]]
6522 !! html
6523 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6524 </p>
6525 !! end
6526
6527 !! test
6528 Special page link with fragment
6529 !! wikitext
6530 [[Special:Version#anchor]]
6531 !! html
6532 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6533 </p>
6534 !! end
6535
6536 !! test
6537 Nonexistent special page link with fragment
6538 !! wikitext
6539 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6540 !! html
6541 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6542 </p>
6543 !! end
6544
6545 !! test
6546 Link with prefix
6547 !! wikitext
6548 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6549 !! html
6550 <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>
6551 </p>
6552 !! end
6553
6554 !! test
6555 Link with suffix
6556 !! wikitext
6557 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6558 !! html
6559 <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>!!!
6560 </p>
6561 !! end
6562
6563 !! article
6564 prefixed article
6565 !! text
6566 Some text
6567 !! endarticle
6568
6569 !! test
6570 Bug 43661: Piped links with identical prefixes
6571 !! wikitext
6572 [[prefixed article|prefixed articles with spaces]]
6573
6574 [[prefixed article|prefixed articlesaoeu]]
6575
6576 [[Main Page|Main Page test]]
6577 !! html
6578 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6579 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6580 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6581 </p>
6582 !! end
6583
6584
6585 !! test
6586 Link with HTML entity in suffix / tail
6587 !! wikitext
6588 [[Main Page]]&quot;, [[Main Page]]&#97;
6589 !! html/php
6590 <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;
6591 </p>
6592 !! html/parsoid
6593 <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>
6594 !! end
6595
6596 !! test
6597 Link with 3 brackets
6598 !! wikitext
6599 [[[Main Page]]]
6600 !! html
6601 <p>[[[Main Page]]]
6602 </p>
6603 !! end
6604
6605 !! test
6606 Link with 4 brackets
6607 !! wikitext
6608 [[[[Main Page]]]]
6609 !! html
6610 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6611 </p>
6612 !! end
6613
6614 !! test
6615 Piped link with 3 brackets
6616 !! wikitext
6617 [[[main page|the main page]]]
6618 !! html
6619 <p>[[[main page|the main page]]]
6620 </p>
6621 !! end
6622
6623 !! test
6624 Piped link with extlink-like text
6625 !! wikitext
6626 [[Main Page|[bar]]]
6627 [[Main Page|This is a [bar]]]
6628 !! html/php
6629 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6630 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6631 </p>
6632 !! html/parsoid
6633 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
6634 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
6635 !! end
6636
6637 !! test
6638 Link with multiple pipes
6639 !! wikitext
6640 [[Main Page|The|Main|Page]]
6641 !! html
6642 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6643 </p>
6644 !! end
6645
6646 # Note that parsoid does not munge anchor text; all non-space
6647 # characters are valid in HTML5 ids.
6648 !! test
6649 Anchor containing a #. (bug 63430)
6650 !! wikitext
6651 [[Main Page#And#Link]]
6652 !! html/php
6653 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6654 </p>
6655 !! html/parsoid
6656 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6657 !! end
6658
6659 !! test
6660 Link to namespaces
6661 !! wikitext
6662 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6663 !! html
6664 <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>
6665 </p>
6666 !! end
6667
6668 !! test
6669 Link with space in namespace
6670 !! wikitext
6671 [[User talk:Foo bar]]
6672 !! html
6673 <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>
6674 </p>
6675 !! end
6676
6677 !! article
6678 MemoryAlpha:AlphaTest
6679 !! text
6680 This is an article in the MemoryAlpha namespace
6681 (which shadows the memoryalpha interwiki link).
6682 !! endarticle
6683
6684 !! test
6685 Namespace takes precedence over interwiki link (bug 51680)
6686 !! wikitext
6687 [[MemoryAlpha:AlphaTest]]
6688 !! html
6689 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6690 </p>
6691 !! end
6692
6693 # The previous test doesn't work correctly in html2*, due to not recognizing the
6694 # link as an internal one. This one checks for the correct behavior.
6695 !! test
6696 Link to namespace preferred over interwiki with correct rel attribute
6697 !! options
6698 parsoid=html2wt,html2html
6699 !! html
6700 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
6701 !! wikitext
6702 [[MemoryAlpha:AlphaTest]]
6703 !! end
6704
6705 !! test
6706 Piped link to namespace
6707 !! wikitext
6708 [[Meta:Disclaimers|The disclaimers]]
6709 !! html
6710 <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>
6711 </p>
6712 !! end
6713
6714 !! test
6715 Link containing }
6716 !! wikitext
6717 [[Usually caused by a typo (oops}]]
6718 !! html
6719 <p>[[Usually caused by a typo (oops}]]
6720 </p>
6721 !! end
6722
6723 !! article
6724 7% Solution
6725 !! text
6726 Just a test of an article title containing a percent.
6727 !! endarticle
6728
6729 !! test
6730 Link containing % (not as a hex sequence)
6731 !! wikitext
6732 [[7% Solution]]
6733 !! html/php
6734 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6735 </p>
6736 !! html/parsoid
6737 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6738 !! end
6739
6740 # note that the parsoid HTML is identical to the previous test output,
6741 # so the previous test ensures that the html2wt mode will generate the
6742 # "not as a hex sequence" wikitext.
6743 !! test
6744 Link containing % as a single hex sequence interpreted to char
6745 !! options
6746 parsoid=wt2wt,wt2html,html2html
6747 !! wikitext
6748 [[7%25 Solution]]
6749 !! html/php
6750 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6751 </p>
6752 !! html/parsoid
6753 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6754 !!end
6755
6756 !! test
6757 Link containing % as a double hex sequence interpreted to hex sequence
6758 !! wikitext
6759 [[7%2525 Solution]]
6760 !! html
6761 <p>[[7%2525 Solution]]
6762 </p>
6763 !!end
6764
6765 # note that parsoid does not munge anchor text; all non-space
6766 # characters are valid in HTML5 anchors.
6767 !! test
6768 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6769 Example for such a section: == < ==
6770 !! wikitext
6771 [[%23%3c]][[%23%3e]]
6772 !! html/php
6773 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6774 </p>
6775 !! html/parsoid
6776 <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>
6777 !! end
6778
6779 !! test
6780 Link containing "<#" and ">#" as a hex sequences
6781 !! wikitext
6782 [[%3c%23]][[%3e%23]]
6783 !! html
6784 <p>[[%3c%23]][[%3e%23]]
6785 </p>
6786 !! end
6787
6788 !! test
6789 Link containing an equals sign
6790 !! wikitext
6791 [[Special:BookSources/isbn=4-00-026157-6]]
6792 !! html/php
6793 <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>
6794 </p>
6795 !! html/parsoid
6796 <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>
6797 !! end
6798
6799 !! article
6800 Foo~bar
6801 !! text
6802 Just a test of an article title containing a tilde.
6803 !! endarticle
6804
6805 # note that links containing signatures, like [[Foo~~~~]], are
6806 # massaged by the pre-save transform (PST) and so the tildes are never
6807 # seen by the parser.
6808 !! test
6809 Link containing a tilde
6810 !! wikitext
6811 [[Foo~bar]]
6812 !! html/php
6813 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6814 </p>
6815 !! html/parsoid
6816 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6817 !! end
6818
6819 !! test
6820 Link containing double-single-quotes '' (bug 4598)
6821 !! wikitext
6822 [[Lista d''e paise d''o munno]]
6823 !! html/php
6824 <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>
6825 </p>
6826 !! html/parsoid
6827 <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>
6828 !! end
6829
6830 !! test
6831 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6832 !! wikitext
6833 Some [[Link|pretty ''italics'' and stuff]]!
6834 !! html/php
6835 <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>!
6836 </p>
6837 !! html/parsoid
6838 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6839 !! end
6840
6841 !! test
6842 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6843 !! wikitext
6844 ''Some [[Link|pretty ''italics'' and stuff]]!''
6845 !! html
6846 <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>
6847 </p>
6848 !! end
6849
6850 !! test
6851 Link with double quotes in title part (literal) and alternate part (interpreted)
6852 !! wikitext
6853 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
6854
6855 [[''Pentecoste'']]
6856
6857 [[''Pentecoste''|Pentecoste]]
6858
6859 [[''Pentecoste''|''Pentecoste'']]
6860 !! html/php
6861 <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>
6862 </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>
6863 </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>
6864 </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>
6865 </p>
6866 !! html/parsoid
6867 <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>
6868 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6869 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6870 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6871 !! end
6872
6873 !! test
6874 Broken image links with HTML captions (bug 39700)
6875 !! wikitext
6876 [[File:Nonexistent|<script></script>]]
6877 [[File:Nonexistent|100x100px|<script></script>]]
6878 [[File:Nonexistent|&lt;]]
6879 [[File:Nonexistent|a<i>b</i>c]]
6880 !! html/php
6881 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6882 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6883 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6884 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6885 </p>
6886 !! html/parsoid
6887 <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>
6888 <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>
6889 <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>
6890 <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>
6891 !! end
6892
6893 !! test
6894 Plain link to URL
6895 !! wikitext
6896 [[http://www.example.com]]
6897 !! html/php
6898 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6899 </p>
6900 !! html/parsoid
6901 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6902 !! end
6903
6904 !! test
6905 Plain link to URL with link text
6906 !! wikitext
6907 [[http://www.example.com Link text]]
6908 !! html
6909 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6910 </p>
6911 !! end
6912
6913 !! test
6914 Plain link to protocol-relative URL
6915 !! wikitext
6916 [[//www.example.com]]
6917 !! html/php
6918 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6919 </p>
6920 !! html/parsoid
6921 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6922 !! end
6923
6924 !! test
6925 Plain link to protocol-relative URL with link text
6926 !! wikitext
6927 [[//www.example.com Link text]]
6928 !! html
6929 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6930 </p>
6931 !! end
6932
6933 !! test
6934 Plain link to page with question mark in title
6935 !! wikitext
6936 [[A?b]]
6937
6938 [[A?b|Baz]]
6939 !! html
6940 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6941 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6942 </p>
6943 !! end
6944
6945
6946 # I'm fairly sure the expected result here is wrong.
6947 # We want these to be URL links, not pseudo-pages with URLs for titles....
6948 # However the current output is also pretty screwy.
6949 #
6950 # ----
6951 # I'm changing it to match the current output--it arguably makes more
6952 # sense in the light of the test above. Old expected result was:
6953 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6954 #</p>
6955 # But I think this test is bordering on "garbage in, garbage out" anyway.
6956 # -- wtm
6957 !! test
6958 Piped link to URL
6959 !! wikitext
6960 Piped link to URL: [[http://www.example.com|an example URL]]
6961 !! html/php
6962 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6963 </p>
6964 !! html/parsoid
6965 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6966 !! end
6967
6968 !! test
6969 BUG 2: [[page|http://url/]] should link to page, not http://url/
6970 !! wikitext
6971 [[Main Page|http://url/]]
6972 !! html/php
6973 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6974 </p>
6975 !! html/parsoid
6976 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6977 !! end
6978
6979 # Parsoid does not mark self-links, by design.
6980 !! test
6981 BUG 337: Escaped self-links should be bold
6982 !! options
6983 title=[[Bug462]]
6984 !! wikitext
6985 [[Bu&#103;462]] [[Bug462]]
6986 !! html/php
6987 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6988 </p>
6989 !! html/php+tidy
6990 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6991 !! html/parsoid
6992 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6993 !! end
6994
6995 !! test
6996 Self-link to section should not be bold
6997 !! options
6998 title=[[Main Page]]
6999 !! wikitext
7000 [[Main Page#section]]
7001 !! html
7002 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7003 </p>
7004 !! end
7005
7006 !! article
7007 00
7008 !! text
7009 This is 00.
7010 !! endarticle
7011
7012 !!test
7013 Self-link to numeric title
7014 !!options
7015 title=[[0]]
7016 !! wikitext
7017 [[0]]
7018 !! html
7019 <p><strong class="selflink">0</strong>
7020 </p>
7021 !!end
7022
7023 !!test
7024 Link to numeric-equivalent title
7025 !!options
7026 title=[[0]]
7027 !! wikitext
7028 [[00]]
7029 !! html
7030 <p><a href="/wiki/00" title="00">00</a>
7031 </p>
7032 !!end
7033
7034 !! test
7035 <nowiki> inside a link
7036 !! wikitext
7037 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7038 !! html
7039 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7040 </p>
7041 !! end
7042
7043 !! test
7044 Non-breaking spaces in title
7045 !! wikitext
7046 [[&nbsp; Main &nbsp; Page &nbsp;]]
7047 !! html
7048 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7049 </p>
7050 !!end
7051
7052 !! test
7053 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7054 !! options
7055 language=ca
7056 !! wikitext
7057 '''[[Main Page]]'''
7058 !! html
7059 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7060 </p>
7061 !! end
7062
7063 !! test
7064 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7065 !! options
7066 language=ca
7067 !! wikitext
7068 ''[[Main Page]]''
7069 !! html
7070 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7071 </p>
7072 !! end
7073
7074 !! test
7075 Internal link with en linktrail: no apostrophes (bug 27473)
7076 !! options
7077 language=en
7078 !! wikitext
7079 [[Something]]'nice
7080 !! html
7081 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7082 </p>
7083 !! end
7084
7085 !! test
7086 Internal link with ca linktrail with apostrophes (bug 27473)
7087 !! options
7088 language=ca
7089 !! wikitext
7090 [[Something]]'nice
7091 !! html
7092 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7093 </p>
7094 !! end
7095
7096 !! test
7097 Internal link with kaa linktrail with apostrophes (bug 27473)
7098 !! options
7099 language=kaa
7100 !! wikitext
7101 [[Something]]'nice
7102 !! html
7103 <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>
7104 </p>
7105 !! end
7106
7107 !! test
7108 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7109 !! wikitext
7110 [[User:Foo/Test/63636:Bar|Test]]
7111 !! html/php
7112 <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>
7113 </p>
7114 !! html/parsoid
7115 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7116 !! end
7117
7118 !! test
7119 Purely hash wikilink
7120 !! options
7121 title=[[User:test/123]]
7122 !! wikitext
7123 [[#a|b]]
7124 !! html/php
7125 <p><a href="#a">b</a>
7126 </p>
7127 !! html/parsoid
7128 <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>
7129 !! end
7130
7131 !! test
7132 1. Interaction of linktrail and template encapsulation
7133 !! options
7134 parsoid
7135 !! wikitext
7136 {{echo|[[Foo]]}}l
7137 !! html
7138 <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>
7139 !! end
7140
7141 !! test
7142 2. Interaction of linktrail and template encapsulation
7143 !! options
7144 parsoid
7145 !! wikitext
7146 {{echo|Some [[Fool]]}}s
7147 !! html
7148 <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>
7149 !! end
7150
7151 !! test
7152 3. Interaction of linktrail and template encapsulation
7153 !! options
7154 parsoid
7155 !! wikitext
7156 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7157 !! html
7158 <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>
7159 !! end
7160
7161 !! article
7162 Söfnuður
7163 !! text
7164 Test.
7165 !! endarticle
7166
7167 !! test
7168 Internal link with is link prefix
7169 !! options
7170 language=is
7171 !! wikitext
7172 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7173 !! html
7174 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7175 </p>
7176 !! end
7177
7178 !! article
7179 Mótmælendatrú
7180 !! text
7181 Test.
7182 !! endarticle
7183
7184 !! test
7185 Internal link with is link trail and link prefix
7186 !! options
7187 language=is
7188 !! wikitext
7189 [[mótmælendatrú|xxx]]ar
7190 [[mótmælendatrú]]ar
7191 mótmælenda[[söfnuður]]
7192 mótmælenda[[söfnuður|söfnuðir]]
7193 mótmælenda[[söfnuður|söfnuðir]]xxx
7194 !! html
7195 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7196 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7197 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7198 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7199 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7200 </p>
7201 !! end
7202
7203 !! test
7204 Parsoid link trail escaping
7205 !! options
7206 parsoid=html2wt,html2html
7207 !! html
7208 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7209 !! wikitext
7210 [[apple]]<nowiki/>s
7211 !! end
7212
7213 !! test
7214 Parsoid link prefix escaping
7215 !! options
7216 language=is
7217 parsoid=html2wt,html2html
7218 !! html
7219 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7220 !! wikitext
7221 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7222 !! end
7223
7224 !! test
7225 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7226 !! wikitext
7227 [[Foo| bar]]
7228
7229 [[Foo| ''bar'']]
7230
7231 [http://wp.org foo]
7232
7233 [http://wp.org ''foo'']
7234 !! html
7235 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7236 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7237 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7238 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7239 </p>
7240 !! end
7241
7242 !! test
7243 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7244 !! options
7245 parsoid
7246 !! wikitext
7247 [[Foo|{{echo|a}} b {{echo|c}}]]
7248 !! html
7249 <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>
7250 !! end
7251
7252 !! test
7253 Link with angle bracket after anchor
7254 !! wikitext
7255 [[Foo#<bar>]]
7256 !! html/php
7257 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7258 </p>
7259 !! html/parsoid
7260 <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>
7261 !! end
7262
7263 ###
7264 ### Interwiki links (see maintenance/interwiki.sql)
7265 ###
7266
7267 !! test
7268 Inline interwiki link
7269 !! options
7270 parsoid=wt2html,wt2wt,html2html
7271 !! wikitext
7272 [[MeatBall:SoftSecurity]]
7273 !! html/php
7274 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7275 </p>
7276 !! html/parsoid
7277 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7278 !! end
7279
7280 !! test
7281 Inline interwiki link with empty title (bug 2372)
7282 !! options
7283 parsoid=wt2html,wt2wt,html2html
7284 !! wikitext
7285 [[MeatBall:]]
7286 !! html/php
7287 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7288 </p>
7289 !! html/parsoid
7290 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7291 !! end
7292
7293 !! test
7294 Interwiki link encoding conversion (bug 1636)
7295 !! wikitext
7296 *[[Wikipedia:ro:Olteni&#0355;a]]
7297 *[[Wikipedia:ro:Olteni&#355;a]]
7298 !! html
7299 <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>
7300 <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>
7301
7302 !! html+tidy
7303 <ul>
7304 <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>
7305 <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>
7306 </ul>
7307 !! end
7308
7309 !! test
7310 Interwiki link with fragment (bug 2130)
7311 !! wikitext
7312 [[MeatBall:SoftSecurity#foo]]
7313 !! html
7314 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7315 </p>
7316 !! end
7317
7318 # Ideally the wikipedia: prefix here should be proto-relative too
7319 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7320 # define the 'en' prefix, and originally the test used 'wikipedia',
7321 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7322 # article.
7323 !! test
7324 Different interwiki prefixes mapping to the same URL
7325 !! wikitext
7326 [[:en:Foo]]
7327
7328 [[:en:Foo|Foo]]
7329
7330 [[wikipedia:Foo]]
7331
7332 [[:wikipedia:Foo|Foo]]
7333
7334 [[wikipedia:en:Foo]]
7335
7336 [[:wikipedia:en:Foo]]
7337
7338 [[ wikiPEdia :Foo]]
7339 !! html/parsoid
7340 <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>
7341
7342 <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>
7343
7344 <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>
7345
7346 <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>
7347
7348 <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>
7349
7350 <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>
7351
7352 <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>
7353 !! end
7354
7355 !! test
7356 Interwiki links that cannot be represented in wiki syntax
7357 !! wikitext
7358 [[meatball:ok]]
7359 [[meatball:ok#foo|ok with fragment]]
7360 [[meatball:ok_as_well?|ok ending with ? mark]]
7361 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7362 [http://de.wikipedia.org/wiki/#foo is just fragment]
7363
7364 !! html/php
7365 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7366 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7367 <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>
7368 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7369 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7370 </p>
7371 !! html/parsoid
7372 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7373 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7374 <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>
7375 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7376 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7377 !! end
7378
7379 !! test
7380 Interwiki links: trail
7381 !! wikitext
7382 [[wikipedia:Foo|Ba]]r
7383 !! html/php
7384 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7385 </p>
7386 !! html/parsoid
7387 <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>
7388 !! end
7389
7390 !! test
7391 Local interwiki link
7392 !! options
7393 parsoid=wt2html,wt2wt,html2html
7394 !! wikitext
7395 [[local:Template:Foo]]
7396 !! html/php
7397 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7398 </p>
7399 !! html/parsoid
7400 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7401 !! end
7402
7403 # Parsoid does not mark self-links, by design.
7404 !! test
7405 Local interwiki link: self-link to current page
7406 !! options
7407 title=[[Main Page]]
7408 parsoid=wt2html,wt2wt,html2html
7409 !! wikitext
7410 [[local:Main Page]]
7411 !! html/php
7412 <p><strong class="selflink">local:Main Page</strong>
7413 </p>
7414 !! html/parsoid
7415 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7416 !! end
7417
7418 !! test
7419 Local interwiki link: prefix only (bug 64167)
7420 !! options
7421 parsoid=wt2html,wt2wt,html2html
7422 !! wikitext
7423 [[local:]]
7424 !! html/php
7425 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7426 </p>
7427 !! html/parsoid
7428 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7429 !! end
7430
7431 !! test
7432 Local interwiki link: with additional interwiki prefix (bug 61357)
7433 !! options
7434 parsoid=wt2html,wt2wt,html2html
7435 !! wikitext
7436 [[local:meatball:Hello]]
7437 !! html/php
7438 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7439 </p>
7440 !! html/parsoid
7441 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7442 !! end
7443
7444 !! test
7445 Multiple local interwiki link prefixes
7446 !! wikitext
7447 [[local:local:local:local:mi:local:Foo]]
7448 !! options
7449 parsoid=wt2html,wt2wt,html2html
7450 !! html/php
7451 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7452 </p>
7453 !! html/parsoid
7454 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7455 !! end
7456
7457 ###
7458 ### Interlanguage links
7459 ### Language links (so that searching for '### language' matches..)
7460 ###
7461
7462 !! test
7463 Interlanguage link
7464 !! options
7465 parsoid=wt2html,wt2wt,html2html
7466 !! wikitext
7467 Blah blah blah
7468 [[zh:Chinese]]
7469 !! html/php
7470 <p>Blah blah blah
7471 </p>
7472 !! html/parsoid
7473 <p>Blah blah blah</p>
7474 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7475 !! end
7476
7477 !! test
7478 Interlanguage link with spacing
7479 !! options
7480 parsoid=wt2html,wt2wt,html2html
7481 !! wikitext
7482 Blah blah blah
7483 [[ zh : Chinese ]]
7484 !! html/php
7485 <p>Blah blah blah
7486 </p>
7487 !! html/parsoid
7488 <p>Blah blah blah</p>
7489 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7490 !! end
7491
7492 !! test
7493 Double interlanguage link
7494 !! options
7495 parsoid=wt2html,wt2wt,html2html
7496 !! wikitext
7497 Blah blah blah
7498 [[es:Spanish]]
7499 [[zh:Chinese]]
7500 !! html/php
7501 <p>Blah blah blah
7502 </p>
7503 !! html/parsoid
7504 <p>Blah blah blah</p>
7505 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7506 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7507 !! end
7508
7509 !! test
7510 Interlanguage link variations
7511 !! options
7512 parsoid=wt2html,wt2wt,html2html
7513 !! wikitext
7514 Blah blah blah
7515 [[ es :Spanish]]
7516 [[ ZH :Chinese]]
7517 [[es:Foo_bar]]
7518 [[es:Foo bar]]
7519 !! html/php
7520 <p>Blah blah blah
7521 </p>
7522 !! html/parsoid
7523 <p>Blah blah blah</p>
7524 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7525 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7526 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7527 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7528 !! end
7529
7530 !! test
7531 Interlanguage link, with prefix links
7532 !! options
7533 language=ln
7534 !! wikitext
7535 Blah blah blah
7536 [[zh:Chinese]]
7537 !! html/php
7538 <p>Blah blah blah
7539 </p>
7540 !! html/parsoid
7541 <p>Blah blah blah</p>
7542 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7543 !! end
7544
7545 !! test
7546 Double interlanguage link, with prefix links (bug 8897)
7547 !! options
7548 language=ln
7549 !! wikitext
7550 Blah blah blah
7551 [[es:Spanish]]
7552 [[zh:Chinese]]
7553 !! html/php
7554 <p>Blah blah blah
7555 </p>
7556 !! html/parsoid
7557 <p>Blah blah blah</p>
7558 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7559 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7560 !! end
7561
7562 !! test
7563 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7564 !! wikitext
7565 Blah blah blah
7566 [[mul:Article]]
7567 !! html/php
7568 <p>Blah blah blah
7569 </p>
7570 !! html/parsoid
7571 <p>Blah blah blah</p>
7572 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7573 !! end
7574
7575 !! test
7576 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7577 !! options
7578 language=ln
7579 !! wikitext
7580 [[WW&nbsp;II]]
7581 !! html
7582 <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>
7583 </p>
7584 !! end
7585
7586 !! test
7587 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7588 !! options
7589 parsoid=html2wt
7590 !! html
7591 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7592 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7593 !! wikitext
7594 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7595
7596 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7597 !! end
7598
7599 !! test
7600 Parsoid: handle constructor well
7601 !! wikitext
7602 [[constructor]]
7603
7604 [[constructor:foo]]
7605 !! html/php
7606 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7607 </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>
7608 </p>
7609 !! html/parsoid
7610 <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>
7611
7612 <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>
7613 !! end
7614
7615 !! article
7616 ko:
7617 !! text
7618 Test.
7619 !! endarticle
7620
7621 # Note that `ko` isn't a known interlanguage prefix
7622 !! test
7623 Parsoid: recognize interlanguage links without a target page
7624 !! options
7625 ill
7626 !! wikitext
7627 [[es:]]
7628
7629 [[ko:]]
7630 !! html/php
7631 es:
7632 !! html/parsoid
7633 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7634
7635 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7636 !! end
7637
7638 # Note that `ko` isn't a known interwiki prefix
7639 !! test
7640 Parsoid: recognize interwiki links without a target page
7641 !! options
7642 parsoid=wt2html,wt2wt,html2html
7643 !! wikitext
7644 [[:es:]]
7645
7646 [[:ko:]]
7647 !! html/php
7648 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7649 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7650 </p>
7651 !! html/parsoid
7652 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7653 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7654 !! end
7655
7656 !! test
7657 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7658 !! wikitext
7659 [[mi:Foo]]
7660 !! html/php
7661 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7662 </p>
7663 !! html/parsoid
7664 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7665 !! end
7666
7667 !! test
7668 Interlanguage link with preceding local interwiki link (bug 68085)
7669 !! options
7670 parsoid=wt2html,wt2wt,html2html
7671 !! wikitext
7672 Blah blah blah
7673 [[local:es:Spanish]]
7674 !! html/php
7675 <p>Blah blah blah
7676 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7677 </p>
7678 !! html/parsoid
7679 <p>Blah blah blah
7680 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7681 !! end
7682
7683 !! test
7684 Looks like an interlanguage link, but is actually a local interwiki
7685 !! options
7686 parsoid=wt2html,wt2wt,html2html
7687 !! wikitext
7688 Blah blah blah
7689 [[mi:Template:Foo]]
7690 !! html/php
7691 <p>Blah blah blah
7692 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7693 </p>
7694 !! html/parsoid
7695 <p>Blah blah blah
7696 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7697 !! end
7698
7699 ###
7700 ### Redirects, Parsoid-only
7701 ###
7702
7703 !! test
7704 1. Simple redirect to page
7705 !! options
7706 parsoid
7707 !! wikitext
7708 #REDIRECT [[Main Page]]
7709 !! html
7710 <link rel="mw:PageProp/redirect" href="./Main_Page">
7711 !! end
7712
7713 !! test
7714 2. Other redirect variants
7715 !! wikitext
7716 #REDIRECT [[Main_Page]]
7717 !! html/parsoid
7718 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
7719 !! end
7720
7721 !! test
7722 3. Other redirect variants
7723 !! wikitext
7724 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
7725 !! html/parsoid
7726 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./%5B%5BBar%5D%5D"},"sa":{"href":"&lt;nowiki>[[Bar]]&lt;/nowiki>"}}'/>
7727 !! end
7728
7729 !! test
7730 Empty redirect
7731 !! options
7732 parsoid=wt2html,wt2wt
7733 !! wikitext
7734 #REDIRECT [[]]
7735 !! html
7736 <ol>
7737 <li>REDIRECT [[]]</li></ol>
7738 !! end
7739
7740 !! test
7741 Optional colon in #REDIRECT
7742 !! options
7743 # the colon is archaic syntax. we support it for wt2html, but we
7744 # don't care that it roundtrips back to the modern syntax.
7745 parsoid=wt2html,html2html
7746 !! wikitext
7747 #REDIRECT:[[Main Page]]
7748 !! html
7749 <link rel="mw:PageProp/redirect" href="./Main_Page">
7750 !! end
7751
7752 !! test
7753 Whitespace in #REDIRECT with optional colon
7754 !! options
7755 # the colon and gratuitous whitespace is archaic syntax. we support
7756 # it for wt2html, but we don't care that it roundtrips back to the
7757 # modern syntax (without extra whitespace)
7758 parsoid=wt2html,html2html
7759 !! wikitext
7760
7761 #REDIRECT
7762 :
7763 [[Main Page]]
7764 !! html
7765 <link rel="mw:PageProp/redirect" href="./Main_Page">
7766 !! end
7767
7768 !! test
7769 Piped link in #REDIRECT
7770 !! options
7771 # content after piped link is ignored. we support this syntax,
7772 # but don't care that the piped link is lost when we roundtrip this.
7773 parsoid=wt2html
7774 !! wikitext
7775 #REDIRECT [[Main Page|bar]]
7776 !! html
7777 <link rel="mw:PageProp/redirect" href="./Main_Page">
7778 !! end
7779
7780 !! test
7781 Redirect to category
7782 !! options
7783 parsoid=wt2wt,wt2html
7784 !! wikitext
7785 #REDIRECT [[Category:Foo]]
7786 !! html
7787 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7788 !! end
7789
7790 !! test
7791 Redirect to category with URL encoding
7792 !! options
7793 parsoid=wt2html
7794 !! wikitext
7795 #REDIRECT [[Category%3AFoo]]
7796 !! html
7797 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7798 !! end
7799
7800 !! test
7801 Redirect to category page
7802 !! options
7803 parsoid
7804 !! wikitext
7805 #REDIRECT [[:Category:Foo]]
7806 !! html
7807 <link rel="mw:PageProp/redirect" href="Category:Foo" title="Category:Foo"/>
7808 !! end
7809
7810 !! test
7811 Redirect to image page (1)
7812 !! options
7813 parsoid
7814 !! wikitext
7815 #REDIRECT [[File:Wiki.png]]
7816 !! html
7817 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7818 !! end
7819
7820 !! test
7821 Redirect to image page (2)
7822 !! options
7823 parsoid
7824 !! wikitext
7825 #REDIRECT [[Image:Wiki.png]]
7826 !! html
7827 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7828 !! end
7829
7830 !! test
7831 Redirect to language
7832 !! options
7833 parsoid
7834 !! wikitext
7835 #REDIRECT [[en:File:Wiki.png]]
7836 !! html
7837 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7838 !! end
7839
7840 !! test
7841 Redirect to interwiki
7842 !! options
7843 parsoid
7844 !! wikitext
7845 #REDIRECT [[meatball:File:Wiki.png]]
7846 !! html
7847 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7848 !! end
7849
7850 !! test
7851 Non-English #REDIRECT
7852 !! options
7853 parsoid
7854 language=is
7855 !! wikitext
7856 #TILVÍSUN [[Main Page]]
7857 !! html
7858 <link rel="mw:PageProp/redirect" href="./Main_Page">
7859 !! end
7860
7861 !! test
7862 Redirect syntax under text isn't considered a redirect
7863 !! wikitext
7864 some text
7865 #redirect [[Main Page]]
7866 !! html/parsoid
7867 <p>some text</p>
7868 <ol data-parsoid='{}'><li data-parsoid='{}'>redirect <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'>Main Page</a></li></ol>
7869 !! end
7870
7871 # FIXME: Should hoist the redirect to the top of the page and ensure there
7872 # is only one.
7873 !! test
7874 New redirect
7875 !! options
7876 parsoid=html2wt
7877 !! html
7878 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7879 !! wikitext
7880 Foo
7881 #REDIRECT [[Foo]]
7882 !! end
7883
7884 ##
7885 ## XHTML tidiness
7886 ###
7887
7888 !! test
7889 <br> to <br />
7890 !! wikitext
7891 1<br>2<br />3
7892 !! html
7893 <p>1<br />2<br />3
7894 </p>
7895 !! end
7896
7897 !! test
7898 Broken br tag sanitization
7899 !! wikitext
7900 </br>
7901 !! html/php
7902 <p>&lt;/br&gt;
7903 </p>
7904 !! end
7905
7906 # TODO: Fix html2html mode (bug 51055)!
7907 !! test
7908 Parsoid: Broken br tag recognition
7909 !! options
7910 parsoid=wt2html
7911 !! wikitext
7912 </br>
7913
7914 <br/ >
7915 !! html+tidy
7916 <p><br /></p>
7917 <p><br /></p>
7918 !! end
7919
7920 !! test
7921 Incorrecly removing closing slashes from correctly formed XHTML
7922 !! wikitext
7923 <br style="clear:both;" />
7924 !! html
7925 <p><br style="clear:both;" />
7926 </p>
7927 !! end
7928
7929 !! test
7930 Failing to transform badly formed HTML into correct XHTML
7931 !! wikitext
7932 <br style="clear: left;">
7933 <br style="clear: right;">
7934 <br style="clear: both;">
7935 !! html
7936 <p><br style="clear: left;" />
7937 <br style="clear: right;" />
7938 <br style="clear: both;" />
7939 </p>
7940 !!end
7941
7942 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
7943 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
7944 !! test
7945 Handling html with a div self-closing tag
7946 !! wikitext
7947 <div title />
7948 <div title/>
7949 <div title/ >
7950 <div title=bar />
7951 <div title=bar/>
7952 <div title=bar/ >
7953 !! html/php
7954 <p>&lt;div title /&gt;
7955 &lt;div title/&gt;
7956 </p>
7957 <div>
7958 <p>&lt;div title=bar /&gt;
7959 &lt;div title=bar/&gt;
7960 </p>
7961 <div title="bar/"></div>
7962 </div>
7963
7964 !! html/parsoid
7965 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7966 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7967 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
7968 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7969 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7970 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
7971 !! end
7972
7973 !! test
7974 Handling html with a br self-closing tag
7975 !! wikitext
7976 <br title />
7977 <br title/>
7978 <br title/ >
7979 <br title=bar />
7980 <br title=bar/>
7981 <br title=bar/ >
7982 !! html/php
7983 <p><br title="" />
7984 <br title="" />
7985 <br />
7986 <br title="bar" />
7987 <br title="bar" />
7988 <br title="bar/" />
7989 </p>
7990 !! html/parsoid
7991 <p><br title="" />
7992 <br title="" />
7993 <br title="" />
7994 <br title="bar" />
7995 <br title="bar" />
7996 <br title="bar/" />
7997 </p>
7998 !! end
7999
8000 !! test
8001 Horizontal ruler (should it add that extra space?)
8002 !! wikitext
8003 <hr>
8004 <hr >
8005 foo <hr
8006 > bar
8007 !! html+tidy
8008 <hr />
8009 <hr />
8010 <p>foo</p>
8011 <hr />
8012 <p>bar</p>
8013 !! end
8014
8015 !! test
8016 Horizontal ruler -- 4+ dashes render hr
8017 !! wikitext
8018 ----
8019 !! html
8020 <hr />
8021
8022 !! end
8023
8024 !! test
8025 Horizontal ruler -- eats additional dashes on the same line
8026 !! wikitext
8027 ---------
8028 !! html
8029 <hr />
8030
8031 !! end
8032
8033 !! test
8034 Horizontal ruler -- does not collapse dashes on consecutive lines
8035 !! wikitext
8036 ----
8037 ----
8038 !! html
8039 <hr />
8040 <hr />
8041
8042 !! end
8043
8044 !! test
8045 Horizontal ruler -- <4 dashes render as plain text
8046 !! wikitext
8047 ---
8048 !! html
8049 <p>---
8050 </p>
8051 !! end
8052
8053 !! test
8054 Horizontal ruler -- Supports content following dashes on same line
8055 !! wikitext
8056 ---- Foo
8057 !! html
8058 <hr /> Foo
8059
8060 !! html+tidy
8061 <hr />
8062 <p>Foo</p>
8063 !! end
8064
8065 ###
8066 ### Block-level elements
8067 ###
8068 !! test
8069 Common list
8070 !! wikitext
8071 *Common list
8072 * item 2
8073 *item 3
8074 !! html
8075 <ul><li>Common list</li>
8076 <li> item 2</li>
8077 <li>item 3</li></ul>
8078
8079 !! end
8080
8081 !! test
8082 Numbered list
8083 !! wikitext
8084 #Numbered list
8085 #item 2
8086 # item 3
8087 !! html
8088 <ol><li>Numbered list</li>
8089 <li>item 2</li>
8090 <li> item 3</li></ol>
8091
8092 !! end
8093
8094 !! test
8095 Mixed list
8096 !! wikitext
8097 *Mixed list
8098 *# with numbers
8099 ** and bullets
8100 *# and numbers
8101 *bullets again
8102 **bullet level 2
8103 ***bullet level 3
8104 ***#Number on level 4
8105 **bullet level 2
8106 **#Number on level 3
8107 **#Number on level 3
8108 *#number level 2
8109 *Level 1
8110 *** Level 3
8111 #** Level 3, but ordered
8112 !! html
8113 <ul><li>Mixed list
8114 <ol><li> with numbers</li></ol>
8115 <ul><li> and bullets</li></ul>
8116 <ol><li> and numbers</li></ol></li>
8117 <li>bullets again
8118 <ul><li>bullet level 2
8119 <ul><li>bullet level 3
8120 <ol><li>Number on level 4</li></ol></li></ul></li>
8121 <li>bullet level 2
8122 <ol><li>Number on level 3</li>
8123 <li>Number on level 3</li></ol></li></ul>
8124 <ol><li>number level 2</li></ol></li>
8125 <li>Level 1
8126 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8127 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8128
8129 !! end
8130
8131 !! test
8132 Nested lists 1
8133 !! wikitext
8134 *foo
8135 **bar
8136 !! html
8137 <ul><li>foo
8138 <ul><li>bar</li></ul></li></ul>
8139
8140 !! end
8141
8142 !! test
8143 Nested lists 2
8144 !! wikitext
8145 **foo
8146 *bar
8147 !! html
8148 <ul><li><ul><li>foo</li></ul></li>
8149 <li>bar</li></ul>
8150
8151 !! end
8152
8153 !! test
8154 Nested lists 3 (first element empty)
8155 !! wikitext
8156 *
8157 **bar
8158 !! html
8159 <ul><li>
8160 <ul><li>bar</li></ul></li></ul>
8161
8162 !! end
8163
8164 !! test
8165 Nested lists 4 (first element empty)
8166 !! wikitext
8167 **
8168 *bar
8169 !! html
8170 <ul><li><ul><li></li></ul></li>
8171 <li>bar</li></ul>
8172
8173 !! end
8174
8175 !! test
8176 Nested lists 5 (both elements empty)
8177 !! wikitext
8178 **
8179 *
8180 !! html
8181 <ul><li><ul><li></li></ul></li>
8182 <li></li></ul>
8183
8184 !! end
8185
8186 !! test
8187 Nested lists 6 (both elements empty)
8188 !! wikitext
8189 *
8190 **
8191 !! html
8192 <ul><li>
8193 <ul><li></li></ul></li></ul>
8194
8195 !! end
8196
8197 !! test
8198 Nested lists 7 (skip initial nesting levels)
8199 !! wikitext
8200 *** foo
8201 !! html
8202 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8203
8204 !! end
8205
8206 !! test
8207 Nested lists 8 (multiple nesting transitions)
8208 !! wikitext
8209 * foo
8210 *** bar
8211 ** baz
8212 * boo
8213 !! html
8214 <ul><li> foo
8215 <ul><li><ul><li> bar</li></ul></li>
8216 <li> baz</li></ul></li>
8217 <li> boo</li></ul>
8218
8219 !! end
8220
8221 !! test
8222 Nested lists 9 (extension interaction)
8223 !! options
8224 parsoid
8225 !! wikitext
8226 *<references />
8227 !! html/parsoid
8228 <ul><li data-parsoid='{}'><ol class="references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8229 !! end
8230
8231 !! test
8232 1. Lists with start-of-line-transparent tokens before bullets: Comments
8233 !! wikitext
8234 *foo
8235 *<!--cmt-->bar
8236 <!--cmt-->*baz
8237 !! html
8238 <ul><li>foo</li>
8239 <li>bar</li>
8240 <li>baz</li></ul>
8241
8242 !! end
8243
8244 !! test
8245 2. Lists with start-of-line-transparent tokens before bullets: Template close
8246 !! wikitext
8247 *foo {{echo|bar
8248 }}*baz
8249 !! html
8250 <ul><li>foo bar</li>
8251 <li>baz</li></ul>
8252
8253 !! end
8254
8255 !! test
8256 List items are not parsed correctly following a <pre> block (bug 785)
8257 !! wikitext
8258 * <pre>foo</pre>
8259 * <pre>bar</pre>
8260 * zar
8261 !! html
8262 <ul><li> <pre>foo</pre></li>
8263 <li> <pre>bar</pre></li>
8264 <li> zar</li></ul>
8265
8266 !! end
8267
8268 !! test
8269 List items from template
8270 !! wikitext
8271
8272 {{inner list}}
8273 * item 2
8274
8275 * item 0
8276 {{inner list}}
8277 * item 2
8278
8279 * item 0
8280 * notSOL{{inner list}}
8281 * item 2
8282 !! html
8283 <ul><li> item 1</li>
8284 <li> item 2</li></ul>
8285 <ul><li> item 0</li>
8286 <li> item 1</li>
8287 <li> item 2</li></ul>
8288 <ul><li> item 0</li>
8289 <li> notSOL</li>
8290 <li> item 1</li>
8291 <li> item 2</li></ul>
8292
8293 !! end
8294
8295 !! test
8296 List interrupted by empty line or heading
8297 !! wikitext
8298 * foo
8299
8300 ** bar
8301 == A heading ==
8302 * Another list item
8303 !! html
8304 <ul><li> foo</li></ul>
8305 <ul><li><ul><li> bar</li></ul></li></ul>
8306 <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>
8307 <ul><li> Another list item</li></ul>
8308
8309 !!end
8310
8311 !!test
8312 Multiple list tags generated by templates
8313 !! wikitext
8314 {{echo|<li>}}a
8315 {{echo|<li>}}b
8316 {{echo|<li>}}c
8317 !! html
8318 <li>a
8319 <li>b
8320 <li>c</li>
8321 </li>
8322 </li>
8323
8324 !! html+tidy
8325 <ul>
8326 <li>a</li>
8327 <li>b</li>
8328 <li>c</li>
8329 </ul>
8330 !!end
8331
8332 !!test
8333 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8334 !! wikitext
8335 *a
8336 <!--This line will NOT split the list-->
8337 *b
8338 <!--This line will NOT split the list either-->
8339 *c
8340 <!--foo--> <!----> <!--This line NOT split the list either-->
8341 *d
8342 !! html
8343 <ul><li>a</li>
8344 <li>b</li>
8345 <li>c</li>
8346 <li>d</li></ul>
8347
8348 !!end
8349
8350 !!test
8351 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8352 !! wikitext
8353 *a
8354 <!--This line will NOT split the list-->
8355 *b
8356 <!--This line will NOT split the list either-->
8357 *c
8358 <!--foo--> <!----> <!--This line NOT split the list
8359 either-->
8360 *d
8361 !! html
8362 <ul><li>a</li>
8363 <li>b</li>
8364 <li>c</li>
8365 <li>d</li></ul>
8366
8367 !!end
8368
8369 !!test
8370 Test the li-hack
8371 (The PHP parser relies on Tidy for the hack)
8372 !!options
8373 parsoid=wt2html,wt2wt
8374 !! wikitext
8375 * foo
8376 * <li>li-hack
8377 * {{echo|<li>templated li-hack}}
8378 * <!--foo--> <li> unsupported li-hack with preceding comments
8379
8380 <ul>
8381 <li><li>not a li-hack
8382 </li>
8383 </ul>
8384 !! html+tidy
8385 <ul>
8386 <li>foo</li>
8387 <li>li-hack</li>
8388 <li>templated li-hack</li>
8389 <li>unsupported li-hack with preceding comments</li>
8390 </ul>
8391 <ul>
8392 <li>not a li-hack</li>
8393 </ul>
8394 !!end
8395
8396 !! test
8397 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8398 !! options
8399 parsoid
8400 !! wikitext
8401 # foo
8402 ## bar
8403 * foo
8404 ** bar
8405 : foo
8406 :: bar
8407 !! html
8408 <ol>
8409 <li> foo<ol>
8410 <li> bar</li>
8411 </ol></li>
8412 </ol><ul>
8413 <li> foo<ul>
8414 <li> bar</li>
8415 </ul></li>
8416 </ul><dl>
8417 <dd> foo<dl>
8418 <dd> bar</dd>
8419 </dl></dd>
8420 </dl>
8421 !! end
8422
8423 !! test
8424 Parsoid: Test of whitespace serialization with Templated bullets
8425 !! options
8426 parsoid
8427 !! wikitext
8428 * {{bullet}}
8429 !! html
8430 <ul>
8431 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8432 </ul>
8433 !! end
8434
8435 # ------------------------------------------------------------------------
8436 # The next set of tests are about Parsoid's ability to handle badly nested
8437 # tags (parse, minimize scope of fixup, and roundtrip back)
8438 # ------------------------------------------------------------------------
8439
8440 !! test
8441 Unbalanced closing block tags break a list
8442 (php parser relies on Tidy to fix up)
8443 !! wikitext
8444 <div>
8445 *a</div><div>
8446 *b</div>
8447 !! html+tidy
8448 <div>
8449 <ul>
8450 <li>a</li>
8451 </ul>
8452 </div>
8453 <div>
8454 <ul>
8455 <li>b</li>
8456 </ul>
8457 </div>
8458 !! end
8459
8460 # Parsoid fails this test, but it might be tricky to support properly.
8461 # See bug 68395.
8462 !! test
8463 Unbalanced closing non-block tags don't break a list
8464 (php parser relies on Tidy to fix up)
8465 !! wikitext
8466 <span>
8467 *a</span><span>
8468 *b</span>
8469 !! html/php+tidy
8470 <ul>
8471 <li><span>a</span></li>
8472 <li><span>b</span></li>
8473 </ul>
8474 !! html/parsoid
8475 <span>
8476 <ul>
8477 <li>a<span></span>
8478 </li>
8479 <li>b
8480 </li>
8481 </ul>
8482 </span>
8483 !! end
8484
8485 !! test
8486 Unclosed formatting tags that straddle lists are closed and reopened
8487 (php parser relies on Tidy to fix up)
8488 !! options
8489 parsoid=wt2html,wt2wt,html2html
8490 !! wikitext
8491 # <s> a
8492 # b </s>
8493 !! html/php+tidy
8494 <ol>
8495 <li><s>a</s></li>
8496 <li><s>b</s></li>
8497 </ol>
8498 !! html/parsoid
8499 <ol><li> <s> a</s></li>
8500 <li><s> b </s></li></ol>
8501 !! end
8502
8503 # See bug 68395.
8504 !!test
8505 1. List embedded in a formatting tag
8506 !! wikitext
8507 <small>
8508 * foo
8509 </small>
8510 !! html/php+tidy
8511 <ul>
8512 <li><small>foo</small></li>
8513 </ul>
8514 !! html/parsoid
8515 <small>
8516 <ul>
8517 <li> foo</li>
8518 </ul>
8519 </small>
8520 !!end
8521
8522 ## Ugly Parsoid output here
8523 ## Not sure what the right output is.
8524 !!test
8525 2. List embedded in a formatting tag
8526 !! wikitext
8527 <small>
8528 *a
8529 *b</small>
8530 !! html/php+tidy
8531 <ul>
8532 <li><small>a</small></li>
8533 <li><small>b</small></li>
8534 </ul>
8535 !! html/parsoid
8536 <small></small>
8537 <ul><small>
8538 <li>a</li>
8539 </small>
8540 <li><small>b</small></li>
8541 </ul>
8542 !!end
8543
8544 # Ugly Parsoid and PHP parser output here
8545 # Not sure if we want to make this a test!
8546 #
8547 ## !!test
8548 ## 3. Unclosed formatting tags in list elements
8549 ## !! wikitext
8550 ## *<small>a
8551 ## *<small>b
8552 ## !! html/php+tidy
8553 ## <ul>
8554 ## <li><small>a</small></li>
8555 ## <li><small><small>b</small></small></li>
8556 ## </ul>
8557 ## !! html/parsoid
8558 ## <ul>
8559 ## <li><small>a</small></li>
8560 ## <small>
8561 ## <li><small>b</small></li>
8562 ## </small></ul>
8563 ## !!end
8564
8565 # This is a bug in the PHP parser + tidy combination.
8566 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8567 # and then fostered out of the table by tidy.)
8568 # We believe the Parsoid output to be correct.
8569 !! test
8570 Table with missing opening <tr> tag
8571 !! options
8572 parsoid=wt2html,wt2wt
8573 !! wikitext
8574 <table>
8575 <td>foo</td>
8576 </tr>
8577 </table>
8578 !! html+tidy
8579 <table>
8580 <tr>
8581 <td>foo</td>
8582 </tr>
8583 </table>
8584 !! end
8585
8586 ###
8587 ### Magic Words
8588 ###
8589
8590 # Note that the current date is hard-coded as
8591 # 1970-01-01T00:02:03Z (a Thursday)
8592 # when running parser tests. The timezone is also fixed to GMT, so
8593 # local date will be identical to current date.
8594
8595 !! test
8596 Magic Word: {{CURRENTDAY}}
8597 !! wikitext
8598 {{CURRENTDAY}}
8599 !! html
8600 <p>1
8601 </p>
8602 !! end
8603
8604 !! test
8605 Magic Word: {{CURRENTDAY2}}
8606 !! wikitext
8607 {{CURRENTDAY2}}
8608 !! html
8609 <p>01
8610 </p>
8611 !! end
8612
8613 !! test
8614 Magic Word: {{CURRENTDAYNAME}}
8615 !! wikitext
8616 {{CURRENTDAYNAME}}
8617 !! html
8618 <p>Thursday
8619 </p>
8620 !! end
8621
8622 !! test
8623 Magic Word: {{CURRENTDOW}}
8624 !! wikitext
8625 {{CURRENTDOW}}
8626 !! html
8627 <p>4
8628 </p>
8629 !! end
8630
8631 !! test
8632 Magic Word: {{CURRENTMONTH}}
8633 !! wikitext
8634 {{CURRENTMONTH}}
8635 !! html
8636 <p>01
8637 </p>
8638 !! end
8639
8640 !! test
8641 Magic Word: {{CURRENTMONTH1}}
8642 !! wikitext
8643 {{CURRENTMONTH1}}
8644 !! html
8645 <p>1
8646 </p>
8647 !! end
8648
8649 !! test
8650 Magic Word: {{CURRENTMONTHABBREV}}
8651 !! wikitext
8652 {{CURRENTMONTHABBREV}}
8653 !! html
8654 <p>Jan
8655 </p>
8656 !! end
8657
8658 !! test
8659 Magic Word: {{CURRENTMONTHNAME}}
8660 !! wikitext
8661 {{CURRENTMONTHNAME}}
8662 !! html
8663 <p>January
8664 </p>
8665 !! end
8666
8667 !! test
8668 Magic Word: {{CURRENTMONTHNAMEGEN}}
8669 !! wikitext
8670 {{CURRENTMONTHNAMEGEN}}
8671 !! html
8672 <p>January
8673 </p>
8674 !! end
8675
8676 !! test
8677 Magic Word: {{CURRENTTIME}}
8678 !! wikitext
8679 {{CURRENTTIME}}
8680 !! html
8681 <p>00:02
8682 </p>
8683 !! end
8684
8685 !! test
8686 Magic Word: {{CURRENTHOUR}}
8687 !! wikitext
8688 {{CURRENTHOUR}}
8689 !! html
8690 <p>00
8691 </p>
8692 !! end
8693
8694 !! test
8695 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8696 !! wikitext
8697 {{CURRENTWEEK}}
8698 !! html
8699 <p>1
8700 </p>
8701 !! end
8702
8703 !! test
8704 Magic Word: {{CURRENTYEAR}}
8705 !! wikitext
8706 {{CURRENTYEAR}}
8707 !! html
8708 <p>1970
8709 </p>
8710 !! end
8711
8712 !! test
8713 Magic Word: {{CURRENTTIMESTAMP}}
8714 !! wikitext
8715 {{CURRENTTIMESTAMP}}
8716 !! html
8717 <p>19700101000203
8718 </p>
8719 !! end
8720
8721 !! test
8722 Magic Words LOCAL (UTC)
8723 !! wikitext
8724 * {{LOCALMONTH}}
8725 * {{LOCALMONTH1}}
8726 * {{LOCALMONTHNAME}}
8727 * {{LOCALMONTHNAMEGEN}}
8728 * {{LOCALMONTHABBREV}}
8729 * {{LOCALDAY}}
8730 * {{LOCALDAY2}}
8731 * {{LOCALDAYNAME}}
8732 * {{LOCALYEAR}}
8733 * {{LOCALTIME}}
8734 * {{LOCALHOUR}}
8735 * {{LOCALWEEK}}
8736 * {{LOCALDOW}}
8737 * {{LOCALTIMESTAMP}}
8738 !! html
8739 <ul><li> 01</li>
8740 <li> 1</li>
8741 <li> January</li>
8742 <li> January</li>
8743 <li> Jan</li>
8744 <li> 1</li>
8745 <li> 01</li>
8746 <li> Thursday</li>
8747 <li> 1970</li>
8748 <li> 00:02</li>
8749 <li> 00</li>
8750 <li> 1</li>
8751 <li> 4</li>
8752 <li> 19700101000203</li></ul>
8753
8754 !! end
8755
8756 !! test
8757 Magic Word: {{FULLPAGENAME}}
8758 !! options
8759 title=[[User:Ævar Arnfjörð Bjarmason]]
8760 !! wikitext
8761 {{FULLPAGENAME}}
8762 !! html
8763 <p>User:Ævar Arnfjörð Bjarmason
8764 </p>
8765 !! end
8766
8767 !! test
8768 Magic Word: {{FULLPAGENAMEE}}
8769 !! options
8770 title=[[User:Ævar Arnfjörð Bjarmason]]
8771 !! wikitext
8772 {{FULLPAGENAMEE}}
8773 !! html
8774 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8775 </p>
8776 !! end
8777
8778 !! test
8779 Magic Word: {{TALKSPACE}}
8780 !! options
8781 title=[[User:Ævar Arnfjörð Bjarmason]]
8782 !! wikitext
8783 {{TALKSPACE}}
8784 !! html
8785 <p>User talk
8786 </p>
8787 !! end
8788
8789 !! test
8790 Magic Word: {{TALKSPACE}}, same namespace
8791 !! options
8792 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8793 !! wikitext
8794 {{TALKSPACE}}
8795 !! html
8796 <p>User talk
8797 </p>
8798 !! end
8799
8800 !! test
8801 Magic Word: {{TALKSPACE}}, main namespace
8802 !! options
8803 title=[[Parser Test]]
8804 !! wikitext
8805 {{TALKSPACE}}
8806 !! html
8807 <p>Talk
8808 </p>
8809 !! end
8810
8811 !! test
8812 Magic Word: {{TALKSPACEE}}
8813 !! options
8814 title=[[User:Ævar Arnfjörð Bjarmason]]
8815 !! wikitext
8816 {{TALKSPACEE}}
8817 !! html
8818 <p>User_talk
8819 </p>
8820 !! end
8821
8822 !! test
8823 Magic Word: {{SUBJECTSPACE}}
8824 !! options
8825 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8826 !! wikitext
8827 {{SUBJECTSPACE}}
8828 !! html
8829 <p>User
8830 </p>
8831 !! end
8832
8833 !! test
8834 Magic Word: {{SUBJECTSPACE}}, same namespace
8835 !! options
8836 title=[[User:Ævar Arnfjörð Bjarmason]]
8837 !! wikitext
8838 {{SUBJECTSPACE}}
8839 !! html
8840 <p>User
8841 </p>
8842 !! end
8843
8844 !! test
8845 Magic Word: {{SUBJECTSPACE}}, main namespace
8846 !! options
8847 title=[[Parser Test]]
8848 !! wikitext
8849 {{SUBJECTSPACE}}
8850 !! html
8851
8852 !! end
8853
8854 !! test
8855 Magic Word: {{SUBJECTSPACEE}}
8856 !! options
8857 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8858 !! wikitext
8859 {{SUBJECTSPACEE}}
8860 !! html
8861 <p>User
8862 </p>
8863 !! end
8864
8865 !! test
8866 Magic Word: {{NAMESPACE}}
8867 !! options
8868 title=[[User:Ævar Arnfjörð Bjarmason]]
8869 !! wikitext
8870 {{NAMESPACE}}
8871 !! html
8872 <p>User
8873 </p>
8874 !! end
8875
8876 !! test
8877 Magic Word: {{NAMESPACEE}}
8878 !! options
8879 title=[[User:Ævar Arnfjörð Bjarmason]]
8880 !! wikitext
8881 {{NAMESPACEE}}
8882 !! html
8883 <p>User
8884 </p>
8885 !! end
8886
8887 !! test
8888 Magic Word: {{NAMESPACENUMBER}}
8889 !! options
8890 title=[[User:Ævar Arnfjörð Bjarmason]]
8891 !! wikitext
8892 {{NAMESPACENUMBER}}
8893 !! html
8894 <p>2
8895 </p>
8896 !! end
8897
8898 !! test
8899 Magic Word: {{SUBPAGENAME}}
8900 !! options
8901 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8902 !! wikitext
8903 {{SUBPAGENAME}}
8904 !! html
8905 <p>sub ö
8906 </p>
8907 !! end
8908
8909 !! test
8910 Magic Word: {{SUBPAGENAMEE}}
8911 !! options
8912 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8913 !! wikitext
8914 {{SUBPAGENAMEE}}
8915 !! html
8916 <p>sub_%C3%B6
8917 </p>
8918 !! end
8919
8920 !! test
8921 Magic Word: {{ROOTPAGENAME}}
8922 !! options
8923 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8924 !! wikitext
8925 {{ROOTPAGENAME}}
8926 !! html
8927 <p>Ævar Arnfjörð Bjarmason
8928 </p>
8929 !! end
8930
8931 !! test
8932 Magic Word: {{ROOTPAGENAMEE}}
8933 !! options
8934 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8935 !! wikitext
8936 {{ROOTPAGENAMEE}}
8937 !! html
8938 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8939 </p>
8940 !! end
8941
8942 !! test
8943 Magic Word: {{BASEPAGENAME}}
8944 !! options
8945 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8946 !! wikitext
8947 {{BASEPAGENAME}}
8948 !! html
8949 <p>Ævar Arnfjörð Bjarmason
8950 </p>
8951 !! end
8952
8953 !! test
8954 Magic Word: {{BASEPAGENAMEE}}
8955 !! options
8956 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8957 !! wikitext
8958 {{BASEPAGENAMEE}}
8959 !! html
8960 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8961 </p>
8962 !! end
8963
8964 !! test
8965 Magic Word: {{TALKPAGENAME}}
8966 !! options
8967 title=[[User:Ævar Arnfjörð Bjarmason]]
8968 !! wikitext
8969 {{TALKPAGENAME}}
8970 !! html
8971 <p>User talk:Ævar Arnfjörð Bjarmason
8972 </p>
8973 !! end
8974
8975 !! test
8976 Magic Word: {{TALKPAGENAMEE}}
8977 !! options
8978 title=[[User:Ævar Arnfjörð Bjarmason]]
8979 !! wikitext
8980 {{TALKPAGENAMEE}}
8981 !! html
8982 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8983 </p>
8984 !! end
8985
8986 !! test
8987 Magic Word: {{SUBJECTPAGENAME}}
8988 !! options
8989 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8990 !! wikitext
8991 {{SUBJECTPAGENAME}}
8992 !! html
8993 <p>User:Ævar Arnfjörð Bjarmason
8994 </p>
8995 !! end
8996
8997 !! test
8998 Magic Word: {{SUBJECTPAGENAMEE}}
8999 !! options
9000 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9001 !! wikitext
9002 {{SUBJECTPAGENAMEE}}
9003 !! html
9004 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9005 </p>
9006 !! end
9007
9008 !! test
9009 Magic Word: {{NUMBEROFFILES}}
9010 !! wikitext
9011 {{NUMBEROFFILES}}
9012 !! html
9013 <p>5
9014 </p>
9015 !! end
9016
9017 !! test
9018 Magic Word: {{PAGENAME}}
9019 !! options
9020 title=[[User:Ævar Arnfjörð Bjarmason]]
9021 !! wikitext
9022 {{PAGENAME}}
9023 !! html
9024 <p>Ævar Arnfjörð Bjarmason
9025 </p>
9026 !! end
9027
9028 !! test
9029 Magic Word: {{PAGENAME}} with metacharacters
9030 !! options
9031 title=[['foo & bar = baz']]
9032 !! wikitext
9033 ''{{PAGENAME}}''
9034 !! html/php
9035 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9036 </p>
9037 !! html+tidy
9038 <p><i>'foo &amp; bar = baz'</i></p>
9039 !! end
9040
9041 !! test
9042 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9043 !! options
9044 title=[[*RFC 1234 http://example.com/]]
9045 !! wikitext
9046 {{PAGENAME}}
9047 !! html/php
9048 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9049 </p>
9050 !! html+tidy
9051 <p>*RFC 1234 http://example.com/</p>
9052 !! end
9053
9054 !! test
9055 Magic Word: {{PAGENAMEE}}
9056 !! options
9057 title=[[User:Ævar Arnfjörð Bjarmason]]
9058 !! wikitext
9059 {{PAGENAMEE}}
9060 !! html
9061 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9062 </p>
9063 !! end
9064
9065 !! test
9066 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9067 !! options
9068 title=[[*RFC 1234 http://example.com/]]
9069 !! wikitext
9070 {{PAGENAMEE}}
9071 !! html/php
9072 <p>&#42;RFC_1234_http&#58;//example.com/
9073 </p>
9074 !! html+tidy
9075 <p>*RFC_1234_http://example.com/</p>
9076 !! end
9077
9078 !! test
9079 Magic Word: {{REVISIONID}}
9080 !! wikitext
9081 {{REVISIONID}}
9082 !! html
9083 <p>1337
9084 </p>
9085 !! end
9086
9087 !! test
9088 Magic Word: {{SCRIPTPATH}}
9089 !! wikitext
9090 {{SCRIPTPATH}}
9091 !! html
9092 <p>/
9093 </p>
9094 !! end
9095
9096 !! test
9097 Magic Word: {{STYLEPATH}}
9098 !! wikitext
9099 {{STYLEPATH}}
9100 !! html
9101 <p>/skins
9102 </p>
9103 !! end
9104
9105 !! test
9106 Magic Word: {{SERVER}}
9107 !! wikitext
9108 {{SERVER}}
9109 !! html
9110 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9111 </p>
9112 !! end
9113
9114 !! test
9115 Magic Word: {{SERVERNAME}}
9116 !! wikitext
9117 {{SERVERNAME}}
9118 !! html
9119 <p>example.org
9120 </p>
9121 !! end
9122
9123 !! test
9124 Magic Word: {{SITENAME}}
9125 !! wikitext
9126 {{SITENAME}}
9127 !! html
9128 <p>MediaWiki
9129 </p>
9130 !! end
9131
9132 !! test
9133 Case-sensitive magic words, when cased differently, should just be template transclusions
9134 !! wikitext
9135 {{CurrentMonth}}
9136 {{currentday}}
9137 {{cURreNTweEK}}
9138 {{currentHour}}
9139 !! html
9140 <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>
9141 <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>
9142 <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>
9143 <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>
9144 </p>
9145 !! end
9146
9147 !! test
9148 Case-insensitive magic words should still work with weird casing.
9149 !! wikitext
9150 {{sErVeRNaMe}}
9151 {{LCFirst:AOEU}}
9152 {{ucFIRST:aoeu}}
9153 {{SERver}}
9154 !! html
9155 <p>example.org
9156 aOEU
9157 Aoeu
9158 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9159 </p>
9160 !! end
9161
9162 # From plwiki:PLOS_ONE
9163 !! test
9164 Parsoid: Page property magic word with magic word contents
9165 !! wikitext
9166 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9167 !! html/parsoid
9168 <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>"}]]}'/>
9169 !! end
9170
9171 !! test
9172 Parsoid: Template-generated DISPLAYTITLE
9173 !! wikitext
9174 {{{{echo|DISPLAYTITLE}}:Foo}}
9175 !! html/parsoid
9176 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,29,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
9177 !! end
9178
9179 !! test
9180 Namespace 1 {{ns:1}}
9181 !! wikitext
9182 {{ns:1}}
9183 !! html
9184 <p>Talk
9185 </p>
9186 !! end
9187
9188 !! test
9189 Namespace 1 {{ns:01}}
9190 !! wikitext
9191 {{ns:01}}
9192 !! html
9193 <p>Talk
9194 </p>
9195 !! end
9196
9197 !! test
9198 Namespace 0 {{ns:0}} (bug 4783)
9199 !! wikitext
9200 {{ns:0}}
9201 !! html
9202
9203 !! end
9204
9205 !! test
9206 Namespace 0 {{ns:00}} (bug 4783)
9207 !! wikitext
9208 {{ns:00}}
9209 !! html
9210
9211 !! end
9212
9213 !! test
9214 Namespace -1 {{ns:-1}}
9215 !! wikitext
9216 {{ns:-1}}
9217 !! html
9218 <p>Special
9219 </p>
9220 !! end
9221
9222 !! test
9223 Namespace User {{ns:User}}
9224 !! wikitext
9225 {{ns:User}}
9226 !! html
9227 <p>User
9228 </p>
9229 !! end
9230
9231 !! test
9232 Namespace User talk {{ns:User_talk}}
9233 !! wikitext
9234 {{ns:User_talk}}
9235 !! html
9236 <p>User talk
9237 </p>
9238 !! end
9239
9240 !! test
9241 Namespace User talk {{ns:uSeR tAlK}}
9242 !! wikitext
9243 {{ns:uSeR tAlK}}
9244 !! html
9245 <p>User talk
9246 </p>
9247 !! end
9248
9249 !! test
9250 Namespace File {{ns:File}}
9251 !! wikitext
9252 {{ns:File}}
9253 !! html
9254 <p>File
9255 </p>
9256 !! end
9257
9258 !! test
9259 Namespace File {{ns:Image}}
9260 !! wikitext
9261 {{ns:Image}}
9262 !! html
9263 <p>File
9264 </p>
9265 !! end
9266
9267 !! test
9268 Namespace (lang=de) Benutzer {{ns:User}}
9269 !! options
9270 language=de
9271 !! wikitext
9272 {{ns:User}}
9273 !! html
9274 <p>Benutzer
9275 </p>
9276 !! end
9277
9278 !! test
9279 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9280 !! options
9281 language=de
9282 !! wikitext
9283 {{ns:3}}
9284 !! html
9285 <p>Benutzer Diskussion
9286 </p>
9287 !! end
9288
9289
9290 !! test
9291 Urlencode
9292 !! wikitext
9293 {{urlencode:hi world?!}}
9294 {{urlencode:hi world?!|WIKI}}
9295 {{urlencode:hi world?!|PATH}}
9296 {{urlencode:hi world?!|QUERY}}
9297 !! html
9298 <p>hi+world%3F%21
9299 hi_world%3F!
9300 hi%20world%3F%21
9301 hi+world%3F%21
9302 </p>
9303 !! end
9304
9305 !! test
9306 Magic Word: prioritize type info over data-parsoid
9307 !! options
9308 parsoid=html2wt
9309 !! html
9310 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9311 !! wikitext
9312 __FORCETOC__
9313 !! end
9314
9315 !! test
9316 Magic Word: serialize on separate line (parsoid)
9317 !! options
9318 parsoid=wt2wt,html2wt
9319 !! wikitext
9320 foo
9321 __NOTOC__
9322 bar
9323 !! html
9324 foo<meta property="mw:PageProp/notoc"/>bar
9325 !! end
9326
9327 !! test
9328 Magic Word: rt non-english wikis
9329 !! options
9330 parsoid=wt2wt
9331 language=de
9332 !! wikitext
9333 __NOEDITSECTION__
9334 !! html
9335 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9336 !! end
9337
9338 ###
9339 ### Magic links
9340 ###
9341 !! test
9342 Magic links: internal link to RFC (bug 479)
9343 !! wikitext
9344 [[RFC 123]]
9345 !! html
9346 <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>
9347 </p>
9348 !! end
9349
9350 !! test
9351 Magic links: RFC (bug 479)
9352 !! wikitext
9353 RFC 822
9354 !! html
9355 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9356 </p>
9357 !! end
9358
9359 !! test
9360 Magic links: RFC (bug 65278)
9361 !! wikitext
9362 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9363 !! html
9364 <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.
9365 </p>
9366 !! end
9367
9368 !! test
9369 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9370 !! wikitext
9371 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9372 RFC
9373 822
9374 !! html
9375 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9376 RFC
9377 822
9378 </p>
9379 !! end
9380
9381 !! test
9382 Magic links: ISBN (bug 1937)
9383 !! wikitext
9384 ISBN 0-306-40615-2
9385 !! html
9386 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9387 </p>
9388 !! end
9389
9390 !! test
9391 Magic links: ISBN (bug 65278)
9392 !! wikitext
9393 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9394 !! html/php
9395 <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.
9396 </p>
9397 !! html/parsoid
9398 <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>
9399 !! end
9400
9401 !! test
9402 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9403 !! wikitext
9404 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9405 ISBN
9406 9780316098113
9407 ISBN 978
9408 0316098113
9409 !! html
9410 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9411 ISBN
9412 9780316098113
9413 ISBN 978
9414 0316098113
9415 </p>
9416 !! end
9417
9418 !! test
9419 Magic links: PMID incorrectly converts space to underscore
9420 !! wikitext
9421 PMID 1234
9422 !! html
9423 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9424 </p>
9425 !! end
9426
9427 !! test
9428 Magic links: PMID (bug 65278)
9429 !! wikitext
9430 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9431 !! html
9432 <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.
9433 </p>
9434 !! end
9435
9436 !! test
9437 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9438 !! wikitext
9439 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9440 PMID
9441 1234
9442 !! html
9443 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9444 PMID
9445 1234
9446 </p>
9447 !! end
9448
9449 ###
9450 ### Templates
9451 ####
9452
9453 !! test
9454 Nonexistent template
9455 !! wikitext
9456 {{thistemplatedoesnotexist}}
9457 !! html
9458 <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>
9459 </p>
9460 !! end
9461
9462 !! test
9463 Template with invalid target containing tags
9464 !! wikitext
9465 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9466 !! html
9467 <p>{{a<b>b</b>|foo|a=b|a = b}}
9468 </p>
9469 !! end
9470
9471 !! test
9472 Template with invalid target containing unclosed tag
9473 !! wikitext
9474 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9475 !! html
9476 <p>{{a<b>|foo|a=b|a = b}}</b>
9477 </p>
9478 !! end
9479
9480 !! test
9481 Template with invalid target containing wikilink
9482 !! wikitext
9483 {{[[Main Page]]}}
9484 !! html/php
9485 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
9486 </p>
9487 !! html/parsoid
9488 <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>
9489 !! end
9490
9491 !! test
9492 Template with just whitespace in it, bug #68421
9493 !! wikitext
9494 {{echo|{{ }}}}
9495 !! html/parsoid
9496 <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>
9497 !! end
9498
9499 !! article
9500 Template:test
9501 !! text
9502 This is a test template
9503 !! endarticle
9504
9505 !! test
9506 Simple template
9507 !! wikitext
9508 {{test}}
9509 !! html
9510 <p>This is a test template
9511 </p>
9512 !! end
9513
9514 !! test
9515 Template with explicit namespace
9516 !! wikitext
9517 {{Template:test}}
9518 !! html
9519 <p>This is a test template
9520 </p>
9521 !! end
9522
9523
9524 !! article
9525 Template:paramtest
9526 !! text
9527 This is a test template with parameter {{{param}}}
9528 !! endarticle
9529
9530 !! test
9531 Template parameter
9532 !! wikitext
9533 {{paramtest|param=foo}}
9534 !! html
9535 <p>This is a test template with parameter foo
9536 </p>
9537 !! end
9538
9539 !! article
9540 Template:paramtestnum
9541 !! text
9542 [[{{{1}}}|{{{2}}}]]
9543 !! endarticle
9544
9545 !! test
9546 Template unnamed parameter
9547 !! wikitext
9548 {{paramtestnum|Main Page|the main page}}
9549 !! html
9550 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9551 </p>
9552 !! end
9553
9554 !! article
9555 Template:templatesimple
9556 !! text
9557 (test)
9558 !! endarticle
9559
9560 !! article
9561 Template:templateredirect
9562 !! text
9563 #redirect [[Template:templatesimple]]
9564 !! endarticle
9565
9566 !! article
9567 Template:templateasargtestnum
9568 !! text
9569 {{{{{1}}}}}
9570 !! endarticle
9571
9572 !! article
9573 Template:templateasargtest
9574 !! text
9575 {{template{{{templ}}}}}
9576 !! endarticle
9577
9578 !! article
9579 Template:templateasargtest2
9580 !! text
9581 {{{{{templ}}}}}
9582 !! endarticle
9583
9584 !! test
9585 Template with template name as unnamed argument
9586 !! wikitext
9587 {{templateasargtestnum|templatesimple}}
9588 !! html
9589 <p>(test)
9590 </p>
9591 !! end
9592
9593 !! test
9594 Template with template name as argument
9595 !! wikitext
9596 {{templateasargtest|templ=simple}}
9597 !! html
9598 <p>(test)
9599 </p>
9600 !! end
9601
9602 !! test
9603 Template with template name as argument (2)
9604 !! wikitext
9605 {{templateasargtest2|templ=templatesimple}}
9606 !! html
9607 <p>(test)
9608 </p>
9609 !! end
9610
9611 !! article
9612 Template:templateasargtestdefault
9613 !! text
9614 {{{{{templ|templatesimple}}}}}
9615 !! endarticle
9616
9617 !! article
9618 Template:templa
9619 !! text
9620 '''templ'''
9621 !! endarticle
9622
9623 !! test
9624 Template with default value
9625 !! wikitext
9626 {{templateasargtestdefault}}
9627 !! html
9628 <p>(test)
9629 </p>
9630 !! end
9631
9632 !! test
9633 Template with default value (value set)
9634 !! wikitext
9635 {{templateasargtestdefault|templ=templa}}
9636 !! html
9637 <p><b>templ</b>
9638 </p>
9639 !! end
9640
9641 !! test
9642 Template redirect
9643 !! wikitext
9644 {{templateredirect}}
9645 !! html
9646 <p>(test)
9647 </p>
9648 !! end
9649
9650 !! test
9651 Template with argument in separate line
9652 !! wikitext
9653 {{ templateasargtest |
9654 templ = simple }}
9655 !! html
9656 <p>(test)
9657 </p>
9658 !! end
9659
9660 !! test
9661 Template with complex template as argument
9662 !! wikitext
9663 {{paramtest|
9664 param ={{ templateasargtest |
9665 templ = simple }}}}
9666 !! html
9667 <p>This is a test template with parameter (test)
9668 </p>
9669 !! end
9670
9671 !! test
9672 Template with thumb image (with link in description)
9673 !! wikitext
9674 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9675 !! html/php
9676 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>
9677
9678 !! html+tidy
9679 <p>This is a test template with parameter</p>
9680 <div class="thumb tright">
9681 <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>
9682 <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>
9683 </div>
9684 </div>
9685 !! html/parsoid
9686 <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>
9687 !! end
9688
9689 !! article
9690 Template:complextemplate
9691 !! text
9692 {{{1}}} {{paramtest|
9693 param ={{{param}}}}}
9694 !! endarticle
9695
9696 !! test
9697 Template with complex arguments
9698 !! wikitext
9699 {{complextemplate|
9700 param ={{ templateasargtest |
9701 templ = simple }}|[[Template:complextemplate|link]]}}
9702 !! html
9703 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
9704 </p>
9705 !! end
9706
9707 !! test
9708 BUG 553: link with two variables in a piped link
9709 !! wikitext
9710 {|
9711 |[[{{{1}}}|{{{2}}}]]
9712 |}
9713 !! html
9714 <table>
9715 <tr>
9716 <td>[[{{{1}}}|{{{2}}}]]
9717 </td></tr></table>
9718
9719 !! end
9720
9721 !! test
9722 Magic variable as template parameter
9723 !! wikitext
9724 {{paramtest|param={{SITENAME}}}}
9725 !! html
9726 <p>This is a test template with parameter MediaWiki
9727 </p>
9728 !! end
9729
9730 !! article
9731 Template:linktest
9732 !! text
9733 [[{{{param}}}|link]]
9734 !! endarticle
9735
9736 !! test
9737 Template parameter as link source
9738 !! wikitext
9739 {{linktest|param=Main Page}}
9740 !! html
9741 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
9742 </p>
9743 !! end
9744
9745 !!article
9746 Template:paramtest2
9747 !! text
9748 including another template, {{paramtest|param={{{arg}}}}}
9749 !! endarticle
9750
9751 !! test
9752 Template passing argument to another template
9753 !! wikitext
9754 {{paramtest2|arg='hmm'}}
9755 !! html
9756 <p>including another template, This is a test template with parameter 'hmm'
9757 </p>
9758 !! end
9759
9760 !! article
9761 Template:Linktest2
9762 !! text
9763 Main Page
9764 !! endarticle
9765
9766 !! test
9767 Template as link source
9768 !! wikitext
9769 [[{{linktest2}}]]
9770
9771 [[{{linktest2}}|Main Page]]
9772
9773 [[{{linktest2}}]]Page
9774 !! html
9775 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9776 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9777 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
9778 </p>
9779 !! end
9780
9781
9782 !! article
9783 Template:loop1
9784 !! text
9785 {{loop2}}
9786 !! endarticle
9787
9788 !! article
9789 Template:loop2
9790 !! text
9791 {{loop1}}
9792 !! endarticle
9793
9794 !! test
9795 Template infinite loop
9796 !! wikitext
9797 {{loop1}}
9798 !! html
9799 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
9800 </p>
9801 !! end
9802
9803 !! test
9804 Template from main namespace
9805 !! wikitext
9806 {{:Main Page}}
9807 !! html
9808 <p>blah blah
9809 </p>
9810 !! end
9811
9812 !! article
9813 Template:table
9814 !! text
9815 {|
9816 | 1 || 2
9817 |-
9818 | 3 || 4
9819 |}
9820 !! endarticle
9821
9822 !! test
9823 BUG 529: Template with table, not included at beginning of line
9824 !! wikitext
9825 foo {{table}}
9826 !! html
9827 <p>foo
9828 </p>
9829 <table>
9830 <tr>
9831 <td> 1 </td>
9832 <td> 2
9833 </td></tr>
9834 <tr>
9835 <td> 3 </td>
9836 <td> 4
9837 </td></tr></table>
9838
9839 !! end
9840
9841 !! test
9842 BUG 523: Template shouldn't eat newline (or add an extra one before table)
9843 !! wikitext
9844 foo
9845 {{table}}
9846 !! html
9847 <p>foo
9848 </p>
9849 <table>
9850 <tr>
9851 <td> 1 </td>
9852 <td> 2
9853 </td></tr>
9854 <tr>
9855 <td> 3 </td>
9856 <td> 4
9857 </td></tr></table>
9858
9859 !! end
9860
9861 !! test
9862 BUG 41: Template parameters shown as broken links
9863 !! wikitext
9864 {{{parameter}}}
9865 !! html
9866 <p>{{{parameter}}}
9867 </p>
9868 !! end
9869
9870 !! test
9871 Template with targets containing wikilinks
9872 !! wikitext
9873 {{[[foo]]}}
9874
9875 {{[[{{echo|foo}}]]}}
9876
9877 {{{{echo|[[foo}}]]}}
9878 !! html
9879 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9880 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9881 </p><p>{{[[foo}}]]
9882 </p>
9883 !! end
9884
9885 !! article
9886 Template:MSGNW test
9887 !! text
9888 ''None'' of '''this''' should be
9889 * interpreted
9890 but rather passed unmodified
9891 {{test}}
9892 <gallery>
9893 File:Foobar.jpg
9894 </gallery>
9895 !! endarticle
9896
9897 # hmm, fix this or just deprecate msgnw and document its behavior?
9898 !! test
9899 msgnw keyword
9900 !! wikitext
9901 {{msgnw:MSGNW test}}
9902 !! html
9903 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
9904 &#42; interpreted
9905 &#32;but rather passed unmodified
9906 &#123;&#123;test&#125;&#125;
9907 &#60;gallery&#62;
9908 File:Foobar.jpg
9909 &#60;/gallery&#62;
9910 </p>
9911 !! end
9912
9913 !! test
9914 int keyword
9915 !! wikitext
9916 {{int:youhavenewmessages|lots of money|not!}}
9917 !! html
9918 <p>You have lots of money (not!).
9919 </p>
9920 !! end
9921
9922 !! article
9923 Template:Includes
9924 !! text
9925 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9926 !! endarticle
9927
9928 !! test
9929 <includeonly> and <noinclude> being included
9930 !! wikitext
9931 {{Includes}}
9932 !! html
9933 <p>Foobar
9934 </p>
9935 !! end
9936
9937 !! article
9938 Template:Includes2
9939 !! text
9940 <onlyinclude>Foo</onlyinclude>bar
9941 !! endarticle
9942
9943 !! test
9944 <onlyinclude> being included
9945 !! wikitext
9946 {{Includes2}}
9947 !! html
9948 <p>Foo
9949 </p>
9950 !! end
9951
9952
9953 !! article
9954 Template:Includes3
9955 !! text
9956 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9957 !! endarticle
9958
9959 !! test
9960 <onlyinclude> and <includeonly> being included
9961 !! wikitext
9962 {{Includes3}}
9963 !! html
9964 <p>Foo
9965 </p>
9966 !! end
9967
9968 !! test
9969 <includeonly> and <noinclude> on a page
9970 !! wikitext
9971 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9972 !! html
9973 <p>Foozar
9974 </p>
9975 !! end
9976
9977 !! test
9978 Un-closed <noinclude>
9979 !! wikitext
9980 <noinclude>
9981 !! html
9982 !! end
9983
9984 !! test
9985 <onlyinclude> on a page
9986 !! wikitext
9987 <onlyinclude>Foo</onlyinclude>bar
9988 !! html
9989 <p>Foobar
9990 </p>
9991 !! end
9992
9993 !! test
9994 Un-closed <onlyinclude>
9995 !! wikitext
9996 <onlyinclude>
9997 !! html
9998 !! end
9999
10000 !!test
10001 Self-closed noinclude, includeonly, onlyinclude tags
10002 !! wikitext
10003 <noinclude />
10004 <includeonly />
10005 <onlyinclude />
10006 !! html
10007 <p><br />
10008 </p>
10009 !!end
10010
10011 !!test
10012 Unbalanced includeonly and noinclude tags
10013 !! wikitext
10014 {|
10015 |a</noinclude>
10016 |b</noinclude></noinclude>
10017 |c</noinclude></includeonly>
10018 |d</includeonly></includeonly>
10019 |}
10020 !! html
10021 <table>
10022 <tr>
10023 <td>a
10024 </td>
10025 <td>b
10026 </td>
10027 <td>c&lt;/includeonly&gt;
10028 </td>
10029 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10030 </td></tr></table>
10031
10032 !!end
10033
10034 !! article
10035 Template:Includeonly section
10036 !! text
10037 <includeonly>
10038 ==Includeonly section==
10039 </includeonly>
10040 ==Section T-1==
10041 !!endarticle
10042
10043 !! test
10044 Bug 6563: Edit link generation for section shown by <includeonly>
10045 !! wikitext
10046 {{includeonly section}}
10047 !! html
10048 <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>
10049 <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>
10050
10051 !! end
10052
10053 # Uses same input as the contents of [[Template:Includeonly section]]
10054 !! test
10055 Bug 6563: Section extraction for section shown by <includeonly>
10056 !! options
10057 section=T-2
10058 !! wikitext
10059 <includeonly>
10060 ==Includeonly section==
10061 </includeonly>
10062 ==Section T-2==
10063 !! html
10064 ==Section T-2==
10065 !! end
10066
10067 !! test
10068 Bug 6563: Edit link generation for section suppressed by <includeonly>
10069 !! wikitext
10070 <includeonly>
10071 ==Includeonly section==
10072 </includeonly>
10073 ==Section 1==
10074 !! html
10075 <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>
10076
10077 !! end
10078
10079 !! test
10080 Bug 6563: Section extraction for section suppressed by <includeonly>
10081 !! options
10082 section=1
10083 !! wikitext
10084 <includeonly>
10085 ==Includeonly section==
10086 </includeonly>
10087 ==Section 1==
10088 !! html
10089 ==Section 1==
10090 !! end
10091
10092 !! test
10093 Un-closed <includeonly>
10094 !! wikitext
10095 <includeonly>
10096 !! html
10097 !! end
10098
10099 !! test
10100 Includes and comments at SOL
10101 !! wikitext
10102 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10103
10104 <noinclude>
10105 some
10106 </noinclude>* stuff
10107 * here
10108
10109 <includeonly>can have stuff</includeonly>=== here ===
10110
10111 !! html/php
10112 <h2><span class="mw-headline" id="hu">hu</span></h2>
10113 <p>some
10114 </p>
10115 <ul><li> stuff</li>
10116 <li> here</li></ul>
10117 <h3><span class="mw-headline" id="here">here</span></h3>
10118
10119 !! html/parsoid
10120 <!-- 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>
10121
10122 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10123 <p>some</p>
10124 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10125 <li> here</li></ul>
10126
10127 <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>
10128
10129 !! end
10130
10131 # TODO: test with DOM fragment reuse!
10132 !! test
10133 Parsoid: DOM fragment reuse
10134 !! options
10135 parsoid=wt2wt,wt2html
10136 !! wikitext
10137 a{{echo|b<table></table>c}}d
10138
10139 a{{echo|b
10140 <table></table>
10141 c}}d
10142
10143 {{echo|a
10144
10145 <table></table>
10146
10147 b}}
10148 !! html
10149 <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>
10150
10151 <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">
10152 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10153 </span><p about="#mwt2">cd</p>
10154
10155 <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">
10156
10157 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10158
10159 </span><p about="#mwt3">b</p>
10160 !! end
10161
10162 !! test
10163 Parsoid: Merge double tds (bug 50603)
10164 !! options
10165 parsoid
10166 !! wikitext
10167 {|
10168 |{{echo|{{!}} foo}}
10169 |}
10170 !! html
10171 <table><tbody>
10172 <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>
10173 </tbody></table>
10174 !! end
10175
10176 !! test
10177 Parsoid: Merge double tds in nested transclusion content (bug 50603)
10178 !! options
10179 parsoid
10180 !! wikitext
10181 {{echo|<div>}}
10182 {|
10183 |{{echo|{{!}} foo}}
10184 |}
10185 {{echo|</div>}}
10186 !! html
10187 <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}}]}'>
10188 <table><tbody>
10189 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10190 </tbody></table>
10191 </div>
10192 !! end
10193
10194 ###
10195 ### <includeonly> and <noinclude> in attributes
10196 ###
10197 !!test
10198 0. includeonly around the entire attribute
10199 !! wikitext
10200 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10201 !! html
10202 <p><span id="v2">bar</span>
10203 </p>
10204 !!end
10205
10206 !!test
10207 1. includeonly in html attr key
10208 !! wikitext
10209 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10210 !! html
10211 <p><span id="foo">bar</span>
10212 </p>
10213 !!end
10214
10215 !!test
10216 2. includeonly in html attr value
10217 !! wikitext
10218 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10219 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10220 !! html
10221 <p><span id="v1">bar</span>
10222 <span id="v1">bar</span>
10223 </p>
10224 !!end
10225
10226 !!test
10227 3. includeonly in part of an attr value
10228 !! wikitext
10229 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10230 !! html
10231 <p><span style="color:red;">bar</span>
10232 </p>
10233 !!end
10234
10235 !!test
10236 4. includeonly in table attributes
10237 !! wikitext
10238 {|
10239 |- <noinclude>
10240 |-
10241 |a
10242 </noinclude>
10243 |- <includeonly>
10244 |-
10245 |b
10246 </includeonly>
10247 |}
10248 !! html
10249 <table>
10250
10251
10252 <tr>
10253 <td>a
10254 </td></tr>
10255 </table>
10256
10257 !!end
10258
10259 ###
10260 ### Token Stream Patcher tests
10261 ###
10262 ### These tests won't always pass wt2wt and other modes because
10263 ### on serialization, the table will be output on a new line.
10264 ### For now, we are blacklisting them, and using this to test selser.
10265 ###
10266
10267 !!test
10268 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10269 !!options
10270 parsoid=wt2html,wt2wt
10271 !!wikitext
10272 {{echo|}}{| width = '100%'
10273 |foo
10274 |}
10275 !!html/parsoid
10276 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10277 <tbody><tr><td>foo</td></tr>
10278 </tbody></table>
10279 !!end
10280
10281 !!test
10282 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10283 !!options
10284 parsoid=wt2html,wt2wt
10285 !!wikitext
10286 <includeonly>a</includeonly>{| {{{b}}}
10287 |c
10288 |}
10289 !!html/parsoid
10290 <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}}}":""}}'>
10291 <tbody><tr><td>c</td></tr>
10292 </tbody></table>
10293
10294 !!end
10295
10296 ###
10297 ### Testing parsing of templates where a template arg
10298 ### has the same name as the template itself.
10299 ###
10300
10301 !! article
10302 Template:quote
10303 !! text
10304 {{{quote|{{{1}}}}}}
10305 !! endarticle
10306
10307 !!test
10308 Templates: Template Name/Arg clash: 1. Use of positional param
10309 !! wikitext
10310 {{quote|foo}}
10311 !! html
10312 <p>foo
10313 </p>
10314 !!end
10315
10316 !!test
10317 Templates: Template Name/Arg clash: 2. Use of named param
10318 !! wikitext
10319 {{quote|quote=foo}}
10320 !! html
10321 <p>foo
10322 </p>
10323 !!end
10324
10325 !!test
10326 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10327 !! wikitext
10328 {{quote|quote}}
10329 !! html
10330 <p>quote
10331 </p>
10332 !!end
10333
10334 ###
10335 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10336 ###
10337
10338 !!test
10339 Templates: 1. Simple use
10340 !! wikitext
10341 {{echo|Foo}}
10342 !! html
10343 <p>Foo
10344 </p>
10345 !!end
10346
10347 !!test
10348 Templates: 2. Inside a block tag
10349 !! wikitext
10350 <div>{{echo|Foo}}</div>
10351 <blockquote>{{echo|Foo}}</blockquote>
10352 !! html
10353 <div>Foo</div>
10354 <blockquote>Foo</blockquote>
10355
10356 !! html+tidy
10357 <div>Foo</div>
10358 <blockquote>
10359 <p>Foo</p>
10360 </blockquote>
10361 !!end
10362
10363 !!test
10364 Templates: P-wrapping: 1a. Templates on consecutive lines
10365 !! wikitext
10366 {{echo|Foo}}
10367 {{echo|bar}}
10368 !! html
10369 <p>Foo
10370 bar
10371 </p>
10372 !!end
10373
10374 !!test
10375 Templates: P-wrapping: 1b. Templates on consecutive lines
10376 !! wikitext
10377 Foo
10378
10379 {{echo|bar}}
10380 {{echo|baz}}
10381 !! html
10382 <p>Foo
10383 </p><p>bar
10384 baz
10385 </p>
10386 !!end
10387
10388 !!test
10389 Templates: P-wrapping: 1c. Templates on consecutive lines
10390 !! wikitext
10391 {{echo|Foo}}
10392 {{echo|bar}} <div>baz</div>
10393 !! html
10394 <p>Foo
10395 </p>
10396 bar <div>baz</div>
10397
10398 !! html+tidy
10399 <p>Foo</p>
10400 <p>bar</p>
10401 <div>baz</div>
10402 !! end
10403
10404 !!test
10405 Templates: P-wrapping: 1d. Template preceded by comment-only line
10406 !!options
10407 parsoid
10408 !! wikitext
10409 <!-- foo -->
10410 {{echo|Bar}}
10411 !! html
10412 <!-- foo -->
10413
10414 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10415 !!end
10416
10417 !!test
10418 Templates: Inline Text: 1. Multiple template uses
10419 !! wikitext
10420 {{echo|Foo}}bar{{echo|baz}}
10421 !! html
10422 <p>Foobarbaz
10423 </p>
10424 !!end
10425
10426 !!test
10427 Templates: Inline Text: 2. Back-to-back template uses
10428 !! wikitext
10429 {{echo|Foo}}{{echo|bar}}
10430 !! html
10431 <p>Foobar
10432 </p>
10433 !!end
10434
10435 !!test
10436 Templates: Block Tags: 1. Multiple template uses
10437 !! wikitext
10438 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10439 !! html
10440 <div>Foo</div><div>bar</div><div>baz</div>
10441
10442 !!end
10443
10444 !!test
10445 Templates: Block Tags: 2. Back-to-back template uses
10446 !! wikitext
10447 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
10448 !! html
10449 <div>Foo</div><div>bar</div>
10450
10451 !!end
10452
10453 # This is an edge case relating to paragraph wrapping.
10454 !!test
10455 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
10456 !! wikitext
10457 {{echo|a
10458 b</p>}}
10459 !! html/parsoid
10460 <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
10461 b</p>
10462 !!end
10463
10464 !!test
10465 Templates: Links: 1. Simple example
10466 !! wikitext
10467 {{echo|[[Foo|bar]]}}
10468 !! html
10469 <p><a href="/wiki/Foo" title="Foo">bar</a>
10470 </p>
10471 !!end
10472
10473 !!test
10474 Templates: Links: 2. Generation of link href
10475 !! wikitext
10476 [[{{echo|Foo}}|bar]]
10477 !! html
10478 <p><a href="/wiki/Foo" title="Foo">bar</a>
10479 </p>
10480 !!end
10481
10482 !!test
10483 Templates: Links: 3. Generation of part of a link href
10484 !! wikitext
10485 [[Fo{{echo|o}}|bar]]
10486
10487 [[Foo{{echo|bar}}]]
10488
10489 [[Foo{{echo|bar}}baz]]
10490
10491 [[Foo{{echo|bar}}|bar]]
10492
10493 [[:Foo{{echo|bar}}]]
10494
10495 [[:Foo{{echo|bar}}|bar]]
10496 !! html
10497 <p><a href="/wiki/Foo" title="Foo">bar</a>
10498 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10499 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10500 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10501 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10502 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10503 </p>
10504 !!end
10505
10506 !!test
10507 Templates: Links: 4. Multiple templates generating link href
10508 !! wikitext
10509 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10510 !! html
10511 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10512 </p>
10513 !!end
10514
10515 !!test
10516 Templates: Links: 5. Generation of link text
10517 !! wikitext
10518 [[Foo|{{echo|bar}}]]
10519 !! html
10520 <p><a href="/wiki/Foo" title="Foo">bar</a>
10521 </p>
10522 !!end
10523
10524 !!test
10525 Templates: Links: 5. Nested templates (only outermost template should be marked)
10526 !! wikitext
10527 {{echo|[[{{echo|Foo}}|bar]]}}
10528 !! html
10529 <p><a href="/wiki/Foo" title="Foo">bar</a>
10530 </p>
10531 !!end
10532
10533 !!test
10534 Templates: HTML Tag: 1. Generation of HTML attr. key
10535 !! wikitext
10536 <div {{echo|style}}="color:red;">foo</div>
10537 !! html
10538 <div style="color:red;">foo</div>
10539
10540 !!end
10541
10542 !!test
10543 Templates: HTML Tag: 2. Generation of HTML attr. value
10544 !! wikitext
10545 <div style={{echo|'color:red;'}}>foo</div>
10546 !! html
10547 <div style="color:red;">foo</div>
10548
10549 !!end
10550
10551 !!test
10552 Templates: HTML Tag: 3. Generation of HTML attr key and value
10553 !! wikitext
10554 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10555 !! html
10556 <div style="color:red;">foo</div>
10557
10558 !!end
10559
10560 !!test
10561 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10562 !! wikitext
10563 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10564 !! html
10565 <div title="This is a long title with just one piece templated">foo</div>
10566
10567 !!end
10568
10569 !!test
10570 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10571 !! wikitext
10572 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10573 !! html
10574 <div title="This is a long title with just one piece templated">foo</div>
10575
10576 !!end
10577
10578 !!test
10579 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10580 !! wikitext
10581 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10582 !! html
10583 <div title="This is a long title with just one piece templated">foo</div>
10584
10585 !!end
10586
10587 # SSS FIXME: While it is great we added support for all this,
10588 # do we want to make this part of the spec? Maybe we want to
10589 # deprecate this kind of usage in the future?
10590 !!test
10591 Templates: HTML Tag: 7. Generation of partial attribute key string
10592 !! wikitext
10593 <div st{{echo|yle}}="color:red;">foo</div>
10594 !! html
10595 <div style="color:red;">foo</div>
10596
10597 !!end
10598
10599 !! test
10600 Templates: HTML Tag: 8. Template-generated attribute (k=v)
10601 !! wikitext
10602 <div {{echo|1=id="v1"}}>bar</div>
10603 !! html
10604 <div id="v1">bar</div>
10605
10606 !!end
10607
10608 !! test
10609 Templates: HTML Tag: 9. Multiple template-generated attributes
10610 !! wikitext
10611 <div {{echo|1=id="v1" title="foo"}}>bar</div>
10612 !! html
10613 <div id="v1" title="foo">bar</div>
10614
10615 !!end
10616
10617 !! test
10618 Templates: Support for templates generating attributes and content
10619 !! wikitext
10620 {| {{mixed_attr_content_template}}
10621 |-
10622 |bar
10623 |}
10624 !! html/php
10625 <table style="color:red;" title="T48811">
10626
10627 <tr>
10628 <td>foo
10629 </td></tr>
10630 <tr>
10631 <td>bar
10632 </td></tr></table>
10633
10634 !! html/parsoid
10635 <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|}"]}'>
10636 <tbody><tr>
10637 <td>foo</td></tr>
10638 <tr>
10639 <td>bar</td></tr>
10640 </tbody></table>
10641 !!end
10642
10643 !! test
10644 1. Entities and nowikis inside templated attributes should be handled correctly
10645 !! wikitext
10646 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
10647 !! html/php
10648 <div style="background:#f9f9f9;">foo</div>
10649
10650 !! html/parsoid
10651 <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","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;:[5,49,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;style{{=}}\\&amp;quot;background:&amp;amp;#35;f9f9f9;\\&amp;quot;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">style&lt;/span>&lt;span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;#35;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;#&amp;quot;}\">#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
10652 !! end
10653
10654 !! test
10655 2. Entities and nowikis inside templated attributes should be handled correctly
10656 !! wikitext
10657 {|
10658 |{{table_attribs_3}}
10659 |}
10660 !! html/php
10661 <table>
10662 <tr>
10663 <td style="background:#f9f9f9;">Foo
10664 </td></tr></table>
10665
10666 !! html/parsoid
10667 <table>
10668 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":0}}]}'>Foo</td></tr>
10669 </tbody></table>
10670 !! end
10671
10672 !!test
10673 Templates: HTML Tables: 1. Generating start of a HTML table
10674 !! wikitext
10675 {{echo|<table><tr><td>foo</td>}}</tr></table>
10676 !! html
10677 <table><tr><td>foo</td></tr></table>
10678
10679 !!end
10680
10681 !!test
10682 Templates: HTML Tables: 2a. Generating middle of a HTML table
10683 !! wikitext
10684 <table><tr>{{echo|<td>foo</td>}}</tr></table>
10685 !! html
10686 <table><tr><td>foo</td></tr></table>
10687
10688 !!end
10689
10690 !!test
10691 Templates: HTML Tables: 2b. Generating middle of a HTML table
10692 !! wikitext
10693 <table>{{echo|<tr><td>foo</td></tr>}}</table>
10694 !! html
10695 <table><tr><td>foo</td></tr></table>
10696
10697 !!end
10698
10699 !!test
10700 Templates: HTML Tables: 3. Generating end of a HTML table
10701 !! wikitext
10702 <table><tr>{{echo|<td>foo</td></tr></table>}}
10703 !! html
10704 <table><tr><td>foo</td></tr></table>
10705
10706 !!end
10707
10708 !!test
10709 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
10710 !! wikitext
10711 {{echo|<table>}}<tr><td>foo</td></tr></table>
10712 !! html
10713 <table><tr><td>foo</td></tr></table>
10714
10715 !!end
10716
10717 !!test
10718 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
10719 !! wikitext
10720 <table>{{echo|<tr>}}<td>foo</td></tr></table>
10721 !! html
10722 <table><tr><td>foo</td></tr></table>
10723
10724 !!end
10725
10726 !!test
10727 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
10728 !! wikitext
10729 <table><tr>{{echo|<td>}}foo</td></tr></table>
10730 !! html
10731 <table><tr><td>foo</td></tr></table>
10732
10733 !!end
10734
10735 !!test
10736 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
10737 !! wikitext
10738 <table><tr><td>foo{{echo|</td>}}</tr></table>
10739 !! html
10740 <table><tr><td>foo</td></tr></table>
10741
10742 !!end
10743
10744 !!test
10745 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
10746 !! wikitext
10747 <table><tr><td>foo</td>{{echo|</tr>}}</table>
10748 !! html
10749 <table><tr><td>foo</td></tr></table>
10750
10751 !!end
10752
10753 !!test
10754 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
10755 !! wikitext
10756 <table><tr><td>foo</td></tr>{{echo|</table>}}
10757 !! html
10758 <table><tr><td>foo</td></tr></table>
10759
10760 !!end
10761
10762 !!test
10763 Templates: HTML Tables: 5. Proper fostering of categories from inside
10764 !!options
10765 parsoid=wt2html,wt2wt
10766 !! wikitext
10767 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
10768 <!--Two categories (Bug 50330)-->
10769 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
10770 !! html
10771 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
10772 <!--Two categories (Bug 50330)-->
10773 <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>
10774 !!end
10775
10776 !!test
10777 Templates: Wiki Tables: 1a. Fostering of entire template content
10778 !! wikitext
10779 {|
10780 {{echo|a}}
10781 |}
10782 !! html
10783 <table>
10784 a
10785 <tr><td></td></tr></table>
10786
10787 !! html+tidy
10788 <p>a</p>
10789 <table>
10790 <tr>
10791 <td></td>
10792 </tr>
10793 </table>
10794 !! end
10795
10796 !!test
10797 Templates: Wiki Tables: 1b. Fostering of entire template content
10798 !! wikitext
10799 {|
10800 {{echo|<div>}}
10801 foo
10802 {{echo|</div>}}
10803 |}
10804 !! html
10805 <table>
10806 <div>
10807 <p>foo
10808 </p>
10809 </div>
10810 <tr><td></td></tr></table>
10811
10812 !! html+tidy
10813 <div>
10814 <p>foo</p>
10815 </div>
10816 <table>
10817 <tr>
10818 <td></td>
10819 </tr>
10820 </table>
10821 !! end
10822
10823 !!test
10824 Templates: Wiki Tables: 2. Fostering of partial template content
10825 !! wikitext
10826 {|
10827 {{echo|a
10828 <div>b</div>}}
10829 |}
10830 !! html
10831 <table>
10832 a
10833 <div>b</div>
10834 <tr><td></td></tr></table>
10835
10836 !! html+tidy
10837 <p>a</p>
10838 <div>b</div>
10839 <table>
10840 <tr>
10841 <td></td>
10842 </tr>
10843 </table>
10844 !! end
10845
10846 !!test
10847 Templates: Wiki Tables: 3. td-content via multiple templates
10848 !! wikitext
10849 {|
10850 {{echo|{{pipe}}a}}{{echo|b}}
10851 |}
10852 !! html
10853 <table>
10854 <tr>
10855 <td>ab
10856 </td></tr></table>
10857
10858 !!end
10859
10860 !!test
10861 Templates: Wiki Tables: 4. Templated tags, no content
10862 !! wikitext
10863 {{tbl-start}}
10864 {{tbl-end}}
10865 !! html
10866 <table>
10867 <tr><td></td></tr></table>
10868
10869 !!end
10870
10871 !!test
10872 Templates: Wiki Tables: 5. Templated tags, regular td-tags
10873 !! wikitext
10874 {{tbl-start}}
10875 |foo
10876 {{tbl-end}}
10877 !! html
10878 <table>
10879 <tr>
10880 <td>foo
10881 </td></tr></table>
10882
10883 !!end
10884
10885 !!test
10886 Templates: Wiki Tables: 6. Templated tags, templated td-tags
10887 !! wikitext
10888 {{tbl-start}}
10889 {{!}}foo
10890 {{tbl-end}}
10891 !! html
10892 <table>
10893 <tr>
10894 <td>foo
10895 </td></tr></table>
10896
10897 !!end
10898
10899 !!test
10900 Templates: Lists: Multi-line list-items via templates
10901 !! wikitext
10902 *{{echo|a {{nonexistent|
10903 unused}}}}
10904 *{{echo|b {{nonexistent|
10905 unused}}}}
10906 !! html
10907 <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>
10908 <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>
10909
10910 !!end
10911
10912 !!test
10913 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
10914 !! wikitext
10915 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
10916 !! html
10917 <p><i>ab</i>c<i>d</i>e
10918 </p>
10919 !!end
10920
10921 !!test
10922 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
10923 (PHP parser generates misnested html)
10924 !! wikitext
10925 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
10926 !! html/parsoid
10927 <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>
10928 !!end
10929
10930 !!test
10931 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
10932 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
10933 !! options
10934 parsoid=wt2html,wt2wt
10935 !! wikitext
10936 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
10937 !! html
10938 <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>
10939 <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>
10940 <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>
10941 !!end
10942
10943 !!test
10944 Templates: Ugly nesting: 4. Divs opened/closed across templates
10945 !! wikitext
10946 a<div>b{{echo|c</div>d}}e
10947 !! html
10948 a<div>bc</div>de
10949
10950 !! html+tidy
10951 <p>a</p>
10952 <div>bc</div>
10953 <p>de</p>
10954 !! end
10955
10956 !!test
10957 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10958 (Parsoid-centric)
10959 !! options
10960 parsoid
10961 !! wikitext
10962 {|
10963 |{{echo|foo</table>}}
10964 |bar
10965 |}
10966 !! html
10967 <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|}"]}'>
10968
10969 <tbody>
10970 <tr>
10971 <td>foo</td></tr></tbody></table><span about="#mwt1">
10972 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10973 |}</span>
10974 !!end
10975
10976 !!test
10977 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10978 (Parsoid-centric)
10979 !! options
10980 parsoid
10981 !! wikitext
10982 <table>
10983 <tr>
10984 <td>
10985 <table>
10986 <tr>
10987 <td>1. {{echo|foo </table>}}</td>
10988 <td> bar </td>
10989 <td>2. {{echo|baz </table>}}</td>
10990 </tr>
10991 <tr>
10992 <td>abc</td>
10993 </tr>
10994 </table>
10995 </td>
10996 </tr>
10997 <tr>
10998 <td>xyz</td>
10999 </tr>
11000 </table>
11001 !! html
11002 <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>"]}'>
11003 <tbody><tr>
11004 <td>
11005 <table>
11006 <tbody><tr>
11007 <td>1. foo </td></tr></tbody></table></td>
11008 <td> bar </td>
11009 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11010 </span><span about="#mwt2">
11011 </span><span about="#mwt2">
11012 </span><span about="#mwt2">abc</span><span about="#mwt2">
11013 </span><span about="#mwt2">
11014 </span><span about="#mwt2">
11015 </span><span about="#mwt2">
11016 </span><span about="#mwt2">
11017 </span><span about="#mwt2">
11018 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11019 </span><span about="#mwt2">
11020 </span>
11021 !!end
11022
11023 !! test
11024 Templates: Ugly templates: 3. newline-only template parameter
11025 !! wikitext
11026 foo {{echo|
11027 }}
11028 !! html
11029 <p>foo
11030 </p>
11031 !! end
11032
11033 # This looks like a bug: a single newline triggers p/br for some reason.
11034 !! test
11035 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11036 !! wikitext
11037 {{echo|
11038 }}
11039 !! html
11040 <p><br />
11041 </p>
11042 !! end
11043
11044 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11045 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11046 !! test
11047 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11048 !! wikitext
11049 {{echo|<table>}}
11050 {{echo|<div>foo}}
11051 {{echo|</table>}}
11052 !! html/parsoid
11053 <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
11054 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11055 </table>
11056 !! end
11057
11058 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11059 # that are "identical" and generate nesting cycles in the algorithm
11060 !! test
11061 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11062 !! wikitext
11063 {{echo|<table><tr><td><table>}}
11064 {{echo|<div>}}
11065 {{echo|</div>}}
11066 !! html/parsoid
11067 <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"}'>
11068 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11069 </table></td></tr></tbody></table>
11070 !! end
11071
11072 !!test
11073 Parser Functions: 1. Simple example
11074 !! wikitext
11075 {{uc:foo}}
11076 !! html
11077 <p>FOO
11078 </p>
11079 !!end
11080
11081 !!test
11082 Parser Functions: 2. Nested use (only outermost should be marked up)
11083 !! wikitext
11084 {{uc:{{lc:FOO}}}}
11085 !! html
11086 <p>FOO
11087 </p>
11088 !!end
11089
11090 ###
11091 ### Pre-save transform tests
11092 ###
11093 !! test
11094 pre-save transform: subst:
11095 !! options
11096 PST
11097 !! wikitext
11098 {{subst:test}}
11099 !! html
11100 This is a test template
11101 !! end
11102
11103 !! test
11104 pre-save transform: normal template
11105 !! options
11106 PST
11107 !! wikitext
11108 {{test}}
11109 !! html
11110 {{test}}
11111 !! end
11112
11113 !! test
11114 pre-save transform: nonexistent template
11115 !! options
11116 PST
11117 !! wikitext
11118 {{thistemplatedoesnotexist}}
11119 !! html
11120 {{thistemplatedoesnotexist}}
11121 !! end
11122
11123
11124 !! test
11125 pre-save transform: subst magic variables
11126 !! options
11127 PST
11128 !! wikitext
11129 {{subst:SITENAME}}
11130 !! html
11131 MediaWiki
11132 !! end
11133
11134 # This is bug 89, which I fixed. -- wtm
11135 !! test
11136 pre-save transform: subst: templates with parameters
11137 !! options
11138 pst
11139 !! wikitext
11140 {{subst:paramtest|param="something else"}}
11141 !! html
11142 This is a test template with parameter "something else"
11143 !! end
11144
11145 !! article
11146 Template:nowikitest
11147 !! text
11148 <nowiki>'''not wiki'''</nowiki>
11149 !! endarticle
11150
11151 !! test
11152 pre-save transform: nowiki in subst (bug 1188)
11153 !! options
11154 pst
11155 !! wikitext
11156 {{subst:nowikitest}}
11157 !! html
11158 <nowiki>'''not wiki'''</nowiki>
11159 !! end
11160
11161
11162 !! article
11163 Template:commenttest
11164 !! text
11165 This template has <!-- a comment --> in it.
11166 !! endarticle
11167
11168 !! test
11169 pre-save transform: comment in subst (bug 1936)
11170 !! options
11171 pst
11172 !! wikitext
11173 {{subst:commenttest}}
11174 !! html
11175 This template has <!-- a comment --> in it.
11176 !! end
11177
11178 !! test
11179 pre-save transform: unclosed tag
11180 !! options
11181 pst noxml
11182 !! wikitext
11183 <nowiki>'''not wiki'''
11184 !! html
11185 <nowiki>'''not wiki'''
11186 !! end
11187
11188 !! test
11189 pre-save transform: mixed tag case
11190 !! options
11191 pst noxml
11192 !! wikitext
11193 <NOwiki>'''not wiki'''</noWIKI>
11194 !! html
11195 <NOwiki>'''not wiki'''</noWIKI>
11196 !! end
11197
11198 !! test
11199 pre-save transform: unclosed comment in <nowiki>
11200 !! options
11201 pst noxml
11202 !! wikitext
11203 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11204 !! html
11205 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11206 !!end
11207
11208 # Leading @ in this template definition works around a limitation
11209 # in parsoid's parserTests which otherwise strips the <span> from the
11210 # result (confusing it for a template wrapper)
11211 !! article
11212 Template:dangerous
11213 !!text
11214 @<span onmouseover="alert('crap')">Oh no</span>
11215 !!endarticle
11216
11217 !!test
11218 (confirming safety of fix for subst bug 1936)
11219 !! wikitext
11220 {{Template:dangerous}}
11221 !! html
11222 <p>@<span>Oh no</span>
11223 </p>
11224 !! end
11225
11226 !! test
11227 pre-save transform: comment containing gallery (bug 5024)
11228 !! options
11229 pst
11230 !! wikitext
11231 <!-- <gallery>data</gallery> -->
11232 !! html
11233 <!-- <gallery>data</gallery> -->
11234 !!end
11235
11236 !! test
11237 pre-save transform: comment containing extension
11238 !! options
11239 pst
11240 !! wikitext
11241 <!-- <tag>data</tag> -->
11242 !! html
11243 <!-- <tag>data</tag> -->
11244 !!end
11245
11246 !! test
11247 pre-save transform: comment containing nowiki
11248 !! options
11249 pst
11250 !! wikitext
11251 <!-- <nowiki>data</nowiki> -->
11252 !! html
11253 <!-- <nowiki>data</nowiki> -->
11254 !!end
11255
11256 !! test
11257 pre-save transform: <noinclude> in subst (bug 3298)
11258 !! options
11259 pst
11260 !! wikitext
11261 {{subst:Includes}}
11262 !! html
11263 Foobar
11264 !! end
11265
11266 !! test
11267 pre-save transform: <onlyinclude> in subst (bug 3298)
11268 !! options
11269 pst
11270 !! wikitext
11271 {{subst:Includes2}}
11272 !! html
11273 Foo
11274 !! end
11275
11276 !! article
11277 Template:SubstTest
11278 !!text
11279 {{<includeonly>subst:</includeonly>Includes}}
11280 !! endarticle
11281
11282 !! article
11283 Template:SafeSubstTest
11284 !! text
11285 {{<includeonly>safesubst:</includeonly>Includes}}
11286 !! endarticle
11287
11288 !! test
11289 bug 22297: safesubst: works during PST
11290 !! options
11291 pst
11292 !! wikitext
11293 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
11294 !! html
11295 FoobarFoobar
11296 !! end
11297
11298 !! test
11299 bug 22297: safesubst: works during normal parse
11300 !! wikitext
11301 {{SafeSubstTest}}
11302 !! html
11303 <p>Foobar
11304 </p>
11305 !! end
11306
11307 !! test
11308 subst: does not work during normal parse
11309 !! wikitext
11310 {{SubstTest}}
11311 !! html
11312 <p>{{subst:Includes}}
11313 </p>
11314 !! end
11315
11316 !! test
11317 pre-save transform: context links ("pipe trick")
11318 !! options
11319 pst
11320 !! wikitext
11321 [[Article (context)|]]
11322 [[Bar:Article|]]
11323 [[:Bar:Article|]]
11324 [[Bar:Article (context)|]]
11325 [[:Bar:Article (context)|]]
11326 [[|Article]]
11327 [[|Article (context)]]
11328 [[Bar:X (Y) Z|]]
11329 [[:Bar:X (Y) Z|]]
11330 !! html
11331 [[Article (context)|Article]]
11332 [[Bar:Article|Article]]
11333 [[:Bar:Article|Article]]
11334 [[Bar:Article (context)|Article]]
11335 [[:Bar:Article (context)|Article]]
11336 [[Article]]
11337 [[Article (context)]]
11338 [[Bar:X (Y) Z|X (Y) Z]]
11339 [[:Bar:X (Y) Z|X (Y) Z]]
11340 !! end
11341
11342 !! test
11343 pre-save transform: context links ("pipe trick") with interwiki prefix
11344 !! options
11345 pst
11346 !! wikitext
11347 [[interwiki:Article|]]
11348 [[:interwiki:Article|]]
11349 [[interwiki:Bar:Article|]]
11350 [[:interwiki:Bar:Article|]]
11351 !! html
11352 [[interwiki:Article|Article]]
11353 [[:interwiki:Article|Article]]
11354 [[interwiki:Bar:Article|Bar:Article]]
11355 [[:interwiki:Bar:Article|Bar:Article]]
11356 !! end
11357
11358 !! test
11359 pre-save transform: context links ("pipe trick") with parens in title
11360 !! options
11361 pst title=[[Somearticle (context)]]
11362 !! wikitext
11363 [[|Article]]
11364 !! html
11365 [[Article (context)|Article]]
11366 !! end
11367
11368 !! test
11369 pre-save transform: context links ("pipe trick") with comma in title
11370 !! options
11371 pst title=[[Someplace, Somewhere]]
11372 !! wikitext
11373 [[|Otherplace]]
11374 [[Otherplace, Elsewhere|]]
11375 [[Otherplace, Elsewhere, Anywhere|]]
11376 !! html
11377 [[Otherplace, Somewhere|Otherplace]]
11378 [[Otherplace, Elsewhere|Otherplace]]
11379 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
11380 !! end
11381
11382 !! test
11383 pre-save transform: context links ("pipe trick") with parens and comma
11384 !! options
11385 pst title=[[Someplace (IGNORED), Somewhere]]
11386 !! wikitext
11387 [[|Otherplace]]
11388 [[Otherplace (place), Elsewhere|]]
11389 !! html
11390 [[Otherplace, Somewhere|Otherplace]]
11391 [[Otherplace (place), Elsewhere|Otherplace]]
11392 !! end
11393
11394 !! test
11395 pre-save transform: context links ("pipe trick") with comma and parens
11396 !! options
11397 pst title=[[Who, me? (context)]]
11398 !! wikitext
11399 [[|Yes, you.]]
11400 [[Me, Myself, and I (1937 song)|]]
11401 !! html
11402 [[Yes, you. (context)|Yes, you.]]
11403 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
11404 !! end
11405
11406 !! test
11407 pre-save transform: context links ("pipe trick") with namespace
11408 !! options
11409 pst title=[[Ns:Somearticle]]
11410 !! wikitext
11411 [[|Article]]
11412 !! html
11413 [[Ns:Article|Article]]
11414 !! end
11415
11416 !! test
11417 pre-save transform: context links ("pipe trick") with namespace and parens
11418 !! options
11419 pst title=[[Ns:Somearticle (context)]]
11420 !! wikitext
11421 [[|Article]]
11422 !! html
11423 [[Ns:Article (context)|Article]]
11424 !! end
11425
11426 !! test
11427 pre-save transform: context links ("pipe trick") with namespace and comma
11428 !! options
11429 pst title=[[Ns:Somearticle, Context, Whatever]]
11430 !! wikitext
11431 [[|Article]]
11432 !! html
11433 [[Ns:Article, Context, Whatever|Article]]
11434 !! end
11435
11436 !! test
11437 pre-save transform: context links ("pipe trick") with namespace, comma and parens
11438 !! options
11439 pst title=[[Ns:Somearticle, Context (context)]]
11440 !! wikitext
11441 [[|Article]]
11442 !! html
11443 [[Ns:Article (context)|Article]]
11444 !! end
11445
11446 !! test
11447 pre-save transform: context links ("pipe trick") with namespace, parens and comma
11448 !! options
11449 pst title=[[Ns:Somearticle (IGNORED), Context]]
11450 !! wikitext
11451 [[|Article]]
11452 !! html
11453 [[Ns:Article, Context|Article]]
11454 !! end
11455
11456 !! test
11457 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
11458 !! options
11459 pst
11460 !! wikitext
11461 [[Article(context)|]]
11462 [[Bar:Article(context)|]]
11463 [[:Bar:Article(context)|]]
11464 [[|Article(context)]]
11465 [[Bar:X(Y)Z|]]
11466 [[:Bar:X(Y)Z|]]
11467 !! html
11468 [[Article(context)|Article]]
11469 [[Bar:Article(context)|Article]]
11470 [[:Bar:Article(context)|Article]]
11471 [[Article(context)]]
11472 [[Bar:X(Y)Z|X(Y)Z]]
11473 [[:Bar:X(Y)Z|X(Y)Z]]
11474 !! end
11475
11476 !! test
11477 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
11478 !! options
11479 pst
11480 !! wikitext
11481 [[Article (context)|]]
11482 [[Bar:Article (context)|]]
11483 [[:Bar:Article (context)|]]
11484 [[|Article (context)]]
11485 [[Bar:X (Y) Z|]]
11486 [[:Bar:X (Y) Z|]]
11487 !! html
11488 [[Article (context)|Article]]
11489 [[Bar:Article (context)|Article]]
11490 [[:Bar:Article (context)|Article]]
11491 [[Article (context)]]
11492 [[Bar:X (Y) Z|X (Y) Z]]
11493 [[:Bar:X (Y) Z|X (Y) Z]]
11494 !! end
11495
11496 !! test
11497 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
11498 !! options
11499 pst
11500 !! wikitext
11501 [[Article(context)|]]
11502 [[Bar:Article(context)|]]
11503 [[:Bar:Article(context)|]]
11504 [[|Article(context)]]
11505 [[Bar:X(Y)Z|]]
11506 [[:Bar:X(Y)Z|]]
11507 !! html
11508 [[Article(context)|Article]]
11509 [[Bar:Article(context)|Article]]
11510 [[:Bar:Article(context)|Article]]
11511 [[Article(context)]]
11512 [[Bar:X(Y)Z|X(Y)Z]]
11513 [[:Bar:X(Y)Z|X(Y)Z]]
11514 !! end
11515
11516 !! test
11517 pre-save transform: context links ("pipe trick") with commas (bug 21660)
11518 !! options
11519 pst
11520 !! wikitext
11521 [[Article (context), context|]]
11522 [[Article (context),context|]]
11523 [[Bar:Article (context), context|]]
11524 [[Bar:Article (context),context|]]
11525 [[:Bar:Article (context), context|]]
11526 [[:Bar:Article (context),context|]]
11527 !! html
11528 [[Article (context), context|Article]]
11529 [[Article (context),context|Article]]
11530 [[Bar:Article (context), context|Article]]
11531 [[Bar:Article (context),context|Article]]
11532 [[:Bar:Article (context), context|Article]]
11533 [[:Bar:Article (context),context|Article]]
11534 !! end
11535
11536 !! test
11537 pre-save transform: trim trailing empty lines
11538 !! options
11539 pst
11540 !! wikitext
11541 Empty lines are trimmed
11542
11543
11544
11545
11546 !! html
11547 Empty lines are trimmed
11548 !! end
11549
11550 !! test
11551 pre-save transform: Signature expansion
11552 !! options
11553 pst
11554 !! wikitext
11555 * ~~~
11556 * <noinclude>~~~</noinclude>
11557 * <includeonly>~~~</includeonly>
11558 * <onlyinclude>~~~</onlyinclude>
11559 !! html
11560 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
11561 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
11562 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
11563 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
11564 !! end
11565
11566
11567 !! test
11568 pre-save transform: Signature expansion in nowiki tags (bug 93)
11569 !! options
11570 pst disabled
11571 !! wikitext
11572 Shall not expand:
11573
11574 <nowiki>~~~~</nowiki>
11575
11576 <includeonly><nowiki>~~~~</nowiki></includeonly>
11577
11578 <noinclude><nowiki>~~~~</nowiki></noinclude>
11579
11580 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11581
11582 {{subst:Foo}} shall be converted to FOO
11583
11584 As well as inside noinclude/onlyinclude
11585 <noinclude>{{subst:Foo}}</noinclude>
11586 <onlyinclude>{{subst:Foo}}</onlyinclude>
11587
11588 But not inside includeonly
11589 <includeonly>{{subst:Foo}}</includeonly>
11590 !! html
11591 Shall not expand:
11592
11593 <nowiki>~~~~</nowiki>
11594
11595 <includeonly><nowiki>~~~~</nowiki></includeonly>
11596
11597 <noinclude><nowiki>~~~~</nowiki></noinclude>
11598
11599 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11600
11601 FOO shall be converted to FOO
11602
11603 As well as inside noinclude/onlyinclude
11604 <noinclude>FOO</noinclude>
11605 <onlyinclude>FOO</onlyinclude>
11606
11607 But not inside includeonly
11608 <includeonly>{{subst:Foo}}</includeonly>
11609 !! end
11610
11611 !! test
11612 Parsoid: Recognize nowiki with trailing space in tags
11613 !! options
11614 parsoid=wt2html
11615 !! wikitext
11616 <nowiki ><div>[[foo]]</nowiki >
11617
11618 a<nowiki / >b
11619
11620 c<nowiki />d
11621
11622 e<nowiki/ >f
11623 !! html
11624 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11625 <p>ab</p>
11626 <p>cd</p>
11627 <p>ef</p>
11628 !! end
11629
11630 !! test
11631 Parsoid: Recognize nowiki with odd capitalization
11632 !! options
11633 parsoid=wt2html
11634 !! wikitext
11635 <noWikI ><div>[[foo]]</Nowiki >
11636 !! html
11637 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11638 !! end
11639
11640
11641 !! test
11642 Parsoid: Escape nowiki with trailing space in tags
11643 !! options
11644 parsoid=html2wt
11645 !! html
11646 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
11647 <p>a&lt;nowiki /&gt;b</p>
11648 <p>c&lt;nowiki/ &gt;d</p>
11649 !! wikitext
11650 &lt;nowiki &gt; foo &lt;/nowiki &gt;
11651
11652 a&lt;nowiki /&gt;b
11653
11654 c&lt;nowiki/ &gt;d
11655 !! end
11656
11657 !! test
11658 Parsoid: Escape weird noWikI capitalizations
11659 !! options
11660 parsoid=html2wt
11661 !! html
11662 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
11663 !! wikitext
11664 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
11665 !! end
11666
11667 ###
11668 ### Message transform tests
11669 ###
11670 !! test
11671 message transform: magic variables
11672 !! options
11673 msg
11674 !! wikitext
11675 {{SITENAME}}
11676 !! html
11677 MediaWiki
11678 !! end
11679
11680 !! test
11681 message transform: should not transform wiki markup
11682 !! options
11683 msg
11684 !! wikitext
11685 ''test''
11686 !! html
11687 ''test''
11688 !! end
11689
11690 !! test
11691 message transform: <noinclude> in transcluded template (bug 4926)
11692 !! options
11693 msg
11694 !! wikitext
11695 {{Includes}}
11696 !! html
11697 Foobar
11698 !! end
11699
11700 !! test
11701 message transform: <onlyinclude> in transcluded template (bug 4926)
11702 !! options
11703 msg
11704 !! wikitext
11705 {{Includes2}}
11706 !! html
11707 Foo
11708 !! end
11709
11710 !! test
11711 {{#special:}} page name, known
11712 !! options
11713 msg
11714 !! wikitext
11715 {{#special:Recentchanges}}
11716 !! html
11717 Special:RecentChanges
11718 !! end
11719
11720 !! test
11721 {{#special:}} page name with subpage, known
11722 !! options
11723 msg
11724 !! wikitext
11725 {{#special:Recentchanges/param}}
11726 !! html
11727 Special:RecentChanges/param
11728 !! end
11729
11730 !! test
11731 {{#special:}} page name, unknown
11732 !! options
11733 msg
11734 !! wikitext
11735 {{#special:foobar nonexistent}}
11736 !! html
11737 Special:Foobar nonexistent
11738 !! end
11739
11740 !! test
11741 {{#speciale:}} page name, known
11742 !! options
11743 msg
11744 !! wikitext
11745 {{#speciale:Recentchanges}}
11746 !! html
11747 Special:RecentChanges
11748 !! end
11749
11750 !! test
11751 {{#speciale:}} page name with subpage, known
11752 !! options
11753 msg
11754 !! wikitext
11755 {{#speciale:Recentchanges/param}}
11756 !! html
11757 Special:RecentChanges/param
11758 !! end
11759
11760 !! test
11761 {{#speciale:}} page name, unknown
11762 !! options
11763 msg
11764 !! wikitext
11765 {{#speciale:foobar nonexistent}}
11766 !! html
11767 Special:Foobar_nonexistent
11768 !! end
11769
11770 ###
11771 ### Images
11772 ###
11773 ### For Parsoid-specific tests, see
11774 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11775
11776 !! test
11777 Simple image
11778 !! options
11779 parsoid=wt2html,wt2wt,html2html
11780 !! wikitext
11781 [[Image:foobar.jpg]]
11782 !! html/php
11783 <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>
11784 </p>
11785 !! html/parsoid
11786 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
11787 !! end
11788
11789 !! test
11790 Simple image (using File: namespace, now canonical)
11791 !! wikitext
11792 [[File:Foobar.jpg]]
11793 !! html/php
11794 <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>
11795 </p>
11796 !! html/parsoid
11797 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
11798 !! end
11799
11800 !! test
11801 Right-aligned image
11802 !! wikitext
11803 [[File:Foobar.jpg|right]]
11804 !! html/php
11805 <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>
11806
11807 !! html/parsoid
11808 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
11809 !! end
11810
11811 !! test
11812 Image with caption
11813 !! wikitext
11814 [[File:Foobar.jpg|right|Caption text]]
11815 !! html/php
11816 <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>
11817
11818 !! html/parsoid
11819 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
11820 !! end
11821
11822 !! test
11823 Image with caption, bug 53312 #1
11824 !! wikitext
11825 [[File:Foobar.jpg|right|Caption page stuff]]
11826 !! html/php
11827 <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>
11828
11829 !! html/parsoid
11830 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page stuff</figcaption></figure>
11831 !! end
11832
11833 !! test
11834 Image with caption, bug 53312 #2
11835 !! wikitext
11836 [[File:Foobar.jpg|right|Caption page=]]
11837 !! html/php
11838 <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>
11839
11840 !! html/parsoid
11841 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=</figcaption></figure>
11842 !! end
11843
11844 !! test
11845 Image with caption, bug 53312 #3
11846 !! wikitext
11847 [[File:Foobar.jpg|right|Caption page=stuff]]
11848 !! html/php
11849 <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>
11850
11851 !! html/parsoid
11852 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=stuff</figcaption></figure>
11853 !! end
11854
11855 !! test
11856 Allow empty links in image captions (Bug 60753)
11857 !! options
11858 thumbsize=220
11859 !! wikitext
11860 [[File:Foobar.jpg|thumb|Caption [[Link1]]
11861 [[]]
11862 [[Link2]]
11863 ]]
11864 !! html/php
11865 <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>
11866
11867 !! html/parsoid
11868 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" 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>
11869 [[]]
11870 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
11871 </figcaption></figure>
11872 !! end
11873
11874 !! test
11875 Titles in unlinked images (T23454)
11876 !! wikitext
11877 [[File:Foobar.jpg|link=|stuff]]
11878 !! html/php
11879 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
11880 </p>
11881 !! end
11882
11883 !! test
11884 Link with empty target
11885 !! wikitext
11886 [[]]
11887 !! html
11888 <p>[[]]
11889 </p>
11890 !! end
11891
11892 !! test
11893 Image with link trail
11894 !! wikitext
11895 Linktrails should not work for images: [[File:Foobar.jpg]]s
11896 !! html/php
11897 <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
11898 </p>
11899 !! html/parsoid
11900 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span>s</p>
11901 !! end
11902
11903 !! test
11904 Image with empty attribute
11905 !! options
11906 parsoid=wt2html,wt2wt,html2html
11907 !! wikitext
11908 [[File:Foobar.jpg|right||Caption text]]
11909 !! html/php
11910 <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>
11911
11912 !! html/parsoid
11913 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
11914 !! end
11915
11916 !! test
11917 1. Block image with individual attributes from templates
11918 !! wikitext
11919 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
11920 !! html/php
11921 <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>
11922
11923 !! html/parsoid
11924 <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/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
11925 !! end
11926
11927 !! test
11928 2. Block Image with individual attributes from templates
11929 !! wikitext
11930 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
11931 !! html/php
11932 <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>
11933
11934 !! html/parsoid
11935 <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/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
11936 !! end
11937
11938 !! test
11939 3. Inline image with individual attributes from templates
11940 !! wikitext
11941 [[File:Foobar.jpg|{{echo|50px}}]]
11942 !! html/php
11943 <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>
11944 </p>
11945 !! html/parsoid
11946 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
11947 !! end
11948
11949 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
11950 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
11951 !! test
11952 Image with multiple attributes from the same template
11953 !! wikitext
11954 [[File:Foobar.jpg|{{image_attribs}}]]
11955 !! html/php
11956 <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>
11957
11958 !! html/parsoid
11959 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
11960 !! end
11961
11962 !! test
11963 Image with link tails
11964 !! options
11965 thumbsize=220
11966 !! wikitext
11967 123[[File:Foobar.jpg]]456
11968 123[[File:Foobar.jpg|right]]456
11969 123[[File:Foobar.jpg|thumb]]456
11970 !! html/php
11971 <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
11972 </p>
11973 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
11974 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
11975
11976 !! html/php+tidy
11977 <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>
11978 <p>123</p>
11979 <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>
11980 <p>456 123</p>
11981 <div class="thumb tright">
11982 <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>
11983 <div class="thumbcaption">
11984 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11985 </div>
11986 </div>
11987 </div>
11988 <p>456</p>
11989 !! html/parsoid
11990 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span>456</p>
11991 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure><p>456</p>
11992 <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/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure><p>456</p>
11993 !! end
11994
11995 !! test
11996 Image with multiple captions -- only last one is accepted
11997 !! wikitext
11998 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11999 !! html/php
12000 <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>
12001
12002 !! html/parsoid
12003 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption3 - accepted</figcaption></figure>
12004 !! end
12005
12006 !! test
12007 Image with multiple widths -- use last
12008 !! wikitext
12009 [[File:Foobar.jpg|200px|300px|caption]]
12010 !! html/php
12011 <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>
12012 </p>
12013 !! html/parsoid
12014 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></span></p>
12015 !! end
12016
12017 !! test
12018 Image with multiple alignments -- use first (bug 48664)
12019 !! options
12020 thumbsize=220
12021 !! wikitext
12022 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12023
12024 [[File:Foobar.jpg|middle|text-top|caption]]
12025 !! html/php
12026 <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>
12027 <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>
12028 </p>
12029 !! html/parsoid
12030 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12031 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12032 !! end
12033
12034 !! test
12035 Image with width attribute at different positions
12036 !! wikitext
12037 [[File:Foobar.jpg|200px|right|Caption]]
12038 [[File:Foobar.jpg|right|200px|Caption]]
12039 [[File:Foobar.jpg|right|Caption|200px]]
12040 !! html/php
12041 <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>
12042 <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>
12043 <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>
12044
12045 !! html/parsoid
12046 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
12047 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
12048 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
12049 !! end
12050
12051 # a sad bit of backward-compatibility
12052 !! test
12053 Image with size specified with pxpx (bug 13500, 51628)
12054 !! options
12055 parsoid=wt2html,wt2wt,html2html
12056 !! wikitext
12057 [[File:Foobar.jpg|20pxpx]]
12058 [[File:Foobar.jpg|200x20pxpx]]
12059 !! html/php
12060 <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>
12061 <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>
12062 </p>
12063 !! html/parsoid
12064 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" 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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="177"/></a></span></p>
12065 !! end
12066
12067 !! test
12068 Image with link parameter, wiki target
12069 !! wikitext
12070 [[File:Foobar.jpg|link=Main Page]]
12071 !! html/php
12072 <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>
12073 </p>
12074 !! html/parsoid
12075 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12076 !! end
12077
12078 # parsoid bug 49293 (part 1)
12079 !! test
12080 Image with link parameter, URL target
12081 !! wikitext
12082 [[File:Foobar.jpg|link=http://example.com/]]
12083 !! html/php
12084 <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>
12085 </p>
12086 !! html/parsoid
12087 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12088 !! end
12089
12090 # parsoid bug 49293 (part 2)
12091 !! test
12092 Image with link parameter, protocol-less URL target
12093 !! wikitext
12094 [[File:Foobar.jpg|link=//example.com/]]
12095 !! html/php
12096 <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>
12097 </p>
12098 !! html/parsoid
12099 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12100 !! end
12101
12102 !! test
12103 Image with link parameter, wgExternalLinkTarget
12104 !! wikitext
12105 [[Image:foobar.jpg|link=http://example.com/]]
12106 !! config
12107 wgExternalLinkTarget='foobar'
12108 !! html
12109 <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>
12110 </p>
12111 !! end
12112
12113 !! test
12114 Image with link parameter, wgNoFollowLinks set to false
12115 !! wikitext
12116 [[Image:foobar.jpg|link=http://example.com/]]
12117 !! config
12118 wgNoFollowLinks=false
12119 !! html
12120 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12121 </p>
12122 !! end
12123
12124 !! test
12125 Image with link parameter, wgNoFollowDomainExceptions
12126 !! wikitext
12127 [[Image:foobar.jpg|link=http://example.com/]]
12128 !! config
12129 wgNoFollowDomainExceptions='example.com'
12130 !! html
12131 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12132 </p>
12133 !! end
12134
12135 !! test
12136 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12137 !! wikitext
12138 [[Image:foobar.jpg|link=http://example.com/|Title]]
12139 !! config
12140 wgExternalLinkTarget='foobar'
12141 !! html
12142 <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>
12143 </p>
12144 !! end
12145
12146 !! test
12147 Image with empty link parameter
12148 !! wikitext
12149 [[File:Foobar.jpg|link=]]
12150 !! html/php
12151 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12152 </p>
12153 !! html/parsoid
12154 <p><span class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></span></span></p>
12155 !! end
12156
12157 !! test
12158 Image with link parameter (wiki target) and unnamed parameter
12159 !! wikitext
12160 [[File:Foobar.jpg|link=Main_Page|Title]]
12161 !! html/php
12162 <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>
12163 </p>
12164 !! html/parsoid
12165 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12166 !! end
12167
12168 !! test
12169 Image with link parameter (URL target) and unnamed parameter
12170 !! wikitext
12171 [[File:Foobar.jpg|link=http://example.com/|Title]]
12172 !! html/php
12173 <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>
12174 </p>
12175 !! html/parsoid
12176 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12177 !! end
12178
12179 !! test
12180 Thumbnail image with link parameter
12181 !! options
12182 thumbsize=220
12183 parsoid=wt2html,wt2wt,html2html
12184 !! wikitext
12185 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12186 !! html/php
12187 <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>
12188
12189 !! html/parsoid
12190 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Title</figcaption></figure>
12191 !! end
12192
12193 !! test
12194 Manually-specified thumbnail image
12195 !! options
12196 thumbsize=220
12197 !! wikitext
12198 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12199 !! html/php
12200 <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>
12201
12202 !! html/parsoid
12203 <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" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12204 !! end
12205
12206 !! test
12207 Manually-specified thumbnail image with explicit link to wiki page
12208 !! options
12209 thumbsize=220
12210 parsoid=wt2html,wt2wt,html2html
12211 !! wikitext
12212 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12213 !! html/php
12214 <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>
12215
12216 !! html/parsoid
12217 <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" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12218 !! end
12219
12220 !! test
12221 Manually-specified thumbnail image with explicit link to url
12222 !! options
12223 thumbsize=220
12224 parsoid=wt2html,wt2wt,html2html
12225 !! wikitext
12226 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12227 !! html/php
12228 <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>
12229
12230 !! html/parsoid
12231 <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" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12232 !! end
12233
12234 !! test
12235 Manually-specified thumbnail image with explicit no link
12236 !! options
12237 thumbsize=220
12238 parsoid=wt2html,wt2wt,html2html
12239 !! wikitext
12240 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
12241 !! html/php
12242 <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>
12243
12244 !! html/parsoid
12245 <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" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></span><figcaption>Title</figcaption></figure>
12246 !! end
12247
12248 !! test
12249 Manually-specified thumbnail image with explicit link and alt text
12250 !! options
12251 thumbsize=220
12252 parsoid=wt2html,wt2wt,html2html
12253 !! wikitext
12254 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
12255 !! html/php
12256 <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>
12257
12258 !! html/parsoid
12259 <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" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12260 !! end
12261
12262 !! test
12263 Image with frame and link
12264 !! options
12265 parsoid=wt2html,wt2wt,html2html
12266 !! wikitext
12267 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
12268 !! html/php
12269 <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>
12270
12271 !! html/parsoid
12272 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" 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>
12273 !! end
12274
12275 !! test
12276 Image with frame and link and explicit alt
12277 !! options
12278 parsoid=wt2html,wt2wt,html2html
12279 !! wikitext
12280 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
12281 !! html/php
12282 <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>
12283
12284 !! html/parsoid
12285 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" 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>
12286 !! end
12287
12288 !! test
12289 Image with wiki markup in implicit alt
12290 !! options
12291 parsoid=wt2html,wt2wt,html2html
12292 !! wikitext
12293 [[Image:Foobar.jpg|testing '''bold''' in alt]]
12294
12295 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
12296 !! html/php
12297 <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>
12298 </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>
12299 </p>
12300 !! html/parsoid
12301 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12302 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12303 !! end
12304
12305 !! test
12306 Alt image option should handle most kinds of wikitext without barfing
12307 !! wikitext
12308 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
12309 !! html/php
12310 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a link and a bold template." 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 the image caption</div></div></div>
12311
12312 !! html/parsoid
12313 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[65,73,2,2]}\">link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[80,106,null,null],&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;]}]]}\" 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;&#39;&#39;bold template&#39;&#39;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
12314 !! end
12315
12316 ###################
12317 # Conflicting image format options.
12318 # First option specified should 'win'.
12319 # All three cases in each test should be identical.
12320
12321 !! test
12322 Image with 'frameless' first.
12323 !! options
12324 parsoid=wt2html,wt2wt,html2html
12325 !! wikitext
12326 [[File:Foobar.jpg|frameless|caption]]
12327
12328 [[File:Foobar.jpg|frameless|frame|caption]]
12329
12330 [[File:Foobar.jpg|frameless|thumb|caption]]
12331 !! html/php
12332 <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>
12333 </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>
12334 </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>
12335 </p>
12336 !! html/parsoid
12337 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12338 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12339 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12340 !! end
12341
12342 !! test
12343 Image with 'frame' first.
12344 !! options
12345 parsoid=wt2html,wt2wt,html2html
12346 !! wikitext
12347 [[File:Foobar.jpg|frame|caption]]
12348 [[File:Foobar.jpg|frame|frameless|caption]]
12349 [[File:Foobar.jpg|frame|thumb|caption]]
12350 !! html/php
12351 <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>
12352 <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>
12353 <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>
12354
12355 !! html/parsoid
12356 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12357 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12358 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12359 !! end
12360
12361 !! test
12362 Image with 'thumb' first.
12363 !! options
12364 parsoid=wt2html,wt2wt,html2html
12365 !! wikitext
12366 [[File:Foobar.jpg|thumb|caption]]
12367 [[File:Foobar.jpg|thumb|frameless|caption]]
12368 [[File:Foobar.jpg|thumb|frame|caption]]
12369 !! html/php
12370 <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>
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>caption</div></div></div>
12372 <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>
12373
12374 !! html/parsoid
12375 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12376 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12377 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12378 !! end
12379
12380 ###################
12381 # Image sizing.
12382 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
12383 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
12384 # Foobar has actual size of 1941x220
12385 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
12386 # a scalable format.
12387 # 2. Framed images always ignore size options; always render at default size.
12388 # 3. "Unspecified format" and border are the only types which can be
12389 # enlarged.
12390
12391 !! test
12392 Image: "unspecified format" and border enlarge
12393 !! options
12394 parsoid=wt2html,wt2wt,html2html
12395 !! wikitext
12396 [[File:Foobar.jpg|2000px]]
12397
12398 [[File:Foobar.jpg|border|2000px]]
12399 !! html/php
12400 <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>
12401 </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>
12402 </p>
12403 !! html/parsoid
12404 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
12405 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
12406 !! end
12407
12408 !! test
12409 Image: "unspecified format" and border reduce
12410 !! options
12411 parsoid=wt2html,wt2wt,html2html
12412 !! wikitext
12413 [[File:Foobar.jpg|1000px]]
12414
12415 [[File:Foobar.jpg|border|1000px]]
12416 !! html/php
12417 <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>
12418 </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>
12419 </p>
12420 !! html/parsoid
12421 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
12422 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
12423 !! end
12424
12425 !! test
12426 Image: thumbs reduce
12427 !! options
12428 parsoid=wt2html,wt2wt,html2html
12429 !! wikitext
12430 [[File:Foobar.jpg|thumb|50px]]
12431 !! html/php
12432 <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>
12433
12434 !! html/parsoid
12435 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure>
12436 !! end
12437
12438 !! test
12439 Image: bitmap thumbs can't be enlarged past original size, but vector can.
12440 !! options
12441 parsoid=wt2html,wt2wt,html2html
12442 !! wikitext
12443 [[File:Foobar.jpg|thumb|2000px]]
12444
12445 [[File:Foobar.svg|thumb|2000px]]
12446 !! html/php
12447 <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>
12448 <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>
12449
12450 !! html/parsoid
12451 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
12452 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure>
12453 !! end
12454
12455 !! test
12456 Image: frameless can reduce in size
12457 !! options
12458 parsoid=wt2html,wt2wt,html2html
12459 !! wikitext
12460 [[File:Foobar.jpg|frameless|50px]]
12461 !! html/php
12462 <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>
12463 </p>
12464 !! html/parsoid
12465 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
12466 !! end
12467
12468 !! test
12469 Image: bitmap frameless can't be enlarged past original size, but vector can
12470 !! options
12471 parsoid=wt2html,wt2wt,html2html
12472 !! wikitext
12473 [[File:Foobar.jpg|frameless|2000px]]
12474
12475 [[File:Foobar.svg|frameless|2000px]]
12476 !! html/php
12477 <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>
12478 </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>
12479 </p>
12480 !! html/parsoid
12481 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12482 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></span></p>
12483 !! end
12484
12485 !! test
12486 Image: framed images are always unscaled.
12487 !! options
12488 parsoid=wt2html,wt2wt,html2html
12489 !! wikitext
12490 [[File:Foobar.jpg|frame]]
12491
12492 [[File:Foobar.jpg|frame|50px]]
12493
12494 [[File:Foobar.jpg|frame|50x50px]]
12495
12496 [[File:Foobar.jpg|frame|2000px]]
12497 !! html/php
12498 <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>
12499 <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>
12500 <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>
12501 <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>
12502
12503 !! html/parsoid
12504 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
12505 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
12506 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
12507 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
12508 !! end
12509
12510 ###################
12511
12512 !! test
12513 Link to image page- image page normally doesn't exists, hence edit link
12514 Add test with existing image page
12515 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
12516 !! wikitext
12517 [[:Image:test]]
12518 !! html
12519 <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>
12520 </p>
12521 !! end
12522
12523 !! test
12524 bug 18784 Link to non-existent image page with caption should use caption as link text
12525 !! wikitext
12526 [[:Image:test|caption]]
12527 !! html
12528 <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>
12529 </p>
12530 !! end
12531
12532 !! test
12533 Frameless image caption with a free URL
12534 !! wikitext
12535 [[File:Foobar.jpg|http://example.com]]
12536 !! html/php
12537 <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>
12538 </p>
12539 !! html/parsoid
12540 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12541 !! end
12542
12543 !! test
12544 Thumbnail image caption with a free URL
12545 !! options
12546 thumbsize=220
12547 !! wikitext
12548 [[File:Foobar.jpg|thumb|http://example.com]]
12549 !! html/php
12550 <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>
12551
12552 !! html/parsoid
12553 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
12554 !! end
12555
12556 !! test
12557 Thumbnail image caption with a free URL and explicit alt
12558 !! options
12559 thumbsize=220
12560 parsoid=wt2html,wt2wt,html2html
12561 !! wikitext
12562 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
12563 !! html/php
12564 <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>
12565
12566 !! html/parsoid
12567 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
12568 !! end
12569
12570 !! test
12571 SVG thumbnails with no language set
12572 !! options
12573 !! wikitext
12574 [[File:Foobar.svg|thumb|caption]]
12575 !! html/php
12576 <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>
12577
12578 !! html/parsoid
12579 <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" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
12580 !! end
12581
12582 !! test
12583 SVG thumbnails with language de
12584 !! options
12585 parsoid=wt2html,wt2wt,html2html
12586 !! wikitext
12587 [[File:Foobar.svg|thumb|caption|lang=de]]
12588 !! html/php
12589 <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>
12590
12591 !! html/parsoid
12592 <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" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
12593 !! end
12594
12595 !! test
12596 SVG thumbnails with invalid language code
12597 !! options
12598 parsoid=wt2html,wt2wt,html2html
12599 !! wikitext
12600 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
12601 !! html/php
12602 <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>
12603
12604 !! html/parsoid
12605 <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" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>lang=invalid.language.code</figcaption></figure>
12606 !! end
12607
12608 !! test
12609 BUG 1887: A ISBN with a thumbnail
12610 !! wikitext
12611 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
12612 !! html/php
12613 <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>
12614
12615 !! html/parsoid
12616 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="Special:BookSources/1235467890" rel="mw:ExtLink">ISBN 1235467890</a></figcaption></figure>
12617 !! end
12618
12619 !! test
12620 BUG 1887: A RFC with a thumbnail
12621 !! wikitext
12622 [[File:Foobar.jpg|thumb|This is RFC 12354]]
12623 !! html/php
12624 <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>
12625
12626 !! html/parsoid
12627 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
12628 !! end
12629
12630 !! test
12631 BUG 1887: A mailto link with a thumbnail
12632 !! wikitext
12633 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
12634 !! html/php
12635 <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>
12636
12637 !! html/parsoid
12638 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
12639 !! end
12640
12641 # Pending resolution to bug 368
12642 !! test
12643 BUG 648: Frameless image caption with a link
12644 !! wikitext
12645 [[File:Foobar.jpg|text with a [[link]] in it]]
12646 !! html/php
12647 <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>
12648 </p>
12649 !! html/parsoid
12650 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12651 !! end
12652
12653 !! test
12654 BUG 648: Frameless image caption with a link (suffix)
12655 !! wikitext
12656 [[File:Foobar.jpg|text with a [[link]]foo in it]]
12657 !! html/php
12658 <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>
12659 </p>
12660 !! html/parsoid
12661 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12662 !! end
12663
12664 !! test
12665 BUG 648: Frameless image caption with an interwiki link
12666 !! wikitext
12667 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
12668 !! html/php
12669 <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>
12670 </p>
12671 !! html/parsoid
12672 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12673 !! end
12674
12675 !! test
12676 BUG 648: Frameless image caption with a piped interwiki link
12677 !! wikitext
12678 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
12679 !! html/php
12680 <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>
12681 </p>
12682 !! html/parsoid
12683 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12684 !! end
12685
12686 !! test
12687 Escape HTML special chars in image alt text
12688 !! wikitext
12689 [[File:Foobar.jpg|& < > "]]
12690 !! html/php
12691 <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>
12692 </p>
12693 !! html/parsoid
12694 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12695 !! end
12696
12697 !! test
12698 BUG 499: Alt text should have &#1234;, not &amp;1234;
12699 !! wikitext
12700 [[File:Foobar.jpg|&#9792;]]
12701 !! html/php
12702 <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>
12703 </p>
12704 !! html/parsoid
12705 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12706 !! end
12707
12708 !! test
12709 Broken image caption with link
12710 !! options
12711 parsoid=wt2html,wt2wt,html2html
12712 !! wikitext
12713 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
12714 !! html/php
12715 <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.
12716 </p>
12717 !! html/parsoid
12718 <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>
12719 !! end
12720
12721 !! test
12722 Image caption containing another image
12723 !! wikitext
12724 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
12725 !! html/php
12726 <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>
12727
12728 !! html/parsoid
12729 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" 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" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a></span> inside it!</figcaption></figure>
12730 !! end
12731
12732 !! test
12733 Image: caption containing a newline
12734 !! wikitext
12735 [[File:Foobar.jpg|This
12736 *is some text]]
12737 !! html/php
12738 <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>
12739 </p>
12740 !! html/parsoid
12741 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12742 !!end
12743
12744 !!test
12745 Image: caption containing leading space
12746 (The leading space should not trigger nowiki escaping in wt2wt mode)
12747 !! wikitext
12748 [[File:Foobar.jpg|thumb| bar]]
12749 !! html/php
12750 <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>
12751
12752 !! html/parsoid
12753 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
12754 !!end
12755
12756 !! test
12757 Image: caption containing a table
12758 !! options
12759 parsoid=wt2html,wt2wt,html2html
12760 !! wikitext
12761 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
12762 {|
12763 ! Foo !! Bar
12764 |-
12765 | Foo1 || Bar1
12766 |}
12767 and some more text.]]
12768 !! html/php
12769 <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>
12770
12771 !! html/parsoid
12772 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This is an example image thumbnail caption with a table
12773 <table>
12774 <tbody>
12775 <tr><th>Foo </th><th>Bar</th></tr>
12776 <tr>
12777 <td>Foo1 </td>
12778 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
12779 !! end
12780
12781 !! test
12782 Bug 3090: External links other than http: in image captions
12783 !! wikitext
12784 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
12785 !! html/php
12786 <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>
12787
12788 !! html/parsoid
12789 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" 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>
12790 !! end
12791
12792 !! test
12793 Custom class
12794 !! options
12795 parsoid=wt2html,wt2wt,html2html
12796 !! wikitext
12797 [[Image:foobar.jpg|a|class=b]]
12798 !! html/php
12799 <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>
12800 </p>
12801 !! html/parsoid
12802 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12803 !! end
12804
12805 !! test
12806 Localized image handling (1).
12807 !! options
12808 parsoid=wt2html,wt2wt,html2html
12809 language=es
12810 !! wikitext
12811 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
12812 !! html/php
12813 <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>
12814
12815 !! html/parsoid
12816 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12817 !! end
12818
12819 !! test
12820 Localized image handling (2).
12821 !! options
12822 thumbsize=220
12823 parsoid=wt2html,wt2wt,html2html
12824 language=es
12825 !! wikitext
12826 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
12827 !! html/php
12828 <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>
12829
12830 !! html/parsoid
12831 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12832 !! end
12833
12834 !! test
12835 "border", "frameless" and "class" attributes on an image.
12836 !! options
12837 thumbsize=220
12838 parsoid=wt2html,wt2wt,html2html
12839 !! wikitext
12840 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
12841 !! html/php
12842 <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>
12843 </p>
12844 !! html/parsoid
12845 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12846 !! end
12847
12848 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
12849 !! test
12850 Invalid image attributes (bug 62500)
12851 !! options
12852 thumbsize=220
12853 parsoid=wt2html,wt2wt,html2html
12854 !! wikitext
12855 [[File:Foobar.jpg|thumb|float|left|caption]]
12856
12857 [[File:Foobar.jpg|thumb|righ|caption]]
12858
12859 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
12860 !! html/php
12861 <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>
12862 <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>
12863 <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>
12864
12865 !! html/parsoid
12866 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12867 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12868 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12869 !! end
12870
12871 !! article
12872 File:Barfoo.jpg
12873 !! text
12874 #REDIRECT [[File:Barfoo.jpg]]
12875 !! endarticle
12876
12877 # FIXME: Parsoid should run this test -- but we'd need to teach the
12878 # mockAPI about the redirected Barfoo.jpg image.
12879 !! test
12880 Redirected image
12881 !! wikitext
12882 [[Image:Barfoo.jpg]]
12883 !! html/php
12884 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
12885 </p>
12886 !! end
12887
12888 !! test
12889 Missing image with uploads disabled
12890 !! options
12891 wgEnableUploads=0
12892 !! wikitext
12893 [[File:Foobaz.jpg]]
12894 !! html/php
12895 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
12896 </p>
12897 !! html/parsoid
12898 <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>
12899 !! end
12900
12901 # Parsoid-specific testing for images
12902 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12903 # Currently imperfect due to a flaw in the Parsoid testrunner
12904 # Work in progress
12905 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
12906 # image tests.
12907
12908 !! test
12909 Parsoid-specific image handling - simple image with size and middle alignment
12910 !! wikitext
12911 [[File:Foobar.jpg|middle|50px]]
12912 !! html/parsoid
12913 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
12914 !! end
12915
12916 !! test
12917 Parsoid-specific image handling - simple image with size, middle alignment,
12918 non-standard namespace alias
12919 !! options
12920 parsoid=wt2wt,wt2html,html2html
12921 !! wikitext
12922 [[Image:Foobar.jpg|middle|50px]]
12923 !! html/parsoid
12924 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
12925 !! end
12926
12927 !! test
12928 Parsoid-specific image handling - simple image with size and middle alignment
12929 (existing content)
12930 !! wikitext
12931 [[File:Foobar.jpg|50px|middle]]
12932 !! html/parsoid
12933 <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/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
12934 !! end
12935
12936 !! test
12937 Parsoid-specific image handling - simple image with size and middle alignment
12938 and non-standard namespace name
12939 !! options
12940 parsoid=wt2html,wt2wt,html2html
12941 !! wikitext
12942 [[Image:Foobar.jpg|50px|middle]]
12943 !! html/parsoid
12944 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
12945 !! end
12946
12947 !! test
12948 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
12949 !! wikitext
12950 [[File:Foobar.jpg|500x10px|baseline|caption]]
12951 !! html/parsoid
12952 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="10" width="89" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"10","width":"89"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
12953 !! end
12954
12955 !! test
12956 Parsoid-specific image handling - simple image with border and size spec
12957 !! wikitext
12958 [[File:Foobar.jpg|50px|border|caption]]
12959 !! html/parsoid
12960 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
12961 !! end
12962
12963 !! test
12964 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12965 !! wikitext
12966 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
12967 !! html/parsoid
12968 <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/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption content</figcaption></figure>
12969 !! end
12970
12971 !! test
12972 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12973 (existing content)
12974 !! wikitext
12975 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12976 !! html/parsoid
12977 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" 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>
12978 !! end
12979
12980 !! test
12981 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12982 !! wikitext
12983 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12984 !! html/parsoid
12985 <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/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a><figcaption>caption</figcaption></figure>
12986 !! end
12987
12988 !! test
12989 Parsoid-specific image handling - thumbnail with specific size, halign,
12990 valign, and caption (existing content)
12991 !! wikitext
12992 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12993 !! html/parsoid
12994 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" 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>
12995 !! end
12996
12997 !! test
12998 Parsoid-specific image handling - framed image with specific size and caption
12999 (size is ignored)
13000 !! options
13001 parsoid=wt2html,wt2wt,html2html
13002 !! wikitext
13003 [[File:Foobar.jpg|frame|500x50px|caption]]
13004 !! html/parsoid
13005 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13006 !! end
13007
13008 !! test
13009 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13010 (size is ignored)
13011 !! options
13012 parsoid=wt2html,wt2wt,html2html
13013 !! wikitext
13014 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13015 !! html/parsoid
13016 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13017 !! end
13018
13019 !! test
13020 Parsoid-specific image handling - frameless image with specific size, border, and caption
13021 !! wikitext
13022 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13023 !! html/parsoid
13024 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="50" width="442" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"50","width":"442"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13025 !! end
13026
13027 !! test
13028 Parsoid-specific image handling - simple image with a formatted caption
13029 !! wikitext
13030 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13031 !! html/parsoid
13032 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13033 !! end
13034
13035 !! test
13036 Parsoid-specific image handling - caption with a template in it
13037 !! wikitext
13038 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13039 !! html/parsoid
13040 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" 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>
13041 !! end
13042
13043 !! test
13044 Parsoid-specific image handling - caption with unbalanced tags in it
13045 !! options
13046 parsoid=wt2html,wt2wt,html2html
13047 !! wikitext
13048 foo
13049 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13050 bar
13051 !! html/parsoid
13052 <p>foo</p>
13053 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has a <center>unbalanced tag in it.</center></figcaption></figure>
13054 <p>bar</p>
13055 !! end
13056
13057 !! test
13058 Parsoid-specific image handling - empty caption (1)
13059 !! options
13060 parsoid=wt2html,wt2wt
13061 !! wikitext
13062 [[File:Foobar.jpg|thumb|]]
13063 !! html/parsoid
13064 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption></figcaption></figure>
13065 !! end
13066
13067 # empty captions don't get serialized unless we're in the "round trip" case
13068 !! test
13069 Parsoid-specific image handling - empty caption (2)
13070 !! options
13071 parsoid=html2wt
13072 !! html/parsoid
13073 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13074 <a href="./File:Foobar.jpg">
13075 <img resource="./File:Foobar.jpg"
13076 src="//example.com/images/3/3a/Foobar.jpg"
13077 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13078 height="25" width="220"/>
13079 </a>
13080 <figcaption></figcaption>
13081 </figure>
13082 !! wikitext
13083 [[File:Foobar.jpg|thumb]]
13084 !! end
13085
13086 !! test
13087 Parsoid-specific image handling - whitespace caption
13088 !! wikitext
13089 [[File:Foobar.jpg|thumb| ]]
13090 !! html/parsoid
13091 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> </figcaption></figure>
13092 !! end
13093
13094 !! test
13095 Parsoid-specific image handling - lang option
13096 !! wikitext
13097 foo
13098 [[File:Foobar.svg|lang=de|caption]]
13099 bar
13100 !! html/parsoid
13101 <p>foo
13102 <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" data-file-width="240" data-file-height="180" data-file-type="drawing" height="180" width="240"/></a></span>
13103 bar</p>
13104 !! end
13105
13106
13107 ###
13108 ### Subpages
13109 ###
13110 !! article
13111 Subpage test/subpage
13112 !! text
13113 foo
13114 !! endarticle
13115
13116 !! test
13117 Subpage link
13118 !! options
13119 subpage title=[[Subpage test]]
13120 !! wikitext
13121 [[/subpage]]
13122 !! html
13123 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13124 </p>
13125 !! end
13126
13127 !! test
13128 Subpage noslash link
13129 !! options
13130 subpage title=[[Subpage test]]
13131 !! wikitext
13132 [[/subpage/]]
13133 !! html
13134 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13135 </p>
13136 !! end
13137
13138 !! article
13139 Subpage test/1/2/subpage
13140 !! text
13141 blah
13142 !! endarticle
13143
13144 !! test
13145 Relative subpage noslash link
13146 !! options
13147 parsoid=wt2wt,wt2html,html2html
13148 subpage title=[[Subpage test/1/2/3/4]]
13149 !! wikitext
13150 [[../../subpage/]]
13151
13152 [[../../subpage]]
13153 !! html/php
13154 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13155 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13156 </p>
13157 !! html/parsoid
13158 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13159 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13160 !! end
13161
13162 !! test
13163 Parsoid: dot-slash prefixed wikilinks
13164 !! wikitext
13165 [[./foo]]
13166
13167 [[././bar]]
13168
13169 [[././baz/]]
13170 !! html/php
13171 <p>[[./foo]]
13172 </p><p>[[././bar]]
13173 </p><p>[[././baz/]]
13174 </p>
13175 !! html/parsoid
13176 <p>[[./foo]]
13177 </p><p>[[././bar]]
13178 </p><p>[[././baz/]]
13179 </p>
13180 !! end
13181
13182 !! test
13183 Render invalid page names as plain text (bug 51090)
13184 !! wikitext
13185 [[./../foo|bar]]
13186 [[foo�|bar]]
13187 [[foo/.|bar]]
13188 [[foo/..|bar]]
13189 [[foo~~~bar]]
13190 [[foo>bar]]
13191 [[foo[bar]]
13192 [[.]]
13193 [[..]]
13194 [[foo././bar]]
13195
13196 [[{{echo|./../foo}}|bar]]
13197 [[{{echo|foo/.}}|bar]]
13198 [[{{echo|foo/..}}|bar]]
13199 [[{{echo|foo~~~~bar}}]]
13200 [[{{echo|foo>bar}}]]
13201 [[{{echo|foo././bar}}]]
13202 [[{{echo|foo{bar}}]]
13203 [[{{echo|foo}bar}}]]
13204 [[{{echo|foo[bar}}]]
13205 [[{{echo|foo]bar}}]]
13206 [[{{echo|foo<bar}}]]
13207 !!html/php
13208 <p>[[./../foo|bar]]
13209 [[foo�|bar]]
13210 [[foo/.|bar]]
13211 [[foo/..|bar]]
13212 [[foo~~~bar]]
13213 [[foo&gt;bar]]
13214 [[foo[bar]]
13215 [[.]]
13216 [[..]]
13217 [[foo././bar]]
13218 </p><p>[[./../foo|bar]]
13219 [[foo/.|bar]]
13220 [[foo/..|bar]]
13221 [[foo~~~~bar]]
13222 [[foo&gt;bar]]
13223 [[foo././bar]]
13224 [[foo{bar]]
13225 [[foo}bar]]
13226 [[foo[bar]]
13227 [[foo]bar]]
13228 [[foo&lt;bar]]
13229 </p>
13230 !!html/parsoid
13231 <p>[[./../foo|bar]]
13232 [[foo�|bar]]
13233 [[foo/.|bar]]
13234 [[foo/..|bar]]
13235 [[foo~~~bar]]
13236 [[foo>bar]]
13237 [[foo[bar]]
13238 [[.]]
13239 [[..]]
13240 [[foo././bar]]</p>
13241
13242 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
13243 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
13244 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
13245 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
13246 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
13247 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
13248 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
13249 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
13250 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
13251 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
13252 [[<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>
13253 !!end
13254
13255 !! test
13256 Disabled subpages
13257 !! wikitext
13258 [[/subpage]]
13259 !! html
13260 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
13261 </p>
13262 !! end
13263
13264 !! test
13265 BUG 561: {{/Subpage}}
13266 !! options
13267 subpage title=[[Page]]
13268 !! wikitext
13269 {{/Subpage}}
13270 !! html
13271 <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>
13272 </p>
13273 !! end
13274
13275 ###
13276 ### Categories
13277 ###
13278 !! article
13279 Category:MediaWiki User's Guide
13280 !! text
13281 blah
13282 !! endarticle
13283
13284 !! test
13285 Link to category
13286 !! wikitext
13287 [[:Category:MediaWiki User's Guide]]
13288 !! html
13289 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
13290 </p>
13291 !! end
13292
13293 !! test
13294 Simple category
13295 !! options
13296 cat
13297 !! wikitext
13298 [[Category:MediaWiki User's Guide]]
13299 !! html
13300 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13301 !! end
13302
13303 !! test
13304 PAGESINCATEGORY invalid title fatal (r33546 fix)
13305 !! wikitext
13306 {{PAGESINCATEGORY:<bogus>}}
13307 !! html
13308 <p>0
13309 </p>
13310 !! end
13311
13312 !! test
13313 Category with different sort key
13314 !! options
13315 cat
13316 !! wikitext
13317 [[Category:MediaWiki User's Guide|Foo]]
13318 !! html
13319 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13320 !! end
13321
13322 !! test
13323 Category with identical sort key
13324 !! options
13325 cat
13326 !! wikitext
13327 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13328 !! html
13329 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13330 !! end
13331
13332 !! test
13333 Category with empty sort key
13334 !! options
13335 cat
13336 pst
13337 !! wikitext
13338 [[Category:MediaWiki User's Guide|]]
13339 !! html
13340 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13341 !! end
13342
13343 !! test
13344 Category with empty sort key and parentheses
13345 !! options
13346 cat
13347 pst
13348 !! wikitext
13349 [[Category:Foo (bar)|]]
13350 !! html
13351 [[Category:Foo (bar)|Foo]]
13352 !! end
13353
13354 !! test
13355 Category with link tail
13356 !! options
13357 cat
13358 pst
13359 !! wikitext
13360 123[[Category:Foo]]456
13361 !! html
13362 123[[Category:Foo]]456
13363 !! end
13364
13365 !! test
13366 Category with template
13367 !! options
13368 cat
13369 pst
13370 !! wikitext
13371 [[Category:{{echo|Foo}}]]
13372 !! html
13373 [[Category:{{echo|Foo}}]]
13374 !! end
13375
13376 !! test
13377 Category with template in sort key
13378 !! options
13379 cat
13380 pst
13381 !! wikitext
13382 [[Category:Foo|{{echo|Bar}}]]
13383 !! html
13384 [[Category:Foo|{{echo|Bar}}]]
13385 !! end
13386
13387 !! test
13388 Category with template in sort key and title
13389 !! options
13390 cat
13391 pst
13392 !! wikitext
13393 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13394 !! html
13395 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13396 !! end
13397
13398 !! test
13399 Category / paragraph interactions
13400 !! wikitext
13401 Foo [[Category:Baz]] Bar
13402
13403 Foo [[Category:Baz]]
13404 Bar
13405
13406 Foo
13407 [[Category:Baz]]
13408 Bar
13409
13410 Foo
13411 [[Category:Baz]] Bar
13412
13413 Foo
13414 [[Category:Baz]]
13415 [[Category:Baz]]
13416 [[Category:Baz]]
13417 Bar
13418
13419 [[Category:Baz]]
13420 [[Category:Baz]]
13421 [[Category:Baz]]
13422
13423 [[Category:Baz]]
13424 {{echo|[[Category:Baz]]}}
13425 [[Category:Baz]]
13426 !! html
13427 <p>Foo Bar
13428 </p><p>Foo
13429 Bar
13430 </p><p>Foo
13431 Bar
13432 </p><p>Foo Bar
13433 </p><p>Foo
13434 Bar
13435 </p>
13436 !! end
13437
13438 !! test
13439 Parsoid: Serialize link to category page with colon escape
13440 !! options
13441 parsoid
13442 !! wikitext
13443
13444 [[:Category:Foo]]
13445 [[:Category:Foo|Bar]]
13446 !! html
13447 <p>
13448 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
13449 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
13450 </p>
13451 !! end
13452
13453 !! test
13454 Parsoid: Link prefix/suffixes aren't applied to category links
13455 !! options
13456 parsoid=wt2html,wt2wt,html2html
13457 language=is
13458 !! wikitext
13459 x[[Category:Foo]]y
13460 !! html
13461 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
13462 !! end
13463
13464 !! test
13465 Parsoid: Serialize link to file page with colon escape
13466 !! options
13467 parsoid
13468 !! wikitext
13469
13470 [[:File:Foo.png]]
13471 [[:File:Foo.png|Bar]]
13472 !! html
13473 <p>
13474 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
13475 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
13476 </p>
13477 !! end
13478
13479 !! test
13480 Parsoid: Serialize a genuine category link without colon escape
13481 !! options
13482 parsoid
13483 !! wikitext
13484 [[Category:Foo]]
13485 [[Category:Foo|Bar]]
13486 !! html
13487 <link rel="mw:PageProp/Category" href="Category:Foo">
13488 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
13489 !! end
13490
13491 !! test
13492 Normalize hrefs properly before testing for invalid link targets (bug 70894)
13493 !! options
13494 parsoid=html2wt
13495 !! html
13496 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
13497 !! wikitext
13498 [[Category:Toxine bactérienne]]
13499 !! end
13500
13501 !! test
13502 Parsoid: Defaultsort
13503 !! wikitext
13504 {{DEFAULTSORT:Foo}}
13505 !! html/parsoid
13506 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
13507 !! end
13508
13509 !! test
13510 Parsoid: Defaultsort (template-generated)
13511 !! wikitext
13512 {{{{echo|DEFAULTSORT}}:Foo}}
13513 !! html/parsoid
13514 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,28,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
13515 !! end
13516
13517 ###
13518 ### Inter-language links
13519 ###
13520 !! test
13521 Interlanguage links
13522 !! options
13523 ill
13524 !! wikitext
13525 [[es:Alimento]]
13526 [[fr:Nourriture]]
13527 [[zh:食品]]
13528 !! html/php
13529 es:Alimento fr:Nourriture zh:食品
13530 !! html/parsoid
13531 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
13532 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
13533 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
13534 !! end
13535
13536 !! test
13537 Duplicate interlanguage links (bug 24502)
13538 !! options
13539 ill
13540 !! wikitext
13541 [[es:1]]
13542 [[es:2]]
13543 [[fr:1]]
13544 [[fr:2]]
13545 !! html/php
13546 es:1 fr:1
13547 !! html/parsoid
13548 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
13549 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
13550 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
13551 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
13552 !! end
13553
13554 ###
13555 ### Sections
13556 ###
13557 !! test
13558 Basic section headings
13559 !! wikitext
13560 == Headline 1 ==
13561 Some text
13562
13563 ==Headline 2==
13564 More
13565 ===Smaller headline===
13566 Blah blah
13567 !! html
13568 <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>
13569 <p>Some text
13570 </p>
13571 <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>
13572 <p>More
13573 </p>
13574 <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>
13575 <p>Blah blah
13576 </p>
13577 !! end
13578
13579 !! test
13580 Section headings with TOC
13581 !! wikitext
13582 == Headline 1 ==
13583 === Subheadline 1 ===
13584 ===== Skipping a level =====
13585 ====== Skipping a level ======
13586
13587 == Headline 2 ==
13588 Some text
13589 ===Another headline===
13590 !! html
13591 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13592 <ul>
13593 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
13594 <ul>
13595 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
13596 <ul>
13597 <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>
13598 <ul>
13599 <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>
13600 </ul>
13601 </li>
13602 </ul>
13603 </li>
13604 </ul>
13605 </li>
13606 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
13607 <ul>
13608 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
13609 </ul>
13610 </li>
13611 </ul>
13612 </div>
13613
13614 <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>
13615 <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>
13616 <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>
13617 <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>
13618 <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>
13619 <p>Some text
13620 </p>
13621 <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>
13622
13623 !! end
13624
13625 !! test
13626 TOC anchors don't collide
13627 !! wikitext
13628 __FORCETOC__
13629 == Headline 2 ==
13630 == Headline ==
13631 == Headline 2 ==
13632 == Headline ==
13633 !! html
13634 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13635 <ul>
13636 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
13637 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
13638 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
13639 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
13640 </ul>
13641 </div>
13642
13643 <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=1" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13644 <h2><span class="mw-headline" id="Headline">Headline</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">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13645 <h2><span class="mw-headline" id="Headline_2_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=3" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13646 <h2><span class="mw-headline" id="Headline_3">Headline</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: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13647
13648 !! end
13649
13650 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
13651 !! test
13652 Handling of sections up to level 6 and beyond
13653 !! wikitext
13654 = Level 1 Heading=
13655 == Level 2 Heading==
13656 === Level 3 Heading===
13657 ==== Level 4 Heading====
13658 ===== Level 5 Heading=====
13659 ====== Level 6 Heading======
13660 ======= Level 7 Heading=======
13661 ======== Level 8 Heading========
13662 ========= Level 9 Heading=========
13663 ========== Level 10 Heading==========
13664 !! html
13665 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13666 <ul>
13667 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
13668 <ul>
13669 <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>
13670 <ul>
13671 <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>
13672 <ul>
13673 <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>
13674 <ul>
13675 <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>
13676 <ul>
13677 <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>
13678 <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>
13679 <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>
13680 <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>
13681 <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>
13682 </ul>
13683 </li>
13684 </ul>
13685 </li>
13686 </ul>
13687 </li>
13688 </ul>
13689 </li>
13690 </ul>
13691 </li>
13692 </ul>
13693 </div>
13694
13695 <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>
13696 <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>
13697 <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>
13698 <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>
13699 <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>
13700 <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>
13701 <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>
13702 <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>
13703 <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>
13704 <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>
13705
13706 !! end
13707
13708 !! test
13709 TOC regression (T11764)
13710 !! wikitext
13711 == title 1 ==
13712 === title 1.1 ===
13713 ==== title 1.1.1 ====
13714 === title 1.2 ===
13715 == title 2 ==
13716 === title 2.1 ===
13717 !! html
13718 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13719 <ul>
13720 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13721 <ul>
13722 <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>
13723 <ul>
13724 <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>
13725 </ul>
13726 </li>
13727 <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>
13728 </ul>
13729 </li>
13730 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13731 <ul>
13732 <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>
13733 </ul>
13734 </li>
13735 </ul>
13736 </div>
13737
13738 <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>
13739 <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>
13740 <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>
13741 <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>
13742 <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>
13743 <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>
13744
13745 !! end
13746
13747 !! test
13748 TOC with wgMaxTocLevel=3 (bug 6204)
13749 !! options
13750 wgMaxTocLevel=3
13751 !! wikitext
13752 == title 1 ==
13753 === title 1.1 ===
13754 ==== title 1.1.1 ====
13755 === title 1.2 ===
13756 == title 2 ==
13757 === title 2.1 ===
13758 !! html
13759 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13760 <ul>
13761 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13762 <ul>
13763 <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>
13764 <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>
13765 </ul>
13766 </li>
13767 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13768 <ul>
13769 <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>
13770 </ul>
13771 </li>
13772 </ul>
13773 </div>
13774
13775 <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>
13776 <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>
13777 <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>
13778 <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>
13779 <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>
13780 <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>
13781
13782 !! end
13783
13784 !! test
13785 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
13786 !! options
13787 wgMaxTocLevel=3
13788 !! wikitext
13789 ==Section 1==
13790 ===Section 1.1===
13791 ====Section 1.1.1====
13792 ====Section 1.1.1.1====
13793 ==Section 2==
13794 !! html
13795 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13796 <ul>
13797 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
13798 <ul>
13799 <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>
13800 </ul>
13801 </li>
13802 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
13803 </ul>
13804 </div>
13805
13806 <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>
13807 <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>
13808 <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>
13809 <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>
13810 <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>
13811
13812 !! end
13813
13814
13815 !! test
13816 Resolving duplicate section names
13817 !! wikitext
13818 == Foo bar ==
13819 == Foo bar ==
13820 !! html
13821 <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>
13822 <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>
13823
13824 !! end
13825
13826 !! test
13827 Resolving duplicate section names with differing case (bug 10721)
13828 !! wikitext
13829 == Foo bar ==
13830 == Foo Bar ==
13831 !! html
13832 <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>
13833 <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>
13834
13835 !! end
13836
13837 !! article
13838 Template:sections
13839 !! text
13840 ===Section 1===
13841 ==Section 2==
13842 !! endarticle
13843
13844 !! test
13845 Template with sections, __NOTOC__
13846 !! wikitext
13847 __NOTOC__
13848 ==Section 0==
13849 {{sections}}
13850 ==Section 4==
13851 !! html
13852 <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>
13853 <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>
13854 <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>
13855 <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>
13856
13857 !! end
13858
13859 !! test
13860 __NOEDITSECTION__ keyword
13861 !! wikitext
13862 __NOEDITSECTION__
13863 ==Section 1==
13864 ==Section 2==
13865 !! html
13866 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
13867 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
13868
13869 !! end
13870
13871 !! test
13872 Link inside a section heading
13873 !! wikitext
13874 ==Section with a [[Main Page|link]] in it==
13875 !! html
13876 <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>
13877
13878 !! end
13879
13880 !! test
13881 TOC regression (T14077)
13882 !! wikitext
13883 __TOC__
13884 == title 1 ==
13885 === title 1.1 ===
13886 == title 2 ==
13887 !! html
13888 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13889 <ul>
13890 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13891 <ul>
13892 <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>
13893 </ul>
13894 </li>
13895 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13896 </ul>
13897 </div>
13898
13899 <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>
13900 <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>
13901 <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>
13902
13903 !! end
13904
13905 !! test
13906 BUG 1219 URL next to image (good)
13907 !! wikitext
13908 http://example.com [[File:Foobar.jpg]]
13909 !! html/php
13910 <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>
13911 </p>
13912 !! html/parsoid
13913 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13914 !!end
13915
13916 !! test
13917 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13918 !! wikitext
13919 ===
13920 The line above must have a trailing space!
13921 === <!--
13922 --> <!-- -->
13923 But just in case it doesn't...
13924 !! html
13925 <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>
13926 <p>The line above must have a trailing space!
13927 </p>
13928 <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>
13929 <p>But just in case it doesn't...
13930 </p>
13931 !! end
13932
13933 !! test
13934 Header with special characters (bug 25462)
13935 !! wikitext
13936 The tooltips shall not show entities to the user (ie. be double escaped)
13937
13938 == text > text ==
13939 section 1
13940
13941 == text < text ==
13942 section 2
13943
13944 == text & text ==
13945 section 3
13946
13947 == text ' text ==
13948 section 4
13949
13950 == text " text ==
13951 section 5
13952 !! html
13953 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13954 </p>
13955 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13956 <ul>
13957 <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>
13958 <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>
13959 <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>
13960 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13961 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13962 </ul>
13963 </div>
13964
13965 <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 &gt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13966 <p>section 1
13967 </p>
13968 <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>
13969 <p>section 2
13970 </p>
13971 <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>
13972 <p>section 3
13973 </p>
13974 <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>
13975 <p>section 4
13976 </p>
13977 <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>
13978 <p>section 5
13979 </p>
13980 !! end
13981
13982 !! test
13983 Header with space, plus and underscore as entity
13984 !! wikitext
13985 Id should not contain + for spaces
13986
13987 == Space between Text ==
13988 section 1
13989
13990 == Space-Entity&#32;between&#32;Text ==
13991 section 2
13992
13993 == Plus+between+Text ==
13994 section 3
13995
13996 == Plus-Entity&#43;between&#43;Text ==
13997 section 4
13998
13999 == Underscore_between_Text ==
14000 section 5
14001
14002 == Underscore-Entity&#95;between&#95;Text ==
14003 section 6
14004
14005 [[#Space between Text]]
14006 [[#Space-Entity&#32;between&#32;Text]]
14007 [[#Plus+between+Text]]
14008 [[#Plus-Entity&#43;between&#43;Text]]
14009 [[#Underscore_between_Text]]
14010 [[#Underscore-Entity&#95;between&#95;Text]]
14011 !! html
14012 <p>Id should not contain + for spaces
14013 </p>
14014 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14015 <ul>
14016 <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>
14017 <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>
14018 <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>
14019 <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>
14020 <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>
14021 <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>
14022 </ul>
14023 </div>
14024
14025 <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>
14026 <p>section 1
14027 </p>
14028 <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>
14029 <p>section 2
14030 </p>
14031 <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>
14032 <p>section 3
14033 </p>
14034 <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>
14035 <p>section 4
14036 </p>
14037 <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>
14038 <p>section 5
14039 </p>
14040 <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>
14041 <p>section 6
14042 </p><p><a href="#Space_between_Text">#Space between Text</a>
14043 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
14044 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
14045 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
14046 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
14047 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
14048 </p>
14049 !! end
14050
14051 !! test
14052 Headers with excess '=' characters
14053 (Are similar tests necessary beyond the 1st level?)
14054 !! wikitext
14055 =foo==
14056 ==foo=
14057 =''italic'' heading==
14058 ==''italic'' heading=
14059 !! html
14060 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14061 <ul>
14062 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
14063 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
14064 <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>
14065 <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>
14066 </ul>
14067 </div>
14068
14069 <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>
14070 <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>
14071 <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>
14072 <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>
14073
14074 !! end
14075
14076 !! test
14077 HTML headers vs TOC (bug 23393)
14078 (__NOEDITSECTION__ for clearer output, doesn't matter here)
14079 !! wikitext
14080 <h1>Header 1</h1>
14081 == Header 1.1 ==
14082 == Header 1.2 ==
14083
14084 <h1>Header 2
14085 </h1>
14086 == Header 2.1 ==
14087 == Header 2.2 ==
14088 __NOEDITSECTION__
14089 !! html
14090 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14091 <ul>
14092 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
14093 <ul>
14094 <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>
14095 <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>
14096 </ul>
14097 </li>
14098 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
14099 <ul>
14100 <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>
14101 <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>
14102 </ul>
14103 </li>
14104 </ul>
14105 </div>
14106
14107 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
14108 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
14109 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
14110 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
14111 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
14112 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
14113
14114 !! end
14115
14116 !! test
14117 Single-line or multiline-comments can follow headings
14118 !! options
14119 parsoid=wt2html,wt2wt
14120 !! wikitext
14121 ==foo==<!---->
14122 ==bar==<!--c1-->
14123 ==baz==<!--
14124 c2
14125 c3-->
14126 !! html
14127 <h2><span class="mw-headline" id="foo">foo</span></h2>
14128 <h2><span class="mw-headline" id="bar">bar</span></h2>
14129 <h2><span class="mw-headline" id="baz">baz</span></h2>
14130
14131 !! end
14132
14133 !! test
14134 BUG 1219 URL next to image (broken)
14135 !! wikitext
14136 http://example.com[[File:Foobar.jpg]]
14137 !! html/php
14138 <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>
14139 </p>
14140 !! html/parsoid
14141 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14142 !!end
14143
14144 !! test
14145 Bug 1186 news: in the middle of text
14146 !! wikitext
14147 http://en.wikinews.org/wiki/Wikinews:Workplace
14148 !! html
14149 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
14150 </p>
14151 !!end
14152
14153
14154 !! test
14155 Namespaced link must have a title
14156 !! wikitext
14157 [[Project:]]
14158 !! html
14159 <p>[[Project:]]
14160 </p>
14161 !!end
14162
14163 !! test
14164 Namespaced link must have a title (bad fragment version)
14165 !! wikitext
14166 [[Project:#fragment]]
14167 !! html
14168 <p>[[Project:#fragment]]
14169 </p>
14170 !!end
14171
14172
14173 ###
14174 ### HTML tags and HTML attributes
14175 ###
14176
14177 !! test
14178 div with no attributes
14179 !! wikitext
14180 <div>HTML rocks</div>
14181 !! html
14182 <div>HTML rocks</div>
14183
14184 !! end
14185
14186 !! test
14187 div with double-quoted attribute
14188 !! wikitext
14189 <div id="rock">HTML rocks</div>
14190 !! html
14191 <div id="rock">HTML rocks</div>
14192
14193 !! end
14194
14195 !! test
14196 div with single-quoted attribute
14197 !! wikitext
14198 <div id='rock'>HTML rocks</div>
14199 !! html
14200 <div id="rock">HTML rocks</div>
14201
14202 !! end
14203
14204 !! test
14205 div with unquoted attribute
14206 !! wikitext
14207 <div id=rock>HTML rocks</div>
14208 !! html
14209 <div id="rock">HTML rocks</div>
14210
14211 !! end
14212
14213 !! test
14214 div with illegal double attributes
14215 !! wikitext
14216 <div id="a" id="b">HTML rocks</div>
14217 !! html
14218 <div id="b">HTML rocks</div>
14219
14220 !!end
14221
14222 # FIXME: produce empty string instead of "class" in the PHP parser, following
14223 # the HTML5 spec.
14224 !! test
14225 div with empty attribute value, space before equals
14226 !! options
14227 parsoid
14228 !! wikitext
14229 <div class =>HTML rocks</div>
14230 !! html
14231 <div class="">HTML rocks</div>
14232
14233 !! end
14234
14235 !! test
14236 div with multiple empty attribute values
14237 !! options
14238 parsoid
14239 !! wikitext
14240 <div id= title=>HTML rocks</div>
14241 !! html
14242 <div id="" title="">HTML rocks</div>
14243
14244 !! end
14245
14246 !! test
14247 table with multiple empty attribute values
14248 !! options
14249 parsoid
14250 !! wikitext
14251 {| title= id=
14252 | hi
14253 |}
14254 !! html
14255 <table title="" id="">
14256 <tbody><tr><td> hi</td></tr>
14257 </tbody></table>
14258 !! end
14259
14260 !! test
14261 div with braces in attribute value
14262 !! wikitext
14263 <div title="{}">Foo</div>
14264 !! html/php
14265 <div title="&#123;}">Foo</div>
14266
14267 !! html/parsoid
14268 <div title="{}">Foo</div>
14269 !! end
14270
14271 # This it very inconsistent in the PHP parser: it returns
14272 # class="class" if there is a space between the name and the equal sign (see
14273 # 'div with empty attribute value, space before equals'), but strips the
14274 # attribute completely if the space is missing. We hope that not much content
14275 # depends on this, so are implementing the behavior below in Parsoid for
14276 # consistencies' sake.
14277 # FIXME: fix this behavior in the PHP parser?
14278 !! test
14279 div with empty attribute value, no space before equals
14280 !! options
14281 parsoid=wt2html,html2html
14282 !! wikitext
14283 <div class=>HTML rocks</div>
14284 !! html/php
14285 <div>HTML rocks</div>
14286
14287 !! html/parsoid
14288 <div class="">HTML rocks</div>
14289 !! end
14290
14291 !! test
14292 HTML multiple attributes correction
14293 !! wikitext
14294 <p class="error" class="awesome">Awesome!</p>
14295 !! html
14296 <p class="awesome">Awesome!</p>
14297
14298 !!end
14299
14300 !! test
14301 Table multiple attributes correction
14302 !! wikitext
14303 {|
14304 !+ class="error" class="awesome"| status
14305 |}
14306 !! html
14307 <table>
14308 <tr>
14309 <th class="awesome"> status
14310 </th></tr></table>
14311
14312 !!end
14313
14314 !! test
14315 DIV IN UPPERCASE
14316 !! wikitext
14317 <DIV ID="x">HTML ROCKS</DIV>
14318 !! html
14319 <div id="x">HTML ROCKS</div>
14320
14321 !!end
14322
14323 !! test
14324 Non-ASCII pseudo-tags are rendered as text
14325 !! wikitext
14326 <khyô>
14327 !! html
14328 <p>&lt;khyô&gt;
14329 </p>
14330 !! end
14331
14332 !! test
14333 Pseudo-tag with URL 'name' renders as url link
14334 !! wikitext
14335 <http://example.com/>
14336 !! html
14337 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
14338 </p>
14339 !! end
14340
14341 !! test
14342 text with amp in the middle of nowhere
14343 !! wikitext
14344 Remember AT&T?
14345 !! html
14346 <p>Remember AT&amp;T?
14347 </p>
14348 !! end
14349
14350 !! test
14351 text with character entity: eacute
14352 !! wikitext
14353 I always thought &eacute; was a cute letter.
14354 !! html
14355 <p>I always thought &#233; was a cute letter.
14356 </p>
14357 !! html+tidy
14358 <p>I always thought é was a cute letter.</p>
14359 !! end
14360
14361 !! test
14362 text with entity-escaped character entity-like string: eacute
14363 !! wikitext
14364 I always thought &amp;eacute; was a cute letter.
14365 !! html
14366 <p>I always thought &amp;eacute; was a cute letter.
14367 </p>
14368 !! end
14369
14370 !! test
14371 text with undefined character entity: xacute
14372 !! wikitext
14373 I always thought &xacute; was a cute letter.
14374 !! html
14375 <p>I always thought &amp;xacute; was a cute letter.
14376 </p>
14377 !! end
14378
14379 # TODO: generalize to PHP parser?
14380 !! test
14381 HTML5 tags
14382 !! options
14383 parsoid
14384 !! wikitext
14385 <data value="5">five</data>
14386 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14387 <mark>This highlighted text</mark>
14388 !! html
14389 <p><data value="5">five</data>
14390 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14391 <mark>This highlighted text</mark></p>
14392 !! end
14393
14394 !! test
14395 HTML tag with leading space is parsed as text
14396 !! wikitext
14397 < div>foo< /div>
14398 !! html
14399 <p>&lt; div&gt;foo&lt; /div&gt;
14400 </p>
14401 !! end
14402
14403 ###
14404 ### Nesting tests (see bug 41545, 50604, 51081)
14405 ###
14406
14407 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
14408 # Note that html2wt is considerably more difficult if we use <b> in
14409 # the test case, instead of <big>
14410 !! test
14411 Ensure that HTML adoption agency algorithm is properly implemented.
14412 !! wikitext
14413 <big>X<big>Y</big>Z</big>
14414 !! html
14415 <p><big>X<big>Y</big>Z</big>
14416 </p>
14417 !! end
14418
14419 # This was bug 41545 in the PHP parser.
14420 # Note that tidy doesn't handle this correctly.
14421 !! test
14422 Nesting of <kbd>
14423 !! wikitext
14424 <kbd>X<kbd>Y</kbd>Z</kbd>
14425 !! html
14426 <p><kbd>X<kbd>Y</kbd>Z</kbd>
14427 </p>
14428 !! end
14429
14430 # The following cases were bug 51081 in the PHP parser.
14431 # Note that there are some other nestable tags (b, i, etc) which are
14432 # not covered; see bug 51081 for discussion.
14433
14434 # Note that tidy doesn't handle this correctly.
14435 !! test
14436 Nesting of <em>
14437 !! wikitext
14438 <em>X<em>Y</em>Z</em>
14439 !! html
14440 <p><em>X<em>Y</em>Z</em>
14441 </p>
14442 !! end
14443
14444 # Note that tidy doesn't handle this correctly.
14445 !! test
14446 Nesting of <strong>
14447 !! wikitext
14448 <strong>X<strong>Y</strong>Z</strong>
14449 !! html
14450 <p><strong>X<strong>Y</strong>Z</strong>
14451 </p>
14452 !! end
14453
14454 !! test
14455 Nesting of <q>
14456 !! wikitext
14457 <q>X<q>Y</q>Z</q>
14458 !! html+tidy
14459 <p><q>X<q>Y</q>Z</q></p>
14460 !! end
14461
14462 # Note that tidy doesn't handle this correctly.
14463 !! test
14464 Nesting of <ruby>
14465 !! wikitext
14466 <ruby>X<ruby>Y</ruby>Z</ruby>
14467 !! html
14468 <p><ruby>X<ruby>Y</ruby>Z</ruby>
14469 </p>
14470 !! end
14471
14472 # Note that tidy doesn't handle this correctly.
14473 !! test
14474 Nesting of <bdo>
14475 !! wikitext
14476 <bdo>X<bdo>Y</bdo>Z</bdo>
14477 !! html
14478 <p><bdo>X<bdo>Y</bdo>Z</bdo>
14479 </p>
14480 !! end
14481
14482
14483 ###
14484 ### Media links
14485 ###
14486
14487 !! test
14488 Media link
14489 !! wikitext
14490 [[Media:Foobar.jpg]]
14491 !! html
14492 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
14493 </p>
14494 !! end
14495
14496 !! test
14497 Media link with text
14498 !! wikitext
14499 [[Media:Foobar.jpg|A neat file to look at]]
14500 !! html
14501 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
14502 </p>
14503 !! end
14504
14505 # FIXME: this is still bad HTML tag nesting
14506 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
14507 !! test
14508 Media link with nasty text
14509 !! wikitext
14510 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
14511 !! html
14512 <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>
14513
14514 !! html+tidy
14515 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
14516 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
14517 !! end
14518
14519 !! test
14520 Media link to nonexistent file (bug 1702)
14521 !! wikitext
14522 [[Media:No such.jpg]]
14523 !! html
14524 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
14525 </p>
14526 !! end
14527
14528 !! test
14529 Image link to nonexistent file (bug 1850 - good)
14530 !! wikitext
14531 [[File:No_such.jpg]]
14532 !! html/php
14533 <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>
14534 </p>
14535 !! html/parsoid
14536 <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>
14537 !! end
14538
14539 !! test
14540 :Image link to nonexistent file (bug 1850 - bad)
14541 !! wikitext
14542 [[:Image:No such.jpg]]
14543 !! html/php
14544 <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>
14545 </p>
14546 !! html/parsoid
14547 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
14548 !! end
14549
14550
14551
14552 !! test
14553 Character reference normalization in link text (bug 1938)
14554 !! wikitext
14555 [[Main Page|this&that]]
14556 !! html
14557 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
14558 </p>
14559 !!end
14560
14561 !! article
14562 אַ
14563 !! text
14564 Test for unicode normalization
14565
14566 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
14567 !! endarticle
14568
14569 !! test
14570 (bug 19451) Links should refer to the normalized form.
14571 !! wikitext
14572 [[&#xFB2E;]]
14573 [[&#x5d0;&#x5b7;]]
14574 [[&#x5d0;ַ]]
14575 [[א&#x5b7;]]
14576 [[אַ]]
14577 !! html
14578 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
14579 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
14580 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
14581 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
14582 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
14583 </p>
14584 !! end
14585
14586 !! test
14587 Empty attribute crash test (bug 2067)
14588 !! wikitext
14589 <font color="">foo</font>
14590 !! html
14591 <p><font color="">foo</font>
14592 </p>
14593 !! end
14594
14595 !! test
14596 Empty attribute crash test single-quotes (bug 2067)
14597 !! wikitext
14598 <font color=''>foo</font>
14599 !! html
14600 <p><font color="">foo</font>
14601 </p>
14602 !! end
14603
14604 !! test
14605 Attribute test: equals, then nothing
14606 !! wikitext
14607 <font color=>foo</font>
14608 !! html
14609 <p><font>foo</font>
14610 </p>
14611 !! end
14612
14613 !! test
14614 Attribute test: unquoted value
14615 !! wikitext
14616 <font color=x>foo</font>
14617 !! html
14618 <p><font color="x">foo</font>
14619 </p>
14620 !! end
14621
14622 !! test
14623 Attribute test: unquoted but illegal value (hash)
14624 !! wikitext
14625 <font color=#x>foo</font>
14626 !! html
14627 <p><font color="#x">foo</font>
14628 </p>
14629 !! end
14630
14631 # Parsoid does not serialize to empty attribute syntax,
14632 # so wt2wt and html2wt cases are skipped
14633 !! test
14634 Attribute test: no value (T54330)
14635 !! options
14636 parsoid=wt2html,html2html
14637 !! wikitext
14638 <font color>foo</font>
14639 !! html/php
14640 <p><font color="">foo</font>
14641 </p>
14642 !! html/parsoid
14643 <p><font color="">foo</font></p>
14644 !! end
14645
14646 !! test
14647 Bug 2095: link with three closing brackets
14648 !! wikitext
14649 [[Main Page]]]
14650 !! html/php
14651 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
14652 </p>
14653 !! html/parsoid
14654 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
14655 !! end
14656
14657 !! test
14658 Bug 2095: link with pipe and three closing brackets
14659 !! wikitext
14660 [[Main Page|link]]]
14661 !! html/php
14662 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
14663 </p>
14664 !! html/parsoid
14665 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
14666 !! end
14667
14668 !! test
14669 Bug 2095: link with pipe and three closing brackets, version 2
14670 !! wikitext
14671 [[Main Page|[http://example.com/]]]
14672 !! html/php
14673 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
14674 </p>
14675 !! html/parsoid
14676 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
14677 !! end
14678
14679
14680 ###
14681 ### Safety
14682 ###
14683
14684 !! article
14685 Template:Dangerous attribute
14686 !! text
14687 " onmouseover="alert(document.cookie)
14688 !! endarticle
14689
14690 !! article
14691 Template:Dangerous style attribute
14692 !! text
14693 border-size: expression(alert(document.cookie))
14694 !! endarticle
14695
14696 !! article
14697 Template:Div style
14698 !! text
14699 <div style="float: right; {{{1}}}">Magic div</div>
14700 !! endarticle
14701
14702 !! test
14703 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
14704 !! wikitext
14705 <div title="{{test}}"></div>
14706 !! html
14707 <div title="This is a test template"></div>
14708
14709 !! end
14710
14711 # Parsoid has enough context to handle this case
14712 !! test
14713 Bug 2304: HTML attribute safety (dangerous template; 2309)
14714 !! wikitext
14715 <div title="{{dangerous attribute}}"></div>
14716 !! html/php
14717 <div title=""></div>
14718
14719 !! html/parsoid
14720 <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>
14721 !! end
14722
14723 !! test
14724 Bug 2304: HTML attribute safety (dangerous style template; 2309)
14725 !! wikitext
14726 <div style="{{dangerous style attribute}}"></div>
14727 !! html
14728 <div style="/* insecure input */"></div>
14729
14730 !! end
14731
14732 !! test
14733 Bug 2304: HTML attribute safety (safe parameter; 2309)
14734 !! wikitext
14735 {{div style|width: 200px}}
14736 !! html
14737 <div style="float: right; width: 200px">Magic div</div>
14738
14739 !! end
14740
14741 !! test
14742 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
14743 !! wikitext
14744 {{div style|width: expression(alert(document.cookie))}}
14745 !! html
14746 <div style="/* insecure input */">Magic div</div>
14747
14748 !! end
14749
14750 !! test
14751 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
14752 !! wikitext
14753 {{div style|"><script>alert(document.cookie)</script>}}
14754 !! html
14755 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14756
14757 !! end
14758
14759 !! test
14760 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
14761 !! wikitext
14762 {{div style|" ><script>alert(document.cookie)</script>}}
14763 !! html
14764 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14765
14766 !! end
14767
14768 !! test
14769 Bug 2304: HTML attribute safety (link)
14770 !! wikitext
14771 <div title="[[Main Page]]"></div>
14772 !! html
14773 <div title="&#91;&#91;Main Page]]"></div>
14774
14775 !! end
14776
14777 !! test
14778 Bug 2304: HTML attribute safety (italics)
14779 !! wikitext
14780 <div title="''foobar''"></div>
14781 !! html
14782 <div title="&#39;&#39;foobar&#39;&#39;"></div>
14783
14784 !! end
14785
14786 !! test
14787 Bug 2304: HTML attribute safety (bold)
14788 !! wikitext
14789 <div title="'''foobar'''"></div>
14790 !! html
14791 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
14792
14793 !! end
14794
14795
14796 !! test
14797 Bug 2304: HTML attribute safety (ISBN)
14798 !! wikitext
14799 <div title="ISBN 1234567890"></div>
14800 !! html
14801 <div title="&#73;SBN 1234567890"></div>
14802
14803 !! end
14804
14805 !! test
14806 Bug 2304: HTML attribute safety (RFC)
14807 !! wikitext
14808 <div title="RFC 1234"></div>
14809 !! html
14810 <div title="&#82;FC 1234"></div>
14811
14812 !! end
14813
14814 !! test
14815 Bug 2304: HTML attribute safety (PMID)
14816 !! wikitext
14817 <div title="PMID 1234567890"></div>
14818 !! html
14819 <div title="&#80;MID 1234567890"></div>
14820
14821 !! end
14822
14823 !! test
14824 Bug 2304: HTML attribute safety (web link)
14825 !! wikitext
14826 <div title="http://example.com/"></div>
14827 !! html
14828 <div title="http&#58;//example.com/"></div>
14829
14830 !! end
14831
14832 !! test
14833 Bug 2304: HTML attribute safety (named web link)
14834 !! wikitext
14835 <div title="[http://example.com/ link]"></div>
14836 !! html
14837 <div title="&#91;http&#58;//example.com/ link]"></div>
14838
14839 !! end
14840
14841 !! test
14842 Bug 3244: HTML attribute safety (extension; safe)
14843 !! wikitext
14844 <div style="<nowiki>background:blue</nowiki>"></div>
14845 !! html
14846 <div style="background:blue"></div>
14847
14848 !! end
14849
14850 !! test
14851 Bug 3244: HTML attribute safety (extension; unsafe)
14852 !! wikitext
14853 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14854 !! html
14855 <div style="/* insecure input */"></div>
14856
14857 !! end
14858
14859 # More MSIE fun discovered by Tom Gilder
14860
14861 !! test
14862 MSIE CSS safety test: spurious slash
14863 !! wikitext
14864 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14865 !! html
14866 <div style="/* insecure input */">evil</div>
14867
14868 !! end
14869
14870 !! test
14871 MSIE CSS safety test: hex code
14872 !! wikitext
14873 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14874 !! html
14875 <div style="/* insecure input */">evil</div>
14876
14877 !! end
14878
14879 !! test
14880 MSIE CSS safety test: comment in url
14881 !! wikitext
14882 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14883 !! html
14884 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14885
14886 !! end
14887
14888 !! test
14889 MSIE CSS safety test: comment in expression
14890 !! wikitext
14891 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14892 !! html
14893 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14894
14895 !! end
14896
14897 !! test
14898 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14899 !! wikitext
14900 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14901 !! html
14902 <p style="/* invalid control char */">A</p>
14903
14904 !! end
14905
14906 !! test
14907 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14908 !! wikitext
14909 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14910 <div style="top:EXPRESSION(alert())">B</div>
14911 !! html
14912 <p style="/* insecure input */">A</p>
14913 <div style="/* insecure input */">B</div>
14914
14915 !! end
14916
14917 !! test
14918 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14919 !! wikitext
14920 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14921 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14922 !! html
14923 <div style="/* insecure input */">A</div>
14924 <p style="/* insecure input */">B</p>
14925
14926 !! end
14927
14928 !! test
14929 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14930 !! wikitext
14931 <div style="background-image:url⁽javascript:alert())">A</div>
14932 <div style="background-image:url₍javascript:alert())">B</div>
14933 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14934 !! html
14935 <div style="/* insecure input */">A</div>
14936 <div style="/* insecure input */">B</div>
14937 <p style="/* insecure input */">C</p>
14938
14939 !! end
14940
14941 !! test
14942 Opera -o-link CSS
14943 !! wikitext
14944 <div
14945 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;"
14946 style="-o-link:attr(title);-o-link-source:current">X</div>
14947 !! html
14948 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14949
14950 !! end
14951
14952 !! test
14953 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14954 !! wikitext
14955 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14956 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14957 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14958 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14959 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14960 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14961 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14962 !! html
14963 <p style="/* insecure input */">A</p>
14964 <p style="/* insecure input */">B</p>
14965 <p style="/* insecure input */">C</p>
14966 <p style="/* insecure input */">D</p>
14967 <p style="/* insecure input */">E</p>
14968 <p style="/* insecure input */">F</p>
14969 <p style="/* insecure input */">G</p>
14970
14971 !! end
14972
14973 !! test
14974 Table attribute legitimate extension
14975 !! wikitext
14976 {|
14977 !+ style="<nowiki>color:blue</nowiki>"| status
14978 |}
14979 !! html
14980 <table>
14981 <tr>
14982 <th style="color:blue"> status
14983 </th></tr></table>
14984
14985 !!end
14986
14987 !! test
14988 Table attribute safety
14989 !! wikitext
14990 {|
14991 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14992 |}
14993 !! html
14994 <table>
14995 <tr>
14996 <th style="/* insecure input */"> status
14997 </th></tr></table>
14998
14999 !! end
15000
15001 !! test
15002 CSS line continuation 1
15003 !! wikitext
15004 <div style="background-image: u\&#10;rl(test.jpg);"></div>
15005 !! html
15006 <div style="/* insecure input */"></div>
15007
15008 !! end
15009
15010 !! test
15011 CSS line continuation 2
15012 !! wikitext
15013 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15014 !! html
15015 <div style="/* insecure input */"></div>
15016
15017 !! end
15018
15019 !! article
15020 Template:Identity
15021 !! text
15022 {{{1}}}
15023 !! endarticle
15024
15025 !! test
15026 Expansion of multi-line templates in attribute values (bug 6255)
15027 !! wikitext
15028 <div style="background: {{identity|#00FF00}}">-</div>
15029 !! html
15030 <div style="background: #00FF00">-</div>
15031
15032 !! end
15033
15034
15035 !! test
15036 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
15037 !! wikitext
15038 <div style="background:
15039 #00FF00">-</div>
15040 !! html/php
15041 <div style="background: #00FF00">-</div>
15042
15043 !! html/parsoid
15044 <div style="background:
15045 #00FF00">-</div>
15046 !! end
15047
15048 !! test
15049 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
15050 !! wikitext
15051 <div style="background: &#10;#00FF00">-</div>
15052 !! html
15053 <div style="background: &#10;#00FF00">-</div>
15054
15055 !! end
15056
15057 !! test
15058 evil <math>-wiki-tags without Extension:Math enabled
15059 !! wikitext
15060 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
15061 !! html+tidy
15062 <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>
15063 !! end
15064
15065 ###
15066 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
15067 ###
15068 !! test
15069 Parser hook: empty input
15070 !! wikitext
15071 <tag></tag>
15072 !! html
15073 <pre>
15074 ''
15075 array (
15076 )
15077 </pre>
15078
15079 !! end
15080
15081 !! test
15082 Parser hook: empty input using terminated empty elements
15083 !! wikitext
15084 <tag/>
15085 !! html
15086 <pre>
15087 NULL
15088 array (
15089 )
15090 </pre>
15091
15092 !! end
15093
15094 !! test
15095 Parser hook: empty input using terminated empty elements (space before)
15096 !! wikitext
15097 <tag />
15098 !! html
15099 <pre>
15100 NULL
15101 array (
15102 )
15103 </pre>
15104
15105 !! end
15106
15107 !! test
15108 Parser hook: basic input
15109 !! wikitext
15110 <tag>input</tag>
15111 !! html
15112 <pre>
15113 'input'
15114 array (
15115 )
15116 </pre>
15117
15118 !! end
15119
15120
15121 !! test
15122 Parser hook: case insensitive
15123 !! wikitext
15124 <TAG>input</TAG>
15125 !! html
15126 <pre>
15127 'input'
15128 array (
15129 )
15130 </pre>
15131
15132 !! end
15133
15134
15135 !! test
15136 Parser hook: case insensitive, redux
15137 !! wikitext
15138 <TaG>input</TAg>
15139 !! html
15140 <pre>
15141 'input'
15142 array (
15143 )
15144 </pre>
15145
15146 !! end
15147
15148 !! test
15149 Parser hook: nested tags
15150 !! options
15151 noxml
15152 !! wikitext
15153 <tag><tag></tag></tag>
15154 !! html
15155 <pre>
15156 '<tag>'
15157 array (
15158 )
15159 </pre>&lt;/tag&gt;
15160
15161 !! end
15162
15163 !! test
15164 Parser hook: basic arguments
15165 !! wikitext
15166 <tag width=200 height = "100" depth = '50' square></tag>
15167 !! html
15168 <pre>
15169 ''
15170 array (
15171 'width' => '200',
15172 'height' => '100',
15173 'depth' => '50',
15174 'square' => '',
15175 )
15176 </pre>
15177
15178 !! end
15179
15180 !! test
15181 Parser hook: argument containing a forward slash (bug 5344)
15182 !! wikitext
15183 <tag filename='/tmp/bla'></tag>
15184 !! html
15185 <pre>
15186 ''
15187 array (
15188 'filename' => '/tmp/bla',
15189 )
15190 </pre>
15191
15192 !! end
15193
15194 !! test
15195 Parser hook: empty input using terminated empty elements (bug 2374)
15196 !! wikitext
15197 <tag foo=bar/>text
15198 !! html
15199 <pre>
15200 NULL
15201 array (
15202 'foo' => 'bar',
15203 )
15204 </pre>text
15205
15206 !! end
15207
15208 # </tag> should be output literally since there is no matching tag that begins it
15209 !! test
15210 Parser hook: basic arguments using terminated empty elements (bug 2374)
15211 !! wikitext
15212 <tag width=200 height = "100" depth = '50' square/>
15213 other stuff
15214 </tag>
15215 !! html
15216 <pre>
15217 NULL
15218 array (
15219 'width' => '200',
15220 'height' => '100',
15221 'depth' => '50',
15222 'square' => '',
15223 )
15224 </pre>
15225 <p>other stuff
15226 &lt;/tag&gt;
15227 </p>
15228 !! end
15229
15230 ###
15231 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
15232 ###
15233
15234 !! test
15235 Parser hook: static parser hook not inside a comment
15236 !! wikitext
15237 <statictag>hello, world</statictag>
15238 <statictag action=flush/>
15239 !! html
15240 <p>hello, world
15241 </p>
15242 !! end
15243
15244
15245 !! test
15246 Parser hook: static parser hook inside a comment
15247 !! wikitext
15248 <!-- <statictag>hello, world</statictag> -->
15249 <statictag action=flush/>
15250 !! html
15251 <p><br />
15252 </p>
15253 !! end
15254
15255 # Nested template calls; this case was broken by Parser.php rev 1.506,
15256 # since reverted.
15257
15258 !! article
15259 Template:One-parameter
15260 !! text
15261 (My parameter is: {{{1}}})
15262 !! endarticle
15263
15264 !! article
15265 Template:Map-one-parameter
15266 !! text
15267 {{{{{1}}}|{{{2}}}}}
15268 !! endarticle
15269
15270 !! test
15271 Nested template calls
15272 !! wikitext
15273 {{Map-one-parameter|One-parameter|param}}
15274 !! html
15275 <p>(My parameter is: param)
15276 </p>
15277 !! end
15278
15279
15280 ###
15281 ### Sanitizer
15282 ###
15283
15284 # HTML+Tidy effectively strips out the empty tags completely
15285 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
15286 # which Tidy would have done for the PHP parser had there been content inside it.
15287 !! test
15288 Sanitizer: Closing of open tags
15289 !! wikitext
15290 <s></s><table></table>
15291 !! html
15292 <s></s><table></table>
15293
15294 !! html/parsoid
15295 <p><s></s></p><table></table>
15296 !! end
15297
15298 !! test
15299 Sanitizer: Closing of open but not closed tags
15300 !! wikitext
15301 <s>foo
15302 !! html
15303 <p><s>foo</s>
15304 </p>
15305 !! end
15306
15307 !! test
15308 Sanitizer: Closing of closed but not open tags
15309 !! wikitext
15310 </s>
15311 !! html
15312 <p>&lt;/s&gt;
15313 </p>
15314 !! end
15315
15316 !! test
15317 Sanitizer: Closing of closed but not open table tags
15318 !! wikitext
15319 Table not started</td></tr></table>
15320 !! html
15321 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
15322 </p>
15323 !! end
15324
15325 !! test
15326 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
15327 !! wikitext
15328 <span id="æ: v">byte</span>[[#æ: v|backlink]]
15329 !! html
15330 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
15331 </p>
15332 !! end
15333
15334 # In HTML5, the restrictions are that id must contain at least one character,
15335 # and must not contain any space characters.
15336 !! test
15337 Sanitizer: Validating the contents of the id attribute (bug 4515)
15338 !! options
15339 disabled
15340 !! wikitext
15341 <br id="" /><br id="a space" />
15342 !! html
15343 Something ...
15344 !! end
15345
15346 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
15347 !! test
15348 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
15349 !! options
15350 disabled
15351 !! wikitext
15352 <br id="foo" /><br id="foo" />
15353 !! html
15354 Something need to be done. foo-2 ?
15355 !! end
15356
15357 !! test
15358 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
15359 !! wikitext
15360 <div itemscope>
15361 <meta itemprop="hello" content="world">
15362 <meta http-equiv="refresh" content="5">
15363 <meta itemprop="hello" http-equiv="refresh" content="5">
15364 <link itemprop="hello" href="{{SERVER}}">
15365 <link rel="stylesheet" href="{{SERVER}}">
15366 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
15367 </div>
15368 !! html
15369 <div itemscope="">
15370 <p> <meta itemprop="hello" content="world" />
15371 &lt;meta http-equiv="refresh" content="5"&gt;
15372 <meta itemprop="hello" content="5" />
15373 </p>
15374 <link itemprop="hello" href="http&#58;//example.org" />
15375 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
15376 <link itemprop="hello" href="http&#58;//example.org" />
15377 </div>
15378
15379 !! end
15380
15381 !! test
15382 Language converter: output gets cut off unexpectedly (bug 5757)
15383 !! options
15384 language=zh
15385 !! wikitext
15386 this bit is safe: }-
15387
15388 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
15389
15390 then we get cut off here: }-
15391
15392 all additional text is vanished
15393 !! html
15394 <p>this bit is safe: }-
15395 </p><p>but if we add a conversion instance: xxx
15396 </p><p>then we get cut off here: }-
15397 </p><p>all additional text is vanished
15398 </p>
15399 !! end
15400
15401 !! test
15402 Self closed html pairs (bug 5487)
15403 !! options
15404 !! wikitext
15405 <center><font id="bug" />Centered text</center>
15406 <div><font id="bug2" />In div text</div>
15407 !! html
15408 <center>&lt;font id="bug" /&gt;Centered text</center>
15409 <div>&lt;font id="bug2" /&gt;In div text</div>
15410
15411 !! end
15412
15413 #
15414 #
15415 #
15416
15417 !! test
15418 Punctuation: nbsp before exclamation
15419 !! wikitext
15420 C'est grave !
15421 !! html
15422 <p>C'est grave&#160;!
15423 </p>
15424 !! end
15425
15426 !! test
15427 Punctuation: CSS !important (bug 11874)
15428 !! wikitext
15429 <div style="width:50% !important">important</div>
15430 !! html
15431 <div style="width:50% !important">important</div>
15432
15433 !!end
15434
15435 !! test
15436 Punctuation: CSS ! important (bug 11874; with space after)
15437 !! wikitext
15438 <div style="width:50% ! important">important</div>
15439 !! html
15440 <div style="width:50% ! important">important</div>
15441
15442 !!end
15443
15444 !! test
15445 HTML bullet list, closed tags (bug 5497)
15446 !! wikitext
15447 <ul>
15448 <li>One</li>
15449 <li>Two</li>
15450 </ul>
15451 !! html/php
15452 <ul>
15453 <li>One</li>
15454 <li>Two</li>
15455 </ul>
15456
15457 !! html/parsoid
15458 <ul data-parsoid='{"stx":"html"}'>
15459 <li data-parsoid='{"stx":"html"}'>One</li>
15460 <li data-parsoid='{"stx":"html"}'>Two</li>
15461 </ul>
15462
15463 !! end
15464
15465 !! test
15466 HTML bullet list, unclosed tags (bug 5497)
15467 !! wikitext
15468 <ul>
15469 <li>One
15470 <li>Two
15471 </ul>
15472 !! html/php+tidy
15473 <ul>
15474 <li>One</li>
15475 <li>Two</li>
15476 </ul>
15477 !! html/parsoid
15478 <ul data-parsoid='{"stx":"html"}'>
15479 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15480 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15481 </ul>
15482
15483 !! end
15484
15485 !! test
15486 HTML ordered list, closed tags (bug 5497)
15487 !! wikitext
15488 <ol>
15489 <li>One</li>
15490 <li>Two</li>
15491 </ol>
15492 !! html/php
15493 <ol>
15494 <li>One</li>
15495 <li>Two</li>
15496 </ol>
15497
15498 !! html/parsoid
15499 <ol data-parsoid='{"stx":"html"}'>
15500 <li data-parsoid='{"stx":"html"}'>One</li>
15501 <li data-parsoid='{"stx":"html"}'>Two</li>
15502 </ol>
15503
15504 !! end
15505
15506 !! test
15507 HTML ordered list, unclosed tags (bug 5497)
15508 !! options
15509 !! wikitext
15510 <ol>
15511 <li>One
15512 <li>Two
15513 </ol>
15514 !! html/php+tidy
15515 <ol>
15516 <li>One</li>
15517 <li>Two</li>
15518 </ol>
15519 !! html/parsoid
15520 <ol data-parsoid='{"stx":"html"}'>
15521 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15522 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15523 </ol>
15524
15525 !! end
15526
15527 !! test
15528 HTML nested bullet list, closed tags (bug 5497)
15529 !! wikitext
15530 <ul>
15531 <li>One</li>
15532 <li>Two:
15533 <ul>
15534 <li>Sub-one</li>
15535 <li>Sub-two</li>
15536 </ul>
15537 </li>
15538 </ul>
15539 !! html
15540 <ul>
15541 <li>One</li>
15542 <li>Two:
15543 <ul>
15544 <li>Sub-one</li>
15545 <li>Sub-two</li>
15546 </ul>
15547 </li>
15548 </ul>
15549
15550 !! end
15551
15552 !! test
15553 HTML nested bullet list, open tags (bug 5497)
15554 !! wikitext
15555 <ul>
15556 <li>One
15557 <li>Two:
15558 <ul>
15559 <li>Sub-one
15560 <li>Sub-two
15561 </ul>
15562 </ul>
15563 !! html/php+tidy
15564 <ul>
15565 <li>One</li>
15566 <li>Two:
15567 <ul>
15568 <li>Sub-one</li>
15569 <li>Sub-two</li>
15570 </ul>
15571 </li>
15572 </ul>
15573 !! html/parsoid
15574 <ul>
15575 <li>One
15576 </li>
15577 <li>Two:
15578 <ul>
15579 <li>Sub-one
15580 </li>
15581 <li>Sub-two
15582 </li>
15583 </ul>
15584 </li>
15585 </ul>
15586
15587 !! end
15588
15589 !! test
15590 HTML nested ordered list, closed tags (bug 5497)
15591 !! wikitext
15592 <ol>
15593 <li>One</li>
15594 <li>Two:
15595 <ol>
15596 <li>Sub-one</li>
15597 <li>Sub-two</li>
15598 </ol>
15599 </li>
15600 </ol>
15601 !! html
15602 <ol>
15603 <li>One</li>
15604 <li>Two:
15605 <ol>
15606 <li>Sub-one</li>
15607 <li>Sub-two</li>
15608 </ol>
15609 </li>
15610 </ol>
15611
15612 !! end
15613
15614 !! test
15615 HTML nested ordered list, open tags (bug 5497)
15616 !! wikitext
15617 <ol>
15618 <li>One
15619 <li>Two:
15620 <ol>
15621 <li>Sub-one
15622 <li>Sub-two
15623 </ol>
15624 </ol>
15625 !! html/php
15626 <ol>
15627 <li>One
15628 <li>Two:
15629 <ol>
15630 <li>Sub-one
15631 <li>Sub-two
15632 </ol>
15633 </ol>
15634
15635 !! html/parsoid
15636 <ol>
15637 <li>One
15638 </li>
15639 <li>Two:
15640 <ol>
15641 <li>Sub-one
15642 </li>
15643 <li>Sub-two
15644 </li>
15645 </ol>
15646 </li>
15647 </ol>
15648
15649 !! end
15650
15651 !! test
15652 HTML ordered list item with parameters oddity
15653 !! wikitext
15654 <ol><li id="fragment">One</li>
15655 </ol>
15656 !! html
15657 <ol><li id="fragment">One</li>
15658 </ol>
15659
15660 !! end
15661
15662 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
15663 !!test
15664 bug 5918: autonumbering
15665 !! wikitext
15666 [http://first/] [http://second] [ftp://ftp]
15667
15668 ftp://inlineftp
15669
15670 [mailto:enclosed@mail.tld With target]
15671
15672 [mailto:enclosed@mail.tld]
15673
15674 mailto:inline@mail.tld
15675 !! html/php
15676 <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>
15677 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
15678 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
15679 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
15680 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
15681 </p>
15682 !! html/parsoid
15683 <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>
15684 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
15685 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
15686 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
15687 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
15688 !! end
15689
15690
15691 #
15692 # Security and HTML correctness
15693 # From Nick Jenkins' fuzz testing
15694 #
15695
15696 !! test
15697 Fuzz testing: Parser13
15698 !! wikitext
15699 {|
15700 | http://a|
15701 !! html
15702 <table>
15703 <tr>
15704 <td>
15705 </td>
15706 </tr>
15707 </table>
15708
15709 !! end
15710
15711 !! test
15712 Fuzz testing: Parser14
15713 !! wikitext
15714 == onmouseover= ==
15715 http://__TOC__
15716 !! html
15717 <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>
15718 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15719 <ul>
15720 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15721 </ul>
15722 </div>
15723
15724
15725 !! html+tidy
15726 <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>
15727 <p>http://</p>
15728 <div id="toc" class="toc">
15729 <div id="toctitle">
15730 <h2>Contents</h2>
15731 </div>
15732 <ul>
15733 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15734 </ul>
15735 </div>
15736 <p></p>
15737 !! end
15738
15739 !! test
15740 Fuzz testing: Parser14-table
15741 !! wikitext
15742 ==a==
15743 {| STYLE=__TOC__
15744 !! html
15745 <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>
15746 <table style="&#95;_TOC&#95;_">
15747 <tr><td></td></tr>
15748 </table>
15749
15750 !! html+tidy
15751 <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>
15752 <table style="__TOC__">
15753 <tr>
15754 <td></td>
15755 </tr>
15756 </table>
15757 !! end
15758
15759 # Known to produce bogus xml (extra </td>)
15760 !! test
15761 Fuzz testing: Parser16
15762 !! options
15763 noxml
15764 !! wikitext
15765 {|
15766 !https://||||||
15767 !! html
15768 <table>
15769 <tr>
15770 <th>https://</th>
15771 <th></th>
15772 <th></th>
15773 <th>
15774 </td>
15775 </tr>
15776 </table>
15777
15778 !! html+tidy
15779 <table>
15780 <tr>
15781 <th>https://</th>
15782 <th></th>
15783 <th></th>
15784 <th></th>
15785 </tr>
15786 </table>
15787 !! end
15788
15789 !! test
15790 Fuzz testing: Parser21
15791 !! wikitext
15792 {|
15793 ! irc://{{ftp://a" onmouseover="alert('hello world');"
15794 |
15795 !! html
15796 <table>
15797 <tr>
15798 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
15799 </th>
15800 <td>
15801 </td>
15802 </tr>
15803 </table>
15804
15805 !! end
15806
15807 !! test
15808 Fuzz testing: Parser22
15809 !! wikitext
15810 http://===r:::https://b
15811
15812 {|
15813 !! html
15814 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
15815 </p>
15816 <table>
15817 <tr><td></td></tr>
15818 </table>
15819
15820 !! end
15821
15822 # Known to produce bad XML for now
15823 !! test
15824 Fuzz testing: Parser24
15825 !! options
15826 noxml
15827 !! wikitext
15828 {|
15829 {{{|
15830 <u CLASS=
15831 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
15832 <br style="onmouseover='alert(document.cookie);' " />
15833
15834 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15835 |
15836 !! html
15837 <table>
15838 {{{|
15839 <u class="&#124;">}}}} &gt;
15840 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
15841
15842 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15843 <tr>
15844 <td></u>
15845 </td>
15846 </tr>
15847 </table>
15848
15849 !! end
15850
15851 # Note: the current result listed for this is not what the original one was,
15852 # but the original bug was JavaScript injection, which is fixed in any case.
15853 # It's not clear that the original result listed was any more correct than the
15854 # current one. Original result:
15855 # <p>{{{|
15856 # </p>
15857 # <li class="&#124;&#124;">
15858 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15859 !!test
15860 Fuzz testing: Parser25 (bug 6055)
15861 !! wikitext
15862 {{{
15863 |
15864 <LI CLASS=||
15865 >
15866 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15867 !! html
15868 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15869 </p>
15870 !! end
15871
15872 !!test
15873 Fuzz testing: URL adjacent extension (with space, clean)
15874 !! wikitext
15875 http://example.com <nowiki>junk</nowiki>
15876 !! html/php
15877 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15878 </p>
15879 !! html/parsoid
15880 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
15881 !! end
15882
15883 !!test
15884 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15885 !! wikitext
15886 http://example.com<nowiki>junk</nowiki>
15887 !! html/php
15888 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15889 </p>
15890 !! html/parsoid
15891 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
15892 !! end
15893
15894 !!test
15895 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15896 !! wikitext
15897 http://example.com<pre>junk</pre>
15898 !! html/php
15899 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15900
15901 !! html/php+tidy
15902 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15903 <pre>
15904 junk
15905 </pre>
15906 !! html/parsoid
15907 <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>
15908 !!end
15909
15910 !!test
15911 Fuzz testing: image with bogus manual thumbnail
15912 !! wikitext
15913 [[Image:foobar.jpg|thumbnail= ]]
15914 !! html/php
15915 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
15916
15917 !! html/parsoid
15918 <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>
15919 !!end
15920
15921 !! test
15922 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15923 !! wikitext
15924 <pre dir="&#10;"></pre>
15925 !! html
15926 <pre dir="&#10;"></pre>
15927
15928 !! end
15929
15930 !! test
15931 Parsing optional HTML elements (Bug 6171)
15932 !! options
15933 !! wikitext
15934 <table>
15935 <tr>
15936 <td> Some tabular data</td>
15937 <td> More tabular data ...
15938 <td> And yet som tabular data</td>
15939 </tr>
15940 </table>
15941 !! html
15942 <table>
15943 <tr>
15944 <td> Some tabular data</td>
15945 <td> More tabular data ...
15946 </td><td> And yet som tabular data</td>
15947 </tr>
15948 </table>
15949
15950 !! end
15951
15952 !! test
15953 Correct handling of <td>, <tr> (Bug 6171)
15954 !! options
15955 !! wikitext
15956 <table>
15957 <tr>
15958 <td> Some tabular data</td>
15959 <td> More tabular data ...</td>
15960 <td> And yet som tabular data</td>
15961 </tr>
15962 </table>
15963 !! html
15964 <table>
15965 <tr>
15966 <td> Some tabular data</td>
15967 <td> More tabular data ...</td>
15968 <td> And yet som tabular data</td>
15969 </tr>
15970 </table>
15971
15972 !! end
15973
15974
15975 !! test
15976 Parsing crashing regression (fr:JavaScript)
15977 !! wikitext
15978 </body></x>
15979 !! html
15980 <p>&lt;/body&gt;&lt;/x&gt;
15981 </p>
15982 !! end
15983
15984 !! test
15985 Inline wiki vs wiki block nesting
15986 !! wikitext
15987 '''Bold paragraph
15988
15989 New wiki paragraph
15990 !! html
15991 <p><b>Bold paragraph</b>
15992 </p><p>New wiki paragraph
15993 </p>
15994 !! end
15995
15996 # FIXME: The current php output is documented
15997 # and desired output is the parsoid target.
15998 !! test
15999 Inline HTML vs wiki block nesting
16000 !! wikitext
16001 <b>Bold paragraph
16002
16003 New wiki paragraph
16004 !! html/php
16005 <p><b>Bold paragraph
16006 </p><p>New wiki paragraph</b>
16007 </p>
16008 !! html/parsoid
16009 <p><b>Bold paragraph</b>
16010 </p><p>New wiki paragraph
16011 </p>
16012 !! end
16013
16014 # Original result was this:
16015 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16016 # </p>
16017 # While that might be marginally more intuitive, maybe, the six-apostrophe
16018 # construct is clearly pathological and the result stated here (which is what
16019 # the parser actually does) is about as reasonable as anything.
16020 !!test
16021 Mixing markup for italics and bold
16022 !! options
16023 !! wikitext
16024 '''bold''''''bold''bolditalics'''''
16025 !! html
16026 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
16027 </p>
16028 !! end
16029
16030
16031 !! article
16032 Xyzzyx
16033 !! text
16034 Article for special page transclusion test
16035 !! endarticle
16036
16037 !! test
16038 Special page transclusion
16039 !! options
16040 !! wikitext
16041 {{Special:Prefixindex/Xyzzyx}}
16042 !! html
16043 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16044
16045 !! end
16046
16047 !! test
16048 Special page transclusion twice (bug 5021)
16049 !! options
16050 !! wikitext
16051 {{Special:Prefixindex/Xyzzyx}}
16052 {{Special:Prefixindex/Xyzzyx}}
16053 !! html
16054 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16055 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16056
16057 !! end
16058
16059 !! test
16060 Transclusion of default MediaWiki message
16061 !! wikitext
16062 {{MediaWiki:Mainpage}}
16063 !! html
16064 <p>Main Page
16065 </p>
16066 !! end
16067
16068 !! test
16069 Transclusion of nonexistent MediaWiki message
16070 !! wikitext
16071 {{MediaWiki:Mainpagexxx}}
16072 !! html
16073 <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>
16074 </p>
16075 !! end
16076
16077 !! test
16078 Transclusion of MediaWiki message with underscore
16079 !! wikitext
16080 {{MediaWiki:history_short}}
16081 !! html
16082 <p>History
16083 </p>
16084 !! end
16085
16086 !! test
16087 Transclusion of MediaWiki message with space
16088 !! wikitext
16089 {{MediaWiki:history short}}
16090 !! html
16091 <p>History
16092 </p>
16093 !! end
16094
16095 !! test
16096 Invalid header with following text
16097 !! wikitext
16098 = x = y
16099 !! html
16100 <p>= x = y
16101 </p>
16102 !! end
16103
16104
16105 !! test
16106 Section extraction test (section 0)
16107 !! options
16108 section=0
16109 !! wikitext
16110 start
16111 ==a==
16112 ===aa===
16113 ====aaa====
16114 ==b==
16115 ===ba===
16116 ===bb===
16117 ====bba====
16118 ===bc===
16119 ==c==
16120 ===ca===
16121 !! html
16122 start
16123 !! end
16124
16125 !! test
16126 Section extraction test (section 1)
16127 !! options
16128 section=1
16129 !! wikitext
16130 start
16131 ==a==
16132 ===aa===
16133 ====aaa====
16134 ==b==
16135 ===ba===
16136 ===bb===
16137 ====bba====
16138 ===bc===
16139 ==c==
16140 ===ca===
16141 !! html
16142 ==a==
16143 ===aa===
16144 ====aaa====
16145 !! end
16146
16147 !! test
16148 Section extraction test (section 2)
16149 !! options
16150 section=2
16151 !! wikitext
16152 start
16153 ==a==
16154 ===aa===
16155 ====aaa====
16156 ==b==
16157 ===ba===
16158 ===bb===
16159 ====bba====
16160 ===bc===
16161 ==c==
16162 ===ca===
16163 !! html
16164 ===aa===
16165 ====aaa====
16166 !! end
16167
16168 !! test
16169 Section extraction test (section 3)
16170 !! options
16171 section=3
16172 !! wikitext
16173 start
16174 ==a==
16175 ===aa===
16176 ====aaa====
16177 ==b==
16178 ===ba===
16179 ===bb===
16180 ====bba====
16181 ===bc===
16182 ==c==
16183 ===ca===
16184 !! html
16185 ====aaa====
16186 !! end
16187
16188 !! test
16189 Section extraction test (section 4)
16190 !! options
16191 section=4
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 ==b==
16206 ===ba===
16207 ===bb===
16208 ====bba====
16209 ===bc===
16210 !! end
16211
16212 !! test
16213 Section extraction test (section 5)
16214 !! options
16215 section=5
16216 !! wikitext
16217 start
16218 ==a==
16219 ===aa===
16220 ====aaa====
16221 ==b==
16222 ===ba===
16223 ===bb===
16224 ====bba====
16225 ===bc===
16226 ==c==
16227 ===ca===
16228 !! html
16229 ===ba===
16230 !! end
16231
16232 !! test
16233 Section extraction test (section 6)
16234 !! options
16235 section=6
16236 !! wikitext
16237 start
16238 ==a==
16239 ===aa===
16240 ====aaa====
16241 ==b==
16242 ===ba===
16243 ===bb===
16244 ====bba====
16245 ===bc===
16246 ==c==
16247 ===ca===
16248 !! html
16249 ===bb===
16250 ====bba====
16251 !! end
16252
16253 !! test
16254 Section extraction test (section 7)
16255 !! options
16256 section=7
16257 !! wikitext
16258 start
16259 ==a==
16260 ===aa===
16261 ====aaa====
16262 ==b==
16263 ===ba===
16264 ===bb===
16265 ====bba====
16266 ===bc===
16267 ==c==
16268 ===ca===
16269 !! html
16270 ====bba====
16271 !! end
16272
16273 !! test
16274 Section extraction test (section 8)
16275 !! options
16276 section=8
16277 !! wikitext
16278 start
16279 ==a==
16280 ===aa===
16281 ====aaa====
16282 ==b==
16283 ===ba===
16284 ===bb===
16285 ====bba====
16286 ===bc===
16287 ==c==
16288 ===ca===
16289 !! html
16290 ===bc===
16291 !! end
16292
16293 !! test
16294 Section extraction test (section 9)
16295 !! options
16296 section=9
16297 !! wikitext
16298 start
16299 ==a==
16300 ===aa===
16301 ====aaa====
16302 ==b==
16303 ===ba===
16304 ===bb===
16305 ====bba====
16306 ===bc===
16307 ==c==
16308 ===ca===
16309 !! html
16310 ==c==
16311 ===ca===
16312 !! end
16313
16314 !! test
16315 Section extraction test (section 10)
16316 !! options
16317 section=10
16318 !! wikitext
16319 start
16320 ==a==
16321 ===aa===
16322 ====aaa====
16323 ==b==
16324 ===ba===
16325 ===bb===
16326 ====bba====
16327 ===bc===
16328 ==c==
16329 ===ca===
16330 !! html
16331 ===ca===
16332 !! end
16333
16334 !! test
16335 Section extraction test (nonexistent section 11)
16336 !! options
16337 section=11
16338 !! wikitext
16339 start
16340 ==a==
16341 ===aa===
16342 ====aaa====
16343 ==b==
16344 ===ba===
16345 ===bb===
16346 ====bba====
16347 ===bc===
16348 ==c==
16349 ===ca===
16350 !! html
16351 !! end
16352
16353 !! test
16354 Section extraction test with bogus heading (section 1)
16355 !! options
16356 section=1
16357 !! wikitext
16358 ==a==
16359 ==bogus== not a legal section
16360 ==b==
16361 !! html
16362 ==a==
16363 ==bogus== not a legal section
16364 !! end
16365
16366 !! test
16367 Section extraction test with bogus heading (section 2)
16368 !! options
16369 section=2
16370 !! wikitext
16371 ==a==
16372 ==bogus== not a legal section
16373 ==b==
16374 !! html
16375 ==b==
16376 !! end
16377
16378 !! test
16379 Section extraction test with comment after heading (section 1)
16380 !! options
16381 section=1
16382 !! wikitext
16383 ==a==
16384 ==b== <!-- -->
16385 ==c==
16386 !! html
16387 ==a==
16388 !! end
16389
16390 !! test
16391 Section extraction test with comment after heading (section 2)
16392 !! options
16393 section=2
16394 !! wikitext
16395 ==a==
16396 ==b== <!-- -->
16397 ==c==
16398 !! html
16399 ==b== <!-- -->
16400 !! end
16401
16402 !! test
16403 Section extraction test with bogus <nowiki> heading (section 1)
16404 !! options
16405 section=1
16406 !! wikitext
16407 ==a==
16408 ==bogus== <nowiki>not a legal section</nowiki>
16409 ==b==
16410 !! html
16411 ==a==
16412 ==bogus== <nowiki>not a legal section</nowiki>
16413 !! end
16414
16415 !! test
16416 Section extraction test with bogus <nowiki> heading (section 2)
16417 !! options
16418 section=2
16419 !! wikitext
16420 ==a==
16421 ==bogus== <nowiki>not a legal section</nowiki>
16422 ==b==
16423 !! html
16424 ==b==
16425 !! end
16426
16427
16428 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
16429 # instead of respecting commented sections
16430 !! test
16431 Section extraction prefixed by comment (section 1)
16432 !! options
16433 section=1
16434 !! wikitext
16435 <!-- -->==sec1==
16436 ==sec2==
16437 !! html
16438 ==sec2==
16439 !!end
16440
16441 !! test
16442 Section extraction prefixed by comment (section 2)
16443 !! options
16444 section=2
16445 !! wikitext
16446 <!-- -->==sec1==
16447 ==sec2==
16448 !! html
16449
16450 !!end
16451
16452
16453 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
16454 # instead of respecting HTML-style headings
16455 !! test
16456 Section extraction, mixed wiki and html (section 1)
16457 !! options
16458 section=1
16459 !! wikitext
16460 <h2>unmarked</h2>
16461 unmarked
16462 ==1==
16463 one
16464 ==2==
16465 two
16466 !! html
16467 ==1==
16468 one
16469 !! end
16470
16471 !! test
16472 Section extraction, mixed wiki and html (section 2)
16473 !! options
16474 section=2
16475 !! wikitext
16476 <h2>unmarked</h2>
16477 unmarked
16478 ==1==
16479 one
16480 ==2==
16481 two
16482 !! html
16483 ==2==
16484 two
16485 !! end
16486
16487
16488 # Formerly testing for bug 3342
16489 !! test
16490 Section extraction, heading surrounded by <noinclude>
16491 !! options
16492 section=1
16493 !! wikitext
16494 <noinclude>==unmarked==</noinclude>
16495 ==marked==
16496 !! html
16497 ==marked==
16498 !!end
16499
16500 # Test behavior of bug 19910
16501 !! test
16502 Sectiion with all-equals
16503 !! options
16504 section=2
16505 !! wikitext
16506 ===
16507 The line above must have a trailing space
16508 === <!--
16509 --> <!-- -->
16510 But just in case it doesn't...
16511 !! html
16512 === <!--
16513 --> <!-- -->
16514 But just in case it doesn't...
16515 !! end
16516
16517 !! test
16518 Section replacement test (section 0)
16519 !! options
16520 replace=0,"xxx"
16521 !! wikitext
16522 start
16523 ==a==
16524 ===aa===
16525 ====aaa====
16526 ==b==
16527 ===ba===
16528 ===bb===
16529 ====bba====
16530 ===bc===
16531 ==c==
16532 ===ca===
16533 !! html
16534 xxx
16535
16536 ==a==
16537 ===aa===
16538 ====aaa====
16539 ==b==
16540 ===ba===
16541 ===bb===
16542 ====bba====
16543 ===bc===
16544 ==c==
16545 ===ca===
16546 !! end
16547
16548 !! test
16549 Section replacement test (section 1)
16550 !! options
16551 replace=1,"xxx"
16552 !! wikitext
16553 start
16554 ==a==
16555 ===aa===
16556 ====aaa====
16557 ==b==
16558 ===ba===
16559 ===bb===
16560 ====bba====
16561 ===bc===
16562 ==c==
16563 ===ca===
16564 !! html
16565 start
16566 xxx
16567
16568 ==b==
16569 ===ba===
16570 ===bb===
16571 ====bba====
16572 ===bc===
16573 ==c==
16574 ===ca===
16575 !! end
16576
16577 !! test
16578 Section replacement test (section 2)
16579 !! options
16580 replace=2,"xxx"
16581 !! wikitext
16582 start
16583 ==a==
16584 ===aa===
16585 ====aaa====
16586 ==b==
16587 ===ba===
16588 ===bb===
16589 ====bba====
16590 ===bc===
16591 ==c==
16592 ===ca===
16593 !! html
16594 start
16595 ==a==
16596 xxx
16597
16598 ==b==
16599 ===ba===
16600 ===bb===
16601 ====bba====
16602 ===bc===
16603 ==c==
16604 ===ca===
16605 !! end
16606
16607 !! test
16608 Section replacement test (section 3)
16609 !! options
16610 replace=3,"xxx"
16611 !! wikitext
16612 start
16613 ==a==
16614 ===aa===
16615 ====aaa====
16616 ==b==
16617 ===ba===
16618 ===bb===
16619 ====bba====
16620 ===bc===
16621 ==c==
16622 ===ca===
16623 !! html
16624 start
16625 ==a==
16626 ===aa===
16627 xxx
16628
16629 ==b==
16630 ===ba===
16631 ===bb===
16632 ====bba====
16633 ===bc===
16634 ==c==
16635 ===ca===
16636 !! end
16637
16638 !! test
16639 Section replacement test (section 4)
16640 !! options
16641 replace=4,"xxx"
16642 !! wikitext
16643 start
16644 ==a==
16645 ===aa===
16646 ====aaa====
16647 ==b==
16648 ===ba===
16649 ===bb===
16650 ====bba====
16651 ===bc===
16652 ==c==
16653 ===ca===
16654 !! html
16655 start
16656 ==a==
16657 ===aa===
16658 ====aaa====
16659 xxx
16660
16661 ==c==
16662 ===ca===
16663 !! end
16664
16665 !! test
16666 Section replacement test (section 5)
16667 !! options
16668 replace=5,"xxx"
16669 !! wikitext
16670 start
16671 ==a==
16672 ===aa===
16673 ====aaa====
16674 ==b==
16675 ===ba===
16676 ===bb===
16677 ====bba====
16678 ===bc===
16679 ==c==
16680 ===ca===
16681 !! html
16682 start
16683 ==a==
16684 ===aa===
16685 ====aaa====
16686 ==b==
16687 xxx
16688
16689 ===bb===
16690 ====bba====
16691 ===bc===
16692 ==c==
16693 ===ca===
16694 !! end
16695
16696 !! test
16697 Section replacement test (section 6)
16698 !! options
16699 replace=6,"xxx"
16700 !! wikitext
16701 start
16702 ==a==
16703 ===aa===
16704 ====aaa====
16705 ==b==
16706 ===ba===
16707 ===bb===
16708 ====bba====
16709 ===bc===
16710 ==c==
16711 ===ca===
16712 !! html
16713 start
16714 ==a==
16715 ===aa===
16716 ====aaa====
16717 ==b==
16718 ===ba===
16719 xxx
16720
16721 ===bc===
16722 ==c==
16723 ===ca===
16724 !! end
16725
16726 !! test
16727 Section replacement test (section 7)
16728 !! options
16729 replace=7,"xxx"
16730 !! wikitext
16731 start
16732 ==a==
16733 ===aa===
16734 ====aaa====
16735 ==b==
16736 ===ba===
16737 ===bb===
16738 ====bba====
16739 ===bc===
16740 ==c==
16741 ===ca===
16742 !! html
16743 start
16744 ==a==
16745 ===aa===
16746 ====aaa====
16747 ==b==
16748 ===ba===
16749 ===bb===
16750 xxx
16751
16752 ===bc===
16753 ==c==
16754 ===ca===
16755 !! end
16756
16757 !! test
16758 Section replacement test (section 8)
16759 !! options
16760 replace=8,"xxx"
16761 !! wikitext
16762 start
16763 ==a==
16764 ===aa===
16765 ====aaa====
16766 ==b==
16767 ===ba===
16768 ===bb===
16769 ====bba====
16770 ===bc===
16771 ==c==
16772 ===ca===
16773 !! html
16774 start
16775 ==a==
16776 ===aa===
16777 ====aaa====
16778 ==b==
16779 ===ba===
16780 ===bb===
16781 ====bba====
16782 xxx
16783
16784 ==c==
16785 ===ca===
16786 !!end
16787
16788 !! test
16789 Section replacement test (section 9)
16790 !! options
16791 replace=9,"xxx"
16792 !! wikitext
16793 start
16794 ==a==
16795 ===aa===
16796 ====aaa====
16797 ==b==
16798 ===ba===
16799 ===bb===
16800 ====bba====
16801 ===bc===
16802 ==c==
16803 ===ca===
16804 !! html
16805 start
16806 ==a==
16807 ===aa===
16808 ====aaa====
16809 ==b==
16810 ===ba===
16811 ===bb===
16812 ====bba====
16813 ===bc===
16814 xxx
16815 !! end
16816
16817 !! test
16818 Section replacement test (section 10)
16819 !! options
16820 replace=10,"xxx"
16821 !! wikitext
16822 start
16823 ==a==
16824 ===aa===
16825 ====aaa====
16826 ==b==
16827 ===ba===
16828 ===bb===
16829 ====bba====
16830 ===bc===
16831 ==c==
16832 ===ca===
16833 !! html
16834 start
16835 ==a==
16836 ===aa===
16837 ====aaa====
16838 ==b==
16839 ===ba===
16840 ===bb===
16841 ====bba====
16842 ===bc===
16843 ==c==
16844 xxx
16845 !! end
16846
16847 !! test
16848 Section replacement test with initial whitespace (bug 13728)
16849 !! options
16850 replace=2,"xxx"
16851 !! wikitext
16852 Preformatted initial line
16853 ==a==
16854 ===a===
16855 !! html
16856 Preformatted initial line
16857 ==a==
16858 xxx
16859 !! end
16860
16861
16862 !! test
16863 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16864 !! options
16865 section=1
16866 !! wikitext
16867 ==a==
16868 a
16869 !! html
16870 ==a==
16871 a
16872 !! end
16873
16874 !! test
16875 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16876 !! options
16877 section=1
16878 !! wikitext
16879 ==a==
16880 a
16881 !! html
16882 ==a==
16883 a
16884 !! end
16885
16886
16887 !! test
16888 Section extraction, <pre> around bogus header (bug 10309)
16889 !! options
16890 noxml section=2
16891 !! wikitext
16892 == Section One ==
16893 <pre>
16894 =======
16895 </pre>
16896
16897 == Section Two ==
16898 stuff
16899 !! html
16900 == Section Two ==
16901 stuff
16902 !! end
16903
16904 !! test
16905 Section replacement, <pre> around bogus header (bug 10309)
16906 !! options
16907 noxml replace=2,"xxx"
16908 !! wikitext
16909 == Section One ==
16910 <pre>
16911 =======
16912 </pre>
16913
16914 == Section Two ==
16915 stuff
16916 !! html
16917 == Section One ==
16918 <pre>
16919 =======
16920 </pre>
16921
16922 xxx
16923 !! end
16924
16925
16926
16927 !! test
16928 Handling of &#x0A; in URLs
16929 !! wikitext
16930 ** irc://&#x0A;a
16931 !! html/php
16932 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16933
16934 !! html/parsoid
16935 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16936 a">irc://
16937 a</a></li></ul></li></ul>
16938 !! end
16939
16940 !! test
16941 Handling of %0A in URLs
16942 !! wikitext
16943 ** irc://%0Aa
16944 !! html/php
16945 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16946
16947 !! html/parsoid
16948 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16949 !! end
16950
16951
16952 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16953 !! test
16954 5 quotes, code coverage +1 line
16955 !! options
16956 parsoid=wt2html
16957 !! wikitext
16958 '''''
16959 !! html/php
16960 !! html/parsoid
16961 <p><b><i></i></b></p>
16962 !! end
16963
16964 # same html as previous, but wikitext adjusted to match parsoid html2wt
16965 # note that wt2html and html2html will put the <i> before the <b>
16966 !! test
16967 5 quotes, code coverage +1 line w/ nowiki (1)
16968 !! options
16969 parsoid=wt2wt,html2wt
16970 !! wikitext
16971 '''''<nowiki/>'''''
16972 !! html/php
16973 <p><i></i>
16974 </p>
16975 !! html/parsoid
16976 <p><b><i></i></b></p>
16977 !! end
16978
16979 # same as previous, just swapping the <i> and <b>
16980 !! test
16981 5 quotes, code coverage +1 line w/ nowiki (2)
16982 !! wikitext
16983 '''''<nowiki/>'''''
16984 !! html/php
16985 <p><i></i>
16986 </p>
16987 !! html/parsoid
16988 <p><i><b></b></i></p>
16989 !! end
16990
16991 !! test
16992 Special:Search page linking.
16993 !! wikitext
16994 {{Special:search}}
16995 !! html
16996 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16997 </p>
16998 !! end
16999
17000 !! test
17001 {{!}} is a magic word
17002 !! wikitext
17003 {{!}} is a magic word there and {{!}} is still a magic word here
17004 !! html/php
17005 <p>| is a magic word there and | is still a magic word here
17006 </p>
17007 !! html/parsoid
17008 <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>
17009 !! end
17010
17011 !! test
17012 Say the magic word
17013 !! options
17014 title=[[Parser test]]
17015 !! wikitext
17016 * {{PAGENAME}}
17017 * {{PAGENAMEE}}
17018 * {{FULLPAGENAME}}
17019 * {{FULLPAGENAMEE}}
17020 * {{BASEPAGENAME}}
17021 * {{BASEPAGENAMEE}}
17022 * {{SUBPAGENAME}}
17023 * {{SUBPAGENAMEE}}
17024 * {{ROOTPAGENAME}}
17025 * {{ROOTPAGENAMEE}}
17026 * {{TALKPAGENAME}}
17027 * {{TALKPAGENAMEE}}
17028 * {{SUBJECTPAGENAME}}
17029 * {{SUBJECTPAGENAMEE}}
17030 * {{NAMESPACEE}}
17031 * {{NAMESPACE}}
17032 * {{NAMESPACENUMBER}}
17033 * {{TALKSPACE}}
17034 * {{TALKSPACEE}}
17035 * {{SUBJECTSPACE}}
17036 * {{SUBJECTSPACEE}}
17037 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
17038 !! html
17039 <ul><li> Parser test</li>
17040 <li> Parser_test</li>
17041 <li> Parser test</li>
17042 <li> Parser_test</li>
17043 <li> Parser test</li>
17044 <li> Parser_test</li>
17045 <li> Parser test</li>
17046 <li> Parser_test</li>
17047 <li> Parser test</li>
17048 <li> Parser_test</li>
17049 <li> Talk:Parser test</li>
17050 <li> Talk:Parser_test</li>
17051 <li> Parser test</li>
17052 <li> Parser_test</li>
17053 <li> </li>
17054 <li> </li>
17055 <li> 0</li>
17056 <li> Talk</li>
17057 <li> Talk</li>
17058 <li> </li>
17059 <li> </li>
17060 <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>
17061
17062 !! end
17063 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
17064
17065 !! test
17066 Gallery
17067 !! wikitext
17068 <gallery>
17069 image1.png |
17070 image2.gif|||||
17071
17072 image3|
17073 image4 |300px| centre
17074 image5.svg| http://///////
17075 [[x|xx]]]]
17076 * image6
17077 </gallery>
17078 !! html
17079 <ul class="gallery mw-gallery-traditional">
17080 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17081 <div class="thumb" style="height: 150px;">Image1.png</div>
17082 <div class="gallerytext">
17083 </div>
17084 </div></li>
17085 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17086 <div class="thumb" style="height: 150px;">Image2.gif</div>
17087 <div class="gallerytext">
17088 <p>||||
17089 </p>
17090 </div>
17091 </div></li>
17092 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17093 <div class="thumb" style="height: 150px;">Image3</div>
17094 <div class="gallerytext">
17095 </div>
17096 </div></li>
17097 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17098 <div class="thumb" style="height: 150px;">Image4</div>
17099 <div class="gallerytext">
17100 <p>300px| centre
17101 </p>
17102 </div>
17103 </div></li>
17104 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17105 <div class="thumb" style="height: 150px;">Image5.svg</div>
17106 <div class="gallerytext">
17107 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
17108 </p>
17109 </div>
17110 </div></li>
17111 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17112 <div class="thumb" style="height: 150px;">* image6</div>
17113 <div class="gallerytext">
17114 </div>
17115 </div></li>
17116 </ul>
17117
17118 !! end
17119
17120 !! test
17121 Gallery (with options)
17122 !! wikitext
17123 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
17124 File:Nonexistent.jpg|caption
17125 File:Nonexistent.jpg
17126 image:foobar.jpg|some '''caption''' [[Main Page]]
17127 image:foobar.jpg
17128 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
17129 </gallery>
17130 !! html
17131 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
17132 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
17133 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17134 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17135 <div class="gallerytext">
17136 <p>caption
17137 </p>
17138 </div>
17139 </div></li>
17140 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17141 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17142 <div class="gallerytext">
17143 </div>
17144 </div></li>
17145 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17146 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
17147 <div class="gallerytext">
17148 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17149 </p>
17150 </div>
17151 </div></li>
17152 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17153 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
17154 <div class="gallerytext">
17155 </div>
17156 </div></li>
17157 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17158 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
17159 <div class="gallerytext">
17160 <p>Blabla|blabla.
17161 </p>
17162 </div>
17163 </div></li>
17164 </ul>
17165
17166 !! end
17167
17168 !! test
17169 Gallery with link that has fragment
17170 !! wikitext
17171 <gallery>
17172 image:foobar.jpg|link=Main_Page
17173 image:foobar.jpg|link=Main_Page#section
17174 image:foobar.jpg|link=Main Page#section|caption
17175 </gallery>
17176 !! html
17177 <ul class="gallery mw-gallery-traditional">
17178 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17179 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17180 <div class="gallerytext">
17181 </div>
17182 </div></li>
17183 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17184 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17185 <div class="gallerytext">
17186 </div>
17187 </div></li>
17188 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17189 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17190 <div class="gallerytext">
17191 <p>caption
17192 </p>
17193 </div>
17194 </div></li>
17195 </ul>
17196
17197 !! end
17198
17199 !! test
17200 Gallery with wikitext inside caption
17201 !! wikitext
17202 <gallery>
17203 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
17204 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
17205 </gallery>
17206 !! html
17207 <ul class="gallery mw-gallery-traditional">
17208 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17209 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17210 <div class="gallerytext">
17211 <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>
17212 </p>
17213 </div>
17214 </div></li>
17215 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17216 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17217 <div class="gallerytext">
17218 <p>This is a test template
17219 </p>
17220 </div>
17221 </div></li>
17222 </ul>
17223
17224 !! end
17225
17226 !! test
17227 gallery (with showfilename option)
17228 !! wikitext
17229 <gallery showfilename>
17230 File:Nonexistent.jpg|caption
17231 File:Nonexistent.jpg
17232 image:foobar.jpg|some '''caption''' [[Main Page]]
17233 File:Foobar.jpg
17234 </gallery>
17235 !! html
17236 <ul class="gallery mw-gallery-traditional">
17237 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17238 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17239 <div class="gallerytext">
17240 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17241 caption
17242 </p>
17243 </div>
17244 </div></li>
17245 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17246 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17247 <div class="gallerytext">
17248 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17249 </p>
17250 </div>
17251 </div></li>
17252 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17253 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17254 <div class="gallerytext">
17255 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17256 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17257 </p>
17258 </div>
17259 </div></li>
17260 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17261 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17262 <div class="gallerytext">
17263 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17264 </p>
17265 </div>
17266 </div></li>
17267 </ul>
17268
17269 !! end
17270
17271 !! test
17272 Gallery (with namespace-less filenames)
17273 !! wikitext
17274 <gallery>
17275 File:Nonexistent.jpg
17276 Nonexistent.jpg
17277 image:foobar.jpg
17278 foobar.jpg
17279 </gallery>
17280 !! html
17281 <ul class="gallery mw-gallery-traditional">
17282 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17283 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17284 <div class="gallerytext">
17285 </div>
17286 </div></li>
17287 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17288 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17289 <div class="gallerytext">
17290 </div>
17291 </div></li>
17292 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17293 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17294 <div class="gallerytext">
17295 </div>
17296 </div></li>
17297 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17298 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17299 <div class="gallerytext">
17300 </div>
17301 </div></li>
17302 </ul>
17303
17304 !! end
17305
17306 !! test
17307 HTML Hex character encoding (spells the word "JavaScript")
17308 !! options
17309 parsoid=wt2html,wt2wt,html2html
17310 !! wikitext
17311 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
17312 !! html/php
17313 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
17314 </p>
17315 !! html/php+tidy
17316 <p>JavaScript</p>
17317 !! html/parsoid
17318 <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>
17319 !! end
17320
17321 !! test
17322 HTML Hex character encoding bogus encoding (bug 26437 regression check)
17323 !! wikitext
17324 &#xsee;&#XSEE;
17325 !! html/php
17326 <p>&amp;#xsee;&amp;#XSEE;
17327 </p>
17328 !! html/parsoid
17329 <p>&amp;#xsee;&amp;#XSEE;</p>
17330 !! end
17331
17332 !! test
17333 HTML Hex character encoding mixed case
17334 !! options
17335 parsoid=wt2html,wt2wt,html2html
17336 !! wikitext
17337 &#xEE;&#Xee;
17338 !! html/php
17339 <p>&#xee;&#xee;
17340 </p>
17341 !! html/php+tidy
17342 <p>îî</p>
17343 !! html/parsoid
17344 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
17345 !! end
17346
17347 !! test
17348 __FORCETOC__ override
17349 !! wikitext
17350 __NEWSECTIONLINK__
17351 __FORCETOC__
17352 !! html
17353 <p><br />
17354 </p>
17355 !! end
17356
17357 !! test
17358 ISBN code coverage
17359 !! wikitext
17360 ISBN 978-0-1234-56&#x20;789
17361 !! html
17362 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
17363 </p>
17364 !! html+tidy
17365 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
17366 !! html/parsoid
17367 <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>
17368 !! end
17369
17370 !! test
17371 ISBN followed by 5 spaces
17372 !! wikitext
17373 ISBN
17374 !! html
17375 <p>ISBN
17376 </p>
17377 !! end
17378
17379 !! test
17380 Double ISBN
17381 !! wikitext
17382 ISBN ISBN 1234567890
17383 !! html/php
17384 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17385 </p>
17386 !! html/parsoid
17387 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
17388 !! end
17389
17390 !! test
17391 ISBN with an X
17392 !! wikitext
17393 ISBN 3-462-04561-X
17394 ISBN 080442957X
17395 ISBN 978080442957X
17396 !! html/php
17397 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
17398 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
17399 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
17400 </p>
17401 !! html/parsoid
17402 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
17403 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
17404 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p>
17405 !! end
17406
17407 !! test
17408 ISBN with empty prefix (parsoid test)
17409 !! wikitext
17410 ISBN 1234567890
17411 !! html/php
17412 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17413 </p>
17414 !! html/parsoid
17415 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
17416 !! end
17417
17418 !! test
17419 Bug 22905: <abbr> followed by ISBN followed by </a>
17420 !! wikitext
17421 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
17422 !! html/php
17423 <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>
17424 </p>
17425 !! html/parsoid
17426 <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>
17427 !! end
17428
17429 !! test
17430 Double RFC
17431 !! wikitext
17432 RFC RFC 1234
17433 !! html
17434 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
17435 </p>
17436 !! end
17437
17438 !! test
17439 Double RFC with a wiki link
17440 !! wikitext
17441 RFC [[RFC 1234]]
17442 !! html
17443 <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>
17444 </p>
17445 !! end
17446
17447 !! test
17448 RFC code coverage
17449 !! wikitext
17450 RFC 983&#x20;987
17451 !! html
17452 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
17453 </p>
17454 !! html+tidy
17455 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
17456 !! end
17457
17458 !! test
17459 Centre-aligned image
17460 !! wikitext
17461 [[Image:foobar.jpg|centre]]
17462 !! html
17463 <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>
17464
17465 !!end
17466
17467 !! test
17468 None-aligned image
17469 !! wikitext
17470 [[Image:foobar.jpg|none]]
17471 !! html
17472 <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>
17473
17474 !!end
17475
17476 !! test
17477 Width + Height sized image (using px) (height is ignored)
17478 !! wikitext
17479 [[Image:foobar.jpg|640x480px]]
17480 !! html
17481 <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>
17482 </p>
17483 !!end
17484
17485 !! test
17486 Width-sized image (using px, no following whitespace)
17487 !! wikitext
17488 [[Image:foobar.jpg|640px]]
17489 !! html
17490 <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>
17491 </p>
17492 !!end
17493
17494 !! test
17495 Width-sized image (using px, with following whitespace - test regression from r39467)
17496 !! wikitext
17497 [[Image:foobar.jpg|640px ]]
17498 !! html
17499 <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>
17500 </p>
17501 !!end
17502
17503 !! test
17504 Width-sized image (using px, with preceding whitespace - test regression from r39467)
17505 !! wikitext
17506 [[Image:foobar.jpg| 640px]]
17507 !! html
17508 <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>
17509 </p>
17510 !!end
17511
17512 !! test
17513 Image with page parameter
17514 !! options
17515 djvu
17516 !! wikitext
17517 [[File:LoremIpsum.djvu|page=2]]
17518 !! html/php
17519 <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>
17520 </p>
17521 !! html/parsoid
17522 <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" data-file-width="2480" data-file-height="3508" data-file-type="bitmap" height="3508" width="2480" data-parsoid='{"a":{"resource":"./File:LoremIpsum.djvu","height":"3508","width":"2480"},"sa":{"resource":"File:LoremIpsum.djvu"}}'/></a></span></p>
17523 !! end
17524
17525 !! test
17526 Another italics / bold test
17527 !! wikitext
17528 ''' ''x'
17529 !! html
17530 <pre>'<i> </i>x'
17531 </pre>
17532 !!end
17533
17534 # FIXME: The php output seems broken. It's interleaving some open/close tags.
17535 !! test
17536 dt/dd/dl test
17537 !! wikitext
17538 :;;;::
17539 !! html/php
17540 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
17541
17542 !! html/parsoid
17543 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
17544
17545 !!end
17546
17547
17548 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
17549 !! test
17550 Images with the "|" character in the comment
17551 !! wikitext
17552 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
17553 !! html/php
17554 <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>
17555
17556 !! html/parsoid
17557 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" href="http://test/?param1=|left|&amp;param2=|x">external</a> URL</figcaption></figure>
17558 !! end
17559
17560 !! test
17561 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
17562 !! wikitext
17563 <html><script>alert(1);</script></html>
17564 !! html
17565 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
17566 </p>
17567 !! end
17568
17569 !! test
17570 HTML with raw HTML ($wgRawHtml==true)
17571 !! options
17572 wgRawHtml=1
17573 !! wikitext
17574 <html><script>alert(1);</script></html>
17575 !! html
17576 <p><script>alert(1);</script>
17577 </p>
17578 !! end
17579
17580 !! test
17581 Parents of subpages, one level up
17582 !! options
17583 subpage title=[[Subpage test/L1/L2/L3]]
17584 !! wikitext
17585 [[../|L2]]
17586 !! html
17587 <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>
17588 </p>
17589 !! end
17590
17591
17592 !! test
17593 Parents of subpages, one level up, not named
17594 !! options
17595 subpage title=[[Subpage test/L1/L2/L3]]
17596 !! wikitext
17597 [[../]]
17598 !! html
17599 <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>
17600 </p>
17601 !! end
17602
17603
17604
17605 !! test
17606 Parents of subpages, two levels up
17607 !! options
17608 subpage title=[[Subpage test/L1/L2/L3]]
17609 !! wikitext
17610 [[../../|L1]]2
17611
17612 [[../../|L1]]l
17613 !! html
17614 <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
17615 </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>
17616 </p>
17617 !! end
17618
17619 !! test
17620 Parents of subpages, two levels up, without trailing slash or name.
17621 !! options
17622 subpage title=[[Subpage test/L1/L2/L3]]
17623 !! wikitext
17624 [[../..]]
17625 !! html
17626 <p>[[../..]]
17627 </p>
17628 !! end
17629
17630 !! test
17631 Parents of subpages, two levels up, with lots of extra trailing slashes.
17632 !! options
17633 subpage title=[[Subpage test/L1/L2/L3]]
17634 !! wikitext
17635 [[../../////]]
17636 !! html
17637 <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>
17638 </p>
17639 !! end
17640
17641 !! article
17642 Subpage test/L1/L2/L3Sibling
17643 !! text
17644 Sibling article
17645 !! endarticle
17646
17647 !! test
17648 Transclusion of a sibling page (one level up)
17649 !! options
17650 subpage title=[[Subpage test/L1/L2/L3]]
17651 !! wikitext
17652 {{../L3Sibling}}
17653 !! html
17654 <p>Sibling article
17655 </p>
17656 !! end
17657
17658 !! test
17659 Transclusion of a child page
17660 !! options
17661 subpage title=[[Subpage test/L1/L2]]
17662 !! wikitext
17663 {{/L3Sibling}}
17664 !! html
17665 <p>Sibling article
17666 </p>
17667 !! end
17668
17669 !! test
17670 Non-transclusion because of too many up levels
17671 !! options
17672 subpage title=[[Subpage test/L1/L2/L3]]
17673 !! wikitext
17674 {{../../../../More than parent}}
17675 !! html
17676 <p>{{../../../../More than parent}}
17677 </p>
17678 !! end
17679
17680 !! test
17681 Definition list code coverage
17682 !! wikitext
17683 ; title : def
17684 ; title : def
17685 ;title: def
17686 !! html/php
17687 <dl><dt> title &#160;</dt>
17688 <dd> def</dd>
17689 <dt> title&#160;</dt>
17690 <dd> def</dd>
17691 <dt>title</dt>
17692 <dd> def</dd></dl>
17693
17694 !! html/parsoid
17695 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17696 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17697 <dt>title</dt><dd> def</dd></dl>
17698 !! end
17699
17700 !! test
17701 Don't fall for the self-closing div
17702 !! wikitext
17703 <div>hello world</div/>
17704 !! html
17705 <div>hello world</div>
17706
17707 !! end
17708
17709 !! test
17710 MSGNW magic word
17711 !! wikitext
17712 {{MSGNW:msg}}
17713 !! html
17714 <p>&#91;&#91;:Template:Msg&#93;&#93;
17715 </p>
17716 !! end
17717
17718 !! test
17719 RAW magic word
17720 !! wikitext
17721 {{RAW:QUERTY}}
17722 !! html
17723 <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>
17724 </p>
17725 !! end
17726
17727 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
17728 !! test
17729 Always escape literal '>' in output, not just after '<'
17730 !! wikitext
17731 ><>
17732 !! html
17733 <p>&gt;&lt;&gt;
17734 </p>
17735 !! end
17736
17737 !! test
17738 Template caching
17739 !! wikitext
17740 {{Test}}
17741 {{Test}}
17742 !! html
17743 <p>This is a test template
17744 This is a test template
17745 </p>
17746 !! end
17747
17748
17749 !! article
17750 MediaWiki:Fake
17751 !! text
17752 ==header==
17753 !! endarticle
17754
17755 !! test
17756 Inclusion of !userCanEdit() content
17757 !! wikitext
17758 {{MediaWiki:Fake}}
17759 !! html
17760 <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>
17761
17762 !! end
17763
17764
17765 !! test
17766 Out-of-order TOC heading levels
17767 !! wikitext
17768 ==2==
17769 ======6======
17770 ===3===
17771 =1=
17772 =====5=====
17773 ==2==
17774 !! html
17775 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17776 <ul>
17777 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
17778 <ul>
17779 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
17780 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
17781 </ul>
17782 </li>
17783 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
17784 <ul>
17785 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
17786 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
17787 </ul>
17788 </li>
17789 </ul>
17790 </div>
17791
17792 <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>
17793 <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>
17794 <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>
17795 <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>
17796 <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>
17797 <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>
17798
17799 !! end
17800
17801
17802 !! test
17803 ISBN with a dummy number
17804 !! wikitext
17805 ISBN ---
17806 !! html
17807 <p>ISBN ---
17808 </p>
17809 !! end
17810
17811
17812 !! test
17813 ISBN with space-delimited number
17814 !! wikitext
17815 ISBN 92 9017 032 8
17816 !! html
17817 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
17818 </p>
17819 !! end
17820
17821
17822 !! test
17823 ISBN with multiple spaces, no number
17824 !! wikitext
17825 ISBN foo
17826 !! html
17827 <p>ISBN foo
17828 </p>
17829 !! end
17830
17831
17832 !! test
17833 ISBN length
17834 !! wikitext
17835 ISBN 123456789
17836
17837 ISBN 1234567890
17838
17839 ISBN 12345678901
17840 !! html
17841 <p>ISBN 123456789
17842 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17843 </p><p>ISBN 12345678901
17844 </p>
17845 !! end
17846
17847
17848 !! test
17849 ISBN with trailing year (bug 8110)
17850 !! wikitext
17851 ISBN 1-234-56789-0 - 2006
17852
17853 ISBN 1 234 56789 0 - 2006
17854 !! html
17855 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
17856 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
17857 </p>
17858 !! end
17859
17860
17861 !! test
17862 anchorencode
17863 !! wikitext
17864 {{anchorencode:foo bar©#%n}}
17865 !! html
17866 <p>foo_bar.C2.A9.23.25n
17867 </p>
17868 !! end
17869
17870 !! test
17871 anchorencode trims spaces
17872 !! wikitext
17873 {{anchorencode: __pretty__please__}}
17874 !! html
17875 <p>pretty_please
17876 </p>
17877 !! end
17878
17879 !! test
17880 anchorencode deals with links
17881 !! wikitext
17882 {{anchorencode: [[hello|world]] [[hi]]}}
17883 !! html
17884 <p>world_hi
17885 </p>
17886 !! end
17887
17888 !! test
17889 anchorencode deals with templates
17890 !! wikitext
17891 {{anchorencode: {{Foo}} }}
17892 !! html
17893 <p>FOO
17894 </p>
17895 !! end
17896
17897 !! test
17898 anchorencode encodes like the TOC generator: (bug 18431)
17899 !! wikitext
17900 === _ +:.3A%3A&&amp;]] ===
17901 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17902 __NOEDITSECTION__
17903 !! html
17904 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17905 <p>.2B:.3A.253A.26.26.5D.5D
17906 </p>
17907 !! end
17908
17909 !! test
17910 Bug 6200: blockquotes and paragraph formatting
17911 !! wikitext
17912 <blockquote>
17913 foo
17914 </blockquote>
17915
17916 bar
17917
17918 baz
17919 !! html
17920 <blockquote>
17921 <p>foo
17922 </p>
17923 </blockquote>
17924 <p>bar
17925 </p>
17926 <pre>baz
17927 </pre>
17928 !! end
17929
17930 !! test
17931 Bug 8293: Use of center tag ruins paragraph formatting
17932 !! wikitext
17933 <center>
17934 foo
17935 </center>
17936
17937 bar
17938
17939 baz
17940 !! html
17941 <center>
17942 <p>foo
17943 </p>
17944 </center>
17945 <p>bar
17946 </p>
17947 <pre>baz
17948 </pre>
17949 !! end
17950
17951 !!test
17952 Parsing of overlapping (improperly nested) inline html tags
17953 !! wikitext
17954 <span><s>x</span></s>
17955 !! html/php
17956 <p><span><s>x&lt;/span&gt;</s></span>
17957 </p>
17958 !! html/parsoid
17959 <p><span><s>x</s></span>
17960 </p>
17961 !!end
17962
17963 ###
17964 ### Language variants related tests
17965 ###
17966 !! test
17967 Self-link in language variants
17968 !! options
17969 title=[[Dunav]] language=sr
17970 !! wikitext
17971 Both [[Dunav]] and [[Дунав]] are names for this river.
17972 !! html
17973 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17974 </p>
17975 !!end
17976
17977 !! article
17978 Дуна
17979 !! text
17980 content
17981 !! endarticle
17982
17983 !! test
17984 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17985 !! options
17986 title=[[Duna]] language=sr
17987 !! wikitext
17988 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17989 !! html
17990 <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.
17991 </p>
17992 !! end
17993
17994 !! test
17995 Link to a section of a variant of this title shouldn't be parsed as self-link
17996 !! options
17997 title=[[Duna]] language=sr
17998 !! wikitext
17999 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
18000 !! html
18001 <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.
18002 </p>
18003 !! end
18004
18005 !! test
18006 Link to pages in language variants
18007 !! options
18008 language=sr
18009 !! wikitext
18010 Main Page can be written as [[Маин Паге]]
18011 !! html
18012 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
18013 </p>
18014 !!end
18015
18016
18017 !! test
18018 Multiple links to pages in language variants
18019 !! options
18020 language=sr
18021 !! wikitext
18022 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
18023 !! html
18024 <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>.
18025 </p>
18026 !!end
18027
18028
18029 !! test
18030 Simple template in language variants
18031 !! options
18032 language=sr
18033 !! wikitext
18034 {{тест}}
18035 !! html
18036 <p>This is a test template
18037 </p>
18038 !! end
18039
18040
18041 !! test
18042 Template with explicit namespace in language variants
18043 !! options
18044 language=sr
18045 !! wikitext
18046 {{Template:тест}}
18047 !! html
18048 <p>This is a test template
18049 </p>
18050 !! end
18051
18052
18053 !! test
18054 Basic test for template parameter in language variants
18055 !! options
18056 language=sr
18057 !! wikitext
18058 {{парамтест|param=foo}}
18059 !! html
18060 <p>This is a test template with parameter foo
18061 </p>
18062 !! end
18063
18064
18065 !! test
18066 Simple category in language variants
18067 !! options
18068 language=sr cat
18069 !! wikitext
18070 [[Category:МедиаWики Усер'с Гуиде]]
18071 !! html
18072 <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>
18073 !! end
18074
18075
18076 !! article
18077 Category:分类
18078 !! text
18079 blah
18080 !! endarticle
18081
18082 !! article
18083 Category:分類
18084 !! text
18085 blah
18086 !! endarticle
18087
18088 !! test
18089 Don't convert blue categorylinks to another variant (bug 33210)
18090 !! options
18091 language=zh cat
18092 !! wikitext
18093 [[A]][[Category:分类]]
18094 !! html
18095 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
18096 !! end
18097
18098
18099 !! test
18100 Stripping -{}- tags (language variants)
18101 !! options
18102 language=sr
18103 !! wikitext
18104 Latin proverb: -{Ne nuntium necare}-
18105 !! html
18106 <p>Latin proverb: Ne nuntium necare
18107 </p>
18108 !! end
18109
18110
18111 !! test
18112 Prevent conversion with -{}- tags (language variants)
18113 !! options
18114 language=sr variant=sr-ec
18115 !! wikitext
18116 Latinski: -{Ne nuntium necare}-
18117 !! html
18118 <p>Латински: Ne nuntium necare
18119 </p>
18120 !! end
18121
18122
18123 !! test
18124 Prevent conversion of text with -{}- tags (language variants)
18125 !! options
18126 language=sr variant=sr-ec
18127 !! wikitext
18128 Latinski: -{Ne nuntium necare}-
18129 !! html
18130 <p>Латински: Ne nuntium necare
18131 </p>
18132 !! end
18133
18134
18135 !! test
18136 Prevent conversion of links with -{}- tags (language variants)
18137 !! options
18138 language=sr variant=sr-ec
18139 !! wikitext
18140 -{[[Main Page]]}-
18141 !! html
18142 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18143 </p>
18144 !! end
18145
18146
18147 !! test
18148 -{}- tags within headlines (within html for parserConvert())
18149 !! options
18150 language=sr variant=sr-ec
18151 !! wikitext
18152 == -{Naslov}- ==
18153 !! html
18154 <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>
18155
18156 !! end
18157
18158
18159 !! test
18160 Explicit definition of language variant alternatives
18161 !! options
18162 language=zh variant=zh-tw
18163 !! wikitext
18164 -{zh:China;zh-tw:Taiwan}-, not China
18165 !! html
18166 <p>Taiwan, not China
18167 </p>
18168 !! end
18169
18170
18171 !! test
18172 Conversion around HTML tags
18173 !! options
18174 language=sr variant=sr-ec
18175 !! wikitext
18176 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
18177 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
18178 !! html
18179 <p>
18180 <span title="ЛаCтин">ски</span>
18181 </p>
18182 !! end
18183
18184
18185 !! test
18186 Explicit session-wise language variant mapping (A flag and - flag)
18187 !! options
18188 language=zh variant=zh-tw
18189 !! wikitext
18190 Taiwan is not China.
18191 But -{A|zh:China;zh-tw:Taiwan}- is China,
18192 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
18193 and -{China}- is China.
18194 !! html
18195 <p>Taiwan is not China.
18196 But Taiwan is Taiwan,
18197 (This should be stripped!)
18198 and China is China.
18199 </p>
18200 !! end
18201
18202 !! test
18203 Explicit session-wise language variant mapping (H flag for hide)
18204 !! options
18205 language=zh variant=zh-tw
18206 !! wikitext
18207 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
18208 Taiwan is China.
18209 !! html
18210 <p>(This should be stripped!)
18211 Taiwan is Taiwan.
18212 </p>
18213 !! end
18214
18215 !! test
18216 Adding explicit conversion rule for title (T flag)
18217 !! options
18218 language=zh variant=zh-tw showtitle
18219 !! wikitext
18220 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18221 !! html
18222 Taiwan
18223 <p>Should be stripped!
18224 </p>
18225 !! end
18226
18227 !! test
18228 Testing that changing the language variant here in the tests actually works
18229 !! options
18230 language=zh variant=zh showtitle
18231 !! wikitext
18232 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18233 !! html
18234 China
18235 <p>Should be stripped!
18236 </p>
18237 !! end
18238
18239 !! test
18240 Recursive conversion of alt and title attrs shouldn't clear converter state
18241 !! options
18242 language=zh variant=zh-cn showtitle
18243 !! wikitext
18244 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
18245 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
18246 !! html
18247 China
18248 <p>
18249 Should be stripped<span title="Exclamation">!</span>
18250 </p>
18251 !! end
18252
18253 !! test
18254 Bug 24072: more test on conversion rule for title
18255 !! options
18256 language=zh variant=zh-tw showtitle
18257 !! wikitext
18258 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18259 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
18260 !! html
18261 Taiwan
18262 <p>This should be stripped!
18263 This won't take interferes with the title rule.
18264 </p>
18265 !! end
18266
18267 !! test
18268 Partly disable title conversion if variant == main language code
18269 !! options
18270 language=zh variant=zh title=[[ZH]] showtitle
18271 !! wikitext
18272 -{T|zh-cn:CN;zh-tw:TW}-
18273 !! html
18274 ZH
18275 <p>
18276 </p>
18277 !! end
18278
18279 !! test
18280 Partly disable title conversion if variant == main language code, more
18281 !! options
18282 language=zh variant=zh title=[[ZH]] showtitle
18283 !! wikitext
18284 -{T|TW}-
18285 !! html
18286 ZH
18287 <p>
18288 </p>
18289 !! end
18290
18291 !! test
18292 Raw output of variant escape tags (R flag)
18293 !! options
18294 language=zh variant=zh-tw
18295 !! wikitext
18296 Raw: -{R|zh:China;zh-tw:Taiwan}-
18297 !! html
18298 <p>Raw: zh:China;zh-tw:Taiwan
18299 </p>
18300 !! end
18301
18302 !! test
18303 Strings evaluating false shouldn't be ignored by Language converter (T51072)
18304 !! options
18305 language=zh variant=zh-cn
18306 !! input
18307 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
18308 !! result
18309 <p>0
18310 </p>
18311 !! end
18312
18313 !! test
18314 Conversion rules from [numeric-only string] to [something else] (T48634)
18315 !! options
18316 language=zh variant=zh-cn
18317 !! input
18318 -{H|0=>zh-cn:B}--{H|0=>zh-cn:C;0=>zh-cn:D}--{H|0=>zh-hans:A}-012345-{A|zh-tw:0;zh-cn:E;}-012345
18319 !! result
18320 <p>D12345EE12345
18321 </p>
18322 !! end
18323
18324 !! test
18325 Bidirectional converter rule entries with an empty value should be ignored (T53551)
18326 !! options
18327 language=zh variant=zh-cn
18328 !! input
18329 -{H|zh-cn:foo;zh-tw:;}-foobar
18330 !! result
18331 <p>foobar
18332 </p>
18333 !! end
18334
18335 !! test
18336 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
18337 !! options
18338 language=zh variant=zh-cn
18339 !! input
18340 -{H|=>zh-cn:foo;}-foobar
18341 !! result
18342 <p>foobar
18343 </p>
18344 !! end
18345
18346 !! test
18347 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
18348 !! options
18349 language=zh variant=zh-cn
18350 !! input
18351 -{H|}-foobar
18352 !! result
18353 <p>foobar
18354 </p>
18355 !! end
18356
18357 !! test
18358 Nested using of manual convert syntax
18359 !! options
18360 language=zh variant=zh-hk
18361 !! wikitext
18362 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
18363 !! html
18364 <p>Nested: Hello Hong Kong!
18365 </p>
18366 !! end
18367
18368 !! test
18369 Proper conversion of text in external links
18370 !! options
18371 language=sr variant=sr-ec
18372 !! wikitext
18373 http://www.google.com
18374 gopher://www.google.com
18375 [http://www.google.com http://www.google.com]
18376 [gopher://www.google.com gopher://www.google.com]
18377 [https://www.google.com irc://www.google.com]
18378 [ftp://www.google.com www.google.com/ftp://dir]
18379 [//www.google.com www.google.com]
18380 !! html
18381 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18382 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18383 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18384 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18385 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
18386 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
18387 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
18388 </p>
18389 !! end
18390
18391 !! test
18392 Do not convert roman numbers to language variants
18393 !! options
18394 language=sr variant=sr-ec
18395 !! wikitext
18396 Fridrih IV je car.
18397 !! html
18398 <p>Фридрих IV је цар.
18399 </p>
18400 !! end
18401
18402 !! test
18403 Unclosed language converter markup "-{"
18404 !! options
18405 language=sr
18406 !! wikitext
18407 -{T|hello
18408 !! html
18409 <p>-{T|hello
18410 </p>
18411 !! end
18412
18413 !! test
18414 Don't convert raw rule "-{R|=&gt;}-" to "=>"
18415 !! options
18416 language=sr
18417 !! wikitext
18418 -{R|=&gt;}-
18419 !! html
18420 <p>=&gt;
18421 </p>
18422 !!end
18423
18424 !! test
18425 Don't break link parsing if language converter markup is in the caption.
18426 !! options
18427 language=sr variant=sr-ec
18428 !! wikitext
18429 [[Main Page|-{R|main page}-]]
18430 !! html
18431 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
18432 </p>
18433 !! end
18434
18435 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18436 !! test
18437 Don't break image parsing if language converter markup is in the caption.
18438 !! options
18439 language=sr
18440 !! wikitext
18441 [[File:Foobar.jpg|-{R|caption}-]]
18442 !! html/parsoid
18443 <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>
18444 </p>
18445 !! end
18446
18447 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18448 !! test
18449 Don't break list handling if language converter markup is in the item.
18450 !! options
18451 language=zh variant=zh-cn
18452 !! wikitext
18453 ;-{zh-cn:AAA;zh-tw:BBB}-
18454 !! html/php
18455 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
18456
18457 !! html/parsoid
18458 <dl><dt>AAA
18459 </dt></dl>
18460 !! end
18461
18462 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18463 !! test
18464 Don't break table handling if language converter markup is in the cell.
18465 !! options
18466 language=sr variant=sr-ec
18467 !! wikitext
18468 {|
18469 |-
18470 | -{R|B}-
18471 |}
18472 !! html/php
18473 <table>
18474
18475 <tr>
18476 <td>Б}-
18477 </td></tr></table>
18478
18479 !! html/parsoid
18480 <table>
18481
18482 <tr>
18483 <td> B
18484 </td></tr></table>
18485
18486 !! end
18487
18488 !! test
18489 Bug 529: Uncovered bullet
18490 !! wikitext
18491 * Foo {{bullet}}
18492 !! html
18493 <ul><li> Foo </li>
18494 <li> Bar</li></ul>
18495
18496 !! end
18497
18498 # Plain MediaWiki does not remove empty lists, but tidy actually does.
18499 # Templates in Wikipedia rely on this behavior, as tidy has always been
18500 # enabled there. These tests are normally run *without* tidy, so specify the
18501 # full output here.
18502 # To test realistic parsing behavior, apply a tidy-like transformation to both
18503 # the expected output and your parser's output.
18504 !! test
18505 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
18506 !! wikitext
18507 ******* Foo {{bullet}}
18508 !! html
18509 <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>
18510 <li> Bar</li></ul>
18511
18512 !! end
18513
18514 !! test
18515 Bug 529: Uncovered table already at line-start
18516 !! wikitext
18517 x
18518
18519 {{table}}
18520 y
18521 !! html
18522 <p>x
18523 </p>
18524 <table>
18525 <tr>
18526 <td> 1 </td>
18527 <td> 2
18528 </td></tr>
18529 <tr>
18530 <td> 3 </td>
18531 <td> 4
18532 </td></tr></table>
18533 <p>y
18534 </p>
18535 !! end
18536
18537 !! test
18538 Bug 529: Uncovered bullet in parser function result
18539 !! wikitext
18540 * Foo {{lc:{{bullet}} }}
18541 !! html
18542 <ul><li> Foo </li>
18543 <li> bar</li></ul>
18544
18545 !! end
18546
18547 !! test
18548 Bug 5678: Double-parsed template argument
18549 !! wikitext
18550 {{lc:{{{1}}}|hello}}
18551 !! html
18552 <p>{{{1}}}
18553 </p>
18554 !! end
18555
18556 !! test
18557 Bug 5678: Double-parsed template invocation
18558 !! wikitext
18559 {{lc:{{paramtest {{!}} param = hello }} }}
18560 !! html
18561 <p>{{paramtest | param = hello }}
18562 </p>
18563 !! end
18564
18565 !! test
18566 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
18567 !! options
18568 language=cs
18569 title=[[Main Page]]
18570 !! wikitext
18571 {{PRVNÍVELKÉ:ěščř}}
18572 {{prvnívelké:ěščř}}
18573 {{PRVNÍMALÉ:ěščř}}
18574 {{prvnímalé:ěščř}}
18575 {{MALÁ:ěščř}}
18576 {{malá:ěščř}}
18577 {{VELKÁ:ěščř}}
18578 {{velká:ěščř}}
18579 !! html
18580 <p>Ěščř
18581 Ěščř
18582 ěščř
18583 ěščř
18584 ěščř
18585 ěščř
18586 ĚŠČŘ
18587 ĚŠČŘ
18588 </p>
18589 !! end
18590
18591 !! test
18592 Morwen/13: Unclosed link followed by heading
18593 !! wikitext
18594 [[link
18595 ==heading==
18596 !! html
18597 <p>[[link
18598 </p>
18599 <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>
18600
18601 !! end
18602
18603 !! test
18604 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
18605 !! wikitext
18606 {{foo|
18607 =heading=
18608 !! html
18609 <p>{{foo|
18610 </p>
18611 <h1><span class="mw-headline" id="heading">heading</span></h1>
18612
18613 !! end
18614
18615 !! test
18616 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
18617 !! wikitext
18618 {{foo|
18619 ==heading==
18620 !! html
18621 <p>{{foo|
18622 </p>
18623 <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>
18624
18625 !! end
18626
18627 !! test
18628 Tildes in comments
18629 !! options
18630 pst
18631 !! wikitext
18632 <!-- ~~~~ -->
18633 !! html
18634 <!-- ~~~~ -->
18635 !! end
18636
18637 !! test
18638 Paragraphs inside divs (no extra line breaks)
18639 !! wikitext
18640 <div>Line one
18641
18642 Line two</div>
18643 !! html
18644 <div>Line one
18645 Line two</div>
18646
18647 !! end
18648
18649 !! test
18650 Paragraphs inside divs (extra line break on open)
18651 !! wikitext
18652 <div>
18653 Line one
18654
18655 Line two</div>
18656 !! html
18657 <div>
18658 <p>Line one
18659 </p>
18660 Line two</div>
18661
18662 !! end
18663
18664 !! test
18665 Paragraphs inside divs (extra line break on close)
18666 !! wikitext
18667 <div>Line one
18668
18669 Line two
18670 </div>
18671 !! html
18672 <div>Line one
18673 <p>Line two
18674 </p>
18675 </div>
18676
18677 !! end
18678
18679 !! test
18680 Paragraphs inside divs (extra line break on open and close)
18681 !! wikitext
18682 <div>
18683 Line one
18684
18685 Line two
18686 </div>
18687 !! html
18688 <div>
18689 <p>Line one
18690 </p><p>Line two
18691 </p>
18692 </div>
18693
18694 !! end
18695
18696 !! test
18697 Nesting tags, paragraphs on lines which begin with <div>
18698 !! wikitext
18699 <div></div><strong>A
18700 B</strong>
18701 !! html/php+tidy
18702 <p><strong>A</strong></p>
18703 <p><strong>B</strong></p>
18704 !! html/parsoid
18705 <div></div>
18706 <p><strong>A
18707 B</strong>
18708 </p>
18709 !! end
18710
18711 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
18712 !! test
18713 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
18714 !! wikitext
18715 <blockquote>Line one
18716
18717 Line two</blockquote>
18718 !! html
18719 <blockquote>Line one
18720 Line two</blockquote>
18721
18722 !! html+tidy
18723 <blockquote>
18724 <p>Line one Line two</p>
18725 </blockquote>
18726 !! end
18727
18728 !! test
18729 Bug 6200: paragraphs inside blockquotes (extra line break on open)
18730 !! wikitext
18731 <blockquote>
18732 Line one
18733
18734 Line two</blockquote>
18735 !! html
18736 <blockquote>
18737 <p>Line one
18738 </p>
18739 Line two</blockquote>
18740
18741 !! html+tidy
18742 <blockquote>
18743 <p>Line one</p>
18744 Line two</blockquote>
18745 !! end
18746
18747 !! test
18748 Bug 6200: paragraphs inside blockquotes (extra line break on close)
18749 !! wikitext
18750 <blockquote>Line one
18751
18752 Line two
18753 </blockquote>
18754 !! html
18755 <blockquote>Line one
18756 <p>Line two
18757 </p>
18758 </blockquote>
18759
18760 !! html+tidy
18761 <blockquote>
18762 <p>Line one</p>
18763 <p>Line two</p>
18764 </blockquote>
18765 !! end
18766
18767 !! test
18768 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
18769 !! wikitext
18770 <blockquote>
18771 Line one
18772
18773 Line two
18774 </blockquote>
18775 !! html
18776 <blockquote>
18777 <p>Line one
18778 </p><p>Line two
18779 </p>
18780 </blockquote>
18781
18782 !! html+tidy
18783 <blockquote>
18784 <p>Line one</p>
18785 <p>Line two</p>
18786 </blockquote>
18787 !! end
18788
18789 !! test
18790 Paragraphs inside blockquotes/divs (no extra line breaks)
18791 !! wikitext
18792 <blockquote><div>Line one
18793
18794 Line two</div></blockquote>
18795 !! html
18796 <blockquote><div>Line one
18797 Line two</div></blockquote>
18798
18799 !! end
18800
18801 !! test
18802 Paragraphs inside blockquotes/divs (extra line break on open)
18803 !! wikitext
18804 <blockquote><div>
18805 Line one
18806
18807 Line two</div></blockquote>
18808 !! html
18809 <blockquote><div>
18810 <p>Line one
18811 </p>
18812 Line two</div></blockquote>
18813
18814 !! end
18815
18816 !! test
18817 Paragraphs inside blockquotes/divs (extra line break on close)
18818 !! wikitext
18819 <blockquote><div>Line one
18820
18821 Line two
18822 </div></blockquote>
18823 !! html
18824 <blockquote><div>Line one
18825 <p>Line two
18826 </p>
18827 </div></blockquote>
18828
18829 !! end
18830
18831 !! test
18832 Paragraphs inside blockquotes/divs (extra line break on open and close)
18833 !! wikitext
18834 <blockquote><div>
18835 Line one
18836
18837 Line two
18838 </div></blockquote>
18839 !! html
18840 <blockquote><div>
18841 <p>Line one
18842 </p><p>Line two
18843 </p>
18844 </div></blockquote>
18845
18846 !! end
18847
18848 !! test
18849 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
18850 !! options
18851 wgLinkHolderBatchSize=0
18852 !! wikitext
18853 [[meatball:1]]
18854 [[meatball:2]]
18855 [[meatball:3]]
18856 !! html
18857 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
18858 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
18859 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
18860 </p>
18861 !! end
18862
18863 !! test
18864 Free external link invading image caption
18865 !! wikitext
18866 [[Image:Foobar.jpg|thumb|http://x|hello]]
18867 !! html
18868 <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>
18869
18870 !! end
18871
18872 !! test
18873 Bug 15196: localised external link numbers
18874 !! options
18875 language=fa
18876 !! wikitext
18877 [http://en.wikipedia.org/]
18878 !! html/php
18879 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
18880 </p>
18881 !! html/parsoid
18882 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
18883 !! end
18884
18885 !! test
18886 Multibyte character in padleft
18887 !! wikitext
18888 {{padleft:-Hello|7|Æ}}
18889 !! html
18890 <p>Æ-Hello
18891 </p>
18892 !! end
18893
18894 !! test
18895 Multibyte character in padright
18896 !! wikitext
18897 {{padright:Hello-|7|Æ}}
18898 !! html
18899 <p>Hello-Æ
18900 </p>
18901 !! end
18902
18903 !!test
18904 formatdate parser function
18905 !! wikitext
18906 {{#formatdate:2009-03-24}}
18907 !! html
18908 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
18909 </p>
18910 !! end
18911
18912 !!test
18913 formatdate parser function, with default format
18914 !! wikitext
18915 {{#formatdate:2009-03-24|mdy}}
18916 !! html
18917 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
18918 </p>
18919 !! end
18920
18921 !! test
18922 Spacing of numbers in formatted dates
18923 !! wikitext
18924 {{#formatdate:January 15}}
18925 !! html
18926 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18927 </p>
18928 !! end
18929
18930 !! test
18931 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
18932 !! options
18933 language=nl title=[[MediaWiki:Common.css]]
18934 !! wikitext
18935 {{#formatdate:2009-03-24|dmy}}
18936 !! html
18937 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18938 </p>
18939 !! end
18940
18941 #
18942 #
18943 #
18944
18945 #
18946 # Edit comments
18947 #
18948
18949 !! test
18950 Edit comment with link
18951 !! options
18952 comment
18953 !! wikitext
18954 I like the [[Main Page]] a lot
18955 !! html
18956 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18957 !!end
18958
18959 !! test
18960 Edit comment with link and link text
18961 !! options
18962 comment
18963 !! wikitext
18964 I like the [[Main Page|best pages]] a lot
18965 !! html
18966 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18967 !!end
18968
18969 !! test
18970 Edit comment with link and link text with suffix
18971 !! options
18972 comment
18973 !! wikitext
18974 I like the [[Main Page|best page]]s a lot
18975 !! html
18976 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18977 !!end
18978
18979 !! test
18980 Edit comment with section link (non-local, eg in history list)
18981 !! options
18982 comment title=[[Main Page]]
18983 !! wikitext
18984 /* External links */ removed bogus entries
18985 !! html
18986 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18987 !!end
18988
18989 !! test
18990 Edit comment with section link and text before it (non-local, eg in history list)
18991 !! options
18992 comment title=[[Main Page]]
18993 !! wikitext
18994 pre-comment text /* External links */ removed bogus entries
18995 !! html
18996 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>
18997 !!end
18998
18999 !! test
19000 Edit comment with section link (local, eg in diff view)
19001 !! options
19002 comment local title=[[Main Page]]
19003 !! wikitext
19004 /* External links */ removed bogus entries
19005 !! html
19006 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19007 !!end
19008
19009 !! test
19010 Edit comment with subpage link (bug 14080)
19011 !! options
19012 comment
19013 subpage
19014 title=[[Subpage test]]
19015 !! wikitext
19016 Poked at a [[/subpage]] here...
19017 !! html
19018 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
19019 !!end
19020
19021 !! test
19022 Edit comment with subpage link and link text (bug 14080)
19023 !! options
19024 comment
19025 subpage
19026 title=[[Subpage test]]
19027 !! wikitext
19028 Poked at a [[/subpage|neat little page]] here...
19029 !! html
19030 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
19031 !!end
19032
19033 !! test
19034 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
19035 !! options
19036 comment
19037 title=[[Subpage test]]
19038 !! wikitext
19039 Poked at a [[/subpage]] here...
19040 !! html
19041 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...
19042 !!end
19043
19044 !! test
19045 Edit comment with bare anchor link (local, as on diff)
19046 !! options
19047 comment
19048 local
19049 title=[[Main Page]]
19050 !! wikitext
19051 [[#section]]
19052 !! html
19053 <a href="#section">#section</a>
19054 !! end
19055
19056 !! test
19057 Edit comment with bare anchor link (non-local, as on history)
19058 !! options
19059 comment
19060 title=[[Main Page]]
19061 !! wikitext
19062 [[#section]]
19063 !! html
19064 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
19065 !! end
19066
19067 !! test
19068 Anchor starting with underscore
19069 !! wikitext
19070 [[#_ref|One]]
19071 !! html
19072 <p><a href="#_ref">One</a>
19073 </p>
19074 !! end
19075
19076 !! test
19077 Id starting with underscore
19078 !! wikitext
19079 <div id="_ref"></div>
19080 !! html
19081 <div id="_ref"></div>
19082
19083 !! end
19084
19085 !! test
19086 Space normalisation on autocomment (bug 22784)
19087 !! options
19088 comment
19089 title=[[Main Page]]
19090 !! wikitext
19091 /* __hello__world__ */
19092 !! html
19093 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
19094 !! end
19095
19096 !! test
19097 percent-encoding and + signs in comments (Bug 26410)
19098 !! options
19099 comment
19100 !! wikitext
19101 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
19102 !! html
19103 <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>
19104 !! end
19105
19106 # Parsoid doesn't support this yet: see bug 73581
19107 # but it *should* omit the 'src' attribute if the image is bad.
19108 # PHP side of tests was disabled in
19109 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
19110 # because of issues in the PHP parserTests infrastructure
19111 # (but the output below is indeed what the PHP side emits)
19112 !! test
19113 Bad images - basic functionality
19114 !! wikitext
19115 [[File:Bad.jpg]]
19116 !! DISABLED/html/php
19117 !! html/parsoid
19118 <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>
19119 !! end
19120
19121 !! test
19122 Bad images - bug 16039: text after bad image disappears
19123 !! wikitext
19124 Foo bar
19125 [[File:Bad.jpg]]
19126 Bar foo
19127 !! DISABLED/html/php
19128 <p>Foo bar
19129 </p><p>Bar foo
19130 </p>
19131 !! html/parsoid
19132 <p>Foo bar
19133 <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>
19134 Bar foo</p>
19135 !! end
19136
19137 !! test
19138 Verify that displaytitle works (bug #22501) no displaytitle
19139 !! options
19140 showtitle
19141 !! config
19142 wgAllowDisplayTitle=true
19143 wgRestrictDisplayTitle=false
19144 !! wikitext
19145 this is not the the title
19146 !! html
19147 Parser test
19148 <p>this is not the the title
19149 </p>
19150 !! end
19151
19152 !! test
19153 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
19154 !! options
19155 showtitle
19156 title=[[Screen]]
19157 !! config
19158 wgAllowDisplayTitle=true
19159 wgRestrictDisplayTitle=false
19160 !! wikitext
19161 this is not the the title
19162 {{DISPLAYTITLE:whatever}}
19163 !! html
19164 whatever
19165 <p>this is not the the title
19166 </p>
19167 !! end
19168
19169 !! test
19170 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
19171 !! options
19172 showtitle
19173 title=[[Screen]]
19174 !! config
19175 wgAllowDisplayTitle=true
19176 wgRestrictDisplayTitle=true
19177 !! wikitext
19178 this is not the the title
19179 {{DISPLAYTITLE:whatever}}
19180 !! html
19181 Screen
19182 <p>this is not the the title
19183 </p>
19184 !! end
19185
19186 !! test
19187 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
19188 !! options
19189 showtitle
19190 title=[[Screen]]
19191 !! config
19192 wgAllowDisplayTitle=true
19193 wgRestrictDisplayTitle=true
19194 !! wikitext
19195 this is not the the title
19196 {{DISPLAYTITLE:screen}}
19197 !! html
19198 screen
19199 <p>this is not the the title
19200 </p>
19201 !! end
19202
19203 !! test
19204 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
19205 !! options
19206 showtitle
19207 title=[[Screen]]
19208 !! config
19209 wgAllowDisplayTitle=false
19210 !! wikitext
19211 this is not the the title
19212 {{DISPLAYTITLE:screen}}
19213 !! html
19214 Screen
19215 <p>this is not the the title
19216 <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>
19217 </p>
19218 !! end
19219
19220 !! test
19221 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
19222 !! options
19223 showtitle
19224 title=[[Screen]]
19225 !! config
19226 wgAllowDisplayTitle=false
19227 !! wikitext
19228 this is not the the title
19229 !! html
19230 Screen
19231 <p>this is not the the title
19232 </p>
19233 !! end
19234
19235 !! test
19236 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
19237 !! options
19238 showtitle
19239 title=[[Screen]]
19240 !! config
19241 wgAllowDisplayTitle=true
19242 wgRestrictDisplayTitle=true
19243 !! wikitext
19244 this is not the the title
19245 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
19246 !! html
19247 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
19248 <p>this is not the the title
19249 </p>
19250 !! end
19251
19252 !! test
19253 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
19254 !! options
19255 showtitle
19256 title=[[Screen]]
19257 !! config
19258 wgAllowDisplayTitle=true
19259 wgRestrictDisplayTitle=true
19260 !! wikitext
19261 this is not the the title
19262 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
19263 !! html
19264 <span style="color: red;">s</span>creen
19265 <p>this is not the the title
19266 </p>
19267 !! end
19268
19269 !! test
19270 Page status indicators: Empty name is invalid
19271 !! options
19272 showindicators
19273 !! wikitext
19274 <indicator name=" "></indicator>
19275 <indicator></indicator>
19276 !! html
19277 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19278 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19279 </p>
19280 !! end
19281
19282 !! test
19283 Page status indicators: Weird syntaxes that are okay
19284 !! options
19285 showindicators
19286 !! wikitext
19287 <indicator name="empty" />
19288 <indicator name="name"></indicator>
19289 !! html
19290 empty=
19291 name=
19292 <p><br />
19293 </p>
19294 !! end
19295
19296 !! test
19297 Page status indicators: Torture test
19298 !! options
19299 showindicators
19300 !! wikitext
19301 <indicator name="01">hello world</indicator>
19302 <indicator name="02">[[Main Page]]</indicator>
19303 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
19304 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
19305 <indicator name="05">* foo
19306 * bar</indicator>
19307 <indicator name="06"><nowiki>foo</nowiki></indicator>
19308 <indicator name="07"> Preformatted</indicator>
19309 <indicator name="08"><div>Broken tag</indicator>
19310 <indicator name="09">{| class=wikitable
19311 | cell
19312 |}</indicator>
19313 <indicator name="10">Two
19314
19315 paragraphs</indicator>
19316 !! html
19317 01=hello world
19318 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19319 03=<img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg" width="25" height="3" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/38px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg 2x" />
19320 04=<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg" width="25" height="3" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/38px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg 2x" /></a>
19321 05=<ul><li> foo</li>
19322 <li> bar</li></ul>
19323
19324 06=foo
19325 07=<pre>Preformatted
19326 </pre>
19327 08=<div>Broken tag</div>
19328
19329 09=<table class="wikitable">
19330 <tr>
19331 <td> cell
19332 </td></tr></table>
19333
19334 10=<p>Two
19335 </p><p>paragraphs
19336 </p>
19337 <p><br />
19338 </p><p><br />
19339 </p><p><br />
19340 </p><p><br />
19341 </p><p><br />
19342 </p>
19343 !! end
19344
19345 !! test
19346 preload: check <noinclude> and <includeonly>
19347 !! options
19348 preload
19349 !! wikitext
19350 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
19351 !! html
19352 Hello kind world.
19353 !! end
19354
19355 !! test
19356 preload: check <onlyinclude>
19357 !! options
19358 preload
19359 !! wikitext
19360 Goodbye <onlyinclude>Hello world</onlyinclude>
19361 !! html
19362 Hello world
19363 !! end
19364
19365 !! test
19366 preload: can pass tags through if we want to
19367 !! options
19368 preload
19369 !! wikitext
19370 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
19371 !! html
19372 <includeonly>Hello world</includeonly>
19373 !! end
19374
19375 !! test
19376 preload: check that it doesn't try to do tricks
19377 !! options
19378 preload
19379 !! wikitext
19380 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19381 !! html
19382 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19383 !! end
19384
19385 !! test
19386 Play a bit with r67090 and bug 3158
19387 !! wikitext
19388 <div style="width:50% !important">&nbsp;</div>
19389 <div style="width:50%&nbsp;!important">&nbsp;</div>
19390 <div style="width:50%&#160;!important">&nbsp;</div>
19391 <div style="border : solid;">&nbsp;</div>
19392 !! html/php
19393 <div style="width:50% !important">&#160;</div>
19394 <div style="width:50% !important">&#160;</div>
19395 <div style="width:50% !important">&#160;</div>
19396 <div style="border&#160;: solid;">&#160;</div>
19397
19398 !! html/parsoid
19399 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19400 <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>
19401 <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>
19402 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19403
19404 !! end
19405
19406 !! test
19407 HTML5 data attributes
19408 !! wikitext
19409 <span data-foo="bar">Baz</span>
19410 <p data-abc-def_hij="">Quuz</p>
19411 !! html
19412 <p><span data-foo="bar">Baz</span>
19413 </p>
19414 <p data-abc-def_hij="">Quuz</p>
19415
19416 !! end
19417
19418 !! test
19419 percent-encoding and + signs in internal links (Bug 26410)
19420 !! wikitext
19421 [[User:+%]] [[Page+title%]]
19422 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
19423 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
19424 [[%33%45]] [[%33%45+]]
19425 !! html/php
19426 <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>
19427 <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>
19428 <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>
19429 <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>
19430 </p>
19431 !! html/parsoid
19432 <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>
19433 !! end
19434
19435 !! test
19436 Special characters in embedded file links (bug 27679)
19437 !! wikitext
19438 [[File:Contains & ampersand.jpg]]
19439 [[File:Does not exist.jpg|Title with & ampersand]]
19440 !! html/php
19441 <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>
19442 <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>
19443 </p>
19444 !! html/parsoid
19445 <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>
19446 <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>
19447 !! end
19448
19449 !! test
19450 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
19451 !! wikitext
19452 Text&apos;s been normalized?
19453 !! html
19454 <p>Text&#39;s been normalized?
19455 </p>
19456 !! end
19457
19458 !! test
19459 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
19460 !! wikitext
19461 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
19462 !! html
19463 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
19464 </p>
19465 !! end
19466
19467 !! test
19468 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
19469 !! wikitext
19470 [http://www.example.org/ ideograms]
19471 !! html
19472 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
19473 </p>
19474 !! end
19475
19476 !! test
19477 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
19478 !! wikitext
19479 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
19480 !! html
19481 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
19482 </p>
19483 !! end
19484
19485 !! article
19486 Mediawiki:loop1
19487 !! text
19488 {{Identical|A}}
19489 !! endarticle
19490
19491 !! article
19492 Mediawiki:loop2
19493 !! text
19494 {{Identical|B}}
19495 !! endarticle
19496
19497 !! article
19498 Template:Identical
19499 !! text
19500 {{int:loop1}}
19501 {{int:loop2}}
19502 !! endarticle
19503
19504 !! test
19505 Bug 31098 Template which includes system messages which includes the template
19506 !! wikitext
19507 {{Identical}}
19508 !! html
19509 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
19510 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
19511 </p>
19512 !! end
19513
19514 !! test
19515 Bug31490 Turkish: ucfirst 'blah'
19516 !! options
19517 language=tr
19518 !! wikitext
19519 {{ucfirst:blah}}
19520 !! html
19521 <p>Blah
19522 </p>
19523 !! end
19524
19525 !! test
19526 Bug31490 Turkish: ucfirst 'ix'
19527 !! options
19528 language=tr
19529 !! wikitext
19530 {{ucfirst:ix}}
19531 !! html
19532 <p>İx
19533 </p>
19534 !! end
19535
19536 !! test
19537 Bug31490 Turkish: lcfirst 'BLAH'
19538 !! options
19539 language=tr
19540 !! wikitext
19541 {{lcfirst:BLAH}}
19542 !! html
19543 <p>bLAH
19544 </p>
19545 !! end
19546
19547 !! test
19548 Bug31490 Turkish: ucfırst (with a dotless i)
19549 !! options
19550 language=tr
19551 !! wikitext
19552 {{ucfırst:blah}}
19553 !! html
19554 <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>
19555 </p>
19556 !! end
19557
19558 !! test
19559 Bug31490 ucfırst (with a dotless i) with English language
19560 !! options
19561 language=en
19562 !! wikitext
19563 {{ucfırst:blah}}
19564 !! html
19565 <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>
19566 </p>
19567 !! end
19568
19569 !! test
19570 Bug 26375: TOC with italics
19571 !! options
19572 title=[[Main Page]]
19573 !! wikitext
19574 __TOC__
19575 == ''Lost'' episodes ==
19576 !! html
19577 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19578 <ul>
19579 <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>
19580 </ul>
19581 </div>
19582
19583 <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>
19584
19585 !! end
19586
19587 !! test
19588 Bug 26375: TOC with bold
19589 !! options
19590 title=[[Main Page]]
19591 !! wikitext
19592 __TOC__
19593 == '''should be bold''' then normal text ==
19594 !! html
19595 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19596 <ul>
19597 <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>
19598 </ul>
19599 </div>
19600
19601 <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>
19602
19603 !! end
19604
19605 !! test
19606 Bug 33845: Headings become cursive in TOC when they contain an image
19607 !! options
19608 title=[[Main Page]]
19609 !! wikitext
19610 __TOC__
19611 == Image [[Image:foobar.jpg]] ==
19612 !! html
19613 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19614 <ul>
19615 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
19616 </ul>
19617 </div>
19618
19619 <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>
19620
19621 !! end
19622
19623 !! test
19624 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
19625 !! options
19626 title=[[Main Page]]
19627 !! wikitext
19628 __TOC__
19629 == <blockquote>Quote</blockquote> ==
19630 !! html
19631 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19632 <ul>
19633 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19634 </ul>
19635 </div>
19636
19637 <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>
19638
19639 !! html+tidy
19640 <p></p>
19641 <div id="toc" class="toc">
19642 <div id="toctitle">
19643 <h2>Contents</h2>
19644 </div>
19645 <ul>
19646 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19647 </ul>
19648 </div>
19649 <p></p>
19650 <h2><span class="mw-headline" id="Quote"></span></h2>
19651 <blockquote>
19652 <p><span class="mw-headline" id="Quote">Quote</span></p>
19653 </blockquote>
19654 <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>
19655 !! end
19656
19657 !! test
19658 Unclosed tags in TOC
19659 !! options
19660 title=[[Main Page]]
19661 !! wikitext
19662 __TOC__
19663 == Proof: 2 < 3 ==
19664 <small>Hanc marginis exiguitas non caperet.</small>
19665 QED
19666 !! html
19667 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19668 <ul>
19669 <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>
19670 </ul>
19671 </div>
19672
19673 <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>
19674 <p><small>Hanc marginis exiguitas non caperet.</small>
19675 QED
19676 </p>
19677 !! end
19678
19679 !! test
19680 Multiple tags in TOC
19681 !! wikitext
19682 __TOC__
19683 == <i>Foo</i> <b>Bar</b> ==
19684
19685 == <i>Foo</i> <blockquote>Bar</blockquote> ==
19686 !! html
19687 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19688 <ul>
19689 <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>
19690 <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>
19691 </ul>
19692 </div>
19693
19694 <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>
19695 <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>
19696
19697 !! html+tidy
19698 <p></p>
19699 <div id="toc" class="toc">
19700 <div id="toctitle">
19701 <h2>Contents</h2>
19702 </div>
19703 <ul>
19704 <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>
19705 <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>
19706 </ul>
19707 </div>
19708 <p></p>
19709 <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>
19710 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
19711 <blockquote>
19712 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
19713 </blockquote>
19714 <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>
19715 !! end
19716
19717 !! test
19718 Tags with parameters in TOC
19719 !! wikitext
19720 __TOC__
19721 == <sup class="in-h2">Hello</sup> ==
19722
19723 == <sup class="a > b">Evilbye</sup> ==
19724 !! html
19725 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19726 <ul>
19727 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
19728 <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>
19729 </ul>
19730 </div>
19731
19732 <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>
19733 <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;&gt;Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19734
19735 !! end
19736
19737 !! test
19738 span tags with directionality in TOC
19739 !! wikitext
19740 __TOC__
19741 == <span dir="ltr">C++</span> ==
19742
19743 == <span dir="rtl">זבנג!</span> ==
19744
19745 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
19746
19747 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
19748
19749 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
19750 !! html
19751 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19752 <ul>
19753 <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>
19754 <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>
19755 <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>
19756 <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>
19757 <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>
19758 </ul>
19759 </div>
19760
19761 <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>
19762 <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>
19763 <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>
19764 <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>
19765 <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>
19766
19767 !! end
19768
19769 !! test
19770 Bug 72884: bdi element in ToC
19771 !! wikitext
19772 __TOC__
19773 == <bdi>test</bdi> ==
19774 !! html
19775 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19776 <ul>
19777 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
19778 </ul>
19779 </div>
19780
19781 <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>
19782
19783 !! end
19784
19785 # Note that the html output does not have the <p></p>, but the
19786 # html+tidy output *does*. This is because the empty <p></p> is
19787 # removed by the sanitizer, but only when tidy is *not* enabled (!).
19788 !! test
19789 Empty <p> tag in TOC, removed by Sanitizer (T92892)
19790 !! wikitext
19791 __TOC__
19792 == x ==
19793 !! html
19794 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19795 <ul>
19796 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
19797 </ul>
19798 </div>
19799
19800 <h2><span class="mw-headline" id="x">x</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: x">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19801
19802 !! html+tidy
19803 <p></p>
19804 <div id="toc" class="toc">
19805 <div id="toctitle">
19806 <h2>Contents</h2>
19807 </div>
19808 <ul>
19809 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
19810 </ul>
19811 </div>
19812 <p></p>
19813 <h2><span class="mw-headline" id="x">x</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: x">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19814 !! end
19815
19816 !! article
19817 MediaWiki:Bug32057
19818 !! text
19819 == {{int:headline_sample}} ==
19820 !! endarticle
19821
19822 !! test
19823 Bug 32057: Title needed when expanding <h> nodes.
19824 !! options
19825 title=[[Main Page]]
19826 !! wikitext
19827 {{int:Bug32057}}
19828 !! html
19829 <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>
19830
19831 !! end
19832
19833 !! test
19834 Strip marker in urlencode
19835 !! wikitext
19836 {{urlencode:x<nowiki/>y}}
19837 {{urlencode:x<nowiki/>y|wiki}}
19838 {{urlencode:x<nowiki/>y|path}}
19839 !! html
19840 <p>xy
19841 xy
19842 xy
19843 </p>
19844 !! end
19845
19846 !! test
19847 Strip marker in lc
19848 !! wikitext
19849 {{lc:x<nowiki/>y}}
19850 !! html
19851 <p>xy
19852 </p>
19853 !! end
19854
19855 !! test
19856 Strip marker in uc
19857 !! wikitext
19858 {{uc:x<nowiki/>y}}
19859 !! html
19860 <p>XY
19861 </p>
19862 !! end
19863
19864 !! test
19865 Strip marker in formatNum
19866 !! wikitext
19867 {{formatnum:1<nowiki/>2}}
19868 {{formatnum:1<nowiki/>2|R}}
19869 !! html
19870 <p>12
19871 12
19872 </p>
19873 !! end
19874
19875 !! test
19876 Check noCommafy in formatNum
19877 !! options
19878 language=be-tarask
19879 !! wikitext
19880 {{formatnum:123456.78}}
19881 {{formatnum:123456.78|NOSEP}}
19882 !! html
19883 <p>123 456,78
19884 123456.78
19885 </p>
19886 !! end
19887
19888 !! test
19889 Wrong option for formatNum (bug 56199)
19890 !! wikitext
19891 {{formatnum:1,234.56|Random}}
19892 {{formatnum:1,234.56|EVERYTHING}}
19893 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
19894 !! html
19895 <p>1,234.56
19896 1,234.56
19897 1,234.56
19898 </p>
19899 !! end
19900
19901 !! test
19902 Strip marker in grammar
19903 !! options
19904 language=fi
19905 !! wikitext
19906 {{grammar:elative|foo<nowiki/>bar}}
19907 !! html
19908 <p>foobarista
19909 </p>
19910 !! end
19911
19912 !! test
19913 Strip marker in padleft
19914 !! wikitext
19915 {{padleft:|2|x<nowiki/>y}}
19916 !! html
19917 <p>xy
19918 </p>
19919 !! end
19920
19921 !! test
19922 Strip marker in padright
19923 !! wikitext
19924 {{padright:|2|x<nowiki/>y}}
19925 !! html
19926 <p>xy
19927 </p>
19928 !! end
19929
19930 !! test
19931 Strip marker in anchorencode
19932 !! wikitext
19933 {{anchorencode:x<nowiki/>y}}
19934 !! html
19935 <p>xy
19936 </p>
19937 !! end
19938
19939 !! test
19940 nowiki inside link inside heading (bug 18295)
19941 !! wikitext
19942 ==[[foo|x<nowiki>y</nowiki>z]]==
19943 !! html
19944 <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>
19945
19946 !! end
19947
19948 !! test
19949 new support for bdi element (bug 31817)
19950 !! wikitext
19951 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19952 !! html
19953 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19954
19955 !!end
19956
19957 !! test
19958 Ignore pipe between table row attributes
19959 !! wikitext
19960 {|
19961 | quux
19962 |- id=foo | style='color: red'
19963 | bar
19964 |}
19965 !! html
19966 <table>
19967 <tr>
19968 <td> quux
19969 </td></tr>
19970 <tr id="foo" style="color: red">
19971 <td> bar
19972 </td></tr></table>
19973
19974 !! end
19975
19976 !!test
19977 Gallery override link with WikiLink (bug 34852)
19978 !! wikitext
19979 <gallery>
19980 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
19981 </gallery>
19982 !! html
19983 <ul class="gallery mw-gallery-traditional">
19984 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19985 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
19986 <div class="gallerytext">
19987 <p>caption
19988 </p>
19989 </div>
19990 </div></li>
19991 </ul>
19992
19993 !! end
19994
19995 !!test
19996 Gallery override link with absolute external link (bug 34852)
19997 !! wikitext
19998 <gallery>
19999 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20000 </gallery>
20001 !! html
20002 <ul class="gallery mw-gallery-traditional">
20003 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20004 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20005 <div class="gallerytext">
20006 <p>caption
20007 </p>
20008 </div>
20009 </div></li>
20010 </ul>
20011
20012 !! end
20013
20014 !!test
20015 Gallery override link with malicious javascript (bug 34852)
20016 !! wikitext
20017 <gallery>
20018 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20019 </gallery>
20020 !! html
20021 <ul class="gallery mw-gallery-traditional">
20022 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20023 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20024 <div class="gallerytext">
20025 <p>caption
20026 </p>
20027 </div>
20028 </div></li>
20029 </ul>
20030
20031 !! end
20032
20033 !!test
20034 Gallery with invalid title as link (bug 43964)
20035 !! wikitext
20036 <gallery>
20037 File:foobar.jpg|link=<
20038 </gallery>
20039 !! html
20040 <ul class="gallery mw-gallery-traditional">
20041 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20042 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20043 <div class="gallerytext">
20044 </div>
20045 </div></li>
20046 </ul>
20047
20048 !! end
20049
20050 !!test
20051 Language parser function
20052 !! wikitext
20053 {{#language:ar}}
20054 !! html
20055 <p>العربية
20056 </p>
20057 !! end
20058
20059 !!test
20060 Padleft and padright as substr
20061 !! wikitext
20062 {{padleft:|3|abcde}}
20063 {{padright:|3|abcde}}
20064 !! html
20065 <p>abc
20066 abc
20067 </p>
20068 !! end
20069
20070 !!test
20071 Special parser function
20072 !! wikitext
20073 {{#special:RandomPage}}
20074 {{#special:BaDtItLe}}
20075 {{#special:Foobar}}
20076 !! html
20077 <p>Special:Random
20078 Special:Badtitle
20079 Special:Foobar
20080 </p>
20081 !! end
20082
20083 !!test
20084 Bug 34939 - Case insensitive link parsing ([HttP://])
20085 !! wikitext
20086 [HttP://MediaWiki.Org/]
20087 !! html/php
20088 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
20089 </p>
20090 !! html/parsoid
20091 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
20092 !! end
20093
20094 !!test
20095 Bug 34939 - Case insensitive link parsing ([HttP:// title])
20096 !! wikitext
20097 [HttP://MediaWiki.Org/ MediaWiki]
20098 !! html
20099 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
20100 </p>
20101 !! end
20102
20103 !!test
20104 Bug 34939 - Case insensitive link parsing (HttP://)
20105 !! wikitext
20106 HttP://MediaWiki.Org/
20107 !! html/php
20108 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
20109 </p>
20110 !! html/parsoid
20111 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
20112 !! end
20113
20114 !!test
20115 Disable TOC
20116 !! options
20117 notoc
20118 !! wikitext
20119 Lead
20120 == Section 1 ==
20121 == Section 2 ==
20122 == Section 3 ==
20123 == Section 4 ==
20124 == Section 5 ==
20125 !! html
20126 <p>Lead
20127 </p>
20128
20129 <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>
20130 <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>
20131 <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>
20132 <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>
20133 <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>
20134
20135 !! end
20136
20137
20138 ###
20139 ### Parsoid-specific tests
20140 ### Parsoid-PHP parser incompatibilities
20141 ###
20142 !!test
20143 1. SOL-sensitive wikitext tokens as template-args
20144 !!options
20145 parsoid=wt2html,wt2wt
20146 !! wikitext
20147 {{echo|*a}}
20148 {{echo|#a}}
20149 {{echo|:a}}
20150 !! html
20151 <span about="#mwt1" typeof="mw:Transclusion">
20152 </span><ul about="#mwt1"><li>a</li>
20153 </ul>
20154 <span about="#mwt2" typeof="mw:Transclusion">
20155 </span><ol about="#mwt2"><li>a</li>
20156 </ol>
20157 <span about="#mwt3" typeof="mw:Transclusion">
20158 </span><dl about="#mwt3"><dd>a</dd>
20159 </dl>
20160 !!end
20161
20162 #### -----------------------------------------------------------------
20163 #### Parsoid-specific functionality tests
20164 #### -----------------------------------------------------------------
20165
20166 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
20167 # We know wt2wt will fail, but we expect selser to pass.
20168 # Due to the nature of our testing, wt2wt and selser tests will enter the
20169 # blacklist and we'll catch selser regressions based on changes to the
20170 # blacklist entries for selser tests.
20171 !! test
20172 1. Bad treebuilder fixup of formatting elt is cleaned up
20173 !! options
20174 parsoid=wt2html,wt2wt
20175 !! wikitext
20176 {|
20177 |
20178 <small>
20179 [[Image:Foobar.jpg|right|Test]]
20180 </small>
20181 |}
20182 !! html/parsoid
20183 <table>
20184 <tbody><tr><td>
20185 <small>
20186 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Test</figcaption></figure>
20187 </small>
20188 </td></tr>
20189 </tbody></table>
20190 !! end
20191
20192 !! test
20193 2. Bad treebuilder fixup of formatting elt is cleaned up
20194 !! options
20195 parsoid=wt2html,wt2wt
20196 !! wikitext
20197 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
20198
20199 <small>[[Image:Foobar.jpg|right|300px]]</small>
20200 !! html/parsoid
20201 <p><b>foo</b></p>
20202 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><b>caption</b></figcaption></figure>
20203 <p><b>bar</b></p>
20204 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></figure></small>
20205 !! end
20206
20207 #### ----------------------------------------------------------------
20208 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
20209 #### tags. Parsoid's output for these tags differs from that of the
20210 #### PHP parser.
20211 #### ----------------------------------------------------------------
20212
20213 !!test
20214 Ref: 1. ref-location should be replaced with an index span
20215 !!options
20216 parsoid
20217 !! wikitext
20218 A <ref>foo</ref>
20219 B <ref name="x">foo</ref>
20220 C <ref name="y" />
20221 <references />
20222 !! html
20223 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
20224 B <span about="#mwt4" class="reference" id="cite_ref-x_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-2"},"attrs":{"name":"x"}}'><a href="#cite_note-x-2">[2]</a></span>
20225 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>
20226 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20227 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
20228 <li about="#cite_note-x-2" id="cite_note-x-2"><span rel="mw:referencedBy"><a href="#cite_ref-x_2-0">↑</a></span> <span id="mw-reference-text-cite_note-x-2" class="mw-reference-text">foo</span></li>
20229 <li about="#cite_note-y-3" id="cite_note-y-3"><span rel="mw:referencedBy"><a href="#cite_ref-y_3-0">↑</a></span> <span id="mw-reference-text-cite_note-y-3" class="mw-reference-text"></span></li>
20230 </ol>
20231 !!end
20232
20233 !!test
20234 Ref: 2. ref-tags with identical names should all get the same index
20235 !!options
20236 parsoid
20237 !! wikitext
20238 A <ref name="x">foo</ref>
20239 B <ref name="x" />
20240 <references />
20241 !! html
20242 <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":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span>
20243 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>
20244 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20245 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-x_1-0">1.0</a> <a href="#cite_ref-x_1-1">1.1</a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
20246 </ol>
20247 !!end
20248
20249 !!test
20250 Ref: 3. spaces in ref-names should be ignored
20251 !!options
20252 parsoid
20253 !! wikitext
20254 A <ref name="x">foo</ref>
20255 B <ref name=" x " />
20256 C <ref name= x />
20257 <references />
20258 !! html
20259 <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":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span>
20260 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>
20261 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>
20262 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20263 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-x_1-0">1.0</a> <a href="#cite_ref-x_1-1">1.1</a> <a href="#cite_ref-x_1-2">1.2</a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
20264 </ol>
20265 !!end
20266
20267 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
20268 !!test
20269 Ref: 4. 'constructor' should be accepted as a valid ref-name
20270 !!options
20271 parsoid
20272 !! wikitext
20273 A <ref name="constructor">foo</ref>
20274 <references />
20275 !! html
20276 <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":{"id":"mw-reference-text-cite_note-constructor-1"},"attrs":{"name":"constructor"}}'><a href="#cite_note-constructor-1">[1]</a></span></p>
20277 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20278 <li about="#cite_note-constructor-1" id="cite_note-constructor-1"><span rel="mw:referencedBy"><a href="#cite_ref-constructor_1-0">↑</a></span> <span id="mw-reference-text-cite_note-constructor-1" class="mw-reference-text">foo</span></li>
20279 </ol>
20280 !!end
20281
20282 !!test
20283 Ref: 5. body should accept generic wikitext
20284 !!options
20285 parsoid
20286 !! wikitext
20287 A <ref>
20288 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
20289 </ref>
20290
20291 <references />
20292 !! html
20293 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
20294
20295 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20296 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">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>
20297 </span></li>
20298 </ol>
20299 !!end
20300
20301 !!test
20302 Ref: 6. indent-pres should not be output in ref-body
20303 !!options
20304 parsoid
20305 !! wikitext
20306 A <ref>
20307 foo
20308 bar
20309 baz
20310 </ref>
20311
20312 <references />
20313 !! html
20314 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
20315
20316 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20317 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
20318 bar
20319 baz
20320 </span></li>
20321 </ol>
20322 !!end
20323
20324 !!test
20325 Ref: 7. No p-wrapping in ref-body
20326 !!options
20327 parsoid
20328 !! wikitext
20329 A <ref>
20330 foo
20331
20332 bar
20333
20334
20335 baz
20336
20337
20338
20339 booz
20340 </ref>
20341
20342 <references />
20343 !! html
20344 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
20345
20346 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20347 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
20348
20349 bar
20350
20351
20352 baz
20353
20354
20355
20356 booz
20357 </span></li>
20358 </ol>
20359 !!end
20360
20361 !!test
20362 Ref: 8. transclusion wikitext has lower precedence
20363 !!options
20364 parsoid
20365 !! wikitext
20366 A <ref> foo {{echo|</ref> B C}}
20367
20368 <references />
20369 !! html
20370 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C<span typeof="mw:Nowiki">}}</span></p>
20371 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20372 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <span typeof="mw:Nowiki" data-parsoid='{"src":"{{","dsr":[12,14,0,0]}'>{{</span>echo|</span></li>
20373 </ol>
20374 !!end
20375
20376 !!test
20377 Ref: 9. unclosed comments should not leak out of ref-body
20378 !!options
20379 parsoid
20380 !! wikitext
20381 A <ref> foo <!--</ref> B C
20382 <references />
20383 !! html
20384 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C</p>
20385 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20386 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <!----></span></li>
20387 </ol>
20388 !!end
20389
20390 !!test
20391 Ref: 10. Unclosed HTML tags should not leak out of ref-body
20392 !!options
20393 parsoid
20394 !! wikitext
20395 A <ref> <b> foo </ref> B C
20396
20397 <references />
20398 !! html
20399 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C</p>
20400
20401
20402 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20403 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li>
20404 </ol>
20405 !!end
20406
20407 !!test
20408 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
20409 !!options
20410 parsoid
20411 !! wikitext
20412 A <ref>foo</ref> B
20413 C <ref>bar</ref> D
20414 <references />
20415 !! html
20416 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B
20417 C <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2">[2]</a></span> D</p>
20418 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20419 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
20420 <li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
20421 </ol>
20422 !!end
20423
20424 !!test
20425 Ref: 12. ref-tags act as trailing newline migration barrier
20426 !!options
20427 parsoid
20428 !! wikitext
20429 <!--the newline at the end of this line moves out of the p-tag-->a
20430
20431 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
20432 <ref />
20433
20434 c
20435 <references />
20436 !! html
20437 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
20438
20439
20440 <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>
20441 <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>
20442
20443 <p>c</p>
20444 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20445 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"></span></li>
20446 <li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"></span></li></ol>
20447 !!end
20448
20449 !!test
20450 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
20451 !!options
20452 parsoid
20453 !! wikitext
20454 <ref>foo</ref> A
20455 <ref>bar
20456 </ref> B
20457 <references />
20458 !! html
20459 <p><span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> A
20460 <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2">[2]</a></span> B</p>
20461 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20462 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
20463 <li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar
20464 </span></li>
20465 </ol>
20466 !!end
20467
20468 !!test
20469 Ref: 14. A nested ref-tag should be emitted as plain text
20470 !!options
20471 parsoid
20472 !! wikitext
20473 <ref>foo <ref>bar</ref> baz</ref>
20474
20475 <references />
20476 !! html
20477 <p><span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
20478 </p>
20479 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20480 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo &lt;ref>bar&lt;/ref> baz</span></li>
20481 </ol>
20482 !!end
20483
20484 !!test
20485 Ref: 15. ref-tags with identical names should get identical indexes
20486 !!options
20487 parsoid
20488 !! wikitext
20489 A1 <ref name="a">foo</ref> A2 <ref name="a" />
20490 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
20491
20492 <references />
20493 !! html
20494 <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":{"id":"mw-reference-text-cite_note-a-1"},"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>
20495 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":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span></p>
20496
20497 <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> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></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> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
20498 </ol>
20499 !!end
20500
20501 ## We don't bother wt2wt-ing non-standard whitespace
20502 !!test
20503 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
20504 !!options
20505 parsoid=wt2html
20506 !! wikitext
20507 A <ref >foo</ref >
20508
20509 <references />
20510 !! html
20511 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
20512 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20513 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
20514 !!end
20515
20516 !!test
20517 Ref: 17. Generate valid HTML5 id/about attributes
20518 !!options
20519 parsoid
20520 !!wikitext
20521 <ref name="a b">foo</ref>
20522
20523 <references />
20524 !!html
20525 <p><span class="reference" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_b-1"},"attrs":{"name":"a b"}}'><a href="#cite_note-a_b-1">[1]</a></span>
20526 </p>
20527
20528 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20529 <li about="#cite_note-a_b-1" id="cite_note-a_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_b_1-0">↑</a></span> <span id="mw-reference-text-cite_note-a_b-1" class="mw-reference-text">foo</span></li>
20530 </ol>
20531 !!end
20532
20533 !!test
20534 Ref: 18. T58916: Extension attributes should be parsed as plain text
20535 !!options
20536 parsoid
20537 !!wikitext
20538 <ref name="{{echo|a}}">foo</ref>
20539
20540 <references />
20541 !!html
20542 <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":{"id":"mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1"},"attrs":{"name":"{{echo|a}}"}}'><a href="#cite_note-.7B.7Becho.7Ca.7D.7D-1">[1]</a></span>
20543 </p>
20544
20545 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20546 <li about="#cite_note-.7B.7Becho.7Ca.7D.7D-1" 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> <span id="mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1" class="mw-reference-text">foo</span></li>
20547 </ol>
20548 !!end
20549
20550 !!test
20551 Ref: 19. ref-tags with identical name encodings should get identical indexes
20552 !!options
20553 parsoid
20554 !! wikitext
20555 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
20556
20557 <references />
20558 !! html
20559 <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":{"id":"mw-reference-text-cite_note-a_.26_b-1"},"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>
20560 </p>
20561 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20562 <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> <span id="mw-reference-text-cite_note-a_.26_b-1" class="mw-reference-text">foo</span></li>
20563 </ol>
20564 !!end
20565
20566 !!test
20567 Ref: 20. ref-tags with identical names but different content should keep it
20568 !!options
20569 parsoid
20570 !! wikitext
20571 A <ref name="foo">Foo one</ref>
20572 B <ref name="foo">Foo two</ref>
20573 C <ref name="foo" />
20574
20575 <references />
20576 !! html
20577 <p>A <span about="#mwt2" class="reference" id="cite_ref-foo_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-foo-1"},"attrs":{"name":"foo"}}'><a href="#cite_note-foo-1">[1]</a></span>
20578 B <span about="#mwt4" class="reference" id="cite_ref-foo_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"Foo two"},"attrs":{"name":"foo"}}'><a href="#cite_note-foo-1">[1]</a></span>
20579 C <span about="#mwt6" class="reference" id="cite_ref-foo_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"}}'><a href="#cite_note-foo-1">[1]</a></span></p>
20580
20581 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-foo-1" id="cite_note-foo-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-foo_1-0">1.0</a> <a href="#cite_ref-foo_1-1">1.1</a> <a href="#cite_ref-foo_1-2">1.2</a></span> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text">Foo one</span></li>
20582 </ol>
20583 !!end
20584
20585 !!test
20586 References: 1. references tag without any refs should be handled properly
20587 !!options
20588 parsoid
20589 !! wikitext
20590 <references />
20591 !! html
20592 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
20593 !!end
20594
20595 !!test
20596 References: 2. references tag with group only outputs references from that group
20597 !!options
20598 parsoid
20599 !! wikitext
20600 A <ref group="a">foo</ref>
20601 B <ref group="b">bar</ref>
20602 C <ref>baz</ref>
20603
20604 <references group="a" />
20605 <references />
20606 <references group="b" />
20607 !! html
20608 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
20609 B <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"b"}}'><a href="#cite_note-2">[b 1]</a></span>
20610 C <span class="reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="#cite_note-3">[1]</a></span></p>
20611
20612 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{"group":"a"}}'>
20613 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
20614 </ol>
20615 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
20616 <li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3">↑</a></span> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">baz</span></li>
20617 </ol>
20618 <ol class="references" typeof="mw:Extension/references" about="#mwt12" data-mw='{"name":"references","attrs":{"group":"b"}}'>
20619 <li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
20620 </ol>
20621 !!end
20622
20623 !!test
20624 References: 3. ref list should be cleared after processing references
20625 !!options
20626 parsoid
20627 !! wikitext
20628 A <ref>foo</ref>
20629
20630 <references />
20631
20632 B <ref>bar</ref>
20633
20634 <references />
20635 !! html
20636 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
20637
20638 <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> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
20639 </ol>
20640
20641 <p>B <span about="#mwt6" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2">[1]</a></span></p>
20642
20643 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20644 <li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
20645 </ol>
20646 !!end
20647
20648 !!test
20649 References: 4. only referenced group should be cleared after processing references
20650 !!options
20651 parsoid
20652 !! wikitext
20653 A <ref group="a">afoo</ref>
20654 B <ref>bfoo</ref>
20655
20656 <references group="a" />
20657
20658 C <ref>cfoo</ref>
20659
20660 <references />
20661 !! html
20662 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
20663 B <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2">[1]</a></span></p>
20664
20665 <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> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">afoo</span></li>
20666 </ol>
20667
20668 <p>C <span about="#mwt8" class="reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="#cite_note-3">[2]</a></span></p>
20669
20670 <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> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bfoo</span></li><li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3">↑</a></span> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">cfoo</span></li>
20671 </ol>
20672 !!end
20673
20674 !!test
20675 References: 5. ref tags in references should be processed while ignoring all other content
20676 !!options
20677 parsoid
20678 !! wikitext
20679 A <ref name="a" />
20680 B <ref name="b">bar</ref>
20681
20682 <references>
20683 <ref name="a">foo</ref>
20684 This should just get lost.
20685 </references>
20686 !! html
20687 <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>
20688 B <span about="#mwt4" class="reference" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span></p>
20689
20690
20691 <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;{\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"},\"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> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></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> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
20692 </ol>
20693 !!end
20694
20695 !!test
20696 References: 6. <references /> from a transclusion
20697 !!options
20698 parsoid
20699 !! wikitext
20700 <ref>Foo</ref> {{echo|<references />}}
20701 !! html
20702 <p><span about="#mwt3" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"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> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">Foo</span></li>
20703 </ol>
20704 !!end
20705
20706 !! test
20707 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
20708 !! options
20709 parsoid
20710 !! wikitext
20711 A <ref>foo bar for a</ref>
20712 B <ref group="X" name="b" />
20713
20714 <references />
20715
20716 <references group="X">
20717 <ref name="b">foo</ref>
20718 </references>
20719 !! html
20720 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
20721 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>
20722 </p>
20723
20724 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20725 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo bar for a</span></li>
20726 </ol>
20727
20728 <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;{\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-b-2\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"#cite_note-b-2\">[X 1]&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'>
20729 <li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b_2-0">↑</a></span> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">foo</span></li>
20730 </ol>
20731 !! end
20732
20733 !! test
20734 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
20735 !! options
20736 parsoid
20737 !! wikitext
20738 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
20739 <references />
20740 !! html
20741 <p>X<span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo {{echo|&lt;b>bar&lt;/b>}} and {{echo|baz}} boo&lt;/ref>"}},"i":0}}]}'><a href="#cite_note-1">[1]</a></span></p>
20742 <ol class="references" typeof="mw:Extension/references" about="#mwt7" 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> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <b data-parsoid='{"stx":"html"}'>bar</b> and baz boo</span></li>
20743 </ol>
20744 !!end
20745
20746 # This test only works in wt2html now as the <references /> are always generated
20747 # unless selser is active. Once T72722 is fixed, we should add a changes test
20748 # here to ensure that unrelated changes don't add the new <references /> in
20749 # wt2wt.
20750 !! test
20751 References: 9. Generate missing references list at the end
20752 !! options
20753 parsoid
20754 !! wikitext
20755 A <ref>foo</ref>
20756 B <ref group="inexistent">bar</ref>
20757 !! html
20758 <p>A <span class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B <span class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"inexistent"}}'><a href="#cite_note-2">[inexistent 1]</a></span></p>
20759 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20760 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
20761 </ol>
20762 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
20763 <li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
20764 </ol>
20765 !! end
20766
20767 !! test
20768 References: 10. New <references/> shouldn't be added for unrelated edits.
20769 !! options
20770 parsoid={
20771 "modes": ["selser"],
20772 "changes": [["#x", "remove"]],
20773 "selser": "noauto"
20774 }
20775 !! wikitext
20776 Unrelated text<span id="x"> that's going to disappear</span>.
20777 A <ref>foo</ref>
20778 !! wikitext/edited
20779 Unrelated text.
20780 A <ref>foo</ref>
20781 !!end
20782
20783 !! test
20784 Entities in ref name
20785 !! options
20786 parsoid
20787 !! wikitext
20788 <ref name="test &amp; me">hi</ref>
20789 <references />
20790 !! html
20791 <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":{"id":"mw-reference-text-cite_note-test_.26_me-1"},"attrs":{"name":"test &amp;amp; me"}}'><a href="#cite_note-test_.26_me-1">[1]</a></span></p>
20792 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20793 <li about="#cite_note-test_.26_me-1" id="cite_note-test_.26_me-1"><span rel="mw:referencedBy"><a href="#cite_ref-test_.26_me_1-0">↑</a></span> <span id="mw-reference-text-cite_note-test_.26_me-1" class="mw-reference-text">hi</span></li>
20794 </ol>
20795 !! end
20796
20797 # This test is wt2html only because we're permitting the serializer to produce
20798 # dirty diffs, normalizing the unclosed references to the self-closed version.
20799 !! test
20800 Generate references for unclosed references tag
20801 !! options
20802 parsoid=wt2html
20803 !! wikitext
20804 a<ref>foo</ref>
20805
20806 <references>
20807 !! html
20808 <p>a<span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
20809 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20810 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
20811 !! end
20812
20813 !! test
20814 New reference serializes on its own line
20815 !! options
20816 parsoid=wt2wt,html2wt
20817 !! wikitext
20818 foo
20819 <references />
20820 !! html
20821 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
20822 !! end
20823
20824 #### ----------------------------------------------------------------
20825 #### Parsoid-only testing of Parsoid's impl of LST
20826 #### Not implemented yet, see
20827 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
20828 #### ----------------------------------------------------------------
20829
20830 !!test
20831 LST Sections: 1. Simple section start and end
20832 !! wikitext
20833 <section begin="2011-05-16" />
20834 <section end="2014-04-10 (MW 1.23wmf22)" />
20835 !! html/parsoid
20836 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
20837 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
20838 !! end
20839
20840 #--------- Test stripping of empty nodes in template content ----------
20841 !!test
20842 Empty LI and TR nodes should be stripped from template content
20843 !!wikitext
20844 {{EmptyLITest}}
20845 {{EmptyTRTest}}
20846 !!html/parsoid
20847 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
20848 <li>a</li>
20849 <li>b</li>
20850 </ul>
20851 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
20852 <tbody>
20853 <tr>
20854 <td>foo</td>
20855 </tr>
20856 <tr>
20857 <td>bar</td>
20858 </tr>
20859 </tbody>
20860 </table>
20861 !!end
20862
20863 !!test
20864 Empty LI and TR nodes should not be stripped from top-level content
20865 !!wikitext
20866 * a
20867 *
20868 * b
20869 {|
20870 |-
20871 |-
20872 |foo
20873 |}
20874 !!html/parsoid
20875 <ul>
20876 <li> a</li>
20877 <li></li>
20878 <li> b</li>
20879 </ul>
20880 <table>
20881 <tbody>
20882 <tr></tr>
20883 <tr>
20884 <td>foo</td>
20885 </tr>
20886 </tbody>
20887 </table>
20888 !!end
20889
20890 !!test
20891 Empty TR nodes should not be stripped if they have any attributes set
20892 !!wikitext
20893 {{EmptyTRWithHTMLAttrTest}}
20894 !!html/parsoid
20895 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
20896 <tr align="center"></tr>
20897 <tr><td>foo</td></tr>
20898 <tr align="center"></tr>
20899 <tr><td>bar</td></tr>
20900 </table>
20901 !!end
20902
20903 #### ----------------------------------------------------------------
20904 #### The following section of tests are primarily to test
20905 #### wikitext escaping capabilities of Parsoid. Given that
20906 #### escaping can be done any number of ways, the wikitext (input)
20907 #### is always adjusted to reflect how Parsoid adds nowiki
20908 #### escape tags.
20909 ####
20910 #### We are marking several tests as parsoid-only since the
20911 #### HTML in the result section is different from what the
20912 #### PHP parser generates for it.
20913 #### ----------------------------------------------------------------
20914
20915
20916 #### --------------- Headings ---------------
20917 #### 0. Unnested
20918 #### 1. Nested inside html <h1>=foo=</h1>
20919 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
20920 #### 3. Nested inside html with wikitext split by html tags
20921 #### 4. No escape needed
20922 #### 5. Empty headings <h1></h1>
20923 #### 6. Heading chars in SOL context
20924 #### ----------------------------------------
20925 !! test
20926 Headings: 0. Unnested
20927 !! options
20928 parsoid
20929 !! wikitext
20930 <nowiki>=foo=</nowiki>
20931
20932 <nowiki> =foo= </nowiki>
20933 <!--cmt-->
20934 <nowiki>=foo=</nowiki>
20935
20936 =foo''a''<nowiki>=</nowiki>
20937 !! html
20938 <p><span typeof="mw:Nowiki">=foo=</span></p>
20939
20940 <p><span typeof="mw:Nowiki"> =foo= </span>
20941 <!--cmt-->
20942 <span typeof="mw:Nowiki">=foo=</span></p>
20943
20944 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
20945 !!end
20946
20947 # New headings and existing headings are handled differently
20948 !! test
20949 Headings: 1. Nested inside html
20950 !! options
20951 parsoid=html2wt
20952 !! html
20953 <h1>=foo=</h1>
20954 <h2>=foo=</h2>
20955 <h3>=foo=</h3>
20956
20957 <h1 data-parsoid=''>=foo=</h1>
20958 <h2 data-parsoid=''>=foo=</h2>
20959 <h3 data-parsoid=''>=foo=</h3>
20960 <h4 data-parsoid=''>=foo=</h4>
20961 <h5 data-parsoid=''>=foo=</h5>
20962 <h6 data-parsoid=''>=foo=</h6>
20963 !! wikitext
20964 = =foo= =
20965
20966 == =foo= ==
20967
20968 === =foo= ===
20969
20970 =<nowiki>=foo=</nowiki>=
20971 ==<nowiki>=foo=</nowiki>==
20972 ===<nowiki>=foo=</nowiki>===
20973 ====<nowiki>=foo=</nowiki>====
20974 =====<nowiki>=foo=</nowiki>=====
20975 ======<nowiki>=foo=</nowiki>======
20976
20977 !!end
20978
20979 !! test
20980 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
20981 !! options
20982 parsoid=html2wt
20983 !! html
20984 <h1>foo</h1>*bar
20985 <h1>foo</h1>=bar
20986 <h1>foo</h1>=bar=
20987 !! wikitext
20988 = foo =
20989 <nowiki>*</nowiki>bar
20990
20991 = foo =
20992 =bar
20993
20994 = foo =
20995 <nowiki>=bar=</nowiki>
20996 !!end
20997
20998 !! test
20999 Headings: 3. Nested inside html with wikitext split by html tags
21000 !! options
21001 parsoid=html2wt,wt2wt
21002 !! wikitext
21003 = ='''bold'''<nowiki>foo=</nowiki> =
21004 !! html/parsoid
21005 <h1>=<b>bold</b>foo=</h1>
21006 !!end
21007
21008 !! test
21009 Headings: 4a. No escaping needed (testing just h1 and h2)
21010 !! wikitext
21011 = =foo =
21012
21013 = foo= =
21014
21015 = =foo= =
21016
21017 = =foo= bar =
21018
21019 == =foo ==
21020
21021 == foo= ==
21022
21023 = = =
21024
21025 = ''=''foo= =
21026 !! html/parsoid
21027 <h1>=foo</h1>
21028 <h1>foo=</h1>
21029 <h1> =foo= </h1>
21030 <h1>=foo= bar</h1>
21031 <h2>=foo</h2>
21032 <h2>foo=</h2>
21033 <h1>=</h1>
21034 <h1><i>=</i>foo=</h1>
21035 !!end
21036
21037 !! test
21038 Headings: 4b. No escaping needed (inside p-tags)
21039 !! options
21040 parsoid=html2wt
21041 !! html
21042 <p>===
21043 =foo= x
21044 =foo= <s></s>
21045 </p>
21046 !! wikitext
21047 ===
21048 =foo= x
21049 =foo= <s></s>
21050 !!end
21051
21052 !! test
21053 Headings: 5. Empty headings
21054 !! options
21055 parsoid
21056 !! wikitext
21057 =<nowiki/>=
21058
21059 ==<nowiki/>==
21060
21061 ===<nowiki/>===
21062
21063 ====<nowiki/>====
21064
21065 =====<nowiki/>=====
21066
21067 ======<nowiki/>======
21068 !! html
21069 <h1></h1>
21070 <h2></h2>
21071 <h3></h3>
21072 <h4></h4>
21073 <h5></h5>
21074 <h6></h6>
21075 !!end
21076
21077 !! test
21078 Headings: 6a. Heading chars in SOL context (with trailing spaces)
21079 !! options
21080 parsoid
21081 !! wikitext
21082 <nowiki>=a=</nowiki>
21083
21084 <nowiki>=a=</nowiki>
21085
21086 <nowiki>=a=</nowiki>
21087
21088 <nowiki>=a=</nowiki>
21089 !! html
21090 <p>=a=</p>
21091 <p>=a= </p>
21092 <p>=a= </p>
21093 <p>=a= </p>
21094 !!end
21095
21096 !! test
21097 Headings: 6b. Heading chars in SOL context (with trailing newlines)
21098 !! options
21099 parsoid
21100 !! wikitext
21101 <nowiki>=a=
21102 b</nowiki>
21103
21104 <nowiki>=a=
21105 b</nowiki>
21106
21107 <nowiki>=a=
21108 b</nowiki>
21109
21110 <nowiki>=a=
21111 b</nowiki>
21112 !! html
21113 <p>=a=
21114 b</p>
21115 <p>=a=
21116 b</p>
21117 <p>=a=
21118 b</p>
21119 <p>=a=
21120 b</p>
21121 </p>
21122 !!end
21123
21124 !! test
21125 Headings: 6c. Heading chars in SOL context (leading newline break)
21126 !! options
21127 parsoid
21128 !! wikitext
21129 a
21130 <nowiki>=b=</nowiki>
21131 !! html
21132 <p>a
21133 =b=</p>
21134 !!end
21135
21136 !! test
21137 Headings: 6d. Heading chars in SOL context (with interspersed comments)
21138 !! options
21139 parsoid
21140 !! wikitext
21141 <!--c0--><nowiki>=a=</nowiki>
21142
21143 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
21144 !! html
21145 <p><!--c0-->=a=</p>
21146 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
21147 !!end
21148
21149 !! test
21150 Headings: 6d. Heading chars in SOL context (No escaping needed)
21151 !! options
21152 parsoid=html2wt
21153 !! html
21154 =a=<div>b</div>
21155 !! wikitext
21156 =a=<div>b</div>
21157 !!end
21158
21159 !! test
21160 Headings: 7. Insert a newline between new content and headings
21161 !! options
21162 parsoid=html2wt
21163 !! html
21164 <h2>NEW</h2>
21165 <p>new</p>
21166 <h2 data-parsoid='{"dsr":[0,5,2,2]}'>A</h2>
21167 <p data-parsoid='{"dsr":[6,7,0,0]}'>a</p>
21168 !! wikitext
21169 == NEW ==
21170 new
21171
21172 ==A==
21173 a
21174
21175 !! end
21176
21177 #### --------------- Lists ---------------
21178 #### 0. Outside nests (*foo, etc.)
21179 #### 1. Nested inside html <ul><li>*foo</li></ul>
21180 #### 2. Inside definition lists
21181 #### 3. Only bullets at start should be escaped
21182 #### 4. No escapes needed
21183 #### 5. No unnecessary escapes
21184 #### 6. Escape bullets in SOL position
21185 #### 7. Escape bullets in a multi-line context
21186 #### ----------------------------------------
21187
21188 !! test
21189 Lists: 0. Outside nests
21190 !! wikitext
21191 <nowiki>*</nowiki>foo
21192
21193 <nowiki>#</nowiki>foo
21194
21195 <nowiki>;Foo:</nowiki>bar
21196 !! html
21197 <p>*foo
21198 </p><p>#foo
21199 </p><p>;Foo:bar
21200 </p>
21201 !!end
21202
21203 !! test
21204 Lists: 1. Nested inside html
21205 !! wikitext
21206 *<nowiki>*foo</nowiki>
21207
21208 *<nowiki>#foo</nowiki>
21209
21210 *<nowiki>:foo</nowiki>
21211
21212 *<nowiki>;foo</nowiki>
21213
21214 #<nowiki>*foo</nowiki>
21215
21216 #<nowiki>#foo</nowiki>
21217
21218 #<nowiki>:foo</nowiki>
21219
21220 #<nowiki>;foo</nowiki>
21221 !! html
21222 <ul><li>*foo</li></ul>
21223 <ul><li>#foo</li></ul>
21224 <ul><li>:foo</li></ul>
21225 <ul><li>;foo</li></ul>
21226 <ol><li>*foo</li></ol>
21227 <ol><li>#foo</li></ol>
21228 <ol><li>:foo</li></ol>
21229 <ol><li>;foo</li></ol>
21230
21231 !!end
21232
21233 !! test
21234 Lists: 2. Inside definition lists
21235 !! wikitext
21236 ;<nowiki>;foo</nowiki>
21237
21238 ;<nowiki>:foo</nowiki>
21239
21240 ;<nowiki>:foo</nowiki>
21241 :bar
21242
21243 :<nowiki>:foo</nowiki>
21244 !! html
21245 <dl><dt>;foo</dt></dl>
21246 <dl><dt>:foo</dt></dl>
21247 <dl><dt>:foo</dt>
21248 <dd>bar</dd></dl>
21249 <dl><dd>:foo</dd></dl>
21250
21251 !!end
21252
21253 !! test
21254 Lists: 3. Only bullets at start of text should be escaped
21255 !! wikitext
21256 *<nowiki>*foo*bar</nowiki>
21257
21258 *<nowiki>*foo</nowiki>''it''*bar
21259 !! html
21260 <ul><li>*foo*bar</li></ul>
21261 <ul><li>*foo<i>it</i>*bar</li></ul>
21262
21263 !!end
21264
21265 !! test
21266 Lists: 4. No escapes needed
21267 !! options
21268 parsoid
21269 !! wikitext
21270 *foo*bar
21271
21272 *''foo''*bar
21273
21274 *[[Foo]]: bar
21275
21276 *[[Foo]]*bar
21277 !! html
21278 <ul>
21279 <li>foo*bar
21280 </li>
21281 </ul>
21282 <ul>
21283 <li><i>foo</i>*bar
21284 </li>
21285 </ul>
21286 <ul>
21287 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
21288 </li>
21289 </ul>
21290 <ul>
21291 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
21292 </li>
21293 </ul>
21294 !!end
21295
21296 !! test
21297 Lists: 5. No unnecessary escapes
21298 !! wikitext
21299 * bar <span><nowiki>[[foo]]</nowiki></span>
21300
21301 * =bar <span><nowiki>[[foo]]</nowiki></span>
21302
21303 * [[bar <span><nowiki>[[foo]]</nowiki></span>
21304
21305 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
21306
21307 * =bar <span>foo]]</span>=
21308
21309 * <s></s>: a
21310
21311 * ''* foo''
21312 !! html
21313 <ul><li> bar <span>[[foo]]</span></li></ul>
21314 <ul><li> =bar <span>[[foo]]</span></li></ul>
21315 <ul><li> [[bar <span>[[foo]]</span></li></ul>
21316 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
21317 <ul><li> =bar <span>foo]]</span>=</li></ul>
21318 <ul><li> <s></s>: a</li></ul>
21319 <ul><li> <i>* foo</i></li></ul>
21320
21321 !!end
21322
21323 !! test
21324 Lists: 6. Escape bullets in SOL position
21325 !! options
21326 parsoid=html2wt
21327 !! html
21328 <p><!--cmt-->*foo</p>
21329 !! wikitext
21330 <!--cmt--><nowiki>*</nowiki>foo
21331 !!end
21332
21333 !! test
21334 Lists: 7. Escape bullets in a multi-line context
21335 !! wikitext
21336 a
21337 <nowiki>*</nowiki>b
21338 !! html
21339 <p>a
21340 *b
21341 </p>
21342 !!end
21343
21344 !! test
21345 Lists: 8. Escape colons only if not present in tags
21346 !! options
21347 parsoid=html2wt
21348 !! html
21349 <dl><dt>a:b<i>c:d</i></dt></dl>
21350 !! wikitext
21351 ; <nowiki>a:b</nowiki>''c:d''
21352 !! end
21353
21354 #### --------------- HRs ---------------
21355 #### 1. Single line
21356 #### -----------------------------------
21357
21358 !! test
21359 HRs: 1. Single line
21360 !! wikitext
21361 ----<nowiki>----</nowiki>
21362 ----=foo=
21363 ----*foo
21364 !! html+tidy
21365 <hr />
21366 <p>----</p>
21367 <hr />
21368 <p>=foo=</p>
21369 <hr />
21370 <p>*foo</p>
21371 !! end
21372
21373 #### --------------- Tables ---------------
21374 #### 1a. Simple example
21375 #### 1b. No escaping needed (!foo)
21376 #### 1c. No escaping needed (|foo)
21377 #### 1d. No escaping needed (|}foo)
21378 ####
21379 #### 2a. Nested in td (<td>foo|bar</td>)
21380 #### 2b. Nested in td (<td>foo||bar</td>)
21381 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
21382 ####
21383 #### 3a. Nested in th (<th>foo!bar</th>)
21384 #### 3b. Nested in th (<th>foo!!bar</th>)
21385 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
21386 ####
21387 #### 4a. Escape -
21388 #### 4b. Escape +
21389 #### 4c. No escaping needed
21390 #### --------------------------------------
21391
21392 !! test
21393 Tables: 1a. Simple example
21394 !! wikitext
21395 <nowiki>{|
21396 |}</nowiki>
21397 !! html
21398 <p>{|
21399 |}
21400 </p>
21401 !! end
21402
21403 !! test
21404 Tables: 1b. No escaping needed
21405 !! wikitext
21406 !foo
21407 !! html
21408 <p>!foo
21409 </p>
21410 !! end
21411
21412 !! test
21413 Tables: 1c. No escaping needed
21414 !! wikitext
21415 |foo
21416 !! html
21417 <p>|foo
21418 </p>
21419 !! end
21420
21421 !! test
21422 Tables: 1d. No escaping needed
21423 !! wikitext
21424 |}foo
21425 !! html
21426 <p>|}foo
21427 </p>
21428 !! end
21429
21430 !! test
21431 Tables: 2a. Nested in td
21432 !! options
21433 parsoid=html2wt
21434 !! html/parsoid
21435 <table><tbody><tr>
21436 <td>foo|bar</td></tr>
21437 <tr><td>x<div>a|b</div></td>
21438 </tbody></table>
21439 !! wikitext
21440 {|
21441 |<nowiki>foo|bar</nowiki>
21442 |-
21443 |x<div><nowiki>a|b</nowiki></div>
21444 |}
21445 !! html/php+tidy
21446 <table>
21447 <tr>
21448 <td>foo|bar</td>
21449 </tr>
21450 <tr>
21451 <td>x
21452 <div>a|b</div>
21453 </td>
21454 </tr>
21455 </table>
21456 !! end
21457
21458 !! test
21459 Tables: 2b. Nested in td
21460 !! options
21461 parsoid=html2wt
21462 !! html/parsoid
21463 <table><tbody><tr>
21464 <td>foo||bar</td>
21465 <td>a<i>b||c</i></td>
21466 <td>a<i><div>b||c</div></i></td>
21467 </tr></tbody></table>
21468 !! wikitext
21469 {|
21470 |<nowiki>foo||bar</nowiki>
21471 |a''<nowiki>b||c</nowiki>''
21472 |a''<div><nowiki>b||c</nowiki></div>''
21473 |}
21474 !! html/php
21475 <table>
21476 <tr>
21477 <td>foo||bar
21478 </td>
21479 <td>a<i>b||c</i>
21480 </td>
21481 <td>a<i><div>b||c</div></i>
21482 </td></tr></table>
21483
21484 !! end
21485
21486 !! test
21487 Tables: 2c. Nested in td -- no escaping needed
21488 !! wikitext
21489 {|
21490
21491 |foo!!bar
21492 |}
21493 !! html/*
21494 <table>
21495
21496 <tr>
21497 <td>foo!!bar
21498 </td></tr></table>
21499
21500 !! end
21501
21502 !! test
21503 Tables: 3a. Nested in th
21504 !! wikitext
21505 {|
21506
21507 !foo!bar
21508 |}
21509 !! html/*
21510 <table>
21511
21512 <tr>
21513 <th>foo!bar
21514 </th></tr></table>
21515
21516 !! end
21517
21518 !! test
21519 Tables: 3b. Nested in th
21520 !! options
21521 parsoid=html2wt
21522 !! html/parsoid
21523 <table><tbody>
21524 <tr><th>foo!!bar</th>
21525 <th><i>foo|bar</i></th>
21526 <th><i>foo!!bar</i></th>
21527 <th><i><span>foo!!bar</span></i></th>
21528 </tr></tbody></table>
21529 !! wikitext
21530 {|
21531 !<nowiki>foo!!bar</nowiki>
21532 !''<nowiki>foo|bar</nowiki>''
21533 !''<nowiki>foo!!bar</nowiki>''
21534 !''<span><nowiki>foo!!bar</nowiki></span>''
21535 |}
21536 !! html/php
21537 <table>
21538 <tr>
21539 <th>foo!!bar
21540 </th>
21541 <th><i>foo|bar</i>
21542 </th>
21543 <th><i>foo!!bar</i>
21544 </th>
21545 <th><i><span>foo!!bar</span></i>
21546 </th></tr></table>
21547
21548 !! end
21549
21550 !! test
21551 Tables: 3c. Nested in th
21552 !! options
21553 parsoid=html2wt
21554 !! html/parsoid
21555 <table><tbody>
21556 <tr><th>foo||bar</th>
21557 <th><span typeof="mw:Nowiki">foo||bar</span></th>
21558 </tr></tbody></table>
21559 !! wikitext
21560 {|
21561 !<nowiki>foo||bar</nowiki>
21562 !<nowiki>foo||bar</nowiki>
21563 |}
21564 !! html/php
21565 <table>
21566 <tr>
21567 <th>foo||bar
21568 </th>
21569 <th>foo||bar
21570 </th></tr></table>
21571
21572 !! end
21573
21574 !! test
21575 Tables: 4a. Escape -
21576 !! options
21577 parsoid=html2wt
21578 !! html/*
21579 <table>
21580
21581 <tr>
21582 <th>-bar
21583 </th></tr>
21584 <tr>
21585 <td>-bar
21586 </td></tr></table>
21587
21588 !! wikitext
21589 {|
21590
21591 !-bar
21592
21593 |-
21594 |<nowiki>-bar</nowiki>
21595 |}
21596 !! end
21597
21598 !! test
21599 Tables: 4b. Escape +
21600 !! options
21601 parsoid=html2wt
21602 !! html/*
21603 <table>
21604
21605 <tr>
21606 <th>+bar
21607 </th></tr>
21608 <tr>
21609 <td>+bar
21610 </td></tr></table>
21611
21612 !! wikitext
21613 {|
21614
21615 !+bar
21616
21617 |-
21618 |<nowiki>+bar</nowiki>
21619 |}
21620 !! end
21621
21622 !! test
21623 Tables: 4c. No escaping needed
21624 !! wikitext
21625 {|
21626 |foo-bar
21627 |foo+bar
21628 |-
21629 |''foo''-bar
21630 |''foo''+bar
21631 |-
21632 |foo
21633 bar|baz
21634 +bar
21635 -bar
21636 |-
21637 |x
21638 <div>a|b</div>
21639 |}
21640 !! html/php
21641 <table>
21642 <tr>
21643 <td>foo-bar
21644 </td>
21645 <td>foo+bar
21646 </td></tr>
21647 <tr>
21648 <td><i>foo</i>-bar
21649 </td>
21650 <td><i>foo</i>+bar
21651 </td></tr>
21652 <tr>
21653 <td>foo
21654 <p>bar|baz
21655 +bar
21656 -bar
21657 </p>
21658 </td></tr>
21659 <tr>
21660 <td>x
21661 <div>a|b</div>
21662 </td></tr></table>
21663
21664 !! html/parsoid
21665 <table><tbody>
21666 <tr><td>foo-bar</td><td>foo+bar</td></tr>
21667 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
21668 <tr><td>foo
21669 <p>bar|baz
21670 +bar
21671 -bar</p></td></tr>
21672 <tr><td>x
21673 <div>a|b</div></td>
21674 </tbody></table>
21675 !! end
21676
21677 !! test
21678 Tables: 4d. No escaping needed
21679 !! wikitext
21680 {|
21681 |[[Foo]]-bar
21682 ||+1
21683 ||-2
21684 |}
21685 !! html/php
21686 <table>
21687 <tr>
21688 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
21689 </td>
21690 <td>+1
21691 </td>
21692 <td>-2
21693 </td></tr></table>
21694
21695 !! html/parsoid
21696 <table>
21697 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
21698 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
21699 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
21700 </tbody></table>
21701 !! end
21702
21703 !! test
21704 Tables: Digest broken attributes on table and tr tag
21705 !! options
21706 parsoid=wt2html
21707 !! wikitext
21708 {| || |} ++
21709 |- || || ++ --
21710 |- > [
21711 |}
21712 !! html
21713 <table>
21714 <tbody>
21715 <tr></tr>
21716 <tr></tr>
21717 </tbody></table>
21718 !! end
21719
21720 #### --------------- Links ----------------
21721 #### 1. Quote marks in link text
21722 #### 2. Wikilinks: Escapes needed
21723 #### 3. Wikilinks: No escapes needed
21724 #### 4. Extlinks: Escapes needed
21725 #### 5. Extlinks: No escapes needed
21726 #### --------------------------------------
21727 !! test
21728 Links 1. WikiLinks: No escapes needed
21729 !! wikitext
21730 [[Foo|Foo''boo'']]
21731 [[Foo|[Foobar]]]
21732 [[Foo|x [Foobar] x]]
21733 !! html/php
21734 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
21735 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
21736 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
21737 </p>
21738 !! html/parsoid
21739 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
21740 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
21741 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
21742 !! end
21743
21744 !! test
21745 Links 2. WikiLinks: Escapes needed
21746 !! options
21747 parsoid=html2wt
21748 !! html/parsoid
21749 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
21750 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
21751 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
21752 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
21753 <a href="Foo" rel="mw:WikiLink">|Bar</a>
21754 <a href="Foo" rel="mw:WikiLink">]]bar</a>
21755 <a href="Foo" rel="mw:WikiLink">[[bar</a>
21756 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
21757 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
21758 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
21759 !! wikitext
21760 [[Foo|<nowiki>Foobar]</nowiki>]]
21761 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
21762 [[Foo|<nowiki>[[Bar]]</nowiki>]]
21763 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
21764 [[Foo|<nowiki>|Bar</nowiki>]]
21765 [[Foo|<nowiki>]]bar</nowiki>]]
21766 [[Foo|<nowiki>[[bar</nowiki>]]
21767 [[Foo|<nowiki>x [[ y</nowiki>]]
21768 [[Foo|<nowiki>x ]] y</nowiki>]]
21769 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
21770 !! html/php
21771 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
21772 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
21773 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
21774 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
21775 <a href="/wiki/Foo" title="Foo">|Bar</a>
21776 <a href="/wiki/Foo" title="Foo">]]bar</a>
21777 <a href="/wiki/Foo" title="Foo">[[bar</a>
21778 <a href="/wiki/Foo" title="Foo">x [[ y</a>
21779 <a href="/wiki/Foo" title="Foo">x ]] y</a>
21780 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
21781 </p>
21782 !! end
21783
21784 !! test
21785 Links 3. WikiLinks: No escapes needed
21786 !! wikitext
21787 [[Foo|[Foobar]]
21788 [[Foo|foo|bar]]
21789 !! html/php
21790 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
21791 <a href="/wiki/Foo" title="Foo">foo|bar</a>
21792 </p>
21793 !! html/parsoid
21794 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
21795 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
21796 !! end
21797
21798 !! test
21799 Links 4. ExtLinks: Escapes needed
21800 !! options
21801 parsoid=html2wt
21802 !! html/parsoid
21803 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
21804 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
21805 <p>[http://google.com]</p>
21806 <p>[http://google.com google]</p>
21807 !! wikitext
21808 [http://google.com <nowiki>[google]</nowiki>]
21809 [http://google.com <nowiki>google]</nowiki>]
21810
21811 <nowiki>[http://google.com]</nowiki>
21812
21813 <nowiki>[http://google.com google]</nowiki>
21814
21815 !! html/php
21816 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
21817 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
21818 </p><p>[http://google.com]
21819 </p><p>[http://google.com google]
21820 </p>
21821 !! end
21822
21823 !! test
21824 Links 5. ExtLinks: No escapes needed
21825 !! wikitext
21826 [http://google.com [google]
21827 !! html/php
21828 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
21829 </p>
21830 !! html/parsoid
21831 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
21832 !! end
21833
21834 !! test
21835 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
21836 !! html/parsoid
21837 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
21838 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
21839 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
21840 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
21841 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
21842 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
21843 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21844 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
21845 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21846 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
21847 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
21848 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
21849 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
21850 </p>
21851 !! wikitext
21852 x<nowiki/>http://example.com<nowiki/>y
21853 http://example.com<nowiki/>?x
21854 http://example.com<nowiki/>&x
21855 http://example.com<nowiki/>'x
21856 http://example.com<nowiki/>,x
21857 http://example.com<nowiki/>.x
21858 http://example.com<nowiki/>;x
21859 http://example.com<nowiki/>:x
21860 http://example.com<nowiki/>;x
21861 http://example.com<nowiki/>!x
21862 http://example.com<nowiki/>=x
21863 http://example.com<nowiki/>(x)
21864 http://example.com(x<nowiki/>)
21865 !! end
21866
21867 !! test
21868 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21869 !! html/parsoid
21870 <p>x
21871 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
21872 y
21873 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
21874 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
21875 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
21876 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
21877 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
21878 </p>
21879 !! wikitext
21880 x
21881 http://example.com
21882 y
21883 "http://example.com"
21884 (http://example.com)
21885 (http://example.com) foo
21886 http://example.com,
21887 http://example.com, foo
21888 !! html/php
21889 <p>x
21890 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
21891 y
21892 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
21893 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
21894 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
21895 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
21896 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
21897 </p>
21898 !! end
21899
21900 !! test
21901 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21902 !! html/parsoid
21903 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
21904 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
21905 !! wikitext
21906 http://example.com.,;:!?\
21907 -http://example.com:
21908 !! html/php
21909 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
21910 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
21911 </p>
21912 !! end
21913
21914 !! test
21915 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
21916 !! html/parsoid
21917 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
21918 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
21919 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
21920 !! wikitext
21921 RFC 123<nowiki/>4
21922 RFC 123<nowiki/>y
21923 X<nowiki/>RFC 123<nowiki/>y
21924 !! end
21925
21926 !! test
21927 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
21928 !! html/parsoid
21929 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
21930 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
21931 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
21932 </p>
21933 !! wikitext
21934 RFC 123?foo
21935 RFC 123&foo
21936 -RFC 123-
21937 !! html/php
21938 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
21939 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
21940 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
21941 </p>
21942 !! end
21943
21944 !! test
21945 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
21946 !! html/parsoid
21947 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
21948 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21949 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21950 !! wikitext
21951 PMID 123<nowiki/>4
21952 PMID 123<nowiki/>y
21953 X<nowiki/>PMID 123<nowiki/>y
21954 !! end
21955
21956 !! test
21957 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
21958 !! html/parsoid
21959 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
21960 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
21961 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
21962 </p>
21963 !! wikitext
21964 PMID 123?foo
21965 PMID 123&foo
21966 -PMID 123-
21967 !! html/php
21968 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
21969 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
21970 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
21971 </p>
21972 !! end
21973
21974 !! test
21975 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
21976 !! html/parsoid
21977 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
21978 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
21979 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
21980 </p>
21981 !! wikitext
21982 ISBN 1234567890<nowiki/>1
21983 ISBN 1234567890<nowiki/>x
21984 a<nowiki/>ISBN 1234567890<nowiki/>b
21985 !! end
21986
21987 !! test
21988 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
21989 !! html/parsoid
21990 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
21991 !! wikitext
21992 -ISBN 1234567890's
21993 !! html/php
21994 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
21995 </p>
21996 !! end
21997
21998 !! test
21999 Links 14. Protect link-like plain text. (Parsoid bug T78425)
22000 !! options
22001 parsoid=html2wt
22002 !! html/*
22003 <p>this is not a link: http://example.com
22004 </p>
22005 !! wikitext
22006 this is not a link: <nowiki>http://example.com</nowiki>
22007 !! end
22008
22009 !! test
22010 Links 15. Link trails can't become link prefixes.
22011 !! options
22012 language=is
22013 !! wikitext
22014 [[Söfnuður]]-[[00]]
22015 !! html/php
22016 <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>
22017 </p>
22018 !! html/parsoid
22019 <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>
22020 !! end
22021
22022 #### --------------- Quotes ---------------
22023 #### 1. Quotes inside <b> and <i>
22024 #### 2. Link fragments separated by <i> and <b> tags
22025 #### 3. Link fragments inside <i> and <b>
22026 #### 4. No escaping needed
22027 #### --------------------------------------
22028 !! test
22029 1a. Quotes inside <b> and <i>
22030 !! options
22031 parsoid=html2wt,wt2wt
22032 !! wikitext
22033 ''<nowiki/>'foo'''
22034 ''<nowiki>''foo''</nowiki>''
22035 ''<nowiki>'''foo'''</nowiki>''
22036 ''foo''<nowiki/>'s
22037 '''<nowiki/>'foo''''
22038 '''<nowiki>''foo''</nowiki>'''
22039 '''<nowiki>'''foo'''</nowiki>'''
22040 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
22041 '''foo'''<nowiki/>'s
22042 '''foo''
22043 ''foo''<nowiki/>'
22044 ''foo'''<nowiki/>'
22045 '''foo''<nowiki/>'
22046 ''''foo'''
22047 '''foo'''<nowiki/>'
22048 ''''foo'''<nowiki/>'
22049 ''fools'<span> errand</span>''
22050 ''<span>fool</span>'s errand''
22051 '<nowiki/>''foo'' bar '''baz''
22052 a|!*#-:;+-~[]{}b'''x''
22053 !! html/*
22054 <p><i>'foo'</i>
22055 <i>''foo''</i>
22056 <i>'''foo'''</i>
22057 <i>foo</i>'s
22058 <b>'foo'</b>
22059 <b>''foo''</b>
22060 <b>'''foo'''</b>
22061 <b>foo'<i>bar'</i>baz</b>
22062 <b>foo</b>'s
22063 '<i>foo</i>
22064 <i>foo</i>'
22065 <i>foo'</i>'
22066 '<i>foo</i>'
22067 '<b>foo</b>
22068 <b>foo</b>'
22069 '<b>foo</b>'
22070 <i>fools'<span> errand</span></i>
22071 <i><span>fool</span>'s errand</i>
22072 '<i>foo</i> bar '<i>baz</i>
22073 a|!*#-:;+-~[]{}b'<i>x</i>
22074 </p>
22075 !! end
22076
22077 !! test
22078 1b. Quotes inside <b> and <i> with other tags on same line
22079 !! options
22080 parsoid=html2wt,wt2wt
22081 !! wikitext
22082 '''a'' foo ''[[bar]]''
22083 ''a''' foo ''[[bar]]''
22084 ''a''' foo '''{{echo|[[bar]]}}'''
22085 [[foo]] x'''[[bar]]''
22086 '''foo'' <ref>test</ref>
22087 '''foo'' <div title="name">test</div>
22088 '''foo'' and <br> bar
22089 <references />
22090 !! html
22091 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22092 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22093 <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>
22094 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
22095 '<i>foo</i> <span class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
22096 '<i>foo</i> <div title="name">test</div>
22097 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
22098 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22099 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">test</span></li>
22100 </ol>
22101 !! end
22102
22103 !! test
22104 2. Link fragments separated by <i> and <b> tags
22105 !! wikitext
22106 [[''foo''<nowiki>hello]]</nowiki>
22107
22108 [['''foo'''<nowiki>hello]]</nowiki>
22109 !! html
22110 <p>[[<i>foo</i>hello]]
22111 </p><p>[[<b>foo</b>hello]]
22112 </p>
22113 !! end
22114
22115 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
22116 # this is one of the shortcomings of this format
22117 !! test
22118 3. Link fragments inside <i> and <b>
22119 !! wikitext
22120 ''[[foo''<nowiki>]]</nowiki>
22121
22122 '''[[foo'''<nowiki>]]</nowiki>
22123 !! html
22124 <p><i>[[foo</i>]]
22125 </p><p><b>[[foo</b>]]
22126 </p>
22127 !! end
22128
22129 !! test
22130 4. No escaping needed
22131 !! wikitext
22132 '<span>''bar''</span>'
22133 '<span>'''bar'''</span>'
22134 'a:b'foo
22135 !! html
22136 <p>'<span><i>bar</i></span>'
22137 '<span><b>bar</b></span>'
22138 'a:b'foo
22139 </p>
22140 !! end
22141
22142 #### ----------- Paragraphs ---------------
22143 #### 1. No unnecessary escapes
22144 #### --------------------------------------
22145
22146 !! test
22147 1. No unnecessary escapes
22148 !! wikitext
22149 bar <span><nowiki>[[foo]]</nowiki></span>
22150
22151 =bar <span><nowiki>[[foo]]</nowiki></span>
22152
22153 [[bar <span><nowiki>[[foo]]</nowiki></span>
22154
22155 ]]bar <span><nowiki>[[foo]]</nowiki></span>
22156
22157 =bar <span>foo]]</span><nowiki>=</nowiki>
22158 !! html
22159 <p>bar <span>[[foo]]</span>
22160 </p><p>=bar <span>[[foo]]</span>
22161 </p><p>[[bar <span>[[foo]]</span>
22162 </p><p>]]bar <span>[[foo]]</span>
22163 </p><p>=bar <span>foo]]</span>=
22164 </p>
22165 !!end
22166
22167 #### ----------------------- PRE --------------------------
22168 #### 1. Leading whitespace in SOL context should be escaped
22169 #### ------------------------------------------------------
22170 !! test
22171 1. Leading whitespace in SOL context should be escaped
22172 !! options
22173 parsoid
22174 !! wikitext
22175 <nowiki> </nowiki>a
22176
22177 <nowiki> </nowiki> a
22178
22179 <nowiki> </nowiki>a(tab)
22180
22181 <nowiki> </nowiki> a
22182 <!--cmt-->
22183 <nowiki> </nowiki> a
22184
22185 a
22186 <nowiki> </nowiki>b
22187
22188 a
22189 <nowiki> </nowiki>b
22190
22191 a
22192 <nowiki> </nowiki> b
22193 !! html
22194 <p> a</p>
22195 <p> a</p>
22196 <p> a(tab)</p>
22197 <p> a</p>
22198 <p><!--cmt--> a</p>
22199 <p>a
22200 b</p>
22201 <p>a
22202 b</p>
22203 <p>a
22204 b</p>
22205 !! end
22206
22207 !! test
22208 2. Leading whitespace in non-indent-pre contexts should not be escaped
22209 !! options
22210 parsoid
22211 !! wikitext
22212 foo <ref>''a''
22213 b</ref>
22214 <references />
22215 !! html
22216 <p>foo <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
22217 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22218 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><i data-parsoid='{"dsr":[9,14,2,2]}'>a</i>
22219 b</span></li>
22220 </ol>
22221 !! end
22222
22223 !! test
22224 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
22225 !! options
22226 parsoid
22227 !! wikitext
22228 <blockquote>
22229 a
22230 <span>b</span>
22231 c
22232 </blockquote>
22233 !! html
22234 <blockquote>
22235 <p>
22236 a
22237 <span>b</span>
22238 c</p>
22239 </blockquote>
22240 !! end
22241
22242 !! test
22243 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
22244 !! options
22245 parsoid
22246 !! wikitext
22247 [[File:Foobar.jpg|thumb|caption]]
22248 !! html/parsoid
22249 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
22250 !! end
22251
22252 !! test
22253 5. Nowiki escaping should account for indent-pres
22254 !! options
22255 parsoid=html2wt
22256 !! html
22257 <pre>==foo==</pre>
22258 !! wikitext
22259 ==foo==
22260 !! end
22261
22262 #### --------------- Behavior Switches --------------------
22263 !! test
22264 1. Valid behavior switches should be escaped
22265 !! options
22266 parsoid=html2wt
22267 !! html
22268 __TOC__
22269 <i>__TOC__</i>
22270 !! wikitext
22271 <nowiki>__TOC__</nowiki>
22272 ''<nowiki>__TOC__</nowiki>''
22273 !! end
22274
22275 !! test
22276 2. Invalid behavior switches should not be escaped
22277 !! options
22278 parsoid=html2wt
22279 !! html
22280 __TOO__
22281 __|__
22282 !! wikitext
22283 __TOO__
22284 __|__
22285 !! end
22286
22287 #### --------------- HTML tags ---------------
22288 #### 1. a tags
22289 #### 2. other tags
22290 #### 3. multi-line html tag
22291 #### 4. extension tags
22292 #### -----------------------------------------
22293 !! test
22294 1. a tags
22295 !! options
22296 parsoid
22297 !! wikitext
22298 <a href="http://google.com">google</a>
22299 !! html
22300 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
22301 !! end
22302
22303 !! test
22304 2. other tags
22305 !! wikitext
22306 * <nowiki><div>foo</div></nowiki>
22307 * <nowiki><div style="color:red">foo</div></nowiki>
22308 * <nowiki><td></nowiki>
22309 !! html
22310 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
22311 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
22312 <li> &lt;td&gt;</li></ul>
22313
22314 !! end
22315
22316 !! test
22317 3. multi-line html tag
22318 !! wikitext
22319 <nowiki><div
22320 >foo</div
22321 ></nowiki>
22322 !! html
22323 <p>&lt;div
22324 &gt;foo&lt;/div
22325 &gt;
22326 </p>
22327 !! end
22328
22329 !! test
22330 4. extension tags
22331 !! wikitext
22332 <nowiki><ref>foo</ref></nowiki>
22333
22334 <nowiki><ref>bar</nowiki>
22335
22336 baz<nowiki></ref></nowiki>
22337 !! html
22338 <p>&lt;ref&gt;foo&lt;/ref&gt;
22339 </p><p>&lt;ref&gt;bar
22340 </p><p>baz&lt;/ref&gt;
22341 </p>
22342 !! end
22343
22344 #### --------------- Others ---------------
22345 !! test
22346 Escaping nowikis
22347 !! wikitext
22348 &lt;nowiki&gt;foo&lt;/nowiki&gt;
22349 !! html
22350 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
22351 </p>
22352 !! end
22353
22354 ## The quote-char in the input is necessary for triggering the bug
22355 !! test
22356 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
22357 !! options
22358 parsoid=wt2wt,html2wt
22359 !! wikitext
22360 foo's bar :
22361 !! html
22362 <p>foo's bar :</p>
22363 !! end
22364
22365 !! test
22366
22367 Tag-like HTML structures are passed through as text
22368 !! wikitext
22369 <x y>
22370
22371 <x.y>
22372
22373 <x-y>
22374
22375 1>2
22376
22377 x<y
22378
22379 a>b
22380
22381 1<d e>f
22382 !! html
22383 <p>&lt;x y&gt;
22384 </p><p>&lt;x.y&gt;
22385 </p><p>&lt;x-y&gt;
22386 </p><p>1&gt;2
22387 </p><p>x&lt;y
22388 </p><p>a&gt;b
22389 </p><p>1&lt;d e&gt;f
22390 </p>
22391 !! end
22392
22393 !! test
22394 HTML tag with necessary entities in attributes
22395 !! wikitext
22396 <span title="&amp;amp;">foo</span>
22397 !! html
22398 <p><span title="&amp;amp;">foo</span>
22399 </p>
22400 !! end
22401
22402 !! test
22403 HTML tag with 'unnecessary' entity encoding in attributes
22404 !! wikitext
22405 <span title="&amp;">foo</span>
22406 !! html
22407 <p><span title="&amp;">foo</span>
22408 </p>
22409 !! end
22410
22411 !! test
22412 HTML tag with broken attribute value quoting
22413 !! wikitext
22414 <span title="Hello world>Foo</span>
22415 !! html/php
22416 <p><span>Foo</span>
22417 </p>
22418 !! html/parsoid
22419 <p><span title="Hello world">Foo</span>
22420 </p>
22421 !! end
22422
22423 !! test
22424 Parsoid-only: HTML tag with broken attribute value quoting
22425 !! options
22426 parsoid
22427 !! wikitext
22428 <span title="Hello world>Foo</span>
22429 !! html
22430 <p><span title="Hello world">Foo</span>
22431 </p>
22432 !! end
22433
22434 !! test
22435 Table with broken attribute value quoting
22436 !! wikitext
22437 {|
22438 | title="Hello world|Foo
22439 |}
22440 !! html/php
22441 <table>
22442 <tr>
22443 <td>Foo
22444 </td></tr></table>
22445
22446 !! html/parsoid
22447 <table>
22448 <tr>
22449 <td title="Hello world">Foo
22450 </td></tr></table>
22451
22452 !! end
22453
22454 !! test
22455 Table with broken attribute value quoting on consecutive lines
22456 !! wikitext
22457 {|
22458 | title="Hello world|Foo
22459 | style="color:red|Bar
22460 |}
22461 !! html/php
22462 <table>
22463 <tr>
22464 <td>Foo
22465 </td>
22466 <td>Bar
22467 </td></tr></table>
22468
22469 !! html/parsoid
22470 <table><tbody>
22471 <tr>
22472 <td title="Hello world">Foo
22473 </td><td style="color: red">Bar
22474 </td></tr></tbody></table>
22475
22476 !! end
22477
22478 !! test
22479 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
22480 !! options
22481 parsoid
22482 !! wikitext
22483 {{}}
22484 !! html
22485 {{}}
22486 !! end
22487
22488 !! test
22489 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
22490 !! options
22491 parsoid
22492 !! wikitext
22493 }}{{
22494 !! html
22495 }}{{
22496 !! end
22497
22498 !!test
22499 Accept empty td cell attribute
22500 !! wikitext
22501 {|
22502 | align="center" | foo || |
22503 |}
22504 !! html
22505 <table>
22506 <tr>
22507 <td align="center"> foo </td>
22508 <td>
22509 </td></tr></table>
22510
22511 !!end
22512
22513 !!test
22514 Non-empty attributes in th-cells
22515 !! wikitext
22516 {|
22517 ! Foo !! style="color: red" | Bar
22518 |}
22519 !! html
22520 <table>
22521 <tr>
22522 <th> Foo </th>
22523 <th style="color: red"> Bar
22524 </th></tr></table>
22525
22526 !!end
22527
22528 !!test
22529 Accept empty attributes in th-cells
22530 !! wikitext
22531 {|
22532 !| foo !!| bar
22533 |}
22534 !! html
22535 <table>
22536 <tr>
22537 <th> foo </th>
22538 <th> bar
22539 </th></tr></table>
22540
22541 !!end
22542
22543 !!test
22544 Empty table rows go away
22545 !! wikitext
22546 {|
22547 | Hello
22548 | there
22549 |- class="foo"
22550 |-
22551 |}
22552 !! html
22553 <table>
22554 <tr>
22555 <td> Hello
22556 </td>
22557 <td> there
22558 </td></tr>
22559
22560 </table>
22561
22562 !! end
22563
22564 ###
22565 ### Parsoid-centric tests for testing RTing of inter-element separators
22566 ### Edge cases not tested by existing parser tests and specific to
22567 ### Parsoid-specific serialization strategies.
22568 ###
22569
22570 !!test
22571 RT-ed inter-element separators should be valid separators
22572 !! wikitext
22573 {|
22574 |- [[foo]]
22575 |}
22576 !! html
22577 <table>
22578
22579 </table>
22580
22581 !!end
22582
22583 # Parsoid-only since PHP parser relies on Tidy for correct output
22584 !!test
22585 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
22586 !!options
22587 parsoid
22588 !! wikitext
22589 {|
22590 |<small>foo
22591 bar
22592 |}
22593
22594 {|
22595 |<small>foo<small>
22596 |}
22597 !! html
22598 <table>
22599 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
22600 <p>bar</p></small></td></tr>
22601 </tbody></table>
22602
22603 <table>
22604 <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>
22605 </tbody></table>
22606 !!end
22607
22608 !!test
22609 Empty TD followed by TD with tpl-generated attribute
22610 !! wikitext
22611 {|
22612 |-
22613 |
22614 |{{echo|style='color:red'}}|foo
22615 |}
22616 !! html
22617 <table>
22618
22619 <tr>
22620 <td>
22621 </td>
22622 <td>foo
22623 </td></tr></table>
22624
22625 !!end
22626
22627 !!test
22628 Indented table with an empty td
22629 !! wikitext
22630 {|
22631 |-
22632 |
22633 |foo
22634 |}
22635 !! html
22636 <table>
22637
22638 <tr>
22639 <td>
22640 </td>
22641 <td>foo
22642 </td></tr></table>
22643
22644 !!end
22645
22646 ## We have some newline diffs RT-ing this edge case
22647 ## and it is not important enough -- we seem to be emitting
22648 ## at most 2 newlines after a </tr> and this is unrelated to
22649 ## the issue from T85627 that this is testing.
22650 !!test
22651 Indented table with blank lines in between (T85627)
22652 !! options
22653 parsoid=wt2html
22654 !! wikitext
22655 {|
22656 |foo
22657
22658
22659 |}
22660 !! html
22661 <table>
22662
22663 <tr>
22664 <td>foo
22665 </td></tr></table>
22666
22667 !!end
22668
22669 !!test
22670 Indented block & table
22671 !! wikitext
22672 <div>foo</div>
22673 {|
22674 |foo
22675 |}
22676 !! html/php
22677 <div>foo</div>
22678 <table>
22679 <tr>
22680 <td>foo
22681 </td></tr></table>
22682
22683 !! html/parsoid
22684 <div data-parsoid='{"stx":"html"}'>foo</div>
22685 <table><tbody>
22686 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
22687 </tbody></table>
22688 !!end
22689
22690 !! test
22691 Indent and comment before table row
22692 !! wikitext
22693 {|
22694 <!--hi-->|-
22695 | there
22696 |}
22697 !! html/php
22698 <table>
22699
22700 <tr>
22701 <td> there
22702 </td></tr></table>
22703
22704 !! html/parsoid
22705 <table>
22706 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
22707 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
22708 </tbody></table>
22709 !! end
22710
22711 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
22712 !!test
22713 Empty TR followed by a template-generated TR
22714 !!options
22715 parsoid
22716 !! wikitext
22717 {|
22718 |-
22719 {{echo|<tr><td>foo</td></tr>}}
22720 |}
22721 !! html
22722 <table>
22723 <tbody>
22724 <tr></tr>
22725 <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}}]}'>
22726 <td>foo</td></tr>
22727 </tbody></table>
22728 !!end
22729
22730 ## PHP and parsoid output differ for this, and since this is primarily
22731 ## for testing Parsoid's serializer, marking this Parsoid only
22732 !!test
22733 Empty TR followed by mixed-ws-comment line should RT correctly
22734 !!options
22735 parsoid
22736 !! wikitext
22737 {|
22738 |-
22739 <!--c-->
22740 |-
22741 <!--c--> <!--d-->
22742 |}
22743 !! html
22744 <table>
22745 <tbody>
22746 <tr></tr>
22747 <!--c-->
22748 <tr>
22749 <!--c--> </tr><!--d-->
22750 </tbody></table>
22751
22752 !!end
22753
22754 !!test
22755 Multi-line image caption generated by templates with/without trailing newlines
22756 !! wikitext
22757 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
22758 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
22759 !! html/parsoid
22760 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" 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>
22761 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" 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>
22762 !!end
22763
22764 !! test
22765 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
22766 !! options
22767 parsoid=html2wt
22768 !! html
22769 <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>
22770
22771 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
22772 !! wikitext
22773 <includeonly>foo</includeonly>
22774 new para
22775
22776 [[Category:Foo]]
22777
22778 = new heading =
22779 !! end
22780
22781 ## PHP emits broken html for this, and since this is primarily
22782 ## a Parsoid serializer test, marking this Parsoid only
22783 !!test
22784 Improperly nested inline or quotes tags with whitespace in between
22785 !!options
22786 parsoid
22787 !! wikitext
22788 <span> <s>x</span> </s>
22789 ''' ''x''' ''
22790 !! html
22791 <p><span> <s>x</s></span><s> </s>
22792 <b> <i>x</i></b><i> </i>
22793 </p>
22794 !!end
22795
22796 !!test
22797 Encapsulate protected attributes from wt
22798 !!options
22799 parsoid
22800 !! wikitext
22801 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
22802 !! html
22803 <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>
22804 </body>
22805 !!end
22806
22807 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
22808 ## Having nested or stray pre tags results in the attempt to add duplicates,
22809 ## causing an assertion fail. This test tries to prevent that situation.
22810 !!test
22811 Ensure ParagraphWrapper can deal with stray closing pre tags
22812 !!options
22813 parsoid=wt2html
22814 !! wikitext
22815 plain text</pre>
22816 !! html
22817 plain text
22818 !!end
22819
22820 !!test
22821 1. Ensure fostered text content is wrapped in element nodes
22822 !!options
22823 parsoid=wt2html
22824 !! wikitext
22825 <table>hi</table><table>ho</table>
22826 !! html
22827 <p>hi</p>
22828 <table></table>
22829 <p>ho</p>
22830 <table></table>
22831 !!end
22832
22833 !!test
22834 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
22835 !!options
22836 parsoid=wt2html,wt2wt
22837 !! wikitext
22838 <table>
22839 <tr> || ||
22840 <td> a
22841 </table>
22842 !! html
22843 <p> || ||
22844 </p><table>
22845 <tbody><tr><td> a</td></tr>
22846 </tbody></table>
22847 !!end
22848
22849 !!test
22850 Encapsulation properly handles null DSR information from foster box
22851 !!options
22852 parsoid=wt2html,wt2wt
22853 !! wikitext
22854 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
22855 !! html
22856 <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>
22857 !!end
22858
22859 !!test
22860 1. Encapsulate foster-parented transclusion content
22861 !!options
22862 parsoid=wt2wt,wt2html
22863 !! wikitext
22864 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
22865 !! html
22866 <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>
22867 <tbody>
22868 <tr>
22869 <td>bar</td>
22870 </tr>
22871 </tbody>
22872 </table>
22873 !!end
22874
22875 !!test
22876 2. Encapsulate foster-parented transclusion content
22877 !!options
22878 parsoid=wt2wt,wt2html
22879 !! wikitext
22880 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
22881 !! html
22882 <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>
22883 <table>
22884 <tbody>
22885 <tr>
22886 <td>bar</td>
22887 </tr>
22888 </tbody>
22889 </table>
22890 !!end
22891
22892 !!test
22893 3. Encapsulate foster-parented transclusion content
22894 !!options
22895 parsoid=wt2wt,wt2html
22896 !! wikitext
22897 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22898 !! html
22899 <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;]}">
22900 <p>foo</p>
22901 </div>
22902 <table>
22903 <tbody>
22904 <tr>
22905 <td>bar</td>
22906 </tr>
22907 </tbody>
22908 </table>
22909 !!end
22910
22911 !!test
22912 4. Encapsulate foster-parented transclusion content
22913 !!options
22914 parsoid=wt2wt,wt2html
22915 !! wikitext
22916 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22917 !! html
22918 <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;]}">
22919 <p>foo</p>
22920 </div>
22921 <table>
22922 <tbody>
22923 <tr>
22924 <td>bar</td>
22925 </tr>
22926 </tbody>
22927 </table>
22928 !!end
22929
22930 !!test
22931 5. Encapsulate foster-parented transclusion content
22932 !!options
22933 parsoid=wt2wt,wt2html
22934 !! wikitext
22935 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
22936 !! html
22937 <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>
22938 <table>
22939 <tbody>
22940 <tr>
22941 <td>
22942 <div>
22943 <p>foo</p>
22944 </div>
22945 </td>
22946 </tr>
22947 </tbody>
22948 </table>
22949 !!end
22950
22951 !!test
22952 6. Encapsulate foster-parented transclusion content
22953 !!options
22954 parsoid=wt2wt,wt2html
22955 !! wikitext
22956 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
22957 !! html
22958 <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>
22959 <table>
22960 <tbody>
22961 <tr>
22962 <td>
22963 <div>
22964 <p>foo</p>
22965 </div>
22966 </td>
22967 </tr>
22968 </tbody>
22969 </table>
22970 <p>ok</p>
22971 !!end
22972
22973 !!test
22974 7. Encapsulate foster-parented transclusion content
22975 !!options
22976 parsoid=wt2wt,wt2html
22977 !! wikitext
22978 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
22979 !! html
22980 <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>
22981 <table>
22982 <tbody>
22983 <tr>
22984 <td>bar</td>
22985 </tr>
22986 </tbody>
22987 </table>
22988 !!end
22989
22990 !!test
22991 8. Encapsulate foster-parented transclusion content
22992 !!options
22993 parsoid=wt2wt,wt2html
22994 !! wikitext
22995 {{echo|a
22996 }}{|{{echo|style='color:red'}}
22997 |-
22998 |b
22999 |}
23000 !! html
23001 <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>
23002 <tbody>
23003 <tr>
23004 <td>b</td>
23005 </tr>
23006 </tbody>
23007 </table>
23008 !!end
23009
23010 !!test
23011 9. Encapsulate foster-parented transclusion content
23012 !!options
23013 parsoid=wt2wt,wt2html
23014 !! wikitext
23015 <table>{{echo|hi</table>hello}}
23016 !! html
23017 <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>
23018 !!end
23019
23020 !!test
23021 Table in fosterable position
23022 !!options
23023 parsoid=wt2html,wt2wt
23024 !! wikitext
23025 {{OpenTable}}
23026 <div>
23027 {|
23028 |}
23029 </div>
23030 |}
23031 !! html
23032 <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">
23033 </span>
23034 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
23035
23036 <table>
23037 </table>
23038 !!end
23039
23040 # Parsoid only for bug 64747
23041 !! test
23042 Properly encapsulate empty-content transclusions in fosterable positions
23043 !! wikitext
23044 <table>
23045 {{#if:|
23046 <td>foo</td>
23047 }}
23048 </table>
23049 !! html/parsoid
23050 <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":["","","",""]}]]}'>
23051
23052 </table>
23053 !! end
23054
23055 !!test
23056 Support <object> element with .data attribute
23057 !!options
23058 parsoid=html2wt
23059 !! html
23060 <object data="test.swf"></object>
23061 !! wikitext
23062 <object data="test.swf"></object>
23063 !!end
23064
23065 !! test
23066 Don't block XML namespace declaration
23067 !! wikitext
23068 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
23069 !! html/php
23070 <p><span>MediaWiki</span>
23071 </p>
23072 !! html/parsoid
23073 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
23074 !! end
23075
23076 # -----------------------------------------------------------------
23077 # The following section of tests are primarily to spec requirements
23078 # around serialization of new/edited content.
23079 #
23080 # All these tests are marked Parsoid html2wt and html2html only
23081 # ----------------------------------------------------------------
23082
23083 # 'mi' is a localinterwiki prefix as well as a language
23084 !! test
23085 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
23086 !! options
23087 parsoid=html2wt
23088 !! html
23089 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
23090 !! wikitext
23091 [[Foo]]
23092 !! end
23093
23094 # See T93839
23095 !! test
23096 New wikilinks should be serialized properly
23097 !! options
23098 parsoid=html2wt
23099 !! html
23100 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
23101 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
23102 !! wikitext
23103 [[Foo]]
23104 [[Foo]]
23105 !! end
23106
23107 !! test
23108 New wiki links (href variations)
23109 !! options
23110 parsoid=html2wt
23111 !! html
23112 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23113 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
23114 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
23115 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
23116 !! wikitext
23117 [[Foo_bar]]
23118 [[Foo_bar]]
23119 [[Foo_bar]]
23120 [[Toxine bactérienne]]
23121 !! end
23122
23123 !! test
23124 New wiki links (content string variations)
23125 !! options
23126 parsoid=html2wt
23127 !! html
23128 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23129 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
23130 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
23131 !! wikitext
23132 [[Foo_bar]]
23133 [[Foo bar]]
23134 [[Foo_bar|./Foo_bar]]
23135 !! end
23136
23137 !! test
23138 New category links (href variations)
23139 !! options
23140 parsoid=html2wt
23141 !! html
23142 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
23143 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
23144 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
23145 !! wikitext
23146 [[Category:Toxine bactérienne]]
23147 [[Category:Toxine bactérienne]]
23148 [[Category:Toxine bactérienne]]
23149 !! end
23150
23151 !! test
23152 New sol transparent links don't need indent-pre nowiki protection
23153 !! options
23154 parsoid=html2wt
23155 language=de
23156 !! html
23157 <link rel="mw:PageProp/redirect" href="./Main_Page">
23158 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
23159 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
23160 !! wikitext
23161 #WEITERLEITUNG [[Main Page]]
23162 <!-- this is good --> [[Category:Good]]
23163 <!-- this is great --> [[Kategorie:Great]]
23164 !! end
23165
23166 !! test
23167 New interlanguage links (href variations)
23168 !! options
23169 parsoid=html2wt
23170 !! html
23171 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
23172 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
23173 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
23174 !! wikitext
23175 [[es:Toxine bactérienne]]
23176 [[es:Toxine_bactérienne]]
23177 [[es:Toxine_bactérienne]]
23178 !! end
23179
23180 !! test
23181 Image: Modifying size of an image (1)
23182 !! options
23183 parsoid={
23184 "modes": ["wt2wt"],
23185 "changes": [
23186 ["img[height]", "attr", "height", "22"],
23187 ["img[width]", "attr", "width", "200"]
23188 ]
23189 }
23190 !! wikitext
23191 [[Image:Foobar.jpg|230x230px]]
23192 !! wikitext/edited
23193 [[Image:Foobar.jpg|200x200px]]
23194 !!end
23195
23196 !! test
23197 Image: Modifying size of an image (2)
23198 !! options
23199 parsoid={
23200 "modes": ["wt2wt"],
23201 "changes": [
23202 ["img[height]", "attr", "height", "100"],
23203 ["img[width]", "attr", "width", "500"]
23204 ]
23205 }
23206 !! wikitext
23207 [[Image:Foobar.jpg|230x230px]]
23208 !! wikitext/edited
23209 [[Image:Foobar.jpg|500x500px]]
23210 !!end
23211
23212 # Change in size is ignored so long as class='mw-default-size'
23213 !! test
23214 Image: Modifying size of an image (3)
23215 !! options
23216 parsoid={
23217 "modes": ["wt2wt"],
23218 "changes": [
23219 ["figure[class]", "removeClass", "mw-default-size"],
23220 ["figure img", "attr", "height", "19"],
23221 ["figure img", "attr", "width", "170"]
23222 ]
23223 }
23224 !! wikitext
23225 [[Image:Foobar.jpg|thumb]]
23226 !! wikitext/edited
23227 [[Image:Foobar.jpg|thumb|170x170px]]
23228 !!end
23229
23230 !! test
23231 Image: Modifying alignment of an image (bug 48665)
23232 !! options
23233 parsoid={
23234 "modes": ["wt2wt"],
23235 "changes": [
23236 ["figure[class]", "removeClass", "mw-halign-right"],
23237 ["figure[class]", "addClass", "mw-halign-left"]
23238 ]
23239 }
23240 !! wikitext
23241 [[Image:Foobar.jpg|thumb|caption|right]]
23242 !! wikitext/edited
23243 [[Image:Foobar.jpg|thumb|caption|left]]
23244 !! end
23245
23246 !! test
23247 Image: Modifying mw-default-size of an frameless image (bug 62805)
23248 !! options
23249 parsoid={
23250 "modes": ["wt2wt"],
23251 "changes": [
23252 ["figure.mw-default-size", "removeClass", "mw-default-size"]
23253 ]
23254 }
23255 !! wikitext
23256 [[Image:Foobar.jpg|frameless|right]]
23257 !! wikitext/edited
23258 [[Image:Foobar.jpg|frameless|right|220x220px]]
23259 !! end
23260
23261 !! test
23262 Image: Modifying valign of an image (bug 49221)
23263 !! options
23264 parsoid={
23265 "modes": ["wt2wt"],
23266 "changes": [
23267 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
23268 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
23269 ]
23270 }
23271 !! wikitext
23272 [[File:Foobar.jpg|20px|middle]]
23273 !! wikitext/edited
23274 [[File:Foobar.jpg|20px|text-top]]
23275 !! end
23276
23277 !! test
23278 Image: Modifying alt attribute of an image (bug 56400)
23279 !! options
23280 parsoid={
23281 "modes": ["wt2wt"],
23282 "changes": [
23283 ["img[alt]", "attr", "alt", "some alternate edited text"]
23284 ]
23285 }
23286 !! wikitext
23287 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
23288 !! wikitext/edited
23289 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
23290 !!end
23291
23292 !! test
23293 Image: Modifying caption of an image
23294 !! options
23295 parsoid={
23296 "modes": ["wt2wt"],
23297 "changes": [
23298 ["figcaption", "text", "new caption"]
23299 ]
23300 }
23301 !! wikitext
23302 [[Image:Foobar.jpg|thumb|original caption]]
23303 !! wikitext/edited
23304 [[Image:Foobar.jpg|thumb|new caption]]
23305 !!end
23306
23307 !! test
23308 Image: empty alt attribute (bug 48924)
23309 !! options
23310 parsoid
23311 !! wikitext
23312 [[File:Foobar.jpg|thumb|alt=|bar]]
23313 !! html
23314 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" 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>
23315 !! end
23316
23317 #!! test
23318 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
23319 #!! options
23320 #parsoid=html2wt
23321 #language=ar
23322 #!! html
23323 #<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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="180"/></a></figure>
23324 #!! wikitext
23325 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
23326 #!! end
23327
23328 !! test
23329 Image: Block level image should have \n before and after
23330 !! wikitext
23331 123
23332 [[File:Foobar.jpg|right|thumb|150x150px]]
23333 456
23334 !! html/parsoid
23335 <p>123</p>
23336 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150"/></a></figure>
23337 <p>456</p>
23338 !!end
23339
23340 !! test
23341 Image: New block level image should have \n before and after (existing content)
23342 !! wikitext
23343 123
23344 [[File:Foobar.jpg|right|thumb|150x150px]]
23345 456
23346 !! html/parsoid
23347 <p>123</p>
23348 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"17","width":"150"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure>
23349 <p>456</p>
23350 !!end
23351
23352 !! test
23353 Image: upright option (parsoid)
23354 !! options
23355 parsoid
23356 !! wikitext
23357 [[File:Foobar.jpg|thumb|upright|caption]]
23358 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
23359 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
23360 !! html
23361 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="19" width="170"/></a><figcaption>caption</figcaption></figure>
23362 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="12" width="110"/></a><figcaption>caption</figcaption></figure>
23363 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="57" width="500"/></a><figcaption>caption</figcaption></figure>
23364 !!end
23365
23366 !! test
23367 Image: upright option is ignored on inline and frame images (parsoid)
23368 !! options
23369 parsoid
23370 !! wikitext
23371 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
23372 !! html
23373 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="57" width="500"/></a></span></p>
23374 !!end
23375
23376 !! test
23377 Image: from basic HTML (1)
23378 !! options
23379 parsoid=html2wt
23380 !! html/parsoid
23381 <span typeof="mw:Image">
23382 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
23383 </span>
23384 !! wikitext
23385 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
23386 !! end
23387
23388 !! test
23389 Image: from basic HTML (2)
23390 !! options
23391 parsoid=html2wt
23392 !! html/parsoid
23393 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
23394 !! wikitext
23395 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
23396 !! end
23397
23398 !! test
23399 Image: from basic HTML (3)
23400 !! options
23401 parsoid=html2wt
23402 !! html/parsoid
23403 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
23404 !! wikitext
23405 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
23406 !! end
23407
23408 !! test
23409 Image: from basic HTML (4)
23410 !! options
23411 parsoid=html2wt
23412 !! html/parsoid
23413 <img src="./File:Foobar.jpg">
23414 !! wikitext
23415 [[File:Foobar.jpg|link=]]
23416 !! end
23417
23418 !! test
23419 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
23420 !! options
23421 parsoid=html2wt
23422 !! html
23423 <ul>
23424 <li><p>foo</p></li>
23425 </ul>
23426 !! wikitext
23427 * foo
23428 !! end
23429
23430 !! test
23431 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
23432 !! options
23433 parsoid=html2wt
23434 !! html
23435 <ul> <li>foo</li></ul>
23436 !! wikitext
23437 * foo
23438 !! end
23439
23440 !! test
23441 Don't strip leading whitespace when handling indent-pre suppressing tags
23442 !! options
23443 parsoid=html2wt
23444 !! html
23445 <table>
23446 <tr><td> indented row</td></tr>
23447 </table>
23448 <blockquote><p>
23449 <b>This is very bold of you!</b>
23450 </p>
23451 <table><tr><td>
23452 indented cell (no pre-wrapping!)
23453 </td></tr></table>
23454 </blockquote>
23455 <p>foo</p>
23456 <div>bar</div>
23457 !! wikitext
23458 {|
23459 | indented row
23460 |}
23461 <blockquote>
23462 '''This is very bold of you!'''
23463
23464 {|
23465 |
23466 indented cell (no pre-wrapping!)
23467 |}
23468 </blockquote>
23469 foo
23470 <div>bar</div>
23471 !! end
23472
23473 !! test
23474 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
23475 !! options
23476 parsoid=html2wt
23477 !! wikitext
23478 foo
23479 <nowiki> </nowiki><span>bar</span>
23480
23481 <span>foo2
23482 <nowiki> </nowiki></span>bar2
23483
23484 <div>foo</div>
23485 <nowiki> </nowiki><span>bar</span>
23486
23487 <div>
23488 <nowiki> </nowiki><span>foo</span>
23489 </div>
23490 !! html
23491 <p>foo</p>
23492 <span>bar</span>
23493
23494 <span>foo2
23495 </span>bar2
23496
23497 <div>foo</div>
23498 <span>bar</span>
23499
23500 <div>
23501 <span>foo</span>
23502 </div>
23503 !! end
23504
23505 !! test
23506 Lists: Add space after bullets
23507 !! options
23508 parsoid=html2wt
23509 !! html
23510 <ul>
23511 <li>foo</li>
23512 <li> bar</li>
23513 <li><span> baz</span></li>
23514 </ul>
23515 !! wikitext
23516 * foo
23517 * bar
23518 * <span> baz</span>
23519 !! end
23520
23521 !! test
23522 Lists: Dont insert newlines in a serialized list item.
23523 !! options
23524 parsoid=html2wt
23525 !! html
23526 <ul><li>a<br>b</li><li>c</li></ul>
23527 !! wikitext
23528 * a<br>b
23529 * c
23530 !! end
23531
23532 !! test
23533 Headings: Add space before/after == (Bug 51744)
23534 !! options
23535 parsoid=html2wt
23536 !! html
23537 <h2>foo</h2>
23538 <h2> bar</h2>
23539 <h2>baz </h2>
23540 <h2><span> baz</span></h2>
23541 !! wikitext
23542 == foo ==
23543
23544 == bar ==
23545
23546 == baz ==
23547
23548 == <span> baz</span> ==
23549 !! end
23550
23551 !! test
23552 Headings: Force metas to serialize before/after
23553 !! options
23554 parsoid=html2wt
23555 !! html
23556 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
23557 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
23558
23559 <h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
23560 !! wikitext
23561 == hello there ==
23562 [[Category:A1]]
23563
23564 [[Category:A2]]
23565 == hi pal ==
23566
23567 <!--foo--> [[Category:A3]]
23568 == how goes it ==
23569 !! end
23570
23571 !! test
23572 Parsoid: Serialize positional parameters with = in them as named parameter
23573 !! options
23574 parsoid=html2wt
23575 !! html
23576 <p about="#mwt1" typeof="mw:Transclusion"
23577 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
23578
23579 <p about="#mwt1" typeof="mw:Transclusion"
23580 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
23581
23582 <!--Orig params with data-parsoid has heuristics for handling = chars-->
23583 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
23584 <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>
23585 !! wikitext
23586 {{echo|1 = f=oo}}
23587
23588 {{echo|1 = f=oo|2 = bar}}
23589
23590 <!--Orig params with data-parsoid has heuristics for handling = chars-->
23591 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
23592 {{echo|<nowiki>f=oo</nowiki>|bar}}
23593 !! end
23594
23595 !! test
23596 Parsoid: Serialize positional parameters with = in extlink as named parameter
23597 !! options
23598 parsoid=html2wt
23599 !! html
23600 <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>
23601 !! wikitext
23602 {{echo|1 = http://stuff?is=ok}}
23603 !! end
23604
23605 !! test
23606 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
23607 !! options
23608 parsoid=html2wt
23609 !! html
23610 <div>a<p>b</p></div>
23611 <div>a
23612 <p>b</p></div>
23613 <div>
23614 a
23615 <p>b</p></div>
23616 !! wikitext
23617 <div>a
23618 b
23619 </div>
23620 <div>a
23621 b
23622 </div>
23623 <div>
23624 a
23625
23626 b
23627 </div>
23628 !! end
23629
23630 !! test
23631 Substrings resembling wikitext in hrefs should not get nowiki escapes
23632 !! options
23633 parsoid=html2wt
23634 !! html
23635 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
23636 !! wikitext
23637 [[Foo''bar''baz]]
23638 !! end
23639
23640 !! test
23641 Enforce single-line context in the serializer
23642 !! options
23643 parsoid=html2wt
23644 !! html
23645 <h2>testing
23646 123</h2>
23647
23648 <ul><li>asd
23649 sdf</li></ul>
23650 !! wikitext
23651 == testing 123 ==
23652
23653 * asd sdf
23654 !! end
23655
23656 #-----------------------------
23657 # I/B quote minimization tests
23658 #-----------------------------
23659
23660 !! test
23661 1. I/B quote minimization: wikitext-only tags should be combined
23662 !! options
23663 parsoid=html2wt
23664 !! html
23665 <p><i>A</i><i>B</i></p>
23666 <p><b>A</b><b>B</b></p>
23667 <p><i>A</i><b><i>B</i></b></p>
23668 <p><b>A</b><i><b>B</b></i></p>
23669 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
23670 <p><i><b>A</b></i><i><b>B</b></i></p>
23671 <p><i><b>A</b></i><b><i>B</i></b></p>
23672 <p><b><i>A</i></b><i><b>B</b></i></p>
23673 !! wikitext
23674 ''AB''
23675
23676 '''AB'''
23677
23678 ''A'''B'''''
23679
23680 '''A''B'''''
23681
23682 '''A''BC''D'''
23683
23684 '''''AB'''''
23685
23686 '''''AB'''''
23687
23688 '''''AB'''''
23689 !! end
23690
23691 !! test
23692 2. I/B quote minimization: wikitext and html tags should not be combined
23693 !! options
23694 parsoid=html2wt
23695 !! html
23696 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
23697 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
23698 !! wikitext
23699 ''A''<i>B</i>
23700
23701 ''A''<nowiki/>'''<i>B</i>'''
23702 !! end
23703
23704 !! test
23705 3. I/B quote minimization: templated content stops minimization
23706 !! options
23707 parsoid=html2wt
23708 !! html
23709 <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>
23710 <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>
23711 !! wikitext
23712 ''A''{{echo|''B''}}
23713
23714 ''A''{{echo|'''''B'''''}}
23715 !! end
23716
23717 !! test
23718 4. I/B quote minimization: new content should be mimimized with adjacent old content
23719 !! options
23720 parsoid=html2wt
23721 !! html
23722 <p><i>A</i><i>B</i></p>
23723 <p><b>A</b><b>B</b></p>
23724 <p><i>A</i><b><i>B</i></b></p>
23725 !! wikitext
23726 ''AB''
23727
23728 '''AB'''
23729
23730 ''A'''B'''''
23731 !! end
23732
23733 !! test
23734 5a. Merge adjacent quote nodes if they've been edited
23735 !! options
23736 parsoid={
23737 "modes": ["wt2wt", "selser"],
23738 "changes": [
23739 ["p", "contents", "remove", ":contains('b')"]
23740 ]
23741 }
23742 !! wikitext
23743 ''a''b''c''
23744 !! wikitext/edited
23745 ''ac''
23746 !! end
23747
23748 !! test
23749 5b. Merge adjacent quote nodes if they've been edited
23750 !! options
23751 parsoid={
23752 "modes": ["wt2wt", "selser"],
23753 "changes": [
23754 ["#x", "remove"]
23755 ]
23756 }
23757 !! wikitext
23758 ''a''<span id="x">b</span>''c''
23759 !! wikitext/edited
23760 ''ac''
23761 !! end
23762
23763 #------------------------------------
23764 # End of I/B quote minimization tests
23765 #------------------------------------
23766
23767 !!test
23768 Bug 54262: New entities
23769 !! options
23770 parsoid=html2wt
23771 !! wikitext
23772 &nbsp;
23773 !! html
23774 <span typeof="mw:Entity">&nbsp;</span>
23775 !! end
23776
23777 ## Note that there is no wikitext output for 'unknownproperty' ##
23778 ## Unknown magic words are silently dropped ##
23779
23780 !! test
23781 Magic words
23782 !! options
23783 parsoid=html2wt
23784 !! html
23785 <meta property='mw:PageProp/toc' />
23786 <meta property='mw:PageProp/notoc' />
23787 <meta property='mw:PageProp/forcetoc' />
23788 <meta property='mw:PageProp/index' />
23789 <meta property='mw:PageProp/noindex' />
23790 <meta property='mw:PageProp/nogallery' />
23791 <meta property='mw:PageProp/noeditsection' />
23792 <meta property='mw:PageProp/notitleconvert' />
23793 <meta property='mw:PageProp/nocontentconvert' />
23794 <meta property='mw:PageProp/unknownproperty' />
23795 !! wikitext
23796 __TOC__
23797 __NOTOC__
23798 __FORCETOC__
23799 __INDEX__
23800 __NOINDEX__
23801 __NOGALLERY__
23802 __NOEDITSECTION__
23803 __NOTITLECONVERT__
23804 __NOCONTENTCONVERT__
23805 !! end
23806
23807 !! test
23808 Consecutive <pre>s should not get merged
23809 !! options
23810 parsoid=html2wt,html2html
23811 !! html
23812 <pre>a</pre><pre>b</pre>
23813
23814 <pre>c
23815 </pre><pre>
23816 d</pre>
23817
23818 <pre>e
23819
23820 </pre><pre>
23821
23822 f</pre>
23823 !! wikitext
23824 a
23825
23826 b
23827
23828 c
23829
23830 d
23831
23832 e
23833
23834
23835
23836 f
23837 !! end
23838
23839 !! test
23840 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
23841 !! options
23842 parsoid=html2wt
23843 !! html
23844 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
23845 !! wikitext
23846 [[Special:BookSources/1234567890|ISBN 1234567895]]
23847 !! end
23848
23849 !! test
23850 Edited RFC links not serializable as RFC links should serialize as extlinks
23851 !! options
23852 parsoid=html2wt
23853 !! html
23854 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
23855 !! wikitext
23856 [//tools.ietf.org/html/rfc123 New RFC]
23857 !! end
23858
23859 !! test
23860 Edited PMID links not serializable as PMID links should serialize as extlinks
23861 !! options
23862 parsoid=html2wt
23863 !! html
23864 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
23865 !! wikitext
23866 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
23867 !! end
23868
23869 !! test
23870 WTS of autolinks with trailing/surrounding context
23871 !! options
23872 parsoid=html2wt
23873 !! html/parsoid
23874 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
23875 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
23876 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
23877 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
23878 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
23879 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
23880 !! wikitext
23881 http://cscott.net<nowiki/>'''foo'''
23882
23883 http://cscott.net<b>foo</b>
23884
23885 '''http://cscott.net<nowiki/>'''
23886
23887 '''http://cscott.net '''
23888
23889 '''http://cscott.net<nowiki/>x'''
23890
23891 http://cscott.net<nowiki/>x
23892 !! end
23893
23894 !! test
23895 WTS of autolinks with nowikis (round-trip)
23896 !! wikitext
23897 x<nowiki/>http://cscott.net<nowiki/>x
23898 !! html/parsoid
23899 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
23900 !! end
23901
23902 # this is the "easy" test because it leaves in place all the
23903 # data-parsoid information indicating this is an autolink
23904 !! test
23905 WTS of autolinks with escapes (editing)
23906 !! options
23907 parsoid={
23908 "modes": ["wt2wt"],
23909 "changes": [
23910 [ "meta", "remove" ]
23911 ]
23912 }
23913 !! wikitext
23914 x<nowiki/>http://cscott.net<nowiki/>x
23915 !! wikitext/edited
23916 x<nowiki/>http://cscott.net<nowiki/>x
23917 !! end
23918
23919 !! test
23920 Edited Redirect link should emit a non-piped wikitext link
23921 !! options
23922 parsoid=html2wt
23923 !! html
23924 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
23925 !! wikitext
23926 #REDIRECT [[Bar]]
23927 !! end
23928
23929 !! test
23930 T75121: Infer extension name from typeOf if data-mw is not present
23931 !! options
23932 parsoid=html2wt
23933 !! html
23934 <div typeOf="mw:Extension/foo"></div>
23935 !! wikitext
23936 <foo />
23937 !! end
23938
23939 # Note that the <p> wrapping isn't present in PHP parser output
23940 # The important thing for this test is that P-wrapping doesn't
23941 # interfere with the <nowiki> protection for leading - in <td>
23942 # (which isn't necessary for <th>).
23943 !! test
23944 T88318: p-wrapped dash in table.
23945 !! options
23946 parsoid=html2wt,wt2wt
23947 !! html/parsoid
23948 <table><tbody>
23949 <tr><th><p>-</p></th><th><p>- </p></th></tr>
23950 <tr><td><p>-</p></td><td><p>- </p></td></tr>
23951 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
23952 </tbody></table>
23953 !! wikitext
23954 {|
23955 !-
23956 !-
23957 |-
23958 |<nowiki>-</nowiki>
23959 |<nowiki>- </nowiki>
23960 |-
23961 |<small>-</small>
23962 |<br>
23963 -
23964 |<br>
23965 -
23966 |}
23967 !! html/php+tidy
23968 <table>
23969 <tr>
23970 <th>-</th>
23971 <th>-</th>
23972 </tr>
23973 <tr>
23974 <td>-</td>
23975 <td>-</td>
23976 </tr>
23977 <tr>
23978 <td><small>-</small></td>
23979 <td><br />
23980 <p>-</p>
23981 </td>
23982 <td><br />
23983 <p>-</p>
23984 </td>
23985 </tr>
23986 </table>
23987 !! end
23988
23989 !! test
23990 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
23991 !! options
23992 parsoid=html2wt
23993 !! html
23994 <table id='mwAb'>
23995 <td id='mwAc'>foo</td>
23996 <td id='serialize-this'>bar</td>
23997 </table>
23998 !! wikitext
23999 {|
24000 |foo
24001 | id="serialize-this" |bar
24002 |}
24003 !! end
24004
24005 !! test
24006 Parsoid-like element ids should not be serialized to wikitext unless shadowed
24007 !! options
24008 parsoid=html2wt
24009 !! html
24010 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
24011 !! wikitext
24012 <div id="hello">ok</div>
24013 !! end
24014
24015 !! test
24016 WTS change modes
24017 !! options
24018 parsoid={
24019 "modes": ["wt2wt"],
24020 "changes": [
24021 [ "#xyz", "before", "<b>before</b> stuff " ],
24022 [ "#xyz", "after", " stuff <i>after</i>" ],
24023 [ "#xyz", "html", "x <b>y</b> z" ]
24024 ]
24025 }
24026 !! wikitext
24027 <span id="xyz">hello</span>
24028 !! wikitext/edited
24029 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
24030 !! end
24031
24032 !! test
24033 Never serialize a-tag as html, regardless of what data-parsoid has to say
24034 !! options
24035 parsoid=html2wt
24036 !! html
24037 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
24038 !! wikitext
24039 [[Foo]]
24040 !! end
24041
24042 # -----------------------------------------------------------------
24043 # End of section for Parsoid-only html2wt tests for serialization
24044 # of new content
24045 # -----------------------------------------------------------------
24046
24047 # -----------------------------------------------------------------
24048 # The following section of tests are primarily to spec behavior of
24049 # the selective serializer. All these tests have manual selser
24050 # changes. The automated selser changes for all tests handle the
24051 # wide variation of changes, but these tests here capture specs
24052 # deterministically.
24053 # ----------------------------------------------------------------
24054
24055 ## T90517
24056 !! test
24057 1. Selser: New comments should not be lost
24058 !! options
24059 parsoid={
24060 "modes": ["selser"],
24061 "changes": [
24062 [ "#a", "after", "<!--c1-->" ],
24063 [ "#b", "before", "<!--c2-->" ]
24064 ]
24065 }
24066 !! wikitext
24067 <span id="a">a</span>
24068
24069 <span id="b">b</span>
24070 !! wikitext/edited
24071 <span id="a">a</span><!--c1-->
24072
24073 <!--c2--><span id="b">b</span>
24074 !! end
24075
24076 ## T89383
24077 !! test
24078 2. Selser: Check for validity of DSR before using it
24079 !! options
24080 parsoid={
24081 "modes": ["selser"],
24082 "changes": [
24083 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
24084 ]
24085 }
24086 !! wikitext
24087 <span id="a">a</span>
24088 !! wikitext/edited
24089 {{DISPLAYTITLE:foo}}
24090 <span id="a">a</span>
24091 !! end
24092
24093
24094 TODO:
24095 more images
24096 more tables
24097 character entities
24098 and much more
24099 Try for 100% code coverage