18d9aa85e057b7517b513f6f5ae2b1f6e430f176
[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="title" />
7984 <br title="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 !! test
14632 Attribute test: no value
14633 !! wikitext
14634 <font color>foo</font>
14635 !! html
14636 <p><font color="color">foo</font>
14637 </p>
14638 !! end
14639
14640 !! test
14641 Bug 2095: link with three closing brackets
14642 !! wikitext
14643 [[Main Page]]]
14644 !! html/php
14645 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
14646 </p>
14647 !! html/parsoid
14648 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
14649 !! end
14650
14651 !! test
14652 Bug 2095: link with pipe and three closing brackets
14653 !! wikitext
14654 [[Main Page|link]]]
14655 !! html/php
14656 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
14657 </p>
14658 !! html/parsoid
14659 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
14660 !! end
14661
14662 !! test
14663 Bug 2095: link with pipe and three closing brackets, version 2
14664 !! wikitext
14665 [[Main Page|[http://example.com/]]]
14666 !! html/php
14667 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
14668 </p>
14669 !! html/parsoid
14670 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
14671 !! end
14672
14673
14674 ###
14675 ### Safety
14676 ###
14677
14678 !! article
14679 Template:Dangerous attribute
14680 !! text
14681 " onmouseover="alert(document.cookie)
14682 !! endarticle
14683
14684 !! article
14685 Template:Dangerous style attribute
14686 !! text
14687 border-size: expression(alert(document.cookie))
14688 !! endarticle
14689
14690 !! article
14691 Template:Div style
14692 !! text
14693 <div style="float: right; {{{1}}}">Magic div</div>
14694 !! endarticle
14695
14696 !! test
14697 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
14698 !! wikitext
14699 <div title="{{test}}"></div>
14700 !! html
14701 <div title="This is a test template"></div>
14702
14703 !! end
14704
14705 # Parsoid has enough context to handle this case
14706 !! test
14707 Bug 2304: HTML attribute safety (dangerous template; 2309)
14708 !! wikitext
14709 <div title="{{dangerous attribute}}"></div>
14710 !! html/php
14711 <div title=""></div>
14712
14713 !! html/parsoid
14714 <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>
14715 !! end
14716
14717 !! test
14718 Bug 2304: HTML attribute safety (dangerous style template; 2309)
14719 !! wikitext
14720 <div style="{{dangerous style attribute}}"></div>
14721 !! html
14722 <div style="/* insecure input */"></div>
14723
14724 !! end
14725
14726 !! test
14727 Bug 2304: HTML attribute safety (safe parameter; 2309)
14728 !! wikitext
14729 {{div style|width: 200px}}
14730 !! html
14731 <div style="float: right; width: 200px">Magic div</div>
14732
14733 !! end
14734
14735 !! test
14736 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
14737 !! wikitext
14738 {{div style|width: expression(alert(document.cookie))}}
14739 !! html
14740 <div style="/* insecure input */">Magic div</div>
14741
14742 !! end
14743
14744 !! test
14745 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
14746 !! wikitext
14747 {{div style|"><script>alert(document.cookie)</script>}}
14748 !! html
14749 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14750
14751 !! end
14752
14753 !! test
14754 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
14755 !! wikitext
14756 {{div style|" ><script>alert(document.cookie)</script>}}
14757 !! html
14758 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14759
14760 !! end
14761
14762 !! test
14763 Bug 2304: HTML attribute safety (link)
14764 !! wikitext
14765 <div title="[[Main Page]]"></div>
14766 !! html
14767 <div title="&#91;&#91;Main Page]]"></div>
14768
14769 !! end
14770
14771 !! test
14772 Bug 2304: HTML attribute safety (italics)
14773 !! wikitext
14774 <div title="''foobar''"></div>
14775 !! html
14776 <div title="&#39;&#39;foobar&#39;&#39;"></div>
14777
14778 !! end
14779
14780 !! test
14781 Bug 2304: HTML attribute safety (bold)
14782 !! wikitext
14783 <div title="'''foobar'''"></div>
14784 !! html
14785 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
14786
14787 !! end
14788
14789
14790 !! test
14791 Bug 2304: HTML attribute safety (ISBN)
14792 !! wikitext
14793 <div title="ISBN 1234567890"></div>
14794 !! html
14795 <div title="&#73;SBN 1234567890"></div>
14796
14797 !! end
14798
14799 !! test
14800 Bug 2304: HTML attribute safety (RFC)
14801 !! wikitext
14802 <div title="RFC 1234"></div>
14803 !! html
14804 <div title="&#82;FC 1234"></div>
14805
14806 !! end
14807
14808 !! test
14809 Bug 2304: HTML attribute safety (PMID)
14810 !! wikitext
14811 <div title="PMID 1234567890"></div>
14812 !! html
14813 <div title="&#80;MID 1234567890"></div>
14814
14815 !! end
14816
14817 !! test
14818 Bug 2304: HTML attribute safety (web link)
14819 !! wikitext
14820 <div title="http://example.com/"></div>
14821 !! html
14822 <div title="http&#58;//example.com/"></div>
14823
14824 !! end
14825
14826 !! test
14827 Bug 2304: HTML attribute safety (named web link)
14828 !! wikitext
14829 <div title="[http://example.com/ link]"></div>
14830 !! html
14831 <div title="&#91;http&#58;//example.com/ link]"></div>
14832
14833 !! end
14834
14835 !! test
14836 Bug 3244: HTML attribute safety (extension; safe)
14837 !! wikitext
14838 <div style="<nowiki>background:blue</nowiki>"></div>
14839 !! html
14840 <div style="background:blue"></div>
14841
14842 !! end
14843
14844 !! test
14845 Bug 3244: HTML attribute safety (extension; unsafe)
14846 !! wikitext
14847 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14848 !! html
14849 <div style="/* insecure input */"></div>
14850
14851 !! end
14852
14853 # More MSIE fun discovered by Tom Gilder
14854
14855 !! test
14856 MSIE CSS safety test: spurious slash
14857 !! wikitext
14858 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14859 !! html
14860 <div style="/* insecure input */">evil</div>
14861
14862 !! end
14863
14864 !! test
14865 MSIE CSS safety test: hex code
14866 !! wikitext
14867 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14868 !! html
14869 <div style="/* insecure input */">evil</div>
14870
14871 !! end
14872
14873 !! test
14874 MSIE CSS safety test: comment in url
14875 !! wikitext
14876 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14877 !! html
14878 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14879
14880 !! end
14881
14882 !! test
14883 MSIE CSS safety test: comment in expression
14884 !! wikitext
14885 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14886 !! html
14887 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14888
14889 !! end
14890
14891 !! test
14892 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14893 !! wikitext
14894 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14895 !! html
14896 <p style="/* invalid control char */">A</p>
14897
14898 !! end
14899
14900 !! test
14901 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14902 !! wikitext
14903 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14904 <div style="top:EXPRESSION(alert())">B</div>
14905 !! html
14906 <p style="/* insecure input */">A</p>
14907 <div style="/* insecure input */">B</div>
14908
14909 !! end
14910
14911 !! test
14912 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14913 !! wikitext
14914 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14915 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14916 !! html
14917 <div style="/* insecure input */">A</div>
14918 <p style="/* insecure input */">B</p>
14919
14920 !! end
14921
14922 !! test
14923 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14924 !! wikitext
14925 <div style="background-image:url⁽javascript:alert())">A</div>
14926 <div style="background-image:url₍javascript:alert())">B</div>
14927 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14928 !! html
14929 <div style="/* insecure input */">A</div>
14930 <div style="/* insecure input */">B</div>
14931 <p style="/* insecure input */">C</p>
14932
14933 !! end
14934
14935 !! test
14936 Opera -o-link CSS
14937 !! wikitext
14938 <div
14939 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;"
14940 style="-o-link:attr(title);-o-link-source:current">X</div>
14941 !! html
14942 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14943
14944 !! end
14945
14946 !! test
14947 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14948 !! wikitext
14949 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14950 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14951 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14952 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14953 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14954 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14955 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14956 !! html
14957 <p style="/* insecure input */">A</p>
14958 <p style="/* insecure input */">B</p>
14959 <p style="/* insecure input */">C</p>
14960 <p style="/* insecure input */">D</p>
14961 <p style="/* insecure input */">E</p>
14962 <p style="/* insecure input */">F</p>
14963 <p style="/* insecure input */">G</p>
14964
14965 !! end
14966
14967 !! test
14968 Table attribute legitimate extension
14969 !! wikitext
14970 {|
14971 !+ style="<nowiki>color:blue</nowiki>"| status
14972 |}
14973 !! html
14974 <table>
14975 <tr>
14976 <th style="color:blue"> status
14977 </th></tr></table>
14978
14979 !!end
14980
14981 !! test
14982 Table attribute safety
14983 !! wikitext
14984 {|
14985 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14986 |}
14987 !! html
14988 <table>
14989 <tr>
14990 <th style="/* insecure input */"> status
14991 </th></tr></table>
14992
14993 !! end
14994
14995 !! test
14996 CSS line continuation 1
14997 !! wikitext
14998 <div style="background-image: u\&#10;rl(test.jpg);"></div>
14999 !! html
15000 <div style="/* insecure input */"></div>
15001
15002 !! end
15003
15004 !! test
15005 CSS line continuation 2
15006 !! wikitext
15007 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15008 !! html
15009 <div style="/* insecure input */"></div>
15010
15011 !! end
15012
15013 !! article
15014 Template:Identity
15015 !! text
15016 {{{1}}}
15017 !! endarticle
15018
15019 !! test
15020 Expansion of multi-line templates in attribute values (bug 6255)
15021 !! wikitext
15022 <div style="background: {{identity|#00FF00}}">-</div>
15023 !! html
15024 <div style="background: #00FF00">-</div>
15025
15026 !! end
15027
15028
15029 !! test
15030 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
15031 !! wikitext
15032 <div style="background:
15033 #00FF00">-</div>
15034 !! html/php
15035 <div style="background: #00FF00">-</div>
15036
15037 !! html/parsoid
15038 <div style="background:
15039 #00FF00">-</div>
15040 !! end
15041
15042 !! test
15043 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
15044 !! wikitext
15045 <div style="background: &#10;#00FF00">-</div>
15046 !! html
15047 <div style="background: &#10;#00FF00">-</div>
15048
15049 !! end
15050
15051 !! test
15052 evil <math>-wiki-tags without Extension:Math enabled
15053 !! wikitext
15054 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
15055 !! html+tidy
15056 <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>
15057 !! end
15058
15059 ###
15060 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
15061 ###
15062 !! test
15063 Parser hook: empty input
15064 !! wikitext
15065 <tag></tag>
15066 !! html
15067 <pre>
15068 ''
15069 array (
15070 )
15071 </pre>
15072
15073 !! end
15074
15075 !! test
15076 Parser hook: empty input using terminated empty elements
15077 !! wikitext
15078 <tag/>
15079 !! html
15080 <pre>
15081 NULL
15082 array (
15083 )
15084 </pre>
15085
15086 !! end
15087
15088 !! test
15089 Parser hook: empty input using terminated empty elements (space before)
15090 !! wikitext
15091 <tag />
15092 !! html
15093 <pre>
15094 NULL
15095 array (
15096 )
15097 </pre>
15098
15099 !! end
15100
15101 !! test
15102 Parser hook: basic input
15103 !! wikitext
15104 <tag>input</tag>
15105 !! html
15106 <pre>
15107 'input'
15108 array (
15109 )
15110 </pre>
15111
15112 !! end
15113
15114
15115 !! test
15116 Parser hook: case insensitive
15117 !! wikitext
15118 <TAG>input</TAG>
15119 !! html
15120 <pre>
15121 'input'
15122 array (
15123 )
15124 </pre>
15125
15126 !! end
15127
15128
15129 !! test
15130 Parser hook: case insensitive, redux
15131 !! wikitext
15132 <TaG>input</TAg>
15133 !! html
15134 <pre>
15135 'input'
15136 array (
15137 )
15138 </pre>
15139
15140 !! end
15141
15142 !! test
15143 Parser hook: nested tags
15144 !! options
15145 noxml
15146 !! wikitext
15147 <tag><tag></tag></tag>
15148 !! html
15149 <pre>
15150 '<tag>'
15151 array (
15152 )
15153 </pre>&lt;/tag&gt;
15154
15155 !! end
15156
15157 !! test
15158 Parser hook: basic arguments
15159 !! wikitext
15160 <tag width=200 height = "100" depth = '50' square></tag>
15161 !! html
15162 <pre>
15163 ''
15164 array (
15165 'width' => '200',
15166 'height' => '100',
15167 'depth' => '50',
15168 'square' => 'square',
15169 )
15170 </pre>
15171
15172 !! end
15173
15174 !! test
15175 Parser hook: argument containing a forward slash (bug 5344)
15176 !! wikitext
15177 <tag filename='/tmp/bla'></tag>
15178 !! html
15179 <pre>
15180 ''
15181 array (
15182 'filename' => '/tmp/bla',
15183 )
15184 </pre>
15185
15186 !! end
15187
15188 !! test
15189 Parser hook: empty input using terminated empty elements (bug 2374)
15190 !! wikitext
15191 <tag foo=bar/>text
15192 !! html
15193 <pre>
15194 NULL
15195 array (
15196 'foo' => 'bar',
15197 )
15198 </pre>text
15199
15200 !! end
15201
15202 # </tag> should be output literally since there is no matching tag that begins it
15203 !! test
15204 Parser hook: basic arguments using terminated empty elements (bug 2374)
15205 !! wikitext
15206 <tag width=200 height = "100" depth = '50' square/>
15207 other stuff
15208 </tag>
15209 !! html
15210 <pre>
15211 NULL
15212 array (
15213 'width' => '200',
15214 'height' => '100',
15215 'depth' => '50',
15216 'square' => 'square',
15217 )
15218 </pre>
15219 <p>other stuff
15220 &lt;/tag&gt;
15221 </p>
15222 !! end
15223
15224 ###
15225 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
15226 ###
15227
15228 !! test
15229 Parser hook: static parser hook not inside a comment
15230 !! wikitext
15231 <statictag>hello, world</statictag>
15232 <statictag action=flush/>
15233 !! html
15234 <p>hello, world
15235 </p>
15236 !! end
15237
15238
15239 !! test
15240 Parser hook: static parser hook inside a comment
15241 !! wikitext
15242 <!-- <statictag>hello, world</statictag> -->
15243 <statictag action=flush/>
15244 !! html
15245 <p><br />
15246 </p>
15247 !! end
15248
15249 # Nested template calls; this case was broken by Parser.php rev 1.506,
15250 # since reverted.
15251
15252 !! article
15253 Template:One-parameter
15254 !! text
15255 (My parameter is: {{{1}}})
15256 !! endarticle
15257
15258 !! article
15259 Template:Map-one-parameter
15260 !! text
15261 {{{{{1}}}|{{{2}}}}}
15262 !! endarticle
15263
15264 !! test
15265 Nested template calls
15266 !! wikitext
15267 {{Map-one-parameter|One-parameter|param}}
15268 !! html
15269 <p>(My parameter is: param)
15270 </p>
15271 !! end
15272
15273
15274 ###
15275 ### Sanitizer
15276 ###
15277
15278 # HTML+Tidy effectively strips out the empty tags completely
15279 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
15280 # which Tidy would have done for the PHP parser had there been content inside it.
15281 !! test
15282 Sanitizer: Closing of open tags
15283 !! wikitext
15284 <s></s><table></table>
15285 !! html
15286 <s></s><table></table>
15287
15288 !! html/parsoid
15289 <p><s></s></p><table></table>
15290 !! end
15291
15292 !! test
15293 Sanitizer: Closing of open but not closed tags
15294 !! wikitext
15295 <s>foo
15296 !! html
15297 <p><s>foo</s>
15298 </p>
15299 !! end
15300
15301 !! test
15302 Sanitizer: Closing of closed but not open tags
15303 !! wikitext
15304 </s>
15305 !! html
15306 <p>&lt;/s&gt;
15307 </p>
15308 !! end
15309
15310 !! test
15311 Sanitizer: Closing of closed but not open table tags
15312 !! wikitext
15313 Table not started</td></tr></table>
15314 !! html
15315 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
15316 </p>
15317 !! end
15318
15319 !! test
15320 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
15321 !! wikitext
15322 <span id="æ: v">byte</span>[[#æ: v|backlink]]
15323 !! html
15324 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
15325 </p>
15326 !! end
15327
15328 # In HTML5, the restrictions are that id must contain at least one character,
15329 # and must not contain any space characters.
15330 !! test
15331 Sanitizer: Validating the contents of the id attribute (bug 4515)
15332 !! options
15333 disabled
15334 !! wikitext
15335 <br id="" /><br id="a space" />
15336 !! html
15337 Something ...
15338 !! end
15339
15340 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
15341 !! test
15342 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
15343 !! options
15344 disabled
15345 !! wikitext
15346 <br id="foo" /><br id="foo" />
15347 !! html
15348 Something need to be done. foo-2 ?
15349 !! end
15350
15351 !! test
15352 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
15353 !! wikitext
15354 <div itemscope>
15355 <meta itemprop="hello" content="world">
15356 <meta http-equiv="refresh" content="5">
15357 <meta itemprop="hello" http-equiv="refresh" content="5">
15358 <link itemprop="hello" href="{{SERVER}}">
15359 <link rel="stylesheet" href="{{SERVER}}">
15360 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
15361 </div>
15362 !! html
15363 <div itemscope="itemscope">
15364 <p> <meta itemprop="hello" content="world" />
15365 &lt;meta http-equiv="refresh" content="5"&gt;
15366 <meta itemprop="hello" content="5" />
15367 </p>
15368 <link itemprop="hello" href="http&#58;//example.org" />
15369 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
15370 <link itemprop="hello" href="http&#58;//example.org" />
15371 </div>
15372
15373 !! end
15374
15375 !! test
15376 Language converter: output gets cut off unexpectedly (bug 5757)
15377 !! options
15378 language=zh
15379 !! wikitext
15380 this bit is safe: }-
15381
15382 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
15383
15384 then we get cut off here: }-
15385
15386 all additional text is vanished
15387 !! html
15388 <p>this bit is safe: }-
15389 </p><p>but if we add a conversion instance: xxx
15390 </p><p>then we get cut off here: }-
15391 </p><p>all additional text is vanished
15392 </p>
15393 !! end
15394
15395 !! test
15396 Self closed html pairs (bug 5487)
15397 !! options
15398 !! wikitext
15399 <center><font id="bug" />Centered text</center>
15400 <div><font id="bug2" />In div text</div>
15401 !! html
15402 <center>&lt;font id="bug" /&gt;Centered text</center>
15403 <div>&lt;font id="bug2" /&gt;In div text</div>
15404
15405 !! end
15406
15407 #
15408 #
15409 #
15410
15411 !! test
15412 Punctuation: nbsp before exclamation
15413 !! wikitext
15414 C'est grave !
15415 !! html
15416 <p>C'est grave&#160;!
15417 </p>
15418 !! end
15419
15420 !! test
15421 Punctuation: CSS !important (bug 11874)
15422 !! wikitext
15423 <div style="width:50% !important">important</div>
15424 !! html
15425 <div style="width:50% !important">important</div>
15426
15427 !!end
15428
15429 !! test
15430 Punctuation: CSS ! important (bug 11874; with space after)
15431 !! wikitext
15432 <div style="width:50% ! important">important</div>
15433 !! html
15434 <div style="width:50% ! important">important</div>
15435
15436 !!end
15437
15438 !! test
15439 HTML bullet list, closed tags (bug 5497)
15440 !! wikitext
15441 <ul>
15442 <li>One</li>
15443 <li>Two</li>
15444 </ul>
15445 !! html/php
15446 <ul>
15447 <li>One</li>
15448 <li>Two</li>
15449 </ul>
15450
15451 !! html/parsoid
15452 <ul data-parsoid='{"stx":"html"}'>
15453 <li data-parsoid='{"stx":"html"}'>One</li>
15454 <li data-parsoid='{"stx":"html"}'>Two</li>
15455 </ul>
15456
15457 !! end
15458
15459 !! test
15460 HTML bullet list, unclosed tags (bug 5497)
15461 !! wikitext
15462 <ul>
15463 <li>One
15464 <li>Two
15465 </ul>
15466 !! html/php+tidy
15467 <ul>
15468 <li>One</li>
15469 <li>Two</li>
15470 </ul>
15471 !! html/parsoid
15472 <ul data-parsoid='{"stx":"html"}'>
15473 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15474 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15475 </ul>
15476
15477 !! end
15478
15479 !! test
15480 HTML ordered list, closed tags (bug 5497)
15481 !! wikitext
15482 <ol>
15483 <li>One</li>
15484 <li>Two</li>
15485 </ol>
15486 !! html/php
15487 <ol>
15488 <li>One</li>
15489 <li>Two</li>
15490 </ol>
15491
15492 !! html/parsoid
15493 <ol data-parsoid='{"stx":"html"}'>
15494 <li data-parsoid='{"stx":"html"}'>One</li>
15495 <li data-parsoid='{"stx":"html"}'>Two</li>
15496 </ol>
15497
15498 !! end
15499
15500 !! test
15501 HTML ordered list, unclosed tags (bug 5497)
15502 !! options
15503 !! wikitext
15504 <ol>
15505 <li>One
15506 <li>Two
15507 </ol>
15508 !! html/php+tidy
15509 <ol>
15510 <li>One</li>
15511 <li>Two</li>
15512 </ol>
15513 !! html/parsoid
15514 <ol data-parsoid='{"stx":"html"}'>
15515 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15516 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15517 </ol>
15518
15519 !! end
15520
15521 !! test
15522 HTML nested bullet list, closed tags (bug 5497)
15523 !! wikitext
15524 <ul>
15525 <li>One</li>
15526 <li>Two:
15527 <ul>
15528 <li>Sub-one</li>
15529 <li>Sub-two</li>
15530 </ul>
15531 </li>
15532 </ul>
15533 !! html
15534 <ul>
15535 <li>One</li>
15536 <li>Two:
15537 <ul>
15538 <li>Sub-one</li>
15539 <li>Sub-two</li>
15540 </ul>
15541 </li>
15542 </ul>
15543
15544 !! end
15545
15546 !! test
15547 HTML nested bullet list, open tags (bug 5497)
15548 !! wikitext
15549 <ul>
15550 <li>One
15551 <li>Two:
15552 <ul>
15553 <li>Sub-one
15554 <li>Sub-two
15555 </ul>
15556 </ul>
15557 !! html/php+tidy
15558 <ul>
15559 <li>One</li>
15560 <li>Two:
15561 <ul>
15562 <li>Sub-one</li>
15563 <li>Sub-two</li>
15564 </ul>
15565 </li>
15566 </ul>
15567 !! html/parsoid
15568 <ul>
15569 <li>One
15570 </li>
15571 <li>Two:
15572 <ul>
15573 <li>Sub-one
15574 </li>
15575 <li>Sub-two
15576 </li>
15577 </ul>
15578 </li>
15579 </ul>
15580
15581 !! end
15582
15583 !! test
15584 HTML nested ordered list, closed tags (bug 5497)
15585 !! wikitext
15586 <ol>
15587 <li>One</li>
15588 <li>Two:
15589 <ol>
15590 <li>Sub-one</li>
15591 <li>Sub-two</li>
15592 </ol>
15593 </li>
15594 </ol>
15595 !! html
15596 <ol>
15597 <li>One</li>
15598 <li>Two:
15599 <ol>
15600 <li>Sub-one</li>
15601 <li>Sub-two</li>
15602 </ol>
15603 </li>
15604 </ol>
15605
15606 !! end
15607
15608 !! test
15609 HTML nested ordered list, open tags (bug 5497)
15610 !! wikitext
15611 <ol>
15612 <li>One
15613 <li>Two:
15614 <ol>
15615 <li>Sub-one
15616 <li>Sub-two
15617 </ol>
15618 </ol>
15619 !! html/php
15620 <ol>
15621 <li>One
15622 <li>Two:
15623 <ol>
15624 <li>Sub-one
15625 <li>Sub-two
15626 </ol>
15627 </ol>
15628
15629 !! html/parsoid
15630 <ol>
15631 <li>One
15632 </li>
15633 <li>Two:
15634 <ol>
15635 <li>Sub-one
15636 </li>
15637 <li>Sub-two
15638 </li>
15639 </ol>
15640 </li>
15641 </ol>
15642
15643 !! end
15644
15645 !! test
15646 HTML ordered list item with parameters oddity
15647 !! wikitext
15648 <ol><li id="fragment">One</li>
15649 </ol>
15650 !! html
15651 <ol><li id="fragment">One</li>
15652 </ol>
15653
15654 !! end
15655
15656 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
15657 !!test
15658 bug 5918: autonumbering
15659 !! wikitext
15660 [http://first/] [http://second] [ftp://ftp]
15661
15662 ftp://inlineftp
15663
15664 [mailto:enclosed@mail.tld With target]
15665
15666 [mailto:enclosed@mail.tld]
15667
15668 mailto:inline@mail.tld
15669 !! html/php
15670 <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>
15671 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
15672 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
15673 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
15674 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
15675 </p>
15676 !! html/parsoid
15677 <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>
15678 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
15679 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
15680 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
15681 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
15682 !! end
15683
15684
15685 #
15686 # Security and HTML correctness
15687 # From Nick Jenkins' fuzz testing
15688 #
15689
15690 !! test
15691 Fuzz testing: Parser13
15692 !! wikitext
15693 {|
15694 | http://a|
15695 !! html
15696 <table>
15697 <tr>
15698 <td>
15699 </td>
15700 </tr>
15701 </table>
15702
15703 !! end
15704
15705 !! test
15706 Fuzz testing: Parser14
15707 !! wikitext
15708 == onmouseover= ==
15709 http://__TOC__
15710 !! html
15711 <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>
15712 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15713 <ul>
15714 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15715 </ul>
15716 </div>
15717
15718
15719 !! html+tidy
15720 <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>
15721 <p>http://</p>
15722 <div id="toc" class="toc">
15723 <div id="toctitle">
15724 <h2>Contents</h2>
15725 </div>
15726 <ul>
15727 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15728 </ul>
15729 </div>
15730 <p></p>
15731 !! end
15732
15733 !! test
15734 Fuzz testing: Parser14-table
15735 !! wikitext
15736 ==a==
15737 {| STYLE=__TOC__
15738 !! html
15739 <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>
15740 <table style="&#95;_TOC&#95;_">
15741 <tr><td></td></tr>
15742 </table>
15743
15744 !! html+tidy
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="__TOC__">
15747 <tr>
15748 <td></td>
15749 </tr>
15750 </table>
15751 !! end
15752
15753 # Known to produce bogus xml (extra </td>)
15754 !! test
15755 Fuzz testing: Parser16
15756 !! options
15757 noxml
15758 !! wikitext
15759 {|
15760 !https://||||||
15761 !! html
15762 <table>
15763 <tr>
15764 <th>https://</th>
15765 <th></th>
15766 <th></th>
15767 <th>
15768 </td>
15769 </tr>
15770 </table>
15771
15772 !! html+tidy
15773 <table>
15774 <tr>
15775 <th>https://</th>
15776 <th></th>
15777 <th></th>
15778 <th></th>
15779 </tr>
15780 </table>
15781 !! end
15782
15783 !! test
15784 Fuzz testing: Parser21
15785 !! wikitext
15786 {|
15787 ! irc://{{ftp://a" onmouseover="alert('hello world');"
15788 |
15789 !! html
15790 <table>
15791 <tr>
15792 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
15793 </th>
15794 <td>
15795 </td>
15796 </tr>
15797 </table>
15798
15799 !! end
15800
15801 !! test
15802 Fuzz testing: Parser22
15803 !! wikitext
15804 http://===r:::https://b
15805
15806 {|
15807 !! html
15808 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
15809 </p>
15810 <table>
15811 <tr><td></td></tr>
15812 </table>
15813
15814 !! end
15815
15816 # Known to produce bad XML for now
15817 !! test
15818 Fuzz testing: Parser24
15819 !! options
15820 noxml
15821 !! wikitext
15822 {|
15823 {{{|
15824 <u CLASS=
15825 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
15826 <br style="onmouseover='alert(document.cookie);' " />
15827
15828 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15829 |
15830 !! html
15831 <table>
15832 {{{|
15833 <u class="&#124;">}}}} &gt;
15834 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
15835
15836 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15837 <tr>
15838 <td></u>
15839 </td>
15840 </tr>
15841 </table>
15842
15843 !! end
15844
15845 # Note: the current result listed for this is not what the original one was,
15846 # but the original bug was JavaScript injection, which is fixed in any case.
15847 # It's not clear that the original result listed was any more correct than the
15848 # current one. Original result:
15849 # <p>{{{|
15850 # </p>
15851 # <li class="&#124;&#124;">
15852 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15853 !!test
15854 Fuzz testing: Parser25 (bug 6055)
15855 !! wikitext
15856 {{{
15857 |
15858 <LI CLASS=||
15859 >
15860 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15861 !! html
15862 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15863 </p>
15864 !! end
15865
15866 !!test
15867 Fuzz testing: URL adjacent extension (with space, clean)
15868 !! wikitext
15869 http://example.com <nowiki>junk</nowiki>
15870 !! html/php
15871 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15872 </p>
15873 !! html/parsoid
15874 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
15875 !! end
15876
15877 !!test
15878 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15879 !! wikitext
15880 http://example.com<nowiki>junk</nowiki>
15881 !! html/php
15882 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15883 </p>
15884 !! html/parsoid
15885 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
15886 !! end
15887
15888 !!test
15889 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15890 !! wikitext
15891 http://example.com<pre>junk</pre>
15892 !! html/php
15893 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15894
15895 !! html/php+tidy
15896 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15897 <pre>
15898 junk
15899 </pre>
15900 !! html/parsoid
15901 <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>
15902 !!end
15903
15904 !!test
15905 Fuzz testing: image with bogus manual thumbnail
15906 !! wikitext
15907 [[Image:foobar.jpg|thumbnail= ]]
15908 !! html/php
15909 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
15910
15911 !! html/parsoid
15912 <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>
15913 !!end
15914
15915 !! test
15916 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15917 !! wikitext
15918 <pre dir="&#10;"></pre>
15919 !! html
15920 <pre dir="&#10;"></pre>
15921
15922 !! end
15923
15924 !! test
15925 Parsing optional HTML elements (Bug 6171)
15926 !! options
15927 !! wikitext
15928 <table>
15929 <tr>
15930 <td> Some tabular data</td>
15931 <td> More tabular data ...
15932 <td> And yet som tabular data</td>
15933 </tr>
15934 </table>
15935 !! html
15936 <table>
15937 <tr>
15938 <td> Some tabular data</td>
15939 <td> More tabular data ...
15940 </td><td> And yet som tabular data</td>
15941 </tr>
15942 </table>
15943
15944 !! end
15945
15946 !! test
15947 Correct handling of <td>, <tr> (Bug 6171)
15948 !! options
15949 !! wikitext
15950 <table>
15951 <tr>
15952 <td> Some tabular data</td>
15953 <td> More tabular data ...</td>
15954 <td> And yet som tabular data</td>
15955 </tr>
15956 </table>
15957 !! html
15958 <table>
15959 <tr>
15960 <td> Some tabular data</td>
15961 <td> More tabular data ...</td>
15962 <td> And yet som tabular data</td>
15963 </tr>
15964 </table>
15965
15966 !! end
15967
15968
15969 !! test
15970 Parsing crashing regression (fr:JavaScript)
15971 !! wikitext
15972 </body></x>
15973 !! html
15974 <p>&lt;/body&gt;&lt;/x&gt;
15975 </p>
15976 !! end
15977
15978 !! test
15979 Inline wiki vs wiki block nesting
15980 !! wikitext
15981 '''Bold paragraph
15982
15983 New wiki paragraph
15984 !! html
15985 <p><b>Bold paragraph</b>
15986 </p><p>New wiki paragraph
15987 </p>
15988 !! end
15989
15990 # FIXME: The current php output is documented
15991 # and desired output is the parsoid target.
15992 !! test
15993 Inline HTML vs wiki block nesting
15994 !! wikitext
15995 <b>Bold paragraph
15996
15997 New wiki paragraph
15998 !! html/php
15999 <p><b>Bold paragraph
16000 </p><p>New wiki paragraph</b>
16001 </p>
16002 !! html/parsoid
16003 <p><b>Bold paragraph</b>
16004 </p><p>New wiki paragraph
16005 </p>
16006 !! end
16007
16008 # Original result was this:
16009 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16010 # </p>
16011 # While that might be marginally more intuitive, maybe, the six-apostrophe
16012 # construct is clearly pathological and the result stated here (which is what
16013 # the parser actually does) is about as reasonable as anything.
16014 !!test
16015 Mixing markup for italics and bold
16016 !! options
16017 !! wikitext
16018 '''bold''''''bold''bolditalics'''''
16019 !! html
16020 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
16021 </p>
16022 !! end
16023
16024
16025 !! article
16026 Xyzzyx
16027 !! text
16028 Article for special page transclusion test
16029 !! endarticle
16030
16031 !! test
16032 Special page transclusion
16033 !! options
16034 !! wikitext
16035 {{Special:Prefixindex/Xyzzyx}}
16036 !! html
16037 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16038
16039 !! end
16040
16041 !! test
16042 Special page transclusion twice (bug 5021)
16043 !! options
16044 !! wikitext
16045 {{Special:Prefixindex/Xyzzyx}}
16046 {{Special:Prefixindex/Xyzzyx}}
16047 !! html
16048 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16049 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16050
16051 !! end
16052
16053 !! test
16054 Transclusion of default MediaWiki message
16055 !! wikitext
16056 {{MediaWiki:Mainpage}}
16057 !! html
16058 <p>Main Page
16059 </p>
16060 !! end
16061
16062 !! test
16063 Transclusion of nonexistent MediaWiki message
16064 !! wikitext
16065 {{MediaWiki:Mainpagexxx}}
16066 !! html
16067 <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>
16068 </p>
16069 !! end
16070
16071 !! test
16072 Transclusion of MediaWiki message with underscore
16073 !! wikitext
16074 {{MediaWiki:history_short}}
16075 !! html
16076 <p>History
16077 </p>
16078 !! end
16079
16080 !! test
16081 Transclusion of MediaWiki message with space
16082 !! wikitext
16083 {{MediaWiki:history short}}
16084 !! html
16085 <p>History
16086 </p>
16087 !! end
16088
16089 !! test
16090 Invalid header with following text
16091 !! wikitext
16092 = x = y
16093 !! html
16094 <p>= x = y
16095 </p>
16096 !! end
16097
16098
16099 !! test
16100 Section extraction test (section 0)
16101 !! options
16102 section=0
16103 !! wikitext
16104 start
16105 ==a==
16106 ===aa===
16107 ====aaa====
16108 ==b==
16109 ===ba===
16110 ===bb===
16111 ====bba====
16112 ===bc===
16113 ==c==
16114 ===ca===
16115 !! html
16116 start
16117 !! end
16118
16119 !! test
16120 Section extraction test (section 1)
16121 !! options
16122 section=1
16123 !! wikitext
16124 start
16125 ==a==
16126 ===aa===
16127 ====aaa====
16128 ==b==
16129 ===ba===
16130 ===bb===
16131 ====bba====
16132 ===bc===
16133 ==c==
16134 ===ca===
16135 !! html
16136 ==a==
16137 ===aa===
16138 ====aaa====
16139 !! end
16140
16141 !! test
16142 Section extraction test (section 2)
16143 !! options
16144 section=2
16145 !! wikitext
16146 start
16147 ==a==
16148 ===aa===
16149 ====aaa====
16150 ==b==
16151 ===ba===
16152 ===bb===
16153 ====bba====
16154 ===bc===
16155 ==c==
16156 ===ca===
16157 !! html
16158 ===aa===
16159 ====aaa====
16160 !! end
16161
16162 !! test
16163 Section extraction test (section 3)
16164 !! options
16165 section=3
16166 !! wikitext
16167 start
16168 ==a==
16169 ===aa===
16170 ====aaa====
16171 ==b==
16172 ===ba===
16173 ===bb===
16174 ====bba====
16175 ===bc===
16176 ==c==
16177 ===ca===
16178 !! html
16179 ====aaa====
16180 !! end
16181
16182 !! test
16183 Section extraction test (section 4)
16184 !! options
16185 section=4
16186 !! wikitext
16187 start
16188 ==a==
16189 ===aa===
16190 ====aaa====
16191 ==b==
16192 ===ba===
16193 ===bb===
16194 ====bba====
16195 ===bc===
16196 ==c==
16197 ===ca===
16198 !! html
16199 ==b==
16200 ===ba===
16201 ===bb===
16202 ====bba====
16203 ===bc===
16204 !! end
16205
16206 !! test
16207 Section extraction test (section 5)
16208 !! options
16209 section=5
16210 !! wikitext
16211 start
16212 ==a==
16213 ===aa===
16214 ====aaa====
16215 ==b==
16216 ===ba===
16217 ===bb===
16218 ====bba====
16219 ===bc===
16220 ==c==
16221 ===ca===
16222 !! html
16223 ===ba===
16224 !! end
16225
16226 !! test
16227 Section extraction test (section 6)
16228 !! options
16229 section=6
16230 !! wikitext
16231 start
16232 ==a==
16233 ===aa===
16234 ====aaa====
16235 ==b==
16236 ===ba===
16237 ===bb===
16238 ====bba====
16239 ===bc===
16240 ==c==
16241 ===ca===
16242 !! html
16243 ===bb===
16244 ====bba====
16245 !! end
16246
16247 !! test
16248 Section extraction test (section 7)
16249 !! options
16250 section=7
16251 !! wikitext
16252 start
16253 ==a==
16254 ===aa===
16255 ====aaa====
16256 ==b==
16257 ===ba===
16258 ===bb===
16259 ====bba====
16260 ===bc===
16261 ==c==
16262 ===ca===
16263 !! html
16264 ====bba====
16265 !! end
16266
16267 !! test
16268 Section extraction test (section 8)
16269 !! options
16270 section=8
16271 !! wikitext
16272 start
16273 ==a==
16274 ===aa===
16275 ====aaa====
16276 ==b==
16277 ===ba===
16278 ===bb===
16279 ====bba====
16280 ===bc===
16281 ==c==
16282 ===ca===
16283 !! html
16284 ===bc===
16285 !! end
16286
16287 !! test
16288 Section extraction test (section 9)
16289 !! options
16290 section=9
16291 !! wikitext
16292 start
16293 ==a==
16294 ===aa===
16295 ====aaa====
16296 ==b==
16297 ===ba===
16298 ===bb===
16299 ====bba====
16300 ===bc===
16301 ==c==
16302 ===ca===
16303 !! html
16304 ==c==
16305 ===ca===
16306 !! end
16307
16308 !! test
16309 Section extraction test (section 10)
16310 !! options
16311 section=10
16312 !! wikitext
16313 start
16314 ==a==
16315 ===aa===
16316 ====aaa====
16317 ==b==
16318 ===ba===
16319 ===bb===
16320 ====bba====
16321 ===bc===
16322 ==c==
16323 ===ca===
16324 !! html
16325 ===ca===
16326 !! end
16327
16328 !! test
16329 Section extraction test (nonexistent section 11)
16330 !! options
16331 section=11
16332 !! wikitext
16333 start
16334 ==a==
16335 ===aa===
16336 ====aaa====
16337 ==b==
16338 ===ba===
16339 ===bb===
16340 ====bba====
16341 ===bc===
16342 ==c==
16343 ===ca===
16344 !! html
16345 !! end
16346
16347 !! test
16348 Section extraction test with bogus heading (section 1)
16349 !! options
16350 section=1
16351 !! wikitext
16352 ==a==
16353 ==bogus== not a legal section
16354 ==b==
16355 !! html
16356 ==a==
16357 ==bogus== not a legal section
16358 !! end
16359
16360 !! test
16361 Section extraction test with bogus heading (section 2)
16362 !! options
16363 section=2
16364 !! wikitext
16365 ==a==
16366 ==bogus== not a legal section
16367 ==b==
16368 !! html
16369 ==b==
16370 !! end
16371
16372 !! test
16373 Section extraction test with comment after heading (section 1)
16374 !! options
16375 section=1
16376 !! wikitext
16377 ==a==
16378 ==b== <!-- -->
16379 ==c==
16380 !! html
16381 ==a==
16382 !! end
16383
16384 !! test
16385 Section extraction test with comment after heading (section 2)
16386 !! options
16387 section=2
16388 !! wikitext
16389 ==a==
16390 ==b== <!-- -->
16391 ==c==
16392 !! html
16393 ==b== <!-- -->
16394 !! end
16395
16396 !! test
16397 Section extraction test with bogus <nowiki> heading (section 1)
16398 !! options
16399 section=1
16400 !! wikitext
16401 ==a==
16402 ==bogus== <nowiki>not a legal section</nowiki>
16403 ==b==
16404 !! html
16405 ==a==
16406 ==bogus== <nowiki>not a legal section</nowiki>
16407 !! end
16408
16409 !! test
16410 Section extraction test with bogus <nowiki> heading (section 2)
16411 !! options
16412 section=2
16413 !! wikitext
16414 ==a==
16415 ==bogus== <nowiki>not a legal section</nowiki>
16416 ==b==
16417 !! html
16418 ==b==
16419 !! end
16420
16421
16422 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
16423 # instead of respecting commented sections
16424 !! test
16425 Section extraction prefixed by comment (section 1)
16426 !! options
16427 section=1
16428 !! wikitext
16429 <!-- -->==sec1==
16430 ==sec2==
16431 !! html
16432 ==sec2==
16433 !!end
16434
16435 !! test
16436 Section extraction prefixed by comment (section 2)
16437 !! options
16438 section=2
16439 !! wikitext
16440 <!-- -->==sec1==
16441 ==sec2==
16442 !! html
16443
16444 !!end
16445
16446
16447 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
16448 # instead of respecting HTML-style headings
16449 !! test
16450 Section extraction, mixed wiki and html (section 1)
16451 !! options
16452 section=1
16453 !! wikitext
16454 <h2>unmarked</h2>
16455 unmarked
16456 ==1==
16457 one
16458 ==2==
16459 two
16460 !! html
16461 ==1==
16462 one
16463 !! end
16464
16465 !! test
16466 Section extraction, mixed wiki and html (section 2)
16467 !! options
16468 section=2
16469 !! wikitext
16470 <h2>unmarked</h2>
16471 unmarked
16472 ==1==
16473 one
16474 ==2==
16475 two
16476 !! html
16477 ==2==
16478 two
16479 !! end
16480
16481
16482 # Formerly testing for bug 3342
16483 !! test
16484 Section extraction, heading surrounded by <noinclude>
16485 !! options
16486 section=1
16487 !! wikitext
16488 <noinclude>==unmarked==</noinclude>
16489 ==marked==
16490 !! html
16491 ==marked==
16492 !!end
16493
16494 # Test behavior of bug 19910
16495 !! test
16496 Sectiion with all-equals
16497 !! options
16498 section=2
16499 !! wikitext
16500 ===
16501 The line above must have a trailing space
16502 === <!--
16503 --> <!-- -->
16504 But just in case it doesn't...
16505 !! html
16506 === <!--
16507 --> <!-- -->
16508 But just in case it doesn't...
16509 !! end
16510
16511 !! test
16512 Section replacement test (section 0)
16513 !! options
16514 replace=0,"xxx"
16515 !! wikitext
16516 start
16517 ==a==
16518 ===aa===
16519 ====aaa====
16520 ==b==
16521 ===ba===
16522 ===bb===
16523 ====bba====
16524 ===bc===
16525 ==c==
16526 ===ca===
16527 !! html
16528 xxx
16529
16530 ==a==
16531 ===aa===
16532 ====aaa====
16533 ==b==
16534 ===ba===
16535 ===bb===
16536 ====bba====
16537 ===bc===
16538 ==c==
16539 ===ca===
16540 !! end
16541
16542 !! test
16543 Section replacement test (section 1)
16544 !! options
16545 replace=1,"xxx"
16546 !! wikitext
16547 start
16548 ==a==
16549 ===aa===
16550 ====aaa====
16551 ==b==
16552 ===ba===
16553 ===bb===
16554 ====bba====
16555 ===bc===
16556 ==c==
16557 ===ca===
16558 !! html
16559 start
16560 xxx
16561
16562 ==b==
16563 ===ba===
16564 ===bb===
16565 ====bba====
16566 ===bc===
16567 ==c==
16568 ===ca===
16569 !! end
16570
16571 !! test
16572 Section replacement test (section 2)
16573 !! options
16574 replace=2,"xxx"
16575 !! wikitext
16576 start
16577 ==a==
16578 ===aa===
16579 ====aaa====
16580 ==b==
16581 ===ba===
16582 ===bb===
16583 ====bba====
16584 ===bc===
16585 ==c==
16586 ===ca===
16587 !! html
16588 start
16589 ==a==
16590 xxx
16591
16592 ==b==
16593 ===ba===
16594 ===bb===
16595 ====bba====
16596 ===bc===
16597 ==c==
16598 ===ca===
16599 !! end
16600
16601 !! test
16602 Section replacement test (section 3)
16603 !! options
16604 replace=3,"xxx"
16605 !! wikitext
16606 start
16607 ==a==
16608 ===aa===
16609 ====aaa====
16610 ==b==
16611 ===ba===
16612 ===bb===
16613 ====bba====
16614 ===bc===
16615 ==c==
16616 ===ca===
16617 !! html
16618 start
16619 ==a==
16620 ===aa===
16621 xxx
16622
16623 ==b==
16624 ===ba===
16625 ===bb===
16626 ====bba====
16627 ===bc===
16628 ==c==
16629 ===ca===
16630 !! end
16631
16632 !! test
16633 Section replacement test (section 4)
16634 !! options
16635 replace=4,"xxx"
16636 !! wikitext
16637 start
16638 ==a==
16639 ===aa===
16640 ====aaa====
16641 ==b==
16642 ===ba===
16643 ===bb===
16644 ====bba====
16645 ===bc===
16646 ==c==
16647 ===ca===
16648 !! html
16649 start
16650 ==a==
16651 ===aa===
16652 ====aaa====
16653 xxx
16654
16655 ==c==
16656 ===ca===
16657 !! end
16658
16659 !! test
16660 Section replacement test (section 5)
16661 !! options
16662 replace=5,"xxx"
16663 !! wikitext
16664 start
16665 ==a==
16666 ===aa===
16667 ====aaa====
16668 ==b==
16669 ===ba===
16670 ===bb===
16671 ====bba====
16672 ===bc===
16673 ==c==
16674 ===ca===
16675 !! html
16676 start
16677 ==a==
16678 ===aa===
16679 ====aaa====
16680 ==b==
16681 xxx
16682
16683 ===bb===
16684 ====bba====
16685 ===bc===
16686 ==c==
16687 ===ca===
16688 !! end
16689
16690 !! test
16691 Section replacement test (section 6)
16692 !! options
16693 replace=6,"xxx"
16694 !! wikitext
16695 start
16696 ==a==
16697 ===aa===
16698 ====aaa====
16699 ==b==
16700 ===ba===
16701 ===bb===
16702 ====bba====
16703 ===bc===
16704 ==c==
16705 ===ca===
16706 !! html
16707 start
16708 ==a==
16709 ===aa===
16710 ====aaa====
16711 ==b==
16712 ===ba===
16713 xxx
16714
16715 ===bc===
16716 ==c==
16717 ===ca===
16718 !! end
16719
16720 !! test
16721 Section replacement test (section 7)
16722 !! options
16723 replace=7,"xxx"
16724 !! wikitext
16725 start
16726 ==a==
16727 ===aa===
16728 ====aaa====
16729 ==b==
16730 ===ba===
16731 ===bb===
16732 ====bba====
16733 ===bc===
16734 ==c==
16735 ===ca===
16736 !! html
16737 start
16738 ==a==
16739 ===aa===
16740 ====aaa====
16741 ==b==
16742 ===ba===
16743 ===bb===
16744 xxx
16745
16746 ===bc===
16747 ==c==
16748 ===ca===
16749 !! end
16750
16751 !! test
16752 Section replacement test (section 8)
16753 !! options
16754 replace=8,"xxx"
16755 !! wikitext
16756 start
16757 ==a==
16758 ===aa===
16759 ====aaa====
16760 ==b==
16761 ===ba===
16762 ===bb===
16763 ====bba====
16764 ===bc===
16765 ==c==
16766 ===ca===
16767 !! html
16768 start
16769 ==a==
16770 ===aa===
16771 ====aaa====
16772 ==b==
16773 ===ba===
16774 ===bb===
16775 ====bba====
16776 xxx
16777
16778 ==c==
16779 ===ca===
16780 !!end
16781
16782 !! test
16783 Section replacement test (section 9)
16784 !! options
16785 replace=9,"xxx"
16786 !! wikitext
16787 start
16788 ==a==
16789 ===aa===
16790 ====aaa====
16791 ==b==
16792 ===ba===
16793 ===bb===
16794 ====bba====
16795 ===bc===
16796 ==c==
16797 ===ca===
16798 !! html
16799 start
16800 ==a==
16801 ===aa===
16802 ====aaa====
16803 ==b==
16804 ===ba===
16805 ===bb===
16806 ====bba====
16807 ===bc===
16808 xxx
16809 !! end
16810
16811 !! test
16812 Section replacement test (section 10)
16813 !! options
16814 replace=10,"xxx"
16815 !! wikitext
16816 start
16817 ==a==
16818 ===aa===
16819 ====aaa====
16820 ==b==
16821 ===ba===
16822 ===bb===
16823 ====bba====
16824 ===bc===
16825 ==c==
16826 ===ca===
16827 !! html
16828 start
16829 ==a==
16830 ===aa===
16831 ====aaa====
16832 ==b==
16833 ===ba===
16834 ===bb===
16835 ====bba====
16836 ===bc===
16837 ==c==
16838 xxx
16839 !! end
16840
16841 !! test
16842 Section replacement test with initial whitespace (bug 13728)
16843 !! options
16844 replace=2,"xxx"
16845 !! wikitext
16846 Preformatted initial line
16847 ==a==
16848 ===a===
16849 !! html
16850 Preformatted initial line
16851 ==a==
16852 xxx
16853 !! end
16854
16855
16856 !! test
16857 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16858 !! options
16859 section=1
16860 !! wikitext
16861 ==a==
16862 a
16863 !! html
16864 ==a==
16865 a
16866 !! end
16867
16868 !! test
16869 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16870 !! options
16871 section=1
16872 !! wikitext
16873 ==a==
16874 a
16875 !! html
16876 ==a==
16877 a
16878 !! end
16879
16880
16881 !! test
16882 Section extraction, <pre> around bogus header (bug 10309)
16883 !! options
16884 noxml section=2
16885 !! wikitext
16886 == Section One ==
16887 <pre>
16888 =======
16889 </pre>
16890
16891 == Section Two ==
16892 stuff
16893 !! html
16894 == Section Two ==
16895 stuff
16896 !! end
16897
16898 !! test
16899 Section replacement, <pre> around bogus header (bug 10309)
16900 !! options
16901 noxml replace=2,"xxx"
16902 !! wikitext
16903 == Section One ==
16904 <pre>
16905 =======
16906 </pre>
16907
16908 == Section Two ==
16909 stuff
16910 !! html
16911 == Section One ==
16912 <pre>
16913 =======
16914 </pre>
16915
16916 xxx
16917 !! end
16918
16919
16920
16921 !! test
16922 Handling of &#x0A; in URLs
16923 !! wikitext
16924 ** irc://&#x0A;a
16925 !! html/php
16926 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16927
16928 !! html/parsoid
16929 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16930 a">irc://
16931 a</a></li></ul></li></ul>
16932 !! end
16933
16934 !! test
16935 Handling of %0A in URLs
16936 !! wikitext
16937 ** irc://%0Aa
16938 !! html/php
16939 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16940
16941 !! html/parsoid
16942 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16943 !! end
16944
16945
16946 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16947 !! test
16948 5 quotes, code coverage +1 line
16949 !! options
16950 parsoid=wt2html
16951 !! wikitext
16952 '''''
16953 !! html/php
16954 !! html/parsoid
16955 <p><b><i></i></b></p>
16956 !! end
16957
16958 # same html as previous, but wikitext adjusted to match parsoid html2wt
16959 # note that wt2html and html2html will put the <i> before the <b>
16960 !! test
16961 5 quotes, code coverage +1 line w/ nowiki (1)
16962 !! options
16963 parsoid=wt2wt,html2wt
16964 !! wikitext
16965 '''''<nowiki/>'''''
16966 !! html/php
16967 <p><i></i>
16968 </p>
16969 !! html/parsoid
16970 <p><b><i></i></b></p>
16971 !! end
16972
16973 # same as previous, just swapping the <i> and <b>
16974 !! test
16975 5 quotes, code coverage +1 line w/ nowiki (2)
16976 !! wikitext
16977 '''''<nowiki/>'''''
16978 !! html/php
16979 <p><i></i>
16980 </p>
16981 !! html/parsoid
16982 <p><i><b></b></i></p>
16983 !! end
16984
16985 !! test
16986 Special:Search page linking.
16987 !! wikitext
16988 {{Special:search}}
16989 !! html
16990 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16991 </p>
16992 !! end
16993
16994 !! test
16995 {{!}} is a magic word
16996 !! wikitext
16997 {{!}} is a magic word there and {{!}} is still a magic word here
16998 !! html/php
16999 <p>| is a magic word there and | is still a magic word here
17000 </p>
17001 !! html/parsoid
17002 <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>
17003 !! end
17004
17005 !! test
17006 Say the magic word
17007 !! options
17008 title=[[Parser test]]
17009 !! wikitext
17010 * {{PAGENAME}}
17011 * {{PAGENAMEE}}
17012 * {{FULLPAGENAME}}
17013 * {{FULLPAGENAMEE}}
17014 * {{BASEPAGENAME}}
17015 * {{BASEPAGENAMEE}}
17016 * {{SUBPAGENAME}}
17017 * {{SUBPAGENAMEE}}
17018 * {{ROOTPAGENAME}}
17019 * {{ROOTPAGENAMEE}}
17020 * {{TALKPAGENAME}}
17021 * {{TALKPAGENAMEE}}
17022 * {{SUBJECTPAGENAME}}
17023 * {{SUBJECTPAGENAMEE}}
17024 * {{NAMESPACEE}}
17025 * {{NAMESPACE}}
17026 * {{NAMESPACENUMBER}}
17027 * {{TALKSPACE}}
17028 * {{TALKSPACEE}}
17029 * {{SUBJECTSPACE}}
17030 * {{SUBJECTSPACEE}}
17031 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
17032 !! html
17033 <ul><li> Parser test</li>
17034 <li> Parser_test</li>
17035 <li> Parser test</li>
17036 <li> Parser_test</li>
17037 <li> Parser test</li>
17038 <li> Parser_test</li>
17039 <li> Parser test</li>
17040 <li> Parser_test</li>
17041 <li> Parser test</li>
17042 <li> Parser_test</li>
17043 <li> Talk:Parser test</li>
17044 <li> Talk:Parser_test</li>
17045 <li> Parser test</li>
17046 <li> Parser_test</li>
17047 <li> </li>
17048 <li> </li>
17049 <li> 0</li>
17050 <li> Talk</li>
17051 <li> Talk</li>
17052 <li> </li>
17053 <li> </li>
17054 <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>
17055
17056 !! end
17057 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
17058
17059 !! test
17060 Gallery
17061 !! wikitext
17062 <gallery>
17063 image1.png |
17064 image2.gif|||||
17065
17066 image3|
17067 image4 |300px| centre
17068 image5.svg| http://///////
17069 [[x|xx]]]]
17070 * image6
17071 </gallery>
17072 !! html
17073 <ul class="gallery mw-gallery-traditional">
17074 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17075 <div class="thumb" style="height: 150px;">Image1.png</div>
17076 <div class="gallerytext">
17077 </div>
17078 </div></li>
17079 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17080 <div class="thumb" style="height: 150px;">Image2.gif</div>
17081 <div class="gallerytext">
17082 <p>||||
17083 </p>
17084 </div>
17085 </div></li>
17086 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17087 <div class="thumb" style="height: 150px;">Image3</div>
17088 <div class="gallerytext">
17089 </div>
17090 </div></li>
17091 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17092 <div class="thumb" style="height: 150px;">Image4</div>
17093 <div class="gallerytext">
17094 <p>300px| centre
17095 </p>
17096 </div>
17097 </div></li>
17098 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17099 <div class="thumb" style="height: 150px;">Image5.svg</div>
17100 <div class="gallerytext">
17101 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
17102 </p>
17103 </div>
17104 </div></li>
17105 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17106 <div class="thumb" style="height: 150px;">* image6</div>
17107 <div class="gallerytext">
17108 </div>
17109 </div></li>
17110 </ul>
17111
17112 !! end
17113
17114 !! test
17115 Gallery (with options)
17116 !! wikitext
17117 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
17118 File:Nonexistent.jpg|caption
17119 File:Nonexistent.jpg
17120 image:foobar.jpg|some '''caption''' [[Main Page]]
17121 image:foobar.jpg
17122 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
17123 </gallery>
17124 !! html
17125 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
17126 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
17127 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17128 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17129 <div class="gallerytext">
17130 <p>caption
17131 </p>
17132 </div>
17133 </div></li>
17134 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17135 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17136 <div class="gallerytext">
17137 </div>
17138 </div></li>
17139 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17140 <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>
17141 <div class="gallerytext">
17142 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17143 </p>
17144 </div>
17145 </div></li>
17146 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17147 <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>
17148 <div class="gallerytext">
17149 </div>
17150 </div></li>
17151 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17152 <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>
17153 <div class="gallerytext">
17154 <p>Blabla|blabla.
17155 </p>
17156 </div>
17157 </div></li>
17158 </ul>
17159
17160 !! end
17161
17162 !! test
17163 Gallery with link that has fragment
17164 !! wikitext
17165 <gallery>
17166 image:foobar.jpg|link=Main_Page
17167 image:foobar.jpg|link=Main_Page#section
17168 image:foobar.jpg|link=Main Page#section|caption
17169 </gallery>
17170 !! html
17171 <ul class="gallery mw-gallery-traditional">
17172 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17173 <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>
17174 <div class="gallerytext">
17175 </div>
17176 </div></li>
17177 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17178 <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>
17179 <div class="gallerytext">
17180 </div>
17181 </div></li>
17182 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17183 <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>
17184 <div class="gallerytext">
17185 <p>caption
17186 </p>
17187 </div>
17188 </div></li>
17189 </ul>
17190
17191 !! end
17192
17193 !! test
17194 Gallery with wikitext inside caption
17195 !! wikitext
17196 <gallery>
17197 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
17198 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
17199 </gallery>
17200 !! html
17201 <ul class="gallery mw-gallery-traditional">
17202 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17203 <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>
17204 <div class="gallerytext">
17205 <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>
17206 </p>
17207 </div>
17208 </div></li>
17209 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17210 <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>
17211 <div class="gallerytext">
17212 <p>This is a test template
17213 </p>
17214 </div>
17215 </div></li>
17216 </ul>
17217
17218 !! end
17219
17220 !! test
17221 gallery (with showfilename option)
17222 !! wikitext
17223 <gallery showfilename>
17224 File:Nonexistent.jpg|caption
17225 File:Nonexistent.jpg
17226 image:foobar.jpg|some '''caption''' [[Main Page]]
17227 File:Foobar.jpg
17228 </gallery>
17229 !! html
17230 <ul class="gallery mw-gallery-traditional">
17231 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17232 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17233 <div class="gallerytext">
17234 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17235 caption
17236 </p>
17237 </div>
17238 </div></li>
17239 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17240 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17241 <div class="gallerytext">
17242 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17243 </p>
17244 </div>
17245 </div></li>
17246 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17247 <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>
17248 <div class="gallerytext">
17249 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17250 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17251 </p>
17252 </div>
17253 </div></li>
17254 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17255 <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>
17256 <div class="gallerytext">
17257 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17258 </p>
17259 </div>
17260 </div></li>
17261 </ul>
17262
17263 !! end
17264
17265 !! test
17266 Gallery (with namespace-less filenames)
17267 !! wikitext
17268 <gallery>
17269 File:Nonexistent.jpg
17270 Nonexistent.jpg
17271 image:foobar.jpg
17272 foobar.jpg
17273 </gallery>
17274 !! html
17275 <ul class="gallery mw-gallery-traditional">
17276 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17277 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17278 <div class="gallerytext">
17279 </div>
17280 </div></li>
17281 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17282 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17283 <div class="gallerytext">
17284 </div>
17285 </div></li>
17286 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17287 <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>
17288 <div class="gallerytext">
17289 </div>
17290 </div></li>
17291 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17292 <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>
17293 <div class="gallerytext">
17294 </div>
17295 </div></li>
17296 </ul>
17297
17298 !! end
17299
17300 !! test
17301 HTML Hex character encoding (spells the word "JavaScript")
17302 !! options
17303 parsoid=wt2html,wt2wt,html2html
17304 !! wikitext
17305 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
17306 !! html/php
17307 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
17308 </p>
17309 !! html/php+tidy
17310 <p>JavaScript</p>
17311 !! html/parsoid
17312 <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>
17313 !! end
17314
17315 !! test
17316 HTML Hex character encoding bogus encoding (bug 26437 regression check)
17317 !! wikitext
17318 &#xsee;&#XSEE;
17319 !! html/php
17320 <p>&amp;#xsee;&amp;#XSEE;
17321 </p>
17322 !! html/parsoid
17323 <p>&amp;#xsee;&amp;#XSEE;</p>
17324 !! end
17325
17326 !! test
17327 HTML Hex character encoding mixed case
17328 !! options
17329 parsoid=wt2html,wt2wt,html2html
17330 !! wikitext
17331 &#xEE;&#Xee;
17332 !! html/php
17333 <p>&#xee;&#xee;
17334 </p>
17335 !! html/php+tidy
17336 <p>îî</p>
17337 !! html/parsoid
17338 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
17339 !! end
17340
17341 !! test
17342 __FORCETOC__ override
17343 !! wikitext
17344 __NEWSECTIONLINK__
17345 __FORCETOC__
17346 !! html
17347 <p><br />
17348 </p>
17349 !! end
17350
17351 !! test
17352 ISBN code coverage
17353 !! wikitext
17354 ISBN 978-0-1234-56&#x20;789
17355 !! html
17356 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
17357 </p>
17358 !! html+tidy
17359 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
17360 !! html/parsoid
17361 <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>
17362 !! end
17363
17364 !! test
17365 ISBN followed by 5 spaces
17366 !! wikitext
17367 ISBN
17368 !! html
17369 <p>ISBN
17370 </p>
17371 !! end
17372
17373 !! test
17374 Double ISBN
17375 !! wikitext
17376 ISBN ISBN 1234567890
17377 !! html/php
17378 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17379 </p>
17380 !! html/parsoid
17381 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
17382 !! end
17383
17384 !! test
17385 ISBN with an X
17386 !! wikitext
17387 ISBN 3-462-04561-X
17388 ISBN 080442957X
17389 ISBN 978080442957X
17390 !! html/php
17391 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
17392 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
17393 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
17394 </p>
17395 !! html/parsoid
17396 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
17397 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
17398 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p>
17399 !! end
17400
17401 !! test
17402 ISBN with empty prefix (parsoid test)
17403 !! wikitext
17404 ISBN 1234567890
17405 !! html/php
17406 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17407 </p>
17408 !! html/parsoid
17409 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
17410 !! end
17411
17412 !! test
17413 Bug 22905: <abbr> followed by ISBN followed by </a>
17414 !! wikitext
17415 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
17416 !! html/php
17417 <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>
17418 </p>
17419 !! html/parsoid
17420 <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>
17421 !! end
17422
17423 !! test
17424 Double RFC
17425 !! wikitext
17426 RFC RFC 1234
17427 !! html
17428 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
17429 </p>
17430 !! end
17431
17432 !! test
17433 Double RFC with a wiki link
17434 !! wikitext
17435 RFC [[RFC 1234]]
17436 !! html
17437 <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>
17438 </p>
17439 !! end
17440
17441 !! test
17442 RFC code coverage
17443 !! wikitext
17444 RFC 983&#x20;987
17445 !! html
17446 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
17447 </p>
17448 !! html+tidy
17449 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
17450 !! end
17451
17452 !! test
17453 Centre-aligned image
17454 !! wikitext
17455 [[Image:foobar.jpg|centre]]
17456 !! html
17457 <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>
17458
17459 !!end
17460
17461 !! test
17462 None-aligned image
17463 !! wikitext
17464 [[Image:foobar.jpg|none]]
17465 !! html
17466 <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>
17467
17468 !!end
17469
17470 !! test
17471 Width + Height sized image (using px) (height is ignored)
17472 !! wikitext
17473 [[Image:foobar.jpg|640x480px]]
17474 !! html
17475 <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>
17476 </p>
17477 !!end
17478
17479 !! test
17480 Width-sized image (using px, no following whitespace)
17481 !! wikitext
17482 [[Image:foobar.jpg|640px]]
17483 !! html
17484 <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>
17485 </p>
17486 !!end
17487
17488 !! test
17489 Width-sized image (using px, with following whitespace - test regression from r39467)
17490 !! wikitext
17491 [[Image:foobar.jpg|640px ]]
17492 !! html
17493 <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>
17494 </p>
17495 !!end
17496
17497 !! test
17498 Width-sized image (using px, with preceding whitespace - test regression from r39467)
17499 !! wikitext
17500 [[Image:foobar.jpg| 640px]]
17501 !! html
17502 <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>
17503 </p>
17504 !!end
17505
17506 !! test
17507 Image with page parameter
17508 !! options
17509 djvu
17510 !! wikitext
17511 [[File:LoremIpsum.djvu|page=2]]
17512 !! html/php
17513 <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>
17514 </p>
17515 !! html/parsoid
17516 <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>
17517 !! end
17518
17519 !! test
17520 Another italics / bold test
17521 !! wikitext
17522 ''' ''x'
17523 !! html
17524 <pre>'<i> </i>x'
17525 </pre>
17526 !!end
17527
17528 # FIXME: The php output seems broken. It's interleaving some open/close tags.
17529 !! test
17530 dt/dd/dl test
17531 !! wikitext
17532 :;;;::
17533 !! html/php
17534 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
17535
17536 !! html/parsoid
17537 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
17538
17539 !!end
17540
17541
17542 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
17543 !! test
17544 Images with the "|" character in the comment
17545 !! wikitext
17546 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
17547 !! html/php
17548 <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>
17549
17550 !! html/parsoid
17551 <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>
17552 !! end
17553
17554 !! test
17555 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
17556 !! wikitext
17557 <html><script>alert(1);</script></html>
17558 !! html
17559 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
17560 </p>
17561 !! end
17562
17563 !! test
17564 HTML with raw HTML ($wgRawHtml==true)
17565 !! options
17566 wgRawHtml=1
17567 !! wikitext
17568 <html><script>alert(1);</script></html>
17569 !! html
17570 <p><script>alert(1);</script>
17571 </p>
17572 !! end
17573
17574 !! test
17575 Parents of subpages, one level up
17576 !! options
17577 subpage title=[[Subpage test/L1/L2/L3]]
17578 !! wikitext
17579 [[../|L2]]
17580 !! html
17581 <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>
17582 </p>
17583 !! end
17584
17585
17586 !! test
17587 Parents of subpages, one level up, not named
17588 !! options
17589 subpage title=[[Subpage test/L1/L2/L3]]
17590 !! wikitext
17591 [[../]]
17592 !! html
17593 <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>
17594 </p>
17595 !! end
17596
17597
17598
17599 !! test
17600 Parents of subpages, two levels up
17601 !! options
17602 subpage title=[[Subpage test/L1/L2/L3]]
17603 !! wikitext
17604 [[../../|L1]]2
17605
17606 [[../../|L1]]l
17607 !! html
17608 <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
17609 </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>
17610 </p>
17611 !! end
17612
17613 !! test
17614 Parents of subpages, two levels up, without trailing slash or name.
17615 !! options
17616 subpage title=[[Subpage test/L1/L2/L3]]
17617 !! wikitext
17618 [[../..]]
17619 !! html
17620 <p>[[../..]]
17621 </p>
17622 !! end
17623
17624 !! test
17625 Parents of subpages, two levels up, with lots of extra trailing slashes.
17626 !! options
17627 subpage title=[[Subpage test/L1/L2/L3]]
17628 !! wikitext
17629 [[../../////]]
17630 !! html
17631 <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>
17632 </p>
17633 !! end
17634
17635 !! article
17636 Subpage test/L1/L2/L3Sibling
17637 !! text
17638 Sibling article
17639 !! endarticle
17640
17641 !! test
17642 Transclusion of a sibling page (one level up)
17643 !! options
17644 subpage title=[[Subpage test/L1/L2/L3]]
17645 !! wikitext
17646 {{../L3Sibling}}
17647 !! html
17648 <p>Sibling article
17649 </p>
17650 !! end
17651
17652 !! test
17653 Transclusion of a child page
17654 !! options
17655 subpage title=[[Subpage test/L1/L2]]
17656 !! wikitext
17657 {{/L3Sibling}}
17658 !! html
17659 <p>Sibling article
17660 </p>
17661 !! end
17662
17663 !! test
17664 Non-transclusion because of too many up levels
17665 !! options
17666 subpage title=[[Subpage test/L1/L2/L3]]
17667 !! wikitext
17668 {{../../../../More than parent}}
17669 !! html
17670 <p>{{../../../../More than parent}}
17671 </p>
17672 !! end
17673
17674 !! test
17675 Definition list code coverage
17676 !! wikitext
17677 ; title : def
17678 ; title : def
17679 ;title: def
17680 !! html/php
17681 <dl><dt> title &#160;</dt>
17682 <dd> def</dd>
17683 <dt> title&#160;</dt>
17684 <dd> def</dd>
17685 <dt>title</dt>
17686 <dd> def</dd></dl>
17687
17688 !! html/parsoid
17689 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17690 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17691 <dt>title</dt><dd> def</dd></dl>
17692 !! end
17693
17694 !! test
17695 Don't fall for the self-closing div
17696 !! wikitext
17697 <div>hello world</div/>
17698 !! html
17699 <div>hello world</div>
17700
17701 !! end
17702
17703 !! test
17704 MSGNW magic word
17705 !! wikitext
17706 {{MSGNW:msg}}
17707 !! html
17708 <p>&#91;&#91;:Template:Msg&#93;&#93;
17709 </p>
17710 !! end
17711
17712 !! test
17713 RAW magic word
17714 !! wikitext
17715 {{RAW:QUERTY}}
17716 !! html
17717 <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>
17718 </p>
17719 !! end
17720
17721 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
17722 !! test
17723 Always escape literal '>' in output, not just after '<'
17724 !! wikitext
17725 ><>
17726 !! html
17727 <p>&gt;&lt;&gt;
17728 </p>
17729 !! end
17730
17731 !! test
17732 Template caching
17733 !! wikitext
17734 {{Test}}
17735 {{Test}}
17736 !! html
17737 <p>This is a test template
17738 This is a test template
17739 </p>
17740 !! end
17741
17742
17743 !! article
17744 MediaWiki:Fake
17745 !! text
17746 ==header==
17747 !! endarticle
17748
17749 !! test
17750 Inclusion of !userCanEdit() content
17751 !! wikitext
17752 {{MediaWiki:Fake}}
17753 !! html
17754 <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>
17755
17756 !! end
17757
17758
17759 !! test
17760 Out-of-order TOC heading levels
17761 !! wikitext
17762 ==2==
17763 ======6======
17764 ===3===
17765 =1=
17766 =====5=====
17767 ==2==
17768 !! html
17769 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17770 <ul>
17771 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
17772 <ul>
17773 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
17774 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
17775 </ul>
17776 </li>
17777 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
17778 <ul>
17779 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
17780 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
17781 </ul>
17782 </li>
17783 </ul>
17784 </div>
17785
17786 <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>
17787 <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>
17788 <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>
17789 <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>
17790 <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>
17791 <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>
17792
17793 !! end
17794
17795
17796 !! test
17797 ISBN with a dummy number
17798 !! wikitext
17799 ISBN ---
17800 !! html
17801 <p>ISBN ---
17802 </p>
17803 !! end
17804
17805
17806 !! test
17807 ISBN with space-delimited number
17808 !! wikitext
17809 ISBN 92 9017 032 8
17810 !! html
17811 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
17812 </p>
17813 !! end
17814
17815
17816 !! test
17817 ISBN with multiple spaces, no number
17818 !! wikitext
17819 ISBN foo
17820 !! html
17821 <p>ISBN foo
17822 </p>
17823 !! end
17824
17825
17826 !! test
17827 ISBN length
17828 !! wikitext
17829 ISBN 123456789
17830
17831 ISBN 1234567890
17832
17833 ISBN 12345678901
17834 !! html
17835 <p>ISBN 123456789
17836 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17837 </p><p>ISBN 12345678901
17838 </p>
17839 !! end
17840
17841
17842 !! test
17843 ISBN with trailing year (bug 8110)
17844 !! wikitext
17845 ISBN 1-234-56789-0 - 2006
17846
17847 ISBN 1 234 56789 0 - 2006
17848 !! html
17849 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
17850 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
17851 </p>
17852 !! end
17853
17854
17855 !! test
17856 anchorencode
17857 !! wikitext
17858 {{anchorencode:foo bar©#%n}}
17859 !! html
17860 <p>foo_bar.C2.A9.23.25n
17861 </p>
17862 !! end
17863
17864 !! test
17865 anchorencode trims spaces
17866 !! wikitext
17867 {{anchorencode: __pretty__please__}}
17868 !! html
17869 <p>pretty_please
17870 </p>
17871 !! end
17872
17873 !! test
17874 anchorencode deals with links
17875 !! wikitext
17876 {{anchorencode: [[hello|world]] [[hi]]}}
17877 !! html
17878 <p>world_hi
17879 </p>
17880 !! end
17881
17882 !! test
17883 anchorencode deals with templates
17884 !! wikitext
17885 {{anchorencode: {{Foo}} }}
17886 !! html
17887 <p>FOO
17888 </p>
17889 !! end
17890
17891 !! test
17892 anchorencode encodes like the TOC generator: (bug 18431)
17893 !! wikitext
17894 === _ +:.3A%3A&&amp;]] ===
17895 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17896 __NOEDITSECTION__
17897 !! html
17898 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17899 <p>.2B:.3A.253A.26.26.5D.5D
17900 </p>
17901 !! end
17902
17903 !! test
17904 Bug 6200: blockquotes and paragraph formatting
17905 !! wikitext
17906 <blockquote>
17907 foo
17908 </blockquote>
17909
17910 bar
17911
17912 baz
17913 !! html
17914 <blockquote>
17915 <p>foo
17916 </p>
17917 </blockquote>
17918 <p>bar
17919 </p>
17920 <pre>baz
17921 </pre>
17922 !! end
17923
17924 !! test
17925 Bug 8293: Use of center tag ruins paragraph formatting
17926 !! wikitext
17927 <center>
17928 foo
17929 </center>
17930
17931 bar
17932
17933 baz
17934 !! html
17935 <center>
17936 <p>foo
17937 </p>
17938 </center>
17939 <p>bar
17940 </p>
17941 <pre>baz
17942 </pre>
17943 !! end
17944
17945 !!test
17946 Parsing of overlapping (improperly nested) inline html tags
17947 !! wikitext
17948 <span><s>x</span></s>
17949 !! html/php
17950 <p><span><s>x&lt;/span&gt;</s></span>
17951 </p>
17952 !! html/parsoid
17953 <p><span><s>x</s></span>
17954 </p>
17955 !!end
17956
17957 ###
17958 ### Language variants related tests
17959 ###
17960 !! test
17961 Self-link in language variants
17962 !! options
17963 title=[[Dunav]] language=sr
17964 !! wikitext
17965 Both [[Dunav]] and [[Дунав]] are names for this river.
17966 !! html
17967 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17968 </p>
17969 !!end
17970
17971 !! article
17972 Дуна
17973 !! text
17974 content
17975 !! endarticle
17976
17977 !! test
17978 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17979 !! options
17980 title=[[Duna]] language=sr
17981 !! wikitext
17982 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17983 !! html
17984 <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.
17985 </p>
17986 !! end
17987
17988 !! test
17989 Link to a section of a variant of this title shouldn't be parsed as self-link
17990 !! options
17991 title=[[Duna]] language=sr
17992 !! wikitext
17993 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
17994 !! html
17995 <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.
17996 </p>
17997 !! end
17998
17999 !! test
18000 Link to pages in language variants
18001 !! options
18002 language=sr
18003 !! wikitext
18004 Main Page can be written as [[Маин Паге]]
18005 !! html
18006 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
18007 </p>
18008 !!end
18009
18010
18011 !! test
18012 Multiple links to pages in language variants
18013 !! options
18014 language=sr
18015 !! wikitext
18016 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
18017 !! html
18018 <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>.
18019 </p>
18020 !!end
18021
18022
18023 !! test
18024 Simple template in language variants
18025 !! options
18026 language=sr
18027 !! wikitext
18028 {{тест}}
18029 !! html
18030 <p>This is a test template
18031 </p>
18032 !! end
18033
18034
18035 !! test
18036 Template with explicit namespace in language variants
18037 !! options
18038 language=sr
18039 !! wikitext
18040 {{Template:тест}}
18041 !! html
18042 <p>This is a test template
18043 </p>
18044 !! end
18045
18046
18047 !! test
18048 Basic test for template parameter in language variants
18049 !! options
18050 language=sr
18051 !! wikitext
18052 {{парамтест|param=foo}}
18053 !! html
18054 <p>This is a test template with parameter foo
18055 </p>
18056 !! end
18057
18058
18059 !! test
18060 Simple category in language variants
18061 !! options
18062 language=sr cat
18063 !! wikitext
18064 [[Category:МедиаWики Усер'с Гуиде]]
18065 !! html
18066 <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>
18067 !! end
18068
18069
18070 !! article
18071 Category:分类
18072 !! text
18073 blah
18074 !! endarticle
18075
18076 !! article
18077 Category:分類
18078 !! text
18079 blah
18080 !! endarticle
18081
18082 !! test
18083 Don't convert blue categorylinks to another variant (bug 33210)
18084 !! options
18085 language=zh cat
18086 !! wikitext
18087 [[A]][[Category:分类]]
18088 !! html
18089 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
18090 !! end
18091
18092
18093 !! test
18094 Stripping -{}- tags (language variants)
18095 !! options
18096 language=sr
18097 !! wikitext
18098 Latin proverb: -{Ne nuntium necare}-
18099 !! html
18100 <p>Latin proverb: Ne nuntium necare
18101 </p>
18102 !! end
18103
18104
18105 !! test
18106 Prevent conversion with -{}- tags (language variants)
18107 !! options
18108 language=sr variant=sr-ec
18109 !! wikitext
18110 Latinski: -{Ne nuntium necare}-
18111 !! html
18112 <p>Латински: Ne nuntium necare
18113 </p>
18114 !! end
18115
18116
18117 !! test
18118 Prevent conversion of text with -{}- tags (language variants)
18119 !! options
18120 language=sr variant=sr-ec
18121 !! wikitext
18122 Latinski: -{Ne nuntium necare}-
18123 !! html
18124 <p>Латински: Ne nuntium necare
18125 </p>
18126 !! end
18127
18128
18129 !! test
18130 Prevent conversion of links with -{}- tags (language variants)
18131 !! options
18132 language=sr variant=sr-ec
18133 !! wikitext
18134 -{[[Main Page]]}-
18135 !! html
18136 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18137 </p>
18138 !! end
18139
18140
18141 !! test
18142 -{}- tags within headlines (within html for parserConvert())
18143 !! options
18144 language=sr variant=sr-ec
18145 !! wikitext
18146 == -{Naslov}- ==
18147 !! html
18148 <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>
18149
18150 !! end
18151
18152
18153 !! test
18154 Explicit definition of language variant alternatives
18155 !! options
18156 language=zh variant=zh-tw
18157 !! wikitext
18158 -{zh:China;zh-tw:Taiwan}-, not China
18159 !! html
18160 <p>Taiwan, not China
18161 </p>
18162 !! end
18163
18164
18165 !! test
18166 Conversion around HTML tags
18167 !! options
18168 language=sr variant=sr-ec
18169 !! wikitext
18170 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
18171 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
18172 !! html
18173 <p>
18174 <span title="ЛаCтин">ски</span>
18175 </p>
18176 !! end
18177
18178
18179 !! test
18180 Explicit session-wise language variant mapping (A flag and - flag)
18181 !! options
18182 language=zh variant=zh-tw
18183 !! wikitext
18184 Taiwan is not China.
18185 But -{A|zh:China;zh-tw:Taiwan}- is China,
18186 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
18187 and -{China}- is China.
18188 !! html
18189 <p>Taiwan is not China.
18190 But Taiwan is Taiwan,
18191 (This should be stripped!)
18192 and China is China.
18193 </p>
18194 !! end
18195
18196 !! test
18197 Explicit session-wise language variant mapping (H flag for hide)
18198 !! options
18199 language=zh variant=zh-tw
18200 !! wikitext
18201 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
18202 Taiwan is China.
18203 !! html
18204 <p>(This should be stripped!)
18205 Taiwan is Taiwan.
18206 </p>
18207 !! end
18208
18209 !! test
18210 Adding explicit conversion rule for title (T flag)
18211 !! options
18212 language=zh variant=zh-tw showtitle
18213 !! wikitext
18214 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18215 !! html
18216 Taiwan
18217 <p>Should be stripped!
18218 </p>
18219 !! end
18220
18221 !! test
18222 Testing that changing the language variant here in the tests actually works
18223 !! options
18224 language=zh variant=zh showtitle
18225 !! wikitext
18226 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18227 !! html
18228 China
18229 <p>Should be stripped!
18230 </p>
18231 !! end
18232
18233 !! test
18234 Recursive conversion of alt and title attrs shouldn't clear converter state
18235 !! options
18236 language=zh variant=zh-cn showtitle
18237 !! wikitext
18238 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
18239 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
18240 !! html
18241 China
18242 <p>
18243 Should be stripped<span title="Exclamation">!</span>
18244 </p>
18245 !! end
18246
18247 !! test
18248 Bug 24072: more test on conversion rule for title
18249 !! options
18250 language=zh variant=zh-tw showtitle
18251 !! wikitext
18252 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18253 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
18254 !! html
18255 Taiwan
18256 <p>This should be stripped!
18257 This won't take interferes with the title rule.
18258 </p>
18259 !! end
18260
18261 !! test
18262 Partly disable title conversion if variant == main language code
18263 !! options
18264 language=zh variant=zh title=[[ZH]] showtitle
18265 !! wikitext
18266 -{T|zh-cn:CN;zh-tw:TW}-
18267 !! html
18268 ZH
18269 <p>
18270 </p>
18271 !! end
18272
18273 !! test
18274 Partly disable title conversion if variant == main language code, more
18275 !! options
18276 language=zh variant=zh title=[[ZH]] showtitle
18277 !! wikitext
18278 -{T|TW}-
18279 !! html
18280 ZH
18281 <p>
18282 </p>
18283 !! end
18284
18285 !! test
18286 Raw output of variant escape tags (R flag)
18287 !! options
18288 language=zh variant=zh-tw
18289 !! wikitext
18290 Raw: -{R|zh:China;zh-tw:Taiwan}-
18291 !! html
18292 <p>Raw: zh:China;zh-tw:Taiwan
18293 </p>
18294 !! end
18295
18296 !! test
18297 Strings evaluating false shouldn't be ignored by Language converter (T51072)
18298 !! options
18299 language=zh variant=zh-cn
18300 !! input
18301 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
18302 !! result
18303 <p>0
18304 </p>
18305 !! end
18306
18307 !! test
18308 Conversion rules from [numeric-only string] to [something else] (T48634)
18309 !! options
18310 language=zh variant=zh-cn
18311 !! input
18312 -{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
18313 !! result
18314 <p>D12345EE12345
18315 </p>
18316 !! end
18317
18318 !! test
18319 Bidirectional converter rule entries with an empty value should be ignored (T53551)
18320 !! options
18321 language=zh variant=zh-cn
18322 !! input
18323 -{H|zh-cn:foo;zh-tw:;}-foobar
18324 !! result
18325 <p>foobar
18326 </p>
18327 !! end
18328
18329 !! test
18330 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
18331 !! options
18332 language=zh variant=zh-cn
18333 !! input
18334 -{H|=>zh-cn:foo;}-foobar
18335 !! result
18336 <p>foobar
18337 </p>
18338 !! end
18339
18340 !! test
18341 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
18342 !! options
18343 language=zh variant=zh-cn
18344 !! input
18345 -{H|}-foobar
18346 !! result
18347 <p>foobar
18348 </p>
18349 !! end
18350
18351 !! test
18352 Nested using of manual convert syntax
18353 !! options
18354 language=zh variant=zh-hk
18355 !! wikitext
18356 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
18357 !! html
18358 <p>Nested: Hello Hong Kong!
18359 </p>
18360 !! end
18361
18362 !! test
18363 Proper conversion of text in external links
18364 !! options
18365 language=sr variant=sr-ec
18366 !! wikitext
18367 http://www.google.com
18368 gopher://www.google.com
18369 [http://www.google.com http://www.google.com]
18370 [gopher://www.google.com gopher://www.google.com]
18371 [https://www.google.com irc://www.google.com]
18372 [ftp://www.google.com www.google.com/ftp://dir]
18373 [//www.google.com www.google.com]
18374 !! html
18375 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18376 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18377 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18378 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18379 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
18380 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
18381 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
18382 </p>
18383 !! end
18384
18385 !! test
18386 Do not convert roman numbers to language variants
18387 !! options
18388 language=sr variant=sr-ec
18389 !! wikitext
18390 Fridrih IV je car.
18391 !! html
18392 <p>Фридрих IV је цар.
18393 </p>
18394 !! end
18395
18396 !! test
18397 Unclosed language converter markup "-{"
18398 !! options
18399 language=sr
18400 !! wikitext
18401 -{T|hello
18402 !! html
18403 <p>-{T|hello
18404 </p>
18405 !! end
18406
18407 !! test
18408 Don't convert raw rule "-{R|=&gt;}-" to "=>"
18409 !! options
18410 language=sr
18411 !! wikitext
18412 -{R|=&gt;}-
18413 !! html
18414 <p>=&gt;
18415 </p>
18416 !!end
18417
18418 !! test
18419 Don't break link parsing if language converter markup is in the caption.
18420 !! options
18421 language=sr variant=sr-ec
18422 !! wikitext
18423 [[Main Page|-{R|main page}-]]
18424 !! html
18425 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
18426 </p>
18427 !! end
18428
18429 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18430 !! test
18431 Don't break image parsing if language converter markup is in the caption.
18432 !! options
18433 language=sr
18434 !! wikitext
18435 [[File:Foobar.jpg|-{R|caption}-]]
18436 !! html/parsoid
18437 <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>
18438 </p>
18439 !! end
18440
18441 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18442 !! test
18443 Don't break list handling if language converter markup is in the item.
18444 !! options
18445 language=zh variant=zh-cn
18446 !! wikitext
18447 ;-{zh-cn:AAA;zh-tw:BBB}-
18448 !! html/php
18449 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
18450
18451 !! html/parsoid
18452 <dl><dt>AAA
18453 </dt></dl>
18454 !! end
18455
18456 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18457 !! test
18458 Don't break table handling if language converter markup is in the cell.
18459 !! options
18460 language=sr variant=sr-ec
18461 !! wikitext
18462 {|
18463 |-
18464 | -{R|B}-
18465 |}
18466 !! html/php
18467 <table>
18468
18469 <tr>
18470 <td>Б}-
18471 </td></tr></table>
18472
18473 !! html/parsoid
18474 <table>
18475
18476 <tr>
18477 <td> B
18478 </td></tr></table>
18479
18480 !! end
18481
18482 !! test
18483 Bug 529: Uncovered bullet
18484 !! wikitext
18485 * Foo {{bullet}}
18486 !! html
18487 <ul><li> Foo </li>
18488 <li> Bar</li></ul>
18489
18490 !! end
18491
18492 # Plain MediaWiki does not remove empty lists, but tidy actually does.
18493 # Templates in Wikipedia rely on this behavior, as tidy has always been
18494 # enabled there. These tests are normally run *without* tidy, so specify the
18495 # full output here.
18496 # To test realistic parsing behavior, apply a tidy-like transformation to both
18497 # the expected output and your parser's output.
18498 !! test
18499 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
18500 !! wikitext
18501 ******* Foo {{bullet}}
18502 !! html
18503 <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>
18504 <li> Bar</li></ul>
18505
18506 !! end
18507
18508 !! test
18509 Bug 529: Uncovered table already at line-start
18510 !! wikitext
18511 x
18512
18513 {{table}}
18514 y
18515 !! html
18516 <p>x
18517 </p>
18518 <table>
18519 <tr>
18520 <td> 1 </td>
18521 <td> 2
18522 </td></tr>
18523 <tr>
18524 <td> 3 </td>
18525 <td> 4
18526 </td></tr></table>
18527 <p>y
18528 </p>
18529 !! end
18530
18531 !! test
18532 Bug 529: Uncovered bullet in parser function result
18533 !! wikitext
18534 * Foo {{lc:{{bullet}} }}
18535 !! html
18536 <ul><li> Foo </li>
18537 <li> bar</li></ul>
18538
18539 !! end
18540
18541 !! test
18542 Bug 5678: Double-parsed template argument
18543 !! wikitext
18544 {{lc:{{{1}}}|hello}}
18545 !! html
18546 <p>{{{1}}}
18547 </p>
18548 !! end
18549
18550 !! test
18551 Bug 5678: Double-parsed template invocation
18552 !! wikitext
18553 {{lc:{{paramtest {{!}} param = hello }} }}
18554 !! html
18555 <p>{{paramtest | param = hello }}
18556 </p>
18557 !! end
18558
18559 !! test
18560 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
18561 !! options
18562 language=cs
18563 title=[[Main Page]]
18564 !! wikitext
18565 {{PRVNÍVELKÉ:ěščř}}
18566 {{prvnívelké:ěščř}}
18567 {{PRVNÍMALÉ:ěščř}}
18568 {{prvnímalé:ěščř}}
18569 {{MALÁ:ěščř}}
18570 {{malá:ěščř}}
18571 {{VELKÁ:ěščř}}
18572 {{velká:ěščř}}
18573 !! html
18574 <p>Ěščř
18575 Ěščř
18576 ěščř
18577 ěščř
18578 ěščř
18579 ěščř
18580 ĚŠČŘ
18581 ĚŠČŘ
18582 </p>
18583 !! end
18584
18585 !! test
18586 Morwen/13: Unclosed link followed by heading
18587 !! wikitext
18588 [[link
18589 ==heading==
18590 !! html
18591 <p>[[link
18592 </p>
18593 <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>
18594
18595 !! end
18596
18597 !! test
18598 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
18599 !! wikitext
18600 {{foo|
18601 =heading=
18602 !! html
18603 <p>{{foo|
18604 </p>
18605 <h1><span class="mw-headline" id="heading">heading</span></h1>
18606
18607 !! end
18608
18609 !! test
18610 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
18611 !! wikitext
18612 {{foo|
18613 ==heading==
18614 !! html
18615 <p>{{foo|
18616 </p>
18617 <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>
18618
18619 !! end
18620
18621 !! test
18622 Tildes in comments
18623 !! options
18624 pst
18625 !! wikitext
18626 <!-- ~~~~ -->
18627 !! html
18628 <!-- ~~~~ -->
18629 !! end
18630
18631 !! test
18632 Paragraphs inside divs (no extra line breaks)
18633 !! wikitext
18634 <div>Line one
18635
18636 Line two</div>
18637 !! html
18638 <div>Line one
18639 Line two</div>
18640
18641 !! end
18642
18643 !! test
18644 Paragraphs inside divs (extra line break on open)
18645 !! wikitext
18646 <div>
18647 Line one
18648
18649 Line two</div>
18650 !! html
18651 <div>
18652 <p>Line one
18653 </p>
18654 Line two</div>
18655
18656 !! end
18657
18658 !! test
18659 Paragraphs inside divs (extra line break on close)
18660 !! wikitext
18661 <div>Line one
18662
18663 Line two
18664 </div>
18665 !! html
18666 <div>Line one
18667 <p>Line two
18668 </p>
18669 </div>
18670
18671 !! end
18672
18673 !! test
18674 Paragraphs inside divs (extra line break on open and close)
18675 !! wikitext
18676 <div>
18677 Line one
18678
18679 Line two
18680 </div>
18681 !! html
18682 <div>
18683 <p>Line one
18684 </p><p>Line two
18685 </p>
18686 </div>
18687
18688 !! end
18689
18690 !! test
18691 Nesting tags, paragraphs on lines which begin with <div>
18692 !! wikitext
18693 <div></div><strong>A
18694 B</strong>
18695 !! html/php+tidy
18696 <p><strong>A</strong></p>
18697 <p><strong>B</strong></p>
18698 !! html/parsoid
18699 <div></div>
18700 <p><strong>A
18701 B</strong>
18702 </p>
18703 !! end
18704
18705 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
18706 !! test
18707 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
18708 !! wikitext
18709 <blockquote>Line one
18710
18711 Line two</blockquote>
18712 !! html
18713 <blockquote>Line one
18714 Line two</blockquote>
18715
18716 !! html+tidy
18717 <blockquote>
18718 <p>Line one Line two</p>
18719 </blockquote>
18720 !! end
18721
18722 !! test
18723 Bug 6200: paragraphs inside blockquotes (extra line break on open)
18724 !! wikitext
18725 <blockquote>
18726 Line one
18727
18728 Line two</blockquote>
18729 !! html
18730 <blockquote>
18731 <p>Line one
18732 </p>
18733 Line two</blockquote>
18734
18735 !! html+tidy
18736 <blockquote>
18737 <p>Line one</p>
18738 Line two</blockquote>
18739 !! end
18740
18741 !! test
18742 Bug 6200: paragraphs inside blockquotes (extra line break on close)
18743 !! wikitext
18744 <blockquote>Line one
18745
18746 Line two
18747 </blockquote>
18748 !! html
18749 <blockquote>Line one
18750 <p>Line two
18751 </p>
18752 </blockquote>
18753
18754 !! html+tidy
18755 <blockquote>
18756 <p>Line one</p>
18757 <p>Line two</p>
18758 </blockquote>
18759 !! end
18760
18761 !! test
18762 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
18763 !! wikitext
18764 <blockquote>
18765 Line one
18766
18767 Line two
18768 </blockquote>
18769 !! html
18770 <blockquote>
18771 <p>Line one
18772 </p><p>Line two
18773 </p>
18774 </blockquote>
18775
18776 !! html+tidy
18777 <blockquote>
18778 <p>Line one</p>
18779 <p>Line two</p>
18780 </blockquote>
18781 !! end
18782
18783 !! test
18784 Paragraphs inside blockquotes/divs (no extra line breaks)
18785 !! wikitext
18786 <blockquote><div>Line one
18787
18788 Line two</div></blockquote>
18789 !! html
18790 <blockquote><div>Line one
18791 Line two</div></blockquote>
18792
18793 !! end
18794
18795 !! test
18796 Paragraphs inside blockquotes/divs (extra line break on open)
18797 !! wikitext
18798 <blockquote><div>
18799 Line one
18800
18801 Line two</div></blockquote>
18802 !! html
18803 <blockquote><div>
18804 <p>Line one
18805 </p>
18806 Line two</div></blockquote>
18807
18808 !! end
18809
18810 !! test
18811 Paragraphs inside blockquotes/divs (extra line break on close)
18812 !! wikitext
18813 <blockquote><div>Line one
18814
18815 Line two
18816 </div></blockquote>
18817 !! html
18818 <blockquote><div>Line one
18819 <p>Line two
18820 </p>
18821 </div></blockquote>
18822
18823 !! end
18824
18825 !! test
18826 Paragraphs inside blockquotes/divs (extra line break on open and close)
18827 !! wikitext
18828 <blockquote><div>
18829 Line one
18830
18831 Line two
18832 </div></blockquote>
18833 !! html
18834 <blockquote><div>
18835 <p>Line one
18836 </p><p>Line two
18837 </p>
18838 </div></blockquote>
18839
18840 !! end
18841
18842 !! test
18843 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
18844 !! options
18845 wgLinkHolderBatchSize=0
18846 !! wikitext
18847 [[meatball:1]]
18848 [[meatball:2]]
18849 [[meatball:3]]
18850 !! html
18851 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
18852 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
18853 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
18854 </p>
18855 !! end
18856
18857 !! test
18858 Free external link invading image caption
18859 !! wikitext
18860 [[Image:Foobar.jpg|thumb|http://x|hello]]
18861 !! html
18862 <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>
18863
18864 !! end
18865
18866 !! test
18867 Bug 15196: localised external link numbers
18868 !! options
18869 language=fa
18870 !! wikitext
18871 [http://en.wikipedia.org/]
18872 !! html/php
18873 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
18874 </p>
18875 !! html/parsoid
18876 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
18877 !! end
18878
18879 !! test
18880 Multibyte character in padleft
18881 !! wikitext
18882 {{padleft:-Hello|7|Æ}}
18883 !! html
18884 <p>Æ-Hello
18885 </p>
18886 !! end
18887
18888 !! test
18889 Multibyte character in padright
18890 !! wikitext
18891 {{padright:Hello-|7|Æ}}
18892 !! html
18893 <p>Hello-Æ
18894 </p>
18895 !! end
18896
18897 !!test
18898 formatdate parser function
18899 !! wikitext
18900 {{#formatdate:2009-03-24}}
18901 !! html
18902 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
18903 </p>
18904 !! end
18905
18906 !!test
18907 formatdate parser function, with default format
18908 !! wikitext
18909 {{#formatdate:2009-03-24|mdy}}
18910 !! html
18911 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
18912 </p>
18913 !! end
18914
18915 !! test
18916 Spacing of numbers in formatted dates
18917 !! wikitext
18918 {{#formatdate:January 15}}
18919 !! html
18920 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18921 </p>
18922 !! end
18923
18924 !! test
18925 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
18926 !! options
18927 language=nl title=[[MediaWiki:Common.css]]
18928 !! wikitext
18929 {{#formatdate:2009-03-24|dmy}}
18930 !! html
18931 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18932 </p>
18933 !! end
18934
18935 #
18936 #
18937 #
18938
18939 #
18940 # Edit comments
18941 #
18942
18943 !! test
18944 Edit comment with link
18945 !! options
18946 comment
18947 !! wikitext
18948 I like the [[Main Page]] a lot
18949 !! html
18950 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18951 !!end
18952
18953 !! test
18954 Edit comment with link and link text
18955 !! options
18956 comment
18957 !! wikitext
18958 I like the [[Main Page|best pages]] a lot
18959 !! html
18960 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18961 !!end
18962
18963 !! test
18964 Edit comment with link and link text with suffix
18965 !! options
18966 comment
18967 !! wikitext
18968 I like the [[Main Page|best page]]s a lot
18969 !! html
18970 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18971 !!end
18972
18973 !! test
18974 Edit comment with section link (non-local, eg in history list)
18975 !! options
18976 comment title=[[Main Page]]
18977 !! wikitext
18978 /* External links */ removed bogus entries
18979 !! html
18980 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18981 !!end
18982
18983 !! test
18984 Edit comment with section link and text before it (non-local, eg in history list)
18985 !! options
18986 comment title=[[Main Page]]
18987 !! wikitext
18988 pre-comment text /* External links */ removed bogus entries
18989 !! html
18990 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>
18991 !!end
18992
18993 !! test
18994 Edit comment with section link (local, eg in diff view)
18995 !! options
18996 comment local title=[[Main Page]]
18997 !! wikitext
18998 /* External links */ removed bogus entries
18999 !! html
19000 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19001 !!end
19002
19003 !! test
19004 Edit comment with subpage link (bug 14080)
19005 !! options
19006 comment
19007 subpage
19008 title=[[Subpage test]]
19009 !! wikitext
19010 Poked at a [[/subpage]] here...
19011 !! html
19012 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
19013 !!end
19014
19015 !! test
19016 Edit comment with subpage link and link text (bug 14080)
19017 !! options
19018 comment
19019 subpage
19020 title=[[Subpage test]]
19021 !! wikitext
19022 Poked at a [[/subpage|neat little page]] here...
19023 !! html
19024 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
19025 !!end
19026
19027 !! test
19028 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
19029 !! options
19030 comment
19031 title=[[Subpage test]]
19032 !! wikitext
19033 Poked at a [[/subpage]] here...
19034 !! html
19035 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...
19036 !!end
19037
19038 !! test
19039 Edit comment with bare anchor link (local, as on diff)
19040 !! options
19041 comment
19042 local
19043 title=[[Main Page]]
19044 !! wikitext
19045 [[#section]]
19046 !! html
19047 <a href="#section">#section</a>
19048 !! end
19049
19050 !! test
19051 Edit comment with bare anchor link (non-local, as on history)
19052 !! options
19053 comment
19054 title=[[Main Page]]
19055 !! wikitext
19056 [[#section]]
19057 !! html
19058 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
19059 !! end
19060
19061 !! test
19062 Anchor starting with underscore
19063 !! wikitext
19064 [[#_ref|One]]
19065 !! html
19066 <p><a href="#_ref">One</a>
19067 </p>
19068 !! end
19069
19070 !! test
19071 Id starting with underscore
19072 !! wikitext
19073 <div id="_ref"></div>
19074 !! html
19075 <div id="_ref"></div>
19076
19077 !! end
19078
19079 !! test
19080 Space normalisation on autocomment (bug 22784)
19081 !! options
19082 comment
19083 title=[[Main Page]]
19084 !! wikitext
19085 /* __hello__world__ */
19086 !! html
19087 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
19088 !! end
19089
19090 !! test
19091 percent-encoding and + signs in comments (Bug 26410)
19092 !! options
19093 comment
19094 !! wikitext
19095 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
19096 !! html
19097 <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>
19098 !! end
19099
19100 # Parsoid doesn't support this yet: see bug 73581
19101 # but it *should* omit the 'src' attribute if the image is bad.
19102 # PHP side of tests was disabled in
19103 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
19104 # because of issues in the PHP parserTests infrastructure
19105 # (but the output below is indeed what the PHP side emits)
19106 !! test
19107 Bad images - basic functionality
19108 !! wikitext
19109 [[File:Bad.jpg]]
19110 !! DISABLED/html/php
19111 !! html/parsoid
19112 <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>
19113 !! end
19114
19115 !! test
19116 Bad images - bug 16039: text after bad image disappears
19117 !! wikitext
19118 Foo bar
19119 [[File:Bad.jpg]]
19120 Bar foo
19121 !! DISABLED/html/php
19122 <p>Foo bar
19123 </p><p>Bar foo
19124 </p>
19125 !! html/parsoid
19126 <p>Foo bar
19127 <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>
19128 Bar foo</p>
19129 !! end
19130
19131 !! test
19132 Verify that displaytitle works (bug #22501) no displaytitle
19133 !! options
19134 showtitle
19135 !! config
19136 wgAllowDisplayTitle=true
19137 wgRestrictDisplayTitle=false
19138 !! wikitext
19139 this is not the the title
19140 !! html
19141 Parser test
19142 <p>this is not the the title
19143 </p>
19144 !! end
19145
19146 !! test
19147 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
19148 !! options
19149 showtitle
19150 title=[[Screen]]
19151 !! config
19152 wgAllowDisplayTitle=true
19153 wgRestrictDisplayTitle=false
19154 !! wikitext
19155 this is not the the title
19156 {{DISPLAYTITLE:whatever}}
19157 !! html
19158 whatever
19159 <p>this is not the the title
19160 </p>
19161 !! end
19162
19163 !! test
19164 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
19165 !! options
19166 showtitle
19167 title=[[Screen]]
19168 !! config
19169 wgAllowDisplayTitle=true
19170 wgRestrictDisplayTitle=true
19171 !! wikitext
19172 this is not the the title
19173 {{DISPLAYTITLE:whatever}}
19174 !! html
19175 Screen
19176 <p>this is not the the title
19177 </p>
19178 !! end
19179
19180 !! test
19181 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
19182 !! options
19183 showtitle
19184 title=[[Screen]]
19185 !! config
19186 wgAllowDisplayTitle=true
19187 wgRestrictDisplayTitle=true
19188 !! wikitext
19189 this is not the the title
19190 {{DISPLAYTITLE:screen}}
19191 !! html
19192 screen
19193 <p>this is not the the title
19194 </p>
19195 !! end
19196
19197 !! test
19198 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
19199 !! options
19200 showtitle
19201 title=[[Screen]]
19202 !! config
19203 wgAllowDisplayTitle=false
19204 !! wikitext
19205 this is not the the title
19206 {{DISPLAYTITLE:screen}}
19207 !! html
19208 Screen
19209 <p>this is not the the title
19210 <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>
19211 </p>
19212 !! end
19213
19214 !! test
19215 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
19216 !! options
19217 showtitle
19218 title=[[Screen]]
19219 !! config
19220 wgAllowDisplayTitle=false
19221 !! wikitext
19222 this is not the the title
19223 !! html
19224 Screen
19225 <p>this is not the the title
19226 </p>
19227 !! end
19228
19229 !! test
19230 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
19231 !! options
19232 showtitle
19233 title=[[Screen]]
19234 !! config
19235 wgAllowDisplayTitle=true
19236 wgRestrictDisplayTitle=true
19237 !! wikitext
19238 this is not the the title
19239 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
19240 !! html
19241 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
19242 <p>this is not the the title
19243 </p>
19244 !! end
19245
19246 !! test
19247 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
19248 !! options
19249 showtitle
19250 title=[[Screen]]
19251 !! config
19252 wgAllowDisplayTitle=true
19253 wgRestrictDisplayTitle=true
19254 !! wikitext
19255 this is not the the title
19256 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
19257 !! html
19258 <span style="color: red;">s</span>creen
19259 <p>this is not the the title
19260 </p>
19261 !! end
19262
19263 !! test
19264 Page status indicators: Empty name is invalid
19265 !! options
19266 showindicators
19267 !! wikitext
19268 <indicator name=" "></indicator>
19269 <indicator></indicator>
19270 !! html
19271 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19272 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19273 </p>
19274 !! end
19275
19276 !! test
19277 Page status indicators: Weird syntaxes that are okay
19278 !! options
19279 showindicators
19280 !! wikitext
19281 <indicator name="empty" />
19282 <indicator name></indicator>
19283 !! html
19284 empty=
19285 name=
19286 <p><br />
19287 </p>
19288 !! end
19289
19290 !! test
19291 Page status indicators: Torture test
19292 !! options
19293 showindicators
19294 !! wikitext
19295 <indicator name="01">hello world</indicator>
19296 <indicator name="02">[[Main Page]]</indicator>
19297 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
19298 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
19299 <indicator name="05">* foo
19300 * bar</indicator>
19301 <indicator name="06"><nowiki>foo</nowiki></indicator>
19302 <indicator name="07"> Preformatted</indicator>
19303 <indicator name="08"><div>Broken tag</indicator>
19304 <indicator name="09">{| class=wikitable
19305 | cell
19306 |}</indicator>
19307 <indicator name="10">Two
19308
19309 paragraphs</indicator>
19310 !! html
19311 01=hello world
19312 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19313 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" />
19314 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>
19315 05=<ul><li> foo</li>
19316 <li> bar</li></ul>
19317
19318 06=foo
19319 07=<pre>Preformatted
19320 </pre>
19321 08=<div>Broken tag</div>
19322
19323 09=<table class="wikitable">
19324 <tr>
19325 <td> cell
19326 </td></tr></table>
19327
19328 10=<p>Two
19329 </p><p>paragraphs
19330 </p>
19331 <p><br />
19332 </p><p><br />
19333 </p><p><br />
19334 </p><p><br />
19335 </p><p><br />
19336 </p>
19337 !! end
19338
19339 !! test
19340 preload: check <noinclude> and <includeonly>
19341 !! options
19342 preload
19343 !! wikitext
19344 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
19345 !! html
19346 Hello kind world.
19347 !! end
19348
19349 !! test
19350 preload: check <onlyinclude>
19351 !! options
19352 preload
19353 !! wikitext
19354 Goodbye <onlyinclude>Hello world</onlyinclude>
19355 !! html
19356 Hello world
19357 !! end
19358
19359 !! test
19360 preload: can pass tags through if we want to
19361 !! options
19362 preload
19363 !! wikitext
19364 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
19365 !! html
19366 <includeonly>Hello world</includeonly>
19367 !! end
19368
19369 !! test
19370 preload: check that it doesn't try to do tricks
19371 !! options
19372 preload
19373 !! wikitext
19374 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19375 !! html
19376 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19377 !! end
19378
19379 !! test
19380 Play a bit with r67090 and bug 3158
19381 !! wikitext
19382 <div style="width:50% !important">&nbsp;</div>
19383 <div style="width:50%&nbsp;!important">&nbsp;</div>
19384 <div style="width:50%&#160;!important">&nbsp;</div>
19385 <div style="border : solid;">&nbsp;</div>
19386 !! html/php
19387 <div style="width:50% !important">&#160;</div>
19388 <div style="width:50% !important">&#160;</div>
19389 <div style="width:50% !important">&#160;</div>
19390 <div style="border&#160;: solid;">&#160;</div>
19391
19392 !! html/parsoid
19393 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19394 <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>
19395 <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>
19396 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19397
19398 !! end
19399
19400 !! test
19401 HTML5 data attributes
19402 !! wikitext
19403 <span data-foo="bar">Baz</span>
19404 <p data-abc-def_hij="">Quuz</p>
19405 !! html
19406 <p><span data-foo="bar">Baz</span>
19407 </p>
19408 <p data-abc-def_hij="">Quuz</p>
19409
19410 !! end
19411
19412 !! test
19413 percent-encoding and + signs in internal links (Bug 26410)
19414 !! wikitext
19415 [[User:+%]] [[Page+title%]]
19416 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
19417 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
19418 [[%33%45]] [[%33%45+]]
19419 !! html/php
19420 <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>
19421 <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>
19422 <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>
19423 <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>
19424 </p>
19425 !! html/parsoid
19426 <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>
19427 !! end
19428
19429 !! test
19430 Special characters in embedded file links (bug 27679)
19431 !! wikitext
19432 [[File:Contains & ampersand.jpg]]
19433 [[File:Does not exist.jpg|Title with & ampersand]]
19434 !! html/php
19435 <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>
19436 <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>
19437 </p>
19438 !! html/parsoid
19439 <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>
19440 <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>
19441 !! end
19442
19443 !! test
19444 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
19445 !! wikitext
19446 Text&apos;s been normalized?
19447 !! html
19448 <p>Text&#39;s been normalized?
19449 </p>
19450 !! end
19451
19452 !! test
19453 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
19454 !! wikitext
19455 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
19456 !! html
19457 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
19458 </p>
19459 !! end
19460
19461 !! test
19462 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
19463 !! wikitext
19464 [http://www.example.org/ ideograms]
19465 !! html
19466 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
19467 </p>
19468 !! end
19469
19470 !! test
19471 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
19472 !! wikitext
19473 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
19474 !! html
19475 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
19476 </p>
19477 !! end
19478
19479 !! article
19480 Mediawiki:loop1
19481 !! text
19482 {{Identical|A}}
19483 !! endarticle
19484
19485 !! article
19486 Mediawiki:loop2
19487 !! text
19488 {{Identical|B}}
19489 !! endarticle
19490
19491 !! article
19492 Template:Identical
19493 !! text
19494 {{int:loop1}}
19495 {{int:loop2}}
19496 !! endarticle
19497
19498 !! test
19499 Bug 31098 Template which includes system messages which includes the template
19500 !! wikitext
19501 {{Identical}}
19502 !! html
19503 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
19504 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
19505 </p>
19506 !! end
19507
19508 !! test
19509 Bug31490 Turkish: ucfirst 'blah'
19510 !! options
19511 language=tr
19512 !! wikitext
19513 {{ucfirst:blah}}
19514 !! html
19515 <p>Blah
19516 </p>
19517 !! end
19518
19519 !! test
19520 Bug31490 Turkish: ucfirst 'ix'
19521 !! options
19522 language=tr
19523 !! wikitext
19524 {{ucfirst:ix}}
19525 !! html
19526 <p>İx
19527 </p>
19528 !! end
19529
19530 !! test
19531 Bug31490 Turkish: lcfirst 'BLAH'
19532 !! options
19533 language=tr
19534 !! wikitext
19535 {{lcfirst:BLAH}}
19536 !! html
19537 <p>bLAH
19538 </p>
19539 !! end
19540
19541 !! test
19542 Bug31490 Turkish: ucfırst (with a dotless i)
19543 !! options
19544 language=tr
19545 !! wikitext
19546 {{ucfırst:blah}}
19547 !! html
19548 <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>
19549 </p>
19550 !! end
19551
19552 !! test
19553 Bug31490 ucfırst (with a dotless i) with English language
19554 !! options
19555 language=en
19556 !! wikitext
19557 {{ucfırst:blah}}
19558 !! html
19559 <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>
19560 </p>
19561 !! end
19562
19563 !! test
19564 Bug 26375: TOC with italics
19565 !! options
19566 title=[[Main Page]]
19567 !! wikitext
19568 __TOC__
19569 == ''Lost'' episodes ==
19570 !! html
19571 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19572 <ul>
19573 <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>
19574 </ul>
19575 </div>
19576
19577 <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>
19578
19579 !! end
19580
19581 !! test
19582 Bug 26375: TOC with bold
19583 !! options
19584 title=[[Main Page]]
19585 !! wikitext
19586 __TOC__
19587 == '''should be bold''' then normal text ==
19588 !! html
19589 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19590 <ul>
19591 <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>
19592 </ul>
19593 </div>
19594
19595 <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>
19596
19597 !! end
19598
19599 !! test
19600 Bug 33845: Headings become cursive in TOC when they contain an image
19601 !! options
19602 title=[[Main Page]]
19603 !! wikitext
19604 __TOC__
19605 == Image [[Image:foobar.jpg]] ==
19606 !! html
19607 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19608 <ul>
19609 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
19610 </ul>
19611 </div>
19612
19613 <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>
19614
19615 !! end
19616
19617 !! test
19618 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
19619 !! options
19620 title=[[Main Page]]
19621 !! wikitext
19622 __TOC__
19623 == <blockquote>Quote</blockquote> ==
19624 !! html
19625 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19626 <ul>
19627 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19628 </ul>
19629 </div>
19630
19631 <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>
19632
19633 !! html+tidy
19634 <p></p>
19635 <div id="toc" class="toc">
19636 <div id="toctitle">
19637 <h2>Contents</h2>
19638 </div>
19639 <ul>
19640 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19641 </ul>
19642 </div>
19643 <p></p>
19644 <h2><span class="mw-headline" id="Quote"></span></h2>
19645 <blockquote>
19646 <p><span class="mw-headline" id="Quote">Quote</span></p>
19647 </blockquote>
19648 <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>
19649 !! end
19650
19651 !! test
19652 Unclosed tags in TOC
19653 !! options
19654 title=[[Main Page]]
19655 !! wikitext
19656 __TOC__
19657 == Proof: 2 < 3 ==
19658 <small>Hanc marginis exiguitas non caperet.</small>
19659 QED
19660 !! html
19661 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19662 <ul>
19663 <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>
19664 </ul>
19665 </div>
19666
19667 <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>
19668 <p><small>Hanc marginis exiguitas non caperet.</small>
19669 QED
19670 </p>
19671 !! end
19672
19673 !! test
19674 Multiple tags in TOC
19675 !! wikitext
19676 __TOC__
19677 == <i>Foo</i> <b>Bar</b> ==
19678
19679 == <i>Foo</i> <blockquote>Bar</blockquote> ==
19680 !! html
19681 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19682 <ul>
19683 <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>
19684 <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>
19685 </ul>
19686 </div>
19687
19688 <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>
19689 <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>
19690
19691 !! html+tidy
19692 <p></p>
19693 <div id="toc" class="toc">
19694 <div id="toctitle">
19695 <h2>Contents</h2>
19696 </div>
19697 <ul>
19698 <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>
19699 <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>
19700 </ul>
19701 </div>
19702 <p></p>
19703 <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>
19704 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
19705 <blockquote>
19706 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
19707 </blockquote>
19708 <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>
19709 !! end
19710
19711 !! test
19712 Tags with parameters in TOC
19713 !! wikitext
19714 __TOC__
19715 == <sup class="in-h2">Hello</sup> ==
19716
19717 == <sup class="a > b">Evilbye</sup> ==
19718 !! html
19719 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19720 <ul>
19721 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
19722 <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>
19723 </ul>
19724 </div>
19725
19726 <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>
19727 <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>
19728
19729 !! end
19730
19731 !! test
19732 span tags with directionality in TOC
19733 !! wikitext
19734 __TOC__
19735 == <span dir="ltr">C++</span> ==
19736
19737 == <span dir="rtl">זבנג!</span> ==
19738
19739 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
19740
19741 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
19742
19743 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
19744 !! html
19745 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19746 <ul>
19747 <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>
19748 <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>
19749 <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>
19750 <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>
19751 <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>
19752 </ul>
19753 </div>
19754
19755 <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>
19756 <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>
19757 <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>
19758 <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>
19759 <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>
19760
19761 !! end
19762
19763 !! test
19764 Bug 72884: bdi element in ToC
19765 !! wikitext
19766 __TOC__
19767 == <bdi>test</bdi> ==
19768 !! html
19769 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19770 <ul>
19771 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
19772 </ul>
19773 </div>
19774
19775 <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>
19776
19777 !! end
19778
19779 # Note that the html output does not have the <p></p>, but the
19780 # html+tidy output *does*. This is because the empty <p></p> is
19781 # removed by the sanitizer, but only when tidy is *not* enabled (!).
19782 !! test
19783 Empty <p> tag in TOC, removed by Sanitizer (T92892)
19784 !! wikitext
19785 __TOC__
19786 == x ==
19787 !! html
19788 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19789 <ul>
19790 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
19791 </ul>
19792 </div>
19793
19794 <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>
19795
19796 !! html+tidy
19797 <p></p>
19798 <div id="toc" class="toc">
19799 <div id="toctitle">
19800 <h2>Contents</h2>
19801 </div>
19802 <ul>
19803 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
19804 </ul>
19805 </div>
19806 <p></p>
19807 <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>
19808 !! end
19809
19810 !! article
19811 MediaWiki:Bug32057
19812 !! text
19813 == {{int:headline_sample}} ==
19814 !! endarticle
19815
19816 !! test
19817 Bug 32057: Title needed when expanding <h> nodes.
19818 !! options
19819 title=[[Main Page]]
19820 !! wikitext
19821 {{int:Bug32057}}
19822 !! html
19823 <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>
19824
19825 !! end
19826
19827 !! test
19828 Strip marker in urlencode
19829 !! wikitext
19830 {{urlencode:x<nowiki/>y}}
19831 {{urlencode:x<nowiki/>y|wiki}}
19832 {{urlencode:x<nowiki/>y|path}}
19833 !! html
19834 <p>xy
19835 xy
19836 xy
19837 </p>
19838 !! end
19839
19840 !! test
19841 Strip marker in lc
19842 !! wikitext
19843 {{lc:x<nowiki/>y}}
19844 !! html
19845 <p>xy
19846 </p>
19847 !! end
19848
19849 !! test
19850 Strip marker in uc
19851 !! wikitext
19852 {{uc:x<nowiki/>y}}
19853 !! html
19854 <p>XY
19855 </p>
19856 !! end
19857
19858 !! test
19859 Strip marker in formatNum
19860 !! wikitext
19861 {{formatnum:1<nowiki/>2}}
19862 {{formatnum:1<nowiki/>2|R}}
19863 !! html
19864 <p>12
19865 12
19866 </p>
19867 !! end
19868
19869 !! test
19870 Check noCommafy in formatNum
19871 !! options
19872 language=be-tarask
19873 !! wikitext
19874 {{formatnum:123456.78}}
19875 {{formatnum:123456.78|NOSEP}}
19876 !! html
19877 <p>123 456,78
19878 123456.78
19879 </p>
19880 !! end
19881
19882 !! test
19883 Wrong option for formatNum (bug 56199)
19884 !! wikitext
19885 {{formatnum:1,234.56|Random}}
19886 {{formatnum:1,234.56|EVERYTHING}}
19887 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
19888 !! html
19889 <p>1,234.56
19890 1,234.56
19891 1,234.56
19892 </p>
19893 !! end
19894
19895 !! test
19896 Strip marker in grammar
19897 !! options
19898 language=fi
19899 !! wikitext
19900 {{grammar:elative|foo<nowiki/>bar}}
19901 !! html
19902 <p>foobarista
19903 </p>
19904 !! end
19905
19906 !! test
19907 Strip marker in padleft
19908 !! wikitext
19909 {{padleft:|2|x<nowiki/>y}}
19910 !! html
19911 <p>xy
19912 </p>
19913 !! end
19914
19915 !! test
19916 Strip marker in padright
19917 !! wikitext
19918 {{padright:|2|x<nowiki/>y}}
19919 !! html
19920 <p>xy
19921 </p>
19922 !! end
19923
19924 !! test
19925 Strip marker in anchorencode
19926 !! wikitext
19927 {{anchorencode:x<nowiki/>y}}
19928 !! html
19929 <p>xy
19930 </p>
19931 !! end
19932
19933 !! test
19934 nowiki inside link inside heading (bug 18295)
19935 !! wikitext
19936 ==[[foo|x<nowiki>y</nowiki>z]]==
19937 !! html
19938 <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>
19939
19940 !! end
19941
19942 !! test
19943 new support for bdi element (bug 31817)
19944 !! wikitext
19945 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19946 !! html
19947 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19948
19949 !!end
19950
19951 !! test
19952 Ignore pipe between table row attributes
19953 !! wikitext
19954 {|
19955 | quux
19956 |- id=foo | style='color: red'
19957 | bar
19958 |}
19959 !! html
19960 <table>
19961 <tr>
19962 <td> quux
19963 </td></tr>
19964 <tr id="foo" style="color: red">
19965 <td> bar
19966 </td></tr></table>
19967
19968 !! end
19969
19970 !!test
19971 Gallery override link with WikiLink (bug 34852)
19972 !! wikitext
19973 <gallery>
19974 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
19975 </gallery>
19976 !! html
19977 <ul class="gallery mw-gallery-traditional">
19978 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19979 <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>
19980 <div class="gallerytext">
19981 <p>caption
19982 </p>
19983 </div>
19984 </div></li>
19985 </ul>
19986
19987 !! end
19988
19989 !!test
19990 Gallery override link with absolute external link (bug 34852)
19991 !! wikitext
19992 <gallery>
19993 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19994 </gallery>
19995 !! html
19996 <ul class="gallery mw-gallery-traditional">
19997 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19998 <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>
19999 <div class="gallerytext">
20000 <p>caption
20001 </p>
20002 </div>
20003 </div></li>
20004 </ul>
20005
20006 !! end
20007
20008 !!test
20009 Gallery override link with malicious javascript (bug 34852)
20010 !! wikitext
20011 <gallery>
20012 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20013 </gallery>
20014 !! html
20015 <ul class="gallery mw-gallery-traditional">
20016 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20017 <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>
20018 <div class="gallerytext">
20019 <p>caption
20020 </p>
20021 </div>
20022 </div></li>
20023 </ul>
20024
20025 !! end
20026
20027 !!test
20028 Gallery with invalid title as link (bug 43964)
20029 !! wikitext
20030 <gallery>
20031 File:foobar.jpg|link=<
20032 </gallery>
20033 !! html
20034 <ul class="gallery mw-gallery-traditional">
20035 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20036 <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>
20037 <div class="gallerytext">
20038 </div>
20039 </div></li>
20040 </ul>
20041
20042 !! end
20043
20044 !!test
20045 Language parser function
20046 !! wikitext
20047 {{#language:ar}}
20048 !! html
20049 <p>العربية
20050 </p>
20051 !! end
20052
20053 !!test
20054 Padleft and padright as substr
20055 !! wikitext
20056 {{padleft:|3|abcde}}
20057 {{padright:|3|abcde}}
20058 !! html
20059 <p>abc
20060 abc
20061 </p>
20062 !! end
20063
20064 !!test
20065 Special parser function
20066 !! wikitext
20067 {{#special:RandomPage}}
20068 {{#special:BaDtItLe}}
20069 {{#special:Foobar}}
20070 !! html
20071 <p>Special:Random
20072 Special:Badtitle
20073 Special:Foobar
20074 </p>
20075 !! end
20076
20077 !!test
20078 Bug 34939 - Case insensitive link parsing ([HttP://])
20079 !! wikitext
20080 [HttP://MediaWiki.Org/]
20081 !! html/php
20082 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
20083 </p>
20084 !! html/parsoid
20085 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
20086 !! end
20087
20088 !!test
20089 Bug 34939 - Case insensitive link parsing ([HttP:// title])
20090 !! wikitext
20091 [HttP://MediaWiki.Org/ MediaWiki]
20092 !! html
20093 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
20094 </p>
20095 !! end
20096
20097 !!test
20098 Bug 34939 - Case insensitive link parsing (HttP://)
20099 !! wikitext
20100 HttP://MediaWiki.Org/
20101 !! html/php
20102 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
20103 </p>
20104 !! html/parsoid
20105 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
20106 !! end
20107
20108 !!test
20109 Disable TOC
20110 !! options
20111 notoc
20112 !! wikitext
20113 Lead
20114 == Section 1 ==
20115 == Section 2 ==
20116 == Section 3 ==
20117 == Section 4 ==
20118 == Section 5 ==
20119 !! html
20120 <p>Lead
20121 </p>
20122
20123 <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>
20124 <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>
20125 <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>
20126 <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>
20127 <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>
20128
20129 !! end
20130
20131
20132 ###
20133 ### Parsoid-specific tests
20134 ### Parsoid-PHP parser incompatibilities
20135 ###
20136 !!test
20137 1. SOL-sensitive wikitext tokens as template-args
20138 !!options
20139 parsoid=wt2html,wt2wt
20140 !! wikitext
20141 {{echo|*a}}
20142 {{echo|#a}}
20143 {{echo|:a}}
20144 !! html
20145 <span about="#mwt1" typeof="mw:Transclusion">
20146 </span><ul about="#mwt1"><li>a</li>
20147 </ul>
20148 <span about="#mwt2" typeof="mw:Transclusion">
20149 </span><ol about="#mwt2"><li>a</li>
20150 </ol>
20151 <span about="#mwt3" typeof="mw:Transclusion">
20152 </span><dl about="#mwt3"><dd>a</dd>
20153 </dl>
20154 !!end
20155
20156 #### -----------------------------------------------------------------
20157 #### Parsoid-specific functionality tests
20158 #### -----------------------------------------------------------------
20159
20160 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
20161 # We know wt2wt will fail, but we expect selser to pass.
20162 # Due to the nature of our testing, wt2wt and selser tests will enter the
20163 # blacklist and we'll catch selser regressions based on changes to the
20164 # blacklist entries for selser tests.
20165 !! test
20166 1. Bad treebuilder fixup of formatting elt is cleaned up
20167 !! options
20168 parsoid=wt2html,wt2wt
20169 !! wikitext
20170 {|
20171 |
20172 <small>
20173 [[Image:Foobar.jpg|right|Test]]
20174 </small>
20175 |}
20176 !! html/parsoid
20177 <table>
20178 <tbody><tr><td>
20179 <small>
20180 <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>
20181 </small>
20182 </td></tr>
20183 </tbody></table>
20184 !! end
20185
20186 !! test
20187 2. Bad treebuilder fixup of formatting elt is cleaned up
20188 !! options
20189 parsoid=wt2html,wt2wt
20190 !! wikitext
20191 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
20192
20193 <small>[[Image:Foobar.jpg|right|300px]]</small>
20194 !! html/parsoid
20195 <p><b>foo</b></p>
20196 <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>
20197 <p><b>bar</b></p>
20198 <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>
20199 !! end
20200
20201 #### ----------------------------------------------------------------
20202 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
20203 #### tags. Parsoid's output for these tags differs from that of the
20204 #### PHP parser.
20205 #### ----------------------------------------------------------------
20206
20207 !!test
20208 Ref: 1. ref-location should be replaced with an index span
20209 !!options
20210 parsoid
20211 !! wikitext
20212 A <ref>foo</ref>
20213 B <ref name="x">foo</ref>
20214 C <ref name="y" />
20215 <references />
20216 !! html
20217 <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>
20218 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>
20219 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>
20220 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20221 <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>
20222 <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>
20223 <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>
20224 </ol>
20225 !!end
20226
20227 !!test
20228 Ref: 2. ref-tags with identical names should all get the same index
20229 !!options
20230 parsoid
20231 !! wikitext
20232 A <ref name="x">foo</ref>
20233 B <ref name="x" />
20234 <references />
20235 !! html
20236 <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>
20237 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>
20238 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20239 <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>
20240 </ol>
20241 !!end
20242
20243 !!test
20244 Ref: 3. spaces in ref-names should be ignored
20245 !!options
20246 parsoid
20247 !! wikitext
20248 A <ref name="x">foo</ref>
20249 B <ref name=" x " />
20250 C <ref name= x />
20251 <references />
20252 !! html
20253 <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>
20254 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>
20255 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>
20256 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20257 <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>
20258 </ol>
20259 !!end
20260
20261 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
20262 !!test
20263 Ref: 4. 'constructor' should be accepted as a valid ref-name
20264 !!options
20265 parsoid
20266 !! wikitext
20267 A <ref name="constructor">foo</ref>
20268 <references />
20269 !! html
20270 <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>
20271 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20272 <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>
20273 </ol>
20274 !!end
20275
20276 !!test
20277 Ref: 5. body should accept generic wikitext
20278 !!options
20279 parsoid
20280 !! wikitext
20281 A <ref>
20282 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
20283 </ref>
20284
20285 <references />
20286 !! html
20287 <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>
20288
20289 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20290 <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>
20291 </span></li>
20292 </ol>
20293 !!end
20294
20295 !!test
20296 Ref: 6. indent-pres should not be output in ref-body
20297 !!options
20298 parsoid
20299 !! wikitext
20300 A <ref>
20301 foo
20302 bar
20303 baz
20304 </ref>
20305
20306 <references />
20307 !! html
20308 <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>
20309
20310 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20311 <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
20312 bar
20313 baz
20314 </span></li>
20315 </ol>
20316 !!end
20317
20318 !!test
20319 Ref: 7. No p-wrapping in ref-body
20320 !!options
20321 parsoid
20322 !! wikitext
20323 A <ref>
20324 foo
20325
20326 bar
20327
20328
20329 baz
20330
20331
20332
20333 booz
20334 </ref>
20335
20336 <references />
20337 !! html
20338 <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>
20339
20340 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20341 <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
20342
20343 bar
20344
20345
20346 baz
20347
20348
20349
20350 booz
20351 </span></li>
20352 </ol>
20353 !!end
20354
20355 !!test
20356 Ref: 8. transclusion wikitext has lower precedence
20357 !!options
20358 parsoid
20359 !! wikitext
20360 A <ref> foo {{echo|</ref> B C}}
20361
20362 <references />
20363 !! html
20364 <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>
20365 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20366 <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>
20367 </ol>
20368 !!end
20369
20370 !!test
20371 Ref: 9. unclosed comments should not leak out of ref-body
20372 !!options
20373 parsoid
20374 !! wikitext
20375 A <ref> foo <!--</ref> B C
20376 <references />
20377 !! html
20378 <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>
20379 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20380 <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>
20381 </ol>
20382 !!end
20383
20384 !!test
20385 Ref: 10. Unclosed HTML tags should not leak out of ref-body
20386 !!options
20387 parsoid
20388 !! wikitext
20389 A <ref> <b> foo </ref> B C
20390
20391 <references />
20392 !! html
20393 <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>
20394
20395
20396 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20397 <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>
20398 </ol>
20399 !!end
20400
20401 !!test
20402 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
20403 !!options
20404 parsoid
20405 !! wikitext
20406 A <ref>foo</ref> B
20407 C <ref>bar</ref> D
20408 <references />
20409 !! html
20410 <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
20411 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>
20412 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20413 <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>
20414 <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>
20415 </ol>
20416 !!end
20417
20418 !!test
20419 Ref: 12. ref-tags act as trailing newline migration barrier
20420 !!options
20421 parsoid
20422 !! wikitext
20423 <!--the newline at the end of this line moves out of the p-tag-->a
20424
20425 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
20426 <ref />
20427
20428 c
20429 <references />
20430 !! html
20431 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
20432
20433
20434 <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>
20435 <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>
20436
20437 <p>c</p>
20438 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20439 <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>
20440 <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>
20441 !!end
20442
20443 !!test
20444 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
20445 !!options
20446 parsoid
20447 !! wikitext
20448 <ref>foo</ref> A
20449 <ref>bar
20450 </ref> B
20451 <references />
20452 !! html
20453 <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
20454 <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>
20455 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20456 <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>
20457 <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
20458 </span></li>
20459 </ol>
20460 !!end
20461
20462 !!test
20463 Ref: 14. A nested ref-tag should be emitted as plain text
20464 !!options
20465 parsoid
20466 !! wikitext
20467 <ref>foo <ref>bar</ref> baz</ref>
20468
20469 <references />
20470 !! html
20471 <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>
20472 </p>
20473 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20474 <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>
20475 </ol>
20476 !!end
20477
20478 !!test
20479 Ref: 15. ref-tags with identical names should get identical indexes
20480 !!options
20481 parsoid
20482 !! wikitext
20483 A1 <ref name="a">foo</ref> A2 <ref name="a" />
20484 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
20485
20486 <references />
20487 !! html
20488 <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>
20489 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>
20490
20491 <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>
20492 </ol>
20493 !!end
20494
20495 ## We don't bother wt2wt-ing non-standard whitespace
20496 !!test
20497 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
20498 !!options
20499 parsoid=wt2html
20500 !! wikitext
20501 A <ref >foo</ref >
20502
20503 <references />
20504 !! html
20505 <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>
20506 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20507 <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>
20508 !!end
20509
20510 !!test
20511 Ref: 17. Generate valid HTML5 id/about attributes
20512 !!options
20513 parsoid
20514 !!wikitext
20515 <ref name="a b">foo</ref>
20516
20517 <references />
20518 !!html
20519 <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>
20520 </p>
20521
20522 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20523 <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>
20524 </ol>
20525 !!end
20526
20527 !!test
20528 Ref: 18. T58916: Extension attributes should be parsed as plain text
20529 !!options
20530 parsoid
20531 !!wikitext
20532 <ref name="{{echo|a}}">foo</ref>
20533
20534 <references />
20535 !!html
20536 <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>
20537 </p>
20538
20539 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20540 <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>
20541 </ol>
20542 !!end
20543
20544 !!test
20545 Ref: 19. ref-tags with identical name encodings should get identical indexes
20546 !!options
20547 parsoid
20548 !! wikitext
20549 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
20550
20551 <references />
20552 !! html
20553 <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>
20554 </p>
20555 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20556 <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>
20557 </ol>
20558 !!end
20559
20560 !!test
20561 Ref: 20. ref-tags with identical names but different content should keep it
20562 !!options
20563 parsoid
20564 !! wikitext
20565 A <ref name="foo">Foo one</ref>
20566 B <ref name="foo">Foo two</ref>
20567 C <ref name="foo" />
20568
20569 <references />
20570 !! html
20571 <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>
20572 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>
20573 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>
20574
20575 <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>
20576 </ol>
20577 !!end
20578
20579 !!test
20580 References: 1. references tag without any refs should be handled properly
20581 !!options
20582 parsoid
20583 !! wikitext
20584 <references />
20585 !! html
20586 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
20587 !!end
20588
20589 !!test
20590 References: 2. references tag with group only outputs references from that group
20591 !!options
20592 parsoid
20593 !! wikitext
20594 A <ref group="a">foo</ref>
20595 B <ref group="b">bar</ref>
20596 C <ref>baz</ref>
20597
20598 <references group="a" />
20599 <references />
20600 <references group="b" />
20601 !! html
20602 <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>
20603 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>
20604 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>
20605
20606 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{"group":"a"}}'>
20607 <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>
20608 </ol>
20609 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
20610 <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>
20611 </ol>
20612 <ol class="references" typeof="mw:Extension/references" about="#mwt12" data-mw='{"name":"references","attrs":{"group":"b"}}'>
20613 <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>
20614 </ol>
20615 !!end
20616
20617 !!test
20618 References: 3. ref list should be cleared after processing references
20619 !!options
20620 parsoid
20621 !! wikitext
20622 A <ref>foo</ref>
20623
20624 <references />
20625
20626 B <ref>bar</ref>
20627
20628 <references />
20629 !! html
20630 <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>
20631
20632 <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>
20633 </ol>
20634
20635 <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>
20636
20637 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20638 <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>
20639 </ol>
20640 !!end
20641
20642 !!test
20643 References: 4. only referenced group should be cleared after processing references
20644 !!options
20645 parsoid
20646 !! wikitext
20647 A <ref group="a">afoo</ref>
20648 B <ref>bfoo</ref>
20649
20650 <references group="a" />
20651
20652 C <ref>cfoo</ref>
20653
20654 <references />
20655 !! html
20656 <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>
20657 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>
20658
20659 <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>
20660 </ol>
20661
20662 <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>
20663
20664 <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>
20665 </ol>
20666 !!end
20667
20668 !!test
20669 References: 5. ref tags in references should be processed while ignoring all other content
20670 !!options
20671 parsoid
20672 !! wikitext
20673 A <ref name="a" />
20674 B <ref name="b">bar</ref>
20675
20676 <references>
20677 <ref name="a">foo</ref>
20678 This should just get lost.
20679 </references>
20680 !! html
20681 <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>
20682 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>
20683
20684
20685 <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>
20686 </ol>
20687 !!end
20688
20689 !!test
20690 References: 6. <references /> from a transclusion
20691 !!options
20692 parsoid
20693 !! wikitext
20694 <ref>Foo</ref> {{echo|<references />}}
20695 !! html
20696 <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>
20697 </ol>
20698 !!end
20699
20700 !! test
20701 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
20702 !! options
20703 parsoid
20704 !! wikitext
20705 A <ref>foo bar for a</ref>
20706 B <ref group="X" name="b" />
20707
20708 <references />
20709
20710 <references group="X">
20711 <ref name="b">foo</ref>
20712 </references>
20713 !! html
20714 <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>
20715 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>
20716 </p>
20717
20718 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20719 <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>
20720 </ol>
20721
20722 <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"}}'>
20723 <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>
20724 </ol>
20725 !! end
20726
20727 !! test
20728 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
20729 !! options
20730 parsoid
20731 !! wikitext
20732 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
20733 <references />
20734 !! html
20735 <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>
20736 <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>
20737 </ol>
20738 !!end
20739
20740 # This test only works in wt2html now as the <references /> are always generated
20741 # unless selser is active. Once T72722 is fixed, we should add a changes test
20742 # here to ensure that unrelated changes don't add the new <references /> in
20743 # wt2wt.
20744 !! test
20745 References: 9. Generate missing references list at the end
20746 !! options
20747 parsoid
20748 !! wikitext
20749 A <ref>foo</ref>
20750 B <ref group="inexistent">bar</ref>
20751 !! html
20752 <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>
20753 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20754 <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>
20755 </ol>
20756 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
20757 <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>
20758 </ol>
20759 !! end
20760
20761 !! test
20762 References: 10. New <references/> shouldn't be added for unrelated edits.
20763 !! options
20764 parsoid={
20765 "modes": ["selser"],
20766 "changes": [["#x", "remove"]],
20767 "selser": "noauto"
20768 }
20769 !! wikitext
20770 Unrelated text<span id="x"> that's going to disappear</span>.
20771 A <ref>foo</ref>
20772 !! wikitext/edited
20773 Unrelated text.
20774 A <ref>foo</ref>
20775 !!end
20776
20777 !! test
20778 Entities in ref name
20779 !! options
20780 parsoid
20781 !! wikitext
20782 <ref name="test &amp; me">hi</ref>
20783 <references />
20784 !! html
20785 <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>
20786 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20787 <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>
20788 </ol>
20789 !! end
20790
20791 # This test is wt2html only because we're permitting the serializer to produce
20792 # dirty diffs, normalizing the unclosed references to the self-closed version.
20793 !! test
20794 Generate references for unclosed references tag
20795 !! options
20796 parsoid=wt2html
20797 !! wikitext
20798 a<ref>foo</ref>
20799
20800 <references>
20801 !! html
20802 <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>
20803 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20804 <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>
20805 !! end
20806
20807 !! test
20808 New reference serializes on its own line
20809 !! options
20810 parsoid=wt2wt,html2wt
20811 !! wikitext
20812 foo
20813 <references />
20814 !! html
20815 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
20816 !! end
20817
20818 #### ----------------------------------------------------------------
20819 #### Parsoid-only testing of Parsoid's impl of LST
20820 #### Not implemented yet, see
20821 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
20822 #### ----------------------------------------------------------------
20823
20824 !!test
20825 LST Sections: 1. Simple section start and end
20826 !! wikitext
20827 <section begin="2011-05-16" />
20828 <section end="2014-04-10 (MW 1.23wmf22)" />
20829 !! html/parsoid
20830 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
20831 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
20832 !! end
20833
20834 #--------- Test stripping of empty nodes in template content ----------
20835 !!test
20836 Empty LI and TR nodes should be stripped from template content
20837 !!wikitext
20838 {{EmptyLITest}}
20839 {{EmptyTRTest}}
20840 !!html/parsoid
20841 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
20842 <li>a</li>
20843 <li>b</li>
20844 </ul>
20845 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
20846 <tbody>
20847 <tr>
20848 <td>foo</td>
20849 </tr>
20850 <tr>
20851 <td>bar</td>
20852 </tr>
20853 </tbody>
20854 </table>
20855 !!end
20856
20857 !!test
20858 Empty LI and TR nodes should not be stripped from top-level content
20859 !!wikitext
20860 * a
20861 *
20862 * b
20863 {|
20864 |-
20865 |-
20866 |foo
20867 |}
20868 !!html/parsoid
20869 <ul>
20870 <li> a</li>
20871 <li></li>
20872 <li> b</li>
20873 </ul>
20874 <table>
20875 <tbody>
20876 <tr></tr>
20877 <tr>
20878 <td>foo</td>
20879 </tr>
20880 </tbody>
20881 </table>
20882 !!end
20883
20884 !!test
20885 Empty TR nodes should not be stripped if they have any attributes set
20886 !!wikitext
20887 {{EmptyTRWithHTMLAttrTest}}
20888 !!html/parsoid
20889 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
20890 <tr align="center"></tr>
20891 <tr><td>foo</td></tr>
20892 <tr align="center"></tr>
20893 <tr><td>bar</td></tr>
20894 </table>
20895 !!end
20896
20897 #### ----------------------------------------------------------------
20898 #### The following section of tests are primarily to test
20899 #### wikitext escaping capabilities of Parsoid. Given that
20900 #### escaping can be done any number of ways, the wikitext (input)
20901 #### is always adjusted to reflect how Parsoid adds nowiki
20902 #### escape tags.
20903 ####
20904 #### We are marking several tests as parsoid-only since the
20905 #### HTML in the result section is different from what the
20906 #### PHP parser generates for it.
20907 #### ----------------------------------------------------------------
20908
20909
20910 #### --------------- Headings ---------------
20911 #### 0. Unnested
20912 #### 1. Nested inside html <h1>=foo=</h1>
20913 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
20914 #### 3. Nested inside html with wikitext split by html tags
20915 #### 4. No escape needed
20916 #### 5. Empty headings <h1></h1>
20917 #### 6. Heading chars in SOL context
20918 #### ----------------------------------------
20919 !! test
20920 Headings: 0. Unnested
20921 !! options
20922 parsoid
20923 !! wikitext
20924 <nowiki>=foo=</nowiki>
20925
20926 <nowiki> =foo= </nowiki>
20927 <!--cmt-->
20928 <nowiki>=foo=</nowiki>
20929
20930 =foo''a''<nowiki>=</nowiki>
20931 !! html
20932 <p><span typeof="mw:Nowiki">=foo=</span></p>
20933
20934 <p><span typeof="mw:Nowiki"> =foo= </span>
20935 <!--cmt-->
20936 <span typeof="mw:Nowiki">=foo=</span></p>
20937
20938 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
20939 !!end
20940
20941 # New headings and existing headings are handled differently
20942 !! test
20943 Headings: 1. Nested inside html
20944 !! options
20945 parsoid=html2wt
20946 !! html
20947 <h1>=foo=</h1>
20948 <h2>=foo=</h2>
20949 <h3>=foo=</h3>
20950
20951 <h1 data-parsoid=''>=foo=</h1>
20952 <h2 data-parsoid=''>=foo=</h2>
20953 <h3 data-parsoid=''>=foo=</h3>
20954 <h4 data-parsoid=''>=foo=</h4>
20955 <h5 data-parsoid=''>=foo=</h5>
20956 <h6 data-parsoid=''>=foo=</h6>
20957 !! wikitext
20958 = =foo= =
20959
20960 == =foo= ==
20961
20962 === =foo= ===
20963
20964 =<nowiki>=foo=</nowiki>=
20965 ==<nowiki>=foo=</nowiki>==
20966 ===<nowiki>=foo=</nowiki>===
20967 ====<nowiki>=foo=</nowiki>====
20968 =====<nowiki>=foo=</nowiki>=====
20969 ======<nowiki>=foo=</nowiki>======
20970
20971 !!end
20972
20973 !! test
20974 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
20975 !! options
20976 parsoid=html2wt
20977 !! html
20978 <h1>foo</h1>*bar
20979 <h1>foo</h1>=bar
20980 <h1>foo</h1>=bar=
20981 !! wikitext
20982 = foo =
20983 <nowiki>*</nowiki>bar
20984
20985 = foo =
20986 =bar
20987
20988 = foo =
20989 <nowiki>=bar=</nowiki>
20990 !!end
20991
20992 !! test
20993 Headings: 3. Nested inside html with wikitext split by html tags
20994 !! options
20995 parsoid=html2wt,wt2wt
20996 !! wikitext
20997 = ='''bold'''<nowiki>foo=</nowiki> =
20998 !! html/parsoid
20999 <h1>=<b>bold</b>foo=</h1>
21000 !!end
21001
21002 !! test
21003 Headings: 4a. No escaping needed (testing just h1 and h2)
21004 !! wikitext
21005 = =foo =
21006
21007 = foo= =
21008
21009 = =foo= =
21010
21011 = =foo= bar =
21012
21013 == =foo ==
21014
21015 == foo= ==
21016
21017 = = =
21018
21019 = ''=''foo= =
21020 !! html/parsoid
21021 <h1>=foo</h1>
21022 <h1>foo=</h1>
21023 <h1> =foo= </h1>
21024 <h1>=foo= bar</h1>
21025 <h2>=foo</h2>
21026 <h2>foo=</h2>
21027 <h1>=</h1>
21028 <h1><i>=</i>foo=</h1>
21029 !!end
21030
21031 !! test
21032 Headings: 4b. No escaping needed (inside p-tags)
21033 !! options
21034 parsoid=html2wt
21035 !! html
21036 <p>===
21037 =foo= x
21038 =foo= <s></s>
21039 </p>
21040 !! wikitext
21041 ===
21042 =foo= x
21043 =foo= <s></s>
21044 !!end
21045
21046 !! test
21047 Headings: 5. Empty headings
21048 !! options
21049 parsoid
21050 !! wikitext
21051 =<nowiki/>=
21052
21053 ==<nowiki/>==
21054
21055 ===<nowiki/>===
21056
21057 ====<nowiki/>====
21058
21059 =====<nowiki/>=====
21060
21061 ======<nowiki/>======
21062 !! html
21063 <h1></h1>
21064 <h2></h2>
21065 <h3></h3>
21066 <h4></h4>
21067 <h5></h5>
21068 <h6></h6>
21069 !!end
21070
21071 !! test
21072 Headings: 6a. Heading chars in SOL context (with trailing spaces)
21073 !! options
21074 parsoid
21075 !! wikitext
21076 <nowiki>=a=</nowiki>
21077
21078 <nowiki>=a=</nowiki>
21079
21080 <nowiki>=a=</nowiki>
21081
21082 <nowiki>=a=</nowiki>
21083 !! html
21084 <p>=a=</p>
21085 <p>=a= </p>
21086 <p>=a= </p>
21087 <p>=a= </p>
21088 !!end
21089
21090 !! test
21091 Headings: 6b. Heading chars in SOL context (with trailing newlines)
21092 !! options
21093 parsoid
21094 !! wikitext
21095 <nowiki>=a=
21096 b</nowiki>
21097
21098 <nowiki>=a=
21099 b</nowiki>
21100
21101 <nowiki>=a=
21102 b</nowiki>
21103
21104 <nowiki>=a=
21105 b</nowiki>
21106 !! html
21107 <p>=a=
21108 b</p>
21109 <p>=a=
21110 b</p>
21111 <p>=a=
21112 b</p>
21113 <p>=a=
21114 b</p>
21115 </p>
21116 !!end
21117
21118 !! test
21119 Headings: 6c. Heading chars in SOL context (leading newline break)
21120 !! options
21121 parsoid
21122 !! wikitext
21123 a
21124 <nowiki>=b=</nowiki>
21125 !! html
21126 <p>a
21127 =b=</p>
21128 !!end
21129
21130 !! test
21131 Headings: 6d. Heading chars in SOL context (with interspersed comments)
21132 !! options
21133 parsoid
21134 !! wikitext
21135 <!--c0--><nowiki>=a=</nowiki>
21136
21137 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
21138 !! html
21139 <p><!--c0-->=a=</p>
21140 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
21141 !!end
21142
21143 !! test
21144 Headings: 6d. Heading chars in SOL context (No escaping needed)
21145 !! options
21146 parsoid=html2wt
21147 !! html
21148 =a=<div>b</div>
21149 !! wikitext
21150 =a=<div>b</div>
21151 !!end
21152
21153 !! test
21154 Headings: 7. Insert a newline between new content and headings
21155 !! options
21156 parsoid=html2wt
21157 !! html
21158 <h2>NEW</h2>
21159 <p>new</p>
21160 <h2 data-parsoid='{"dsr":[0,5,2,2]}'>A</h2>
21161 <p data-parsoid='{"dsr":[6,7,0,0]}'>a</p>
21162 !! wikitext
21163 == NEW ==
21164 new
21165
21166 ==A==
21167 a
21168
21169 !! end
21170
21171 #### --------------- Lists ---------------
21172 #### 0. Outside nests (*foo, etc.)
21173 #### 1. Nested inside html <ul><li>*foo</li></ul>
21174 #### 2. Inside definition lists
21175 #### 3. Only bullets at start should be escaped
21176 #### 4. No escapes needed
21177 #### 5. No unnecessary escapes
21178 #### 6. Escape bullets in SOL position
21179 #### 7. Escape bullets in a multi-line context
21180 #### ----------------------------------------
21181
21182 !! test
21183 Lists: 0. Outside nests
21184 !! wikitext
21185 <nowiki>*</nowiki>foo
21186
21187 <nowiki>#</nowiki>foo
21188
21189 <nowiki>;Foo:</nowiki>bar
21190 !! html
21191 <p>*foo
21192 </p><p>#foo
21193 </p><p>;Foo:bar
21194 </p>
21195 !!end
21196
21197 !! test
21198 Lists: 1. Nested inside html
21199 !! wikitext
21200 *<nowiki>*foo</nowiki>
21201
21202 *<nowiki>#foo</nowiki>
21203
21204 *<nowiki>:foo</nowiki>
21205
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 !! html
21216 <ul><li>*foo</li></ul>
21217 <ul><li>#foo</li></ul>
21218 <ul><li>:foo</li></ul>
21219 <ul><li>;foo</li></ul>
21220 <ol><li>*foo</li></ol>
21221 <ol><li>#foo</li></ol>
21222 <ol><li>:foo</li></ol>
21223 <ol><li>;foo</li></ol>
21224
21225 !!end
21226
21227 !! test
21228 Lists: 2. Inside definition lists
21229 !! wikitext
21230 ;<nowiki>;foo</nowiki>
21231
21232 ;<nowiki>:foo</nowiki>
21233
21234 ;<nowiki>:foo</nowiki>
21235 :bar
21236
21237 :<nowiki>:foo</nowiki>
21238 !! html
21239 <dl><dt>;foo</dt></dl>
21240 <dl><dt>:foo</dt></dl>
21241 <dl><dt>:foo</dt>
21242 <dd>bar</dd></dl>
21243 <dl><dd>:foo</dd></dl>
21244
21245 !!end
21246
21247 !! test
21248 Lists: 3. Only bullets at start of text should be escaped
21249 !! wikitext
21250 *<nowiki>*foo*bar</nowiki>
21251
21252 *<nowiki>*foo</nowiki>''it''*bar
21253 !! html
21254 <ul><li>*foo*bar</li></ul>
21255 <ul><li>*foo<i>it</i>*bar</li></ul>
21256
21257 !!end
21258
21259 !! test
21260 Lists: 4. No escapes needed
21261 !! options
21262 parsoid
21263 !! wikitext
21264 *foo*bar
21265
21266 *''foo''*bar
21267
21268 *[[Foo]]: bar
21269
21270 *[[Foo]]*bar
21271 !! html
21272 <ul>
21273 <li>foo*bar
21274 </li>
21275 </ul>
21276 <ul>
21277 <li><i>foo</i>*bar
21278 </li>
21279 </ul>
21280 <ul>
21281 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
21282 </li>
21283 </ul>
21284 <ul>
21285 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
21286 </li>
21287 </ul>
21288 !!end
21289
21290 !! test
21291 Lists: 5. No unnecessary escapes
21292 !! wikitext
21293 * bar <span><nowiki>[[foo]]</nowiki></span>
21294
21295 * =bar <span><nowiki>[[foo]]</nowiki></span>
21296
21297 * [[bar <span><nowiki>[[foo]]</nowiki></span>
21298
21299 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
21300
21301 * =bar <span>foo]]</span>=
21302
21303 * <s></s>: a
21304
21305 * ''* foo''
21306 !! html
21307 <ul><li> bar <span>[[foo]]</span></li></ul>
21308 <ul><li> =bar <span>[[foo]]</span></li></ul>
21309 <ul><li> [[bar <span>[[foo]]</span></li></ul>
21310 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
21311 <ul><li> =bar <span>foo]]</span>=</li></ul>
21312 <ul><li> <s></s>: a</li></ul>
21313 <ul><li> <i>* foo</i></li></ul>
21314
21315 !!end
21316
21317 !! test
21318 Lists: 6. Escape bullets in SOL position
21319 !! options
21320 parsoid=html2wt
21321 !! html
21322 <p><!--cmt-->*foo</p>
21323 !! wikitext
21324 <!--cmt--><nowiki>*</nowiki>foo
21325 !!end
21326
21327 !! test
21328 Lists: 7. Escape bullets in a multi-line context
21329 !! wikitext
21330 a
21331 <nowiki>*</nowiki>b
21332 !! html
21333 <p>a
21334 *b
21335 </p>
21336 !!end
21337
21338 !! test
21339 Lists: 8. Escape colons only if not present in tags
21340 !! options
21341 parsoid=html2wt
21342 !! html
21343 <dl><dt>a:b<i>c:d</i></dt></dl>
21344 !! wikitext
21345 ; <nowiki>a:b</nowiki>''c:d''
21346 !! end
21347
21348 #### --------------- HRs ---------------
21349 #### 1. Single line
21350 #### -----------------------------------
21351
21352 !! test
21353 HRs: 1. Single line
21354 !! wikitext
21355 ----<nowiki>----</nowiki>
21356 ----=foo=
21357 ----*foo
21358 !! html+tidy
21359 <hr />
21360 <p>----</p>
21361 <hr />
21362 <p>=foo=</p>
21363 <hr />
21364 <p>*foo</p>
21365 !! end
21366
21367 #### --------------- Tables ---------------
21368 #### 1a. Simple example
21369 #### 1b. No escaping needed (!foo)
21370 #### 1c. No escaping needed (|foo)
21371 #### 1d. No escaping needed (|}foo)
21372 ####
21373 #### 2a. Nested in td (<td>foo|bar</td>)
21374 #### 2b. Nested in td (<td>foo||bar</td>)
21375 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
21376 ####
21377 #### 3a. Nested in th (<th>foo!bar</th>)
21378 #### 3b. Nested in th (<th>foo!!bar</th>)
21379 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
21380 ####
21381 #### 4a. Escape -
21382 #### 4b. Escape +
21383 #### 4c. No escaping needed
21384 #### --------------------------------------
21385
21386 !! test
21387 Tables: 1a. Simple example
21388 !! wikitext
21389 <nowiki>{|
21390 |}</nowiki>
21391 !! html
21392 <p>{|
21393 |}
21394 </p>
21395 !! end
21396
21397 !! test
21398 Tables: 1b. No escaping needed
21399 !! wikitext
21400 !foo
21401 !! html
21402 <p>!foo
21403 </p>
21404 !! end
21405
21406 !! test
21407 Tables: 1c. No escaping needed
21408 !! wikitext
21409 |foo
21410 !! html
21411 <p>|foo
21412 </p>
21413 !! end
21414
21415 !! test
21416 Tables: 1d. No escaping needed
21417 !! wikitext
21418 |}foo
21419 !! html
21420 <p>|}foo
21421 </p>
21422 !! end
21423
21424 !! test
21425 Tables: 2a. Nested in td
21426 !! options
21427 parsoid=html2wt
21428 !! html/parsoid
21429 <table><tbody><tr>
21430 <td>foo|bar</td></tr>
21431 <tr><td>x<div>a|b</div></td>
21432 </tbody></table>
21433 !! wikitext
21434 {|
21435 |<nowiki>foo|bar</nowiki>
21436 |-
21437 |x<div><nowiki>a|b</nowiki></div>
21438 |}
21439 !! html/php+tidy
21440 <table>
21441 <tr>
21442 <td>foo|bar</td>
21443 </tr>
21444 <tr>
21445 <td>x
21446 <div>a|b</div>
21447 </td>
21448 </tr>
21449 </table>
21450 !! end
21451
21452 !! test
21453 Tables: 2b. Nested in td
21454 !! options
21455 parsoid=html2wt
21456 !! html/parsoid
21457 <table><tbody><tr>
21458 <td>foo||bar</td>
21459 <td>a<i>b||c</i></td>
21460 <td>a<i><div>b||c</div></i></td>
21461 </tr></tbody></table>
21462 !! wikitext
21463 {|
21464 |<nowiki>foo||bar</nowiki>
21465 |a''<nowiki>b||c</nowiki>''
21466 |a''<div><nowiki>b||c</nowiki></div>''
21467 |}
21468 !! html/php
21469 <table>
21470 <tr>
21471 <td>foo||bar
21472 </td>
21473 <td>a<i>b||c</i>
21474 </td>
21475 <td>a<i><div>b||c</div></i>
21476 </td></tr></table>
21477
21478 !! end
21479
21480 !! test
21481 Tables: 2c. Nested in td -- no escaping needed
21482 !! wikitext
21483 {|
21484
21485 |foo!!bar
21486 |}
21487 !! html/*
21488 <table>
21489
21490 <tr>
21491 <td>foo!!bar
21492 </td></tr></table>
21493
21494 !! end
21495
21496 !! test
21497 Tables: 3a. Nested in th
21498 !! wikitext
21499 {|
21500
21501 !foo!bar
21502 |}
21503 !! html/*
21504 <table>
21505
21506 <tr>
21507 <th>foo!bar
21508 </th></tr></table>
21509
21510 !! end
21511
21512 !! test
21513 Tables: 3b. Nested in th
21514 !! options
21515 parsoid=html2wt
21516 !! html/parsoid
21517 <table><tbody>
21518 <tr><th>foo!!bar</th>
21519 <th><i>foo|bar</i></th>
21520 <th><i>foo!!bar</i></th>
21521 <th><i><span>foo!!bar</span></i></th>
21522 </tr></tbody></table>
21523 !! wikitext
21524 {|
21525 !<nowiki>foo!!bar</nowiki>
21526 !''<nowiki>foo|bar</nowiki>''
21527 !''<nowiki>foo!!bar</nowiki>''
21528 !''<span><nowiki>foo!!bar</nowiki></span>''
21529 |}
21530 !! html/php
21531 <table>
21532 <tr>
21533 <th>foo!!bar
21534 </th>
21535 <th><i>foo|bar</i>
21536 </th>
21537 <th><i>foo!!bar</i>
21538 </th>
21539 <th><i><span>foo!!bar</span></i>
21540 </th></tr></table>
21541
21542 !! end
21543
21544 !! test
21545 Tables: 3c. Nested in th
21546 !! options
21547 parsoid=html2wt
21548 !! html/parsoid
21549 <table><tbody>
21550 <tr><th>foo||bar</th>
21551 <th><span typeof="mw:Nowiki">foo||bar</span></th>
21552 </tr></tbody></table>
21553 !! wikitext
21554 {|
21555 !<nowiki>foo||bar</nowiki>
21556 !<nowiki>foo||bar</nowiki>
21557 |}
21558 !! html/php
21559 <table>
21560 <tr>
21561 <th>foo||bar
21562 </th>
21563 <th>foo||bar
21564 </th></tr></table>
21565
21566 !! end
21567
21568 !! test
21569 Tables: 4a. Escape -
21570 !! options
21571 parsoid=html2wt
21572 !! html/*
21573 <table>
21574
21575 <tr>
21576 <th>-bar
21577 </th></tr>
21578 <tr>
21579 <td>-bar
21580 </td></tr></table>
21581
21582 !! wikitext
21583 {|
21584
21585 !-bar
21586
21587 |-
21588 |<nowiki>-bar</nowiki>
21589 |}
21590 !! end
21591
21592 !! test
21593 Tables: 4b. Escape +
21594 !! options
21595 parsoid=html2wt
21596 !! html/*
21597 <table>
21598
21599 <tr>
21600 <th>+bar
21601 </th></tr>
21602 <tr>
21603 <td>+bar
21604 </td></tr></table>
21605
21606 !! wikitext
21607 {|
21608
21609 !+bar
21610
21611 |-
21612 |<nowiki>+bar</nowiki>
21613 |}
21614 !! end
21615
21616 !! test
21617 Tables: 4c. No escaping needed
21618 !! wikitext
21619 {|
21620 |foo-bar
21621 |foo+bar
21622 |-
21623 |''foo''-bar
21624 |''foo''+bar
21625 |-
21626 |foo
21627 bar|baz
21628 +bar
21629 -bar
21630 |-
21631 |x
21632 <div>a|b</div>
21633 |}
21634 !! html/php
21635 <table>
21636 <tr>
21637 <td>foo-bar
21638 </td>
21639 <td>foo+bar
21640 </td></tr>
21641 <tr>
21642 <td><i>foo</i>-bar
21643 </td>
21644 <td><i>foo</i>+bar
21645 </td></tr>
21646 <tr>
21647 <td>foo
21648 <p>bar|baz
21649 +bar
21650 -bar
21651 </p>
21652 </td></tr>
21653 <tr>
21654 <td>x
21655 <div>a|b</div>
21656 </td></tr></table>
21657
21658 !! html/parsoid
21659 <table><tbody>
21660 <tr><td>foo-bar</td><td>foo+bar</td></tr>
21661 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
21662 <tr><td>foo
21663 <p>bar|baz
21664 +bar
21665 -bar</p></td></tr>
21666 <tr><td>x
21667 <div>a|b</div></td>
21668 </tbody></table>
21669 !! end
21670
21671 !! test
21672 Tables: 4d. No escaping needed
21673 !! wikitext
21674 {|
21675 |[[Foo]]-bar
21676 ||+1
21677 ||-2
21678 |}
21679 !! html/php
21680 <table>
21681 <tr>
21682 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
21683 </td>
21684 <td>+1
21685 </td>
21686 <td>-2
21687 </td></tr></table>
21688
21689 !! html/parsoid
21690 <table>
21691 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
21692 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
21693 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
21694 </tbody></table>
21695 !! end
21696
21697 !! test
21698 Tables: Digest broken attributes on table and tr tag
21699 !! options
21700 parsoid=wt2html
21701 !! wikitext
21702 {| || |} ++
21703 |- || || ++ --
21704 |- > [
21705 |}
21706 !! html
21707 <table>
21708 <tbody>
21709 <tr></tr>
21710 <tr></tr>
21711 </tbody></table>
21712 !! end
21713
21714 #### --------------- Links ----------------
21715 #### 1. Quote marks in link text
21716 #### 2. Wikilinks: Escapes needed
21717 #### 3. Wikilinks: No escapes needed
21718 #### 4. Extlinks: Escapes needed
21719 #### 5. Extlinks: No escapes needed
21720 #### --------------------------------------
21721 !! test
21722 Links 1. WikiLinks: No escapes needed
21723 !! wikitext
21724 [[Foo|Foo''boo'']]
21725 [[Foo|[Foobar]]]
21726 [[Foo|x [Foobar] x]]
21727 !! html/php
21728 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
21729 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
21730 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
21731 </p>
21732 !! html/parsoid
21733 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
21734 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
21735 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
21736 !! end
21737
21738 !! test
21739 Links 2. WikiLinks: Escapes needed
21740 !! options
21741 parsoid=html2wt
21742 !! html/parsoid
21743 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
21744 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
21745 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
21746 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
21747 <a href="Foo" rel="mw:WikiLink">|Bar</a>
21748 <a href="Foo" rel="mw:WikiLink">]]bar</a>
21749 <a href="Foo" rel="mw:WikiLink">[[bar</a>
21750 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
21751 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
21752 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
21753 !! wikitext
21754 [[Foo|<nowiki>Foobar]</nowiki>]]
21755 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
21756 [[Foo|<nowiki>[[Bar]]</nowiki>]]
21757 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
21758 [[Foo|<nowiki>|Bar</nowiki>]]
21759 [[Foo|<nowiki>]]bar</nowiki>]]
21760 [[Foo|<nowiki>[[bar</nowiki>]]
21761 [[Foo|<nowiki>x [[ y</nowiki>]]
21762 [[Foo|<nowiki>x ]] y</nowiki>]]
21763 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
21764 !! html/php
21765 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
21766 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
21767 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
21768 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
21769 <a href="/wiki/Foo" title="Foo">|Bar</a>
21770 <a href="/wiki/Foo" title="Foo">]]bar</a>
21771 <a href="/wiki/Foo" title="Foo">[[bar</a>
21772 <a href="/wiki/Foo" title="Foo">x [[ y</a>
21773 <a href="/wiki/Foo" title="Foo">x ]] y</a>
21774 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
21775 </p>
21776 !! end
21777
21778 !! test
21779 Links 3. WikiLinks: No escapes needed
21780 !! wikitext
21781 [[Foo|[Foobar]]
21782 [[Foo|foo|bar]]
21783 !! html/php
21784 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
21785 <a href="/wiki/Foo" title="Foo">foo|bar</a>
21786 </p>
21787 !! html/parsoid
21788 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
21789 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
21790 !! end
21791
21792 !! test
21793 Links 4. ExtLinks: Escapes needed
21794 !! options
21795 parsoid=html2wt
21796 !! html/parsoid
21797 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
21798 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
21799 <p>[http://google.com]</p>
21800 <p>[http://google.com google]</p>
21801 !! wikitext
21802 [http://google.com <nowiki>[google]</nowiki>]
21803 [http://google.com <nowiki>google]</nowiki>]
21804
21805 <nowiki>[http://google.com]</nowiki>
21806
21807 <nowiki>[http://google.com google]</nowiki>
21808
21809 !! html/php
21810 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
21811 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
21812 </p><p>[http://google.com]
21813 </p><p>[http://google.com google]
21814 </p>
21815 !! end
21816
21817 !! test
21818 Links 5. ExtLinks: No escapes needed
21819 !! wikitext
21820 [http://google.com [google]
21821 !! html/php
21822 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
21823 </p>
21824 !! html/parsoid
21825 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
21826 !! end
21827
21828 !! test
21829 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
21830 !! html/parsoid
21831 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
21832 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
21833 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
21834 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
21835 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
21836 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
21837 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
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>;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(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
21844 </p>
21845 !! wikitext
21846 x<nowiki/>http://example.com<nowiki/>y
21847 http://example.com<nowiki/>?x
21848 http://example.com<nowiki/>&x
21849 http://example.com<nowiki/>'x
21850 http://example.com<nowiki/>,x
21851 http://example.com<nowiki/>.x
21852 http://example.com<nowiki/>;x
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(x<nowiki/>)
21859 !! end
21860
21861 !! test
21862 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21863 !! html/parsoid
21864 <p>x
21865 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
21866 y
21867 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
21868 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
21869 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
21870 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
21871 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
21872 </p>
21873 !! wikitext
21874 x
21875 http://example.com
21876 y
21877 "http://example.com"
21878 (http://example.com)
21879 (http://example.com) foo
21880 http://example.com,
21881 http://example.com, foo
21882 !! html/php
21883 <p>x
21884 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
21885 y
21886 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
21887 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
21888 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
21889 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
21890 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
21891 </p>
21892 !! end
21893
21894 !! test
21895 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21896 !! html/parsoid
21897 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
21898 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
21899 !! wikitext
21900 http://example.com.,;:!?\
21901 -http://example.com:
21902 !! html/php
21903 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
21904 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
21905 </p>
21906 !! end
21907
21908 !! test
21909 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
21910 !! html/parsoid
21911 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
21912 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
21913 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
21914 !! wikitext
21915 RFC 123<nowiki/>4
21916 RFC 123<nowiki/>y
21917 X<nowiki/>RFC 123<nowiki/>y
21918 !! end
21919
21920 !! test
21921 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
21922 !! html/parsoid
21923 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
21924 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
21925 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
21926 </p>
21927 !! wikitext
21928 RFC 123?foo
21929 RFC 123&foo
21930 -RFC 123-
21931 !! html/php
21932 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
21933 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
21934 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
21935 </p>
21936 !! end
21937
21938 !! test
21939 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
21940 !! html/parsoid
21941 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
21942 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21943 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21944 !! wikitext
21945 PMID 123<nowiki/>4
21946 PMID 123<nowiki/>y
21947 X<nowiki/>PMID 123<nowiki/>y
21948 !! end
21949
21950 !! test
21951 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
21952 !! html/parsoid
21953 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
21954 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
21955 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
21956 </p>
21957 !! wikitext
21958 PMID 123?foo
21959 PMID 123&foo
21960 -PMID 123-
21961 !! html/php
21962 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
21963 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
21964 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
21965 </p>
21966 !! end
21967
21968 !! test
21969 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
21970 !! html/parsoid
21971 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
21972 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
21973 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
21974 </p>
21975 !! wikitext
21976 ISBN 1234567890<nowiki/>1
21977 ISBN 1234567890<nowiki/>x
21978 a<nowiki/>ISBN 1234567890<nowiki/>b
21979 !! end
21980
21981 !! test
21982 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
21983 !! html/parsoid
21984 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
21985 !! wikitext
21986 -ISBN 1234567890's
21987 !! html/php
21988 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
21989 </p>
21990 !! end
21991
21992 !! test
21993 Links 14. Protect link-like plain text. (Parsoid bug T78425)
21994 !! options
21995 parsoid=html2wt
21996 !! html/*
21997 <p>this is not a link: http://example.com
21998 </p>
21999 !! wikitext
22000 this is not a link: <nowiki>http://example.com</nowiki>
22001 !! end
22002
22003 !! test
22004 Links 15. Link trails can't become link prefixes.
22005 !! options
22006 language=is
22007 !! wikitext
22008 [[Söfnuður]]-[[00]]
22009 !! html/php
22010 <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>
22011 </p>
22012 !! html/parsoid
22013 <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>
22014 !! end
22015
22016 #### --------------- Quotes ---------------
22017 #### 1. Quotes inside <b> and <i>
22018 #### 2. Link fragments separated by <i> and <b> tags
22019 #### 3. Link fragments inside <i> and <b>
22020 #### 4. No escaping needed
22021 #### --------------------------------------
22022 !! test
22023 1a. Quotes inside <b> and <i>
22024 !! options
22025 parsoid=html2wt,wt2wt
22026 !! wikitext
22027 ''<nowiki/>'foo'''
22028 ''<nowiki>''foo''</nowiki>''
22029 ''<nowiki>'''foo'''</nowiki>''
22030 ''foo''<nowiki/>'s
22031 '''<nowiki/>'foo''''
22032 '''<nowiki>''foo''</nowiki>'''
22033 '''<nowiki>'''foo'''</nowiki>'''
22034 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
22035 '''foo'''<nowiki/>'s
22036 '''foo''
22037 ''foo''<nowiki/>'
22038 ''foo'''<nowiki/>'
22039 '''foo''<nowiki/>'
22040 ''''foo'''
22041 '''foo'''<nowiki/>'
22042 ''''foo'''<nowiki/>'
22043 ''fools'<span> errand</span>''
22044 ''<span>fool</span>'s errand''
22045 '<nowiki/>''foo'' bar '''baz''
22046 a|!*#-:;+-~[]{}b'''x''
22047 !! html/*
22048 <p><i>'foo'</i>
22049 <i>''foo''</i>
22050 <i>'''foo'''</i>
22051 <i>foo</i>'s
22052 <b>'foo'</b>
22053 <b>''foo''</b>
22054 <b>'''foo'''</b>
22055 <b>foo'<i>bar'</i>baz</b>
22056 <b>foo</b>'s
22057 '<i>foo</i>
22058 <i>foo</i>'
22059 <i>foo'</i>'
22060 '<i>foo</i>'
22061 '<b>foo</b>
22062 <b>foo</b>'
22063 '<b>foo</b>'
22064 <i>fools'<span> errand</span></i>
22065 <i><span>fool</span>'s errand</i>
22066 '<i>foo</i> bar '<i>baz</i>
22067 a|!*#-:;+-~[]{}b'<i>x</i>
22068 </p>
22069 !! end
22070
22071 !! test
22072 1b. Quotes inside <b> and <i> with other tags on same line
22073 !! options
22074 parsoid=html2wt,wt2wt
22075 !! wikitext
22076 '''a'' foo ''[[bar]]''
22077 ''a''' foo ''[[bar]]''
22078 ''a''' foo '''{{echo|[[bar]]}}'''
22079 [[foo]] x'''[[bar]]''
22080 '''foo'' <ref>test</ref>
22081 '''foo'' <div title="name">test</div>
22082 '''foo'' and <br> bar
22083 <references />
22084 !! html
22085 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22086 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22087 <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>
22088 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
22089 '<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>
22090 '<i>foo</i> <div title="name">test</div>
22091 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
22092 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22093 <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>
22094 </ol>
22095 !! end
22096
22097 !! test
22098 2. Link fragments separated by <i> and <b> tags
22099 !! wikitext
22100 [[''foo''<nowiki>hello]]</nowiki>
22101
22102 [['''foo'''<nowiki>hello]]</nowiki>
22103 !! html
22104 <p>[[<i>foo</i>hello]]
22105 </p><p>[[<b>foo</b>hello]]
22106 </p>
22107 !! end
22108
22109 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
22110 # this is one of the shortcomings of this format
22111 !! test
22112 3. Link fragments inside <i> and <b>
22113 !! wikitext
22114 ''[[foo''<nowiki>]]</nowiki>
22115
22116 '''[[foo'''<nowiki>]]</nowiki>
22117 !! html
22118 <p><i>[[foo</i>]]
22119 </p><p><b>[[foo</b>]]
22120 </p>
22121 !! end
22122
22123 !! test
22124 4. No escaping needed
22125 !! wikitext
22126 '<span>''bar''</span>'
22127 '<span>'''bar'''</span>'
22128 'a:b'foo
22129 !! html
22130 <p>'<span><i>bar</i></span>'
22131 '<span><b>bar</b></span>'
22132 'a:b'foo
22133 </p>
22134 !! end
22135
22136 #### ----------- Paragraphs ---------------
22137 #### 1. No unnecessary escapes
22138 #### --------------------------------------
22139
22140 !! test
22141 1. No unnecessary escapes
22142 !! wikitext
22143 bar <span><nowiki>[[foo]]</nowiki></span>
22144
22145 =bar <span><nowiki>[[foo]]</nowiki></span>
22146
22147 [[bar <span><nowiki>[[foo]]</nowiki></span>
22148
22149 ]]bar <span><nowiki>[[foo]]</nowiki></span>
22150
22151 =bar <span>foo]]</span><nowiki>=</nowiki>
22152 !! html
22153 <p>bar <span>[[foo]]</span>
22154 </p><p>=bar <span>[[foo]]</span>
22155 </p><p>[[bar <span>[[foo]]</span>
22156 </p><p>]]bar <span>[[foo]]</span>
22157 </p><p>=bar <span>foo]]</span>=
22158 </p>
22159 !!end
22160
22161 #### ----------------------- PRE --------------------------
22162 #### 1. Leading whitespace in SOL context should be escaped
22163 #### ------------------------------------------------------
22164 !! test
22165 1. Leading whitespace in SOL context should be escaped
22166 !! options
22167 parsoid
22168 !! wikitext
22169 <nowiki> </nowiki>a
22170
22171 <nowiki> </nowiki> a
22172
22173 <nowiki> </nowiki>a(tab)
22174
22175 <nowiki> </nowiki> a
22176 <!--cmt-->
22177 <nowiki> </nowiki> a
22178
22179 a
22180 <nowiki> </nowiki>b
22181
22182 a
22183 <nowiki> </nowiki>b
22184
22185 a
22186 <nowiki> </nowiki> b
22187 !! html
22188 <p> a</p>
22189 <p> a</p>
22190 <p> a(tab)</p>
22191 <p> a</p>
22192 <p><!--cmt--> a</p>
22193 <p>a
22194 b</p>
22195 <p>a
22196 b</p>
22197 <p>a
22198 b</p>
22199 !! end
22200
22201 !! test
22202 2. Leading whitespace in non-indent-pre contexts should not be escaped
22203 !! options
22204 parsoid
22205 !! wikitext
22206 foo <ref>''a''
22207 b</ref>
22208 <references />
22209 !! html
22210 <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>
22211 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22212 <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>
22213 b</span></li>
22214 </ol>
22215 !! end
22216
22217 !! test
22218 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
22219 !! options
22220 parsoid
22221 !! wikitext
22222 <blockquote>
22223 a
22224 <span>b</span>
22225 c
22226 </blockquote>
22227 !! html
22228 <blockquote>
22229 <p>
22230 a
22231 <span>b</span>
22232 c</p>
22233 </blockquote>
22234 !! end
22235
22236 !! test
22237 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
22238 !! options
22239 parsoid
22240 !! wikitext
22241 [[File:Foobar.jpg|thumb|caption]]
22242 !! html/parsoid
22243 <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>
22244 !! end
22245
22246 !! test
22247 5. Nowiki escaping should account for indent-pres
22248 !! options
22249 parsoid=html2wt
22250 !! html
22251 <pre>==foo==</pre>
22252 !! wikitext
22253 ==foo==
22254 !! end
22255
22256 #### --------------- Behavior Switches --------------------
22257 !! test
22258 1. Valid behavior switches should be escaped
22259 !! options
22260 parsoid=html2wt
22261 !! html
22262 __TOC__
22263 <i>__TOC__</i>
22264 !! wikitext
22265 <nowiki>__TOC__</nowiki>
22266 ''<nowiki>__TOC__</nowiki>''
22267 !! end
22268
22269 !! test
22270 2. Invalid behavior switches should not be escaped
22271 !! options
22272 parsoid=html2wt
22273 !! html
22274 __TOO__
22275 __|__
22276 !! wikitext
22277 __TOO__
22278 __|__
22279 !! end
22280
22281 #### --------------- HTML tags ---------------
22282 #### 1. a tags
22283 #### 2. other tags
22284 #### 3. multi-line html tag
22285 #### 4. extension tags
22286 #### -----------------------------------------
22287 !! test
22288 1. a tags
22289 !! options
22290 parsoid
22291 !! wikitext
22292 <a href="http://google.com">google</a>
22293 !! html
22294 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
22295 !! end
22296
22297 !! test
22298 2. other tags
22299 !! wikitext
22300 * <nowiki><div>foo</div></nowiki>
22301 * <nowiki><div style="color:red">foo</div></nowiki>
22302 * <nowiki><td></nowiki>
22303 !! html
22304 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
22305 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
22306 <li> &lt;td&gt;</li></ul>
22307
22308 !! end
22309
22310 !! test
22311 3. multi-line html tag
22312 !! wikitext
22313 <nowiki><div
22314 >foo</div
22315 ></nowiki>
22316 !! html
22317 <p>&lt;div
22318 &gt;foo&lt;/div
22319 &gt;
22320 </p>
22321 !! end
22322
22323 !! test
22324 4. extension tags
22325 !! wikitext
22326 <nowiki><ref>foo</ref></nowiki>
22327
22328 <nowiki><ref>bar</nowiki>
22329
22330 baz<nowiki></ref></nowiki>
22331 !! html
22332 <p>&lt;ref&gt;foo&lt;/ref&gt;
22333 </p><p>&lt;ref&gt;bar
22334 </p><p>baz&lt;/ref&gt;
22335 </p>
22336 !! end
22337
22338 #### --------------- Others ---------------
22339 !! test
22340 Escaping nowikis
22341 !! wikitext
22342 &lt;nowiki&gt;foo&lt;/nowiki&gt;
22343 !! html
22344 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
22345 </p>
22346 !! end
22347
22348 ## The quote-char in the input is necessary for triggering the bug
22349 !! test
22350 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
22351 !! options
22352 parsoid=wt2wt,html2wt
22353 !! wikitext
22354 foo's bar :
22355 !! html
22356 <p>foo's bar :</p>
22357 !! end
22358
22359 !! test
22360
22361 Tag-like HTML structures are passed through as text
22362 !! wikitext
22363 <x y>
22364
22365 <x.y>
22366
22367 <x-y>
22368
22369 1>2
22370
22371 x<y
22372
22373 a>b
22374
22375 1<d e>f
22376 !! html
22377 <p>&lt;x y&gt;
22378 </p><p>&lt;x.y&gt;
22379 </p><p>&lt;x-y&gt;
22380 </p><p>1&gt;2
22381 </p><p>x&lt;y
22382 </p><p>a&gt;b
22383 </p><p>1&lt;d e&gt;f
22384 </p>
22385 !! end
22386
22387 !! test
22388 HTML tag with necessary entities in attributes
22389 !! wikitext
22390 <span title="&amp;amp;">foo</span>
22391 !! html
22392 <p><span title="&amp;amp;">foo</span>
22393 </p>
22394 !! end
22395
22396 !! test
22397 HTML tag with 'unnecessary' entity encoding in attributes
22398 !! wikitext
22399 <span title="&amp;">foo</span>
22400 !! html
22401 <p><span title="&amp;">foo</span>
22402 </p>
22403 !! end
22404
22405 !! test
22406 HTML tag with broken attribute value quoting
22407 !! wikitext
22408 <span title="Hello world>Foo</span>
22409 !! html/php
22410 <p><span>Foo</span>
22411 </p>
22412 !! html/parsoid
22413 <p><span title="Hello world">Foo</span>
22414 </p>
22415 !! end
22416
22417 !! test
22418 Parsoid-only: HTML tag with broken attribute value quoting
22419 !! options
22420 parsoid
22421 !! wikitext
22422 <span title="Hello world>Foo</span>
22423 !! html
22424 <p><span title="Hello world">Foo</span>
22425 </p>
22426 !! end
22427
22428 !! test
22429 Table with broken attribute value quoting
22430 !! wikitext
22431 {|
22432 | title="Hello world|Foo
22433 |}
22434 !! html/php
22435 <table>
22436 <tr>
22437 <td>Foo
22438 </td></tr></table>
22439
22440 !! html/parsoid
22441 <table>
22442 <tr>
22443 <td title="Hello world">Foo
22444 </td></tr></table>
22445
22446 !! end
22447
22448 !! test
22449 Table with broken attribute value quoting on consecutive lines
22450 !! wikitext
22451 {|
22452 | title="Hello world|Foo
22453 | style="color:red|Bar
22454 |}
22455 !! html/php
22456 <table>
22457 <tr>
22458 <td>Foo
22459 </td>
22460 <td>Bar
22461 </td></tr></table>
22462
22463 !! html/parsoid
22464 <table><tbody>
22465 <tr>
22466 <td title="Hello world">Foo
22467 </td><td style="color: red">Bar
22468 </td></tr></tbody></table>
22469
22470 !! end
22471
22472 !! test
22473 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
22474 !! options
22475 parsoid
22476 !! wikitext
22477 {{}}
22478 !! html
22479 {{}}
22480 !! end
22481
22482 !! test
22483 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
22484 !! options
22485 parsoid
22486 !! wikitext
22487 }}{{
22488 !! html
22489 }}{{
22490 !! end
22491
22492 !!test
22493 Accept empty td cell attribute
22494 !! wikitext
22495 {|
22496 | align="center" | foo || |
22497 |}
22498 !! html
22499 <table>
22500 <tr>
22501 <td align="center"> foo </td>
22502 <td>
22503 </td></tr></table>
22504
22505 !!end
22506
22507 !!test
22508 Non-empty attributes in th-cells
22509 !! wikitext
22510 {|
22511 ! Foo !! style="color: red" | Bar
22512 |}
22513 !! html
22514 <table>
22515 <tr>
22516 <th> Foo </th>
22517 <th style="color: red"> Bar
22518 </th></tr></table>
22519
22520 !!end
22521
22522 !!test
22523 Accept empty attributes in th-cells
22524 !! wikitext
22525 {|
22526 !| foo !!| bar
22527 |}
22528 !! html
22529 <table>
22530 <tr>
22531 <th> foo </th>
22532 <th> bar
22533 </th></tr></table>
22534
22535 !!end
22536
22537 !!test
22538 Empty table rows go away
22539 !! wikitext
22540 {|
22541 | Hello
22542 | there
22543 |- class="foo"
22544 |-
22545 |}
22546 !! html
22547 <table>
22548 <tr>
22549 <td> Hello
22550 </td>
22551 <td> there
22552 </td></tr>
22553
22554 </table>
22555
22556 !! end
22557
22558 ###
22559 ### Parsoid-centric tests for testing RTing of inter-element separators
22560 ### Edge cases not tested by existing parser tests and specific to
22561 ### Parsoid-specific serialization strategies.
22562 ###
22563
22564 !!test
22565 RT-ed inter-element separators should be valid separators
22566 !! wikitext
22567 {|
22568 |- [[foo]]
22569 |}
22570 !! html
22571 <table>
22572
22573 </table>
22574
22575 !!end
22576
22577 # Parsoid-only since PHP parser relies on Tidy for correct output
22578 !!test
22579 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
22580 !!options
22581 parsoid
22582 !! wikitext
22583 {|
22584 |<small>foo
22585 bar
22586 |}
22587
22588 {|
22589 |<small>foo<small>
22590 |}
22591 !! html
22592 <table>
22593 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
22594 <p>bar</p></small></td></tr>
22595 </tbody></table>
22596
22597 <table>
22598 <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>
22599 </tbody></table>
22600 !!end
22601
22602 !!test
22603 Empty TD followed by TD with tpl-generated attribute
22604 !! wikitext
22605 {|
22606 |-
22607 |
22608 |{{echo|style='color:red'}}|foo
22609 |}
22610 !! html
22611 <table>
22612
22613 <tr>
22614 <td>
22615 </td>
22616 <td>foo
22617 </td></tr></table>
22618
22619 !!end
22620
22621 !!test
22622 Indented table with an empty td
22623 !! wikitext
22624 {|
22625 |-
22626 |
22627 |foo
22628 |}
22629 !! html
22630 <table>
22631
22632 <tr>
22633 <td>
22634 </td>
22635 <td>foo
22636 </td></tr></table>
22637
22638 !!end
22639
22640 ## We have some newline diffs RT-ing this edge case
22641 ## and it is not important enough -- we seem to be emitting
22642 ## at most 2 newlines after a </tr> and this is unrelated to
22643 ## the issue from T85627 that this is testing.
22644 !!test
22645 Indented table with blank lines in between (T85627)
22646 !! options
22647 parsoid=wt2html
22648 !! wikitext
22649 {|
22650 |foo
22651
22652
22653 |}
22654 !! html
22655 <table>
22656
22657 <tr>
22658 <td>foo
22659 </td></tr></table>
22660
22661 !!end
22662
22663 !!test
22664 Indented block & table
22665 !! wikitext
22666 <div>foo</div>
22667 {|
22668 |foo
22669 |}
22670 !! html/php
22671 <div>foo</div>
22672 <table>
22673 <tr>
22674 <td>foo
22675 </td></tr></table>
22676
22677 !! html/parsoid
22678 <div data-parsoid='{"stx":"html"}'>foo</div>
22679 <table><tbody>
22680 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
22681 </tbody></table>
22682 !!end
22683
22684 !! test
22685 Indent and comment before table row
22686 !! wikitext
22687 {|
22688 <!--hi-->|-
22689 | there
22690 |}
22691 !! html/php
22692 <table>
22693
22694 <tr>
22695 <td> there
22696 </td></tr></table>
22697
22698 !! html/parsoid
22699 <table>
22700 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
22701 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
22702 </tbody></table>
22703 !! end
22704
22705 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
22706 !!test
22707 Empty TR followed by a template-generated TR
22708 !!options
22709 parsoid
22710 !! wikitext
22711 {|
22712 |-
22713 {{echo|<tr><td>foo</td></tr>}}
22714 |}
22715 !! html
22716 <table>
22717 <tbody>
22718 <tr></tr>
22719 <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}}]}'>
22720 <td>foo</td></tr>
22721 </tbody></table>
22722 !!end
22723
22724 ## PHP and parsoid output differ for this, and since this is primarily
22725 ## for testing Parsoid's serializer, marking this Parsoid only
22726 !!test
22727 Empty TR followed by mixed-ws-comment line should RT correctly
22728 !!options
22729 parsoid
22730 !! wikitext
22731 {|
22732 |-
22733 <!--c-->
22734 |-
22735 <!--c--> <!--d-->
22736 |}
22737 !! html
22738 <table>
22739 <tbody>
22740 <tr></tr>
22741 <!--c-->
22742 <tr>
22743 <!--c--> </tr><!--d-->
22744 </tbody></table>
22745
22746 !!end
22747
22748 !!test
22749 Multi-line image caption generated by templates with/without trailing newlines
22750 !! wikitext
22751 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
22752 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
22753 !! html/parsoid
22754 <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>
22755 <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>
22756 !!end
22757
22758 !! test
22759 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
22760 !! options
22761 parsoid=html2wt
22762 !! html
22763 <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>
22764
22765 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
22766 !! wikitext
22767 <includeonly>foo</includeonly>
22768 new para
22769
22770 [[Category:Foo]]
22771
22772 = new heading =
22773 !! end
22774
22775 ## PHP emits broken html for this, and since this is primarily
22776 ## a Parsoid serializer test, marking this Parsoid only
22777 !!test
22778 Improperly nested inline or quotes tags with whitespace in between
22779 !!options
22780 parsoid
22781 !! wikitext
22782 <span> <s>x</span> </s>
22783 ''' ''x''' ''
22784 !! html
22785 <p><span> <s>x</s></span><s> </s>
22786 <b> <i>x</i></b><i> </i>
22787 </p>
22788 !!end
22789
22790 !!test
22791 Encapsulate protected attributes from wt
22792 !!options
22793 parsoid
22794 !! wikitext
22795 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
22796 !! html
22797 <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>
22798 </body>
22799 !!end
22800
22801 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
22802 ## Having nested or stray pre tags results in the attempt to add duplicates,
22803 ## causing an assertion fail. This test tries to prevent that situation.
22804 !!test
22805 Ensure ParagraphWrapper can deal with stray closing pre tags
22806 !!options
22807 parsoid=wt2html
22808 !! wikitext
22809 plain text</pre>
22810 !! html
22811 plain text
22812 !!end
22813
22814 !!test
22815 1. Ensure fostered text content is wrapped in element nodes
22816 !!options
22817 parsoid=wt2html
22818 !! wikitext
22819 <table>hi</table><table>ho</table>
22820 !! html
22821 <p>hi</p>
22822 <table></table>
22823 <p>ho</p>
22824 <table></table>
22825 !!end
22826
22827 !!test
22828 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
22829 !!options
22830 parsoid=wt2html,wt2wt
22831 !! wikitext
22832 <table>
22833 <tr> || ||
22834 <td> a
22835 </table>
22836 !! html
22837 <p> || ||
22838 </p><table>
22839 <tbody><tr><td> a</td></tr>
22840 </tbody></table>
22841 !!end
22842
22843 !!test
22844 Encapsulation properly handles null DSR information from foster box
22845 !!options
22846 parsoid=wt2html,wt2wt
22847 !! wikitext
22848 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
22849 !! html
22850 <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>
22851 !!end
22852
22853 !!test
22854 1. Encapsulate foster-parented transclusion content
22855 !!options
22856 parsoid=wt2wt,wt2html
22857 !! wikitext
22858 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
22859 !! html
22860 <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>
22861 <tbody>
22862 <tr>
22863 <td>bar</td>
22864 </tr>
22865 </tbody>
22866 </table>
22867 !!end
22868
22869 !!test
22870 2. Encapsulate foster-parented transclusion content
22871 !!options
22872 parsoid=wt2wt,wt2html
22873 !! wikitext
22874 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
22875 !! html
22876 <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>
22877 <table>
22878 <tbody>
22879 <tr>
22880 <td>bar</td>
22881 </tr>
22882 </tbody>
22883 </table>
22884 !!end
22885
22886 !!test
22887 3. Encapsulate foster-parented transclusion content
22888 !!options
22889 parsoid=wt2wt,wt2html
22890 !! wikitext
22891 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22892 !! html
22893 <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;]}">
22894 <p>foo</p>
22895 </div>
22896 <table>
22897 <tbody>
22898 <tr>
22899 <td>bar</td>
22900 </tr>
22901 </tbody>
22902 </table>
22903 !!end
22904
22905 !!test
22906 4. Encapsulate foster-parented transclusion content
22907 !!options
22908 parsoid=wt2wt,wt2html
22909 !! wikitext
22910 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22911 !! html
22912 <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;]}">
22913 <p>foo</p>
22914 </div>
22915 <table>
22916 <tbody>
22917 <tr>
22918 <td>bar</td>
22919 </tr>
22920 </tbody>
22921 </table>
22922 !!end
22923
22924 !!test
22925 5. Encapsulate foster-parented transclusion content
22926 !!options
22927 parsoid=wt2wt,wt2html
22928 !! wikitext
22929 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
22930 !! html
22931 <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>
22932 <table>
22933 <tbody>
22934 <tr>
22935 <td>
22936 <div>
22937 <p>foo</p>
22938 </div>
22939 </td>
22940 </tr>
22941 </tbody>
22942 </table>
22943 !!end
22944
22945 !!test
22946 6. Encapsulate foster-parented transclusion content
22947 !!options
22948 parsoid=wt2wt,wt2html
22949 !! wikitext
22950 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
22951 !! html
22952 <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>
22953 <table>
22954 <tbody>
22955 <tr>
22956 <td>
22957 <div>
22958 <p>foo</p>
22959 </div>
22960 </td>
22961 </tr>
22962 </tbody>
22963 </table>
22964 <p>ok</p>
22965 !!end
22966
22967 !!test
22968 7. Encapsulate foster-parented transclusion content
22969 !!options
22970 parsoid=wt2wt,wt2html
22971 !! wikitext
22972 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
22973 !! html
22974 <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>
22975 <table>
22976 <tbody>
22977 <tr>
22978 <td>bar</td>
22979 </tr>
22980 </tbody>
22981 </table>
22982 !!end
22983
22984 !!test
22985 8. Encapsulate foster-parented transclusion content
22986 !!options
22987 parsoid=wt2wt,wt2html
22988 !! wikitext
22989 {{echo|a
22990 }}{|{{echo|style='color:red'}}
22991 |-
22992 |b
22993 |}
22994 !! html
22995 <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>
22996 <tbody>
22997 <tr>
22998 <td>b</td>
22999 </tr>
23000 </tbody>
23001 </table>
23002 !!end
23003
23004 !!test
23005 9. Encapsulate foster-parented transclusion content
23006 !!options
23007 parsoid=wt2wt,wt2html
23008 !! wikitext
23009 <table>{{echo|hi</table>hello}}
23010 !! html
23011 <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>
23012 !!end
23013
23014 !!test
23015 Table in fosterable position
23016 !!options
23017 parsoid=wt2html,wt2wt
23018 !! wikitext
23019 {{OpenTable}}
23020 <div>
23021 {|
23022 |}
23023 </div>
23024 |}
23025 !! html
23026 <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">
23027 </span>
23028 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
23029
23030 <table>
23031 </table>
23032 !!end
23033
23034 # Parsoid only for bug 64747
23035 !! test
23036 Properly encapsulate empty-content transclusions in fosterable positions
23037 !! wikitext
23038 <table>
23039 {{#if:|
23040 <td>foo</td>
23041 }}
23042 </table>
23043 !! html/parsoid
23044 <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":["","","",""]}]]}'>
23045
23046 </table>
23047 !! end
23048
23049 !!test
23050 Support <object> element with .data attribute
23051 !!options
23052 parsoid=html2wt
23053 !! html
23054 <object data="test.swf"></object>
23055 !! wikitext
23056 <object data="test.swf"></object>
23057 !!end
23058
23059 !! test
23060 Don't block XML namespace declaration
23061 !! wikitext
23062 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
23063 !! html/php
23064 <p><span>MediaWiki</span>
23065 </p>
23066 !! html/parsoid
23067 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
23068 !! end
23069
23070 # -----------------------------------------------------------------
23071 # The following section of tests are primarily to spec requirements
23072 # around serialization of new/edited content.
23073 #
23074 # All these tests are marked Parsoid html2wt and html2html only
23075 # ----------------------------------------------------------------
23076
23077 # 'mi' is a localinterwiki prefix as well as a language
23078 !! test
23079 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
23080 !! options
23081 parsoid=html2wt
23082 !! html
23083 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
23084 !! wikitext
23085 [[Foo]]
23086 !! end
23087
23088 # See T93839
23089 !! test
23090 New wikilinks should be serialized properly
23091 !! options
23092 parsoid=html2wt
23093 !! html
23094 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
23095 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
23096 !! wikitext
23097 [[Foo]]
23098 [[Foo]]
23099 !! end
23100
23101 !! test
23102 New wiki links (href variations)
23103 !! options
23104 parsoid=html2wt
23105 !! html
23106 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23107 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
23108 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
23109 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
23110 !! wikitext
23111 [[Foo_bar]]
23112 [[Foo_bar]]
23113 [[Foo_bar]]
23114 [[Toxine bactérienne]]
23115 !! end
23116
23117 !! test
23118 New wiki links (content string variations)
23119 !! options
23120 parsoid=html2wt
23121 !! html
23122 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23123 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
23124 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
23125 !! wikitext
23126 [[Foo_bar]]
23127 [[Foo bar]]
23128 [[Foo_bar|./Foo_bar]]
23129 !! end
23130
23131 !! test
23132 New category links (href variations)
23133 !! options
23134 parsoid=html2wt
23135 !! html
23136 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
23137 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
23138 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
23139 !! wikitext
23140 [[Category:Toxine bactérienne]]
23141 [[Category:Toxine bactérienne]]
23142 [[Category:Toxine bactérienne]]
23143 !! end
23144
23145 !! test
23146 New sol transparent links don't need indent-pre nowiki protection
23147 !! options
23148 parsoid=html2wt
23149 language=de
23150 !! html
23151 <link rel="mw:PageProp/redirect" href="./Main_Page">
23152 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
23153 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
23154 !! wikitext
23155 #WEITERLEITUNG [[Main Page]]
23156 <!-- this is good --> [[Category:Good]]
23157 <!-- this is great --> [[Kategorie:Great]]
23158 !! end
23159
23160 !! test
23161 New interlanguage links (href variations)
23162 !! options
23163 parsoid=html2wt
23164 !! html
23165 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
23166 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
23167 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
23168 !! wikitext
23169 [[es:Toxine bactérienne]]
23170 [[es:Toxine_bactérienne]]
23171 [[es:Toxine_bactérienne]]
23172 !! end
23173
23174 !! test
23175 Image: Modifying size of an image (1)
23176 !! options
23177 parsoid={
23178 "modes": ["wt2wt"],
23179 "changes": [
23180 ["img[height]", "attr", "height", "22"],
23181 ["img[width]", "attr", "width", "200"]
23182 ]
23183 }
23184 !! wikitext
23185 [[Image:Foobar.jpg|230x230px]]
23186 !! wikitext/edited
23187 [[Image:Foobar.jpg|200x200px]]
23188 !!end
23189
23190 !! test
23191 Image: Modifying size of an image (2)
23192 !! options
23193 parsoid={
23194 "modes": ["wt2wt"],
23195 "changes": [
23196 ["img[height]", "attr", "height", "100"],
23197 ["img[width]", "attr", "width", "500"]
23198 ]
23199 }
23200 !! wikitext
23201 [[Image:Foobar.jpg|230x230px]]
23202 !! wikitext/edited
23203 [[Image:Foobar.jpg|500x500px]]
23204 !!end
23205
23206 # Change in size is ignored so long as class='mw-default-size'
23207 !! test
23208 Image: Modifying size of an image (3)
23209 !! options
23210 parsoid={
23211 "modes": ["wt2wt"],
23212 "changes": [
23213 ["figure[class]", "removeClass", "mw-default-size"],
23214 ["figure img", "attr", "height", "19"],
23215 ["figure img", "attr", "width", "170"]
23216 ]
23217 }
23218 !! wikitext
23219 [[Image:Foobar.jpg|thumb]]
23220 !! wikitext/edited
23221 [[Image:Foobar.jpg|thumb|170x170px]]
23222 !!end
23223
23224 !! test
23225 Image: Modifying alignment of an image (bug 48665)
23226 !! options
23227 parsoid={
23228 "modes": ["wt2wt"],
23229 "changes": [
23230 ["figure[class]", "removeClass", "mw-halign-right"],
23231 ["figure[class]", "addClass", "mw-halign-left"]
23232 ]
23233 }
23234 !! wikitext
23235 [[Image:Foobar.jpg|thumb|caption|right]]
23236 !! wikitext/edited
23237 [[Image:Foobar.jpg|thumb|caption|left]]
23238 !! end
23239
23240 !! test
23241 Image: Modifying mw-default-size of an frameless image (bug 62805)
23242 !! options
23243 parsoid={
23244 "modes": ["wt2wt"],
23245 "changes": [
23246 ["figure.mw-default-size", "removeClass", "mw-default-size"]
23247 ]
23248 }
23249 !! wikitext
23250 [[Image:Foobar.jpg|frameless|right]]
23251 !! wikitext/edited
23252 [[Image:Foobar.jpg|frameless|right|220x220px]]
23253 !! end
23254
23255 !! test
23256 Image: Modifying valign of an image (bug 49221)
23257 !! options
23258 parsoid={
23259 "modes": ["wt2wt"],
23260 "changes": [
23261 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
23262 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
23263 ]
23264 }
23265 !! wikitext
23266 [[File:Foobar.jpg|20px|middle]]
23267 !! wikitext/edited
23268 [[File:Foobar.jpg|20px|text-top]]
23269 !! end
23270
23271 !! test
23272 Image: Modifying alt attribute of an image (bug 56400)
23273 !! options
23274 parsoid={
23275 "modes": ["wt2wt"],
23276 "changes": [
23277 ["img[alt]", "attr", "alt", "some alternate edited text"]
23278 ]
23279 }
23280 !! wikitext
23281 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
23282 !! wikitext/edited
23283 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
23284 !!end
23285
23286 !! test
23287 Image: Modifying caption of an image
23288 !! options
23289 parsoid={
23290 "modes": ["wt2wt"],
23291 "changes": [
23292 ["figcaption", "text", "new caption"]
23293 ]
23294 }
23295 !! wikitext
23296 [[Image:Foobar.jpg|thumb|original caption]]
23297 !! wikitext/edited
23298 [[Image:Foobar.jpg|thumb|new caption]]
23299 !!end
23300
23301 !! test
23302 Image: empty alt attribute (bug 48924)
23303 !! options
23304 parsoid
23305 !! wikitext
23306 [[File:Foobar.jpg|thumb|alt=|bar]]
23307 !! html
23308 <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>
23309 !! end
23310
23311 #!! test
23312 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
23313 #!! options
23314 #parsoid=html2wt
23315 #language=ar
23316 #!! html
23317 #<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>
23318 #!! wikitext
23319 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
23320 #!! end
23321
23322 !! test
23323 Image: Block level image should have \n before and after
23324 !! wikitext
23325 123
23326 [[File:Foobar.jpg|right|thumb|150x150px]]
23327 456
23328 !! html/parsoid
23329 <p>123</p>
23330 <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>
23331 <p>456</p>
23332 !!end
23333
23334 !! test
23335 Image: New block level image should have \n before and after (existing content)
23336 !! wikitext
23337 123
23338 [[File:Foobar.jpg|right|thumb|150x150px]]
23339 456
23340 !! html/parsoid
23341 <p>123</p>
23342 <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>
23343 <p>456</p>
23344 !!end
23345
23346 !! test
23347 Image: upright option (parsoid)
23348 !! options
23349 parsoid
23350 !! wikitext
23351 [[File:Foobar.jpg|thumb|upright|caption]]
23352 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
23353 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
23354 !! html
23355 <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>
23356 <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>
23357 <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>
23358 !!end
23359
23360 !! test
23361 Image: upright option is ignored on inline and frame images (parsoid)
23362 !! options
23363 parsoid
23364 !! wikitext
23365 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
23366 !! html
23367 <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>
23368 !!end
23369
23370 !! test
23371 Image: from basic HTML (1)
23372 !! options
23373 parsoid=html2wt
23374 !! html/parsoid
23375 <span typeof="mw:Image">
23376 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
23377 </span>
23378 !! wikitext
23379 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
23380 !! end
23381
23382 !! test
23383 Image: from basic HTML (2)
23384 !! options
23385 parsoid=html2wt
23386 !! html/parsoid
23387 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
23388 !! wikitext
23389 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
23390 !! end
23391
23392 !! test
23393 Image: from basic HTML (3)
23394 !! options
23395 parsoid=html2wt
23396 !! html/parsoid
23397 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
23398 !! wikitext
23399 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
23400 !! end
23401
23402 !! test
23403 Image: from basic HTML (4)
23404 !! options
23405 parsoid=html2wt
23406 !! html/parsoid
23407 <img src="./File:Foobar.jpg">
23408 !! wikitext
23409 [[File:Foobar.jpg|link=]]
23410 !! end
23411
23412 !! test
23413 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
23414 !! options
23415 parsoid=html2wt
23416 !! html
23417 <ul>
23418 <li><p>foo</p></li>
23419 </ul>
23420 !! wikitext
23421 * foo
23422 !! end
23423
23424 !! test
23425 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
23426 !! options
23427 parsoid=html2wt
23428 !! html
23429 <ul> <li>foo</li></ul>
23430 !! wikitext
23431 * foo
23432 !! end
23433
23434 !! test
23435 Don't strip leading whitespace when handling indent-pre suppressing tags
23436 !! options
23437 parsoid=html2wt
23438 !! html
23439 <table>
23440 <tr><td> indented row</td></tr>
23441 </table>
23442 <blockquote><p>
23443 <b>This is very bold of you!</b>
23444 </p>
23445 <table><tr><td>
23446 indented cell (no pre-wrapping!)
23447 </td></tr></table>
23448 </blockquote>
23449 <p>foo</p>
23450 <div>bar</div>
23451 !! wikitext
23452 {|
23453 | indented row
23454 |}
23455 <blockquote>
23456 '''This is very bold of you!'''
23457
23458 {|
23459 |
23460 indented cell (no pre-wrapping!)
23461 |}
23462 </blockquote>
23463 foo
23464 <div>bar</div>
23465 !! end
23466
23467 !! test
23468 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
23469 !! options
23470 parsoid=html2wt
23471 !! wikitext
23472 foo
23473 <nowiki> </nowiki><span>bar</span>
23474
23475 <span>foo2
23476 <nowiki> </nowiki></span>bar2
23477
23478 <div>foo</div>
23479 <nowiki> </nowiki><span>bar</span>
23480
23481 <div>
23482 <nowiki> </nowiki><span>foo</span>
23483 </div>
23484 !! html
23485 <p>foo</p>
23486 <span>bar</span>
23487
23488 <span>foo2
23489 </span>bar2
23490
23491 <div>foo</div>
23492 <span>bar</span>
23493
23494 <div>
23495 <span>foo</span>
23496 </div>
23497 !! end
23498
23499 !! test
23500 Lists: Add space after bullets
23501 !! options
23502 parsoid=html2wt
23503 !! html
23504 <ul>
23505 <li>foo</li>
23506 <li> bar</li>
23507 <li><span> baz</span></li>
23508 </ul>
23509 !! wikitext
23510 * foo
23511 * bar
23512 * <span> baz</span>
23513 !! end
23514
23515 !! test
23516 Lists: Dont insert newlines in a serialized list item.
23517 !! options
23518 parsoid=html2wt
23519 !! html
23520 <ul><li>a<br>b</li><li>c</li></ul>
23521 !! wikitext
23522 * a<br>b
23523 * c
23524 !! end
23525
23526 !! test
23527 Headings: Add space before/after == (Bug 51744)
23528 !! options
23529 parsoid=html2wt
23530 !! html
23531 <h2>foo</h2>
23532 <h2> bar</h2>
23533 <h2>baz </h2>
23534 <h2><span> baz</span></h2>
23535 !! wikitext
23536 == foo ==
23537
23538 == bar ==
23539
23540 == baz ==
23541
23542 == <span> baz</span> ==
23543 !! end
23544
23545 !! test
23546 Headings: Force metas to serialize before/after
23547 !! options
23548 parsoid=html2wt
23549 !! html
23550 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
23551 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
23552
23553 <h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
23554 !! wikitext
23555 == hello there ==
23556 [[Category:A1]]
23557
23558 [[Category:A2]]
23559 == hi pal ==
23560
23561 <!--foo--> [[Category:A3]]
23562 == how goes it ==
23563 !! end
23564
23565 !! test
23566 Parsoid: Serialize positional parameters with = in them as named parameter
23567 !! options
23568 parsoid=html2wt
23569 !! html
23570 <p about="#mwt1" typeof="mw:Transclusion"
23571 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
23572
23573 <p about="#mwt1" typeof="mw:Transclusion"
23574 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
23575
23576 <!--Orig params with data-parsoid has heuristics for handling = chars-->
23577 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
23578 <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>
23579 !! wikitext
23580 {{echo|1 = f=oo}}
23581
23582 {{echo|1 = f=oo|2 = bar}}
23583
23584 <!--Orig params with data-parsoid has heuristics for handling = chars-->
23585 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
23586 {{echo|<nowiki>f=oo</nowiki>|bar}}
23587 !! end
23588
23589 !! test
23590 Parsoid: Serialize positional parameters with = in extlink as named parameter
23591 !! options
23592 parsoid=html2wt
23593 !! html
23594 <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>
23595 !! wikitext
23596 {{echo|1 = http://stuff?is=ok}}
23597 !! end
23598
23599 !! test
23600 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
23601 !! options
23602 parsoid=html2wt
23603 !! html
23604 <div>a<p>b</p></div>
23605 <div>a
23606 <p>b</p></div>
23607 <div>
23608 a
23609 <p>b</p></div>
23610 !! wikitext
23611 <div>a
23612 b
23613 </div>
23614 <div>a
23615 b
23616 </div>
23617 <div>
23618 a
23619
23620 b
23621 </div>
23622 !! end
23623
23624 !! test
23625 Substrings resembling wikitext in hrefs should not get nowiki escapes
23626 !! options
23627 parsoid=html2wt
23628 !! html
23629 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
23630 !! wikitext
23631 [[Foo''bar''baz]]
23632 !! end
23633
23634 !! test
23635 Enforce single-line context in the serializer
23636 !! options
23637 parsoid=html2wt
23638 !! html
23639 <h2>testing
23640 123</h2>
23641
23642 <ul><li>asd
23643 sdf</li></ul>
23644 !! wikitext
23645 == testing 123 ==
23646
23647 * asd sdf
23648 !! end
23649
23650 #-----------------------------
23651 # I/B quote minimization tests
23652 #-----------------------------
23653
23654 !! test
23655 1. I/B quote minimization: wikitext-only tags should be combined
23656 !! options
23657 parsoid=html2wt
23658 !! html
23659 <p><i>A</i><i>B</i></p>
23660 <p><b>A</b><b>B</b></p>
23661 <p><i>A</i><b><i>B</i></b></p>
23662 <p><b>A</b><i><b>B</b></i></p>
23663 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
23664 <p><i><b>A</b></i><i><b>B</b></i></p>
23665 <p><i><b>A</b></i><b><i>B</i></b></p>
23666 <p><b><i>A</i></b><i><b>B</b></i></p>
23667 !! wikitext
23668 ''AB''
23669
23670 '''AB'''
23671
23672 ''A'''B'''''
23673
23674 '''A''B'''''
23675
23676 '''A''BC''D'''
23677
23678 '''''AB'''''
23679
23680 '''''AB'''''
23681
23682 '''''AB'''''
23683 !! end
23684
23685 !! test
23686 2. I/B quote minimization: wikitext and html tags should not be combined
23687 !! options
23688 parsoid=html2wt
23689 !! html
23690 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
23691 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
23692 !! wikitext
23693 ''A''<i>B</i>
23694
23695 ''A''<nowiki/>'''<i>B</i>'''
23696 !! end
23697
23698 !! test
23699 3. I/B quote minimization: templated content stops minimization
23700 !! options
23701 parsoid=html2wt
23702 !! html
23703 <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>
23704 <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>
23705 !! wikitext
23706 ''A''{{echo|''B''}}
23707
23708 ''A''{{echo|'''''B'''''}}
23709 !! end
23710
23711 !! test
23712 4. I/B quote minimization: new content should be mimimized with adjacent old content
23713 !! options
23714 parsoid=html2wt
23715 !! html
23716 <p><i>A</i><i>B</i></p>
23717 <p><b>A</b><b>B</b></p>
23718 <p><i>A</i><b><i>B</i></b></p>
23719 !! wikitext
23720 ''AB''
23721
23722 '''AB'''
23723
23724 ''A'''B'''''
23725 !! end
23726
23727 !! test
23728 5a. Merge adjacent quote nodes if they've been edited
23729 !! options
23730 parsoid={
23731 "modes": ["wt2wt", "selser"],
23732 "changes": [
23733 ["p", "contents", "remove", ":contains('b')"]
23734 ]
23735 }
23736 !! wikitext
23737 ''a''b''c''
23738 !! wikitext/edited
23739 ''ac''
23740 !! end
23741
23742 !! test
23743 5b. Merge adjacent quote nodes if they've been edited
23744 !! options
23745 parsoid={
23746 "modes": ["wt2wt", "selser"],
23747 "changes": [
23748 ["#x", "remove"]
23749 ]
23750 }
23751 !! wikitext
23752 ''a''<span id="x">b</span>''c''
23753 !! wikitext/edited
23754 ''ac''
23755 !! end
23756
23757 #------------------------------------
23758 # End of I/B quote minimization tests
23759 #------------------------------------
23760
23761 !!test
23762 Bug 54262: New entities
23763 !! options
23764 parsoid=html2wt
23765 !! wikitext
23766 &nbsp;
23767 !! html
23768 <span typeof="mw:Entity">&nbsp;</span>
23769 !! end
23770
23771 ## Note that there is no wikitext output for 'unknownproperty' ##
23772 ## Unknown magic words are silently dropped ##
23773
23774 !! test
23775 Magic words
23776 !! options
23777 parsoid=html2wt
23778 !! html
23779 <meta property='mw:PageProp/toc' />
23780 <meta property='mw:PageProp/notoc' />
23781 <meta property='mw:PageProp/forcetoc' />
23782 <meta property='mw:PageProp/index' />
23783 <meta property='mw:PageProp/noindex' />
23784 <meta property='mw:PageProp/nogallery' />
23785 <meta property='mw:PageProp/noeditsection' />
23786 <meta property='mw:PageProp/notitleconvert' />
23787 <meta property='mw:PageProp/nocontentconvert' />
23788 <meta property='mw:PageProp/unknownproperty' />
23789 !! wikitext
23790 __TOC__
23791 __NOTOC__
23792 __FORCETOC__
23793 __INDEX__
23794 __NOINDEX__
23795 __NOGALLERY__
23796 __NOEDITSECTION__
23797 __NOTITLECONVERT__
23798 __NOCONTENTCONVERT__
23799 !! end
23800
23801 !! test
23802 Consecutive <pre>s should not get merged
23803 !! options
23804 parsoid=html2wt,html2html
23805 !! html
23806 <pre>a</pre><pre>b</pre>
23807
23808 <pre>c
23809 </pre><pre>
23810 d</pre>
23811
23812 <pre>e
23813
23814 </pre><pre>
23815
23816 f</pre>
23817 !! wikitext
23818 a
23819
23820 b
23821
23822 c
23823
23824 d
23825
23826 e
23827
23828
23829
23830 f
23831 !! end
23832
23833 !! test
23834 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
23835 !! options
23836 parsoid=html2wt
23837 !! html
23838 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
23839 !! wikitext
23840 [[Special:BookSources/1234567890|ISBN 1234567895]]
23841 !! end
23842
23843 !! test
23844 Edited RFC links not serializable as RFC links should serialize as extlinks
23845 !! options
23846 parsoid=html2wt
23847 !! html
23848 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
23849 !! wikitext
23850 [//tools.ietf.org/html/rfc123 New RFC]
23851 !! end
23852
23853 !! test
23854 Edited PMID links not serializable as PMID links should serialize as extlinks
23855 !! options
23856 parsoid=html2wt
23857 !! html
23858 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
23859 !! wikitext
23860 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
23861 !! end
23862
23863 !! test
23864 WTS of autolinks with trailing/surrounding context
23865 !! options
23866 parsoid=html2wt
23867 !! html/parsoid
23868 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
23869 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
23870 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
23871 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
23872 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
23873 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
23874 !! wikitext
23875 http://cscott.net<nowiki/>'''foo'''
23876
23877 http://cscott.net<b>foo</b>
23878
23879 '''http://cscott.net<nowiki/>'''
23880
23881 '''http://cscott.net '''
23882
23883 '''http://cscott.net<nowiki/>x'''
23884
23885 http://cscott.net<nowiki/>x
23886 !! end
23887
23888 !! test
23889 WTS of autolinks with nowikis (round-trip)
23890 !! wikitext
23891 x<nowiki/>http://cscott.net<nowiki/>x
23892 !! html/parsoid
23893 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
23894 !! end
23895
23896 # this is the "easy" test because it leaves in place all the
23897 # data-parsoid information indicating this is an autolink
23898 !! test
23899 WTS of autolinks with escapes (editing)
23900 !! options
23901 parsoid={
23902 "modes": ["wt2wt"],
23903 "changes": [
23904 [ "meta", "remove" ]
23905 ]
23906 }
23907 !! wikitext
23908 x<nowiki/>http://cscott.net<nowiki/>x
23909 !! wikitext/edited
23910 x<nowiki/>http://cscott.net<nowiki/>x
23911 !! end
23912
23913 !! test
23914 Edited Redirect link should emit a non-piped wikitext link
23915 !! options
23916 parsoid=html2wt
23917 !! html
23918 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
23919 !! wikitext
23920 #REDIRECT [[Bar]]
23921 !! end
23922
23923 !! test
23924 T75121: Infer extension name from typeOf if data-mw is not present
23925 !! options
23926 parsoid=html2wt
23927 !! html
23928 <div typeOf="mw:Extension/foo"></div>
23929 !! wikitext
23930 <foo />
23931 !! end
23932
23933 # Note that the <p> wrapping isn't present in PHP parser output
23934 # The important thing for this test is that P-wrapping doesn't
23935 # interfere with the <nowiki> protection for leading - in <td>
23936 # (which isn't necessary for <th>).
23937 !! test
23938 T88318: p-wrapped dash in table.
23939 !! options
23940 parsoid=html2wt,wt2wt
23941 !! html/parsoid
23942 <table><tbody>
23943 <tr><th><p>-</p></th><th><p>- </p></th></tr>
23944 <tr><td><p>-</p></td><td><p>- </p></td></tr>
23945 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
23946 </tbody></table>
23947 !! wikitext
23948 {|
23949 !-
23950 !-
23951 |-
23952 |<nowiki>-</nowiki>
23953 |<nowiki>- </nowiki>
23954 |-
23955 |<small>-</small>
23956 |<br>
23957 -
23958 |<br>
23959 -
23960 |}
23961 !! html/php+tidy
23962 <table>
23963 <tr>
23964 <th>-</th>
23965 <th>-</th>
23966 </tr>
23967 <tr>
23968 <td>-</td>
23969 <td>-</td>
23970 </tr>
23971 <tr>
23972 <td><small>-</small></td>
23973 <td><br />
23974 <p>-</p>
23975 </td>
23976 <td><br />
23977 <p>-</p>
23978 </td>
23979 </tr>
23980 </table>
23981 !! end
23982
23983 !! test
23984 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
23985 !! options
23986 parsoid=html2wt
23987 !! html
23988 <table id='mwAb'>
23989 <td id='mwAc'>foo</td>
23990 <td id='serialize-this'>bar</td>
23991 </table>
23992 !! wikitext
23993 {|
23994 |foo
23995 | id="serialize-this" |bar
23996 |}
23997 !! end
23998
23999 !! test
24000 Parsoid-like element ids should not be serialized to wikitext unless shadowed
24001 !! options
24002 parsoid=html2wt
24003 !! html
24004 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
24005 !! wikitext
24006 <div id="hello">ok</div>
24007 !! end
24008
24009 !! test
24010 WTS change modes
24011 !! options
24012 parsoid={
24013 "modes": ["wt2wt"],
24014 "changes": [
24015 [ "#xyz", "before", "<b>before</b> stuff " ],
24016 [ "#xyz", "after", " stuff <i>after</i>" ],
24017 [ "#xyz", "html", "x <b>y</b> z" ]
24018 ]
24019 }
24020 !! wikitext
24021 <span id="xyz">hello</span>
24022 !! wikitext/edited
24023 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
24024 !! end
24025
24026 !! test
24027 Never serialize a-tag as html, regardless of what data-parsoid has to say
24028 !! options
24029 parsoid=html2wt
24030 !! html
24031 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
24032 !! wikitext
24033 [[Foo]]
24034 !! end
24035
24036 # -----------------------------------------------------------------
24037 # End of section for Parsoid-only html2wt tests for serialization
24038 # of new content
24039 # -----------------------------------------------------------------
24040
24041 # -----------------------------------------------------------------
24042 # The following section of tests are primarily to spec behavior of
24043 # the selective serializer. All these tests have manual selser
24044 # changes. The automated selser changes for all tests handle the
24045 # wide variation of changes, but these tests here capture specs
24046 # deterministically.
24047 # ----------------------------------------------------------------
24048
24049 ## T90517
24050 !! test
24051 1. Selser: New comments should not be lost
24052 !! options
24053 parsoid={
24054 "modes": ["selser"],
24055 "changes": [
24056 [ "#a", "after", "<!--c1-->" ],
24057 [ "#b", "before", "<!--c2-->" ]
24058 ]
24059 }
24060 !! wikitext
24061 <span id="a">a</span>
24062
24063 <span id="b">b</span>
24064 !! wikitext/edited
24065 <span id="a">a</span><!--c1-->
24066
24067 <!--c2--><span id="b">b</span>
24068 !! end
24069
24070 ## T89383
24071 !! test
24072 2. Selser: Check for validity of DSR before using it
24073 !! options
24074 parsoid={
24075 "modes": ["selser"],
24076 "changes": [
24077 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
24078 ]
24079 }
24080 !! wikitext
24081 <span id="a">a</span>
24082 !! wikitext/edited
24083 {{DISPLAYTITLE:foo}}
24084 <span id="a">a</span>
24085 !! end
24086
24087
24088 TODO:
24089 more images
24090 more tables
24091 character entities
24092 and much more
24093 Try for 100% code coverage